@aipper/aiws-spec 0.0.21 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/docs/spec-contract.md +5 -4
  2. package/package.json +1 -1
  3. package/templates/workspace/.agents/skills/{aiws-change-archive → p-aiws-change-archive}/SKILL.md +3 -2
  4. package/templates/workspace/.agents/skills/{aiws-change-finish → p-aiws-change-finish}/SKILL.md +2 -2
  5. package/templates/workspace/.agents/skills/{aiws-change-list → p-aiws-change-list}/SKILL.md +2 -2
  6. package/templates/workspace/.agents/skills/{aiws-change-new → p-aiws-change-new}/SKILL.md +2 -2
  7. package/templates/workspace/.agents/skills/{aiws-change-next → p-aiws-change-next}/SKILL.md +2 -2
  8. package/templates/workspace/.agents/skills/{aiws-change-start → p-aiws-change-start}/SKILL.md +2 -2
  9. package/templates/workspace/.agents/skills/{aiws-change-status → p-aiws-change-status}/SKILL.md +2 -2
  10. package/templates/workspace/.agents/skills/{aiws-change-sync → p-aiws-change-sync}/SKILL.md +2 -2
  11. package/templates/workspace/.agents/skills/{aiws-change-templates-init → p-aiws-change-templates-init}/SKILL.md +2 -2
  12. package/templates/workspace/.agents/skills/{aiws-change-templates-which → p-aiws-change-templates-which}/SKILL.md +2 -2
  13. package/templates/workspace/.agents/skills/{aiws-change-validate → p-aiws-change-validate}/SKILL.md +2 -2
  14. package/templates/workspace/.agents/skills/{aiws-hooks-install → p-aiws-hooks-install}/SKILL.md +2 -2
  15. package/templates/workspace/.agents/skills/{aiws-hooks-status → p-aiws-hooks-status}/SKILL.md +2 -2
  16. package/templates/workspace/.agents/skills/{aiws-init → p-aiws-init}/SKILL.md +2 -2
  17. package/templates/workspace/.agents/skills/{aiws-rollback → p-aiws-rollback}/SKILL.md +2 -2
  18. package/templates/workspace/.agents/skills/{aiws-update → p-aiws-update}/SKILL.md +2 -2
  19. package/templates/workspace/.agents/skills/{aiws-validate → p-aiws-validate}/SKILL.md +2 -2
  20. package/templates/workspace/.agents/skills/p-tasks-plan/SKILL.md +37 -0
  21. package/templates/workspace/.agents/skills/ws-bugfix/SKILL.md +30 -7
  22. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +23 -6
  23. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +61 -17
  24. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +102 -2
  25. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +96 -65
  26. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +31 -0
  27. package/templates/workspace/.agents/skills/ws-plan/SKILL.md +68 -1
  28. package/templates/workspace/.agents/skills/ws-push/SKILL.md +17 -12
  29. package/templates/workspace/.claude/commands/{aiws-change-archive.md → p-aiws-change-archive.md} +3 -1
  30. package/templates/workspace/.claude/commands/{aiws-change-finish.md → p-aiws-change-finish.md} +2 -0
  31. package/templates/workspace/.claude/commands/{aiws-change-list.md → p-aiws-change-list.md} +2 -0
  32. package/templates/workspace/.claude/commands/{aiws-change-new.md → p-aiws-change-new.md} +2 -0
  33. package/templates/workspace/.claude/commands/{aiws-change-next.md → p-aiws-change-next.md} +2 -0
  34. package/templates/workspace/.claude/commands/{aiws-change-start.md → p-aiws-change-start.md} +2 -0
  35. package/templates/workspace/.claude/commands/{aiws-change-status.md → p-aiws-change-status.md} +2 -0
  36. package/templates/workspace/.claude/commands/{aiws-change-sync.md → p-aiws-change-sync.md} +2 -0
  37. package/templates/workspace/.claude/commands/{aiws-change-templates-init.md → p-aiws-change-templates-init.md} +2 -0
  38. package/templates/workspace/.claude/commands/{aiws-change-templates-which.md → p-aiws-change-templates-which.md} +2 -0
  39. package/templates/workspace/.claude/commands/{aiws-change-validate.md → p-aiws-change-validate.md} +2 -0
  40. package/templates/workspace/.claude/commands/{aiws-hooks-install.md → p-aiws-hooks-install.md} +2 -0
  41. package/templates/workspace/.claude/commands/{aiws-hooks-status.md → p-aiws-hooks-status.md} +2 -0
  42. package/templates/workspace/.claude/commands/{aiws-init.md → p-aiws-init.md} +2 -1
  43. package/templates/workspace/.claude/commands/{aiws-rollback.md → p-aiws-rollback.md} +2 -1
  44. package/templates/workspace/.claude/commands/{aiws-update.md → p-aiws-update.md} +2 -1
  45. package/templates/workspace/.claude/commands/{aiws-validate.md → p-aiws-validate.md} +2 -1
  46. package/templates/workspace/.claude/commands/ws-bugfix.md +11 -6
  47. package/templates/workspace/.claude/commands/ws-commit.md +2 -1
  48. package/templates/workspace/.claude/commands/ws-deliver.md +6 -2
  49. package/templates/workspace/.claude/commands/ws-dev.md +7 -1
  50. package/templates/workspace/.claude/commands/ws-finish.md +19 -19
  51. package/templates/workspace/.claude/commands/ws-handoff.md +22 -0
  52. package/templates/workspace/.claude/commands/ws-plan.md +9 -5
  53. package/templates/workspace/.codex/prompts/ws-dev.md +5 -1
  54. package/templates/workspace/.githooks/commit-msg +109 -0
  55. package/templates/workspace/.iflow/commands/ws-commit.toml +2 -1
  56. package/templates/workspace/.iflow/commands/ws-deliver.toml +6 -2
  57. package/templates/workspace/.iflow/commands/ws-finish.toml +19 -19
  58. package/templates/workspace/.opencode/command/{aiws-change-archive.md → p-aiws-change-archive.md} +4 -2
  59. package/templates/workspace/.opencode/command/{aiws-change-finish.md → p-aiws-change-finish.md} +3 -1
  60. package/templates/workspace/.opencode/command/{aiws-change-list.md → p-aiws-change-list.md} +3 -1
  61. package/templates/workspace/.opencode/command/{aiws-change-new.md → p-aiws-change-new.md} +3 -1
  62. package/templates/workspace/.opencode/command/{aiws-change-next.md → p-aiws-change-next.md} +3 -1
  63. package/templates/workspace/.opencode/command/{aiws-change-start.md → p-aiws-change-start.md} +3 -1
  64. package/templates/workspace/.opencode/command/{aiws-change-status.md → p-aiws-change-status.md} +3 -1
  65. package/templates/workspace/.opencode/command/{aiws-change-sync.md → p-aiws-change-sync.md} +3 -1
  66. package/templates/workspace/.opencode/command/{aiws-change-templates-init.md → p-aiws-change-templates-init.md} +3 -1
  67. package/templates/workspace/.opencode/command/{aiws-change-templates-which.md → p-aiws-change-templates-which.md} +3 -1
  68. package/templates/workspace/.opencode/command/{aiws-change-validate.md → p-aiws-change-validate.md} +3 -1
  69. package/templates/workspace/.opencode/command/{aiws-hooks-install.md → p-aiws-hooks-install.md} +3 -1
  70. package/templates/workspace/.opencode/command/{aiws-hooks-status.md → p-aiws-hooks-status.md} +3 -1
  71. package/templates/workspace/.opencode/command/{aiws-init.md → p-aiws-init.md} +3 -1
  72. package/templates/workspace/.opencode/command/{aiws-rollback.md → p-aiws-rollback.md} +3 -1
  73. package/templates/workspace/.opencode/command/{aiws-update.md → p-aiws-update.md} +3 -1
  74. package/templates/workspace/.opencode/command/{aiws-validate.md → p-aiws-validate.md} +3 -1
  75. package/templates/workspace/.opencode/command/ws-bugfix.md +11 -6
  76. package/templates/workspace/.opencode/command/ws-commit.md +3 -2
  77. package/templates/workspace/.opencode/command/ws-deliver.md +6 -2
  78. package/templates/workspace/.opencode/command/ws-dev.md +7 -1
  79. package/templates/workspace/.opencode/command/ws-finish.md +19 -19
  80. package/templates/workspace/.opencode/command/ws-handoff.md +25 -0
  81. package/templates/workspace/.opencode/command/ws-plan.md +9 -5
  82. package/templates/workspace/.opencode/command/ws-review.md +1 -1
  83. package/templates/workspace/AGENTS.md +8 -4
  84. package/templates/workspace/AI_WORKSPACE.md +4 -4
  85. package/templates/workspace/changes/README.md +8 -2
  86. package/templates/workspace/manifest.json +173 -103
  87. package/templates/workspace/tools/ws_change_check.py +99 -0
  88. package/templates/workspace/tools/ws_resolve_sub_target.sh +47 -0
  89. package/templates/workspace/tools/ws_tasks_plan.py +137 -0
@@ -1,9 +1,11 @@
1
1
  ---
2
- description: 门禁:校验 required/托管块/漂移(可落盘 stamp)
2
+ description: 私有:门禁:校验 required/托管块/漂移(可落盘 stamp)
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:aiws-validate -->
5
5
  # aiws validate
6
6
 
7
+ (私有原子入口;日常优先用 ws-* 链路。)
8
+
7
9
  目标:
8
10
  - 作为 CI/本地门禁:校验 required 文件结构、托管块、`.aiws/manifest.json` 漂移
9
11
  - 强门禁:缺 `python3`/缺 required 脚本也应失败
@@ -11,15 +11,20 @@ description: 缺陷修复:禅道 MCP 拉单、图片证据落盘并汇总 fix_
11
11
 
12
12
  建议流程:
13
13
  1) 先运行 `/ws-preflight`。
14
- 2) 建立变更工件(推荐):`aiws change start <change-id> --hooks`(superproject+submodule 可用 `--worktree --submodules`)。
15
- 3) 通过已配置 zentao MCP 拉取 bug 字段与附件列表。
16
- 4) 落盘证据到 `changes/<change-id>/bug/`:
14
+ 2) 若当前不在 `change/<change-id>` 分支 / worktree,先建立 change 上下文:
15
+ - 工作区先保持干净
16
+ - 仓库已有提交:优先 `aiws change start <change-id> --hooks --worktree`
17
+ - superproject + submodule:优先 `aiws change start <change-id> --hooks --worktree --submodules`
18
+ - 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
19
+ 3) 若上一步创建了 worktree:后续 bug 证据、CSV 更新、`/ws-dev` 修复都必须在该 worktree 中继续。
20
+ 4) 通过已配置 zentao MCP 拉取 bug 字段与附件列表。
21
+ 5) 落盘证据到当前 active change 上下文的 `changes/<change-id>/bug/`:
17
22
  - `zentao-bug-<bug-id>.json`
18
23
  - `zentao-bug-<bug-id>.md`
19
24
  - `images/<bug-id>/...`
20
- 5) upsert `issues/fix_bus_issues.csv`(主键 `Bug_ID`)。
21
- 6) 进入 `/ws-dev` 修复并回填 `Fix_Status/Verify_Command/Updated_At`。
22
- 7) 质量门:`aiws change validate <change-id> --strict` + `aiws validate . --stamp`。
25
+ 6) upsert 当前 active change 上下文中的 `issues/fix_bus_issues.csv`(主键 `Bug_ID`)。
26
+ 7) 进入 `/ws-dev` 修复并回填 `Fix_Status/Verify_Command/Updated_At`。
27
+ 8) 质量门:`aiws change validate <change-id> --strict` + `aiws validate . --stamp`。
23
28
 
24
29
  强制约束:
25
30
  - 不自动 commit / push。
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Commit:门禁/审计后提交(submodule 感知)
2
+ description: 提交:门禁/审计后提交(submodule 感知)
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-commit -->
5
5
  # ws commit
@@ -14,6 +14,7 @@ description: Commit:门禁/审计后提交(submodule 感知)
14
14
  - 不使用 `--no-verify` 绕过 hooks
15
15
  - 不自动 push
16
16
  - 不打印 secrets
17
+ - commit message 优先使用中文;若启用了 `.githooks/commit-msg`,默认仅提示,只有 strict 模式才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
17
18
 
18
19
  步骤(建议):
19
20
  1) 先运行 `/ws-preflight`。
@@ -54,7 +55,7 @@ git status --porcelain
54
55
  git diff --staged --submodule=short
55
56
  ```
56
57
  7) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
57
- 8) 让用户提供 commit message(必须确认后再执行)。
58
+ 8) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
58
59
  9) 执行提交(不带 `--no-verify`):
59
60
  ```bash
60
61
  git commit -m "<message>"
@@ -6,7 +6,7 @@ description: 交付:submodules+superproject 分步提交并安全合并回 bas
6
6
 
7
7
  用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
8
 
9
- 目标:适配 superproject + submodule(数量不固定)的交付收尾,降低“提交顺序/合并回 base 分支”出错概率:
9
+ 目标:适配 superproject + submodule(数量不固定)的交付收尾,降低提交顺序和合并回 base 分支的出错概率:
10
10
  1) 先逐个提交 submodule(每个 repo 单独确认 commit message;默认 `git add -p`)
11
11
  2) 再提交 superproject(包含 submodule gitlink 指针更新 + 自身改动/变更工件)
12
12
  3) 最后 fast-forward 合并回目标分支(复用 `aiws change finish`;建议用 `/ws-finish`)
@@ -19,11 +19,15 @@ description: 交付:submodules+superproject 分步提交并安全合并回 bas
19
19
  建议流程(按顺序):
20
20
  1) 先运行 `/ws-preflight`。
21
21
  2) 如果存在 `.gitmodules` 但缺少 `submodule.<name>.branch`,先运行 `/ws-submodule-setup` 并提交 `.gitmodules`(否则 `aiws validate .` 会失败,且 submodule 工作流会产生人为差异)。
22
+ 2.1) 若存在 submodule:必须准备 `changes/<change-id>/submodules.targets`,并覆盖所有 submodule path;这是本次交付的目标分支真值。
23
+ - 生成该文件时可先做默认预填:detached HEAD 默认建议取 `.gitmodules` 声明分支;已附着在本地分支时默认建议取当前分支。
24
+ - 上述都只是建议值;真正的 deliver/finish 只认 `submodules.targets`。
22
25
  2) 发现 submodules:
23
26
  - `git submodule status --recursive`
24
27
  3) 逐个提交 submodules(按上一步顺序):
25
28
  - `git -C "<sub_path>" status --porcelain`
26
- - 若当前为 detached HEAD:不要直接切 `change/<change-id>` / `main` / `master`;先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target-branch>`
29
+ - 先说明该 submodule 目标分支的来源:attached branch 默认建议取当前分支;detached HEAD 默认建议取 `.gitmodules`;若与 `submodules.targets` 已落盘值冲突,则以 `submodules.targets` 为准
30
+ - 若当前为 detached HEAD:不要直接切 `change/<change-id>` / `main` / `master`;先按 `submodules.targets`(若分支为 `.` 则展开为 `.ws-change.json` 的 `base_branch`)挂到 `aiws/pin/<target-branch>`
27
31
  - `git -C "<sub_path>" add -p`
28
32
  - `git -C "<sub_path>" diff --staged --stat`
29
33
  - 生成并让用户确认该 submodule 的 commit message(每个 repo 单独确认)
@@ -10,8 +10,14 @@ description: 开发:在 AIWS 约束下完成小步交付
10
10
 
11
11
  建议流程:
12
12
  1) 先运行 `/ws-preflight`(读真值文件并输出约束摘要)。
13
+ - 若 `/ws-plan` 刚创建了 `change/<change-id>` worktree:后续实现必须在该 worktree 中继续;不要回原工作区重复 `aiws change start ...`
13
14
  2) 建立变更归因(推荐):
14
- - 推荐一键:`aiws change start <change-id> --hooks`
15
+ - ⚠️ 若准备切分支/创建 worktree,先看 `git status --porcelain`;否则切换上下文后,未提交改动可能“看起来丢了”。
16
+ - 若当前目录已经是 `change/<change-id>` worktree(例如由 `/ws-plan` 创建):直接在这里继续,不要再创建第二个 worktree,也不要回原工作区写代码。
17
+ - 若非空仅因为 `/ws-plan` 生成了 `plan/...` 或 `changes/<change-id>/...`,这是预期行为;此时优先 `aiws change start <change-id> --hooks --no-switch`,若仍要 `--switch/--worktree`,先提交这些规划工件。
18
+ - 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`(只创建分支/工件 + 启用 hooks;不切分支)
19
+ - 准备进入实现时:若当前已在 `change/<change-id>` 直接继续;若需切换到该分支,先确认除规划工件外无额外未提交改动,再执行:`git switch change/<change-id>`
20
+ - 若你明确要“一键切分支”(不推荐,且 dirty 会被拦截):`aiws change start <change-id> --hooks --switch`
15
21
  - superproject + submodule(推荐):`aiws change start <change-id> --hooks --worktree --submodules`
16
22
  - 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
17
23
  - 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
@@ -37,34 +37,34 @@ fi
37
37
  2) (推荐)门禁校验并落盘证据:`aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)。
38
38
  2.1) (强烈建议)收敛持久证据并回填 `Evidence_Path`:`aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)。
39
39
  2.2) (可选)生成状态快照(建议):`aiws change state <change-id> --write`。
40
- 3) 安全合并并切回目标分支:
41
- - 若当前就在 `change/<change-id>` 分支上,可直接执行:`aiws change finish`
42
- - 否则执行:`aiws change finish <change-id>`
43
- 4) 若提示无法 fast-forward:先在 change 分支(或对应 worktree)里 `git rebase <target-branch>`,再重试 `aiws change finish`。
44
- 5) 合并成功后,按顺序处理每个 submodule(减少 detached;再 push):
40
+ 3) 若不存在 `.gitmodules`,或 submodules 已按顺序处理完成,优先直接执行最小收尾闭环:
41
+ - `aiws change finish <change-id> --push`
42
+ - 若当前就在 `change/<change-id>` 分支上,也可省略 `<change-id>`
43
+ - 该命令会在 fast-forward 合并成功后 push 目标分支;默认优先使用 upstream 配置(`branch.<name>.remote` + `branch.<name>.merge`),只有在你明确知道要推向别的 remote 时才追加 `--remote <name>`
44
+ - `change/<change-id>` 位于独立 worktree,且该 worktree 干净,则会在 push 成功后自动执行 `git worktree remove` + `git worktree prune`
45
+ - AI 入口执行前,应先向用户说明将要 push 的 remote/branch;显式传入 `--push` 即视为确认
46
+ 4) 若提示无法 fast-forward:先在 change 分支(或对应 worktree)里 `git rebase <target-branch>`,再重试 `aiws change finish --push`。
47
+ 5) 若需要先处理 submodules,则按顺序处理每个 submodule(减少 detached;再 push):
48
+ - 先显式解析 base branch,不要用当前分支名替代:
49
+ - `python3 - <<'PY'`
50
+ - `import json, pathlib; meta = pathlib.Path("changes") / "<change-id>" / ".ws-change.json"; print((json.loads(meta.read_text(encoding="utf-8")).get("base_branch") or "").strip())`
51
+ - `PY`
45
52
  - 发现 submodules:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
46
53
  - 对每个 `<sub_path>`:
47
54
  - 读取 superproject 当前 gitlink:`git rev-parse "HEAD:<sub_path>"`
48
- - 目标分支:必须在 `.gitmodules` 配置 `submodule.<name>.branch`(若为 `.` 则用当前主仓库分支;避免 origin 多分支时误判)
49
- - 不要直接切 `change/<change-id>` / `main` / `master` 来“解 detached”
55
+ - 目标分支真值:`changes/<change-id>/submodules.targets`;若条目里分支写 `.`,则展开为刚才解析出的 `base_branch`
56
+ - 生成/检查 `submodules.targets` 时,detached HEAD 默认建议取 `.gitmodules` `submodule.<name>.branch`;已附着在本地分支时默认建议取当前分支;这些都只是预填建议,不是 finish/push 的运行时真值
57
+ - 不要直接切 `change/<change-id>` / `main` / `master` 来解 detached
50
58
  - 用 pin 分支挂回(不改动现有 main/master 指针):`git -C "<sub_path>" checkout -B "aiws/pin/<target-branch>" <gitlink-sha>`
51
59
  - 仅当 `<gitlink-sha>` 属于 `origin/<target-branch>` 历史时才允许 push;否则停止并人工处理分叉
52
60
  - push(只允许 fast-forward):`git -C "<sub_path>" push origin "<gitlink-sha>:refs/heads/<target-branch>"`
53
61
  6) 任一 submodule 不满足 fast-forward 条件时立即停止(不要继续 push 主仓库)。
54
- 7) submodules 全部成功后,再 push 主仓库当前分支:
55
- - `git branch --show-current`
56
- - `git status -sb`
57
- - `git push`
58
- 8) push 成功后,清理 `change/<change-id>` 对应 worktree(若存在且不是当前 worktree):
59
- - `change_ref="refs/heads/change/<change-id>"`
60
- - `main_wt="$(git rev-parse --show-toplevel)"`
61
- - `change_wt="$(git worktree list --porcelain | awk -v ref="$change_ref" '$1=="worktree"{wt=substr($0,10)} $1=="branch"&&$2==ref{print wt; exit}')"`
62
- - 若 `change_wt` 非空且不等于 `main_wt`:先输出并让用户确认,再执行 `git worktree remove "$change_wt"`(不带 `--force`),最后 `git worktree prune`
63
- - 若 `git -C "$change_wt" status --porcelain` 非空:停止并提示先清理该 worktree
64
- 9) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
62
+ 7) submodules 全部成功后,再回到主仓库执行:
63
+ - `aiws change finish <change-id> --push`
64
+ 8) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
65
65
 
66
66
  安全:
67
- - push 前先输出状态并请用户确认远端/分支。
67
+ - push 前先输出状态并说明远端/分支。
68
68
  - 不执行破坏性命令。
69
69
  <!-- AIWS_MANAGED_END:opencode:ws-finish -->
70
70
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: 交接:查看归档 change 的 handoff.md(由 aiws change archive 生成)
3
+ ---
4
+ <!-- AIWS_MANAGED_BEGIN:opencode:ws-handoff -->
5
+ # ws handoff
6
+
7
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
+
9
+ 目标:
10
+ - 交接与回放:通过 `handoff.md` 让已归档的 change 可被下一位/下一次会话快速接力。
11
+ - handoff 文件位置:`changes/archive/<date>-<change-id>/handoff.md`(由 `aiws change archive` 自动生成)。
12
+
13
+ 执行建议:
14
+ 1) 若 change 已完成并准备归档:运行 `/p-aiws-change-archive`(会先严格校验,再归档并生成 `handoff.md`)。
15
+ 2) 查看 handoff:
16
+ ```bash
17
+ change_id="<change-id>"
18
+ ls -1 changes/archive/*-"${change_id}"/handoff.md
19
+ sed -n '1,160p' changes/archive/*-"${change_id}"/handoff.md
20
+ ```
21
+ 3) 依赖提示:
22
+ - 若你在某个 change 的 `proposal.md` 声明了 `Depends_On`,`aiws change start` 会尝试读取依赖 change 的 `handoff.md` 并输出摘要(前提:依赖已归档且 handoff 存在)。
23
+ <!-- AIWS_MANAGED_END:opencode:ws-handoff -->
24
+
25
+ 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -7,14 +7,18 @@ description: 规划:生成可落盘 plan 工件
7
7
  用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
8
 
9
9
  目标:
10
- - 生成可落盘执行计划(供 /ws-dev 执行)。
10
+ - 若尚未进入本次 change 的工作上下文:先建立 `change/<change-id>` 分支 / worktree,再生成可落盘执行计划(供 /ws-dev 执行)。
11
11
 
12
12
  执行建议:
13
13
  1) 先运行 `/ws-preflight`(对齐 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`)。
14
- 2) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
15
- 3) 计划至少包含:`Bindings`、`Goal`、`Non-goals`、`Scope`、`Plan`、`Verify`、`Risks & Rollback`、`Evidence`。
16
- 4) 若已有 `changes/<change-id>/proposal.md`,对齐 `Plan_File` / `Contract_Row` / `Evidence_Path`。
17
- 5) 完成后先运行 `/ws-plan-verify`,通过再进入 `/ws-dev`。
14
+ 2) 若当前不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start <change-id>` 建立上下文:
15
+ - 仓库已有提交:优先 `aiws change start <change-id> --hooks --worktree`;若声明了 submodules,加 `--submodules`
16
+ - 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
17
+ 3) 若上一步创建了 worktree:切到输出的 `worktree:` 路径,后续所有计划文件都写在该 worktree 中。
18
+ 4) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
19
+ 5) 计划至少包含:`Bindings`、`Goal`、`Non-goals`、`Scope`、`Plan`、`Verify`、`Risks & Rollback`、`Evidence`。
20
+ 6) 若已有 `changes/<change-id>/proposal.md`,对齐 `Plan_File` / `Contract_Row` / `Evidence_Path`。
21
+ 7) 完成后先运行 `/ws-plan-verify`,通过再进入 `/ws-dev`。
18
22
  <!-- AIWS_MANAGED_END:opencode:ws-plan -->
19
23
 
20
24
  可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Review:提交前审计改动并落盘证据
2
+ description: 评审:提交前审计改动并落盘证据
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-review -->
5
5
  # ws review
@@ -8,23 +8,27 @@
8
8
  协作约束(建议最小集):
9
9
  - 每次变更使用分支 `change/<change-id>`,并维护 `changes/<change-id>/proposal.md`、`tasks.md`(可选 `design.md`)
10
10
  - 启用本机门禁(推荐):`aiws hooks install .`(或手工:`git config core.hooksPath .githooks`;`git commit`/`git push` 会自动跑 `aiws validate .`)
11
+ - 启用 hooks 后,`.githooks/commit-msg` 默认提示优先使用中文 commit message;如需强制,可执行:`git config aiws.commitMessagePolicy strict`
11
12
  - 提交前校验(强制门禁):`aiws validate .`(包含:漂移检测 + `ws_change_check` + `requirements_contract`)
12
13
  - Codex(推荐):本仓库内置 repo skills:`.agents/skills/`(可显式 `$ws-dev`,也可隐式套用工作流)
14
+ - Codex skills 命名约定:`ws-*` 为常用链路入口;`p-*` 为私有原子入口(一般不需要直接调用)。
13
15
  - Codex skills(常用,一句话说明):
14
16
  - `$ws-preflight`:预检(读取真值文件并输出约束摘要)
15
17
  - `$ws-submodule-setup`:子模块分支对齐(写入 `.gitmodules` 的 `submodule.<name>.branch`)
16
18
  - `$ws-plan`:规划(生成可落盘 `plan/` 工件;供 `$ws-dev` 执行)
17
19
  - `$ws-plan-verify`:计划质检(执行前检查计划是否过长/跑偏)
20
+ - `$p-tasks-plan`:原子:tasks 同步(从 `changes/<id>/tasks.md` 生成 `update_plan` payload)
18
21
  - `$ws-dev`:开发(按需求实现并验证;适用于任何需要修改代码/配置的任务)
19
22
  - `$ws-bugfix`:缺陷修复(禅道 MCP 拉单 + 图片证据落盘 + `issues/fix_bus_issues.csv` 汇总)
20
23
  - `$ws-pull`:拉取并对齐 submodules(尽量避免 detached;减少人为差异)
21
24
  - `$ws-push`:推送(submodule 感知:先 submodules 后 superproject;fast-forward 安全)
22
25
  - `$ws-review`:评审(提交前审计;证据优先落盘到 `changes/<change-id>/review/`)
23
26
  - `$ws-commit`:提交(先审计/门禁再 commit;submodule 感知)
24
- - `$aiws-init`:初始化工作区(生成真值文件与门禁)
25
- - `$aiws-validate`:校验工作区(漂移检测 + 门禁)
26
- - `$aiws-hooks-install`:启用 git hooks 门禁(`core.hooksPath=.githooks`)
27
- - `$aiws-change-new`:创建 `changes/<change-id>` 工件
27
+ - `$ws-handoff`:交接(归档后生成/查看 `changes/archive/.../handoff.md`,便于跨会话接力)
28
+ - `$p-aiws-init`:初始化工作区(生成真值文件与门禁)
29
+ - `$p-aiws-validate`:校验工作区(漂移检测 + 门禁)
30
+ - `$p-aiws-hooks-install`:启用 git hooks 门禁(`core.hooksPath=.githooks`)
31
+ - `$p-aiws-change-new`:创建 `changes/<change-id>` 工件
28
32
  - Codex CLI(推荐,可选):安装全局 skills:`npx @aipper/aiws codex install-skills`(写入 `~/.codex/skills/` 或 `$CODEX_HOME/skills`)
29
33
  - Codex CLI(遗留,可选):安装全局 prompts:`npx @aipper/aiws codex install-prompts`(写入 `~/.codex/prompts/` 或 `$CODEX_HOME/prompts`;prompts 已 deprecated)
30
34
  - 不要把敏感信息写入 git:`secrets/test-accounts.json`、`.env*`、token、内网地址等
@@ -80,10 +80,10 @@
80
80
  - 先 `/server-test-plan` → `/server-test` 跑到验收通过
81
81
  - 再 `/server-commit` 对 `server_dirs` 指定的 submodule 做 commit,并在工作区根仓库提交 submodule 指针更新
82
82
 
83
- 建议 commit message 保持通用简洁(Conventional Commits 风格),例如:
84
- - `fix(api): ...`
85
- - `chore(server): api test fixes`
86
- - `chore(workspace): bump server submodules`
83
+ 建议 commit message 保持通用简洁,优先使用中文;英文也可以,例如:
84
+ - `修复: API 健康检查空指针`
85
+ - `构建: 调整 server 测试脚本`
86
+ - `杂项: 更新 workspace submodule 指针`
87
87
 
88
88
  ## 3) 测试入口
89
89
 
@@ -28,6 +28,7 @@ changes/
28
28
  - 可选:`--worktree-dir <path>` 覆盖 worktree 目录
29
29
  - 可选:`--submodules` 在 worktree 内执行 `git submodule update --init --recursive`
30
30
  - `aiws change finish <change-id>`(安全合并:fast-forward 合并回目标分支;在 `change/<change-id>` 分支上执行时会尝试使用 `.ws-change.json` 的 `base_branch` 作为目标分支)
31
+ - `aiws change finish <change-id> --push [--remote <name>]`(最小收尾闭环:若存在 `.gitmodules` 则先按 `changes/<id>/submodules.targets` 顺序 push submodule,再 push 目标分支;默认优先遵循 upstream 配置;若 `change/<change-id>` 位于独立 worktree,且该 worktree 干净,则在 push 成功后自动执行 worktree cleanup;含 submodule 的 worktree 会因 Git 原生限制在 clean-check 后内部走 `git worktree remove --force`)
31
32
  - `aiws change new <change-id>`
32
33
  - `aiws change list`
33
34
  - `aiws change status <change-id>`
@@ -41,9 +42,10 @@ Active change(推荐,团队共享):
41
42
  - 切到该分支后,可省略 `<change-id>` 执行:`aiws change status|next|validate|sync|archive`
42
43
 
43
44
  计划质量门(推荐,执行前):
44
- - 先生成计划:`$ws-plan`
45
+ - 先生成计划:`$ws-plan`(若尚未进入 `change/<change-id>` 上下文,应先由它调用 `aiws change start <change-id>` 建立分支 / worktree,再在该上下文内写 `plan/...`)
45
46
  - 再执行计划质检:`$ws-plan-verify`
46
47
  - 最后进入实现:`$ws-dev`
48
+ - 若 `$ws-plan` 创建了独立 worktree,后续 `$ws-plan-verify` / `$ws-dev` / `$ws-finish` 都应优先在该 worktree 内继续
47
49
  - 目标:确保计划具备主索引绑定、步骤不过长、验证命令可复现且有预期结果
48
50
 
49
51
  模板覆盖(可选):
@@ -59,7 +61,10 @@ Active change(推荐,团队共享):
59
61
  - 若真值文件(`AI_PROJECT.md` / `AI_WORKSPACE.md` / `REQUIREMENTS.md`)在变更期间发生变化,严格校验/归档会要求先运行 `aiws change sync <change-id>` 确认基线。
60
62
 
61
63
  Hooks/CI(推荐,硬约束):
62
- - 工作区会安装 `.githooks/{pre-commit,pre-push}`(默认执行 `aiws validate .`)与门禁脚本(`tools/ws_change_check.py`、`tools/requirements_contract.py`)。
64
+ - 工作区会安装 `.githooks/{commit-msg,pre-commit,pre-push}`:
65
+ - `commit-msg`:默认提示优先使用中文 commit message;若执行 `git config aiws.commitMessagePolicy strict`,则会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
66
+ - `pre-commit` / `pre-push`:默认执行 `aiws validate .`
67
+ - 还会安装门禁脚本(`tools/ws_change_check.py`、`tools/requirements_contract.py`)。
63
68
  - **启用 hooks 需要本地配置**(不会自动提交到 git):
64
69
  - 直接启用:`git config core.hooksPath .githooks`
65
70
  - 或使用:`aiws hooks install .`(等价)
@@ -69,4 +74,5 @@ Hooks/CI(推荐,硬约束):
69
74
  合并建议(减少人为 merge 引入新问题):
70
75
  - 优先使用 worktree + fast-forward 合并:
71
76
  - 完成后在主工作区(例如 `main`)执行:`aiws change finish <change-id>`(等价于 `git merge --ff-only change/<change-id>`)
77
+ - 若还要顺手 push 并清理独立 change worktree:`aiws change finish <change-id> --push`
72
78
  - 若失败:先在 worktree 里 `git rebase main`(或更新 main 后再 rebase),再重试 `--ff-only`