@kafka0102/onespec 0.1.2 → 0.1.14
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 +45 -48
- package/assets/skills/onespec/SKILL.md +21 -13
- package/assets/skills/onespec/references/archive.md +191 -0
- package/assets/skills/{onespec-design/SKILL.md → onespec/references/design.md} +44 -42
- package/assets/skills/{onespec-execute/SKILL.md → onespec/references/execute.md} +81 -31
- package/assets/skills/onespec/references/fast.md +110 -0
- package/assets/skills/onespec/scripts/onespec-closeout.sh +238 -77
- package/assets/skills/onespec/scripts/onespec-commit.sh +191 -11
- package/assets/skills/onespec/scripts/onespec-handoff.sh +19 -6
- package/assets/skills/onespec/scripts/onespec-state.sh +157 -18
- package/assets/skills/onespec-fast/SKILL.md +22 -0
- package/assets/skills/onespec-fast/agents/openai.yaml +4 -0
- package/assets/skills-en/onespec/SKILL.md +21 -12
- package/assets/skills-en/onespec/references/archive.md +190 -0
- package/assets/skills-en/{onespec-design/SKILL.md → onespec/references/design.md} +44 -42
- package/assets/skills-en/{onespec-execute/SKILL.md → onespec/references/execute.md} +81 -31
- package/assets/skills-en/onespec/references/fast.md +110 -0
- package/assets/skills-en/onespec-fast/SKILL.md +22 -0
- package/package.json +6 -2
- package/scripts/postinstall.js +3 -3
- package/src/cli.js +104 -87
- package/src/doctor.js +46 -20
- package/src/init.js +24 -10
- package/src/platforms.js +88 -8
- package/src/setup.js +211 -0
- package/assets/skills/onespec-archive/SKILL.md +0 -202
- package/assets/skills-en/onespec-archive/SKILL.md +0 -199
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: onespec
|
|
3
|
-
description: Use when the user wants to manage the full AI coding change lifecycle with OpenSpec and Superpowers, or is unsure whether they should be in design, execution, or
|
|
3
|
+
description: Use when the user wants to manage the full AI coding change lifecycle with OpenSpec and Superpowers, or is unsure whether they should be in design, execution, archive, or the fast path.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OneSpec Workflow
|
|
7
7
|
|
|
8
|
-
OneSpec is a
|
|
8
|
+
OneSpec is a single-entry workflow skill. Restore state, determine the current phase, then read the matching module under `references/`; do not call deprecated phase child skills.
|
|
9
9
|
|
|
10
10
|
Announce at the start:
|
|
11
11
|
|
|
@@ -16,7 +16,7 @@ Announce at the start:
|
|
|
16
16
|
Always check state before relying on chat history:
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
19
|
+
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.claude "$HOME"/.cursor "$HOME"/.gemini "$HOME"/.copilot "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
20
20
|
. "$ONESPEC_ENV"
|
|
21
21
|
"$ONESPEC_BASH" "$ONESPEC_STATE" list
|
|
22
22
|
```
|
|
@@ -28,23 +28,32 @@ If a relevant change exists, run:
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
Runtime state lives in `openspec/changes/<change-id>/.onespec.yaml`. Handoff summary, hashes, and touched-file tracking all live there; keep it until archive, then delete it during archive cleanup.
|
|
31
|
-
Treat `recover` output as the execution contract, not as a hint. Read at least `phase`, `next_skill`, `next_gate`, and `allowed_actions` before deciding what to do next.
|
|
31
|
+
Treat `recover` output as the execution contract, not as a hint. Read at least `phase`, `next_skill`, `next_reference`, `next_gate`, and `allowed_actions` before deciding what to do next.
|
|
32
32
|
|
|
33
33
|
## Phase Routing
|
|
34
34
|
|
|
35
35
|
Classify the current request first:
|
|
36
36
|
|
|
37
|
-
- `propose`: define a new change, clarify scope, generate `proposal.md`, `design.md`, `tasks.md`, and spec deltas.
|
|
38
|
-
- `apply`: implement an approved change, continue an existing change, generate or resume a Superpowers plan, and sync OpenSpec state.
|
|
39
|
-
- `review-closeout`: user review, feedback handling, worktree deletion, or archive.
|
|
37
|
+
- `propose`: define a new change, clarify scope, generate `proposal.md`, `design.md`, `tasks.md`, and spec deltas. Read `references/design.md`.
|
|
38
|
+
- `apply`: implement an approved change, continue an existing change, generate or resume a Superpowers plan, and sync OpenSpec state. Read `references/execute.md`.
|
|
39
|
+
- `review-closeout`: user review, feedback handling, worktree deletion, or archive. Read `references/archive.md`.
|
|
40
|
+
- `fast`: the user explicitly asks for `onespec-fast`, the fast path, fast apply, automatic OpenSpec end-to-end execution, or automatic proposal/implementation/archive. Read `references/fast.md`; the standalone `onespec-fast` entrypoint also routes to this same reference.
|
|
40
41
|
|
|
41
42
|
If intent is unclear, ask one short question only.
|
|
42
43
|
|
|
43
44
|
Default intent mapping:
|
|
44
45
|
|
|
45
|
-
- Requests like "new requirement", "design this", "write a proposal/spec", or "define a change"
|
|
46
|
-
- Requests like "start implementation", "execute this change", "apply this proposal/change", "continue this change", "start coding/development", or "make plan"
|
|
47
|
-
- Requests like "review", "close out", "archive", or "delete the worktree"
|
|
46
|
+
- Requests like "new requirement", "design this", "write a proposal/spec", or "define a change" read `references/design.md`.
|
|
47
|
+
- Requests like "start implementation", "execute this change", "apply this proposal/change", "continue this change", "start coding/development", or "make plan" read `references/execute.md`. If the proposal is not approved yet, stop and send the flow back to the approval gate in `references/design.md`.
|
|
48
|
+
- Requests like "review", "close out", "archive", or "delete the worktree" read `references/archive.md`.
|
|
49
|
+
- Requests like "onespec-fast", "fast path", "fast apply", "automatic OpenSpec end-to-end execution", or "automatic proposal/implementation/archive" read `references/fast.md`.
|
|
50
|
+
|
|
51
|
+
## Reference Loading
|
|
52
|
+
|
|
53
|
+
- Read only the one reference needed for the current phase; do not preload other phases.
|
|
54
|
+
- If `recover` returns `next_reference`, read it by default. Override it only when the user explicitly changes phase and the previous phase gate is already complete.
|
|
55
|
+
- `references/fast.md` may reuse procedure sections from `design.md`, `execute.md`, and `archive.md`, but the fast path overrides the normal proposal approval, review pause, and closeout-menu gates.
|
|
56
|
+
- For cross-phase checks, read only the smallest section directly required by the gate.
|
|
48
57
|
|
|
49
58
|
## Shared Constraints
|
|
50
59
|
|
|
@@ -53,5 +62,5 @@ Default intent mapping:
|
|
|
53
62
|
- Do not ask the user to name the change. Generate a short kebab-case `change-id` from the task and append a suffix if needed.
|
|
54
63
|
- Read the minimum necessary context: `openspec/config.yaml`, `openspec/project.md`, relevant `openspec/specs/**`, project entry docs, and current branch/worktree state.
|
|
55
64
|
- Only ask questions that can change the proposal, execution path, branch handling, or archive result.
|
|
56
|
-
- If shared and phase-specific rules conflict, the
|
|
57
|
-
-
|
|
65
|
+
- If shared and phase-specific rules conflict, the current phase reference wins.
|
|
66
|
+
- Each phase reference defines mandatory pause gates, such as the approval gate in `references/design.md` and the implementation-complete gate in `references/execute.md`. Before routing to the next phase, confirm the previous gate is complete; if it is not, refuse to continue and name the missing gate.
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Archive Phase
|
|
2
|
+
|
|
3
|
+
Read on demand from `onespec` during the `review-closeout` phase. The goal is to resolve the code fate of temporary worktrees and complete merge, discard, or archive actions according to the user's explicit closeout selection.
|
|
4
|
+
|
|
5
|
+
## 1. Review Entry
|
|
6
|
+
|
|
7
|
+
Recover state first:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.claude "$HOME"/.cursor "$HOME"/.gemini "$HOME"/.copilot "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
11
|
+
. "$ONESPEC_ENV"
|
|
12
|
+
"$ONESPEC_BASH" "$ONESPEC_STATE" list
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If a relevant change exists, you must continue with:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
"$ONESPEC_BASH" "$ONESPEC_STATE" recover <change-id>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Treat `recover` output as the current phase contract, not as reference information. Read at least `phase`, `next_skill`, `next_reference`, `next_gate`, and `allowed_actions` before deciding whether to continue closeout-phase work.
|
|
22
|
+
|
|
23
|
+
Read the minimum necessary context:
|
|
24
|
+
|
|
25
|
+
- `openspec/changes/<change-id>/proposal.md`
|
|
26
|
+
- `openspec/changes/<change-id>/tasks.md`
|
|
27
|
+
- `openspec/changes/<change-id>/design.md`, if present
|
|
28
|
+
- relevant `openspec/specs/**`
|
|
29
|
+
- latest test results and `openspec validate <change-id> --strict` result
|
|
30
|
+
- current branch, worktree, and workspace status
|
|
31
|
+
- `origin_branch`, `origin_workspace_path`, and `origin_workspace_mode`
|
|
32
|
+
|
|
33
|
+
If state has not reached `review`, explain what is still missing: implementation, verification, `tasks.md` sync, or proposal approval.
|
|
34
|
+
|
|
35
|
+
Entry validation: if phase is already `review` but `.onespec.yaml` does not show `handoff_purpose: review` or does not have a `handoff_hash`, treat that as an incomplete execute gate. Tell the user the review handoff state was not written back and send them to re-run the execute report instead of silently continuing.
|
|
36
|
+
|
|
37
|
+
## 2. User Review
|
|
38
|
+
|
|
39
|
+
Let the user review the implementation. If they raise issues, continue editing and re-verify.
|
|
40
|
+
|
|
41
|
+
After implementation is done, do not require another explicit review-confirmation step and do not show a generic "continue review / preserve branch" menu. First decide what happens to the temporary worktree code. If the user replies with any non-numbered content, treat that as a request to keep modifying the implementation and return directly to code work.
|
|
42
|
+
|
|
43
|
+
Do not make the user guess what to type next. If the user enters archive phase without having made a closeout choice yet, provide a numbered menu.
|
|
44
|
+
|
|
45
|
+
If the user arrived from the execute phase completion report and already replied with a closeout number there, treat that earlier reply as the only required authorization. Do not show the same menu again and do not add an intermediate "should I handle merge/archive?" confirmation. At that point, only report the required state checks and execute the selected actions directly without splitting closeout into a second confirmation round.
|
|
46
|
+
|
|
47
|
+
Before offering closeout choices, explicitly tell the user:
|
|
48
|
+
|
|
49
|
+
- the current branch name
|
|
50
|
+
- the current workspace path
|
|
51
|
+
- the recorded `origin_branch` and `origin_workspace_path`
|
|
52
|
+
- whether the current review location still matches the original branch/workspace
|
|
53
|
+
|
|
54
|
+
If the current branch or workspace differs from the recorded `origin_*` fields, explicitly say that the implementation is now living in a temporary branch or temporary worktree. If the user switches to free-form text, treat it as a request for more code changes.
|
|
55
|
+
|
|
56
|
+
Supported closeout paths are limited to these three outcomes:
|
|
57
|
+
|
|
58
|
+
- Archive the current change, then merge the branch into the base branch
|
|
59
|
+
- Archive only, without merging
|
|
60
|
+
- Delete the current temporary worktree and discard the code
|
|
61
|
+
|
|
62
|
+
Merge, discard, deletion, and archive are consequential actions, but once the user has explicitly selected them in the numbered menu, execute them directly without another confirmation round.
|
|
63
|
+
|
|
64
|
+
## 2.1 Superpowers Worktree Priority
|
|
65
|
+
|
|
66
|
+
If `origin_workspace_mode=worktree`, or the current path is a temporary implementation worktree created during execution, make the "return to the original branch/workspace" consequence explicit before any destructive action.
|
|
67
|
+
|
|
68
|
+
The agent must tell the user:
|
|
69
|
+
|
|
70
|
+
- implementation currently lives in a temporary worktree
|
|
71
|
+
- the original branch is `origin_branch`
|
|
72
|
+
- the original workspace is `origin_workspace_path`
|
|
73
|
+
- whether local temporary branch/worktree cleanup will happen after closeout
|
|
74
|
+
|
|
75
|
+
Default recommended order:
|
|
76
|
+
|
|
77
|
+
1. finish review inside the temporary worktree
|
|
78
|
+
2. if no more implementation work is needed, archive first, then merge the temporary worktree into the base branch and delete the temporary worktree
|
|
79
|
+
3. if the user only wants to preserve the archive record without merging code, allow archive-only
|
|
80
|
+
4. if the user wants to discard the code, delete the worktree and drop the local temporary branch
|
|
81
|
+
|
|
82
|
+
## 2.2 Worktree Closeout Rules
|
|
83
|
+
|
|
84
|
+
If the current workspace is a temporary worktree, show this menu:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
1. Archive the current change, then merge the branch into the base branch
|
|
88
|
+
2. Archive only, without merging
|
|
89
|
+
3. Delete the current temporary worktree and discard the code
|
|
90
|
+
Other: any non-numbered content means continue modifying the current implementation; if the user gives no input, remain paused in the current review stage
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Menu interpretation:
|
|
94
|
+
|
|
95
|
+
- reply `1`: run `archive-then-merge-worktree`; archive first, then merge into the base branch, then delete the temporary worktree and the merged local temporary branch.
|
|
96
|
+
- reply `2`: run `archive-only`; archive immediately, do not merge into the base branch, and do not auto-delete the current worktree.
|
|
97
|
+
- reply `3`: run `discard-worktree`; delete the temporary worktree and delete the matching local branch. Do not archive discarded code.
|
|
98
|
+
- any non-numbered content means continue modifying the current implementation; ask only one short clarification if the intent is unclear.
|
|
99
|
+
|
|
100
|
+
If the current workspace is not a temporary worktree and the code is already truly on the target branch, `archive-only` is allowed.
|
|
101
|
+
|
|
102
|
+
If the current checkout is not a temporary worktree, the current branch already equals `origin_branch`, and that branch is `main` or `master`, do not show the "archive then merge" or "delete the current temporary worktree" options. In that case the closeout menu must contain only:
|
|
103
|
+
|
|
104
|
+
```text
|
|
105
|
+
1. Archive only, without merging
|
|
106
|
+
Other: any non-numbered content means continue modifying the current implementation; if the user gives no input, remain paused in the current review stage
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
In other words, on `master/main`, do not prompt for branch merge or worktree deletion.
|
|
110
|
+
|
|
111
|
+
If the user already selected a closeout number in the execute phase completion menu, do not repeat the same menu here; combine that reply with the actual workspace state and execute the matching action directly.
|
|
112
|
+
|
|
113
|
+
## 3. Archive Rules
|
|
114
|
+
|
|
115
|
+
Before merge, discard, delete, or archive is finalized, always check whether there is still uncommitted code related to the current change:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
"$ONESPEC_BASH" "$ONESPEC_COMMIT" related-dirty <change-id>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- if the result is empty, continue with closeout
|
|
122
|
+
- if the result is empty, unrelated untracked directories must not block closeout; for example, `.superpowers/` that is not recorded in the tracked-file list inside `.onespec.yaml` can be called out as "not included in this change" and then ignored for closeout purposes
|
|
123
|
+
- if the result is not empty, do not stop at "please commit first". The closeout scripts must auto-commit those files, and they must only commit files related to this change:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
"$ONESPEC_BASH" "$ONESPEC_COMMIT" commit-related <change-id> <closeout|archive|preserve-state>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- prefer the repository's own Git commit policy for commit-message format, scope, and language; detect project docs and config first:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
"$ONESPEC_BASH" "$ONESPEC_COMMIT" detect-policy <change-id>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
- if the project defines an explicit policy, follow it
|
|
136
|
+
- if the project does not define a policy, fall back to general Conventional Commits: `<type>(<scope>): <short summary>`
|
|
137
|
+
- only commit the intersection of the tracked-file list stored in `.onespec.yaml` and current dirty files; if `.onespec.yaml` itself is dirty, include it too; never include unrelated changes
|
|
138
|
+
- exception: temporary zip files, export bundles, or other change-local artifacts under `openspec/changes/<change-id>/` are also part of the current change; auto-commit should include them so archive preserves them in change history
|
|
139
|
+
- auto-commit only covers the local commits needed for closeout. Local merge/archive actions included in the numbered closeout selection are already authorized. Merge, rebase, or push actions outside that selection still require explicit user approval.
|
|
140
|
+
- recommended order:
|
|
141
|
+
1. auto-commit current-workspace dirty files related to the change before closeout continues
|
|
142
|
+
2. if archive creates new archive artifacts or removes `.onespec.yaml`, auto-commit the archive result after archive finishes
|
|
143
|
+
3. if the user chooses archive-then-merge, merge the implementation branch back into the base branch only after the archive commit is complete
|
|
144
|
+
- If the user selects `archive-then-merge-worktree`, archive first, then merge into the target branch, and set state to `archived`.
|
|
145
|
+
- If the user selects `archive-only`, run OpenSpec archive and set state to `archived`; do not auto-merge and do not auto-delete the current worktree.
|
|
146
|
+
- If the user discards the worktree, do not archive and do not merge discarded branch code into the base branch.
|
|
147
|
+
- Only after archive actually runs should the runtime state file be removed:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
"$ONESPEC_BASH" "$ONESPEC_CLOSEOUT" cleanup-runtime <change-id>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
For actual closeout execution, prefer:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
"$ONESPEC_BASH" "$ONESPEC_CLOSEOUT" run-actions <change-id> [archive-then-merge-worktree|archive-only|discard-worktree]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> phase done
|
|
161
|
+
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> archive <skipped|archived>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Before archiving, confirm:
|
|
165
|
+
|
|
166
|
+
- `tasks.md` is checked off to match reality
|
|
167
|
+
- project tests passed, or any failures are explicitly called out
|
|
168
|
+
- `openspec validate <change-id> --strict` passed
|
|
169
|
+
- the user explicitly chose archive-then-merge, archive-only, or discard-worktree
|
|
170
|
+
- no user-review feedback remains unresolved
|
|
171
|
+
|
|
172
|
+
## 4. Report
|
|
173
|
+
|
|
174
|
+
The closeout report must cover:
|
|
175
|
+
|
|
176
|
+
- user review result
|
|
177
|
+
- selected closeout path: archive then merge, archive only, or discard worktree
|
|
178
|
+
- final branch/worktree state
|
|
179
|
+
- how the current branch relates to `origin_branch`, and whether a temporary worktree is still kept locally
|
|
180
|
+
- status of `tasks.md`, tests, and OpenSpec validate
|
|
181
|
+
- archive field: `skipped` or `archived`
|
|
182
|
+
|
|
183
|
+
## 5. Stop Conditions
|
|
184
|
+
|
|
185
|
+
Pause and explain if:
|
|
186
|
+
|
|
187
|
+
- the user has not finished final review
|
|
188
|
+
- the user has not explicitly chosen a closeout path
|
|
189
|
+
- the user has not explicitly approved archive-then-merge, archive-only, or discard-worktree
|
|
190
|
+
- tests or `openspec validate <change-id> --strict` are failing and the user has not explicitly accepted the risk
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
name: onespec-design
|
|
3
|
-
description: Use when the user needs requirement clarification, proposal/design/tasks/spec deltas, complexity analysis, or approval-path selection for an OpenSpec change.
|
|
4
|
-
---
|
|
1
|
+
# Design Phase
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Handles the design and proposal phase for OneSpec. The goal is to turn a request into pre-approval OpenSpec artifacts and recommend the correct implementation path.
|
|
9
|
-
|
|
10
|
-
Announce at the start:
|
|
11
|
-
|
|
12
|
-
> I am using `onespec-design` for the proposal/design phase.
|
|
3
|
+
Read on demand from `onespec` during the `propose` phase. The goal is to turn a request into pre-approval OpenSpec artifacts and recommend the correct implementation path.
|
|
13
4
|
|
|
14
5
|
## 1. Intake
|
|
15
6
|
|
|
16
7
|
Recover state first:
|
|
17
8
|
|
|
18
9
|
```bash
|
|
19
|
-
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
10
|
+
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.claude "$HOME"/.cursor "$HOME"/.gemini "$HOME"/.copilot "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
20
11
|
. "$ONESPEC_ENV"
|
|
21
12
|
"$ONESPEC_BASH" "$ONESPEC_STATE" list
|
|
22
13
|
```
|
|
@@ -27,7 +18,7 @@ If a relevant change exists, you must continue with:
|
|
|
27
18
|
"$ONESPEC_BASH" "$ONESPEC_STATE" recover <change-id>
|
|
28
19
|
```
|
|
29
20
|
|
|
30
|
-
Treat `recover` output as the current phase contract, not as reference information. Read at least `phase`, `next_skill`, `next_gate`, and `allowed_actions` before deciding whether to continue design-phase work.
|
|
21
|
+
Treat `recover` output as the current phase contract, not as reference information. Read at least `phase`, `next_skill`, `next_reference`, `next_gate`, and `allowed_actions` before deciding whether to continue design-phase work.
|
|
31
22
|
|
|
32
23
|
Read the minimum necessary context:
|
|
33
24
|
|
|
@@ -141,7 +132,10 @@ Always state:
|
|
|
141
132
|
- change id and artifact locations
|
|
142
133
|
- a short summary of the task artifact
|
|
143
134
|
- complexity level and concrete reasons
|
|
144
|
-
- recommended
|
|
135
|
+
- the recommended combination, not only an abstract route:
|
|
136
|
+
- `OpenSpec apply + native + current branch`
|
|
137
|
+
- `Superpowers + subagent + new worktree`
|
|
138
|
+
- `Superpowers + subagent + current worktree/current branch`
|
|
145
139
|
- that the user may override the recommendation
|
|
146
140
|
|
|
147
141
|
## 4. Proposal Approval Gate and Path Selection
|
|
@@ -150,9 +144,17 @@ Default intent mapping, issue-workflow routing, or implementation recommendation
|
|
|
150
144
|
|
|
151
145
|
Implementation planning is only allowed after the user explicitly approves the proposal / design / spec. At the end of the design phase, do not fall back to a single free-form sentence, and do not require the user to type words like `approve`, `yes`, or `continue`. Present an "explicit options + recommendation + direct reply phrase" menu. The user may reply with digits or with the matching phrase. Silence, "looks okay", the original "start implementation", "execute this change", or "make plan" do not count as artifact approval.
|
|
152
146
|
|
|
153
|
-
|
|
147
|
+
Before rendering the approval menu, determine the recommended combination:
|
|
148
|
+
|
|
149
|
+
- If recommending `OpenSpec apply`, the combination is fixed as `OpenSpec apply + native + current branch`; record `implementation_path=openspec-apply`, `execution_method=native`, and `workspace=current-branch` (if the current branch is `main`/`master` and project docs forbid direct main-branch changes, pause and warn first).
|
|
150
|
+
- If recommending `Superpowers`, default the execution method to `subagent`; recommend `local` only when tasks are tightly coupled, unsuitable for per-task dispatch, or the user/platform clearly cannot use subagents.
|
|
151
|
+
- Detect whether the current checkout is already an attached git worktree: compare `git rev-parse --path-format=absolute --git-dir` with `git rev-parse --path-format=absolute --git-common-dir`; if they differ, the current checkout is an attached worktree. If that command is unavailable, fall back to `git worktree list --porcelain` and match the current `pwd -P` against `worktree` entries.
|
|
152
|
+
- If already inside an attached worktree, do not recommend creating another worktree; recommend `Superpowers + <subagent|local> + current worktree/current branch`, and record `workspace=current-branch` because execution happens in the current checkout.
|
|
153
|
+
- If not inside an attached worktree and recommending `Superpowers`, default to `Superpowers + subagent + new worktree` for implementation-branch isolation; record `workspace=worktree`.
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
Use this default approval menu, with the recommended combination baked into item 1. The menu must explain that the combination has three parts: implementation path + execution method + workspace policy.
|
|
156
|
+
|
|
157
|
+
1. approve the current proposal / design / spec and continue with the recommended combination: `<recommended-combination>` (Recommended)
|
|
156
158
|
Direct reply phrase: `approve and use the recommended path`
|
|
157
159
|
2. approve the current proposal / design / spec, but change the implementation path, execution method, or workspace
|
|
158
160
|
Direct reply phrase: `approve but change the implementation path`
|
|
@@ -164,41 +166,41 @@ Other: if the user's intent is not covered by the menu, allow free-form instruct
|
|
|
164
166
|
|
|
165
167
|
Menu handling rules:
|
|
166
168
|
|
|
167
|
-
- reply `1` or `approve and use the recommended path`: treat this as approval of the current artifacts and acceptance of the recommended
|
|
168
|
-
- reply `2` or `approve but change the implementation path`: treat this as approval of the current artifacts, but continue with
|
|
169
|
-
- reply `3` or `revise the proposal first`: stay in
|
|
169
|
+
- reply `1` or `approve and use the recommended path`: treat this as approval of the current artifacts and acceptance of the recommended combination; do not ask a second round for `subagent/local` or `worktree/current-branch`; directly record the combination's `implementation_path`, `execution_method`, and `workspace`
|
|
170
|
+
- reply `2` or `approve but change the implementation path`: treat this as approval of the current artifacts, but continue with a combination menu; do not split `subagent/local` and `worktree/current-branch` into two rounds
|
|
171
|
+
- reply `3` or `revise the proposal first`: stay in design phase, revise artifacts based on feedback, and do not enter implementation
|
|
170
172
|
- reply `4` or `stay in design for now`: pause at the design phase and wait for later instructions
|
|
171
173
|
- free-form text instead of digits: if intent is clear, follow it; otherwise ask one minimal clarification question
|
|
172
174
|
|
|
173
|
-
If the user
|
|
174
|
-
|
|
175
|
-
- execution method: `subagent` or `local`. Recommend `subagent` by default, which maps to `subagent-driven-development`; `local` maps to `executing-plans`.
|
|
176
|
-
- workspace: `worktree` or `current-branch`.
|
|
175
|
+
If the user picked item 2, keep using the same "explicit combination options + recommendation + direct reply phrase" format instead of only digits or only free-form words. Generate the menu based on whether the current checkout is already an attached worktree:
|
|
177
176
|
|
|
178
|
-
If
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Direct reply phrase: `use Superpowers`
|
|
183
|
-
|
|
177
|
+
- If not currently inside an attached worktree, use this default menu:
|
|
178
|
+
1. `Superpowers + subagent + new worktree` (Recommended)
|
|
179
|
+
Direct reply phrase: `use Superpowers subagent worktree`
|
|
180
|
+
2. `Superpowers + local + new worktree`
|
|
181
|
+
Direct reply phrase: `use Superpowers local worktree`
|
|
182
|
+
3. `Superpowers + local + current branch`
|
|
183
|
+
Direct reply phrase: `use Superpowers local current-branch`
|
|
184
|
+
4. `OpenSpec apply + native + current branch`
|
|
185
|
+
Direct reply phrase: `use OpenSpec apply`
|
|
186
|
+
Other: allow a special combination, for example an explicit `Superpowers + subagent + current branch`
|
|
187
|
+
- If already inside an attached worktree, use this default menu:
|
|
188
|
+
1. `Superpowers + subagent + current worktree/current branch` (Recommended)
|
|
189
|
+
Direct reply phrase: `use Superpowers subagent current worktree`
|
|
190
|
+
2. `Superpowers + local + current worktree/current branch`
|
|
191
|
+
Direct reply phrase: `use Superpowers local current worktree`
|
|
192
|
+
3. `OpenSpec apply + native + current worktree/current branch`
|
|
184
193
|
Direct reply phrase: `use OpenSpec apply`
|
|
185
|
-
|
|
186
|
-
1. `subagent` (Recommended)
|
|
187
|
-
Direct reply phrase: `use subagent`
|
|
188
|
-
2. `local`
|
|
189
|
-
Direct reply phrase: `use local`
|
|
190
|
-
- workspace:
|
|
191
|
-
1. `worktree` (Recommended)
|
|
192
|
-
Direct reply phrase: `use worktree`
|
|
193
|
-
2. `current-branch`
|
|
194
|
-
Direct reply phrase: `use current-branch`
|
|
195
|
-
Other: allow the user to describe a special workspace arrangement
|
|
194
|
+
Other: allow a special combination; do not recommend creating another worktree
|
|
196
195
|
|
|
197
196
|
`main`/`master` rules:
|
|
198
197
|
|
|
199
198
|
- Do not implement directly on `main`/`master` unless the user explicitly accepts the risk after being warned.
|
|
200
|
-
- If the current branch is `main`/`master` and the user chooses `Superpowers
|
|
199
|
+
- If the current branch is `main`/`master` and the user chooses `Superpowers + current branch`, warn first and record `main-override`; if the user chooses `new worktree`, follow the worktree creation rules.
|
|
201
200
|
- If already on a feature branch and the workspace is clean, `current-branch` is acceptable.
|
|
201
|
+
- If the plan is to switch into a `worktree` but the current workspace is dirty, handle those changes first before creating the worktree. In particular, do not create a temporary worktree while carrying uncommitted `main`/`master` changes.
|
|
202
|
+
- For uncommitted changes on `main`/`master`, require a local commit that follows the project's commit policy before creating the temporary branch/worktree. Do not implicitly carry dirty base-branch code into a new implementation branch.
|
|
203
|
+
- If the user refuses to commit the current dirty changes first, do not continue creating the worktree. Stop, switch to `current-branch`, or ask the user to clean up the branch state first.
|
|
202
204
|
|
|
203
205
|
After confirmation record:
|
|
204
206
|
|
|
@@ -213,7 +215,7 @@ After confirmation record:
|
|
|
213
215
|
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> phase approved
|
|
214
216
|
```
|
|
215
217
|
|
|
216
|
-
These `origin_*` fields represent the branch and workspace where the user originally started the change. If implementation later happens in a different branch or temporary worktree,
|
|
218
|
+
These `origin_*` fields represent the branch and workspace where the user originally started the change. If implementation later happens in a different branch or temporary worktree, execute phase and archive phase must use them when prompting for review and closeout.
|
|
217
219
|
|
|
218
220
|
## 5. Stop Conditions
|
|
219
221
|
|
|
@@ -1,22 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
name: onespec-execute
|
|
3
|
-
description: Use when the user needs to execute an approved OpenSpec change, continue implementation, generate a Superpowers plan, run OpenSpec apply, sync tasks, or verify the result.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# OneSpec Execute
|
|
7
|
-
|
|
8
|
-
Handles the execution phase for OneSpec. The goal is to implement only within approved scope and sync the outcome back into OpenSpec state.
|
|
1
|
+
# Execute Phase
|
|
9
2
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
> I am using `onespec-execute` for the apply / implementation phase.
|
|
3
|
+
Read on demand from `onespec` during the `apply` phase. The goal is to implement only within approved scope and sync the outcome back into OpenSpec state.
|
|
13
4
|
|
|
14
5
|
## 1. Apply Routing
|
|
15
6
|
|
|
16
7
|
Recover state first:
|
|
17
8
|
|
|
18
9
|
```bash
|
|
19
|
-
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
10
|
+
ONESPEC_ENV="${ONESPEC_ENV:-$(find . "$HOME"/.codex "$HOME"/.claude "$HOME"/.cursor "$HOME"/.gemini "$HOME"/.copilot "$HOME"/.agents "$HOME"/.config -path '*/onespec/scripts/onespec-env.sh' -type f -print -quit 2>/dev/null)}"
|
|
20
11
|
. "$ONESPEC_ENV"
|
|
21
12
|
"$ONESPEC_BASH" "$ONESPEC_STATE" list
|
|
22
13
|
```
|
|
@@ -27,7 +18,7 @@ If a relevant change exists, you must continue with:
|
|
|
27
18
|
"$ONESPEC_BASH" "$ONESPEC_STATE" recover <change-id>
|
|
28
19
|
```
|
|
29
20
|
|
|
30
|
-
Treat `recover` output as the current phase contract, not as reference information. Read at least `phase`, `next_skill`, `next_gate`, and `allowed_actions` before deciding whether to continue execution-phase work.
|
|
21
|
+
Treat `recover` output as the current phase contract, not as reference information. Read at least `phase`, `next_skill`, `next_reference`, `next_gate`, and `allowed_actions` before deciding whether to continue execution-phase work.
|
|
31
22
|
|
|
32
23
|
Before apply, read at least:
|
|
33
24
|
|
|
@@ -51,20 +42,36 @@ If the proposal phase already confirmed the implementation path:
|
|
|
51
42
|
- user chose native `OpenSpec apply`: switch to native apply.
|
|
52
43
|
- user still has not confirmed: restate the recommendation and require a numbered choice before implementation starts.
|
|
53
44
|
|
|
54
|
-
If execution-time route confirmation is still needed,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
If execution-time route confirmation is still needed, first detect whether the current checkout is already an attached git worktree, then use the matching numbered menu. The user may reply with digits.
|
|
46
|
+
|
|
47
|
+
When not currently inside an attached worktree:
|
|
48
|
+
1. continue with the recommended combination
|
|
49
|
+
2. switch to `Superpowers + subagent + new worktree`
|
|
50
|
+
3. switch to `Superpowers + local + new worktree`
|
|
51
|
+
4. switch to `Superpowers + local + current branch`
|
|
52
|
+
5. switch to native `OpenSpec apply + native + current branch`
|
|
53
|
+
6. do not start implementation yet; go back and revise proposal / design / tasks
|
|
54
|
+
|
|
55
|
+
When already inside an attached worktree:
|
|
56
|
+
1. continue with the recommended combination
|
|
57
|
+
2. switch to `Superpowers + subagent + current worktree/current branch`
|
|
58
|
+
3. switch to `Superpowers + local + current worktree/current branch`
|
|
59
|
+
4. switch to native `OpenSpec apply + native + current worktree/current branch`
|
|
60
|
+
5. do not start implementation yet; go back and revise proposal / design / tasks
|
|
60
61
|
Other: if intent is not covered by the menu, allow free-form instructions
|
|
61
62
|
|
|
62
63
|
Menu handling rules:
|
|
63
64
|
|
|
64
|
-
- reply `1`: use the current
|
|
65
|
-
-
|
|
66
|
-
- reply `3`:
|
|
67
|
-
- reply `4`:
|
|
65
|
+
- reply `1`: use the current recommended combination; do not ask a second round for `subagent/local` or `worktree/current-branch`
|
|
66
|
+
- when not currently inside an attached worktree, reply `2`: record `implementation_path=superpowers`, `execution_method=subagent`, and `workspace=worktree`
|
|
67
|
+
- when not currently inside an attached worktree, reply `3`: record `implementation_path=superpowers`, `execution_method=local`, and `workspace=worktree`
|
|
68
|
+
- when not currently inside an attached worktree, reply `4`: record `implementation_path=superpowers`, `execution_method=local`, and `workspace=current-branch`
|
|
69
|
+
- when not currently inside an attached worktree, reply `5`: record `implementation_path=openspec-apply`, `execution_method=native`, and `workspace=current-branch`
|
|
70
|
+
- when not currently inside an attached worktree, reply `6`: stop execution and return to design revision
|
|
71
|
+
- when already inside an attached worktree, reply `2`: record `implementation_path=superpowers`, `execution_method=subagent`, and `workspace=current-branch`
|
|
72
|
+
- when already inside an attached worktree, reply `3`: record `implementation_path=superpowers`, `execution_method=local`, and `workspace=current-branch`
|
|
73
|
+
- when already inside an attached worktree, reply `4`: record `implementation_path=openspec-apply`, `execution_method=native`, and `workspace=current-branch`
|
|
74
|
+
- when already inside an attached worktree, reply `5`: stop execution and return to design revision
|
|
68
75
|
- free-form text instead of digits: if intent is clear, follow it; otherwise ask one minimal clarification question
|
|
69
76
|
|
|
70
77
|
## 2. Superpowers Make Plan and Execution
|
|
@@ -113,6 +120,27 @@ If `origin_branch` or `origin_workspace_path` is still `unknown`, fill them in i
|
|
|
113
120
|
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> origin_workspace_mode "$( "$ONESPEC_BASH" "$ONESPEC_STATE" get <change-id> workspace )"
|
|
114
121
|
```
|
|
115
122
|
|
|
123
|
+
If the next step is to create a temporary worktree from the current branch, check for uncommitted changes first:
|
|
124
|
+
|
|
125
|
+
- if the current workspace is dirty, handle those changes before creating the worktree
|
|
126
|
+
- if the current branch is `main`/`master` and has uncommitted changes, require a local commit that follows the project commit policy before creating the worktree; do not carry dirty base-branch code straight into a new implementation branch
|
|
127
|
+
- if the user refuses to commit the current dirty changes first, do not continue creating the worktree; pause, or switch to `current-branch` with an explicit risk callout
|
|
128
|
+
|
|
129
|
+
### 2.1 Implementation Workspace Binding
|
|
130
|
+
|
|
131
|
+
After creating or selecting the implementation worktree, immediately bind the absolute implementation workspace path as `implementation_workspace_path`, and verify that it is the working directory for subsequent commands before writing the plan:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
implementation_workspace_path="$(pwd -P)"
|
|
135
|
+
git -C "$implementation_workspace_path" status --short
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
- If `workspace=worktree`, enter the new worktree first, then set `implementation_workspace_path`; do not keep generating the plan in the origin workspace.
|
|
139
|
+
- If `workspace=current-branch`, or if the current checkout is already an attached worktree, `implementation_workspace_path` is the current `pwd -P`.
|
|
140
|
+
- Every OpenSpec artifact read, Superpowers plan write, `.onespec.yaml` update, handoff generation, and implementation command must run with the implementation workspace as the working directory.
|
|
141
|
+
- The plan path `docs/superpowers/plans/YYYY-MM-DD-<change-id>.md` is always relative to `implementation_workspace_path`. Do not write the plan in the origin workspace and then copy it into the implementation worktree.
|
|
142
|
+
- Before recording the plan and handoff, run `git -C "$implementation_workspace_path" status --short` to confirm that the plan and `.onespec.yaml` are in the same implementation workspace.
|
|
143
|
+
|
|
116
144
|
Default execution path:
|
|
117
145
|
|
|
118
146
|
- prefer `subagent-driven-development`
|
|
@@ -156,7 +184,7 @@ Pause and explain if:
|
|
|
156
184
|
|
|
157
185
|
> This gate is mandatory. If it is not satisfied, do not output a completion summary, do not give closeout suggestions, and do not enter the next phase.
|
|
158
186
|
|
|
159
|
-
After implementation and verification, the flow must pause explicitly. Do not continue directly into merge, worktree deletion, archive, or any implicit closeout. The goal here is to enter user-review / `review-closeout` waiting state. After development finishes,
|
|
187
|
+
After implementation and verification, the flow must pause explicitly. Do not continue directly into merge, worktree deletion, archive, or any implicit closeout. The goal here is to enter user-review / `review-closeout` waiting state. After development finishes, present the closeout action menu directly; do not require a separate review-confirmation step first and do not split archive into a second confirmation round.
|
|
160
188
|
|
|
161
189
|
### 5.1 Mandatory Script Calls
|
|
162
190
|
|
|
@@ -196,15 +224,37 @@ Current branch: <branch>
|
|
|
196
224
|
Current workspace: <path>
|
|
197
225
|
Origin: <origin_branch> @ <origin_workspace_path>
|
|
198
226
|
|
|
199
|
-
1.
|
|
200
|
-
2.
|
|
201
|
-
|
|
227
|
+
1. Archive the current change, then merge the branch into the base branch
|
|
228
|
+
2. Archive only, without merging
|
|
229
|
+
3. Delete the current temporary worktree and discard the code
|
|
230
|
+
Other: any non-numbered content means continue modifying the current implementation; if the user gives no input, remain paused in the current review stage
|
|
202
231
|
---
|
|
203
232
|
```
|
|
204
233
|
|
|
234
|
+
If the current checkout is not a temporary worktree, the current branch already equals `origin_branch`, and that branch is `main` or `master`, do not show "merge the branch into the base branch" or "delete the current temporary worktree". In that case the closeout menu must collapse to a single archive-only option:
|
|
235
|
+
|
|
236
|
+
```text
|
|
237
|
+
---
|
|
238
|
+
Implementation and verification are complete.
|
|
239
|
+
|
|
240
|
+
Current branch: <branch>
|
|
241
|
+
Current workspace: <path>
|
|
242
|
+
Origin: <origin_branch> @ <origin_workspace_path>
|
|
243
|
+
|
|
244
|
+
1. Archive only, without merging
|
|
245
|
+
Other: any non-numbered content means continue modifying the current implementation; if the user gives no input, remain paused in the current review stage
|
|
246
|
+
---
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
In other words, on `master/main`, do not prompt for branch merge or worktree deletion.
|
|
250
|
+
|
|
205
251
|
If the current branch or workspace differs from `origin_*`, add an explicit note that implementation currently lives in a temporary branch or temporary worktree and that any non-numbered reply will be treated as a request for more implementation work.
|
|
206
252
|
|
|
207
|
-
|
|
253
|
+
- If the user chooses `1`, archive phase must archive first, then merge the branch into the base branch.
|
|
254
|
+
- If the user chooses `2`, archive phase must archive only, without merging and without auto-deleting the current worktree.
|
|
255
|
+
- If the user chooses `3`, archive phase must delete the temporary worktree and discard the code without archiving.
|
|
256
|
+
|
|
257
|
+
Do not stop at an abstract note such as "the next step is archive phase" or just "do review-closeout". You must also give the user a concrete numbered menu.
|
|
208
258
|
|
|
209
259
|
### 5.4 Anti-Patterns (NEVER)
|
|
210
260
|
|
|
@@ -213,7 +263,7 @@ The following are gate violations:
|
|
|
213
263
|
- reporting "done" without first running the scripts in 5.1
|
|
214
264
|
- omitting current branch / workspace information from the report
|
|
215
265
|
- omitting a concrete numbered next-step menu
|
|
216
|
-
-
|
|
217
|
-
- entering
|
|
218
|
-
- replacing the concrete numbered menu with an abstract "next step is
|
|
266
|
+
- executing archive, merge, or worktree-deletion actions before the user has chosen one
|
|
267
|
+
- entering archive phase before the user replies
|
|
268
|
+
- replacing the concrete numbered menu with an abstract "next step is archive phase" statement
|
|
219
269
|
- deleting a temporary worktree before review is complete and the user explicitly asks for closeout
|