@codewalla_india/openspec 1.3.2 → 1.3.4
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.
- package/README.md +271 -271
- package/dist/comprehension-quiz/index.d.ts +7 -7
- package/dist/comprehension-quiz/index.js +7 -7
- package/dist/comprehension-quiz/providers/anthropic.d.ts +1 -0
- package/dist/comprehension-quiz/providers/anthropic.js +25 -9
- package/dist/comprehension-quiz/providers/interface.d.ts +42 -3
- package/dist/comprehension-quiz/providers/interface.js +102 -15
- package/dist/comprehension-quiz/providers/local.d.ts +1 -0
- package/dist/comprehension-quiz/providers/local.js +25 -9
- package/dist/comprehension-quiz/providers/ollama.d.ts +1 -0
- package/dist/comprehension-quiz/providers/ollama.js +25 -9
- package/dist/comprehension-quiz/providers/openai.d.ts +1 -0
- package/dist/comprehension-quiz/providers/openai.js +28 -9
- package/dist/comprehension-quiz/question-generator.d.ts +51 -3
- package/dist/comprehension-quiz/question-generator.js +91 -29
- package/dist/comprehension-quiz/quiz-executor.d.ts +36 -31
- package/dist/comprehension-quiz/quiz-executor.js +113 -97
- package/dist/comprehension-quiz/types.d.ts +22 -0
- package/dist/core/templates/workflows/apply-change.js +93 -3
- package/dist/core/templates/workflows/modify-change.js +233 -233
- package/package.json +1 -1
- package/schemas/spec-driven/templates/plan-template.md +91 -91
|
@@ -3,163 +3,163 @@ export function getModifyChangeSkillTemplate() {
|
|
|
3
3
|
return {
|
|
4
4
|
name: 'openspec-modify-change',
|
|
5
5
|
description: "Modify planning artifacts before implementation starts. Use when the user wants to revise artifacts after they've been created but before implementation begins.",
|
|
6
|
-
instructions: `Modify planning artifacts before implementation starts.
|
|
7
|
-
|
|
8
|
-
${STORE_SELECTION_GUIDANCE}
|
|
9
|
-
|
|
10
|
-
**Input**: Specify a change name and the artifact to modify (e.g., \`/openspec-modify-change modify-command proposal\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes and artifacts.
|
|
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 ask the user to select one
|
|
20
|
-
|
|
21
|
-
Always announce: "Using change: <name>" and how to override (e.g., \`/openspec-modify-change <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
|
-
- \`planningHome\`, \`changeRoot\`, and \`actionContext\`: planning scope and edit constraints
|
|
30
|
-
- Which artifacts exist and their completion status
|
|
31
|
-
|
|
32
|
-
3. **Validate pre-apply conditions**
|
|
33
|
-
|
|
34
|
-
Check if implementation has started by examining the tasks file:
|
|
35
|
-
- If any tasks are marked as complete (\`- [x]\`), modification is blocked
|
|
36
|
-
- Explain that modification is only allowed before \`/opsx:apply\` begins
|
|
37
|
-
- If blocked, suggest creating a new change or using \`/opsx:continue-change\` for artifact updates
|
|
38
|
-
|
|
39
|
-
4. **Select the artifact to modify**
|
|
40
|
-
|
|
41
|
-
If the user specified an artifact, use it. Otherwise:
|
|
42
|
-
- Show available artifacts from the status output
|
|
43
|
-
- Ask the user which artifact to modify
|
|
44
|
-
- Explain that modifying an artifact will also update its dependents
|
|
45
|
-
|
|
46
|
-
5. **Get modify instructions**
|
|
47
|
-
|
|
48
|
-
\`\`\`bash
|
|
49
|
-
openspec instructions modify --change "<name>" --artifact "<artifact-id>" --json
|
|
50
|
-
\`\`\`
|
|
51
|
-
|
|
52
|
-
This returns:
|
|
53
|
-
- \`artifactsToUpdate\`: list of artifacts that will be updated (direct and propagated)
|
|
54
|
-
- \`conflicts\`: any conflicts with manual edits (if present, modification is blocked)
|
|
55
|
-
- Success/failure status
|
|
56
|
-
|
|
57
|
-
**Handle states:**
|
|
58
|
-
- If \`success: false\` with conflicts: show conflicts, explain resolution options
|
|
59
|
-
- If \`success: false\` with pre-apply error: explain why modification is blocked
|
|
60
|
-
- If \`success: true\`: proceed with modification
|
|
61
|
-
|
|
62
|
-
6. **Make the requested changes**
|
|
63
|
-
|
|
64
|
-
- Open the artifact file in the editor (if \`--editor\` flag is used)
|
|
65
|
-
- Make the requested modifications
|
|
66
|
-
- Save the file
|
|
67
|
-
|
|
68
|
-
**Important:** The modify command calculates which artifacts need updating based on the artifact graph. The system will handle:
|
|
69
|
-
- Direct modification of the specified artifact
|
|
70
|
-
- Propagation to dependent artifacts (in reverse topological order)
|
|
71
|
-
- Conflict detection with manual edits
|
|
72
|
-
- History tracking in the change marker
|
|
73
|
-
|
|
74
|
-
7. **Verify the changes**
|
|
75
|
-
|
|
76
|
-
- Review the modified artifact
|
|
77
|
-
- If dependents were updated, review those as well
|
|
78
|
-
- Ensure changes align with the intended modification
|
|
79
|
-
|
|
80
|
-
8. **Show summary**
|
|
81
|
-
|
|
82
|
-
Display:
|
|
83
|
-
- Artifact modified
|
|
84
|
-
- Dependent artifacts updated (if any)
|
|
85
|
-
- Modification history recorded
|
|
86
|
-
- Next steps (e.g., continue with other artifacts or proceed to apply)
|
|
87
|
-
|
|
88
|
-
**Output During Modification**
|
|
89
|
-
|
|
90
|
-
\`\`\`
|
|
91
|
-
## Modifying: <change-name>
|
|
92
|
-
|
|
93
|
-
**Artifact:** <artifact-id>
|
|
94
|
-
**Dependents to update:** <list of dependent artifacts>
|
|
95
|
-
|
|
96
|
-
[...modification happening...]
|
|
97
|
-
✓ Modification complete
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
-
**Output On Success**
|
|
101
|
-
|
|
102
|
-
\`\`\`
|
|
103
|
-
## Modification Complete
|
|
104
|
-
|
|
105
|
-
**Change:** <change-name>
|
|
106
|
-
**Artifact modified:** <artifact-id>
|
|
107
|
-
**Dependents updated:** <list>
|
|
108
|
-
|
|
109
|
-
### History Recorded
|
|
110
|
-
- Timestamp: <timestamp>
|
|
111
|
-
- Modified artifacts: <list>
|
|
112
|
-
- Intent: <user's intent>
|
|
113
|
-
|
|
114
|
-
**Next steps:**
|
|
115
|
-
- Modify additional artifacts, or
|
|
116
|
-
- Proceed with implementation: \`/opsx:apply-change\`
|
|
117
|
-
\`\`\`
|
|
118
|
-
|
|
119
|
-
**Output On Block (Pre-apply Validation Failed)**
|
|
120
|
-
|
|
121
|
-
\`\`\`
|
|
122
|
-
## Modification Blocked
|
|
123
|
-
|
|
124
|
-
**Change:** <change-name>
|
|
125
|
-
**Reason:** Implementation has started (tasks have been completed)
|
|
126
|
-
|
|
127
|
-
**Options:**
|
|
128
|
-
1. Use \`/opsx:continue-change\` to update artifacts during implementation
|
|
129
|
-
2. Create a new change for the revision
|
|
130
|
-
3. Proceed with current implementation and address changes in a follow-up
|
|
131
|
-
|
|
132
|
-
What would you like to do?
|
|
133
|
-
\`\`\`
|
|
134
|
-
|
|
135
|
-
**Output On Block (Conflicts Detected)**
|
|
136
|
-
|
|
137
|
-
\`\`\`
|
|
138
|
-
## Modification Blocked
|
|
139
|
-
|
|
140
|
-
**Change:** <change-name>
|
|
141
|
-
**Artifact:** <artifact-id>
|
|
142
|
-
**Reason:** Conflicts with manual edits
|
|
143
|
-
|
|
144
|
-
### Conflicts
|
|
145
|
-
- <artifact-id>: <affected sections>
|
|
146
|
-
|
|
147
|
-
**Options:**
|
|
148
|
-
1. Resolve conflicts manually and retry
|
|
149
|
-
2. Accept manual edits and skip propagation
|
|
150
|
-
3. Revert manual edits and allow propagation
|
|
151
|
-
|
|
152
|
-
What would you like to do?
|
|
153
|
-
\`\`\`
|
|
154
|
-
|
|
155
|
-
**Guardrails**
|
|
156
|
-
- Only allow modification before implementation starts (no completed tasks)
|
|
157
|
-
- Always check for conflicts before modifying
|
|
158
|
-
- Show which dependents will be updated
|
|
159
|
-
- Record modification history in the change marker
|
|
160
|
-
- Preserve manual edits when possible (conflict detection)
|
|
161
|
-
- Explain blocking conditions clearly
|
|
162
|
-
- Do not modify artifacts after implementation has begun
|
|
6
|
+
instructions: `Modify planning artifacts before implementation starts.
|
|
7
|
+
|
|
8
|
+
${STORE_SELECTION_GUIDANCE}
|
|
9
|
+
|
|
10
|
+
**Input**: Specify a change name and the artifact to modify (e.g., \`/openspec-modify-change modify-command proposal\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes and artifacts.
|
|
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 ask the user to select one
|
|
20
|
+
|
|
21
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/openspec-modify-change <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
|
+
- \`planningHome\`, \`changeRoot\`, and \`actionContext\`: planning scope and edit constraints
|
|
30
|
+
- Which artifacts exist and their completion status
|
|
31
|
+
|
|
32
|
+
3. **Validate pre-apply conditions**
|
|
33
|
+
|
|
34
|
+
Check if implementation has started by examining the tasks file:
|
|
35
|
+
- If any tasks are marked as complete (\`- [x]\`), modification is blocked
|
|
36
|
+
- Explain that modification is only allowed before \`/opsx:apply\` begins
|
|
37
|
+
- If blocked, suggest creating a new change or using \`/opsx:continue-change\` for artifact updates
|
|
38
|
+
|
|
39
|
+
4. **Select the artifact to modify**
|
|
40
|
+
|
|
41
|
+
If the user specified an artifact, use it. Otherwise:
|
|
42
|
+
- Show available artifacts from the status output
|
|
43
|
+
- Ask the user which artifact to modify
|
|
44
|
+
- Explain that modifying an artifact will also update its dependents
|
|
45
|
+
|
|
46
|
+
5. **Get modify instructions**
|
|
47
|
+
|
|
48
|
+
\`\`\`bash
|
|
49
|
+
openspec instructions modify --change "<name>" --artifact "<artifact-id>" --json
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
This returns:
|
|
53
|
+
- \`artifactsToUpdate\`: list of artifacts that will be updated (direct and propagated)
|
|
54
|
+
- \`conflicts\`: any conflicts with manual edits (if present, modification is blocked)
|
|
55
|
+
- Success/failure status
|
|
56
|
+
|
|
57
|
+
**Handle states:**
|
|
58
|
+
- If \`success: false\` with conflicts: show conflicts, explain resolution options
|
|
59
|
+
- If \`success: false\` with pre-apply error: explain why modification is blocked
|
|
60
|
+
- If \`success: true\`: proceed with modification
|
|
61
|
+
|
|
62
|
+
6. **Make the requested changes**
|
|
63
|
+
|
|
64
|
+
- Open the artifact file in the editor (if \`--editor\` flag is used)
|
|
65
|
+
- Make the requested modifications
|
|
66
|
+
- Save the file
|
|
67
|
+
|
|
68
|
+
**Important:** The modify command calculates which artifacts need updating based on the artifact graph. The system will handle:
|
|
69
|
+
- Direct modification of the specified artifact
|
|
70
|
+
- Propagation to dependent artifacts (in reverse topological order)
|
|
71
|
+
- Conflict detection with manual edits
|
|
72
|
+
- History tracking in the change marker
|
|
73
|
+
|
|
74
|
+
7. **Verify the changes**
|
|
75
|
+
|
|
76
|
+
- Review the modified artifact
|
|
77
|
+
- If dependents were updated, review those as well
|
|
78
|
+
- Ensure changes align with the intended modification
|
|
79
|
+
|
|
80
|
+
8. **Show summary**
|
|
81
|
+
|
|
82
|
+
Display:
|
|
83
|
+
- Artifact modified
|
|
84
|
+
- Dependent artifacts updated (if any)
|
|
85
|
+
- Modification history recorded
|
|
86
|
+
- Next steps (e.g., continue with other artifacts or proceed to apply)
|
|
87
|
+
|
|
88
|
+
**Output During Modification**
|
|
89
|
+
|
|
90
|
+
\`\`\`
|
|
91
|
+
## Modifying: <change-name>
|
|
92
|
+
|
|
93
|
+
**Artifact:** <artifact-id>
|
|
94
|
+
**Dependents to update:** <list of dependent artifacts>
|
|
95
|
+
|
|
96
|
+
[...modification happening...]
|
|
97
|
+
✓ Modification complete
|
|
98
|
+
\`\`\`
|
|
99
|
+
|
|
100
|
+
**Output On Success**
|
|
101
|
+
|
|
102
|
+
\`\`\`
|
|
103
|
+
## Modification Complete
|
|
104
|
+
|
|
105
|
+
**Change:** <change-name>
|
|
106
|
+
**Artifact modified:** <artifact-id>
|
|
107
|
+
**Dependents updated:** <list>
|
|
108
|
+
|
|
109
|
+
### History Recorded
|
|
110
|
+
- Timestamp: <timestamp>
|
|
111
|
+
- Modified artifacts: <list>
|
|
112
|
+
- Intent: <user's intent>
|
|
113
|
+
|
|
114
|
+
**Next steps:**
|
|
115
|
+
- Modify additional artifacts, or
|
|
116
|
+
- Proceed with implementation: \`/opsx:apply-change\`
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
**Output On Block (Pre-apply Validation Failed)**
|
|
120
|
+
|
|
121
|
+
\`\`\`
|
|
122
|
+
## Modification Blocked
|
|
123
|
+
|
|
124
|
+
**Change:** <change-name>
|
|
125
|
+
**Reason:** Implementation has started (tasks have been completed)
|
|
126
|
+
|
|
127
|
+
**Options:**
|
|
128
|
+
1. Use \`/opsx:continue-change\` to update artifacts during implementation
|
|
129
|
+
2. Create a new change for the revision
|
|
130
|
+
3. Proceed with current implementation and address changes in a follow-up
|
|
131
|
+
|
|
132
|
+
What would you like to do?
|
|
133
|
+
\`\`\`
|
|
134
|
+
|
|
135
|
+
**Output On Block (Conflicts Detected)**
|
|
136
|
+
|
|
137
|
+
\`\`\`
|
|
138
|
+
## Modification Blocked
|
|
139
|
+
|
|
140
|
+
**Change:** <change-name>
|
|
141
|
+
**Artifact:** <artifact-id>
|
|
142
|
+
**Reason:** Conflicts with manual edits
|
|
143
|
+
|
|
144
|
+
### Conflicts
|
|
145
|
+
- <artifact-id>: <affected sections>
|
|
146
|
+
|
|
147
|
+
**Options:**
|
|
148
|
+
1. Resolve conflicts manually and retry
|
|
149
|
+
2. Accept manual edits and skip propagation
|
|
150
|
+
3. Revert manual edits and allow propagation
|
|
151
|
+
|
|
152
|
+
What would you like to do?
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
**Guardrails**
|
|
156
|
+
- Only allow modification before implementation starts (no completed tasks)
|
|
157
|
+
- Always check for conflicts before modifying
|
|
158
|
+
- Show which dependents will be updated
|
|
159
|
+
- Record modification history in the change marker
|
|
160
|
+
- Preserve manual edits when possible (conflict detection)
|
|
161
|
+
- Explain blocking conditions clearly
|
|
162
|
+
- Do not modify artifacts after implementation has begun
|
|
163
163
|
`,
|
|
164
164
|
license: 'MIT',
|
|
165
165
|
compatibility: 'Requires openspec CLI.',
|
|
@@ -172,82 +172,82 @@ export function getOpsxModifyCommandTemplate() {
|
|
|
172
172
|
description: "Modify a planning artifact before implementation starts - with dependency propagation and conflict detection (Experimental)",
|
|
173
173
|
category: 'Workflow',
|
|
174
174
|
tags: ['workflow', 'artifacts', 'experimental'],
|
|
175
|
-
content: `Modify a planning artifact before implementation starts. Only works before implementation begins.
|
|
176
|
-
|
|
177
|
-
${STORE_SELECTION_GUIDANCE}
|
|
178
|
-
|
|
179
|
-
**Input**: Specify a change name and artifact to modify (e.g., \`/opsx:modify <change-name> --artifact <artifact-id>\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes and artifacts.
|
|
180
|
-
|
|
181
|
-
\`/opsx:continue\` is an expanded-profile workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, \`openspec status --change "<name>" --json\` shows the next artifact and \`openspec instructions "<artifact-id>" --change "<name>" --json\` explains how to create it.
|
|
182
|
-
|
|
183
|
-
**Steps**
|
|
184
|
-
|
|
185
|
-
1. **Select the change**
|
|
186
|
-
|
|
187
|
-
If a name is provided, use it. Otherwise:
|
|
188
|
-
- Infer from conversation context if the user mentioned a change
|
|
189
|
-
- Auto-select if only one active change exists
|
|
190
|
-
- If ambiguous, run \`openspec list --json\` to get available changes sorted by most recently modified, and ask the user to select one
|
|
191
|
-
|
|
192
|
-
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
193
|
-
- Change name
|
|
194
|
-
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
195
|
-
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
196
|
-
- How recently it was modified (from \`lastModified\` field)
|
|
197
|
-
|
|
198
|
-
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to modify.
|
|
199
|
-
|
|
200
|
-
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:modify <other>\`).
|
|
201
|
-
|
|
202
|
-
2. **Check pre-apply conditions**
|
|
203
|
-
|
|
204
|
-
\`\`\`bash
|
|
205
|
-
openspec instructions modify --change "<name>" --artifact "<artifact-id>" --json
|
|
206
|
-
\`\`\`
|
|
207
|
-
|
|
208
|
-
This validates that implementation hasn't started by checking tasks.md for completed tasks. If blocked, the command returns an error with the reason.
|
|
209
|
-
|
|
210
|
-
3. **Review update scope**
|
|
211
|
-
|
|
212
|
-
The command returns a list of artifacts that will be updated in reverse topological order (deepest dependents first). Review this list to understand the impact.
|
|
213
|
-
|
|
214
|
-
4. **Check for conflicts**
|
|
215
|
-
|
|
216
|
-
The command returns any conflicts with manual edits in downstream artifacts. If conflicts exist, modification is blocked and you must resolve them first.
|
|
217
|
-
|
|
218
|
-
5. **Make the modification**
|
|
219
|
-
|
|
220
|
-
- Open the artifact file for editing
|
|
221
|
-
- Make the requested changes
|
|
222
|
-
- Save the file
|
|
223
|
-
|
|
224
|
-
The modify command will:
|
|
225
|
-
- Calculate affected artifacts using the artifact graph
|
|
226
|
-
- Propagate changes to dependents automatically
|
|
227
|
-
- Record modification history in the change marker
|
|
228
|
-
- Emit telemetry events
|
|
229
|
-
|
|
230
|
-
6. **Verify the changes**
|
|
231
|
-
|
|
232
|
-
- Review the modified artifact
|
|
233
|
-
- Review any propagated changes to dependents
|
|
234
|
-
- Ensure changes align with the intended modification
|
|
235
|
-
|
|
236
|
-
**Output**
|
|
237
|
-
|
|
238
|
-
After modification, show:
|
|
239
|
-
- Artifact modified
|
|
240
|
-
- Dependent artifacts updated (if any)
|
|
241
|
-
- Modification history recorded
|
|
242
|
-
- Next steps (e.g., modify additional artifacts or proceed to apply)
|
|
243
|
-
|
|
244
|
-
**Guardrails**
|
|
245
|
-
- Modification is blocked if implementation has started (any completed tasks)
|
|
246
|
-
- Modification is blocked if conflicts with manual edits exist
|
|
247
|
-
- Do not modify artifacts after implementation begins
|
|
248
|
-
- Always check for conflicts before modifying
|
|
249
|
-
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names
|
|
250
|
-
- The modify command handles dependency propagation automatically - do not manually update dependents
|
|
175
|
+
content: `Modify a planning artifact before implementation starts. Only works before implementation begins.
|
|
176
|
+
|
|
177
|
+
${STORE_SELECTION_GUIDANCE}
|
|
178
|
+
|
|
179
|
+
**Input**: Specify a change name and artifact to modify (e.g., \`/opsx:modify <change-name> --artifact <artifact-id>\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes and artifacts.
|
|
180
|
+
|
|
181
|
+
\`/opsx:continue\` is an expanded-profile workflow and may not be installed. Before suggesting it anywhere below, verify that it is available. If it is unavailable, \`openspec status --change "<name>" --json\` shows the next artifact and \`openspec instructions "<artifact-id>" --change "<name>" --json\` explains how to create it.
|
|
182
|
+
|
|
183
|
+
**Steps**
|
|
184
|
+
|
|
185
|
+
1. **Select the change**
|
|
186
|
+
|
|
187
|
+
If a name is provided, use it. Otherwise:
|
|
188
|
+
- Infer from conversation context if the user mentioned a change
|
|
189
|
+
- Auto-select if only one active change exists
|
|
190
|
+
- If ambiguous, run \`openspec list --json\` to get available changes sorted by most recently modified, and ask the user to select one
|
|
191
|
+
|
|
192
|
+
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
193
|
+
- Change name
|
|
194
|
+
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
195
|
+
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
196
|
+
- How recently it was modified (from \`lastModified\` field)
|
|
197
|
+
|
|
198
|
+
Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to modify.
|
|
199
|
+
|
|
200
|
+
Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:modify <other>\`).
|
|
201
|
+
|
|
202
|
+
2. **Check pre-apply conditions**
|
|
203
|
+
|
|
204
|
+
\`\`\`bash
|
|
205
|
+
openspec instructions modify --change "<name>" --artifact "<artifact-id>" --json
|
|
206
|
+
\`\`\`
|
|
207
|
+
|
|
208
|
+
This validates that implementation hasn't started by checking tasks.md for completed tasks. If blocked, the command returns an error with the reason.
|
|
209
|
+
|
|
210
|
+
3. **Review update scope**
|
|
211
|
+
|
|
212
|
+
The command returns a list of artifacts that will be updated in reverse topological order (deepest dependents first). Review this list to understand the impact.
|
|
213
|
+
|
|
214
|
+
4. **Check for conflicts**
|
|
215
|
+
|
|
216
|
+
The command returns any conflicts with manual edits in downstream artifacts. If conflicts exist, modification is blocked and you must resolve them first.
|
|
217
|
+
|
|
218
|
+
5. **Make the modification**
|
|
219
|
+
|
|
220
|
+
- Open the artifact file for editing
|
|
221
|
+
- Make the requested changes
|
|
222
|
+
- Save the file
|
|
223
|
+
|
|
224
|
+
The modify command will:
|
|
225
|
+
- Calculate affected artifacts using the artifact graph
|
|
226
|
+
- Propagate changes to dependents automatically
|
|
227
|
+
- Record modification history in the change marker
|
|
228
|
+
- Emit telemetry events
|
|
229
|
+
|
|
230
|
+
6. **Verify the changes**
|
|
231
|
+
|
|
232
|
+
- Review the modified artifact
|
|
233
|
+
- Review any propagated changes to dependents
|
|
234
|
+
- Ensure changes align with the intended modification
|
|
235
|
+
|
|
236
|
+
**Output**
|
|
237
|
+
|
|
238
|
+
After modification, show:
|
|
239
|
+
- Artifact modified
|
|
240
|
+
- Dependent artifacts updated (if any)
|
|
241
|
+
- Modification history recorded
|
|
242
|
+
- Next steps (e.g., modify additional artifacts or proceed to apply)
|
|
243
|
+
|
|
244
|
+
**Guardrails**
|
|
245
|
+
- Modification is blocked if implementation has started (any completed tasks)
|
|
246
|
+
- Modification is blocked if conflicts with manual edits exist
|
|
247
|
+
- Do not modify artifacts after implementation begins
|
|
248
|
+
- Always check for conflicts before modifying
|
|
249
|
+
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names
|
|
250
|
+
- The modify command handles dependency propagation automatically - do not manually update dependents
|
|
251
251
|
`,
|
|
252
252
|
};
|
|
253
253
|
}
|
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
## Code Map
|
|
2
|
-
|
|
3
|
-
<!-- List all files that will be created, modified, or deleted for this change -->
|
|
4
|
-
|
|
5
|
-
### Files to Create
|
|
6
|
-
<!-- List new files to be created with brief descriptions -->
|
|
7
|
-
<!-- Example:
|
|
8
|
-
- `src/core/new-feature.ts` - Core implementation of new feature
|
|
9
|
-
- `src/core/new-feature.test.ts` - Unit tests for new feature
|
|
10
|
-
-->
|
|
11
|
-
|
|
12
|
-
### Files to Modify
|
|
13
|
-
<!-- List existing files that will be modified with brief descriptions -->
|
|
14
|
-
<!-- Example:
|
|
15
|
-
- `src/core/index.ts` - Export new feature module
|
|
16
|
-
- `src/cli/commands.ts` - Add CLI command for new feature
|
|
17
|
-
-->
|
|
18
|
-
|
|
19
|
-
### Files to Delete
|
|
20
|
-
<!-- List files that will be removed (if any) -->
|
|
21
|
-
<!-- Example:
|
|
22
|
-
- `src/legacy/old-feature.ts` - Remove deprecated feature
|
|
23
|
-
-->
|
|
24
|
-
|
|
25
|
-
## Implementation Order
|
|
26
|
-
|
|
27
|
-
<!-- Sequence the implementation work at file/module level -->
|
|
28
|
-
<!-- Use numbered steps with file references in parentheses -->
|
|
29
|
-
<!-- Example:
|
|
30
|
-
|
|
31
|
-
1. **Core Implementation** (new-feature.ts)
|
|
32
|
-
- Implement primary data structures
|
|
33
|
-
- Add main function logic
|
|
34
|
-
- Handle edge cases
|
|
35
|
-
|
|
36
|
-
2. **CLI Integration** (commands.ts)
|
|
37
|
-
- Add command registration
|
|
38
|
-
- Implement command handler
|
|
39
|
-
- Add help text
|
|
40
|
-
|
|
41
|
-
3. **Testing** (new-feature.test.ts)
|
|
42
|
-
- Write unit tests
|
|
43
|
-
- Add integration tests
|
|
44
|
-
- Verify coverage
|
|
45
|
-
-->
|
|
46
|
-
|
|
47
|
-
## Test Plan
|
|
48
|
-
|
|
49
|
-
<!-- Describe how to verify the change -->
|
|
50
|
-
<!-- Include test types: unit, integration, e2e, manual -->
|
|
51
|
-
<!-- Example:
|
|
52
|
-
|
|
53
|
-
### Unit Tests
|
|
54
|
-
- Test core function with valid inputs
|
|
55
|
-
- Test error handling for invalid inputs
|
|
56
|
-
- Test edge cases
|
|
57
|
-
|
|
58
|
-
### Integration Tests
|
|
59
|
-
- Test CLI command with real filesystem
|
|
60
|
-
- Test integration with existing modules
|
|
61
|
-
|
|
62
|
-
### Manual Tests
|
|
63
|
-
- Verify CLI command works as expected
|
|
64
|
-
- Check error messages are clear
|
|
65
|
-
-->
|
|
66
|
-
|
|
67
|
-
## Risks
|
|
68
|
-
|
|
69
|
-
<!-- Identify known risks with mitigations -->
|
|
70
|
-
<!-- Format: [Risk] → Mitigation -->
|
|
71
|
-
<!-- Example:
|
|
72
|
-
|
|
73
|
-
**Breaking Change Risk**
|
|
74
|
-
- [Risk] Existing users may rely on old behavior
|
|
75
|
-
- [Mitigation] Provide migration guide, add deprecation warning
|
|
76
|
-
|
|
77
|
-
**Performance Risk**
|
|
78
|
-
- [Risk] New feature may slow down existing operations
|
|
79
|
-
- [Mitigation] Add performance tests, optimize hot paths
|
|
80
|
-
-->
|
|
81
|
-
|
|
82
|
-
## Done Definition
|
|
83
|
-
|
|
84
|
-
<!-- Define objective criteria for completion -->
|
|
85
|
-
<!-- Example:
|
|
86
|
-
- All unit tests passing
|
|
87
|
-
- All integration tests passing
|
|
88
|
-
- Documentation updated
|
|
89
|
-
- Error messages are clear and actionable
|
|
90
|
-
- Performance requirements met
|
|
91
|
-
-->
|
|
1
|
+
## Code Map
|
|
2
|
+
|
|
3
|
+
<!-- List all files that will be created, modified, or deleted for this change -->
|
|
4
|
+
|
|
5
|
+
### Files to Create
|
|
6
|
+
<!-- List new files to be created with brief descriptions -->
|
|
7
|
+
<!-- Example:
|
|
8
|
+
- `src/core/new-feature.ts` - Core implementation of new feature
|
|
9
|
+
- `src/core/new-feature.test.ts` - Unit tests for new feature
|
|
10
|
+
-->
|
|
11
|
+
|
|
12
|
+
### Files to Modify
|
|
13
|
+
<!-- List existing files that will be modified with brief descriptions -->
|
|
14
|
+
<!-- Example:
|
|
15
|
+
- `src/core/index.ts` - Export new feature module
|
|
16
|
+
- `src/cli/commands.ts` - Add CLI command for new feature
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
### Files to Delete
|
|
20
|
+
<!-- List files that will be removed (if any) -->
|
|
21
|
+
<!-- Example:
|
|
22
|
+
- `src/legacy/old-feature.ts` - Remove deprecated feature
|
|
23
|
+
-->
|
|
24
|
+
|
|
25
|
+
## Implementation Order
|
|
26
|
+
|
|
27
|
+
<!-- Sequence the implementation work at file/module level -->
|
|
28
|
+
<!-- Use numbered steps with file references in parentheses -->
|
|
29
|
+
<!-- Example:
|
|
30
|
+
|
|
31
|
+
1. **Core Implementation** (new-feature.ts)
|
|
32
|
+
- Implement primary data structures
|
|
33
|
+
- Add main function logic
|
|
34
|
+
- Handle edge cases
|
|
35
|
+
|
|
36
|
+
2. **CLI Integration** (commands.ts)
|
|
37
|
+
- Add command registration
|
|
38
|
+
- Implement command handler
|
|
39
|
+
- Add help text
|
|
40
|
+
|
|
41
|
+
3. **Testing** (new-feature.test.ts)
|
|
42
|
+
- Write unit tests
|
|
43
|
+
- Add integration tests
|
|
44
|
+
- Verify coverage
|
|
45
|
+
-->
|
|
46
|
+
|
|
47
|
+
## Test Plan
|
|
48
|
+
|
|
49
|
+
<!-- Describe how to verify the change -->
|
|
50
|
+
<!-- Include test types: unit, integration, e2e, manual -->
|
|
51
|
+
<!-- Example:
|
|
52
|
+
|
|
53
|
+
### Unit Tests
|
|
54
|
+
- Test core function with valid inputs
|
|
55
|
+
- Test error handling for invalid inputs
|
|
56
|
+
- Test edge cases
|
|
57
|
+
|
|
58
|
+
### Integration Tests
|
|
59
|
+
- Test CLI command with real filesystem
|
|
60
|
+
- Test integration with existing modules
|
|
61
|
+
|
|
62
|
+
### Manual Tests
|
|
63
|
+
- Verify CLI command works as expected
|
|
64
|
+
- Check error messages are clear
|
|
65
|
+
-->
|
|
66
|
+
|
|
67
|
+
## Risks
|
|
68
|
+
|
|
69
|
+
<!-- Identify known risks with mitigations -->
|
|
70
|
+
<!-- Format: [Risk] → Mitigation -->
|
|
71
|
+
<!-- Example:
|
|
72
|
+
|
|
73
|
+
**Breaking Change Risk**
|
|
74
|
+
- [Risk] Existing users may rely on old behavior
|
|
75
|
+
- [Mitigation] Provide migration guide, add deprecation warning
|
|
76
|
+
|
|
77
|
+
**Performance Risk**
|
|
78
|
+
- [Risk] New feature may slow down existing operations
|
|
79
|
+
- [Mitigation] Add performance tests, optimize hot paths
|
|
80
|
+
-->
|
|
81
|
+
|
|
82
|
+
## Done Definition
|
|
83
|
+
|
|
84
|
+
<!-- Define objective criteria for completion -->
|
|
85
|
+
<!-- Example:
|
|
86
|
+
- All unit tests passing
|
|
87
|
+
- All integration tests passing
|
|
88
|
+
- Documentation updated
|
|
89
|
+
- Error messages are clear and actionable
|
|
90
|
+
- Performance requirements met
|
|
91
|
+
-->
|