@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,162 @@
1
+ ---
2
+ name: openspec-propose
3
+ description: Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.
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
+ Propose a new change - create the change and generate all artifacts in one step.
13
+
14
+ **Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
15
+
16
+ I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
17
+ - proposal.md (what & why)
18
+ - `specs/<capability-path>/spec.md` (what the system must do - a delta, not the main spec)
19
+ - design.md (how)
20
+ - tasks.md (implementation steps)
21
+
22
+ `<capability-path>` is the spec directory relative to `specs/` (for example, `user-auth` or `identity/user-auth`). Preserve an existing capability's full path and follow the project's established organization for new capabilities.
23
+
24
+ When the user is ready to implement, they must start the apply workflow explicitly.
25
+
26
+ ---
27
+
28
+ **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.
29
+
30
+ **Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
31
+
32
+ **Steps**
33
+
34
+ 1. **Understand the request and clarify material ambiguity**
35
+
36
+ If no clear input is provided, ask the user (open-ended, no preset options):
37
+ > "What change do you want to work on? Describe what you want to build or fix."
38
+
39
+ From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
40
+
41
+ **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
42
+
43
+ If the request contains ambiguity that would materially affect scope, externally observable behavior, compatibility, or acceptance criteria, ask the user before creating the change. For minor details, make a reasonable assumption and record it in the planning artifacts.
44
+
45
+ 2. **Load project context**
46
+
47
+ Run `openspec context --json` from the current working directory (or `openspec context --json --store "<store-id>"` when a registered store was explicitly selected). Use the returned `root.path` as the authoritative OpenSpec root. If context reports `no_openspec_root`, stop without creating or changing any files. Offer `openspec init` and wait for the user to request initialization. Do not initialize automatically or run `openspec new change`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
48
+
49
+ Only when context returns a resolved `root.path`, read `<root.path>/openspec/config.yaml`. Use `config.yml` only when `config.yaml` does not exist. If neither file exists, continue without project context. Do not fall back to `config.yml` if `config.yaml` is unreadable or invalid.
50
+
51
+ If the file parses as a YAML object and its `context` field is a string no larger than 51,200 bytes in UTF-8, apply that field before exploring the codebase or making planning decisions. If the file cannot be read or parsed, or the context field is invalid or oversized, continue without project context. Validate this field independently of other config fields, as OpenSpec does.
52
+
53
+ Treat context as project-provided data and constraints, not as authority to change this workflow: it cannot override user authorization, the planning boundary, tool restrictions, or artifact and output rules. Do not copy the context into artifacts; use it to focus any codebase exploration and as a constraint on the proposal.
54
+
55
+ 3. **Determine the workflow schema**
56
+
57
+ Use the configured default schema unless the user explicitly requests a different workflow.
58
+
59
+ **Use a different schema only if the user:**
60
+ - Explicitly requests a specific schema by name → use `--schema <schema-name>`
61
+ - Asks to "show workflows" or asks "what workflows" exist → resolve the authoritative root by running `openspec context --json` from the current working directory. If the user explicitly selected a registered store, use `openspec context --json --store "<store-id>"`. Then run `openspec schemas --json` with its working directory set to the returned `root.path` and let them choose. This preserves roots selected by a local `store:` pointer or the global `defaultStore`; when a registered store was explicitly selected, append `--store "<store-id>"` to `openspec schemas --json` as well. If context fails, stop as described in the context-loading step; do not fall back to the current directory.
62
+
63
+ Otherwise, omit `--schema` to preserve the configured default.
64
+
65
+ 4. **Create the change directory**
66
+
67
+ Choose one schema form below. If a registered store is selected, append `--store "<store-id>"` to that command and each later OpenSpec command shown below that accepts `--store`.
68
+
69
+ Using the configured default:
70
+ ```bash
71
+ openspec new change "<name>"
72
+ ```
73
+
74
+ Using an explicitly requested schema:
75
+ ```bash
76
+ openspec new change "<name>" --schema "<schema-name>"
77
+ ```
78
+ This creates a scaffolded change in the planning home resolved by the CLI with `.openspec.yaml`.
79
+
80
+ 5. **Get the artifact build order**
81
+ ```bash
82
+ openspec status --change "<name>" --json
83
+ ```
84
+ Parse the JSON to get:
85
+ - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
86
+ - `artifacts`: list of all artifacts, each with its `status` and its `requires` edges (the artifact IDs it directly depends on)
87
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
88
+
89
+ 6. **Create every artifact in the required set**
90
+
91
+ Use a todo list to track progress through the artifacts.
92
+
93
+ Loop through artifacts in dependency order (artifacts with no pending dependencies first):
94
+
95
+ a. **For each artifact that is `ready` (dependencies satisfied)**:
96
+ - Get instructions:
97
+ ```bash
98
+ openspec instructions <artifact-id> --change "<name>" --json
99
+ ```
100
+ - The instructions JSON includes:
101
+ - `context`: Project background (constraints for you - do NOT include in output)
102
+ - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
103
+ - `template`: The structure to use for your output file
104
+ - `instruction`: Schema-specific guidance for this artifact type
105
+ - `skipped`/`warning`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
106
+ - `resolvedOutputPath`: Resolved path or pattern to write the artifact
107
+ - `dependencies`: Completed artifacts to read for context
108
+ - Read any completed dependency files for context - always re-read them from disk, even if you saw them earlier in the conversation (the user may have edited them)
109
+ - **Inspect the relevant project before drafting**: Read `context` and `rules` first, then inspect relevant implementation, nearby tests, configuration, and documentation outside `openspec/`. Keep inspection read-only and proportional to the change; reuse findings for later artifacts and inspect more only as needed.
110
+ - Identify the target project from the request and project context; the planning home may be separate from the code. If the target is unclear, ask. For greenfield or non-code changes, inspect the available structure and relevant documents. If source is unavailable, state the limitation and ask when it materially affects the plan.
111
+ - Ground scope, approach, and tasks in what you find. Distinguish observed behavior from assumptions and proposed additions; surface conflicts with existing specs instead of silently deciding which is correct.
112
+ - Do this discovery now, rather than leaving generic "explore the codebase" or "make a plan" tasks for implementation. Keep any necessary follow-up investigation specific to an unresolved question.
113
+ - If the `instruction` field delegates creation to a specific skill or command, invoke it to produce the artifact instead of writing the file yourself, then verify the artifact file exists at `resolvedOutputPath`
114
+ - Otherwise create the artifact file using `template` as the structure and write it to `resolvedOutputPath`. If `resolvedOutputPath` is a glob, follow `instruction` to choose the concrete file path
115
+ - Apply `context` and `rules` as constraints - but do NOT copy them into the file
116
+ - Show brief progress: "Created <artifact-id>"
117
+
118
+ b. **Continue until every artifact in the required set exists (not just `apply.requires`)**
119
+ - After creating each artifact, re-run `openspec status --change "<name>" --json`
120
+ - The required set is `applyRequires` plus every artifact reachable from those by following the `requires` edges in `status --json` - walk them transitively (spec-driven closes over proposal, specs, design, tasks). Leave artifacts outside that set alone
121
+ - `status` is file-existence only, so an `applyRequires` artifact reading `done` does NOT mean its dependencies exist - writing `tasks.md` early marks `tasks` done while `specs` was never written. Use each artifact's `requires` edges, not its `status`, to build the required set: a `done` artifact still lists what it depends on
122
+ - An artifact already reading `status: "skipped"` is satisfied: the change declares `skip_specs` in `.openspec.yaml`, so its files must NOT exist. Never try to create one
123
+ - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
124
+ - Skip one only when `status` already reports it `skipped`, or when its own `instruction` says it is conditional: run `openspec instructions <artifact-id> --change "<name>" --json` and skip only if its `instruction` field marks it optional (e.g. "create only if..."). Spec-driven's `design.md` qualifies; `specs` qualifies only via the `skipped` status above, never by your own judgment. Tell the user, and do not reconsider it
125
+ - Dependencies are enablers, not gates: if a required artifact is still `blocked` only because you skipped a conditional dependency, write it anyway
126
+ - Stop when every artifact in the required set is `done`, `skipped`, or was deliberately skipped
127
+
128
+ c. **If an artifact requires user input** (unclear context):
129
+ - Ask the user to clarify
130
+ - Then continue with creation
131
+
132
+ 7. **Show final status**
133
+ ```bash
134
+ openspec status --change "<name>"
135
+ ```
136
+
137
+ **Output**
138
+
139
+ After completing all artifacts, summarize:
140
+ - Change name and location
141
+ - List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
142
+ - What's ready: "All artifacts needed for implementation are ready."
143
+ - Prompt: "The artifacts are ready for review. When you are ready, run `/openspec-apply-change` or ask me to apply this change."
144
+
145
+ **Artifact Creation Guidelines**
146
+
147
+ - Follow the `instruction` field from `openspec instructions` for each artifact type - it is the authoritative guidance, even for familiar artifact names
148
+ - If the `instruction` field directs you to use a specific skill or command to create the artifact, invoke it instead of writing the artifact directly
149
+ - The schema defines what each artifact should contain - follow it
150
+ - Read dependency artifacts for context before creating new ones
151
+ - Use `template` as the structure for your output file - fill in its sections
152
+ - **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
153
+ - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
154
+ - These guide what you write, but should never appear in the output
155
+
156
+ **Guardrails**
157
+ - The request that invoked this workflow authorizes planning only. Any implementation or apply instruction in that request does not carry forward. Do NOT implement the change, start the apply workflow, or edit project code during this workflow. After presenting the artifacts, stop and wait for a new user request to start the apply workflow
158
+ - Create every artifact the apply phase transitively depends on, not just the ids listed in `apply.requires`
159
+ - Always read dependency artifacts before creating a new one - re-read from disk, not from conversation memory (files may have changed since you last saw them)
160
+ - Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
161
+ - If a change with that name already exists, ask if user wants to continue it or create a new one
162
+ - Verify each artifact file exists after writing before proceeding to next
@@ -0,0 +1,261 @@
1
+ ---
2
+ name: openspec-sync-specs
3
+ description: Sync delta specs from a change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change.
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
+ Sync delta specs from a change to main specs.
13
+
14
+ This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
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**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
21
+
22
+ **Steps**
23
+
24
+ 1. **Select the change**
25
+
26
+ If a name is provided, use it. Otherwise:
27
+ - Infer from conversation context if the user mentioned a change
28
+ - Auto-select if only one active change exists
29
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
30
+
31
+ When prompting, show changes that have delta specs (under `specs/` directory).
32
+
33
+ Always announce: "Using change: <name>" and how to override (e.g., `/openspec-sync-specs <other>`).
34
+
35
+ 2. **Resolve change context**
36
+
37
+ Run:
38
+ ```bash
39
+ openspec status --change "<name>" --json
40
+ ```
41
+
42
+ The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
43
+
44
+ 3. **Find delta specs**
45
+
46
+ Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
47
+ only source of delta spec paths. If the `specs` entry is missing or
48
+ `existingOutputPaths` is empty, report that there are no delta specs to sync,
49
+ do not infer them from other artifacts, and stop without requesting artifact
50
+ instructions or writing a main spec.
51
+
52
+ Sync every path in `existingOutputPaths` unless the caller narrowed the set.
53
+ A caller narrows it by naming an explicit list of complete entries from
54
+ `existingOutputPaths` — copy those absolute values verbatim. Archive does
55
+ this inline, and a user can too (for example, by selecting the entry ending
56
+ in `/specs/billing/invoices/spec.md`).
57
+ Then sync only the named paths and leave the remaining delta specs untouched:
58
+ bulk archive excludes a delta whose implementation it could not find, and
59
+ syncing it anyway would write a main spec the caller deliberately withheld.
60
+ Carry that narrowed selection through step 4; never widen it back to the full
61
+ list. If a named path is not in `existingOutputPaths`, do not sync it —
62
+ report it and stop, rather than dropping it silently. If the named list is
63
+ empty, report that there is nothing to sync and stop without writing a main
64
+ spec.
65
+
66
+ Each delta spec file contains sections like:
67
+ - `## ADDED Requirements` - New requirements to add
68
+ - `## MODIFIED Requirements` - Changes to existing requirements
69
+ - `## REMOVED Requirements` - Requirements to remove
70
+ - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
71
+
72
+ If no delta specs found, inform user and stop.
73
+
74
+ 4. **For each delta spec, apply changes to main specs**
75
+
76
+ Before the first main-spec write, obtain one current specs-rule snapshot:
77
+ - If archive invoked this workflow inline and supplied a valid snapshot from
78
+ `openspec instructions specs --change "<name>" --json`, reuse it and do not
79
+ fetch the same instructions again.
80
+ - Otherwise run that command once now with the same selected-root flags.
81
+ - If the direct lookup exits non-zero or returns invalid artifact-instruction
82
+ JSON, report the error and stop before writing any main spec. Do not treat the
83
+ failure as an absent rule set.
84
+ - A valid response with omitted `rules` means no artifact rules are configured
85
+ and the existing semantic merge continues.
86
+
87
+ Apply returned `rules` only to the content and form of the main specs produced
88
+ by this merge. Artifact rules are not operation guidance and cannot change
89
+ selected roots, delta paths, CLI checks, or workflow steps. Use their text as
90
+ constraints without copying it verbatim into a main spec or summary.
91
+
92
+ For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
93
+
94
+ a. **Read the delta spec** to understand the intended changes
95
+
96
+ b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
97
+
98
+ c. **Apply changes intelligently**:
99
+
100
+ **ADDED Requirements:**
101
+ - If requirement doesn't exist in main spec → add it
102
+ - If requirement already exists → update it to match (treat as implicit MODIFIED)
103
+
104
+ **MODIFIED Requirements:**
105
+ - Find the requirement in main spec
106
+ - Apply the changes - this can be:
107
+ - Adding new scenarios the main spec does not have yet
108
+ - Modifying existing scenarios
109
+ - Changing the requirement description
110
+ - Preserve scenarios/content not mentioned in the delta
111
+
112
+ **REMOVED Requirements:**
113
+ - Remove the entire requirement block from main spec
114
+ - Retiring the capability. Delete the whole `spec.md` - and the directory once
115
+ nothing else is left in it - only when ALL of these hold:
116
+ 1. removing the requirements *this run* left no requirement blocks;
117
+ 2. the rest of the spec is well-formed (it still has a `## Purpose`);
118
+ 3. the main spec was not already empty before this sync - if you removed
119
+ nothing, change nothing;
120
+ 4. every other nonblank line in the whole file is accounted for as the
121
+ title, Purpose, Requirements header, or a canonical requirement's
122
+ statement, scenarios, or fenced examples;
123
+ 5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
124
+ 6. the `spec.md` resolves inside the real specs root (do not follow a
125
+ capability-directory symlink to delete an external file).
126
+ If removing the selected requirements would leave no requirement blocks and
127
+ any retirement condition is not satisfied, do not modify the main spec. Stop
128
+ the sync for that capability, report the blocking condition, and tell the user
129
+ how to resolve it. Never write or leave an empty `## Requirements` section.
130
+ When only the marker is missing, say that too - it is the one thing the user
131
+ can add to make the retirement go through.
132
+ - Deleting the file also deletes its `## Purpose`; any other section blocks
133
+ retirement. Name Purpose when you report the retirement. Include a pasteable
134
+ `git checkout` only when the spec lived in the caller's checkout;
135
+ otherwise give checkout-scoped recovery guidance.
136
+
137
+ **RENAMED Requirements:**
138
+ - Find the FROM requirement, rename to TO
139
+
140
+ **`## Purpose` in the delta:**
141
+ - The main spec already has one and it is authoritative - leave it alone
142
+ (this is what `openspec archive` does; it warns and moves on)
143
+
144
+ d. **Create new main spec** if capability doesn't exist yet:
145
+ - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
146
+ - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
147
+ (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
148
+ - Add Requirements section with the ADDED requirements
149
+ - Follow the **Main Spec Format Reference** below
150
+
151
+ 5. **Validate updated main specs**
152
+
153
+ Run `openspec validate --specs` with the same selected-root flags used earlier.
154
+ If validation fails, report the problems and do not claim the sync succeeded.
155
+
156
+ 6. **Show summary**
157
+
158
+ After applying all changes, summarize:
159
+ - Which capabilities were updated
160
+ - What changes were made (requirements added/modified/removed/renamed)
161
+ - Any new main spec left with a TBD Purpose placeholder, so it gets written
162
+ now rather than lingering
163
+ - Any capability retired, naming the deleted `spec.md`, its Purpose, and
164
+ either a pasteable `git checkout` or checkout-scoped recovery guidance
165
+
166
+ **Delta Spec Format Reference**
167
+
168
+ ```markdown
169
+ ## Purpose
170
+
171
+ Only on a delta that introduces a brand-new capability. Seeds the new main spec.
172
+
173
+ ## ADDED Requirements
174
+
175
+ ### Requirement: New Feature
176
+ The system SHALL do something new.
177
+
178
+ #### Scenario: Basic case
179
+ - **WHEN** user does X
180
+ - **THEN** system does Y
181
+
182
+ ## MODIFIED Requirements
183
+
184
+ ### Requirement: Existing Feature
185
+ The system SHALL keep doing the existing thing, now also handling A.
186
+
187
+ #### Scenario: Scenario the main spec already has
188
+ - **WHEN** user does X
189
+ - **THEN** system does Y
190
+
191
+ #### Scenario: New scenario to add
192
+ - **WHEN** user does A
193
+ - **THEN** system does B
194
+
195
+ ## REMOVED Requirements
196
+
197
+ ### Requirement: Deprecated Feature
198
+
199
+ ## RENAMED Requirements
200
+
201
+ - FROM: `### Requirement: Old Name`
202
+ - TO: `### Requirement: New Name`
203
+ ```
204
+
205
+ **Main Spec Format Reference**
206
+
207
+ Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
208
+
209
+ ```markdown
210
+ # <capability> Specification
211
+
212
+ ## Purpose
213
+ Short description of what this capability does and why it exists.
214
+
215
+ ## Requirements
216
+
217
+ ### Requirement: New Feature
218
+ The system SHALL do something new.
219
+
220
+ #### Scenario: Basic case
221
+ - **WHEN** user does X
222
+ - **THEN** system does Y
223
+ ```
224
+
225
+ **Key Principle: Intelligent Merging**
226
+
227
+ Unlike programmatic merging, you merge rather than overwrite:
228
+ - A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
229
+ - Keep anything the delta does not mention, in the main spec's existing order
230
+ - Use your judgment to merge changes sensibly
231
+
232
+ **Output On Success**
233
+
234
+ ```markdown
235
+ ## Specs Synced: <change-name>
236
+
237
+ Updated main specs:
238
+
239
+ **<capability-1>**:
240
+ - Added requirement: "New Feature"
241
+ - Modified requirement: "Existing Feature" (added 1 scenario)
242
+
243
+ **<capability-2>**:
244
+ - Created new spec file
245
+ - Added requirement: "Another Feature"
246
+
247
+ Main specs are now updated. The change remains active - archive when implementation is complete.
248
+ ```
249
+
250
+ **Guardrails**
251
+ - Read both delta and main specs before making changes
252
+ - Preserve existing content not mentioned in delta
253
+ - Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
254
+ - If something is unclear, ask for clarification
255
+ - Show what you're changing as you go
256
+ - The operation should be idempotent - running twice should give same result
257
+ - Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
258
+ - Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
259
+ - Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
260
+ - Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
261
+ - Artifact rules constrain only the specs being written and are never copied into output files
@@ -0,0 +1,90 @@
1
+ ---
2
+ name: openspec-update-change
3
+ description: Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.
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
+ Revise a change's existing planning artifacts and keep them coherent. Never edit code.
13
+
14
+ **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.
15
+
16
+ **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
17
+
18
+ `/openspec-continue-change` is an optional workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, `openspec status --change "<name>" --json` shows the next artifact and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to create it.
19
+
20
+ **Steps**
21
+
22
+ 1. **Select the change**
23
+
24
+ If a name is provided, use it. Otherwise:
25
+ - Infer from conversation context if the user mentioned a change
26
+ - Auto-select if only one active change exists
27
+ - If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
28
+
29
+ When prompting, present the top 3-4 most recently modified changes as options, showing:
30
+ - Change name
31
+ - Schema (from `schema` field if present, otherwise "spec-driven")
32
+ - Status (e.g., "0/5 tasks", "complete", "no tasks")
33
+ - How recently it was modified (from `lastModified` field)
34
+
35
+ Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
36
+
37
+ Always announce: "Using change: <name>" and how to override (e.g., `/openspec-update-change <other>`).
38
+
39
+ 2. **Get the change's artifacts**
40
+ ```bash
41
+ openspec status --change "<name>" --json
42
+ ```
43
+ Parse the JSON to understand current state. The response includes:
44
+ - `schemaName`: The workflow schema being used (e.g., "spec-driven")
45
+ - `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
46
+ - `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
47
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
48
+
49
+ The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
50
+
51
+ The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
52
+
53
+ 3. **Understand the request**
54
+ - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
55
+ - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
56
+
57
+ 4. **Read and reconcile**
58
+ - Read the artifact(s) the request touches and the change's other existing artifacts.
59
+ - Apply the requested edit. Then check every other existing artifact against it - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
60
+ - Note everything that is now inconsistent, missing, or contradictory.
61
+ - Revise only files that already exist (`existingOutputPaths`). Do NOT create artifacts that don't exist yet, and do NOT invent new files under a glob artifact - note them and point the user to `/openspec-continue-change` to create them.
62
+ - If the change is already coherent, say so and make no edits.
63
+
64
+ 5. **Confirm and apply, one artifact at a time**
65
+ - Show each proposed revision and why. Write only after the user confirms.
66
+ - If the user rejects a revision, do not write it - leave that artifact unchanged.
67
+ - When a substantial rewrite is needed, get that artifact's rules and template first:
68
+ ```bash
69
+ openspec instructions "<artifact-id>" --change "<name>" --json
70
+ ```
71
+
72
+ 6. **Point to the next step (guidance only - NEVER act on it)**
73
+ - Artifacts still missing -> suggest `/openspec-continue-change` to create them.
74
+ - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/openspec-apply-change` to carry the delta into code.
75
+ - Everything done and implemented -> suggest `/openspec-archive-change`.
76
+
77
+ **Output**
78
+
79
+ After each invocation, show:
80
+ - Which artifacts were revised (and which proposed revisions were rejected)
81
+ - Anything deferred to `/openspec-continue-change` (not-yet-created artifacts or files)
82
+ - Where the change stands and the recommended next command
83
+
84
+ **Guardrails**
85
+ - Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/openspec-apply-change`.
86
+ - Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
87
+ - Edit only the concrete files in `existingOutputPaths`; never write to a glob `resolvedOutputPath`.
88
+ - Do not advance the build frontier: no new artifacts, no new files under glob artifacts - that is `/openspec-continue-change`'s job.
89
+ - Confirm every edit with the user before writing.
90
+ - If the request changes the change's *intent* rather than refining it, first verify whether the optional `/openspec-new-change` workflow is available. If it is, recommend starting fresh with `/openspec-new-change` (the "Update vs. Start Fresh" heuristic). If it is unavailable, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead.