@abelxiaoxing/cadence 1.0.9 → 1.0.11
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 +49 -1
- package/package.json +1 -1
- package/prompts/abel-design.md +14 -2
- package/prompts/abel-implement.md +10 -2
- package/skills/abel-workflow/SKILL.md +36 -0
- package/src/candidate-preflight.ts +237 -90
- package/src/child-session.ts +1 -0
- package/src/contracts.ts +482 -41
- package/src/patch.ts +13 -1
- package/src/result-store.ts +6 -9
- package/src/runtime.ts +66 -10
- package/src/verification-capability.ts +481 -0
package/README.md
CHANGED
|
@@ -45,6 +45,54 @@ npm install -g @abelxiaoxing/cadence
|
|
|
45
45
|
|
|
46
46
|
本包从不检查或分类 Pi 主机版本,不声明任何版本范围,也不从参考仓库源安装。
|
|
47
47
|
|
|
48
|
+
## 跨项目验证合同(Cross-project verification)
|
|
49
|
+
|
|
50
|
+
Cadence 不要求 consumer repository 提供 `check` 或 `test:target` 脚本。
|
|
51
|
+
Gate B 使用 Implement Runtime 同一套 capability validator,只批准 consumer 当前确实能够执行的结构化合同:
|
|
52
|
+
|
|
53
|
+
- `vitest`:显式 package script、本地 binary 或 `npx`(必须 `noInstall: true`),安全相对测试路径和 `minTests`。
|
|
54
|
+
只有这个 kind 会注入 JSON reporter 并校验 Red assertion identity。
|
|
55
|
+
- `package-script`:固定 `bun | npm | pnpm | yarn`、script 名、完整 script
|
|
56
|
+
command 和参数;可用于 typecheck、build 与仓库已有测试脚本。
|
|
57
|
+
- `static-check`:本地 binary、禁止下载的 `npx` 或安全相对 Node script;可用于
|
|
58
|
+
schema/Prisma/AGENTS 等静态检查,不接收 Vitest 参数。
|
|
59
|
+
- `steps`:显式有序 precheck/target;不使用 `&&` 拼接复合命令。
|
|
60
|
+
|
|
61
|
+
例如 npm-only consumer 的 Vitest target:
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"kind": "vitest",
|
|
66
|
+
"id": "npm-vitest-target",
|
|
67
|
+
"runner": {
|
|
68
|
+
"kind": "package-script",
|
|
69
|
+
"packageManager": "npm",
|
|
70
|
+
"script": "test:run",
|
|
71
|
+
"command": "vitest run"
|
|
72
|
+
},
|
|
73
|
+
"testFiles": ["tests/utils/upstreamFetch.test.js"],
|
|
74
|
+
"args": [],
|
|
75
|
+
"classification": "expected-green",
|
|
76
|
+
"minTests": 1
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Prisma 检查使用本地已安装 executable,不会隐式联网:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"kind": "static-check",
|
|
85
|
+
"id": "prisma-schema",
|
|
86
|
+
"runner": { "kind": "npx", "executable": "prisma", "noInstall": true },
|
|
87
|
+
"args": ["validate"],
|
|
88
|
+
"classification": "expected-green"
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
迁移时,将新的 Gate B argv 命令改为上述 kind;需要 `typecheck` 再测试时用 `steps`,并把 typecheck 建模为 expected-green precheck。
|
|
93
|
+
Cadence 仍接受旧版 `bun run test:target <paths>` 和 `bun run check` 合同并立即规范化,但 Design 不再生成 argv-only 合同。
|
|
94
|
+
脚本缺失会在 readiness 以 `verification-adapter/script-missing` 明确关闭,而不是在 Red 阶段误报为 Bubblewrap 或依赖环境故障。
|
|
95
|
+
|
|
48
96
|
## 开发(Development)
|
|
49
97
|
|
|
50
98
|
```sh
|
|
@@ -60,7 +108,7 @@ bun run check:agents # AGENTS 索引校验
|
|
|
60
108
|
|
|
61
109
|
```sh
|
|
62
110
|
bun run verify # check && lint && test && pack:check(发布前全套校验)
|
|
63
|
-
bun run pack:check # 真实 tarball
|
|
111
|
+
bun run pack:check # 真实 tarball 44 成员清单校验
|
|
64
112
|
bun run traceability:check # 81 条 Requirement/Scenario 引用精确解析
|
|
65
113
|
```
|
|
66
114
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abelxiaoxing/cadence",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Prompts, skills, and a private orchestration extension exposing the Abel four-stage workflow (/abel-init, /abel-design, /abel-implement, /abel-diagnose) with package-owned professional Agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/prompts/abel-design.md
CHANGED
|
@@ -150,7 +150,9 @@ $ARGUMENTS
|
|
|
150
150
|
- 计划写集:修改/新建/删除的精确路径或最窄可判定 glob;预期交付文件/符号
|
|
151
151
|
- 冲突集:任务 ID + 原因;共享状态、生成物、清单、数据库、端口、fixture 或验证资源及所需资源锁
|
|
152
152
|
- 验证类型:`property | example | E2E | static`
|
|
153
|
-
- Red 命令 + 预期失败原因;Green 预期行为
|
|
153
|
+
- 每个 phase 的 Runtime verification contract:只使用 `kind: "vitest"`、`kind: "package-script"`、`kind: "static-check"` 或 `kind: "steps"`;Red 命令 + 预期失败原因;Green 预期行为
|
|
154
|
+
- `vitest` 明确 runner、安全相对 `testFiles`、`args`、`minTests`;`package-script` 明确 `bun | npm | pnpm | yarn`、真实 script、Gate B 固定的完整 script command 与 `args`;`static-check` 明确本地 executable、`npx` + `noInstall: true` 或安全相对 Node script
|
|
155
|
+
- 复合验证建模为有序 `steps`:前置检查为 `expected-green`,最后一步匹配 phase classification;不得使用 `&&` 或其他 shell operator
|
|
154
156
|
- 受影响套件命令;目标范围;验证命令的并行资格及资源锁
|
|
155
157
|
- 影响闭包(impact closure):`changedSurfaces`、检索命令/命中证据、全部相关既有测试及其 `current-task | regression-task | unaffected` 归类、affected suite 中的既有测试证据
|
|
156
158
|
- 已批准依赖变化清单(无则 `[]`)
|
|
@@ -166,15 +168,25 @@ $ARGUMENTS
|
|
|
166
168
|
- 写集未知、过宽或可能重叠的任务不得标为并行;先重塑任务,或用 `conflict-order` 串行化。
|
|
167
169
|
- 非行为变更任务的 Red 是变更前即可执行的静态验证。
|
|
168
170
|
仅人工验证的任务不具备实施就绪性,绝不通过 Gate B 或退出;重塑任务直至具备可执行验证。
|
|
171
|
+
- Gate B 呈现前,使用 Cadence 与 Implement Runtime 共用的 `src/verification-capability.ts::assessVerificationReadiness` 在 consumer root 校验全部 phase verification contracts。
|
|
172
|
+
仅允许 consumer 已存在且内容与合同完全一致的 package script、可用的显式 package manager、本地 `node_modules` executable,以及 `npx` 的 `noInstall: true`/`--no-install` 语义;绝不允许隐式联网下载、任意 shell 或 shell operator。
|
|
173
|
+
将来才由任务创建的测试/静态输入只有在其精确安全相对路径已列入批准写集时才可暂缺;绝对路径、路径逃逸和符号链接仍关闭失败。
|
|
174
|
+
不支持的合同以 `design-readiness/verification-contract-unsupported` 诊断关闭;脚本缺失以 `verification-adapter/script-missing` 关闭。
|
|
175
|
+
任何诊断存在时不得呈现 Gate B 为可批准、不得生成 `taskContractsExecutable: true`。
|
|
176
|
+
- `vitest` 才允许 Runtime 注入 JSON reporter、要求 `minTests` 并用 assertion identity 判定 Red;`package-script` 与 `static-check` 只按退出码及批准的稳定输出 identity 判定,绝不附加 Vitest 参数。
|
|
177
|
+
`bun run check`、`bun run test:target`、precheck 与 affected suite 都不得由 Runtime 隐式补充;需要时必须成为 Gate B 明确批准的 contract/step。
|
|
178
|
+
Design 不生成 argv-only legacy contract。
|
|
169
179
|
- 范围内每个索引过期发现分配给一个任务,或报告为无关的既有过期问题。
|
|
170
180
|
- 循环至未决技术决策为零;在内存中备好剩余产物内容/统一 diff。
|
|
171
181
|
|
|
172
182
|
## ⛔ Gate B —— 批准实施契约
|
|
173
183
|
|
|
174
184
|
- 核实阶段 3/4 忠实展开 Gate A 契约,未引入未批准的新决策。
|
|
185
|
+
- 重新运行共享 `assessVerificationReadiness`;只有结果为 `{ taskContractsExecutable: true, diagnostics: [] }` 才可请求 Gate B 批准。
|
|
186
|
+
否则以精确 readiness/adapter 诊断返回阶段 3/4 修正,不把缺失 consumer capability 延迟到 Implement Red。
|
|
175
187
|
- 呈现实质技术决策、任务 DAG/建议波次、前置条件、计划写集/冲突/资源锁、验证映射、AGENTS 影响矩阵与产物物化预览;用户显式批准。
|
|
176
188
|
- 按写入协议逐个写入剩余就绪产物。
|
|
177
|
-
- 最后写 `changeRoot/ready.yaml`:记录 receipt 版本、change/schema、Gate B 批准原文的忠实摘要(含任务 DAG
|
|
189
|
+
- 最后写 `changeRoot/ready.yaml`:记录 receipt 版本、change/schema、Gate B 批准原文的忠实摘要(含任务 DAG、建议波次、前置条件、计划写集、冲突与资源锁)、共享 capability validator 产生的 `taskContractsExecutable: true` 与空 diagnostics、任务验证与 AGENTS 影响摘要、`gate-a.yaml` 的 SHA-256,以及全部规划产物的规范化相对路径与 SHA-256;排除 `ready.yaml` 自身。
|
|
178
190
|
任务跟踪文件计算 hash 前只将任务完成标记 `- [x]`/`- [X]` 规范化为 `- [ ]`,其余字节不得忽略。
|
|
179
191
|
|
|
180
192
|
## 回环规则
|
|
@@ -63,12 +63,19 @@ Implement 不重新作出或请求 Gate A/B 决策;只有 Gate receipts、arti
|
|
|
63
63
|
7. `openspec validate <name> --strict --type change` 问题为零。
|
|
64
64
|
8. 阅读 `artifactPaths` 报告的全部规划产物;运行 `openspec instructions apply --change <name> --json` 并遵循其 apply 契约。
|
|
65
65
|
9. 校验稳定 Requirement/Scenario 引用、Requirement → Scenario → Verification → Task 追溯链,以及每个任务的前置条件、`depends_on`、计划写集、冲突/资源锁、派发上下文、验证、批准依赖、结构化 AGENTS 影响和影响闭包契约;缺失、含糊或不可判定时按下方矩阵关闭失败。
|
|
66
|
+
每个 phase 必须是 Gate B 批准的结构化 `kind: "vitest" | "package-script" | "static-check" | "steps"`;Implement 不从命令固定下标猜测语义,也不隐式运行 `bun run check`、`bun run test:target` 或任何 consumer script。
|
|
67
|
+
`steps` 按声明顺序执行;precheck 必须是显式 `expected-green` step,不得用 `&&` 或其他 shell operator 合成。
|
|
66
68
|
10. 影响闭包(impact closure):若任务修改路由授权、页面状态、API 响应或公共 HTML,检查 URL/路由/handler/template 检索证据及全部相关既有测试归类。
|
|
67
69
|
E2E、theme/layout、authorization、HTML/template、API contract 测试必须进入当前写集、明确后续回归任务或有不受影响证据;affected suite 不能只包含新增测试。
|
|
68
70
|
`/videos`、`/api/videos` 等变化须检查全部这些测试面。
|
|
69
|
-
11.
|
|
71
|
+
11. 在注册任务和运行 Red 前,对 ready receipt 的 `taskContractsExecutable: true` 与所有 TaskBoundary verification 重跑共享 `assessVerificationReadiness`。
|
|
72
|
+
package script 的 package manager、名称与完整 command 必须和当前 consumer `package.json` 一致;本地 executable 必须受 `node_modules` 约束;`npx` 只能用 `noInstall: true` 并编译为 `--no-install`,不允许下载。
|
|
73
|
+
`vitest` 才注入 JSON reporter、应用 `minTests` 并解析 assertion Red identity;`package-script`/`static-check` 不附加 Vitest 参数,只使用退出码和批准的稳定输出 identity。
|
|
74
|
+
parent-only AGENTS checkpoint 可使用合法的 Node/static contract。
|
|
75
|
+
不支持的 shape 是 `design-readiness/verification-contract-unsupported` stage blocker;缺失 script 是 `verification-adapter/script-missing`,其他缺失/漂移能力使用精确 adapter code;只有 Bubblewrap、Bun 解析、依赖路径或 sandbox runtime 不可用才使用 environment code。
|
|
76
|
+
12. 在任何写入前运行并记录每个未完成任务的目标命令、全部 affected-suite 命令与完整套件基线:命令、退出码、归一化失败标识/原因。
|
|
70
77
|
尚未加入 Red 验证时,目标命令可记录为契约规定的预期状态;既有失败与目标 Red 严格分离,既有失败绝不算 Red。
|
|
71
|
-
|
|
78
|
+
13. 可信交付无效时,在注册任务前输出 stage-level blocker;不得伪装成 task outcome。
|
|
72
79
|
boundary 外的新路径、依赖、行为、策略、架构、冲突、资源、verification 或 AGENTS 需求使当前任务以 typed `approval-boundary` failure 终止。
|
|
73
80
|
工具、依赖路径、命令或沙箱不可用使当前任务以 typed environment failure 终止;可机械修复的产物仅使用 phase 的有界 correction budget。
|
|
74
81
|
|
|
@@ -124,6 +131,7 @@ Runtime 只报告当前任务事实,不选择用户恢复动作,也不控制
|
|
|
124
131
|
- malformed diff、syntax/import/load、no-test/错误命令、wrong Red identity、重复/无效提交或 Red 候选意外通过:`{ kind: "artifact", code: <closed-artifact-code> }`,其中意外通过使用 `red-not-witnessed`;首次可在共享两次 launch 内修正,耗尽为 `attempts-exhausted`。
|
|
125
132
|
- stale snapshot 使用 `{ kind: "stale", code: <closed-stale-code> }`;可机械重派的 transport failure 使用 `{ kind: "transport", code: "transport-failure" }`;首次可在共享两次 launch 内刷新或同调用重派,耗尽为 `attempts-exhausted`。
|
|
126
133
|
- Bubblewrap、依赖路径、测试沙箱或外部环境不可用:`{ kind: "environment", code: <closed-environment-code> }`,当前任务 terminal blocked。
|
|
134
|
+
- 缺失/漂移的已批准 script、runner、本地 executable 或 verification input:`{ kind: "verification-adapter", code: <closed-adapter-code> }`;`script-missing` 不得误报为 `bubblewrap-or-dependency-unavailable`。
|
|
127
135
|
- 新路径、依赖、行为、策略、架构、冲突、资源、verification 或 AGENTS 合同:对应 closed `approval-boundary` code,当前任务 terminal blocked,不扩大 boundary。
|
|
128
136
|
- result size 超限:`{ kind: "result-limit", limitBytes }`,当前任务 terminal blocked,不接受 partial diff。
|
|
129
137
|
|
|
@@ -23,6 +23,39 @@ A missing receipt, invalid hash, or inconsistent artifact is a `delivery-invalid
|
|
|
23
23
|
Every approved behavior must retain a stable trace from Requirement to Scenario to Verification to Task.
|
|
24
24
|
Every task must state exactly one executable verification type, its Red command and expected target failure, Green behavior, affected suite, target files, approved dependency changes, impact-closure evidence, and structured AGENTS impact.
|
|
25
25
|
|
|
26
|
+
### Structured verification capability
|
|
27
|
+
|
|
28
|
+
Design and Implement share `src/verification-capability.ts`; Design must call `assessVerificationReadiness` over every phase verification contract before Gate B approval and again immediately before writing `ready.yaml`.
|
|
29
|
+
The receipt may state `taskContractsExecutable: true` only when that assessment returns true with no diagnostics.
|
|
30
|
+
A future verification input may be absent only when its exact safe relative path is in the task's approved write set.
|
|
31
|
+
Missing, escaping, absolute, or symbolic-link inputs remain closed failures.
|
|
32
|
+
|
|
33
|
+
Design emits only the structured Runtime kinds `kind: "vitest"`, `kind: "package-script"`, `kind: "static-check"`, and `kind: "steps"`:
|
|
34
|
+
|
|
35
|
+
- `vitest` declares its runner, safe relative `testFiles`, explicit `args`, and `minTests`.
|
|
36
|
+
It uses a consumer-installed local Vitest.
|
|
37
|
+
Runtime alone injects the JSON reporter and checks assertion identity for Red.
|
|
38
|
+
- `package-script` pins the package manager, script name, exact Gate-B-approved `package.json` command, and argument array.
|
|
39
|
+
The script and runner must already exist in the consumer repository.
|
|
40
|
+
- `static-check` declares a local binary, `npx` with `noInstall: true`, or a safe relative Node script.
|
|
41
|
+
It covers static, typecheck, build, schema, and parent-only AGENTS checkpoint verification without Vitest arguments.
|
|
42
|
+
- `steps` is an ordered list of atomic contracts.
|
|
43
|
+
Every precheck is an explicit expected-green step and only the final step carries the phase classification.
|
|
44
|
+
A compound command must not use `&&` or another shell operator.
|
|
45
|
+
|
|
46
|
+
No kind admits an arbitrary shell command.
|
|
47
|
+
Tokens are passed without a shell; shell operators, path escapes, absolute paths, unsafe executable names, unapproved commands, and implicit download runners are rejected.
|
|
48
|
+
`npx` is compiled with `--no-install` and still requires its executable in the approved local `node_modules`.
|
|
49
|
+
Bun, npm, pnpm, and Yarn package scripts are allowed only when the named package manager and exact pinned script capability validate.
|
|
50
|
+
|
|
51
|
+
Runtime never invents `bun run check`, `bun run test:target`, or another consumer script.
|
|
52
|
+
A precheck or affected verification runs only as an explicit approved contract or ordered step.
|
|
53
|
+
Legacy Cadence 1.0.x `bun run test:target <paths>` and `bun run check` inputs remain accepted and are normalized immediately, but Design must not generate new argv-only contracts.
|
|
54
|
+
|
|
55
|
+
An unsupported shape is `design-readiness/verification-contract-unsupported`.
|
|
56
|
+
A missing approved script is `verification-adapter/script-missing`; other missing or drifted consumer capabilities use their closed `verification-adapter` code.
|
|
57
|
+
Only an unavailable Bubblewrap launch, Bun resolution, dependency path, or sandbox runtime is an `environment` failure.
|
|
58
|
+
|
|
26
59
|
## Verification discipline
|
|
27
60
|
|
|
28
61
|
Before writes, record target, affected-suite, and full-suite baselines with commands, exit codes, and normalized failure identities.
|
|
@@ -94,6 +127,9 @@ It does not select a user recovery action, recommend another workflow, or claim
|
|
|
94
127
|
- Generated artifact defects are closed typed failures: malformed diff, syntax/import/load, no-test or wrong command, wrong Red identity, duplicate/invalid structured result, and `red-not-witnessed`.
|
|
95
128
|
- Artifact, stale-snapshot, and transport failures share two non-cancelled launches per phase; exhaustion is `attempts-exhausted` and cancellation is budget-neutral.
|
|
96
129
|
- Bubblewrap, dependency-path, sandbox, or external runtime failure is `{ kind: "environment", code: <closed-environment-code> }` and terminally blocks the current task.
|
|
130
|
+
- Unsupported verification contracts close Design readiness; missing scripts,
|
|
131
|
+
runners, local executables, or inputs are closed `verification-adapter` failures
|
|
132
|
+
and must not be reported as Bubblewrap or dependency environment failures.
|
|
97
133
|
- Any required path, dependency, behavior, policy, architecture, conflict, resource, verification, or AGENTS expansion is the matching closed `approval-boundary` failure and never expands the boundary at runtime.
|
|
98
134
|
- Oversized output is `{ kind: "result-limit", limitBytes }`, terminal, and never yields a partial diff.
|
|
99
135
|
|