@fission-ai/openspec 1.13.0 → 1.13.2
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 +16 -4
- package/dist/commands/change.js +12 -1
- package/dist/commands/config.d.ts +9 -0
- package/dist/commands/config.js +161 -22
- package/dist/commands/feedback.js +6 -4
- package/dist/commands/schema.js +30 -9
- package/dist/commands/store.js +5 -2
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.js +63 -1
- package/dist/commands/workflow/instructions.js +69 -22
- package/dist/commands/workflow/new-change.js +20 -0
- package/dist/commands/workflow/shared.d.ts +5 -0
- package/dist/commands/workflow/shared.js +8 -0
- package/dist/commands/workflow/status.d.ts +5 -1
- package/dist/commands/workflow/status.js +42 -5
- package/dist/core/archive.js +260 -77
- package/dist/core/artifact-graph/outputs.d.ts +1 -1
- package/dist/core/artifact-graph/outputs.js +38 -8
- package/dist/core/artifact-graph/schema.d.ts +14 -0
- package/dist/core/artifact-graph/schema.js +52 -0
- package/dist/core/artifact-graph/types.js +12 -1
- package/dist/core/change-status-policy.d.ts +14 -0
- package/dist/core/change-status-policy.js +14 -6
- package/dist/core/command-generation/adapters/continue.js +4 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +1 -1
- package/dist/core/command-generation/adapters/kilocode.js +2 -2
- package/dist/core/command-generation/generator.js +2 -0
- package/dist/core/completion-tip.js +7 -7
- package/dist/core/completions/installers/bash-installer.js +15 -7
- package/dist/core/completions/installers/shell-quote.d.ts +11 -0
- package/dist/core/completions/installers/shell-quote.js +13 -0
- package/dist/core/completions/installers/zsh-installer.js +3 -2
- package/dist/core/config-schema.d.ts +1 -1
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.js +27 -1
- package/dist/core/global-config.d.ts +30 -2
- package/dist/core/global-config.js +57 -3
- package/dist/core/init.js +22 -6
- package/dist/core/legacy-cleanup.d.ts +5 -1
- package/dist/core/legacy-cleanup.js +207 -14
- package/dist/core/list.js +55 -11
- package/dist/core/migration.js +6 -1
- package/dist/core/parsers/change-parser.d.ts +12 -1
- package/dist/core/parsers/change-parser.js +85 -87
- package/dist/core/parsers/markdown-parser.js +4 -3
- package/dist/core/parsers/requirement-blocks.d.ts +78 -6
- package/dist/core/parsers/requirement-blocks.js +155 -38
- package/dist/core/parsers/requirement-text.d.ts +13 -2
- package/dist/core/parsers/requirement-text.js +34 -7
- package/dist/core/parsers/spec-structure.js +4 -1
- package/dist/core/project-config.d.ts +9 -1
- package/dist/core/project-config.js +11 -2
- package/dist/core/references.d.ts +20 -0
- package/dist/core/references.js +56 -0
- package/dist/core/shared/skill-content-equivalence.js +5 -1
- package/dist/core/shared/skill-generation.js +36 -8
- package/dist/core/shared/tool-detection.js +9 -3
- package/dist/core/specs-apply.d.ts +20 -0
- package/dist/core/specs-apply.js +101 -17
- package/dist/core/store/git.d.ts +33 -0
- package/dist/core/store/git.js +60 -6
- package/dist/core/store/operations.d.ts +1 -1
- package/dist/core/store/operations.js +32 -10
- package/dist/core/store/registry.d.ts +2 -1
- package/dist/core/store/registry.js +5 -1
- package/dist/core/templates/optional-workflow.d.ts +69 -0
- package/dist/core/templates/optional-workflow.js +140 -0
- package/dist/core/templates/workflows/apply-change.js +18 -3
- package/dist/core/templates/workflows/archive-change.js +70 -21
- package/dist/core/templates/workflows/bulk-archive-change.js +85 -21
- package/dist/core/templates/workflows/continue-change.js +14 -4
- package/dist/core/templates/workflows/explore.js +34 -16
- package/dist/core/templates/workflows/ff-change.js +21 -5
- package/dist/core/templates/workflows/new-change.js +15 -3
- package/dist/core/templates/workflows/onboard.js +76 -41
- package/dist/core/templates/workflows/project-root.d.ts +29 -0
- package/dist/core/templates/workflows/project-root.js +38 -0
- package/dist/core/templates/workflows/propose.js +22 -5
- package/dist/core/templates/workflows/sync-specs.js +40 -1
- package/dist/core/templates/workflows/update-change.js +66 -27
- package/dist/core/templates/workflows/verify-change.js +121 -49
- package/dist/core/update.d.ts +12 -0
- package/dist/core/update.js +78 -10
- package/dist/core/validation/purpose-placeholder.js +24 -9
- package/dist/core/validation/task-checkboxes.d.ts +34 -0
- package/dist/core/validation/task-checkboxes.js +181 -0
- package/dist/core/validation/validator.d.ts +53 -1
- package/dist/core/validation/validator.js +160 -45
- package/dist/core/version-check.d.ts +14 -7
- package/dist/core/version-check.js +63 -17
- package/dist/core/worksets.js +6 -4
- package/dist/prompts/searchable-multi-select.d.ts +7 -0
- package/dist/prompts/searchable-multi-select.js +35 -6
- package/dist/telemetry/config.js +14 -2
- package/dist/telemetry/index.d.ts +4 -3
- package/dist/telemetry/index.js +22 -10
- package/dist/telemetry/opt-out.d.ts +17 -0
- package/dist/telemetry/opt-out.js +27 -0
- package/dist/utils/file-system.js +20 -3
- package/dist/utils/line-endings.d.ts +34 -0
- package/dist/utils/line-endings.js +46 -0
- package/dist/utils/nested-change.d.ts +35 -0
- package/dist/utils/nested-change.js +186 -0
- package/dist/utils/spec-discovery.d.ts +20 -0
- package/dist/utils/spec-discovery.js +59 -0
- package/dist/utils/task-progress.d.ts +1 -1
- package/dist/utils/task-progress.js +38 -6
- package/package.json +5 -5
- package/schemas/spec-driven/schema.yaml +18 -3
- package/schemas/spec-driven/templates/design.md +2 -0
- package/schemas/spec-driven/templates/proposal.md +2 -0
- package/schemas/spec-driven/templates/spec.md +2 -0
- package/schemas/spec-driven/templates/tasks.md +2 -0
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
import { optionalWorkflow } from '../optional-workflow.js';
|
|
1
2
|
import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
|
|
3
|
+
import { PROJECT_ROOT_GUARD } from './project-root.js';
|
|
4
|
+
/**
|
|
5
|
+
* The implementation handoff. `apply` is not guaranteed to be installed, so
|
|
6
|
+
* the prompt is resolved at generation time (see optional-workflow.ts) rather
|
|
7
|
+
* than naming a workflow that may not exist.
|
|
8
|
+
*
|
|
9
|
+
* The two surfaces word this differently on purpose (#258): a command-only
|
|
10
|
+
* tool has no conversational agent to ask, so its prompt names a command or
|
|
11
|
+
* the CLI and never invites "ask me to implement".
|
|
12
|
+
*/
|
|
13
|
+
const SKILL_APPLY_HANDOFF = optionalWorkflow('apply', 'run `/opsx:apply` or ask me to apply this change', 'ask me to apply this change');
|
|
14
|
+
const COMMAND_APPLY_HANDOFF = optionalWorkflow('apply', 'run `/opsx:apply`', 'run `openspec instructions apply --change "<name>" --json` to get the tasks');
|
|
2
15
|
export function getOpsxProposeSkillTemplate() {
|
|
3
16
|
return {
|
|
4
17
|
name: 'openspec-propose',
|
|
5
|
-
description: 'Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.',
|
|
18
|
+
description: 'Propose a new OpenSpec change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation. Also use when the user says "openspec propose" or "opsx propose".',
|
|
6
19
|
instructions: `Propose a new change - create the change and generate all artifacts in one step.
|
|
7
20
|
|
|
8
21
|
**Planning boundary**: This workflow creates planning artifacts only. The user request that selected or triggered this workflow authorizes planning only, even if it asks to build or fix something. Do not edit project code. After the planning artifacts are complete, stop. Do not start implementation in the same response, even if the initial request asks for it. Wait for a new user request after the artifacts are presented; then start the apply workflow.
|
|
@@ -21,6 +34,8 @@ When the user is ready to implement, they must start the apply workflow explicit
|
|
|
21
34
|
|
|
22
35
|
${STORE_SELECTION_GUIDANCE}
|
|
23
36
|
|
|
37
|
+
${PROJECT_ROOT_GUARD}
|
|
38
|
+
|
|
24
39
|
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
|
25
40
|
|
|
26
41
|
**Steps**
|
|
@@ -38,7 +53,7 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
38
53
|
|
|
39
54
|
2. **Load project context**
|
|
40
55
|
|
|
41
|
-
Run \`openspec context --json\` from the current working directory (or \`openspec context --json --store "<store-id>"\` when a registered store was explicitly selected). Use the returned \`root.path\` as the authoritative OpenSpec root. If context reports \`no_openspec_root\`, stop without creating or changing any files. Offer \`openspec init\` and wait for the user to request initialization. Do not initialize automatically or run \`openspec new change\`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
|
56
|
+
Run \`openspec context --json\` from the current working directory (or \`openspec context --json --store "<store-id>"\` when a registered store was explicitly selected). Use the returned \`root.path\` as the authoritative OpenSpec root. If context reports \`no_openspec_root\`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer \`openspec init\` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run \`openspec new change\`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
|
42
57
|
|
|
43
58
|
Only when context returns a resolved \`root.path\`, read \`<root.path>/openspec/config.yaml\`. Use \`config.yml\` only when \`config.yaml\` does not exist. If neither file exists, continue without project context. Do not fall back to \`config.yml\` if \`config.yaml\` is unreadable or invalid.
|
|
44
59
|
|
|
@@ -134,7 +149,7 @@ After completing all artifacts, summarize:
|
|
|
134
149
|
- Change name and location
|
|
135
150
|
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
|
136
151
|
- What's ready: "All artifacts needed for implementation are ready."
|
|
137
|
-
- Prompt: "The artifacts are ready for review. When you are ready,
|
|
152
|
+
- Prompt: "The artifacts are ready for review. When you are ready, ${SKILL_APPLY_HANDOFF}."
|
|
138
153
|
|
|
139
154
|
**Artifact Creation Guidelines**
|
|
140
155
|
|
|
@@ -183,6 +198,8 @@ When the user is ready to implement, they must start the apply workflow explicit
|
|
|
183
198
|
|
|
184
199
|
${STORE_SELECTION_GUIDANCE}
|
|
185
200
|
|
|
201
|
+
${PROJECT_ROOT_GUARD}
|
|
202
|
+
|
|
186
203
|
**Input**: The argument after \`/opsx:propose\` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
187
204
|
|
|
188
205
|
**Steps**
|
|
@@ -200,7 +217,7 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
200
217
|
|
|
201
218
|
2. **Load project context**
|
|
202
219
|
|
|
203
|
-
Run \`openspec context --json\` from the current working directory (or \`openspec context --json --store "<store-id>"\` when a registered store was explicitly selected). Use the returned \`root.path\` as the authoritative OpenSpec root. If context reports \`no_openspec_root\`, stop without creating or changing any files. Offer \`openspec init\` and wait for the user to request initialization. Do not initialize automatically or run \`openspec new change\`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
|
220
|
+
Run \`openspec context --json\` from the current working directory (or \`openspec context --json --store "<store-id>"\` when a registered store was explicitly selected). Use the returned \`root.path\` as the authoritative OpenSpec root. If context reports \`no_openspec_root\`, stop without creating or changing any files and follow the **Project check** above for how this workflow was reached. Offer \`openspec init\` only for an explicit OpenSpec request, and wait for the user to request initialization. Do not initialize automatically or run \`openspec new change\`. After initialization, rerun this context check before continuing. For any other context failure, stop and report the error; do not fall back to the current directory or run later OpenSpec commands without the selected store.
|
|
204
221
|
|
|
205
222
|
Only when context returns a resolved \`root.path\`, read \`<root.path>/openspec/config.yaml\`. Use \`config.yml\` only when \`config.yaml\` does not exist. If neither file exists, continue without project context. Do not fall back to \`config.yml\` if \`config.yaml\` is unreadable or invalid.
|
|
206
223
|
|
|
@@ -296,7 +313,7 @@ After completing all artifacts, summarize:
|
|
|
296
313
|
- Change name and location
|
|
297
314
|
- List of artifacts created with brief descriptions, plus any conditional artifact you skipped and why
|
|
298
315
|
- What's ready: "All artifacts needed for implementation are ready."
|
|
299
|
-
- Prompt: "The artifacts are ready for review. When you are ready,
|
|
316
|
+
- Prompt: "The artifacts are ready for review. When you are ready, ${COMMAND_APPLY_HANDOFF}."
|
|
300
317
|
|
|
301
318
|
**Artifact Creation Guidelines**
|
|
302
319
|
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
|
|
2
|
+
import { PROJECT_ROOT_GUARD } from './project-root.js';
|
|
2
3
|
export function getSyncSpecsSkillTemplate() {
|
|
3
4
|
return {
|
|
4
5
|
name: 'openspec-sync-specs',
|
|
5
|
-
description: 'Sync delta specs from
|
|
6
|
+
description: 'Sync delta specs from an OpenSpec change to main specs. Use when the user wants to update main specs with changes from a delta spec, without archiving the change. Also use when the user says "openspec sync" or "opsx sync".',
|
|
6
7
|
instructions: `Sync delta specs from a change to main specs.
|
|
7
8
|
|
|
8
9
|
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
|
9
10
|
|
|
10
11
|
${STORE_SELECTION_GUIDANCE}
|
|
11
12
|
|
|
13
|
+
${PROJECT_ROOT_GUARD}
|
|
14
|
+
|
|
12
15
|
\`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve the full path from each delta spec when resolving its main spec.
|
|
13
16
|
|
|
14
17
|
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
@@ -89,6 +92,13 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
89
92
|
|
|
90
93
|
b. **Read the main spec** at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (may not exist yet)
|
|
91
94
|
|
|
95
|
+
**If it does not exist yet** (a new capability), match what \`openspec archive\` does:
|
|
96
|
+
only ADDED requirements may be applied - step d creates the spec from them.
|
|
97
|
+
MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
|
|
98
|
+
capability and report that its main spec does not exist and only ADDED is allowed
|
|
99
|
+
for a new spec; never invent the missing requirement. REMOVED has nothing to
|
|
100
|
+
remove - skip it and warn.
|
|
101
|
+
|
|
92
102
|
c. **Apply changes intelligently**:
|
|
93
103
|
|
|
94
104
|
**ADDED Requirements:**
|
|
@@ -136,6 +146,14 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
136
146
|
(this is what \`openspec archive\` does; it warns and moves on)
|
|
137
147
|
|
|
138
148
|
d. **Create new main spec** if capability doesn't exist yet:
|
|
149
|
+
- Only when the delta has ADDED requirements to put in it and no MODIFIED or
|
|
150
|
+
RENAMED requirements blocked this capability in step b. Otherwise create nothing
|
|
151
|
+
and leave the specs directory untouched. For a REMOVED-only delta, if the change's
|
|
152
|
+
\`.openspec.yaml\` declares \`retire_capabilities: true\`, report it as already retired
|
|
153
|
+
and continue without recreating the spec. Without that marker, report the sync as blocked:
|
|
154
|
+
\`openspec archive\` rejects it with \`Spec must have at least one requirement\`.
|
|
155
|
+
An empty delta has no operations to sync; report it as blocked too.
|
|
156
|
+
Never write an empty \`## Requirements\` section.
|
|
139
157
|
- Create \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\`
|
|
140
158
|
- Add Purpose section: copy the delta's \`## Purpose\` body verbatim when it has one
|
|
141
159
|
(this is what \`openspec archive\` does); only write a brief TBD placeholder when it does not
|
|
@@ -160,6 +178,8 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
160
178
|
**Delta Spec Format Reference**
|
|
161
179
|
|
|
162
180
|
\`\`\`markdown
|
|
181
|
+
# Spec Delta
|
|
182
|
+
|
|
163
183
|
## Purpose
|
|
164
184
|
|
|
165
185
|
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
|
@@ -270,6 +290,8 @@ This is an **agent-driven** operation - you will read delta specs and directly e
|
|
|
270
290
|
|
|
271
291
|
${STORE_SELECTION_GUIDANCE}
|
|
272
292
|
|
|
293
|
+
${PROJECT_ROOT_GUARD}
|
|
294
|
+
|
|
273
295
|
\`<capability-path>\` is the spec directory relative to \`specs/\` (for example, \`user-auth\` or \`identity/user-auth\`). Preserve the full path from each delta spec when resolving its main spec.
|
|
274
296
|
|
|
275
297
|
**Input**: Optionally specify a change name after \`/opsx:sync\` (e.g., \`/opsx:sync add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
@@ -350,6 +372,13 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
350
372
|
|
|
351
373
|
b. **Read the main spec** at \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\` (may not exist yet)
|
|
352
374
|
|
|
375
|
+
**If it does not exist yet** (a new capability), match what \`openspec archive\` does:
|
|
376
|
+
only ADDED requirements may be applied - step d creates the spec from them.
|
|
377
|
+
MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
|
|
378
|
+
capability and report that its main spec does not exist and only ADDED is allowed
|
|
379
|
+
for a new spec; never invent the missing requirement. REMOVED has nothing to
|
|
380
|
+
remove - skip it and warn.
|
|
381
|
+
|
|
353
382
|
c. **Apply changes intelligently**:
|
|
354
383
|
|
|
355
384
|
**ADDED Requirements:**
|
|
@@ -397,6 +426,14 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
397
426
|
(this is what \`openspec archive\` does; it warns and moves on)
|
|
398
427
|
|
|
399
428
|
d. **Create new main spec** if capability doesn't exist yet:
|
|
429
|
+
- Only when the delta has ADDED requirements to put in it and no MODIFIED or
|
|
430
|
+
RENAMED requirements blocked this capability in step b. Otherwise create nothing
|
|
431
|
+
and leave the specs directory untouched. For a REMOVED-only delta, if the change's
|
|
432
|
+
\`.openspec.yaml\` declares \`retire_capabilities: true\`, report it as already retired
|
|
433
|
+
and continue without recreating the spec. Without that marker, report the sync as blocked:
|
|
434
|
+
\`openspec archive\` rejects it with \`Spec must have at least one requirement\`.
|
|
435
|
+
An empty delta has no operations to sync; report it as blocked too.
|
|
436
|
+
Never write an empty \`## Requirements\` section.
|
|
400
437
|
- Create \`<planningHome.root>/openspec/specs/<capability-path>/spec.md\`
|
|
401
438
|
- Add Purpose section: copy the delta's \`## Purpose\` body verbatim when it has one
|
|
402
439
|
(this is what \`openspec archive\` does); only write a brief TBD placeholder when it does not
|
|
@@ -421,6 +458,8 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
421
458
|
**Delta Spec Format Reference**
|
|
422
459
|
|
|
423
460
|
\`\`\`markdown
|
|
461
|
+
# Spec Delta
|
|
462
|
+
|
|
424
463
|
## Purpose
|
|
425
464
|
|
|
426
465
|
Only on a delta that introduces a brand-new capability. Seeds the new main spec.
|
|
@@ -1,15 +1,38 @@
|
|
|
1
|
+
import { optionalWorkflow } from '../optional-workflow.js';
|
|
1
2
|
import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
|
|
3
|
+
import { PROJECT_ROOT_GUARD } from './project-root.js';
|
|
4
|
+
/**
|
|
5
|
+
* Passages that hand off to `/opsx:continue` or `/opsx:new`. Neither workflow
|
|
6
|
+
* is in the `core` profile, so each is authored with a CLI fallback and
|
|
7
|
+
* resolved at generation time (see optional-workflow.ts). Shared by both
|
|
8
|
+
* surfaces below so the skill and the command cannot drift apart.
|
|
9
|
+
*/
|
|
10
|
+
const CONTINUE_SCOPE_NOTE = optionalWorkflow('continue', 'This workflow revises artifacts that already exist; `/opsx:continue` is what creates the ones that do not.', 'This workflow revises artifacts that already exist; it never creates missing ones. When an artifact is missing, `openspec status --change "<name>" --json` names the next one and `openspec instructions "<artifact-id>" --change "<name>" --json` explains how to write it.');
|
|
11
|
+
const CONTINUE_CREATE_THEM = optionalWorkflow('continue', 'point the user to `/opsx:continue` to create them', 'point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create them');
|
|
12
|
+
const CONTINUE_NEXT_STEP = optionalWorkflow('continue', 'suggest `/opsx:continue` to create them', 'run `openspec status --change "<name>" --json` for the next artifact and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create it');
|
|
13
|
+
const CONTINUE_DEFERRED = optionalWorkflow('continue', 'Anything deferred to `/opsx:continue` (artifacts with no files yet and status `ready` or `blocked`, never `skipped` artifacts)', 'Anything deferred because it does not exist yet (artifacts with no files and status `ready` or `blocked`, never `skipped` artifacts)');
|
|
14
|
+
const CONTINUE_FRONTIER = optionalWorkflow('continue', "that is `/opsx:continue`'s job", 'creating them is a separate step, outside this workflow');
|
|
15
|
+
/**
|
|
16
|
+
* `apply` and `archive` are in the `core` profile but not guaranteed in a
|
|
17
|
+
* custom one, so their handoffs are resolved the same way.
|
|
18
|
+
*/
|
|
19
|
+
const APPLY_DELTA_HANDOFF = optionalWorkflow('apply', 'suggest `/opsx:apply` to carry the delta into code', 'say that the code may need updating and offer to carry the delta into it');
|
|
20
|
+
const APPLY_GUARDRAIL = optionalWorkflow('apply', 'stop and point to `/opsx:apply`', 'stop and say that the revised plan now implies code changes; implementing them is a separate step');
|
|
21
|
+
const ARCHIVE_HANDOFF = optionalWorkflow('archive', 'suggest `/opsx:archive`', 'suggest archiving with `openspec archive "<name>"`');
|
|
22
|
+
const INTENT_CHANGE_GUARDRAIL = optionalWorkflow('new', 'recommend starting fresh with `/opsx:new` (the "Update vs. Start Fresh" heuristic)', 'ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead (the "Update vs. Start Fresh" heuristic)');
|
|
2
23
|
export function getUpdateChangeSkillTemplate() {
|
|
3
24
|
return {
|
|
4
25
|
name: 'openspec-update-change',
|
|
5
|
-
description: "Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Never edits code.",
|
|
26
|
+
description: "Update an OpenSpec change by revising its existing planning artifacts and keeping them coherent with one another. Use when the user wants to revise a change's plan, fold new decisions into it, or reconcile its artifacts after an edit. Also use when the user says \"openspec update change\" or \"opsx update\". If the user means the openspec update CLI command, which refreshes generated files, run that command instead. Never edits code.",
|
|
6
27
|
instructions: `Revise a change's existing planning artifacts and keep them coherent. Never edit code.
|
|
7
28
|
|
|
8
29
|
${STORE_SELECTION_GUIDANCE}
|
|
9
30
|
|
|
31
|
+
${PROJECT_ROOT_GUARD}
|
|
32
|
+
|
|
10
33
|
**Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
11
34
|
|
|
12
|
-
|
|
35
|
+
${CONTINUE_SCOPE_NOTE}
|
|
13
36
|
|
|
14
37
|
**Steps**
|
|
15
38
|
|
|
@@ -22,7 +45,6 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
22
45
|
|
|
23
46
|
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
24
47
|
- Change name
|
|
25
|
-
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
26
48
|
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
27
49
|
- How recently it was modified (from \`lastModified\` field)
|
|
28
50
|
|
|
@@ -50,13 +72,20 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
50
72
|
|
|
51
73
|
4. **Read and reconcile**
|
|
52
74
|
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
|
53
|
-
-
|
|
75
|
+
- Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
|
54
76
|
- Note everything that is now inconsistent, missing, or contradictory.
|
|
55
|
-
-
|
|
56
|
-
-
|
|
77
|
+
- Propose revisions to files that already exist (\`existingOutputPaths\`). If an artifact has no existing output files and status \`ready\` or \`blocked\`, note it and ${CONTINUE_CREATE_THEM}. Leave \`skipped\` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
|
|
78
|
+
- A glob artifact (e.g. \`specs/**/*.md\`) is marked \`done\` after at least one file matches, and the continue workflow only handles \`ready\` artifacts. When reconciliation identifies a missing file for a glob artifact whose \`existingOutputPaths\` is non-empty:
|
|
79
|
+
1. Run \`openspec instructions "<artifact-id>" --change "<name>" --json\` and use its \`instruction\` and \`template\`. Treat \`context\` and \`rules\` as constraints; do not copy them into the file. If instructions report \`skipped: true\`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
|
|
80
|
+
2. Choose a concrete path inside \`changeRoot\` that matches \`artifactPaths.<id>.outputPath\` and does not already exist. Verify it remains inside \`changeRoot\` after resolving any symlinked parent directories. The glob \`resolvedOutputPath\` is not a valid target.
|
|
81
|
+
3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
|
|
82
|
+
4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
|
|
83
|
+
5. Use a create operation that fails if the target already exists. If \`instruction\` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
|
|
84
|
+
- If the change is already coherent, say so and propose no revisions.
|
|
57
85
|
|
|
58
86
|
5. **Confirm and apply, one artifact at a time**
|
|
59
|
-
-
|
|
87
|
+
- This step performs every artifact write in this workflow; no earlier step edits an artifact.
|
|
88
|
+
- Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
|
|
60
89
|
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
|
61
90
|
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
|
62
91
|
\`\`\`bash
|
|
@@ -64,24 +93,25 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
64
93
|
\`\`\`
|
|
65
94
|
|
|
66
95
|
6. **Point to the next step (guidance only - NEVER act on it)**
|
|
67
|
-
- Artifacts
|
|
68
|
-
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan;
|
|
69
|
-
- Everything done and implemented ->
|
|
96
|
+
- Artifacts with empty \`existingOutputPaths\` and status \`ready\` or \`blocked\` -> ${CONTINUE_NEXT_STEP}.
|
|
97
|
+
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; ${APPLY_DELTA_HANDOFF}.
|
|
98
|
+
- Everything done and implemented -> ${ARCHIVE_HANDOFF}.
|
|
70
99
|
|
|
71
100
|
**Output**
|
|
72
101
|
|
|
73
102
|
After each invocation, show:
|
|
74
103
|
- Which artifacts were revised (and which proposed revisions were rejected)
|
|
75
|
-
-
|
|
104
|
+
- Any file created under a glob artifact that was already partially populated
|
|
105
|
+
- ${CONTINUE_DEFERRED}
|
|
76
106
|
- Where the change stands and the recommended next command
|
|
77
107
|
|
|
78
108
|
**Guardrails**
|
|
79
|
-
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes,
|
|
109
|
+
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, ${APPLY_GUARDRAIL}.
|
|
80
110
|
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names.
|
|
81
111
|
- Edit only the concrete files in \`existingOutputPaths\`; never write to a glob \`resolvedOutputPath\`.
|
|
82
|
-
- Do not advance the build frontier:
|
|
112
|
+
- Do not advance the build frontier: if an artifact has empty \`existingOutputPaths\` and status \`ready\` or \`blocked\`, ${CONTINUE_FRONTIER}. Leave \`skipped\` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose \`existingOutputPaths\` is non-empty.
|
|
83
113
|
- Confirm every edit with the user before writing.
|
|
84
|
-
- If the request changes the change's *intent* rather than refining it,
|
|
114
|
+
- If the request changes the change's *intent* rather than refining it, ${INTENT_CHANGE_GUARDRAIL}.`,
|
|
85
115
|
license: 'MIT',
|
|
86
116
|
compatibility: 'Requires openspec CLI.',
|
|
87
117
|
metadata: { author: 'openspec', version: '1.0' },
|
|
@@ -97,9 +127,11 @@ export function getOpsxUpdateCommandTemplate() {
|
|
|
97
127
|
|
|
98
128
|
${STORE_SELECTION_GUIDANCE}
|
|
99
129
|
|
|
130
|
+
${PROJECT_ROOT_GUARD}
|
|
131
|
+
|
|
100
132
|
**Input**: Optionally specify a change name after \`/opsx:update\` (e.g., \`/opsx:update add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
101
133
|
|
|
102
|
-
|
|
134
|
+
${CONTINUE_SCOPE_NOTE}
|
|
103
135
|
|
|
104
136
|
**Steps**
|
|
105
137
|
|
|
@@ -112,7 +144,6 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
112
144
|
|
|
113
145
|
When prompting, present the top 3-4 most recently modified changes as options, showing:
|
|
114
146
|
- Change name
|
|
115
|
-
- Schema (from \`schema\` field if present, otherwise "spec-driven")
|
|
116
147
|
- Status (e.g., "0/5 tasks", "complete", "no tasks")
|
|
117
148
|
- How recently it was modified (from \`lastModified\` field)
|
|
118
149
|
|
|
@@ -140,13 +171,20 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
140
171
|
|
|
141
172
|
4. **Read and reconcile**
|
|
142
173
|
- Read the artifact(s) the request touches and the change's other existing artifacts.
|
|
143
|
-
-
|
|
174
|
+
- Draft the requested edit in the conversation, not in files. Work out exactly what it changes; step 5 owns every write. Then check every other existing artifact against the drafted edit - in ANY direction: an edit to a later artifact may require revising an earlier one, not only the other way around. Build order is a useful reading order, not a constraint on which artifacts may be revised.
|
|
144
175
|
- Note everything that is now inconsistent, missing, or contradictory.
|
|
145
|
-
-
|
|
146
|
-
-
|
|
176
|
+
- Propose revisions to files that already exist (\`existingOutputPaths\`). If an artifact has no existing output files and status \`ready\` or \`blocked\`, note it and ${CONTINUE_CREATE_THEM}. Leave \`skipped\` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
|
|
177
|
+
- A glob artifact (e.g. \`specs/**/*.md\`) is marked \`done\` after at least one file matches, and the continue workflow only handles \`ready\` artifacts. When reconciliation identifies a missing file for a glob artifact whose \`existingOutputPaths\` is non-empty:
|
|
178
|
+
1. Run \`openspec instructions "<artifact-id>" --change "<name>" --json\` and use its \`instruction\` and \`template\`. Treat \`context\` and \`rules\` as constraints; do not copy them into the file. If instructions report \`skipped: true\`, do not create the file. Read current dependency files from disk; if a required non-skipped dependency is missing, stop and ask the user to restore it first.
|
|
179
|
+
2. Choose a concrete path inside \`changeRoot\` that matches \`artifactPaths.<id>.outputPath\` and does not already exist. Verify it remains inside \`changeRoot\` after resolving any symlinked parent directories. The glob \`resolvedOutputPath\` is not a valid target.
|
|
180
|
+
3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
|
|
181
|
+
4. After confirmation, immediately before creation, refresh status and instructions. Verify the artifact is still in scope, not skipped, and partially populated; repeat the concrete-path checks above.
|
|
182
|
+
5. Use a create operation that fails if the target already exists. If \`instruction\` delegates creation to another skill or command, invoke it only if it can honor the confirmed path and these guardrails; otherwise stop. If any check fails or the confirmed draft is no longer valid, stop and reconcile with the user rather than replacing existing content or choosing a different path.
|
|
183
|
+
- If the change is already coherent, say so and propose no revisions.
|
|
147
184
|
|
|
148
185
|
5. **Confirm and apply, one artifact at a time**
|
|
149
|
-
-
|
|
186
|
+
- This step performs every artifact write in this workflow; no earlier step edits an artifact.
|
|
187
|
+
- Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
|
|
150
188
|
- If the user rejects a revision, do not write it - leave that artifact unchanged.
|
|
151
189
|
- When a substantial rewrite is needed, get that artifact's rules and template first:
|
|
152
190
|
\`\`\`bash
|
|
@@ -154,24 +192,25 @@ ${STORE_SELECTION_GUIDANCE}
|
|
|
154
192
|
\`\`\`
|
|
155
193
|
|
|
156
194
|
6. **Point to the next step (guidance only - NEVER act on it)**
|
|
157
|
-
- Artifacts
|
|
158
|
-
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan;
|
|
159
|
-
- Everything done and implemented ->
|
|
195
|
+
- Artifacts with empty \`existingOutputPaths\` and status \`ready\` or \`blocked\` -> ${CONTINUE_NEXT_STEP}.
|
|
196
|
+
- Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; ${APPLY_DELTA_HANDOFF}.
|
|
197
|
+
- Everything done and implemented -> ${ARCHIVE_HANDOFF}.
|
|
160
198
|
|
|
161
199
|
**Output**
|
|
162
200
|
|
|
163
201
|
After each invocation, show:
|
|
164
202
|
- Which artifacts were revised (and which proposed revisions were rejected)
|
|
165
|
-
-
|
|
203
|
+
- Any file created under a glob artifact that was already partially populated
|
|
204
|
+
- ${CONTINUE_DEFERRED}
|
|
166
205
|
- Where the change stands and the recommended next command
|
|
167
206
|
|
|
168
207
|
**Guardrails**
|
|
169
|
-
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes,
|
|
208
|
+
- Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, ${APPLY_GUARDRAIL}.
|
|
170
209
|
- Use the artifact ids and paths reported by \`openspec status\`; never branch on hardcoded artifact names.
|
|
171
210
|
- Edit only the concrete files in \`existingOutputPaths\`; never write to a glob \`resolvedOutputPath\`.
|
|
172
|
-
- Do not advance the build frontier:
|
|
211
|
+
- Do not advance the build frontier: if an artifact has empty \`existingOutputPaths\` and status \`ready\` or \`blocked\`, ${CONTINUE_FRONTIER}. Leave \`skipped\` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose \`existingOutputPaths\` is non-empty.
|
|
173
212
|
- Confirm every edit with the user before writing.
|
|
174
|
-
- If the request changes the change's *intent* rather than refining it,
|
|
213
|
+
- If the request changes the change's *intent* rather than refining it, ${INTENT_CHANGE_GUARDRAIL}.`
|
|
175
214
|
};
|
|
176
215
|
}
|
|
177
216
|
//# sourceMappingURL=update-change.js.map
|