@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,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 提交:门禁/审计后提交(submodule 感知)
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-commit -->
|
|
5
|
+
# ws commit
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
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
|
+
```bash
|
|
24
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
25
|
+
./node_modules/.bin/aiws validate . --stamp
|
|
26
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
27
|
+
aiws validate . --stamp
|
|
28
|
+
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
|
|
41
|
+
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
|
+
```
|
|
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
|
+
<!-- AIWS_MANAGED_END:opencode:ws-commit -->
|
|
69
|
+
|
|
70
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -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 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 交付:submodules+superproject 分步提交并安全合并回 base
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-deliver -->
|
|
5
|
+
# ws deliver
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
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)
|
|
56
|
+
<!-- AIWS_MANAGED_END:opencode:ws-deliver -->
|
|
57
|
+
|
|
58
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 开发:在 AIWS 约束下完成小步交付
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-dev -->
|
|
5
|
+
# ws dev
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:在 AIWS 约束下完成一个可回放、可验证的小步交付。
|
|
10
|
+
|
|
11
|
+
建议流程:
|
|
12
|
+
1) 先运行 `/ws-preflight`(读真值文件并输出约束摘要)。
|
|
13
|
+
- 若 `/ws-plan` 刚创建了 `change/<change-id>` worktree:后续实现必须在该 worktree 中继续;不要回原工作区重复 `aiws change start ...`
|
|
14
|
+
2) 建立变更归因(推荐):
|
|
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`
|
|
21
|
+
- superproject + submodule(推荐):`aiws change start <change-id> --hooks --worktree --submodules`
|
|
22
|
+
- 若后续需要在 detached submodule 内提交:先挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`
|
|
23
|
+
- 或手工:`git switch -c change/<change-id>`,并创建 `changes/<change-id>/proposal.md` 与 `changes/<change-id>/tasks.md`(参考 `changes/README.md`)
|
|
24
|
+
3) 如涉及需求调整:先 `/ws-req-review` → 用户确认后再 `/ws-req-change`(避免需求漂移)。
|
|
25
|
+
4) 实施最小改动:任何改动都要能归因到 `REQUIREMENTS.md`(验收)或 `issues/problem-issues.csv`(问题)。
|
|
26
|
+
5) 运行 `AI_WORKSPACE.md` 里声明的验证命令;未运行不声称已运行。
|
|
27
|
+
6) 提交前强制:`aiws validate .`(commit/push hooks 也会阻断)。
|
|
28
|
+
7) 交付收尾(推荐,减少手动 merge 出错):运行 `/ws-finish`(底层调用 `aiws change finish`,默认 fast-forward 安全合并回目标分支)。
|
|
29
|
+
|
|
30
|
+
输出要求:
|
|
31
|
+
- `变更文件(Changed):` 文件清单
|
|
32
|
+
- `验证(Verify):` 实际运行的命令 + 期望结果
|
|
33
|
+
- `证据(Evidence):` 证据路径(例如 `changes/<change-id>/review/...`、`changes/<change-id>/...` 或 `.agentdocs/tmp/...`)
|
|
34
|
+
<!-- AIWS_MANAGED_END:opencode:ws-dev -->
|
|
35
|
+
|
|
36
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 收尾:fast-forward 合并并把 submodule 并回目标分支后顺序 push
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-finish -->
|
|
5
|
+
# ws finish
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:安全把 `change/<change-id>` fast-forward 合并回目标分支,避免手输分支名导致的错误。
|
|
10
|
+
补充:若团队希望减少 submodule detached 的人为差异,建议在 `.gitmodules` 配置 `submodule.<name>.branch`,并在日常拉取时使用 `/ws-pull`。
|
|
11
|
+
|
|
12
|
+
前置(必须):
|
|
13
|
+
- 工作区干净:`git status --porcelain` 无输出(否则先 commit 或 stash)
|
|
14
|
+
- change 分支存在(`change/<change-id>`;也支持 `changes/`、`ws/`、`ws-change/`)
|
|
15
|
+
- 若存在 `.gitmodules`:必须为每个 submodule 配置 `submodule.<name>.branch`(否则先运行 `/ws-submodule-setup` 并提交 `.gitmodules`)
|
|
16
|
+
|
|
17
|
+
步骤(建议):
|
|
18
|
+
0) 若存在 `.gitmodules`,先检查 submodule branch 配置是否齐全(缺失则停止并提示 setup):
|
|
19
|
+
```bash
|
|
20
|
+
if [[ -f .gitmodules ]]; then
|
|
21
|
+
missing=0
|
|
22
|
+
while read -r key sub_path; do
|
|
23
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
24
|
+
b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
25
|
+
if [[ -z "${b:-}" ]]; then
|
|
26
|
+
echo "error: missing .gitmodules submodule.${name}.branch (path=${sub_path})"
|
|
27
|
+
missing=1
|
|
28
|
+
fi
|
|
29
|
+
done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
|
|
30
|
+
if [[ "$missing" -ne 0 ]]; then
|
|
31
|
+
echo "hint: run /ws-submodule-setup (and commit .gitmodules), then retry"
|
|
32
|
+
exit 2
|
|
33
|
+
fi
|
|
34
|
+
fi
|
|
35
|
+
```
|
|
36
|
+
1) 先运行 `/ws-preflight`(确保真值文件齐全)。
|
|
37
|
+
2) (推荐)门禁校验并落盘证据:`aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)。
|
|
38
|
+
2.1) (强烈建议)收敛持久证据并回填 `Evidence_Path`:`aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)。
|
|
39
|
+
2.2) (可选)生成状态快照(建议):`aiws change state <change-id> --write`。
|
|
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`
|
|
52
|
+
- 发现 submodules:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
|
|
53
|
+
- 对每个 `<sub_path>`:
|
|
54
|
+
- 读取 superproject 当前 gitlink:`git rev-parse "HEAD:<sub_path>"`
|
|
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
|
|
58
|
+
- 用 pin 分支挂回(不改动现有 main/master 指针):`git -C "<sub_path>" checkout -B "aiws/pin/<target-branch>" <gitlink-sha>`
|
|
59
|
+
- 仅当 `<gitlink-sha>` 属于 `origin/<target-branch>` 历史时才允许 push;否则停止并人工处理分叉
|
|
60
|
+
- push(只允许 fast-forward):`git -C "<sub_path>" push origin "<gitlink-sha>:refs/heads/<target-branch>"`
|
|
61
|
+
6) 任一 submodule 不满足 fast-forward 条件时立即停止(不要继续 push 主仓库)。
|
|
62
|
+
7) submodules 全部成功后,再回到主仓库执行:
|
|
63
|
+
- `aiws change finish <change-id> --push`
|
|
64
|
+
8) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
|
|
65
|
+
|
|
66
|
+
安全:
|
|
67
|
+
- push 前先输出状态并说明远端/分支。
|
|
68
|
+
- 不执行破坏性命令。
|
|
69
|
+
<!-- AIWS_MANAGED_END:opencode:ws-finish -->
|
|
70
|
+
|
|
71
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -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 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 迁移:把仓库对齐到 aiws workspace 模板
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-migrate -->
|
|
5
|
+
# ws migrate
|
|
6
|
+
|
|
7
|
+
用中文输出;命令与路径保持原样不翻译。
|
|
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
|
+
- 不执行破坏性命令。
|
|
23
|
+
<!-- AIWS_MANAGED_END:opencode:ws-migrate -->
|
|
24
|
+
|
|
25
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 计划质检:执行前检查并给出最小修正项
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-plan-verify -->
|
|
5
|
+
# ws plan verify
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:
|
|
10
|
+
- 执行前检查计划是否跑偏,并给出最小修正项。
|
|
11
|
+
|
|
12
|
+
执行建议:
|
|
13
|
+
1) 先运行 `/ws-preflight`。
|
|
14
|
+
2) 运行严格门禁:
|
|
15
|
+
```bash
|
|
16
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
17
|
+
./node_modules/.bin/aiws change validate <change-id> --strict
|
|
18
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
19
|
+
aiws change validate <change-id> --strict
|
|
20
|
+
else
|
|
21
|
+
npx @aipper/aiws change validate <change-id> --strict
|
|
22
|
+
fi
|
|
23
|
+
```
|
|
24
|
+
3) 若失败:先修 `proposal.md` / `plan` 的绑定字段与验证命令,再复跑。
|
|
25
|
+
4) 通过后再进入 `/ws-dev`。
|
|
26
|
+
<!-- AIWS_MANAGED_END:opencode:ws-plan-verify -->
|
|
27
|
+
|
|
28
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 规划:生成可落盘 plan 工件
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-plan -->
|
|
5
|
+
# ws plan
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:
|
|
10
|
+
- 若尚未进入本次 change 的工作上下文:先建立 `change/<change-id>` 分支 / worktree,再生成可落盘执行计划(供 /ws-dev 执行)。
|
|
11
|
+
|
|
12
|
+
执行建议:
|
|
13
|
+
1) 先运行 `/ws-preflight`(对齐 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`)。
|
|
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/...`。
|
|
25
|
+
<!-- AIWS_MANAGED_END:opencode:ws-plan -->
|
|
26
|
+
|
|
27
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 预检:读取真值文件并输出约束摘要
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-preflight -->
|
|
5
|
+
# ws preflight
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:在开始任何“写代码/改配置/落盘文件”之前,对齐工作区真值文件,避免规则漂移。
|
|
10
|
+
|
|
11
|
+
执行步骤(强制):
|
|
12
|
+
1) 定位项目根目录:
|
|
13
|
+
- 优先:`git rev-parse --show-toplevel`
|
|
14
|
+
- 若失败:停止并让用户确认当前目录是否为项目根(不要猜测)。
|
|
15
|
+
2) 在项目根目录读取以下文件(存在则必须读取;缺失则明确报告缺失项,不要臆测内容):
|
|
16
|
+
- `AI_PROJECT.md`
|
|
17
|
+
- `REQUIREMENTS.md`
|
|
18
|
+
- `AI_WORKSPACE.md`
|
|
19
|
+
3) 输出:
|
|
20
|
+
- `Root:` <项目根路径>
|
|
21
|
+
- `Found:` <实际读取到的文件列表>
|
|
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
|
|
27
|
+
- `Key rules:` 3–8 条 bullet(范围/禁止项/必须产物/必须验证命令)
|
|
28
|
+
|
|
29
|
+
安全:
|
|
30
|
+
- 不打印 secrets;遇到疑似敏感值只提示“存在风险”但不要复述原文。
|
|
31
|
+
- 不执行破坏性命令。
|
|
32
|
+
<!-- AIWS_MANAGED_END:opencode:ws-preflight -->
|
|
33
|
+
|
|
34
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 拉取:fast-forward 拉取并对齐 submodules(尽量避免 detached)
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-pull -->
|
|
5
|
+
# ws pull
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:安全拉取 superproject,并对齐 submodules,尽量把 submodule 从 detached HEAD “挂回”分支(仅当该分支包含 gitlink commit),减少人为操作差异。
|
|
10
|
+
|
|
11
|
+
安全约束(强制):
|
|
12
|
+
- 不执行破坏性命令;不自动提交/不自动 push
|
|
13
|
+
- 若工作区不干净:停止并要求用户先 commit 或 stash
|
|
14
|
+
- `git pull` 默认只允许 fast-forward(避免隐式 merge/rebase)
|
|
15
|
+
|
|
16
|
+
步骤(建议):
|
|
17
|
+
1) 输出上下文并检查工作区干净:
|
|
18
|
+
```bash
|
|
19
|
+
git rev-parse --show-toplevel
|
|
20
|
+
git branch --show-current
|
|
21
|
+
git status --porcelain
|
|
22
|
+
```
|
|
23
|
+
若 `git status --porcelain` 非空:停止。
|
|
24
|
+
|
|
25
|
+
2) 拉取 superproject(fast-forward only):
|
|
26
|
+
```bash
|
|
27
|
+
git pull --ff-only
|
|
28
|
+
```
|
|
29
|
+
若失败:停止并说明需要用户明确选择 `git pull --rebase` 或手动处理。
|
|
30
|
+
|
|
31
|
+
3) 更新 submodules 到 superproject 记录的 gitlink commit:
|
|
32
|
+
```bash
|
|
33
|
+
if [[ -f .gitmodules ]]; then
|
|
34
|
+
git submodule sync --recursive
|
|
35
|
+
git submodule update --init --recursive
|
|
36
|
+
else
|
|
37
|
+
echo "[info] no .gitmodules"
|
|
38
|
+
fi
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
4) (可选但推荐)把 submodule 从 detached HEAD 尽量“挂回分支”(不改动 gitlink commit):
|
|
42
|
+
为避免 origin 多分支时“猜错分支”,本步骤只在 `.gitmodules` 明确配置了 `submodule.<name>.branch` 时才执行;否则保持 detached 并提示先运行 `/ws-submodule-setup` 对齐配置。
|
|
43
|
+
```bash
|
|
44
|
+
if [[ -f .gitmodules ]]; then
|
|
45
|
+
base_branch="$(git branch --show-current)"
|
|
46
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
|
|
47
|
+
| while read -r key sub_path; do
|
|
48
|
+
[[ -z "${sub_path:-}" ]] && continue
|
|
49
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
50
|
+
echo "== submodule: ${sub_path} (${name}) =="
|
|
51
|
+
sub_sha="$(git rev-parse "HEAD:${sub_path}" 2>/dev/null || true)"
|
|
52
|
+
[[ -z "${sub_sha:-}" ]] && { echo "[warn] no gitlink sha"; continue; }
|
|
53
|
+
|
|
54
|
+
cfg_branch="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
55
|
+
if [[ "${cfg_branch:-}" == "." ]]; then cfg_branch="$base_branch"; fi
|
|
56
|
+
if [[ -z "${cfg_branch:-}" ]]; then
|
|
57
|
+
echo "[warn] ${sub_path}: missing .gitmodules submodule.${name}.branch; keep detached (run ws-submodule-setup)"
|
|
58
|
+
continue
|
|
59
|
+
fi
|
|
60
|
+
target_branch="${cfg_branch}"
|
|
61
|
+
pin_branch="aiws/pin/${target_branch}"
|
|
62
|
+
|
|
63
|
+
git -C "${sub_path}" fetch origin --prune || true
|
|
64
|
+
if git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/origin/${target_branch}"; then
|
|
65
|
+
if git -C "${sub_path}" merge-base --is-ancestor "${sub_sha}" "origin/${target_branch}"; then
|
|
66
|
+
git -C "${sub_path}" checkout -B "${pin_branch}" "${sub_sha}"
|
|
67
|
+
git -C "${sub_path}" branch --set-upstream-to "origin/${target_branch}" "${pin_branch}" >/dev/null 2>&1 || true
|
|
68
|
+
echo "[ok] attached ${sub_path} to ${pin_branch} (upstream=origin/${target_branch}) at ${sub_sha}"
|
|
69
|
+
else
|
|
70
|
+
echo "[warn] ${sub_path}: ${sub_sha} is not in origin/${target_branch}; keep detached"
|
|
71
|
+
fi
|
|
72
|
+
else
|
|
73
|
+
echo "[warn] ${sub_path}: origin/${target_branch} not found; keep detached"
|
|
74
|
+
fi
|
|
75
|
+
done
|
|
76
|
+
fi
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
可选(方案 2,一次性设置 submodule 跟踪分支,会改 `.gitmodules`,需提交):
|
|
80
|
+
```bash
|
|
81
|
+
git submodule set-branch --branch main <sub_path>
|
|
82
|
+
git add .gitmodules
|
|
83
|
+
git commit -m "chore(submodule): set tracking branch"
|
|
84
|
+
```
|
|
85
|
+
<!-- AIWS_MANAGED_END:opencode:ws-pull -->
|
|
86
|
+
|
|
87
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 推送:submodule 感知(先 submodules 后 superproject;fast-forward;不 force)
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-push -->
|
|
5
|
+
# ws push
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:安全 push 当前仓库;若仓库包含 submodules,则先 push submodules,再 push superproject(默认 fast-forward;不 force)。
|
|
10
|
+
|
|
11
|
+
强制约束:
|
|
12
|
+
- 不自动提交、不自动 `git add -A`
|
|
13
|
+
- 不使用 `--force` / `--force-with-lease`
|
|
14
|
+
- 若工作区不干净:停止并要求先 commit 或 stash
|
|
15
|
+
|
|
16
|
+
步骤(建议):
|
|
17
|
+
1) 输出上下文并检查工作区干净:
|
|
18
|
+
```bash
|
|
19
|
+
git branch --show-current
|
|
20
|
+
git status --porcelain
|
|
21
|
+
git status -sb
|
|
22
|
+
```
|
|
23
|
+
若 `git status --porcelain` 非空:停止。
|
|
24
|
+
|
|
25
|
+
2) 判断是否存在 submodules:
|
|
26
|
+
```bash
|
|
27
|
+
if [[ -f .gitmodules ]]; then
|
|
28
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' || true
|
|
29
|
+
fi
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3) 若没有 submodules:正常 push(仍需用户确认远端/分支):
|
|
33
|
+
```bash
|
|
34
|
+
git remote -v
|
|
35
|
+
git push
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
4) 若有 submodules:先检查 `.gitmodules` 的 `submodule.<name>.branch` 是否齐全(缺失则停止并提示 `/ws-submodule-setup`):
|
|
39
|
+
```bash
|
|
40
|
+
missing=0
|
|
41
|
+
while read -r key sub_path; do
|
|
42
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
43
|
+
b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
44
|
+
if [[ -z "${b:-}" ]]; then
|
|
45
|
+
echo "error: missing .gitmodules submodule.${name}.branch (path=${sub_path})"
|
|
46
|
+
missing=1
|
|
47
|
+
fi
|
|
48
|
+
done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
|
|
49
|
+
if [[ "$missing" -ne 0 ]]; then
|
|
50
|
+
echo "hint: run /ws-submodule-setup (and commit .gitmodules), then retry"
|
|
51
|
+
exit 2
|
|
52
|
+
fi
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
5) 逐个 push submodules(fast-forward only),再 push superproject:
|
|
56
|
+
```bash
|
|
57
|
+
base_branch="$(git branch --show-current)"
|
|
58
|
+
|
|
59
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
|
|
60
|
+
| while read -r key sub_path; do
|
|
61
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
62
|
+
echo "== submodule: ${sub_path} (${name}) =="
|
|
63
|
+
|
|
64
|
+
if [[ -n "$(git -C "${sub_path}" status --porcelain 2>/dev/null || true)" ]]; then
|
|
65
|
+
echo "error: submodule dirty: ${sub_path}"
|
|
66
|
+
exit 2
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
cfg_branch="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
70
|
+
if [[ "${cfg_branch:-}" == "." ]]; then cfg_branch="$base_branch"; fi
|
|
71
|
+
target_branch="${cfg_branch}"
|
|
72
|
+
|
|
73
|
+
git -C "${sub_path}" fetch origin --prune
|
|
74
|
+
if ! git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/origin/${target_branch}"; then
|
|
75
|
+
echo "error: missing origin/${target_branch} for ${sub_path}"
|
|
76
|
+
exit 2
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
if ! git -C "${sub_path}" merge-base --is-ancestor "origin/${target_branch}" HEAD; then
|
|
80
|
+
echo "error: non-fast-forward (submodule=${sub_path}, branch=${target_branch})"
|
|
81
|
+
exit 2
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
git -C "${sub_path}" push origin "HEAD:refs/heads/${target_branch}"
|
|
85
|
+
done
|
|
86
|
+
|
|
87
|
+
git remote -v
|
|
88
|
+
git push
|
|
89
|
+
```
|
|
90
|
+
<!-- AIWS_MANAGED_END:opencode:ws-push -->
|
|
91
|
+
|
|
92
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|
|
93
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 质量审查:行为回归 / 测试覆盖 / 实现质量
|
|
3
|
+
---
|
|
4
|
+
<!-- AIWS_MANAGED_BEGIN:opencode:ws-quality-review -->
|
|
5
|
+
# ws quality review
|
|
6
|
+
|
|
7
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
8
|
+
|
|
9
|
+
目标:审查行为回归、边界条件、测试覆盖与实现质量。
|
|
10
|
+
|
|
11
|
+
步骤(建议):
|
|
12
|
+
1) 读取 `git diff`、已执行的验证结果和相关代码。
|
|
13
|
+
- 若检测到 `.opencode/oh-my-opencode.json` 或当前会话明确可用 `oracle` / `explore`:优先按 `packages/spec/docs/opencode-omo-adapter.md` 借用这些 agent。
|
|
14
|
+
- 质量/回归审查优先 `@oracle`;代码路径与影响面补充优先 `@explore`。
|
|
15
|
+
2) 检查:
|
|
16
|
+
- 是否存在行为回归或明显 bug 风险
|
|
17
|
+
- 边界条件 / 失败路径是否覆盖
|
|
18
|
+
- 测试是否足以支撑当前改动
|
|
19
|
+
3) 将结论落盘到:
|
|
20
|
+
- 默认:`changes/<change-id>/review/quality-review.md`
|
|
21
|
+
- 回退:`.agentdocs/tmp/review/quality-review.md`
|
|
22
|
+
4) 输出:
|
|
23
|
+
- `证据(Evidence):`
|
|
24
|
+
- `主要发现(Findings):`
|
|
25
|
+
- `测试缺口(Gaps):`
|
|
26
|
+
- `下一步(Next):`
|
|
27
|
+
5) 若 oMo 不可用:回退为当前 agent 本地 quality review。
|
|
28
|
+
<!-- AIWS_MANAGED_END:opencode:ws-quality-review -->
|
|
29
|
+
|
|
30
|
+
可在下方追加本项目对 OpenCode 的额外说明(托管块外内容会被保留)。
|