@syncfusion/ej2-vue-pdfviewer 35.1.46 → 35.2.13

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.
@@ -0,0 +1,286 @@
1
+ ---
2
+ name: "OPSX: Sync"
3
+ description: "Sync delta specs from a change to main specs"
4
+ allowed-tools: Bash(openspec:*)
5
+ category: "Workflow"
6
+ tags: ["workflow", "specs", "experimental"]
7
+ ---
8
+
9
+ Sync delta specs from a change to main specs.
10
+
11
+ 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).
12
+
13
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
14
+
15
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
16
+
17
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
18
+
19
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
20
+
21
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
22
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
23
+
24
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
25
+
26
+ `<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.
27
+
28
+ **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.
29
+
30
+ **Steps**
31
+
32
+ 1. **Select the change**
33
+
34
+ If a name is provided, use it. Otherwise:
35
+ - Infer from conversation context if the user mentioned a change
36
+ - Auto-select if only one active change exists
37
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
38
+
39
+ When prompting, show changes that have delta specs (under `specs/` directory).
40
+
41
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:sync <other>`).
42
+
43
+ 2. **Resolve change context**
44
+
45
+ Run:
46
+ ```bash
47
+ openspec status --change "<name>" --json
48
+ ```
49
+
50
+ The JSON includes `planningHome.root`. Main specs live under `<planningHome.root>/openspec/specs/` — use that (store-aware) root for every main-spec path below, not a hardcoded repo path. When a store is selected it points at the store, not the current repository.
51
+
52
+ 3. **Find delta specs**
53
+
54
+ Use `artifactPaths.specs.existingOutputPaths` from the status JSON as the
55
+ only source of delta spec paths. If the `specs` entry is missing or
56
+ `existingOutputPaths` is empty, report that there are no delta specs to sync,
57
+ do not infer them from other artifacts, and stop without requesting artifact
58
+ instructions or writing a main spec.
59
+
60
+ Sync every path in `existingOutputPaths` unless the caller narrowed the set.
61
+ A caller narrows it by naming an explicit list of complete entries from
62
+ `existingOutputPaths` — copy those absolute values verbatim. Archive does
63
+ this inline, and a user can too (for example, by selecting the entry ending
64
+ in `/specs/billing/invoices/spec.md`).
65
+ Then sync only the named paths and leave the remaining delta specs untouched:
66
+ bulk archive excludes a delta whose implementation it could not find, and
67
+ syncing it anyway would write a main spec the caller deliberately withheld.
68
+ Carry that narrowed selection through step 4; never widen it back to the full
69
+ list. If a named path is not in `existingOutputPaths`, do not sync it —
70
+ report it and stop, rather than dropping it silently. If the named list is
71
+ empty, report that there is nothing to sync and stop without writing a main
72
+ spec.
73
+
74
+ Each delta spec file contains sections like:
75
+ - `## ADDED Requirements` - New requirements to add
76
+ - `## MODIFIED Requirements` - Changes to existing requirements
77
+ - `## REMOVED Requirements` - Requirements to remove
78
+ - `## RENAMED Requirements` - Requirements to rename (FROM:/TO: format)
79
+
80
+ If no delta specs found, inform user and stop.
81
+
82
+ 4. **For each delta spec, apply changes to main specs**
83
+
84
+ Before the first main-spec write, obtain one current specs-rule snapshot:
85
+ - If archive invoked this workflow inline and supplied a valid snapshot from
86
+ `openspec instructions specs --change "<name>" --json`, reuse it and do not
87
+ fetch the same instructions again.
88
+ - Otherwise run that command once now with the same selected-root flags.
89
+ - If the direct lookup exits non-zero or returns invalid artifact-instruction
90
+ JSON, report the error and stop before writing any main spec. Do not treat the
91
+ failure as an absent rule set.
92
+ - A valid response with omitted `rules` means no artifact rules are configured
93
+ and the existing semantic merge continues.
94
+
95
+ Apply returned `rules` only to the content and form of the main specs produced
96
+ by this merge. Artifact rules are not operation guidance and cannot change
97
+ selected roots, delta paths, CLI checks, or workflow steps. Use their text as
98
+ constraints without copying it verbatim into a main spec or summary.
99
+
100
+ For each capability delta spec path selected in step 3 — the full `existingOutputPaths` list, or the narrowed subset when a caller supplied one (these may belong to a selected store, not the repo):
101
+
102
+ a. **Read the delta spec** to understand the intended changes
103
+
104
+ b. **Read the main spec** at `<planningHome.root>/openspec/specs/<capability-path>/spec.md` (may not exist yet)
105
+
106
+ **If it does not exist yet** (a new capability), match what `openspec archive` does:
107
+ only ADDED requirements may be applied - step d creates the spec from them.
108
+ MODIFIED and RENAMED have no requirement to act on, so stop the sync for that
109
+ capability and report that its main spec does not exist and only ADDED is allowed
110
+ for a new spec; never invent the missing requirement. REMOVED has nothing to
111
+ remove - skip it and warn.
112
+
113
+ c. **Apply changes intelligently**:
114
+
115
+ **ADDED Requirements:**
116
+ - If requirement doesn't exist in main spec → add it
117
+ - If requirement already exists → update it to match (treat as implicit MODIFIED)
118
+
119
+ **MODIFIED Requirements:**
120
+ - Find the requirement in main spec
121
+ - Apply the changes - this can be:
122
+ - Adding new scenarios the main spec does not have yet
123
+ - Modifying existing scenarios
124
+ - Changing the requirement description
125
+ - Preserve scenarios/content not mentioned in the delta
126
+
127
+ **REMOVED Requirements:**
128
+ - Remove the entire requirement block from main spec
129
+ - Retiring the capability. Delete the whole `spec.md` - and the directory once
130
+ nothing else is left in it - only when ALL of these hold:
131
+ 1. removing the requirements *this run* left no requirement blocks;
132
+ 2. the rest of the spec is well-formed (it still has a `## Purpose`);
133
+ 3. the main spec was not already empty before this sync - if you removed
134
+ nothing, change nothing;
135
+ 4. every other nonblank line in the whole file is accounted for as the
136
+ title, Purpose, Requirements header, or a canonical requirement's
137
+ statement, scenarios, or fenced examples;
138
+ 5. the change's `.openspec.yaml` declares `retire_capabilities: true`;
139
+ 6. the `spec.md` resolves inside the real specs root (do not follow a
140
+ capability-directory symlink to delete an external file).
141
+ If removing the selected requirements would leave no requirement blocks and
142
+ any retirement condition is not satisfied, do not modify the main spec. Stop
143
+ the sync for that capability, report the blocking condition, and tell the user
144
+ how to resolve it. Never write or leave an empty `## Requirements` section.
145
+ When only the marker is missing, say that too - it is the one thing the user
146
+ can add to make the retirement go through.
147
+ - Deleting the file also deletes its `## Purpose`; any other section blocks
148
+ retirement. Name Purpose when you report the retirement. Include a pasteable
149
+ `git checkout` only when the spec lived in the caller's checkout;
150
+ otherwise give checkout-scoped recovery guidance.
151
+
152
+ **RENAMED Requirements:**
153
+ - Find the FROM requirement, rename to TO
154
+
155
+ **`## Purpose` in the delta:**
156
+ - The main spec already has one and it is authoritative - leave it alone
157
+ (this is what `openspec archive` does; it warns and moves on)
158
+
159
+ d. **Create new main spec** if capability doesn't exist yet:
160
+ - Only when the delta has ADDED requirements to put in it and no MODIFIED or
161
+ RENAMED requirements blocked this capability in step b. Otherwise create nothing
162
+ and leave the specs directory untouched. For a REMOVED-only delta, if the change's
163
+ `.openspec.yaml` declares `retire_capabilities: true`, report it as already retired
164
+ and continue without recreating the spec. Without that marker, report the sync as blocked:
165
+ `openspec archive` rejects it with `Spec must have at least one requirement`.
166
+ An empty delta has no operations to sync; report it as blocked too.
167
+ Never write an empty `## Requirements` section.
168
+ - Create `<planningHome.root>/openspec/specs/<capability-path>/spec.md`
169
+ - Add Purpose section: copy the delta's `## Purpose` body verbatim when it has one
170
+ (this is what `openspec archive` does); only write a brief TBD placeholder when it does not
171
+ - Add Requirements section with the ADDED requirements
172
+ - Follow the **Main Spec Format Reference** below
173
+
174
+ 5. **Validate updated main specs**
175
+
176
+ Run `openspec validate --specs` with the same selected-root flags used earlier.
177
+ If validation fails, report the problems and do not claim the sync succeeded.
178
+
179
+ 6. **Show summary**
180
+
181
+ After applying all changes, summarize:
182
+ - Which capabilities were updated
183
+ - What changes were made (requirements added/modified/removed/renamed)
184
+ - Any new main spec left with a TBD Purpose placeholder, so it gets written
185
+ now rather than lingering
186
+ - Any capability retired, naming the deleted `spec.md`, its Purpose, and
187
+ either a pasteable `git checkout` or checkout-scoped recovery guidance
188
+
189
+ **Delta Spec Format Reference**
190
+
191
+ ```markdown
192
+ # Spec Delta
193
+
194
+ ## Purpose
195
+
196
+ Only on a delta that introduces a brand-new capability. Seeds the new main spec.
197
+
198
+ ## ADDED Requirements
199
+
200
+ ### Requirement: New Feature
201
+ The system SHALL do something new.
202
+
203
+ #### Scenario: Basic case
204
+ - **WHEN** user does X
205
+ - **THEN** system does Y
206
+
207
+ ## MODIFIED Requirements
208
+
209
+ ### Requirement: Existing Feature
210
+ The system SHALL keep doing the existing thing, now also handling A.
211
+
212
+ #### Scenario: Scenario the main spec already has
213
+ - **WHEN** user does X
214
+ - **THEN** system does Y
215
+
216
+ #### Scenario: New scenario to add
217
+ - **WHEN** user does A
218
+ - **THEN** system does B
219
+
220
+ ## REMOVED Requirements
221
+
222
+ ### Requirement: Deprecated Feature
223
+
224
+ ## RENAMED Requirements
225
+
226
+ - FROM: `### Requirement: Old Name`
227
+ - TO: `### Requirement: New Name`
228
+ ```
229
+
230
+ **Main Spec Format Reference**
231
+
232
+ Main specs are what the delta merges INTO. They must never contain delta operation headers (`## ADDED/MODIFIED/REMOVED/RENAMED Requirements`) - after syncing, every requirement lives under a single `## Requirements` section:
233
+
234
+ ```markdown
235
+ # <capability> Specification
236
+
237
+ ## Purpose
238
+ Short description of what this capability does and why it exists.
239
+
240
+ ## Requirements
241
+
242
+ ### Requirement: New Feature
243
+ The system SHALL do something new.
244
+
245
+ #### Scenario: Basic case
246
+ - **WHEN** user does X
247
+ - **THEN** system does Y
248
+ ```
249
+
250
+ **Key Principle: Intelligent Merging**
251
+
252
+ Unlike programmatic merging, you merge rather than overwrite:
253
+ - A MODIFIED block carries the whole requirement - body plus every scenario that survives the change. `openspec validate` and `openspec archive` both reject one that drops a scenario the main spec still has.
254
+ - Keep anything the delta does not mention, in the main spec's existing order
255
+ - Use your judgment to merge changes sensibly
256
+
257
+ **Output On Success**
258
+
259
+ ```markdown
260
+ ## Specs Synced: <change-name>
261
+
262
+ Updated main specs:
263
+
264
+ **<capability-1>**:
265
+ - Added requirement: "New Feature"
266
+ - Modified requirement: "Existing Feature" (added 1 scenario)
267
+
268
+ **<capability-2>**:
269
+ - Created new spec file
270
+ - Added requirement: "Another Feature"
271
+
272
+ Main specs are now updated. The change remains active - archive when implementation is complete.
273
+ ```
274
+
275
+ **Guardrails**
276
+ - Read both delta and main specs before making changes
277
+ - Preserve existing content not mentioned in delta
278
+ - Never copy a delta file into a main spec as-is - merge its content so the main spec keeps the Main Spec Format Reference structure, with no delta operation headers
279
+ - If something is unclear, ask for clarification
280
+ - Show what you're changing as you go
281
+ - The operation should be idempotent - running twice should give same result
282
+ - Use only `artifactPaths.specs.existingOutputPaths`; never infer delta specs from unrelated artifacts
283
+ - Honor a caller-supplied subset of `existingOutputPaths`; never widen it back to the full list
284
+ - Fetch specs instructions once for direct sync, or reuse the archive-supplied snapshot inline
285
+ - Stop before every main-spec write on a non-zero or invalid JSON specs-instruction response
286
+ - Artifact rules constrain only the specs being written and are never copied into output files
@@ -0,0 +1,105 @@
1
+ ---
2
+ name: "OPSX: Update"
3
+ description: "Update a change - revise existing planning artifacts and keep them coherent (Experimental)"
4
+ allowed-tools: Bash(openspec:*)
5
+ category: "Workflow"
6
+ tags: ["workflow", "artifacts", "experimental"]
7
+ ---
8
+
9
+ Revise a change's existing planning artifacts and keep them coherent. Never edit code.
10
+
11
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
12
+
13
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
14
+
15
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
16
+
17
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
18
+
19
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
20
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
21
+
22
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
23
+
24
+ **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.
25
+
26
+ 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.
27
+
28
+ **Steps**
29
+
30
+ 1. **Select the change**
31
+
32
+ If a name is provided, use it. Otherwise:
33
+ - Infer from conversation context if the user mentioned a change
34
+ - Auto-select if only one active change exists
35
+ - If ambiguous, run `openspec list --json` to get available changes sorted by most recently modified, and ask the user to select one
36
+
37
+ When prompting, present the top 3-4 most recently modified changes as options, showing:
38
+ - Change name
39
+ - Status (e.g., "0/5 tasks", "complete", "no tasks")
40
+ - How recently it was modified (from `lastModified` field)
41
+
42
+ Mark the most recently modified change as "(Recommended)" since it's likely what the user wants to update.
43
+
44
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:update <other>`).
45
+
46
+ 2. **Get the change's artifacts**
47
+ ```bash
48
+ openspec status --change "<name>" --json
49
+ ```
50
+ Parse the JSON to understand current state. The response includes:
51
+ - `schemaName`: The workflow schema being used (e.g., "spec-driven")
52
+ - `artifacts`: Array of artifacts with their status ("done", "skipped", "ready", "blocked")
53
+ - `isPlanningComplete`: Boolean indicating if all planning artifacts are complete. Older CLI versions expose the same value as `isComplete`.
54
+ - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context. Use these instead of assuming repo-local paths.
55
+
56
+ The artifact ids and paths come from the active schema - do NOT assume them, and do NOT branch on hardcoded artifact names. Custom schemas must work unchanged.
57
+
58
+ The files to edit are `artifactPaths.<id>.existingOutputPaths` - the concrete files that exist on disk, already glob-expanded for glob artifacts (e.g. `specs/**/*.md`), plus any confirmed concrete path allowed under a partly populated glob artifact (step 4). Do NOT write to `resolvedOutputPath`: for a glob artifact it is still the glob pattern, not a real file.
59
+
60
+ 3. **Understand the request**
61
+ - If the user asked for a specific revision ("the design now uses X"), that is the starting edit.
62
+ - If they only said "update" / "make this coherent", treat it as a coherence review: read the existing artifacts and check them against each other for contradictions, gaps, and duplication.
63
+
64
+ 4. **Read and reconcile**
65
+ - Read the artifact(s) the request touches and the change's other existing artifacts.
66
+ - 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.
67
+ - Note everything that is now inconsistent, missing, or contradictory.
68
+ - Propose revisions to files that already exist (`existingOutputPaths`). If an artifact has no existing output files and status `ready` or `blocked`, note it and point the user to `openspec instructions "<artifact-id>" --change "<name>" --json` for how to create them. Leave `skipped` artifacts untouched; do not treat them as missing or defer them to the continue workflow.
69
+ - 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:
70
+ 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.
71
+ 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.
72
+ 3. Include the new file in step 5's proposed revisions and create it only after the user confirms.
73
+ 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.
74
+ 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.
75
+ - If the change is already coherent, say so and propose no revisions.
76
+
77
+ 5. **Confirm and apply, one artifact at a time**
78
+ - This step performs every artifact write in this workflow; no earlier step edits an artifact.
79
+ - Show each proposed revision and why - including the requested edit drafted in step 4. Write only after the user confirms.
80
+ - If the user rejects a revision, do not write it - leave that artifact unchanged.
81
+ - When a substantial rewrite is needed, get that artifact's rules and template first:
82
+ ```bash
83
+ openspec instructions "<artifact-id>" --change "<name>" --json
84
+ ```
85
+
86
+ 6. **Point to the next step (guidance only - NEVER act on it)**
87
+ - Artifacts with empty `existingOutputPaths` and status `ready` or `blocked` -> 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.
88
+ - Change already implemented (tasks checked off / already applied) -> the code may no longer match the revised plan; suggest `/opsx:apply` to carry the delta into code.
89
+ - Everything done and implemented -> suggest `/opsx:archive`.
90
+
91
+ **Output**
92
+
93
+ After each invocation, show:
94
+ - Which artifacts were revised (and which proposed revisions were rejected)
95
+ - Any file created under a glob artifact that was already partially populated
96
+ - Anything deferred because it does not exist yet (artifacts with no files and status `ready` or `blocked`, never `skipped` artifacts)
97
+ - Where the change stands and the recommended next command
98
+
99
+ **Guardrails**
100
+ - Planning artifacts only - NEVER edit implementation code. If the revised plan implies code changes, stop and point to `/opsx:apply`.
101
+ - Use the artifact ids and paths reported by `openspec status`; never branch on hardcoded artifact names.
102
+ - Edit only the concrete files in `existingOutputPaths`, plus any confirmed concrete path allowed under a partly populated glob artifact (step 4); never write to a glob `resolvedOutputPath`.
103
+ - Do not advance the build frontier: if an artifact has empty `existingOutputPaths` and status `ready` or `blocked`, creating them is a separate step, outside this workflow. Leave `skipped` artifacts untouched. The only new-file scope is a confirmed concrete path under a glob artifact whose `existingOutputPaths` is non-empty.
104
+ - Confirm every edit with the user before writing.
105
+ - If the request changes the change's *intent* rather than refining it, ask for a distinct unused change name and recommend `openspec new change "<new-change-name>"` instead (the "Update vs. Start Fresh" heuristic).
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: openspec-apply-change
3
+ description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. Also use when the user says "openspec apply", "opsx apply", or "openspec implement".
4
+ allowed-tools: Bash(openspec:*)
5
+ license: MIT
6
+ compatibility: Requires openspec CLI.
7
+ metadata:
8
+ author: openspec
9
+ version: "1.0"
10
+ generatedBy: "1.16.0"
11
+ ---
12
+
13
+ Implement tasks from an OpenSpec change.
14
+
15
+ **Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store <id>` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`, `schemas`, `view`). Once selected, treat `--store <id>` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "<name>" --json --store "<id>"`, not the unscoped form shown below. Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root.
16
+
17
+ **Project check:** These steps expect a project that already uses OpenSpec. Before the first step that writes anything (`new change`, `archive`, `sync specs`, or authoring an artifact file), confirm the project has a root: run `openspec list --json` (with `--store <id>` when a store is selected, since the store is then the root) and read `root`. A root object means the project is set up. `"root": null` means it is not - there is no `openspec/` directory here, and a write such as `openspec new change` would create one as a side effect. The command also exits non-zero, which is that answer rather than a broken CLI, so read the JSON instead of retrying or working around it.
18
+
19
+ One `"root": null` is not about setup: when a `status` error message starts with `Declared in` or `Invalid store declaration in` and names this project's `openspec/config.yaml` (or `config.yml`), the project does use OpenSpec through a store it declares, which this machine cannot resolve (the store is not registered, or the `store:` line is malformed). Do not treat it as uninitialized and skip the branches below: stop before writing and show the user that error's `message` and `fix`.
20
+
21
+ Otherwise, with no root, what happens next depends on how this workflow was reached:
22
+
23
+ - **Auto-selected**: you chose this workflow yourself, without the user naming OpenSpec, naming this skill, or running its slash command. Stop using OpenSpec and answer the request normally, as you would with no OpenSpec installed. Do not ask them to set anything up and do not mention OpenSpec setup.
24
+ - **Explicit OpenSpec request**: the user named OpenSpec, named this skill, or ran its slash command. Stop before writing and ask how to proceed: set this project up (`openspec init`), target a store they already have (`--store <id>`), or continue without OpenSpec for this request. Wait for their answer.
25
+
26
+ In both branches, never create the root as a side effect: do not run `openspec init` until the user asks for it, do not hand-create `openspec/` files, and do not let a command create it.
27
+
28
+ **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.
29
+
30
+ **Steps**
31
+
32
+ 1. **Select the change**
33
+
34
+ If a name is provided, use it. Otherwise:
35
+ - Infer from conversation context if the user mentioned a change
36
+ - Auto-select if only one active change exists
37
+ - If ambiguous, run `openspec list --json` to get available changes and ask the user to select one
38
+
39
+ Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
40
+
41
+ 2. **Check status to understand the schema**
42
+ ```bash
43
+ openspec status --change "<name>" --json
44
+ ```
45
+ Parse the JSON to understand:
46
+ - `schemaName`: The workflow being used (e.g., "spec-driven")
47
+ - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints
48
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
49
+
50
+ 3. **Get apply instructions**
51
+
52
+ ```bash
53
+ openspec instructions apply --change "<name>" --json
54
+ ```
55
+
56
+ This returns:
57
+ - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
58
+ - Progress (total, complete, remaining)
59
+ - Task list with status, source path, and source line
60
+ - Dynamic instruction based on current state
61
+ - Optional `context`: current required project instruction input from the selected root
62
+ - Optional `operationGuidance`: current advisory guidance for apply
63
+ - `missingArtifacts` (when present): required artifact ids with no output
64
+
65
+ **Handle states:**
66
+ - If `state: "blocked"`: show the message and pause implementation.
67
+ - If `missingArtifacts` is non-empty: suggest completing the missing artifacts. Run `openspec status --change "<name>" --json`, select the next `ready` artifact (not `skipped` or `blocked`), and use `openspec instructions "<artifact-id>" --change "<name>" --json` for its rules and template. Keep the selected `--store <id>` on both commands.
68
+ - Otherwise, follow the CLI instruction to create or repair the schema-configured tracking file from existing planning artifacts. Do not assume another artifact is ready or start implementation while blocked.
69
+ - If `state: "all_done"`: report that all tracked tasks are complete and suggest review or verification as appropriate before archiving
70
+ - Otherwise: proceed to implementation
71
+
72
+ Treat `context` as a required prompt-level input. Read and consider it, and
73
+ apply relevant project facts, conventions, and constraints while implementing.
74
+ Treat `operationGuidance` as optional additive advice. Read and consider every
75
+ entry, and follow entries that are applicable and compatible with the built-in
76
+ workflow.
77
+
78
+ Keep both fields separate from CLI-returned state, missing artifacts, tasks,
79
+ progress, `contextFiles`, and the built-in `instruction`. They are not
80
+ evidence of task completion, do not replace the built-in instruction, and do
81
+ not permit bypassing a blocked state. If context conflicts with the built-in
82
+ instruction, an explicit user choice, or a CLI-controlled value, report the
83
+ conflict and preserve the controlling value. If guidance is inapplicable or
84
+ conflicts with those controlling inputs, do not follow it and explain why.
85
+ These are prompt-level behavior contracts, not enforceable checks.
86
+
87
+ 4. **Read context files**
88
+
89
+ Read every file path listed under `contextFiles` from the apply instructions output.
90
+ The files depend on the schema being used:
91
+ - **spec-driven**: proposal, specs, design, tasks
92
+ - Other schemas: follow the contextFiles from CLI output
93
+
94
+ Do not copy `context` or `operationGuidance` verbatim into implementation
95
+ files or planning artifacts unless the user separately asks for that content.
96
+
97
+ 5. **Show current progress**
98
+
99
+ Display:
100
+ - Schema being used
101
+ - Progress: "N/M tasks complete"
102
+ - Remaining tasks overview
103
+ - Dynamic instruction from CLI
104
+
105
+ 6. **Implement tasks (loop until done or blocked)**
106
+
107
+ For each pending task:
108
+ - Show which task is being worked on
109
+ - Make the code changes required
110
+ - Keep changes minimal and focused
111
+ - Before editing, confirm the checkbox at the returned `sourcePath` and `line` still matches the task description; if it does not, rerun the apply instructions and use the refreshed location
112
+ - Mark the task complete at its returned `sourcePath` and `line`: `- [ ]` → `- [x]`
113
+ - Rerun the apply instructions and confirm that task is now done and progress changed
114
+ - Continue to next task
115
+
116
+ **Pause if:**
117
+ - Task is unclear → ask for clarification
118
+ - Implementation reveals a design issue → suggest updating artifacts
119
+ - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently
120
+ - Error or blocker encountered → report and wait for guidance
121
+ - User interrupts
122
+
123
+ 7. **On completion or pause, show status**
124
+
125
+ Display:
126
+ - Tasks completed this session
127
+ - Overall progress: "N/M tasks complete"
128
+ - If all done: report that tracked tasks are complete and suggest review or verification as appropriate before archiving
129
+ - If paused: explain why and wait for guidance
130
+
131
+ **Output During Implementation**
132
+
133
+ ```
134
+ ## Implementing: <change-name> (schema: <schema-name>)
135
+
136
+ Working on task 3/7: <task description>
137
+ [...implementation happening...]
138
+ ✓ Task complete
139
+
140
+ Working on task 4/7: <task description>
141
+ [...implementation happening...]
142
+ ✓ Task complete
143
+ ```
144
+
145
+ **Output On Completion**
146
+
147
+ ```
148
+ ## Implementation Complete
149
+
150
+ **Change:** <change-name>
151
+ **Schema:** <schema-name>
152
+ **Progress:** 7/7 tasks complete ✓
153
+
154
+ ### Completed This Session
155
+ - [x] Task 1
156
+ - [x] Task 2
157
+ ...
158
+
159
+ All tracked tasks are complete. Review or verify the change as appropriate
160
+ before archiving. You can archive this change with `/opsx:archive`.
161
+ ```
162
+
163
+ **Output On Pause (Issue Encountered)**
164
+
165
+ ```
166
+ ## Implementation Paused
167
+
168
+ **Change:** <change-name>
169
+ **Schema:** <schema-name>
170
+ **Progress:** 4/7 tasks complete
171
+
172
+ ### Issue Encountered
173
+ <description of the issue>
174
+
175
+ **Options:**
176
+ 1. <option 1>
177
+ 2. <option 2>
178
+ 3. Other approach
179
+
180
+ What would you like to do?
181
+ ```
182
+
183
+ **Guardrails**
184
+ - Keep going through tasks until done or blocked
185
+ - Always read context files before starting (from the apply instructions output)
186
+ - If task is ambiguous, pause and ask before implementing
187
+ - If implementation reveals issues, pause and suggest artifact updates
188
+ - Keep code changes minimal and scoped to each task
189
+ - Update task checkbox immediately after completing each task
190
+ - Pause on errors, blockers, or unclear requirements - don't guess
191
+ - When a task needs work beyond what the spec describes, surface the added scope and pause - never silently narrow, defer, or simplify away specified behavior
192
+ - Only mark a task `- [x]` when its specified behavior is fully implemented, not when it is partially done or deferred
193
+ - Use contextFiles from CLI output, don't assume specific file names
194
+ - Use each task's sourcePath and line to update its exact checkbox
195
+ - Do not use context or operation guidance as proof that a task is complete
196
+ - Apply relevant project context; report conflicts with controlling workflow inputs
197
+ - Consider every guidance entry; explain any inapplicable or conflicting advice
198
+ - Do not copy runtime context or operation guidance into implementation files or planning artifacts
199
+ - Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
200
+
201
+ **Fluid Workflow Integration**
202
+
203
+ This skill supports the "actions on a change" model:
204
+
205
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
206
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly