@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
|
@@ -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` 只用于诊断,不作为默认上下文。
|
|
@@ -24,14 +24,12 @@ metadata:
|
|
|
24
24
|
|
|
25
25
|
Explore 只做需求澄清、代码事实调查、范围边界和风险记录。产物是 `openspec/changes/<change>/.superspec/artifacts/discovery.md`;不写 `proposal.md`、`specs/**`、`design.md`、`tasks.md`,也不改实现代码。
|
|
26
26
|
|
|
27
|
-
##
|
|
27
|
+
## 产物格式
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
- discovery.md 必须按 SuperSpec discovery 模板的结构填写,保留全部段落:`调查范围` / `现有实现事实` / `隐性合约` / `风险与歧义` / `待确认问题` / `Subagent Evidence`;不得自创或删减段落骨架。
|
|
30
|
+
- 第一条必跑命令 `superspec check workflow-packet --change "<change>" --gate explore_complete --format agent` 的返回里带 `discovery_template` 与 `discovery_rules`:按其中的模板骨架和填写规则产出,而不是自由发挥,这样无论哪个模型产物结构都一致。
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
superspec guard hook-session-begin --change "<change>" --workflow superspec-explore --entrypoint-token "<fresh-entrypoint-token>" --format agent
|
|
33
|
-
superspec guard hook-session-status --change "<change>" --format agent
|
|
34
|
-
```
|
|
32
|
+
## 第一条必跑命令
|
|
35
33
|
|
|
36
34
|
```text
|
|
37
35
|
superspec init --scope project --format agent
|
|
@@ -42,11 +40,11 @@ superspec init --scope project --format agent
|
|
|
42
40
|
```text
|
|
43
41
|
openspec list --json
|
|
44
42
|
openspec status --change "<change>" --json
|
|
45
|
-
superspec
|
|
46
|
-
superspec
|
|
43
|
+
superspec check check-init --change "<change>" --format agent
|
|
44
|
+
superspec check workflow-packet --change "<change>" --gate explore_complete --format agent
|
|
47
45
|
```
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
遇到 `block` 就停止,按检查结果的下一步提示处理;不要绕过检查。
|
|
50
48
|
|
|
51
49
|
## OpenSpec 边界
|
|
52
50
|
|
|
@@ -55,32 +53,33 @@ superspec guard workflow-packet --change "<change>" --gate explore_complete --fo
|
|
|
55
53
|
- OpenSpec 负责 change 结构和后续 artifact 语义;本阶段只补 SuperSpec discovery 证据。
|
|
56
54
|
- 如果发现需要正式方案、规格、设计或任务,先写入 discovery,再交给 `superspec-propose`。
|
|
57
55
|
|
|
58
|
-
##
|
|
56
|
+
## 专用代理边界
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
需求审查由本仓库的 `critic` 专用代理完成。生成审查提示时使用检查命令的输出,而不是把披露协议常驻在 skill 正文:
|
|
61
59
|
|
|
62
60
|
```text
|
|
63
|
-
superspec
|
|
61
|
+
superspec check review-packet --change "<change>" --gate explore_complete --role critic --round 1 --format prompt
|
|
64
62
|
```
|
|
65
63
|
|
|
66
|
-
|
|
64
|
+
主流程整理审查问题时读取主线程提示信息:
|
|
67
65
|
|
|
68
66
|
```text
|
|
69
|
-
superspec
|
|
67
|
+
superspec check review-packet --change "<change>" --gate explore_complete --role main-thread --round 1 --format agent
|
|
70
68
|
```
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
第二轮及以后的审查,必须由检查命令把上一轮的问题注入提示;不要手写历史问题清单。
|
|
73
71
|
|
|
74
72
|
## 用户确认边界
|
|
75
73
|
|
|
76
74
|
- 关键范围、非目标、验收标准、业务语义或设计边界问题必须面向用户说明并等待明确确认。
|
|
77
75
|
- 探索结论、范围边界和进入 propose 的授权必须等待用户确认后再记录 evidence。
|
|
76
|
+
- discovery.md 必须含 `## 待确认问题` 段(标题含「确认」字样即可,如「待确认问题」「需要用户确认的问题」)。每条问题用 `- [ ]`(未决)或 `- [x]`(已确认)标记;也可在已确认项写「已确认:」。**该段只要还有 `- [ ]` 或「仍需确认/待确认」项,`explore_complete` 检查就不会通过**,不得记录人工确认,也不得进入 propose。
|
|
78
77
|
- 用户看到的文字要用中文业务语言;内部 JSON 名只写进证据、命令输出或诊断片段。
|
|
79
78
|
|
|
80
79
|
## 完成检查
|
|
81
80
|
|
|
82
81
|
```text
|
|
83
|
-
superspec
|
|
82
|
+
superspec check workflow-packet --change "<change>" --gate explore_complete --format agent
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
只有检查结果显示通过后,才进入 `superspec-propose`。
|
|
@@ -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 @@ Propose 把 discovery 转成 OpenSpec proposal package,并补 SuperSpec 业务
|
|
|
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-propose --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 explore_complete --format agent
|
|
38
31
|
```
|
|
39
32
|
|
|
40
|
-
|
|
33
|
+
遇到 `block` 就停止,回 explore 阶段补事实或确认。
|
|
41
34
|
|
|
42
35
|
## OpenSpec 边界
|
|
43
36
|
|
|
@@ -49,39 +42,50 @@ superspec guard workflow-packet --change "<change>" --gate explore_complete --fo
|
|
|
49
42
|
openspec instructions <artifact-id> --change "<change>" --json
|
|
50
43
|
```
|
|
51
44
|
|
|
45
|
+
## 执行步骤
|
|
46
|
+
|
|
47
|
+
把 discovery 整理成 OpenSpec proposal package,每个正本 artifact 都通过 OpenSpec 产出引擎生成:
|
|
48
|
+
|
|
49
|
+
1. 运行 `openspec status --change "<change>" --json`,取 artifact 顺序、状态和 `resolvedOutputPath`。
|
|
50
|
+
2. 每个 artifact(proposal/specs/design/tasks)运行 `openspec instructions <artifact-id> --change "<change>" --json`,取回 template/rules/context/instruction/dependencies。
|
|
51
|
+
3. 先读 dependencies 列出的已完成 artifact,再按 template 写到 `resolvedOutputPath`;context/rules 是对作者的约束,不写进产出文件。
|
|
52
|
+
4. sidecar(`.superspec/artifacts/business-invariants.md`、`.superspec/artifacts/test-contract.md`)用 SuperSpec 内置模板,写到 change 内 `.superspec/artifacts/`。
|
|
53
|
+
|
|
52
54
|
## Packet 驱动的阶段门
|
|
53
55
|
|
|
54
|
-
按 artifact
|
|
56
|
+
按 artifact 依赖顺序工作,每个门都先读检查结果,通过后才进入下一段:
|
|
55
57
|
|
|
56
58
|
```text
|
|
57
|
-
superspec
|
|
58
|
-
superspec
|
|
59
|
-
superspec
|
|
60
|
-
superspec
|
|
61
|
-
superspec
|
|
62
|
-
superspec
|
|
59
|
+
superspec check workflow-packet --change "<change>" --gate proposal_reviewed --format agent
|
|
60
|
+
superspec check workflow-packet --change "<change>" --gate design_complete --format agent
|
|
61
|
+
superspec check workflow-packet --change "<change>" --gate invariants_reviewed --format agent
|
|
62
|
+
superspec check workflow-packet --change "<change>" --gate test_contract_drafted --format agent
|
|
63
|
+
superspec check workflow-packet --change "<change>" --gate test_contract_honored --format agent
|
|
64
|
+
superspec check workflow-packet --change "<change>" --gate tasks_complete --format agent
|
|
65
|
+
superspec check workflow-packet --change "<change>" --gate propose_complete --format agent
|
|
66
|
+
superspec check workflow-packet --change "<change>" --gate apply_ready --format agent
|
|
63
67
|
```
|
|
64
68
|
|
|
65
|
-
`proposal_reviewed` 不是 advisory note;它是硬门。`propose.proposal_reviewed`、`propose.design_reviewed`、`propose.invariants_reviewed`、`propose.test_plan_drafted`、`propose.tasks_mapped`
|
|
69
|
+
`proposal_reviewed` 不是 advisory note;它是硬门。`propose.proposal_reviewed`、`propose.design_reviewed`、`propose.invariants_reviewed`、`propose.test_plan_drafted`、`propose.tasks_mapped` 是兼容别名,检查结果输出中的规范阶段门名为准。
|
|
66
70
|
|
|
67
|
-
##
|
|
71
|
+
## 专用代理边界
|
|
68
72
|
|
|
69
73
|
- proposal review 使用 repo-local `critic`。
|
|
70
74
|
- design review 使用 repo-local `architect`、`critic`、`test-engineer`。
|
|
71
75
|
- business-invariants 和 test-contract review 使用 repo-local `critic` / `test-engineer`。
|
|
72
76
|
- reviewer prompt 一律由 `review-packet --format prompt` 生成;主线程 digest 输入一律由 `review-packet --role main-thread --format agent` 读取。
|
|
73
|
-
-
|
|
77
|
+
- 第二轮及以后的审查,必须由检查命令把上一轮的问题注入提示,不手写历史 finding 清单。
|
|
74
78
|
|
|
75
79
|
## 用户确认边界
|
|
76
80
|
|
|
77
|
-
关键范围、非目标、验收标准、业务语义和设计边界问题必须停止并交给用户确认。主线程不能静默关闭这类 finding;需要回 explore 或回上游 artifact
|
|
81
|
+
关键范围、非目标、验收标准、业务语义和设计边界问题必须停止并交给用户确认。主线程不能静默关闭这类 finding;需要回 explore 或回上游 artifact 时,按检查结果和阶段检查给出的回退路径处理。
|
|
78
82
|
|
|
79
83
|
设计选项选择、任务审查确认,以及任何会改变范围或验收标准的处理,都必须等待明确用户确认。
|
|
80
84
|
|
|
81
85
|
## 完成检查
|
|
82
86
|
|
|
83
87
|
```text
|
|
84
|
-
superspec
|
|
88
|
+
superspec check workflow-packet --change "<change>" --gate apply_ready --format agent
|
|
85
89
|
```
|
|
86
90
|
|
|
87
91
|
只有 apply-ready allowed 后,才进入 `superspec-apply`。
|
|
@@ -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,28 +26,21 @@ Review 合并实现审查、架构审查、SuperSpec critic、final verification
|
|
|
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-review --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 check-init --change "<change>" --format agent
|
|
38
31
|
```
|
|
39
32
|
|
|
40
33
|
然后检查 review readiness:
|
|
41
34
|
|
|
42
35
|
```text
|
|
43
|
-
superspec
|
|
36
|
+
superspec check check-review-ready --change "<change>" --format agent
|
|
44
37
|
```
|
|
45
38
|
|
|
46
|
-
|
|
39
|
+
遇到任何返回状态为 `block` 就停止。review 不直接回改 `tasks.md` checkbox。
|
|
47
40
|
|
|
48
|
-
##
|
|
41
|
+
## 专用代理边界
|
|
49
42
|
|
|
50
|
-
Review
|
|
43
|
+
Review 必须使用本仓库安装的 repo-local native agents(专用代理),不要调用全局 `$code-review`、OMX workflow、主线程自审或普通 markdown 报告替代。
|
|
51
44
|
|
|
52
45
|
必需入口:
|
|
53
46
|
|
|
@@ -56,12 +49,12 @@ Review 必须使用 SuperSpec 分发包里的 repo-local native agents,不要
|
|
|
56
49
|
- `.codex/agents/critic.toml` / `.codex/prompts/critic.md`
|
|
57
50
|
- `.codex/agents/verifier.toml` / `.codex/prompts/verifier.md`
|
|
58
51
|
|
|
59
|
-
|
|
52
|
+
每个审查提示都先由检查命令产出:
|
|
60
53
|
|
|
61
54
|
```text
|
|
62
|
-
superspec
|
|
63
|
-
superspec
|
|
64
|
-
superspec
|
|
55
|
+
superspec check review-packet --change "<change>" --gate review_complete --role code-reviewer --round 1 --format prompt
|
|
56
|
+
superspec check review-packet --change "<change>" --gate review_complete --role architect --round 1 --format prompt
|
|
57
|
+
superspec check review-packet --change "<change>" --gate review_complete --role critic --round 1 --format prompt
|
|
65
58
|
```
|
|
66
59
|
|
|
67
60
|
## Final Verification 边界
|
|
@@ -72,11 +65,11 @@ superspec guard review-packet --change "<change>" --gate review_complete --role
|
|
|
72
65
|
openspec validate "<change>"
|
|
73
66
|
```
|
|
74
67
|
|
|
75
|
-
然后执行 test contract
|
|
68
|
+
然后执行 test contract 要求的最终测试,启动本仓库 `verifier` 和 `critic` 做验证审查。验证提示也必须由检查命令产出:
|
|
76
69
|
|
|
77
70
|
```text
|
|
78
|
-
superspec
|
|
79
|
-
superspec
|
|
71
|
+
superspec check review-packet --change "<change>" --gate review_complete --role verifier --round 1 --format prompt
|
|
72
|
+
superspec check review-packet --change "<change>" --gate review_complete --role critic --round 1 --kind verification_review --format prompt
|
|
80
73
|
```
|
|
81
74
|
|
|
82
75
|
verification 只提供 proof/gap,不替代主流程最终判断。
|
|
@@ -86,10 +79,10 @@ verification 只提供 proof/gap,不替代主流程最终判断。
|
|
|
86
79
|
主线程写最终判断前读取:
|
|
87
80
|
|
|
88
81
|
```text
|
|
89
|
-
superspec
|
|
82
|
+
superspec check review-packet --change "<change>" --gate review_complete --role main-thread --round 1 --format agent
|
|
90
83
|
```
|
|
91
84
|
|
|
92
|
-
`review_complete`
|
|
85
|
+
`review_complete` 是只允许通过的阶段检查。通过路径由主线程写本轮审查结论(主线程直接写,不携带代理字段)。
|
|
93
86
|
|
|
94
87
|
`request_changes` 不是 review_complete allow。它必须写清 `request_changes_route`:
|
|
95
88
|
|
|
@@ -103,7 +96,7 @@ request-changes round 不生成 allow-path verification,也不调用 `check-re
|
|
|
103
96
|
仅 allow path 运行:
|
|
104
97
|
|
|
105
98
|
```text
|
|
106
|
-
superspec
|
|
99
|
+
superspec check workflow-packet --change "<change>" --gate review_complete --format agent
|
|
107
100
|
```
|
|
108
101
|
|
|
109
|
-
|
|
102
|
+
只有检查结果显示通过后,才进入 `superspec-archive`。
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export type MeasuredTextFile = {
|
|
2
|
-
path: string;
|
|
3
|
-
chars: number;
|
|
4
|
-
};
|
|
5
|
-
export type SurfaceMeasure = {
|
|
6
|
-
total_chars: number;
|
|
7
|
-
files: MeasuredTextFile[];
|
|
8
|
-
};
|
|
9
|
-
export type RepresentativeScenarioMeasure = {
|
|
10
|
-
name: string;
|
|
11
|
-
description: string;
|
|
12
|
-
total_chars: number;
|
|
13
|
-
files: MeasuredTextFile[];
|
|
14
|
-
};
|
|
15
|
-
export type MaterializedTextSample = {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
chars: number;
|
|
19
|
-
matched_markers?: string[];
|
|
20
|
-
};
|
|
21
|
-
export type MaterializedTextMeasure = {
|
|
22
|
-
total_chars: number;
|
|
23
|
-
samples: MaterializedTextSample[];
|
|
24
|
-
};
|
|
25
|
-
export type PacketMeasureReport = {
|
|
26
|
-
fixed_surface_chars_install_upper_bound: SurfaceMeasure;
|
|
27
|
-
fixed_surface_chars_runtime_required_subset: SurfaceMeasure;
|
|
28
|
-
materialized_workflow_packet_chars: MaterializedTextMeasure;
|
|
29
|
-
materialized_review_packet_chars: MaterializedTextMeasure;
|
|
30
|
-
materialized_review_prompt_chars: MaterializedTextMeasure;
|
|
31
|
-
ledger_block_chars: MaterializedTextMeasure;
|
|
32
|
-
representative_loaded_surface_chars: {
|
|
33
|
-
scenarios: RepresentativeScenarioMeasure[];
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
type ScenarioSpec = {
|
|
37
|
-
name: string;
|
|
38
|
-
description: string;
|
|
39
|
-
files: string[];
|
|
40
|
-
};
|
|
41
|
-
export declare function representative_scenarios(): readonly ScenarioSpec[];
|
|
42
|
-
export declare function measure_packet_surface_report(repoRoot: string): PacketMeasureReport;
|
|
43
|
-
export {};
|