@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,199 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: onespec-archive
|
|
3
|
-
description: Use when the user needs final review, feedback handling, worktree deletion, or OpenSpec archive for a OneSpec change.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# OneSpec Archive
|
|
7
|
-
|
|
8
|
-
Handles the review, closeout, and archive phase for OneSpec. The goal is to execute worktree deletion and OpenSpec archive only after explicit user confirmation.
|
|
9
|
-
|
|
10
|
-
Announce at the start:
|
|
11
|
-
|
|
12
|
-
> I am using `onespec-archive` for the review / closeout phase.
|
|
13
|
-
|
|
14
|
-
## 1. Review Entry
|
|
15
|
-
|
|
16
|
-
Recover state first:
|
|
17
|
-
|
|
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)}"
|
|
20
|
-
. "$ONESPEC_ENV"
|
|
21
|
-
"$ONESPEC_BASH" "$ONESPEC_STATE" list
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
If a relevant change exists, you must continue with:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
"$ONESPEC_BASH" "$ONESPEC_STATE" recover <change-id>
|
|
28
|
-
```
|
|
29
|
-
|
|
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 closeout-phase work.
|
|
31
|
-
|
|
32
|
-
Read the minimum necessary context:
|
|
33
|
-
|
|
34
|
-
- `openspec/changes/<change-id>/proposal.md`
|
|
35
|
-
- `openspec/changes/<change-id>/tasks.md`
|
|
36
|
-
- `openspec/changes/<change-id>/design.md`, if present
|
|
37
|
-
- relevant `openspec/specs/**`
|
|
38
|
-
- latest test results and `openspec validate <change-id> --strict` result
|
|
39
|
-
- current branch, worktree, and workspace status
|
|
40
|
-
- `origin_branch`, `origin_workspace_path`, and `origin_workspace_mode`
|
|
41
|
-
|
|
42
|
-
If state has not reached `review`, explain what is still missing: implementation, verification, `tasks.md` sync, or proposal approval.
|
|
43
|
-
|
|
44
|
-
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.
|
|
45
|
-
|
|
46
|
-
## 2. User Review
|
|
47
|
-
|
|
48
|
-
Let the user review the implementation. If they raise issues, continue editing and re-verify.
|
|
49
|
-
|
|
50
|
-
After implementation is done, do not require another explicit review-confirmation step and do not show a generic "continue review / preserve branch" menu. Only ask whether archive-related cleanup should happen. 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.
|
|
51
|
-
|
|
52
|
-
Do not make the user guess what to type next. When entering `onespec-archive`, provide a numbered menu. If multiple actions can be combined, allow comma-separated digits such as `1,3`.
|
|
53
|
-
|
|
54
|
-
Before offering closeout choices, explicitly tell the user:
|
|
55
|
-
|
|
56
|
-
- the current branch name
|
|
57
|
-
- the current workspace path
|
|
58
|
-
- the recorded `origin_branch` and `origin_workspace_path`
|
|
59
|
-
- whether the current review location still matches the original branch/workspace
|
|
60
|
-
|
|
61
|
-
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. In that case, show delete-worktree / archive combinations by default; if the user switches to free-form text, treat it as a request for more code changes.
|
|
62
|
-
|
|
63
|
-
Supported closeout paths are only about these two actions:
|
|
64
|
-
|
|
65
|
-
- delete worktree
|
|
66
|
-
- run archive
|
|
67
|
-
|
|
68
|
-
Do not auto-delete the worktree. Deletion and archive are consequential actions and require an explicit user choice.
|
|
69
|
-
|
|
70
|
-
## 2.1 Superpowers Worktree Priority
|
|
71
|
-
|
|
72
|
-
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.
|
|
73
|
-
|
|
74
|
-
The agent must tell the user:
|
|
75
|
-
|
|
76
|
-
- implementation currently lives in a temporary worktree
|
|
77
|
-
- the original branch is `origin_branch`
|
|
78
|
-
- the original workspace is `origin_workspace_path`
|
|
79
|
-
- whether local temporary branch/worktree cleanup will happen after closeout
|
|
80
|
-
|
|
81
|
-
Default recommended order:
|
|
82
|
-
|
|
83
|
-
1. finish review inside the temporary worktree
|
|
84
|
-
2. if no more code changes are needed, prefer `delete worktree and archive`
|
|
85
|
-
3. if the user only wants local cleanup, allow `delete worktree` only
|
|
86
|
-
4. if the code is already truly on the target branch, allow `run archive` only
|
|
87
|
-
|
|
88
|
-
## 2.2 Multi-Select Closeout Combinations
|
|
89
|
-
|
|
90
|
-
Do not model closeout as a pure single-choice menu anymore. The menu should revolve around combinable archive-related actions. Use numbered combinations such as `1,3`:
|
|
91
|
-
|
|
92
|
-
- `delete worktree`
|
|
93
|
-
- `run archive`
|
|
94
|
-
|
|
95
|
-
Recommended validation rules:
|
|
96
|
-
|
|
97
|
-
- `{delete worktree, run archive}`: valid. Use when the temporary worktree should be cleaned up and the change should be archived now.
|
|
98
|
-
- `{delete worktree}`: valid. Use when the user only wants to clean up the local temporary worktree for now.
|
|
99
|
-
- `{run archive}`: valid only when code is already on the target branch; if the code is still in a temporary branch/worktree, this is invalid by default.
|
|
100
|
-
|
|
101
|
-
If the user selects an invalid combination, explain the conflict explicitly. Do not guess the execution order on the user's behalf.
|
|
102
|
-
|
|
103
|
-
Default recommended combinations:
|
|
104
|
-
|
|
105
|
-
- if currently in a Superpowers temporary worktree: recommend `{delete worktree, run archive}`
|
|
106
|
-
- if currently in a temporary worktree but the user only wants local cleanup: recommend `{delete worktree}`
|
|
107
|
-
- if not in a temporary worktree and code is already truly on the target branch: recommend `{run archive}`
|
|
108
|
-
|
|
109
|
-
The user-facing closeout menu should include at least:
|
|
110
|
-
|
|
111
|
-
1. delete worktree and archive
|
|
112
|
-
2. delete worktree only
|
|
113
|
-
3. run archive only
|
|
114
|
-
Other: if the user's intent is not covered, allow free-form instructions; any non-numbered content means continue modifying the current implementation
|
|
115
|
-
|
|
116
|
-
Menu handling rules:
|
|
117
|
-
|
|
118
|
-
- reply `1`: execute `delete worktree and archive`
|
|
119
|
-
- reply `2`: execute `delete worktree` only
|
|
120
|
-
- reply `3`: run archive only when archive prerequisites are satisfied; otherwise explain the blocker
|
|
121
|
-
- reply with multiple digits, such as `1,3`: validate the combination and execute it in a safe order if valid; otherwise explain the conflict explicitly
|
|
122
|
-
- free-form text instead of digits: treat it as a request to continue modifying the implementation; only ask a minimal clarification question if the intent is genuinely unclear
|
|
123
|
-
|
|
124
|
-
## 3. Archive Rules
|
|
125
|
-
|
|
126
|
-
Before archive or worktree deletion is finalized, always check whether there is still uncommitted code related to the current change:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
"$ONESPEC_BASH" "$ONESPEC_COMMIT" related-dirty <change-id>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
- if the result is empty, continue with closeout
|
|
133
|
-
- 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
|
|
134
|
-
- if the result is not empty, explicitly tell the user which change-related files are still uncommitted and pause archive
|
|
135
|
-
- if the user wants to commit now, stage only the files related to this change:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
"$ONESPEC_BASH" "$ONESPEC_COMMIT" stage-related <change-id>
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
- prefer the repository's own Git commit policy for commit-message format, scope, and language; detect project docs and config first:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
"$ONESPEC_BASH" "$ONESPEC_COMMIT" detect-policy <change-id>
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
- if the project defines an explicit policy, follow it
|
|
148
|
-
- if the project does not define a policy, fall back to general Conventional Commits: `<type>(<scope>): <short summary>`
|
|
149
|
-
- 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
|
|
150
|
-
- 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
|
|
151
|
-
- If code is merged into the target branch and the user chooses archive, run OpenSpec archive immediately and set state to `archived`.
|
|
152
|
-
- If the user deletes the worktree but does not archive yet, set state to `done` and explain that archive can be run later. Do not delete `.onespec.yaml` in that case.
|
|
153
|
-
- Only after archive actually runs should the runtime state file be removed:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
"$ONESPEC_BASH" "$ONESPEC_CLOSEOUT" cleanup-runtime <change-id>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Once the user chooses archive or a combined archive action from the closeout menu, treat that menu choice as the only required confirmation. Do not ask for a second archive confirmation.
|
|
160
|
-
|
|
161
|
-
For actual closeout execution, prefer:
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
"$ONESPEC_BASH" "$ONESPEC_CLOSEOUT" run-actions <change-id> [delete-worktree] [archive]
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> phase done
|
|
169
|
-
"$ONESPEC_BASH" "$ONESPEC_STATE" set <change-id> archive <skipped|archived>
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Before archiving, confirm:
|
|
173
|
-
|
|
174
|
-
- `tasks.md` is checked off to match reality
|
|
175
|
-
- project tests passed, or any failures are explicitly called out
|
|
176
|
-
- `openspec validate <change-id> --strict` passed
|
|
177
|
-
- the user explicitly chose a delete-worktree, archive, or combined strategy
|
|
178
|
-
- no user-review feedback remains unresolved
|
|
179
|
-
|
|
180
|
-
## 4. Report
|
|
181
|
-
|
|
182
|
-
The closeout report must cover:
|
|
183
|
-
|
|
184
|
-
- user review result
|
|
185
|
-
- selected closeout path: delete worktree, archive, or a combination
|
|
186
|
-
- final branch/worktree state
|
|
187
|
-
- how the current branch relates to `origin_branch`, and whether a temporary worktree is still preserved
|
|
188
|
-
- status of `tasks.md`, tests, and OpenSpec validate
|
|
189
|
-
- archive field: `skipped` or `archived`
|
|
190
|
-
|
|
191
|
-
## 5. Stop Conditions
|
|
192
|
-
|
|
193
|
-
Pause and explain if:
|
|
194
|
-
|
|
195
|
-
- the user has not finished final review
|
|
196
|
-
- the user has not explicitly chosen a closeout path
|
|
197
|
-
- the user has not explicitly approved worktree deletion or OpenSpec archive
|
|
198
|
-
- code is not merged into the target branch and the user asks to archive without a valid delete-worktree combination
|
|
199
|
-
- tests or `openspec validate <change-id> --strict` are failing and the user has not explicitly accepted the risk
|