@superspec/cli 1.1.1 → 1.2.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jay Hsueh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,374 @@
1
+ <div align="center">
2
+
3
+ # SuperSpec
4
+
5
+ <p align="center">
6
+ <a href="https://www.npmjs.com/package/@superspec/cli"><img src="https://img.shields.io/npm/v/@superspec/cli.svg" alt="npm version"></a>
7
+ <a href="https://www.npmjs.com/package/@superspec/cli"><img src="https://img.shields.io/npm/dm/@superspec/cli.svg" alt="npm downloads"></a>
8
+ <a href="https://github.com/asasugar/SuperSpec/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license"></a>
9
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="node version"></a>
10
+ </p>
11
+
12
+ <p align="center">
13
+ <img src="https://raw.githubusercontent.com/asasugar/SuperSpec/master/assets/logo.svg" alt="SuperSpec" width="320" />
14
+ </p>
15
+
16
+ Spec-driven development (SDD) for AI-powered coding assistants.
17
+
18
+ [Online Docs](https://asasugar.github.io/SuperSpec/) · [GitHub](https://github.com/asasugar/SuperSpec) · [中文文档](https://github.com/asasugar/SuperSpec/blob/master/README-zh.md)
19
+
20
+ </div>
21
+
22
+ ## Why SuperSpec?
23
+
24
+ AI coding assistants are powerful but often produce inconsistent, undocumented code when requirements are vague.
25
+
26
+ **Supported AI assistants:** [Cursor](https://cursor.com), [Claude Code](https://claude.ai), [Qwen](https://tongyi.aliyun.com) (通义), [OpenCode](https://opencode.com), [Codex](https://codex.ai), [CodeBuddy](https://codebuddy.ai), [Qoder](https://qoder.com). Any editor that reads `AGENTS.md` can use the workflow. Use `superspec init --ai cursor|claude|qwen|opencode|codex|codebuddy|qoder` to install editor-specific rules and slash commands (default: `cursor`).
27
+
28
+ ### OpenSpec Pain Points
29
+
30
+ | # | OpenSpec Pain Point | SuperSpec Solution |
31
+ |---|---|---|
32
+ | 1 | No spec size control — specs grow unbounded, eating AI context window | First Principles + `lint` (target 300 / hard 400 lines), auto-split via `/ss-specs` |
33
+ | 2 | Validation inconsistency — `validate --strict` passes but `archive` fails | Unified validation pipeline: `lint` → `validate` → `checklist` → `archive` |
34
+ | 3 | No implementation↔spec verification — spec drift after coding | `sync` collects git diff into `context.md`, `/ss-resume` cross-references with spec |
35
+ | 4 | No context restoration workflow — context lost when switching AI conversations | `sync` + `context.md` + `/ss-resume` restores full spec context in new sessions |
36
+ | 5 | No dependency management between specs | `depends_on` frontmatter + `deps add`/`deps list`/`deps remove` |
37
+ | 6 | No search across specs and archived changes | `search` with `--archived`, `--artifact`, `--regex` filters |
38
+ | 7 | No progress tracking or status visibility | `status` shows all changes with per-artifact status (Draft → Ready → Done) |
39
+ | 8 | Single mode — same overhead for simple fixes and large features | Standard mode (lightweight) vs Boost mode (full US/FR/AC + checklist) |
40
+ | 9 | No project-level configuration for AI context rules | `superspec.config.json` with `strategy`, `context`, `limits`, `branchTemplate` etc. |
41
+ | 10 | No cross-reference validation (US↔FR↔AC↔tasks) | `validate --check-deps` ensures full traceability |
42
+ | 11 | No i18n — English only | `--lang zh\|en`, full Chinese templates + CLI prompts |
43
+ | 12 | No task granularity control | Boost mode: each task < 1 hour, phased with parallel markers `[P]` |
44
+ | 13 | No automatic branch creation — inconsistent naming for change branches | `superspec create` auto-creates git branches from `branchTemplate`, with customizable `branchPrefix` / `branchTemplate` / `changeNameTemplate` |
45
+
46
+ ### Spec-Kit Pain Points
47
+
48
+ | # | Spec-Kit Pain Point | SuperSpec Solution |
49
+ |---|---|---|
50
+ | 1 | Commands consume a large number of tokens, severely eating into the context window | Slash commands are file-based templates, loaded on-demand (zero idle cost) |
51
+ | 2 | Creates "illusion of work" — generates excessive documentation | First Principles: every sentence must inform a decision, signal-over-noise |
52
+ | 3 | Can't update/refine existing specs — always creates new branches | In-place spec evolution: edit proposal/spec/tasks directly, `/ss-clarify` for iterations |
53
+ | 4 | Ignores existing project structure and conventions | `strategy: follow` reads `context` files as constraints, matches existing patterns |
54
+ | 5 | Generates hundreds of unhelpful tests | No auto-test generation — task verification is developer-controlled |
55
+ | 6 | Poor for incremental development / small tasks | Standard mode for quick features; Boost only when needed (`-b`) |
56
+ | 7 | Python-based install (`uv tool`) — mismatched with JS/TS ecosystem | npm/pnpm/yarn install, native to Node.js ecosystem |
57
+ | 8 | No spec dependency management between changes | `depends_on` + `deps add`/`deps list` with dependency graph |
58
+ | 9 | No context restoration workflow | `sync` → `context.md` → `/ss-resume` for seamless continuation |
59
+ | 10 | Fails when initialized in subfolders | Works anywhere — `superspec.config.json` at project root, `specDir` configurable |
60
+ | 11 | No spec archiving with context preservation | `archive` moves completed changes, `search --archived` still finds them |
61
+ | 12 | Incompatible with latest AI tool upgrades | Editor-agnostic `AGENTS.md` + per-editor rules via `--ai` flag |
62
+ | 13 | Single mode and rigid configuration — no flexible switching between lightweight and Boost modes | SuperSpec lets you freely switch between Standard and Boost modes, with highly customizable `boost`, `strategy`, `branchTemplate` and more in `superspec.config.json` |
63
+ | 14 | No creative/exploration mode | `strategy: create` (`-c`) allows proposing new architectures with documented trade-offs |
64
+
65
+ ## Installation
66
+
67
+ ```bash
68
+ # npm
69
+ npm install -g @superspec/cli
70
+
71
+ # pnpm
72
+ pnpm add -g @superspec/cli
73
+
74
+ # yarn
75
+ yarn global add @superspec/cli
76
+ ```
77
+
78
+ > Requires Node.js >= 18.0.0
79
+
80
+ ## Quick Start
81
+
82
+ ```bash
83
+ cd your-project
84
+
85
+ superspec init # Default (English templates)
86
+ superspec init --lang zh # Chinese templates
87
+ superspec init --ai claude # Specify AI assistant type (cursor|claude|qwen|opencode|codex|codebuddy|qoder)
88
+ superspec init --force # Force overwrite existing config
89
+ superspec init --no-git # Skip git initialization
90
+ ```
91
+
92
+ ## Core Workflow
93
+
94
+ ```
95
+ Standard: create (proposal → checklist ✓) → tasks → apply → [vibe: sync → resume] → archive
96
+ Boost: create -b (proposal → spec → [auto: split? design?] → checklist ✓) → tasks → apply → ...
97
+ ```
98
+
99
+ **Standard mode**: AI generates `proposal.md` (requirements + technical solution) → auto checklist (/10) → `tasks.md` — enough for simple features and bug fixes.
100
+
101
+ **Boost mode**: AI generates `proposal.md` (requirements background) → `spec.md` (US/FR/AC details) → auto complexity assessment (split? design?) → auto checklist (/25) → `tasks.md` — for large features requiring design review and cross-validation.
102
+
103
+ **Vibe coding phase**: after `apply`, use `sync` to collect git changes and `/ss-resume` to restore context in new AI conversations.
104
+
105
+ ## Slash Commands (AI Agent)
106
+
107
+ These are the primary commands you use with AI assistants. Type them directly in your AI chat:
108
+
109
+ ### Main Flow
110
+
111
+ | Command | Flags | What it does |
112
+ |---------|-------|-------------|
113
+ | `/ss-create <feature>` | `-b` boost, `-c` creative, `-d <desc>`, `--no-branch`, `--spec-dir <dir>`, `--branch-prefix <prefix>`, `--branch-template <tpl>`, `--change-name-template <tpl>`, `--intent-type <type>`, `--user <user>`, `--lang <lang>` | Create folder + branch, AI generates proposal (boost: + spec + design) with auto checklist gate |
114
+ | `/ss-tasks` | — | Generate task list from proposal |
115
+ | `/ss-apply` | — | Implement tasks one by one |
116
+ | `/ss-resume` | — | Restore spec context for vibe coding (runs sync → reads context.md) |
117
+ | `/ss-archive [name]` | `--all` | Archive completed change |
118
+
119
+ ### Quality & Discovery
120
+
121
+ | Command | Mode | Flags | What it does |
122
+ |---------|------|-------|-------------|
123
+ | `/ss-clarify` | Both | — | Resolve ambiguity, record decisions |
124
+ | `/ss-checklist` | Both | — | Quality gate: Standard (/10 after proposal) or Boost (/25 after spec). Auto-invoked by /ss-create |
125
+ | `/ss-lint [name]` | Both | — | Check artifact sizes |
126
+ | `/ss-validate [name]` | Boost | `--check-deps` | Cross-reference consistency check (US↔FR↔AC↔tasks) |
127
+ | `/ss-status` | Both | — | View all changes and their status |
128
+ | `/ss-search <q>` | Both | `--archived`, `--artifact <type>`, `--limit <n>`, `-E`/`--regex` | Full-text search across changes |
129
+ | `/ss-link <name>` | Both | `--on <other>` | Add spec dependency |
130
+ | `/ss-deps [name]` | Both | — | View dependency graph |
131
+
132
+ ### Usage Example
133
+
134
+ ```
135
+ You: /ss-create add user authentication @jay
136
+ AI: → runs `superspec create addUserAuth --intent-type feature`
137
+ → generates proposal.md (with requirements + technical solution)
138
+ → auto-runs checklist (/10) → pass
139
+ → prompts to run /ss-tasks
140
+
141
+ You: /ss-tasks
142
+ AI: → reads proposal.md → generates phased tasks
143
+
144
+ You: /ss-apply
145
+ AI: → implements tasks one by one, marks each ✅
146
+
147
+ You: /ss-resume (new conversation / after a break)
148
+ AI: → runs sync → reads context.md → continues where you left off
149
+ ```
150
+
151
+ ## CLI Commands
152
+
153
+ ### Setup
154
+
155
+ #### `superspec init`
156
+
157
+ Initialize SuperSpec in current project.
158
+
159
+ ```bash
160
+ superspec init # Default (English templates)
161
+ superspec init --lang zh # Chinese templates
162
+ superspec init --ai claude # Specify AI assistant type (cursor|claude|qwen|opencode|codex|codebuddy|qoder)
163
+ superspec init --force # Force overwrite existing config
164
+ superspec init --no-git # Skip git initialization
165
+ ```
166
+
167
+ ### Core Workflow
168
+
169
+ #### `superspec create <feature>`
170
+
171
+ Create a change folder and git branch. Artifacts are generated on demand by AI via `/ss-create`.
172
+
173
+ ```bash
174
+ superspec create add-dark-mode # Standard mode
175
+ superspec create add-auth -b # Boost mode (spec + design + checklist)
176
+ superspec create redesign-ui -c # Creative mode (explore new patterns)
177
+ superspec create new-arch -b -c --no-branch # Boost + creative + skip branch
178
+ superspec create add-auth -d "OAuth2 integration" # With description
179
+ superspec create add-auth --spec-dir specs # Custom spec folder
180
+ superspec create add-auth --branch-prefix feature/ # Custom branch prefix
181
+ superspec create add-auth --branch-template "{prefix}{date}-{feature}-{user}" # Custom branch name template
182
+ superspec create add-auth --change-name-template "{date}-{feature}-{user}" # Custom folder name template
183
+ superspec create add-auth --intent-type hotfix # Intent type (feature|hotfix|bugfix|refactor|chore)
184
+ superspec create add-auth --user jay # Developer identifier
185
+ superspec create add-auth --lang zh # SDD document language (en|zh)
186
+ ```
187
+
188
+ #### `superspec archive [name]`
189
+
190
+ Archive completed changes.
191
+
192
+ ```bash
193
+ superspec archive add-auth # Archive a specific change
194
+ superspec archive --all # Archive all completed changes
195
+ ```
196
+
197
+ #### `superspec update`
198
+
199
+ Refresh agent instructions and templates to latest version.
200
+
201
+ ```bash
202
+ superspec update
203
+ ```
204
+
205
+ ### Quality & Validation
206
+
207
+ #### `superspec lint [name]`
208
+
209
+ Check artifact sizes against configured limits.
210
+
211
+ ```bash
212
+ superspec lint add-auth # Lint a specific change
213
+ superspec lint # Lint all active changes
214
+ ```
215
+
216
+ #### `superspec validate [name]`
217
+
218
+ Cross-reference consistency check (US↔FR↔AC↔tasks).
219
+
220
+ ```bash
221
+ superspec validate add-auth # Validate a specific change
222
+ superspec validate add-auth --check-deps # Validate with dependency check
223
+ superspec validate # Validate all active changes
224
+ ```
225
+
226
+ ### Search & Discovery
227
+
228
+ #### `superspec search <query>`
229
+
230
+ Full-text search across all changes.
231
+
232
+ ```bash
233
+ superspec search "JWT authentication" # Search active changes
234
+ superspec search "login flow" --archived # Include archived changes
235
+ superspec search "refresh token" --artifact tasks # Filter by artifact type (proposal|spec|tasks|clarify|checklist)
236
+ superspec search "auth" --limit 10 # Limit results count (default: 50)
237
+ superspec search "user\d+" -E # Use regex pattern matching
238
+ ```
239
+
240
+ #### `superspec status`
241
+
242
+ View all active changes and their artifact statuses.
243
+
244
+ ```bash
245
+ superspec status
246
+ ```
247
+
248
+ ### Dependencies
249
+
250
+ #### `superspec deps add <name>`
251
+
252
+ ```bash
253
+ superspec deps add add-auth --on setup-database
254
+ ```
255
+
256
+ #### `superspec deps remove <name>`
257
+
258
+ ```bash
259
+ superspec deps remove add-auth --on setup-database
260
+ ```
261
+
262
+ #### `superspec deps list [name]`
263
+
264
+ ```bash
265
+ superspec deps list add-auth # View deps for a specific change
266
+ superspec deps list # View all dependency relationships
267
+ ```
268
+
269
+ ### Vibe Coding (Post-SDD)
270
+
271
+ #### `superspec sync [name]`
272
+
273
+ Generate/refresh `context.md` summary with git diff (zero AI tokens — pure CLI).
274
+
275
+ ```bash
276
+ superspec sync add-auth # Sync a specific change
277
+ superspec sync add-auth --base develop # Sync with custom base branch
278
+ superspec sync add-auth --no-git # Skip git diff collection
279
+ superspec sync # Sync all active changes
280
+ ```
281
+
282
+ ## Strategy: follow vs create
283
+
284
+ Each change has a `strategy` that controls how the AI agent approaches implementation:
285
+
286
+ | | `follow` (default) | `create` (`-c`) |
287
+ |---|---|---|
288
+ | Reads project rules | Yes, as **constraints** | Yes, as **awareness** |
289
+ | Architecture | Must align with existing | May propose alternatives |
290
+ | File structure | Match existing patterns | May introduce new patterns |
291
+ | Use case | Regular features, bug fixes | Refactoring, new modules, UX innovation |
292
+
293
+ Configure project rule files in `superspec.config.json`:
294
+
295
+ ```json
296
+ {
297
+ "context": [".cursor/rules/coding-style.mdc", "AGENTS.md", "docs/conventions.md"]
298
+ }
299
+ ```
300
+
301
+ ## First Principles
302
+
303
+ | # | Principle | Rule |
304
+ |---|-----------|------|
305
+ | I | Context Economy | < 300 lines per artifact, 400 hard limit |
306
+ | II | Signal-to-Noise | Every sentence must inform a decision |
307
+ | III | Intent Over Implementation | Focus on why and what, not how |
308
+ | IV | Progressive Disclosure | Start minimal, expand only when needed |
309
+ | V | Required Sections | Metadata, Problem, Solution, Success Criteria, Trade-offs |
310
+
311
+ ## Configuration
312
+
313
+ `superspec init` generates `superspec.config.json`:
314
+
315
+ | Field | Default | Description |
316
+ |-------|---------|-------------|
317
+ | `lang` | `"en"` | Template language (`zh` / `en`). Also controls CLI prompt language |
318
+ | `specDir` | `"superspec"` | Spec folder name |
319
+ | `branchPrefix` | `"spec/"` | Git branch prefix |
320
+ | `boost` | `false` | Enable boost mode by default |
321
+ | `strategy` | `"follow"` | `follow` = obey project rules, `create` = explore freely |
322
+ | `context` | `[]` | Files AI should read for project conventions |
323
+ | `limits.targetLines` | `300` | Target max lines per artifact |
324
+ | `limits.hardLines` | `400` | Hard max lines per artifact |
325
+ | `archive.dir` | `"archive"` | Archive subdirectory |
326
+ | `archive.datePrefix` | `true` | Prefix archive folder with date |
327
+
328
+ ## Project Structure
329
+
330
+ ```
331
+ SuperSpec/
332
+ ├── package.json # monorepo root
333
+ ├── pnpm-workspace.yaml
334
+ ├── tsconfig.json
335
+ └── packages/
336
+ └── cli/ # @superspec/cli
337
+ ├── package.json
338
+ ├── tsup.config.ts
339
+ ├── src/
340
+ │ ├── index.ts # Library exports
341
+ │ ├── cli/ # CLI entry (commander)
342
+ │ ├── commands/ # create / archive / init / update / lint / validate / search / deps / status / sync
343
+ │ ├── core/ # config / template / frontmatter / lint / validate / context
344
+ │ ├── prompts/ # Agent rules installer
345
+ │ ├── ui/ # Terminal output (chalk)
346
+ │ └── utils/ # fs / git / date / paths / template
347
+ ├── templates/
348
+ │ ├── zh/ # Chinese templates
349
+ │ └── en/ # English templates
350
+ └── prompts/
351
+ ├── rules.md # Rules.md template
352
+ └── agents.md # AGENTS.md template
353
+ ```
354
+
355
+ ## Tech Stack
356
+
357
+ - **Language**: TypeScript
358
+ - **Build**: tsup
359
+ - **Package Manager**: pnpm (monorepo)
360
+ - **Runtime**: Node.js >= 18
361
+ - **Dependencies**: commander, chalk
362
+
363
+ ## Development
364
+
365
+ ```bash
366
+ pnpm install # Install dependencies
367
+ pnpm build # Build all packages
368
+ pnpm dev # Watch mode
369
+ pnpm --filter @superspec/cli typecheck # Type check
370
+ ```
371
+
372
+ ## License
373
+
374
+ MIT