@aipper/aiws-spec 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/docs/cli-interface.md +288 -0
- package/docs/spec-contract.md +183 -0
- package/package.json +18 -0
- package/templates/workspace/.agents/skills/aiws-change-archive/SKILL.md +23 -0
- package/templates/workspace/.agents/skills/aiws-change-list/SKILL.md +18 -0
- package/templates/workspace/.agents/skills/aiws-change-new/SKILL.md +26 -0
- package/templates/workspace/.agents/skills/aiws-change-next/SKILL.md +19 -0
- package/templates/workspace/.agents/skills/aiws-change-start/SKILL.md +27 -0
- package/templates/workspace/.agents/skills/aiws-change-status/SKILL.md +19 -0
- package/templates/workspace/.agents/skills/aiws-change-sync/SKILL.md +19 -0
- package/templates/workspace/.agents/skills/aiws-change-templates-init/SKILL.md +18 -0
- package/templates/workspace/.agents/skills/aiws-change-templates-which/SKILL.md +18 -0
- package/templates/workspace/.agents/skills/aiws-change-validate/SKILL.md +23 -0
- package/templates/workspace/.agents/skills/aiws-hooks-install/SKILL.md +30 -0
- package/templates/workspace/.agents/skills/aiws-hooks-status/SKILL.md +18 -0
- package/templates/workspace/.agents/skills/aiws-init/SKILL.md +27 -0
- package/templates/workspace/.agents/skills/aiws-rollback/SKILL.md +18 -0
- package/templates/workspace/.agents/skills/aiws-update/SKILL.md +26 -0
- package/templates/workspace/.agents/skills/aiws-validate/SKILL.md +22 -0
- package/templates/workspace/.agents/skills/ws-analyze/SKILL.md +26 -0
- package/templates/workspace/.agents/skills/ws-commit/SKILL.md +50 -0
- package/templates/workspace/.agents/skills/ws-dev/SKILL.md +34 -0
- package/templates/workspace/.agents/skills/ws-migrate/SKILL.md +54 -0
- package/templates/workspace/.agents/skills/ws-plan/SKILL.md +39 -0
- package/templates/workspace/.agents/skills/ws-preflight/SKILL.md +29 -0
- package/templates/workspace/.agents/skills/ws-req-change/SKILL.md +33 -0
- package/templates/workspace/.agents/skills/ws-req-contract-sync/SKILL.md +17 -0
- package/templates/workspace/.agents/skills/ws-req-contract-validate/SKILL.md +12 -0
- package/templates/workspace/.agents/skills/ws-req-flow-sync/SKILL.md +28 -0
- package/templates/workspace/.agents/skills/ws-req-review/SKILL.md +32 -0
- package/templates/workspace/.agents/skills/ws-review/SKILL.md +24 -0
- package/templates/workspace/.agents/skills/ws-rule/SKILL.md +23 -0
- package/templates/workspace/.aiws/manifest.json +36 -0
- package/templates/workspace/.claude/commands/aiws-init.md +19 -0
- package/templates/workspace/.claude/commands/aiws-rollback.md +12 -0
- package/templates/workspace/.claude/commands/aiws-update.md +18 -0
- package/templates/workspace/.claude/commands/aiws-validate.md +13 -0
- package/templates/workspace/.claude/commands/ws-analyze.md +27 -0
- package/templates/workspace/.claude/commands/ws-dev.md +24 -0
- package/templates/workspace/.claude/commands/ws-migrate.md +22 -0
- package/templates/workspace/.claude/commands/ws-preflight.md +27 -0
- package/templates/workspace/.claude/commands/ws-req-change.md +34 -0
- package/templates/workspace/.claude/commands/ws-req-contract-sync.md +18 -0
- package/templates/workspace/.claude/commands/ws-req-contract-validate.md +13 -0
- package/templates/workspace/.claude/commands/ws-req-flow-sync.md +20 -0
- package/templates/workspace/.claude/commands/ws-req-review.md +33 -0
- package/templates/workspace/.claude/commands/ws-review.md +25 -0
- package/templates/workspace/.claude/commands/ws-rule.md +24 -0
- package/templates/workspace/.codex/prompts/aiws-init.md +23 -0
- package/templates/workspace/.codex/prompts/aiws-rollback.md +16 -0
- package/templates/workspace/.codex/prompts/aiws-update.md +22 -0
- package/templates/workspace/.codex/prompts/aiws-validate.md +17 -0
- package/templates/workspace/.codex/prompts/ws-analyze.md +32 -0
- package/templates/workspace/.codex/prompts/ws-dev.md +29 -0
- package/templates/workspace/.codex/prompts/ws-migrate.md +27 -0
- package/templates/workspace/.codex/prompts/ws-preflight.md +32 -0
- package/templates/workspace/.codex/prompts/ws-req-change.md +39 -0
- package/templates/workspace/.codex/prompts/ws-req-contract-sync.md +23 -0
- package/templates/workspace/.codex/prompts/ws-req-contract-validate.md +18 -0
- package/templates/workspace/.codex/prompts/ws-req-flow-sync.md +25 -0
- package/templates/workspace/.codex/prompts/ws-req-review.md +38 -0
- package/templates/workspace/.codex/prompts/ws-review.md +30 -0
- package/templates/workspace/.codex/prompts/ws-rule.md +29 -0
- package/templates/workspace/.githooks/pre-commit +32 -0
- package/templates/workspace/.githooks/pre-push +32 -0
- package/templates/workspace/.iflow/agents/feature-reviewer.md +27 -0
- package/templates/workspace/.iflow/agents/requirements-analyst.md +24 -0
- package/templates/workspace/.iflow/agents/server-commit-manager.md +28 -0
- package/templates/workspace/.iflow/agents/server-fix-implementer.md +31 -0
- package/templates/workspace/.iflow/agents/server-test-planner.md +28 -0
- package/templates/workspace/.iflow/agents/server-test-triager.md +30 -0
- package/templates/workspace/.iflow/commands/aiws-init.toml +24 -0
- package/templates/workspace/.iflow/commands/aiws-rollback.toml +18 -0
- package/templates/workspace/.iflow/commands/aiws-update.toml +23 -0
- package/templates/workspace/.iflow/commands/aiws-validate.toml +18 -0
- package/templates/workspace/.iflow/commands/server-commit.toml +27 -0
- package/templates/workspace/.iflow/commands/server-drain.toml +99 -0
- package/templates/workspace/.iflow/commands/server-fix-and-commit.toml +27 -0
- package/templates/workspace/.iflow/commands/server-fix.toml +65 -0
- package/templates/workspace/.iflow/commands/server-test-plan.toml +62 -0
- package/templates/workspace/.iflow/commands/server-test.toml +58 -0
- package/templates/workspace/.iflow/commands/server-triage.toml +38 -0
- package/templates/workspace/.iflow/commands/server_test-plan.toml +12 -0
- package/templates/workspace/.iflow/commands/server_test.toml +12 -0
- package/templates/workspace/.iflow/commands/ws-analyze.toml +33 -0
- package/templates/workspace/.iflow/commands/ws-contract-check.toml +69 -0
- package/templates/workspace/.iflow/commands/ws-dev.toml +34 -0
- package/templates/workspace/.iflow/commands/ws-doctor.toml +141 -0
- package/templates/workspace/.iflow/commands/ws-env-doctor.toml +74 -0
- package/templates/workspace/.iflow/commands/ws-feature-deliver.toml +44 -0
- package/templates/workspace/.iflow/commands/ws-feature-plan.toml +47 -0
- package/templates/workspace/.iflow/commands/ws-init.toml +53 -0
- package/templates/workspace/.iflow/commands/ws-memory-bank-init.toml +100 -0
- package/templates/workspace/.iflow/commands/ws-migrate.toml +59 -0
- package/templates/workspace/.iflow/commands/ws-preflight.toml +30 -0
- package/templates/workspace/.iflow/commands/ws-req-change.toml +52 -0
- package/templates/workspace/.iflow/commands/ws-req-contract-sync.toml +25 -0
- package/templates/workspace/.iflow/commands/ws-req-contract-validate.toml +16 -0
- package/templates/workspace/.iflow/commands/ws-req-flow-sync.toml +36 -0
- package/templates/workspace/.iflow/commands/ws-req-review.toml +56 -0
- package/templates/workspace/.iflow/commands/ws-review.toml +32 -0
- package/templates/workspace/.iflow/commands/ws-rule.toml +43 -0
- package/templates/workspace/.opencode/command/aiws-init.md +19 -0
- package/templates/workspace/.opencode/command/aiws-rollback.md +12 -0
- package/templates/workspace/.opencode/command/aiws-update.md +18 -0
- package/templates/workspace/.opencode/command/aiws-validate.md +13 -0
- package/templates/workspace/.opencode/command/ws-analyze.md +27 -0
- package/templates/workspace/.opencode/command/ws-dev.md +24 -0
- package/templates/workspace/.opencode/command/ws-migrate.md +22 -0
- package/templates/workspace/.opencode/command/ws-preflight.md +27 -0
- package/templates/workspace/.opencode/command/ws-req-change.md +34 -0
- package/templates/workspace/.opencode/command/ws-req-contract-sync.md +18 -0
- package/templates/workspace/.opencode/command/ws-req-contract-validate.md +13 -0
- package/templates/workspace/.opencode/command/ws-req-flow-sync.md +20 -0
- package/templates/workspace/.opencode/command/ws-req-review.md +33 -0
- package/templates/workspace/.opencode/command/ws-review.md +25 -0
- package/templates/workspace/.opencode/command/ws-rule.md +24 -0
- package/templates/workspace/AGENTS.md +22 -0
- package/templates/workspace/AI_PROJECT.md +86 -0
- package/templates/workspace/AI_WORKSPACE.md +167 -0
- package/templates/workspace/REQUIREMENTS.md +94 -0
- package/templates/workspace/changes/README.md +55 -0
- package/templates/workspace/changes/templates/design.md +29 -0
- package/templates/workspace/changes/templates/proposal.md +59 -0
- package/templates/workspace/changes/templates/tasks.md +33 -0
- package/templates/workspace/issues/problem-issues.csv +2 -0
- package/templates/workspace/manifest.json +205 -0
- package/templates/workspace/memory-bank/README.md +14 -0
- package/templates/workspace/memory-bank/architecture.md +9 -0
- package/templates/workspace/memory-bank/implementation-plan.md +11 -0
- package/templates/workspace/memory-bank/progress.md +10 -0
- package/templates/workspace/memory-bank/tech-stack.md +11 -0
- package/templates/workspace/requirements/CHANGELOG.md +13 -0
- package/templates/workspace/requirements/requirements-issues.csv +2 -0
- package/templates/workspace/secrets/test-accounts.example.json +32 -0
- package/templates/workspace/tools/iflow_watchdog.sh +138 -0
- package/templates/workspace/tools/install_iflow_watchdog_systemd_user.sh +118 -0
- package/templates/workspace/tools/requirements_contract.py +285 -0
- package/templates/workspace/tools/requirements_contract_sync.py +290 -0
- package/templates/workspace/tools/requirements_flow_gen.py +250 -0
- package/templates/workspace/tools/server_test_runner.py +1902 -0
- package/templates/workspace/tools/systemd/iflow-watchdog@.service +16 -0
- package/templates/workspace/tools/systemd/iflow-watchdog@.timer +11 -0
- package/templates/workspace/tools/ws_change_check.py +323 -0
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
"""
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
"""
|