@lyhue1991/tvsearch 0.1.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 (86) hide show
  1. package/.claude/commands/opsx/apply.md +152 -0
  2. package/.claude/commands/opsx/archive.md +157 -0
  3. package/.claude/commands/opsx/explore.md +173 -0
  4. package/.claude/commands/opsx/propose.md +106 -0
  5. package/.claude/skills/openspec-apply-change/SKILL.md +156 -0
  6. package/.claude/skills/openspec-archive-change/SKILL.md +114 -0
  7. package/.claude/skills/openspec-explore/SKILL.md +288 -0
  8. package/.claude/skills/openspec-propose/SKILL.md +110 -0
  9. package/.opencode/command/opsx-apply.md +149 -0
  10. package/.opencode/command/opsx-archive.md +154 -0
  11. package/.opencode/command/opsx-explore.md +170 -0
  12. package/.opencode/command/opsx-propose.md +103 -0
  13. package/.opencode/skills/openspec-apply-change/SKILL.md +156 -0
  14. package/.opencode/skills/openspec-archive-change/SKILL.md +114 -0
  15. package/.opencode/skills/openspec-explore/SKILL.md +288 -0
  16. package/.opencode/skills/openspec-propose/SKILL.md +110 -0
  17. package/AGENTS.md +154 -0
  18. package/README.md +192 -0
  19. package/dist/api/tavily.d.ts +25 -0
  20. package/dist/api/tavily.d.ts.map +1 -0
  21. package/dist/api/tavily.js +94 -0
  22. package/dist/api/tavily.js.map +1 -0
  23. package/dist/cli.d.ts +4 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +52 -0
  26. package/dist/cli.js.map +1 -0
  27. package/dist/commands/config.d.ts +13 -0
  28. package/dist/commands/config.d.ts.map +1 -0
  29. package/dist/commands/config.js +64 -0
  30. package/dist/commands/config.js.map +1 -0
  31. package/dist/commands/search.d.ts +13 -0
  32. package/dist/commands/search.d.ts.map +1 -0
  33. package/dist/commands/search.js +66 -0
  34. package/dist/commands/search.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +4 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/types/index.d.ts +89 -0
  40. package/dist/types/index.d.ts.map +1 -0
  41. package/dist/types/index.js +10 -0
  42. package/dist/types/index.js.map +1 -0
  43. package/dist/utils/config.d.ts +55 -0
  44. package/dist/utils/config.d.ts.map +1 -0
  45. package/dist/utils/config.js +122 -0
  46. package/dist/utils/config.js.map +1 -0
  47. package/dist/utils/errors.d.ts +54 -0
  48. package/dist/utils/errors.d.ts.map +1 -0
  49. package/dist/utils/errors.js +109 -0
  50. package/dist/utils/errors.js.map +1 -0
  51. package/dist/utils/output.d.ts +26 -0
  52. package/dist/utils/output.d.ts.map +1 -0
  53. package/dist/utils/output.js +80 -0
  54. package/dist/utils/output.js.map +1 -0
  55. package/jest.config.js +18 -0
  56. package/openspec/changes/archive/2026-03-21-enhance-help-documentation/.openspec.yaml +2 -0
  57. package/openspec/changes/archive/2026-03-21-enhance-help-documentation/design.md +58 -0
  58. package/openspec/changes/archive/2026-03-21-enhance-help-documentation/proposal.md +31 -0
  59. package/openspec/changes/archive/2026-03-21-enhance-help-documentation/specs/cli-interface/spec.md +41 -0
  60. package/openspec/changes/archive/2026-03-21-enhance-help-documentation/tasks.md +27 -0
  61. package/openspec/changes/archive/2026-03-21-init-tavily-search/.openspec.yaml +2 -0
  62. package/openspec/changes/archive/2026-03-21-init-tavily-search/design.md +123 -0
  63. package/openspec/changes/archive/2026-03-21-init-tavily-search/proposal.md +29 -0
  64. package/openspec/changes/archive/2026-03-21-init-tavily-search/specs/cli-interface/spec.md +57 -0
  65. package/openspec/changes/archive/2026-03-21-init-tavily-search/specs/config-management/spec.md +45 -0
  66. package/openspec/changes/archive/2026-03-21-init-tavily-search/specs/web-search/spec.md +49 -0
  67. package/openspec/changes/archive/2026-03-21-init-tavily-search/tasks.md +59 -0
  68. package/openspec/config.yaml +20 -0
  69. package/openspec/specs/cli-interface/spec.md +79 -0
  70. package/openspec/specs/config-management/spec.md +45 -0
  71. package/openspec/specs/web-search/spec.md +49 -0
  72. package/package.json +50 -0
  73. package/skill/tvsearch/SKILL.md +212 -0
  74. package/src/api/tavily.ts +132 -0
  75. package/src/cli.ts +57 -0
  76. package/src/commands/config.ts +88 -0
  77. package/src/commands/search.ts +98 -0
  78. package/src/index.ts +4 -0
  79. package/src/types/index.ts +98 -0
  80. package/src/utils/config.ts +140 -0
  81. package/src/utils/errors.ts +127 -0
  82. package/src/utils/output.ts +96 -0
  83. package/test/config.test.ts +88 -0
  84. package/test/output.test.ts +76 -0
  85. package/test/tavily.test.ts +85 -0
  86. package/tsconfig.json +20 -0
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: "OPSX: Apply"
3
+ description: Implement tasks from an OpenSpec change (Experimental)
4
+ category: Workflow
5
+ tags: [workflow, artifacts, experimental]
6
+ ---
7
+
8
+ Implement tasks from an OpenSpec change.
9
+
10
+ **Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
11
+
12
+ **Steps**
13
+
14
+ 1. **Select the change**
15
+
16
+ If a name is provided, use it. Otherwise:
17
+ - Infer from conversation context if the user mentioned a change
18
+ - Auto-select if only one active change exists
19
+ - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
20
+
21
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
22
+
23
+ 2. **Check status to understand the schema**
24
+ ```bash
25
+ openspec status --change "<name>" --json
26
+ ```
27
+ Parse the JSON to understand:
28
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
29
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
30
+
31
+ 3. **Get apply instructions**
32
+
33
+ ```bash
34
+ openspec instructions apply --change "<name>" --json
35
+ ```
36
+
37
+ This returns:
38
+ - Context file paths (varies by schema)
39
+ - Progress (total, complete, remaining)
40
+ - Task list with status
41
+ - Dynamic instruction based on current state
42
+
43
+ **Handle states:**
44
+ - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue`
45
+ - If `state: "all_done"`: congratulate, suggest archive
46
+ - Otherwise: proceed to implementation
47
+
48
+ 4. **Read context files**
49
+
50
+ Read the files listed in `contextFiles` from the apply instructions output.
51
+ The files depend on the schema being used:
52
+ - **spec-driven**: proposal, specs, design, tasks
53
+ - Other schemas: follow the contextFiles from CLI output
54
+
55
+ 5. **Show current progress**
56
+
57
+ Display:
58
+ - Schema being used
59
+ - Progress: "N/M tasks complete"
60
+ - Remaining tasks overview
61
+ - Dynamic instruction from CLI
62
+
63
+ 6. **Implement tasks (loop until done or blocked)**
64
+
65
+ For each pending task:
66
+ - Show which task is being worked on
67
+ - Make the code changes required
68
+ - Keep changes minimal and focused
69
+ - Mark task complete in the tasks file: `- [ ]` → `- [x]`
70
+ - Continue to next task
71
+
72
+ **Pause if:**
73
+ - Task is unclear → ask for clarification
74
+ - Implementation reveals a design issue → suggest updating artifacts
75
+ - Error or blocker encountered → report and wait for guidance
76
+ - User interrupts
77
+
78
+ 7. **On completion or pause, show status**
79
+
80
+ Display:
81
+ - Tasks completed this session
82
+ - Overall progress: "N/M tasks complete"
83
+ - If all done: suggest archive
84
+ - If paused: explain why and wait for guidance
85
+
86
+ **Output During Implementation**
87
+
88
+ ```
89
+ ## Implementing: <change-name> (schema: <schema-name>)
90
+
91
+ Working on task 3/7: <task description>
92
+ [...implementation happening...]
93
+ ✓ Task complete
94
+
95
+ Working on task 4/7: <task description>
96
+ [...implementation happening...]
97
+ ✓ Task complete
98
+ ```
99
+
100
+ **Output On Completion**
101
+
102
+ ```
103
+ ## Implementation Complete
104
+
105
+ **Change:** <change-name>
106
+ **Schema:** <schema-name>
107
+ **Progress:** 7/7 tasks complete ✓
108
+
109
+ ### Completed This Session
110
+ - [x] Task 1
111
+ - [x] Task 2
112
+ ...
113
+
114
+ All tasks complete! You can archive this change with `/opsx:archive`.
115
+ ```
116
+
117
+ **Output On Pause (Issue Encountered)**
118
+
119
+ ```
120
+ ## Implementation Paused
121
+
122
+ **Change:** <change-name>
123
+ **Schema:** <schema-name>
124
+ **Progress:** 4/7 tasks complete
125
+
126
+ ### Issue Encountered
127
+ <description of the issue>
128
+
129
+ **Options:**
130
+ 1. <option 1>
131
+ 2. <option 2>
132
+ 3. Other approach
133
+
134
+ What would you like to do?
135
+ ```
136
+
137
+ **Guardrails**
138
+ - Keep going through tasks until done or blocked
139
+ - Always read context files before starting (from the apply instructions output)
140
+ - If task is ambiguous, pause and ask before implementing
141
+ - If implementation reveals issues, pause and suggest artifact updates
142
+ - Keep code changes minimal and scoped to each task
143
+ - Update task checkbox immediately after completing each task
144
+ - Pause on errors, blockers, or unclear requirements - don't guess
145
+ - Use contextFiles from CLI output, don't assume specific file names
146
+
147
+ **Fluid Workflow Integration**
148
+
149
+ This skill supports the "actions on a change" model:
150
+
151
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
152
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
@@ -0,0 +1,157 @@
1
+ ---
2
+ name: "OPSX: Archive"
3
+ description: Archive a completed change in the experimental workflow
4
+ category: Workflow
5
+ tags: [workflow, archive, experimental]
6
+ ---
7
+
8
+ Archive a completed change in the experimental workflow.
9
+
10
+ **Input**: Optionally specify a change name after `/opsx:archive` (e.g., `/opsx:archive add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
11
+
12
+ **Steps**
13
+
14
+ 1. **If no change name provided, prompt for selection**
15
+
16
+ Run `openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
17
+
18
+ Show only active changes (not already archived).
19
+ Include the schema used for each change if available.
20
+
21
+ **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
22
+
23
+ 2. **Check artifact completion status**
24
+
25
+ Run `openspec status --change "<name>" --json` to check artifact completion.
26
+
27
+ Parse the JSON to understand:
28
+ - `schemaName`: The workflow being used
29
+ - `artifacts`: List of artifacts with their status (`done` or other)
30
+
31
+ **If any artifacts are not `done`:**
32
+ - Display warning listing incomplete artifacts
33
+ - Prompt user for confirmation to continue
34
+ - Proceed if user confirms
35
+
36
+ 3. **Check task completion status**
37
+
38
+ Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
39
+
40
+ Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
41
+
42
+ **If incomplete tasks found:**
43
+ - Display warning showing count of incomplete tasks
44
+ - Prompt user for confirmation to continue
45
+ - Proceed if user confirms
46
+
47
+ **If no tasks file exists:** Proceed without task-related warning.
48
+
49
+ 4. **Assess delta spec sync state**
50
+
51
+ Check for delta specs at `openspec/changes/<name>/specs/`. If none exist, proceed without sync prompt.
52
+
53
+ **If delta specs exist:**
54
+ - Compare each delta spec with its corresponding main spec at `openspec/specs/<capability>/spec.md`
55
+ - Determine what changes would be applied (adds, modifications, removals, renames)
56
+ - Show a combined summary before prompting
57
+
58
+ **Prompt options:**
59
+ - If changes needed: "Sync now (recommended)", "Archive without syncing"
60
+ - If already synced: "Archive now", "Sync anyway", "Cancel"
61
+
62
+ If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke openspec-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
63
+
64
+ 5. **Perform the archive**
65
+
66
+ Create the archive directory if it doesn't exist:
67
+ ```bash
68
+ mkdir -p openspec/changes/archive
69
+ ```
70
+
71
+ Generate target name using current date: `YYYY-MM-DD-<change-name>`
72
+
73
+ **Check if target already exists:**
74
+ - If yes: Fail with error, suggest renaming existing archive or using different date
75
+ - If no: Move the change directory to archive
76
+
77
+ ```bash
78
+ mv openspec/changes/<name> openspec/changes/archive/YYYY-MM-DD-<name>
79
+ ```
80
+
81
+ 6. **Display summary**
82
+
83
+ Show archive completion summary including:
84
+ - Change name
85
+ - Schema that was used
86
+ - Archive location
87
+ - Spec sync status (synced / sync skipped / no delta specs)
88
+ - Note about any warnings (incomplete artifacts/tasks)
89
+
90
+ **Output On Success**
91
+
92
+ ```
93
+ ## Archive Complete
94
+
95
+ **Change:** <change-name>
96
+ **Schema:** <schema-name>
97
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
98
+ **Specs:** ✓ Synced to main specs
99
+
100
+ All artifacts complete. All tasks complete.
101
+ ```
102
+
103
+ **Output On Success (No Delta Specs)**
104
+
105
+ ```
106
+ ## Archive Complete
107
+
108
+ **Change:** <change-name>
109
+ **Schema:** <schema-name>
110
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
111
+ **Specs:** No delta specs
112
+
113
+ All artifacts complete. All tasks complete.
114
+ ```
115
+
116
+ **Output On Success With Warnings**
117
+
118
+ ```
119
+ ## Archive Complete (with warnings)
120
+
121
+ **Change:** <change-name>
122
+ **Schema:** <schema-name>
123
+ **Archived to:** openspec/changes/archive/YYYY-MM-DD-<name>/
124
+ **Specs:** Sync skipped (user chose to skip)
125
+
126
+ **Warnings:**
127
+ - Archived with 2 incomplete artifacts
128
+ - Archived with 3 incomplete tasks
129
+ - Delta spec sync was skipped (user chose to skip)
130
+
131
+ Review the archive if this was not intentional.
132
+ ```
133
+
134
+ **Output On Error (Archive Exists)**
135
+
136
+ ```
137
+ ## Archive Failed
138
+
139
+ **Change:** <change-name>
140
+ **Target:** openspec/changes/archive/YYYY-MM-DD-<name>/
141
+
142
+ Target archive directory already exists.
143
+
144
+ **Options:**
145
+ 1. Rename the existing archive
146
+ 2. Delete the existing archive if it's a duplicate
147
+ 3. Wait until a different date to archive
148
+ ```
149
+
150
+ **Guardrails**
151
+ - Always prompt for change selection if not provided
152
+ - Use artifact graph (openspec status --json) for completion checking
153
+ - Don't block archive on warnings - just inform and confirm
154
+ - Preserve .openspec.yaml when moving to archive (it moves with the directory)
155
+ - Show clear summary of what happened
156
+ - If sync is requested, use the Skill tool to invoke `openspec-sync-specs` (agent-driven)
157
+ - If delta specs exist, always run the sync assessment and show the combined summary before prompting
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: "OPSX: Explore"
3
+ description: "Enter explore mode - think through ideas, investigate problems, clarify requirements"
4
+ category: Workflow
5
+ tags: [workflow, explore, experimental, thinking]
6
+ ---
7
+
8
+ Enter explore mode. Think deeply. Visualize freely. Follow the conversation wherever it goes.
9
+
10
+ **IMPORTANT: Explore mode is for thinking, not implementing.** You may read files, search code, and investigate the codebase, but you must NEVER write code or implement features. If the user asks you to implement something, remind them to exit explore mode first and create a change proposal. You MAY create OpenSpec artifacts (proposals, designs, specs) if the user asks—that's capturing thinking, not implementing.
11
+
12
+ **This is a stance, not a workflow.** There are no fixed steps, no required sequence, no mandatory outputs. You're a thinking partner helping the user explore.
13
+
14
+ **Input**: The argument after `/opsx:explore` is whatever the user wants to think about. Could be:
15
+ - A vague idea: "real-time collaboration"
16
+ - A specific problem: "the auth system is getting unwieldy"
17
+ - A change name: "add-dark-mode" (to explore in context of that change)
18
+ - A comparison: "postgres vs sqlite for this"
19
+ - Nothing (just enter explore mode)
20
+
21
+ ---
22
+
23
+ ## The Stance
24
+
25
+ - **Curious, not prescriptive** - Ask questions that emerge naturally, don't follow a script
26
+ - **Open threads, not interrogations** - Surface multiple interesting directions and let the user follow what resonates. Don't funnel them through a single path of questions.
27
+ - **Visual** - Use ASCII diagrams liberally when they'd help clarify thinking
28
+ - **Adaptive** - Follow interesting threads, pivot when new information emerges
29
+ - **Patient** - Don't rush to conclusions, let the shape of the problem emerge
30
+ - **Grounded** - Explore the actual codebase when relevant, don't just theorize
31
+
32
+ ---
33
+
34
+ ## What You Might Do
35
+
36
+ Depending on what the user brings, you might:
37
+
38
+ **Explore the problem space**
39
+ - Ask clarifying questions that emerge from what they said
40
+ - Challenge assumptions
41
+ - Reframe the problem
42
+ - Find analogies
43
+
44
+ **Investigate the codebase**
45
+ - Map existing architecture relevant to the discussion
46
+ - Find integration points
47
+ - Identify patterns already in use
48
+ - Surface hidden complexity
49
+
50
+ **Compare options**
51
+ - Brainstorm multiple approaches
52
+ - Build comparison tables
53
+ - Sketch tradeoffs
54
+ - Recommend a path (if asked)
55
+
56
+ **Visualize**
57
+ ```
58
+ ┌─────────────────────────────────────────┐
59
+ │ Use ASCII diagrams liberally │
60
+ ├─────────────────────────────────────────┤
61
+ │ │
62
+ │ ┌────────┐ ┌────────┐ │
63
+ │ │ State │────────▶│ State │ │
64
+ │ │ A │ │ B │ │
65
+ │ └────────┘ └────────┘ │
66
+ │ │
67
+ │ System diagrams, state machines, │
68
+ │ data flows, architecture sketches, │
69
+ │ dependency graphs, comparison tables │
70
+ │ │
71
+ └─────────────────────────────────────────┘
72
+ ```
73
+
74
+ **Surface risks and unknowns**
75
+ - Identify what could go wrong
76
+ - Find gaps in understanding
77
+ - Suggest spikes or investigations
78
+
79
+ ---
80
+
81
+ ## OpenSpec Awareness
82
+
83
+ You have full context of the OpenSpec system. Use it naturally, don't force it.
84
+
85
+ ### Check for context
86
+
87
+ At the start, quickly check what exists:
88
+ ```bash
89
+ openspec list --json
90
+ ```
91
+
92
+ This tells you:
93
+ - If there are active changes
94
+ - Their names, schemas, and status
95
+ - What the user might be working on
96
+
97
+ If the user mentioned a specific change name, read its artifacts for context.
98
+
99
+ ### When no change exists
100
+
101
+ Think freely. When insights crystallize, you might offer:
102
+
103
+ - "This feels solid enough to start a change. Want me to create a proposal?"
104
+ - Or keep exploring - no pressure to formalize
105
+
106
+ ### When a change exists
107
+
108
+ If the user mentions a change or you detect one is relevant:
109
+
110
+ 1. **Read existing artifacts for context**
111
+ - `openspec/changes/<name>/proposal.md`
112
+ - `openspec/changes/<name>/design.md`
113
+ - `openspec/changes/<name>/tasks.md`
114
+ - etc.
115
+
116
+ 2. **Reference them naturally in conversation**
117
+ - "Your design mentions using Redis, but we just realized SQLite fits better..."
118
+ - "The proposal scopes this to premium users, but we're now thinking everyone..."
119
+
120
+ 3. **Offer to capture when decisions are made**
121
+
122
+ | Insight Type | Where to Capture |
123
+ |--------------|------------------|
124
+ | New requirement discovered | `specs/<capability>/spec.md` |
125
+ | Requirement changed | `specs/<capability>/spec.md` |
126
+ | Design decision made | `design.md` |
127
+ | Scope changed | `proposal.md` |
128
+ | New work identified | `tasks.md` |
129
+ | Assumption invalidated | Relevant artifact |
130
+
131
+ Example offers:
132
+ - "That's a design decision. Capture it in design.md?"
133
+ - "This is a new requirement. Add it to specs?"
134
+ - "This changes scope. Update the proposal?"
135
+
136
+ 4. **The user decides** - Offer and move on. Don't pressure. Don't auto-capture.
137
+
138
+ ---
139
+
140
+ ## What You Don't Have To Do
141
+
142
+ - Follow a script
143
+ - Ask the same questions every time
144
+ - Produce a specific artifact
145
+ - Reach a conclusion
146
+ - Stay on topic if a tangent is valuable
147
+ - Be brief (this is thinking time)
148
+
149
+ ---
150
+
151
+ ## Ending Discovery
152
+
153
+ There's no required ending. Discovery might:
154
+
155
+ - **Flow into a proposal**: "Ready to start? I can create a change proposal."
156
+ - **Result in artifact updates**: "Updated design.md with these decisions"
157
+ - **Just provide clarity**: User has what they need, moves on
158
+ - **Continue later**: "We can pick this up anytime"
159
+
160
+ When things crystallize, you might offer a summary - but it's optional. Sometimes the thinking IS the value.
161
+
162
+ ---
163
+
164
+ ## Guardrails
165
+
166
+ - **Don't implement** - Never write code or implement features. Creating OpenSpec artifacts is fine, writing application code is not.
167
+ - **Don't fake understanding** - If something is unclear, dig deeper
168
+ - **Don't rush** - Discovery is thinking time, not task time
169
+ - **Don't force structure** - Let patterns emerge naturally
170
+ - **Don't auto-capture** - Offer to save insights, don't just do it
171
+ - **Do visualize** - A good diagram is worth many paragraphs
172
+ - **Do explore the codebase** - Ground discussions in reality
173
+ - **Do question assumptions** - Including the user's and your own
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: "OPSX: Propose"
3
+ description: Propose a new change - create it and generate all artifacts in one step
4
+ category: Workflow
5
+ tags: [workflow, artifacts, experimental]
6
+ ---
7
+
8
+ Propose a new change - create the change and generate all artifacts in one step.
9
+
10
+ I'll create a change with artifacts:
11
+ - proposal.md (what & why)
12
+ - design.md (how)
13
+ - tasks.md (implementation steps)
14
+
15
+ When ready to implement, run /opsx:apply
16
+
17
+ ---
18
+
19
+ **Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
20
+
21
+ **Steps**
22
+
23
+ 1. **If no input provided, ask what they want to build**
24
+
25
+ Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
26
+ > "What change do you want to work on? Describe what you want to build or fix."
27
+
28
+ From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
29
+
30
+ **IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
31
+
32
+ 2. **Create the change directory**
33
+ ```bash
34
+ openspec new change "<name>"
35
+ ```
36
+ This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
37
+
38
+ 3. **Get the artifact build order**
39
+ ```bash
40
+ openspec status --change "<name>" --json
41
+ ```
42
+ Parse the JSON to get:
43
+ - `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
44
+ - `artifacts`: list of all artifacts with their status and dependencies
45
+
46
+ 4. **Create artifacts in sequence until apply-ready**
47
+
48
+ Use the **TodoWrite tool** to track progress through the artifacts.
49
+
50
+ Loop through artifacts in dependency order (artifacts with no pending dependencies first):
51
+
52
+ a. **For each artifact that is `ready` (dependencies satisfied)**:
53
+ - Get instructions:
54
+ ```bash
55
+ openspec instructions <artifact-id> --change "<name>" --json
56
+ ```
57
+ - The instructions JSON includes:
58
+ - `context`: Project background (constraints for you - do NOT include in output)
59
+ - `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
60
+ - `template`: The structure to use for your output file
61
+ - `instruction`: Schema-specific guidance for this artifact type
62
+ - `outputPath`: Where to write the artifact
63
+ - `dependencies`: Completed artifacts to read for context
64
+ - Read any completed dependency files for context
65
+ - Create the artifact file using `template` as the structure
66
+ - Apply `context` and `rules` as constraints - but do NOT copy them into the file
67
+ - Show brief progress: "Created <artifact-id>"
68
+
69
+ b. **Continue until all `applyRequires` artifacts are complete**
70
+ - After creating each artifact, re-run `openspec status --change "<name>" --json`
71
+ - Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
72
+ - Stop when all `applyRequires` artifacts are done
73
+
74
+ c. **If an artifact requires user input** (unclear context):
75
+ - Use **AskUserQuestion tool** to clarify
76
+ - Then continue with creation
77
+
78
+ 5. **Show final status**
79
+ ```bash
80
+ openspec status --change "<name>"
81
+ ```
82
+
83
+ **Output**
84
+
85
+ After completing all artifacts, summarize:
86
+ - Change name and location
87
+ - List of artifacts created with brief descriptions
88
+ - What's ready: "All artifacts created! Ready for implementation."
89
+ - Prompt: "Run `/opsx:apply` to start implementing."
90
+
91
+ **Artifact Creation Guidelines**
92
+
93
+ - Follow the `instruction` field from `openspec instructions` for each artifact type
94
+ - The schema defines what each artifact should contain - follow it
95
+ - Read dependency artifacts for context before creating new ones
96
+ - Use `template` as the structure for your output file - fill in its sections
97
+ - **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
98
+ - Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
99
+ - These guide what you write, but should never appear in the output
100
+
101
+ **Guardrails**
102
+ - Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
103
+ - Always read dependency artifacts before creating a new one
104
+ - If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
105
+ - If a change with that name already exists, ask if user wants to continue it or create a new one
106
+ - Verify each artifact file exists after writing before proceeding to next