@aipper/aiws-spec 0.0.24 → 0.0.26
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 +91 -6
- 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 +30 -22
- 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 +87 -0
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +27 -1
- package/templates/workspace/.agents/skills/ws-delegate/SKILL.md +75 -0
- package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +25 -4
- package/templates/workspace/.agents/skills/ws-dev/SKILL.md +35 -6
- package/templates/workspace/.agents/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.agents/skills/ws-finish/SKILL.md +25 -12
- package/templates/workspace/.agents/skills/ws-frontend-design/SKILL.md +126 -0
- package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +25 -4
- package/templates/workspace/.agents/skills/ws-plan/SKILL.md +25 -1
- 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/.aiws/manifest.json +2 -6
- package/templates/workspace/.claude/commands/using-aiws.md +25 -0
- package/templates/workspace/.claude/commands/ws-dev-lite.md +31 -0
- package/templates/workspace/.claude/commands/ws-finish.md +1 -1
- package/templates/workspace/.claude/commands/ws-handoff.md +3 -2
- package/templates/workspace/.claude/commands/ws-quality-review.md +24 -0
- package/templates/workspace/.claude/commands/ws-review.md +2 -2
- 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 +87 -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 +130 -0
- package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +230 -0
- package/templates/workspace/.claude/skills/ws-dev/SKILL.md +168 -0
- package/templates/workspace/.claude/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.claude/skills/ws-finish/SKILL.md +209 -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/.githooks/commit-msg +10 -0
- package/templates/workspace/.opencode/command/using-aiws.md +30 -0
- package/templates/workspace/.opencode/command/ws-delegate.md +33 -0
- package/templates/workspace/.opencode/command/ws-dev-lite.md +34 -0
- package/templates/workspace/.opencode/command/ws-finish.md +1 -1
- package/templates/workspace/.opencode/command/ws-handoff.md +4 -3
- package/templates/workspace/.opencode/command/ws-plan.md +3 -0
- 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 +5 -2
- 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 +30 -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/{.iflow/commands/ws-deliver.toml → .opencode/commands/ws-deliver.md} +13 -13
- package/templates/workspace/.opencode/commands/ws-dev-lite.md +34 -0
- package/templates/workspace/.opencode/commands/ws-dev.md +36 -0
- package/templates/workspace/{.iflow/commands/ws-finish.toml → .opencode/commands/ws-finish.md} +46 -29
- package/templates/workspace/.opencode/commands/ws-handoff.md +26 -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 +91 -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 +130 -0
- package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +63 -0
- package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +230 -0
- package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +168 -0
- package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +209 -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 +74 -30
- package/templates/workspace/AI_PROJECT.md +1 -1
- package/templates/workspace/AI_WORKSPACE.md +1 -1
- package/templates/workspace/changes/README.md +25 -4
- package/templates/workspace/changes/templates/proposal.md +15 -0
- package/templates/workspace/changes/templates/tasks.md +9 -2
- package/templates/workspace/manifest.json +340 -82
- package/templates/workspace/memory-bank/README.md +1 -2
- package/templates/workspace/tools/ws_change_check.py +26 -4
- package/templates/workspace/.iflow/agents/feature-reviewer.md +0 -27
- package/templates/workspace/.iflow/agents/requirements-analyst.md +0 -24
- package/templates/workspace/.iflow/agents/server-commit-manager.md +0 -28
- package/templates/workspace/.iflow/agents/server-fix-implementer.md +0 -31
- package/templates/workspace/.iflow/agents/server-test-planner.md +0 -28
- package/templates/workspace/.iflow/agents/server-test-triager.md +0 -30
- package/templates/workspace/.iflow/commands/aiws-init.toml +0 -24
- package/templates/workspace/.iflow/commands/aiws-rollback.toml +0 -18
- package/templates/workspace/.iflow/commands/aiws-update.toml +0 -23
- package/templates/workspace/.iflow/commands/aiws-validate.toml +0 -18
- package/templates/workspace/.iflow/commands/server-commit.toml +0 -27
- package/templates/workspace/.iflow/commands/server-drain.toml +0 -99
- package/templates/workspace/.iflow/commands/server-fix-and-commit.toml +0 -27
- package/templates/workspace/.iflow/commands/server-fix.toml +0 -65
- package/templates/workspace/.iflow/commands/server-test-plan.toml +0 -62
- package/templates/workspace/.iflow/commands/server-test.toml +0 -58
- package/templates/workspace/.iflow/commands/server-triage.toml +0 -38
- package/templates/workspace/.iflow/commands/server_test-plan.toml +0 -12
- package/templates/workspace/.iflow/commands/server_test.toml +0 -12
- package/templates/workspace/.iflow/commands/ws-analyze.toml +0 -33
- package/templates/workspace/.iflow/commands/ws-commit.toml +0 -46
- package/templates/workspace/.iflow/commands/ws-contract-check.toml +0 -69
- package/templates/workspace/.iflow/commands/ws-dev.toml +0 -34
- package/templates/workspace/.iflow/commands/ws-doctor.toml +0 -141
- package/templates/workspace/.iflow/commands/ws-env-doctor.toml +0 -74
- package/templates/workspace/.iflow/commands/ws-feature-deliver.toml +0 -44
- package/templates/workspace/.iflow/commands/ws-feature-plan.toml +0 -47
- package/templates/workspace/.iflow/commands/ws-init.toml +0 -53
- package/templates/workspace/.iflow/commands/ws-memory-bank-init.toml +0 -100
- package/templates/workspace/.iflow/commands/ws-migrate.toml +0 -59
- package/templates/workspace/.iflow/commands/ws-preflight.toml +0 -30
- package/templates/workspace/.iflow/commands/ws-pull.toml +0 -47
- package/templates/workspace/.iflow/commands/ws-push.toml +0 -40
- package/templates/workspace/.iflow/commands/ws-req-change.toml +0 -64
- package/templates/workspace/.iflow/commands/ws-req-contract-sync.toml +0 -25
- package/templates/workspace/.iflow/commands/ws-req-contract-validate.toml +0 -16
- package/templates/workspace/.iflow/commands/ws-req-flow-sync.toml +0 -36
- package/templates/workspace/.iflow/commands/ws-req-review.toml +0 -56
- package/templates/workspace/.iflow/commands/ws-review.toml +0 -33
- package/templates/workspace/.iflow/commands/ws-rule.toml +0 -43
- package/templates/workspace/.iflow/commands/ws-submodule-setup.toml +0 -32
- package/templates/workspace/tools/iflow_watchdog.sh +0 -138
- package/templates/workspace/tools/install_iflow_watchdog_systemd_user.sh +0 -118
- package/templates/workspace/tools/systemd/iflow-watchdog@.service +0 -16
- package/templates/workspace/tools/systemd/iflow-watchdog@.timer +0 -11
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-migrate
|
|
3
|
+
description: 迁移(补齐/升级 AIWS 工作区文件)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出;命令与路径保持原样不翻译。
|
|
7
|
+
|
|
8
|
+
目标:把当前仓库补齐为 aiws workspace 模板,并启用可验证门禁。
|
|
9
|
+
|
|
10
|
+
执行(在项目根目录):
|
|
11
|
+
```bash
|
|
12
|
+
if [[ -f ".aiws/manifest.json" ]]; then
|
|
13
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
14
|
+
./node_modules/.bin/aiws update .
|
|
15
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
16
|
+
aiws update .
|
|
17
|
+
else
|
|
18
|
+
npx @aipper/aiws update .
|
|
19
|
+
fi
|
|
20
|
+
else
|
|
21
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
22
|
+
./node_modules/.bin/aiws init .
|
|
23
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
24
|
+
aiws init .
|
|
25
|
+
else
|
|
26
|
+
npx @aipper/aiws init .
|
|
27
|
+
fi
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
31
|
+
./node_modules/.bin/aiws validate .
|
|
32
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
33
|
+
aiws validate .
|
|
34
|
+
else
|
|
35
|
+
npx @aipper/aiws validate .
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
git config core.hooksPath .githooks
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
回滚(恢复最近一次快照):
|
|
42
|
+
```bash
|
|
43
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
44
|
+
./node_modules/.bin/aiws rollback . latest
|
|
45
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
46
|
+
aiws rollback . latest
|
|
47
|
+
else
|
|
48
|
+
npx @aipper/aiws rollback . latest
|
|
49
|
+
fi
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
约束:
|
|
53
|
+
- 不写入任何 secrets。
|
|
54
|
+
- 不执行破坏性命令。
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-plan
|
|
3
|
+
description: 规划(生成可落盘 plan/ 工件;供 ws-dev 执行)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 对齐真值文件(`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`)
|
|
10
|
+
- 若尚未进入本次 change 的工作上下文:先建立 `change/<change-id>` 分支 / worktree,再生成计划
|
|
11
|
+
- 为当前任务生成一份可追踪的执行计划文件:`plan/<timestamp>-<slug>.md`
|
|
12
|
+
- 计划必须包含可复现验证命令(优先引用 `AI_WORKSPACE.md`)
|
|
13
|
+
- 计划必须包含“主索引绑定”:`Change_ID` / (`Req_ID` or `Problem_ID`) / `Contract_Row` / `Plan_File` / `Evidence_Path`
|
|
14
|
+
|
|
15
|
+
OpenCode + oMo 优先策略:
|
|
16
|
+
- 若检测到 `.opencode/oh-my-opencode.json`,或当前会话明确可用 `planner-sisyphus` / `explore` / `librarian`,优先按 `packages/spec/docs/opencode-omo-adapter.md` 借用这些 agent。
|
|
17
|
+
- 计划主框架优先交给 `planner-sisyphus`;代码结构探索优先交给 `@explore`;规范/文档/依赖查证优先交给 `@librarian`。
|
|
18
|
+
- 主 agent 负责回收这些结果并最终落盘 `plan/...`;不要把“调用了 oMo agent”当作已经完成计划。
|
|
19
|
+
|
|
20
|
+
约束:
|
|
21
|
+
- 不写入任何 secrets(token、账号、内网端点等不得进入 git)
|
|
22
|
+
- 本 skill 只负责“想清楚怎么做 + 落盘计划”,不要直接大规模改动代码
|
|
23
|
+
- 未运行不声称已运行;验证命令要写清“预期结果”
|
|
24
|
+
- 若存在 `changes/<change-id>/proposal.md`,计划与 proposal 的绑定字段必须保持一致(不一致时先修正再继续)
|
|
25
|
+
|
|
26
|
+
阶段定位:
|
|
27
|
+
- planning 阶段;负责把用户目标收敛为 change 绑定、计划文件和验证入口。
|
|
28
|
+
|
|
29
|
+
必需输入:
|
|
30
|
+
- 当前任务描述
|
|
31
|
+
- 真值文件:`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`
|
|
32
|
+
- 若已存在:`changes/<change-id>/proposal.md`
|
|
33
|
+
- 若已有计划:当前 `plan/...` 文件
|
|
34
|
+
|
|
35
|
+
必需输出:
|
|
36
|
+
- `Plan file:` 实际写入的 `plan/...`
|
|
37
|
+
- `Change context:` 当前生效的 `change/<change-id>` 分支或 worktree
|
|
38
|
+
- `Bindings:` `Change_ID` / `Req_ID|Problem_ID` / `Contract_Row` / `Plan_File` / `Evidence_Path`
|
|
39
|
+
- `Verify:` 可复现验证命令与预期
|
|
40
|
+
- `Next:` 先 `$ws-plan-verify`,通过后再 `$ws-dev`
|
|
41
|
+
|
|
42
|
+
阻断条件:
|
|
43
|
+
- 任务目标或归因绑定不清晰
|
|
44
|
+
- 当前工作区 dirty 且尚未进入可复用的 change 上下文
|
|
45
|
+
- 无法把计划实际写盘
|
|
46
|
+
|
|
47
|
+
完成判定:
|
|
48
|
+
- 计划已落盘、绑定已同步、验证入口明确,后续实现可以直接按计划推进。
|
|
49
|
+
|
|
50
|
+
执行步骤(建议):
|
|
51
|
+
1) 先运行 `$ws-preflight`(读取真值文件并输出约束摘要)。
|
|
52
|
+
- 若检测到 oMo:优先让 `planner-sisyphus` 生成 planning draft;若需要补结构探索,再委托 `@explore` / `@librarian`。
|
|
53
|
+
2) 若用户任务描述不清:先问 1-3 个关键澄清问题(不要猜)。
|
|
54
|
+
3) 判断复杂度:`simple / medium / complex`(给出一句理由),并估算步骤数。
|
|
55
|
+
4) 识别或建立主索引 / change 上下文:
|
|
56
|
+
- 若存在 `changes/<change-id>/proposal.md`:读取其中 `Change_ID` / `Req_ID` / `Problem_ID` / `Contract_Row` / `Evidence_Path`
|
|
57
|
+
- 若缺失关键绑定:先补齐 proposal(至少 `Change_ID`、`Req_ID|Problem_ID`、`Contract_Row`)再继续生成计划
|
|
58
|
+
- 若当前不在 `change/<change-id>` 分支 / worktree,且本次任务需要新建 change:先调用 `aiws change start` 建立上下文,再继续写 plan
|
|
59
|
+
- 推荐顺序:
|
|
60
|
+
- 工作区已存在未提交改动:不要先写 `plan/...`;先停下来说明原因,并要求用户先 commit/stash,或改用已有 change 上下文
|
|
61
|
+
- 仓库已有提交:优先创建独立 worktree;若仓库声明了 submodules,加上 `--submodules`
|
|
62
|
+
- 仓库尚无提交 / 不满足 worktree 前置条件:回退为 `--no-switch`
|
|
63
|
+
```bash
|
|
64
|
+
change_id="<change-id>"
|
|
65
|
+
if [[ -n "$(git status --porcelain)" ]]; then
|
|
66
|
+
echo "error: working tree dirty before ws-plan creates change context"
|
|
67
|
+
echo "hint: commit/stash first, or continue inside an existing change/<change-id> context"
|
|
68
|
+
exit 2
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
has_commits=0
|
|
72
|
+
git rev-parse --verify HEAD >/dev/null 2>&1 && has_commits=1
|
|
73
|
+
|
|
74
|
+
has_submodules=0
|
|
75
|
+
if [[ -f .gitmodules ]] && git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' >/dev/null 2>&1; then
|
|
76
|
+
has_submodules=1
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
if [[ "${has_commits}" -eq 1 ]]; then
|
|
80
|
+
if [[ "${has_submodules}" -eq 1 ]]; then
|
|
81
|
+
aiws change start "${change_id}" --hooks --worktree --submodules
|
|
82
|
+
else
|
|
83
|
+
aiws change start "${change_id}" --hooks --worktree
|
|
84
|
+
fi
|
|
85
|
+
else
|
|
86
|
+
aiws change start "${change_id}" --hooks --no-switch
|
|
87
|
+
fi
|
|
88
|
+
```
|
|
89
|
+
- 若上一步创建了 worktree:后续所有读取/写入都必须切到 `aiws change start` 输出的 `worktree:` 路径中进行;不要把 `plan/...` 写回原工作区
|
|
90
|
+
5) 生成计划文件:
|
|
91
|
+
- 文件名:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`(`<slug>` 用 kebab-case;同一任务调整计划时尽量复用同一文件)
|
|
92
|
+
- 若 `plan/` 不存在先创建
|
|
93
|
+
- 必须实际写入到磁盘(不要只在对话里输出);如因权限/策略无法写盘,必须明确说明原因并输出可复制的完整内容
|
|
94
|
+
- 计划必须写在当前 active change 上下文内:若当前已进入 `change/<change-id>` worktree,则 `plan/...`、`proposal.md`、`tasks.md` 都应写在该 worktree 中
|
|
95
|
+
6) 计划内容至少包含(不要留空):
|
|
96
|
+
- `Bindings`:`Change_ID` / `Req_ID` / `Problem_ID` / `Contract_Row` / `Plan_File` / `Evidence_Path`
|
|
97
|
+
- `Goal`:要达成什么
|
|
98
|
+
- `Non-goals`:明确不做什么(避免 scope creep)
|
|
99
|
+
- `Scope`:将改动的文件/目录清单(不确定就写 `TBD` 并说明如何确定)
|
|
100
|
+
- `Plan`:分步执行(每步尽量落到具体文件/命令;必要时拆 Phase)
|
|
101
|
+
- `Submodules`(当存在 `.gitmodules` 且声明了 submodule 条目时,强制):声明“本次 change 的 submodule 目标分支真值”(用于同一 superproject 分支内的多渠道交付;也避免仅靠 `.gitmodules` 默认分支导致交付推送到错误分支)
|
|
102
|
+
- `Verify`:可复现命令 + 期望结果(优先引用 `AI_WORKSPACE.md` 的入口;必要时补充 e2e)
|
|
103
|
+
- `Risks & Rollback`:风险点 + 回滚方案(例如 git 回滚、`aiws rollback`、恢复备份等)
|
|
104
|
+
- `Evidence`:计划文件路径;若创建了变更工件则附 `changes/<change-id>/...`
|
|
105
|
+
7) 若存在 change proposal:回填并对齐 `proposal.md` 的 `Plan_File`(必要时同步 `Contract_Row` / `Evidence_Path`),保证 plan/proposal 一致。
|
|
106
|
+
8) 运行 `$ws-plan-verify` 作为执行前质量门(计划不过长、不跑偏、验证可复现)。
|
|
107
|
+
9) 若计划涉及“需求/验收”变更:先用 `$ws-req-review` 评审 → 用户确认后再 `$ws-req-change` 落盘(避免需求漂移)。
|
|
108
|
+
10) 多步任务(≥2 步):后续进入实现时,使用 `update_plan` 工具跟踪 `pending → in_progress → completed`。
|
|
109
|
+
|
|
110
|
+
oMo 回退:
|
|
111
|
+
- 若当前没有 oMo、没有 `planner-sisyphus`,或你无法稳定调用相关 agent:直接回退为普通 OpenCode `plan` / 当前 agent 本地规划。
|
|
112
|
+
- 回退不改变 AIWS 的要求:`plan/...` 仍必须落盘,bindings / verify / risks / evidence 仍必须完整。
|
|
113
|
+
|
|
114
|
+
补充:submodule 目标分支真值(强约束;同一 superproject 分支内可多渠道)
|
|
115
|
+
- 背景:`.gitmodules submodule.<name>.branch` 适合作为“团队默认分支真值”,但当同一 superproject 分支需要在不同交付中选择不同 submodule 目标分支(多渠道)时,仅靠 `.gitmodules` 不足。
|
|
116
|
+
- 强约束:当 `.gitmodules` 声明了 submodule 条目时,门禁会要求本次 change 存在该文件且覆盖所有 submodule path(否则 `aiws validate .` / `aiws change validate --strict` 阻断)。
|
|
117
|
+
- 约定:为本次 change 落盘一个“交付目标分支映射”文件,并在后续 `$ws-dev`/`$ws-deliver`/`$ws-finish` 优先使用它:
|
|
118
|
+
- 文件:`changes/<change-id>/submodules.targets`
|
|
119
|
+
- 格式:每行一个 submodule(忽略空行与 `#` 注释),字段用空白分隔(推荐 `TAB`):
|
|
120
|
+
- 第 1 列:submodule path(例如 `vendor/foo`)
|
|
121
|
+
- 第 2 列:target branch(例如 `release/channel-a`)
|
|
122
|
+
- 第 3 列(可选):remote 名(默认 `origin`)
|
|
123
|
+
- 生成模板(建议在确认 `Change_ID` 后执行;如文件已存在先备份再覆盖):
|
|
124
|
+
```bash
|
|
125
|
+
change_id="<change-id>"
|
|
126
|
+
targets="changes/${change_id}/submodules.targets"
|
|
127
|
+
mkdir -p "changes/${change_id}"
|
|
128
|
+
if [[ -f "${targets}" ]]; then
|
|
129
|
+
bak="${targets}.bak.$(date -u +%Y%m%d-%H%M%SZ)"
|
|
130
|
+
cp "${targets}" "${bak}"
|
|
131
|
+
echo "info: backup: ${bak}"
|
|
132
|
+
fi
|
|
133
|
+
: > "${targets}"
|
|
134
|
+
echo "# path<TAB>target_branch<TAB>remote(optional, default=origin)" >> "${targets}"
|
|
135
|
+
while read -r key sub_path; do
|
|
136
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
137
|
+
b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
138
|
+
[[ "${b:-}" == "." ]] && b="$(git branch --show-current)" # '.' means "follow superproject branch"
|
|
139
|
+
printf "%s\t%s\t%s\n" "${sub_path}" "${b:-<fill-me>}" "origin" >> "${targets}"
|
|
140
|
+
done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
|
|
141
|
+
echo "ok: wrote ${targets}"
|
|
142
|
+
```
|
|
143
|
+
- 计划里必须写清:本次交付选择的 `targets` 内容,以及后续在 `$ws-dev` 进入编码前会把 submodules 挂到 `aiws/pin/<target_branch>`(必要时先 `fetch`)。
|
|
144
|
+
|
|
145
|
+
输出要求:
|
|
146
|
+
- `Plan file:` <实际写入的路径>
|
|
147
|
+
- `Change context:` <当前 change 分支或 worktree 路径;若新建了 worktree 需明确写出>
|
|
148
|
+
- `Next:` 推荐下一步(先 `$ws-plan-verify`,通过后再 `$ws-dev`;或 `aiws change start <change-id> --hooks`,superproject + submodule 可用 `--worktree`)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-plan-verify
|
|
3
|
+
description: 计划质检(执行前检查计划是否过长/跑偏,并给出最小修正清单)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 在进入 `$ws-dev` 前,对 `plan/...` 与 `changes/<change-id>/proposal.md` 做一次“硬约束”质检
|
|
10
|
+
- 避免计划过长、步骤不够具体、验证不可复现、与需求合同绑定不一致
|
|
11
|
+
- 失败时只给最小修正项,修完后再进入实现
|
|
12
|
+
|
|
13
|
+
适用时机:
|
|
14
|
+
- 已执行过 `$ws-plan`,且准备开始编码
|
|
15
|
+
- 或用户反馈“计划太长/容易跑偏”,需要先压缩并对齐
|
|
16
|
+
|
|
17
|
+
阶段定位:
|
|
18
|
+
- planning gate;负责在编码前检查计划是否满足 change 严格契约。
|
|
19
|
+
|
|
20
|
+
必需输入:
|
|
21
|
+
- 当前 `plan/...`
|
|
22
|
+
- `changes/<change-id>/proposal.md`
|
|
23
|
+
- 当前 change 上下文
|
|
24
|
+
|
|
25
|
+
必需输出:
|
|
26
|
+
- `Quality gate:` pass/fail
|
|
27
|
+
- `Fix list:` 最小修正项
|
|
28
|
+
- `Next:` 通过则 `$ws-dev`,未通过则继续修正并复跑
|
|
29
|
+
|
|
30
|
+
阻断条件:
|
|
31
|
+
- 无法定位当前 change 或计划文件
|
|
32
|
+
- `aiws change validate <change-id> --strict` 未通过
|
|
33
|
+
|
|
34
|
+
完成判定:
|
|
35
|
+
- 计划满足严格门禁,且后续实现可以在不补需求/补绑定的情况下直接开始。
|
|
36
|
+
|
|
37
|
+
执行步骤(建议):
|
|
38
|
+
1) 先运行 `$ws-preflight`。
|
|
39
|
+
2) 识别 change 上下文:
|
|
40
|
+
- 优先从当前分支推断 `change/<change-id>`
|
|
41
|
+
- 若无法推断:读取 `changes/*/proposal.md` 中的 `Change_ID`,并让用户确认本次要质检的 change
|
|
42
|
+
3) 运行严格门禁(这是硬约束入口):
|
|
43
|
+
```bash
|
|
44
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
45
|
+
./node_modules/.bin/aiws change validate <change-id> --strict
|
|
46
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
47
|
+
aiws change validate <change-id> --strict
|
|
48
|
+
else
|
|
49
|
+
npx @aipper/aiws change validate <change-id> --strict
|
|
50
|
+
fi
|
|
51
|
+
```
|
|
52
|
+
4) 若失败:按报错逐条修正 `proposal.md` / `plan/...`,优先级如下:
|
|
53
|
+
- 先修绑定:`Change_ID` / `Req_ID|Problem_ID` / `Contract_Row` / `Plan_File` / `Evidence_Path`
|
|
54
|
+
- 再修计划质量:必需章节、步骤数量、步骤具体性、验证命令与预期
|
|
55
|
+
5) 复跑 strict 校验,直到通过。
|
|
56
|
+
6) 输出“可执行最小计划摘要”(3-8 步),再进入 `$ws-dev`。
|
|
57
|
+
|
|
58
|
+
输出要求:
|
|
59
|
+
- `Quality gate:` pass/fail
|
|
60
|
+
- `Fix list:` 仅保留必须修改项(按阻断级别排序)
|
|
61
|
+
- `Next:` 通过后建议 `$ws-dev`;未通过则继续修正并复跑 strict
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-preflight
|
|
3
|
+
description: 预检(提交前快速检查与建议)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:在开始任何“写代码/改配置/落盘文件”之前,对齐工作区真值文件,避免规则漂移。
|
|
9
|
+
|
|
10
|
+
阶段定位:
|
|
11
|
+
- workflow 入口阶段;负责判断当前仓库是否具备继续执行其它 `ws-*` 阶段的前置条件。
|
|
12
|
+
|
|
13
|
+
必需输入:
|
|
14
|
+
- 当前项目根目录候选路径
|
|
15
|
+
- `AI_PROJECT.md`
|
|
16
|
+
- `REQUIREMENTS.md`
|
|
17
|
+
- `AI_WORKSPACE.md`
|
|
18
|
+
|
|
19
|
+
必需输出:
|
|
20
|
+
- `Root:` 当前项目根
|
|
21
|
+
- `Found:` 实际读取到的真值文件
|
|
22
|
+
- `Missing:` 缺失项
|
|
23
|
+
- `OpenCode mode:` `oMo-enabled` / `standard-opencode`
|
|
24
|
+
- `Key rules:` 3-8 条约束摘要
|
|
25
|
+
- `Next:` 若真值齐全,建议进入 `$ws-plan` 或 `$ws-dev`;若缺失,建议先 `aiws init .`
|
|
26
|
+
|
|
27
|
+
阻断条件:
|
|
28
|
+
- 无法确定项目根目录
|
|
29
|
+
- 缺失任一真值文件
|
|
30
|
+
|
|
31
|
+
完成判定:
|
|
32
|
+
- 使用者已经知道当前仓库能否继续进入后续阶段,以及必须遵守的约束与下一步入口。
|
|
33
|
+
|
|
34
|
+
执行步骤(强制):
|
|
35
|
+
1) 定位项目根目录:
|
|
36
|
+
- 优先:`git rev-parse --show-toplevel`
|
|
37
|
+
- 若失败:停止并让用户确认当前目录是否为项目根(不要猜测)。
|
|
38
|
+
2) 在项目根目录读取以下文件(存在则必须读取;缺失则明确报告缺失项,不要臆测内容):
|
|
39
|
+
- `AI_PROJECT.md`
|
|
40
|
+
- `REQUIREMENTS.md`
|
|
41
|
+
- `AI_WORKSPACE.md`
|
|
42
|
+
3) 若缺失任意真值文件:不要继续“写代码/改配置/落盘文件”。先输出缺失项,并给出下一步建议:
|
|
43
|
+
- `npx @aipper/aiws init .`(或 `aiws init .`)初始化真值文件
|
|
44
|
+
- 然后重新执行 `$ws-preflight`
|
|
45
|
+
4) 输出:
|
|
46
|
+
- `Root:` <项目根路径>
|
|
47
|
+
- `Found:` <实际读取到的文件列表>
|
|
48
|
+
- `Missing:` <缺失文件列表>
|
|
49
|
+
- `OpenCode mode:`
|
|
50
|
+
- 若检测到 `.opencode/oh-my-opencode.json`:`oMo-enabled`
|
|
51
|
+
- 否则:`standard-opencode`
|
|
52
|
+
- 若为 `oMo-enabled`:附一句说明后续 `ws-plan` / `ws-review` / `ws-spec-review` / `ws-quality-review` / `ws-delegate` 会优先借用 oMo agent
|
|
53
|
+
- `Key rules:` 3–8 条 bullet(范围/禁止项/必须产物/必须验证命令)
|
|
54
|
+
5) 若存在 `.gitmodules`:
|
|
55
|
+
- 输出 submodule 列表:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
|
|
56
|
+
- 检查每个 submodule 是否配置 `submodule.<name>.branch`(缺失则提示先运行 `$ws-submodule-setup`;否则 `aiws validate .` 会失败)
|
|
57
|
+
|
|
58
|
+
安全:
|
|
59
|
+
- 不打印 secrets;遇到疑似敏感值只提示“存在风险”但不要复述原文。
|
|
60
|
+
- 不执行破坏性命令。
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-pull
|
|
3
|
+
description: 拉取并对齐 submodules(避免 detached;减少人为差异)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
背景:
|
|
9
|
+
- Git submodule 在别的电脑 `git submodule update` 后常见现象是子模块处于 detached HEAD(因为主仓库记录的是固定 gitlink commit)。
|
|
10
|
+
- detached 本身不一定是错,但会增加“需要手动切分支/容易忘”的操作差异。
|
|
11
|
+
|
|
12
|
+
目标:
|
|
13
|
+
- 安全拉取 superproject(默认只允许 fast-forward)
|
|
14
|
+
- 初始化/同步 submodules(`--init --recursive`)
|
|
15
|
+
- 在**不改动 superproject gitlink commit** 的前提下,尽量把每个 submodule 从 detached HEAD “挂回”到一个**确定的目标分支**(仅当该分支包含 gitlink commit 时)
|
|
16
|
+
- 若未配置 `.gitmodules` 的 `submodule.<name>.branch`:保持 detached,并提示先运行 `$ws-submodule-setup`
|
|
17
|
+
|
|
18
|
+
安全约束(强制):
|
|
19
|
+
- 不执行破坏性命令(不 `reset --hard` 主仓库;不改动远端)
|
|
20
|
+
- 不自动提交/不自动 push
|
|
21
|
+
- 若工作区不干净:停止并要求用户先 commit 或 stash(不要自动处理)
|
|
22
|
+
|
|
23
|
+
执行步骤(建议):
|
|
24
|
+
0) 输出上下文:
|
|
25
|
+
```bash
|
|
26
|
+
git rev-parse --show-toplevel
|
|
27
|
+
git branch --show-current
|
|
28
|
+
git status --porcelain
|
|
29
|
+
```
|
|
30
|
+
若 `git status --porcelain` 非空:停止,要求用户先清理工作区(commit 或 stash)。
|
|
31
|
+
|
|
32
|
+
1) 拉取 superproject(默认只允许 fast-forward,避免隐式 merge/rebase):
|
|
33
|
+
```bash
|
|
34
|
+
git pull --ff-only
|
|
35
|
+
```
|
|
36
|
+
若失败(需要 merge/rebase):停止并向用户解释原因,让用户明确选择 `git pull --rebase` 或手动处理。
|
|
37
|
+
|
|
38
|
+
2) 同步并更新 submodules 到 superproject 记录的 gitlink commit:
|
|
39
|
+
```bash
|
|
40
|
+
if [[ -f .gitmodules ]]; then
|
|
41
|
+
git submodule sync --recursive
|
|
42
|
+
git submodule update --init --recursive
|
|
43
|
+
else
|
|
44
|
+
echo "[info] no .gitmodules"
|
|
45
|
+
fi
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3) (可选但推荐)把 submodule 从 detached HEAD 尽量“挂回分支”,减少手工操作差异:
|
|
49
|
+
|
|
50
|
+
说明:
|
|
51
|
+
- 该步骤不会改变 superproject 的 gitlink commit(也不会让主仓库出现“submodule modified”)。
|
|
52
|
+
- 只在目标分支包含该 gitlink commit 时才执行“挂回”;否则保持 detached 并提示原因。
|
|
53
|
+
- 为了避免 origin 分支较多时“猜错分支”,本步骤**只在** `.gitmodules` 明确配置了 `submodule.<name>.branch` 时才执行“挂回分支”;否则保持 detached 并提示先运行 `$ws-submodule-setup` 对齐配置。
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
if [[ -f .gitmodules ]]; then
|
|
57
|
+
base_branch="$(git branch --show-current)"
|
|
58
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
|
|
59
|
+
| while read -r key sub_path; do
|
|
60
|
+
[[ -z "${sub_path:-}" ]] && continue
|
|
61
|
+
name="${key#submodule.}"
|
|
62
|
+
name="${name%.path}"
|
|
63
|
+
echo "== submodule: ${sub_path} (${name}) =="
|
|
64
|
+
|
|
65
|
+
sub_sha="$(git rev-parse "HEAD:${sub_path}" 2>/dev/null || true)"
|
|
66
|
+
if [[ -z "${sub_sha:-}" ]]; then
|
|
67
|
+
echo "[warn] failed to read gitlink sha for ${sub_path}"
|
|
68
|
+
continue
|
|
69
|
+
fi
|
|
70
|
+
|
|
71
|
+
cfg_branch="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
72
|
+
if [[ "${cfg_branch:-}" == "." ]]; then cfg_branch="$base_branch"; fi
|
|
73
|
+
if [[ -z "${cfg_branch:-}" ]]; then
|
|
74
|
+
echo "[warn] ${sub_path}: missing .gitmodules submodule.${name}.branch; keep detached (run ws-submodule-setup to set it)"
|
|
75
|
+
continue
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
target_branch="${cfg_branch}"
|
|
79
|
+
pin_branch="aiws/pin/${target_branch}"
|
|
80
|
+
|
|
81
|
+
git -C "${sub_path}" fetch origin --prune || true
|
|
82
|
+
|
|
83
|
+
if git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/origin/${target_branch}"; then
|
|
84
|
+
if git -C "${sub_path}" merge-base --is-ancestor "${sub_sha}" "origin/${target_branch}"; then
|
|
85
|
+
# 不改动现有分支(避免把已有 main/master 等分支强行指回旧 commit)
|
|
86
|
+
# 仅创建/更新一个 AIWS 专用 pin 分支指向 gitlink commit,从 detached “挂回分支”。
|
|
87
|
+
git -C "${sub_path}" checkout -B "${pin_branch}" "${sub_sha}"
|
|
88
|
+
git -C "${sub_path}" branch --set-upstream-to "origin/${target_branch}" "${pin_branch}" >/dev/null 2>&1 || true
|
|
89
|
+
echo "[ok] attached ${sub_path} to ${pin_branch} (upstream=origin/${target_branch}) at ${sub_sha}"
|
|
90
|
+
else
|
|
91
|
+
echo "[warn] ${sub_path}: ${sub_sha} is not in origin/${target_branch}; keep detached"
|
|
92
|
+
fi
|
|
93
|
+
else
|
|
94
|
+
echo "[warn] ${sub_path}: origin/${target_branch} not found; keep detached"
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
git -C "${sub_path}" rev-parse --abbrev-ref HEAD 2>/dev/null || true
|
|
98
|
+
git -C "${sub_path}" status -sb || true
|
|
99
|
+
done
|
|
100
|
+
fi
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
4) 一次性配置(方案 2):为每个 submodule 写入跟踪分支,便于团队统一(需要用户确认,会改动 `.gitmodules`):
|
|
104
|
+
```bash
|
|
105
|
+
# 示例:把某个 submodule 固定跟踪 main(会写入 .gitmodules 的 submodule.<name>.branch)
|
|
106
|
+
git submodule set-branch --branch main <sub_path>
|
|
107
|
+
|
|
108
|
+
# 提示:该变更需要提交到 superproject
|
|
109
|
+
git add .gitmodules
|
|
110
|
+
git commit -m "chore(submodule): set tracking branch"
|
|
111
|
+
```
|
|
112
|
+
建议:
|
|
113
|
+
- 只有当团队明确希望“子模块按分支滚动”(而不是锁定固定 commit)时,才采用方案 2。
|
|
114
|
+
- 若只是想避免 detached 但仍锁定 gitlink commit:优先使用步骤 3(不改 `.gitmodules`)。
|
|
115
|
+
- 推荐用 `$ws-submodule-setup` 交互式对齐所有 submodules 的 branch,并提交 `.gitmodules`。
|
|
116
|
+
|
|
117
|
+
输出要求:
|
|
118
|
+
- `Context:` 当前分支 + 是否存在 `.gitmodules` + submodule 列表
|
|
119
|
+
- `Result:` pull 是否 fast-forward;每个 submodule 是否成功“挂回分支”,失败原因是什么
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-push
|
|
3
|
+
description: 推送(submodule 感知:先 submodules 后 superproject;fast-forward 安全)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 在不自动提交的前提下,安全 push 当前仓库
|
|
10
|
+
- 若仓库包含 submodules:按 `submodules -> superproject` 顺序 push,减少“别人拉取后子模块 detached/分叉”的协作摩擦
|
|
11
|
+
- 若不包含 submodules:按普通 git 仓库的规则 push
|
|
12
|
+
|
|
13
|
+
安全约束(强制):
|
|
14
|
+
- 不自动提交、不自动 `git add -A`
|
|
15
|
+
- 不使用 `--force` / `--force-with-lease`
|
|
16
|
+
- 默认只允许 fast-forward push(发现分叉则停止并提示人工处理)
|
|
17
|
+
- 若工作区不干净:停止并要求先 commit 或 stash
|
|
18
|
+
|
|
19
|
+
执行步骤(建议):
|
|
20
|
+
0) 输出上下文:
|
|
21
|
+
```bash
|
|
22
|
+
git branch --show-current
|
|
23
|
+
git status --porcelain
|
|
24
|
+
git status -sb
|
|
25
|
+
```
|
|
26
|
+
若 `git status --porcelain` 非空:停止。
|
|
27
|
+
|
|
28
|
+
1) 判断是否存在 submodules:
|
|
29
|
+
```bash
|
|
30
|
+
if [[ -f .gitmodules ]]; then
|
|
31
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' || true
|
|
32
|
+
else
|
|
33
|
+
echo "[info] no .gitmodules"
|
|
34
|
+
fi
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2) 若不存在 `.gitmodules` 或没有 submodule 条目:按普通仓库 push(仍需用户确认):
|
|
38
|
+
```bash
|
|
39
|
+
git remote -v
|
|
40
|
+
git push
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3) 若存在 submodules:先检查 `.gitmodules` 的 branch 真值是否齐全(缺失则停止并提示 setup):
|
|
44
|
+
```bash
|
|
45
|
+
missing=0
|
|
46
|
+
while read -r key sub_path; do
|
|
47
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
48
|
+
b="$(git config --file .gitmodules --get "submodule.${name}.branch" 2>/dev/null || true)"
|
|
49
|
+
if [[ -z "${b:-}" ]]; then
|
|
50
|
+
echo "error: missing .gitmodules submodule.${name}.branch (path=${sub_path})"
|
|
51
|
+
missing=1
|
|
52
|
+
fi
|
|
53
|
+
done < <(git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null || true)
|
|
54
|
+
if [[ "$missing" -ne 0 ]]; then
|
|
55
|
+
echo "hint: run $ws-submodule-setup (and commit .gitmodules), then retry"
|
|
56
|
+
exit 2
|
|
57
|
+
fi
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
4) 逐个 push submodules(fast-forward only),再 push superproject:
|
|
61
|
+
```bash
|
|
62
|
+
base_branch="$(git branch --show-current)"
|
|
63
|
+
change_id="$(echo "${base_branch}" | sed -n 's|^change/||p')"
|
|
64
|
+
targets="changes/${change_id}/submodules.targets"
|
|
65
|
+
# Note: if not on a change/ branch, change_id is empty and targets file won't exist;
|
|
66
|
+
# resolution falls back to .gitmodules submodule.<name>.branch via ws_resolve_sub_target.
|
|
67
|
+
|
|
68
|
+
source tools/ws_resolve_sub_target.sh
|
|
69
|
+
|
|
70
|
+
git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$' 2>/dev/null \
|
|
71
|
+
| while read -r key sub_path; do
|
|
72
|
+
name="${key#submodule.}"; name="${name%.path}"
|
|
73
|
+
echo "== submodule: ${sub_path} (${name}) =="
|
|
74
|
+
|
|
75
|
+
# submodule 工作区必须干净
|
|
76
|
+
if [[ -n "$(git -C "${sub_path}" status --porcelain 2>/dev/null || true)" ]]; then
|
|
77
|
+
echo "error: submodule dirty: ${sub_path}"
|
|
78
|
+
exit 2
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
ws_resolve_sub_target "${sub_path}" "${name}" "${targets}" "${base_branch}" || exit 2
|
|
82
|
+
target_branch="${_resolved_branch}"
|
|
83
|
+
remote="${_resolved_remote}"
|
|
84
|
+
|
|
85
|
+
git -C "${sub_path}" fetch "${remote}" --prune
|
|
86
|
+
if ! git -C "${sub_path}" show-ref --verify --quiet "refs/remotes/${remote}/${target_branch}"; then
|
|
87
|
+
echo "error: missing ${remote}/${target_branch} for ${sub_path}"
|
|
88
|
+
exit 2
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# fast-forward only: <remote>/<branch> 必须是 HEAD 的祖先
|
|
92
|
+
if ! git -C "${sub_path}" merge-base --is-ancestor "${remote}/${target_branch}" HEAD; then
|
|
93
|
+
echo "error: non-fast-forward (submodule=${sub_path}, remote=${remote}, branch=${target_branch})"
|
|
94
|
+
echo "hint: rebase/merge in submodule, then retry"
|
|
95
|
+
exit 2
|
|
96
|
+
fi
|
|
97
|
+
|
|
98
|
+
# push HEAD -> <remote>/<branch>(不 force)
|
|
99
|
+
git -C "${sub_path}" push "${remote}" "HEAD:refs/heads/${target_branch}"
|
|
100
|
+
done
|
|
101
|
+
|
|
102
|
+
# 最后 push superproject(仍需用户确认远端/分支)
|
|
103
|
+
git remote -v
|
|
104
|
+
git push
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
输出要求:
|
|
108
|
+
- `Context:` 当前分支 + 是否有 submodules
|
|
109
|
+
- `Submodules:` 每个 submodule push 的目标分支与结果(成功/阻断原因)
|
|
110
|
+
- `Superproject:` push 结果
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-quality-review
|
|
3
|
+
description: 质量审查(行为回归 / 测试覆盖 / 实现质量)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:
|
|
9
|
+
- 审查当前改动的行为正确性、边界条件、测试覆盖和实现质量
|
|
10
|
+
- 把“代码/行为层 findings”优先落盘到 `changes/<change-id>/review/quality-review.md`
|
|
11
|
+
|
|
12
|
+
OpenCode + oMo 优先策略:
|
|
13
|
+
- 若检测到 `.opencode/oh-my-opencode.json`,或当前会话明确可用 `oracle` / `explore`,优先借用这些 agent 做质量审查。
|
|
14
|
+
- `@oracle` 优先负责独立质量/回归审查;`@explore` 负责补代码路径、依赖关系和影响面探索。
|
|
15
|
+
- 主 agent 负责把 findings / gaps / next 收敛并落盘。
|
|
16
|
+
|
|
17
|
+
阶段定位:
|
|
18
|
+
- review 子 gate;负责实现质量、行为回归与验证覆盖审查。
|
|
19
|
+
|
|
20
|
+
必需输入:
|
|
21
|
+
- 当前 `git diff`
|
|
22
|
+
- 已执行的验证结果
|
|
23
|
+
- 相关代码 / 配置 / 测试文件
|
|
24
|
+
- 若存在:`changes/<change-id>/analysis/`、`patches/`、已有 review 文件
|
|
25
|
+
|
|
26
|
+
必需输出:
|
|
27
|
+
- `证据(Evidence):` `changes/<change-id>/review/quality-review.md` 或回退 `.agentdocs/tmp/review/quality-review.md`
|
|
28
|
+
- `主要发现(Findings):` 高到低排序的问题 / 风险 / 缺失测试
|
|
29
|
+
- `下一步(Next):` 最小修复项与回归命令
|
|
30
|
+
|
|
31
|
+
阻断条件:
|
|
32
|
+
- 没有可审改动
|
|
33
|
+
- 没有任何验证上下文
|
|
34
|
+
- 无法写 review 证据
|
|
35
|
+
|
|
36
|
+
完成判定:
|
|
37
|
+
- 已落盘 quality review 证据,且 findings / 测试缺口 / next 明确。
|
|
38
|
+
|
|
39
|
+
步骤(建议):
|
|
40
|
+
1) 先读取 `git diff`、验证结果与相关代码。
|
|
41
|
+
- 若检测到 oMo:优先让 `@oracle` 做 quality review 草稿;必要时再调用 `@explore` 补代码路径上下文。
|
|
42
|
+
2) 检查:
|
|
43
|
+
- 行为是否可能回归
|
|
44
|
+
- 边界条件 / 失败路径是否覆盖
|
|
45
|
+
- 测试是否足以支撑改动
|
|
46
|
+
- 是否存在明显复杂度、耦合、可维护性或性能问题
|
|
47
|
+
3) 将结论落盘到:
|
|
48
|
+
- 默认:`changes/<change-id>/review/quality-review.md`
|
|
49
|
+
- 回退:`.agentdocs/tmp/review/quality-review.md`
|
|
50
|
+
4) 输出:
|
|
51
|
+
- `证据(Evidence):`
|
|
52
|
+
- `主要发现(Findings):`
|
|
53
|
+
- `测试缺口(Gaps):`
|
|
54
|
+
- `下一步(Next):`
|
|
55
|
+
|
|
56
|
+
重点:
|
|
57
|
+
- 这是质量 / 回归 review,不替代 requirements / gate review。
|
|
58
|
+
- 若发现流程、归因、evidence 缺口,转交给 `$ws-spec-review`。
|
|
59
|
+
|
|
60
|
+
安全:
|
|
61
|
+
- 不打印 secrets。
|
|
62
|
+
- 不执行破坏性命令。
|
|
63
|
+
- 若 oMo agent 不可用,回退为当前 agent 本地 quality review。
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ws-req-change
|
|
3
|
+
description: 需求变更(更新 REQUIREMENTS 并同步执行合同)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
7
|
+
|
|
8
|
+
目标:记录需求变更(更新 `REQUIREMENTS.md` + 追加 `requirements/CHANGELOG.md`),并同步/校验执行合同 `requirements/requirements-issues.csv`。
|
|
9
|
+
|
|
10
|
+
步骤(必须按顺序):
|
|
11
|
+
1) 读取:`AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`、`requirements/CHANGELOG.md`(缺失则创建目录与文件)。
|
|
12
|
+
2) 先产出“拟变更方案”(不要立刻写文件):
|
|
13
|
+
- 变更摘要(1–5 条)
|
|
14
|
+
- 影响范围(API/鉴权/字段/状态码/测试边界)
|
|
15
|
+
- 回滚思路(1–2 条)
|
|
16
|
+
3) 对比与冲突检查(强制,不写文件):
|
|
17
|
+
- 对比“变更前 vs 拟变更后”的差异清单(新增/删除/语义变化)
|
|
18
|
+
- 整理潜在冲突/不确定点(只列“最可能影响验收/实现”的,避免噪音)
|
|
19
|
+
4) 逐条澄清(强制,避免一次问完):
|
|
20
|
+
- 若存在潜在冲突/不确定点:**本轮只问 1 个**最高优先级问题(给出 2–4 个可选答案或二选一),然后停止,等待用户回复;不要继续问下一题,也不要写文件。
|
|
21
|
+
- 收到用户回复后:更新“拟变更方案”,回到步骤 3) 重新对比,直至没有未决问题。
|
|
22
|
+
5) 强制停下来让用户确认:是否继续落盘?(Y/N)
|
|
23
|
+
6) 用户确认 Y 后再写入:
|
|
24
|
+
- 更新 `REQUIREMENTS.md`(只保留当前有效版本,不在此堆历史)
|
|
25
|
+
- 追加 `requirements/CHANGELOG.md`
|
|
26
|
+
7) 同步/补齐需求执行合同(强制,自动处理 FlowSpec 有/无两种情况):
|
|
27
|
+
- `python3 tools/requirements_contract_sync.py --workspace .`
|
|
28
|
+
- 说明:若 `REQUIREMENTS.md` 中不存在 FlowSpec(或 flows 为空),该命令只会确保 `requirements/requirements-issues.csv` 表头存在并给出 WARN(这是预期行为,不要当成失败)。
|
|
29
|
+
8) 校验需求执行合同(强制):`python3 tools/requirements_contract.py validate`
|
|
30
|
+
9) 同步场景合同(可选,但若存在 FlowSpec 则强烈建议自动执行):
|
|
31
|
+
- 若 `REQUIREMENTS.md` 同时包含 `<!-- FLOW_SPEC_BEGIN -->` 与 `<!-- FLOW_SPEC_END -->`:运行 `$ws-req-flow-sync`
|
|
32
|
+
- 否则:跳过,并提示用户“可以先不维护 FlowSpec;后续需要场景回归时再补”
|
|
33
|
+
|
|
34
|
+
输出必须包含:
|
|
35
|
+
- 本次更新的文件清单(路径)
|
|
36
|
+
- 回滚方案(如何撤销本次需求变更)
|
|
37
|
+
- 下一步建议命令
|
|
38
|
+
|
|
39
|
+
安全:
|
|
40
|
+
- 不打印 `secrets/test-accounts.json`
|
|
41
|
+
- 不引入任何 token/密钥到仓库
|