@clawplays/ospec-cli 0.3.1 → 0.3.3

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/SKILL.md ADDED
@@ -0,0 +1,278 @@
1
+ ---
2
+ name: ospec
3
+ description: Document-driven OSpec workflow for AI-assisted development with change-ready initialization, execution, validation, and archive readiness.
4
+ tags: [cli, workflow, automation, typescript, ospec, bootstrap]
5
+ ---
6
+
7
+ # OSpec CLI
8
+
9
+ Document-driven OSpec workflow for AI-assisted development with change-ready initialization, execution, validation, archiving, and docs maintenance.
10
+
11
+ ## Default Entry
12
+
13
+ When the user says something short like:
14
+
15
+ - `使用 ospec 初始化项目`
16
+ - `使用 ospec 初始化这个目录`
17
+ - `use ospec to initialize this directory`
18
+ - `use ospec to initialize this repo`
19
+
20
+ expand it internally as:
21
+
22
+ 1. initialize the repository with `ospec init` so it ends in a change-ready state
23
+ 2. if project context is missing and the AI can ask follow-up questions, ask one concise question for project summary or tech stack
24
+ 3. if the user declines or the flow is CLI-only, continue with placeholder project docs
25
+ 4. create the first change only when explicitly requested
26
+
27
+ Do not force the user to repeat those steps manually when the request is already clear.
28
+
29
+ Treat plain project-init intent as enough to trigger this flow. Do not require the user to restate the guardrails in a longer prompt.
30
+
31
+ ## Mandatory Init Execution
32
+
33
+ When the user asks to initialize a directory, do not freehand the initialization flow.
34
+
35
+ If the user intent is simply to initialize the project or current directory, treat that as a request for this mandatory flow.
36
+
37
+ Use this exact behavior:
38
+
39
+ 1. run `ospec init [path]` when the directory is uninitialized or not yet change-ready
40
+ 2. if AI assistance is available and the repository lacks usable project context, ask one concise follow-up for summary or tech stack before init when helpful
41
+ 3. verify the actual filesystem result before claiming initialization is complete
42
+ 4. stop before `ospec new` unless the user explicitly asks to create a change
43
+
44
+ Never replace `ospec init` with manual directory creation or a hand-written approximation.
45
+
46
+ Do not say initialization is complete unless the managed protocol-shell assets and baseline project knowledge docs actually exist on disk.
47
+
48
+ Required checks after `ospec init`:
49
+
50
+ - `.skillrc`
51
+ - `.ospec/`
52
+ - `changes/active/`
53
+ - `changes/archived/`
54
+ - `SKILL.md`
55
+ - `SKILL.index.json`
56
+ - `build-index-auto.cjs`
57
+ - `for-ai/ai-guide.md`
58
+ - `for-ai/execution-protocol.md`
59
+ - `for-ai/naming-conventions.md`
60
+ - `for-ai/skill-conventions.md`
61
+ - `for-ai/workflow-conventions.md`
62
+ - `for-ai/development-guide.md`
63
+ - `docs/project/overview.md`
64
+ - `docs/project/tech-stack.md`
65
+ - `docs/project/architecture.md`
66
+ - `docs/project/module-map.md`
67
+ - `docs/project/api-overview.md`
68
+
69
+ During plain init, do not report `docs/SKILL.md`, `src/SKILL.md`, `tests/SKILL.md`, or business scaffold as if they were part of change-ready completion.
70
+
71
+ ## Prompt Profiles
72
+
73
+ Use these prompt styles as the preferred mental model.
74
+
75
+ ### 1. Minimal Prompt
76
+
77
+ Use when the user already trusts OSpec defaults.
78
+
79
+ ```text
80
+ Use ospec to initialize this project.
81
+ ```
82
+
83
+ ### 2. Standard Prompt
84
+
85
+ Use when you want short prompts and still want OSpec to finish initialization properly.
86
+
87
+ ```text
88
+ Use ospec to initialize this project according to current OSpec rules.
89
+ ```
90
+
91
+ ### 3. Guided Init Prompt
92
+
93
+ Use when you want the AI to gather missing context before initialization if needed.
94
+
95
+ ```text
96
+ Use ospec to initialize this project. If project context is missing, ask me for a short summary or tech stack first. If I skip it, continue with placeholder docs.
97
+ ```
98
+
99
+ ### 4. Docs Maintenance Prompt
100
+
101
+ Use when the repository is already initialized and the project knowledge layer needs a refresh or repair pass.
102
+
103
+ ```text
104
+ Use ospec to refresh or repair the project knowledge layer for this directory. Do not create a change yet.
105
+ ```
106
+
107
+ ### 5. Change-Creation Prompt
108
+
109
+ Use when the user is explicitly ready to move into execution.
110
+
111
+ ```text
112
+ Use ospec to create and advance a change for this requirement. Respect the current project state and do not create queue work unless I ask for it.
113
+ ```
114
+
115
+ ### 6. Queue Prompt
116
+
117
+ Use when the user explicitly wants multiple changes queued instead of one normal active change.
118
+
119
+ ```text
120
+ Use ospec to break this TODO into multiple changes, create a queue, show the queue first, and do not run it yet.
121
+ ```
122
+
123
+ ### 7. Queue-Run Prompt
124
+
125
+ Use when the user explicitly wants queue execution, not the normal single-change flow.
126
+
127
+ ```text
128
+ Use ospec to create a change queue and execute it explicitly with ospec run manual-safe.
129
+ ```
130
+
131
+ ## Anti-Drift Rules
132
+
133
+ Always keep these rules:
134
+
135
+ - `ospec init` should leave the repository in a change-ready state
136
+ - AI-assisted init may ask one concise follow-up question for missing summary or tech stack; if the user declines, continue with placeholder docs
137
+ - `ospec docs generate` refreshes, repairs, or backfills project knowledge docs after initialization
138
+ - when the user asks to initialize, execute the CLI init command and verify the protocol-shell files and `docs/project/*` files on disk before declaring success
139
+ - do not assume the project is a web or Next.js project unless the repository or user makes that explicit
140
+ - do not apply business scaffold during plain init or docs maintenance
141
+ - do not generate `docs/project/bootstrap-summary.md`
142
+ - do not create the first change automatically unless the user explicitly asks to create a change
143
+ - do not enter queue mode unless the user explicitly asks for queue behavior
144
+ - treat planning defaults as guidance, not as init-time templates
145
+ - use the CLI commands for verification, archiving, and targeted inspection instead of ad-hoc filesystem edits
146
+
147
+ ## What The CLI Manages
148
+
149
+ This CLI now covers:
150
+
151
+ - change-ready initialization
152
+ - project knowledge maintenance
153
+ - layered skill files
154
+ - execution-layer change workflow
155
+ - planning defaults for proposal and task setup
156
+ - explicit business scaffold generation when that scope is requested
157
+ - Codex and Claude Code skill install and sync checks
158
+
159
+ ## Canonical Execution Files
160
+
161
+ Treat these as the source of truth for active delivery work:
162
+
163
+ - `.skillrc`
164
+ - `docs/project/overview.md`
165
+ - `docs/project/tech-stack.md`
166
+ - `docs/project/architecture.md`
167
+ - `changes/active/<change>/proposal.md`
168
+ - `changes/active/<change>/tasks.md`
169
+ - `changes/active/<change>/state.json`
170
+ - `changes/active/<change>/verification.md`
171
+
172
+ ## Plugin Gates
173
+
174
+ Before advancing an active change:
175
+
176
+ - read `.skillrc.plugins` to detect enabled blocking plugins
177
+ - if the current change activates `stitch_design_review`, inspect `changes/active/<change>/artifacts/stitch/approval.json`
178
+ - when Stitch approval is missing or `status != approved`, treat the change as blocked and do not claim it is ready to continue or archive
179
+
180
+ Do not fall back to the old `features/...` layout unless the target repository really still uses it.
181
+
182
+ ## Commands To Prefer
183
+
184
+ ```bash
185
+ ospec status [path]
186
+ ospec init [path]
187
+ ospec init [path] --summary "..." --tech-stack node,react
188
+ ospec docs generate [path]
189
+ ospec new <change-name> [path]
190
+ ospec docs status [path]
191
+ ospec skills status [path]
192
+ ospec changes status [path]
193
+ ospec queue status [path]
194
+ ospec queue add <change-name> [path]
195
+ ospec queue next [path]
196
+ ospec run start [path] --profile manual-safe
197
+ ospec run status [path]
198
+ ospec run step [path]
199
+ ospec run resume [path]
200
+ ospec run stop [path]
201
+ ospec plugins status [path]
202
+ ospec plugins approve stitch [changes/active/<change>]
203
+ ospec plugins reject stitch [changes/active/<change>]
204
+ ospec index check [path]
205
+ ospec index build [path]
206
+ ospec workflow show
207
+ ospec workflow list-flags
208
+ ospec progress [changes/active/<change>]
209
+ ospec verify [changes/active/<change>]
210
+ ospec archive [changes/active/<change>]
211
+ ospec archive [changes/active/<change>] --check
212
+ ospec finalize [changes/active/<change>]
213
+ ospec skill status ospec
214
+ ospec skill install ospec
215
+ ospec skill status ospec-change
216
+ ospec skill install ospec-change
217
+ ospec skill status-claude ospec
218
+ ospec skill install-claude ospec
219
+ ospec skill status-claude ospec-change
220
+ ospec skill install-claude ospec-change
221
+ ```
222
+
223
+ Managed auto-sync targets for global install, `ospec init`, and `ospec update` are:
224
+
225
+ - `ospec`
226
+ - `ospec-change`
227
+
228
+ Additional packaged skills remain available for explicit install, for example:
229
+
230
+ ```bash
231
+ ospec skill install ospec-init
232
+ ospec skill install-claude ospec-init
233
+ ```
234
+
235
+ Preferred execution order for a new directory:
236
+
237
+ ```bash
238
+ ospec init [path]
239
+ ospec new <change-name> [path]
240
+ ospec verify [changes/active/<change>]
241
+ ospec finalize [changes/active/<change>]
242
+ ```
243
+
244
+ Use `ospec docs generate [path]` later when you need a docs-only maintenance pass.
245
+
246
+ Use `ospec status [path]` separately when you want an explicit troubleshooting snapshot.
247
+
248
+ For completed changes, archive before commit. Use `ospec archive [changes/active/<change>]` to execute the archive and `--check` only when you want a readiness preview without moving files.
249
+
250
+ For the normal closeout path, prefer `ospec finalize [changes/active/<change>]`. It should verify completeness, rebuild the index, archive the change, and leave Git commit as a separate manual step.
251
+
252
+ ## Project-Type Rules
253
+
254
+ If the repository type is unclear:
255
+
256
+ - inspect the real directory only when needed for troubleshooting or context gathering
257
+ - let initialization stay stack-agnostic
258
+ - allow the project to stay minimal except for OSpec-managed assets and baseline project docs
259
+ - let later skills or explicit project-knowledge steps shape the actual stack
260
+
261
+ This is important because valid OSpec projects include:
262
+
263
+ - web applications
264
+ - CLI tools
265
+ - Unity projects
266
+ - Godot projects
267
+ - desktop apps
268
+ - service backends
269
+ - protocol-only repositories
270
+
271
+ ## Verification Discipline
272
+
273
+ Before saying work is complete:
274
+
275
+ 1. verify the relevant active change
276
+ 2. confirm docs, skills, and index state if project knowledge changed
277
+ 3. keep `SKILL.index.json` current after meaningful skill updates
278
+ 4. treat `SKILL.index.json` section offsets as LF-normalized so Windows CRLF and Linux LF checkouts do not drift
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OSpec"
3
+ short_description: "Inspect, initialize, and operate OSpec projects"
4
+ default_prompt: "Use $ospec to initialize this directory according to OSpec rules: use ospec init so the repository ends in change-ready state, reuse existing project docs when available, ask one concise follow-up for missing summary or tech stack in AI-assisted flows, fall back to placeholder docs when the user skips that context, do not assume a web template when the project type is unclear, do not create the first change automatically, and use ospec status or ospec changes status only when you need an explicit summary."
package/dist/cli.js CHANGED
@@ -224,7 +224,7 @@ const services_1 = require("./services");
224
224
 
225
225
 
226
226
 
227
- const CLI_VERSION = '0.3.1';
227
+ const CLI_VERSION = '0.3.3';
228
228
 
229
229
  function showInitUsage() {
230
230
  console.log('Usage: ospec init [root-dir] [--summary "..."] [--tech-stack node,react] [--architecture "..."] [--document-language zh-CN|en-US]');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawplays/ospec-cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "CLI tool for enforcing ospec workflow",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -47,8 +47,11 @@
47
47
  "files": [
48
48
  "dist/**",
49
49
  "assets/**",
50
+ "agents/openai.yaml",
50
51
  "scripts/postinstall.js",
51
52
  ".ospec/templates/hooks/**",
53
+ "SKILL.md",
54
+ "skill.yaml",
52
55
  "README.md",
53
56
  "README.zh-CN.md",
54
57
  "LICENSE"
package/skill.yaml ADDED
@@ -0,0 +1,151 @@
1
+ name: ospec
2
+ title: OSpec
3
+ description: Document-driven OSpec workflow skill for AI-assisted development with Codex, Claude Code, and similar AI tools.
4
+ version: 5.1.0
5
+ author: OSpec Team
6
+ license: MIT
7
+
8
+ interface:
9
+ display_name: "OSpec"
10
+ short_description: "Inspect, initialize, and operate OSpec projects"
11
+ default_prompt: "Use $ospec to initialize this directory according to OSpec rules: use ospec init so the repository ends in change-ready state, reuse existing project docs when available, ask one concise follow-up for missing summary or tech stack in AI-assisted flows, fall back to placeholder docs when the user skips that context, do not assume a web template when the project type is unclear, and do not create the first change automatically."
12
+
13
+ requires_local:
14
+ node: ">=18.0.0"
15
+ npm: ">=8.0.0"
16
+
17
+ protocol:
18
+ project_files:
19
+ - ".skillrc"
20
+ - "SKILL.md"
21
+ - "SKILL.index.json"
22
+ - "build-index-auto.cjs"
23
+ - "for-ai/ai-guide.md"
24
+ - "for-ai/execution-protocol.md"
25
+ - "for-ai/naming-conventions.md"
26
+ - "for-ai/skill-conventions.md"
27
+ - "for-ai/workflow-conventions.md"
28
+ - "for-ai/development-guide.md"
29
+ feature_files:
30
+ - "changes/active/<feature>/proposal.md"
31
+ - "changes/active/<feature>/tasks.md"
32
+ - "changes/active/<feature>/state.json"
33
+ - "changes/active/<feature>/verification.md"
34
+ feature_name_format: "kebab-case"
35
+
36
+ commands:
37
+ - id: status
38
+ command: "ospec status [project-dir]"
39
+ purpose: "Show project knowledge, execution status, and the recommended next step."
40
+ - id: init
41
+ command: "ospec init [root-dir]"
42
+ purpose: "Initialize the repository to a change-ready state from CLI."
43
+ - id: docs_generate
44
+ command: "ospec docs generate [project-dir]"
45
+ purpose: "Refresh, repair, or backfill the project knowledge layer for an already initialized repository."
46
+ - id: new
47
+ command: "ospec new <feature-name> [root-dir]"
48
+ purpose: "Create a new change under changes/active with proposal/tasks/state/verification/review."
49
+ - id: changes_status
50
+ command: "ospec changes status [project-dir]"
51
+ purpose: "Show PASS/WARN/FAIL protocol status for every active change."
52
+ - id: docs_status
53
+ command: "ospec docs status [project-dir]"
54
+ purpose: "Show project-doc coverage and missing knowledge docs."
55
+ - id: skills_status
56
+ command: "ospec skills status [project-dir]"
57
+ purpose: "Show layered SKILL coverage, module skills, and index status."
58
+ - id: index_check
59
+ command: "ospec index check [project-dir]"
60
+ purpose: "Show whether the skill index exists, is stale, or needs rebuild."
61
+ - id: index_build
62
+ command: "ospec index build [project-dir]"
63
+ purpose: "Rebuild the project skill index."
64
+ - id: progress
65
+ command: "ospec progress [changes/active/<feature>]"
66
+ purpose: "Show progress for a single active feature."
67
+ - id: verify
68
+ command: "ospec verify [changes/active/<feature>]"
69
+ purpose: "Check protocol completeness and optional-step coverage."
70
+ - id: archive
71
+ command: "ospec archive [changes/active/<feature>] [--check]"
72
+ purpose: "Archive a completed change after gate checks; use --check for readiness only."
73
+ - id: finalize
74
+ command: "ospec finalize [changes/active/<feature>]"
75
+ purpose: "Run verify + index refresh + archive as the standard closeout flow before commit."
76
+ - id: workflow_show
77
+ command: "ospec workflow show"
78
+ purpose: "Show workflow configuration for the current project."
79
+ - id: workflow_flags
80
+ command: "ospec workflow list-flags"
81
+ purpose: "List supported workflow feature flags."
82
+ - id: skill_status
83
+ command: "ospec skill status"
84
+ purpose: "Check whether a Codex-installed OSpec skill is present and in sync. Managed defaults are ospec and ospec-change."
85
+ - id: skill_install
86
+ command: "ospec skill install"
87
+ purpose: "Install or sync one OSpec skill package into ~/.codex/skills/. Managed defaults are ospec and ospec-change."
88
+ - id: skill_status_claude
89
+ command: "ospec skill status-claude"
90
+ purpose: "Check whether a Claude Code-installed OSpec skill is present and in sync. Managed defaults are ospec and ospec-change."
91
+ - id: skill_install_claude
92
+ command: "ospec skill install-claude"
93
+ purpose: "Install or sync one OSpec skill package into ~/.claude/skills/. Managed defaults are ospec and ospec-change."
94
+
95
+ workflow:
96
+ read_order:
97
+ - ".skillrc"
98
+ - "changes/active/<feature>/proposal.md"
99
+ - "changes/active/<feature>/tasks.md"
100
+ - "changes/active/<feature>/state.json"
101
+ - "changes/active/<feature>/verification.md"
102
+ archive_requirements:
103
+ - "state.json.status must be ready_to_archive"
104
+ - "verification.md must be fully passed"
105
+ - "activated optional steps must appear in tasks.md and verification.md"
106
+ - "activated optional steps must be listed in verification.md.passed_optional_steps"
107
+ preferred_entry:
108
+ - "Run ospec init [path] when the directory is uninitialized or not yet change-ready."
109
+ - "Pass --summary, --tech-stack, or --architecture during init when CLI users already know the missing project context."
110
+ - "Run your project deployment and validation flow before archiving the active change."
111
+ - "Run ospec verify [changes/active/<change>] before archiving."
112
+ - "Use ospec status [path] when you want an explicit textual summary or troubleshooting snapshot."
113
+ - "Run ospec docs generate [path] later when you only need a docs maintenance pass."
114
+ - "Create the first change explicitly instead of assuming initialization will do it."
115
+
116
+ guardrails:
117
+ - "Treat init as change-ready initialization, not protocol-shell-only initialization."
118
+ - "If the user intent is simply to initialize the project or current directory, still trigger the mandatory init flow without asking for a longer prompt."
119
+ - "When the user asks to initialize, use ospec init to take the repository to change-ready state and verify the managed protocol-shell files plus docs/project/* on disk before declaring success."
120
+ - "In AI-assisted flows, ask at most one concise follow-up for missing summary or tech stack before init when that context is unavailable."
121
+ - "If the user declines or no AI follow-up is possible, continue with placeholder docs instead of blocking init."
122
+ - "Do not assume the project is a web or Next.js project unless the repository or user makes that explicit."
123
+ - "Do not apply business scaffold during plain init."
124
+ - "Do not generate docs/project/bootstrap-summary.md during plain init or docs generate."
125
+ - "Do not create the first change automatically unless the user explicitly asks for a change."
126
+ - "Treat presets as planning defaults, not as init-time templates."
127
+
128
+ prompt_profiles:
129
+ minimal: "Initialize this project with ospec. Use ospec init and verify the managed files before saying it is initialized."
130
+ standard: "Initialize this project with ospec according to current OSpec rules. Use ospec init so the repository ends in change-ready state, and do not create the first change automatically."
131
+ guided_init: "Use ospec to initialize this project. If the repository lacks project context, ask me for a short summary or tech stack first. If I skip it, continue with placeholder docs."
132
+ knowledge_backfill: "Use ospec to refresh or repair the project knowledge layer for this directory. Focus on docs, layered skills, and index state. Do not create a change yet."
133
+ change_creation: "Use ospec to create and advance a change for this requirement. Respect the current project state and do not treat init as auto-change creation."
134
+
135
+ usage:
136
+ new_project_flow:
137
+ - "Initialize the repository with ospec init [path]."
138
+ - "If AI can ask follow-up questions and project context is missing, provide a short summary or tech stack once, or skip it and let placeholder docs be generated."
139
+ - "Create the first active change explicitly."
140
+ - "Run your project deployment and validation flow, then use ospec verify [changes/active/<change>]."
141
+ - "Archive the validated change with ospec finalize [changes/active/<change>]."
142
+ - "Verify .skillrc, changes/, .ospec/, build-index-auto.cjs, for-ai docs, and docs/project/* before claiming init is complete."
143
+ - "Use presets only as planning defaults; scaffold still requires explicit intent."
144
+ prompt_shortcuts:
145
+ - "initialize this project"
146
+ - "initialize this directory"
147
+ - "initialize the current project"
148
+ - "使用 ospec 初始化项目"
149
+ - "使用 ospec 初始化这个目录"
150
+ - "use ospec to initialize this directory"
151
+ - "use ospec to refresh or repair the project knowledge layer"