@aipper/aiws-spec 0.0.28 → 0.0.30

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 (138) hide show
  1. package/docs/cli-interface.md +10 -12
  2. package/docs/opencode-autonomous-swarm.md +178 -0
  3. package/docs/opencode-omo-adapter.md +123 -4
  4. package/docs/opencode-omo-validation-checklist.md +47 -0
  5. package/docs/opencode-subagent-first.md +187 -0
  6. package/docs/workflow-delegation-context-injection.md +217 -0
  7. package/docs/workflow-delegation-contracts.json +108 -2
  8. package/docs/workflow-delegation-contracts.md +13 -0
  9. package/docs/workflow-delegation-contracts.schema.json +152 -0
  10. package/docs/workflow-governance-rules.json +47 -6
  11. package/docs/workflow-governance-rules.md +8 -7
  12. package/docs/workflow-governance-rules.schema.json +39 -1
  13. package/docs/workflow-review-gates.json +6 -0
  14. package/docs/workflow-review-gates.md +14 -5
  15. package/docs/workflow-review-gates.schema.json +4 -0
  16. package/docs/workflow-router-rules.json +72 -8
  17. package/docs/workflow-router-rules.md +21 -14
  18. package/docs/workflow-router-rules.schema.json +4 -0
  19. package/docs/workflow-stage-contracts.json +24 -5
  20. package/docs/workflow-stage-contracts.md +16 -15
  21. package/docs/workflow-stage-contracts.schema.json +12 -1
  22. package/package.json +1 -1
  23. package/templates/workspace/.agents/skills/using-aiws/SKILL.md +16 -10
  24. package/templates/workspace/.agents/skills/ws-commit/SKILL.md +6 -118
  25. package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +6 -218
  26. package/templates/workspace/.agents/skills/ws-dev/SKILL.md +82 -141
  27. package/templates/workspace/.agents/skills/ws-finish/SKILL.md +9 -204
  28. package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +10 -44
  29. package/templates/workspace/.agents/skills/ws-migrate/SKILL.md +6 -42
  30. package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +6 -58
  31. package/templates/workspace/.agents/skills/ws-pull/SKILL.md +8 -109
  32. package/templates/workspace/.agents/skills/ws-push/SKILL.md +8 -100
  33. package/templates/workspace/.agents/skills/ws-review/SKILL.md +6 -1
  34. package/templates/workspace/.agents/skills/ws-submodule-setup/SKILL.md +10 -57
  35. package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +12 -53
  36. package/templates/workspace/{changes → .aiws/changes}/README.md +20 -23
  37. package/templates/workspace/{changes → .aiws/changes}/templates/proposal.md +12 -12
  38. package/templates/workspace/{changes → .aiws/changes}/templates/tasks.md +8 -8
  39. package/templates/workspace/{issues → .aiws/issues}/problem-issues.csv +1 -1
  40. package/templates/workspace/.aiws/journal/.gitkeep +1 -0
  41. package/templates/workspace/{requirements → .aiws/requirements}/requirements-issues.csv +1 -1
  42. package/templates/workspace/.aiws/tmp/.gitkeep +0 -0
  43. package/templates/workspace/{tools → .aiws/tools}/requirements_contract.py +2 -2
  44. package/templates/workspace/{tools → .aiws/tools}/requirements_contract_sync.py +2 -2
  45. package/templates/workspace/{tools → .aiws/tools}/requirements_flow_gen.py +1 -1
  46. package/templates/workspace/{tools → .aiws/tools}/server_test_runner.py +10 -10
  47. package/templates/workspace/{tools → .aiws/tools}/ws_change_check.py +23 -23
  48. package/templates/workspace/{tools → .aiws/tools}/ws_resolve_sub_target.sh +2 -2
  49. package/templates/workspace/{tools → .aiws/tools}/ws_tasks_plan.py +3 -3
  50. package/templates/workspace/.claude/commands/ws-review.md +5 -1
  51. package/templates/workspace/.claude/settings.json.example +26 -0
  52. package/templates/workspace/.claude/skills/ws-commit/SKILL.md +6 -118
  53. package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +6 -218
  54. package/templates/workspace/.claude/skills/ws-dev/SKILL.md +52 -141
  55. package/templates/workspace/.claude/skills/ws-finish/SKILL.md +9 -204
  56. package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +10 -44
  57. package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +6 -42
  58. package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +6 -49
  59. package/templates/workspace/.claude/skills/ws-pull/SKILL.md +8 -109
  60. package/templates/workspace/.claude/skills/ws-push/SKILL.md +8 -100
  61. package/templates/workspace/.claude/skills/ws-review/SKILL.md +6 -1
  62. package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +10 -57
  63. package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +12 -53
  64. package/templates/workspace/.githooks/pre-commit +13 -0
  65. package/templates/workspace/.githooks/pre-push +7 -0
  66. package/templates/workspace/.opencode/command/ws-auto.md +33 -0
  67. package/templates/workspace/.opencode/command/ws-autonomy.md +25 -0
  68. package/templates/workspace/.opencode/command/ws-review.md +5 -1
  69. package/templates/workspace/.opencode/commands/ws-auto.md +33 -0
  70. package/templates/workspace/.opencode/commands/ws-autonomy.md +25 -0
  71. package/templates/workspace/.opencode/commands/ws-commit.md +4 -56
  72. package/templates/workspace/.opencode/commands/ws-deliver.md +10 -50
  73. package/templates/workspace/.opencode/commands/ws-finish.md +11 -3
  74. package/templates/workspace/.opencode/commands/ws-handoff.md +9 -17
  75. package/templates/workspace/.opencode/commands/ws-migrate.md +10 -17
  76. package/templates/workspace/.opencode/commands/ws-plan-verify.md +5 -15
  77. package/templates/workspace/.opencode/commands/ws-pull.md +6 -75
  78. package/templates/workspace/.opencode/commands/ws-push.md +7 -82
  79. package/templates/workspace/.opencode/commands/ws-review.md +5 -1
  80. package/templates/workspace/.opencode/commands/ws-submodule-setup.md +8 -47
  81. package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +10 -19
  82. package/templates/workspace/.opencode/helpers/approval-whitelist-check.sh +148 -0
  83. package/templates/workspace/.opencode/helpers/approval-whitelist-run.sh +82 -0
  84. package/templates/workspace/.opencode/helpers/approval-whitelist-watchdog.sh +144 -0
  85. package/templates/workspace/.opencode/helpers/tmux-swarm-rescue.sh +56 -0
  86. package/templates/workspace/.opencode/helpers/tmux-swarm-scan.sh +46 -0
  87. package/templates/workspace/.opencode/lib/aiws-context.js +953 -0
  88. package/templates/workspace/.opencode/oh-my-opencode.json.example +64 -4
  89. package/templates/workspace/.opencode/plugins/aiws-inject-context.js +201 -0
  90. package/templates/workspace/.opencode/plugins/aiws-session-start.js +86 -0
  91. package/templates/workspace/.opencode/plugins/aiws-workflow-state.js +116 -0
  92. package/templates/workspace/.opencode/scripts/ws-plan-gen-submodule-targets.sh +27 -0
  93. package/templates/workspace/.opencode/scripts/ws-plan-setup-worktree.sh +31 -0
  94. package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +130 -77
  95. package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +1 -1
  96. package/templates/workspace/.opencode/skills/ws-auto/SKILL.md +46 -0
  97. package/templates/workspace/.opencode/skills/ws-autonomy/SKILL.md +62 -0
  98. package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +1 -1
  99. package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +6 -118
  100. package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +115 -40
  101. package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +6 -218
  102. package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +105 -146
  103. package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +23 -7
  104. package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +9 -204
  105. package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +1 -1
  106. package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +10 -44
  107. package/templates/workspace/.opencode/skills/ws-intake/SKILL.md +43 -4
  108. package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +6 -42
  109. package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +15 -55
  110. package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +6 -49
  111. package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +1 -1
  112. package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +8 -109
  113. package/templates/workspace/.opencode/skills/ws-push/SKILL.md +8 -100
  114. package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +7 -2
  115. package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +1 -1
  116. package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +1 -1
  117. package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +1 -1
  118. package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +1 -1
  119. package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +1 -1
  120. package/templates/workspace/.opencode/skills/ws-review/SKILL.md +35 -4
  121. package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +1 -1
  122. package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +1 -1
  123. package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +10 -57
  124. package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +45 -55
  125. package/templates/workspace/AGENTS.md +32 -84
  126. package/templates/workspace/AI_PROJECT.md +5 -5
  127. package/templates/workspace/AI_WORKSPACE.md +1 -1
  128. package/templates/workspace/REQUIREMENTS.md +1 -1
  129. package/templates/workspace/gitignore +1 -1
  130. package/templates/workspace/manifest.json +215 -395
  131. /package/templates/workspace/{changes → .aiws/changes}/templates/design.md +0 -0
  132. /package/templates/workspace/{memory-bank → .aiws/memory-bank}/README.md +0 -0
  133. /package/templates/workspace/{memory-bank → .aiws/memory-bank}/architecture.md +0 -0
  134. /package/templates/workspace/{memory-bank → .aiws/memory-bank}/implementation-plan.md +0 -0
  135. /package/templates/workspace/{memory-bank → .aiws/memory-bank}/progress.md +0 -0
  136. /package/templates/workspace/{memory-bank → .aiws/memory-bank}/tech-stack.md +0 -0
  137. /package/templates/workspace/{requirements → .aiws/requirements}/CHANGELOG.md +0 -0
  138. /package/templates/workspace/{secrets → .aiws/secrets}/test-accounts.example.json +0 -0
@@ -6,6 +6,7 @@ description: 评审(提交前审计与证据落盘)
6
6
  用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
7
 
8
8
  目标:在提交/交付前审计当前改动,对照真值文件检查是否越界,并把审计证据优先落盘到 `changes/<change-id>/review/`(若无法确定 `change-id` 再回退 `.agentdocs/tmp/review/`)。
9
+ 若当前语境已经明确是“准备交付/finish”,则本入口不应只停留在通用 review:应继续同时补齐 `$ws-spec-review` 与 `$ws-quality-review`,把 dual review gate 一次性收敛完。
9
10
 
10
11
  阶段定位:
11
12
  - review 阶段;负责对当前改动做规范、风险和验证完整性的审计。
@@ -40,7 +41,11 @@ description: 评审(提交前审计与证据落盘)
40
41
  - 默认:`changes/<change-id>/review/codex-review.md`
41
42
  - 回退:`.agentdocs/tmp/review/codex-review.md`(仅在无法确定 `change-id` 时使用)
42
43
  - 若已有其它 reviewer 文件:不要覆盖它们;当前 reviewer 应写自己的文件或更新自己的汇总文件
43
- 4) 回复中输出:
44
+ 4) 若当前任务已进入“准备提交/交付/finish”的语境,继续补齐 dual review gate:
45
+ - 运行/收敛 `$ws-spec-review`,落盘 `changes/<change-id>/review/spec-review.md`(或回退 `.agentdocs/tmp/review/spec-review.md`)
46
+ - 运行/收敛 `$ws-quality-review`,落盘 `changes/<change-id>/review/quality-review.md`(或回退 `.agentdocs/tmp/review/quality-review.md`)
47
+ - 不要把单个 `codex-review.md` 误当成 finish gate 已完成
48
+ 5) 回复中输出:
44
49
  - `证据(Evidence):` 证据文件路径
45
50
  - `主要风险(Top risks):` 3–8 条(高→低)
46
51
  - `下一步(Next):` 最小修复清单 + 最小验证命令
@@ -1,65 +1,18 @@
1
1
  ---
2
2
  name: ws-submodule-setup
3
- description: 子模块分支对齐(写入 .gitmodules 的 submodule.<name>.branch;减少 detached 与人为差异)
3
+ description: `aiws submodule-setup` 的薄包装入口
4
4
  ---
5
5
 
6
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
6
+ # ws-submodule-setup
7
7
 
8
- 目标:
9
- - 为每个 submodule 写入 `.gitmodules` 的 `submodule.<name>.branch`,让 `ws-pull` / `ws-finish` 能确定性地“挂回分支/fast-forward push”,避免 origin 多分支时靠猜导致偏差。
10
- - 该变更是 **superproject 的团队真值**:需要提交 `.gitmodules`。
8
+ `aiws submodule-setup` 的薄包装入口。
11
9
 
12
- 安全约束(强制):
13
- - 不自动提交、不自动 push(必须先输出 diff 并让用户确认)
14
- - 不在 submodule 中做破坏性操作(不 `reset --hard` / 不改动远端)
15
-
16
- 步骤(建议):
17
- 1) 确认工作区干净(否则停止):
18
- ```bash
19
- git status --porcelain
20
- ```
21
-
22
- 2) 列出 submodules(没有则停止并说明无需配置):
23
- ```bash
24
- test -f .gitmodules || { echo "no .gitmodules"; exit 0; }
25
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'
26
- ```
27
-
28
- 3) 对每个 submodule,输出当前配置与建议分支(让用户确认每个 submodule 的 branch):
29
- ```bash
30
- while read -r key sub_path; do
31
- name="${key#submodule.}"; name="${name%.path}"
32
- echo "== submodule: ${name} path=${sub_path} =="
33
- echo "[current] branch=$(git config --file .gitmodules --get submodule.${name}.branch || true)"
34
- echo "[origin] HEAD=$(git -C \"${sub_path}\" symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || true)"
35
- git -C "${sub_path}" branch -r --list "origin/*" | sed -n '1,30p' || true
36
- echo "[choose] set one of:"
37
- echo " - a concrete branch, e.g. main / master / release/x.y"
38
- echo " - '.' to follow superproject current branch name (only if your team uses matching branch names)"
39
- done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$')
40
- ```
41
-
42
- 4) 逐个写入分支配置(每次写完都回显,避免误配):
43
10
  ```bash
44
- # Example:
45
- # git submodule set-branch --branch main path/to/submodule
46
- # git submodule set-branch --branch . path/to/submodule
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws submodule-setup
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws submodule-setup
15
+ else
16
+ npx @aipper/aiws submodule-setup
17
+ fi
47
18
  ```
48
-
49
- 5) 输出变更并让用户确认是否提交:
50
- ```bash
51
- git diff -- .gitmodules
52
- git status --porcelain
53
- ```
54
-
55
- 6) 若用户确认要提交:
56
- ```bash
57
- git add .gitmodules
58
- git commit -m "chore(submodule): set tracking branches"
59
- ```
60
-
61
- 输出要求:
62
- - `Submodules:` name/path + 选择的 branch(每个都列出)
63
- - `Diff:` `.gitmodules` 的 diff(或至少 `git diff -- .gitmodules` 的摘要)
64
- - `Next:` 提示后续用 `$ws-pull` 拉取可自动减少 detached;`aiws validate` 会检查该配置是否齐全
65
-
@@ -1,59 +1,18 @@
1
1
  ---
2
2
  name: ws-verify-before-complete
3
- description: 完成前验证(finish / handoff 前检查双审查与 validate/evidence 是否齐全)
3
+ description: `aiws verify-bc` 的薄包装入口
4
4
  ---
5
5
 
6
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
6
+ # ws-verify-before-complete
7
7
 
8
- 目标:
9
- - 在进入 `$ws-finish` / `$ws-handoff` 前,检查 review、validate stamp 和证据是否齐全
10
- - 输出明确的 pass/fail 结论,避免“看起来完成了但 gate 没过”的伪完成
8
+ `aiws verify-bc` 的薄包装入口。
11
9
 
12
- 阶段定位:
13
- - finish gate;负责 completion readiness 检查,不直接做 merge / push / handoff。
14
-
15
- 必需输入:
16
- - `changes/<change-id>/review/spec-review.md`
17
- - `changes/<change-id>/review/quality-review.md`
18
- - `.agentdocs/tmp/aiws-validate/*.json`
19
- - 若存在:`changes/<change-id>/evidence/...`、`git status`
20
-
21
- 必需输出:
22
- - `证据(Evidence):` `changes/<change-id>/evidence/verify-before-complete.md` 或回退 `.agentdocs/tmp/review/verify-before-complete.md`
23
- - `结论(Result):` pass / fail
24
- - `缺失项(Missing):` 未满足的 gate
25
- - `下一步(Next):` 进入 `$ws-finish` / `$ws-handoff`,或回退前置 gate
26
-
27
- 阻断条件:
28
- - 缺少 spec review
29
- - 缺少 quality review
30
- - 缺少 validate stamp
31
- - review 中仍有未关闭 blocker
32
- - 无法写 verification 证据
33
-
34
- 完成判定:
35
- - 已落盘 verify-before-complete 证据,并明确能否进入 `$ws-finish` / `$ws-handoff`。
36
-
37
- 步骤(建议):
38
- 1) 识别当前 `change/<change-id>`。
39
- 2) 检查以下最小 gate:
40
- - `changes/<change-id>/review/spec-review.md`
41
- - `changes/<change-id>/review/quality-review.md`
42
- - `.agentdocs/tmp/aiws-validate/*.json`
43
- 3) 若存在 `changes/<change-id>/evidence/`,检查是否已经收敛 review / validate / collaboration summary。
44
- 4) 将结果落盘到:
45
- - 默认:`changes/<change-id>/evidence/verify-before-complete.md`
46
- - 回退:`.agentdocs/tmp/review/verify-before-complete.md`
47
- 5) 输出:
48
- - `证据(Evidence):`
49
- - `结论(Result): pass|fail`
50
- - `缺失项(Missing):`
51
- - `下一步(Next):`
52
-
53
- 重点:
54
- - 这个 gate 不替代 `$ws-finish`;它只判断“是否具备进入 finish / handoff 的前置条件”。
55
- - 若 fail,必须明确回退到哪个 gate:`$ws-spec-review`、`$ws-quality-review`、`aiws validate . --stamp` 或 `aiws change evidence <change-id>`。
56
-
57
- 安全:
58
- - 不打印 secrets。
59
- - 不执行破坏性命令。
10
+ ```bash
11
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
12
+ ./node_modules/.bin/aiws verify-bc
13
+ elif command -v aiws >/dev/null 2>&1; then
14
+ aiws verify-bc
15
+ else
16
+ npx @aipper/aiws verify-bc
17
+ fi
18
+ ```
@@ -30,3 +30,16 @@ if [[ -z "${aiws_bin:-}" ]]; then
30
30
  fi
31
31
 
32
32
  "$aiws_bin" validate .
33
+
34
+ # Quality gates (non-blocking warnings)
35
+ if [[ -f "package.json" ]] && grep -q '"lint"' package.json 2>/dev/null; then
36
+ npm run lint >/dev/null 2>&1 || echo "warn: lint found issues (non-blocking)" >&2
37
+ fi
38
+
39
+ if [[ -f "packages/aiws/package.json" ]] && grep -q '"build"' packages/aiws/package.json 2>/dev/null; then
40
+ npm run --workspace packages/aiws build >/dev/null 2>&1 || echo "warn: build/typecheck found issues (non-blocking)" >&2
41
+ fi
42
+
43
+ if [[ -f "package.json" ]] && grep -q '"test"' package.json 2>/dev/null; then
44
+ npm test >/dev/null 2>&1 || echo "warn: tests found issues (non-blocking)" >&2
45
+ fi
@@ -30,3 +30,10 @@ if [[ -z "${aiws_bin:-}" ]]; then
30
30
  fi
31
31
 
32
32
  "$aiws_bin" validate .
33
+
34
+ # Quality gates — non-blocking (failures downgraded to warning to avoid false positives)
35
+ if [[ -f "$root/package.json" ]]; then
36
+ npm --prefix "$root" run lint --if-present 2>/dev/null || echo "[aiws] lint: skipped or failed (non-blocking)" >&2
37
+ npm --prefix "$root" run typecheck --if-present 2>/dev/null || echo "[aiws] typecheck: skipped or failed (non-blocking)" >&2
38
+ npm --prefix "$root" test --if-present 2>/dev/null || echo "[aiws] test: skipped or failed (non-blocking)" >&2
39
+ fi
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: 自动 bootstrap:检查 update、确保 watchdog 已启动,并给出下一步
3
+ ---
4
+ <!-- AIWS_MANAGED_BEGIN:opencode:ws-auto -->
5
+ # ws auto
6
+
7
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
+
9
+ 目标:为当前 OpenCode 工作区执行一次显式 auto bootstrap,先补齐托管内容,再按条件启动 watchdog。
10
+
11
+ 执行建议:
12
+ 1) 先运行 `/ws-preflight`,确认 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md` 已读取。
13
+ 2) 在项目根运行 `aiws opencode auto .`。
14
+ 3) 输出:
15
+ - `Auto Bootstrap:`
16
+ - `Update:`
17
+ - `OpenCode mode:`
18
+ - `Watchdog:`
19
+ - `Next:`
20
+ 4) 若输出 `watchdog:` 为已启动状态:
21
+ - 若当前任务意图明确:继续 `/using-aiws`、`/ws-plan`、`/ws-dev` 或 `/ws-review`
22
+ - 若当前只是要声明自主协作合同:继续 `/ws-autonomy`
23
+ 5) 若输出 `watchdog: skipped (...)`:
24
+ - 明确写出原因
25
+ - 不要假装已经进入 autonomous 模式
26
+
27
+ 边界:
28
+ - 允许通过 `aiws update .` 刷新 AIWS 托管内容。
29
+ - 不自动复制 `.opencode/oh-my-opencode.json.example` 成真实配置。
30
+ - 不自动批准 host permission,不自动执行 tmux rescue。
31
+ <!-- AIWS_MANAGED_END:opencode:ws-auto -->
32
+
33
+ 可在下方追加本项目对 auto bootstrap 的额外说明(托管块外内容会被保留)。
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: 自主协作实验:声明 completion/retry/rescue 合同,并按需启用 tmux helper
3
+ ---
4
+ <!-- AIWS_MANAGED_BEGIN:opencode:ws-autonomy -->
5
+ # ws autonomy
6
+
7
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
+
9
+ 目标:声明当前 OpenCode/oMo 任务的 autonomous execution mode,并写清 completion/retry/rescue 合同。
10
+
11
+ 执行建议:
12
+ 1) 先运行 `/ws-preflight`,再读取 `packages/spec/docs/opencode-autonomous-swarm.md` 与 `packages/spec/docs/opencode-omo-adapter.md`。
13
+ 2) 输出:
14
+ - `Execution Mode: single-agent / omo-native / omo-native + tmux-swarm`
15
+ - `Completion Contract:`
16
+ - `Retry Contract:`
17
+ - `Rescue Policy:`
18
+ - `Evidence:`
19
+ 3) 若选择 `omo-native + tmux-swarm`:
20
+ - 先运行 `.opencode/helpers/tmux-swarm-scan.sh`
21
+ - 仅在需要安全白名单救援时运行 `.opencode/helpers/tmux-swarm-rescue.sh`
22
+ 4) 明确这是实验层,不接管 runtime controller,不替代 `ws-plan` / `ws-dev` / `ws-review`。
23
+ <!-- AIWS_MANAGED_END:opencode:ws-autonomy -->
24
+
25
+ 可在下方追加本项目对 autonomous swarm 的额外说明(托管块外内容会被保留)。
@@ -19,7 +19,11 @@ description: 评审:提交前审计改动并落盘证据
19
19
  3) 将审计落盘到(目录不存在则创建):
20
20
  - 默认:`changes/<change-id>/review/codex-review.md`
21
21
  - 回退:`.agentdocs/tmp/review/codex-review.md`(仅在无法确定 `change-id` 时使用)
22
- 4) 回复中输出:
22
+ 4) 若当前任务已进入“准备提交/交付/finish”的语境,继续补齐 dual review gate:
23
+ - 运行/收敛 `/ws-spec-review`,落盘 `changes/<change-id>/review/spec-review.md`
24
+ - 运行/收敛 `/ws-quality-review`,落盘 `changes/<change-id>/review/quality-review.md`
25
+ - 不要把单个 `codex-review.md` 误当成 finish gate 已完成
26
+ 5) 回复中输出:
23
27
  - `证据(Evidence):` 证据文件路径
24
28
  - `主要风险(Top risks):` 3–8 条(高→低)
25
29
  - `下一步(Next):` 最小修复清单 + 最小验证命令
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: 自动 bootstrap:检查 update、确保 watchdog 已启动,并给出下一步
3
+ ---
4
+ <!-- AIWS_MANAGED_BEGIN:opencode:ws-auto -->
5
+ # ws auto
6
+
7
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
+
9
+ 目标:为当前 OpenCode 工作区执行一次显式 auto bootstrap,先补齐托管内容,再按条件启动 watchdog。
10
+
11
+ 执行建议:
12
+ 1) 先运行 `/ws-preflight`,确认 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md` 已读取。
13
+ 2) 在项目根运行 `aiws opencode auto .`。
14
+ 3) 输出:
15
+ - `Auto Bootstrap:`
16
+ - `Update:`
17
+ - `OpenCode mode:`
18
+ - `Watchdog:`
19
+ - `Next:`
20
+ 4) 若输出 `watchdog:` 为已启动状态:
21
+ - 若当前任务意图明确:继续 `/using-aiws`、`/ws-plan`、`/ws-dev` 或 `/ws-review`
22
+ - 若当前只是要声明自主协作合同:继续 `/ws-autonomy`
23
+ 5) 若输出 `watchdog: skipped (...)`:
24
+ - 明确写出原因
25
+ - 不要假装已经进入 autonomous 模式
26
+
27
+ 边界:
28
+ - 允许通过 `aiws update .` 刷新 AIWS 托管内容。
29
+ - 不自动复制 `.opencode/oh-my-opencode.json.example` 成真实配置。
30
+ - 不自动批准 host permission,不自动执行 tmux rescue。
31
+ <!-- AIWS_MANAGED_END:opencode:ws-auto -->
32
+
33
+ 可在下方追加本项目对 auto bootstrap 的额外说明(托管块外内容会被保留)。
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: 自主协作实验:声明 completion/retry/rescue 合同,并按需启用 tmux helper
3
+ ---
4
+ <!-- AIWS_MANAGED_BEGIN:opencode:ws-autonomy -->
5
+ # ws autonomy
6
+
7
+ 用中文输出(命令/路径/代码标识符保持原样不翻译)。
8
+
9
+ 目标:声明当前 OpenCode/oMo 任务的 autonomous execution mode,并写清 completion/retry/rescue 合同。
10
+
11
+ 执行建议:
12
+ 1) 先运行 `/ws-preflight`,再读取 `packages/spec/docs/opencode-autonomous-swarm.md` 与 `packages/spec/docs/opencode-omo-adapter.md`。
13
+ 2) 输出:
14
+ - `Execution Mode: single-agent / omo-native / omo-native + tmux-swarm`
15
+ - `Completion Contract:`
16
+ - `Retry Contract:`
17
+ - `Rescue Policy:`
18
+ - `Evidence:`
19
+ 3) 若选择 `omo-native + tmux-swarm`:
20
+ - 先运行 `.opencode/helpers/tmux-swarm-scan.sh`
21
+ - 仅在需要安全白名单救援时运行 `.opencode/helpers/tmux-swarm-rescue.sh`
22
+ 4) 明确这是实验层,不接管 runtime controller,不替代 `ws-plan` / `ws-dev` / `ws-review`。
23
+ <!-- AIWS_MANAGED_END:opencode:ws-autonomy -->
24
+
25
+ 可在下方追加本项目对 autonomous swarm 的额外说明(托管块外内容会被保留)。
@@ -4,67 +4,15 @@ description: 提交:门禁/审计后提交(submodule 感知)
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-commit -->
5
5
  # ws commit
6
6
 
7
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+ Thin CLI wrapper. Delegates to `aiws commit`.
8
8
 
9
- 目标:在**当前分支可直提**的前提下,先做审计与门禁,并在存在 submodule 时给出正确的提交顺序(先 submodule,再 superproject),最后执行 `git commit`。
10
- 补充:若你经常遇到 submodule detached,建议日常拉取优先使用 `/ws-pull`(尽量把 submodule “挂回分支”且不改变 gitlink commit)。
11
-
12
- 安全约束(强制):
13
- - 不自动 `git add -A`;只在用户明确指示时才做 staging
14
- - 不使用 `--no-verify` 绕过 hooks
15
- - 不自动 push
16
- - 不打印 secrets
17
- - commit message 优先使用中文;若启用了 `.githooks/commit-msg`,默认仅提示,只有 strict 模式才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
18
-
19
- 步骤(建议):
20
- 1) 先运行 `/ws-preflight`。
21
- 2) 运行 `/ws-review`(优先落盘审计证据到 `changes/<change-id>/review/`)。
22
- 3) 运行门禁校验并写 stamp:
23
9
  ```bash
24
10
  if [[ -x "./node_modules/.bin/aiws" ]]; then
25
- ./node_modules/.bin/aiws validate . --stamp
11
+ ./node_modules/.bin/aiws commit -m "<message>"
26
12
  elif command -v aiws >/dev/null 2>&1; then
27
- aiws validate . --stamp
13
+ aiws commit -m "<message>"
28
14
  else
29
- npx @aipper/aiws validate . --stamp
30
- fi
31
- ```
32
- 4) 输出提交上下文(必须输出给用户确认):
33
- ```bash
34
- git branch --show-current
35
- git status --porcelain
36
- ```
37
- 5) submodule 感知检查:
38
- ```bash
39
- if [[ -f .gitmodules ]]; then
40
- git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' || true
15
+ npx @aipper/aiws commit -m "<message>"
41
16
  fi
42
- while read -r _ sub_path; do
43
- [[ -z "${sub_path:-}" ]] && continue
44
- echo "== submodule: ${sub_path} =="
45
- git -C "${sub_path}" rev-parse --abbrev-ref HEAD 2>/dev/null || true
46
- git -C "${sub_path}" status --porcelain || true
47
- done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
48
17
  ```
49
- 判定规则(强制):
50
- - 任一 submodule `git status --porcelain` 非空:停止提交 superproject;先在对应 submodule 完成 commit,再回到 superproject 更新并提交 gitlink。
51
- - 若该 submodule 当前为 detached HEAD:先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`。
52
- 6) 检查 staging(必须输出给用户确认):
53
- ```bash
54
- git status --porcelain
55
- git diff --staged --submodule=short
56
- ```
57
- 7) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
58
- 8) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
59
- 9) 执行提交(不带 `--no-verify`):
60
- ```bash
61
- git commit -m "<message>"
62
- ```
63
-
64
- 输出必须包含:
65
- - `证据(Evidence):` `changes/<change-id>/review/*`(无 change-id 时回退 `.agentdocs/tmp/review/*`) + `.agentdocs/tmp/aiws-validate/*`
66
- - `上下文(Context):` 当前分支 + 是否检测到 submodule + 若阻断则给出阻断原因
67
- - `下一步(Next):` 若存在 submodule 改动,先提示用户进入 submodule 提交
68
18
  <!-- AIWS_MANAGED_END:opencode:ws-commit -->
69
-
70
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -4,55 +4,15 @@ description: 交付:submodules+superproject 分步提交并安全合并回 bas
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-deliver -->
5
5
  # ws deliver
6
6
 
7
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+ Thin CLI wrapper. Delegates to `aiws deliver`.
8
8
 
9
- 目标:适配 superproject + submodule(数量不固定)的交付收尾,降低提交顺序和合并回 base 分支的出错概率:
10
- 1) 先逐个提交 submodule(每个 repo 单独确认 commit message;默认 `git add -p`)
11
- 2) 再提交 superproject(包含 submodule gitlink 指针更新 + 自身改动/变更工件)
12
- 3) 最后 fast-forward 合并回目标分支(复用 `aiws change finish`;建议用 `/ws-finish`)
13
-
14
- 强制约束:
15
- - 不自动 `git add -A`。
16
- - 不自动 push。
17
- - 不自动删除分支。
18
-
19
- 建议流程(按顺序):
20
- 1) 先运行 `/ws-preflight`。
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`。
25
- 2) 发现 submodules:
26
- - `git submodule status --recursive`
27
- 3) 逐个提交 submodules(按上一步顺序):
28
- - `git -C "<sub_path>" status --porcelain`
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>`
31
- - `git -C "<sub_path>" add -p`
32
- - `git -C "<sub_path>" diff --staged --stat`
33
- - 生成并让用户确认该 submodule 的 commit message(每个 repo 单独确认)
34
- - `git -C "<sub_path>" commit -m "<message>"`
35
- 4) 提交 superproject(gitlinks + 自身改动):
36
- - `git diff --submodule`
37
- - `git add <submodule-path-1> <submodule-path-2> ...`
38
- - `git add -p`
39
- - 生成并让用户确认 superproject 的 commit message
40
- - `git commit -m "<message>"`
41
- 5) (推荐)门禁 + 证据:
42
- - `aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)
43
- 5.1) (强烈建议)生成持久证据并回填 `Evidence_Path`:
44
- - `aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)
45
- 5.2) (可选)生成状态快照(建议):
46
- - `aiws change state <change-id> --write`
47
- 6) 安全合并回目标分支:
48
- - 优先运行 `/ws-finish`(底层调用 `aiws change finish`,默认 `--ff-only`;push 成功后会清理对应 change worktree)
49
-
50
- 输出要求:
51
- - `Submodules:` 每个 submodule 的 commit 摘要(repo/path → sha → message)
52
- - `Superproject:` commit 摘要
53
- - `Merge:` `/ws-finish` 输出(into/from)
54
- - `Worktree cleanup:` 若存在独立 change worktree,输出清理结果(removed/skipped + reason)
55
- - `Evidence:` `.agentdocs/tmp/aiws-validate/*.json`(若使用 --stamp)
9
+ ```bash
10
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
11
+ ./node_modules/.bin/aiws deliver -m "<message>"
12
+ elif command -v aiws >/dev/null 2>&1; then
13
+ aiws deliver -m "<message>"
14
+ else
15
+ npx @aipper/aiws deliver -m "<message>"
16
+ fi
17
+ ```
56
18
  <!-- AIWS_MANAGED_END:opencode:ws-deliver -->
57
-
58
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: 收尾:fast-forward 合并并把 submodule 并回目标分支后顺序 push
2
+ description: 收尾:fast-forward 合并并把 submodule 并回目标分支后顺序 push。完成后标记 finish 阶段为 DONE
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-finish -->
5
5
  # ws finish
@@ -70,6 +70,14 @@ fi
70
70
  安全:
71
71
  - push 前先输出状态并说明远端/分支。
72
72
  - 不执行破坏性命令。
73
- <!-- AIWS_MANAGED_END:opencode:ws-finish -->
74
73
 
75
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
74
+ ```bash
75
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
76
+ ./node_modules/.bin/aiws finish
77
+ elif command -v aiws >/dev/null 2>&1; then
78
+ aiws finish
79
+ else
80
+ npx @aipper/aiws finish
81
+ fi
82
+ ```
83
+ <!-- AIWS_MANAGED_END:opencode:ws-finish -->
@@ -1,26 +1,18 @@
1
1
  ---
2
- description: 交接:查看归档 change 的 handoff.md(标准由 aiws change finish --push 自动归档生成)
2
+ description: 交接:查看归档 change 的 handoff.md
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-handoff -->
5
5
  # ws handoff
6
6
 
7
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+ Thin CLI wrapper. Delegates to `aiws handoff`.
8
8
 
9
- 目标:
10
- - 交接与回放:通过 `handoff.md` 让已归档的 change 可被下一位/下一次会话快速接力。
11
- - handoff 文件位置:`changes/archive/<date>-<change-id>/handoff.md`(默认由 `aiws change finish --push` 自动归档时生成)。
12
-
13
- 执行建议:
14
- 1) 先确认 change 已通过 `/ws-finish` 或 `aiws change finish --push` 完成自动归档。
15
- 2) 查看 handoff:
16
9
  ```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
10
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
11
+ ./node_modules/.bin/aiws handoff
12
+ elif command -v aiws >/dev/null 2>&1; then
13
+ aiws handoff
14
+ else
15
+ npx @aipper/aiws handoff
16
+ fi
20
17
  ```
21
- 3) 依赖提示:
22
- - 若你在某个 change 的 `proposal.md` 声明了 `Depends_On`,`aiws change start` 会尝试读取依赖 change 的 `handoff.md` 并输出摘要(前提:依赖已归档且 handoff 存在)。
23
- - 若是历史/异常场景尚未归档,再手工运行 `/p-aiws-change-archive`。
24
18
  <!-- AIWS_MANAGED_END:opencode:ws-handoff -->
25
-
26
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -4,22 +4,15 @@ description: 迁移:把仓库对齐到 aiws workspace 模板
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-migrate -->
5
5
  # ws migrate
6
6
 
7
- 用中文输出;命令与路径保持原样不翻译。
7
+ Thin CLI wrapper. Delegates to `aiws migrate`.
8
8
 
9
- 目标:把当前仓库补齐为 aiws workspace 模板,并启用可验证门禁。
10
-
11
- 执行(在项目根目录):
12
- 1) 若已存在 `.aiws/manifest.json`:`npx @aipper/aiws update .`
13
- 2) 否则:`npx @aipper/aiws init .`
14
- 3) 门禁校验:`npx @aipper/aiws validate .`
15
- 4) 启用本机 git hooks(推荐,本地生效):`git config core.hooksPath .githooks`
16
-
17
- 回滚:
18
- - 恢复最近一次快照:`npx @aipper/aiws rollback . latest`
19
-
20
- 约束:
21
- - 不写入任何 secrets。
22
- - 不执行破坏性命令。
9
+ ```bash
10
+ if [[ -x "./node_modules/.bin/aiws" ]]; then
11
+ ./node_modules/.bin/aiws migrate
12
+ elif command -v aiws >/dev/null 2>&1; then
13
+ aiws migrate
14
+ else
15
+ npx @aipper/aiws migrate
16
+ fi
17
+ ```
23
18
  <!-- AIWS_MANAGED_END:opencode:ws-migrate -->
24
-
25
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
@@ -1,28 +1,18 @@
1
1
  ---
2
- description: 计划质检:执行前检查并给出最小修正项
2
+ description: 计划质检:执行前检查并给出最小修正项。通过后标记 plan 阶段为 DONE
3
3
  ---
4
4
  <!-- AIWS_MANAGED_BEGIN:opencode:ws-plan-verify -->
5
5
  # ws plan verify
6
6
 
7
- 用中文输出(命令/路径/代码标识符保持原样不翻译)。
7
+ Thin CLI wrapper. Delegates to `aiws plan-verify`.
8
8
 
9
- 目标:
10
- - 执行前检查计划是否跑偏,并给出最小修正项。
11
-
12
- 执行建议:
13
- 1) 先运行 `/ws-preflight`。
14
- 2) 运行严格门禁:
15
9
  ```bash
16
10
  if [[ -x "./node_modules/.bin/aiws" ]]; then
17
- ./node_modules/.bin/aiws change validate <change-id> --strict
11
+ ./node_modules/.bin/aiws plan-verify
18
12
  elif command -v aiws >/dev/null 2>&1; then
19
- aiws change validate <change-id> --strict
13
+ aiws plan-verify
20
14
  else
21
- npx @aipper/aiws change validate <change-id> --strict
15
+ npx @aipper/aiws plan-verify
22
16
  fi
23
17
  ```
24
- 3) 若失败:先修 `proposal.md` / `plan` 的绑定字段与验证命令,再复跑。
25
- 4) 通过后再进入 `/ws-dev`。
26
18
  <!-- AIWS_MANAGED_END:opencode:ws-plan-verify -->
27
-
28
- 可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。