dev-playbooks 1.5.3 → 1.5.5

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 CHANGED
@@ -196,7 +196,6 @@ Run devbooks-archiver skill for change add-oauth2
196
196
  | Skill | Description |
197
197
  |-------|-------------|
198
198
  | devbooks-archiver | Maintain/dedupe specs |
199
- | devbooks-delivery-workflow | End-to-end delivery workflow |
200
199
 
201
200
  ### Standalone Skills
202
201
 
@@ -206,6 +205,14 @@ Run devbooks-archiver skill for change add-oauth2
206
205
  | devbooks-brownfield-bootstrap | Brownfield project bootstrap |
207
206
  | devbooks-convergence-audit | Convergence audit (anti-deception design) |
208
207
 
208
+ ### Orchestration Layer (For tools with sub-agent support)
209
+
210
+ | Skill | Description |
211
+ |-------|-------------|
212
+ | devbooks-delivery-workflow | Complete closed-loop orchestrator, auto-orchestrates Proposal→Design→Spec→Plan→Test→Code→Review→Archive workflow |
213
+
214
+ > **Note**: `devbooks-delivery-workflow` is an orchestration layer Skill, designed for AI programming tools with sub-agent support (e.g., Claude Code with Task tool). It calls sub-agents to execute each stage's Skill, completing the full change closed-loop.
215
+
209
216
  ---
210
217
 
211
218
  ## DevBooks Comparisons
package/bin/devbooks.js CHANGED
@@ -5,17 +5,17 @@
5
5
  *
6
6
  * AI-agnostic spec-driven development workflow
7
7
  *
8
- * 用法:
9
- * dev-playbooks-cn init [path] [options]
10
- * dev-playbooks-cn update [path]
11
- * dev-playbooks-cn migrate --from <framework> [options]
8
+ * Usage:
9
+ * dev-playbooks init [path] [options]
10
+ * dev-playbooks update [path] # Update CLI and configured tools
11
+ * dev-playbooks migrate --from <framework> [options]
12
12
  *
13
- * 选项:
14
- * --tools <tools> 非交互式指定 AI 工具:all, none, 或逗号分隔的列表
15
- * --from <framework> 迁移来源框架:openspec, speckit
16
- * --dry-run 模拟运行,不实际修改文件
17
- * --keep-old 迁移后保留原目录
18
- * --help 显示帮助信息
13
+ * Options:
14
+ * --tools <tools> Non-interactive tool selection: all, none, or comma-separated list
15
+ * --from <framework> Migration source: openspec, speckit
16
+ * --dry-run Dry run, don't modify files
17
+ * --keep-old Keep old directory after migration
18
+ * --help Show help
19
19
  * --version Show version
20
20
  */
21
21
 
@@ -316,6 +316,70 @@ function getCliVersion() {
316
316
  }
317
317
  }
318
318
 
319
+ /**
320
+ * Check if a new version is available on 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
+ // Simple semver comparison
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
+ // Network error or timeout, silently ignore
345
+ return { hasUpdate: false, latestVersion: null, currentVersion };
346
+ }
347
+ }
348
+
349
+ /**
350
+ * Perform npm global update
351
+ * @returns {Promise<boolean>} Whether the update succeeded
352
+ */
353
+ async function performNpmUpdate() {
354
+ return new Promise((resolve) => {
355
+ const spinner = ora(`Updating ${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} updated to latest version`);
369
+ resolve(true);
370
+ } else {
371
+ spinner.fail(`Update failed: ${stderr || 'Unknown error'}`);
372
+ resolve(false);
373
+ }
374
+ });
375
+
376
+ child.on('error', (err) => {
377
+ spinner.fail(`Update failed: ${err.message}`);
378
+ resolve(false);
379
+ });
380
+ });
381
+ }
382
+
319
383
  // ============================================================================
320
384
  // Auto-update .gitignore and .npmignore
321
385
  // ============================================================================
@@ -1297,7 +1361,32 @@ async function updateCommand(projectDir) {
1297
1361
  console.log(chalk.bold('DevBooks Update'));
1298
1362
  console.log();
1299
1363
 
1300
- // Check if initialized
1364
+ // 1. Check if CLI has a new version
1365
+ const spinner = ora('Checking for CLI updates...').start();
1366
+ const { hasUpdate, latestVersion, currentVersion } = await checkNpmUpdate();
1367
+
1368
+ if (hasUpdate) {
1369
+ spinner.info(`New version available: ${currentVersion} → ${latestVersion}`);
1370
+ const shouldUpdate = await confirm({
1371
+ message: `Update ${CLI_COMMAND} to ${latestVersion}?`,
1372
+ default: true
1373
+ });
1374
+
1375
+ if (shouldUpdate) {
1376
+ const success = await performNpmUpdate();
1377
+ if (success) {
1378
+ console.log(chalk.blue('ℹ') + ` Please run \`${CLI_COMMAND} update\` again to update project files.`);
1379
+ return;
1380
+ }
1381
+ // Update failed, continue with local file updates
1382
+ }
1383
+ } else {
1384
+ spinner.succeed(`CLI is up to date (v${currentVersion})`);
1385
+ }
1386
+
1387
+ console.log();
1388
+
1389
+ // 2. Check if initialized (update project files)
1301
1390
  const configPath = path.join(projectDir, '.devbooks', 'config.yaml');
1302
1391
  if (!fs.existsSync(configPath)) {
1303
1392
  console.log(chalk.red('✗') + ` DevBooks config not found. Please run \`${CLI_COMMAND} init\` first.`);
@@ -1464,7 +1553,7 @@ function showHelp() {
1464
1553
  console.log();
1465
1554
  console.log(chalk.cyan('Usage:'));
1466
1555
  console.log(` ${CLI_COMMAND} init [path] [options] Initialize DevBooks`);
1467
- console.log(` ${CLI_COMMAND} update [path] Update configured tools`);
1556
+ console.log(` ${CLI_COMMAND} update [path] Update CLI and configured tools`);
1468
1557
  console.log(` ${CLI_COMMAND} migrate --from <framework> [opts] Migrate from other frameworks`);
1469
1558
  console.log();
1470
1559
  console.log(chalk.cyan('Options:'));
@@ -1518,7 +1607,7 @@ function showHelp() {
1518
1607
  console.log(` ${CLI_COMMAND} init my-project # Initialize in my-project directory`);
1519
1608
  console.log(` ${CLI_COMMAND} init --tools claude,cursor # Non-interactive (project-level by default)`);
1520
1609
  console.log(` ${CLI_COMMAND} init --tools claude --scope global # Non-interactive (global installation)`);
1521
- console.log(` ${CLI_COMMAND} update # Update configured tools`);
1610
+ console.log(` ${CLI_COMMAND} update # Update CLI and Skills`);
1522
1611
  console.log(` ${CLI_COMMAND} migrate --from openspec # Migrate from OpenSpec`);
1523
1612
  console.log(` ${CLI_COMMAND} migrate --from speckit # Migrate from spec-kit`);
1524
1613
  console.log(` ${CLI_COMMAND} migrate --from openspec --dry-run # Dry run migration`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dev-playbooks",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "description": "AI-powered spec-driven development workflow",
5
5
  "keywords": [
6
6
  "devbooks",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: devbooks-delivery-workflow
3
- description: devbooks-delivery-workflow: Run a change through a traceable closed-loop workflow (Design->Plan->Trace->Verify->Implement->Archive), with clear DoD, traceability matrix, and role isolation (Test Owner and Coder separation). Use when the user says "run closed-loop/delivery acceptance/traceability matrix/DoD/close and archive/acceptance workflow" etc.
3
+ description: "devbooks-delivery-workflow: Complete closed-loop orchestrator that runs in AI programming tools with sub-agent support, automatically orchestrating the full Proposal→Design→Spec→Plan→Test→Implement→Review→Archive workflow. Use when the user says 'run closed-loop/complete delivery/end-to-end flow/automated change workflow' etc."
4
4
  allowed-tools:
5
5
  - Glob
6
6
  - Grep
@@ -8,9 +8,12 @@ allowed-tools:
8
8
  - Write
9
9
  - Edit
10
10
  - Bash
11
+ - Task
11
12
  ---
12
13
 
13
- # DevBooks: Delivery Acceptance Workflow (Closed-Loop Skeleton)
14
+ # DevBooks: Delivery Acceptance Workflow (Complete Closed-Loop Orchestrator)
15
+
16
+ > **Positioning**: This Skill is an **orchestration layer**, not a daily-use Skill. It runs in AI programming tools with sub-agent support (e.g., Claude Code with Task tool) to automatically orchestrate complete change closed-loops.
14
17
 
15
18
  ## Prerequisites: Configuration Discovery (Protocol-Agnostic)
16
19
 
@@ -28,57 +31,83 @@ Before execution, **must** search for configuration in the following order (stop
28
31
  - Do not guess directory roots
29
32
  - Do not skip reading the rules document
30
33
 
31
- ## Change Package Naming Convention (Mandatory)
34
+ ## Core Responsibility: Complete Closed-Loop Orchestration
32
35
 
33
- Change package ID (change-id) **must** follow this naming convention:
36
+ This Skill's core capability is **orchestrating sub-agents to complete the full change closed-loop**.
34
37
 
35
- ### Format
38
+ ### Closed-Loop Flow (8 Stages)
36
39
 
37
40
  ```
38
- <datetime>-<verb-prefixed-semantic-description>
41
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
42
+ │ 1. Propose │ ──▶ │ 2. Design │ ──▶ │ 3. Spec │ ──▶ │ 4. Plan │
43
+ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
44
+ │ │
45
+ ▼ ▼
46
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
47
+ │ 8. Archive │ ◀── │ 7. Review │ ◀── │ 6. Code │ ◀── │ 5. Test │
48
+ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
39
49
  ```
40
50
 
41
- ### Rules
51
+ ### Stage Details and Corresponding Skills
42
52
 
43
- | Component | Rule | Example |
44
- |-----------|------|---------|
45
- | Datetime | `YYYYMMDD-HHMM` format | `20240116-1030` |
46
- | Separator | Use `-` between datetime and semantic | `-` |
47
- | Semantic description | **Must start with a verb**, use lowercase and hyphens | `add-oauth2`, `fix-login-bug` |
53
+ | Stage | Skill | Artifact | Role |
54
+ |-------|-------|----------|------|
55
+ | 1. Propose | `devbooks-proposal-author` | proposal.md | Author |
56
+ | 1.5 Challenge (optional) | `devbooks-proposal-challenger` | Challenge comments | Challenger |
57
+ | 1.6 Judge (optional) | `devbooks-proposal-judge` | Decision | Judge |
58
+ | 2. Design | `devbooks-design-doc` | design.md | Designer |
59
+ | 3. Spec | `devbooks-spec-contract` | specs/*.md | Spec Owner |
60
+ | 4. Plan | `devbooks-implementation-plan` | tasks.md | Planner |
61
+ | 5. Test | `devbooks-test-owner` | verification.md + tests/ | Test Owner |
62
+ | 6. Code | `devbooks-coder` | src/ implementation | Coder |
63
+ | 7. Review | `devbooks-code-review` | Review comments | Reviewer |
64
+ | 7.5 Test Review (optional) | `devbooks-test-reviewer` | Test review | Test Reviewer |
65
+ | 8. Archive | `devbooks-archiver` | Archived to truth source | Archiver |
48
66
 
49
- ### Valid Examples
67
+ ### Orchestration Logic
50
68
 
51
- ```bash
52
- # ✅ Correct
53
- 20240116-1030-add-oauth2-support
54
- 20240116-1430-fix-user-auth-bug
55
- 20240116-0900-refactor-payment-module
56
- 20240115-2200-update-api-docs
57
-
58
- # ❌ Incorrect
59
- add-oauth2 # Missing datetime
60
- 20240116-oauth2 # Semantic doesn't start with verb
61
- 2024-01-16-add-oauth2 # Wrong date format (shouldn't have -)
62
- oauth2-20240116 # Wrong order
63
69
  ```
70
+ 1. Receive user requirement
71
+ 2. Call proposal-author to create proposal (auto-generate change-id)
72
+ 3. [Optional] Call proposal-challenger to challenge proposal
73
+ 4. [Optional] Call proposal-judge to adjudicate
74
+ 5. Call design-doc to create design document
75
+ 6. [If external contracts] Call spec-contract to define specs
76
+ 7. Call implementation-plan to create implementation plan
77
+ 8. Call test-owner to write tests (independent Agent)
78
+ 9. Call coder to implement features (independent Agent)
79
+ 10. Call code-review to review code
80
+ 11. [Optional] Call test-reviewer to review tests
81
+ 12. Call archiver to archive to truth source
82
+ ```
83
+
84
+ ### Role Isolation Constraints
85
+
86
+ **Key Principle**: Test Owner and Coder must use **independent Agent instances/sessions**.
64
87
 
65
- ### Common Verbs
88
+ | Role | Isolation Requirement | Reason |
89
+ |------|----------------------|--------|
90
+ | Test Owner | Independent Agent | Prevent Coder from tampering with tests |
91
+ | Coder | Independent Agent | Prevent Coder from seeing test implementation details |
92
+ | Reviewer | Independent Agent (recommended) | Maintain review objectivity |
66
93
 
67
- | Verb | Usage |
68
- |------|-------|
69
- | `add` | Add new feature |
70
- | `fix` | Fix defect |
71
- | `update` | Update existing feature |
72
- | `refactor` | Refactor code |
73
- | `remove` | Remove feature |
74
- | `improve` | Improve performance/experience |
75
- | `migrate` | Migrate data/system |
94
+ ### Gate Checkpoints
76
95
 
77
- ### Why This Naming Convention?
96
+ After each stage completes, call `change-check.sh` to verify:
78
97
 
79
- 1. **Timestamp first**: Auto-sorts by time in archive directory
80
- 2. **Verb prefix**: Clearly expresses change intent, aids code review
81
- 3. **Lowercase hyphens**: Avoids cross-platform filename issues
98
+ ```bash
99
+ # Proposal stage check
100
+ change-check.sh <change-id> --mode proposal
101
+
102
+ # Implementation stage check (Test Owner)
103
+ change-check.sh <change-id> --mode apply --role test-owner
104
+
105
+ # Implementation stage check (Coder)
106
+ change-check.sh <change-id> --mode apply --role coder
107
+
108
+ # Pre-archive check
109
+ change-check.sh <change-id> --mode archive
110
+ ```
82
111
 
83
112
  ## Reference Skeleton (Read as Needed)
84
113
 
@@ -81,6 +81,82 @@ if [[ -z "$change_id" || "$change_id" == "-"* || "$change_id" =~ [[:space:]] ]];
81
81
  exit 2
82
82
  fi
83
83
 
84
+ # Validate change-id format: YYYYMMDD-HHMM-<verb-prefixed-description>
85
+ # Format: datetime-verb-prefixed-semantic-description
86
+ # Example: 20240116-1030-add-oauth2-support
87
+ validate_change_id_format() {
88
+ local id="$1"
89
+
90
+ # Pattern: 8 digits (date) + hyphen + 4 digits (time) + hyphen + verb-prefixed-description
91
+ # Date: YYYYMMDD, Time: HHMM
92
+ if [[ ! "$id" =~ ^[0-9]{8}-[0-9]{4}-.+ ]]; then
93
+ return 1
94
+ fi
95
+
96
+ # Extract datetime part for validation
97
+ local date_part="${id:0:8}"
98
+ local time_part="${id:9:4}"
99
+ local desc_part="${id:14}"
100
+
101
+ # Validate date (basic check: year 2020-2099, month 01-12, day 01-31)
102
+ local year="${date_part:0:4}"
103
+ local month="${date_part:4:2}"
104
+ local day="${date_part:6:2}"
105
+
106
+ # Remove leading zeros for numeric comparison
107
+ year=$((10#$year))
108
+ month=$((10#$month))
109
+ day=$((10#$day))
110
+
111
+ if [[ "$year" -lt 2020 || "$year" -gt 2099 ]]; then
112
+ return 1
113
+ fi
114
+ if [[ "$month" -lt 1 || "$month" -gt 12 ]]; then
115
+ return 1
116
+ fi
117
+ if [[ "$day" -lt 1 || "$day" -gt 31 ]]; then
118
+ return 1
119
+ fi
120
+
121
+ # Validate time (hour 00-23, minute 00-59)
122
+ local hour="${time_part:0:2}"
123
+ local minute="${time_part:2:2}"
124
+
125
+ hour=$((10#$hour))
126
+ minute=$((10#$minute))
127
+
128
+ if [[ "$hour" -lt 0 || "$hour" -gt 23 ]]; then
129
+ return 1
130
+ fi
131
+ if [[ "$minute" -lt 0 || "$minute" -gt 59 ]]; then
132
+ return 1
133
+ fi
134
+
135
+ # Validate description starts with a verb (common verbs)
136
+ local verb_pattern="^(add|fix|update|refactor|remove|improve|migrate|implement|enable|disable|change|create|delete|modify|optimize|resolve|setup|init|configure|introduce|extract|merge|split|move|rename|deprecate|upgrade|downgrade|revert|sync|integrate|unify|standardize|simplify|extend|reduce|enhance|support|handle|validate|test|document|cleanup|prepare|finalize|complete|release|publish|deploy|hotfix|patch|bump)-"
137
+
138
+ if [[ ! "$desc_part" =~ $verb_pattern ]]; then
139
+ return 1
140
+ fi
141
+
142
+ return 0
143
+ }
144
+
145
+ if ! validate_change_id_format "$change_id"; then
146
+ echo "error: invalid change-id format: '$change_id'" >&2
147
+ echo "" >&2
148
+ echo "Expected format: YYYYMMDD-HHMM-<verb-prefixed-description>" >&2
149
+ echo "Example: 20240116-1030-add-oauth2-support" >&2
150
+ echo "" >&2
151
+ echo "Rules:" >&2
152
+ echo " - Date: YYYYMMDD (e.g., 20240116)" >&2
153
+ echo " - Time: HHMM (e.g., 1030 for 10:30)" >&2
154
+ echo " - Description: must start with a verb (add/fix/update/refactor/...)" >&2
155
+ echo "" >&2
156
+ echo "Common verbs: add, fix, update, refactor, remove, improve, migrate, implement" >&2
157
+ exit 2
158
+ fi
159
+
84
160
  if [[ -z "$project_root" || -z "$change_root" || -z "$truth_root" ]]; then
85
161
  usage
86
162
  exit 2
@@ -32,6 +32,66 @@ Before execution, you **must** search for configuration in the following order (
32
32
  1. **Proposal Authoring**: Produce clear, reviewable, and actionable change proposals
33
33
  2. **Design Decision Interaction**: For design choices that cannot be objectively judged as better or worse (where A and B are both viable depending on preferences), present options to users for their decision rather than deciding unilaterally
34
34
 
35
+ ## Change Package Naming Convention (Mandatory)
36
+
37
+ Change package ID (change-id) **must** follow this naming convention:
38
+
39
+ ### Format
40
+
41
+ ```
42
+ <datetime>-<verb-prefixed-semantic-description>
43
+ ```
44
+
45
+ ### Rules
46
+
47
+ | Component | Rule | Example |
48
+ |-----------|------|---------|
49
+ | Datetime | `YYYYMMDD-HHMM` format | `20240116-1030` |
50
+ | Separator | Use `-` between datetime and semantic | `-` |
51
+ | Semantic description | **Must start with a verb**, use lowercase and hyphens | `add-oauth2`, `fix-login-bug` |
52
+
53
+ ### Examples
54
+
55
+ ```bash
56
+ # ✅ Correct
57
+ 20240116-1030-add-oauth2-support
58
+ 20240116-1430-fix-user-auth-bug
59
+ 20240116-0900-refactor-payment-module
60
+ 20240115-2200-update-api-docs
61
+
62
+ # ❌ Incorrect
63
+ add-oauth2 # Missing datetime
64
+ 20240116-oauth2 # Semantic doesn't start with verb
65
+ 2024-01-16-add-oauth2 # Wrong date format (shouldn't have -)
66
+ oauth2-20240116 # Wrong order
67
+ ```
68
+
69
+ ### Common Verbs
70
+
71
+ | Verb | Usage |
72
+ |------|-------|
73
+ | `add` | Add new feature |
74
+ | `fix` | Fix defect |
75
+ | `update` | Update existing feature |
76
+ | `refactor` | Refactor code |
77
+ | `remove` | Remove feature |
78
+ | `improve` | Improve performance/experience |
79
+ | `migrate` | Migrate data/system |
80
+
81
+ ### Why This Naming Convention?
82
+
83
+ 1. **Timestamp first**: Auto-sorts by time in archive directory
84
+ 2. **Verb prefix**: Clearly expresses change intent, aids code review
85
+ 3. **Lowercase hyphens**: Avoids cross-platform filename issues
86
+
87
+ ### Creating Change Package
88
+
89
+ After determining the change-id, call the scaffold script to initialize the change package:
90
+
91
+ ```bash
92
+ change-scaffold.sh <change-id> --project-root <repo-root> --change-root <change-root> --truth-root <truth-root>
93
+ ```
94
+
35
95
  ## Artifact Location
36
96
 
37
97
  - Proposal: `<change-root>/<change-id>/proposal.md`