refactor(cli): restructure cmd-*.ts into commands/ subdirectories #98
Reference in New Issue
Block a user
Delete Branch "refactor/93-phase1-directory-restructure"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Phase 1 of RFC #93: reorganize flat
cmd-*.tsfiles intocommands/{workflow,thread,cas,init}/subdirectories that strictly mirror the CLI subcommand hierarchy.Why
15+
cmd-*.tsfiles were flat insrc/, making it impossible to tell which CLI group a file belonged to. Directory structure should reflect command structure.Changes
Directory mapping (strict 1:1 with CLI subcommands)
workflowcommands/workflow/threadcommands/thread/cascommands/cas/initcommands/init/File-level changes
cmd-*.ts->commands/with names matching subcommandscmd-cas.ts(4-in-1) ->cas/{get,put,list,rm}.ts;cmd-thread.ts->thread/{show,rm}.ts;cmd-init.ts->init/{workspace,template}.tscmd-help.ts->skill.ts(matches primary command name)index.tsre-exports per groupcli-dispatch.tsand 9 test filesNo logic changes
Pure structural refactor -- all 242 tests pass, CLI output identical.
Ref
RFC #93, closes #94
Reorganize flat cmd-*.ts files into commands/{workflow,thread,cas,init}/ subdirectories that strictly mirror the CLI subcommand hierarchy: - workflow/: add, list, show, rm, history, rollback - thread/: run, list, show, rm, fork, ps, kill, live, pause, resume - cas/: get, put, list, rm, gc - init/: workspace, template Each group has an index.ts re-export. Split multi-command files (cmd-cas.ts, cmd-thread.ts, cmd-init.ts) into per-subcommand files. Rename cmd-help.ts → skill.ts to match the primary command name. Update all import paths in cli-dispatch.ts and test files. Pure structural change — no logic modifications. Ref: #93, closes #94Review: CLI 目录重构
目录结构重组做得很干净 — 文件名 = 子命令名,一目了然 👍
观察
PR 描述说是 Phase 1 纯结构重构,但实际包含了额外改动:
skill.ts系统(238 行)—cmd-help.ts→ 多 topic skill 系统(cli/develop/author),这是新功能cli-dispatch.ts重构 —dispatchGroup()泛化、--help/-h支持、printCliError→printCliLine行为变更workflow-role-*包删除并入 template(这不是已经在 #78 做了吗?)如果 #78 的 role 合并已经合了,这里应该不会重复。如果没合,建议拆开单独 PR。
结构部分 ✅
commands/四个子目录对应 CLI 分组,清晰建议
更新 PR 描述,反映实际 scope(不只是纯文件移动)。
LGTM ✅
—— 小墨 🖊️
更正:重新 review(正确 diff base)
之前的 review 用了错误的 diff base,包含了已合并的改动,导致误报。重新用 Gitea API diff 审查:
实际 scope:39 files, +384/-321,全在
packages/cli-workflow/内。结论
纯结构重构 ✅ — 无逻辑变更:
cmd-*.ts正确拆分移入commands/{workflow,thread,cas,init}/formatSkillDoc)正确删除之前提到的 "role 合并" 和 "新 skill 系统" 不在此 PR scope 内,是 diff base 错误的误报,抱歉。
LGTM ✅
—— 小墨 🖊️