speccore 4.0.0 → 4.0.2

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.
Files changed (3) hide show
  1. package/README.en.md +149 -311
  2. package/README.md +153 -370
  3. package/package.json +1 -1
package/README.en.md CHANGED
@@ -1,4 +1,4 @@
1
- # SpecCore
1
+ # SpecCore CLI
2
2
 
3
3
  > **Code by Spec, Not by Vibe.**
4
4
 
@@ -6,389 +6,227 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
8
8
 
9
- SpecCore is the official command-line tool for the [SpecCore](https://github.com/spec-core/spec-core) specification-driven development framework. It decouples deterministic operations (file creation, directory management, format validation, status statistics) from AI, executing them directly through code to improve efficiency and reduce Token consumption.
9
+ SpecCore CLI is the official TypeScript command-line tool for the [SpecCore specification-driven development framework](https://github.com/windfallsheng/SpecCore). It decouples deterministic operations (file creation, directory management, format validation, status statistics) from AI, executing them directly through code to improve efficiency and reduce Token consumption.
10
10
 
11
- ---
12
-
13
- ## One Minute Overview
14
-
15
- | Question | Answer |
16
- | :--- | :--- |
17
- | **What is this?** | CLI tool for SpecCore framework, deterministic operations executed by code, intelligent decisions handled by AI |
18
- | **What problem does it solve?** | AI file operations are error-prone, high Token consumption, context window waste |
19
- | **What do I need to install?** | Node.js >= 18, run `npm install -g speccore` |
20
- | **Relationship with Slash Commands?** | CLI is the underlying execution engine for Slash Commands, AI makes decisions, CLI executes |
11
+ > 💡 **v4.0.0** | 39 Commands | 31 Intent Types | Multi-Platform
21
12
 
22
13
  ---
23
14
 
24
- ## Feature Highlights
25
-
26
- - **🚀 Quick Initialization**: Initialize a complete SpecCore project structure with one command
27
- - **📁 Smart Directory Management**: Auto-create iterations, tasks, shared resource directories following specifications
28
- - **✅ Auto Compliance Check**: Scan all Spec files, check required fields and formats
29
- - **📊 Real-time Progress Tracking**: Auto-identify active iterations, calculate task completion rates
30
- - **🏥 Health Dashboard**: Evaluate project health with 4 dimensions and 12 metrics
31
- - **📈 One-click Reporting**: Support Markdown/HTML/JSON format output for project reports
32
- - **🧠 Context Awareness**: Auto-read `.speccore/local/context.json`, intelligently fill default values
33
- - **🔄 Deterministic Execution**: File operations, format validation, status statistics all executed locally with zero Token consumption
34
-
35
- ---
36
-
37
- ## Design Philosophy
38
-
39
- SpecCore adopts an architecture that **decouples deterministic logic from intelligent logic**:
40
-
41
- | Logic Type | Responsibility | Executor | Example |
42
- | :--- | :--- | :--- | :--- |
43
- | **Deterministic Logic** | Structured operations | CLI code | Create directories, move files, parse YAML, validate formats, count status |
44
- | **Intelligent Logic** | Understanding & Decision | AI | Understand requirements, split tasks, generate code, review outputs |
45
-
46
- ```
47
- User Input (Slash Command)
48
-
49
-
50
- ┌───────────────────────────────────────┐
51
- │ AI Layer (Intelligent Decision) │
52
- │ - Understand user intent │
53
- │ - Decide which operations to execute│
54
- │ - Generate code content │
55
- └───────────────────────────────────────┘
56
- │ Call CLI Commands
57
-
58
- ┌───────────────────────────────────────┐
59
- │ CLI Layer (Deterministic Execution) │
60
- │ - Create directory structure │
61
- │ - Read/write files │
62
- │ - Parse YAML │
63
- │ - Validate formats │
64
- │ - Output JSON results │
65
- └───────────────────────────────────────┘
66
- ```
67
-
68
- **Core Benefit**: Directory checking, YAML parsing, and status statistics are executed deterministically by code. AI only interprets results and formats outputs, significantly reducing Token consumption.
15
+ ## 🧩 Two Ways to Use
69
16
 
70
- ---
17
+ SpecCore has two distinct parts:
71
18
 
72
- ## Requirements
19
+ | | 🔧 Terminal (CLI) | 🤖 AI Commands (Slash) |
20
+ | :--- | :--- | :--- |
21
+ | **Where** | Terminal | AI coding tools (WorkBuddy / Cursor / Claude) |
22
+ | **How** | `speccore init` | Type `/spec-xxx` |
23
+ | **Mechanism** | TypeScript, direct file ops | Markdown prompts, AI reads & executes |
24
+ | **Count** | 39 CLI commands | 39 Slash Commands |
25
+ | **When** | Init, validation, batch ops | Daily dev: iteration, execution, review, archive |
73
26
 
74
- - **Node.js**: >= 18.0.0
75
- - **Operating System**: macOS / Linux / Windows
27
+ > 💡 **Remember**: `speccore` prefix → Terminal; `/spec` prefix → AI tool.
76
28
 
77
29
  ---
78
30
 
79
- ## Installation
31
+ ## 📦 Install
80
32
 
81
33
  ```bash
82
- # Global installation (recommended)
83
- npm install -g speccore
84
-
85
- # Or use npx (no installation required, always use latest version)
86
- npx speccore --version
87
-
88
- # Or install specific version
89
- npm install -g speccore@1.0.0
34
+ npm install -g speccore # Global install (recommended)
35
+ npx speccore --version # Or use npx
90
36
  ```
91
37
 
92
38
  ---
93
39
 
94
- ## Quick Start
95
-
96
- ### 1. Initialize Project
40
+ ## 🚀 Quick Start (5 min)
97
41
 
98
42
  ```bash
99
- # Enter your project directory
100
- cd my-project
43
+ # 1. Initialize
44
+ cd my-project && speccore init
101
45
 
102
- # Initialize SpecCore
103
- speccore init --mode fresh
46
+ # 2. Import to global layer
47
+ speccore import --project=user-service --path=./backend --type=backend
104
48
 
105
- # Or migrate existing project
106
- speccore init --mode migration
107
- ```
49
+ # 3. Create iteration
50
+ speccore iteration create --name 2026-07-UserSystem
108
51
 
109
- After execution, the following structure will be generated:
52
+ # 4. Multi-platform task
53
+ speccore new-task --name UserLogin --platforms=web,h5
110
54
 
55
+ # 5. Smart entry
56
+ speccore spec "How's the progress?"
111
57
  ```
112
- .speccore/ # Global configuration directory
113
- ├── CONSTITUTION.md # Technical Constitution (tech stack, standards)
114
- ├── SETTINGS.md # Framework configuration (switches, modes)
115
- ├── ITERATIONS/ # Iteration records
116
- ├── PATTERNS/ # Pattern library
117
- ├── PROJECT/ # Project-level assets
118
- │ ├── OVERVIEW.md
119
- │ ├── TEAM.md
120
- │ └── ...
121
- ├── RULES/ # Adjudication rules
122
- └── local/ # Local state
123
- └── context.json # Current context (iteration, task, user)
124
- ```
125
-
126
- ### 2. Create Iteration
127
58
 
128
- ```bash
129
- speccore iteration create --name 2026-07-User-System
130
- ```
131
-
132
- Generates `Iteration-2026-07-User-System/` directory containing:
133
- - `00-Requirements/REQUIREMENT.md`
134
- - `00-Technical-Design/ARCHITECTURE.md`
135
- - `00-Iteration-Overview/PROJECT_GRAPH.md`
136
-
137
- ### 3. Create Tasks
138
-
139
- ```bash
140
- speccore task new --name User-Login --type feature
141
- speccore task new --name Phone-Registration --type feature
142
- speccore task new --name Password-Reset --type bugfix
143
- ```
59
+ > 📚 See [Quick Start Guide](docs/quick-start.en.md) for detailed steps.
144
60
 
145
- ### 4. View Progress
61
+ ---
146
62
 
147
- ```bash
148
- # View overall progress
149
- speccore progress
63
+ ## Feature Highlights
150
64
 
151
- # JSON format output (suitable for CI/CD)
152
- speccore progress --format json
65
+ - **🚀 Quick Init**: One command initializes the full project structure, auto-integrates WorkBuddy
66
+ - **📱 Multi-Platform**: `--platforms=web,h5,miniapp` per-platform Task management, dynamic platform types
67
+ - **🧠 Intent Recognition**: 31 intent types, 200+ keywords, natural language → command matching
68
+ - **🌐 Global Layer**: Cross-project requirement indexing via GLOBAL/ architecture
69
+ - **📊 Progress Tracking**: Auto-detect active iteration, per-platform/per-assignee stats
70
+ - **✅ Auto Compliance**: Scan all Spec files, check required fields and format
71
+ - **🔄 Deterministic Execution**: File ops, validation, statistics — all local code, zero Token cost
153
72
 
154
- # View detailed progress
155
- speccore progress --detail
156
- ```
73
+ ---
157
74
 
158
- ### 5. Validate Compliance
75
+ ## Design Philosophy
159
76
 
160
- ```bash
161
- # Validate all tasks
162
- speccore validate
77
+ SpecCore decouples **deterministic logic from intelligent logic**:
163
78
 
164
- # Auto-fix fixable issues
165
- speccore validate --fix
79
+ | Logic Type | Responsibility | Executor | Example |
80
+ | :--- | :--- | :--- | :--- |
81
+ | **Deterministic** | Structured operations | CLI code | Create dirs, parse YAML, validate, count |
82
+ | **Intelligent** | Understanding & decision | AI tool | Understand requirements, split tasks, generate code |
166
83
 
167
- # JSON format output (AI can read directly)
168
- speccore validate --format json
169
84
  ```
170
-
171
- ### 6. Generate Report
172
-
173
- ```bash
174
- # Markdown format (default)
175
- speccore report
176
-
177
- # HTML format (suitable for email)
178
- speccore report --format html --output ./report.html
179
-
180
- # JSON format (suitable for import into other systems)
181
- speccore report --format json
182
-
183
- # Include team analysis and risk analysis
184
- speccore report --team --risk
85
+ User Input (Natural Language / Slash Command)
86
+
87
+
88
+ ┌───────────────────────────────────────┐
89
+ │ AI Layer (Intelligent Decision)
90
+ │ - Understand user intent │
91
+ │ - Decide which operations to run │
92
+ │ - Generate code content │
93
+ └───────────────────────────────────────┘
94
+ │ Call CLI commands
95
+
96
+ ┌───────────────────────────────────────┐
97
+ │ CLI Layer (Deterministic Execution) │
98
+ │ - Create directory structure │
99
+ │ - Read/write config & Spec files │
100
+ │ - Parse YAML │
101
+ │ - Compliance validation │
102
+ │ - Output structured results │
103
+ └───────────────────────────────────────┘
185
104
  ```
186
105
 
187
106
  ---
188
107
 
189
- ## Full Command List
190
-
191
- ### Initialization & Import
192
-
193
- | Command | Description | Corresponding Slash Command | Deterministic |
194
- | :--- | :--- | :--- | :--- |
195
- | `speccore init` | Initialize SpecCore project | `/spec-init` | ✅ |
196
- | `speccore import` | Import existing project | `/spec-import` | ✅ |
197
-
198
- ### Iteration Management
199
-
200
- | Command | Description | Corresponding Slash Command | Deterministic |
201
- | :--- | :--- | :--- | :--- |
202
- | `speccore iteration create` | Create iteration | `/spec-iteration-create` | ✅ |
203
- | `speccore iteration split` | Requirement splitting (requires AI task list) | `/spec-iteration-split` | ⚠️ |
204
-
205
- ### Task Management
206
-
207
- | Command | Description | Corresponding Slash Command | Deterministic |
208
- | :--- | :--- | :--- | :--- |
209
- | `speccore task new` | Create atomic task | `/spec-new-task` | ✅ |
210
-
211
- ### Execution & Scheduling
108
+ ## 🔧 CLI Commands Quick Reference (39 total)
212
109
 
213
- | Command | Description | Corresponding Slash Command | Deterministic |
214
- | :--- | :--- | :--- | :--- |
215
- | `speccore plan` | Generate scheduling plan (DAG analysis) | `/spec-plan` | ✅ |
216
- | `speccore execute` | Execute task (requires AI collaboration) | `/spec-execute` | ⚠️ |
217
-
218
- ### Validation & Review
219
-
220
- | Command | Description | Corresponding Slash Command | Deterministic |
221
- | :--- | :--- | :--- | :--- |
222
- | `speccore validate` | Compliance check | `/spec-validate` | ✅ |
223
- | `speccore progress` | View progress | `/spec-progress` | ✅ |
224
- | `speccore status` | Project status | `/spec-status` | ✅ |
225
- | `speccore health` | Health dashboard (4 dimensions, 12 metrics) | `/spec-health` | ✅ |
226
- | `speccore report` | Generate project report | `/spec-report` | ✅ |
227
-
228
- ### Archive & Configuration
229
-
230
- | Command | Description | Corresponding Slash Command | Deterministic |
231
- | :--- | :--- | :--- | :--- |
232
- | `speccore archive` | Archive task | `/spec-archive` | ✅ |
233
- | `speccore config` | Configuration management | `/spec-config` | ✅ |
110
+ > Run in terminal. All commands start with `speccore`.
234
111
 
235
- - **✅** Pure deterministic logic, fully executable by code
236
- - **⚠️** Requires AI participation for understanding/generation (e.g., requirement splitting, code generation)
112
+ | Category | Key Commands |
113
+ | :--- | :--- |
114
+ | 🧠 Smart Entry | `speccore spec "<query>"` |
115
+ | 🌐 Global Layer | `import` / `iteration-from-global` / `sync-global` / `global-status` / `history` / `index-update` |
116
+ | 📋 Scenario | `goal` / `bugfix` / `research` / `retro` / `handover` |
117
+ | 📐 Planning | `init` / `iteration create` / `iteration split` / `new-task` / `plan` |
118
+ | ⚡ Execution | `execute` (--platform / --priority / --status) |
119
+ | 🔄 Change | `change` / `sync` / `sync-global` |
120
+ | ✅ Review | `validate` (--fix) |
121
+ | 📊 Progress | `progress` (--platform / --detail) / `status` |
122
+ | 📦 Management | `archive` / `config` / `baseline` / `rename` |
123
+ | 🔗 Analysis | `impact` / `dashboard` / `audit` |
124
+ | 📱 Platform | `platform-add` / `context` |
125
+ | 🛠️ Tools | `health` / `report` / `template-add` / `help` / `demo` / `welcome` |
126
+
127
+ ## 🤖 AI Commands (Slash Command) Mapping
128
+
129
+ > Type `/` in AI tools (WorkBuddy / Cursor / Claude Code etc.). AI commands call the corresponding CLI command internally.
130
+
131
+ | CLI Command | AI Slash Command | Purpose |
132
+ | :--- | :--- | :--- |
133
+ | `speccore init` | `/spec-init` | Initialize project |
134
+ | `speccore import` | `/spec-import` | Import to global layer |
135
+ | `speccore iteration create` | `/spec-iteration-create` | Create iteration |
136
+ | `speccore new-task` | `/spec-new-task` | Create multi-platform task |
137
+ | `speccore execute` | `/spec-execute` | Execute development |
138
+ | `speccore progress` | `/spec-progress` | View progress |
139
+ | `speccore validate` | `/spec-validate` | Compliance check |
140
+ | `speccore impact` | `/spec-impact` | Impact analysis |
141
+ | `speccore audit` | `/spec-ai-audit` | AI smart audit |
142
+ | `speccore spec "query"` | `/spec query` | Natural language intent |
143
+
144
+ > 📋 Full command reference: [Command Reference](docs/commands.en.md) | 🧠 Intent mapping: [Intent Map](docs/commands.en.md#natural-language-intent-mapping-31-types)
237
145
 
238
146
  ---
239
147
 
240
- ## Project Structure
148
+ ## 🏗️ Architecture
241
149
 
242
150
  ```
243
- speccore/
244
- ├── package.json
245
- ├── tsconfig.json
246
- ├── README.md
247
- ├── bin/
248
- └── speccore # CLI entry script
249
- ├── src/
250
- │ ├── index.ts # Entry file
251
- │ ├── cli.ts # CLI command registration (Commander.js)
252
- │ │
253
- │ ├── commands/ # All CLI command implementations
254
- │ │ ├── init.ts # Initialize project
255
- │ │ ├── import.ts # Import existing project
256
- │ │ ├── iteration/
257
- │ │ │ ├── create.ts # Create iteration
258
- │ │ │ └── split.ts # Requirement splitting
259
- │ │ ├── task/
260
- │ │ │ └── new.ts # Create task
261
- │ │ ├── plan.ts # Generate scheduling plan
262
- │ │ ├── execute.ts # Execute task
263
- │ │ ├── validate.ts # Compliance check
264
- │ │ ├── archive.ts # Archive task
265
- │ │ ├── progress.ts # View progress
266
- │ │ ├── status.ts # Project status
267
- │ │ ├── health.ts # Health dashboard
268
- │ │ ├── report.ts # Generate report
269
- │ │ └── config.ts # Configuration management
270
- │ │
271
- │ ├── core/ # Core engine
272
- │ │ ├── context.ts # Context management (read context.json)
273
- │ │ ├── state.ts # State management (read PROJECT_GRAPH.md)
274
- │ │ ├── yaml-parser.ts # YAML parsing
275
- │ │ ├── template-engine.ts # Template rendering (Handlebars)
276
- │ │ └── validator.ts # Compliance check engine
277
- │ │
278
- │ ├── templates/ # Built-in templates
279
- │ │ ├── spec/ # Spec file templates
280
- │ │ │ └── project-readme.md
281
- │ │ └── code/ # Code generation templates
282
- │ │ ├── spring-controller.java
283
- │ │ ├── spring-service.java
284
- │ │ ├── spring-test.java
285
- │ │ └── nest-controller.ts
286
- │ │
287
- │ └── utils/
288
- │ ├── file.ts # File utilities
289
- │ ├── git.ts # Git utilities (get username, etc.)
290
- │ └── logger.ts # Logger (with progress bar, Spinner)
291
-
292
- └── dist/ # Compiled output (TypeScript → JavaScript)
151
+ .speccore/GLOBAL/ ← Global Layer: unified multi-project requirements
152
+ .speccore/ ← Project Layer: constitution, config, patterns
153
+ Iteration-XXX/ ← Iteration Layer: what this iteration does
154
+ └── Task-XXX/ ← Task Layer: how this feature works
155
+ ├── _shared/ ← Shared: API Contract + business rules
156
+ ├── backend/ Backend Specs
157
+ └── frontend/ ← Multi-platform frontend specs (web / h5 / miniapp)
293
158
  ```
294
159
 
295
160
  ---
296
161
 
297
- ## Development Guide
298
-
299
- ```bash
300
- # Clone repository
301
- git clone https://github.com/windfallsheng/SpecCore-ts.git
302
- cd SpecCore-ts
303
-
304
- # Install dependencies
305
- npm install
306
-
307
- # Compile TypeScript
308
- npm run build
162
+ ## 🛠️ Tool Support
309
163
 
310
- # Development mode (watch for file changes and auto-compile)
311
- npm run watch
164
+ | CN | Global |
165
+ | :--- | :--- |
166
+ | WorkBuddy / Qcoder / Trae | Cursor / Claude Code / Windsurf / Gemini CLI / OpenCode |
312
167
 
313
- # Local testing
314
- node bin/speccore --version
168
+ SpecCore CLI natively integrates WorkBuddy. Other tools supported via the SpecCore framework.
315
169
 
316
- # Link to global (development testing)
317
- npm link
318
- speccore --version
319
- ```
170
+ > 📚 See [Tool Adaptation](docs/tool-adaptation.en.md)
320
171
 
321
172
  ---
322
173
 
323
- ## Related Projects
174
+ ## 📚 Documentation
324
175
 
325
- | Project | Description | GitHub | Gitee |
326
- | :--- | :--- | :--- | :--- |
327
- | **SpecCore** | Specification-driven development framework (methodology + file templates + Slash Commands) | [windfallsheng/SpecCore](https://github.com/windfallsheng/SpecCore) | [windfullsheng/spec-core](https://gitee.com/windfullsheng/spec-core) |
328
- | **SpecCore** | CLI tool (deterministic operation execution engine) | [windfallsheng/SpecCore-ts](https://github.com/windfallsheng/SpecCore-ts) | [windfullsheng/spec-core-ts](https://gitee.com/windfullsheng/spec-core-ts) |
176
+ | Document | Lang | Content |
177
+ | :--- | :--- | :--- |
178
+ | [Quick Start](docs/quick-start.en.md) | 🇬🇧 | Install Init Import Multi-platform Scenarios |
179
+ | [快速开始指南](docs/快速开始.md) | 🇨🇳 | 安装 初始化 导入 多端 Task → 场景速查 |
180
+ | [Command Reference](docs/commands.en.md) | 🇬🇧 | 39 commands full params + 31 intents + aliases |
181
+ | [命令参考手册](docs/命令参考.md) | 🇨🇳 | 39 个命令完整参数 + 31 种意图映射 + 别名速查 |
182
+ | [Tool Adaptation](docs/tool-adaptation.en.md) | 🇬🇧 | WorkBuddy integration + workflow + security |
183
+ | [工具适配说明](docs/工具适配说明.md) | 🇨🇳 | WorkBuddy 集成原理 + 工作流程 + 安全检查 |
184
+ | [CHANGELOG](CHANGELOG.md) | 🇨🇳 | Version history (v1.0.0 → v4.0.0) |
185
+ | [README.md](README.md) | 🇨🇳 | 中文项目概述 |
329
186
 
330
187
  ---
331
188
 
332
189
  ## FAQ
333
190
 
334
- ### Q: Command not found after installation?
335
-
336
- A: Ensure npm global bin directory is in PATH:
337
-
338
- ```bash
339
- # Check global installation path
340
- npm bin -g
341
-
342
- # Add to PATH (macOS/Linux)
343
- export PATH="$(npm bin -g):$PATH"
344
- ```
345
-
346
- ### Q: How to update to latest version?
347
-
348
- ```bash
349
- npm update -g speccore
350
- ```
351
-
352
- ### Q: How to uninstall?
353
-
354
- ```bash
355
- npm uninstall -g speccore
356
- ```
191
+ | Q | A |
192
+ | :--- | :--- |
193
+ | **Command not found?** | Add npm bin to PATH: `export PATH="$(npm bin -g):$PATH"` |
194
+ | **How to update?** | `npm update -g speccore` |
195
+ | **Same feature on Web+H5+MiniApp?** | `speccore new-task --platforms=web,h5,miniapp` |
196
+ | **Add new platform?** | `speccore platform-add --name=tablet --tech="React Native"` |
197
+ | **Rename iteration/task?** | `speccore rename --target=old --new-name=new` |
198
+ | **Batch rename?** | `speccore rename --batch --pattern="Task-" --replacement="Feature-"` |
199
+ | **Rebuild requirement index?** | `speccore index-update` (--dry-run to preview) |
357
200
 
358
- ### Q: How to integrate with AI tools?
201
+ ---
359
202
 
360
- A: AI tools (like WorkBuddy) execute deterministic operations by calling CLI commands. For example:
203
+ ## Development
361
204
 
362
205
  ```bash
363
- # When AI executes /spec-validate, it internally calls:
364
- speccore validate --json
365
-
366
- # AI reads JSON results and generates user-friendly reports
206
+ git clone https://github.com/windfallsheng/SpecCore-ts.git
207
+ cd SpecCore-ts/ts-cli
208
+ npm install && npm run build
209
+ npm run watch # Dev mode
210
+ npm link && speccore --version # Local test
211
+ bash verify.sh # Run tests
367
212
  ```
368
213
 
369
214
  ---
370
215
 
371
- ## Contributing
372
-
373
- Welcome to submit Issues and Pull Requests!
216
+ ## Related Projects
374
217
 
375
- 1. Fork this repository
376
- 2. Create feature branch: `git checkout -b feature/my-feature`
377
- 3. Commit changes: `git commit -m 'feat: add some feature'`
378
- 4. Push branch: `git push origin feature/my-feature`
379
- 5. Create Pull Request
218
+ | Project | Description | Link |
219
+ | :--- | :--- | :--- |
220
+ | **SpecCore Framework** | Spec-driven methodology + Slash Commands + templates | [GitHub](https://github.com/windfallsheng/SpecCore) |
221
+ | **SpecCore CLI** | TypeScript CLI tool (deterministic execution engine) | [GitHub](https://github.com/windfallsheng/SpecCore-ts) |
380
222
 
381
223
  ---
382
224
 
383
- ## Changelog
225
+ ## Version
384
226
 
385
- ### v1.0.0 (2026-07-05)
227
+ v4.0.0 | 🔧 CLI Commands: 39 | 🧠 Intents: 31
386
228
 
387
- - Initial release
388
- - Supports 14 CLI commands
389
- - Core engine: context management, state management, YAML parsing, template rendering, compliance checking
390
- - Built-in templates: Spring Boot Controller/Service/Test, NestJS Controller
391
- - Support JSON/Markdown/HTML multi-format output
229
+ Changelog: [CHANGELOG.md](CHANGELOG.md)
392
230
 
393
231
  ---
394
232
 
@@ -398,4 +236,4 @@ Welcome to submit Issues and Pull Requests!
398
236
 
399
237
  ---
400
238
 
401
- <p align="center">Built with ❤️ by the SpecCore Team</p>
239
+ <p align="center">Built with ❤️ by the SpecCore Team</p>
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # SpecCore
1
+ # SpecCore CLI
2
2
 
3
3
  > **Code by Spec, Not by Vibe.**
4
4
 
@@ -6,34 +6,68 @@
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
  [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
8
8
 
9
- SpecCore 是 [SpecCore](https://github.com/spec-core/spec-core) 规范驱动开发框架的官方命令行工具。它将确定性操作(文件创建、目录管理、格式校验、状态统计)从 AI 中剥离,由代码直接执行,提升效率并降低 Token 消耗。
9
+ SpecCore CLI 是 [SpecCore 规范驱动开发框架](https://github.com/windfallsheng/SpecCore) 的官方 TypeScript 命令行工具。它将确定性操作(文件创建、目录管理、格式校验、状态统计)从 AI 中剥离,由代码直接执行,提升效率并降低 Token 消耗。
10
10
 
11
11
  ---
12
12
 
13
- ## 一分钟了解
13
+ ## 🧩 两种使用方式
14
14
 
15
- | 问题 | 答案 |
16
- | :--- | :--- |
17
- | **这是什么?** | SpecCore 框架的 CLI 工具,确定性操作由代码执行,智能决策由 AI 负责 |
18
- | **解决什么问题?** | AI 做文件操作容易出错、Token 消耗高、上下文窗口浪费 |
19
- | **需要安装什么?** | Node.js >= 18,执行 `npm install -g speccore` |
20
- | **和 Slash Command 的关系?** | CLI Slash Command 的底层执行引擎,AI 负责决策,CLI 负责执行 |
15
+ SpecCore 由两部分组成,**职责明确,互不混淆**:
16
+
17
+ | | 🔧 终端命令(CLI | 🤖 AI 命令(Slash Command) |
18
+ | :--- | :--- | :--- |
19
+ | **在哪里执行** | 终端 / Terminal | AI 编程工具(WorkBuddy / Cursor / Claude 等) |
20
+ | **怎么用** | `speccore init` | 输入 `/spec-xxx` |
21
+ | **什么原理** | TypeScript 编译,直接操作文件 | Markdown 指令,AI 读取后执行 |
22
+ | **数量** | 39 个 CLI 命令 | 39 个 Slash Command |
23
+ | **何时用** | 项目初始化、文件校验、批量操作 | 日常开发:需求管理、开发执行、审查归档 |
24
+
25
+ > 💡 **简单记忆**:`speccore` 开头 → 终端执行;`/spec` 开头 → AI 工具中执行。
26
+
27
+ ---
28
+
29
+ ## 📦 安装
30
+
31
+ ```bash
32
+ npm install -g speccore # 全局安装(推荐)
33
+ npx speccore --version # 或使用 npx
34
+ ```
35
+
36
+ ---
37
+
38
+ ## 🚀 快速开始(5 分钟)
39
+
40
+ ```bash
41
+ # 1. 初始化项目
42
+ cd my-project && speccore init
43
+
44
+ # 2. 导入项目到全量层
45
+ speccore import --project=user-service --path=./backend --type=backend
46
+
47
+ # 3. 创建期次
48
+ speccore iteration create --name 2026-07-用户系统
49
+
50
+ # 4. 创建多平台 Task
51
+ speccore new-task --name 用户登录 --platforms=web,h5
52
+
53
+ # 5. 自然语言入口
54
+ speccore spec "进度怎么样了"
55
+ ```
56
+
57
+ > 📚 更多场景和详细步骤见 [快速开始指南](docs/快速开始.md)
21
58
 
22
59
  ---
23
60
 
24
61
  ## 特性亮点
25
62
 
26
- - **🚀 快速初始化**:一行命令初始化完整的 SpecCore 项目结构
27
- - **📁 智能目录管理**:自动创建期次、任务、共享资源目录,符合规范
63
+ - **🚀 快速初始化**:一行命令初始化完整 SpecCore 项目结构,自动集成 WorkBuddy
64
+ - **📱 多平台支持**:`--platforms=web,h5,miniapp` 按端管理 Task,动态添加平台类型
65
+ - **🧠 意图识别引擎**:31 种意图类型,200+ 关键词,自然语言自动匹配命令
66
+ - **🌐 多项目全量层**:GLOBAL/ 统一管理跨项目需求索引、架构和技术栈
67
+ - **📊 实时进度追踪**:自动识别活跃期次,统计任务完成率,按平台/人员/类型统计
28
68
  - **✅ 自动合规检查**:扫描所有 Spec 文件,检查必填项和格式
29
- - **📊 实时进度追踪**:自动识别活跃期次,统计任务完成率
30
- - **🏥 健康度看板**:4 维度 12 指标评估项目健康状态
31
- - **📈 一键报告**:支持 Markdown/HTML/JSON 格式输出项目报告
32
- - **🧠 意图识别引擎**:23 种意图类型,200+ 关键词匹配,自然语言→命令自动匹配
33
- - **🧠 上下文感知**:自动读取 `.speccore/local/context.json`,智能填充默认值
69
+ - **🏥 项目健康度**:4 维度 12 指标评估项目健康状态
34
70
  - **🔄 确定性执行**:文件操作、格式校验、状态统计全部本地代码执行,零 Token 消耗
35
- - **🌐 多项目全量层**:GLOBAL/ 目录管理跨项目需求索引、架构、技术栈
36
- - **📱 多平台支持**:Web/H5/小程序多端 Task 管理,平台动态添加
37
71
 
38
72
  ---
39
73
 
@@ -43,15 +77,15 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
43
77
 
44
78
  | 逻辑类型 | 职责 | 执行方 | 示例 |
45
79
  | :--- | :--- | :--- | :--- |
46
- | **确定性逻辑** | 结构化操作 | CLI 代码 | 创建目录、移动文件、解析 YAML、校验格式、统计状态 |
47
- | **智能逻辑** | 理解与决策 | AI | 理解需求、拆分任务、生成代码、审查产出 |
80
+ | **确定性逻辑** | 结构化操作 | CLI 代码 | 创建目录、读写文件、解析 YAML、校验格式、统计状态 |
81
+ | **智能逻辑** | 理解与决策 | AI 工具 | 理解需求、拆分任务、生成代码、审查产出 |
48
82
 
49
83
  ```
50
- 用户输入 (Slash Command)
84
+ 用户输入(自然语言 / Slash Command
51
85
 
52
86
 
53
87
  ┌───────────────────────────────────────┐
54
- │ AI 层 (智能决策)
88
+ │ AI 层(智能决策)
55
89
  │ - 理解用户意图 │
56
90
  │ - 决定执行哪些操作 │
57
91
  │ - 生成代码内容 │
@@ -59,293 +93,112 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
59
93
  │ 调用 CLI 命令
60
94
 
61
95
  ┌───────────────────────────────────────┐
62
- │ CLI 层 (确定性执行)
96
+ │ CLI 层(确定性执行)
63
97
  │ - 创建目录结构 │
64
- │ - 读写文件
98
+ │ - 读写配置和 Spec 文件
65
99
  │ - 解析 YAML │
66
- │ - 校验格式
67
- │ - 输出 JSON 结果
100
+ │ - 合规校验
101
+ │ - 输出结构化结果(JSON/Markdown)
68
102
  └───────────────────────────────────────┘
69
103
  ```
70
104
 
71
- **核心收益**:目录检查、YAML 解析、状态统计由代码确定执行,AI 只负责"解读结果"和"格式化输出",Token 消耗大幅降低。
72
-
73
105
  ---
74
106
 
75
- ## 环境要求
76
-
77
- - **Node.js**: >= 18.0.0
78
- - **操作系统**: macOS / Linux / Windows
107
+ ## 🔧 终端命令速查(39 个 CLI 命令)
108
+
109
+ > 在终端中执行,所有命令以 `speccore` 开头。
110
+
111
+ | 分类 | 命令 | 说明 |
112
+ | :--- | :--- | :--- |
113
+ | 🧠 智能入口 | `speccore spec "<query>"` | 自然语言意图识别 |
114
+ | 🌐 初始化/导入 | `speccore init` / `import` | 项目初始化 + 多项目导入 |
115
+ | 📐 计划 | `speccore iteration create/split` / `new-task` / `plan` | 期次管理 + Task 创建 |
116
+ | | `speccore iteration-from-global` | 从全量层生成期次 |
117
+ | ⚡ 执行 | `speccore execute` | 执行控制中心(--platform / --priority) |
118
+ | 🔄 变更 | `speccore change` / `sync` / `sync-global` | 需求变更 + 反向同步 + 全量同步 |
119
+ | ✅ 审查 | `speccore validate` | 合规性检查(--fix) |
120
+ | 📊 进度 | `speccore progress` / `status` | 进度总览(--platform / --detail) |
121
+ | 🔬 分析 | `speccore impact` / `baseline` / `dashboard` / `audit` | 影响分析 + 基线 + 仪表盘 + 审计 |
122
+ | 🌐 全量层 | `speccore global-status` / `history` / `index-update` | 全量状态 + 历史 + 索引更新 |
123
+ | 📱 平台 | `speccore platform-add` / `context` | 动态平台 + 上下文查看 |
124
+ | 🎯 场景 | `speccore goal` / `bugfix` / `research` / `handover` / `retro` | 端到端需求 + Bug + 调研 + 交接 + 回顾 |
125
+ | 🛠️ 工具 | `speccore health` / `report` / `archive` / `config` / `rename` / `template-add` / `help` / `demo` / `welcome` | 健康度 + 报告 + 归档 + 配置 + 重命名等 |
126
+
127
+ ## 🤖 AI 命令(Slash Command)对应关系
128
+
129
+ > 在 AI 工具(WorkBuddy / Cursor / Claude Code 等)中输入 `/` + 命令。AI 命令在底层调用对应的 CLI 命令执行。
130
+
131
+ | CLI 终端命令 | AI Slash Command | 用途 |
132
+ | :--- | :--- | :--- |
133
+ | `speccore init` | `/spec-init` | 项目初始化 |
134
+ | `speccore import` | `/spec-import` | 导入项目到全量层 |
135
+ | `speccore iteration create` | `/spec-iteration-create` | 创建期次 |
136
+ | `speccore new-task` | `/spec-new-task` | 创建多平台 Task |
137
+ | `speccore execute` | `/spec-execute` | 执行开发任务 |
138
+ | `speccore progress` | `/spec-progress` | 查看进度 |
139
+ | `speccore validate` | `/spec-validate` | 合规性检查 |
140
+ | `speccore impact` | `/spec-impact` | 变更影响分析 |
141
+ | `speccore audit` | `/spec-ai-audit` | AI 智能审计 |
142
+ | `speccore spec "查询"` | `/spec 查询` | 自然语言智能入口 |
143
+
144
+ > 📋 完整命令参数见 [命令参考手册](docs/命令参考.md) | 🧠 31 种意图映射见 [意图映射表](docs/命令参考.md#自然语言意图映射31-种)
79
145
 
80
146
  ---
81
147
 
82
- ## 安装
83
-
84
- ```bash
85
- # 全局安装(推荐)
86
- npm install -g speccore
87
-
88
- # 或使用 npx(无需安装,每次使用最新版)
89
- npx speccore --version
148
+ ## 🏗️ 架构
90
149
 
91
- # 或安装指定版本
92
- npm install -g speccore@1.0.0
93
150
  ```
94
-
95
- ---
96
-
97
- ## 快速开始
98
-
99
- ### 1. 初始化项目
100
-
101
- ```bash
102
- # 进入你的项目目录
103
- cd my-project
104
-
105
- # 初始化 SpecCore
106
- speccore init --mode fresh
107
-
108
- # 或迁移现有项目
109
- speccore init --mode migration
110
- ```
111
-
112
- 执行后,当前目录会生成:
113
-
114
- ```
115
- .speccore/ # 全局配置目录
116
- ├── CONSTITUTION.md # 技术宪法(定义技术栈、规范)
117
- ├── SETTINGS.md # 框架配置(开关、模式)
118
- ├── ITERATIONS/ # 期次记录
119
- ├── PATTERNS/ # 模式库
120
- ├── PROJECT/ # 项目级资产
121
- │ ├── OVERVIEW.md
122
- │ ├── TEAM.md
123
- │ └── ...
124
- ├── RULES/ # 裁决规则
125
- └── local/ # 本地状态
126
- └── context.json # 当前上下文(期次、任务、用户)
127
- ```
128
-
129
- ### 2. 创建期次
130
-
131
- ```bash
132
- speccore iteration create --name 2026-07-用户系统
133
- ```
134
-
135
- 生成 `期次-2026-07-用户系统/` 目录,包含:
136
- - `00-需求文档/REQUIREMENT.md`
137
- - `00-技术文档/ARCHITECTURE.md`
138
- - `00-期次总览/PROJECT_GRAPH.md`
139
-
140
- ### 3. 创建任务
141
-
142
- ```bash
143
- speccore task new --name 用户登录 --type feature
144
- speccore task new --name 手机号注册 --type feature
145
- speccore task new --name 密码重置 --type bugfix
146
- ```
147
-
148
- ### 4. 查看进度
149
-
150
- ```bash
151
- # 查看整体进度
152
- speccore progress
153
-
154
- # JSON 格式输出(适合 CI/CD)
155
- speccore progress --format json
156
-
157
- # 查看详细进度
158
- speccore progress --detail
159
- ```
160
-
161
- ### 5. 验证合规性
162
-
163
- ```bash
164
- # 验证所有任务
165
- speccore validate
166
-
167
- # 自动修复可修复的问题
168
- speccore validate --fix
169
-
170
- # JSON 格式输出(AI 可直接读取)
171
- speccore validate --format json
172
- ```
173
-
174
- ### 6. 生成报告
175
-
176
- ```bash
177
- # Markdown 格式(默认)
178
- speccore report
179
-
180
- # HTML 格式(适合邮件发送)
181
- speccore report --format html --output ./report.html
182
-
183
- # JSON 格式(适合导入其他系统)
184
- speccore report --format json
185
-
186
- # 包含团队分析和风险分析
187
- speccore report --team --risk
151
+ .speccore/GLOBAL/ ← 全量层:多项目统一需求管理
152
+ .speccore/ ← 全局层:项目宪法、配置、模式
153
+ 期次-XXX/ ← 期次层:这一期做什么
154
+ └── Task-XXX/ ← 任务层:这个功能怎么做
155
+ ├── _shared/ ← 共享层:API Contract + 业务规则
156
+ ├── backend/ ← 后端 Spec
157
+ └── frontend/ ← 前端多端 Spec(web / h5 / miniapp)
188
158
  ```
189
159
 
190
160
  ---
191
161
 
192
- ## 完整命令列表
193
-
194
- ### 初始化与导入
162
+ ## 🛠️ 工具适配
195
163
 
196
- | 命令 | 别名 | 说明 | 确定性 |
197
- | :--- | :--- | :--- | :--- |
198
- | `speccore init` | `in` | 初始化 SpecCore 项目(含 WorkBuddy 集成) | |
199
- | `speccore import` | `imp` | 导入项目到全量层(支持 --scope/--ignore/--update) | ✅ |
200
-
201
- ### 智能入口
202
-
203
- | 命令 | 别名 | 说明 | 确定性 |
204
- | :--- | :--- | :--- | :--- |
205
- | `speccore spec "<query>"` | — | 自然语言意图识别,自动匹配命令 | ⚠️ |
206
-
207
- ### 期次管理
208
-
209
- | 命令 | 别名 | 说明 | 确定性 |
210
- | :--- | :--- | :--- | :--- |
211
- | `speccore iteration create` | `it cr` | 创建期次 | ✅ |
212
- | `speccore iteration split` | `it sp` | 需求拆分 | ⚠️ |
213
- | `speccore iteration-from-global` | `ifg` | 从全量层生成期次 | ⚠️ |
214
-
215
- ### 任务管理 (v4.0 增强)
216
-
217
- | 命令 | 别名 | 说明 | 确定性 |
218
- | :--- | :--- | :--- | :--- |
219
- | `speccore new-task` | `nt` | 创建多平台原子任务(--platforms) | ✅ |
220
- | `speccore task new` | `ch nt-` | 创建传统单任务 | ✅ |
221
-
222
- ### 执行与调度 (v4.0 增强)
223
-
224
- | 命令 | 别名 | 说明 | 确定性 |
225
- | :--- | :--- | :--- | :--- |
226
- | `speccore plan` | `pl` | 生成调度方案(DAG 分析) | ✅ |
227
- | `speccore execute` | `ex` | 执行任务(支持 --platform/--priority/--status) | ⚠️ |
228
-
229
- ### 变更与同步
230
-
231
- | 命令 | 别名 | 说明 | 确定性 |
232
- | :--- | :--- | :--- | :--- |
233
- | `speccore change` | `cg` | 需求变更联动 | ⚠️ |
234
- | `speccore sync` | `sy` | 代码→Spec 反向同步 | ⚠️ |
235
- | `speccore sync-global` | `sg` | 期次↔全量层双向同步 | ✅ |
236
-
237
- ### 验证与审查
238
-
239
- | 命令 | 别名 | 说明 | 确定性 |
240
- | :--- | :--- | :--- | :--- |
241
- | `speccore validate` | `rv` | 合规性检查 | ✅ |
242
- | `speccore progress` | `pg` | 进度查看(支持 --platform) | ✅ |
243
- | `speccore status` | `st` | 项目状态 | ✅ |
244
- | `speccore health` | `hl` | 健康度看板(4维度12指标) | ✅ |
245
- | `speccore report` | `rp` | 生成项目报告 | ✅ |
246
-
247
- ### 分析审计
248
-
249
- | 命令 | 别名 | 说明 | 确定性 |
250
- | :--- | :--- | :--- | :--- |
251
- | `speccore impact` | `if` | 变更影响分析 | ⚠️ |
252
- | `speccore baseline` | `bl` | 版本基线管理 | ✅ |
253
- | `speccore dashboard` | `db` | 可视化仪表盘(Chart.js HTML) | ✅ |
254
- | `speccore audit` | `ad` | AI 智能审计 | ⚠️ |
255
-
256
- ### 全量层管理
164
+ | 国内 | 国际 |
165
+ | :--- | :--- |
166
+ | WorkBuddy / Qcoder / Trae | Cursor / Claude Code / Windsurf / Gemini CLI / OpenCode |
257
167
 
258
- | 命令 | 别名 | 说明 | 确定性 |
259
- | :--- | :--- | :--- | :--- |
260
- | `speccore global-status` | `gs` | 全量层状态总览 | ✅ |
261
- | `speccore history` | `hs` | 需求变更历史 | ✅ |
262
- | `speccore index-update` | `iu` | 扫描需求重建 GLOBAL/INDEX | ✅ |
168
+ SpecCore CLI 原生集成 WorkBuddy(`speccore init` 自动创建 `.workbuddy/` skill 和 memory)。其他工具通过 SpecCore 源项目适配。
263
169
 
264
- ### 工具与场景 (v4.0 新增)
170
+ > 📚 完整适配说明见 [工具适配说明](docs/工具适配说明.md)
265
171
 
266
- | 命令 | 别名 | 说明 | 确定性 |
267
- | :--- | :--- | :--- | :--- |
268
- | `speccore goal` | — | 完整需求交付(需求→代码全流程) | ⚠️ |
269
- | `speccore bugfix` | `bf` | 快速 Bug 修复 | ⚠️ |
270
- | `speccore research` | `rs` | 技术调研 | ⚠️ |
271
- | `speccore handover` | `ho` | 交接文档生成 | ✅ |
272
- | `speccore retro` | `rt` | 期次回顾总结 | ⚠️ |
273
- | `speccore rename` | `rn` | 重命名期次/任务(自动更新引用) | ✅ |
274
- | `speccore platform-add` | `padd` | 动态添加前端平台类型 | ✅ |
275
- | `speccore context` | `ctx` | 查看 Task 上下文和依赖链 | ✅ |
276
-
277
- ### 辅助命令
278
-
279
- | 命令 | 别名 | 说明 | 确定性 |
280
- | :--- | :--- | :--- | :--- |
281
- | `speccore template-add` | `ta` | 添加代码模板 | ✅ |
282
- | `speccore archive` | `ar` | 归档任务 | ✅ |
283
- | `speccore config` | `cf` | 配置管理 | ✅ |
284
- | `speccore help` | `hp` | 命令帮助 | ✅ |
285
- | `speccore demo` | `dm` | 快速体验 | ✅ |
286
- | `speccore welcome` | `wc` | 首次使用引导 | ✅ |
172
+ ---
287
173
 
288
- - **✅** 纯确定性逻辑,可完全由代码执行
289
- - **⚠️** 需要 AI 参与理解/生成
174
+ ## 📚 文档
290
175
 
291
- > **命令总数:39 个**(v4.0.0)
176
+ | 文档 | 语言 | 内容 |
177
+ | :--- | :--- | :--- |
178
+ | [快速开始指南](docs/快速开始.md) | 🇨🇳 | 安装 → 初始化 → 导入 → 多端 Task → 场景速查 |
179
+ | [Quick Start](docs/quick-start.en.md) | 🇬🇧 | Install → Init → Import → Multi-platform → Scenarios |
180
+ | [命令参考手册](docs/命令参考.md) | 🇨🇳 | 39 个命令完整参数 + 31 种意图映射 + 别名速查 |
181
+ | [Command Reference](docs/commands.en.md) | 🇬🇧 | 39 commands full params + 31 intents + aliases |
182
+ | [工具适配说明](docs/工具适配说明.md) | 🇨🇳 | WorkBuddy 集成原理 + 工作流程 + 安全检查 |
183
+ | [Tool Adaptation](docs/tool-adaptation.en.md) | 🇬🇧 | WorkBuddy integration + workflow + security |
184
+ | [CHANGELOG](CHANGELOG.md) | 🇨🇳 | 版本历史与更新日志(v1.0.0 → v4.0.0) |
185
+ | [README.en.md](README.en.md) | 🇬🇧 | English project overview |
292
186
 
293
187
  ---
294
188
 
295
- ## 项目结构
189
+ ## 常见问题
296
190
 
297
- ```
298
- speccore/
299
- ├── package.json
300
- ├── tsconfig.json
301
- ├── README.md
302
- ├── bin/
303
- │ └── speccore # CLI 入口脚本
304
- ├── src/
305
- │ ├── index.ts # 入口文件
306
- │ ├── cli.ts # CLI 命令注册(Commander.js)
307
- │ │
308
- │ ├── commands/ # 所有 CLI 命令实现
309
- │ │ ├── init.ts # 初始化项目
310
- │ │ ├── import.ts # 导入现有项目
311
- │ │ ├── iteration/
312
- │ │ │ ├── create.ts # 创建期次
313
- │ │ │ └── split.ts # 需求拆分
314
- │ │ ├── task/
315
- │ │ │ └── new.ts # 创建任务
316
- │ │ ├── plan.ts # 生成调度方案
317
- │ │ ├── execute.ts # 执行任务
318
- │ │ ├── validate.ts # 合规性检查
319
- │ │ ├── archive.ts # 归档任务
320
- │ │ ├── progress.ts # 进度查看
321
- │ │ ├── status.ts # 项目状态
322
- │ │ ├── health.ts # 健康度看板
323
- │ │ ├── report.ts # 生成报告
324
- │ │ └── config.ts # 配置管理
325
- │ │
326
- │ ├── core/ # 核心引擎
327
- │ │ ├── context.ts # 上下文管理(读取 context.json)
328
- │ │ ├── state.ts # 状态管理(读取 PROJECT_GRAPH.md)
329
- │ │ ├── yaml-parser.ts # YAML 解析
330
- │ │ ├── template-engine.ts # 模板渲染(Handlebars)
331
- │ │ └── validator.ts # 合规性检查引擎
332
- │ │
333
- │ ├── templates/ # 内置模板
334
- │ │ ├── spec/ # Spec 文件模板
335
- │ │ │ └── project-readme.md
336
- │ │ └── code/ # 代码生成模板
337
- │ │ ├── spring-controller.java
338
- │ │ ├── spring-service.java
339
- │ │ ├── spring-test.java
340
- │ │ └── nest-controller.ts
341
- │ │
342
- │ └── utils/
343
- │ ├── file.ts # 文件工具
344
- │ ├── git.ts # Git 工具(获取用户名等)
345
- │ └── logger.ts # 日志输出(含进度条、Spinner)
346
-
347
- └── dist/ # 编译输出(TypeScript → JavaScript)
348
- ```
191
+ | 问题 | 答案 |
192
+ | :--- | :--- |
193
+ | **安装后命令找不到?** | 确保 npm bin 目录在 PATH 中:`export PATH="$(npm bin -g):$PATH"` |
194
+ | **如何更新?** | `npm update -g speccore` |
195
+ | **同一个功能多端怎么管理?** | `speccore new-task --platforms=web,h5,miniapp`,按端执行和统计 |
196
+ | **如何添加新平台?** | `speccore platform-add --name=tablet --tech="React Native"` |
197
+ | **期次/Task 想改名?** | `speccore rename --target=旧名 --new-name=新名` |
198
+ | **批量重命名?** | `speccore rename --batch --pattern="Task-" --replacement="Feature-"` |
199
+ | **手动改了文档,需要同步?** | `speccore sync --task=Task-001` 或 `speccore sync-global` |
200
+ | **需求编号重复?** | `speccore validate --fix` 自动检测修复 |
201
+ | **如何重建需求索引?** | `speccore index-update`(--dry-run 预览) |
349
202
 
350
203
  ---
351
204
 
@@ -353,73 +206,38 @@ speccore/
353
206
 
354
207
  ```bash
355
208
  # 克隆仓库
356
- git clone https://github.com/spec-core/speccore.git
357
- cd speccore
209
+ git clone https://github.com/windfallsheng/SpecCore-ts.git
210
+ cd SpecCore-ts/ts-cli
358
211
 
359
- # 安装依赖
360
- npm install
212
+ # 安装依赖 + 编译
213
+ npm install && npm run build
361
214
 
362
- # 编译 TypeScript
363
- npm run build
364
-
365
- # 开发模式(监听文件变化自动编译)
215
+ # 开发模式
366
216
  npm run watch
367
217
 
368
218
  # 本地测试
369
- node bin/speccore --version
219
+ npm link && speccore --version
370
220
 
371
- # 链接到全局(开发测试)
372
- npm link
373
- speccore --version
221
+ # 运行验证脚本
222
+ bash verify.sh
374
223
  ```
375
224
 
376
225
  ---
377
226
 
378
- ## 常见问题
379
-
380
- ### Q: 安装后命令找不到?
381
-
382
- A: 确保 npm 全局 bin 目录在 PATH 中:
383
-
384
- ```bash
385
- # 查看全局安装路径
386
- npm bin -g
387
-
388
- # 添加到 PATH(macOS/Linux)
389
- export PATH="$(npm bin -g):$PATH"
390
- ```
391
-
392
- ### Q: 如何更新到最新版本?
393
-
394
- ```bash
395
- npm update -g speccore
396
- ```
397
-
398
- ### Q: 如何卸载?
399
-
400
- ```bash
401
- npm uninstall -g speccore
402
- ```
403
-
404
- ### Q: 与 AI 工具如何配合?
405
-
406
- A: AI 工具(如 WorkBuddy)通过调用 CLI 命令来执行确定性操作。例如:
407
-
408
- ```bash
409
- # AI 执行 /spec-validate 时,内部调用:
410
- speccore validate --json
227
+ ## 相关项目
411
228
 
412
- # AI 读取 JSON 结果,生成用户友好的中文报告
413
- ```
229
+ | 项目 | 说明 | 链接 |
230
+ | :--- | :--- | :--- |
231
+ | **SpecCore 框架** | 规范驱动开发方法论 + Slash Commands + 模板 | [GitHub](https://github.com/windfallsheng/SpecCore) |
232
+ | **SpecCore CLI** | TypeScript CLI 工具(确定性操作执行引擎) | [GitHub](https://github.com/windfallsheng/SpecCore-ts) |
414
233
 
415
234
  ---
416
235
 
417
- ## 相关项目
236
+ ## 版本
418
237
 
419
- | 项目 | 说明 | GitHub | Gitee |
420
- | :--- | :--- | :--- | :--- |
421
- | **SpecCore** | 规范驱动开发框架(方法论 + 文件模板 + Slash Commands) | [windfallsheng/SpecCore](https://github.com/windfallsheng/SpecCore) | [windfullsheng/spec-core](https://gitee.com/windfullsheng/spec-core) |
422
- | **SpecCore** | CLI 工具(确定性操作执行引擎) | [windfallsheng/SpecCore-ts](https://github.com/windfallsheng/SpecCore-ts) | [windfullsheng/spec-core-ts](https://gitee.com/windfullsheng/spec-core-ts) |
238
+ v4.0.0 | 🔧 CLI 命令 39 | 🧠 意图识别 31 种
239
+
240
+ 版本历史见 [CHANGELOG.md](CHANGELOG.md)
423
241
 
424
242
  ---
425
243
 
@@ -435,41 +253,6 @@ speccore validate --json
435
253
 
436
254
  ---
437
255
 
438
- ## 更新日志
439
-
440
- ### v4.0.0 (2026-07-09) — 最新
441
-
442
- - 🆕 **新增命令**:`new-task`(多平台任务创建)、`platform-add`(动态添加平台)、`index-update`(重建全量索引)、`context`(上下文查看)
443
- - 📱 **多平台支持**:.speccore/config/platforms.yaml 平台配置,Task 目录支持 frontend/{web,h5,miniapp}/
444
- - 🔧 **命令增强**:`execute` 增加 --platform;`progress` 增加 --platform;`import` 增加 --scope/--ignore/--update
445
- - 🧠 **意图识别升级**:31 种意图类型(新增 new_task/platform_add/index_update/context)
446
- - 🤖 **WorkBuddy 集成**:`speccore init` 自动创建 .workbuddy/ skill 和 memory 文件
447
- - 📋 **命令总数**:39 个(原 35 + 新增 4)
448
-
449
- ### v3.0.0 (2026-07-05)
450
-
451
- - 🌐 **多项目全量层**:GLOBAL/ 目录管理跨项目需求索引、架构、技术栈
452
- - 🔗 **全链路可追溯**:需求→Task→代码双向追踪
453
- - 📊 **P0/P1/P2 命令**:impact(影响分析)、baseline(基线管理)、dashboard(仪表盘)、audit(智能审计)
454
- - ✏️ **rename 命令**:重命名期次/任务自动更新引用
455
- - 📋 **命令总数**:35 个(原 26 + 新增 4 + rename + 全量层)
456
-
457
- ### v2.0.0 (2026-07-05)
458
-
459
- - 🧠 **意图识别引擎**:12 种意图类型、100+ 关键词匹配
460
- - 🚀 **新增命令**:spec(智能入口)、goal、bugfix、research、change、sync、handover、retro、template-add、help、demo、welcome
461
- - 📋 **命令总数**:26 个
462
-
463
- ### v1.0.0 (2026-07-05)
464
-
465
- - 🎉 初始版本发布
466
- - 支持 14 个 CLI 命令
467
- - 核心引擎:上下文管理、状态管理、YAML 解析、模板渲染、合规检查
468
- - 内置模板:Spring Boot Controller/Service/Test、NestJS Controller
469
- - 支持 JSON/Markdown/HTML 多格式输出
470
-
471
- ---
472
-
473
256
  ## License
474
257
 
475
258
  [MIT](https://opensource.org/licenses/MIT)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speccore",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "SpecCore - Code by Spec, Not by Vibe.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",