@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,141 +0,0 @@
|
|
|
1
|
-
# Command: ws:doctor
|
|
2
|
-
# Description: 检查 workspace-A 约定并给出可执行的下一步
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "检查 workspace-A 约定并给出可执行的下一步"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出。检查当前目录是否符合 AIWS workspace 约定,并给出可执行的下一步建议。
|
|
10
|
-
|
|
11
|
-
Rules:
|
|
12
|
-
- Do not print secrets (especially secrets/test-accounts.json).
|
|
13
|
-
- Only report presence/absence and safe guidance.
|
|
14
|
-
- Prefer Linux-first commands.
|
|
15
|
-
|
|
16
|
-
Execute:
|
|
17
|
-
!{bash -lc '
|
|
18
|
-
set -euo pipefail
|
|
19
|
-
|
|
20
|
-
ok() { printf "OK: %s\n" "$*"; }
|
|
21
|
-
warn() { printf "警告: %s\n" "$*"; }
|
|
22
|
-
miss() { printf "缺失: %s\n" "$*"; }
|
|
23
|
-
note() { printf "说明: %s\n" "$*"; }
|
|
24
|
-
|
|
25
|
-
project_root() {
|
|
26
|
-
local root
|
|
27
|
-
root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
28
|
-
if [[ -n "${root:-}" ]]; then
|
|
29
|
-
echo "$root"
|
|
30
|
-
else
|
|
31
|
-
pwd
|
|
32
|
-
fi
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
workspace_root() {
|
|
36
|
-
local d="$PWD"
|
|
37
|
-
while true; do
|
|
38
|
-
if [[ -f "$d/AI_WORKSPACE.md" || -f "$d/REQUIREMENTS.md" || -f "$d/AI_PROJECT.md" ]]; then
|
|
39
|
-
echo "$d"
|
|
40
|
-
return 0
|
|
41
|
-
fi
|
|
42
|
-
[[ "$d" == "/" ]] && break
|
|
43
|
-
d="$(dirname "$d")"
|
|
44
|
-
done
|
|
45
|
-
project_root
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
workspace_env() {
|
|
49
|
-
[[ -f AI_WORKSPACE.md ]] || return 0
|
|
50
|
-
local line
|
|
51
|
-
line="$(grep -m1 -E "^[[:space:]]*- environment:[[:space:]]*" AI_WORKSPACE.md 2>/dev/null || true)"
|
|
52
|
-
[[ -n "${line:-}" ]] || return 0
|
|
53
|
-
printf "%s\n" "$line" | sed -E "s/.*environment:[[:space:]]*\\\"?([^\\\"#[:space:]]+).*/\\1/"
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
subdir="$(pwd)"
|
|
57
|
-
root="$(workspace_root)"
|
|
58
|
-
cd "$root"
|
|
59
|
-
|
|
60
|
-
echo "工作目录: $root"
|
|
61
|
-
if [[ "$subdir" != "$root" ]]; then
|
|
62
|
-
echo "当前子目录: $subdir"
|
|
63
|
-
fi
|
|
64
|
-
echo
|
|
65
|
-
|
|
66
|
-
need_init=0
|
|
67
|
-
|
|
68
|
-
if [[ -f AGENTS.md ]]; then ok "AGENTS.md"; else warn "AGENTS.md 未发现(建议运行 /aiws-init 补齐)"; fi
|
|
69
|
-
if [[ -f AI_PROJECT.md ]]; then ok "AI_PROJECT.md"; else miss "AI_PROJECT.md"; need_init=1; fi
|
|
70
|
-
if [[ -f AI_WORKSPACE.md ]]; then ok "AI_WORKSPACE.md"; else miss "AI_WORKSPACE.md"; need_init=1; fi
|
|
71
|
-
if [[ -f REQUIREMENTS.md ]]; then ok "REQUIREMENTS.md"; else miss "REQUIREMENTS.md"; need_init=1; fi
|
|
72
|
-
|
|
73
|
-
if [[ -f requirements/CHANGELOG.md ]]; then ok "requirements/CHANGELOG.md"; else warn "requirements/CHANGELOG.md 未发现"; fi
|
|
74
|
-
if [[ -f requirements/requirements-issues.csv ]]; then ok "requirements/requirements-issues.csv"; else warn "requirements/requirements-issues.csv 未发现"; fi
|
|
75
|
-
if [[ -f issues/problem-issues.csv ]]; then ok "issues/problem-issues.csv"; else warn "issues/problem-issues.csv 未发现"; fi
|
|
76
|
-
|
|
77
|
-
if [[ -f .aiws/manifest.json ]]; then ok ".aiws/manifest.json"; else miss ".aiws/manifest.json"; need_init=1; fi
|
|
78
|
-
if [[ -f .githooks/pre-commit ]]; then ok ".githooks/pre-commit"; else warn ".githooks/pre-commit 未发现"; fi
|
|
79
|
-
if [[ -f .githooks/pre-push ]]; then ok ".githooks/pre-push"; else warn ".githooks/pre-push 未发现"; fi
|
|
80
|
-
|
|
81
|
-
echo
|
|
82
|
-
echo "工具链:"
|
|
83
|
-
if command -v python3 >/dev/null 2>&1; then ok "python3"; else warn "python3 未发现(aiws validate 需要)"; fi
|
|
84
|
-
if command -v uv >/dev/null 2>&1; then ok "uv"; else note "uv 未发现(可选;用于运行 tools/server_test_runner.py)"; fi
|
|
85
|
-
if command -v aiws >/dev/null 2>&1; then ok "aiws"; else note "aiws 未发现(可用 npx @aipper/aiws ...)"; fi
|
|
86
|
-
|
|
87
|
-
echo
|
|
88
|
-
echo "git hooks:"
|
|
89
|
-
git_root="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
90
|
-
if [[ -n "${git_root:-}" ]]; then
|
|
91
|
-
hooks_path="$(git config --get core.hooksPath 2>/dev/null || true)"
|
|
92
|
-
if [[ "$hooks_path" == ".githooks" ]]; then
|
|
93
|
-
ok "core.hooksPath=.githooks(提交/推送将自动运行 aiws validate)"
|
|
94
|
-
else
|
|
95
|
-
warn "core.hooksPath 未设置为 .githooks(当前:${hooks_path:-<unset>})"
|
|
96
|
-
note "可执行:git config core.hooksPath .githooks"
|
|
97
|
-
fi
|
|
98
|
-
else
|
|
99
|
-
note "未检测到 git 仓库(跳过 hooks 检查)"
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
echo
|
|
103
|
-
echo ".gitignore:"
|
|
104
|
-
if [[ -f .gitignore ]]; then
|
|
105
|
-
if grep -qF "# AIWS_MANAGED_BEGIN:gitignore" .gitignore; then
|
|
106
|
-
ok ".gitignore 已包含 AIWS managed block"
|
|
107
|
-
else
|
|
108
|
-
warn ".gitignore 缺少 AIWS managed block(建议运行 /aiws-init 或 /aiws-update 修复)"
|
|
109
|
-
fi
|
|
110
|
-
else
|
|
111
|
-
warn "未找到 .gitignore"
|
|
112
|
-
fi
|
|
113
|
-
|
|
114
|
-
echo
|
|
115
|
-
env="$(workspace_env || true)"
|
|
116
|
-
if [[ -n "${env:-}" ]]; then
|
|
117
|
-
echo "environment: ${env}"
|
|
118
|
-
fi
|
|
119
|
-
|
|
120
|
-
echo
|
|
121
|
-
echo "下一步建议:"
|
|
122
|
-
if [[ "$need_init" -eq 1 ]]; then
|
|
123
|
-
echo " - 执行: /aiws-init(或 `npx @aipper/aiws init .`)"
|
|
124
|
-
else
|
|
125
|
-
echo " - 运行门禁: aiws validate .(或 `npx @aipper/aiws validate .`)"
|
|
126
|
-
fi
|
|
127
|
-
echo " - 如 iFlow 拦截写入:/ws-contract-check(写入 stamp)"
|
|
128
|
-
if [[ ! -f secrets/test-accounts.json && -f secrets/test-accounts.example.json ]]; then
|
|
129
|
-
echo " - 创建 secrets:cp -n secrets/test-accounts.example.json secrets/test-accounts.json"
|
|
130
|
-
fi
|
|
131
|
-
if [[ -f tools/server_test_runner.py ]]; then
|
|
132
|
-
echo " - 接口闭环(自动修复):/server-fix"
|
|
133
|
-
echo " - 仅执行 runner:uv run tools/server_test_runner.py --workspace . --manage-service"
|
|
134
|
-
fi
|
|
135
|
-
if [[ -d memory-bank ]]; then
|
|
136
|
-
echo " - 固定上下文:更新 memory-bank/progress.md"
|
|
137
|
-
else
|
|
138
|
-
echo " - 初始化 memory-bank:/ws-memory-bank-init"
|
|
139
|
-
fi
|
|
140
|
-
'}
|
|
141
|
-
"""
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Command: ws:env-doctor
|
|
2
|
-
# Description: 检查工具链并给出 node/java/python/uv 切换建议(workspace-A)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "检查工具链并给出 node/java/python/uv 切换建议(workspace-A)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出。检查当前环境的工具链与版本,并根据 AI_WORKSPACE.md 给出可执行的切换建议。
|
|
10
|
-
|
|
11
|
-
规则:
|
|
12
|
-
- 只读检查,不修改系统状态
|
|
13
|
-
- 优先 Linux-first
|
|
14
|
-
|
|
15
|
-
Execute:
|
|
16
|
-
!{bash -lc '
|
|
17
|
-
set -euo pipefail
|
|
18
|
-
|
|
19
|
-
say() { printf "%s\n" "$*"; }
|
|
20
|
-
have() { command -v "$1" >/dev/null 2>&1; }
|
|
21
|
-
|
|
22
|
-
ws="$(pwd)"
|
|
23
|
-
say "工作目录: $ws"
|
|
24
|
-
|
|
25
|
-
if [[ -f AI_WORKSPACE.md ]]; then
|
|
26
|
-
say "OK: 发现 AI_WORKSPACE.md"
|
|
27
|
-
else
|
|
28
|
-
say "警告: 未发现 AI_WORKSPACE.md(建议先 /aiws-init)"
|
|
29
|
-
fi
|
|
30
|
-
|
|
31
|
-
say ""
|
|
32
|
-
say "== 工具可用性 =="
|
|
33
|
-
for c in git uv node npm pnpm yarn java javac mvn gradle python3 mise asdf nvm sdk jenv; do
|
|
34
|
-
if have "$c"; then
|
|
35
|
-
say "OK: $c"
|
|
36
|
-
else
|
|
37
|
-
say "缺失: $c"
|
|
38
|
-
fi
|
|
39
|
-
done
|
|
40
|
-
|
|
41
|
-
say ""
|
|
42
|
-
say "== 版本信息 =="
|
|
43
|
-
have node && say "node: $(node -v 2>/dev/null || true)" || true
|
|
44
|
-
have npm && say "npm: $(npm -v 2>/dev/null || true)" || true
|
|
45
|
-
have pnpm && say "pnpm: $(pnpm -v 2>/dev/null || true)" || true
|
|
46
|
-
have java && say "java: $(java -version 2>&1 | head -n 1)" || true
|
|
47
|
-
have javac && say "javac: $(javac -version 2>&1 | head -n 1)" || true
|
|
48
|
-
have python3 && say "python3: $(python3 -V 2>/dev/null || true)" || true
|
|
49
|
-
have uv && say "uv: $(uv --version 2>/dev/null || true)" || true
|
|
50
|
-
|
|
51
|
-
say ""
|
|
52
|
-
say "== AI_WORKSPACE.md 建议执行的切换命令(如果已配置) =="
|
|
53
|
-
extract_cmd() {
|
|
54
|
-
local key="$1"
|
|
55
|
-
rg -n \"^\\s*-\\s*${key}\\s*:\\s*\\\"(.*)\\\"\\s*$\" AI_WORKSPACE.md 2>/dev/null | sed -E \"s/.*\\\"(.*)\\\".*/\\1/\" | head -n 1
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if [[ -f AI_WORKSPACE.md ]]; then
|
|
59
|
-
boot="$(extract_cmd toolchain_bootstrap_cmd || true)"
|
|
60
|
-
node_use="$(extract_cmd node_use_cmd || true)"
|
|
61
|
-
java_use="$(extract_cmd java_use_cmd || true)"
|
|
62
|
-
|
|
63
|
-
[[ -n \"$boot\" ]] && say \"toolchain_bootstrap_cmd: $boot\"
|
|
64
|
-
[[ -n \"$node_use\" ]] && say \"node_use_cmd: $node_use\"
|
|
65
|
-
[[ -n \"$java_use\" ]] && say \"java_use_cmd: $java_use\"
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
say ""
|
|
69
|
-
say "下一步建议:"
|
|
70
|
-
say "- 若版本不匹配:把 node/java 的版本与切换命令写进 AI_WORKSPACE.md 的 3.3 节"
|
|
71
|
-
say "- 跑服务端接口测试:uv run tools/server_test_runner.py --workspace . --manage-service"
|
|
72
|
-
say "- 跑需求交付闭环:/ws-feature-plan -> /ws-feature-deliver"
|
|
73
|
-
'}
|
|
74
|
-
"""
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# Command: ws:feature-deliver
|
|
2
|
-
# Description: 执行跨子项目交付闭环(需求 -> 代码 -> 测试 -> Review -> 提交)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "执行跨子项目交付闭环(需求 -> 代码 -> 测试 -> Review -> 提交)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在工作区根目录执行“需求->实现->测试->审核->提交”的闭环,尽量减少人工干预,但严格遵守边界与可回滚。
|
|
12
|
-
|
|
13
|
-
必须遵守:
|
|
14
|
-
- REQUIREMENTS.md 为唯一真值;若发现需求缺口,先补齐“可验收字段”,不要擅自改语义
|
|
15
|
-
- 需求变更必须通过 `/ws-req-change` 处理,并写入 `requirements/CHANGELOG.md`,再同步 issues 执行合同(避免需求漂移)
|
|
16
|
-
- AI_WORKSPACE.md policy 为硬边界(默认 environment=test、base_url_allowlist=localhost);不满足时不得执行自动化测试/自动提交
|
|
17
|
-
- secrets/test-accounts.json 为敏感文件,禁止输出内容
|
|
18
|
-
- 反死循环:连续 2 轮无法减少 BLOCKED 或无法推进 issues 状态,必须缩小范围或先修环境/补齐 REQUIREMENTS,不能继续盲改
|
|
19
|
-
|
|
20
|
-
步骤(按顺序):
|
|
21
|
-
1) 预检(缺失则补齐):
|
|
22
|
-
- 若不存在 `issues/feature-issues.csv`:先执行 `/ws-feature-plan` 生成计划与执行合同
|
|
23
|
-
- 检查 AI_WORKSPACE.md 是否有 environment/test 与 base_url_allowlist;缺失则用默认安全值并提示用户确认
|
|
24
|
-
- 若 AI_WORKSPACE.md 定义了 toolchain_bootstrap_cmd / node_use_cmd / java_use_cmd:在任何 build/test 前必须先执行(用 bash -lc 保证加载 shell 环境)
|
|
25
|
-
2) 执行(每次只推进 1~3 个 TODO):
|
|
26
|
-
- 从 issues/feature-issues.csv 选取 TODO,标为 DOING
|
|
27
|
-
- 先做“现状验证”:检查该 issue 对应能力是否已存在(避免重复实现/冲突);若已满足则记录证据并直接标 DONE
|
|
28
|
-
- 否则实现最小代码修改(只改与该 issue 相关的文件)
|
|
29
|
-
- 运行对应 Tests(按 issue 的 Tests 字段或 AI_WORKSPACE.md 的 *_test_cmd)
|
|
30
|
-
- 通过则标 DONE;失败则标 BLOCKED 并写 Notes(含复现命令与证据路径)
|
|
31
|
-
3) 如果涉及服务端 API 或你检测到存在 tools/server_test_runner.py:
|
|
32
|
-
- 运行 runner 生成证据包与接口合同:
|
|
33
|
-
`uv run tools/server_test_runner.py --workspace . --manage-service`
|
|
34
|
-
- 若存在 BLOCKED:执行 `/server-fix`(或 `/server-triage` 输出修复清单),直到接口验收通过或达到迭代上限
|
|
35
|
-
4) 审核:
|
|
36
|
-
- 对照 REQUIREMENTS.md 验收标准逐项确认(不满足就回到步骤2/3)
|
|
37
|
-
5) 提交:
|
|
38
|
-
- 若工作区使用 git submodule:优先 `/server-commit`(仅提交 server_dirs),或用 `/server-fix-and-commit`
|
|
39
|
-
- 其它 submodule(web/app)若需要提交:先给出“将提交哪些目录/文件”的清单,再执行对应子仓库 commit(不要 push)
|
|
40
|
-
|
|
41
|
-
输出要求:
|
|
42
|
-
- 每轮输出:本轮处理的 Issue_ID、改动文件、测试命令与结果摘要、下一步
|
|
43
|
-
- 全部完成时输出:可以 merge/提 PR 的最小检查清单
|
|
44
|
-
"""
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Command: ws:feature-plan
|
|
2
|
-
# Description: 规划跨子项目的交付(需求 -> 代码 -> 测试 -> Review -> 提交)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "规划跨子项目的交付(需求 -> 代码 -> 测试 -> Review -> 提交)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在“目录A工作区”(可能包含 server/web/app 等多个 submodule 目录)为本次需求变更产出一个可执行计划,并把计划落到可追踪的执行合同里。
|
|
12
|
-
|
|
13
|
-
输入(按优先级读取):
|
|
14
|
-
- REQUIREMENTS.md:需求与验收标准(唯一真值来源)
|
|
15
|
-
- AI_WORKSPACE.md:工作区结构、目录发现、policy(environment/base_url_allowlist 等)、启动/测试覆盖方式
|
|
16
|
-
- docs/openapi.json(若涉及服务端 API)
|
|
17
|
-
|
|
18
|
-
进行中项目(必须先做,不允许“从零假设”):
|
|
19
|
-
1) 代码现状盘点:扫描当前工作区(server/web/app)已有实现与现有接口(OpenAPI/路由/关键模块)。
|
|
20
|
-
2) 需求对比:将 REQUIREMENTS.md 的目标逐项映射到“已有/缺失/部分完成”,并给证据(文件路径/接口路径)。
|
|
21
|
-
3) 只为“缺失/部分完成”的项创建 issues;已有项要么标 DONE(需有证据),要么标 SKIP(说明理由)。
|
|
22
|
-
|
|
23
|
-
输出必须包含:
|
|
24
|
-
1) GOALS / NON-GOALS(必须与 REQUIREMENTS.md 一致)
|
|
25
|
-
2) 影响范围(按 subproject 列出:server/web/app;给出候选目录与识别依据)
|
|
26
|
-
3) 执行合同(写入/维护这些文件):
|
|
27
|
-
- issues/feature-issues.csv:任务分解(TODO/DOING/DONE/BLOCKED/SKIP)
|
|
28
|
-
- (如涉及 API)issues/server-api-issues.csv:接口验收合同(由 runner 维护)
|
|
29
|
-
4) 测试策略(按 subproject):
|
|
30
|
-
- server:优先 runner(uv),并遵守 AI_WORKSPACE.md policy(base_url_allowlist/allow_mutations)
|
|
31
|
-
- web/app:优先使用 AI_WORKSPACE.md 指定的 *_test_cmd;若缺失则基于常见标记提出建议但不臆测结果
|
|
32
|
-
- 工具链准备:如果 AI_WORKSPACE.md 定义了 toolchain_bootstrap_cmd / node_use_cmd / java_use_cmd,必须在 build/test 前执行
|
|
33
|
-
5) 风险/边界:
|
|
34
|
-
- 不改需求语义;需求不清先补 REQUIREMENTS.md(只补可验收字段)
|
|
35
|
-
- 需求变更必须通过 `/ws-req-change` 处理,并写入 `requirements/CHANGELOG.md`,再同步 issues 执行合同
|
|
36
|
-
- 不触发破坏性数据操作(除非 environment=test 且 allow_mutations=true 且 REQUIREMENTS 明确允许)
|
|
37
|
-
6) 回滚方案(按 submodule/根仓库分别写)
|
|
38
|
-
7) 完成条件:满足 REQUIREMENTS.md 的验收 + 所有相关测试通过 + 无未解释错误日志
|
|
39
|
-
|
|
40
|
-
执行合同 CSV(必须创建或更新):
|
|
41
|
-
- 文件:issues/feature-issues.csv
|
|
42
|
-
- 列(固定):Issue_ID, Subproject, Title, Files, Tests, Status, Notes
|
|
43
|
-
- Status:TODO | DOING | DONE | BLOCKED | SKIP
|
|
44
|
-
|
|
45
|
-
最后给出下一步命令(建议):
|
|
46
|
-
- 运行交付闭环:`/ws-feature-deliver`
|
|
47
|
-
"""
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
# Command: ws:finish
|
|
2
|
-
# Description: AI Workspace 安全收尾(门禁 + fast-forward 合并 + submodule 并回分支后顺序 push)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "AI Workspace 安全收尾(门禁 + fast-forward 合并 + submodule 并回分支后顺序 push)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:安全把 `change/<change-id>` fast-forward 合并回目标分支,并按 `submodule -> superproject` 顺序 push,减少遗漏。
|
|
12
|
-
补充:若团队希望减少 submodule detached 的人为差异,建议在 `.gitmodules` 配置 `submodule.<name>.branch`,并在日常拉取时使用 `ws:pull`。
|
|
13
|
-
|
|
14
|
-
强制步骤:
|
|
15
|
-
1) 读取真值文件:`AI_PROJECT.md`、`REQUIREMENTS.md`、`AI_WORKSPACE.md`(缺失则先运行 `/aiws-init` 或 `aiws init .`)。
|
|
16
|
-
2) 若 iFlow 拦截写入:先执行 `/ws-contract-check`,再继续。
|
|
17
|
-
3) 确认 git 状态(必须输出给用户):
|
|
18
|
-
- `git status --porcelain`
|
|
19
|
-
- `git branch --show-current`(或 `git rev-parse --abbrev-ref HEAD`)
|
|
20
|
-
4) 若工作区不干净:停止,并要求先 commit 或 stash(不要尝试自动处理)。
|
|
21
|
-
4.1) 若存在 `.gitmodules`:必须为每个 submodule 配置 `submodule.<name>.branch`(否则先运行 `ws:submodule-setup` 并提交 `.gitmodules`)。
|
|
22
|
-
5) (推荐)门禁校验并落盘证据:`aiws validate . --stamp`(未安装全局 aiws 时可用 `npx @aipper/aiws validate . --stamp`)。
|
|
23
|
-
5.1) (强烈建议)收敛持久证据并回填 `Evidence_Path`:`aiws change evidence <change-id>`(未安装全局 aiws 时可用 `npx @aipper/aiws change evidence <change-id>`)。
|
|
24
|
-
5.2) (可选)生成状态快照(建议):`aiws change state <change-id> --write`。
|
|
25
|
-
6) 若不存在 `.gitmodules`,或 submodules 已按顺序处理完成,优先直接执行最小收尾闭环:
|
|
26
|
-
- `aiws change finish <change-id> --push`
|
|
27
|
-
- 在 `change/<change-id>` 分支上也可省略 `<change-id>`;命令会尝试读取 `changes/<change-id>/.ws-change.json` 的 `base_branch`
|
|
28
|
-
- 该命令会在 fast-forward 合并成功后 push 目标分支;默认优先使用 upstream 配置(`branch.<name>.remote` + `branch.<name>.merge`),只有在你明确知道要推向别的 remote 时才追加 `--remote <name>`
|
|
29
|
-
- 若 `change/<change-id>` 位于独立 worktree,且该 worktree 干净,则会在 push 成功后自动执行 `git worktree remove` + `git worktree prune`
|
|
30
|
-
- AI 入口执行前,应先向用户说明将要 push 的 remote/branch;显式传入 `--push` 即视为确认
|
|
31
|
-
7) 若提示无法 fast-forward:先在 change 分支(或对应 worktree)里执行 `git rebase <target-branch>`,再重试 `aiws change finish --push`。
|
|
32
|
-
8) 若需要先处理 submodules,则按顺序处理每个 submodule(先并回目标分支,再 push):
|
|
33
|
-
- 先显式解析 base branch,不要用当前分支名替代:
|
|
34
|
-
- `python3 - <<'PY'`
|
|
35
|
-
- `import json, pathlib; meta = pathlib.Path("changes") / "<change-id>" / ".ws-change.json"; print((json.loads(meta.read_text(encoding="utf-8")).get("base_branch") or "").strip())`
|
|
36
|
-
- `PY`
|
|
37
|
-
- 发现 submodules:`git config --file .gitmodules --get-regexp '^submodule\\..*\\.path$'`
|
|
38
|
-
- 对每个 `<sub_path>`:
|
|
39
|
-
- 读取 superproject 当前 gitlink:`git rev-parse "HEAD:<sub_path>"`
|
|
40
|
-
- 目标分支真值:`changes/<change-id>/submodules.targets`;若条目里分支写 `.`,则展开为刚才解析出的 `base_branch`
|
|
41
|
-
- 生成/检查 `submodules.targets` 时,detached HEAD 默认建议取 `.gitmodules` 的 `submodule.<name>.branch`;已附着在本地分支时默认建议取当前分支;这些都只是预填建议,不是 finish/push 的运行时真值
|
|
42
|
-
- 不要直接切 `change/<change-id>` / `main` / `master` 来解 detached
|
|
43
|
-
- 用 pin 分支挂回(不改动现有 main/master 指针):`git -C "<sub_path>" checkout -B "aiws/pin/<target-branch>" <gitlink-sha>`
|
|
44
|
-
- 仅当 `<gitlink-sha>` 属于 `origin/<target-branch>` 历史时才允许 push;否则停止并人工处理分叉
|
|
45
|
-
- push(只允许 fast-forward):`git -C "<sub_path>" push origin "<gitlink-sha>:refs/heads/<target-branch>"`
|
|
46
|
-
9) 任一 submodule 不满足 fast-forward 条件时立即停止(不要继续 push 主仓库)。
|
|
47
|
-
10) submodules push 完成后,再回到主仓库执行:
|
|
48
|
-
- `aiws change finish <change-id> --push`
|
|
49
|
-
11) (可选)交付完成后归档变更工件:`aiws change archive <change-id>`。
|
|
50
|
-
|
|
51
|
-
边界:
|
|
52
|
-
- push 前先输出状态并说明远端/分支。
|
|
53
|
-
- 不执行破坏性命令。
|
|
54
|
-
"""
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# Command: ws:init
|
|
2
|
-
# Description: 初始化当前目录为 workspace-A(AI_WORKSPACE/REQUIREMENTS/tools/secrets 示例)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "初始化当前目录为 workspace-A(AI_WORKSPACE/REQUIREMENTS/tools/secrets 示例)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出;命令与路径保持原样不翻译。
|
|
10
|
-
|
|
11
|
-
目标:把“当前目录”初始化为 aiws `workspace` 模板(真值文件 + 门禁 + tool-native commands)。
|
|
12
|
-
|
|
13
|
-
约束:
|
|
14
|
-
- 不创建/不打印真实 secrets;只生成 `secrets/test-accounts.example.json` 示例文件。
|
|
15
|
-
- 默认不做破坏性操作。
|
|
16
|
-
|
|
17
|
-
执行:
|
|
18
|
-
!{bash -lc '
|
|
19
|
-
set -euo pipefail
|
|
20
|
-
|
|
21
|
-
root="$(pwd)"
|
|
22
|
-
|
|
23
|
-
run_aiws() {
|
|
24
|
-
local subcmd="$1"
|
|
25
|
-
shift
|
|
26
|
-
|
|
27
|
-
if [[ -x "$root/node_modules/.bin/aiws" ]]; then
|
|
28
|
-
"$root/node_modules/.bin/aiws" "$subcmd" "$@"
|
|
29
|
-
return 0
|
|
30
|
-
fi
|
|
31
|
-
if command -v aiws >/dev/null 2>&1; then
|
|
32
|
-
aiws "$subcmd" "$@"
|
|
33
|
-
return 0
|
|
34
|
-
fi
|
|
35
|
-
if command -v npx >/dev/null 2>&1; then
|
|
36
|
-
npx -y @aipper/aiws "$subcmd" "$@"
|
|
37
|
-
return 0
|
|
38
|
-
fi
|
|
39
|
-
|
|
40
|
-
echo "error: aiws not found (install @aipper/aiws or ensure npx is available)" >&2
|
|
41
|
-
exit 2
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
run_aiws init .
|
|
45
|
-
run_aiws validate .
|
|
46
|
-
|
|
47
|
-
echo "下一步:"
|
|
48
|
-
echo " - 启用本机 hooks:git config core.hooksPath .githooks"
|
|
49
|
-
echo " - 如启用了 iFlow pre_tool_guard:执行 /ws-contract-check(写入 stamp)"
|
|
50
|
-
echo " - 创建 secrets:cp -n secrets/test-accounts.example.json secrets/test-accounts.json"
|
|
51
|
-
echo " - 重新运行门禁:aiws validate ."
|
|
52
|
-
'}
|
|
53
|
-
"""
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Command: ws:memory-bank-init
|
|
2
|
-
# Description: 初始化 memory-bank/(用于固定上下文,避免会话跑偏)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "初始化 memory-bank/(用于固定上下文,避免会话跑偏)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在当前 git workspace 根目录创建/更新 `memory-bank/` 的模板文件(非需求真值),用于固定工程上下文。
|
|
12
|
-
|
|
13
|
-
执行:
|
|
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
|
-
mkdir -p memory-bank
|
|
21
|
-
|
|
22
|
-
write_if_missing() {
|
|
23
|
-
local p="$1"
|
|
24
|
-
shift
|
|
25
|
-
if [[ -f "$p" ]]; then
|
|
26
|
-
echo "OK: exists: $p"
|
|
27
|
-
return 0
|
|
28
|
-
fi
|
|
29
|
-
mkdir -p "$(dirname "$p")"
|
|
30
|
-
cat >"$p" <<EOF
|
|
31
|
-
$*
|
|
32
|
-
EOF
|
|
33
|
-
echo "OK: created: $p"
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
write_if_missing "memory-bank/README.md" "# Memory Bank(工作区上下文)
|
|
37
|
-
|
|
38
|
-
目的:给 iFlow/Codex/Claude 一个“固定且可持续更新”的上下文集合,避免每次会话重新讲一遍导致跑偏。
|
|
39
|
-
|
|
40
|
-
在你的工作区中:
|
|
41
|
-
- \`REQUIREMENTS.md\` 仍是**需求真值**(不要复制到这里)。
|
|
42
|
-
- \`AI_PROJECT.md\` / \`AI_WORKSPACE.md\` 是**边界与运行真值**。
|
|
43
|
-
- 本目录补齐的是“实现过程中的稳定上下文”(更偏工程视角)。
|
|
44
|
-
|
|
45
|
-
建议规则:
|
|
46
|
-
- 改代码前:先看 \`REQUIREMENTS.md\` + \`AI_PROJECT.md\` + \`AI_WORKSPACE.md\`,再结合本目录的 \`architecture.md\`/\`progress.md\`。
|
|
47
|
-
- 每次完成一个可验证的小步:更新 \`progress.md\`(写清:做了什么、证据路径、下一步)。
|
|
48
|
-
- 发生重大结构变化:更新 \`architecture.md\`(只写高层关系,不要堆细节)。
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
write_if_missing "memory-bank/tech-stack.md" "# Tech Stack
|
|
52
|
-
|
|
53
|
-
填写原则:只写“确实在用且影响决策”的信息,避免长篇大论。
|
|
54
|
-
|
|
55
|
-
建议包含:
|
|
56
|
-
- 语言/运行时版本(例如 Java/Node/Python)
|
|
57
|
-
- 构建工具链(Gradle/Maven、pnpm、uv 等)
|
|
58
|
-
- 关键框架与约束(Spring Boot、Ktor、Vue、React 等)
|
|
59
|
-
- 数据层(DB/Redis/MQ)与迁移方式
|
|
60
|
-
- 本地/测试环境切换方式(引用 \`AI_WORKSPACE.md\` 的命令即可)
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
write_if_missing "memory-bank/architecture.md" "# Architecture
|
|
64
|
-
|
|
65
|
-
目标:记录“模块关系与关键边界”,让新的会话可以快速对齐代码布局。
|
|
66
|
-
|
|
67
|
-
建议包含:
|
|
68
|
-
- 目录/模块分层(例如 server/web/app)
|
|
69
|
-
- 核心数据流(请求入口 → service → repo → DB)
|
|
70
|
-
- 关键约束(鉴权、request-id、幂等、事务)
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
write_if_missing "memory-bank/implementation-plan.md" "# Implementation Plan
|
|
74
|
-
|
|
75
|
-
目标:把需求拆成可验证的小步(每步都有验证命令与期望结果)。
|
|
76
|
-
|
|
77
|
-
模板(示例字段):
|
|
78
|
-
- Step 1: …
|
|
79
|
-
- Scope:
|
|
80
|
-
- Files:
|
|
81
|
-
- Verify: \`...\`
|
|
82
|
-
- Expected:
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
write_if_missing "memory-bank/progress.md" "# Progress
|
|
86
|
-
|
|
87
|
-
每次完成一个可验证小步就追加一条:
|
|
88
|
-
|
|
89
|
-
- YYYY-MM-DD HH:MM: 做了什么(关联 Issue_ID/验收项)
|
|
90
|
-
- Changed: \`path/to/file\`
|
|
91
|
-
- Verify: \`command\`
|
|
92
|
-
- Evidence: \`path/to/log_or_report\`
|
|
93
|
-
- Next:
|
|
94
|
-
"
|
|
95
|
-
'}
|
|
96
|
-
|
|
97
|
-
说明:
|
|
98
|
-
- `REQUIREMENTS.md` 仍是需求真值;不要把需求复制进 memory-bank。
|
|
99
|
-
- 建议完成后立刻执行:`/ws-contract-check`(让 pre_tool_guard 放行写入类工具)。
|
|
100
|
-
"""
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Command: ws:migrate
|
|
2
|
-
# Description: 将当前目录迁移到最新的 workspace-A 约定(安全,默认不覆盖)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "迁移当前目录为 workspace-A 约定(补齐 AI_PROJECT.md 与 .gitignore managed block,默认不覆盖)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出;命令与路径保持原样不翻译。
|
|
10
|
-
|
|
11
|
-
目标:将“当前目录”迁移/补齐为最新的 aiws `workspace` 约定(以 `.aiws/manifest.json` 与模板托管面为准)。
|
|
12
|
-
|
|
13
|
-
安全规则:
|
|
14
|
-
- 不要打印 secrets;不要创建真实 secrets。
|
|
15
|
-
- 只通过 `aiws init/update/validate` 更新托管面(replace_file + managed blocks)。
|
|
16
|
-
|
|
17
|
-
迁移完成后建议运行 `/ws-doctor` 并手工检查 `AI_PROJECT.md` 的“项目特有规则”段是否符合本项目约束。
|
|
18
|
-
|
|
19
|
-
Execute:
|
|
20
|
-
!{bash -lc '
|
|
21
|
-
set -euo pipefail
|
|
22
|
-
|
|
23
|
-
root="$(pwd)"
|
|
24
|
-
|
|
25
|
-
run_aiws() {
|
|
26
|
-
local subcmd="$1"
|
|
27
|
-
shift
|
|
28
|
-
|
|
29
|
-
if [[ -x "$root/node_modules/.bin/aiws" ]]; then
|
|
30
|
-
"$root/node_modules/.bin/aiws" "$subcmd" "$@"
|
|
31
|
-
return 0
|
|
32
|
-
fi
|
|
33
|
-
if command -v aiws >/dev/null 2>&1; then
|
|
34
|
-
aiws "$subcmd" "$@"
|
|
35
|
-
return 0
|
|
36
|
-
fi
|
|
37
|
-
if command -v npx >/dev/null 2>&1; then
|
|
38
|
-
npx -y @aipper/aiws "$subcmd" "$@"
|
|
39
|
-
return 0
|
|
40
|
-
fi
|
|
41
|
-
|
|
42
|
-
echo "error: aiws not found (install @aipper/aiws or ensure npx is available)" >&2
|
|
43
|
-
exit 2
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if [[ -f ".aiws/manifest.json" ]]; then
|
|
47
|
-
run_aiws update .
|
|
48
|
-
else
|
|
49
|
-
run_aiws init .
|
|
50
|
-
fi
|
|
51
|
-
run_aiws validate .
|
|
52
|
-
|
|
53
|
-
echo
|
|
54
|
-
echo "下一步:"
|
|
55
|
-
echo " - 运行: /ws-doctor"
|
|
56
|
-
echo " - 手工检查: AI_PROJECT.md(把本项目的特殊约束补齐进去)"
|
|
57
|
-
echo " - 如启用了 iFlow pre_tool_guard:执行 /ws-contract-check(写入 stamp)"
|
|
58
|
-
'}
|
|
59
|
-
"""
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Command: ws:preflight
|
|
2
|
-
# Description: AI Workspace 预检:读 AI_PROJECT/REQUIREMENTS/AI_WORKSPACE 并输出约束摘要
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "AI Workspace 预检:读 AI_PROJECT/REQUIREMENTS/AI_WORKSPACE 并输出约束摘要"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:在开始“写代码/改配置/给补丁”之前,先把工作区真值文件读全并对齐,避免规则漂移。
|
|
12
|
-
|
|
13
|
-
执行步骤(强制):
|
|
14
|
-
1) 定位项目根目录:
|
|
15
|
-
- 优先:`git rev-parse --show-toplevel`
|
|
16
|
-
- 若失败:说明无法判断项目根;请用户确认当前目录是否为项目根(不要猜测)。
|
|
17
|
-
2) 在项目根目录读取以下文件(存在则必须读取;缺失则明确报告缺失项,不要臆测内容):
|
|
18
|
-
- `AI_PROJECT.md`
|
|
19
|
-
- `REQUIREMENTS.md`
|
|
20
|
-
- `AI_WORKSPACE.md`
|
|
21
|
-
3) 输出:
|
|
22
|
-
- `Root:` <项目根路径>
|
|
23
|
-
- `Found:` 列出实际读取到的文件列表
|
|
24
|
-
- `Missing:` 列出缺失文件(若缺失 `AI_PROJECT.md`,建议用户先运行 `/ws-migrate` 或 `/aiws-init` 补齐)
|
|
25
|
-
- `Key rules:` 用 3–8 条 bullet 摘要关键约束(范围/禁止项/必须产物/必须验证命令)
|
|
26
|
-
|
|
27
|
-
安全规则:
|
|
28
|
-
- 不打印 secrets;遇到疑似敏感值仅提示并建议迁移到本地私密文件(不要复述原文)。
|
|
29
|
-
- 不执行破坏性命令。
|
|
30
|
-
"""
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Command: ws:pull
|
|
2
|
-
# Description: 拉取并对齐 submodules(fast-forward;尽量避免 detached)
|
|
3
|
-
# Category: workspace
|
|
4
|
-
# Version: 1
|
|
5
|
-
|
|
6
|
-
description = "拉取并对齐 submodules(fast-forward;尽量避免 detached)"
|
|
7
|
-
|
|
8
|
-
prompt = """
|
|
9
|
-
用中文输出(命令/路径/代码标识符保持原样不翻译)。
|
|
10
|
-
|
|
11
|
-
目标:安全拉取 superproject,并对齐 submodules,尽量把 submodule 从 detached HEAD “挂回”分支(仅当该分支包含 gitlink commit),减少人为操作差异。
|
|
12
|
-
|
|
13
|
-
安全约束(强制):
|
|
14
|
-
- 不执行破坏性命令;不自动提交/不自动 push
|
|
15
|
-
- 若工作区不干净:停止并要求用户先 commit 或 stash
|
|
16
|
-
- `git pull` 默认只允许 fast-forward(避免隐式 merge/rebase)
|
|
17
|
-
|
|
18
|
-
步骤(建议):
|
|
19
|
-
1) 输出上下文并检查工作区干净:
|
|
20
|
-
- `git rev-parse --show-toplevel`
|
|
21
|
-
- `git branch --show-current`
|
|
22
|
-
- `git status --porcelain`
|
|
23
|
-
- 若 `git status --porcelain` 非空:停止。
|
|
24
|
-
|
|
25
|
-
2) 拉取 superproject(fast-forward only):
|
|
26
|
-
- `git pull --ff-only`
|
|
27
|
-
- 若失败:停止并说明需要用户明确选择 `git pull --rebase` 或手动处理。
|
|
28
|
-
|
|
29
|
-
3) 更新 submodules 到 superproject 记录的 gitlink commit:
|
|
30
|
-
- 若存在 `.gitmodules`:
|
|
31
|
-
- `git submodule sync --recursive`
|
|
32
|
-
- `git submodule update --init --recursive`
|
|
33
|
-
|
|
34
|
-
4) (可选但推荐)把 submodule 从 detached HEAD 尽量“挂回分支”(不改动 gitlink commit):
|
|
35
|
-
- 为避免 origin 多分支时“猜错分支”,只在 `.gitmodules` 明确配置了 `submodule.<name>.branch` 时才执行;否则保持 detached 并提示先对齐配置
|
|
36
|
-
- 目标分支:`.gitmodules` 的 `submodule.<name>.branch`(若为 `.` 则用 superproject 当前分支)
|
|
37
|
-
- 对每个 submodule:
|
|
38
|
-
- `sub_sha="$(git rev-parse "HEAD:<sub_path>")"`
|
|
39
|
-
- `git -C "<sub_path>" fetch origin --prune`
|
|
40
|
-
- 若 `sub_sha` 属于 `origin/<target_branch>`:创建/更新 pin 分支 `aiws/pin/<target_branch>` 指向 `$sub_sha`(不改动现有分支)
|
|
41
|
-
- 否则保持 detached 并提示原因
|
|
42
|
-
|
|
43
|
-
可选(方案 2,一次性设置 submodule 跟踪分支,会改 `.gitmodules`,需提交):
|
|
44
|
-
- `git submodule set-branch --branch main <sub_path>`
|
|
45
|
-
- `git add .gitmodules && git commit -m "chore(submodule): set tracking branch"`
|
|
46
|
-
推荐:优先使用 `ws:submodule-setup` 交互式对齐所有 submodules 的 branch,并提交 `.gitmodules`。
|
|
47
|
-
"""
|