@fission-ai/openspec 0.23.0 → 1.0.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 (183) hide show
  1. package/README.md +111 -382
  2. package/dist/cli/index.js +120 -6
  3. package/dist/commands/workflow/index.d.ts +17 -0
  4. package/dist/commands/workflow/index.js +12 -0
  5. package/dist/commands/workflow/instructions.d.ts +29 -0
  6. package/dist/commands/workflow/instructions.js +381 -0
  7. package/dist/commands/workflow/new-change.d.ts +11 -0
  8. package/dist/commands/workflow/new-change.js +44 -0
  9. package/dist/commands/workflow/schemas.d.ts +10 -0
  10. package/dist/commands/workflow/schemas.js +34 -0
  11. package/dist/commands/workflow/shared.d.ts +52 -0
  12. package/dist/commands/workflow/shared.js +111 -0
  13. package/dist/commands/workflow/status.d.ts +14 -0
  14. package/dist/commands/workflow/status.js +58 -0
  15. package/dist/commands/workflow/templates.d.ts +16 -0
  16. package/dist/commands/workflow/templates.js +68 -0
  17. package/dist/core/artifact-graph/instruction-loader.d.ts +5 -1
  18. package/dist/core/artifact-graph/instruction-loader.js +8 -19
  19. package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
  20. package/dist/core/command-generation/adapters/amazon-q.js +26 -0
  21. package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
  22. package/dist/core/command-generation/adapters/antigravity.js +26 -0
  23. package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
  24. package/dist/core/command-generation/adapters/auggie.js +27 -0
  25. package/dist/core/command-generation/adapters/claude.d.ts +13 -0
  26. package/dist/core/command-generation/adapters/claude.js +50 -0
  27. package/dist/core/command-generation/adapters/cline.d.ts +14 -0
  28. package/dist/core/command-generation/adapters/cline.js +27 -0
  29. package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
  30. package/dist/core/command-generation/adapters/codebuddy.js +28 -0
  31. package/dist/core/command-generation/adapters/codex.d.ts +13 -0
  32. package/dist/core/command-generation/adapters/codex.js +27 -0
  33. package/dist/core/command-generation/adapters/continue.d.ts +13 -0
  34. package/dist/core/command-generation/adapters/continue.js +28 -0
  35. package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
  36. package/dist/core/command-generation/adapters/costrict.js +27 -0
  37. package/dist/core/command-generation/adapters/crush.d.ts +13 -0
  38. package/dist/core/command-generation/adapters/crush.js +30 -0
  39. package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
  40. package/dist/core/command-generation/adapters/cursor.js +44 -0
  41. package/dist/core/command-generation/adapters/factory.d.ts +13 -0
  42. package/dist/core/command-generation/adapters/factory.js +27 -0
  43. package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
  44. package/dist/core/command-generation/adapters/gemini.js +26 -0
  45. package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
  46. package/dist/core/command-generation/adapters/github-copilot.js +26 -0
  47. package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
  48. package/dist/core/command-generation/adapters/iflow.js +29 -0
  49. package/dist/core/command-generation/adapters/index.d.ts +27 -0
  50. package/dist/core/command-generation/adapters/index.js +27 -0
  51. package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
  52. package/dist/core/command-generation/adapters/kilocode.js +23 -0
  53. package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
  54. package/dist/core/command-generation/adapters/opencode.js +26 -0
  55. package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
  56. package/dist/core/command-generation/adapters/qoder.js +30 -0
  57. package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
  58. package/dist/core/command-generation/adapters/qwen.js +26 -0
  59. package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
  60. package/dist/core/command-generation/adapters/roocode.js +27 -0
  61. package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
  62. package/dist/core/command-generation/adapters/windsurf.js +51 -0
  63. package/dist/core/command-generation/generator.d.ts +21 -0
  64. package/dist/core/command-generation/generator.js +27 -0
  65. package/dist/core/command-generation/index.d.ts +22 -0
  66. package/dist/core/command-generation/index.js +24 -0
  67. package/dist/core/command-generation/registry.d.ts +36 -0
  68. package/dist/core/command-generation/registry.js +88 -0
  69. package/dist/core/command-generation/types.d.ts +55 -0
  70. package/dist/core/command-generation/types.js +8 -0
  71. package/dist/core/config.d.ts +1 -0
  72. package/dist/core/config.js +21 -21
  73. package/dist/core/init.d.ts +16 -36
  74. package/dist/core/init.js +323 -534
  75. package/dist/core/legacy-cleanup.d.ts +162 -0
  76. package/dist/core/legacy-cleanup.js +501 -0
  77. package/dist/core/shared/index.d.ts +8 -0
  78. package/dist/core/shared/index.js +8 -0
  79. package/dist/core/shared/skill-generation.d.ts +41 -0
  80. package/dist/core/shared/skill-generation.js +76 -0
  81. package/dist/core/shared/tool-detection.d.ts +66 -0
  82. package/dist/core/shared/tool-detection.js +140 -0
  83. package/dist/core/templates/index.d.ts +7 -16
  84. package/dist/core/templates/index.js +8 -36
  85. package/dist/core/templates/skill-templates.d.ts +13 -0
  86. package/dist/core/templates/skill-templates.js +627 -21
  87. package/dist/core/update.d.ts +38 -0
  88. package/dist/core/update.js +280 -62
  89. package/dist/prompts/searchable-multi-select.d.ts +27 -0
  90. package/dist/prompts/searchable-multi-select.js +149 -0
  91. package/dist/ui/ascii-patterns.d.ts +16 -0
  92. package/dist/ui/ascii-patterns.js +133 -0
  93. package/dist/ui/welcome-screen.d.ts +10 -0
  94. package/dist/ui/welcome-screen.js +146 -0
  95. package/dist/utils/file-system.d.ts +11 -0
  96. package/dist/utils/file-system.js +65 -2
  97. package/dist/utils/index.d.ts +1 -0
  98. package/dist/utils/index.js +2 -0
  99. package/package.json +1 -1
  100. package/dist/commands/artifact-workflow.d.ts +0 -17
  101. package/dist/commands/artifact-workflow.js +0 -915
  102. package/dist/core/configurators/agents.d.ts +0 -8
  103. package/dist/core/configurators/agents.js +0 -15
  104. package/dist/core/configurators/base.d.ts +0 -7
  105. package/dist/core/configurators/base.js +0 -2
  106. package/dist/core/configurators/claude.d.ts +0 -8
  107. package/dist/core/configurators/claude.js +0 -15
  108. package/dist/core/configurators/cline.d.ts +0 -8
  109. package/dist/core/configurators/cline.js +0 -15
  110. package/dist/core/configurators/codebuddy.d.ts +0 -8
  111. package/dist/core/configurators/codebuddy.js +0 -15
  112. package/dist/core/configurators/costrict.d.ts +0 -8
  113. package/dist/core/configurators/costrict.js +0 -15
  114. package/dist/core/configurators/iflow.d.ts +0 -8
  115. package/dist/core/configurators/iflow.js +0 -15
  116. package/dist/core/configurators/qoder.d.ts +0 -30
  117. package/dist/core/configurators/qoder.js +0 -42
  118. package/dist/core/configurators/qwen.d.ts +0 -24
  119. package/dist/core/configurators/qwen.js +0 -37
  120. package/dist/core/configurators/registry.d.ts +0 -9
  121. package/dist/core/configurators/registry.js +0 -43
  122. package/dist/core/configurators/slash/amazon-q.d.ts +0 -9
  123. package/dist/core/configurators/slash/amazon-q.js +0 -46
  124. package/dist/core/configurators/slash/antigravity.d.ts +0 -9
  125. package/dist/core/configurators/slash/antigravity.js +0 -23
  126. package/dist/core/configurators/slash/auggie.d.ts +0 -9
  127. package/dist/core/configurators/slash/auggie.js +0 -31
  128. package/dist/core/configurators/slash/base.d.ts +0 -19
  129. package/dist/core/configurators/slash/base.js +0 -69
  130. package/dist/core/configurators/slash/claude.d.ts +0 -9
  131. package/dist/core/configurators/slash/claude.js +0 -37
  132. package/dist/core/configurators/slash/cline.d.ts +0 -9
  133. package/dist/core/configurators/slash/cline.js +0 -23
  134. package/dist/core/configurators/slash/codebuddy.d.ts +0 -9
  135. package/dist/core/configurators/slash/codebuddy.js +0 -34
  136. package/dist/core/configurators/slash/codex.d.ts +0 -14
  137. package/dist/core/configurators/slash/codex.js +0 -109
  138. package/dist/core/configurators/slash/continue.d.ts +0 -9
  139. package/dist/core/configurators/slash/continue.js +0 -46
  140. package/dist/core/configurators/slash/costrict.d.ts +0 -9
  141. package/dist/core/configurators/slash/costrict.js +0 -31
  142. package/dist/core/configurators/slash/crush.d.ts +0 -9
  143. package/dist/core/configurators/slash/crush.js +0 -37
  144. package/dist/core/configurators/slash/cursor.d.ts +0 -9
  145. package/dist/core/configurators/slash/cursor.js +0 -37
  146. package/dist/core/configurators/slash/factory.d.ts +0 -10
  147. package/dist/core/configurators/slash/factory.js +0 -35
  148. package/dist/core/configurators/slash/gemini.d.ts +0 -9
  149. package/dist/core/configurators/slash/gemini.js +0 -22
  150. package/dist/core/configurators/slash/github-copilot.d.ts +0 -9
  151. package/dist/core/configurators/slash/github-copilot.js +0 -34
  152. package/dist/core/configurators/slash/iflow.d.ts +0 -9
  153. package/dist/core/configurators/slash/iflow.js +0 -37
  154. package/dist/core/configurators/slash/kilocode.d.ts +0 -9
  155. package/dist/core/configurators/slash/kilocode.js +0 -17
  156. package/dist/core/configurators/slash/opencode.d.ts +0 -12
  157. package/dist/core/configurators/slash/opencode.js +0 -72
  158. package/dist/core/configurators/slash/qoder.d.ts +0 -35
  159. package/dist/core/configurators/slash/qoder.js +0 -76
  160. package/dist/core/configurators/slash/qwen.d.ts +0 -32
  161. package/dist/core/configurators/slash/qwen.js +0 -49
  162. package/dist/core/configurators/slash/registry.d.ts +0 -8
  163. package/dist/core/configurators/slash/registry.js +0 -78
  164. package/dist/core/configurators/slash/roocode.d.ts +0 -9
  165. package/dist/core/configurators/slash/roocode.js +0 -23
  166. package/dist/core/configurators/slash/toml-base.d.ts +0 -10
  167. package/dist/core/configurators/slash/toml-base.js +0 -53
  168. package/dist/core/configurators/slash/windsurf.d.ts +0 -9
  169. package/dist/core/configurators/slash/windsurf.js +0 -23
  170. package/dist/core/templates/agents-root-stub.d.ts +0 -2
  171. package/dist/core/templates/agents-root-stub.js +0 -17
  172. package/dist/core/templates/agents-template.d.ts +0 -2
  173. package/dist/core/templates/agents-template.js +0 -458
  174. package/dist/core/templates/claude-template.d.ts +0 -2
  175. package/dist/core/templates/claude-template.js +0 -2
  176. package/dist/core/templates/cline-template.d.ts +0 -2
  177. package/dist/core/templates/cline-template.js +0 -2
  178. package/dist/core/templates/costrict-template.d.ts +0 -2
  179. package/dist/core/templates/costrict-template.js +0 -2
  180. package/dist/core/templates/project-template.d.ts +0 -8
  181. package/dist/core/templates/project-template.js +0 -32
  182. package/dist/core/templates/slash-command-templates.d.ts +0 -4
  183. package/dist/core/templates/slash-command-templates.js +0 -49
@@ -293,7 +293,10 @@ But this summary is optional. Sometimes the thinking IS the value.
293
293
  - **Don't auto-capture** - Offer to save insights, don't just do it
294
294
  - **Do visualize** - A good diagram is worth many paragraphs
295
295
  - **Do explore the codebase** - Ground discussions in reality
296
- - **Do question assumptions** - Including the user's and your own`
296
+ - **Do question assumptions** - Including the user's and your own`,
297
+ license: 'MIT',
298
+ compatibility: 'Requires openspec CLI.',
299
+ metadata: { author: 'openspec', version: '1.0' },
297
300
  };
298
301
  }
299
302
  /**
@@ -367,7 +370,10 @@ After completing the steps, summarize:
367
370
  - Do NOT advance beyond showing the first artifact template
368
371
  - If the name is invalid (not kebab-case), ask for a valid name
369
372
  - If a change with that name already exists, suggest continuing that change instead
370
- - Pass --schema if using a non-default workflow`
373
+ - Pass --schema if using a non-default workflow`,
374
+ license: 'MIT',
375
+ compatibility: 'Requires openspec CLI.',
376
+ metadata: { author: 'openspec', version: '1.0' },
371
377
  };
372
378
  }
373
379
  /**
@@ -425,10 +431,17 @@ export function getContinueChangeSkillTemplate() {
425
431
  \`\`\`bash
426
432
  openspec instructions <artifact-id> --change "<name>" --json
427
433
  \`\`\`
428
- - Parse the JSON to get template, dependencies, and what it unlocks
429
- - **Create the artifact file** using the template as a starting point:
434
+ - Parse the JSON. The key fields are:
435
+ - \`context\`: Project background (constraints for you - do NOT include in output)
436
+ - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
437
+ - \`template\`: The structure to use for your output file
438
+ - \`instruction\`: Schema-specific guidance
439
+ - \`outputPath\`: Where to write the artifact
440
+ - \`dependencies\`: Completed artifacts to read for context
441
+ - **Create the artifact file**:
430
442
  - Read any completed dependency files for context
431
- - Fill in the template based on context and user's goals
443
+ - Use \`template\` as the structure - fill in its sections
444
+ - Apply \`context\` and \`rules\` as constraints when writing - but do NOT copy them into the file
432
445
  - Write to the output path specified in instructions
433
446
  - Show what was created and what's now unlocked
434
447
  - STOP after creating ONE artifact
@@ -480,7 +493,13 @@ For other schemas, follow the \`instruction\` field from the CLI output.
480
493
  - Never skip artifacts or create out of order
481
494
  - If context is unclear, ask the user before creating
482
495
  - Verify the artifact file exists after writing before marking progress
483
- - Use the schema's artifact sequence, don't assume specific artifact names`
496
+ - Use the schema's artifact sequence, don't assume specific artifact names
497
+ - **IMPORTANT**: \`context\` and \`rules\` are constraints for YOU, not content for the file
498
+ - Do NOT copy \`<context>\`, \`<rules>\`, \`<project_context>\` blocks into the artifact
499
+ - These guide what you write, but should never appear in the output`,
500
+ license: 'MIT',
501
+ compatibility: 'Requires openspec CLI.',
502
+ metadata: { author: 'openspec', version: '1.0' },
484
503
  };
485
504
  }
486
505
  /**
@@ -636,7 +655,10 @@ What would you like to do?
636
655
  This skill supports the "actions on a change" model:
637
656
 
638
657
  - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
639
- - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly`
658
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly`,
659
+ license: 'MIT',
660
+ compatibility: 'Requires openspec CLI.',
661
+ metadata: { author: 'openspec', version: '1.0' },
640
662
  };
641
663
  }
642
664
  /**
@@ -688,12 +710,15 @@ export function getFfChangeSkillTemplate() {
688
710
  openspec instructions <artifact-id> --change "<name>" --json
689
711
  \`\`\`
690
712
  - The instructions JSON includes:
691
- - \`template\`: The template content to use
713
+ - \`context\`: Project background (constraints for you - do NOT include in output)
714
+ - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
715
+ - \`template\`: The structure to use for your output file
692
716
  - \`instruction\`: Schema-specific guidance for this artifact type
693
717
  - \`outputPath\`: Where to write the artifact
694
718
  - \`dependencies\`: Completed artifacts to read for context
695
719
  - Read any completed dependency files for context
696
- - Create the artifact file following the schema's \`instruction\`
720
+ - Create the artifact file using \`template\` as the structure
721
+ - Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
697
722
  - Show brief progress: "✓ Created <artifact-id>"
698
723
 
699
724
  b. **Continue until all \`applyRequires\` artifacts are complete**
@@ -723,14 +748,20 @@ After completing all artifacts, summarize:
723
748
  - Follow the \`instruction\` field from \`openspec instructions\` for each artifact type
724
749
  - The schema defines what each artifact should contain - follow it
725
750
  - Read dependency artifacts for context before creating new ones
726
- - Use the \`template\` as a starting point, filling in based on context
751
+ - Use \`template\` as the structure for your output file - fill in its sections
752
+ - **IMPORTANT**: \`context\` and \`rules\` are constraints for YOU, not content for the file
753
+ - Do NOT copy \`<context>\`, \`<rules>\`, \`<project_context>\` blocks into the artifact
754
+ - These guide what you write, but should never appear in the output
727
755
 
728
756
  **Guardrails**
729
757
  - Create ALL artifacts needed for implementation (as defined by schema's \`apply.requires\`)
730
758
  - Always read dependency artifacts before creating a new one
731
759
  - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
732
760
  - If a change with that name already exists, suggest continuing that change instead
733
- - Verify each artifact file exists after writing before proceeding to next`
761
+ - Verify each artifact file exists after writing before proceeding to next`,
762
+ license: 'MIT',
763
+ compatibility: 'Requires openspec CLI.',
764
+ metadata: { author: 'openspec', version: '1.0' },
734
765
  };
735
766
  }
736
767
  /**
@@ -867,9 +898,549 @@ Main specs are now updated. The change remains active - archive when implementat
867
898
  - Preserve existing content not mentioned in delta
868
899
  - If something is unclear, ask for clarification
869
900
  - Show what you're changing as you go
870
- - The operation should be idempotent - running twice should give same result`
901
+ - The operation should be idempotent - running twice should give same result`,
902
+ license: 'MIT',
903
+ compatibility: 'Requires openspec CLI.',
904
+ metadata: { author: 'openspec', version: '1.0' },
871
905
  };
872
906
  }
907
+ /**
908
+ * Template for openspec-onboard skill
909
+ * Guided onboarding through the complete OpenSpec workflow
910
+ */
911
+ export function getOnboardSkillTemplate() {
912
+ return {
913
+ name: 'openspec-onboard',
914
+ description: 'Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.',
915
+ instructions: getOnboardInstructions(),
916
+ license: 'MIT',
917
+ compatibility: 'Requires openspec CLI.',
918
+ metadata: { author: 'openspec', version: '1.0' },
919
+ };
920
+ }
921
+ /**
922
+ * Shared onboarding instructions used by both skill and command templates.
923
+ */
924
+ function getOnboardInstructions() {
925
+ return `Guide the user through their first complete OpenSpec workflow cycle. This is a teaching experience—you'll do real work in their codebase while explaining each step.
926
+
927
+ ---
928
+
929
+ ## Preflight
930
+
931
+ Before starting, check if OpenSpec is initialized:
932
+
933
+ \`\`\`bash
934
+ openspec status --json 2>&1 || echo "NOT_INITIALIZED"
935
+ \`\`\`
936
+
937
+ **If not initialized:**
938
+ > OpenSpec isn't set up in this project yet. Run \`openspec init\` first, then come back to \`/opsx:onboard\`.
939
+
940
+ Stop here if not initialized.
941
+
942
+ ---
943
+
944
+ ## Phase 1: Welcome
945
+
946
+ Display:
947
+
948
+ \`\`\`
949
+ ## Welcome to OpenSpec!
950
+
951
+ I'll walk you through a complete change cycle—from idea to implementation—using a real task in your codebase. Along the way, you'll learn the workflow by doing it.
952
+
953
+ **What we'll do:**
954
+ 1. Pick a small, real task in your codebase
955
+ 2. Explore the problem briefly
956
+ 3. Create a change (the container for our work)
957
+ 4. Build the artifacts: proposal → specs → design → tasks
958
+ 5. Implement the tasks
959
+ 6. Archive the completed change
960
+
961
+ **Time:** ~15-20 minutes
962
+
963
+ Let's start by finding something to work on.
964
+ \`\`\`
965
+
966
+ ---
967
+
968
+ ## Phase 2: Task Selection
969
+
970
+ ### Codebase Analysis
971
+
972
+ Scan the codebase for small improvement opportunities. Look for:
973
+
974
+ 1. **TODO/FIXME comments** - Search for \`TODO\`, \`FIXME\`, \`HACK\`, \`XXX\` in code files
975
+ 2. **Missing error handling** - \`catch\` blocks that swallow errors, risky operations without try-catch
976
+ 3. **Functions without tests** - Cross-reference \`src/\` with test directories
977
+ 4. **Type issues** - \`any\` types in TypeScript files (\`: any\`, \`as any\`)
978
+ 5. **Debug artifacts** - \`console.log\`, \`console.debug\`, \`debugger\` statements in non-debug code
979
+ 6. **Missing validation** - User input handlers without validation
980
+
981
+ Also check recent git activity:
982
+ \`\`\`bash
983
+ git log --oneline -10 2>/dev/null || echo "No git history"
984
+ \`\`\`
985
+
986
+ ### Present Suggestions
987
+
988
+ From your analysis, present 3-4 specific suggestions:
989
+
990
+ \`\`\`
991
+ ## Task Suggestions
992
+
993
+ Based on scanning your codebase, here are some good starter tasks:
994
+
995
+ **1. [Most promising task]**
996
+ Location: \`src/path/to/file.ts:42\`
997
+ Scope: ~1-2 files, ~20-30 lines
998
+ Why it's good: [brief reason]
999
+
1000
+ **2. [Second task]**
1001
+ Location: \`src/another/file.ts\`
1002
+ Scope: ~1 file, ~15 lines
1003
+ Why it's good: [brief reason]
1004
+
1005
+ **3. [Third task]**
1006
+ Location: [location]
1007
+ Scope: [estimate]
1008
+ Why it's good: [brief reason]
1009
+
1010
+ **4. Something else?**
1011
+ Tell me what you'd like to work on.
1012
+
1013
+ Which task interests you? (Pick a number or describe your own)
1014
+ \`\`\`
1015
+
1016
+ **If nothing found:** Fall back to asking what the user wants to build:
1017
+ > I didn't find obvious quick wins in your codebase. What's something small you've been meaning to add or fix?
1018
+
1019
+ ### Scope Guardrail
1020
+
1021
+ If the user picks or describes something too large (major feature, multi-day work):
1022
+
1023
+ \`\`\`
1024
+ That's a valuable task, but it's probably larger than ideal for your first OpenSpec run-through.
1025
+
1026
+ For learning the workflow, smaller is better—it lets you see the full cycle without getting stuck in implementation details.
1027
+
1028
+ **Options:**
1029
+ 1. **Slice it smaller** - What's the smallest useful piece of [their task]? Maybe just [specific slice]?
1030
+ 2. **Pick something else** - One of the other suggestions, or a different small task?
1031
+ 3. **Do it anyway** - If you really want to tackle this, we can. Just know it'll take longer.
1032
+
1033
+ What would you prefer?
1034
+ \`\`\`
1035
+
1036
+ Let the user override if they insist—this is a soft guardrail.
1037
+
1038
+ ---
1039
+
1040
+ ## Phase 3: Explore Demo
1041
+
1042
+ Once a task is selected, briefly demonstrate explore mode:
1043
+
1044
+ \`\`\`
1045
+ Before we create a change, let me quickly show you **explore mode**—it's how you think through problems before committing to a direction.
1046
+ \`\`\`
1047
+
1048
+ Spend 1-2 minutes investigating the relevant code:
1049
+ - Read the file(s) involved
1050
+ - Draw a quick ASCII diagram if it helps
1051
+ - Note any considerations
1052
+
1053
+ \`\`\`
1054
+ ## Quick Exploration
1055
+
1056
+ [Your brief analysis—what you found, any considerations]
1057
+
1058
+ ┌─────────────────────────────────────────┐
1059
+ │ [Optional: ASCII diagram if helpful] │
1060
+ └─────────────────────────────────────────┘
1061
+
1062
+ Explore mode (\`/opsx:explore\`) is for this kind of thinking—investigating before implementing. You can use it anytime you need to think through a problem.
1063
+
1064
+ Now let's create a change to hold our work.
1065
+ \`\`\`
1066
+
1067
+ **PAUSE** - Wait for user acknowledgment before proceeding.
1068
+
1069
+ ---
1070
+
1071
+ ## Phase 4: Create the Change
1072
+
1073
+ **EXPLAIN:**
1074
+ \`\`\`
1075
+ ## Creating a Change
1076
+
1077
+ A "change" in OpenSpec is a container for all the thinking and planning around a piece of work. It lives in \`openspec/changes/<name>/\` and holds your artifacts—proposal, specs, design, tasks.
1078
+
1079
+ Let me create one for our task.
1080
+ \`\`\`
1081
+
1082
+ **DO:** Create the change with a derived kebab-case name:
1083
+ \`\`\`bash
1084
+ openspec new change "<derived-name>"
1085
+ \`\`\`
1086
+
1087
+ **SHOW:**
1088
+ \`\`\`
1089
+ Created: \`openspec/changes/<name>/\`
1090
+
1091
+ The folder structure:
1092
+ \`\`\`
1093
+ openspec/changes/<name>/
1094
+ ├── proposal.md ← Why we're doing this (empty, we'll fill it)
1095
+ ├── design.md ← How we'll build it (empty)
1096
+ ├── specs/ ← Detailed requirements (empty)
1097
+ └── tasks.md ← Implementation checklist (empty)
1098
+ \`\`\`
1099
+
1100
+ Now let's fill in the first artifact—the proposal.
1101
+ \`\`\`
1102
+
1103
+ ---
1104
+
1105
+ ## Phase 5: Proposal
1106
+
1107
+ **EXPLAIN:**
1108
+ \`\`\`
1109
+ ## The Proposal
1110
+
1111
+ The proposal captures **why** we're making this change and **what** it involves at a high level. It's the "elevator pitch" for the work.
1112
+
1113
+ I'll draft one based on our task.
1114
+ \`\`\`
1115
+
1116
+ **DO:** Draft the proposal content (don't save yet):
1117
+
1118
+ \`\`\`
1119
+ Here's a draft proposal:
1120
+
1121
+ ---
1122
+
1123
+ ## Why
1124
+
1125
+ [1-2 sentences explaining the problem/opportunity]
1126
+
1127
+ ## What Changes
1128
+
1129
+ [Bullet points of what will be different]
1130
+
1131
+ ## Capabilities
1132
+
1133
+ ### New Capabilities
1134
+ - \`<capability-name>\`: [brief description]
1135
+
1136
+ ### Modified Capabilities
1137
+ <!-- If modifying existing behavior -->
1138
+
1139
+ ## Impact
1140
+
1141
+ - \`src/path/to/file.ts\`: [what changes]
1142
+ - [other files if applicable]
1143
+
1144
+ ---
1145
+
1146
+ Does this capture the intent? I can adjust before we save it.
1147
+ \`\`\`
1148
+
1149
+ **PAUSE** - Wait for user approval/feedback.
1150
+
1151
+ After approval, save the proposal:
1152
+ \`\`\`bash
1153
+ openspec instructions proposal --change "<name>" --json
1154
+ \`\`\`
1155
+ Then write the content to \`openspec/changes/<name>/proposal.md\`.
1156
+
1157
+ \`\`\`
1158
+ Proposal saved. This is your "why" document—you can always come back and refine it as understanding evolves.
1159
+
1160
+ Next up: specs.
1161
+ \`\`\`
1162
+
1163
+ ---
1164
+
1165
+ ## Phase 6: Specs
1166
+
1167
+ **EXPLAIN:**
1168
+ \`\`\`
1169
+ ## Specs
1170
+
1171
+ Specs define **what** we're building in precise, testable terms. They use a requirement/scenario format that makes expected behavior crystal clear.
1172
+
1173
+ For a small task like this, we might only need one spec file.
1174
+ \`\`\`
1175
+
1176
+ **DO:** Create the spec file:
1177
+ \`\`\`bash
1178
+ mkdir -p openspec/changes/<name>/specs/<capability-name>
1179
+ \`\`\`
1180
+
1181
+ Draft the spec content:
1182
+
1183
+ \`\`\`
1184
+ Here's the spec:
1185
+
1186
+ ---
1187
+
1188
+ ## ADDED Requirements
1189
+
1190
+ ### Requirement: <Name>
1191
+
1192
+ <Description of what the system should do>
1193
+
1194
+ #### Scenario: <Scenario name>
1195
+
1196
+ - **WHEN** <trigger condition>
1197
+ - **THEN** <expected outcome>
1198
+ - **AND** <additional outcome if needed>
1199
+
1200
+ ---
1201
+
1202
+ This format—WHEN/THEN/AND—makes requirements testable. You can literally read them as test cases.
1203
+ \`\`\`
1204
+
1205
+ Save to \`openspec/changes/<name>/specs/<capability>/spec.md\`.
1206
+
1207
+ ---
1208
+
1209
+ ## Phase 7: Design
1210
+
1211
+ **EXPLAIN:**
1212
+ \`\`\`
1213
+ ## Design
1214
+
1215
+ The design captures **how** we'll build it—technical decisions, tradeoffs, approach.
1216
+
1217
+ For small changes, this might be brief. That's fine—not every change needs deep design discussion.
1218
+ \`\`\`
1219
+
1220
+ **DO:** Draft design.md:
1221
+
1222
+ \`\`\`
1223
+ Here's the design:
1224
+
1225
+ ---
1226
+
1227
+ ## Context
1228
+
1229
+ [Brief context about the current state]
1230
+
1231
+ ## Goals / Non-Goals
1232
+
1233
+ **Goals:**
1234
+ - [What we're trying to achieve]
1235
+
1236
+ **Non-Goals:**
1237
+ - [What's explicitly out of scope]
1238
+
1239
+ ## Decisions
1240
+
1241
+ ### Decision 1: [Key decision]
1242
+
1243
+ [Explanation of approach and rationale]
1244
+
1245
+ ---
1246
+
1247
+ For a small task, this captures the key decisions without over-engineering.
1248
+ \`\`\`
1249
+
1250
+ Save to \`openspec/changes/<name>/design.md\`.
1251
+
1252
+ ---
1253
+
1254
+ ## Phase 8: Tasks
1255
+
1256
+ **EXPLAIN:**
1257
+ \`\`\`
1258
+ ## Tasks
1259
+
1260
+ Finally, we break the work into implementation tasks—checkboxes that drive the apply phase.
1261
+
1262
+ These should be small, clear, and in logical order.
1263
+ \`\`\`
1264
+
1265
+ **DO:** Generate tasks based on specs and design:
1266
+
1267
+ \`\`\`
1268
+ Here are the implementation tasks:
1269
+
1270
+ ---
1271
+
1272
+ ## 1. [Category or file]
1273
+
1274
+ - [ ] 1.1 [Specific task]
1275
+ - [ ] 1.2 [Specific task]
1276
+
1277
+ ## 2. Verify
1278
+
1279
+ - [ ] 2.1 [Verification step]
1280
+
1281
+ ---
1282
+
1283
+ Each checkbox becomes a unit of work in the apply phase. Ready to implement?
1284
+ \`\`\`
1285
+
1286
+ **PAUSE** - Wait for user to confirm they're ready to implement.
1287
+
1288
+ Save to \`openspec/changes/<name>/tasks.md\`.
1289
+
1290
+ ---
1291
+
1292
+ ## Phase 9: Apply (Implementation)
1293
+
1294
+ **EXPLAIN:**
1295
+ \`\`\`
1296
+ ## Implementation
1297
+
1298
+ Now we implement each task, checking them off as we go. I'll announce each one and occasionally note how the specs/design informed the approach.
1299
+ \`\`\`
1300
+
1301
+ **DO:** For each task:
1302
+
1303
+ 1. Announce: "Working on task N: [description]"
1304
+ 2. Implement the change in the codebase
1305
+ 3. Reference specs/design naturally: "The spec says X, so I'm doing Y"
1306
+ 4. Mark complete in tasks.md: \`- [ ]\` → \`- [x]\`
1307
+ 5. Brief status: "✓ Task N complete"
1308
+
1309
+ Keep narration light—don't over-explain every line of code.
1310
+
1311
+ After all tasks:
1312
+
1313
+ \`\`\`
1314
+ ## Implementation Complete
1315
+
1316
+ All tasks done:
1317
+ - [x] Task 1
1318
+ - [x] Task 2
1319
+ - [x] ...
1320
+
1321
+ The change is implemented! One more step—let's archive it.
1322
+ \`\`\`
1323
+
1324
+ ---
1325
+
1326
+ ## Phase 10: Archive
1327
+
1328
+ **EXPLAIN:**
1329
+ \`\`\`
1330
+ ## Archiving
1331
+
1332
+ When a change is complete, we archive it. This moves it from \`openspec/changes/\` to \`openspec/archive/YYYY-MM-DD--<name>/\`.
1333
+
1334
+ Archived changes become your project's decision history—you can always find them later to understand why something was built a certain way.
1335
+ \`\`\`
1336
+
1337
+ **DO:**
1338
+ \`\`\`bash
1339
+ openspec archive "<name>"
1340
+ \`\`\`
1341
+
1342
+ **SHOW:**
1343
+ \`\`\`
1344
+ Archived to: \`openspec/archive/YYYY-MM-DD--<name>/\`
1345
+
1346
+ The change is now part of your project's history. The code is in your codebase, the decision record is preserved.
1347
+ \`\`\`
1348
+
1349
+ ---
1350
+
1351
+ ## Phase 11: Recap & Next Steps
1352
+
1353
+ \`\`\`
1354
+ ## Congratulations!
1355
+
1356
+ You just completed a full OpenSpec cycle:
1357
+
1358
+ 1. **Explore** - Thought through the problem
1359
+ 2. **New** - Created a change container
1360
+ 3. **Proposal** - Captured WHY
1361
+ 4. **Specs** - Defined WHAT in detail
1362
+ 5. **Design** - Decided HOW
1363
+ 6. **Tasks** - Broke it into steps
1364
+ 7. **Apply** - Implemented the work
1365
+ 8. **Archive** - Preserved the record
1366
+
1367
+ This same rhythm works for any size change—a small fix or a major feature.
1368
+
1369
+ ---
1370
+
1371
+ ## Command Reference
1372
+
1373
+ | Command | What it does |
1374
+ |---------|--------------|
1375
+ | \`/opsx:explore\` | Think through problems before/during work |
1376
+ | \`/opsx:new\` | Start a new change, step through artifacts |
1377
+ | \`/opsx:ff\` | Fast-forward: create all artifacts at once |
1378
+ | \`/opsx:continue\` | Continue working on an existing change |
1379
+ | \`/opsx:apply\` | Implement tasks from a change |
1380
+ | \`/opsx:verify\` | Verify implementation matches artifacts |
1381
+ | \`/opsx:archive\` | Archive a completed change |
1382
+
1383
+ ---
1384
+
1385
+ ## What's Next?
1386
+
1387
+ Try \`/opsx:new\` or \`/opsx:ff\` on something you actually want to build. You've got the rhythm now!
1388
+ \`\`\`
1389
+
1390
+ ---
1391
+
1392
+ ## Graceful Exit Handling
1393
+
1394
+ ### User wants to stop mid-way
1395
+
1396
+ If the user says they need to stop, want to pause, or seem disengaged:
1397
+
1398
+ \`\`\`
1399
+ No problem! Your change is saved at \`openspec/changes/<name>/\`.
1400
+
1401
+ To pick up where we left off later:
1402
+ - \`/opsx:continue <name>\` - Resume artifact creation
1403
+ - \`/opsx:apply <name>\` - Jump to implementation (if tasks exist)
1404
+
1405
+ The work won't be lost. Come back whenever you're ready.
1406
+ \`\`\`
1407
+
1408
+ Exit gracefully without pressure.
1409
+
1410
+ ### User just wants command reference
1411
+
1412
+ If the user says they just want to see the commands or skip the tutorial:
1413
+
1414
+ \`\`\`
1415
+ ## OpenSpec Quick Reference
1416
+
1417
+ | Command | What it does |
1418
+ |---------|--------------|
1419
+ | \`/opsx:explore\` | Think through problems (no code changes) |
1420
+ | \`/opsx:new <name>\` | Start a new change, step by step |
1421
+ | \`/opsx:ff <name>\` | Fast-forward: all artifacts at once |
1422
+ | \`/opsx:continue <name>\` | Continue an existing change |
1423
+ | \`/opsx:apply <name>\` | Implement tasks |
1424
+ | \`/opsx:verify <name>\` | Verify implementation |
1425
+ | \`/opsx:archive <name>\` | Archive when done |
1426
+
1427
+ Try \`/opsx:new\` to start your first change, or \`/opsx:ff\` if you want to move fast.
1428
+ \`\`\`
1429
+
1430
+ Exit gracefully.
1431
+
1432
+ ---
1433
+
1434
+ ## Guardrails
1435
+
1436
+ - **Follow the EXPLAIN → DO → SHOW → PAUSE pattern** at key transitions (after explore, after proposal draft, after tasks, after archive)
1437
+ - **Keep narration light** during implementation—teach without lecturing
1438
+ - **Don't skip phases** even if the change is small—the goal is teaching the workflow
1439
+ - **Pause for acknowledgment** at marked points, but don't over-pause
1440
+ - **Handle exits gracefully**—never pressure the user to continue
1441
+ - **Use real codebase tasks**—don't simulate or use fake examples
1442
+ - **Adjust scope gently**—guide toward smaller tasks but respect user choice`;
1443
+ }
873
1444
  /**
874
1445
  * Template for /opsx:explore slash command
875
1446
  * Explore mode - adaptive thinking partner
@@ -1179,10 +1750,17 @@ export function getOpsxContinueCommandTemplate() {
1179
1750
  \`\`\`bash
1180
1751
  openspec instructions <artifact-id> --change "<name>" --json
1181
1752
  \`\`\`
1182
- - Parse the JSON to get template, dependencies, and what it unlocks
1183
- - **Create the artifact file** using the template as a starting point:
1753
+ - Parse the JSON. The key fields are:
1754
+ - \`context\`: Project background (constraints for you - do NOT include in output)
1755
+ - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
1756
+ - \`template\`: The structure to use for your output file
1757
+ - \`instruction\`: Schema-specific guidance
1758
+ - \`outputPath\`: Where to write the artifact
1759
+ - \`dependencies\`: Completed artifacts to read for context
1760
+ - **Create the artifact file**:
1184
1761
  - Read any completed dependency files for context
1185
- - Fill in the template based on context and user's goals
1762
+ - Use \`template\` as the structure - fill in its sections
1763
+ - Apply \`context\` and \`rules\` as constraints when writing - but do NOT copy them into the file
1186
1764
  - Write to the output path specified in instructions
1187
1765
  - Show what was created and what's now unlocked
1188
1766
  - STOP after creating ONE artifact
@@ -1234,7 +1812,10 @@ For other schemas, follow the \`instruction\` field from the CLI output.
1234
1812
  - Never skip artifacts or create out of order
1235
1813
  - If context is unclear, ask the user before creating
1236
1814
  - Verify the artifact file exists after writing before marking progress
1237
- - Use the schema's artifact sequence, don't assume specific artifact names`
1815
+ - Use the schema's artifact sequence, don't assume specific artifact names
1816
+ - **IMPORTANT**: \`context\` and \`rules\` are constraints for YOU, not content for the file
1817
+ - Do NOT copy \`<context>\`, \`<rules>\`, \`<project_context>\` blocks into the artifact
1818
+ - These guide what you write, but should never appear in the output`
1238
1819
  };
1239
1820
  }
1240
1821
  /**
@@ -1444,12 +2025,15 @@ export function getOpsxFfCommandTemplate() {
1444
2025
  openspec instructions <artifact-id> --change "<name>" --json
1445
2026
  \`\`\`
1446
2027
  - The instructions JSON includes:
1447
- - \`template\`: The template content to use
2028
+ - \`context\`: Project background (constraints for you - do NOT include in output)
2029
+ - \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
2030
+ - \`template\`: The structure to use for your output file
1448
2031
  - \`instruction\`: Schema-specific guidance for this artifact type
1449
2032
  - \`outputPath\`: Where to write the artifact
1450
2033
  - \`dependencies\`: Completed artifacts to read for context
1451
2034
  - Read any completed dependency files for context
1452
- - Create the artifact file following the schema's \`instruction\`
2035
+ - Create the artifact file using \`template\` as the structure
2036
+ - Apply \`context\` and \`rules\` as constraints - but do NOT copy them into the file
1453
2037
  - Show brief progress: "✓ Created <artifact-id>"
1454
2038
 
1455
2039
  b. **Continue until all \`applyRequires\` artifacts are complete**
@@ -1599,7 +2183,10 @@ All artifacts complete. All tasks complete.
1599
2183
  - Preserve .openspec.yaml when moving to archive (it moves with the directory)
1600
2184
  - Show clear summary of what happened
1601
2185
  - If sync is requested, use openspec-sync-specs approach (agent-driven)
1602
- - If delta specs exist, always run the sync assessment and show the combined summary before prompting`
2186
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting`,
2187
+ license: 'MIT',
2188
+ compatibility: 'Requires openspec CLI.',
2189
+ metadata: { author: 'openspec', version: '1.0' },
1603
2190
  };
1604
2191
  }
1605
2192
  /**
@@ -1844,7 +2431,10 @@ No active changes found. Use \`/opsx:new\` to create a new change.
1844
2431
  - Track and report all outcomes (success/skip/fail)
1845
2432
  - Preserve .openspec.yaml when moving to archive
1846
2433
  - Archive directory target uses current date: YYYY-MM-DD-<name>
1847
- - If archive target exists, fail that change but continue with others`
2434
+ - If archive target exists, fail that change but continue with others`,
2435
+ license: 'MIT',
2436
+ compatibility: 'Requires openspec CLI.',
2437
+ metadata: { author: 'openspec', version: '1.0' },
1848
2438
  };
1849
2439
  }
1850
2440
  /**
@@ -2149,7 +2739,10 @@ Use clear markdown with:
2149
2739
  - Grouped lists for issues (CRITICAL/WARNING/SUGGESTION)
2150
2740
  - Code references in format: \`file.ts:123\`
2151
2741
  - Specific, actionable recommendations
2152
- - No vague suggestions like "consider reviewing"`
2742
+ - No vague suggestions like "consider reviewing"`,
2743
+ license: 'MIT',
2744
+ compatibility: 'Requires openspec CLI.',
2745
+ metadata: { author: 'openspec', version: '1.0' },
2153
2746
  };
2154
2747
  }
2155
2748
  /**
@@ -2313,6 +2906,19 @@ Target archive directory already exists.
2313
2906
  - If delta specs exist, always run the sync assessment and show the combined summary before prompting`
2314
2907
  };
2315
2908
  }
2909
+ /**
2910
+ * Template for /opsx:onboard slash command
2911
+ * Guided onboarding through the complete OpenSpec workflow
2912
+ */
2913
+ export function getOpsxOnboardCommandTemplate() {
2914
+ return {
2915
+ name: 'OPSX: Onboard',
2916
+ description: 'Guided onboarding - walk through a complete OpenSpec workflow cycle with narration',
2917
+ category: 'Workflow',
2918
+ tags: ['workflow', 'onboarding', 'tutorial', 'learning'],
2919
+ content: getOnboardInstructions(),
2920
+ };
2921
+ }
2316
2922
  /**
2317
2923
  * Template for /opsx:bulk-archive slash command
2318
2924
  */