@fission-ai/openspec 1.6.0 → 1.8.0

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 (208) hide show
  1. package/README.md +31 -2
  2. package/dist/cli/index.js +79 -8
  3. package/dist/commands/change.d.ts +0 -1
  4. package/dist/commands/change.js +105 -51
  5. package/dist/commands/config.js +14 -8
  6. package/dist/commands/doctor.js +9 -4
  7. package/dist/commands/feedback.js +74 -23
  8. package/dist/commands/schema.js +110 -31
  9. package/dist/commands/show.js +5 -2
  10. package/dist/commands/spec.js +49 -29
  11. package/dist/commands/validate.js +20 -5
  12. package/dist/commands/workflow/index.d.ts +1 -1
  13. package/dist/commands/workflow/index.js +1 -1
  14. package/dist/commands/workflow/instructions.d.ts +7 -1
  15. package/dist/commands/workflow/instructions.js +121 -33
  16. package/dist/commands/workflow/shared.d.ts +13 -2
  17. package/dist/commands/workflow/shared.js +34 -4
  18. package/dist/commands/workflow/status.js +9 -4
  19. package/dist/commands/workflow/templates.js +15 -5
  20. package/dist/core/archive.d.ts +14 -1
  21. package/dist/core/archive.js +1332 -155
  22. package/dist/core/artifact-graph/graph.d.ts +16 -0
  23. package/dist/core/artifact-graph/graph.js +30 -6
  24. package/dist/core/artifact-graph/index.d.ts +1 -1
  25. package/dist/core/artifact-graph/index.js +1 -1
  26. package/dist/core/artifact-graph/instruction-loader.d.ts +30 -3
  27. package/dist/core/artifact-graph/instruction-loader.js +70 -12
  28. package/dist/core/artifact-graph/outputs.d.ts +1 -0
  29. package/dist/core/artifact-graph/outputs.js +67 -5
  30. package/dist/core/artifact-graph/resolver.d.ts +14 -0
  31. package/dist/core/artifact-graph/resolver.js +69 -15
  32. package/dist/core/artifact-graph/types.js +21 -3
  33. package/dist/core/available-tools.d.ts +2 -2
  34. package/dist/core/available-tools.js +14 -3
  35. package/dist/core/change-metadata/schema.d.ts +2 -0
  36. package/dist/core/change-metadata/schema.js +13 -0
  37. package/dist/core/change-status-policy.d.ts +1 -1
  38. package/dist/core/change-status-policy.js +2 -2
  39. package/dist/core/command-generation/adapters/amazon-q.d.ts +4 -0
  40. package/dist/core/command-generation/adapters/amazon-q.js +7 -1
  41. package/dist/core/command-generation/adapters/antigravity.js +2 -1
  42. package/dist/core/command-generation/adapters/auggie.js +2 -1
  43. package/dist/core/command-generation/adapters/bob.d.ts +5 -1
  44. package/dist/core/command-generation/adapters/bob.js +6 -5
  45. package/dist/core/command-generation/adapters/claude.js +1 -8
  46. package/dist/core/command-generation/adapters/codebuddy.js +3 -2
  47. package/dist/core/command-generation/adapters/continue.js +3 -2
  48. package/dist/core/command-generation/adapters/costrict.js +2 -1
  49. package/dist/core/command-generation/adapters/crush.js +5 -5
  50. package/dist/core/command-generation/adapters/cursor.js +2 -2
  51. package/dist/core/command-generation/adapters/devin.d.ts +19 -0
  52. package/dist/core/command-generation/adapters/devin.js +36 -0
  53. package/dist/core/command-generation/adapters/factory.js +2 -1
  54. package/dist/core/command-generation/adapters/gemini.js +37 -2
  55. package/dist/core/command-generation/adapters/github-copilot.js +2 -1
  56. package/dist/core/command-generation/adapters/iflow.js +5 -4
  57. package/dist/core/command-generation/adapters/index.d.ts +2 -2
  58. package/dist/core/command-generation/adapters/index.js +2 -2
  59. package/dist/core/command-generation/adapters/junie.js +2 -1
  60. package/dist/core/command-generation/adapters/kiro.js +2 -1
  61. package/dist/core/command-generation/adapters/lingma.js +5 -5
  62. package/dist/core/command-generation/adapters/oh-my-pi.d.ts +2 -2
  63. package/dist/core/command-generation/adapters/oh-my-pi.js +3 -5
  64. package/dist/core/command-generation/adapters/opencode.js +3 -5
  65. package/dist/core/command-generation/adapters/pi.d.ts +2 -2
  66. package/dist/core/command-generation/adapters/pi.js +3 -6
  67. package/dist/core/command-generation/adapters/qoder.js +5 -5
  68. package/dist/core/command-generation/adapters/qwen.d.ts +7 -3
  69. package/dist/core/command-generation/adapters/qwen.js +12 -7
  70. package/dist/core/command-generation/adapters/roocode.d.ts +4 -4
  71. package/dist/core/command-generation/adapters/roocode.js +4 -4
  72. package/dist/core/command-generation/adapters/trae.js +1 -21
  73. package/dist/core/command-generation/adapters/zcode.d.ts +16 -0
  74. package/dist/core/command-generation/adapters/zcode.js +33 -0
  75. package/dist/core/command-generation/generator.d.ts +8 -0
  76. package/dist/core/command-generation/generator.js +15 -1
  77. package/dist/core/command-generation/index.d.ts +1 -1
  78. package/dist/core/command-generation/index.js +1 -1
  79. package/dist/core/command-generation/invocation.d.ts +73 -0
  80. package/dist/core/command-generation/invocation.js +77 -0
  81. package/dist/core/command-generation/registry.js +4 -4
  82. package/dist/core/command-generation/types.d.ts +9 -2
  83. package/dist/core/command-generation/yaml.d.ts +20 -6
  84. package/dist/core/command-generation/yaml.js +31 -21
  85. package/dist/core/command-surface.d.ts +15 -0
  86. package/dist/core/command-surface.js +33 -0
  87. package/dist/core/completions/command-registry.js +16 -2
  88. package/dist/core/completions/generators/powershell-generator.js +15 -8
  89. package/dist/core/completions/installers/zsh-installer.d.ts +9 -0
  90. package/dist/core/completions/installers/zsh-installer.js +20 -4
  91. package/dist/core/config-prompts.d.ts +1 -1
  92. package/dist/core/config-prompts.js +14 -1
  93. package/dist/core/config-schema.d.ts +10 -1
  94. package/dist/core/config-schema.js +67 -1
  95. package/dist/core/config.d.ts +15 -0
  96. package/dist/core/config.js +45 -5
  97. package/dist/core/file-state.js +56 -24
  98. package/dist/core/github-copilot/cloud-agent.d.ts +95 -0
  99. package/dist/core/github-copilot/cloud-agent.js +497 -0
  100. package/dist/core/global-config.d.ts +16 -0
  101. package/dist/core/init.d.ts +58 -0
  102. package/dist/core/init.js +450 -69
  103. package/dist/core/legacy-cleanup.d.ts +59 -0
  104. package/dist/core/legacy-cleanup.js +253 -24
  105. package/dist/core/list.js +5 -7
  106. package/dist/core/migration.d.ts +73 -1
  107. package/dist/core/migration.js +360 -11
  108. package/dist/core/onboarding-commands.d.ts +30 -0
  109. package/dist/core/onboarding-commands.js +38 -0
  110. package/dist/core/parsers/change-parser.d.ts +17 -2
  111. package/dist/core/parsers/change-parser.js +33 -20
  112. package/dist/core/parsers/code-fence.d.ts +15 -0
  113. package/dist/core/parsers/code-fence.js +49 -0
  114. package/dist/core/parsers/markdown-parser.js +2 -1
  115. package/dist/core/parsers/requirement-blocks.d.ts +18 -0
  116. package/dist/core/parsers/requirement-blocks.js +120 -35
  117. package/dist/core/parsers/requirement-text.d.ts +1 -8
  118. package/dist/core/parsers/requirement-text.js +4 -42
  119. package/dist/core/parsers/spec-structure.d.ts +1 -1
  120. package/dist/core/parsers/spec-structure.js +20 -30
  121. package/dist/core/profile-sync-drift.d.ts +0 -8
  122. package/dist/core/profile-sync-drift.js +48 -49
  123. package/dist/core/project-config.d.ts +28 -6
  124. package/dist/core/project-config.js +108 -8
  125. package/dist/core/references.js +42 -4
  126. package/dist/core/relationship-health.d.ts +8 -0
  127. package/dist/core/relationship-health.js +13 -0
  128. package/dist/core/root-selection.d.ts +9 -6
  129. package/dist/core/root-selection.js +42 -5
  130. package/dist/core/shared/index.d.ts +1 -0
  131. package/dist/core/shared/index.js +1 -0
  132. package/dist/core/shared/skill-content-equivalence.d.ts +7 -0
  133. package/dist/core/shared/skill-content-equivalence.js +41 -0
  134. package/dist/core/shared/skill-paths.d.ts +13 -0
  135. package/dist/core/shared/skill-paths.js +23 -0
  136. package/dist/core/shared/tool-detection.d.ts +25 -5
  137. package/dist/core/shared/tool-detection.js +166 -36
  138. package/dist/core/shared-skill-target.d.ts +16 -0
  139. package/dist/core/shared-skill-target.js +156 -0
  140. package/dist/core/specs-apply.d.ts +80 -33
  141. package/dist/core/specs-apply.js +659 -171
  142. package/dist/core/store/git.d.ts +13 -0
  143. package/dist/core/store/git.js +24 -0
  144. package/dist/core/templates/skill-templates.d.ts +1 -1
  145. package/dist/core/templates/skill-templates.js +1 -1
  146. package/dist/core/templates/workflows/apply-change.d.ts +10 -0
  147. package/dist/core/templates/workflows/apply-change.js +48 -158
  148. package/dist/core/templates/workflows/archive-change.js +170 -42
  149. package/dist/core/templates/workflows/bulk-archive-change.js +256 -75
  150. package/dist/core/templates/workflows/continue-change.js +38 -46
  151. package/dist/core/templates/workflows/explore.js +54 -18
  152. package/dist/core/templates/workflows/ff-change.js +46 -30
  153. package/dist/core/templates/workflows/new-change.js +2 -2
  154. package/dist/core/templates/workflows/onboard.js +13 -7
  155. package/dist/core/templates/workflows/propose.js +116 -46
  156. package/dist/core/templates/workflows/store-selection.d.ts +1 -1
  157. package/dist/core/templates/workflows/store-selection.js +1 -1
  158. package/dist/core/templates/workflows/sync-specs.js +260 -32
  159. package/dist/core/templates/workflows/update-change.js +26 -16
  160. package/dist/core/templates/workflows/verify-change.js +16 -10
  161. package/dist/core/update.d.ts +40 -5
  162. package/dist/core/update.js +389 -93
  163. package/dist/core/validation/constants.d.ts +4 -1
  164. package/dist/core/validation/constants.js +4 -1
  165. package/dist/core/validation/validator.d.ts +22 -8
  166. package/dist/core/validation/validator.js +222 -50
  167. package/dist/core/version-check.d.ts +152 -0
  168. package/dist/core/version-check.js +731 -0
  169. package/dist/core/view.js +12 -17
  170. package/dist/prompts/searchable-multi-select.js +1 -1
  171. package/dist/telemetry/config.d.ts +3 -4
  172. package/dist/telemetry/index.d.ts +10 -5
  173. package/dist/telemetry/index.js +75 -41
  174. package/dist/ui/welcome-screen.d.ts +9 -1
  175. package/dist/ui/welcome-screen.js +91 -38
  176. package/dist/utils/change-metadata.d.ts +43 -0
  177. package/dist/utils/change-metadata.js +123 -7
  178. package/dist/utils/change-utils.d.ts +10 -4
  179. package/dist/utils/change-utils.js +20 -13
  180. package/dist/utils/ci.d.ts +12 -0
  181. package/dist/utils/ci.js +16 -0
  182. package/dist/utils/command-references.d.ts +92 -6
  183. package/dist/utils/command-references.js +180 -7
  184. package/dist/utils/date.d.ts +8 -0
  185. package/dist/utils/date.js +13 -0
  186. package/dist/utils/file-system.d.ts +10 -0
  187. package/dist/utils/file-system.js +70 -0
  188. package/dist/utils/index.d.ts +1 -1
  189. package/dist/utils/index.js +1 -1
  190. package/dist/utils/interactive.d.ts +23 -0
  191. package/dist/utils/interactive.js +32 -0
  192. package/dist/utils/item-discovery.d.ts +19 -0
  193. package/dist/utils/item-discovery.js +30 -48
  194. package/dist/utils/shell-detection.d.ts +1 -1
  195. package/dist/utils/shell-detection.js +64 -11
  196. package/dist/utils/spec-discovery.d.ts +40 -0
  197. package/dist/utils/spec-discovery.js +115 -0
  198. package/dist/utils/task-progress.d.ts +17 -0
  199. package/dist/utils/task-progress.js +41 -13
  200. package/package.json +14 -12
  201. package/schemas/spec-driven/schema.yaml +67 -10
  202. package/schemas/spec-driven/templates/design.md +2 -2
  203. package/schemas/spec-driven/templates/proposal.md +10 -4
  204. package/schemas/spec-driven/templates/spec.md +3 -0
  205. package/dist/core/command-generation/adapters/codex.d.ts +0 -16
  206. package/dist/core/command-generation/adapters/codex.js +0 -39
  207. package/dist/core/command-generation/adapters/windsurf.d.ts +0 -14
  208. package/dist/core/command-generation/adapters/windsurf.js +0 -38
@@ -5,12 +5,17 @@ export function getOpsxProposeSkillTemplate() {
5
5
  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.',
6
6
  instructions: `Propose a new change - create the change and generate all artifacts in one step.
7
7
 
8
- I'll create a change with artifacts:
8
+ **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.
9
+
10
+ I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
9
11
  - proposal.md (what & why)
12
+ - \`specs/<capability-path>/spec.md\` (what the system must do - a delta, not the main spec)
10
13
  - design.md (how)
11
14
  - tasks.md (implementation steps)
12
15
 
13
- When ready to implement, run /opsx:apply
16
+ \`<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.
17
+
18
+ When the user is ready to implement, they must start the apply workflow explicitly.
14
19
 
15
20
  ---
16
21
 
@@ -20,33 +25,54 @@ ${STORE_SELECTION_GUIDANCE}
20
25
 
21
26
  **Steps**
22
27
 
23
- 1. **If no clear input provided, ask what they want to build**
28
+ 1. **Understand the request and clarify material ambiguity**
24
29
 
25
- Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
30
+ If no clear input is provided, ask the user (open-ended, no preset options):
26
31
  > "What change do you want to work on? Describe what you want to build or fix."
27
32
 
28
33
  From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
29
34
 
30
35
  **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
31
36
 
32
- 2. **Create the change directory**
37
+ 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.
38
+
39
+ 2. **Determine the workflow schema**
40
+
41
+ Use the configured default schema unless the user explicitly requests a different workflow.
42
+
43
+ **Use a different schema only if the user:**
44
+ - Explicitly requests a specific schema by name → use \`--schema <schema-name>\`
45
+ - 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\`; \`schemas\` does not accept \`--store\`. If context reports only \`no_openspec_root\`, run \`openspec schemas --json\` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
46
+
47
+ Otherwise, omit \`--schema\` to preserve the configured default.
48
+
49
+ 3. **Create the change directory**
50
+
51
+ 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\`.
52
+
53
+ Using the configured default:
33
54
  \`\`\`bash
34
55
  openspec new change "<name>"
35
56
  \`\`\`
57
+
58
+ Using an explicitly requested schema:
59
+ \`\`\`bash
60
+ openspec new change "<name>" --schema "<schema-name>"
61
+ \`\`\`
36
62
  This creates a scaffolded change in the planning home resolved by the CLI with \`.openspec.yaml\`.
37
63
 
38
- 3. **Get the artifact build order**
64
+ 4. **Get the artifact build order**
39
65
  \`\`\`bash
40
66
  openspec status --change "<name>" --json
41
67
  \`\`\`
42
68
  Parse the JSON to get:
43
69
  - \`applyRequires\`: array of artifact IDs needed before implementation (e.g., \`["tasks"]\`)
44
- - \`artifacts\`: list of all artifacts with their status and dependencies
70
+ - \`artifacts\`: list of all artifacts, each with its \`status\` and its \`requires\` edges (the artifact IDs it directly depends on)
45
71
  - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
46
72
 
47
- 4. **Create artifacts in sequence until apply-ready**
73
+ 5. **Create every artifact in the required set**
48
74
 
49
- Use the **TodoWrite tool** to track progress through the artifacts.
75
+ Use a todo list to track progress through the artifacts.
50
76
 
51
77
  Loop through artifacts in dependency order (artifacts with no pending dependencies first):
52
78
 
@@ -60,23 +86,30 @@ ${STORE_SELECTION_GUIDANCE}
60
86
  - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
61
87
  - \`template\`: The structure to use for your output file
62
88
  - \`instruction\`: Schema-specific guidance for this artifact type
89
+ - \`skipped\`/\`warning\`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
63
90
  - \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
64
91
  - \`dependencies\`: Completed artifacts to read for context
65
- - Read any completed dependency files for context
66
- - Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
92
+ - 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)
93
+ - 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\`
94
+ - 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
67
95
  - Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
68
96
  - Show brief progress: "Created <artifact-id>"
69
97
 
70
- b. **Continue until all \`applyRequires\` artifacts are complete**
98
+ b. **Continue until every artifact in the required set exists (not just \`apply.requires\`)**
71
99
  - After creating each artifact, re-run \`openspec status --change "<name>" --json\`
72
- - Check if every artifact ID in \`applyRequires\` has \`status: "done"\` in the artifacts array
73
- - Stop when all \`applyRequires\` artifacts are done
100
+ - 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
101
+ - \`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
102
+ - 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
103
+ - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
104
+ - 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
105
+ - Dependencies are enablers, not gates: if a required artifact is still \`blocked\` only because you skipped a conditional dependency, write it anyway
106
+ - Stop when every artifact in the required set is \`done\`, \`skipped\`, or was deliberately skipped
74
107
 
75
108
  c. **If an artifact requires user input** (unclear context):
76
- - Use **AskUserQuestion tool** to clarify
109
+ - Ask the user to clarify
77
110
  - Then continue with creation
78
111
 
79
- 5. **Show final status**
112
+ 6. **Show final status**
80
113
  \`\`\`bash
81
114
  openspec status --change "<name>"
82
115
  \`\`\`
@@ -85,13 +118,14 @@ ${STORE_SELECTION_GUIDANCE}
85
118
 
86
119
  After completing all artifacts, summarize:
87
120
  - Change name and location
88
- - List of artifacts created with brief descriptions
89
- - What's ready: "All artifacts created! Ready for implementation."
90
- - Prompt: "Run \`/opsx:apply\` or ask me to implement to start working on the tasks."
121
+ - List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
122
+ - What's ready: "All artifacts needed for implementation are ready."
123
+ - Prompt: "The artifacts are ready for review. When you are ready, run \`/opsx:apply\` or ask me to apply this change."
91
124
 
92
125
  **Artifact Creation Guidelines**
93
126
 
94
- - Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
127
+ - Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
128
+ - 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
95
129
  - The schema defines what each artifact should contain - follow it
96
130
  - Read dependency artifacts for context before creating new ones
97
131
  - Use \`template\` as the structure for your output file - fill in its sections
@@ -100,9 +134,10 @@ After completing all artifacts, summarize:
100
134
  - These guide what you write, but should never appear in the output
101
135
 
102
136
  **Guardrails**
103
- - Create ALL artifacts needed for implementation (as defined by schema's \`apply.requires\`)
104
- - Always read dependency artifacts before creating a new one
105
- - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
137
+ - 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
138
+ - Create every artifact the apply phase transitively depends on, not just the ids listed in \`apply.requires\`
139
+ - 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)
140
+ - Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
106
141
  - If a change with that name already exists, ask if user wants to continue it or create a new one
107
142
  - Verify each artifact file exists after writing before proceeding to next`,
108
143
  license: 'MIT',
@@ -118,12 +153,17 @@ export function getOpsxProposeCommandTemplate() {
118
153
  tags: ['workflow', 'artifacts', 'experimental'],
119
154
  content: `Propose a new change - create the change and generate all artifacts in one step.
120
155
 
121
- I'll create a change with artifacts:
156
+ **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.
157
+
158
+ I'll create a change with the artifacts your schema defines. With the default spec-driven schema that is:
122
159
  - proposal.md (what & why)
160
+ - \`specs/<capability-path>/spec.md\` (what the system must do - a delta, not the main spec)
123
161
  - design.md (how)
124
162
  - tasks.md (implementation steps)
125
163
 
126
- When ready to implement, run /opsx:apply
164
+ \`<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.
165
+
166
+ When the user is ready to implement, they must start the apply workflow explicitly.
127
167
 
128
168
  ---
129
169
 
@@ -133,33 +173,54 @@ ${STORE_SELECTION_GUIDANCE}
133
173
 
134
174
  **Steps**
135
175
 
136
- 1. **If no input provided, ask what they want to build**
176
+ 1. **Understand the request and clarify material ambiguity**
137
177
 
138
- Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
178
+ If no input is provided, ask the user (open-ended, no preset options):
139
179
  > "What change do you want to work on? Describe what you want to build or fix."
140
180
 
141
181
  From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
142
182
 
143
183
  **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
144
184
 
145
- 2. **Create the change directory**
185
+ 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.
186
+
187
+ 2. **Determine the workflow schema**
188
+
189
+ Use the configured default schema unless the user explicitly requests a different workflow.
190
+
191
+ **Use a different schema only if the user:**
192
+ - Explicitly requests a specific schema by name → use \`--schema <schema-name>\`
193
+ - 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\`; \`schemas\` does not accept \`--store\`. If context reports only \`no_openspec_root\`, run \`openspec schemas --json\` from the current working directory instead. Do not use this fallback for invalid or unavailable stores.
194
+
195
+ Otherwise, omit \`--schema\` to preserve the configured default.
196
+
197
+ 3. **Create the change directory**
198
+
199
+ 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\`.
200
+
201
+ Using the configured default:
146
202
  \`\`\`bash
147
203
  openspec new change "<name>"
148
204
  \`\`\`
205
+
206
+ Using an explicitly requested schema:
207
+ \`\`\`bash
208
+ openspec new change "<name>" --schema "<schema-name>"
209
+ \`\`\`
149
210
  This creates a scaffolded change in the planning home resolved by the CLI with \`.openspec.yaml\`.
150
211
 
151
- 3. **Get the artifact build order**
212
+ 4. **Get the artifact build order**
152
213
  \`\`\`bash
153
214
  openspec status --change "<name>" --json
154
215
  \`\`\`
155
216
  Parse the JSON to get:
156
217
  - \`applyRequires\`: array of artifact IDs needed before implementation (e.g., \`["tasks"]\`)
157
- - \`artifacts\`: list of all artifacts with their status and dependencies
218
+ - \`artifacts\`: list of all artifacts, each with its \`status\` and its \`requires\` edges (the artifact IDs it directly depends on)
158
219
  - \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context. Use these instead of assuming repo-local paths.
159
220
 
160
- 4. **Create artifacts in sequence until apply-ready**
221
+ 5. **Create every artifact in the required set**
161
222
 
162
- Use the **TodoWrite tool** to track progress through the artifacts.
223
+ Use a todo list to track progress through the artifacts.
163
224
 
164
225
  Loop through artifacts in dependency order (artifacts with no pending dependencies first):
165
226
 
@@ -173,23 +234,30 @@ ${STORE_SELECTION_GUIDANCE}
173
234
  - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
174
235
  - \`template\`: The structure to use for your output file
175
236
  - \`instruction\`: Schema-specific guidance for this artifact type
237
+ - \`skipped\`/\`warning\`: present when the change declares skip_specs and this artifact must NOT be created - stop and pick another artifact
176
238
  - \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
177
239
  - \`dependencies\`: Completed artifacts to read for context
178
- - Read any completed dependency files for context
179
- - Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
240
+ - 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)
241
+ - 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\`
242
+ - 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
180
243
  - Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
181
244
  - Show brief progress: "Created <artifact-id>"
182
245
 
183
- b. **Continue until all \`applyRequires\` artifacts are complete**
246
+ b. **Continue until every artifact in the required set exists (not just \`apply.requires\`)**
184
247
  - After creating each artifact, re-run \`openspec status --change "<name>" --json\`
185
- - Check if every artifact ID in \`applyRequires\` has \`status: "done"\` in the artifacts array
186
- - Stop when all \`applyRequires\` artifacts are done
248
+ - 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
249
+ - \`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
250
+ - 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
251
+ - Create every artifact in the required set that is missing, then re-check - creating one can unblock others
252
+ - 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
253
+ - Dependencies are enablers, not gates: if a required artifact is still \`blocked\` only because you skipped a conditional dependency, write it anyway
254
+ - Stop when every artifact in the required set is \`done\`, \`skipped\`, or was deliberately skipped
187
255
 
188
256
  c. **If an artifact requires user input** (unclear context):
189
- - Use **AskUserQuestion tool** to clarify
257
+ - Ask the user to clarify
190
258
  - Then continue with creation
191
259
 
192
- 5. **Show final status**
260
+ 6. **Show final status**
193
261
  \`\`\`bash
194
262
  openspec status --change "<name>"
195
263
  \`\`\`
@@ -198,13 +266,14 @@ ${STORE_SELECTION_GUIDANCE}
198
266
 
199
267
  After completing all artifacts, summarize:
200
268
  - Change name and location
201
- - List of artifacts created with brief descriptions
202
- - What's ready: "All artifacts created! Ready for implementation."
203
- - Prompt: "Run \`/opsx:apply\` to start implementing."
269
+ - List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
270
+ - What's ready: "All artifacts needed for implementation are ready."
271
+ - Prompt: "The artifacts are ready for review. When you are ready, run \`/opsx:apply\`."
204
272
 
205
273
  **Artifact Creation Guidelines**
206
274
 
207
- - Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
275
+ - Follow the \`instruction\` field from \`openspec instructions\` for each artifact type - it is the authoritative guidance, even for familiar artifact names
276
+ - 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
208
277
  - The schema defines what each artifact should contain - follow it
209
278
  - Read dependency artifacts for context before creating new ones
210
279
  - Use \`template\` as the structure for your output file - fill in its sections
@@ -213,9 +282,10 @@ After completing all artifacts, summarize:
213
282
  - These guide what you write, but should never appear in the output
214
283
 
215
284
  **Guardrails**
216
- - Create ALL artifacts needed for implementation (as defined by schema's \`apply.requires\`)
217
- - Always read dependency artifacts before creating a new one
218
- - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
285
+ - 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
286
+ - Create every artifact the apply phase transitively depends on, not just the ids listed in \`apply.requires\`
287
+ - 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)
288
+ - Ask about ambiguities that would materially change scope, externally observable behavior, compatibility, or acceptance criteria; for minor details, make reasonable assumptions and record them
219
289
  - If a change with that name already exists, ask if user wants to continue it or create a new one
220
290
  - Verify each artifact file exists after writing before proceeding to next`
221
291
  };
@@ -4,5 +4,5 @@
4
4
  * Interpolated into every workflow's instructions so generated skills
5
5
  * consistently teach how to target a registered store with `--store <id>`.
6
6
  */
7
- export declare const STORE_SELECTION_GUIDANCE = "**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.";
7
+ export declare const STORE_SELECTION_GUIDANCE = "**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`, `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.";
8
8
  //# sourceMappingURL=store-selection.d.ts.map
@@ -4,5 +4,5 @@
4
4
  * Interpolated into every workflow's instructions so generated skills
5
5
  * consistently teach how to target a registered store with `--store <id>`.
6
6
  */
7
- export const STORE_SELECTION_GUIDANCE = `**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.`;
7
+ export const STORE_SELECTION_GUIDANCE = `**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\`, \`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.`;
8
8
  //# sourceMappingURL=store-selection.js.map