@aipper/aiws-spec 0.0.25 → 0.0.27
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/aiws-governance-positioning.md +1 -1
- package/docs/cli-interface.md +10 -5
- package/docs/collaboration-artifacts.md +1 -1
- package/docs/spec-contract.md +5 -12
- package/docs/workflow-governance-rules.json +18 -4
- package/docs/workflow-governance-rules.md +8 -6
- package/docs/workflow-router-rules.json +2 -2
- package/docs/workflow-router-rules.md +2 -2
- package/docs/workflow-stage-contracts.json +9 -9
- package/docs/workflow-stage-contracts.md +5 -5
- package/package.json +1 -1
- package/templates/workspace/.agents/skills/using-aiws/SKILL.md +5 -1
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +4 -1
- package/templates/workspace/.agents/skills/ws-deliver/SKILL.md +3 -4
- package/templates/workspace/.agents/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.agents/skills/ws-finish/SKILL.md +13 -16
- package/templates/workspace/.agents/skills/ws-handoff/SKILL.md +8 -8
- package/templates/workspace/.aiws/manifest.json +2 -6
- package/templates/workspace/.claude/commands/using-aiws.md +3 -2
- package/templates/workspace/.claude/commands/ws-dev-lite.md +31 -0
- package/templates/workspace/.claude/commands/ws-finish.md +9 -5
- package/templates/workspace/.claude/commands/ws-handoff.md +3 -2
- package/templates/workspace/.claude/commands/ws-review.md +2 -2
- package/templates/workspace/.claude/skills/using-aiws/SKILL.md +5 -1
- package/templates/workspace/.claude/skills/ws-commit/SKILL.md +4 -1
- package/templates/workspace/.claude/skills/ws-deliver/SKILL.md +3 -4
- package/templates/workspace/.claude/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.claude/skills/ws-finish/SKILL.md +13 -16
- package/templates/workspace/.claude/skills/ws-handoff/SKILL.md +8 -8
- package/templates/workspace/.githooks/commit-msg +10 -0
- package/templates/workspace/.opencode/command/using-aiws.md +3 -2
- package/templates/workspace/.opencode/command/ws-dev-lite.md +34 -0
- package/templates/workspace/.opencode/command/ws-finish.md +9 -5
- package/templates/workspace/.opencode/command/ws-handoff.md +4 -3
- package/templates/workspace/.opencode/command/ws-review.md +2 -2
- package/templates/workspace/.opencode/commands/using-aiws.md +3 -2
- package/templates/workspace/.opencode/commands/ws-dev-lite.md +34 -0
- package/templates/workspace/.opencode/commands/ws-finish.md +9 -5
- package/templates/workspace/.opencode/commands/ws-handoff.md +4 -3
- package/templates/workspace/.opencode/commands/ws-review.md +2 -2
- package/templates/workspace/.opencode/skills/using-aiws/SKILL.md +5 -1
- package/templates/workspace/.opencode/skills/ws-commit/SKILL.md +4 -1
- package/templates/workspace/.opencode/skills/ws-deliver/SKILL.md +3 -4
- package/templates/workspace/.opencode/skills/ws-dev-lite/SKILL.md +58 -0
- package/templates/workspace/.opencode/skills/ws-finish/SKILL.md +13 -16
- package/templates/workspace/.opencode/skills/ws-handoff/SKILL.md +8 -8
- package/templates/workspace/AGENTS.md +5 -3
- package/templates/workspace/AI_PROJECT.md +1 -1
- package/templates/workspace/AI_WORKSPACE.md +1 -1
- package/templates/workspace/changes/README.md +10 -6
- package/templates/workspace/changes/templates/tasks.md +1 -1
- package/templates/workspace/manifest.json +63 -80
- package/templates/workspace/memory-bank/README.md +1 -2
- package/templates/workspace/tools/ws_change_check.py +224 -7
- 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-deliver.toml +0 -58
- 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-finish.toml +0 -54
- 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
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# Command: server:drain
|
|
2
|
-
# Description: 低输出 runner 循环:小批量执行直到出现 BLOCKED 或全部 DONE/SKIP
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "低输出 runner 循环:小批量执行直到出现 BLOCKED 或全部 DONE/SKIP"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出;命令与路径保持原样不翻译。
|
|
10
|
-
|
|
11
|
-
目标:用**极少输出**把 TODO 推进到 DONE/SKIP,避免长时间让 LLM 参与导致 token 膨胀或 iFlow 崩溃。
|
|
12
|
-
|
|
13
|
-
行为:
|
|
14
|
-
- 只循环运行 `tools/server_test_runner.py`(小批量:--max-endpoints)。
|
|
15
|
-
- 一旦检测到 `issues/server-api-issues.csv` 出现 BLOCKED:立即停止,并提示用户进入 `/server-fix`(修复闭环)。
|
|
16
|
-
- 不读取/不打印 `.out` / `.log.txt` 正文;只输出汇总数字与下一步命令。
|
|
17
|
-
|
|
18
|
-
无人值守(可选):
|
|
19
|
-
- 推荐用外部 watchdog(systemd/cron)启动本命令;当检测到 BLOCKED 或 iFlow 崩溃时,由 watchdog 决定是否触发 `/server-fix`。
|
|
20
|
-
|
|
21
|
-
前置:
|
|
22
|
-
- 当前目录为 workspace 根目录(目录A)
|
|
23
|
-
- 已存在 AI_WORKSPACE.md、REQUIREMENTS.md、tools/server_test_runner.py、secrets/test-accounts.json
|
|
24
|
-
- 已安装 uv
|
|
25
|
-
|
|
26
|
-
Execute:
|
|
27
|
-
!{bash -lc '
|
|
28
|
-
set -euo pipefail
|
|
29
|
-
|
|
30
|
-
die() { echo "error: $*" >&2; exit 2; }
|
|
31
|
-
need() { [[ -f "$1" ]] || die "missing: $1"; }
|
|
32
|
-
|
|
33
|
-
need "AI_WORKSPACE.md"
|
|
34
|
-
need "REQUIREMENTS.md"
|
|
35
|
-
need "tools/server_test_runner.py"
|
|
36
|
-
need "secrets/test-accounts.json"
|
|
37
|
-
command -v uv >/dev/null 2>&1 || die "missing: uv"
|
|
38
|
-
|
|
39
|
-
csv="issues/server-api-issues.csv"
|
|
40
|
-
max_rounds="${IFLOW_DRAIN_MAX_ROUNDS:-50}"
|
|
41
|
-
max_endpoints="${IFLOW_DRAIN_MAX_ENDPOINTS:-30}"
|
|
42
|
-
sleep_s="${IFLOW_DRAIN_SLEEP_S:-0}"
|
|
43
|
-
|
|
44
|
-
runner_args=(--workspace . --manage-service --max-endpoints "$max_endpoints" --max-response-bytes 65536 --max-report-blocked 50)
|
|
45
|
-
|
|
46
|
-
lock_dir=".agentdocs/tmp/server-test/.drain.lock"
|
|
47
|
-
mkdir -p ".agentdocs/tmp/server-test"
|
|
48
|
-
if ! mkdir "$lock_dir" 2>/dev/null; then
|
|
49
|
-
echo "error: another /server-drain is running (lock: $lock_dir)" >&2
|
|
50
|
-
exit 2
|
|
51
|
-
fi
|
|
52
|
-
cleanup() { rmdir "$lock_dir" 2>/dev/null || true; }
|
|
53
|
-
trap cleanup EXIT INT TERM
|
|
54
|
-
|
|
55
|
-
echo "drain: max_rounds=$max_rounds max_endpoints=$max_endpoints auto_fix=$auto_fix auto_fix_max=$auto_fix_max sleep_s=$sleep_s"
|
|
56
|
-
echo "drain: max_rounds=$max_rounds max_endpoints=$max_endpoints sleep_s=$sleep_s"
|
|
57
|
-
|
|
58
|
-
i=1
|
|
59
|
-
while [[ "$i" -le "$max_rounds" ]]; do
|
|
60
|
-
echo ""
|
|
61
|
-
echo "== round $i =="
|
|
62
|
-
uv run tools/server_test_runner.py "${runner_args[@]}" >/dev/null
|
|
63
|
-
|
|
64
|
-
if [[ ! -f "$csv" ]]; then
|
|
65
|
-
die "missing after runner: $csv"
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# Print minimal summary (no bodies/logs).
|
|
69
|
-
python3 - <<PY 2>/dev/null || true
|
|
70
|
-
import csv
|
|
71
|
-
from collections import Counter
|
|
72
|
-
path="$csv"
|
|
73
|
-
with open(path, newline="", encoding="utf-8") as f:
|
|
74
|
-
rows=list(csv.DictReader(f))
|
|
75
|
-
c=Counter((r.get("Test_Status","") or "").strip().upper() for r in rows)
|
|
76
|
-
print("summary:", " ".join(f"{k}={c.get(k,0)}" for k in ["DONE","BLOCKED","SKIP","TODO","DOING"]))
|
|
77
|
-
PY
|
|
78
|
-
|
|
79
|
-
if grep -qE ",BLOCKED," "$csv"; then
|
|
80
|
-
echo "blocked: detected BLOCKED in $csv"
|
|
81
|
-
echo "next: /server-fix"
|
|
82
|
-
exit 3
|
|
83
|
-
fi
|
|
84
|
-
|
|
85
|
-
if grep -qE ",(TODO|DOING)," "$csv"; then
|
|
86
|
-
if [[ "$sleep_s" -gt 0 ]]; then sleep "$sleep_s" || true; fi
|
|
87
|
-
i=$((i+1))
|
|
88
|
-
continue
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
echo "ok: all DONE/SKIP (no TODO/DOING/BLOCKED)"
|
|
92
|
-
exit 0
|
|
93
|
-
done
|
|
94
|
-
|
|
95
|
-
echo "warn: reached max rounds ($max_rounds) with remaining TODO/DOING"
|
|
96
|
-
echo "next: re-run /server-drain (or switch to /server-fix if you suspect hidden failures)"
|
|
97
|
-
exit 1
|
|
98
|
-
'}
|
|
99
|
-
"""
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Command: server:fix-and-commit
|
|
2
|
-
# Description: 自动修复闭环,全部通过后提交子模块(仅 test 环境)
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "自动修复闭环,全部通过后提交子模块(仅 test 环境)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:减少人工干预,一条命令完成:
|
|
12
|
-
1) `/server-fix` 自动闭环(必要时自动补齐计划与产物,runner 生成 report)
|
|
13
|
-
2) 若全部 DONE/SKIP,则自动执行 `/server-commit`
|
|
14
|
-
|
|
15
|
-
边界:
|
|
16
|
-
- 只允许在测试环境执行自动提交:AI_WORKSPACE.md 中必须声明 `environment: \"test\"`
|
|
17
|
-
- 若仍有 BLOCKED/TODO/DOING,则禁止提交
|
|
18
|
-
- 禁止提交敏感文件(.env、secrets/ 等);若检测到应停止并提示整改
|
|
19
|
-
- 不做 push
|
|
20
|
-
|
|
21
|
-
执行步骤(按顺序):
|
|
22
|
-
1) 先执行 `/server-fix`,直到:
|
|
23
|
-
- 全部 DONE/SKIP(通过),或
|
|
24
|
-
- 达到迭代上限(失败停止)
|
|
25
|
-
2) 若通过:立即执行 `/server-commit`
|
|
26
|
-
3) 若未通过:输出剩余 BLOCKED 清单与证据路径(report.json / *.out / *.log.txt),不要提交
|
|
27
|
-
"""
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
# Command: server:fix
|
|
2
|
-
# Description: 自动修复闭环:分诊 -> 最小修复 -> 复测直到 DONE/SKIP
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "自动修复闭环:分诊 -> 最小修复 -> 复测直到 DONE/SKIP"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在测试环境(AI_WORKSPACE.md: environment=test)中,针对“单服务”为主的工作区,自动进入闭环:
|
|
12
|
-
(计划)->(执行测试)->(更新 issues CSV + 证据)->(定位)->(修复)->(复测),直到验收通过或达到迭代上限。
|
|
13
|
-
|
|
14
|
-
自动化(减少人工干预):
|
|
15
|
-
- 不要求先手动执行 `/server-test-plan`:如果检测到“计划/执行合同产物缺失”,本命令会先按 `/server-test-plan` 的规则自动补齐计划与产物,再进入闭环。
|
|
16
|
-
|
|
17
|
-
前置(必须满足):
|
|
18
|
-
- 当前目录为工作区根目录(目录A)
|
|
19
|
-
- 已存在 AI_WORKSPACE.md、REQUIREMENTS.md
|
|
20
|
-
- 已存在 tools/server_test_runner.py(uv 可用)
|
|
21
|
-
- 已存在 secrets/test-accounts.json(敏感,不展示内容)
|
|
22
|
-
|
|
23
|
-
你日常只需要关注的产物(其余可忽略):
|
|
24
|
-
- `issues/server-fix-issues.csv`:修复清单(runner 自动生成/更新,包含证据与建议)
|
|
25
|
-
- `issues/server-triage-issues.csv`:需要人工介入的条目(证据不足/需业务判断/日志缺 request_id 等)
|
|
26
|
-
- `.agentdocs/tmp/server-test/report.{json,md}`:证据包与汇总
|
|
27
|
-
|
|
28
|
-
说明(避免混乱):
|
|
29
|
-
- `issues/server-api-issues.csv` 是 runner 的“执行合同/端点账本”,用于记录每个 endpoint 的状态机与期望字段,便于跳过 DONE、聚焦 BLOCKED;你不需要手工维护它。
|
|
30
|
-
- 如你希望尽量减少 LLM 参与、降低 token:可先运行 `/server-drain` 把 TODO 推进到 DONE/SKIP,遇到 BLOCKED 再进入本命令。
|
|
31
|
-
|
|
32
|
-
闭环策略(必须按此执行):
|
|
33
|
-
0) 计划/执行合同预检(若缺失则先补齐):
|
|
34
|
-
- 若 `issues/server-api-issues.csv` 不存在:先从 OpenAPI 生成(runner 会自动 upsert)
|
|
35
|
-
- 若 `.agentdocs/tmp/server-test/report.json` 不存在:先运行 runner 生成证据包
|
|
36
|
-
- 若 `docs/openapi.json` 不存在:优先通过 AI_WORKSPACE.md:openapi_url 从运行服务导出(runner 的 --refresh-openapi)
|
|
37
|
-
- 若 REQUIREMENTS.md 的接口需求未填:先把 REQUIREMENTS.md 补齐到“可验收”(否则修复会跑偏)
|
|
38
|
-
1) 运行 runner(默认小批量,避免长时间运行导致上下文/输出膨胀;需要时重复运行多轮):
|
|
39
|
-
- 单服务推荐默认:`uv run tools/server_test_runner.py --workspace . --manage-service --max-endpoints 30 --max-response-bytes 65536 --max-report-blocked 50`
|
|
40
|
-
- 若需要刷新 OpenAPI:在上述命令后追加 `--refresh-openapi`
|
|
41
|
-
2) 只读取“摘要与清单”,不要读取大文件全文(防止 token 爆炸):
|
|
42
|
-
- 先读 `.agentdocs/tmp/server-test/report.md`(摘要)
|
|
43
|
-
- 再读 `issues/server-fix-issues.csv` 与 `issues/server-triage-issues.csv`
|
|
44
|
-
- 只在需要时,按证据路径打开单个 `*.out` 或 `*.log.txt`(最多 1-2 个 BLOCKED)
|
|
45
|
-
3) 若存在 BLOCKED:
|
|
46
|
-
a) 只处理 Top 3 BLOCKED:对每个 BLOCKED,按 Evidence 读取证据文件路径(resp=... / log_snippet=...),不要把文件内容整段贴回输出
|
|
47
|
-
b) 判断是“需求/业务对齐”还是“代码/配置问题”
|
|
48
|
-
c) 对代码/配置问题:先用 Context7 查对应栈(按 server_dir 检测:pom.xml/gradle/go.mod/Cargo.toml),再做最小修复
|
|
49
|
-
d) 单服务默认直接复测;多服务时只复测相关 service(设置 CSV 对应项为 TODO/BLOCKED 即可;runner 会跳过 DONE)
|
|
50
|
-
4) 每轮最多修复 3 个 BLOCKED,最多迭代 5 轮;超出则停止并给出剩余问题清单与建议
|
|
51
|
-
|
|
52
|
-
输出限制(防止 iFlow 崩溃):
|
|
53
|
-
- 每轮输出只包含:汇总数字 + Top 3 BLOCKED(Issue_ID/Method/Path/证据路径)+ 1-3 条下一步命令
|
|
54
|
-
- 不要输出任何日志/响应正文;一律用文件路径引用
|
|
55
|
-
|
|
56
|
-
边界:
|
|
57
|
-
- 不做破坏性数据操作;除非 AI_WORKSPACE.md allow_mutations=true 且 REQUIREMENTS.md 明确允许
|
|
58
|
-
- 不泄露 secrets
|
|
59
|
-
- 不做 git commit(提交由 /server-commit 负责)
|
|
60
|
-
- 反死循环:连续 2 轮 BLOCKED 数不下降时,必须缩小范围(只跑单 service/单 endpoint)或先修环境/先补齐 REQUIREMENTS,不能继续盲改
|
|
61
|
-
|
|
62
|
-
当全部 DONE/SKIP:
|
|
63
|
-
- 默认输出:可以执行 `/server-commit`
|
|
64
|
-
- 若希望“一条命令自动提交”,使用 `/server-fix-and-commit`(仅限 environment=test)
|
|
65
|
-
"""
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Command: server:test-plan
|
|
2
|
-
# Description: 规划 workspace 级 server API 测试(发现服务目录、记录接口、生成 issues CSV)
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "规划 workspace 级 server API 测试(发现服务目录、记录接口、生成 issues CSV)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
IMPORTANT:
|
|
10
|
-
- Use Chinese for all narrative output (plans, explanations, headings).
|
|
11
|
-
- Keep commands/paths/code identifiers in their original form.
|
|
12
|
-
|
|
13
|
-
Create a concrete, executable plan to test server APIs in a workspace directory that may contain multiple projects (backend/frontend) with non-fixed names.
|
|
14
|
-
|
|
15
|
-
First, read these workspace-standard files (if present in cwd):
|
|
16
|
-
- AI_WORKSPACE.md (workspace discovery and run overrides)
|
|
17
|
-
- REQUIREMENTS.md (single source of truth for requirements)
|
|
18
|
-
If AI_WORKSPACE.md defines a Request-ID convention, follow it (default: X-Request-Id and log field request_id=<id>).
|
|
19
|
-
If AI_WORKSPACE.md defines OpenAPI conventions, follow them (default: docs/openapi.json).
|
|
20
|
-
|
|
21
|
-
Secrets:
|
|
22
|
-
- If secrets/test-accounts.json exists, treat it as sensitive. Never print its contents.
|
|
23
|
-
- Use it only to know headers/base_url/accounts for testing.
|
|
24
|
-
|
|
25
|
-
Output format:
|
|
26
|
-
1) GOALS / NON-GOALS (must match REQUIREMENTS.md)
|
|
27
|
-
2) Discovery strategy:
|
|
28
|
-
- Identify server directories (non-fixed names) using AI_WORKSPACE.md server_dirs if provided,
|
|
29
|
-
else detect by markers: Cargo.toml (Rust), go.mod (Go), pom.xml/gradle (Java).
|
|
30
|
-
- For each server dir, detect build/test/start commands (prefer explicit overrides in AI_WORKSPACE.md).
|
|
31
|
-
3) API inventory strategy (pick in order, per server):
|
|
32
|
-
- OpenAPI spec as source of truth:
|
|
33
|
-
- Prefer docs/openapi.json if present
|
|
34
|
-
- Else export from running server (AI_WORKSPACE.md openapi_url) into docs/openapi.json
|
|
35
|
-
- Runtime route dump endpoint if available (framework-specific)
|
|
36
|
-
- Code scan fallback (list routes from framework conventions)
|
|
37
|
-
4) Artifacts (execution contract):
|
|
38
|
-
- docs/api.md: API document draft (method/path/auth/request/response/error)
|
|
39
|
-
- issues/server-api-issues.csv: rows for each endpoint with a state machine (no percentages)
|
|
40
|
-
Columns MUST include:
|
|
41
|
-
Issue_ID, Service, Title, Method, Path, Auth, Request_Example, Expected_Status,
|
|
42
|
-
Expected_Body_Checks, Log_Checks, Test_Status, Review_Status, Notes
|
|
43
|
-
Test_Status: TODO | DOING | DONE | BLOCKED | SKIP
|
|
44
|
-
Review_Status: PENDING | REVIEWING | APPROVED
|
|
45
|
-
5) Execution loop:
|
|
46
|
-
- Build -> start (capture logs) -> wait health -> for each endpoint: request -> check response -> check logs -> update CSV
|
|
47
|
-
- If fail: smallest fix, implement, rerun only failing items
|
|
48
|
-
- Requests MUST include X-Request-Id; log checks should prefer grepping by that id (fallback to time-window grep)
|
|
49
|
-
- If tools/server_test_runner.py exists and uv is available, prefer using:
|
|
50
|
-
- uv run tools/server_test_runner.py --workspace .
|
|
51
|
-
- (optional) uv run tools/server_test_runner.py --workspace . --refresh-openapi
|
|
52
|
-
- (optional) uv run tools/server_test_runner.py --workspace . --manage-service
|
|
53
|
-
6) Rollback plan (git restore / revert / stop processes)
|
|
54
|
-
7) Verification commands + expected results
|
|
55
|
-
|
|
56
|
-
Constraints:
|
|
57
|
-
- Assume Linux. Avoid docker-compose (not used).
|
|
58
|
-
- If AI_WORKSPACE.md declares environment=test and allow_mutations=true, you may include mutating endpoints in the plan,
|
|
59
|
-
but still require explicit coverage and expectations in REQUIREMENTS.md.
|
|
60
|
-
- Otherwise, do not hit destructive endpoints unless explicitly allowed in REQUIREMENTS.md.
|
|
61
|
-
- Ask 1-2 clarification questions only if required info is missing.
|
|
62
|
-
"""
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Command: server:test
|
|
2
|
-
# Description: 执行 workspace 级 server API 测试循环(构建/运行/请求/日志/迭代)
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "执行 workspace 级 server API 测试循环(构建/运行/请求/日志/迭代)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
IMPORTANT:
|
|
10
|
-
- Use Chinese for all narrative output (status, summaries, next steps).
|
|
11
|
-
- Keep commands/paths/code identifiers in their original form.
|
|
12
|
-
|
|
13
|
-
Execute the workspace-level server API test loop in the current directory.
|
|
14
|
-
|
|
15
|
-
Preflight (must do):
|
|
16
|
-
- Read AI_WORKSPACE.md and REQUIREMENTS.md if present.
|
|
17
|
-
- Ensure secrets/test-accounts.json exists; if missing, ask user to create it from ai-workspace/templates/secrets/test-accounts.example.json.
|
|
18
|
-
- Never print secrets from secrets/test-accounts.json.
|
|
19
|
-
- Generate a per-request X-Request-Id and include it in every request; prefer correlating logs by request_id / X-Request-Id.
|
|
20
|
-
|
|
21
|
-
Working dirs / artifacts:
|
|
22
|
-
- Create .agentdocs/tmp/server-test/ for logs and outputs.
|
|
23
|
-
- Maintain docs/api.md and issues/server-api-issues.csv as the execution contract.
|
|
24
|
-
- Maintain issues/server-fix-issues.csv as the "next fix" list when any endpoint is BLOCKED.
|
|
25
|
-
|
|
26
|
-
Steps:
|
|
27
|
-
1) Discover server dirs (AI_WORKSPACE.md server_dirs or marker-based detection).
|
|
28
|
-
- If tools/server_test_runner.py exists, prefer using it (uv + python runner) to generate/update issues/server-api-issues.csv and execute requests.
|
|
29
|
-
- The runner will use docs/openapi.json as source of truth and enforce Expected_Status when present; keep Expected_Status aligned with OpenAPI/requirements.
|
|
30
|
-
2) For each server:
|
|
31
|
-
a) Determine build/test/start commands (prefer explicit overrides).
|
|
32
|
-
b) Build and start in background, capturing stdout/stderr to .agentdocs/tmp/server-test/<service>.log
|
|
33
|
-
c) Wait for health endpoint (AI_WORKSPACE.md health_path + base_url; fallback /health).
|
|
34
|
-
d) Inventory endpoints (source of truth):
|
|
35
|
-
- Prefer docs/openapi.json if present
|
|
36
|
-
- Else export OpenAPI from running server (AI_WORKSPACE.md openapi_url) into docs/openapi.json
|
|
37
|
-
- Else fallback to route dump / code scan
|
|
38
|
-
Then ensure endpoints exist in issues/server-api-issues.csv (add missing rows).
|
|
39
|
-
e) For each endpoint row with Test_Status in TODO/BLOCKED:
|
|
40
|
-
- Set Test_Status=DOING
|
|
41
|
-
- Execute request (curl preferred; python3 httpx/requests acceptable if installed), always include X-Request-Id header
|
|
42
|
-
- Save response to .agentdocs/tmp/server-test/<service>__<endpoint-slug>.out
|
|
43
|
-
- Prefer grepping logs by request_id / X-Request-Id; fallback to ERROR|Exception|Stacktrace time-window grep; update Notes with evidence (no secrets)
|
|
44
|
-
- Mark DONE if passes, else BLOCKED
|
|
45
|
-
f) Stop the server cleanly (do not leave background processes).
|
|
46
|
-
3) If anything is BLOCKED:
|
|
47
|
-
- Propose the smallest fix to satisfy REQUIREMENTS.md, implement it, and rerun ONLY blocked endpoints.
|
|
48
|
-
- Do not stop at "needs next step": keep the loop until all DONE/SKIP or you hit the iteration cap; keep issues/server-fix-issues.csv current.
|
|
49
|
-
4) Finish when all endpoints are DONE/SKIP and build has no errors.
|
|
50
|
-
|
|
51
|
-
Hard rules:
|
|
52
|
-
- Linux-first commands.
|
|
53
|
-
- If AI_WORKSPACE.md declares environment=test and allow_mutations=true, mutating endpoint tests are allowed,
|
|
54
|
-
but only for endpoints explicitly listed/required by REQUIREMENTS.md.
|
|
55
|
-
- Otherwise, no destructive tests unless explicitly permitted.
|
|
56
|
-
- No leaking of secrets or tokens.
|
|
57
|
-
- Do not claim tests passed unless commands were executed and outputs observed.
|
|
58
|
-
"""
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# Command: server:triage
|
|
2
|
-
# Description: 基于 report.json + issues CSV 分诊失败项,给出与 REQUIREMENTS 对齐的修复建议
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "基于 report.json + issues CSV 分诊失败项,给出与 REQUIREMENTS 对齐的修复建议"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:把“测试结果 → 可执行修复清单”自动化,减少人工判断。
|
|
12
|
-
|
|
13
|
-
输入(在 cwd/workspace 根目录):
|
|
14
|
-
- AI_WORKSPACE.md(server_dirs、base_url、openapi 约定、Request-Id 约定)
|
|
15
|
-
- REQUIREMENTS.md(唯一真值:业务边界/验收标准)
|
|
16
|
-
- issues/server-api-issues.csv(执行合同)
|
|
17
|
-
- issues/server-fix-issues.csv(runner 自动生成的“下一步修复清单”,用于聚焦 BLOCKED)
|
|
18
|
-
- .agentdocs/tmp/server-test/report.json(runner 自动生成;若缺失,先运行 runner 生成)
|
|
19
|
-
|
|
20
|
-
规则:
|
|
21
|
-
- 不打印 secrets/test-accounts.json 内容
|
|
22
|
-
- 若 report.json 不存在:直接运行
|
|
23
|
-
`uv run tools/server_test_runner.py --workspace . --manage-service`
|
|
24
|
-
再继续 triage
|
|
25
|
-
- triage 结束时:必须确保 `issues/server-fix-issues.csv` 已更新(若缺失则重新运行 runner)
|
|
26
|
-
- 将 BLOCKED 分成两类,并给出下一步:
|
|
27
|
-
A) 需求/业务对齐问题:Expected_Status/Expected_Body_Checks 与 REQUIREMENTS.md 不一致 → 先更新 REQUIREMENTS/CSV,再改代码
|
|
28
|
-
B) 代码/配置问题:500/解析异常/安全链路/日志缺 request_id 等 → 先用 Context7 查对应技术文档,再给最小修复点
|
|
29
|
-
- 反死循环:若同一 BLOCKED 连续出现且证据不变,优先缩小范围(只跑单 service/单 endpoint)或先修环境/先补齐 REQUIREMENTS
|
|
30
|
-
|
|
31
|
-
输出必须包含:
|
|
32
|
-
1) 结论:当前是否可以进入提交阶段(是否全部 DONE/SKIP)
|
|
33
|
-
2) BLOCKED Top 列表(按影响排序,引用 Issue_ID + endpoint + 证据文件路径,如 report.json / *.out / *.log.txt)
|
|
34
|
-
3) 每个 BLOCKED 的“修复动作”:
|
|
35
|
-
- 需要改哪些文件(给相对路径)
|
|
36
|
-
- 建议如何验证(优先 rerun runner;必要时只跑对应 service)
|
|
37
|
-
4) 若涉及请求日志关联:明确要求服务端输出 `request_id=<id>` 或按 AI_WORKSPACE.md 的约定
|
|
38
|
-
"""
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Command: server_test-plan
|
|
2
|
-
# Description: 与 /server-test-plan 等价的下划线别名
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "与 /server-test-plan 等价的下划线别名"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
等价于 `/server-test-plan`:请按相同规则生成工作区后端接口测试计划(OpenAPI -> issues CSV -> 闭环执行)。
|
|
12
|
-
"""
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Command: server_test
|
|
2
|
-
# Description: 与 /server-test 等价的下划线别名
|
|
3
|
-
# Category: server
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "与 /server-test 等价的下划线别名"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
等价于 `/server-test`:请按相同规则在当前工作区执行接口测试闭环(runner 优先,BLOCKED 自动进入修复建议/闭环)。
|
|
12
|
-
"""
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Command: ws:analyze
|
|
2
|
-
# Description: AI Workspace 多模型技术分析(Claude + Codex + Gemini),证据落盘到 .agentdocs/tmp/analyze/
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "AI Workspace 多模型技术分析(Claude + Codex + Gemini),证据落盘到 .agentdocs/tmp/analyze/"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在实现/修复前,对当前工作区做技术分析,形成可验证行动清单,并把结果落盘到 `.agentdocs/tmp/analyze/` 便于回放。
|
|
12
|
-
|
|
13
|
-
输入:
|
|
14
|
-
- 本命令参数(如有)视为分析主题(topic)。
|
|
15
|
-
|
|
16
|
-
强制步骤:
|
|
17
|
-
1) 预检:读取 `AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`。
|
|
18
|
-
2) 若 iFlow 拦截写入:先执行 `/ws-contract-check`,再继续。
|
|
19
|
-
3) 输出(必须):
|
|
20
|
-
- GOALS / NON-GOALS(必须映射到 `REQUIREMENTS.md`)
|
|
21
|
-
- Top risks(3–8 条,按高→低)
|
|
22
|
-
- Next actions(最小可验证步骤清单;每步包含 Verify 命令与 Expected)
|
|
23
|
-
4) 证据落盘(必须):
|
|
24
|
-
- 在 `.agentdocs/tmp/analyze/` 写入一份 `analysis.<timestamp>.md`(或等价文件)
|
|
25
|
-
- 文件中必须包含:本次读取到的真值文件列表、以及上述输出
|
|
26
|
-
5) 建议下一步(择一):
|
|
27
|
-
- 进入交付闭环:`/ws-dev`
|
|
28
|
-
- 需求对齐:`/ws-req-review` 或 `/ws-req-change`
|
|
29
|
-
|
|
30
|
-
边界:
|
|
31
|
-
- 不打印任何 secrets(尤其是 `secrets/test-accounts.json`)。
|
|
32
|
-
- 不执行破坏性命令。
|
|
33
|
-
"""
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# Command: ws:commit
|
|
2
|
-
# Description: 提交(先审计/门禁并落盘证据;submodule 感知;当前分支可直提)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "提交(先审计/门禁并落盘证据;submodule 感知;当前分支可直提)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在不要求切换 `change/<change-id>` 的前提下,在当前分支完成一次安全提交:先审计与门禁,再检查 staging,最后 `git commit`;若仓库含 submodule,必须先处理 submodule 再提交 superproject 的 gitlink。
|
|
12
|
-
补充:若你经常遇到 submodule detached,建议日常拉取优先使用 `ws:pull`(尽量把 submodule “挂回分支”且不改变 gitlink commit)。
|
|
13
|
-
|
|
14
|
-
安全约束(强制):
|
|
15
|
-
- 不自动 `git add -A`;只在用户明确指示时才做 staging
|
|
16
|
-
- 不使用 `--no-verify` 绕过 hooks
|
|
17
|
-
- 不自动 push
|
|
18
|
-
- 不打印 secrets
|
|
19
|
-
- commit message 优先使用中文;若启用了 `.githooks/commit-msg`,默认仅提示,只有 strict 模式才会拒绝全英文首行(`Merge/Revert/fixup!/squash!` 例外)
|
|
20
|
-
|
|
21
|
-
强制步骤:
|
|
22
|
-
1) 读取真值文件:`AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`(缺失则先运行 `/aiws-init` 或 `aiws init .`)。
|
|
23
|
-
2) 若 iFlow 拦截写入:先执行 `/ws-contract-check`,再继续。
|
|
24
|
-
3) 先运行 `/ws-review`(优先落盘审计证据到 `changes/<change-id>/review/`)。
|
|
25
|
-
4) 运行门禁并写 stamp:`aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)。
|
|
26
|
-
5) 输出提交上下文(必须输出给用户确认):
|
|
27
|
-
- `git branch --show-current`
|
|
28
|
-
- `git status --porcelain`
|
|
29
|
-
6) submodule 感知检查(必须):
|
|
30
|
-
- 若存在 `.gitmodules`:输出 submodule 列表:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
|
|
31
|
-
- 对每个 `<sub_path>` 输出:
|
|
32
|
-
- `git -C "<sub_path>" rev-parse --abbrev-ref HEAD`
|
|
33
|
-
- `git -C "<sub_path>" status --porcelain`
|
|
34
|
-
- 判定规则:任一 submodule `git status --porcelain` 非空 → **停止提交 superproject**,先在该 submodule 完成 commit,再回到 superproject 更新并提交 gitlink。
|
|
35
|
-
- 若该 submodule 当前为 detached HEAD:先按 `.gitmodules` 的目标分支挂到 `aiws/pin/<target-branch>`;不要直接切 `change/<change-id>` / `main` / `master`。
|
|
36
|
-
7) 检查 staging(必须输出给用户确认):
|
|
37
|
-
- `git status --porcelain`
|
|
38
|
-
- `git diff --staged --submodule=short`
|
|
39
|
-
8) 若没有 staged changes:停止并提示用户先明确要提交哪些文件(例如 `git add -p` 或 `git add <path>`)。
|
|
40
|
-
9) 优先生成并确认中文 commit message(格式建议:`<类型>: <简述>`;若用户明确要求英文也可保留,但 strict 模式下会被 hook 拒绝)。
|
|
41
|
-
10) 执行提交(不带 `--no-verify`):`git commit -m "<message>"`。
|
|
42
|
-
|
|
43
|
-
输出必须包含:
|
|
44
|
-
- 证据(Evidence):`changes/<change-id>/review/*`(无 change-id 时回退 `.agentdocs/tmp/review/*`) + `.agentdocs/tmp/aiws-validate/*`
|
|
45
|
-
- 上下文(Context):当前分支 + 是否检测到 submodule + 若阻断则给出阻断原因
|
|
46
|
-
"""
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
# Command: ws:contract-check
|
|
2
|
-
# Description: 在任何写入前确认已读取需求/规则(生成 stamp 供 pre_tool_guard 放行)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "在任何写入前确认已读取需求/规则(生成 stamp 供 pre_tool_guard 放行)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在开始任何代码/配置写入前,强制完成一次“工作区 contract 预检”,并写入 stamp 文件供 iFlow `pre_tool_guard.sh` 放行。
|
|
12
|
-
|
|
13
|
-
执行(会检查/提示缺失项,并写入 `.agentdocs/tmp/.iflow-contract-checked`):
|
|
14
|
-
!{bash -lc '
|
|
15
|
-
set -euo pipefail
|
|
16
|
-
|
|
17
|
-
ws_root="$(git rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
18
|
-
cd "$ws_root"
|
|
19
|
-
|
|
20
|
-
if ! command -v python3 >/dev/null 2>&1; then
|
|
21
|
-
echo "error: python3 not found (required for contract-check stamp)" >&2
|
|
22
|
-
exit 2
|
|
23
|
-
fi
|
|
24
|
-
|
|
25
|
-
mkdir -p .agentdocs/tmp
|
|
26
|
-
|
|
27
|
-
python3 - <<'PY'
|
|
28
|
-
import datetime
|
|
29
|
-
import hashlib
|
|
30
|
-
import json
|
|
31
|
-
import os
|
|
32
|
-
import pathlib
|
|
33
|
-
|
|
34
|
-
ws_root = pathlib.Path(os.getcwd()).resolve()
|
|
35
|
-
|
|
36
|
-
def sha256(p: pathlib.Path) -> str:
|
|
37
|
-
return hashlib.sha256(p.read_bytes()).hexdigest()
|
|
38
|
-
|
|
39
|
-
truth_files = {}
|
|
40
|
-
missing = []
|
|
41
|
-
for name in ("REQUIREMENTS.md", "AI_PROJECT.md", "AI_WORKSPACE.md"):
|
|
42
|
-
p = ws_root / name
|
|
43
|
-
key = f"{name}_sha256"
|
|
44
|
-
if p.exists():
|
|
45
|
-
truth_files[key] = sha256(p)
|
|
46
|
-
else:
|
|
47
|
-
truth_files[key] = ""
|
|
48
|
-
missing.append(name)
|
|
49
|
-
|
|
50
|
-
data = {
|
|
51
|
-
"generated_at": datetime.datetime.utcnow().replace(microsecond=0).isoformat() + "Z",
|
|
52
|
-
"workspace_root": str(ws_root),
|
|
53
|
-
"truth_files": truth_files,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
stamp = ws_root / ".agentdocs" / "tmp" / ".iflow-contract-checked"
|
|
57
|
-
stamp.write_text(json.dumps(data, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
|
|
58
|
-
|
|
59
|
-
print(f"OK: wrote {stamp}")
|
|
60
|
-
if missing:
|
|
61
|
-
print("WARN: missing truth files: " + ", ".join(missing))
|
|
62
|
-
print("HINT: run aiws init to bootstrap (e.g. `npx @aipper/aiws init .`)")
|
|
63
|
-
PY
|
|
64
|
-
'}
|
|
65
|
-
|
|
66
|
-
边界:
|
|
67
|
-
- 不打印任何 secrets(尤其是 `secrets/test-accounts.json`)。
|
|
68
|
-
- 本命令只负责预检与写 stamp,不做实现、不跑测试、不提交。
|
|
69
|
-
"""
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# Command: ws:deliver
|
|
2
|
-
# Description: 交付(submodules + superproject 分步提交,并安全合并回目标分支)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "交付(submodules + superproject 分步提交,并安全合并回目标分支)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:适配 superproject + submodule(数量不固定)的交付收尾,降低提交顺序和合并回 base 分支的出错概率:
|
|
12
|
-
1) 先逐个提交 submodule(每个 repo 单独确认 commit message;默认 `git add -p`)
|
|
13
|
-
2) 再提交 superproject(包含 submodule gitlink 指针更新 + 自身改动/变更工件)
|
|
14
|
-
3) 最后 fast-forward 合并回目标分支(复用 `aiws change finish`;建议用 `ws:finish`)
|
|
15
|
-
|
|
16
|
-
强制约束:
|
|
17
|
-
- 不自动 `git add -A`。
|
|
18
|
-
- 不自动 push。
|
|
19
|
-
- 不自动删除分支。
|
|
20
|
-
|
|
21
|
-
建议流程(按顺序):
|
|
22
|
-
1) 先确认真值文件存在并遵守:`AI_PROJECT.md` / `REQUIREMENTS.md` / `AI_WORKSPACE.md`。
|
|
23
|
-
2) 如果存在 `.gitmodules` 但缺少 `submodule.<name>.branch`,先运行 `ws:submodule-setup` 并提交 `.gitmodules`(否则 `aiws validate .` 会失败,且 submodule 工作流会产生人为差异)。
|
|
24
|
-
2.1) 若存在 submodule:必须准备 `changes/<change-id>/submodules.targets`,并覆盖所有 submodule path;这是本次交付的目标分支真值。
|
|
25
|
-
- 生成该文件时可先做默认预填:detached HEAD 默认建议取 `.gitmodules` 声明分支;已附着在本地分支时默认建议取当前分支。
|
|
26
|
-
- 上述都只是建议值;真正的 deliver/finish 只认 `submodules.targets`。
|
|
27
|
-
2) 发现 submodules:
|
|
28
|
-
- `git submodule status --recursive`
|
|
29
|
-
3) 逐个提交 submodules(按上一步顺序):
|
|
30
|
-
- `git -C "<sub_path>" status --porcelain`
|
|
31
|
-
- 先说明该 submodule 目标分支的来源:attached branch 默认建议取当前分支;detached HEAD 默认建议取 `.gitmodules`;若与 `submodules.targets` 已落盘值冲突,则以 `submodules.targets` 为准
|
|
32
|
-
- 若当前为 detached HEAD:不要直接切 `change/<change-id>` / `main` / `master`;先按 `submodules.targets`(若分支为 `.` 则展开为 `.ws-change.json` 的 `base_branch`)挂到 `aiws/pin/<target-branch>`
|
|
33
|
-
- `git -C "<sub_path>" add -p`
|
|
34
|
-
- `git -C "<sub_path>" diff --staged --stat`
|
|
35
|
-
- 生成并让用户确认该 submodule 的 commit message(每个 repo 单独确认)
|
|
36
|
-
- `git -C "<sub_path>" commit -m "<message>"`
|
|
37
|
-
4) 提交 superproject(gitlinks + 自身改动):
|
|
38
|
-
- `git diff --submodule`
|
|
39
|
-
- `git add <submodule-path-1> <submodule-path-2> ...`
|
|
40
|
-
- `git add -p`
|
|
41
|
-
- 生成并让用户确认 superproject 的 commit message
|
|
42
|
-
- `git commit -m "<message>"`
|
|
43
|
-
5) (推荐)门禁 + 证据:
|
|
44
|
-
- `aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)
|
|
45
|
-
5.1) (强烈建议)生成持久证据并回填 `Evidence_Path`:
|
|
46
|
-
- `aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)
|
|
47
|
-
5.2) (可选)生成状态快照(建议):
|
|
48
|
-
- `aiws change state <change-id> --write`
|
|
49
|
-
6) 安全合并回目标分支:
|
|
50
|
-
- 优先运行 `ws:finish`(底层调用 `aiws change finish`,默认 `--ff-only`;push 成功后会清理对应 change worktree)
|
|
51
|
-
|
|
52
|
-
输出要求:
|
|
53
|
-
- `Submodules:` 每个 submodule 的 commit 摘要(repo/path → sha → message)
|
|
54
|
-
- `Superproject:` commit 摘要
|
|
55
|
-
- `Merge:` `ws:finish`/`aiws change finish` 输出(into/from)
|
|
56
|
-
- `Worktree cleanup:` 若存在独立 change worktree,输出清理结果(removed/skipped + reason)
|
|
57
|
-
- `Evidence:` `.agentdocs/tmp/aiws-validate/*.json`(若使用 --stamp)
|
|
58
|
-
"""
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# Command: ws:dev
|
|
2
|
-
# Description: AI Workspace Claude-first 开发闭环(分析→确认→实施→审计→证据落盘)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "AI Workspace Claude-first 开发闭环(分析→确认→实施→审计→证据落盘)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在 AI Workspace 约束下完成一个可回放、可验证的小步交付。
|
|
12
|
-
|
|
13
|
-
输入:
|
|
14
|
-
- 本命令参数(如有)视为本次交付主题(topic)。
|
|
15
|
-
|
|
16
|
-
强制流程:
|
|
17
|
-
1) 预检:读取 `AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`(缺失则先运行 `/aiws-init`,或在 shell 执行 `aiws init .`)。
|
|
18
|
-
2) 若 iFlow 拦截写入(缺少 contract-check stamp):先执行 `/ws-contract-check`,再继续。
|
|
19
|
-
3) 明确 GOALS / NON-GOALS,并把改动归因到:
|
|
20
|
-
- `requirements/requirements-issues.csv` 的 `Req_ID`,或
|
|
21
|
-
- `issues/problem-issues.csv` 的 `Problem_ID`。
|
|
22
|
-
4) 先输出“将改动的文件清单 + 回滚方案 + 验证命令”,并等待用户确认继续(Y/N)。
|
|
23
|
-
5) 用户确认后再实施最小改动(遵守 `AI_PROJECT.md` 的安全边界;不要引入任何 secrets)。
|
|
24
|
-
6) 运行门禁并给出结果:
|
|
25
|
-
- `aiws validate .`(若未安装全局 aiws,可用 `npx @aipper/aiws validate .`)
|
|
26
|
-
7) 产出证据(至少一个):
|
|
27
|
-
- 更新 `changes/<change-id>/...`,或
|
|
28
|
-
- 更新 `issues/*.csv` 的状态机,或
|
|
29
|
-
- 写入 `.agentdocs/tmp/...` 的 report/log/resp(不要包含 secrets)。
|
|
30
|
-
|
|
31
|
-
边界:
|
|
32
|
-
- 不打印任何 secrets(尤其是 `secrets/test-accounts.json`)。
|
|
33
|
-
- 不执行破坏性命令。
|
|
34
|
-
"""
|