@aipper/aiws-spec 0.0.23 → 0.0.25
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.
- package/README.md +22 -0
- package/docs/aiws-bootstrap-routing-design.md +138 -0
- package/docs/aiws-governance-positioning.md +69 -0
- package/docs/cli-interface.md +87 -5
- package/docs/collaboration-artifacts.md +62 -0
- package/docs/opencode-omo-adapter.md +135 -0
- package/docs/opencode-omo-validation-checklist.md +90 -0
- package/docs/spec-contract.md +26 -11
- package/docs/superpowers-collaboration-adoption.md +92 -0
- package/docs/workflow-delegation-contracts.json +274 -0
- package/docs/workflow-delegation-contracts.md +248 -0
- package/docs/workflow-delegation-contracts.schema.json +176 -0
- package/docs/workflow-governance-rules.json +294 -0
- package/docs/workflow-governance-rules.md +63 -0
- package/docs/workflow-governance-rules.schema.json +182 -0
- package/docs/workflow-review-gates.json +72 -0
- package/docs/workflow-review-gates.md +36 -0
- package/docs/workflow-review-gates.schema.json +67 -0
- package/docs/workflow-router-rules.json +196 -0
- package/docs/workflow-router-rules.md +83 -0
- package/docs/workflow-router-rules.schema.json +119 -0
- package/docs/workflow-stage-contracts.json +148 -0
- package/docs/workflow-stage-contracts.md +70 -0
- package/docs/workflow-stage-contracts.schema.json +98 -0
- package/package.json +1 -1
- package/templates/workspace/.agents/skills/using-aiws/SKILL.md +83 -0
- package/templates/workspace/.agents/skills/ws-bugfix/SKILL.md +30 -7
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +26 -1
- package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +75 -0
- package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +46 -9
- package/templates/workspace/.agents/skills/ws-dev/SKILL.md +81 -11
- package/templates/workspace/.agents/skills/ws-finish/SKILL.md +101 -60
- package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +126 -0
- package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +22 -1
- package/templates/workspace/.agents/skills/ws-plan/SKILL.md +61 -2
- package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +20 -0
- package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +23 -0
- package/templates/workspace/.agents/skills/ws-quality-review/SKILL.md +56 -0
- package/templates/workspace/.agents/skills/ws-review/SKILL.md +24 -0
- package/templates/workspace/.agents/skills/ws-spec-review/SKILL.md +57 -0
- package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +59 -0
- package/templates/workspace/.claude/commands/using-aiws.md +24 -0
- package/templates/workspace/.claude/commands/ws-bugfix.md +11 -6
- package/templates/workspace/.claude/commands/ws-commit.md +2 -1
- package/templates/workspace/.claude/commands/ws-deliver.md +6 -2
- package/templates/workspace/.claude/commands/ws-dev.md +5 -2
- package/templates/workspace/.claude/commands/ws-finish.md +19 -19
- package/templates/workspace/.claude/commands/ws-plan.md +9 -5
- package/templates/workspace/.claude/commands/ws-quality-review.md +24 -0
- package/templates/workspace/.claude/commands/ws-spec-review.md +24 -0
- package/templates/workspace/.claude/commands/ws-verify-before-complete.md +24 -0
- package/templates/workspace/.claude/skills/p-aiws-change-archive/SKILL.md +24 -0
- package/templates/workspace/.claude/skills/p-aiws-change-finish/SKILL.md +24 -0
- package/templates/workspace/.claude/skills/p-aiws-change-list/SKILL.md +18 -0
- package/templates/workspace/.claude/skills/p-aiws-change-new/SKILL.md +26 -0
- package/templates/workspace/.claude/skills/p-aiws-change-next/SKILL.md +19 -0
- package/templates/workspace/.claude/skills/p-aiws-change-start/SKILL.md +33 -0
- package/templates/workspace/.claude/skills/p-aiws-change-status/SKILL.md +19 -0
- package/templates/workspace/.claude/skills/p-aiws-change-sync/SKILL.md +19 -0
- package/templates/workspace/.claude/skills/p-aiws-change-templates-init/SKILL.md +18 -0
- package/templates/workspace/.claude/skills/p-aiws-change-templates-which/SKILL.md +18 -0
- package/templates/workspace/.claude/skills/p-aiws-change-validate/SKILL.md +23 -0
- package/templates/workspace/.claude/skills/p-aiws-hooks-install/SKILL.md +30 -0
- package/templates/workspace/.claude/skills/p-aiws-hooks-status/SKILL.md +18 -0
- package/templates/workspace/.claude/skills/p-aiws-init/SKILL.md +27 -0
- package/templates/workspace/.claude/skills/p-aiws-rollback/SKILL.md +18 -0
- package/templates/workspace/.claude/skills/p-aiws-update/SKILL.md +26 -0
- package/templates/workspace/.claude/skills/p-aiws-validate/SKILL.md +22 -0
- package/templates/workspace/.claude/skills/p-tasks-plan/SKILL.md +37 -0
- package/templates/workspace/.claude/skills/using-aiws/SKILL.md +83 -0
- package/templates/workspace/.claude/skills/ws-analyze/SKILL.md +26 -0
- package/templates/workspace/.claude/skills/ws-bugfix/SKILL.md +111 -0
- package/templates/workspace/.claude/skills/ws-commit/SKILL.md +127 -0
- package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +231 -0
- package/templates/workspace/.claude/skills/ws-dev/SKILL.md +168 -0
- package/templates/workspace/.claude/skills/ws-finish/SKILL.md +220 -0
- package/templates/workspace/.claude/skills/ws-frontend-design/SKILL.md +126 -0
- package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +52 -0
- package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +54 -0
- package/templates/workspace/.claude/skills/ws-plan/SKILL.md +138 -0
- package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +61 -0
- package/templates/workspace/.claude/skills/ws-preflight/SKILL.md +55 -0
- package/templates/workspace/.claude/skills/ws-pull/SKILL.md +119 -0
- package/templates/workspace/.claude/skills/ws-push/SKILL.md +110 -0
- package/templates/workspace/.claude/skills/ws-quality-review/SKILL.md +56 -0
- package/templates/workspace/.claude/skills/ws-req-change/SKILL.md +41 -0
- package/templates/workspace/.claude/skills/ws-req-contract-sync/SKILL.md +17 -0
- package/templates/workspace/.claude/skills/ws-req-contract-validate/SKILL.md +12 -0
- package/templates/workspace/.claude/skills/ws-req-flow-sync/SKILL.md +28 -0
- package/templates/workspace/.claude/skills/ws-req-review/SKILL.md +32 -0
- package/templates/workspace/.claude/skills/ws-review/SKILL.md +50 -0
- package/templates/workspace/.claude/skills/ws-rule/SKILL.md +23 -0
- package/templates/workspace/.claude/skills/ws-spec-review/SKILL.md +57 -0
- package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +65 -0
- package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +59 -0
- package/templates/workspace/.codex/prompts/ws-dev.md +5 -1
- package/templates/workspace/.githooks/commit-msg +109 -0
- package/templates/workspace/.iflow/commands/ws-commit.toml +2 -1
- package/templates/workspace/.iflow/commands/ws-deliver.toml +6 -2
- package/templates/workspace/.iflow/commands/ws-finish.toml +19 -19
- package/templates/workspace/.opencode/command/using-aiws.md +29 -0
- package/templates/workspace/.opencode/command/ws-bugfix.md +11 -6
- package/templates/workspace/.opencode/command/ws-commit.md +2 -1
- package/templates/workspace/.opencode/command/ws-delegate.md +33 -0
- package/templates/workspace/.opencode/command/ws-deliver.md +6 -2
- package/templates/workspace/.opencode/command/ws-dev.md +5 -2
- package/templates/workspace/.opencode/command/ws-finish.md +19 -19
- package/templates/workspace/.opencode/command/ws-plan.md +12 -5
- package/templates/workspace/.opencode/command/ws-preflight.md +4 -0
- package/templates/workspace/.opencode/command/ws-quality-review.md +30 -0
- package/templates/workspace/.opencode/command/ws-review.md +3 -0
- package/templates/workspace/.opencode/command/ws-spec-review.md +30 -0
- package/templates/workspace/.opencode/command/ws-verify-before-complete.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-archive.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-finish.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-list.md +26 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-new.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-next.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-start.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-status.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-sync.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-templates-init.md +26 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-templates-which.md +26 -0
- package/templates/workspace/.opencode/commands/p-aiws-change-validate.md +27 -0
- package/templates/workspace/.opencode/commands/p-aiws-hooks-install.md +26 -0
- package/templates/workspace/.opencode/commands/p-aiws-hooks-status.md +26 -0
- package/templates/workspace/.opencode/commands/p-aiws-init.md +23 -0
- package/templates/workspace/.opencode/commands/p-aiws-rollback.md +16 -0
- package/templates/workspace/.opencode/commands/p-aiws-update.md +22 -0
- package/templates/workspace/.opencode/commands/p-aiws-validate.md +17 -0
- package/templates/workspace/.opencode/commands/using-aiws.md +29 -0
- package/templates/workspace/.opencode/commands/ws-analyze.md +30 -0
- package/templates/workspace/.opencode/commands/ws-bugfix.md +35 -0
- package/templates/workspace/.opencode/commands/ws-commit.md +70 -0
- package/templates/workspace/.opencode/commands/ws-delegate.md +33 -0
- package/templates/workspace/.opencode/commands/ws-deliver.md +58 -0
- package/templates/workspace/.opencode/commands/ws-dev.md +36 -0
- package/templates/workspace/.opencode/commands/ws-finish.md +71 -0
- package/templates/workspace/.opencode/commands/ws-handoff.md +25 -0
- package/templates/workspace/.opencode/commands/ws-migrate.md +25 -0
- package/templates/workspace/.opencode/commands/ws-plan-verify.md +28 -0
- package/templates/workspace/.opencode/commands/ws-plan.md +27 -0
- package/templates/workspace/.opencode/commands/ws-preflight.md +34 -0
- package/templates/workspace/.opencode/commands/ws-pull.md +87 -0
- package/templates/workspace/.opencode/commands/ws-push.md +93 -0
- package/templates/workspace/.opencode/commands/ws-quality-review.md +30 -0
- package/templates/workspace/.opencode/commands/ws-req-change.md +45 -0
- package/templates/workspace/.opencode/commands/ws-req-contract-sync.md +21 -0
- package/templates/workspace/.opencode/commands/ws-req-contract-validate.md +16 -0
- package/templates/workspace/.opencode/commands/ws-req-flow-sync.md +23 -0
- package/templates/workspace/.opencode/commands/ws-req-review.md +36 -0
- package/templates/workspace/.opencode/commands/ws-review.md +33 -0
- package/templates/workspace/.opencode/commands/ws-rule.md +27 -0
- package/templates/workspace/.opencode/commands/ws-spec-review.md +30 -0
- package/templates/workspace/.opencode/commands/ws-submodule-setup.md +57 -0
- package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +27 -0
- package/templates/workspace/.opencode/oh-my-opencode.json.example +17 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-archive/SKILL.md +24 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-finish/SKILL.md +24 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-list/SKILL.md +18 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-new/SKILL.md +26 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-next/SKILL.md +19 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-start/SKILL.md +33 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-status/SKILL.md +19 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-sync/SKILL.md +19 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-templates-init/SKILL.md +18 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-templates-which/SKILL.md +18 -0
- package/templates/workspace/.opencode/skills/p-aiws-change-validate/SKILL.md +23 -0
- package/templates/workspace/.opencode/skills/p-aiws-hooks-install/SKILL.md +30 -0
- package/templates/workspace/.opencode/skills/p-aiws-hooks-status/SKILL.md +18 -0
- package/templates/workspace/.opencode/skills/p-aiws-init/SKILL.md +27 -0
- package/templates/workspace/.opencode/skills/p-aiws-rollback/SKILL.md +18 -0
- package/templates/workspace/.opencode/skills/p-aiws-update/SKILL.md +26 -0
- package/templates/workspace/.opencode/skills/p-aiws-validate/SKILL.md +22 -0
- package/templates/workspace/.opencode/skills/p-tasks-plan/SKILL.md +37 -0
- package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +87 -0
- package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +26 -0
- package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +111 -0
- package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +127 -0
- package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +63 -0
- package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +231 -0
- package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +168 -0
- package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +220 -0
- package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +126 -0
- package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +52 -0
- package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +54 -0
- package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +148 -0
- package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +61 -0
- package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +60 -0
- package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +119 -0
- package/templates/workspace/.opencode/skills/ws-push/SKILL.md +110 -0
- package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +63 -0
- package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +41 -0
- package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +17 -0
- package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +12 -0
- package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +28 -0
- package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +32 -0
- package/templates/workspace/.opencode/skills/ws-review/SKILL.md +57 -0
- package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +23 -0
- package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +64 -0
- package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +65 -0
- package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +59 -0
- package/templates/workspace/AGENTS.md +72 -29
- package/templates/workspace/AI_WORKSPACE.md +4 -4
- package/templates/workspace/changes/README.md +26 -2
- package/templates/workspace/changes/templates/proposal.md +15 -0
- package/templates/workspace/changes/templates/tasks.md +9 -2
- package/templates/workspace/manifest.json +279 -2
- package/templates/workspace/tools/ws_change_check.py +27 -5
- package/templates/workspace/tools/ws_resolve_sub_target.sh +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-submodule-setup
|
|
3
|
+
description: 子模块分支对齐(写入 .gitmodules 的 submodule.<name>.branch;减少 detached 与人为差异)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 为每个 submodule 写入 `.gitmodules` 的 `submodule.<name>.branch`,让 `ws-pull` / `ws-finish` 能确定性地“挂回分支/fast-forward push”,避免 origin 多分支时靠猜导致偏差。
|
|
10
|
+
- 该变更是 **superproject 的团队真值**:需要提交 `.gitmodules`。
|
|
11
|
+
|
|
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
|
+
```bash
|
|
44
|
+
# Example:
|
|
45
|
+
# git submodule set-branch --branch main path/to/submodule
|
|
46
|
+
# git submodule set-branch --branch . path/to/submodule
|
|
47
|
+
```
|
|
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
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-verify-before-complete
|
|
3
|
+
description: 完成前验证(finish / handoff 前检查双审查与 validate/evidence 是否齐全)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 在进入 `$ws-finish` / `$ws-handoff` 前,检查 review、validate stamp 和证据是否齐全
|
|
10
|
+
- 输出明确的 pass/fail 结论,避免“看起来完成了但 gate 没过”的伪完成
|
|
11
|
+
|
|
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
|
+
- 不执行破坏性命令。
|
|
@@ -12,8 +12,12 @@ argument-hint: ""
|
|
|
12
12
|
|
|
13
13
|
建议流程:
|
|
14
14
|
1) 先运行 `/ws-preflight`(读真值文件并输出约束摘要)。
|
|
15
|
+
- 若 `$ws-plan` 刚创建了 `change/<change-id>` worktree:后续实现必须在该 worktree 中继续;不要回原工作区重复 `aiws change start ...`
|
|
15
16
|
2) 建立变更归因(推荐):
|
|
16
|
-
-
|
|
17
|
+
- 若当前目录已经是 `change/<change-id>` worktree(例如由 `$ws-plan` 创建):直接在这里继续,不要再创建第二个 worktree,也不要回原工作区写代码。
|
|
18
|
+
- 若 `/ws-plan` 已生成 `plan/...` 或 `changes/<change-id>/...` 导致工作区非空,这是预期行为;此时不要直接再做 `--switch/--worktree`,优先:`aiws change start <change-id> --hooks --no-switch`,或先提交规划工件。
|
|
19
|
+
- 推荐一键(工作区干净时):`aiws change start <change-id> --hooks`
|
|
20
|
+
- 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`
|
|
17
21
|
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --worktree --submodules`
|
|
18
22
|
- 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
|
|
19
23
|
- 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
if [[ "${WS_CHANGE_HOOK_BYPASS:-0}" == "1" ]]; then
|
|
5
|
+
echo "warn: WS_CHANGE_HOOK_BYPASS=1; skip aiws commit-msg hook" >&2
|
|
6
|
+
exit 0
|
|
7
|
+
fi
|
|
8
|
+
|
|
9
|
+
msg_file="${1:-}"
|
|
10
|
+
[[ -n "${msg_file:-}" && -f "$msg_file" ]] || exit 0
|
|
11
|
+
|
|
12
|
+
policy="${AIWS_COMMIT_MSG_POLICY:-}"
|
|
13
|
+
if [[ -z "${policy:-}" ]]; then
|
|
14
|
+
policy="$(git config --get aiws.commitMessagePolicy 2>/dev/null || true)"
|
|
15
|
+
fi
|
|
16
|
+
policy="${policy:-warn}"
|
|
17
|
+
|
|
18
|
+
case "$policy" in
|
|
19
|
+
off|disabled|0)
|
|
20
|
+
exit 0
|
|
21
|
+
;;
|
|
22
|
+
warn|prefer-zh)
|
|
23
|
+
policy="warn"
|
|
24
|
+
;;
|
|
25
|
+
strict|require-zh|1)
|
|
26
|
+
policy="strict"
|
|
27
|
+
;;
|
|
28
|
+
*)
|
|
29
|
+
echo "warn: unknown aiws commit message policy '${policy}', fallback to warn" >&2
|
|
30
|
+
policy="warn"
|
|
31
|
+
;;
|
|
32
|
+
esac
|
|
33
|
+
|
|
34
|
+
first_line="$(sed -n '1{s/\r$//;p;q;}' "$msg_file")"
|
|
35
|
+
first_line="${first_line#"${first_line%%[![:space:]]*}"}"
|
|
36
|
+
first_line="${first_line%"${first_line##*[![:space:]]}"}"
|
|
37
|
+
|
|
38
|
+
[[ -n "${first_line:-}" ]] || exit 0
|
|
39
|
+
|
|
40
|
+
case "$first_line" in
|
|
41
|
+
Merge\ *|Revert\ *|fixup!\ *|squash!\ *)
|
|
42
|
+
exit 0
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
|
|
46
|
+
has_cjk=1
|
|
47
|
+
if command -v python3 >/dev/null 2>&1; then
|
|
48
|
+
if python3 - "$first_line" <<'PY'
|
|
49
|
+
import re
|
|
50
|
+
import sys
|
|
51
|
+
|
|
52
|
+
line = sys.argv[1].strip()
|
|
53
|
+
sys.exit(0 if re.search(r"[\u3400-\u9fff]", line) else 1)
|
|
54
|
+
PY
|
|
55
|
+
then
|
|
56
|
+
has_cjk=0
|
|
57
|
+
fi
|
|
58
|
+
else
|
|
59
|
+
if printf '%s\n' "$first_line" | grep -q '[一-龥]'; then
|
|
60
|
+
has_cjk=0
|
|
61
|
+
fi
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
if [[ "$has_cjk" -eq 0 ]]; then
|
|
65
|
+
exit 0
|
|
66
|
+
fi
|
|
67
|
+
|
|
68
|
+
if [[ "$policy" == "warn" ]]; then
|
|
69
|
+
cat >&2 <<'EOF'
|
|
70
|
+
warn: commit message is better in Chinese, but English is still allowed.
|
|
71
|
+
|
|
72
|
+
hint:
|
|
73
|
+
- preferred format: 修复: 登录页空指针
|
|
74
|
+
- or: 功能: 新增 submodule targets 校验
|
|
75
|
+
- if you are in AI tools, prefer: $ws-commit / /ws-commit / ws:commit
|
|
76
|
+
- set strict mode if needed: git config aiws.commitMessagePolicy strict
|
|
77
|
+
- disable this reminder: git config aiws.commitMessagePolicy off
|
|
78
|
+
|
|
79
|
+
allowed exceptions:
|
|
80
|
+
- Merge ...
|
|
81
|
+
- Revert ...
|
|
82
|
+
- fixup! ...
|
|
83
|
+
- squash! ...
|
|
84
|
+
EOF
|
|
85
|
+
|
|
86
|
+
echo "message: ${first_line}" >&2
|
|
87
|
+
exit 0
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
cat >&2 <<'EOF'
|
|
91
|
+
error: commit message should be in Chinese (strict mode).
|
|
92
|
+
|
|
93
|
+
hint:
|
|
94
|
+
- use format: 修复: 登录页空指针
|
|
95
|
+
- or: 功能: 新增 submodule targets 校验
|
|
96
|
+
- if you are in AI tools, prefer: $ws-commit / /ws-commit / ws:commit
|
|
97
|
+
- downgrade to warn: git config aiws.commitMessagePolicy warn
|
|
98
|
+
- disable only when necessary: git config aiws.commitMessagePolicy off
|
|
99
|
+
- bypass only when necessary: WS_CHANGE_HOOK_BYPASS=1 git commit ...
|
|
100
|
+
|
|
101
|
+
allowed exceptions:
|
|
102
|
+
- Merge ...
|
|
103
|
+
- Revert ...
|
|
104
|
+
- fixup! ...
|
|
105
|
+
- squash! ...
|
|
106
|
+
EOF
|
|
107
|
+
|
|
108
|
+
echo "message: ${first_line}" >&2
|
|
109
|
+
exit 1
|
|
@@ -16,6 +16,7 @@ prompt = """
|
|
|
16
16
|
- 不使用 `--no-verify` 绕过 hooks
|
|
17
17
|
- 不自动 push
|
|
18
18
|
- 不打印 secrets
|
|
19
|
+
- commit message 优先使用中文;若启用了 `.githooks/commit-msg`,默认仅提示,只有 strict 模式才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
|
|
19
20
|
|
|
20
21
|
强制步骤:
|
|
21
22
|
1) 读取真值文件:`AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`(缺失则先运行 `/aiws-init` 或 `aiws init .`)。
|
|
@@ -36,7 +37,7 @@ prompt = """
|
|
|
36
37
|
- `git status --porcelain`
|
|
37
38
|
- `git diff --staged --submodule=short`
|
|
38
39
|
8) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
|
|
39
|
-
9)
|
|
40
|
+
9) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
|
|
40
41
|
10) 执行提交(不带 `--no-verify`):`git commit -m "<message>"`。
|
|
41
42
|
|
|
42
43
|
输出必须包含:
|
|
@@ -8,7 +8,7 @@ description = "交付(submodules + superproject 分步提交,并安全合并
|
|
|
8
8
|
prompt = """
|
|
9
9
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
10
|
|
|
11
|
-
目标:适配 superproject + submodule
|
|
11
|
+
目标:适配 superproject + submodule(数量不固定)的交付收尾,降低提交顺序和合并回 base 分支的出错概率:
|
|
12
12
|
1) 先逐个提交 submodule(每个 repo 单独确认 commit message;默认 `git add -p`)
|
|
13
13
|
2) 再提交 superproject(包含 submodule gitlink 指针更新 + 自身改动/变更工件)
|
|
14
14
|
3) 最后 fast-forward 合并回目标分支(复用 `aiws change finish`;建议用 `ws:finish`)
|
|
@@ -21,11 +21,15 @@ prompt = """
|
|
|
21
21
|
建议流程(按顺序):
|
|
22
22
|
1) 先确认真值文件存在并遵守:`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
|
|
23
23
|
2) 如果存在 `.gitmodules` 但缺少 `submodule.<name>.branch`,先运行 `ws:submodule-setup` 并提交 `.gitmodules`(否则 `aiws validate .` 会失败,且 submodule 工作流会产生人为差异)。
|
|
24
|
+
2.1) 若存在 submodule:必须准备 `changes/<change-id>/submodules.targets`,并覆盖所有 submodule path;这是本次交付的目标分支真值。
|
|
25
|
+
- 生成该文件时可先做默认预填:detached HEAD 默认建议取 `.gitmodules` 声明分支;已附着在本地分支时默认建议取当前分支。
|
|
26
|
+
- 上述都只是建议值;真正的 deliver/finish 只认 `submodules.targets`。
|
|
24
27
|
2) 发现 submodules:
|
|
25
28
|
- `git submodule status --recursive`
|
|
26
29
|
3) 逐个提交 submodules(按上一步顺序):
|
|
27
30
|
- `git -C "<sub_path>" status --porcelain`
|
|
28
|
-
-
|
|
31
|
+
- 先说明该 submodule 目标分支的来源:attached branch 默认建议取当前分支;detached HEAD 默认建议取 `.gitmodules`;若与 `submodules.targets` 已落盘值冲突,则以 `submodules.targets` 为准
|
|
32
|
+
- 若当前为 detached HEAD:不要直接切 `change/<change-id>` / `main` / `master`;先按 `submodules.targets`(若分支为 `.` 则展开为 `.ws-change.json` 的 `base_branch`)挂到 `aiws/pin/<target-branch>`
|
|
29
33
|
- `git -C "<sub_path>" add -p`
|
|
30
34
|
- `git -C "<sub_path>" diff --staged --stat`
|
|
31
35
|
- 生成并让用户确认该 submodule 的 commit message(每个 repo 单独确认)
|
|
@@ -22,33 +22,33 @@ prompt = """
|
|
|
22
22
|
5) (推荐)门禁校验并落盘证据:`aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)。
|
|
23
23
|
5.1) (强烈建议)收敛持久证据并回填 `Evidence_Path`:`aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)。
|
|
24
24
|
5.2) (可选)生成状态快照(建议):`aiws change state <change-id> --write`。
|
|
25
|
-
6)
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
6) 若不存在 `.gitmodules`,或 submodules 已按顺序处理完成,优先直接执行最小收尾闭环:
|
|
26
|
+
- `aiws change finish <change-id> --push`
|
|
27
|
+
- 在 `change/<change-id>` 分支上也可省略 `<change-id>`;命令会尝试读取 `changes/<change-id>/.ws-change.json` 的 `base_branch`
|
|
28
|
+
- 该命令会在 fast-forward 合并成功后 push 目标分支;默认优先使用 upstream 配置(`branch.<name>.remote` + `branch.<name>.merge`),只有在你明确知道要推向别的 remote 时才追加 `--remote <name>`
|
|
29
|
+
- 若 `change/<change-id>` 位于独立 worktree,且该 worktree 干净,则会在 push 成功后自动执行 `git worktree remove` + `git worktree prune`
|
|
30
|
+
- AI 入口执行前,应先向用户说明将要 push 的 remote/branch;显式传入 `--push` 即视为确认
|
|
31
|
+
7) 若提示无法 fast-forward:先在 change 分支(或对应 worktree)里执行 `git rebase <target-branch>`,再重试 `aiws change finish --push`。
|
|
32
|
+
8) 若需要先处理 submodules,则按顺序处理每个 submodule(先并回目标分支,再 push):
|
|
33
|
+
- 先显式解析 base branch,不要用当前分支名替代:
|
|
34
|
+
- `python3 - <<'PY'`
|
|
35
|
+
- `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())`
|
|
36
|
+
- `PY`
|
|
30
37
|
- 发现 submodules:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
|
|
31
38
|
- 对每个 `<sub_path>`:
|
|
32
39
|
- 读取 superproject 当前 gitlink:`git rev-parse "HEAD:<sub_path>"`
|
|
33
|
-
-
|
|
34
|
-
-
|
|
40
|
+
- 目标分支真值:`changes/<change-id>/submodules.targets`;若条目里分支写 `.`,则展开为刚才解析出的 `base_branch`
|
|
41
|
+
- 生成/检查 `submodules.targets` 时,detached HEAD 默认建议取 `.gitmodules` 的 `submodule.<name>.branch`;已附着在本地分支时默认建议取当前分支;这些都只是预填建议,不是 finish/push 的运行时真值
|
|
42
|
+
- 不要直接切 `change/<change-id>` / `main` / `master` 来解 detached
|
|
35
43
|
- 用 pin 分支挂回(不改动现有 main/master 指针):`git -C "<sub_path>" checkout -B "aiws/pin/<target-branch>" <gitlink-sha>`
|
|
36
44
|
- 仅当 `<gitlink-sha>` 属于 `origin/<target-branch>` 历史时才允许 push;否则停止并人工处理分叉
|
|
37
45
|
- push(只允许 fast-forward):`git -C "<sub_path>" push origin "<gitlink-sha>:refs/heads/<target-branch>"`
|
|
38
46
|
9) 任一 submodule 不满足 fast-forward 条件时立即停止(不要继续 push 主仓库)。
|
|
39
|
-
10) submodules push
|
|
40
|
-
- `
|
|
41
|
-
|
|
42
|
-
- `git push`
|
|
43
|
-
11) push 成功后,清理 `change/<change-id>` 对应 worktree(若存在且不是当前 worktree):
|
|
44
|
-
- `change_ref="refs/heads/change/<change-id>"`
|
|
45
|
-
- `main_wt="$(git rev-parse --show-toplevel)"`
|
|
46
|
-
- `change_wt="$(git worktree list --porcelain | awk -v ref="$change_ref" '$1=="worktree"{wt=substr($0,10)} $1=="branch"&&$2==ref{print wt; exit}')"`
|
|
47
|
-
- 若 `change_wt` 非空且不等于 `main_wt`:先输出并让用户确认,再执行 `git worktree remove "$change_wt"`(不带 `--force`),最后 `git worktree prune`
|
|
48
|
-
- 若 `git -C "$change_wt" status --porcelain` 非空:停止并提示先清理该 worktree
|
|
49
|
-
12) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
|
|
47
|
+
10) submodules push 完成后,再回到主仓库执行:
|
|
48
|
+
- `aiws change finish <change-id> --push`
|
|
49
|
+
11) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
|
|
50
50
|
|
|
51
51
|
边界:
|
|
52
|
-
- push
|
|
52
|
+
- push 前先输出状态并说明远端/分支。
|
|
53
53
|
- 不执行破坏性命令。
|
|
54
54
|
"""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 默认 workflow router:先判定阶段,再进入具体 ws-* 入口
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:using-aiws -->
|
|
5
|
+
# using aiws
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:
|
|
10
|
+
- 把当前任务先路由到正确的 AIWS workflow,而不是直接跳进实现。
|
|
11
|
+
|
|
12
|
+
执行建议:
|
|
13
|
+
1) 先读取 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
|
|
14
|
+
- 若检测到 `.opencode/oh-my-opencode.json`:输出 `OpenCode mode: oMo-enabled`,并注明后续会优先借用 `planner-sisyphus` / `explore` / `librarian` / `oracle`
|
|
15
|
+
- 若未检测到:输出 `OpenCode mode: standard-opencode`
|
|
16
|
+
2) 若缺失任一真值文件:先 `/ws-preflight`,必要时运行 `aiws init .`,不要继续实现。
|
|
17
|
+
3) 若任务意图、归因或验证入口不明确:先提 1-3 个关键澄清问题并停止。
|
|
18
|
+
4) 路由规则:
|
|
19
|
+
- 需求/验收/合同变更:`/ws-req-review`
|
|
20
|
+
- 中大型实现或需要 change/worktree:`/ws-plan`
|
|
21
|
+
- 小步明确实现:`/ws-dev`
|
|
22
|
+
- 评审/审计:`/ws-review`
|
|
23
|
+
- finish / merge / push / cleanup:`/ws-finish`
|
|
24
|
+
- handoff / archive summary:`/ws-handoff`
|
|
25
|
+
5) 输出 `OpenCode mode:` / `Task intent:` / `Binding:` / `Route:` / `Why:` / `Next:`。
|
|
26
|
+
6) 除非用户只要路由判断,否则给出 route 后继续遵循对应入口的契约。
|
|
27
|
+
<!-- AIWS_MANAGED_END:opencode:using-aiws -->
|
|
28
|
+
|
|
29
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -11,15 +11,20 @@ description: 缺陷修复:禅道 MCP 拉单、图片证据落盘并汇总 fix_
|
|
|
11
11
|
|
|
12
12
|
建议流程:
|
|
13
13
|
1) 先运行 `/ws-preflight`。
|
|
14
|
-
2)
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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。
|
|
@@ -14,6 +14,7 @@ description: 提交:门禁/审计后提交(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)
|
|
58
|
+
8) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
|
|
58
59
|
9) 执行提交(不带 `--no-verify`):
|
|
59
60
|
```bash
|
|
60
61
|
git commit -m "<message>"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 委托:按 AIWS 合同拆分子任务,并优先借用 oMo agent
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-delegate -->
|
|
5
|
+
# ws delegate
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:先写清 delegation plan,再决定是否优先借用 `oh-my-opencode` 的 `planner-sisyphus` / `explore` / `librarian` / `oracle`;若不可用则回退,不阻断流程。
|
|
10
|
+
|
|
11
|
+
执行建议:
|
|
12
|
+
1) 先运行 `/ws-preflight`,再读取 `packages/spec/docs/workflow-delegation-contracts.md` 与 `packages/spec/docs/opencode-omo-adapter.md`。
|
|
13
|
+
2) 先写 `Delegation Plan:`,至少包含:
|
|
14
|
+
- `role`
|
|
15
|
+
- `preferred agent`
|
|
16
|
+
- `task`
|
|
17
|
+
- `readScope`
|
|
18
|
+
- `writeScope`
|
|
19
|
+
- `artifactTargets`
|
|
20
|
+
- `fallback`
|
|
21
|
+
3) 若检测到 `.opencode/oh-my-opencode.json` 或当前会话明确可用相关 agent:
|
|
22
|
+
- planning 优先 `planner-sisyphus`
|
|
23
|
+
- 探索优先 `@explore` / `@librarian`
|
|
24
|
+
- 独立审查优先 `@oracle`
|
|
25
|
+
4) 主 agent 统一收敛结果,并把产物回收到:
|
|
26
|
+
- `changes/<id>/analysis/`
|
|
27
|
+
- `changes/<id>/patches/`
|
|
28
|
+
- `changes/<id>/review/`
|
|
29
|
+
- `changes/<id>/evidence/`
|
|
30
|
+
5) 若 oMo agent 不可用:明确回退为普通 OpenCode delegation / 单 agent 执行。
|
|
31
|
+
<!-- AIWS_MANAGED_END:opencode:ws-delegate -->
|
|
32
|
+
|
|
33
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -6,7 +6,7 @@ description: 交付:submodules+superproject 分步提交并安全合并回 bas
|
|
|
6
6
|
|
|
7
7
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
8
|
|
|
9
|
-
目标:适配 superproject + submodule
|
|
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
|
-
-
|
|
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,10 +10,13 @@ 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
|
-
- ⚠️
|
|
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`,先提交这些规划工件。
|
|
15
18
|
- 推荐更安全(默认):`aiws change start <change-id> --hooks --no-switch`(只创建分支/工件 + 启用 hooks;不切分支)
|
|
16
|
-
-
|
|
19
|
+
- 准备进入实现时:若当前已在 `change/<change-id>` 直接继续;若需切换到该分支,先确认除规划工件外无额外未提交改动,再执行:`git switch change/<change-id>`
|
|
17
20
|
- 若你明确要“一键切分支”(不推荐,且 dirty 会被拦截):`aiws change start <change-id> --hooks --switch`
|
|
18
21
|
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --worktree --submodules`
|
|
19
22
|
- 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
|
|
@@ -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
|
-
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
-
|
|
49
|
-
-
|
|
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
|
|
55
|
-
- `
|
|
56
|
-
|
|
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
|
|
|
@@ -7,14 +7,21 @@ description: 规划:生成可落盘 plan 工件
|
|
|
7
7
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
8
|
|
|
9
9
|
目标:
|
|
10
|
-
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
- 若检测到 `.opencode/oh-my-opencode.json` 或当前会话明确可用 `planner-sisyphus` / `explore` / `librarian`:优先按 `packages/spec/docs/opencode-omo-adapter.md` 借用这些 agent。
|
|
15
|
+
- 计划主框架优先 `planner-sisyphus`;结构探索优先 `@explore`;规范/文档查证优先 `@librarian`。
|
|
16
|
+
2) 若当前不在 `change/<change-id>` 分支 / worktree,先调用 `aiws change start <change-id>` 建立上下文:
|
|
17
|
+
- 仓库已有提交:优先 `aiws change start <change-id> --hooks --worktree`;若声明了 submodules,加 `--submodules`
|
|
18
|
+
- 仓库尚无提交 / 不满足 worktree 前置条件:回退 `aiws change start <change-id> --hooks --no-switch`
|
|
19
|
+
3) 若上一步创建了 worktree:切到输出的 `worktree:` 路径,后续所有计划文件都写在该 worktree 中。
|
|
20
|
+
4) 生成或更新计划文件:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`。
|
|
21
|
+
5) 计划至少包含:`Bindings`、`Goal`、`Non-goals`、`Scope`、`Plan`、`Verify`、`Risks & Rollback`、`Evidence`。
|
|
22
|
+
6) 若已有 `changes/<change-id>/proposal.md`,对齐 `Plan_File` / `Contract_Row` / `Evidence_Path`。
|
|
23
|
+
7) 完成后先运行 `/ws-plan-verify`,通过再进入 `/ws-dev`。
|
|
24
|
+
8) 若 oMo 不可用:回退为普通 OpenCode `plan` / 当前 agent 本地规划,但仍必须落盘完整 `plan/...`。
|
|
18
25
|
<!-- AIWS_MANAGED_END:opencode:ws-plan -->
|
|
19
26
|
|
|
20
27
|
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -20,6 +20,10 @@ description: 预检:读取真值文件并输出约束摘要
|
|
|
20
20
|
- `Root:` <项目根路径>
|
|
21
21
|
- `Found:` <实际读取到的文件列表>
|
|
22
22
|
- `Missing:` <缺失文件列表>
|
|
23
|
+
- `OpenCode mode:`
|
|
24
|
+
- 若检测到 `.opencode/oh-my-opencode.json`:`oMo-enabled`
|
|
25
|
+
- 否则:`standard-opencode`
|
|
26
|
+
- 若为 `oMo-enabled`:附一句说明后续 `ws-plan` / `ws-review` / `ws-spec-review` / `ws-quality-review` / `ws-delegate` 会优先借用 oMo agent
|
|
23
27
|
- `Key rules:` 3–8 条 bullet(范围/禁止项/必须产物/必须验证命令)
|
|
24
28
|
|
|
25
29
|
安全:
|