@jspg-ai/coding-bb 0.0.1 → 0.0.2-beta.22

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.
Files changed (145) hide show
  1. package/cbb/bin/cbb.js +6 -0
  2. package/cbb/bin/cbbm.js +6 -0
  3. package/cbb/dev-standards/rules/cbb-ai-behavior.md +103 -103
  4. package/cbb/dev-standards/rules/cbb-priority.md +55 -55
  5. package/cbb/lib/install/claude-code.js +2 -0
  6. package/cbb/lib/install/init.js +496 -290
  7. package/cbb/lib/install/opencode.js +31 -0
  8. package/cbb/lib/install/qoder.js +2 -0
  9. package/cbb/lib/install/workspaces.js +53 -13
  10. package/cbb/lib/openspec/index.js +3 -3
  11. package/cbb/lib/superpowers/index.js +1 -1
  12. package/cbb/lib/utils/check-update.js +16 -14
  13. package/cbb/lib/utils/gitignore.js +2 -1
  14. package/cbb/lib/utils/output.js +92 -4
  15. package/cbb/lib/utils/version.js +2 -31
  16. package/cbb/lib/wiki/cli.js +25 -25
  17. package/cbb/lib/wiki/index.js +16 -16
  18. package/cbb/tools/cbb-design-to-wiki/SKILL.md +14 -14
  19. package/cbb/tools/cbb-wiki-ops/SKILL.md +22 -22
  20. package/cbb/worktrees/_shared/scripts/find-target-worktree.js +2 -2
  21. package/cbb/worktrees/_shared/scripts/find-workspace-root.js +7 -7
  22. package/cbb/worktrees/_shared/scripts/push-core.js +18 -0
  23. package/cbb/worktrees/commands/{close.md → worktree-close.md} +8 -8
  24. package/cbb/worktrees/commands/{init.md → worktree-init.md} +9 -9
  25. package/cbb/worktrees/commands/{push.md → worktree-push.md} +3 -3
  26. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/SKILL.md +20 -20
  27. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/check-env.js +4 -4
  28. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/check-unarchived.js +1 -1
  29. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/delete-branches.js +3 -3
  30. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/discover-apps.js +6 -6
  31. package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-close}/scripts/find-target-worktree.js +2 -2
  32. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-close}/scripts/find-workspace-root.js +7 -7
  33. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/remove-worktrees.js +4 -4
  34. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/safety-check.js +4 -4
  35. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/SKILL.md +81 -107
  36. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/auto-open.js +1 -1
  37. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env-deep.js +4 -4
  38. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-env.js +6 -6
  39. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/check-repos.js +4 -4
  40. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/create-branches.js +4 -4
  41. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/create-worktrees.js +8 -7
  42. package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-init}/scripts/find-workspace-root.js +7 -7
  43. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/install-ai.js +33 -33
  44. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/parse-config.js +7 -7
  45. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/push-branches.js +9 -7
  46. package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-init}/scripts/push-core.js +18 -0
  47. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/sync-repos.js +10 -12
  48. package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-init}/scripts/update-gitignore.js +19 -6
  49. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/SKILL.md +16 -16
  50. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/commit-worktrees.js +2 -2
  51. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/find-target-worktree.js +2 -2
  52. package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-push}/scripts/find-workspace-root.js +7 -7
  53. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/push-core.js +18 -0
  54. package/cbb/worktrees/skills/{openspec-push-worktrees → cbb-worktree-push}/scripts/push-worktrees.js +7 -5
  55. package/config/workspace-config.sample.json +18 -0
  56. package/config/workspaces.json +11 -6
  57. package/openspec/.version +6 -6
  58. package/openspec/commands/apply.md +7 -7
  59. package/openspec/commands/archive.md +7 -7
  60. package/openspec/commands/bulk-archive.md +7 -7
  61. package/openspec/commands/continue.md +7 -7
  62. package/openspec/commands/explore.md +7 -7
  63. package/openspec/commands/ff.md +7 -7
  64. package/openspec/commands/new.md +7 -7
  65. package/openspec/commands/onboard.md +7 -7
  66. package/openspec/commands/propose.md +7 -7
  67. package/openspec/commands/sync.md +7 -7
  68. package/openspec/commands/update.md +7 -7
  69. package/openspec/commands/verify.md +7 -7
  70. package/openspec/skills/openspec-apply-change/SKILL.md +187 -187
  71. package/openspec/skills/openspec-archive-change/SKILL.md +181 -181
  72. package/openspec/skills/openspec-bulk-archive-change/SKILL.md +338 -338
  73. package/openspec/skills/openspec-continue-change/SKILL.md +117 -117
  74. package/openspec/skills/openspec-explore/SKILL.md +342 -342
  75. package/openspec/skills/openspec-ff-change/SKILL.md +116 -116
  76. package/openspec/skills/openspec-new-change/SKILL.md +76 -76
  77. package/openspec/skills/openspec-onboard/SKILL.md +560 -560
  78. package/openspec/skills/openspec-propose/SKILL.md +162 -162
  79. package/openspec/skills/openspec-sync-specs/SKILL.md +261 -261
  80. package/openspec/skills/openspec-update-change/SKILL.md +90 -90
  81. package/openspec/skills/openspec-verify-change/SKILL.md +174 -174
  82. package/package.json +4 -3
  83. package/superpowers/.version +6 -6
  84. package/superpowers/skills/brainstorming/SKILL.md +250 -250
  85. package/superpowers/skills/brainstorming/scripts/helper.js +167 -167
  86. package/superpowers/skills/brainstorming/scripts/start-server.sh +209 -209
  87. package/superpowers/skills/brainstorming/scripts/stop-server.sh +120 -120
  88. package/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -49
  89. package/superpowers/skills/brainstorming/visual-companion.md +299 -299
  90. package/superpowers/skills/dispatching-parallel-agents/SKILL.md +167 -167
  91. package/superpowers/skills/executing-plans/SKILL.md +64 -64
  92. package/superpowers/skills/finishing-a-development-branch/SKILL.md +225 -225
  93. package/superpowers/skills/receiving-code-review/SKILL.md +205 -205
  94. package/superpowers/skills/requesting-code-review/SKILL.md +95 -95
  95. package/superpowers/skills/requesting-code-review/code-reviewer.md +181 -181
  96. package/superpowers/skills/subagent-driven-development/SKILL.md +568 -568
  97. package/superpowers/skills/subagent-driven-development/implementer-prompt.md +154 -154
  98. package/superpowers/skills/subagent-driven-development/re-review-prompt.md +115 -115
  99. package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +207 -207
  100. package/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -119
  101. package/superpowers/skills/systematic-debugging/SKILL.md +283 -283
  102. package/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -158
  103. package/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -115
  104. package/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -122
  105. package/superpowers/skills/systematic-debugging/find-polluter.sh +72 -72
  106. package/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -169
  107. package/superpowers/skills/systematic-debugging/test-academic.md +14 -14
  108. package/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -58
  109. package/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -68
  110. package/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -69
  111. package/superpowers/skills/test-driven-development/SKILL.md +320 -320
  112. package/superpowers/skills/test-driven-development/writing-good-tests.md +198 -198
  113. package/superpowers/skills/using-git-worktrees/SKILL.md +167 -167
  114. package/superpowers/skills/using-superpowers/SKILL.md +63 -63
  115. package/superpowers/skills/using-superpowers/references/antigravity-tools.md +23 -23
  116. package/superpowers/skills/using-superpowers/references/codex-tools.md +108 -108
  117. package/superpowers/skills/using-superpowers/references/gemini-tools.md +63 -63
  118. package/superpowers/skills/using-superpowers/references/hermes-tools.md +56 -56
  119. package/superpowers/skills/using-superpowers/references/pi-tools.md +16 -16
  120. package/superpowers/skills/verification-before-completion/SKILL.md +120 -120
  121. package/superpowers/skills/writing-plans/SKILL.md +171 -171
  122. package/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -49
  123. package/superpowers/skills/writing-skills/SKILL.md +679 -679
  124. package/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -1150
  125. package/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -189
  126. package/superpowers/skills/writing-skills/persuasion-principles.md +187 -187
  127. package/superpowers/skills/writing-skills/render-graphs.js +169 -169
  128. package/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -384
  129. package/cbb/worktrees/commands/extend.md +0 -65
  130. package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-target-worktree.js +0 -96
  131. package/cbb/worktrees/skills/openspec-extend-worktree/SKILL.md +0 -390
  132. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-env.js +0 -95
  133. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-repos.js +0 -98
  134. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/create-branches-and-worktrees.js +0 -135
  135. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/install-ai.js +0 -150
  136. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/list-available-apps.js +0 -88
  137. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/sync-repos.js +0 -93
  138. package/cbb/worktrees/skills/openspec-init-worktree/scripts/find-workspace-root.js +0 -67
  139. package/cbb/worktrees/skills/openspec-init-worktree/scripts/generate-app-options.js +0 -93
  140. package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-core.js +0 -136
  141. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/silence-popup.js +0 -23
  142. package/config/config.sample.json +0 -16
  143. /package/cbb/worktrees/skills/{openspec-close-worktree → cbb-worktree-close}/scripts/silence-popup.js +0 -0
  144. /package/cbb/worktrees/skills/{openspec-extend-worktree → cbb-worktree-init}/scripts/silence-popup.js +0 -0
  145. /package/cbb/worktrees/skills/{openspec-init-worktree → cbb-worktree-push}/scripts/silence-popup.js +0 -0
@@ -1,338 +1,338 @@
1
- ---
2
- name: openspec-bulk-archive-change
3
- description: Archive multiple completed changes at once. Use when archiving several parallel changes.
4
- allowed-tools: Bash(openspec:*)
5
- license: MIT
6
- compatibility: Requires openspec CLI.
7
- metadata:
8
- author: openspec
9
- version: "1.0"
10
- ---
11
-
12
- Archive multiple completed changes in a single operation.
13
-
14
- This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
15
-
16
- **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
17
-
18
- `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
19
-
20
- **Input**: None required (prompts for selection)
21
-
22
- **Steps**
23
-
24
- 1. **Get active changes**
25
-
26
- Run `openspec list --json` to get all active changes.
27
-
28
- If no active changes exist, inform user and stop.
29
-
30
- 2. **Prompt for change selection**
31
-
32
- Ask the user to choose changes (multi-select):
33
- - Show each change with its schema
34
- - Include an option for "All changes"
35
- - Allow any number of selections (1+ works, 2+ is the typical use case)
36
-
37
- **IMPORTANT**: Do NOT auto-select. Always let the user choose.
38
-
39
- **Load current archive inputs once for the selected root before batch validation:**
40
-
41
- Choose one selected change from this root and run
42
- `openspec instructions archive --change "<selected-change>" --json` with the
43
- same selected-root flags. This lookup is advisory and optional: it only supplies
44
- extra prompt inputs, so it must never block the batch. If it fails or returns
45
- invalid JSON — for example on an older CLI that does not support this command
46
- yet — continue the batch with no context and no operation guidance. Do not
47
- report an error and do not stop.
48
-
49
- A valid response may omit `context` and `operationGuidance`. Treat
50
- `context` as a required prompt-level input across the batch: read and consider
51
- it, and apply relevant project facts, conventions, and constraints. Treat
52
- `operationGuidance` as optional additive advice: read and consider every
53
- entry, and follow entries that are applicable and compatible with the built-in
54
- batch workflow.
55
-
56
- Keep both fields separate from conflict analysis, explicit user choices,
57
- resolved paths, CLI checks, and command contracts. If context conflicts with one
58
- of those controlling inputs, report the conflict and preserve the controlling
59
- value. If guidance is inapplicable or conflicts with a controlling input, do not
60
- follow it and explain why. Do not infer skipped prompts, replacement paths, or
61
- flags from either field, and do not copy their text verbatim into specs, changes,
62
- or summaries. These are prompt-level behavior contracts, not enforceable checks.
63
-
64
- 3. **Batch validation - gather status for all selected changes**
65
-
66
- For each selected change, collect:
67
-
68
- a. **Artifact status** - Run `openspec status --change "<name>" --json`
69
- - Parse `schemaName`, `artifacts`, `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`
70
- - Note which artifacts are `done` vs other states
71
-
72
- b. **Task completion** - Read `artifactPaths.tasks.existingOutputPaths` from status JSON
73
- - Count `- [ ]` (incomplete) vs `- [x]` (complete)
74
- - If no tasks file exists, note as "No tasks"
75
-
76
- c. **Delta specs** - Check `artifactPaths.specs.existingOutputPaths` from status JSON
77
- - List which capability specs exist
78
- - For each, extract requirement names (lines matching `### Requirement: <name>`)
79
- - Treat this list as the only delta-spec source. If the `specs` entry is
80
- missing or the list is empty, perform no spec sync or specs-instruction
81
- lookup for that change; do not infer deltas from unrelated artifacts.
82
- - Evaluate this independently for every change, including mixed-schema
83
- batches where some schemas have no `specs` artifact.
84
- 4. **Detect spec conflicts**
85
-
86
- Build a map keyed by `<capability-path>`, the exact path relative to `specs/`:
87
-
88
- ```text
89
- identity/user-auth -> [change-a, change-b] <- CONFLICT (2+ changes)
90
- billing/user-auth -> [change-c] <- OK (different full path)
91
- ```
92
-
93
- A conflict exists when 2+ selected changes have delta specs for the exact same `<capability-path>`.
94
-
95
- 5. **Resolve conflicts agentically**
96
-
97
- **For each conflict**, investigate the codebase:
98
-
99
- a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
100
-
101
- b. **Search the codebase** for implementation evidence:
102
- - Look for code implementing requirements from each delta spec
103
- - Check for related files, functions, or tests
104
-
105
- c. **Determine resolution**:
106
- - If only one change is actually implemented -> sync that one's specs
107
- - If both implemented -> apply in chronological order (older first, newer overwrites)
108
- - If neither implemented -> skip spec sync, warn user
109
-
110
- d. **Record resolution** for each conflict:
111
- - An inclusion or exclusion decision for every delta spec, keyed by change and `<capability-path>`
112
- - Which included delta specs to apply and in what order
113
- - Which delta specs to exclude from sync because their implementation is missing
114
- - Rationale (what was found in codebase)
115
-
116
- 6. **Show consolidated status table**
117
-
118
- Display a table summarizing all changes:
119
-
120
- ```markdown
121
- | Change | Artifacts | Tasks | Specs | Conflicts | Status |
122
- |---------------------|-----------|-------|---------|-----------|--------|
123
- | schema-management | Done | 5/5 | 2 delta | None | Ready |
124
- | project-config | Done | 3/3 | 1 delta | None | Ready |
125
- | add-oauth | Done | 4/4 | 1 delta | identity/user-auth (!) | Ready* |
126
- | add-verify-skill | 1 left | 2/5 | None | None | Warn |
127
- ```
128
-
129
- For conflicts, show the resolution:
130
- ```text
131
- * Conflict resolution:
132
- - identity/user-auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
133
- ```
134
-
135
- For incomplete changes, show warnings:
136
- ```text
137
- Warnings:
138
- - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
139
- ```
140
-
141
- 7. **Confirm batch operation**
142
-
143
- Ask the user a single confirmation question:
144
-
145
- - "Archive N changes?" with options based on status
146
- - Options might include:
147
- - "Archive all N changes"
148
- - "Archive only N ready changes (skip incomplete)"
149
- - "Cancel"
150
-
151
- If there are incomplete changes, make clear they'll be archived with warnings.
152
-
153
- Route on the answer by intent, not by exact label — you wrote these labels,
154
- so match what the user picked rather than the wording above:
155
- - "Cancel" — stop, do not archive. Report that nothing was archived and skip the remaining steps.
156
- - The archive-everything option — proceed with every selected change
157
- - The ready-only option — proceed with only the changes the step 6 table marks `Ready` or `Ready*`, and record the rest as Skipped in step 8d. If a `Ready*` change's conflict partner is skipped, re-derive that conflict's resolution using only the changes being archived.
158
- - Anything else — ask again rather than archiving
159
-
160
- Before step 8 writes the first main spec or moves any change, fetch every
161
- required specs-rule snapshot for the confirmed batch. For each change that will
162
- sync concrete `artifactPaths.specs.existingOutputPaths`, run
163
- `openspec instructions specs --change "<name>" --json` exactly once with the
164
- same selected-root flags. Obtain all snapshots before the first write or move.
165
- If any lookup exits non-zero or returns invalid artifact-instruction JSON,
166
- identify the affected change, report the error, and stop the whole batch before
167
- any main-spec write or change move. Do not treat lookup failure as omitted
168
- rules. A valid response without `rules` is the no-rules case.
169
-
170
- 8. **Execute archive for each confirmed change**
171
-
172
- Before processing, carry the recorded decisions from step 5 (after any step 7 re-derivation) into two per-delta sets:
173
- - `includedDeltas`: all non-conflicting delta specs from confirmed changes plus conflict deltas selected for sync
174
- - `excludedDeltas`: conflict deltas from confirmed changes excluded because their implementation is missing
175
- - A single change can have both included and excluded delta specs. Keep the decision per delta; do not collapse it into a per-change sync flag.
176
-
177
- Process changes in the determined order (respecting conflict resolution):
178
-
179
- a. **Sync included delta specs**:
180
- - Run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) only for changes with entries in `includedDeltas`, passing only the included delta paths and explicitly instructing it to ignore that change's `excludedDeltas`. Wait for it to finish.
181
- - For conflicts, apply in resolved order.
182
- - Pass that change's fetched specs-rule snapshot into inline sync; inline
183
- sync must reuse it without fetching instructions again
184
- - Apply artifact rules only to main specs produced by that change. They do
185
- not change conflict resolution, archive behavior, or CLI contracts, and
186
- their text is not copied into an output file
187
- - Do not delegate to a background task — step 8c would move `changeRoot` out from under a sync that is still reading it.
188
- - If a change has no included delta specs, do not run the sync workflow for it.
189
-
190
- b. **Verify included delta specs before moving changeRoot**:
191
- - Re-run the comparison only for delta specs in `includedDeltas` against main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 3 status JSON, not a hardcoded repo path).
192
- - Verify that main specs are updated:
193
- - ADDED requirements present
194
- - MODIFIED requirements carrying scenario and description changes named in the delta, with their other scenarios intact
195
- - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
196
- - RENAMED requirements present under the new name and absent under the old one
197
- - Do not verify delta specs in `excludedDeltas`; they are intentionally left unsynced.
198
- - If sync failed or any capability does not match verification, report what differs and fail/skip moving that change's `changeRoot` — do not archive that change. `changeRoot` remains intact.
199
-
200
- c. **Perform the archive**:
201
-
202
- Target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<name>` (same rule as `openspec archive`).
203
-
204
- ```bash
205
- mkdir -p "<planningHome.changesDir>/archive"
206
- mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
207
- ```
208
-
209
- d. **Track outcome** for each change:
210
- - Success: archived successfully
211
- - Failed: error during archive or spec verification (record error)
212
- - Skipped: user chose not to archive (if applicable)
213
- - Sync skipped: for every delta in `excludedDeltas`, report `sync skipped` with the change, `<capability-path>`, and recorded reason. This is distinct from skipping the archive.
214
-
215
- 9. **Display summary**
216
-
217
- Show final results:
218
-
219
- ```markdown
220
- ## Bulk Archive Complete
221
-
222
- Archived 3 changes:
223
- - schema-management-cli -> archive/2026-01-19-schema-management-cli/
224
- - project-config -> archive/2026-01-19-project-config/
225
- - add-oauth -> archive/2026-01-19-add-oauth/
226
-
227
- Skipped 1 change:
228
- - add-verify-skill (user chose not to archive incomplete)
229
-
230
- Spec sync summary:
231
- - 4 delta specs synced to main specs
232
- - 1 delta spec sync skipped (add-jwt, identity/user-auth: implementation not found)
233
- - 1 conflict resolved (identity/user-auth: synced add-oauth, skipped add-jwt)
234
- ```
235
-
236
- If any failures:
237
- ```text
238
- Failed 1 change:
239
- - some-change: Archive directory already exists
240
- ```
241
-
242
- **Conflict Resolution Examples**
243
-
244
- Example 1: Only one implemented
245
- ```text
246
- Conflict: <planningHome.root>/openspec/specs/auth/spec.md touched by [add-oauth, add-jwt]
247
-
248
- Checking add-oauth:
249
- - Delta adds "OAuth Provider Integration" requirement
250
- - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
251
-
252
- Checking add-jwt:
253
- - Delta adds "JWT Token Handling" requirement
254
- - Searching codebase... no JWT implementation found
255
-
256
- Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
257
- ```
258
-
259
- Example 2: Both implemented
260
- ```text
261
- Conflict: <planningHome.root>/openspec/specs/api/spec.md touched by [add-rest-api, add-graphql]
262
-
263
- Checking add-rest-api (created 2026-01-10):
264
- - Delta adds "REST Endpoints" requirement
265
- - Searching codebase... found src/api/rest.ts
266
-
267
- Checking add-graphql (created 2026-01-15):
268
- - Delta adds "GraphQL Schema" requirement
269
- - Searching codebase... found src/api/graphql.ts
270
-
271
- Resolution: Both implemented. Will apply add-rest-api specs first,
272
- then add-graphql specs (chronological order, newer takes precedence).
273
- ```
274
-
275
- **Output On Success**
276
-
277
- ```markdown
278
- ## Bulk Archive Complete
279
-
280
- Archived N changes:
281
- - <change-1> -> archive/<target-name-1>/
282
- - <change-2> -> archive/<target-name-2>/
283
-
284
- Spec sync summary:
285
- - N delta specs synced to main specs
286
- - No conflicts (or: M conflicts resolved)
287
- ```
288
-
289
- **Output On Partial Success**
290
-
291
- ```markdown
292
- ## Bulk Archive Complete (partial)
293
-
294
- Archived N changes:
295
- - <change-1> -> archive/<target-name-1>/
296
-
297
- Skipped M changes:
298
- - <change-2> (user chose not to archive incomplete)
299
-
300
- Failed K changes:
301
- - <change-3>: Archive directory already exists
302
- ```
303
-
304
- **Output When No Changes**
305
-
306
- ```markdown
307
- ## No Changes to Archive
308
-
309
- No active changes found. Create a new change to get started.
310
- ```
311
-
312
- **Guardrails**
313
- - Allow any number of changes (1+ is fine, 2+ is the typical use case)
314
- - Always prompt for selection, never auto-select
315
- - Detect spec conflicts early and resolve by checking codebase
316
- - When both changes are implemented, apply specs in chronological order
317
- - Skip spec sync only when implementation is missing (warn user)
318
- - Show clear per-change status before confirming
319
- - Use single confirmation for entire batch
320
- - Never archive after the user cancels the confirmation — a cancelled batch archives nothing
321
- - Track and report all outcomes (success/skip/fail)
322
- - Preserve .openspec.yaml when moving to archive
323
- - Archive directory target uses current date: YYYY-MM-DD-<name>; a name that already starts with a `YYYY-MM-DD-` prefix is used as-is (never stack a second date)
324
- - If archive target exists, fail that change but continue with others
325
- - If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven) for each change with included delta specs
326
- - Carry the per-delta `includedDeltas` and `excludedDeltas` decisions into execution; sync and verify only included deltas
327
- - Report every excluded delta as `sync skipped` without treating the archive itself as skipped
328
- - Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` before moving `changeRoot`
329
- - Fetch archive inputs once per selected root before spec inspection or moves
330
- - Fetch all required specs-rule snapshots before the batch's first main-spec write or move
331
- - A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
332
- - A failed specs instruction lookup stops the whole batch atomically
333
- - Changes without concrete `artifactPaths.specs.existingOutputPaths` continue without spec sync
334
- - Apply relevant runtime context across the batch and report conflicts
335
- - Operation guidance remains advisory; consider every entry and explain rejected advice
336
- - Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
337
- - Artifact rules constrain only written specs
338
- - Never copy runtime input or artifact-rule text verbatim into output files
1
+ ---
2
+ name: openspec-bulk-archive-change
3
+ description: Archive multiple completed changes at once. Use when archiving several parallel changes.
4
+ allowed-tools: Bash(openspec:*)
5
+ license: MIT
6
+ compatibility: Requires openspec CLI.
7
+ metadata:
8
+ author: openspec
9
+ version: "1.0"
10
+ ---
11
+
12
+ Archive multiple completed changes in a single operation.
13
+
14
+ This skill allows you to batch-archive changes, handling spec conflicts intelligently by checking the codebase to determine what's actually implemented.
15
+
16
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
17
+
18
+ `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve the full path from each delta spec when resolving its main spec.
19
+
20
+ **Input**: None required (prompts for selection)
21
+
22
+ **Steps**
23
+
24
+ 1. **Get active changes**
25
+
26
+ Run `openspec list --json` to get all active changes.
27
+
28
+ If no active changes exist, inform user and stop.
29
+
30
+ 2. **Prompt for change selection**
31
+
32
+ Ask the user to choose changes (multi-select):
33
+ - Show each change with its schema
34
+ - Include an option for "All changes"
35
+ - Allow any number of selections (1+ works, 2+ is the typical use case)
36
+
37
+ **IMPORTANT**: Do NOT auto-select. Always let the user choose.
38
+
39
+ **Load current archive inputs once for the selected root before batch validation:**
40
+
41
+ Choose one selected change from this root and run
42
+ `openspec instructions archive --change "<selected-change>" --json` with the
43
+ same selected-root flags. This lookup is advisory and optional: it only supplies
44
+ extra prompt inputs, so it must never block the batch. If it fails or returns
45
+ invalid JSON — for example on an older CLI that does not support this command
46
+ yet — continue the batch with no context and no operation guidance. Do not
47
+ report an error and do not stop.
48
+
49
+ A valid response may omit `context` and `operationGuidance`. Treat
50
+ `context` as a required prompt-level input across the batch: read and consider
51
+ it, and apply relevant project facts, conventions, and constraints. Treat
52
+ `operationGuidance` as optional additive advice: read and consider every
53
+ entry, and follow entries that are applicable and compatible with the built-in
54
+ batch workflow.
55
+
56
+ Keep both fields separate from conflict analysis, explicit user choices,
57
+ resolved paths, CLI checks, and command contracts. If context conflicts with one
58
+ of those controlling inputs, report the conflict and preserve the controlling
59
+ value. If guidance is inapplicable or conflicts with a controlling input, do not
60
+ follow it and explain why. Do not infer skipped prompts, replacement paths, or
61
+ flags from either field, and do not copy their text verbatim into specs, changes,
62
+ or summaries. These are prompt-level behavior contracts, not enforceable checks.
63
+
64
+ 3. **Batch validation - gather status for all selected changes**
65
+
66
+ For each selected change, collect:
67
+
68
+ a. **Artifact status** - Run `openspec status --change "<name>" --json`
69
+ - Parse `schemaName`, `artifacts`, `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`
70
+ - Note which artifacts are `done` vs other states
71
+
72
+ b. **Task completion** - Read `artifactPaths.tasks.existingOutputPaths` from status JSON
73
+ - Count `- [ ]` (incomplete) vs `- [x]` (complete)
74
+ - If no tasks file exists, note as "No tasks"
75
+
76
+ c. **Delta specs** - Check `artifactPaths.specs.existingOutputPaths` from status JSON
77
+ - List which capability specs exist
78
+ - For each, extract requirement names (lines matching `### Requirement: <name>`)
79
+ - Treat this list as the only delta-spec source. If the `specs` entry is
80
+ missing or the list is empty, perform no spec sync or specs-instruction
81
+ lookup for that change; do not infer deltas from unrelated artifacts.
82
+ - Evaluate this independently for every change, including mixed-schema
83
+ batches where some schemas have no `specs` artifact.
84
+ 4. **Detect spec conflicts**
85
+
86
+ Build a map keyed by `<capability-path>`, the exact path relative to `specs/`:
87
+
88
+ ```text
89
+ identity/user-auth -> [change-a, change-b] <- CONFLICT (2+ changes)
90
+ billing/user-auth -> [change-c] <- OK (different full path)
91
+ ```
92
+
93
+ A conflict exists when 2+ selected changes have delta specs for the exact same `<capability-path>`.
94
+
95
+ 5. **Resolve conflicts agentically**
96
+
97
+ **For each conflict**, investigate the codebase:
98
+
99
+ a. **Read the delta specs** from each conflicting change to understand what each claims to add/modify
100
+
101
+ b. **Search the codebase** for implementation evidence:
102
+ - Look for code implementing requirements from each delta spec
103
+ - Check for related files, functions, or tests
104
+
105
+ c. **Determine resolution**:
106
+ - If only one change is actually implemented -> sync that one's specs
107
+ - If both implemented -> apply in chronological order (older first, newer overwrites)
108
+ - If neither implemented -> skip spec sync, warn user
109
+
110
+ d. **Record resolution** for each conflict:
111
+ - An inclusion or exclusion decision for every delta spec, keyed by change and `<capability-path>`
112
+ - Which included delta specs to apply and in what order
113
+ - Which delta specs to exclude from sync because their implementation is missing
114
+ - Rationale (what was found in codebase)
115
+
116
+ 6. **Show consolidated status table**
117
+
118
+ Display a table summarizing all changes:
119
+
120
+ ```markdown
121
+ | Change | Artifacts | Tasks | Specs | Conflicts | Status |
122
+ |---------------------|-----------|-------|---------|-----------|--------|
123
+ | schema-management | Done | 5/5 | 2 delta | None | Ready |
124
+ | project-config | Done | 3/3 | 1 delta | None | Ready |
125
+ | add-oauth | Done | 4/4 | 1 delta | identity/user-auth (!) | Ready* |
126
+ | add-verify-skill | 1 left | 2/5 | None | None | Warn |
127
+ ```
128
+
129
+ For conflicts, show the resolution:
130
+ ```text
131
+ * Conflict resolution:
132
+ - identity/user-auth spec: Will apply add-oauth then add-jwt (both implemented, chronological order)
133
+ ```
134
+
135
+ For incomplete changes, show warnings:
136
+ ```text
137
+ Warnings:
138
+ - add-verify-skill: 1 incomplete artifact, 3 incomplete tasks
139
+ ```
140
+
141
+ 7. **Confirm batch operation**
142
+
143
+ Ask the user a single confirmation question:
144
+
145
+ - "Archive N changes?" with options based on status
146
+ - Options might include:
147
+ - "Archive all N changes"
148
+ - "Archive only N ready changes (skip incomplete)"
149
+ - "Cancel"
150
+
151
+ If there are incomplete changes, make clear they'll be archived with warnings.
152
+
153
+ Route on the answer by intent, not by exact label — you wrote these labels,
154
+ so match what the user picked rather than the wording above:
155
+ - "Cancel" — stop, do not archive. Report that nothing was archived and skip the remaining steps.
156
+ - The archive-everything option — proceed with every selected change
157
+ - The ready-only option — proceed with only the changes the step 6 table marks `Ready` or `Ready*`, and record the rest as Skipped in step 8d. If a `Ready*` change's conflict partner is skipped, re-derive that conflict's resolution using only the changes being archived.
158
+ - Anything else — ask again rather than archiving
159
+
160
+ Before step 8 writes the first main spec or moves any change, fetch every
161
+ required specs-rule snapshot for the confirmed batch. For each change that will
162
+ sync concrete `artifactPaths.specs.existingOutputPaths`, run
163
+ `openspec instructions specs --change "<name>" --json` exactly once with the
164
+ same selected-root flags. Obtain all snapshots before the first write or move.
165
+ If any lookup exits non-zero or returns invalid artifact-instruction JSON,
166
+ identify the affected change, report the error, and stop the whole batch before
167
+ any main-spec write or change move. Do not treat lookup failure as omitted
168
+ rules. A valid response without `rules` is the no-rules case.
169
+
170
+ 8. **Execute archive for each confirmed change**
171
+
172
+ Before processing, carry the recorded decisions from step 5 (after any step 7 re-derivation) into two per-delta sets:
173
+ - `includedDeltas`: all non-conflicting delta specs from confirmed changes plus conflict deltas selected for sync
174
+ - `excludedDeltas`: conflict deltas from confirmed changes excluded because their implementation is missing
175
+ - A single change can have both included and excluded delta specs. Keep the decision per delta; do not collapse it into a per-change sync flag.
176
+
177
+ Process changes in the determined order (respecting conflict resolution):
178
+
179
+ a. **Sync included delta specs**:
180
+ - Run the `openspec-sync-specs` workflow inline (agent-driven intelligent merge) only for changes with entries in `includedDeltas`, passing only the included delta paths and explicitly instructing it to ignore that change's `excludedDeltas`. Wait for it to finish.
181
+ - For conflicts, apply in resolved order.
182
+ - Pass that change's fetched specs-rule snapshot into inline sync; inline
183
+ sync must reuse it without fetching instructions again
184
+ - Apply artifact rules only to main specs produced by that change. They do
185
+ not change conflict resolution, archive behavior, or CLI contracts, and
186
+ their text is not copied into an output file
187
+ - Do not delegate to a background task — step 8c would move `changeRoot` out from under a sync that is still reading it.
188
+ - If a change has no included delta specs, do not run the sync workflow for it.
189
+
190
+ b. **Verify included delta specs before moving changeRoot**:
191
+ - Re-run the comparison only for delta specs in `includedDeltas` against main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 3 status JSON, not a hardcoded repo path).
192
+ - Verify that main specs are updated:
193
+ - ADDED requirements present
194
+ - MODIFIED requirements carrying scenario and description changes named in the delta, with their other scenarios intact
195
+ - REMOVED requirements gone — and where this sync retired a capability (removed its last requirement, leaving `## Requirements` empty), its main spec deleted rather than left empty; a spec the sync deliberately kept and reported is also a match
196
+ - RENAMED requirements present under the new name and absent under the old one
197
+ - Do not verify delta specs in `excludedDeltas`; they are intentionally left unsynced.
198
+ - If sync failed or any capability does not match verification, report what differs and fail/skip moving that change's `changeRoot` — do not archive that change. `changeRoot` remains intact.
199
+
200
+ c. **Perform the archive**:
201
+
202
+ Target name: use the change name as-is when it already starts with a `YYYY-MM-DD-` prefix; otherwise prepend the current date as `YYYY-MM-DD-<name>` (same rule as `openspec archive`).
203
+
204
+ ```bash
205
+ mkdir -p "<planningHome.changesDir>/archive"
206
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
207
+ ```
208
+
209
+ d. **Track outcome** for each change:
210
+ - Success: archived successfully
211
+ - Failed: error during archive or spec verification (record error)
212
+ - Skipped: user chose not to archive (if applicable)
213
+ - Sync skipped: for every delta in `excludedDeltas`, report `sync skipped` with the change, `<capability-path>`, and recorded reason. This is distinct from skipping the archive.
214
+
215
+ 9. **Display summary**
216
+
217
+ Show final results:
218
+
219
+ ```markdown
220
+ ## Bulk Archive Complete
221
+
222
+ Archived 3 changes:
223
+ - schema-management-cli -> archive/2026-01-19-schema-management-cli/
224
+ - project-config -> archive/2026-01-19-project-config/
225
+ - add-oauth -> archive/2026-01-19-add-oauth/
226
+
227
+ Skipped 1 change:
228
+ - add-verify-skill (user chose not to archive incomplete)
229
+
230
+ Spec sync summary:
231
+ - 4 delta specs synced to main specs
232
+ - 1 delta spec sync skipped (add-jwt, identity/user-auth: implementation not found)
233
+ - 1 conflict resolved (identity/user-auth: synced add-oauth, skipped add-jwt)
234
+ ```
235
+
236
+ If any failures:
237
+ ```text
238
+ Failed 1 change:
239
+ - some-change: Archive directory already exists
240
+ ```
241
+
242
+ **Conflict Resolution Examples**
243
+
244
+ Example 1: Only one implemented
245
+ ```text
246
+ Conflict: <planningHome.root>/openspec/specs/auth/spec.md touched by [add-oauth, add-jwt]
247
+
248
+ Checking add-oauth:
249
+ - Delta adds "OAuth Provider Integration" requirement
250
+ - Searching codebase... found src/auth/oauth.ts implementing OAuth flow
251
+
252
+ Checking add-jwt:
253
+ - Delta adds "JWT Token Handling" requirement
254
+ - Searching codebase... no JWT implementation found
255
+
256
+ Resolution: Only add-oauth is implemented. Will sync add-oauth specs only.
257
+ ```
258
+
259
+ Example 2: Both implemented
260
+ ```text
261
+ Conflict: <planningHome.root>/openspec/specs/api/spec.md touched by [add-rest-api, add-graphql]
262
+
263
+ Checking add-rest-api (created 2026-01-10):
264
+ - Delta adds "REST Endpoints" requirement
265
+ - Searching codebase... found src/api/rest.ts
266
+
267
+ Checking add-graphql (created 2026-01-15):
268
+ - Delta adds "GraphQL Schema" requirement
269
+ - Searching codebase... found src/api/graphql.ts
270
+
271
+ Resolution: Both implemented. Will apply add-rest-api specs first,
272
+ then add-graphql specs (chronological order, newer takes precedence).
273
+ ```
274
+
275
+ **Output On Success**
276
+
277
+ ```markdown
278
+ ## Bulk Archive Complete
279
+
280
+ Archived N changes:
281
+ - <change-1> -> archive/<target-name-1>/
282
+ - <change-2> -> archive/<target-name-2>/
283
+
284
+ Spec sync summary:
285
+ - N delta specs synced to main specs
286
+ - No conflicts (or: M conflicts resolved)
287
+ ```
288
+
289
+ **Output On Partial Success**
290
+
291
+ ```markdown
292
+ ## Bulk Archive Complete (partial)
293
+
294
+ Archived N changes:
295
+ - <change-1> -> archive/<target-name-1>/
296
+
297
+ Skipped M changes:
298
+ - <change-2> (user chose not to archive incomplete)
299
+
300
+ Failed K changes:
301
+ - <change-3>: Archive directory already exists
302
+ ```
303
+
304
+ **Output When No Changes**
305
+
306
+ ```markdown
307
+ ## No Changes to Archive
308
+
309
+ No active changes found. Create a new change to get started.
310
+ ```
311
+
312
+ **Guardrails**
313
+ - Allow any number of changes (1+ is fine, 2+ is the typical use case)
314
+ - Always prompt for selection, never auto-select
315
+ - Detect spec conflicts early and resolve by checking codebase
316
+ - When both changes are implemented, apply specs in chronological order
317
+ - Skip spec sync only when implementation is missing (warn user)
318
+ - Show clear per-change status before confirming
319
+ - Use single confirmation for entire batch
320
+ - Never archive after the user cancels the confirmation — a cancelled batch archives nothing
321
+ - Track and report all outcomes (success/skip/fail)
322
+ - Preserve .openspec.yaml when moving to archive
323
+ - Archive directory target uses current date: YYYY-MM-DD-<name>; a name that already starts with a `YYYY-MM-DD-` prefix is used as-is (never stack a second date)
324
+ - If archive target exists, fail that change but continue with others
325
+ - If sync is requested, run the `openspec-sync-specs` workflow inline (agent-driven) for each change with included delta specs
326
+ - Carry the per-delta `includedDeltas` and `excludedDeltas` decisions into execution; sync and verify only included deltas
327
+ - Report every excluded delta as `sync skipped` without treating the archive itself as skipped
328
+ - Never archive a change while a spec sync is still in flight — run the sync inline and verify main specs at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` before moving `changeRoot`
329
+ - Fetch archive inputs once per selected root before spec inspection or moves
330
+ - Fetch all required specs-rule snapshots before the batch's first main-spec write or move
331
+ - A failed archive-inputs lookup never blocks the batch; it proceeds with no context or guidance
332
+ - A failed specs instruction lookup stops the whole batch atomically
333
+ - Changes without concrete `artifactPaths.specs.existingOutputPaths` continue without spec sync
334
+ - Apply relevant runtime context across the batch and report conflicts
335
+ - Operation guidance remains advisory; consider every entry and explain rejected advice
336
+ - Keep runtime inputs, conflict analysis, CLI-derived values, and artifact rules separate
337
+ - Artifact rules constrain only written specs
338
+ - Never copy runtime input or artifact-rule text verbatim into output files