@jspg-ai/coding-bb 0.0.1

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 (183) hide show
  1. package/README.md +41 -0
  2. package/cbb/dev-standards/rules/cbb-ai-behavior.md +104 -0
  3. package/cbb/dev-standards/rules/cbb-coding-rule.md +50 -0
  4. package/cbb/dev-standards/rules/cbb-priority.md +56 -0
  5. package/cbb/dev-standards/skills/architecture-specs/SKILL.md +129 -0
  6. package/cbb/dev-standards/skills/coding-specs/SKILL.md +376 -0
  7. package/cbb/dev-standards/skills/coding-specs/references/concurrency.md +53 -0
  8. package/cbb/dev-standards/skills/coding-specs/references/config-center.md +16 -0
  9. package/cbb/dev-standards/skills/coding-specs/references/distributed.md +42 -0
  10. package/cbb/dev-standards/skills/coding-specs/references/es-coding.md +60 -0
  11. package/cbb/dev-standards/skills/coding-specs/references/scheduled-task.md +25 -0
  12. package/cbb/dev-standards/skills/coding-specs/references/security.md +11 -0
  13. package/cbb/dev-standards/skills/coding-specs/references/unit-testing.md +43 -0
  14. package/cbb/dev-standards/skills/es-design-specs/SKILL.md +104 -0
  15. package/cbb/dev-standards/skills/mysql-design-specs/SKILL.md +89 -0
  16. package/cbb/lib/install/claude-code.js +20 -0
  17. package/cbb/lib/install/cleanup.js +64 -0
  18. package/cbb/lib/install/init.js +1875 -0
  19. package/cbb/lib/install/qoder.js +20 -0
  20. package/cbb/lib/install/workspaces.js +232 -0
  21. package/cbb/lib/openspec/index.js +554 -0
  22. package/cbb/lib/superpowers/index.js +265 -0
  23. package/cbb/lib/utils/check-update.js +147 -0
  24. package/cbb/lib/utils/checkbox.js +383 -0
  25. package/cbb/lib/utils/gitignore.js +69 -0
  26. package/cbb/lib/utils/output.js +64 -0
  27. package/cbb/lib/utils/settings.js +119 -0
  28. package/cbb/lib/utils/version.js +135 -0
  29. package/cbb/lib/wiki/api-client.js +358 -0
  30. package/cbb/lib/wiki/cli.js +427 -0
  31. package/cbb/lib/wiki/convert.js +464 -0
  32. package/cbb/lib/wiki/index.js +218 -0
  33. package/cbb/lib/wiki/mermaid-guard.js +103 -0
  34. package/cbb/lib/wiki/split.js +131 -0
  35. package/cbb/tools/cbb-decompile-jar/SKILL.md +220 -0
  36. package/cbb/tools/cbb-decompile-jar/scripts/decompile.py +863 -0
  37. package/cbb/tools/cbb-design-to-wiki/SKILL.md +180 -0
  38. package/cbb/tools/cbb-mvn-guide/SKILL.md +281 -0
  39. package/cbb/tools/cbb-mvn-guide/scripts/mvn_jdk_manager.py +378 -0
  40. package/cbb/tools/cbb-mvn-guide/scripts/mvn_pom_jdk_reader.py +197 -0
  41. package/cbb/tools/cbb-plantuml-authoring/SKILL.md +448 -0
  42. package/cbb/tools/cbb-plantuml-authoring/references/drawing-templates.md +479 -0
  43. package/cbb/tools/cbb-wiki-ops/SKILL.md +134 -0
  44. package/cbb/tools/cbb-wiki-ops/scripts/check-auth.js +44 -0
  45. package/cbb/worktrees/_shared/scripts/find-target-worktree.js +96 -0
  46. package/cbb/worktrees/_shared/scripts/find-workspace-root.js +67 -0
  47. package/cbb/worktrees/_shared/scripts/push-core.js +136 -0
  48. package/cbb/worktrees/_shared/scripts/silence-popup.js +23 -0
  49. package/cbb/worktrees/commands/close.md +64 -0
  50. package/cbb/worktrees/commands/extend.md +65 -0
  51. package/cbb/worktrees/commands/init.md +55 -0
  52. package/cbb/worktrees/commands/push.md +42 -0
  53. package/cbb/worktrees/skills/openspec-close-worktree/SKILL.md +449 -0
  54. package/cbb/worktrees/skills/openspec-close-worktree/scripts/check-env.js +76 -0
  55. package/cbb/worktrees/skills/openspec-close-worktree/scripts/check-unarchived.js +48 -0
  56. package/cbb/worktrees/skills/openspec-close-worktree/scripts/delete-branches.js +136 -0
  57. package/cbb/worktrees/skills/openspec-close-worktree/scripts/discover-apps.js +76 -0
  58. package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-target-worktree.js +96 -0
  59. package/cbb/worktrees/skills/openspec-close-worktree/scripts/find-workspace-root.js +67 -0
  60. package/cbb/worktrees/skills/openspec-close-worktree/scripts/remove-worktrees.js +124 -0
  61. package/cbb/worktrees/skills/openspec-close-worktree/scripts/safety-check.js +174 -0
  62. package/cbb/worktrees/skills/openspec-close-worktree/scripts/silence-popup.js +23 -0
  63. package/cbb/worktrees/skills/openspec-extend-worktree/SKILL.md +390 -0
  64. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-env.js +95 -0
  65. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/check-repos.js +98 -0
  66. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/create-branches-and-worktrees.js +135 -0
  67. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/find-target-worktree.js +96 -0
  68. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/find-workspace-root.js +67 -0
  69. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/install-ai.js +150 -0
  70. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/list-available-apps.js +88 -0
  71. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/push-core.js +136 -0
  72. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/silence-popup.js +23 -0
  73. package/cbb/worktrees/skills/openspec-extend-worktree/scripts/sync-repos.js +93 -0
  74. package/cbb/worktrees/skills/openspec-init-worktree/SKILL.md +539 -0
  75. package/cbb/worktrees/skills/openspec-init-worktree/scripts/auto-open.js +136 -0
  76. package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-env-deep.js +87 -0
  77. package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-env.js +90 -0
  78. package/cbb/worktrees/skills/openspec-init-worktree/scripts/check-repos.js +171 -0
  79. package/cbb/worktrees/skills/openspec-init-worktree/scripts/create-branches.js +103 -0
  80. package/cbb/worktrees/skills/openspec-init-worktree/scripts/create-worktrees.js +154 -0
  81. package/cbb/worktrees/skills/openspec-init-worktree/scripts/find-workspace-root.js +67 -0
  82. package/cbb/worktrees/skills/openspec-init-worktree/scripts/generate-app-options.js +93 -0
  83. package/cbb/worktrees/skills/openspec-init-worktree/scripts/install-ai.js +177 -0
  84. package/cbb/worktrees/skills/openspec-init-worktree/scripts/parse-config.js +67 -0
  85. package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-branches.js +101 -0
  86. package/cbb/worktrees/skills/openspec-init-worktree/scripts/push-core.js +136 -0
  87. package/cbb/worktrees/skills/openspec-init-worktree/scripts/silence-popup.js +23 -0
  88. package/cbb/worktrees/skills/openspec-init-worktree/scripts/sync-repos.js +95 -0
  89. package/cbb/worktrees/skills/openspec-init-worktree/scripts/update-gitignore.js +134 -0
  90. package/cbb/worktrees/skills/openspec-push-worktrees/SKILL.md +307 -0
  91. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/commit-worktrees.js +269 -0
  92. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/find-target-worktree.js +96 -0
  93. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/find-workspace-root.js +67 -0
  94. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/push-core.js +136 -0
  95. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/push-worktrees.js +159 -0
  96. package/cbb/worktrees/skills/openspec-push-worktrees/scripts/silence-popup.js +23 -0
  97. package/config/cbb.yaml +6 -0
  98. package/config/config.sample.json +16 -0
  99. package/config/openspec/config.yaml +28 -0
  100. package/config/openspec/schemas/spec-driven/schema.yaml +247 -0
  101. package/config/openspec/schemas/spec-driven/templates/design.md +475 -0
  102. package/config/openspec/schemas/spec-driven/templates/proposal.md +58 -0
  103. package/config/openspec/schemas/spec-driven/templates/spec.md +8 -0
  104. package/config/openspec/schemas/spec-driven/templates/tasks.md +9 -0
  105. package/config/workspaces.json +15 -0
  106. package/openspec/.version +6 -0
  107. package/openspec/commands/apply.md +182 -0
  108. package/openspec/commands/archive.md +223 -0
  109. package/openspec/commands/bulk-archive.md +334 -0
  110. package/openspec/commands/continue.md +112 -0
  111. package/openspec/commands/explore.md +206 -0
  112. package/openspec/commands/ff.md +111 -0
  113. package/openspec/commands/new.md +70 -0
  114. package/openspec/commands/onboard.md +555 -0
  115. package/openspec/commands/propose.md +157 -0
  116. package/openspec/commands/sync.md +256 -0
  117. package/openspec/commands/update.md +85 -0
  118. package/openspec/commands/verify.md +169 -0
  119. package/openspec/skills/openspec-apply-change/SKILL.md +187 -0
  120. package/openspec/skills/openspec-archive-change/SKILL.md +181 -0
  121. package/openspec/skills/openspec-bulk-archive-change/SKILL.md +338 -0
  122. package/openspec/skills/openspec-continue-change/SKILL.md +117 -0
  123. package/openspec/skills/openspec-explore/SKILL.md +342 -0
  124. package/openspec/skills/openspec-ff-change/SKILL.md +116 -0
  125. package/openspec/skills/openspec-new-change/SKILL.md +76 -0
  126. package/openspec/skills/openspec-onboard/SKILL.md +560 -0
  127. package/openspec/skills/openspec-propose/SKILL.md +162 -0
  128. package/openspec/skills/openspec-sync-specs/SKILL.md +261 -0
  129. package/openspec/skills/openspec-update-change/SKILL.md +90 -0
  130. package/openspec/skills/openspec-verify-change/SKILL.md +174 -0
  131. package/package.json +46 -0
  132. package/superpowers/.version +6 -0
  133. package/superpowers/skills/brainstorming/SKILL.md +250 -0
  134. package/superpowers/skills/brainstorming/scripts/frame-template.html +213 -0
  135. package/superpowers/skills/brainstorming/scripts/helper.js +167 -0
  136. package/superpowers/skills/brainstorming/scripts/server.cjs +723 -0
  137. package/superpowers/skills/brainstorming/scripts/start-server.sh +209 -0
  138. package/superpowers/skills/brainstorming/scripts/stop-server.sh +120 -0
  139. package/superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  140. package/superpowers/skills/brainstorming/visual-companion.md +299 -0
  141. package/superpowers/skills/dispatching-parallel-agents/SKILL.md +167 -0
  142. package/superpowers/skills/executing-plans/SKILL.md +64 -0
  143. package/superpowers/skills/finishing-a-development-branch/SKILL.md +225 -0
  144. package/superpowers/skills/receiving-code-review/SKILL.md +205 -0
  145. package/superpowers/skills/requesting-code-review/SKILL.md +95 -0
  146. package/superpowers/skills/requesting-code-review/code-reviewer.md +181 -0
  147. package/superpowers/skills/subagent-driven-development/SKILL.md +568 -0
  148. package/superpowers/skills/subagent-driven-development/implementer-prompt.md +154 -0
  149. package/superpowers/skills/subagent-driven-development/re-review-prompt.md +115 -0
  150. package/superpowers/skills/subagent-driven-development/scripts/review-package +46 -0
  151. package/superpowers/skills/subagent-driven-development/scripts/sdd-workspace +40 -0
  152. package/superpowers/skills/subagent-driven-development/scripts/task-brief +41 -0
  153. package/superpowers/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
  154. package/superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
  155. package/superpowers/skills/systematic-debugging/SKILL.md +283 -0
  156. package/superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  157. package/superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -0
  158. package/superpowers/skills/systematic-debugging/defense-in-depth.md +122 -0
  159. package/superpowers/skills/systematic-debugging/find-polluter.sh +72 -0
  160. package/superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -0
  161. package/superpowers/skills/systematic-debugging/test-academic.md +14 -0
  162. package/superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
  163. package/superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
  164. package/superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
  165. package/superpowers/skills/test-driven-development/SKILL.md +320 -0
  166. package/superpowers/skills/test-driven-development/writing-good-tests.md +198 -0
  167. package/superpowers/skills/using-git-worktrees/SKILL.md +167 -0
  168. package/superpowers/skills/using-superpowers/SKILL.md +63 -0
  169. package/superpowers/skills/using-superpowers/references/antigravity-tools.md +23 -0
  170. package/superpowers/skills/using-superpowers/references/codex-tools.md +108 -0
  171. package/superpowers/skills/using-superpowers/references/gemini-tools.md +63 -0
  172. package/superpowers/skills/using-superpowers/references/hermes-tools.md +56 -0
  173. package/superpowers/skills/using-superpowers/references/pi-tools.md +16 -0
  174. package/superpowers/skills/verification-before-completion/SKILL.md +120 -0
  175. package/superpowers/skills/writing-plans/SKILL.md +171 -0
  176. package/superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
  177. package/superpowers/skills/writing-skills/SKILL.md +679 -0
  178. package/superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
  179. package/superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  180. package/superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
  181. package/superpowers/skills/writing-skills/persuasion-principles.md +187 -0
  182. package/superpowers/skills/writing-skills/render-graphs.js +169 -0
  183. package/superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -0
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: "OPSX: Apply"
3
+ description: Implement tasks from an OpenSpec change (Experimental)
4
+ category: Workflow
5
+ tags: [workflow, artifacts, experimental]
6
+ ---
7
+ Implement tasks from an OpenSpec change.
8
+
9
+ **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`). 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.
10
+
11
+ **Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
12
+
13
+ **Steps**
14
+
15
+ 1. **Select the change**
16
+
17
+ If a name is provided, use it. Otherwise:
18
+ - Infer from conversation context if the user mentioned a change
19
+ - Auto-select if only one active change exists
20
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
21
+
22
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
23
+
24
+ 2. **Check status to understand the schema**
25
+ ```bash
26
+ openspec status --change "<name>" --json
27
+ ```
28
+ Parse the JSON to understand:
29
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
30
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
31
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
32
+
33
+ 3. **Get apply instructions**
34
+
35
+ ```bash
36
+ openspec instructions apply --change "<name>" --json
37
+ ```
38
+
39
+ This returns:
40
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
41
+ - Progress (total, complete, remaining)
42
+ - Task list with status
43
+ - Dynamic instruction based on current state
44
+ - Optional `context`: current required project instruction input from the selected root
45
+ - Optional `operationGuidance`: current advisory guidance for apply
46
+
47
+ **Handle states:**
48
+ - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` (if it is not installed, run `openspec status --change "<name>" --json` to see the next artifact and `openspec instructions <artifact-id> --change "<name>" --json` for how to create it)
49
+ - If `state: "all_done"`: congratulate, suggest archive
50
+ - Otherwise: proceed to implementation
51
+
52
+ Treat `context` as a required prompt-level input. Read and consider it, and
53
+ apply relevant project facts, conventions, and constraints while implementing.
54
+ Treat `operationGuidance` as optional additive advice. Read and consider every
55
+ entry, and follow entries that are applicable and compatible with the built-in
56
+ workflow.
57
+
58
+ Keep both fields separate from CLI-returned state, missing artifacts, tasks,
59
+ progress, `contextFiles`, and the built-in `instruction`. They are not
60
+ evidence of task completion, do not replace the built-in instruction, and do
61
+ not permit bypassing a blocked state. If context conflicts with the built-in
62
+ instruction, an explicit user choice, or a CLI-controlled value, report the
63
+ conflict and preserve the controlling value. If guidance is inapplicable or
64
+ conflicts with those controlling inputs, do not follow it and explain why.
65
+ These are prompt-level behavior contracts, not enforceable checks.
66
+
67
+ 4. **Read context files**
68
+
69
+ Read every file path listed under `contextFiles` from the apply instructions output.
70
+ The files depend on the schema being used:
71
+ - **spec-driven**: proposal, specs, design, tasks
72
+ - Other schemas: follow the contextFiles from CLI output
73
+
74
+ Do not copy `context` or `operationGuidance` verbatim into implementation
75
+ files or planning artifacts unless the user separately asks for that content.
76
+
77
+ 5. **Show current progress**
78
+
79
+ Display:
80
+ - Schema being used
81
+ - Progress: "N/M tasks complete"
82
+ - Remaining tasks overview
83
+ - Dynamic instruction from CLI
84
+
85
+ 6. **Implement tasks (loop until done or blocked)**
86
+
87
+ For each pending task:
88
+ - Show which task is being worked on
89
+ - Make the code changes required
90
+ - Keep changes minimal and focused
91
+ - Mark task complete in the tasks file: `- [ ]` → `- [x]`
92
+ - Continue to next task
93
+
94
+ **Pause if:**
95
+ - Task is unclear → ask for clarification
96
+ - Implementation reveals a design issue → suggest updating artifacts
97
+ - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
98
+ - Error or blocker encountered → report and wait for guidance
99
+ - User interrupts
100
+
101
+ 7. **On completion or pause, show status**
102
+
103
+ Display:
104
+ - Tasks completed this session
105
+ - Overall progress: "N/M tasks complete"
106
+ - If all done: suggest archive
107
+ - If paused: explain why and wait for guidance
108
+
109
+ **Output During Implementation**
110
+
111
+ ```
112
+ ## Implementing: <change-name> (schema: <schema-name>)
113
+
114
+ Working on task 3/7: <task description>
115
+ [...implementation happening...]
116
+ ✓ Task complete
117
+
118
+ Working on task 4/7: <task description>
119
+ [...implementation happening...]
120
+ ✓ Task complete
121
+ ```
122
+
123
+ **Output On Completion**
124
+
125
+ ```
126
+ ## Implementation Complete
127
+
128
+ **Change:** <change-name>
129
+ **Schema:** <schema-name>
130
+ **Progress:** 7/7 tasks complete ✓
131
+
132
+ ### Completed This Session
133
+ - [x] Task 1
134
+ - [x] Task 2
135
+ ...
136
+
137
+ All tasks complete! You can archive this change with `/opsx:archive`.
138
+ ```
139
+
140
+ **Output On Pause (Issue Encountered)**
141
+
142
+ ```
143
+ ## Implementation Paused
144
+
145
+ **Change:** <change-name>
146
+ **Schema:** <schema-name>
147
+ **Progress:** 4/7 tasks complete
148
+
149
+ ### Issue Encountered
150
+ <description of the issue>
151
+
152
+ **Options:**
153
+ 1. <option 1>
154
+ 2. <option 2>
155
+ 3. Other approach
156
+
157
+ What would you like to do?
158
+ ```
159
+
160
+ **Guardrails**
161
+ - Keep going through tasks until done or blocked
162
+ - Always read context files before starting (from the apply instructions output)
163
+ - If task is ambiguous, pause and ask before implementing
164
+ - If implementation reveals issues, pause and suggest artifact updates
165
+ - Keep code changes minimal and scoped to each task
166
+ - Update task checkbox immediately after completing each task
167
+ - Pause on errors, blockers, or unclear requirements - don't guess
168
+ - When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
169
+ - Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
170
+ - Use contextFiles from CLI output, don't assume specific file names
171
+ - Do not use context or operation guidance as proof that a task is complete
172
+ - Apply relevant project context; report conflicts with controlling workflow inputs
173
+ - Consider every guidance entry; explain any inapplicable or conflicting advice
174
+ - Do not copy runtime context or operation guidance into implementation files or planning artifacts
175
+ - Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
176
+
177
+ **Fluid Workflow Integration**
178
+
179
+ This skill supports the "actions on a change" model:
180
+
181
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
182
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,223 @@
1
+ ---
2
+ name: "OPSX: Archive"
3
+ description: Archive a completed change in the experimental workflow
4
+ category: Workflow
5
+ tags: [workflow, archive, experimental]
6
+ ---
7
+ Archive a completed change in the experimental workflow.
8
+
9
+ **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`). 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.
10
+
11
+ `<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.
12
+
13
+ **Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
14
+
15
+ **Steps**
16
+
17
+ 1. **Select the change**
18
+
19
+ If a name is provided, use it. Otherwise:
20
+ - Infer from conversation context if the user mentioned a change
21
+ - Auto-select if only one active change exists
22
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
23
+
24
+ When prompting, show only active changes (not already archived).
25
+ Include the schema used for each change if available.
26
+
27
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:archive <other>`).
28
+
29
+ **Load current archive inputs before the existing archive checks:**
30
+
31
+ After resolving the selected change and planning root, run:
32
+ ```bash
33
+ openspec instructions archive --change "<name>" --json
34
+ ```
35
+ Keep the same selected-root flags on this command. This lookup is advisory and
36
+ optional: it only supplies extra prompt inputs, so it must never block archiving.
37
+ If it exits non-zero or returns invalid JSON — for example on an older CLI that
38
+ does not support this command yet — continue the archive workflow with no
39
+ context and no operation guidance. Do not report an error and do not stop.
40
+
41
+ A successful response may omit both optional fields. Treat `context` as a
42
+ required prompt-level input: read and consider it, and apply relevant project
43
+ facts, conventions, and constraints. Treat `operationGuidance` as optional
44
+ additive advice: read and consider every entry, and follow entries that are
45
+ applicable and compatible with the built-in archive workflow.
46
+
47
+ Keep both fields separate from built-in steps, explicit user choices, resolved
48
+ paths, CLI checks, and command contracts. If context conflicts with one of those
49
+ controlling inputs, report the conflict and preserve the controlling value. If
50
+ guidance is inapplicable or conflicts with a controlling input, do not follow it
51
+ and explain why. Do not infer replacement paths, skipped prompts, or flags from
52
+ either field, and do not copy their text verbatim into specs, change artifacts,
53
+ or archive summaries unless the user separately asks for it. These are
54
+ prompt-level behavior contracts, not enforceable checks.
55
+
56
+ 2. **Check artifact completion status**
57
+
58
+ Run `openspec status --change "<name>" --json` to check artifact completion.
59
+
60
+ Parse the JSON to understand:
61
+ - `schemaName`: The workflow being used
62
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
63
+ - `artifacts`: List of artifacts with their status (`done`, `skipped`, or other)
64
+
65
+ **If any artifacts are neither `done` nor `skipped`** (skipped artifacts satisfy the requirement - the change declares skip_specs):
66
+ - Display warning listing incomplete artifacts
67
+ - Prompt user for confirmation to continue
68
+ - Proceed if user confirms
69
+
70
+ 3. **Check task completion status**
71
+
72
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
73
+
74
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
75
+
76
+ **If incomplete tasks found:**
77
+ - Display warning showing count of incomplete tasks
78
+ - Prompt user for confirmation to continue
79
+ - Proceed if user confirms
80
+
81
+ **If no tasks file exists:** Proceed without task-related warning.
82
+
83
+ 4. **Assess delta spec sync state**
84
+
85
+ Use `artifactPaths.specs.existingOutputPaths` from status JSON as the only
86
+ delta-spec source. If the `specs` entry is missing or
87
+ `existingOutputPaths` is empty, proceed without a sync prompt and do not infer
88
+ delta specs from other artifacts.
89
+
90
+ **If delta specs exist:**
91
+ - Compare each delta spec with its corresponding main spec at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (use the store-aware `planningHome.root` from step 2, not a hardcoded repo path)
92
+ - Determine what changes would be applied (adds, modifications, removals, renames)
93
+ - Show a combined summary before prompting
94
+
95
+ **Prompt options:**
96
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
97
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
98
+
99
+ Route on the answer:
100
+ - "Cancel" — stop, do not archive
101
+ - "Archive without syncing" or "Archive now" — proceed to archive
102
+ - "Sync now" or "Sync anyway" — sync, then verify (below)
103
+ - Anything else — ask again rather than archiving
104
+
105
+ Before a selected sync writes any main spec, run
106
+ `openspec instructions specs --change "<name>" --json` once with the same
107
+ selected-root flags. Require a zero exit status and valid artifact-instruction
108
+ JSON. If the lookup fails or returns invalid JSON, report the error and stop
109
+ before writing any main spec or moving the change. A valid response with omitted
110
+ `rules` is the no-rules case. Apply returned `rules` only to the content and
111
+ form of main specs produced by this merge; do not use them as archive guidance,
112
+ change CLI behavior, or copy the rule text into any output file.
113
+
114
+ Then run the `/opsx:sync` workflow inline (agent-driven intelligent merge) for change '<name>', passing the delta spec analysis and the fetched specs-rule snapshot from above, and wait for it to finish. The inline sync must reuse that snapshot without fetching `specs` instructions again. Do not delegate it to a background task — step 5 would move `changeRoot` out from under a sync that is still reading it, leaving the change archived and the main specs never updated. If your agent can only run it by delegation, delegate synchronously and wait for the result.
115
+
116
+ Then re-run the comparison from the top of this step against every capability that has a delta spec in `artifactPaths.specs.existingOutputPaths` — not only the ones the sync reports it touched. A successful sync leaves nothing left to apply, so each capability must now read as already synced:
117
+ - ADDED requirements present
118
+ - MODIFIED requirements carrying the scenario and description changes named in the delta, with their other scenarios intact
119
+ - 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
120
+ - RENAMED requirements present under the new name and absent under the old one
121
+
122
+ If the sync failed, or any capability does not match, report what differs and stop — do not archive. Nothing has moved and `changeRoot` is intact, so the user can fix the mismatch or re-run the sync and start the archive again.
123
+
124
+ 5. **Perform the archive**
125
+
126
+ Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
127
+ ```bash
128
+ mkdir -p "<planningHome.changesDir>/archive"
129
+ ```
130
+
131
+ Generate the 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-<change-name>`. Never stack a second date (same rule as `openspec archive`).
132
+
133
+ **Check if target already exists:**
134
+ - If yes: Fail with error, suggest renaming existing archive or using different date
135
+ - If no: Move `changeRoot` to the archive directory
136
+
137
+ ```bash
138
+ mv "<changeRoot>" "<planningHome.changesDir>/archive/<target-name>"
139
+ ```
140
+
141
+ 6. **Display summary**
142
+
143
+ Show archive completion summary including:
144
+ - Change name
145
+ - Schema that was used
146
+ - Archive location
147
+ - Spec sync status (synced / sync skipped / no delta specs)
148
+ - Note about any warnings (incomplete artifacts/tasks)
149
+
150
+ **Output On Success**
151
+
152
+ ```markdown
153
+ ## Archive Complete
154
+
155
+ **Change:** <change-name>
156
+ **Schema:** <schema-name>
157
+ **Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
158
+ **Specs:** ✓ Synced to main specs
159
+
160
+ All artifacts complete. All tasks complete.
161
+ ```
162
+
163
+ **Output On Success (No Delta Specs)**
164
+
165
+ ```markdown
166
+ ## Archive Complete
167
+
168
+ **Change:** <change-name>
169
+ **Schema:** <schema-name>
170
+ **Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
171
+ **Specs:** No delta specs
172
+
173
+ All artifacts complete. All tasks complete.
174
+ ```
175
+
176
+ **Output On Success With Warnings**
177
+
178
+ ```markdown
179
+ ## Archive Complete (with warnings)
180
+
181
+ **Change:** <change-name>
182
+ **Schema:** <schema-name>
183
+ **Archived to:** the archive path derived from `planningHome.changesDir`/<target-name>/
184
+ **Specs:** Sync skipped (user chose to skip)
185
+
186
+ **Warnings:**
187
+ - Archived with 2 incomplete artifacts
188
+ - Archived with 3 incomplete tasks
189
+ - Delta spec sync was skipped (user chose to skip)
190
+
191
+ Review the archive if this was not intentional.
192
+ ```
193
+
194
+ **Output On Error (Archive Exists)**
195
+
196
+ ```markdown
197
+ ## Archive Failed
198
+
199
+ **Change:** <change-name>
200
+ **Target:** the archive path derived from `planningHome.changesDir`/<target-name>/
201
+
202
+ Target archive directory already exists.
203
+
204
+ **Options:**
205
+ 1. Rename the existing archive
206
+ 2. Delete the existing archive if it's a duplicate
207
+ 3. Wait until a different date to archive
208
+ ```
209
+
210
+ **Guardrails**
211
+ - Announce the selected change; prompt for selection when it is ambiguous
212
+ - Use artifact graph (openspec status --json) for completion checking
213
+ - Don't block archive on warnings - just inform and confirm
214
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
215
+ - Show clear summary of what happened
216
+ - If sync is requested, run the `/opsx:sync` workflow inline (agent-driven)
217
+ - Never archive while a spec sync is still in flight — run the sync inline and verify the main specs before moving `changeRoot`
218
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
219
+ - Apply relevant runtime context and report conflicts; operation guidance remains advisory
220
+ - Consider every guidance entry and explain any inapplicable or conflicting advice
221
+ - Existing CLI checks, resolved paths, prompts, and command contracts are unchanged
222
+ - Artifact rules constrain only the specs being written and are never operation guidance
223
+ - Never copy runtime context, operation guidance, or artifact-rule text verbatim into output files