dev-playbooks-cn 1.5.4 → 1.5.6
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 +22 -1
- package/bin/devbooks.js +93 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,20 @@ dev-playbooks-cn init --tools claude --scope project # 项目级
|
|
|
97
97
|
dev-playbooks-cn init --tools claude --scope global # 全局
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### 更新
|
|
101
|
+
|
|
102
|
+
使用 `update` 命令同时更新 CLI 和项目中的 Skills:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
dev-playbooks-cn update
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
更新命令会:
|
|
109
|
+
1. **检查 CLI 新版本**:自动检测 npm 上是否有新版本,交互式询问是否更新
|
|
110
|
+
2. **更新项目文件**:更新 Skills、规则文件、指令文件等
|
|
111
|
+
|
|
112
|
+
> **提示**:不再需要手动运行 `npm install -g dev-playbooks-cn`,`update` 命令会自动处理。
|
|
113
|
+
|
|
100
114
|
### 快速集成
|
|
101
115
|
|
|
102
116
|
DevBooks 使用两个目录根:
|
|
@@ -196,7 +210,6 @@ DevBooks 使用两个目录根:
|
|
|
196
210
|
| Skill | 说明 |
|
|
197
211
|
|-------|------|
|
|
198
212
|
| `devbooks-archiver` | 规格维护与去重 |
|
|
199
|
-
| `devbooks-delivery-workflow` | 完整交付闭环 |
|
|
200
213
|
|
|
201
214
|
### 独立技能
|
|
202
215
|
|
|
@@ -206,6 +219,14 @@ DevBooks 使用两个目录根:
|
|
|
206
219
|
| `devbooks-brownfield-bootstrap` | 存量项目初始化 |
|
|
207
220
|
| `devbooks-convergence-audit` | 收敛性审计(反迷惑设计) |
|
|
208
221
|
|
|
222
|
+
### 编排层(支持子 Agent 的工具专用)
|
|
223
|
+
|
|
224
|
+
| Skill | 说明 |
|
|
225
|
+
|-------|------|
|
|
226
|
+
| `devbooks-delivery-workflow` | 完整闭环编排器,自动编排 Proposal→Design→Spec→Plan→Test→Code→Review→Archive 全流程 |
|
|
227
|
+
|
|
228
|
+
> **注意**:`devbooks-delivery-workflow` 是编排层 Skill,专为支持子 Agent 的 AI 编程工具(如 Claude Code with Task tool)设计。它会调用子 Agent 执行各阶段 Skill,完成完整的变更闭环。
|
|
229
|
+
|
|
209
230
|
---
|
|
210
231
|
|
|
211
232
|
## DevBooks 对比
|
package/bin/devbooks.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* 用法:
|
|
9
9
|
* dev-playbooks-cn init [path] [options]
|
|
10
|
-
* dev-playbooks-cn update [path]
|
|
10
|
+
* dev-playbooks-cn update [path] # 更新 CLI 和已配置的工具
|
|
11
11
|
* dev-playbooks-cn migrate --from <framework> [options]
|
|
12
12
|
*
|
|
13
13
|
* 选项:
|
|
@@ -316,6 +316,70 @@ function getCliVersion() {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
/**
|
|
320
|
+
* 检查 npm 上是否有新版本
|
|
321
|
+
* @returns {Promise<{hasUpdate: boolean, latestVersion: string|null, currentVersion: string}>}
|
|
322
|
+
*/
|
|
323
|
+
async function checkNpmUpdate() {
|
|
324
|
+
const currentVersion = getCliVersion();
|
|
325
|
+
try {
|
|
326
|
+
const { execSync } = await import('child_process');
|
|
327
|
+
const latestVersion = execSync(`npm view ${CLI_COMMAND} version`, {
|
|
328
|
+
encoding: 'utf-8',
|
|
329
|
+
timeout: 10000,
|
|
330
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
331
|
+
}).trim();
|
|
332
|
+
|
|
333
|
+
if (latestVersion && latestVersion !== currentVersion) {
|
|
334
|
+
// 简单版本比较(假设语义化版本)
|
|
335
|
+
const current = currentVersion.split('.').map(Number);
|
|
336
|
+
const latest = latestVersion.split('.').map(Number);
|
|
337
|
+
const hasUpdate = latest[0] > current[0] ||
|
|
338
|
+
(latest[0] === current[0] && latest[1] > current[1]) ||
|
|
339
|
+
(latest[0] === current[0] && latest[1] === current[1] && latest[2] > current[2]);
|
|
340
|
+
return { hasUpdate, latestVersion, currentVersion };
|
|
341
|
+
}
|
|
342
|
+
return { hasUpdate: false, latestVersion, currentVersion };
|
|
343
|
+
} catch {
|
|
344
|
+
// 网络错误或超时,静默忽略
|
|
345
|
+
return { hasUpdate: false, latestVersion: null, currentVersion };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* 执行 npm 全局更新
|
|
351
|
+
* @returns {Promise<boolean>} 更新是否成功
|
|
352
|
+
*/
|
|
353
|
+
async function performNpmUpdate() {
|
|
354
|
+
return new Promise((resolve) => {
|
|
355
|
+
const spinner = ora(`正在更新 ${CLI_COMMAND}...`).start();
|
|
356
|
+
const child = spawn('npm', ['install', '-g', CLI_COMMAND], {
|
|
357
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
358
|
+
shell: true
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
let stderr = '';
|
|
362
|
+
child.stderr.on('data', (data) => {
|
|
363
|
+
stderr += data.toString();
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
child.on('close', (code) => {
|
|
367
|
+
if (code === 0) {
|
|
368
|
+
spinner.succeed(`${CLI_COMMAND} 已更新到最新版本`);
|
|
369
|
+
resolve(true);
|
|
370
|
+
} else {
|
|
371
|
+
spinner.fail(`更新失败: ${stderr || '未知错误'}`);
|
|
372
|
+
resolve(false);
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
child.on('error', (err) => {
|
|
377
|
+
spinner.fail(`更新失败: ${err.message}`);
|
|
378
|
+
resolve(false);
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
319
383
|
// ============================================================================
|
|
320
384
|
// 自动更新 .gitignore 和 .npmignore
|
|
321
385
|
// ============================================================================
|
|
@@ -1301,7 +1365,32 @@ async function updateCommand(projectDir) {
|
|
|
1301
1365
|
console.log(chalk.bold('DevBooks 更新'));
|
|
1302
1366
|
console.log();
|
|
1303
1367
|
|
|
1304
|
-
//
|
|
1368
|
+
// 1. 检查 CLI 自身是否有新版本
|
|
1369
|
+
const spinner = ora('检查 CLI 更新...').start();
|
|
1370
|
+
const { hasUpdate, latestVersion, currentVersion } = await checkNpmUpdate();
|
|
1371
|
+
|
|
1372
|
+
if (hasUpdate) {
|
|
1373
|
+
spinner.info(`发现新版本: ${currentVersion} → ${latestVersion}`);
|
|
1374
|
+
const shouldUpdate = await confirm({
|
|
1375
|
+
message: `是否更新 ${CLI_COMMAND} 到 ${latestVersion}?`,
|
|
1376
|
+
default: true
|
|
1377
|
+
});
|
|
1378
|
+
|
|
1379
|
+
if (shouldUpdate) {
|
|
1380
|
+
const success = await performNpmUpdate();
|
|
1381
|
+
if (success) {
|
|
1382
|
+
console.log(chalk.blue('ℹ') + ` 请重新运行 \`${CLI_COMMAND} update\` 以更新项目文件。`);
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
// 更新失败,继续更新本地文件
|
|
1386
|
+
}
|
|
1387
|
+
} else {
|
|
1388
|
+
spinner.succeed(`CLI 已是最新版本 (v${currentVersion})`);
|
|
1389
|
+
}
|
|
1390
|
+
|
|
1391
|
+
console.log();
|
|
1392
|
+
|
|
1393
|
+
// 2. 检查是否已初始化(更新项目文件)
|
|
1305
1394
|
const configPath = path.join(projectDir, '.devbooks', 'config.yaml');
|
|
1306
1395
|
if (!fs.existsSync(configPath)) {
|
|
1307
1396
|
console.log(chalk.red('✗') + ` 未找到 DevBooks 配置。请先运行 \`${CLI_COMMAND} init\`。`);
|
|
@@ -1468,7 +1557,7 @@ function showHelp() {
|
|
|
1468
1557
|
console.log();
|
|
1469
1558
|
console.log(chalk.cyan('用法:'));
|
|
1470
1559
|
console.log(` ${CLI_COMMAND} init [path] [options] 初始化 DevBooks`);
|
|
1471
|
-
console.log(` ${CLI_COMMAND} update [path]
|
|
1560
|
+
console.log(` ${CLI_COMMAND} update [path] 更新 CLI 和已配置的工具`);
|
|
1472
1561
|
console.log(` ${CLI_COMMAND} migrate --from <framework> [opts] 从其他框架迁移`);
|
|
1473
1562
|
console.log();
|
|
1474
1563
|
console.log(chalk.cyan('选项:'));
|
|
@@ -1522,7 +1611,7 @@ function showHelp() {
|
|
|
1522
1611
|
console.log(` ${CLI_COMMAND} init my-project # 在 my-project 目录初始化`);
|
|
1523
1612
|
console.log(` ${CLI_COMMAND} init --tools claude,cursor # 非交互式(默认项目级安装)`);
|
|
1524
1613
|
console.log(` ${CLI_COMMAND} init --tools claude --scope global # 非交互式(全局安装)`);
|
|
1525
|
-
console.log(` ${CLI_COMMAND} update #
|
|
1614
|
+
console.log(` ${CLI_COMMAND} update # 更新 CLI 和 Skills`);
|
|
1526
1615
|
console.log(` ${CLI_COMMAND} migrate --from openspec # 从 OpenSpec 迁移`);
|
|
1527
1616
|
console.log(` ${CLI_COMMAND} migrate --from speckit # 从 spec-kit 迁移`);
|
|
1528
1617
|
console.log(` ${CLI_COMMAND} migrate --from openspec --dry-run # 模拟迁移`);
|