🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
fix(cli): pre-load lazy commands so short flags scope correctly (#1791.2) (#1803)
rUv7ebdaf580b30
diff --git a/v3/@claude-flow/cli/src/index.ts b/v3/@claude-flow/cli/src/index.tsindex ea10d02cfe..5678a6b027 100644--- a/v3/@claude-flow/cli/src/index.ts+++ b/v3/@claude-flow/cli/src/index.ts@@ -83,6 +83,22 @@ export class CLI {*/async run(args: string[] = process.argv.slice(2)): Promise<void> {try {+ // #1791.2 — If the user invoked a lazy command (e.g. `hive-mind task`),+ // pre-load it BEFORE parsing so the parser can build scoped flag+ // aliases for its subcommands. Without this, short flags defined on+ // the lazy command's subcommand options (`-d` for description, etc.)+ // never get into the alias map and silently fall through to global+ // resolution — the user sees `[ERROR] Task description is required`+ // even though they passed `-d "smoke"`.+ for (const arg of args) {+ if (arg.startsWith('-')) continue;+ if (this.parser.isLazyOnly(arg)) {+ const cmd = await getCommandAsync(arg);+ if (cmd) this.parser.registerCommand(cmd);+ }+ break; // only the first non-flag positional is the command name+ }+// Parse argumentsconst parseResult = this.parser.parse(args);const { command: commandPath, flags, positional } = parseResult;diff --git a/v3/@claude-flow/cli/src/parser.ts b/v3/@claude-flow/cli/src/parser.tsindex 61f5c6c7f7..6eea07b2a1 100644--- a/v3/@claude-flow/cli/src/parser.ts+++ b/v3/@claude-flow/cli/src/parser.ts@@ -119,6 +119,18 @@ export class CommandParser {this.lazyCommandNames.add(name);}+ /**+ * #1791.2 — true when `name` is a lazy command that hasn't been promoted+ * to a fully registered Command yet. The CLI uses this to eagerly load+ * the module before parsing so its subcommand flags (e.g. `-d` for+ * `hive-mind task --description`) are scoped into the alias map. Without+ * this, lazy commands' short flags silently fall through to global+ * resolution and the action handler sees an empty `flags.description`.+ */+ isLazyOnly(name: string): boolean {+ return this.lazyCommandNames.has(name) && !this.commands.has(name);+ }+private isKnownCommandName(name: string): boolean {return this.commands.has(name) || this.lazyCommandNames.has(name);}