























@@ -1,12 +1,13 @@
11import type { Command } from "commander";
2+import { resolveMessageSecretScope } from "../../../cli/message-secret-scope.js";
23import { messageCommand } from "../../../commands/message.js";
34import { danger, setVerbose } from "../../../globals.js";
45import { CHANNEL_TARGET_DESCRIPTION } from "../../../infra/outbound/channel-target.js";
56import { runGlobalGatewayStopSafely } from "../../../plugins/hook-runner-global.js";
67import { defaultRuntime } from "../../../runtime.js";
78import { runCommandWithRuntime } from "../../cli-utils.js";
89import { createDefaultDeps } from "../../deps.js";
9-import { ensurePluginRegistryLoaded } from "../../plugin-registry.js";
10+import { ensurePluginRegistryLoaded, type PluginRegistryScope } from "../../plugin-registry.js";
10111112export type MessageCliHelpers = {
1213withMessageBase: (command: Command) => Command;
@@ -31,6 +32,20 @@ async function runPluginStopHooks(): Promise<void> {
3132});
3233}
333435+function resolveMessagePluginLoadOptions(
36+opts: Record<string, unknown>,
37+): { scope: PluginRegistryScope; onlyPluginIds?: string[] } | undefined {
38+const scopedChannel = resolveMessageSecretScope({
39+channel: opts.channel,
40+target: opts.target,
41+targets: opts.targets,
42+}).channel;
43+if (scopedChannel) {
44+return { scope: "configured-channels", onlyPluginIds: [scopedChannel] };
45+}
46+return { scope: "configured-channels" };
47+}
48+3449export function createMessageCliHelpers(
3550message: Command,
3651messageChannelOptions: string,
@@ -50,7 +65,7 @@ export function createMessageCliHelpers(
50655166const runMessageAction = async (action: string, opts: Record<string, unknown>) => {
5267setVerbose(Boolean(opts.verbose));
53-ensurePluginRegistryLoaded();
68+ensurePluginRegistryLoaded(resolveMessagePluginLoadOptions(opts));
5469const deps = createDefaultDeps();
5570let failed = false;
5671await runCommandWithRuntime(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。