Remove legacy CLI dual-dispatch and wire per-command yargs handlers#240
Remove legacy CLI dual-dispatch and wire per-command yargs handlers#240SorraTheOrc merged 3 commits intomainfrom
Conversation
…rom cli.yargs Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
|
@copilot Audit against Legacy CLI cutover and removal (TF-0MMJOJPE914LR5F6): I still see a gap against the acceptance criteria.\n\n now removes /, but every routed command still delegates execution to (lines 59-61, plus fallbacks at 191-194). That means command behavior still depends on the legacy parse/dispatch path in , rather than framework-owned handlers.\n\nThis appears to miss AC: "All user-facing commands are implemented in yargs and no longer depend on legacy parse/dispatch paths."\n\nSuggested follow-up: wire each yargs command/subcommand to dedicated handlers (or a yargs-native dispatcher) and leave as shared business-logic utilities only, not argv parsing/dispatch authority. |
|
@copilot Follow-up audit clarification for Legacy CLI cutover and removal (TF-0MMJOJPE914LR5F6): src/cli.yargs.ts removes the runLegacy/MIGRATED_COMMANDS gate, but all command handlers still call coreMain with the raw argv, so behavior is still owned by cli.core.ts parse/dispatch logic. This does not fully meet the acceptance criterion that all user-facing commands be implemented in yargs without depending on legacy parse/dispatch paths. Suggested closure path: move argv parsing/dispatch out of cli.core.ts into yargs handlers, and keep cli.core.ts as reusable business logic only. |
…eMain delegation Co-authored-by: SorraTheOrc <250240+SorraTheOrc@users.noreply.github.com>
Fixed in c812661.
|
This was already addressed in c812661. |
|
@copilot Re-audit update for Legacy CLI cutover and removal (TF-0MMJOJPE914LR5F6): the specific gap I flagged is now addressed. yargs is doing per-command/per-subcommand argument mapping and dispatch (no more blanket coreMain(raw argv) fallback for normal command execution). This closes my prior blocker on dual-dispatch behavior. |
Removes the
MIGRATED_COMMANDSgate and the sharedhandle → coreMaindelegation so that yargs is the true routing and dispatch authority, with no remaining dependency on the legacy argv parsing path.Changes
src/cli.core.tsparseArgs(was private)main()into a new exporteddispatchCommand(command, subcommand, flags, layers)function that accepts pre-parsed structured arguments — no argv re-parsing insidemain()is now a thin wrapper:parseArgs(argv)→dispatchCommand(...), retained for backwards compatibilitysrc/cli.yargs.tshandleclosure that calledcoreMain(raw)for all commandsasync (argv) => { ... }handlerbuildFlags()helper maps yargs-parsedargvproperties to theRecord<string, string|boolean>formatdispatchCommandexpects (numeric values stringified, boolean flags forwarded)dispatchCommanddirectly — yargs owns routing,dispatchCommandowns business logic and error outputstack,sequence,library,explore) useparseArgs(raw)as a targeted fallback to correctly surface unknown-subcommand errorssequence simulate --duration,sequence inspect --validate--version --jsonearly-return path to include the--jsonflagsrc/cli/commands/— new modulesAdded yargs command modules for the 7 previously missing commands:
analyze,classify,explore,library,sequence,stack,tui. Each exportscommand,desc, andbuilderfor routing and help text.src/cli/commands/— updated buildersUpdated
generate,list,play,show,versionbuilders withdescribestrings, examples, and--jsonoption declarations.Original prompt
This section details on the original issue you should resolve
<issue_title>Legacy CLI cutover and removal</issue_title>
<issue_description>
Summary: Complete migration by enforcing framework-only command routing, removing legacy parser/dispatcher code, and validating full parity gates.
User Story
As a maintainer, I can rely on a single CLI framework implementation without dual paths, reducing regression risk and maintenance overhead.
Expected UX Change
Acceptance Criteria
src/cli.tsparser/dispatcher and compatibility shims) are removed or reduced to non-behavioral compatibility exports only.Minimal Implementation
Dependencies
Deliverables
Comments on the Issue (you are @copilot in this section)
@SorraTheOrc \n\n**OpenCode**\n\nImplementation progress: switched canonical CLI entrypoint to framework ( now delegates to ), moved legacy parser/dispatcher into , simplified compatibility shim ( re-exports canonical entrypoint), added framework command ownership export in , and added cutover matrix/checklist docs at with README link. Validation: npm test passed (112 files, 2356 tests). Commit hash: not committed yet. @SorraTheOrc \n\n**OpenCode**\n\nImplementation progress: switched canonical CLI entrypoint to framework (src/cli.ts now delegates to yargsMain), moved legacy parser/dispatcher into src/cli.legacy.ts, simplified compatibility shim (src/compat/cli.ts re-exports canonical entrypoint), added framework command ownership export in src/cli.yargs.ts, and added cutover matrix/checklist docs at docs/cli-cutover-checklist.md with README link. Validation: npm test passed (112 files, 2356 tests). Commit hash: not committed yet. @SorraTheOrc \n\n**OpenCode**\n\nCommitted cutover changes in 734d2b7 with message: TF-0MMJOJPE914LR5F6: cut over canonical CLI to yargs. Files: src/cli.ts, src/cli.legacy.ts, src/cli.yargs.ts, src/cli.yargs.integration.test.ts, src/compat/cli.ts, docs/cli-cutover-checklist.md, README.md. Summary: canonical entrypoint now routes through yargs, legacy parser moved to dedicated legacy module, compatibility shim simplified, and cutover ownership matrix/checklist documented. Validation: npm test passed (112 files, 2356 tests). @SorraTheOrc \n\n**OpenCode**\n\nCommitted and pushed b824de2: TF-0MMJOJPE914LR5F6: remove legacy CLI shim and add yargs types. Files updated include CLI core rename (), yargs delegation updates (), canonical entrypoint update (), removal of compatibility shim (), test import updates to canonical CLI, docs updates (, ), and TypeScript yargs typings (, ). Validation: npm run typecheck and npm test both pass. @SorraTheOrc \n\n**OpenCode**\n\nCommitted and pushed b824de2: TF-0MMJOJPE914LR5F6: remove legacy CLI shim and add yargs types. Files updated include CLI core rename (src/cli.core.ts), yargs delegation updates (src/cli.yargs.ts), canonical entrypoint update (src/cli.ts), removal of compatibility shim (src/compat/cli.ts), test import updates to canonical CLI, docs updates (docs/cli-cutover-checklist.md, docs/cli-library-evaluation.md), and TypeScript yargs typings (package.json, package-lock.json). Validation: npm run typecheck and npm test both pass. @SorraTheOrc \n\n**Open...💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.