dev-playbooks-cn 1.7.4 → 2.1.0
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 +33 -0
- package/bin/devbooks.js +195 -0
- package/package.json +1 -1
- package/skills/_shared/references//346/211/271/345/207/206/351/205/215/347/275/256/350/257/264/346/230/216.md +285 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-decision-log.md +137 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-design.md +202 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-project-profile.md +159 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-proposal.md +226 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-tasks.md +181 -0
- package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-verification.md +186 -0
- package/skills/devbooks-proposal-author/references//346/217/220/346/241/210/346/222/260/345/206/231/346/217/220/347/244/272/350/257/215.md +46 -22
package/README.md
CHANGED
|
@@ -31,6 +31,39 @@ AI 编码助手很强大,但往往**不可预测**:
|
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
|
+
## ✨ v2.0.0 新特性:人类友好的文档模板
|
|
35
|
+
|
|
36
|
+
**核心理念**:AI 时代,人类需要简洁的信息来做决策,而不是阅读 AI 生成的上千行文档。
|
|
37
|
+
|
|
38
|
+
### 结论先行(30秒快速理解)
|
|
39
|
+
|
|
40
|
+
每个文档(proposal、design、tasks、verification)顶部都有简短摘要:
|
|
41
|
+
- ✅ **会导致什么**:用大白话列出变化
|
|
42
|
+
- ❌ **不会导致什么**:明确说明不变的事情
|
|
43
|
+
- 📝 **一句话总结**:让非技术人员也能理解
|
|
44
|
+
|
|
45
|
+
### 需求对齐(挖掘隐藏需求)
|
|
46
|
+
|
|
47
|
+
在 proposal 阶段,通过问题引导用户思考:
|
|
48
|
+
- 👤 **你是谁?**:快速上手者 / 平台构建者 / 快速验证者
|
|
49
|
+
- 🎯 **你要什么?**:显性需求 + 隐藏需求
|
|
50
|
+
- 💡 **多视角推荐**:基于不同角色给出不同方案
|
|
51
|
+
|
|
52
|
+
### 默认批准机制(减少决策疲劳)
|
|
53
|
+
|
|
54
|
+
- ⏰ **用户不说话 = 同意**:超时后自动批准
|
|
55
|
+
- 🎛️ **可配置超时**:proposal 48h / design 24h / tasks 24h / verification 12h
|
|
56
|
+
- 🔒 **保留控制权**:用户可以随时拒绝或自定义
|
|
57
|
+
|
|
58
|
+
### 项目级文档(知识沉淀)
|
|
59
|
+
|
|
60
|
+
- 📋 **用户画像**(project-profile.md):记录角色、需求、约束、偏好
|
|
61
|
+
- 📝 **决策日志**(decision-log.md):记录所有重要决策,方便回溯
|
|
62
|
+
|
|
63
|
+
**详见**:`docs/v2.0.0-修改总结.md`
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
34
67
|
## 工作原理
|
|
35
68
|
|
|
36
69
|
**核心约束**:Test Owner 与 Coder **必须在独立对话**中工作。这是硬性约束,不是建议。Coder 不能修改 `tests/**`,完成由测试/构建验证,而非 AI 自评。
|
package/bin/devbooks.js
CHANGED
|
@@ -380,6 +380,195 @@ async function performNpmUpdate() {
|
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
|
|
383
|
+
/**
|
|
384
|
+
* 显示版本变更摘要
|
|
385
|
+
* @param {string} fromVersion - 当前版本
|
|
386
|
+
* @param {string} toVersion - 目标版本
|
|
387
|
+
*/
|
|
388
|
+
async function displayVersionChangelog(fromVersion, toVersion) {
|
|
389
|
+
try {
|
|
390
|
+
// 尝试从 npm 获取 CHANGELOG
|
|
391
|
+
const { execSync } = await import('child_process');
|
|
392
|
+
const changelogUrl = `https://raw.githubusercontent.com/Darkbluelr/dev-playbooks-cn/master/CHANGELOG.md`;
|
|
393
|
+
|
|
394
|
+
// 使用 curl 获取 CHANGELOG(如果可用)
|
|
395
|
+
let changelog = '';
|
|
396
|
+
try {
|
|
397
|
+
changelog = execSync(`curl -s -m 5 "${changelogUrl}"`, {
|
|
398
|
+
encoding: 'utf-8',
|
|
399
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
400
|
+
});
|
|
401
|
+
} catch {
|
|
402
|
+
// 如果获取失败,显示简化信息
|
|
403
|
+
console.log(chalk.cyan('📋 版本变更摘要'));
|
|
404
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
405
|
+
console.log(chalk.yellow('⚠ 无法获取详细变更日志,请访问:'));
|
|
406
|
+
console.log(chalk.blue(` https://github.com/Darkbluelr/dev-playbooks-cn/releases/tag/v${toVersion}`));
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// 解析 CHANGELOG,提取相关版本的变更
|
|
411
|
+
const changes = parseChangelog(changelog, fromVersion, toVersion);
|
|
412
|
+
|
|
413
|
+
if (changes.length === 0) {
|
|
414
|
+
console.log(chalk.cyan('📋 版本变更摘要'));
|
|
415
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
416
|
+
console.log(chalk.yellow('⚠ 未找到详细变更信息,请访问:'));
|
|
417
|
+
console.log(chalk.blue(` https://github.com/Darkbluelr/dev-playbooks-cn/releases/tag/v${toVersion}`));
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// 显示变更摘要
|
|
422
|
+
console.log(chalk.cyan('📋 版本变更摘要'));
|
|
423
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
424
|
+
|
|
425
|
+
for (const change of changes) {
|
|
426
|
+
console.log();
|
|
427
|
+
console.log(chalk.bold.green(`## ${change.version}`));
|
|
428
|
+
if (change.date) {
|
|
429
|
+
console.log(chalk.gray(` 发布日期: ${change.date}`));
|
|
430
|
+
}
|
|
431
|
+
console.log();
|
|
432
|
+
|
|
433
|
+
// 显示主要变更(限制显示前10条)
|
|
434
|
+
const highlights = change.content.split('\n')
|
|
435
|
+
.filter(line => line.trim().length > 0)
|
|
436
|
+
.slice(0, 10);
|
|
437
|
+
|
|
438
|
+
for (const line of highlights) {
|
|
439
|
+
if (line.startsWith('###')) {
|
|
440
|
+
console.log(chalk.bold.yellow(line));
|
|
441
|
+
} else if (line.startsWith('####')) {
|
|
442
|
+
console.log(chalk.bold(line));
|
|
443
|
+
} else if (line.startsWith('- ✅') || line.startsWith('- ✓')) {
|
|
444
|
+
console.log(chalk.green(line));
|
|
445
|
+
} else if (line.startsWith('- ⚠️') || line.startsWith('- ❌')) {
|
|
446
|
+
console.log(chalk.yellow(line));
|
|
447
|
+
} else if (line.startsWith('- ')) {
|
|
448
|
+
console.log(chalk.white(line));
|
|
449
|
+
} else {
|
|
450
|
+
console.log(chalk.gray(line));
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (change.content.split('\n').length > 10) {
|
|
455
|
+
console.log(chalk.gray(' ... (更多变更请查看完整日志)'));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
console.log();
|
|
460
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
461
|
+
console.log(chalk.blue('📖 完整变更日志: ') + chalk.underline(`https://github.com/Darkbluelr/dev-playbooks-cn/blob/master/CHANGELOG.md`));
|
|
462
|
+
|
|
463
|
+
} catch (error) {
|
|
464
|
+
// 静默失败,不影响更新流程
|
|
465
|
+
console.log(chalk.gray('提示: 无法显示变更摘要'));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* 解析 CHANGELOG 内容,提取指定版本范围的变更
|
|
471
|
+
* @param {string} changelog - CHANGELOG 内容
|
|
472
|
+
* @param {string} fromVersion - 起始版本
|
|
473
|
+
* @param {string} toVersion - 目标版本
|
|
474
|
+
* @returns {Array} - 变更列表
|
|
475
|
+
*/
|
|
476
|
+
function parseChangelog(changelog, fromVersion, toVersion) {
|
|
477
|
+
const changes = [];
|
|
478
|
+
const lines = changelog.split('\n');
|
|
479
|
+
|
|
480
|
+
let currentVersion = null;
|
|
481
|
+
let currentDate = null;
|
|
482
|
+
let currentContent = [];
|
|
483
|
+
let inVersionBlock = false;
|
|
484
|
+
let shouldCapture = false;
|
|
485
|
+
|
|
486
|
+
// 解析版本号(移除 'v' 前缀)
|
|
487
|
+
const from = fromVersion.replace(/^v/, '');
|
|
488
|
+
const to = toVersion.replace(/^v/, '');
|
|
489
|
+
|
|
490
|
+
for (let i = 0; i < lines.length; i++) {
|
|
491
|
+
const line = lines[i];
|
|
492
|
+
|
|
493
|
+
// 匹配版本标题:## [2.0.0] - 2026-01-19
|
|
494
|
+
const versionMatch = line.match(/^##\s+\[?(\d+\.\d+\.\d+)\]?\s*(?:-\s*(\d{4}-\d{2}-\d{2}))?/);
|
|
495
|
+
|
|
496
|
+
if (versionMatch) {
|
|
497
|
+
// 保存上一个版本的内容
|
|
498
|
+
if (inVersionBlock && shouldCapture && currentVersion) {
|
|
499
|
+
changes.push({
|
|
500
|
+
version: currentVersion,
|
|
501
|
+
date: currentDate,
|
|
502
|
+
content: currentContent.join('\n').trim()
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// 开始新版本
|
|
507
|
+
currentVersion = versionMatch[1];
|
|
508
|
+
currentDate = versionMatch[2] || null;
|
|
509
|
+
currentContent = [];
|
|
510
|
+
inVersionBlock = true;
|
|
511
|
+
|
|
512
|
+
// 判断是否应该捕获这个版本
|
|
513
|
+
// 捕获从 fromVersion 到 toVersion 之间的所有版本
|
|
514
|
+
const versionNum = currentVersion.split('.').map(Number);
|
|
515
|
+
const fromNum = from.split('.').map(Number);
|
|
516
|
+
const toNum = to.split('.').map(Number);
|
|
517
|
+
|
|
518
|
+
const isAfterFrom = compareVersions(versionNum, fromNum) > 0;
|
|
519
|
+
const isBeforeOrEqualTo = compareVersions(versionNum, toNum) <= 0;
|
|
520
|
+
|
|
521
|
+
shouldCapture = isAfterFrom && isBeforeOrEqualTo;
|
|
522
|
+
|
|
523
|
+
continue;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// 如果遇到下一个版本标题或分隔线,结束当前版本
|
|
527
|
+
if (line.startsWith('---') && inVersionBlock) {
|
|
528
|
+
if (shouldCapture && currentVersion) {
|
|
529
|
+
changes.push({
|
|
530
|
+
version: currentVersion,
|
|
531
|
+
date: currentDate,
|
|
532
|
+
content: currentContent.join('\n').trim()
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
inVersionBlock = false;
|
|
536
|
+
shouldCapture = false;
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// 收集内容
|
|
541
|
+
if (inVersionBlock && shouldCapture) {
|
|
542
|
+
currentContent.push(line);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
// 保存最后一个版本
|
|
547
|
+
if (inVersionBlock && shouldCapture && currentVersion) {
|
|
548
|
+
changes.push({
|
|
549
|
+
version: currentVersion,
|
|
550
|
+
date: currentDate,
|
|
551
|
+
content: currentContent.join('\n').trim()
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return changes;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* 比较两个版本号
|
|
560
|
+
* @param {number[]} v1 - 版本1 [major, minor, patch]
|
|
561
|
+
* @param {number[]} v2 - 版本2 [major, minor, patch]
|
|
562
|
+
* @returns {number} - 1 if v1 > v2, -1 if v1 < v2, 0 if equal
|
|
563
|
+
*/
|
|
564
|
+
function compareVersions(v1, v2) {
|
|
565
|
+
for (let i = 0; i < 3; i++) {
|
|
566
|
+
if (v1[i] > v2[i]) return 1;
|
|
567
|
+
if (v1[i] < v2[i]) return -1;
|
|
568
|
+
}
|
|
569
|
+
return 0;
|
|
570
|
+
}
|
|
571
|
+
|
|
383
572
|
// ============================================================================
|
|
384
573
|
// 自动更新 .gitignore 和 .npmignore
|
|
385
574
|
// ============================================================================
|
|
@@ -1373,6 +1562,12 @@ async function updateCommand(projectDir) {
|
|
|
1373
1562
|
|
|
1374
1563
|
if (hasUpdate) {
|
|
1375
1564
|
spinner.info(`发现新版本: ${currentVersion} → ${latestVersion}`);
|
|
1565
|
+
|
|
1566
|
+
// 显示版本变更摘要
|
|
1567
|
+
console.log();
|
|
1568
|
+
await displayVersionChangelog(currentVersion, latestVersion);
|
|
1569
|
+
console.log();
|
|
1570
|
+
|
|
1376
1571
|
const shouldUpdate = await confirm({
|
|
1377
1572
|
message: `是否更新 ${CLI_COMMAND} 到 ${latestVersion}?`,
|
|
1378
1573
|
default: true
|
package/package.json
CHANGED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# 批准配置说明
|
|
2
|
+
|
|
3
|
+
> 本文档说明如何配置批准机制,包括默认批准、超时时间等。
|
|
4
|
+
|
|
5
|
+
## 配置文件位置
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.devbooks/config.yaml
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 配置示例
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
# 批准配置
|
|
15
|
+
approval:
|
|
16
|
+
# 默认批准策略
|
|
17
|
+
# - auto_approve: 超时后自动批准(默认)
|
|
18
|
+
# - require_explicit: 必须明确批准
|
|
19
|
+
# - disabled: 禁用批准机制
|
|
20
|
+
default_strategy: auto_approve
|
|
21
|
+
|
|
22
|
+
# 超时时间(小时)
|
|
23
|
+
timeout:
|
|
24
|
+
proposal: 48 # Proposal 需要 48 小时
|
|
25
|
+
design: 24 # Design 需要 24 小时
|
|
26
|
+
tasks: 24 # Tasks 需要 24 小时
|
|
27
|
+
verification: 12 # Verification 需要 12 小时
|
|
28
|
+
|
|
29
|
+
# 是否需要明确批准
|
|
30
|
+
require_explicit:
|
|
31
|
+
proposal: true # Proposal 必须明确批准
|
|
32
|
+
design: false # Design 可以自动批准
|
|
33
|
+
tasks: false # Tasks 可以自动批准
|
|
34
|
+
verification: false # Verification 可以自动批准
|
|
35
|
+
|
|
36
|
+
# 批准方式
|
|
37
|
+
approval_methods:
|
|
38
|
+
- cli # 命令行批准
|
|
39
|
+
- chat # 聊天批准
|
|
40
|
+
- auto # 自动批准
|
|
41
|
+
|
|
42
|
+
# 通知方式
|
|
43
|
+
notification:
|
|
44
|
+
- terminal # 终端通知
|
|
45
|
+
# - desktop # 桌面通知(可选)
|
|
46
|
+
# - email # 邮件通知(可选)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## 配置说明
|
|
50
|
+
|
|
51
|
+
### 1. 默认批准策略
|
|
52
|
+
|
|
53
|
+
| 策略 | 说明 | 适用场景 |
|
|
54
|
+
|------|------|----------|
|
|
55
|
+
| `auto_approve` | 超时后自动批准 | 大部分情况(推荐) |
|
|
56
|
+
| `require_explicit` | 必须明确批准 | 高风险项目 |
|
|
57
|
+
| `disabled` | 禁用批准机制 | 完全信任 AI |
|
|
58
|
+
|
|
59
|
+
### 2. 超时时间
|
|
60
|
+
|
|
61
|
+
- **Proposal**:48 小时(需要更多时间思考)
|
|
62
|
+
- **Design**:24 小时(技术细节)
|
|
63
|
+
- **Tasks**:24 小时(任务拆分)
|
|
64
|
+
- **Verification**:12 小时(验收结果)
|
|
65
|
+
|
|
66
|
+
**建议**:
|
|
67
|
+
- 个人项目:可以缩短超时时间(如 12/6/6/3 小时)
|
|
68
|
+
- 团队项目:保持默认超时时间
|
|
69
|
+
- 高风险项目:延长超时时间(如 72/48/48/24 小时)
|
|
70
|
+
|
|
71
|
+
### 3. 是否需要明确批准
|
|
72
|
+
|
|
73
|
+
- **true**:必须明确批准,不会自动批准
|
|
74
|
+
- **false**:超时后自动批准
|
|
75
|
+
|
|
76
|
+
**建议**:
|
|
77
|
+
- Proposal 设置为 true(重要决策)
|
|
78
|
+
- 其他阶段设置为 false(减少负担)
|
|
79
|
+
|
|
80
|
+
### 4. 批准方式
|
|
81
|
+
|
|
82
|
+
#### CLI 批准
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# 批准
|
|
86
|
+
devbooks approve <change-id> --stage proposal
|
|
87
|
+
|
|
88
|
+
# 拒绝
|
|
89
|
+
devbooks reject <change-id> --stage proposal --reason "理由"
|
|
90
|
+
|
|
91
|
+
# 修改
|
|
92
|
+
devbooks revise <change-id> --stage proposal
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
#### 聊天批准
|
|
96
|
+
|
|
97
|
+
直接在聊天中说:
|
|
98
|
+
- "同意" / "批准" / "approve"
|
|
99
|
+
- "不同意" / "拒绝" / "reject"
|
|
100
|
+
- "我想修改 XXX"
|
|
101
|
+
|
|
102
|
+
#### 自动批准
|
|
103
|
+
|
|
104
|
+
超时后自动批准(根据配置)
|
|
105
|
+
|
|
106
|
+
### 5. 通知方式
|
|
107
|
+
|
|
108
|
+
- **terminal**:终端通知(默认)
|
|
109
|
+
- **desktop**:桌面通知(需要额外配置)
|
|
110
|
+
- **email**:邮件通知(需要额外配置)
|
|
111
|
+
|
|
112
|
+
## 批准流程
|
|
113
|
+
|
|
114
|
+
### 1. 创建阶段
|
|
115
|
+
|
|
116
|
+
AI 创建文档后,会在文档末尾添加批准区块:
|
|
117
|
+
|
|
118
|
+
```markdown
|
|
119
|
+
## ✅ 批准流程
|
|
120
|
+
|
|
121
|
+
**当前状态**:
|
|
122
|
+
- 📝 状态:待批准
|
|
123
|
+
- ⏰ 创建时间:2026-01-19 10:00
|
|
124
|
+
- ⏰ 超时时间:2026-01-20 10:00(24 小时后)
|
|
125
|
+
|
|
126
|
+
**如果你同意**:
|
|
127
|
+
- [ ] ✅ 批准,开始下一阶段
|
|
128
|
+
|
|
129
|
+
**如果你不同意**:
|
|
130
|
+
- [ ] ❌ 拒绝,说明理由
|
|
131
|
+
|
|
132
|
+
**默认选择**:✅ 批准(24 小时后自动批准)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 2. 通知阶段
|
|
136
|
+
|
|
137
|
+
系统会通过配置的通知方式提醒用户:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
⏰ 提醒:Proposal 待批准
|
|
141
|
+
- 变更:20260119-1000-add-feature-x
|
|
142
|
+
- 阶段:Proposal
|
|
143
|
+
- 超时时间:2026-01-20 10:00(还剩 23 小时)
|
|
144
|
+
- 操作:devbooks approve 20260119-1000-add-feature-x --stage proposal
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 3. 批准阶段
|
|
148
|
+
|
|
149
|
+
用户可以通过以下方式批准:
|
|
150
|
+
|
|
151
|
+
- **CLI**:`devbooks approve <change-id> --stage proposal`
|
|
152
|
+
- **聊天**:直接说"同意"
|
|
153
|
+
- **自动**:什么都不做,等待超时
|
|
154
|
+
|
|
155
|
+
### 4. 超时阶段
|
|
156
|
+
|
|
157
|
+
如果超时且配置为 `auto_approve`,系统会自动批准:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
✅ 自动批准:Proposal
|
|
161
|
+
- 变更:20260119-1000-add-feature-x
|
|
162
|
+
- 阶段:Proposal
|
|
163
|
+
- 原因:超时自动批准(24 小时)
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 5. 记录阶段
|
|
167
|
+
|
|
168
|
+
所有批准操作都会记录在批准历史中:
|
|
169
|
+
|
|
170
|
+
```markdown
|
|
171
|
+
## 批准历史
|
|
172
|
+
|
|
173
|
+
| 时间 | 阶段 | 操作 | 操作者 | 理由 |
|
|
174
|
+
|------|------|------|--------|------|
|
|
175
|
+
| 2026-01-19 10:00 | Proposal | 创建 | AI | - |
|
|
176
|
+
| 2026-01-20 10:00 | Proposal | 自动批准 | 系统 | 24 小时超时 |
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 常见问题
|
|
180
|
+
|
|
181
|
+
### Q1: 如何禁用自动批准?
|
|
182
|
+
|
|
183
|
+
修改配置文件:
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
approval:
|
|
187
|
+
default_strategy: require_explicit
|
|
188
|
+
require_explicit:
|
|
189
|
+
proposal: true
|
|
190
|
+
design: true
|
|
191
|
+
tasks: true
|
|
192
|
+
verification: true
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Q2: 如何缩短超时时间?
|
|
196
|
+
|
|
197
|
+
修改配置文件:
|
|
198
|
+
|
|
199
|
+
```yaml
|
|
200
|
+
approval:
|
|
201
|
+
timeout:
|
|
202
|
+
proposal: 12
|
|
203
|
+
design: 6
|
|
204
|
+
tasks: 6
|
|
205
|
+
verification: 3
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Q3: 如何查看待批准的变更?
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
devbooks status
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
输出:
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
待批准的变更:
|
|
218
|
+
- 20260119-1000-add-feature-x (Proposal, 还剩 23 小时)
|
|
219
|
+
- 20260119-1100-fix-bug-y (Design, 还剩 5 小时)
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Q4: 如何批量批准?
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
devbooks approve --all
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Q5: 如何撤销批准?
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
devbooks revoke <change-id> --stage proposal
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 最佳实践
|
|
235
|
+
|
|
236
|
+
### 1. 个人项目
|
|
237
|
+
|
|
238
|
+
```yaml
|
|
239
|
+
approval:
|
|
240
|
+
default_strategy: auto_approve
|
|
241
|
+
timeout:
|
|
242
|
+
proposal: 12
|
|
243
|
+
design: 6
|
|
244
|
+
tasks: 6
|
|
245
|
+
verification: 3
|
|
246
|
+
require_explicit:
|
|
247
|
+
proposal: false
|
|
248
|
+
design: false
|
|
249
|
+
tasks: false
|
|
250
|
+
verification: false
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 2. 团队项目
|
|
254
|
+
|
|
255
|
+
```yaml
|
|
256
|
+
approval:
|
|
257
|
+
default_strategy: auto_approve
|
|
258
|
+
timeout:
|
|
259
|
+
proposal: 48
|
|
260
|
+
design: 24
|
|
261
|
+
tasks: 24
|
|
262
|
+
verification: 12
|
|
263
|
+
require_explicit:
|
|
264
|
+
proposal: true
|
|
265
|
+
design: false
|
|
266
|
+
tasks: false
|
|
267
|
+
verification: false
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### 3. 高风险项目
|
|
271
|
+
|
|
272
|
+
```yaml
|
|
273
|
+
approval:
|
|
274
|
+
default_strategy: require_explicit
|
|
275
|
+
timeout:
|
|
276
|
+
proposal: 72
|
|
277
|
+
design: 48
|
|
278
|
+
tasks: 48
|
|
279
|
+
verification: 24
|
|
280
|
+
require_explicit:
|
|
281
|
+
proposal: true
|
|
282
|
+
design: true
|
|
283
|
+
tasks: true
|
|
284
|
+
verification: true
|
|
285
|
+
```
|
package/skills/_shared/references//346/226/207/346/241/243/346/250/241/346/235/277-decision-log.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Decision Log 文档模板
|
|
2
|
+
|
|
3
|
+
> 本模板定义了 decision-log.md 的标准结构,用于记录所有重要决策,方便回溯和学习。
|
|
4
|
+
|
|
5
|
+
## 文件位置
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
<truth-root>/specs/_meta/decision-log.md
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 标准结构
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
# 决策日志:<项目名称>
|
|
15
|
+
|
|
16
|
+
> **目的**:记录所有重要决策,方便回溯和学习
|
|
17
|
+
|
|
18
|
+
## 决策 #001:[决策标题]
|
|
19
|
+
|
|
20
|
+
**决策时间**:YYYY-MM-DD
|
|
21
|
+
**决策阶段**:Proposal / Design / Tasks / Verification
|
|
22
|
+
**决策者**:用户 / AI 推荐 / 默认
|
|
23
|
+
|
|
24
|
+
**背景**:
|
|
25
|
+
[为什么需要做这个决策]
|
|
26
|
+
|
|
27
|
+
**选项**:
|
|
28
|
+
- 选项 A:[描述]
|
|
29
|
+
- 优势:[优势]
|
|
30
|
+
- 劣势:[劣势]
|
|
31
|
+
- 适合:[适合什么场景]
|
|
32
|
+
|
|
33
|
+
- 选项 B:[描述]
|
|
34
|
+
- 优势:[优势]
|
|
35
|
+
- 劣势:[劣势]
|
|
36
|
+
- 适合:[适合什么场景]
|
|
37
|
+
|
|
38
|
+
**决策**:
|
|
39
|
+
选择选项 [X]
|
|
40
|
+
|
|
41
|
+
**理由**:
|
|
42
|
+
- [理由 1]
|
|
43
|
+
- [理由 2]
|
|
44
|
+
- [理由 3]
|
|
45
|
+
|
|
46
|
+
**影响**:
|
|
47
|
+
- ✅ [正面影响]
|
|
48
|
+
- ⚠️ [负面影响]
|
|
49
|
+
- ⚠️ [风险]
|
|
50
|
+
|
|
51
|
+
**后续演变**:
|
|
52
|
+
- YYYY-MM-DD:[演变记录]
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 决策 #002:[决策标题]
|
|
57
|
+
|
|
58
|
+
...
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 决策模板
|
|
63
|
+
|
|
64
|
+
**决策 #XXX:[决策标题]**
|
|
65
|
+
|
|
66
|
+
**决策时间**:YYYY-MM-DD
|
|
67
|
+
**决策阶段**:Proposal / Design / Tasks / Verification
|
|
68
|
+
**决策者**:用户 / AI 推荐 / 默认
|
|
69
|
+
|
|
70
|
+
**背景**:
|
|
71
|
+
[为什么需要做这个决策]
|
|
72
|
+
|
|
73
|
+
**选项**:
|
|
74
|
+
- 选项 A:[描述]
|
|
75
|
+
- 选项 B:[描述]
|
|
76
|
+
- 选项 C:[描述]
|
|
77
|
+
|
|
78
|
+
**决策**:
|
|
79
|
+
选择选项 X
|
|
80
|
+
|
|
81
|
+
**理由**:
|
|
82
|
+
- [理由 1]
|
|
83
|
+
- [理由 2]
|
|
84
|
+
- [理由 3]
|
|
85
|
+
|
|
86
|
+
**影响**:
|
|
87
|
+
- ✅ [正面影响]
|
|
88
|
+
- ⚠️ [负面影响]
|
|
89
|
+
- ⚠️ [风险]
|
|
90
|
+
|
|
91
|
+
**后续演变**:
|
|
92
|
+
- YYYY-MM-DD:[演变记录]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 使用指南
|
|
96
|
+
|
|
97
|
+
### 1. 谁来写 Decision Log?
|
|
98
|
+
|
|
99
|
+
- **proposal-author**:记录 Proposal 阶段的决策
|
|
100
|
+
- **design-doc**:记录 Design 阶段的决策
|
|
101
|
+
- **implementation-plan**:记录 Tasks 阶段的决策
|
|
102
|
+
- **archiver**:归档时整理决策日志
|
|
103
|
+
|
|
104
|
+
### 2. 谁来读 Decision Log?
|
|
105
|
+
|
|
106
|
+
| Skill | 读取目的 |
|
|
107
|
+
|-------|----------|
|
|
108
|
+
| proposal-author | 了解历史决策,避免重复讨论 |
|
|
109
|
+
| design-doc | 了解技术选型的历史原因 |
|
|
110
|
+
| impact-analysis | 评估决策的长期影响 |
|
|
111
|
+
| archiver | 整理决策日志,建立知识库 |
|
|
112
|
+
|
|
113
|
+
### 3. 决策日志的作用
|
|
114
|
+
|
|
115
|
+
- **知识沉淀**:记录决策的背景、理由和影响
|
|
116
|
+
- **避免重复**:避免重复讨论相同的问题
|
|
117
|
+
- **学习改进**:回顾决策的后续演变,学习经验教训
|
|
118
|
+
- **团队协作**:让新成员快速了解项目的决策历史
|
|
119
|
+
|
|
120
|
+
### 4. 决策日志的更新频率
|
|
121
|
+
|
|
122
|
+
- **实时更新**:每次做出重要决策时立即记录
|
|
123
|
+
- **定期回顾**:每月回顾一次,更新"后续演变"部分
|
|
124
|
+
- **归档整理**:每次归档时整理决策日志,删除过时的决策
|
|
125
|
+
|
|
126
|
+
### 5. 什么样的决策需要记录?
|
|
127
|
+
|
|
128
|
+
**需要记录的决策**:
|
|
129
|
+
- 技术选型(选择 A 而不是 B)
|
|
130
|
+
- 架构设计(选择方案 A 而不是方案 B)
|
|
131
|
+
- 重要的权衡(牺牲 X 换取 Y)
|
|
132
|
+
- 边界条件(明确不做什么)
|
|
133
|
+
|
|
134
|
+
**不需要记录的决策**:
|
|
135
|
+
- 显而易见的决策(如使用 Git 做版本控制)
|
|
136
|
+
- 临时性的决策(如变量命名)
|
|
137
|
+
- 可逆的决策(如代码格式)
|