@synth-coder/memhub 0.2.4 → 0.2.5
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/.eslintrc.cjs +45 -45
- package/.factory/commands/opsx-apply.md +150 -150
- package/.factory/commands/opsx-archive.md +155 -155
- package/.factory/commands/opsx-explore.md +171 -171
- package/.factory/commands/opsx-propose.md +104 -104
- package/.factory/skills/openspec-apply-change/SKILL.md +156 -156
- package/.factory/skills/openspec-archive-change/SKILL.md +114 -114
- package/.factory/skills/openspec-explore/SKILL.md +288 -288
- package/.factory/skills/openspec-propose/SKILL.md +110 -110
- package/.github/workflows/ci.yml +110 -110
- package/.github/workflows/release.yml +3 -0
- package/.iflow/commands/opsx-apply.md +152 -152
- package/.iflow/commands/opsx-archive.md +157 -157
- package/.iflow/commands/opsx-explore.md +173 -173
- package/.iflow/commands/opsx-propose.md +106 -106
- package/.iflow/skills/openspec-apply-change/SKILL.md +156 -156
- package/.iflow/skills/openspec-archive-change/SKILL.md +114 -114
- package/.iflow/skills/openspec-explore/SKILL.md +288 -288
- package/.iflow/skills/openspec-propose/SKILL.md +110 -110
- package/.prettierrc +11 -11
- package/AGENTS.md +167 -167
- package/README.md +17 -9
- package/README.zh-CN.md +246 -238
- package/dist/src/cli/agents/index.d.ts +0 -1
- package/dist/src/cli/agents/index.d.ts.map +1 -1
- package/dist/src/cli/agents/index.js +0 -3
- package/dist/src/cli/agents/index.js.map +1 -1
- package/dist/src/cli/index.js +0 -0
- package/dist/src/cli/init.d.ts.map +1 -1
- package/dist/src/cli/init.js +4 -24
- package/dist/src/cli/init.js.map +1 -1
- package/dist/src/cli/types.d.ts +2 -2
- package/dist/src/cli/types.d.ts.map +1 -1
- package/dist/src/cli/types.js +0 -11
- package/dist/src/cli/types.js.map +1 -1
- package/docs/user-guide.md +8 -6
- package/package.json +16 -16
- package/src/cli/agents/claude-code.ts +1 -1
- package/src/cli/agents/cline.ts +1 -1
- package/src/cli/agents/codex.ts +2 -2
- package/src/cli/agents/cursor.ts +1 -1
- package/src/cli/agents/factory-droid.ts +1 -1
- package/src/cli/agents/gemini-cli.ts +1 -1
- package/src/cli/agents/windsurf.ts +1 -1
- package/src/cli/init.ts +14 -14
- package/test/cli/init.test.ts +23 -1
- package/tsconfig.json +25 -25
- package/tsconfig.test.json +8 -8
- package/vitest.config.ts +29 -29
- package/dist/src/cli/agents/codex.d.ts +0 -5
- package/dist/src/cli/agents/codex.d.ts.map +0 -1
- package/dist/src/cli/agents/codex.js +0 -14
- package/dist/src/cli/agents/codex.js.map +0 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Propose a new change - create it and generate all artifacts in one step
|
|
3
|
-
argument-hint: command arguments
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Propose a new change - create the change and generate all artifacts in one step.
|
|
7
|
-
|
|
8
|
-
I'll create a change with artifacts:
|
|
9
|
-
- proposal.md (what & why)
|
|
10
|
-
- design.md (how)
|
|
11
|
-
- tasks.md (implementation steps)
|
|
12
|
-
|
|
13
|
-
When ready to implement, run /opsx:apply
|
|
14
|
-
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
18
|
-
|
|
19
|
-
**Steps**
|
|
20
|
-
|
|
21
|
-
1. **If no input provided, ask what they want to build**
|
|
22
|
-
|
|
23
|
-
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
24
|
-
> "What change do you want to work on? Describe what you want to build or fix."
|
|
25
|
-
|
|
26
|
-
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
|
27
|
-
|
|
28
|
-
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
29
|
-
|
|
30
|
-
2. **Create the change directory**
|
|
31
|
-
```bash
|
|
32
|
-
openspec new change "<name>"
|
|
33
|
-
```
|
|
34
|
-
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
|
35
|
-
|
|
36
|
-
3. **Get the artifact build order**
|
|
37
|
-
```bash
|
|
38
|
-
openspec status --change "<name>" --json
|
|
39
|
-
```
|
|
40
|
-
Parse the JSON to get:
|
|
41
|
-
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
|
42
|
-
- `artifacts`: list of all artifacts with their status and dependencies
|
|
43
|
-
|
|
44
|
-
4. **Create artifacts in sequence until apply-ready**
|
|
45
|
-
|
|
46
|
-
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
47
|
-
|
|
48
|
-
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
|
49
|
-
|
|
50
|
-
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
|
51
|
-
- Get instructions:
|
|
52
|
-
```bash
|
|
53
|
-
openspec instructions <artifact-id> --change "<name>" --json
|
|
54
|
-
```
|
|
55
|
-
- The instructions JSON includes:
|
|
56
|
-
- `context`: Project background (constraints for you - do NOT include in output)
|
|
57
|
-
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
58
|
-
- `template`: The structure to use for your output file
|
|
59
|
-
- `instruction`: Schema-specific guidance for this artifact type
|
|
60
|
-
- `outputPath`: Where to write the artifact
|
|
61
|
-
- `dependencies`: Completed artifacts to read for context
|
|
62
|
-
- Read any completed dependency files for context
|
|
63
|
-
- Create the artifact file using `template` as the structure
|
|
64
|
-
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
|
65
|
-
- Show brief progress: "Created <artifact-id>"
|
|
66
|
-
|
|
67
|
-
b. **Continue until all `applyRequires` artifacts are complete**
|
|
68
|
-
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
|
69
|
-
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
|
70
|
-
- Stop when all `applyRequires` artifacts are done
|
|
71
|
-
|
|
72
|
-
c. **If an artifact requires user input** (unclear context):
|
|
73
|
-
- Use **AskUserQuestion tool** to clarify
|
|
74
|
-
- Then continue with creation
|
|
75
|
-
|
|
76
|
-
5. **Show final status**
|
|
77
|
-
```bash
|
|
78
|
-
openspec status --change "<name>"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Output**
|
|
82
|
-
|
|
83
|
-
After completing all artifacts, summarize:
|
|
84
|
-
- Change name and location
|
|
85
|
-
- List of artifacts created with brief descriptions
|
|
86
|
-
- What's ready: "All artifacts created! Ready for implementation."
|
|
87
|
-
- Prompt: "Run `/opsx:apply` to start implementing."
|
|
88
|
-
|
|
89
|
-
**Artifact Creation Guidelines**
|
|
90
|
-
|
|
91
|
-
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
|
92
|
-
- The schema defines what each artifact should contain - follow it
|
|
93
|
-
- Read dependency artifacts for context before creating new ones
|
|
94
|
-
- Use `template` as the structure for your output file - fill in its sections
|
|
95
|
-
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
96
|
-
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
97
|
-
- These guide what you write, but should never appear in the output
|
|
98
|
-
|
|
99
|
-
**Guardrails**
|
|
100
|
-
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
|
101
|
-
- Always read dependency artifacts before creating a new one
|
|
102
|
-
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
|
103
|
-
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
104
|
-
- Verify each artifact file exists after writing before proceeding to next
|
|
1
|
+
---
|
|
2
|
+
description: Propose a new change - create it and generate all artifacts in one step
|
|
3
|
+
argument-hint: command arguments
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Propose a new change - create the change and generate all artifacts in one step.
|
|
7
|
+
|
|
8
|
+
I'll create a change with artifacts:
|
|
9
|
+
- proposal.md (what & why)
|
|
10
|
+
- design.md (how)
|
|
11
|
+
- tasks.md (implementation steps)
|
|
12
|
+
|
|
13
|
+
When ready to implement, run /opsx:apply
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Input**: The argument after `/opsx:propose` is the change name (kebab-case), OR a description of what the user wants to build.
|
|
18
|
+
|
|
19
|
+
**Steps**
|
|
20
|
+
|
|
21
|
+
1. **If no input provided, ask what they want to build**
|
|
22
|
+
|
|
23
|
+
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
24
|
+
> "What change do you want to work on? Describe what you want to build or fix."
|
|
25
|
+
|
|
26
|
+
From their description, derive a kebab-case name (e.g., "add user authentication" → `add-user-auth`).
|
|
27
|
+
|
|
28
|
+
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
29
|
+
|
|
30
|
+
2. **Create the change directory**
|
|
31
|
+
```bash
|
|
32
|
+
openspec new change "<name>"
|
|
33
|
+
```
|
|
34
|
+
This creates a scaffolded change at `openspec/changes/<name>/` with `.openspec.yaml`.
|
|
35
|
+
|
|
36
|
+
3. **Get the artifact build order**
|
|
37
|
+
```bash
|
|
38
|
+
openspec status --change "<name>" --json
|
|
39
|
+
```
|
|
40
|
+
Parse the JSON to get:
|
|
41
|
+
- `applyRequires`: array of artifact IDs needed before implementation (e.g., `["tasks"]`)
|
|
42
|
+
- `artifacts`: list of all artifacts with their status and dependencies
|
|
43
|
+
|
|
44
|
+
4. **Create artifacts in sequence until apply-ready**
|
|
45
|
+
|
|
46
|
+
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
47
|
+
|
|
48
|
+
Loop through artifacts in dependency order (artifacts with no pending dependencies first):
|
|
49
|
+
|
|
50
|
+
a. **For each artifact that is `ready` (dependencies satisfied)**:
|
|
51
|
+
- Get instructions:
|
|
52
|
+
```bash
|
|
53
|
+
openspec instructions <artifact-id> --change "<name>" --json
|
|
54
|
+
```
|
|
55
|
+
- The instructions JSON includes:
|
|
56
|
+
- `context`: Project background (constraints for you - do NOT include in output)
|
|
57
|
+
- `rules`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
58
|
+
- `template`: The structure to use for your output file
|
|
59
|
+
- `instruction`: Schema-specific guidance for this artifact type
|
|
60
|
+
- `outputPath`: Where to write the artifact
|
|
61
|
+
- `dependencies`: Completed artifacts to read for context
|
|
62
|
+
- Read any completed dependency files for context
|
|
63
|
+
- Create the artifact file using `template` as the structure
|
|
64
|
+
- Apply `context` and `rules` as constraints - but do NOT copy them into the file
|
|
65
|
+
- Show brief progress: "Created <artifact-id>"
|
|
66
|
+
|
|
67
|
+
b. **Continue until all `applyRequires` artifacts are complete**
|
|
68
|
+
- After creating each artifact, re-run `openspec status --change "<name>" --json`
|
|
69
|
+
- Check if every artifact ID in `applyRequires` has `status: "done"` in the artifacts array
|
|
70
|
+
- Stop when all `applyRequires` artifacts are done
|
|
71
|
+
|
|
72
|
+
c. **If an artifact requires user input** (unclear context):
|
|
73
|
+
- Use **AskUserQuestion tool** to clarify
|
|
74
|
+
- Then continue with creation
|
|
75
|
+
|
|
76
|
+
5. **Show final status**
|
|
77
|
+
```bash
|
|
78
|
+
openspec status --change "<name>"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Output**
|
|
82
|
+
|
|
83
|
+
After completing all artifacts, summarize:
|
|
84
|
+
- Change name and location
|
|
85
|
+
- List of artifacts created with brief descriptions
|
|
86
|
+
- What's ready: "All artifacts created! Ready for implementation."
|
|
87
|
+
- Prompt: "Run `/opsx:apply` to start implementing."
|
|
88
|
+
|
|
89
|
+
**Artifact Creation Guidelines**
|
|
90
|
+
|
|
91
|
+
- Follow the `instruction` field from `openspec instructions` for each artifact type
|
|
92
|
+
- The schema defines what each artifact should contain - follow it
|
|
93
|
+
- Read dependency artifacts for context before creating new ones
|
|
94
|
+
- Use `template` as the structure for your output file - fill in its sections
|
|
95
|
+
- **IMPORTANT**: `context` and `rules` are constraints for YOU, not content for the file
|
|
96
|
+
- Do NOT copy `<context>`, `<rules>`, `<project_context>` blocks into the artifact
|
|
97
|
+
- These guide what you write, but should never appear in the output
|
|
98
|
+
|
|
99
|
+
**Guardrails**
|
|
100
|
+
- Create ALL artifacts needed for implementation (as defined by schema's `apply.requires`)
|
|
101
|
+
- Always read dependency artifacts before creating a new one
|
|
102
|
+
- If context is critically unclear, ask the user - but prefer making reasonable decisions to keep momentum
|
|
103
|
+
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
104
|
+
- Verify each artifact file exists after writing before proceeding to next
|
|
@@ -1,156 +1,156 @@
|
|
|
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.
|
|
4
|
-
license: MIT
|
|
5
|
-
compatibility: Requires openspec CLI.
|
|
6
|
-
metadata:
|
|
7
|
-
author: openspec
|
|
8
|
-
version: "1.0"
|
|
9
|
-
generatedBy: "1.2.0"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
Implement tasks from an OpenSpec change.
|
|
13
|
-
|
|
14
|
-
**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.
|
|
15
|
-
|
|
16
|
-
**Steps**
|
|
17
|
-
|
|
18
|
-
1. **Select the change**
|
|
19
|
-
|
|
20
|
-
If a name is provided, use it. Otherwise:
|
|
21
|
-
- Infer from conversation context if the user mentioned a change
|
|
22
|
-
- Auto-select if only one active change exists
|
|
23
|
-
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
24
|
-
|
|
25
|
-
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
|
26
|
-
|
|
27
|
-
2. **Check status to understand the schema**
|
|
28
|
-
```bash
|
|
29
|
-
openspec status --change "<name>" --json
|
|
30
|
-
```
|
|
31
|
-
Parse the JSON to understand:
|
|
32
|
-
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
33
|
-
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
34
|
-
|
|
35
|
-
3. **Get apply instructions**
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
openspec instructions apply --change "<name>" --json
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
This returns:
|
|
42
|
-
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
|
43
|
-
- Progress (total, complete, remaining)
|
|
44
|
-
- Task list with status
|
|
45
|
-
- Dynamic instruction based on current state
|
|
46
|
-
|
|
47
|
-
**Handle states:**
|
|
48
|
-
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
|
49
|
-
- If `state: "all_done"`: congratulate, suggest archive
|
|
50
|
-
- Otherwise: proceed to implementation
|
|
51
|
-
|
|
52
|
-
4. **Read context files**
|
|
53
|
-
|
|
54
|
-
Read the files listed in `contextFiles` from the apply instructions output.
|
|
55
|
-
The files depend on the schema being used:
|
|
56
|
-
- **spec-driven**: proposal, specs, design, tasks
|
|
57
|
-
- Other schemas: follow the contextFiles from CLI output
|
|
58
|
-
|
|
59
|
-
5. **Show current progress**
|
|
60
|
-
|
|
61
|
-
Display:
|
|
62
|
-
- Schema being used
|
|
63
|
-
- Progress: "N/M tasks complete"
|
|
64
|
-
- Remaining tasks overview
|
|
65
|
-
- Dynamic instruction from CLI
|
|
66
|
-
|
|
67
|
-
6. **Implement tasks (loop until done or blocked)**
|
|
68
|
-
|
|
69
|
-
For each pending task:
|
|
70
|
-
- Show which task is being worked on
|
|
71
|
-
- Make the code changes required
|
|
72
|
-
- Keep changes minimal and focused
|
|
73
|
-
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
74
|
-
- Continue to next task
|
|
75
|
-
|
|
76
|
-
**Pause if:**
|
|
77
|
-
- Task is unclear → ask for clarification
|
|
78
|
-
- Implementation reveals a design issue → suggest updating artifacts
|
|
79
|
-
- Error or blocker encountered → report and wait for guidance
|
|
80
|
-
- User interrupts
|
|
81
|
-
|
|
82
|
-
7. **On completion or pause, show status**
|
|
83
|
-
|
|
84
|
-
Display:
|
|
85
|
-
- Tasks completed this session
|
|
86
|
-
- Overall progress: "N/M tasks complete"
|
|
87
|
-
- If all done: suggest archive
|
|
88
|
-
- If paused: explain why and wait for guidance
|
|
89
|
-
|
|
90
|
-
**Output During Implementation**
|
|
91
|
-
|
|
92
|
-
```
|
|
93
|
-
## Implementing: <change-name> (schema: <schema-name>)
|
|
94
|
-
|
|
95
|
-
Working on task 3/7: <task description>
|
|
96
|
-
[...implementation happening...]
|
|
97
|
-
✓ Task complete
|
|
98
|
-
|
|
99
|
-
Working on task 4/7: <task description>
|
|
100
|
-
[...implementation happening...]
|
|
101
|
-
✓ Task complete
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Output On Completion**
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
## Implementation Complete
|
|
108
|
-
|
|
109
|
-
**Change:** <change-name>
|
|
110
|
-
**Schema:** <schema-name>
|
|
111
|
-
**Progress:** 7/7 tasks complete ✓
|
|
112
|
-
|
|
113
|
-
### Completed This Session
|
|
114
|
-
- [x] Task 1
|
|
115
|
-
- [x] Task 2
|
|
116
|
-
...
|
|
117
|
-
|
|
118
|
-
All tasks complete! Ready to archive this change.
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
**Output On Pause (Issue Encountered)**
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
## Implementation Paused
|
|
125
|
-
|
|
126
|
-
**Change:** <change-name>
|
|
127
|
-
**Schema:** <schema-name>
|
|
128
|
-
**Progress:** 4/7 tasks complete
|
|
129
|
-
|
|
130
|
-
### Issue Encountered
|
|
131
|
-
<description of the issue>
|
|
132
|
-
|
|
133
|
-
**Options:**
|
|
134
|
-
1. <option 1>
|
|
135
|
-
2. <option 2>
|
|
136
|
-
3. Other approach
|
|
137
|
-
|
|
138
|
-
What would you like to do?
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Guardrails**
|
|
142
|
-
- Keep going through tasks until done or blocked
|
|
143
|
-
- Always read context files before starting (from the apply instructions output)
|
|
144
|
-
- If task is ambiguous, pause and ask before implementing
|
|
145
|
-
- If implementation reveals issues, pause and suggest artifact updates
|
|
146
|
-
- Keep code changes minimal and scoped to each task
|
|
147
|
-
- Update task checkbox immediately after completing each task
|
|
148
|
-
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
149
|
-
- Use contextFiles from CLI output, don't assume specific file names
|
|
150
|
-
|
|
151
|
-
**Fluid Workflow Integration**
|
|
152
|
-
|
|
153
|
-
This skill supports the "actions on a change" model:
|
|
154
|
-
|
|
155
|
-
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
156
|
-
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|
|
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.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires openspec CLI.
|
|
6
|
+
metadata:
|
|
7
|
+
author: openspec
|
|
8
|
+
version: "1.0"
|
|
9
|
+
generatedBy: "1.2.0"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Implement tasks from an OpenSpec change.
|
|
13
|
+
|
|
14
|
+
**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.
|
|
15
|
+
|
|
16
|
+
**Steps**
|
|
17
|
+
|
|
18
|
+
1. **Select the change**
|
|
19
|
+
|
|
20
|
+
If a name is provided, use it. Otherwise:
|
|
21
|
+
- Infer from conversation context if the user mentioned a change
|
|
22
|
+
- Auto-select if only one active change exists
|
|
23
|
+
- If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select
|
|
24
|
+
|
|
25
|
+
Always announce: "Using change: <name>" and how to override (e.g., `/opsx:apply <other>`).
|
|
26
|
+
|
|
27
|
+
2. **Check status to understand the schema**
|
|
28
|
+
```bash
|
|
29
|
+
openspec status --change "<name>" --json
|
|
30
|
+
```
|
|
31
|
+
Parse the JSON to understand:
|
|
32
|
+
- `schemaName`: The workflow being used (e.g., "spec-driven")
|
|
33
|
+
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
34
|
+
|
|
35
|
+
3. **Get apply instructions**
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
openspec instructions apply --change "<name>" --json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This returns:
|
|
42
|
+
- Context file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
|
|
43
|
+
- Progress (total, complete, remaining)
|
|
44
|
+
- Task list with status
|
|
45
|
+
- Dynamic instruction based on current state
|
|
46
|
+
|
|
47
|
+
**Handle states:**
|
|
48
|
+
- If `state: "blocked"` (missing artifacts): show message, suggest using openspec-continue-change
|
|
49
|
+
- If `state: "all_done"`: congratulate, suggest archive
|
|
50
|
+
- Otherwise: proceed to implementation
|
|
51
|
+
|
|
52
|
+
4. **Read context files**
|
|
53
|
+
|
|
54
|
+
Read the files listed in `contextFiles` from the apply instructions output.
|
|
55
|
+
The files depend on the schema being used:
|
|
56
|
+
- **spec-driven**: proposal, specs, design, tasks
|
|
57
|
+
- Other schemas: follow the contextFiles from CLI output
|
|
58
|
+
|
|
59
|
+
5. **Show current progress**
|
|
60
|
+
|
|
61
|
+
Display:
|
|
62
|
+
- Schema being used
|
|
63
|
+
- Progress: "N/M tasks complete"
|
|
64
|
+
- Remaining tasks overview
|
|
65
|
+
- Dynamic instruction from CLI
|
|
66
|
+
|
|
67
|
+
6. **Implement tasks (loop until done or blocked)**
|
|
68
|
+
|
|
69
|
+
For each pending task:
|
|
70
|
+
- Show which task is being worked on
|
|
71
|
+
- Make the code changes required
|
|
72
|
+
- Keep changes minimal and focused
|
|
73
|
+
- Mark task complete in the tasks file: `- [ ]` → `- [x]`
|
|
74
|
+
- Continue to next task
|
|
75
|
+
|
|
76
|
+
**Pause if:**
|
|
77
|
+
- Task is unclear → ask for clarification
|
|
78
|
+
- Implementation reveals a design issue → suggest updating artifacts
|
|
79
|
+
- Error or blocker encountered → report and wait for guidance
|
|
80
|
+
- User interrupts
|
|
81
|
+
|
|
82
|
+
7. **On completion or pause, show status**
|
|
83
|
+
|
|
84
|
+
Display:
|
|
85
|
+
- Tasks completed this session
|
|
86
|
+
- Overall progress: "N/M tasks complete"
|
|
87
|
+
- If all done: suggest archive
|
|
88
|
+
- If paused: explain why and wait for guidance
|
|
89
|
+
|
|
90
|
+
**Output During Implementation**
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
## Implementing: <change-name> (schema: <schema-name>)
|
|
94
|
+
|
|
95
|
+
Working on task 3/7: <task description>
|
|
96
|
+
[...implementation happening...]
|
|
97
|
+
✓ Task complete
|
|
98
|
+
|
|
99
|
+
Working on task 4/7: <task description>
|
|
100
|
+
[...implementation happening...]
|
|
101
|
+
✓ Task complete
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Output On Completion**
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
## Implementation Complete
|
|
108
|
+
|
|
109
|
+
**Change:** <change-name>
|
|
110
|
+
**Schema:** <schema-name>
|
|
111
|
+
**Progress:** 7/7 tasks complete ✓
|
|
112
|
+
|
|
113
|
+
### Completed This Session
|
|
114
|
+
- [x] Task 1
|
|
115
|
+
- [x] Task 2
|
|
116
|
+
...
|
|
117
|
+
|
|
118
|
+
All tasks complete! Ready to archive this change.
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Output On Pause (Issue Encountered)**
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
## Implementation Paused
|
|
125
|
+
|
|
126
|
+
**Change:** <change-name>
|
|
127
|
+
**Schema:** <schema-name>
|
|
128
|
+
**Progress:** 4/7 tasks complete
|
|
129
|
+
|
|
130
|
+
### Issue Encountered
|
|
131
|
+
<description of the issue>
|
|
132
|
+
|
|
133
|
+
**Options:**
|
|
134
|
+
1. <option 1>
|
|
135
|
+
2. <option 2>
|
|
136
|
+
3. Other approach
|
|
137
|
+
|
|
138
|
+
What would you like to do?
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Guardrails**
|
|
142
|
+
- Keep going through tasks until done or blocked
|
|
143
|
+
- Always read context files before starting (from the apply instructions output)
|
|
144
|
+
- If task is ambiguous, pause and ask before implementing
|
|
145
|
+
- If implementation reveals issues, pause and suggest artifact updates
|
|
146
|
+
- Keep code changes minimal and scoped to each task
|
|
147
|
+
- Update task checkbox immediately after completing each task
|
|
148
|
+
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
149
|
+
- Use contextFiles from CLI output, don't assume specific file names
|
|
150
|
+
|
|
151
|
+
**Fluid Workflow Integration**
|
|
152
|
+
|
|
153
|
+
This skill supports the "actions on a change" model:
|
|
154
|
+
|
|
155
|
+
- **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
|
|
156
|
+
- **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly
|