@peterxiaoyang/superspec 0.1.10 → 0.1.12
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 +8 -10
- package/dist/src/apply_worker_chain.d.ts +6 -3
- package/dist/src/apply_worker_chain.js +125 -30
- package/dist/src/apply_worker_chain_lifecycle.d.ts +7 -5
- package/dist/src/apply_worker_chain_lifecycle.js +153 -22
- package/dist/src/cli_args.d.ts +1 -0
- package/dist/src/cli_args.js +33 -15
- package/dist/src/disclosure.js +2 -2
- package/dist/src/evidence.js +104 -8
- package/dist/src/gates.d.ts +1 -0
- package/dist/src/gates.js +160 -27
- package/dist/src/hooks/adapter.js +43 -7
- package/dist/src/hooks/guard_api.js +2 -2
- package/dist/src/hooks/health.js +0 -12
- package/dist/src/hooks/policy_event.js +11 -1
- package/dist/src/i18n.js +63 -3
- package/dist/src/init_cli.js +1 -1
- package/dist/src/install_engine.js +64 -0
- package/dist/src/openspec.d.ts +2 -0
- package/dist/src/openspec.js +31 -0
- package/dist/src/packet_render.d.ts +1 -0
- package/dist/src/packet_render.js +248 -31
- package/dist/src/packet_schema.d.ts +2 -0
- package/dist/src/tasks.d.ts +5 -0
- package/dist/src/tasks.js +62 -0
- package/dist/src/util.d.ts +4 -0
- package/dist/src/util.js +13 -0
- package/dist/superspec.js +4 -4
- package/package.json +3 -3
- package/templates/hooks/codex-hooks.json +0 -26
- package/templates/sidecar/discovery.md +9 -0
- package/templates/sidecar/test-contract.md +2 -1
- package/templates/workflow/prompts/code-reviewer.md +1 -1
- package/templates/workflow/prompts/executor.md +1 -1
- package/templates/workflow/prompts/test-engineer.md +1 -0
- package/templates/workflow/prompts/test-runner.md +3 -1
- package/templates/workflow/prompts/verifier.md +9 -9
- package/templates/workflow/skills/superspec-apply/SKILL.md +58 -40
- package/templates/workflow/skills/superspec-archive/SKILL.md +5 -13
- package/templates/workflow/skills/superspec-explore/SKILL.md +17 -18
- package/templates/workflow/skills/superspec-propose/SKILL.md +26 -22
- package/templates/workflow/skills/superspec-review/SKILL.md +17 -24
- package/dist/src/packet_measure.d.ts +0 -43
- package/dist/src/packet_measure.js +0 -382
- /package/bin/{superspec-guard.js → superspec-check.js} +0 -0
package/dist/src/tasks.js
CHANGED
|
@@ -243,6 +243,68 @@ export function task_test_refs(tasks) {
|
|
|
243
243
|
}
|
|
244
244
|
return refs;
|
|
245
245
|
}
|
|
246
|
+
export const APPLY_EXECUTION_SURFACES = new Set(["implementation", "runtime_config", "docs_generated", "no_code"]);
|
|
247
|
+
function cleanWriteScope(scope) {
|
|
248
|
+
return scope.trim().replace(/\\/g, "/");
|
|
249
|
+
}
|
|
250
|
+
function unsafeWriteScope(scope) {
|
|
251
|
+
const parts = scope.split("/");
|
|
252
|
+
return scope === "" || scope === "." || scope.startsWith("/") || parts.some((part) => part === "" || part === "." || part === "..");
|
|
253
|
+
}
|
|
254
|
+
function rootMarkdown(scope) {
|
|
255
|
+
return !scope.includes("/") && /\.(?:md|mdx|rst|adoc)$/iu.test(scope);
|
|
256
|
+
}
|
|
257
|
+
function rootReadmeOrChangelog(scope) {
|
|
258
|
+
if (scope.includes("/"))
|
|
259
|
+
return false;
|
|
260
|
+
return /^(?:README|CHANGELOG)(?:\.(?:md|mdx|rst|adoc))?$/iu.test(scope);
|
|
261
|
+
}
|
|
262
|
+
function docsGeneratedScopeAllowed(scope) {
|
|
263
|
+
if (unsafeWriteScope(scope))
|
|
264
|
+
return false;
|
|
265
|
+
if (scope.startsWith("docs/") || scope.startsWith("doc/"))
|
|
266
|
+
return true;
|
|
267
|
+
if (rootMarkdown(scope) || rootReadmeOrChangelog(scope))
|
|
268
|
+
return true;
|
|
269
|
+
return scope.startsWith("templates/") && scope.endsWith(".md");
|
|
270
|
+
}
|
|
271
|
+
export function docs_generated_write_scope_reasons(writeScope, taskId = "") {
|
|
272
|
+
const invalid = writeScope
|
|
273
|
+
.map(cleanWriteScope)
|
|
274
|
+
.filter((scope) => !docsGeneratedScopeAllowed(scope))
|
|
275
|
+
.sort();
|
|
276
|
+
if (invalid.length === 0)
|
|
277
|
+
return [];
|
|
278
|
+
const prefix = taskId ? `task ${taskId} ` : "";
|
|
279
|
+
return [reason("invalid_docs_generated_write_scope", `${prefix}apply_execution_surface=docs_generated only allows docs/**, doc/**, root README/CHANGELOG/markdown, and templates/**/*.md write_scope entries: ${renderList(invalid)}`, invalid)];
|
|
280
|
+
}
|
|
281
|
+
export function task_apply_execution_surface(task) {
|
|
282
|
+
const explicit = task.attrs.apply_execution_surface?.trim();
|
|
283
|
+
if (explicit)
|
|
284
|
+
return explicit;
|
|
285
|
+
return splitList(task.attrs.write_scope ?? "").length > 0 ? "implementation" : "no_code";
|
|
286
|
+
}
|
|
287
|
+
export function task_apply_execution_surface_reasons(taskId, task) {
|
|
288
|
+
const surface = task_apply_execution_surface(task);
|
|
289
|
+
const writeScope = splitList(task.attrs.write_scope ?? "");
|
|
290
|
+
if (!APPLY_EXECUTION_SURFACES.has(surface)) {
|
|
291
|
+
return [reason("invalid_apply_execution_surface", `task ${taskId}: apply_execution_surface=${surface}`)];
|
|
292
|
+
}
|
|
293
|
+
if (surface === "implementation" || surface === "runtime_config") {
|
|
294
|
+
return writeScope.length === 0
|
|
295
|
+
? [reason("missing_write_scope", `task ${taskId} apply_execution_surface=${surface} requires non-empty write_scope`)]
|
|
296
|
+
: [];
|
|
297
|
+
}
|
|
298
|
+
if (surface === "no_code") {
|
|
299
|
+
return writeScope.length === 0
|
|
300
|
+
? []
|
|
301
|
+
: [reason("invalid_apply_execution_surface_write_scope", `task ${taskId} apply_execution_surface=no_code requires empty write_scope`, writeScope)];
|
|
302
|
+
}
|
|
303
|
+
if (writeScope.length === 0) {
|
|
304
|
+
return [reason("missing_write_scope", `task ${taskId} apply_execution_surface=docs_generated requires non-empty write_scope`)];
|
|
305
|
+
}
|
|
306
|
+
return docs_generated_write_scope_reasons(writeScope, taskId);
|
|
307
|
+
}
|
|
246
308
|
export function write_scope_conflict_reasons(tasks) {
|
|
247
309
|
const byGroup = {};
|
|
248
310
|
for (const [taskId, task] of Object.entries(tasks)) {
|
package/dist/src/util.d.ts
CHANGED
|
@@ -53,6 +53,10 @@ export declare const ALLOWED_CONFIG_KEYS: Set<string>;
|
|
|
53
53
|
export declare const EVIDENCE_STATUSES: Set<string>;
|
|
54
54
|
export declare const EVIDENCE_KINDS: Set<string>;
|
|
55
55
|
export declare const HUMAN_CONFIRMATION_GATES: Set<string>;
|
|
56
|
+
export declare const PENDING_CONFIRMATION_RE: RegExp;
|
|
57
|
+
export declare const UNCHECKED_CHECKBOX_RE: RegExp;
|
|
58
|
+
export declare const CHECKED_CHECKBOX_RE: RegExp;
|
|
59
|
+
export declare function confirmation_text_has_pending_wording(text: string): boolean;
|
|
56
60
|
export declare const NO_TDD_REASONS: Set<string>;
|
|
57
61
|
export declare const TDD_MODES: Set<string>;
|
|
58
62
|
export declare const ROLE_EVIDENCE_FIELDS: readonly ["agent_role", "agent_id", "prompt_ref", "output_ref", "source_anchors", "target_refs"];
|
package/dist/src/util.js
CHANGED
|
@@ -87,8 +87,21 @@ export const HUMAN_CONFIRMATION_GATES = new Set([
|
|
|
87
87
|
"branch_handling",
|
|
88
88
|
"apply_isolation",
|
|
89
89
|
"scope_expansion",
|
|
90
|
+
"serial_takeover",
|
|
90
91
|
"verify_failure_handling",
|
|
91
92
|
]);
|
|
93
|
+
// Pending-confirmation wording shared by two defenses so they cannot drift:
|
|
94
|
+
// - the explore_complete open-questions gate (B1) counts list items inside discovery.md's
|
|
95
|
+
// "待确认问题" section that carry this wording;
|
|
96
|
+
// - the human_confirmation self-pending guard (B3) rejects confirmation_text that carries it.
|
|
97
|
+
// Worded to confirmation semantics only: "仍需/还需要 + 评估/细化" (legitimate follow-up prose,
|
|
98
|
+
// not an unresolved confirmation) is intentionally excluded because it does not end in 确认.
|
|
99
|
+
export const PENDING_CONFIRMATION_RE = /仍需确认|待确认|尚未确认|未确认完|还需要[^,。;\n]{0,20}确认/u;
|
|
100
|
+
export const UNCHECKED_CHECKBOX_RE = /\[ \]/u;
|
|
101
|
+
export const CHECKED_CHECKBOX_RE = /\[[xX]\]/u;
|
|
102
|
+
export function confirmation_text_has_pending_wording(text) {
|
|
103
|
+
return PENDING_CONFIRMATION_RE.test(text);
|
|
104
|
+
}
|
|
92
105
|
export const NO_TDD_REASONS = new Set([
|
|
93
106
|
"documentation-only",
|
|
94
107
|
"configuration-only",
|
package/dist/superspec.js
CHANGED
|
@@ -25,14 +25,14 @@ function help() {
|
|
|
25
25
|
" init install SuperSpec Codex surfaces (asks project/user; default project)",
|
|
26
26
|
" update update SuperSpec CLI, then update manifest-managed surfaces",
|
|
27
27
|
" uninstall remove manifest-managed SuperSpec surfaces",
|
|
28
|
-
"
|
|
28
|
+
" check run the SuperSpec check command surface",
|
|
29
29
|
" doctor diagnose SuperSpec/OpenSpec/npm/PATH wiring",
|
|
30
30
|
" version print SuperSpec CLI version",
|
|
31
31
|
"",
|
|
32
32
|
"examples:",
|
|
33
33
|
" superspec init --scope project",
|
|
34
34
|
" superspec init --scope user",
|
|
35
|
-
" superspec
|
|
35
|
+
" superspec check check-init --change <change> --format agent",
|
|
36
36
|
" superspec doctor",
|
|
37
37
|
"",
|
|
38
38
|
].join("\n");
|
|
@@ -80,11 +80,11 @@ export async function main_superspec(argv = process.argv.slice(2)) {
|
|
|
80
80
|
}
|
|
81
81
|
if (command === "uninstall")
|
|
82
82
|
return main_init_async([...rest, "--uninstall"]);
|
|
83
|
-
if (command === "guard")
|
|
83
|
+
if (command === "check" || command === "guard")
|
|
84
84
|
return main(rest);
|
|
85
85
|
if (command === "doctor")
|
|
86
86
|
return main_doctor(rest);
|
|
87
|
-
// Convenience fallback: `superspec check-init ...` behaves like `superspec
|
|
87
|
+
// Convenience fallback: `superspec check-init ...` behaves like `superspec check check-init ...`.
|
|
88
88
|
if (command.startsWith("check-") || command === "status" || command === "recompute" || command === "init") {
|
|
89
89
|
return main(argv);
|
|
90
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peterxiaoyang/superspec",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "SuperSpec workflow package: guard runtime, generic workflow templates, and Codex adapter payload.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"bin": {
|
|
22
22
|
"superspec": "bin/superspec.js",
|
|
23
|
-
"superspec-
|
|
23
|
+
"superspec-check": "bin/superspec-check.js",
|
|
24
24
|
"superspec-hook": "bin/superspec-hook.js",
|
|
25
25
|
"superspec-init": "bin/superspec-init.js"
|
|
26
26
|
},
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "node build.js",
|
|
58
58
|
"typecheck": "tsc --noEmit",
|
|
59
|
-
"test": "node --test tests/test_install_engine.test.ts tests/
|
|
59
|
+
"test": "node --test tests/test_install_engine.test.ts tests/test_real_openspec_smoke.test.ts tests/test_superspec_cli.test.ts tests/test_superspec_guard_output.test.ts tests/test_superspec_guard_core.test.ts tests/test_superspec_guard_review.test.ts tests/test_superspec_guard_request_reopen.test.ts tests/test_superspec_guard_archive.test.ts tests/test_superspec_guard_packet.test.ts tests/test_superspec_guard_disclosure.test.ts tests/test_superspec_hooks.test.ts tests/test_superspec_i18n.test.ts tests/test_superspec_skills.test.ts",
|
|
60
60
|
"prepack": "npm run build",
|
|
61
61
|
"prepublishOnly": "npm run build",
|
|
62
62
|
"pack:dry-run": "npm pack --dry-run"
|
|
@@ -5,32 +5,6 @@
|
|
|
5
5
|
"strict_profile_default": "audit-only-until-r1-provenance-passes"
|
|
6
6
|
},
|
|
7
7
|
"hooks": {
|
|
8
|
-
"PreToolUse": [
|
|
9
|
-
{
|
|
10
|
-
"matcher": "Bash|apply_patch|Edit|Write|mcp__.*",
|
|
11
|
-
"hooks": [
|
|
12
|
-
{
|
|
13
|
-
"type": "command",
|
|
14
|
-
"command": "superspec-hook --change \"$SUPERSPEC_CHANGE\"",
|
|
15
|
-
"timeout": 120,
|
|
16
|
-
"statusMessage": "SuperSpec 写入策略检查"
|
|
17
|
-
}
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"PostToolUse": [
|
|
22
|
-
{
|
|
23
|
-
"matcher": "Bash",
|
|
24
|
-
"hooks": [
|
|
25
|
-
{
|
|
26
|
-
"type": "command",
|
|
27
|
-
"command": "superspec-hook --change \"$SUPERSPEC_CHANGE\"",
|
|
28
|
-
"timeout": 120,
|
|
29
|
-
"statusMessage": "SuperSpec 运行证据记录"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
8
|
"SubagentStart": [
|
|
35
9
|
{
|
|
36
10
|
"matcher": ".*",
|
|
@@ -18,6 +18,15 @@
|
|
|
18
18
|
|
|
19
19
|
-
|
|
20
20
|
|
|
21
|
+
## 待确认问题
|
|
22
|
+
|
|
23
|
+
<!-- 需要用户拍板的问题逐条列在此处:未决用 "- [ ]",已确认用 "- [x]"。
|
|
24
|
+
explore_complete 检查在所有项变成 "- [x]"(或标注「已确认」)之前不会通过,也不会进入 propose。
|
|
25
|
+
段标题包含「确认」字样即可被识别(待确认 / 需要用户确认 等)。 -->
|
|
26
|
+
|
|
27
|
+
- [ ] <待确认问题 1>
|
|
28
|
+
- [ ] <待确认问题 2>
|
|
29
|
+
|
|
21
30
|
## Subagent Evidence
|
|
22
31
|
|
|
23
32
|
- explore:
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
- `invariant_refs`: INV-xxx
|
|
14
14
|
- `expected_red`: <实现前因何失败>
|
|
15
15
|
- `expected_green`: <实现后通过的判据>
|
|
16
|
-
- `test_command`:
|
|
16
|
+
- `test_command`: <framework-agnostic command that runs exactly the target test identity>
|
|
17
17
|
|
|
18
18
|
## Iron Law
|
|
19
19
|
|
|
20
20
|
- 没有正在失败的测试,不准写实现代码。
|
|
21
21
|
- 每个实现型 task:先有 RED evidence 才能改实现代码,先有 GREEN evidence 才能勾选。
|
|
22
|
+
- 测试证据语义(框架无关):`target test identity executed` 才算有效运行;`command exit code alone is not proof`,退出码 0 不等于目标测试跑过/通过;命令在到达测试 runner 之前失败属于 `blocked before the target test runner`,不是 RED/GREEN;`do not classify environment/build failures as RED or GREEN`。
|
|
22
23
|
|
|
23
24
|
## 与 tasks 的映射约定
|
|
24
25
|
|
|
@@ -22,7 +22,7 @@ argument-hint: "任务说明、review-packet 或 apply-code-review-packet prompt
|
|
|
22
22
|
|
|
23
23
|
在 apply worker path 中,先读取 `apply-code-review-packet`。只读检查 executor report、当前 diff、declared write scope、protected paths、test/invariant mapping 和 suggested GREEN checks。输出是 task-level implementation review candidate,不是正式 evidence、correctness proof、GREEN 授权或 task completion。
|
|
24
24
|
|
|
25
|
-
apply worker
|
|
25
|
+
apply worker report 字段以提示包的 `code_review_report_required_fields` 为准;不要凭本 prompt 记忆或发明字段名。
|
|
26
26
|
|
|
27
27
|
遵守 `common_worker_report_policy`:长日志、完整 diff、编译输出和大段生成内容必须作为 artifact refs 返回,不要内联或截断。
|
|
28
28
|
|
|
@@ -27,6 +27,6 @@ argument-hint: "任务说明或 apply-executor-packet prompt_ref"
|
|
|
27
27
|
- 所有用户可见输出必须使用简体中文。
|
|
28
28
|
- 命令、路径、JSON/schema 字段、gate 名称、task/test id、代码标识符保留原文。
|
|
29
29
|
- 结论先行:完成、阻塞或部分完成。
|
|
30
|
-
-
|
|
30
|
+
- 报告字段以提示包的 `executor_report_required_fields` 为准;不要凭本 prompt 记忆或发明字段名。
|
|
31
31
|
- 报告还必须包含 `role:"executor"`、`origin_packet_fingerprint`、`input_ref_digest`、`source_implementation_fingerprint`、`produced_implementation_fingerprint`;这些字段必须来自 packet / runtime,不要自行发明。
|
|
32
32
|
- 遵守 `common_worker_report_policy`:长日志、完整 diff、编译输出和大段生成内容必须作为 artifact refs 返回,不要内联或截断。
|
|
@@ -13,6 +13,7 @@ argument-hint: "任务说明或 review-packet prompt_ref"
|
|
|
13
13
|
|
|
14
14
|
- SuperSpec review/propose lane 默认只读;不要修改方案、测试契约或实现。
|
|
15
15
|
- 普通测试实现任务中,只写测试,不写业务实现;需要实现改动时向主流程说明。
|
|
16
|
+
- Apply 阶段如需新增或修改 RED/characterization 测试文件,只在主流程明确交付的 bounded native lane 内写测试;正式 RED/characterization/GREEN 运行证据仍由 test-runner packet 生成。
|
|
16
17
|
- 必须核对现有测试模式和目标 acceptance,不用臆测替代证据。
|
|
17
18
|
|
|
18
19
|
## SuperSpec Packet 规则
|
|
@@ -13,6 +13,7 @@ argument-hint: "任务说明或 apply-test-packet prompt_ref"
|
|
|
13
13
|
|
|
14
14
|
- 默认只读;不要修改 production code、OpenSpec artifacts、`.superspec/**`、task checkbox、review artifacts 或 archive artifacts。
|
|
15
15
|
- 只能执行 `apply-test-packet` 中的 `allowed_test_command`,不要发明、改写或补充命令。
|
|
16
|
+
- 只有 test-runner worker 运行结果可以成为正式 RED/characterization/GREEN candidate;不要让主线程代跑或伪造正式 evidence。
|
|
16
17
|
- 如果 packet 没有 `allowed_test_command`、`worker_state` 不是 `ready`、命令上下文不足或测试产生未声明副作用,停止并报告 blocker。
|
|
17
18
|
- fixture/snapshot 更新只有在 packet 明确列入 `expected_worktree_side_effects` 时才可接受;否则视为不可接收风险。
|
|
18
19
|
|
|
@@ -27,7 +28,8 @@ argument-hint: "任务说明或 apply-test-packet prompt_ref"
|
|
|
27
28
|
- 所有用户可见输出必须使用简体中文。
|
|
28
29
|
- 命令、路径、JSON/schema 字段、gate 名称、task/test id、代码标识符保留原文。
|
|
29
30
|
- 结论先行:测试阶段完成、阻塞或不可接收。
|
|
30
|
-
-
|
|
31
|
+
- 报告字段以提示包的 `test_runner_report_required_fields` 为准;不要凭本 prompt 记忆或发明字段名。
|
|
31
32
|
- 报告还必须包含 `role:"test-runner"`、`origin_packet_fingerprint`、`input_ref_digest`、`source_implementation_fingerprint`、`observed_implementation_fingerprint`;这些字段必须来自 packet / runtime,不要自行发明。
|
|
32
33
|
- RED packet 带 `expected_failure_signature` 或 `expected_failure_classifier` 时,报告和 raw transcript 必须证明匹配;无关 import/build/env/timeout 失败不能作为有效 RED。
|
|
34
|
+
- 测试证据语义(框架无关):只有 `target test identity executed` 才算有效运行;`command exit code alone is not proof`,退出码 0 不证明目标测试真正跑过/通过;命令在到达测试 runner 之前就失败属于 `blocked before the target test runner`,必须作为 blocker 报告;`do not classify environment/build failures as RED or GREEN`。
|
|
33
35
|
- 遵守 `common_worker_report_policy`:长日志、完整 diff、编译输出和大段生成内容必须作为 artifact refs 返回,不要内联或截断。
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "
|
|
3
|
-
argument-hint: "
|
|
2
|
+
description: "完成验证角色"
|
|
3
|
+
argument-hint: "review-packet 或 apply-verify-packet prompt_ref"
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Verifier
|
|
7
7
|
|
|
8
8
|
## 角色身份
|
|
9
9
|
|
|
10
|
-
你是 Verifier
|
|
10
|
+
你是 Verifier。将完成声明转成可复现证据,或指出证明缺口。缺证据不是通过;提供 verification guidance,不替代主流程最终判断。
|
|
11
11
|
|
|
12
12
|
## 读写边界
|
|
13
13
|
|
|
14
14
|
- 默认只读;不要修改文件。
|
|
15
|
-
-
|
|
15
|
+
- 核对命令输出、测试结果、diff、artifact、evidence refs 和验收标准。
|
|
16
16
|
- 区分行为失败、证明缺失、命令不可用和范围不清。
|
|
17
17
|
|
|
18
18
|
## SuperSpec Packet 规则
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
`superspec-review` verification lane 先读 `review-packet` 或 `prompt_ref`;以 packet refs/scope、`required_output_kind`、`output_contract_fields` 和 stop conditions 为准;不要依赖本 prompt 记忆输出 schema。
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
确认 `required_output_kind` 是 `verification_review` 后再输出 verification review。
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
apply worker path 先读 `apply-verify-packet`。只读核对 executor/code-review refs、worktree、scope/protected paths 和 freshness。`completion_proof_kind:"green_tests"` 核对 RED/characterization 与 GREEN;`completion_proof_kind:"alternative_verification"` 核对 `pre_edit_proof_kind:"no_tdd_declared"`、空 pre-edit refs、`tdd_required:false`、surface/no-TDD metadata、`alternative_verification_evidence_refs` / manual refs。输出只是 candidate,不替代 `task_complete.allowed`。
|
|
25
25
|
|
|
26
|
-
apply worker report
|
|
26
|
+
apply worker report 字段以提示包的 `verifier_report_required_fields` 为准;不要凭本 prompt 记忆或发明字段名。alternative 分支的 `input_ref_digest` 必须覆盖 executor report、code-review report、`alternative_verification_evidence_refs` 和 active chain no-TDD metadata。
|
|
27
27
|
|
|
28
|
-
遵守 `common_worker_report_policy`:长日志、完整 diff、编译输出和大段生成内容用 artifact refs
|
|
28
|
+
遵守 `common_worker_report_policy`:长日志、完整 diff、编译输出和大段生成内容用 artifact refs,不内联。
|
|
29
29
|
|
|
30
30
|
## 输出风格
|
|
31
31
|
|
|
@@ -10,7 +10,7 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
## 语言规则 / Language
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- 默认使用简体中文写人类可读内容;命令、路径、字段名、阶段门名、task/test id、代码标识符保留原文。
|
|
14
14
|
- 用户可见文案不得使用“裁决”描述用户动作;统一说“确认”“范围取舍”“处理方式选择”或“用户确认记录”。
|
|
15
15
|
- 不把内部证据种类、reason code、JSON 字段大全直接转述给用户;需要诊断时才引用原文。
|
|
16
16
|
- 普通 workflow 命令使用 `--format agent`;`--format json` 只用于诊断,不作为默认上下文。
|
|
@@ -22,59 +22,47 @@ metadata:
|
|
|
22
22
|
|
|
23
23
|
## 阶段职责
|
|
24
24
|
|
|
25
|
-
Apply 按 OpenSpec tasks
|
|
25
|
+
Apply 按 OpenSpec tasks 实现,负责 RED/GREEN 证据、任务勾选和 review request-changes 后的 reopen 修复;不扩大范围,不改 proposal package 语义。
|
|
26
26
|
|
|
27
27
|
## 第一条必跑命令
|
|
28
28
|
|
|
29
|
-
先尝试建立当前 change 的 SuperSpec hook session。R-1/provenance 未通过时该命令只会记录 audit-only lease 和降级诊断,不代表 mechanical enforcement 已启用:
|
|
30
|
-
|
|
31
|
-
```text
|
|
32
|
-
superspec guard hook-session-begin --change "<change>" --workflow superspec-apply --entrypoint-token "<fresh-entrypoint-token>" --format agent
|
|
33
|
-
superspec guard hook-session-status --change "<change>" --format agent
|
|
34
|
-
```
|
|
35
|
-
|
|
36
29
|
```text
|
|
37
|
-
superspec
|
|
30
|
+
superspec check workflow-packet --change "<change>" --gate apply_ready --format agent
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
遇到任何返回状态为 `block` 就停止;未 allowed 前不要编辑实现。
|
|
41
34
|
|
|
42
35
|
## OpenSpec 边界
|
|
43
36
|
|
|
44
37
|
- 直接使用 OpenSpec CLI surface,不读取 repo-local `openspec-*` skill 文本。
|
|
45
|
-
- task list、`contextFiles`、progress
|
|
38
|
+
- task list、`contextFiles`、progress、dynamic instruction 来自:
|
|
46
39
|
|
|
47
40
|
```text
|
|
48
41
|
openspec instructions apply --change "<change>" --json
|
|
49
42
|
```
|
|
50
43
|
|
|
51
|
-
|
|
44
|
+
不要发明 task list,也不要跳过 OpenSpec 返回的 context files。
|
|
52
45
|
|
|
53
46
|
## Task Guard 边界
|
|
54
47
|
|
|
55
|
-
实现编辑前读取 task
|
|
48
|
+
实现编辑前读取 `task_edit` 检查结果;勾选 task 前读取 `task_complete` 检查结果:
|
|
56
49
|
|
|
57
50
|
```text
|
|
58
|
-
superspec
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
勾选 task 前读取 completion packet:
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
superspec guard workflow-packet --change "<change>" --gate task_complete --task-id "<task-id>" --format agent
|
|
51
|
+
superspec check workflow-packet --change "<change>" --gate task_edit --task-id "<task-id>" --format agent
|
|
52
|
+
superspec check workflow-packet --change "<change>" --gate task_complete --task-id "<task-id>" --format agent
|
|
65
53
|
```
|
|
66
54
|
|
|
67
55
|
`task_edit` 未 allowed 不得编辑实现;`task_complete` 未 allowed 不得把 checkbox 改成 done。
|
|
68
56
|
|
|
69
57
|
## Reopen 边界
|
|
70
58
|
|
|
71
|
-
|
|
59
|
+
review 给出 `request_changes_route:"reopen_tasks"` 时,先生成完整 reopen package,再检查:
|
|
72
60
|
|
|
73
61
|
```text
|
|
74
|
-
superspec
|
|
62
|
+
superspec check workflow-packet --change "<change>" --gate task_reopen --task-id "<task-id>" --format agent
|
|
75
63
|
```
|
|
76
64
|
|
|
77
|
-
只有 `task_reopen` allowed 后,才允许把目标 task 从 checked 改回 unchecked 并重新 RED/GREEN
|
|
65
|
+
只有 `task_reopen` allowed 后,才允许把目标 task 从 checked 改回 unchecked 并重新 RED/GREEN。修完写 `task_reopen_resolved`,再进 review。若 route 是 `change_update`,停止 apply 并回 propose/change update。
|
|
78
66
|
|
|
79
67
|
## 用户确认边界
|
|
80
68
|
|
|
@@ -82,44 +70,74 @@ superspec guard workflow-packet --change "<change>" --gate task_reopen --task-id
|
|
|
82
70
|
- 分支状态、dirty worktree、scope expands 或需要改变 task scope 时必须停止并确认。
|
|
83
71
|
- 不要使用默认值、历史偏好或沉默作为确认。
|
|
84
72
|
|
|
85
|
-
##
|
|
73
|
+
## 专用代理边界
|
|
74
|
+
|
|
75
|
+
主线程只负责用检查命令生成各角色提示、分派专用代理、审核代理报告、登记证据、推进任务勾选。专用代理来自 `.codex/agents/*.toml` 与 `.codex/prompts/*.md`,不能由主线程自审替代。代理报告只是候选材料,通过检查的才是正式证据。当前 CLI 没有登记证据的命令;代理报告返回后,由主线程按检查命令的 output contract 字段手动写入 `.superspec/evidence/` 对应目录。
|
|
76
|
+
|
|
77
|
+
RED/characterization/GREEN 测试必须由 `.codex/agents/test-runner.toml` + `.codex/prompts/test-runner.md` 执行;主线程不得代跑或伪造 formal `test_run` evidence。新增或修改测试文件时用 `test-engineer` 专用代理。
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
superspec check apply-test-packet --change "<change>" --task-id "<task-id>" --test-id "<test-id>" --phase red --format prompt
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
用 test-runner 执行检查命令指定的测试命令;主线程审核报告/原始日志并登记为证据后,才写正式 `test_run` 证据。
|
|
84
|
+
|
|
85
|
+
测试证据语义(框架无关,审核 worker report 时用):只有 `target test identity executed` 才算有效运行;`command exit code alone is not proof`,退出码 0 不证明目标测试真正跑过/通过;命令在到达测试 runner 之前失败属于 `blocked before the target test runner`,不算 RED/GREEN;`do not classify environment/build failures as RED or GREEN`。
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
`apply_execution_surface`:缺省有 `write_scope` 为 `implementation`,无 `write_scope` 为 `no_code`;显式允许 `implementation`、`runtime_config`、`docs_generated`、`no_code`。`implementation` / `runtime_config` 必须走 executor-worker chain;`tdd_required:false` 也只能用 closed `apply_worker_chain` 的 `completion_proof_kind:"alternative_verification"` 完成。`docs_generated` / `no_code` 可用 direct alternative/manual verification。
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
编码实现必须由 `.codex/agents/executor.toml` + `.codex/prompts/executor.md` 执行,并通过 active -> closed `apply_worker_chain` 收敛;主线程不得直接改实现代码来完成 task。
|
|
90
90
|
|
|
91
91
|
```text
|
|
92
|
-
superspec
|
|
92
|
+
superspec check apply-executor-packet --change "<change>" --task-id "<task-id>" --apply-worker-chain-ref "<active-chain-ref>" --format prompt
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
使用 `.codex/agents/
|
|
95
|
+
使用 `.codex/agents/executor.toml` / `.codex/prompts/executor.md`。先把检查命令给出的激活模板登记为工作链证据;缺激活标记不能启动 executor。TDD 与 no-TDD 的激活标记不同(具体字段以检查命令输出为准)。executor 只能改检查命令声明的实现写范围(implementation/runtime_config write scope),不能写正式 evidence,不能改 task checkbox,不能做 review/verification。
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
executor 返回后把报告登记为证据,再生成任务级审查:
|
|
98
98
|
|
|
99
99
|
```text
|
|
100
|
-
superspec
|
|
100
|
+
superspec check apply-code-review-packet --change "<change>" --task-id "<task-id>" --executor-report-ref "<ref>" --format prompt
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
用 `.codex/agents/code-reviewer.toml` 检查 scope/protected paths、executor report 与 diff、test/invariant mapping 和 suggested GREEN checks。
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
code-review 通过后,GREEN 只走同一 executor-worker chain:
|
|
106
106
|
|
|
107
107
|
```text
|
|
108
|
-
superspec
|
|
108
|
+
superspec check apply-test-packet --change "<change>" --task-id "<task-id>" --test-id "<test-id>" --phase green --task-code-review-report-ref "<ref>" --format prompt
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
|
|
111
|
+
GREEN report 审核并登记为 evidence 后,生成 GREEN verification:
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
```text
|
|
114
|
+
superspec check apply-verify-packet --change "<change>" --task-id "<task-id>" --executor-report-ref "<ref>" --task-code-review-report-ref "<ref>" --green-test-run-evidence-ref "<ref>" --red-test-run-evidence-ref "<ref>" --format prompt
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
no-TDD implementation/runtime_config 先登记 live/pass `alternative_verification` 或 `manual_verification`,再生成 alternative verification:
|
|
114
118
|
|
|
115
119
|
```text
|
|
116
|
-
superspec
|
|
120
|
+
superspec check apply-verify-packet --change "<change>" --task-id "<task-id>" --executor-report-ref "<ref>" --task-code-review-report-ref "<ref>" --alternative-verification-evidence-ref "<ref>" --format prompt
|
|
117
121
|
```
|
|
118
122
|
|
|
119
|
-
GREEN
|
|
123
|
+
用 `.codex/agents/verifier.toml` 检查完成方式分支:GREEN 绑定 RED/characterization、GREEN 和当前工作区;alternative 绑定 no-TDD 激活标记、实际替代/人工验证引用、surface/no-TDD 元数据和当前工作区。审核 verifier 报告后写关闭的工作链证据,再跑 `task_complete`。异常终止只取消旧工作链,不授权完成。
|
|
124
|
+
|
|
125
|
+
## 完成检查
|
|
126
|
+
|
|
127
|
+
每个 task 的证据链(RED/characterization → executor → code-review → GREEN 或替代验证 → verifier)齐全后,运行任务完成检查:
|
|
128
|
+
|
|
129
|
+
```text
|
|
130
|
+
superspec check workflow-packet --change "<change>" --gate task_complete --task-id "<task-id>" --format agent
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
只有检查结果显示通过后,才把该 task 的 checkbox 改为 done。所有 task 完成后进入 `superspec-review`。
|
|
134
|
+
|
|
135
|
+
## 异常恢复
|
|
136
|
+
|
|
137
|
+
状态文件损坏时重建:
|
|
120
138
|
|
|
121
139
|
```text
|
|
122
|
-
superspec
|
|
140
|
+
superspec check recompute --change "<change>" --rebuild-corrupt
|
|
123
141
|
```
|
|
124
142
|
|
|
125
|
-
|
|
143
|
+
状态指纹过期时,重跑对应检查命令即可(检查命令会自动重算并刷新指纹);不要手写状态文件。
|
|
@@ -10,7 +10,7 @@ metadata:
|
|
|
10
10
|
|
|
11
11
|
## 语言规则 / Language
|
|
12
12
|
|
|
13
|
-
-
|
|
13
|
+
- 默认使用简体中文写人类可读内容;命令、路径、字段名、阶段门名、task/test id、代码标识符保留原文。
|
|
14
14
|
- 用户可见文案不得使用“裁决”描述用户动作;统一说“确认”“范围取舍”“处理方式选择”或“用户确认记录”。
|
|
15
15
|
- 不把内部证据种类、reason code、JSON 字段大全直接转述给用户;需要诊断时才引用原文。
|
|
16
16
|
- 普通 workflow 命令使用 `--format agent`;`--format json` 只用于诊断,不作为默认上下文。
|
|
@@ -26,18 +26,11 @@ Archive 在 `review_complete` allowed 后收尾:确认 archive readiness、保
|
|
|
26
26
|
|
|
27
27
|
## 第一条必跑命令
|
|
28
28
|
|
|
29
|
-
先尝试建立当前 change 的 SuperSpec hook session。R-1/provenance 未通过时该命令只会记录 audit-only lease 和降级诊断,不代表 mechanical enforcement 已启用:
|
|
30
|
-
|
|
31
|
-
```text
|
|
32
|
-
superspec guard hook-session-begin --change "<change>" --workflow superspec-archive --entrypoint-token "<fresh-entrypoint-token>" --format agent
|
|
33
|
-
superspec guard hook-session-status --change "<change>" --format agent
|
|
34
|
-
```
|
|
35
|
-
|
|
36
29
|
```text
|
|
37
|
-
superspec
|
|
30
|
+
superspec check workflow-packet --change "<change>" --gate archive_ready --format agent
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
遇到 `block` 就停止,不归档。
|
|
41
34
|
|
|
42
35
|
## OpenSpec 边界
|
|
43
36
|
|
|
@@ -54,7 +47,7 @@ superspec guard workflow-packet --change "<change>" --gate archive_ready --forma
|
|
|
54
47
|
确认后运行会写 preservation manifest 的 readiness check:
|
|
55
48
|
|
|
56
49
|
```text
|
|
57
|
-
superspec
|
|
50
|
+
superspec check check-archive-ready --change "<change>" --format agent
|
|
58
51
|
```
|
|
59
52
|
|
|
60
53
|
然后运行 OpenSpec archive:
|
|
@@ -66,8 +59,7 @@ openspec archive -y "<change>"
|
|
|
66
59
|
最后验证 archived sidecar preservation:
|
|
67
60
|
|
|
68
61
|
```text
|
|
69
|
-
superspec
|
|
70
|
-
superspec guard hook-session-end --change "<change>" --reason archived --format agent
|
|
62
|
+
superspec check check-archived --change "<change>" --format agent
|
|
71
63
|
```
|
|
72
64
|
|
|
73
65
|
`.superspec/artifacts/business-invariants.md`、`.superspec/artifacts/test-contract.md`、review/verification evidence、RED/GREEN evidence 和 archive evidence 必须能从 preservation manifest 追溯。
|