@aipper/aiws-spec 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/cli-interface.md +10 -12
- package/docs/opencode-autonomous-swarm.md +178 -0
- package/docs/opencode-omo-adapter.md +123 -4
- package/docs/opencode-omo-validation-checklist.md +47 -0
- package/docs/opencode-subagent-first.md +187 -0
- package/docs/workflow-delegation-context-injection.md +217 -0
- package/docs/workflow-delegation-contracts.json +108 -2
- package/docs/workflow-delegation-contracts.md +13 -0
- package/docs/workflow-delegation-contracts.schema.json +152 -0
- package/docs/workflow-governance-rules.json +47 -6
- package/docs/workflow-governance-rules.md +8 -7
- package/docs/workflow-governance-rules.schema.json +39 -1
- package/docs/workflow-review-gates.json +6 -0
- package/docs/workflow-review-gates.md +14 -5
- package/docs/workflow-review-gates.schema.json +4 -0
- package/docs/workflow-router-rules.json +72 -8
- package/docs/workflow-router-rules.md +21 -14
- package/docs/workflow-router-rules.schema.json +4 -0
- package/docs/workflow-stage-contracts.json +24 -5
- package/docs/workflow-stage-contracts.md +16 -15
- package/docs/workflow-stage-contracts.schema.json +12 -1
- package/package.json +1 -1
- package/templates/workspace/.agents/skills/using-aiws/SKILL.md +16 -10
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.agents/skills/ws-dev/SKILL.md +82 -141
- package/templates/workspace/.agents/skills/ws-finish/SKILL.md +9 -204
- package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.agents/skills/ws-migrate/SKILL.md +6 -42
- package/templates/workspace/.agents/skills/ws-plan-verify/SKILL.md +6 -58
- package/templates/workspace/.agents/skills/ws-pull/SKILL.md +8 -109
- package/templates/workspace/.agents/skills/ws-push/SKILL.md +8 -100
- package/templates/workspace/.agents/skills/ws-review/SKILL.md +6 -1
- package/templates/workspace/.agents/skills/ws-submodule-setup/SKILL.md +10 -57
- package/templates/workspace/.agents/skills/ws-verify-before-complete/SKILL.md +12 -53
- package/templates/workspace/{changes → .aiws/changes}/README.md +20 -23
- package/templates/workspace/{changes → .aiws/changes}/templates/proposal.md +12 -12
- package/templates/workspace/{changes → .aiws/changes}/templates/tasks.md +8 -8
- package/templates/workspace/{issues → .aiws/issues}/problem-issues.csv +1 -1
- package/templates/workspace/.aiws/journal/.gitkeep +1 -0
- package/templates/workspace/{requirements → .aiws/requirements}/requirements-issues.csv +1 -1
- package/templates/workspace/.aiws/tmp/.gitkeep +0 -0
- package/templates/workspace/{tools → .aiws/tools}/requirements_contract.py +2 -2
- package/templates/workspace/{tools → .aiws/tools}/requirements_contract_sync.py +2 -2
- package/templates/workspace/{tools → .aiws/tools}/requirements_flow_gen.py +1 -1
- package/templates/workspace/{tools → .aiws/tools}/server_test_runner.py +10 -10
- package/templates/workspace/{tools → .aiws/tools}/ws_change_check.py +23 -23
- package/templates/workspace/{tools → .aiws/tools}/ws_resolve_sub_target.sh +2 -2
- package/templates/workspace/{tools → .aiws/tools}/ws_tasks_plan.py +3 -3
- package/templates/workspace/.claude/commands/ws-review.md +5 -1
- package/templates/workspace/.claude/settings.json.example +26 -0
- package/templates/workspace/.claude/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.claude/skills/ws-dev/SKILL.md +52 -141
- package/templates/workspace/.claude/skills/ws-finish/SKILL.md +9 -204
- package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.claude/skills/ws-migrate/SKILL.md +6 -42
- package/templates/workspace/.claude/skills/ws-plan-verify/SKILL.md +6 -49
- package/templates/workspace/.claude/skills/ws-pull/SKILL.md +8 -109
- package/templates/workspace/.claude/skills/ws-push/SKILL.md +8 -100
- package/templates/workspace/.claude/skills/ws-review/SKILL.md +6 -1
- package/templates/workspace/.claude/skills/ws-submodule-setup/SKILL.md +10 -57
- package/templates/workspace/.claude/skills/ws-verify-before-complete/SKILL.md +12 -53
- package/templates/workspace/.githooks/pre-commit +13 -0
- package/templates/workspace/.githooks/pre-push +7 -0
- package/templates/workspace/.opencode/command/ws-auto.md +33 -0
- package/templates/workspace/.opencode/command/ws-autonomy.md +25 -0
- package/templates/workspace/.opencode/command/ws-review.md +5 -1
- package/templates/workspace/.opencode/commands/ws-auto.md +33 -0
- package/templates/workspace/.opencode/commands/ws-autonomy.md +25 -0
- package/templates/workspace/.opencode/commands/ws-commit.md +4 -56
- package/templates/workspace/.opencode/commands/ws-deliver.md +10 -50
- package/templates/workspace/.opencode/commands/ws-finish.md +11 -3
- package/templates/workspace/.opencode/commands/ws-handoff.md +9 -17
- package/templates/workspace/.opencode/commands/ws-migrate.md +10 -17
- package/templates/workspace/.opencode/commands/ws-plan-verify.md +5 -15
- package/templates/workspace/.opencode/commands/ws-pull.md +6 -75
- package/templates/workspace/.opencode/commands/ws-push.md +7 -82
- package/templates/workspace/.opencode/commands/ws-review.md +5 -1
- package/templates/workspace/.opencode/commands/ws-submodule-setup.md +8 -47
- package/templates/workspace/.opencode/commands/ws-verify-before-complete.md +10 -19
- package/templates/workspace/.opencode/helpers/approval-whitelist-check.sh +148 -0
- package/templates/workspace/.opencode/helpers/approval-whitelist-run.sh +82 -0
- package/templates/workspace/.opencode/helpers/approval-whitelist-watchdog.sh +144 -0
- package/templates/workspace/.opencode/helpers/tmux-swarm-rescue.sh +56 -0
- package/templates/workspace/.opencode/helpers/tmux-swarm-scan.sh +46 -0
- package/templates/workspace/.opencode/lib/aiws-context.js +953 -0
- package/templates/workspace/.opencode/oh-my-opencode.json.example +64 -4
- package/templates/workspace/.opencode/plugins/aiws-inject-context.js +201 -0
- package/templates/workspace/.opencode/plugins/aiws-session-start.js +86 -0
- package/templates/workspace/.opencode/plugins/aiws-workflow-state.js +116 -0
- package/templates/workspace/.opencode/scripts/ws-plan-gen-submodule-targets.sh +27 -0
- package/templates/workspace/.opencode/scripts/ws-plan-setup-worktree.sh +31 -0
- package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +130 -77
- package/templates/workspace/.opencode/skills/ws-analyze/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-auto/SKILL.md +46 -0
- package/templates/workspace/.opencode/skills/ws-autonomy/SKILL.md +62 -0
- package/templates/workspace/.opencode/skills/ws-bugfix/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +6 -118
- package/templates/workspace/.opencode/skills/ws-delegate/SKILL.md +115 -40
- package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +6 -218
- package/templates/workspace/.opencode/skills/ws-dev/SKILL.md +105 -146
- package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +23 -7
- package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +9 -204
- package/templates/workspace/.opencode/skills/ws-frontend-design/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +10 -44
- package/templates/workspace/.opencode/skills/ws-intake/SKILL.md +43 -4
- package/templates/workspace/.opencode/skills/ws-migrate/SKILL.md +6 -42
- package/templates/workspace/.opencode/skills/ws-plan/SKILL.md +15 -55
- package/templates/workspace/.opencode/skills/ws-plan-verify/SKILL.md +6 -49
- package/templates/workspace/.opencode/skills/ws-preflight/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-pull/SKILL.md +8 -109
- package/templates/workspace/.opencode/skills/ws-push/SKILL.md +8 -100
- package/templates/workspace/.opencode/skills/ws-quality-review/SKILL.md +7 -2
- package/templates/workspace/.opencode/skills/ws-req-change/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-contract-sync/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-contract-validate/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-flow-sync/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-req-review/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-review/SKILL.md +35 -4
- package/templates/workspace/.opencode/skills/ws-rule/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-spec-review/SKILL.md +1 -1
- package/templates/workspace/.opencode/skills/ws-submodule-setup/SKILL.md +10 -57
- package/templates/workspace/.opencode/skills/ws-verify-before-complete/SKILL.md +45 -55
- package/templates/workspace/AGENTS.md +32 -84
- package/templates/workspace/AI_PROJECT.md +5 -5
- package/templates/workspace/AI_WORKSPACE.md +1 -1
- package/templates/workspace/REQUIREMENTS.md +1 -1
- package/templates/workspace/gitignore +1 -1
- package/templates/workspace/manifest.json +215 -395
- /package/templates/workspace/{changes → .aiws/changes}/templates/design.md +0 -0
- /package/templates/workspace/{memory-bank → .aiws/memory-bank}/README.md +0 -0
- /package/templates/workspace/{memory-bank → .aiws/memory-bank}/architecture.md +0 -0
- /package/templates/workspace/{memory-bank → .aiws/memory-bank}/implementation-plan.md +0 -0
- /package/templates/workspace/{memory-bank → .aiws/memory-bank}/progress.md +0 -0
- /package/templates/workspace/{memory-bank → .aiws/memory-bank}/tech-stack.md +0 -0
- /package/templates/workspace/{requirements → .aiws/requirements}/CHANGELOG.md +0 -0
- /package/templates/workspace/{secrets → .aiws/secrets}/test-accounts.example.json +0 -0
|
@@ -1,52 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-handoff
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws handoff`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-handoff
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 让 change 的交接信息可回放:`handoff.md`(包含:本次完成/改动文件/关键决策/下一步建议/绑定)
|
|
10
|
-
- 若存在协同工件:在 handoff 中一并概述 `analysis/`、`patches/`、`review/`、`evidence/`
|
|
11
|
-
- 指引在归档与依赖场景下如何使用 handoff
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws handoff`. See `aiws handoff --help` for details.
|
|
12
9
|
|
|
13
|
-
说明:
|
|
14
|
-
- `handoff.md` 默认由 `aiws change finish --push` 自动归档时生成:`changes/archive/<date>-<change-id>/handoff.md`
|
|
15
|
-
- `Depends_On` 依赖若已归档,`aiws change start` 会尝试读取依赖的 `handoff.md` 并输出摘要
|
|
16
|
-
|
|
17
|
-
阶段定位:
|
|
18
|
-
- handoff / archive 阶段;负责查看或补充已归档 change 的交接说明。
|
|
19
|
-
|
|
20
|
-
必需输入:
|
|
21
|
-
- 已归档的 `change/<change-id>`
|
|
22
|
-
- 对应 archive 目录
|
|
23
|
-
|
|
24
|
-
必需输出:
|
|
25
|
-
- `Change_ID:` 当前交接对象
|
|
26
|
-
- `Handoff:` `changes/archive/.../handoff.md`
|
|
27
|
-
- `Next:` 推荐后续 change / `Depends_On` 关系
|
|
28
|
-
|
|
29
|
-
阻断条件:
|
|
30
|
-
- 无法定位目标 change
|
|
31
|
-
- `handoff.md` 无法生成或读取
|
|
32
|
-
|
|
33
|
-
完成判定:
|
|
34
|
-
- 下一位协作者可以只依赖 `handoff.md` 和绑定信息继续工作,而不需要回溯整段会话。
|
|
35
|
-
|
|
36
|
-
执行建议:
|
|
37
|
-
1) 先运行 `$ws-preflight`。
|
|
38
|
-
2) 先确认本 change 已通过 `aiws change finish <change-id> --push` 完成自动归档。
|
|
39
|
-
3) 查看 handoff:
|
|
40
10
|
```bash
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
11
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
12
|
+
./node_modules/.bin/aiws handoff
|
|
13
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
14
|
+
aiws handoff
|
|
15
|
+
else
|
|
16
|
+
npx @aipper/aiws handoff
|
|
17
|
+
fi
|
|
44
18
|
```
|
|
45
|
-
4) 若是历史/异常场景,尚未归档且需要手工恢复,再运行 `aiws change archive <change-id>`。
|
|
46
|
-
5) 若要让后续 change 可接力:在 `proposal.md` 里声明 `Blocks`(下一步建议会据此生成)。
|
|
47
|
-
6) 若本 change 使用了外部 / 子 agent 协作:确认关键结论已经进入 `review/` 或 `evidence/`,避免 handoff 只留下原始 patch/分析文件而没有最终结论。
|
|
48
|
-
|
|
49
|
-
输出要求:
|
|
50
|
-
- `Change_ID:` <change-id>
|
|
51
|
-
- `Handoff:` `changes/archive/.../handoff.md`
|
|
52
|
-
- `Next:` 若还有后续工作,建议创建新 change 并在其 `Depends_On` 引用本 change
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-intake
|
|
3
|
-
description:
|
|
3
|
+
description: 使用时机:新需求需要逐条澄清、冻结问题时。触发词:需求澄清、intake、冻结问题、前期沟通。注意:需求已冻结直接进 ws-plan。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
@@ -10,6 +10,35 @@ description: 计划前置澄清(逐条冻结问题并产出 intake 草案,
|
|
|
10
10
|
- 采用“一题一线程”模式推进:每次只处理 1 个问题,允许该问题多轮往返,直到形成明确结论。
|
|
11
11
|
- 产出一份可被 `/ws-plan` 消费的轻量草案:`plan/<timestamp>-<slug>.intake.md`。
|
|
12
12
|
|
|
13
|
+
## 发散-收敛两子阶段
|
|
14
|
+
|
|
15
|
+
当需求模糊、方向不明确时,intake 分两子阶段推进:
|
|
16
|
+
|
|
17
|
+
### 发散阶段(Explore)
|
|
18
|
+
- 目标:快速探索 2-3 个可能方向,不深入任何单一方向
|
|
19
|
+
- 输出:每个方向的 1-2 段摘要 + 关键风险 + 依赖
|
|
20
|
+
- 时限:不超过 3 轮对话
|
|
21
|
+
|
|
22
|
+
### 收敛阶段(Converge)
|
|
23
|
+
- 目标:从发散结果中选择 1 个方向,逐条冻结具体问题
|
|
24
|
+
- 回到标准"一题一线程"模式
|
|
25
|
+
- 把发散产出的摘要作为收敛的输入上下文
|
|
26
|
+
|
|
27
|
+
触发条件:用户说"不确定"/"多个方向"/"帮我分析" 等模糊表达。
|
|
28
|
+
非模糊需求不需要经过发散阶段,直接进入收敛。
|
|
29
|
+
|
|
30
|
+
## 核心原则:一次一个问题
|
|
31
|
+
|
|
32
|
+
- 每轮只推进 1 个 `Open Questions` 中的问题
|
|
33
|
+
- 当前问题未标记 `frozen` 或 `deferred` 前,不进入下一题
|
|
34
|
+
- 输出格式:`Current question → Why it matters → Options → Exit condition`
|
|
35
|
+
- 用户选择后立即写盘更新草案,再进入下一题
|
|
36
|
+
|
|
37
|
+
**队列保护**:若用户一次提出多个问题,必须显式建队(Queue),逐一处理——不可同时推进多个维度。队列格式:
|
|
38
|
+
- Queue: [Q1: ..., Q2: ..., Q3: ...]
|
|
39
|
+
- Current: Q1
|
|
40
|
+
- Status: [open/in_discussion/frozen/deferred] per item
|
|
41
|
+
|
|
13
42
|
执行要求:
|
|
14
43
|
1) 先读 `AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`,必要时先 `/ws-preflight`。
|
|
15
44
|
2) 若存在最新 `plan/*.intake.md`,先续写它;否则新建一份 intake 草案。
|
|
@@ -18,8 +47,9 @@ description: 计划前置澄清(逐条冻结问题并产出 intake 草案,
|
|
|
18
47
|
- `Current question:`
|
|
19
48
|
- `Why it matters:`
|
|
20
49
|
- `Current options / current understanding:`
|
|
21
|
-
|
|
22
|
-
|
|
50
|
+
- `Exit condition:`
|
|
51
|
+
- 每个问题独立线程:在未标记 frozen/deferred 前,不进入下一题。问答往返不限轮数,但一次只处理一个维度的决策。
|
|
52
|
+
5) 若用户一次提出多个问题,必须显式排队:列出所有问题编号,按顺序逐个处理;不得同时推进多个问题的讨论。输出格式:`Queued questions: #1, #2, ... | Current: #1`
|
|
23
53
|
6) 每轮都要把 intake 草案写盘,至少包含:
|
|
24
54
|
- `Context`
|
|
25
55
|
- `Open Questions`
|
|
@@ -28,4 +58,13 @@ description: 计划前置澄清(逐条冻结问题并产出 intake 草案,
|
|
|
28
58
|
- `Draft Scope`
|
|
29
59
|
- `Draft Verify`
|
|
30
60
|
- `Ready for ws-plan: yes/no`
|
|
31
|
-
7)
|
|
61
|
+
7) 错误状态节点(Error States):
|
|
62
|
+
- 在 intake 草案中专设 `Error States` 小节,覆盖已知失败模式:
|
|
63
|
+
- 网络/超时/第三方依赖不可用时的系统行为
|
|
64
|
+
- 数据一致性(并发写入、部分失败、脏数据)
|
|
65
|
+
- 输入校验边界(空、超大、非预期类型)
|
|
66
|
+
- 若识别到需要回滚的场景:在 `Error States` 中写明回滚条件与回滚方式。
|
|
67
|
+
8) 回滚规范(Rollback Spec):
|
|
68
|
+
- 当 intake 涉及现有数据迁移、API 契约变更、配置漂移修复时,必须包含 `Rollback Plan` 小节。
|
|
69
|
+
- `Rollback Plan` 至少包含:触发条件、回滚步骤、验证回滚成功的方式、副作用清单。
|
|
70
|
+
9) 若关键问题已冻结:`Next` 指向 `/ws-plan`;否则继续 `/ws-intake`。
|
|
@@ -1,54 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-migrate
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws migrate`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-migrate
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws migrate`. See `aiws migrate --help` for details.
|
|
9
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
10
|
```bash
|
|
43
11
|
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
44
|
-
./node_modules/.bin/aiws
|
|
12
|
+
./node_modules/.bin/aiws migrate
|
|
45
13
|
elif command -v aiws >/dev/null 2>&1; then
|
|
46
|
-
aiws
|
|
14
|
+
aiws migrate
|
|
47
15
|
else
|
|
48
|
-
npx @aipper/aiws
|
|
16
|
+
npx @aipper/aiws migrate
|
|
49
17
|
fi
|
|
50
18
|
```
|
|
51
|
-
|
|
52
|
-
约束:
|
|
53
|
-
- 不写入任何 secrets。
|
|
54
|
-
- 不执行破坏性命令。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-plan
|
|
3
|
-
description:
|
|
3
|
+
description: 使用时机:需要生成执行计划、建立 change 绑定时。触发词:计划、规划、方案、设计、change。注意:需求未冻结先用 ws-intake。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
@@ -52,41 +52,15 @@ OpenCode + oMo 优先策略:
|
|
|
52
52
|
- 若检测到 oMo:优先让 `planner-sisyphus` 生成 planning draft;若需要补结构探索,再委托 `@explore` / `@librarian`。
|
|
53
53
|
2) 若用户任务描述不清:先问 1-3 个关键澄清问题(不要猜)。
|
|
54
54
|
3) 判断复杂度:`simple / medium / complex`(给出一句理由),并估算步骤数。
|
|
55
|
-
4) 识别或建立主索引 / change 上下文:
|
|
55
|
+
4) 识别或建立主索引 / change 上下文:
|
|
56
56
|
- 若存在 `changes/<change-id>/proposal.md`:读取其中 `Change_ID` / `Req_ID` / `Problem_ID` / `Contract_Row` / `Evidence_Path`
|
|
57
57
|
- 若缺失关键绑定:先补齐 proposal(至少 `Change_ID`、`Req_ID|Problem_ID`、`Contract_Row`)再继续生成计划
|
|
58
|
-
- 若当前不在 `change/<change-id>` 分支 / worktree,且本次任务需要新建 change
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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/...` 写回原工作区
|
|
58
|
+
- 若当前不在 `change/<change-id>` 分支 / worktree,且本次任务需要新建 change:
|
|
59
|
+
```bash
|
|
60
|
+
bash .opencode/scripts/ws-plan-setup-worktree.sh <change-id>
|
|
61
|
+
```
|
|
62
|
+
脚本自动处理:dirty 检查、commits/submodules 检测、worktree 创建。
|
|
63
|
+
- 若脚本创建了 worktree:后续所有读取/写入都必须切到 `aiws change start` 输出的 `worktree:` 路径中进行;不要把 `plan/...` 写回原工作区
|
|
90
64
|
5) 生成计划文件:
|
|
91
65
|
- 文件名:`plan/YYYY-MM-DD_HH-MM-SS-<slug>.md`(`<slug>` 用 kebab-case;同一任务调整计划时尽量复用同一文件)
|
|
92
66
|
- 若 `plan/` 不存在先创建
|
|
@@ -100,10 +74,12 @@ fi
|
|
|
100
74
|
- `Plan`:分步执行(每步尽量落到具体文件/命令;必要时拆 Phase)
|
|
101
75
|
- `Submodules`(当存在 `.gitmodules` 且声明了 submodule 条目时,强制):声明“本次 change 的 submodule 目标分支真值”(用于同一 superproject 分支内的多渠道交付;也避免仅靠 `.gitmodules` 默认分支导致交付推送到错误分支)
|
|
102
76
|
- `Verify`:可复现命令 + 期望结果(优先引用 `AI_WORKSPACE.md` 的入口;必要时补充 e2e)
|
|
103
|
-
|
|
77
|
+
- `Risks & Rollback`:风险点 + 回滚方案(例如 git 回滚、`aiws rollback`、恢复备份等)
|
|
78
|
+
- 若 intake 草案包含 `Error States` 或 `Rollback Plan`:必须显式引用并纳入本计划的 `Risks & Rollback` 中,不能丢弃 intake 已识别的问题
|
|
104
79
|
- `Evidence`:计划文件路径;若创建了变更工件则附 `changes/<change-id>/...`
|
|
105
80
|
7) 若存在 change proposal:回填并对齐 `proposal.md` 的 `Plan_File`(必要时同步 `Contract_Row` / `Evidence_Path`),保证 plan/proposal 一致。
|
|
106
81
|
8) 运行 `$ws-plan-verify` 作为执行前质量门(计划不过长、不跑偏、验证可复现)。
|
|
82
|
+
- 通过后:标记 `[workflow-state:plan:DONE]` 或 `[workflow-state:gate:plan_passed]`,表示 plan 阶段已收敛。
|
|
107
83
|
9) 若计划涉及“需求/验收”变更:先用 `$ws-req-review` 评审 → 用户确认后再 `$ws-req-change` 落盘(避免需求漂移)。
|
|
108
84
|
10) 多步任务(≥2 步):后续进入实现时,使用 `update_plan` 工具跟踪 `pending → in_progress → completed`。
|
|
109
85
|
|
|
@@ -120,26 +96,10 @@ oMo 回退:
|
|
|
120
96
|
- 第 1 列:submodule path(例如 `vendor/foo`)
|
|
121
97
|
- 第 2 列:target branch(例如 `release/channel-a`)
|
|
122
98
|
- 第 3 列(可选):remote 名(默认 `origin`)
|
|
123
|
-
-
|
|
124
|
-
```bash
|
|
125
|
-
|
|
126
|
-
|
|
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
|
-
```
|
|
99
|
+
- 生成模板:
|
|
100
|
+
```bash
|
|
101
|
+
bash .opencode/scripts/ws-plan-gen-submodule-targets.sh <change-id>
|
|
102
|
+
```
|
|
143
103
|
- 计划里必须写清:本次交付选择的 `targets` 内容,以及后续在 `$ws-dev` 进入编码前会把 submodules 挂到 `aiws/pin/<target_branch>`(必要时先 `fetch`)。
|
|
144
104
|
|
|
145
105
|
输出要求:
|
|
@@ -1,61 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-plan-verify
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws plan-verify`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-plan-verify
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 在进入 `$ws-dev` 前,对 `plan/...` 与 `changes/<change-id>/proposal.md` 做一次“硬约束”质检
|
|
10
|
-
- 避免计划过长、步骤不够具体、验证不可复现、与需求合同绑定不一致
|
|
11
|
-
- 失败时只给最小修正项,修完后再进入实现
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws plan-verify`. See `aiws plan-verify --help` for details.
|
|
12
9
|
|
|
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
10
|
```bash
|
|
44
11
|
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
45
|
-
./node_modules/.bin/aiws
|
|
12
|
+
./node_modules/.bin/aiws plan-verify
|
|
46
13
|
elif command -v aiws >/dev/null 2>&1; then
|
|
47
|
-
aiws
|
|
14
|
+
aiws plan-verify
|
|
48
15
|
else
|
|
49
|
-
npx @aipper/aiws
|
|
16
|
+
npx @aipper/aiws plan-verify
|
|
50
17
|
fi
|
|
51
18
|
```
|
|
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
|
|
@@ -1,119 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-pull
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws pull`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-pull
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- Git submodule 在别的电脑 `git submodule update` 后常见现象是子模块处于 detached HEAD(因为主仓库记录的是固定 gitlink commit)。
|
|
10
|
-
- detached 本身不一定是错,但会增加“需要手动切分支/容易忘”的操作差异。
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws pull`. See `aiws pull --help` for details.
|
|
11
9
|
|
|
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
10
|
```bash
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
|
11
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
12
|
+
./node_modules/.bin/aiws pull
|
|
13
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
14
|
+
aiws pull
|
|
43
15
|
else
|
|
44
|
-
|
|
16
|
+
npx @aipper/aiws pull
|
|
45
17
|
fi
|
|
46
18
|
```
|
|
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 是否成功“挂回分支”,失败原因是什么
|
|
@@ -1,110 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-push
|
|
3
|
-
description:
|
|
3
|
+
description: Thin wrapper for `aiws push`
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# ws-push
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
- 在不自动提交的前提下,安全 push 当前仓库
|
|
10
|
-
- 若仓库包含 submodules:按 `submodules -> superproject` 顺序 push,减少“别人拉取后子模块 detached/分叉”的协作摩擦
|
|
11
|
-
- 若不包含 submodules:按普通 git 仓库的规则 push
|
|
8
|
+
Thin skill wrapper. Delegates to `aiws push`. See `aiws push --help` for details.
|
|
12
9
|
|
|
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
10
|
```bash
|
|
30
|
-
if [[ -
|
|
31
|
-
|
|
11
|
+
if [[ -x "./node_modules/.bin/aiws" ]]; then
|
|
12
|
+
./node_modules/.bin/aiws push
|
|
13
|
+
elif command -v aiws >/dev/null 2>&1; then
|
|
14
|
+
aiws push
|
|
32
15
|
else
|
|
33
|
-
|
|
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
|
|
16
|
+
npx @aipper/aiws push
|
|
57
17
|
fi
|
|
58
18
|
```
|
|
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 结果
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ws-quality-review
|
|
3
|
-
description:
|
|
3
|
+
description: 使用时机:需要审查实现质量、测试覆盖时。触发词:质量审查、质量、回归、覆盖、代码体检。注意:流程完整性审查请用 ws-spec-review。
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
@@ -43,7 +43,12 @@ OpenCode + oMo 优先策略:
|
|
|
43
43
|
- 行为是否可能回归
|
|
44
44
|
- 边界条件 / 失败路径是否覆盖
|
|
45
45
|
- 测试是否足以支撑改动
|
|
46
|
-
|
|
46
|
+
- 是否存在明显复杂度、耦合、可维护性或性能问题
|
|
47
|
+
- **AI-Slop 检查**(source: `workflow-review-gates.json` aiSlopChecks):
|
|
48
|
+
- unnecessary_abstraction:过度抽象(单实现接口、未使用的泛化层)
|
|
49
|
+
- fake_comments:伪注释(表述代码行为但不解释 why,或与代码不一致)
|
|
50
|
+
- over_defensive:过度防御(不必要的安全检查、对不可能情况的处理)
|
|
51
|
+
- cargo_cult:货舱崇拜(照搬模式但不理解原因,如不必要的 observer/strategy)
|
|
47
52
|
3) 将结论落盘到:
|
|
48
53
|
- 默认:`changes/<change-id>/review/quality-review.md`
|
|
49
54
|
- 回退:`.agentdocs/tmp/review/quality-review.md`
|