@wnlen/agent-execution-template 0.8.17 → 0.8.19
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 +27 -5
- package/README.zh-CN.md +20 -5
- package/bin/agent-execution-template.js +44 -3
- package/docs/SPEC.md +13 -6
- package/package.json +3 -2
- package/template/en/ai/README.md +2 -19
- package/template/en/ai/project/task.md +25 -9
- package/template/en/ai/template/VERSION +1 -1
- package/template/en/ai/template/execution-policy.md +38 -10
- package/template/en/ai/template/prompt.md +17 -12
- package/template/en/ai/template/protocol.md +9 -5
- package/template/en/ai/template/rules/core.md +12 -3
- package/template/zh/ai/README.md +2 -19
- package/template/zh/ai/project/task.md +15 -5
- package/template/zh/ai/template/VERSION +1 -1
- package/template/zh/ai/template/execution-policy.md +26 -5
- package/template/zh/ai/template/prompt.md +11 -8
- package/template/zh/ai/template/protocol.md +5 -2
- package/template/zh/ai/template/rules/core.md +8 -1
- package/test/check-release.js +94 -0
- package/test/selftest.js +39 -0
package/README.md
CHANGED
|
@@ -161,7 +161,8 @@ The user can still give a natural-language goal, for example:
|
|
|
161
161
|
Build the settings page with profile editing, notification toggles, and export entrypoint
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
-
Before execution, the AI decomposes L1 tasks
|
|
164
|
+
Before execution, the AI decomposes L1 tasks. Each L1 must be an independently
|
|
165
|
+
acceptable vertical slice, not a mechanical step checklist:
|
|
165
166
|
|
|
166
167
|
```text
|
|
167
168
|
- [ ] L1-1 Profile editing Green
|
|
@@ -171,12 +172,19 @@ Before execution, the AI decomposes L1 tasks:
|
|
|
171
172
|
|
|
172
173
|
Because there are two or more L1 tasks, the protocol automatically uses bounded
|
|
173
174
|
continuous execution. Before each L1, the AI plans naturally derived L2/L3 work.
|
|
174
|
-
After completing an L1, it checks and strikes the item
|
|
175
|
-
|
|
175
|
+
After completing an L1, it checks and strikes the item. `task_tree` is written
|
|
176
|
+
back only at L1 start/done, Red/blocked, scope changes, or final wrap-up, so tiny
|
|
177
|
+
steps do not churn files.
|
|
176
178
|
|
|
177
179
|
Only Red risk stops for confirmation. Green continues automatically, and Yellow
|
|
178
|
-
|
|
179
|
-
|
|
180
|
+
only permits local low-risk correction inside the current L1/L2; it must not
|
|
181
|
+
change public interfaces, data models, permissions, security, architecture
|
|
182
|
+
direction, or acceptance. By default, users see L1, risk conclusions, evidence,
|
|
183
|
+
Red confirmations, and final results; internal protocol details are not shown.
|
|
184
|
+
|
|
185
|
+
If the AI just created or rewrote `ai/project/task.md` in the current run, it
|
|
186
|
+
must stop for confirmation. Execution is allowed only when an existing task is
|
|
187
|
+
explicitly `ready_to_execute`.
|
|
180
188
|
|
|
181
189
|
## Installed Layout
|
|
182
190
|
|
|
@@ -444,11 +452,25 @@ Run the self-test:
|
|
|
444
452
|
npm test
|
|
445
453
|
```
|
|
446
454
|
|
|
455
|
+
Run the release consistency check:
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
npm run check:release
|
|
459
|
+
```
|
|
460
|
+
|
|
447
461
|
The test suite verifies the core CLI contract:
|
|
448
462
|
|
|
449
463
|
- `init` creates the expected protocol and project files.
|
|
450
464
|
- `update` does not overwrite `ai/project/**`.
|
|
451
465
|
- `doctor` reports missing and empty required files correctly.
|
|
466
|
+
- `check:release` verifies versions, template shape, installed protocol state,
|
|
467
|
+
and the spec's package version.
|
|
468
|
+
|
|
469
|
+
When maintaining this npm package source checkout, test the local CLI with
|
|
470
|
+
`node bin/agent-execution-template.js <command>`. Use
|
|
471
|
+
`npx -y @wnlen/agent-execution-template <command>` in user projects only.
|
|
472
|
+
Maintainer-local `ai/project/**` bootstrap content should not be committed as
|
|
473
|
+
product changes.
|
|
452
474
|
|
|
453
475
|
## Contributing
|
|
454
476
|
|
package/README.zh-CN.md
CHANGED
|
@@ -171,7 +171,7 @@ npx -y @wnlen/agent-execution-template strategy
|
|
|
171
171
|
实现设置页,包括资料编辑、通知开关和导出入口
|
|
172
172
|
```
|
|
173
173
|
|
|
174
|
-
AI 会在执行前先拆 L1
|
|
174
|
+
AI 会在执行前先拆 L1 任务。L1 必须是可独立验收的垂直切片,不是机械步骤清单:
|
|
175
175
|
|
|
176
176
|
```text
|
|
177
177
|
- [ ] L1-1 资料编辑 Green
|
|
@@ -180,11 +180,15 @@ AI 会在执行前先拆 L1 任务:
|
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
因为 L1 有两个以上,协议会自动使用边界内连续执行。执行每个 L1 前,AI 再规划
|
|
183
|
-
自然衍生的 L2/L3;完成一个 L1
|
|
184
|
-
|
|
183
|
+
自然衍生的 L2/L3;完成一个 L1 后,在清单中打勾并划掉。`task_tree` 只在
|
|
184
|
+
L1 开始/完成、Red/blocked、范围变化或最终收尾时写回,避免为微小步骤反复改文件。
|
|
185
185
|
|
|
186
|
-
只有 Red 风险会停下来让你确认。Green 自动继续,Yellow
|
|
187
|
-
|
|
186
|
+
只有 Red 风险会停下来让你确认。Green 自动继续,Yellow 只允许当前 L1/L2 内的
|
|
187
|
+
局部低风险修正,不能改变公共接口、数据模型、权限、安全、架构方向或验收标准。
|
|
188
|
+
用户默认只看 L1、风险结论、证据、Red 确认和最终结果;内部协议细节不默认展示。
|
|
189
|
+
|
|
190
|
+
如果 AI 本轮刚新建或重写了 `ai/project/task.md`,必须先停下来交接确认;
|
|
191
|
+
只有已有任务明确处于 `ready_to_execute` 时,才允许进入执行。
|
|
188
192
|
|
|
189
193
|
## 安装后的结构
|
|
190
194
|
|
|
@@ -449,11 +453,22 @@ License: MIT
|
|
|
449
453
|
npm test
|
|
450
454
|
```
|
|
451
455
|
|
|
456
|
+
发布前检查:
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
npm run check:release
|
|
460
|
+
```
|
|
461
|
+
|
|
452
462
|
测试会验证核心 CLI 契约:
|
|
453
463
|
|
|
454
464
|
- `init` 创建预期的协议和项目文件。
|
|
455
465
|
- `update` 不覆盖 `ai/project/**`。
|
|
456
466
|
- `doctor` 正确报告缺失文件和空的必要文件。
|
|
467
|
+
- `check:release` 验证版本号、模板结构、安装态协议和规格文档一致。
|
|
468
|
+
|
|
469
|
+
维护这个 npm 包源码仓库时,用 `node bin/agent-execution-template.js <command>`
|
|
470
|
+
测试当前 checkout;用户项目才使用 `npx -y @wnlen/agent-execution-template <command>`。
|
|
471
|
+
维护者本地 `ai/project/**` 初始化内容不应作为产品改动提交。
|
|
457
472
|
|
|
458
473
|
## 贡献
|
|
459
474
|
|
|
@@ -155,6 +155,10 @@ const TEXT = {
|
|
|
155
155
|
nextReviewProposal: "已有方向修订提案。先审查提案;确认后对 AI 说:",
|
|
156
156
|
nextContinuePrompt: "继续推进这个项目。执行前先拆 L1 任务;若 L1 >= 2,自动启用边界内连续执行;只有 Red 风险停下来确认。",
|
|
157
157
|
repairHint: "缺失的 project 推荐文件可通过重新运行 init 安全补齐;已有 ai/project/** 不会被覆盖。",
|
|
158
|
+
sourceCheckoutNotice: `维护者提示: 当前目录看起来是 @wnlen/agent-execution-template 源码仓库。
|
|
159
|
+
源码仓库内调试请使用: node bin/agent-execution-template.js <command>
|
|
160
|
+
用户项目中安装才使用: npx -y @wnlen/agent-execution-template <command>
|
|
161
|
+
不要把维护者本地初始化产生的 ai/project/** 当成产品改动提交。`,
|
|
158
162
|
permissionDenied: "无法写入目标路径",
|
|
159
163
|
permissionHint: `请检查 ai/** 的归属和权限。常见修复:
|
|
160
164
|
sudo chown -R "$(id -un):$(id -gn)" ai
|
|
@@ -260,6 +264,10 @@ Usage:
|
|
|
260
264
|
nextReviewProposal: "A direction amendment proposal exists. Review it first; after confirmation, tell the AI:",
|
|
261
265
|
nextContinuePrompt: "Continue this project. Before execution, decompose L1 tasks; if L1 >= 2, automatically use bounded continuous execution; only Red risk stops for confirmation.",
|
|
262
266
|
repairHint: "Missing recommended project files can be safely added by running init again; existing ai/project/** files are not overwritten.",
|
|
267
|
+
sourceCheckoutNotice: `Maintainer note: this directory looks like the @wnlen/agent-execution-template source checkout.
|
|
268
|
+
In the source repository, test with: node bin/agent-execution-template.js <command>
|
|
269
|
+
In user projects, install with: npx -y @wnlen/agent-execution-template <command>
|
|
270
|
+
Do not commit maintainer-local ai/project/** bootstrap content as product changes.`,
|
|
263
271
|
permissionDenied: "Cannot write target path",
|
|
264
272
|
permissionHint: `Check ownership and permissions under ai/**. Common fix:
|
|
265
273
|
sudo chown -R "$(id -un):$(id -gn)" ai
|
|
@@ -291,6 +299,17 @@ function readPackageVersion() {
|
|
|
291
299
|
}
|
|
292
300
|
}
|
|
293
301
|
|
|
302
|
+
function readTargetPackageName() {
|
|
303
|
+
const packageFile = path.join(process.cwd(), "package.json");
|
|
304
|
+
if (!fs.existsSync(packageFile)) return null;
|
|
305
|
+
try {
|
|
306
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, "utf8"));
|
|
307
|
+
return pkg.name || null;
|
|
308
|
+
} catch {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
294
313
|
function readInstalledLang() {
|
|
295
314
|
const langFile = path.join(TARGET_AI, "template", "LANG");
|
|
296
315
|
if (!fs.existsSync(langFile)) return DEFAULT_LANG;
|
|
@@ -298,6 +317,24 @@ function readInstalledLang() {
|
|
|
298
317
|
return SUPPORTED_LANGS.has(lang) ? lang : DEFAULT_LANG;
|
|
299
318
|
}
|
|
300
319
|
|
|
320
|
+
function isSourceCheckout() {
|
|
321
|
+
return process.cwd() === PACKAGE_ROOT &&
|
|
322
|
+
readTargetPackageName() === "@wnlen/agent-execution-template";
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function commandHint(command) {
|
|
326
|
+
if (isSourceCheckout()) {
|
|
327
|
+
return `node bin/agent-execution-template.js ${command}`;
|
|
328
|
+
}
|
|
329
|
+
return `npx -y @wnlen/agent-execution-template ${command}`;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function printSourceCheckoutNotice(lang) {
|
|
333
|
+
if (isSourceCheckout()) {
|
|
334
|
+
console.log(`${getText(lang).sourceCheckoutNotice}\n`);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
301
338
|
function parseLang(args, fallback = DEFAULT_LANG) {
|
|
302
339
|
let lang = fallback;
|
|
303
340
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -487,12 +524,14 @@ function init({ lang = DEFAULT_LANG, verbose = false, quiet = false } = {}) {
|
|
|
487
524
|
.map((change) => ({ ...change, path: path.join("ai/project", change.path) })));
|
|
488
525
|
|
|
489
526
|
if (!quiet) {
|
|
527
|
+
const sourceNotice = isSourceCheckout() ? `${text.sourceCheckoutNotice}\n\n` : "";
|
|
490
528
|
console.log(`${text.ready}
|
|
491
529
|
|
|
492
530
|
${text.initGuide}
|
|
493
531
|
|
|
532
|
+
${sourceNotice}
|
|
494
533
|
${text.files}: ${summarizeChanges(changes, lang)}
|
|
495
|
-
${text.check}:
|
|
534
|
+
${text.check}: ${commandHint("doctor")}
|
|
496
535
|
`);
|
|
497
536
|
|
|
498
537
|
if (verbose) {
|
|
@@ -546,12 +585,13 @@ function next({ lang = readInstalledLang() } = {}) {
|
|
|
546
585
|
}
|
|
547
586
|
|
|
548
587
|
console.log(`${text.nextTitle}\n`);
|
|
588
|
+
printSourceCheckoutNotice(lang);
|
|
549
589
|
|
|
550
590
|
const templatePath = path.join(TARGET_AI, "template");
|
|
551
591
|
const projectPath = path.join(TARGET_AI, "project");
|
|
552
592
|
if (!fs.existsSync(templatePath) || !fs.existsSync(projectPath)) {
|
|
553
593
|
console.log(`${text.nextRunInit}
|
|
554
|
-
|
|
594
|
+
${commandHint("init")}
|
|
555
595
|
`);
|
|
556
596
|
return;
|
|
557
597
|
}
|
|
@@ -678,6 +718,7 @@ function doctor() {
|
|
|
678
718
|
const lang = readInstalledLang();
|
|
679
719
|
const text = getText(lang);
|
|
680
720
|
console.log(`${text.doctorTitle}\n`);
|
|
721
|
+
printSourceCheckoutNotice(lang);
|
|
681
722
|
console.log(`${text.templateVersion}: ${readVersion(path.join(TARGET_AI, "template")) || text.unknown}`);
|
|
682
723
|
console.log(`${text.templateLang}: ${lang}\n`);
|
|
683
724
|
|
|
@@ -748,7 +789,7 @@ function doctor() {
|
|
|
748
789
|
}
|
|
749
790
|
|
|
750
791
|
if (missing > 0) {
|
|
751
|
-
console.log(`\n[${text.fail}] ${
|
|
792
|
+
console.log(`\n[${text.fail}] ${commandHint("init")}`);
|
|
752
793
|
process.exitCode = 1;
|
|
753
794
|
} else if (warnings > 0) {
|
|
754
795
|
console.log(`\n[${text.pass}] ${text.readyWithWarnings}`);
|
package/docs/SPEC.md
CHANGED
|
@@ -22,7 +22,7 @@ npx 安装协议 -> AI 整理项目上下文 -> 人类确认 -> AI 生成任务
|
|
|
22
22
|
|
|
23
23
|
```text
|
|
24
24
|
Protocol: v0.8
|
|
25
|
-
Package: @wnlen/agent-execution-template@0.8.
|
|
25
|
+
Package: @wnlen/agent-execution-template@0.8.19
|
|
26
26
|
中文安装: npx -y @wnlen/agent-execution-template init
|
|
27
27
|
英文安装: npx -y @wnlen/agent-execution-template init --lang en
|
|
28
28
|
```
|
|
@@ -392,7 +392,7 @@ npx -y @wnlen/agent-execution-template doctor
|
|
|
392
392
|
```text
|
|
393
393
|
Agent Execution Template 检查
|
|
394
394
|
|
|
395
|
-
模板版本: 0.8.
|
|
395
|
+
模板版本: 0.8.19
|
|
396
396
|
模板语言: zh
|
|
397
397
|
|
|
398
398
|
[通过] ai/template/LANG
|
|
@@ -664,7 +664,10 @@ ai/template/execution-policy.md
|
|
|
664
664
|
执行前规划:
|
|
665
665
|
|
|
666
666
|
- AI 根据用户目标、项目上下文和仓库事实推断目标、范围、验收、权限和验证方式;
|
|
667
|
+
- 只有 `ai/project/task.md.readiness = ready_to_execute` 时才进入执行;本轮新建或重写
|
|
668
|
+
`task.md` 时必须停在确认交接;
|
|
667
669
|
- 先列 L1 任务清单,并给每个 L1 标注 Green / Yellow / Red;
|
|
670
|
+
- L1 必须是可独立验收的垂直切片,不是机械步骤清单;
|
|
668
671
|
- L1 少于 2 个时使用 `normal`;
|
|
669
672
|
- L1 为 2 个或更多时自动使用 `bounded_continuous`;
|
|
670
673
|
- 任一 L1 为 Red 时停止等待人类确认;Green 和 Yellow 不阻塞启动。
|
|
@@ -675,16 +678,20 @@ ai/template/execution-policy.md
|
|
|
675
678
|
- 默认最多 3 层,只有当 L3 仍过大、不可验证或不可回退时才动态增加 L4;
|
|
676
679
|
- 每个任务节点必须有风险评级、预期改动范围、验收方式和证据要求;
|
|
677
680
|
- L1 清单必须用待办列表展示,每完成一个 L1 就打勾并划掉;
|
|
678
|
-
-
|
|
681
|
+
- `task_tree` 写回应集中在执行前、L1 开始/完成、Red、blocked、范围变化和最终收尾;
|
|
679
682
|
- 默认按 `vertical_slice` 推进,每轮都要产生可检查增量;
|
|
683
|
+
- Checkpoint 只在风险从 Green 变 Yellow/Red、即将扩大范围或权限、完成 L1 垂直切片、
|
|
684
|
+
验证失败后准备继续或最终收尾时输出;
|
|
680
685
|
- 每个 Checkpoint 必须包含证据:已改文件、已运行命令、验证结果或无法验证原因;
|
|
681
686
|
- Green 可自动继续;
|
|
682
|
-
- Yellow
|
|
687
|
+
- Yellow 只允许当前 L1/L2 内的局部低风险修正,不能改变公共接口、数据模型、权限、
|
|
688
|
+
安全、架构方向或验收标准;
|
|
683
689
|
- Red 必须停止等待人类确认;
|
|
690
|
+
- 用户可见输出默认只展示 L1、风险结论、证据、Red 确认和最终结果,不展示内部协议细节;
|
|
684
691
|
- 目标、范围、验收和权限由 AI 推断,但不能越过项目规则、显式用户限制、
|
|
685
692
|
`permission.modify.denied`、安全边界或破坏性操作限制;
|
|
686
|
-
-
|
|
687
|
-
|
|
693
|
+
- 需要扩大权限、运行未允许命令、访问网络、执行破坏性操作、改变产品方向、核心架构、
|
|
694
|
+
公共 API、持久化数据结构、安全边界、支付、账号或权限时,当前节点必须标为 Red。
|
|
688
695
|
|
|
689
696
|
它不适用于方向未定且无法推断、验收无法定义或高风险架构取舍任务;这些应直接评为 Red。
|
|
690
697
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wnlen/agent-execution-template",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.19",
|
|
4
4
|
"description": "Low-friction AI execution protocol template for coding agents.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-execution-template": "bin/agent-execution-template.js"
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"doctor": "node bin/agent-execution-template.js doctor",
|
|
17
|
-
"
|
|
17
|
+
"check:release": "node test/check-release.js",
|
|
18
|
+
"test": "node test/selftest.js && node test/check-release.js"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|
|
20
21
|
"ai",
|
package/template/en/ai/README.md
CHANGED
|
@@ -114,22 +114,5 @@ From a real project back into the template repo:
|
|
|
114
114
|
- Return only `ai/template/**`.
|
|
115
115
|
- Never return `ai/project/**`.
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
- The human provides intent, hard constraints, and final acceptance.
|
|
120
|
-
- The agent drafts `project/project.md` and relevant `project/refs/*` from existing docs, manifests, refs, and project files.
|
|
121
|
-
- The agent drafts `project/task.md` after the human provides the current task goal.
|
|
122
|
-
- The human reviews and confirms project and task drafts before execution.
|
|
123
|
-
- Bootstrap may write only project context files, plus `project/task.md` when a current task is provided.
|
|
124
|
-
- Bootstrap must not edit source code, tests, configuration, dependency files, generated files, runtime files, result files, or metrics files.
|
|
125
|
-
- Ask at most 3 clarification questions.
|
|
126
|
-
- Ask only when the answer changes scope, risk, permission, or acceptance.
|
|
127
|
-
- Repeated assumptions should become `project/runtime.md` update proposals.
|
|
128
|
-
|
|
129
|
-
## Model Division Protocol
|
|
130
|
-
|
|
131
|
-
- Model policy lives in `project/task.md.model_policy`.
|
|
132
|
-
- Use `cheap` by default for routine execution.
|
|
133
|
-
- Use `standard` for moderate implementation complexity.
|
|
134
|
-
- Use `strong` only for planning, risk judgment, architecture review, failure review, or acceptance judgment.
|
|
135
|
-
- Record actual tier, trigger, role, and escalation reason in `project/metrics.json`.
|
|
117
|
+
Detailed execution rules live in `template/protocol.md`,
|
|
118
|
+
`template/bootstrap.md`, `template/execution-policy.md`, and `template/rules/`.
|
|
@@ -11,6 +11,8 @@ execution_policy:
|
|
|
11
11
|
max_depth: 3
|
|
12
12
|
allow_depth_4_when_needed: true
|
|
13
13
|
progress_unit: "vertical_slice"
|
|
14
|
+
l1_granularity: "independently_acceptable_vertical_slice"
|
|
15
|
+
write_back_policy: "l1_start_done_red_blocked_scope_change_final"
|
|
14
16
|
task_tree:
|
|
15
17
|
- id: "L1-1"
|
|
16
18
|
title: ""
|
|
@@ -86,6 +88,9 @@ permissions, and acceptance from the human goal, project context, and repository
|
|
|
86
88
|
facts. If inference would cross permission or safety boundaries, or acceptance
|
|
87
89
|
cannot be defined, set `readiness` to `blocked` or mark the relevant task node
|
|
88
90
|
`Red` and wait for human confirmation.
|
|
91
|
+
If this run creates or rewrites the task contract, keep
|
|
92
|
+
`readiness = draft_for_confirmation` by default and stop at the handoff. Enter
|
|
93
|
+
execution only when an existing task is explicitly `ready_to_execute`.
|
|
89
94
|
|
|
90
95
|
## Goal
|
|
91
96
|
|
|
@@ -143,26 +148,36 @@ fewer than 2 L1 tasks, use `normal`; if it finds 2 or more L1 tasks, use
|
|
|
143
148
|
before execution.
|
|
144
149
|
- `readiness = blocked` means the task cannot execute and must produce a
|
|
145
150
|
blocked result.
|
|
151
|
+
- If this run creates or rewrites `ai/project/task.md`, stop at the confirmation
|
|
152
|
+
handoff; do not execute while the task is still a draft.
|
|
146
153
|
- Before execution, write the L1 checklist to `execution_policy.task_tree`.
|
|
147
154
|
- Before execution, list the L1 task checklist; mark each L1 complete with a
|
|
148
155
|
checked and struck-through item.
|
|
156
|
+
- Each L1 must be an independently acceptable vertical slice. Do not split a
|
|
157
|
+
single mechanical step into L1 tasks, and do not merge multiple independently
|
|
158
|
+
acceptable user-visible outcomes into one L1.
|
|
149
159
|
- Before executing an L1, plan the naturally derived L2 tasks; if an L2 still
|
|
150
160
|
needs decomposition, plan L3 tasks.
|
|
151
161
|
- Default to at most 3 levels; add L4 dynamically only when leaving it out
|
|
152
162
|
would make L3 too large or unverifiable.
|
|
153
163
|
- The AI assigns Green / Yellow / Red risk to every task node.
|
|
154
164
|
- Only Red stops for human confirmation; Green continues automatically, and
|
|
155
|
-
Yellow
|
|
165
|
+
Yellow only permits local low-risk correction inside the current L1/L2. It
|
|
166
|
+
must not change public interfaces, data models, permissions, security,
|
|
167
|
+
architecture direction, or acceptance.
|
|
156
168
|
- `progress_unit` defaults to `vertical_slice`: each work loop should produce
|
|
157
169
|
a reviewable increment.
|
|
158
170
|
- `checkpoint_budget` is the maximum checkpoint budget, not a required count;
|
|
159
171
|
do not report just to spend the budget.
|
|
160
|
-
- Emit
|
|
161
|
-
|
|
172
|
+
- Emit checkpoints only when risk changes from Green to Yellow/Red, scope or
|
|
173
|
+
permission is about to expand, an L1 vertical slice is complete, verification
|
|
174
|
+
failed but execution is about to continue, or final wrap-up is about to start.
|
|
162
175
|
- Every checkpoint must include evidence: changed files, commands run,
|
|
163
176
|
verification results, or why verification was not possible.
|
|
164
|
-
-
|
|
165
|
-
|
|
177
|
+
- `task_tree` write-back frequency: write the L1 checklist before execution;
|
|
178
|
+
update an L1 when it starts or completes; write back immediately on Red,
|
|
179
|
+
blocked, scope change, or final wrap-up; do not write back every tiny L3
|
|
180
|
+
operation.
|
|
166
181
|
- After completion, run one final review; only re-check Yellow, Red, failed
|
|
167
182
|
verification, or high-impact modules.
|
|
168
183
|
- Continuous execution does not change model policy; escalate through
|
|
@@ -192,7 +207,8 @@ Stop and write `ai/project/result.json`, `ai/project/result.md`, and `ai/project
|
|
|
192
207
|
- Required command cannot be run.
|
|
193
208
|
- Risk level is high without explicit authorization.
|
|
194
209
|
- A Red checkpoint appears during continuous execution.
|
|
195
|
-
- The task would change product direction, core architecture,
|
|
196
|
-
security boundaries, payment, accounts, or
|
|
197
|
-
|
|
198
|
-
|
|
210
|
+
- The task would change product direction, core architecture, public API,
|
|
211
|
+
persistent data structures, security boundaries, payment, accounts, or
|
|
212
|
+
permissions.
|
|
213
|
+
- The task would delete files beyond the current L1's directly related files,
|
|
214
|
+
rewrite a core module, or require choosing between multiple high-cost options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.
|
|
1
|
+
0.8.19
|
|
@@ -13,7 +13,13 @@ Pre-execution planning must:
|
|
|
13
13
|
|
|
14
14
|
- Infer goal, scope, acceptance, permissions, and verification method from the
|
|
15
15
|
human goal, project context, and repository facts.
|
|
16
|
+
- Enter execution only when `ai/project/task.md` already exists and
|
|
17
|
+
`readiness = ready_to_execute`. If this run creates or rewrites the task
|
|
18
|
+
contract, stop at the confirmation handoff instead of executing from a draft.
|
|
16
19
|
- List the L1 task checklist and assign Green / Yellow / Red risk to each L1.
|
|
20
|
+
- Each L1 must be an independently acceptable vertical slice. Do not split a
|
|
21
|
+
single mechanical step into L1 tasks, and do not merge multiple independently
|
|
22
|
+
acceptable user-visible outcomes into one L1.
|
|
17
23
|
- Use `normal` if there are fewer than 2 L1 tasks.
|
|
18
24
|
- Automatically use `bounded_continuous` if there are 2 or more L1 tasks.
|
|
19
25
|
- Stop for human confirmation first if any L1 is Red; Green and Yellow do not
|
|
@@ -24,6 +30,10 @@ Pre-execution planning must:
|
|
|
24
30
|
|
|
25
31
|
Execute the task tree in L1 -> L2 -> L3 order.
|
|
26
32
|
|
|
33
|
+
- L1 is a work increment that can be verified, rolled back, and explained to the
|
|
34
|
+
user after completion.
|
|
35
|
+
- L2 is an implementation substep needed to finish that L1.
|
|
36
|
+
- L3 is a local operation step used when an L2 is still too large.
|
|
27
37
|
- Before executing an L1, plan its naturally derived L2 tasks.
|
|
28
38
|
- Before executing an L2, plan L3 tasks if it still needs decomposition.
|
|
29
39
|
- Default to at most 3 levels. Add L4 dynamically only when L3 would otherwise
|
|
@@ -32,8 +42,11 @@ Execute the task tree in L1 -> L2 -> L3 order.
|
|
|
32
42
|
and evidence requirements.
|
|
33
43
|
- Show the L1 checklist as task items; when an L1 is complete, check it off and
|
|
34
44
|
strike it through.
|
|
35
|
-
-
|
|
36
|
-
|
|
45
|
+
- Task tree write-back rule: write the L1 checklist before execution; update an
|
|
46
|
+
L1 when it starts or completes; write back immediately on Red, blocked, scope
|
|
47
|
+
change, or final wrap-up. Do not write back every tiny L3 operation.
|
|
48
|
+
- During execution, use `pending`, `running`, `done`, or `blocked` for node
|
|
49
|
+
status.
|
|
37
50
|
|
|
38
51
|
Recommended node shape:
|
|
39
52
|
|
|
@@ -65,16 +78,19 @@ Yellow:
|
|
|
65
78
|
- Still inside current task scope;
|
|
66
79
|
- local uncertainty or local verification failure exists;
|
|
67
80
|
- a low-risk local correction can continue the work;
|
|
68
|
-
-
|
|
81
|
+
- the correction affects only the current L1/L2 local implementation and does
|
|
82
|
+
not change public interfaces, data models, permissions, security,
|
|
83
|
+
architecture direction, or acceptance;
|
|
84
|
+
- no permission, scope, command, network, or acceptance expansion is needed.
|
|
69
85
|
|
|
70
86
|
Red:
|
|
71
87
|
|
|
72
88
|
- Permission expansion, unallowed command, network access, or destructive action
|
|
73
89
|
is needed;
|
|
74
|
-
- product direction, core architecture,
|
|
75
|
-
payment, account, or permission would change;
|
|
76
|
-
-
|
|
77
|
-
high-cost options require judgment;
|
|
90
|
+
- product direction, core architecture, public APIs, persistent data structures,
|
|
91
|
+
security boundary, payment, account, or permission would change;
|
|
92
|
+
- files beyond the current L1's directly related files must be deleted, a core
|
|
93
|
+
module must be rewritten, or multiple high-cost options require judgment;
|
|
78
94
|
- acceptance cannot be defined, or task goal materially conflicts with project direction.
|
|
79
95
|
|
|
80
96
|
Only Red stops for human confirmation. Green continues automatically. Yellow
|
|
@@ -82,9 +98,10 @@ continues after local low-risk correction.
|
|
|
82
98
|
|
|
83
99
|
## Checkpoint
|
|
84
100
|
|
|
85
|
-
Emit checkpoints only when risk
|
|
86
|
-
|
|
87
|
-
|
|
101
|
+
Emit checkpoints only when risk changes from Green to Yellow/Red, scope or
|
|
102
|
+
permission is about to expand, an L1 vertical slice is complete, verification
|
|
103
|
+
failed but execution is about to continue, or final review is about to start.
|
|
104
|
+
Do not report just to spend checkpoint budget.
|
|
88
105
|
|
|
89
106
|
Every checkpoint must include:
|
|
90
107
|
|
|
@@ -102,6 +119,17 @@ Every checkpoint must include:
|
|
|
102
119
|
Evidence must include changed files, commands run, verification results, or why
|
|
103
120
|
verification was not possible. A purely subjective Green is not valid.
|
|
104
121
|
|
|
122
|
+
## User-Visible Output
|
|
123
|
+
|
|
124
|
+
- Show the L1 checklist by default; do not show full L2/L3/L4 by default.
|
|
125
|
+
- Show risk conclusions and necessary reasons; do not output long internal reasoning.
|
|
126
|
+
- Show evidence; do not show internal protocol fields, full YAML,
|
|
127
|
+
`checkpoint_budget`, or `model_policy`.
|
|
128
|
+
- Say little for Green, be brief for Yellow, and stop with clear reasons and
|
|
129
|
+
options for Red.
|
|
130
|
+
- Final output must include status, completed items, verification results, and
|
|
131
|
+
result files.
|
|
132
|
+
|
|
105
133
|
## Model Policy
|
|
106
134
|
|
|
107
135
|
Continuous execution does not change `model_policy`. Still escalate through
|
|
@@ -69,12 +69,12 @@ In Task Draft Mode:
|
|
|
69
69
|
and write it to `execution_policy.task_tree`. Use `normal` if there are
|
|
70
70
|
fewer than 2 L1 tasks; automatically use `bounded_continuous` if there are 2
|
|
71
71
|
or more L1 tasks.
|
|
72
|
-
5. If
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
6.
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
5. If this run creates or rewrites `ai/project/task.md`, set `readiness` to
|
|
73
|
+
`draft_for_confirmation` and stop at the handoff; do not execute while the
|
|
74
|
+
task is still a draft.
|
|
75
|
+
6. Enter Execution Mode only when an existing task is explicitly
|
|
76
|
+
`ready_to_execute` and no Red preflight item exists; if it cannot execute,
|
|
77
|
+
set it to `blocked`.
|
|
78
78
|
7. Do not modify source or business files in Task Draft Mode.
|
|
79
79
|
|
|
80
80
|
End Task Draft Mode with:
|
|
@@ -129,12 +129,17 @@ In Execution Mode, read:
|
|
|
129
129
|
Then follow `ai/template/execution-policy.md` for pre-execution planning: list
|
|
130
130
|
the L1 checklist, mark each L1 Green / Yellow / Red, and write it to
|
|
131
131
|
`execution_policy.task_tree`. Automatically choose `normal` or
|
|
132
|
-
`bounded_continuous` from the L1 count.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
`bounded_continuous` from the L1 count. Execute only when
|
|
133
|
+
`readiness = ready_to_execute`; if this run creates or rewrites the task
|
|
134
|
+
contract, stop at the confirmation handoff. Each L1 must be an independently
|
|
135
|
+
acceptable vertical slice. Plan L2 before executing an L1, and plan L3 as needed
|
|
136
|
+
before executing an L2; default to at most 3 levels, with L4 allowed when
|
|
137
|
+
needed. When an L1 is complete, check it off and strike it through; write back
|
|
138
|
+
`task_tree` when an L1 starts or completes, on Red/blocked, on scope change, or
|
|
139
|
+
at final wrap-up. Only Red stops for human confirmation; Green continues
|
|
140
|
+
automatically, and Yellow only permits local low-risk correction inside the
|
|
141
|
+
current L1/L2. User-visible output follows the "User-Visible Output" rules in
|
|
142
|
+
`ai/template/execution-policy.md`. Write results to:
|
|
138
143
|
|
|
139
144
|
- `ai/project/result.json`
|
|
140
145
|
- `ai/project/result.md`
|
|
@@ -54,11 +54,15 @@ Before task execution, read `ai/template/execution-policy.md`.
|
|
|
54
54
|
The default execution policy is `auto`: the AI first decomposes L1 tasks and
|
|
55
55
|
judges Green / Yellow / Red risk, then chooses `normal` or `bounded_continuous`.
|
|
56
56
|
Use `normal` when there are fewer than 2 L1 tasks; automatically use
|
|
57
|
-
`bounded_continuous` when there are 2 or more L1 tasks.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
`bounded_continuous` when there are 2 or more L1 tasks. Each L1 must be an
|
|
58
|
+
independently acceptable vertical slice. Execution is allowed only for an
|
|
59
|
+
existing task with `readiness = ready_to_execute`; if this run creates or
|
|
60
|
+
rewrites the task contract, stop at the confirmation handoff. Only Red stops for
|
|
61
|
+
human confirmation, and Yellow only permits local low-risk correction inside the
|
|
62
|
+
current L1/L2.
|
|
63
|
+
|
|
64
|
+
Task tree, risk rubric, checkpoint evidence, and `task_tree` write-back rules
|
|
65
|
+
are defined in `ai/template/execution-policy.md`.
|
|
62
66
|
|
|
63
67
|
## Bootstrap Mode
|
|
64
68
|
|
|
@@ -125,15 +125,24 @@ explicitly say "enable continuous execution".
|
|
|
125
125
|
|
|
126
126
|
Hard gates:
|
|
127
127
|
|
|
128
|
+
- Execute only when `ai/project/task.md.readiness = ready_to_execute`; if this
|
|
129
|
+
run creates or rewrites `task.md`, stop at the confirmation handoff.
|
|
130
|
+
- L1 must be an independently acceptable vertical slice, not a mechanical step
|
|
131
|
+
checklist.
|
|
128
132
|
- `execution_policy.task_tree` must record the L1 checklist and execution state.
|
|
129
133
|
- Every task node must have Green / Yellow / Red risk.
|
|
134
|
+
- Yellow only permits local low-risk correction inside the current L1/L2. It
|
|
135
|
+
must not change public interfaces, data models, permissions, security,
|
|
136
|
+
architecture direction, or acceptance.
|
|
130
137
|
- Every checkpoint must include evidence; a purely subjective Green is not valid.
|
|
131
138
|
- Red must stop for human confirmation.
|
|
132
|
-
- Any product direction, core architecture,
|
|
133
|
-
account, permission, large deletion, core
|
|
134
|
-
must stop.
|
|
139
|
+
- Any product direction, core architecture, public API, persistent data
|
|
140
|
+
structure, security, payment, account, permission, large deletion, core
|
|
141
|
+
rewrite, or high-cost option choice must stop.
|
|
135
142
|
- Any need to expand scope, permission, commands, network access, or acceptance
|
|
136
143
|
must stop.
|
|
144
|
+
- `task_tree` write-back should happen at L1 start/done, Red, blocked, scope
|
|
145
|
+
change, and final wrap-up; do not write back every tiny L3 operation.
|
|
137
146
|
|
|
138
147
|
The AI infers goal, scope, acceptance, and permissions, but must not cross
|
|
139
148
|
project rules, explicit human limits, `permission.modify.denied`, security
|
package/template/zh/ai/README.md
CHANGED
|
@@ -112,22 +112,5 @@ ai/project/inbox/ideas/
|
|
|
112
112
|
- 只回流 `ai/template/**`。
|
|
113
113
|
- 永远不要回流 `ai/project/**`。
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
- 人类提供意图、硬约束和最终验收。
|
|
118
|
-
- Agent 从现有文档、清单、引用和项目文件中起草 `project/project.md` 和相关 `project/refs/*`。
|
|
119
|
-
- 人类提供当前任务目标后,Agent 起草 `project/task.md`。
|
|
120
|
-
- 人类在执行前检查并确认项目和任务草稿。
|
|
121
|
-
- 引导只能写项目上下文文件;当提供当前任务时,也可以写 `project/task.md`。
|
|
122
|
-
- 引导不得编辑源码、测试、配置、依赖文件、生成文件、运行时文件、结果文件或指标文件。
|
|
123
|
-
- 最多问 3 个澄清问题。
|
|
124
|
-
- 只在答案会改变范围、风险、权限或验收时提问。
|
|
125
|
-
- 重复出现的假设应变成 `project/runtime.md` 更新建议。
|
|
126
|
-
|
|
127
|
-
## 模型分工协议
|
|
128
|
-
|
|
129
|
-
- 模型策略位于 `project/task.md.model_policy`。
|
|
130
|
-
- 常规执行默认使用 `cheap`。
|
|
131
|
-
- 中等实现复杂度使用 `standard`。
|
|
132
|
-
- 只有规划、风险判断、架构复核、失败复盘或验收判断才使用 `strong`。
|
|
133
|
-
- 在 `project/metrics.json` 中记录实际档位、触发条件、角色和升级原因。
|
|
115
|
+
详细执行规则见 `template/protocol.md`、`template/bootstrap.md`、
|
|
116
|
+
`template/execution-policy.md` 和 `template/rules/`。
|
|
@@ -11,6 +11,8 @@ execution_policy:
|
|
|
11
11
|
max_depth: 3
|
|
12
12
|
allow_depth_4_when_needed: true
|
|
13
13
|
progress_unit: "vertical_slice"
|
|
14
|
+
l1_granularity: "independently_acceptable_vertical_slice"
|
|
15
|
+
write_back_policy: "l1_start_done_red_blocked_scope_change_final"
|
|
14
16
|
task_tree:
|
|
15
17
|
- id: "L1-1"
|
|
16
18
|
title: ""
|
|
@@ -83,6 +85,8 @@ permission:
|
|
|
83
85
|
优先使用安全假设,少问额外问题。AI 应基于用户目标、项目上下文和仓库事实推断
|
|
84
86
|
范围、风险、权限和验收;如果推断会越过权限、安全边界或验收无法定义,将
|
|
85
87
|
`readiness` 标为 `blocked` 或将相关任务节点标为 `Red`,等待人类确认。
|
|
88
|
+
如果本轮新建或重写了任务契约,默认保持 `draft_for_confirmation` 并停下来交接;
|
|
89
|
+
只有已有任务明确处于 `ready_to_execute` 时,才进入执行。
|
|
86
90
|
|
|
87
91
|
## 目标
|
|
88
92
|
|
|
@@ -132,17 +136,23 @@ permission:
|
|
|
132
136
|
- `readiness = ready_to_execute` 表示没有 Red 预检项,可以执行。
|
|
133
137
|
- `readiness = draft_for_confirmation` 表示需要人类确认后才能执行。
|
|
134
138
|
- `readiness = blocked` 表示当前任务不可执行,必须写 blocked 结果。
|
|
139
|
+
- 本轮如果新建或重写 `ai/project/task.md`,必须停在确认交接;不能在任务仍是草稿时执行。
|
|
135
140
|
- 执行前必须把 L1 任务清单写入 `execution_policy.task_tree`。
|
|
136
141
|
- 执行前必须列出 L1 任务清单;每个 L1 用待办列表表示,完成后打勾并划掉。
|
|
142
|
+
- L1 必须是可独立验收的垂直切片;不要把单个机械步骤拆成 L1,也不要把多个
|
|
143
|
+
可独立验收的用户可见结果合并成一个 L1。
|
|
137
144
|
- 执行某个 L1 前,AI 先规划自然衍生出的 L2;如果 L2 仍需拆分,再规划 L3。
|
|
138
145
|
- 默认最多 3 层;只有当不拆 L4 会导致 L3 过大或不可验证时,才允许动态增加 L4。
|
|
139
146
|
- 每个任务节点都由 AI 自己生成 Green / Yellow / Red 风险评级。
|
|
140
|
-
- 只有 Red 停下来让人类确认;Green 自动继续,Yellow
|
|
147
|
+
- 只有 Red 停下来让人类确认;Green 自动继续,Yellow 只允许当前 L1/L2 内的局部
|
|
148
|
+
低风险修正,不能改变公共接口、数据模型、权限、安全、架构方向或验收标准。
|
|
141
149
|
- `progress_unit` 默认是 `vertical_slice`:每轮推进都应该产生可检查的工作增量。
|
|
142
150
|
- `checkpoint_budget` 是最多可用检查点预算,不是必须用完的次数;不要为了消耗预算而汇报。
|
|
143
|
-
-
|
|
151
|
+
- 只有在风险从 Green 变 Yellow/Red、即将扩大范围或权限、完成 L1 垂直切片、
|
|
152
|
+
验证失败后准备继续、准备最终收尾时才输出 Checkpoint。
|
|
144
153
|
- 每个 Checkpoint 必须包含证据:已改文件、已运行命令、验证结果或无法验证的原因。
|
|
145
|
-
-
|
|
154
|
+
- `task_tree` 写回频率:执行前写入 L1 清单;开始或完成 L1 时更新该 L1 状态;
|
|
155
|
+
出现 Red、blocked、范围变化或最终收尾时立即写回;不要为每个微小 L3 操作写回。
|
|
146
156
|
- 完成后只做一次总复盘;只对 Yellow、Red、失败验证或高影响模块做二次抽检。
|
|
147
157
|
- 连续执行不改变模型策略;涉及判断、架构、失败复盘或验收争议时仍按 `model_policy` 升级。
|
|
148
158
|
|
|
@@ -170,5 +180,5 @@ permission:
|
|
|
170
180
|
- 必需命令无法运行。
|
|
171
181
|
- 风险等级高但没有明确授权。
|
|
172
182
|
- 连续执行中出现 Red 检查点。
|
|
173
|
-
-
|
|
174
|
-
-
|
|
183
|
+
- 需要改变产品方向、核心架构、公共 API、持久化数据结构、安全边界、支付、账号或权限。
|
|
184
|
+
- 需要删除超过当前 L1 直接相关的文件、重写核心模块,或在多个高成本方案之间取舍。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.8.
|
|
1
|
+
0.8.19
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
执行前规划必须:
|
|
12
12
|
|
|
13
13
|
- 根据用户目标、项目上下文和仓库事实,推断目标、范围、验收、权限和验证方式。
|
|
14
|
+
- 只有 `ai/project/task.md` 已存在且 `readiness = ready_to_execute` 时才进入执行。
|
|
15
|
+
如果本轮新建或重写任务契约,必须先停在确认交接,不能边写草稿边执行。
|
|
14
16
|
- 列出 L1 任务清单,并为每个 L1 生成 Green / Yellow / Red 风险评级。
|
|
17
|
+
- L1 必须是可独立验收的垂直切片;不要把单个机械步骤拆成 L1,也不要把多个
|
|
18
|
+
可独立验收的用户可见结果合并成一个 L1。
|
|
15
19
|
- 如果 L1 少于 2 个,使用 `normal`。
|
|
16
20
|
- 如果 L1 为 2 个或更多,自动启用 `bounded_continuous`。
|
|
17
21
|
- 如果任一 L1 为 Red,先停止并让人类确认;Green 和 Yellow 不阻塞启动。
|
|
@@ -21,12 +25,17 @@
|
|
|
21
25
|
|
|
22
26
|
任务树按 L1 -> L2 -> L3 执行。
|
|
23
27
|
|
|
28
|
+
- L1 表示一个完成后可验证、可回退、可向用户解释的工作增量。
|
|
29
|
+
- L2 表示完成该 L1 所需的实现子步骤。
|
|
30
|
+
- L3 表示 L2 仍过大时的局部操作步骤。
|
|
24
31
|
- 执行某个 L1 前,先规划它自然衍生出的 L2。
|
|
25
32
|
- 执行某个 L2 前,如果仍需拆分,再规划 L3。
|
|
26
33
|
- 默认最多 3 层。只有当 L3 仍过大、不可验证或不可回退时,才动态增加 L4。
|
|
27
34
|
- L1/L2/L3/L4 都必须有风险评级、预期改动范围、验收方式和证据要求。
|
|
28
35
|
- L1 清单必须用待办列表展示;每完成一个 L1,就打勾并划掉。
|
|
29
|
-
-
|
|
36
|
+
- 任务树写回规则:执行前写入 L1 清单;开始或完成 L1 时更新该 L1 状态;
|
|
37
|
+
出现 Red、blocked、范围变化或最终收尾时立即写回。不要为每个微小 L3 操作写回。
|
|
38
|
+
- 执行中使用 `pending`、`running`、`done` 或 `blocked` 表示节点状态。
|
|
30
39
|
|
|
31
40
|
推荐节点结构:
|
|
32
41
|
|
|
@@ -57,20 +66,24 @@ Yellow:
|
|
|
57
66
|
- 仍在当前任务范围内;
|
|
58
67
|
- 存在局部不确定或局部验证失败;
|
|
59
68
|
- 可以用低风险修正继续;
|
|
60
|
-
-
|
|
69
|
+
- 修正只影响当前 L1/L2 的局部实现,不改变公共接口、数据模型、权限、安全、
|
|
70
|
+
架构方向或验收标准;
|
|
71
|
+
- 不需要扩大权限、范围、命令、网络或验收。
|
|
61
72
|
|
|
62
73
|
Red:
|
|
63
74
|
|
|
64
75
|
- 需要扩大权限、运行未允许命令、访问网络或执行破坏性操作;
|
|
65
|
-
-
|
|
66
|
-
|
|
76
|
+
- 需要改变产品方向、核心架构、公共 API、持久化数据结构、安全边界、支付、
|
|
77
|
+
账号或权限;
|
|
78
|
+
- 需要删除超过当前 L1 直接相关的文件、重写核心模块或在多个高成本方案之间取舍;
|
|
67
79
|
- 验收不可定义,或任务目标和项目方向发生实质冲突。
|
|
68
80
|
|
|
69
81
|
只有 Red 停止等待人类确认。Green 自动继续。Yellow 做局部低风险修正后继续。
|
|
70
82
|
|
|
71
83
|
## Checkpoint
|
|
72
84
|
|
|
73
|
-
Checkpoint
|
|
85
|
+
Checkpoint 只在以下情况输出:风险从 Green 变 Yellow/Red、即将扩大范围或权限、
|
|
86
|
+
完成一个 L1 垂直切片、验证失败后准备继续、准备最终收尾。
|
|
74
87
|
不要为了消耗预算而汇报。
|
|
75
88
|
|
|
76
89
|
每个 Checkpoint 必须包含:
|
|
@@ -89,6 +102,14 @@ Checkpoint 只在风险升高、边界即将变化、完成垂直切片或准备
|
|
|
89
102
|
证据必须包含已改文件、已运行命令、验证结果,或无法验证的原因。
|
|
90
103
|
不接受只有主观判断的 Green。
|
|
91
104
|
|
|
105
|
+
## 用户可见输出
|
|
106
|
+
|
|
107
|
+
- 默认展示 L1 清单;不要默认展示完整 L2/L3/L4。
|
|
108
|
+
- 展示风险结论和必要原因;不要输出长篇内部推理。
|
|
109
|
+
- 展示证据;不要展示内部协议字段、完整 YAML、`checkpoint_budget` 或 `model_policy`。
|
|
110
|
+
- Green 少说,Yellow 简说,Red 停下并说明原因和选项。
|
|
111
|
+
- 最终必须给状态、完成项、验证结果和结果文件。
|
|
112
|
+
|
|
92
113
|
## 模型策略
|
|
93
114
|
|
|
94
115
|
连续执行不改变 `model_policy`。遇到规划、架构、失败复盘或验收争议,
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
4. 执行前列出 L1 任务清单并标注 Green / Yellow / Red,同时写入
|
|
56
56
|
`execution_policy.task_tree`。L1 少于 2 个时使用 `normal`;L1 为 2 个或更多时
|
|
57
57
|
自动使用 `bounded_continuous`。
|
|
58
|
-
5.
|
|
59
|
-
|
|
60
|
-
6.
|
|
61
|
-
|
|
58
|
+
5. 本轮如果新建或重写了 `ai/project/task.md`,将 `readiness` 设为
|
|
59
|
+
`draft_for_confirmation` 并停止交接;不要在任务仍是草稿时直接执行。
|
|
60
|
+
6. 只有已有任务明确处于 `ready_to_execute`,且没有 Red 预检项时,才能进入执行模式;
|
|
61
|
+
如果不可执行,设为 `blocked`。
|
|
62
62
|
7. 不要在任务草稿模式中修改源码或业务文件。
|
|
63
63
|
|
|
64
64
|
任务草稿模式必须以下面结构结束:
|
|
@@ -110,10 +110,13 @@
|
|
|
110
110
|
|
|
111
111
|
然后按 `ai/template/execution-policy.md` 做执行前规划:列出 L1 清单,给每个 L1
|
|
112
112
|
标注 Green / Yellow / Red,并写入 `execution_policy.task_tree`。根据 L1 数量自动选择
|
|
113
|
-
`normal` 或 `bounded_continuous
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
`normal` 或 `bounded_continuous`。只有 `readiness = ready_to_execute` 才能执行;
|
|
114
|
+
如果本轮新建或重写任务契约,先停在确认交接。L1 必须是可独立验收的垂直切片。
|
|
115
|
+
执行 L1 前规划 L2,执行 L2 前按需规划 L3;默认最多 3 层,必要时允许 L4。
|
|
116
|
+
每完成一个 L1,在清单中打勾并划掉;开始或完成 L1、出现 Red/blocked、范围变化
|
|
117
|
+
或最终收尾时写回 `task_tree`。只有 Red 停止等待人类确认;Green 自动继续,Yellow
|
|
118
|
+
只做当前 L1/L2 内的局部低风险修正。用户可见输出遵守
|
|
119
|
+
`ai/template/execution-policy.md` 的“用户可见输出”规则。最后把结果写入:
|
|
117
120
|
|
|
118
121
|
- `ai/project/result.json`
|
|
119
122
|
- `ai/project/result.md`
|
|
@@ -47,9 +47,12 @@ ai/project/task.md = 当前执行契约
|
|
|
47
47
|
|
|
48
48
|
执行策略默认是 `auto`:AI 先拆 L1 任务并判断 Green / Yellow / Red,再决定使用
|
|
49
49
|
`normal` 或 `bounded_continuous`。L1 少于 2 个使用 `normal`;L1 为 2 个或更多
|
|
50
|
-
自动启用 `bounded_continuous
|
|
50
|
+
自动启用 `bounded_continuous`。L1 必须是可独立验收的垂直切片。只有
|
|
51
|
+
`readiness = ready_to_execute` 的既有任务才能执行;本轮新建或重写任务契约时先
|
|
52
|
+
停在确认交接。只有 Red 停止等待人类确认,Yellow 只允许当前 L1/L2 内的局部
|
|
53
|
+
低风险修正。
|
|
51
54
|
|
|
52
|
-
任务树、风险分级、Checkpoint 证据和 `task_tree`
|
|
55
|
+
任务树、风险分级、Checkpoint 证据和 `task_tree` 写回规则由
|
|
53
56
|
`ai/template/execution-policy.md` 定义。
|
|
54
57
|
|
|
55
58
|
## 引导模式
|
|
@@ -108,13 +108,20 @@
|
|
|
108
108
|
|
|
109
109
|
硬门禁:
|
|
110
110
|
|
|
111
|
+
- 只有 `ai/project/task.md.readiness = ready_to_execute` 才能执行;本轮新建或重写
|
|
112
|
+
`task.md` 时必须停在确认交接。
|
|
113
|
+
- L1 必须是可独立验收的垂直切片,不是机械步骤清单。
|
|
111
114
|
- `execution_policy.task_tree` 必须记录 L1 清单和执行状态。
|
|
112
115
|
- 每个任务节点必须有 Green / Yellow / Red 风险评级。
|
|
116
|
+
- Yellow 只允许当前 L1/L2 内的局部低风险修正,不能改变公共接口、数据模型、
|
|
117
|
+
权限、安全、架构方向或验收标准。
|
|
113
118
|
- 每个 Checkpoint 必须包含证据;不接受只有主观判断的 Green。
|
|
114
119
|
- Red 必须停止等待人类确认。
|
|
115
|
-
-
|
|
120
|
+
- 任何方向、核心架构、公共 API、持久化数据结构、安全、支付、账号、权限、大量删除、
|
|
116
121
|
核心重写或高成本方案取舍,都必须停止。
|
|
117
122
|
- 需要扩大范围、权限、命令、网络或验收时,必须停止。
|
|
123
|
+
- `task_tree` 写回应集中在 L1 开始/完成、Red、blocked、范围变化和最终收尾,
|
|
124
|
+
不要为每个微小 L3 操作写回。
|
|
118
125
|
|
|
119
126
|
目标、范围、验收和权限由 AI 推断,但不能越过项目规则、显式用户限制、
|
|
120
127
|
`permission.modify.denied`、安全边界或破坏性操作限制。
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const repoRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const packagePath = path.join(repoRoot, "package.json");
|
|
8
|
+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
|
|
9
|
+
|
|
10
|
+
function fail(message) {
|
|
11
|
+
throw new Error(message);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function read(relativePath) {
|
|
15
|
+
return fs.readFileSync(path.join(repoRoot, relativePath), "utf8");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function listFiles(relativeDir) {
|
|
19
|
+
const root = path.join(repoRoot, relativeDir);
|
|
20
|
+
const files = [];
|
|
21
|
+
|
|
22
|
+
function walk(dir) {
|
|
23
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
24
|
+
const fullPath = path.join(dir, entry.name);
|
|
25
|
+
if (entry.isDirectory()) {
|
|
26
|
+
walk(fullPath);
|
|
27
|
+
} else if (entry.isFile()) {
|
|
28
|
+
files.push(path.relative(root, fullPath).split(path.sep).join("/"));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
walk(root);
|
|
34
|
+
return files.sort();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function assertEqual(actual, expected, message) {
|
|
38
|
+
if (actual !== expected) {
|
|
39
|
+
fail(`${message}\nExpected: ${expected}\nActual: ${actual}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function assertIncludes(content, expected, message) {
|
|
44
|
+
if (!content.includes(expected)) {
|
|
45
|
+
fail(`${message}\nMissing: ${expected}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function assertFileListsMatch(leftDir, rightDir, message) {
|
|
50
|
+
const left = listFiles(leftDir).join("\n");
|
|
51
|
+
const right = listFiles(rightDir).join("\n");
|
|
52
|
+
assertEqual(left, right, message);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function assertTreesMatch(leftDir, rightDir, message) {
|
|
56
|
+
const leftFiles = listFiles(leftDir);
|
|
57
|
+
const rightFiles = listFiles(rightDir);
|
|
58
|
+
assertEqual(leftFiles.join("\n"), rightFiles.join("\n"), `${message}: file list differs`);
|
|
59
|
+
|
|
60
|
+
for (const file of leftFiles) {
|
|
61
|
+
const left = read(path.join(leftDir, file));
|
|
62
|
+
const right = read(path.join(rightDir, file));
|
|
63
|
+
assertEqual(left, right, `${message}: ${file} differs`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function main() {
|
|
68
|
+
const version = packageJson.version;
|
|
69
|
+
assertEqual(packageJson.name, "@wnlen/agent-execution-template", "package name changed unexpectedly");
|
|
70
|
+
assertEqual(
|
|
71
|
+
packageJson.bin && packageJson.bin["agent-execution-template"],
|
|
72
|
+
"bin/agent-execution-template.js",
|
|
73
|
+
"package bin entry should point to the CLI"
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
assertEqual(read("template/zh/ai/template/VERSION").trim(), version, "zh template version must match package version");
|
|
77
|
+
assertEqual(read("template/en/ai/template/VERSION").trim(), version, "en template version must match package version");
|
|
78
|
+
assertEqual(read("ai/template/VERSION").trim(), version, "installed zh template version must match package version");
|
|
79
|
+
|
|
80
|
+
assertFileListsMatch("template/zh/ai", "template/en/ai", "zh and en templates must expose the same file layout");
|
|
81
|
+
assertTreesMatch("template/zh/ai/template", "ai/template", "installed ai/template must mirror template/zh/ai/template");
|
|
82
|
+
assertEqual(read("template/zh/ai/README.md"), read("ai/README.md"), "installed ai/README.md must mirror template/zh/ai/README.md");
|
|
83
|
+
|
|
84
|
+
const spec = read("docs/SPEC.md");
|
|
85
|
+
assertIncludes(spec, `Package: @wnlen/agent-execution-template@${version}`, "SPEC package version must match package.json");
|
|
86
|
+
|
|
87
|
+
const scripts = packageJson.scripts || {};
|
|
88
|
+
assertIncludes(scripts.test || "", "test/selftest.js", "npm test should run the CLI selftest");
|
|
89
|
+
assertIncludes(scripts.test || "", "test/check-release.js", "npm test should run release consistency checks");
|
|
90
|
+
|
|
91
|
+
console.log("release check ok");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main();
|
package/test/selftest.js
CHANGED
|
@@ -84,13 +84,24 @@ function testInitUpdateDoctor() {
|
|
|
84
84
|
assert(read(cwd, "ai/template/prompt.md").includes("默认也只处理 `ai/project/inbox/*.md`"), "execution prompt should narrow inbox reconciliation");
|
|
85
85
|
assert(read(cwd, "ai/template/protocol.md").includes("`bounded_continuous`"), "protocol should include bounded continuous execution");
|
|
86
86
|
assert(read(cwd, "ai/template/execution-policy.md").includes("垂直切片"), "protocol should require vertical-slice progress for continuous execution");
|
|
87
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("可独立验收的垂直切片"), "execution policy should define L1 granularity");
|
|
88
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("不能边写草稿边执行"), "execution policy should block execution from draft tasks");
|
|
89
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("不要为每个微小 L3 操作写回"), "execution policy should limit task tree write-back churn");
|
|
90
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("公共接口、数据模型、权限、安全"), "execution policy should constrain Yellow corrections");
|
|
91
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("用户可见输出"), "execution policy should define user-visible output rules");
|
|
92
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("不要默认展示完整 L2/L3/L4"), "execution policy should avoid exposing full subtask trees by default");
|
|
93
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("不要展示内部协议字段"), "execution policy should hide internal protocol details by default");
|
|
87
94
|
assert(read(cwd, "ai/template/execution-policy.md").includes("L1 为 2 个或更多,自动启用"), "protocol should auto-enable continuous execution from L1 count");
|
|
88
95
|
assert(read(cwd, "ai/template/execution-policy.md").includes("每个 Checkpoint 必须包含"), "protocol should require evidence-backed checkpoints");
|
|
89
96
|
assert(read(cwd, "ai/template/rules/core.md").includes("边界内连续执行门"), "core rules should include bounded continuous execution gate");
|
|
97
|
+
assert(read(cwd, "ai/template/rules/core.md").includes("readiness = ready_to_execute"), "core rules should require ready task before execution");
|
|
98
|
+
assert(read(cwd, "ai/template/rules/core.md").includes("不是机械步骤清单"), "core rules should reject mechanical L1 task lists");
|
|
90
99
|
assert(read(cwd, "ai/template/rules/core.md").includes("需要扩大范围、权限、命令、网络或验收时"), "core rules should stop continuous execution before boundary expansion");
|
|
91
100
|
assert(read(cwd, "ai/project/task.md").includes("execution_policy:"), "task template should include execution policy");
|
|
92
101
|
assert(read(cwd, "ai/project/task.md").includes("readiness:"), "task template should include readiness state");
|
|
93
102
|
assert(read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "task template should define automatic activation rule");
|
|
103
|
+
assert(read(cwd, "ai/project/task.md").includes("l1_granularity: \"independently_acceptable_vertical_slice\""), "task template should define L1 granularity");
|
|
104
|
+
assert(read(cwd, "ai/project/task.md").includes("write_back_policy: \"l1_start_done_red_blocked_scope_change_final\""), "task template should define task tree write-back policy");
|
|
94
105
|
assert(read(cwd, "ai/project/task.md").includes("risk_gate:"), "task template should define risk gate");
|
|
95
106
|
assert(read(cwd, "ai/project/task.md").includes("status: \"pending | running | done | blocked\""), "task template should define task tree node status");
|
|
96
107
|
assert(read(cwd, "ai/project/task.md").includes("progress_unit: \"vertical_slice\""), "task template should define continuous progress unit");
|
|
@@ -99,6 +110,8 @@ function testInitUpdateDoctor() {
|
|
|
99
110
|
assert(read(cwd, "ai/template/prompt.md").includes("不要重新 bootstrap"), "execution prompt should reconcile inbox material when project context already exists");
|
|
100
111
|
assert(read(cwd, "ai/template/prompt.md").includes("整合 ai/project/inbox/ 里的新资料"), "execution prompt should route natural reconcile entry");
|
|
101
112
|
assert(read(cwd, "ai/template/prompt.md").includes("继续推进这个项目"), "execution prompt should route natural continue entry");
|
|
113
|
+
assert(read(cwd, "ai/template/prompt.md").includes("不要在任务仍是草稿时直接执行"), "execution prompt should stop after drafting a task");
|
|
114
|
+
assert(read(cwd, "ai/template/prompt.md").includes("用户可见输出"), "execution prompt should reference user-visible output rules");
|
|
102
115
|
assert(read(cwd, "ai/template/prompt.md").includes("strategy_update"), "execution prompt should route strategy updates");
|
|
103
116
|
assert(read(cwd, "ai/template/reconcile.md").includes("上下文整合"), "init should install reconcile prompt");
|
|
104
117
|
assert(read(cwd, "ai/template/reconcile.md").includes("整合计划"), "reconcile prompt should require a plan first");
|
|
@@ -122,6 +135,7 @@ function testInitUpdateDoctor() {
|
|
|
122
135
|
assert(initOutput.includes("把 ai/project/inbox/ideas/ 里的新灵感生成方向修订提案"), "init output should provide natural strategy prompt");
|
|
123
136
|
assert(initOutput.includes("agent-execution-template next"), "init output should tell users how to recover the next step");
|
|
124
137
|
assert(initOutput.includes("文件:"), "init output should summarize file changes");
|
|
138
|
+
assert(!initOutput.includes("维护者提示"), "init output should not show source checkout guidance in user projects");
|
|
125
139
|
assert(!initOutput.includes("[已更新]"), "init output should hide detailed file changes by default");
|
|
126
140
|
assert(!initOutput.includes("Read ai/template/bootstrap.md"), "init output should not use weak Read bootstrap command");
|
|
127
141
|
assert(run(["init", "--verbose"], cwd).includes("[已更新] ai/template/VERSION"), "init --verbose should show detailed file changes");
|
|
@@ -167,13 +181,24 @@ function testEnglishInitUpdateDoctor() {
|
|
|
167
181
|
assert(read(cwd, "ai/template/prompt.md").includes("default to only `ai/project/inbox/*.md`"), "English execution prompt should narrow inbox reconciliation");
|
|
168
182
|
assert(read(cwd, "ai/template/protocol.md").includes("`bounded_continuous`"), "English protocol should include bounded continuous execution");
|
|
169
183
|
assert(read(cwd, "ai/template/execution-policy.md").includes("vertical"), "English protocol should require vertical-slice progress for continuous execution");
|
|
184
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("independently acceptable vertical slice"), "English execution policy should define L1 granularity");
|
|
185
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("executing from a draft"), "English execution policy should block execution from draft tasks");
|
|
186
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("every tiny L3 operation"), "English execution policy should limit task tree write-back churn");
|
|
187
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("public interfaces, data models, permissions"), "English execution policy should constrain Yellow corrections");
|
|
188
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("User-Visible Output"), "English execution policy should define user-visible output rules");
|
|
189
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("do not show full L2/L3/L4 by default"), "English execution policy should avoid exposing full subtask trees by default");
|
|
190
|
+
assert(read(cwd, "ai/template/execution-policy.md").includes("do not show internal protocol fields"), "English execution policy should hide internal protocol details by default");
|
|
170
191
|
assert(read(cwd, "ai/template/execution-policy.md").includes("Automatically use `bounded_continuous`"), "English protocol should auto-enable continuous execution from L1 count");
|
|
171
192
|
assert(read(cwd, "ai/template/execution-policy.md").includes("Every checkpoint must include"), "English protocol should require evidence-backed checkpoints");
|
|
172
193
|
assert(read(cwd, "ai/template/rules/core.md").includes("Bounded Continuous Execution Gate"), "English core rules should include bounded continuous execution gate");
|
|
194
|
+
assert(read(cwd, "ai/template/rules/core.md").includes("readiness = ready_to_execute"), "English core rules should require ready task before execution");
|
|
195
|
+
assert(read(cwd, "ai/template/rules/core.md").includes("not a mechanical step"), "English core rules should reject mechanical L1 task lists");
|
|
173
196
|
assert(read(cwd, "ai/template/rules/core.md").includes("expand scope, permission, commands, network access, or acceptance"), "English core rules should stop continuous execution before boundary expansion");
|
|
174
197
|
assert(read(cwd, "ai/project/task.md").includes("execution_policy:"), "English task template should include execution policy");
|
|
175
198
|
assert(read(cwd, "ai/project/task.md").includes("readiness:"), "English task template should include readiness state");
|
|
176
199
|
assert(read(cwd, "ai/project/task.md").includes("activation_rule: \"auto_enable_when_l1_count_gte_2\""), "English task template should define automatic activation rule");
|
|
200
|
+
assert(read(cwd, "ai/project/task.md").includes("l1_granularity: \"independently_acceptable_vertical_slice\""), "English task template should define L1 granularity");
|
|
201
|
+
assert(read(cwd, "ai/project/task.md").includes("write_back_policy: \"l1_start_done_red_blocked_scope_change_final\""), "English task template should define task tree write-back policy");
|
|
177
202
|
assert(read(cwd, "ai/project/task.md").includes("risk_gate:"), "English task template should define risk gate");
|
|
178
203
|
assert(read(cwd, "ai/project/task.md").includes("status: \"pending | running | done | blocked\""), "English task template should define task tree node status");
|
|
179
204
|
assert(read(cwd, "ai/project/task.md").includes("progress_unit: \"vertical_slice\""), "English task template should define continuous progress unit");
|
|
@@ -181,6 +206,8 @@ function testEnglishInitUpdateDoctor() {
|
|
|
181
206
|
assert(read(cwd, "ai/template/prompt.md").includes("instead of bootstrapping again"), "English execution prompt should reconcile inbox material when project context already exists");
|
|
182
207
|
assert(read(cwd, "ai/template/prompt.md").includes("Reconcile the new material in ai/project/inbox/"), "English execution prompt should route natural reconcile entry");
|
|
183
208
|
assert(read(cwd, "ai/template/prompt.md").includes("Continue this project"), "English execution prompt should route natural continue entry");
|
|
209
|
+
assert(read(cwd, "ai/template/prompt.md").includes("do not execute while the\n task is still a draft"), "English execution prompt should stop after drafting a task");
|
|
210
|
+
assert(read(cwd, "ai/template/prompt.md").includes("User-Visible Output"), "English execution prompt should reference user-visible output rules");
|
|
184
211
|
assert(read(cwd, "ai/template/prompt.md").includes("strategy_update"), "English execution prompt should route strategy updates");
|
|
185
212
|
assert(exists(cwd, "ai/project/refs/final-shape.md"), "English init should create project North Star");
|
|
186
213
|
assert(exists(cwd, "ai/project/refs/module-map.md"), "English init should create module map");
|
|
@@ -202,6 +229,7 @@ function testEnglishInitUpdateDoctor() {
|
|
|
202
229
|
assert(initOutput.includes("Generate a direction amendment proposal from ai/project/inbox/ideas/"), "English init output should provide natural strategy prompt");
|
|
203
230
|
assert(initOutput.includes("agent-execution-template next"), "English init output should tell users how to recover the next step");
|
|
204
231
|
assert(initOutput.includes("Files:"), "English init output should summarize file changes");
|
|
232
|
+
assert(!initOutput.includes("Maintainer note"), "English init output should not show source checkout guidance in user projects");
|
|
205
233
|
assert(!initOutput.includes("[UPDATED]"), "English init output should hide detailed file changes by default");
|
|
206
234
|
assert(run(["init", "--lang=en", "--verbose"], cwd).includes("[UPDATED] ai/template/VERSION"), "English init --verbose should show detailed file changes");
|
|
207
235
|
|
|
@@ -338,6 +366,16 @@ function testPermissionErrorIsActionable() {
|
|
|
338
366
|
}
|
|
339
367
|
}
|
|
340
368
|
|
|
369
|
+
function testSourceCheckoutNotice() {
|
|
370
|
+
const doctorOutput = run(["doctor"], repoRoot);
|
|
371
|
+
assert(doctorOutput.includes("维护者提示"), "doctor should warn when run in the package source checkout");
|
|
372
|
+
assert(doctorOutput.includes("node bin/agent-execution-template.js <command>"), "source checkout notice should show local node command");
|
|
373
|
+
assert(doctorOutput.includes("不要把维护者本地初始化产生的 ai/project/** 当成产品改动提交"), "source checkout notice should warn against committing local bootstrap context");
|
|
374
|
+
|
|
375
|
+
const nextOutput = run(["next"], repoRoot);
|
|
376
|
+
assert(nextOutput.includes("维护者提示"), "next should warn when run in the package source checkout");
|
|
377
|
+
}
|
|
378
|
+
|
|
341
379
|
function main() {
|
|
342
380
|
testInitUpdateDoctor();
|
|
343
381
|
testEnglishInitUpdateDoctor();
|
|
@@ -345,6 +383,7 @@ function main() {
|
|
|
345
383
|
testRefreshBacksUpAndImportsOldProject();
|
|
346
384
|
testNextCommandRoutesByProjectState();
|
|
347
385
|
testPermissionErrorIsActionable();
|
|
386
|
+
testSourceCheckoutNotice();
|
|
348
387
|
console.log("selftest ok");
|
|
349
388
|
}
|
|
350
389
|
|