speccore 1.0.1 → 4.0.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/README.en.md +131 -312
- package/README.md +134 -292
- package/dist/cli.js +46 -8
- package/dist/cli.js.map +1 -1
- package/dist/commands/context.d.ts +8 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +180 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/execute.d.ts +1 -0
- package/dist/commands/execute.d.ts.map +1 -1
- package/dist/commands/execute.js +18 -0
- package/dist/commands/execute.js.map +1 -1
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +24 -6
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/index-update.d.ts +8 -0
- package/dist/commands/index-update.d.ts.map +1 -0
- package/dist/commands/index-update.js +180 -0
- package/dist/commands/index-update.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +40 -152
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/new-task.d.ts +15 -0
- package/dist/commands/new-task.d.ts.map +1 -0
- package/dist/commands/new-task.js +208 -0
- package/dist/commands/new-task.js.map +1 -0
- package/dist/commands/platform-add.d.ts +12 -0
- package/dist/commands/platform-add.d.ts.map +1 -0
- package/dist/commands/platform-add.js +111 -0
- package/dist/commands/platform-add.js.map +1 -0
- package/dist/commands/progress.d.ts +1 -0
- package/dist/commands/progress.d.ts.map +1 -1
- package/dist/commands/progress.js +3 -2
- package/dist/commands/progress.js.map +1 -1
- package/dist/core/intent-recognition.d.ts +3 -3
- package/dist/core/intent-recognition.d.ts.map +1 -1
- package/dist/core/intent-recognition.js +41 -2
- package/dist/core/intent-recognition.js.map +1 -1
- package/package.json +1 -1
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,30 +6,67 @@
|
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
|
|
9
|
-
SpecCore 是 [SpecCore](https://github.com/
|
|
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
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
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
|
-
- **🚀
|
|
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
|
-
- **🧠 上下文感知**:自动读取 `.speccore/local/context.json`,智能填充默认值
|
|
69
|
+
- **🏥 项目健康度**:4 维度 12 指标评估项目健康状态
|
|
33
70
|
- **🔄 确定性执行**:文件操作、格式校验、状态统计全部本地代码执行,零 Token 消耗
|
|
34
71
|
|
|
35
72
|
---
|
|
@@ -40,15 +77,15 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
|
|
|
40
77
|
|
|
41
78
|
| 逻辑类型 | 职责 | 执行方 | 示例 |
|
|
42
79
|
| :--- | :--- | :--- | :--- |
|
|
43
|
-
| **确定性逻辑** | 结构化操作 | CLI 代码 |
|
|
44
|
-
| **智能逻辑** | 理解与决策 | AI | 理解需求、拆分任务、生成代码、审查产出 |
|
|
80
|
+
| **确定性逻辑** | 结构化操作 | CLI 代码 | 创建目录、读写文件、解析 YAML、校验格式、统计状态 |
|
|
81
|
+
| **智能逻辑** | 理解与决策 | AI 工具 | 理解需求、拆分任务、生成代码、审查产出 |
|
|
45
82
|
|
|
46
83
|
```
|
|
47
|
-
|
|
84
|
+
用户输入(自然语言 / Slash Command)
|
|
48
85
|
│
|
|
49
86
|
▼
|
|
50
87
|
┌───────────────────────────────────────┐
|
|
51
|
-
│ AI
|
|
88
|
+
│ AI 层(智能决策) │
|
|
52
89
|
│ - 理解用户意图 │
|
|
53
90
|
│ - 决定执行哪些操作 │
|
|
54
91
|
│ - 生成代码内容 │
|
|
@@ -56,241 +93,93 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
|
|
|
56
93
|
│ 调用 CLI 命令
|
|
57
94
|
▼
|
|
58
95
|
┌───────────────────────────────────────┐
|
|
59
|
-
│ CLI
|
|
96
|
+
│ CLI 层(确定性执行) │
|
|
60
97
|
│ - 创建目录结构 │
|
|
61
|
-
│ -
|
|
98
|
+
│ - 读写配置和 Spec 文件 │
|
|
62
99
|
│ - 解析 YAML │
|
|
63
|
-
│ -
|
|
64
|
-
│ -
|
|
100
|
+
│ - 合规校验 │
|
|
101
|
+
│ - 输出结构化结果(JSON/Markdown) │
|
|
65
102
|
└───────────────────────────────────────┘
|
|
66
103
|
```
|
|
67
104
|
|
|
68
|
-
**核心收益**:目录检查、YAML 解析、状态统计由代码确定执行,AI 只负责"解读结果"和"格式化输出",Token 消耗大幅降低。
|
|
69
|
-
|
|
70
105
|
---
|
|
71
106
|
|
|
72
|
-
##
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
## 🤖 AI 命令速查(39 个,按分类)
|
|
108
|
+
|
|
109
|
+
| 分类 | 命令 | 说明 |
|
|
110
|
+
| :--- | :--- | :--- |
|
|
111
|
+
| 🧠 智能入口 | `speccore spec "<query>"` | 自然语言意图识别 |
|
|
112
|
+
| 🌐 初始化/导入 | `speccore init` / `import` | 项目初始化 + 多项目导入 |
|
|
113
|
+
| 📐 计划 | `speccore iteration create/split` / `new-task` / `plan` | 期次管理 + Task 创建 |
|
|
114
|
+
| | `speccore iteration-from-global` | 从全量层生成期次 |
|
|
115
|
+
| ⚡ 执行 | `speccore execute` | 执行控制中心(--platform / --priority) |
|
|
116
|
+
| 🔄 变更 | `speccore change` / `sync` / `sync-global` | 需求变更 + 反向同步 + 全量同步 |
|
|
117
|
+
| ✅ 审查 | `speccore validate` | 合规性检查(--fix) |
|
|
118
|
+
| 📊 进度 | `speccore progress` / `status` | 进度总览(--platform / --detail) |
|
|
119
|
+
| 🔬 分析 | `speccore impact` / `baseline` / `dashboard` / `audit` | 影响分析 + 基线 + 仪表盘 + 审计 |
|
|
120
|
+
| 🌐 全量层 | `speccore global-status` / `history` / `index-update` | 全量状态 + 历史 + 索引更新 |
|
|
121
|
+
| 📱 平台 | `speccore platform-add` / `context` | 动态平台 + 上下文查看 |
|
|
122
|
+
| 🎯 场景 | `speccore goal` / `bugfix` / `research` / `handover` / `retro` | 端到端需求 + Bug + 调研 + 交接 + 回顾 |
|
|
123
|
+
| 🛠️ 工具 | `speccore health` / `report` / `archive` / `config` / `rename` / `template-add` / `help` / `demo` / `welcome` | 健康度 + 报告 + 归档 + 配置 + 重命名等 |
|
|
124
|
+
|
|
125
|
+
> 📋 完整命令参数和别名见 [命令参考手册](docs/命令参考.md) | 🧠 31 种意图映射见 [命令参考—意图映射](docs/命令参考.md#自然语言意图映射31-种)
|
|
76
126
|
|
|
77
127
|
---
|
|
78
128
|
|
|
79
|
-
##
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# 全局安装(推荐)
|
|
83
|
-
npm install -g speccore
|
|
84
|
-
|
|
85
|
-
# 或使用 npx(无需安装,每次使用最新版)
|
|
86
|
-
npx speccore --version
|
|
87
|
-
|
|
88
|
-
# 或安装指定版本
|
|
89
|
-
npm install -g speccore@1.0.0
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
## 快速开始
|
|
95
|
-
|
|
96
|
-
### 1. 初始化项目
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
# 进入你的项目目录
|
|
100
|
-
cd my-project
|
|
101
|
-
|
|
102
|
-
# 初始化 SpecCore
|
|
103
|
-
speccore init --mode fresh
|
|
104
|
-
|
|
105
|
-
# 或迁移现有项目
|
|
106
|
-
speccore init --mode migration
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
执行后,当前目录会生成:
|
|
110
|
-
|
|
111
|
-
```
|
|
112
|
-
.speccore/ # 全局配置目录
|
|
113
|
-
├── CONSTITUTION.md # 技术宪法(定义技术栈、规范)
|
|
114
|
-
├── SETTINGS.md # 框架配置(开关、模式)
|
|
115
|
-
├── ITERATIONS/ # 期次记录
|
|
116
|
-
├── PATTERNS/ # 模式库
|
|
117
|
-
├── PROJECT/ # 项目级资产
|
|
118
|
-
│ ├── OVERVIEW.md
|
|
119
|
-
│ ├── TEAM.md
|
|
120
|
-
│ └── ...
|
|
121
|
-
├── RULES/ # 裁决规则
|
|
122
|
-
└── local/ # 本地状态
|
|
123
|
-
└── context.json # 当前上下文(期次、任务、用户)
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 2. 创建期次
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
speccore iteration create --name 2026-07-用户系统
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
生成 `期次-2026-07-用户系统/` 目录,包含:
|
|
133
|
-
- `00-需求文档/REQUIREMENT.md`
|
|
134
|
-
- `00-技术文档/ARCHITECTURE.md`
|
|
135
|
-
- `00-期次总览/PROJECT_GRAPH.md`
|
|
136
|
-
|
|
137
|
-
### 3. 创建任务
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
speccore task new --name 用户登录 --type feature
|
|
141
|
-
speccore task new --name 手机号注册 --type feature
|
|
142
|
-
speccore task new --name 密码重置 --type bugfix
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### 4. 查看进度
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
# 查看整体进度
|
|
149
|
-
speccore progress
|
|
150
|
-
|
|
151
|
-
# JSON 格式输出(适合 CI/CD)
|
|
152
|
-
speccore progress --format json
|
|
153
|
-
|
|
154
|
-
# 查看详细进度
|
|
155
|
-
speccore progress --detail
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### 5. 验证合规性
|
|
129
|
+
## 🏗️ 架构
|
|
159
130
|
|
|
160
|
-
```bash
|
|
161
|
-
# 验证所有任务
|
|
162
|
-
speccore validate
|
|
163
|
-
|
|
164
|
-
# 自动修复可修复的问题
|
|
165
|
-
speccore validate --fix
|
|
166
|
-
|
|
167
|
-
# JSON 格式输出(AI 可直接读取)
|
|
168
|
-
speccore validate --format json
|
|
169
131
|
```
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
# HTML 格式(适合邮件发送)
|
|
178
|
-
speccore report --format html --output ./report.html
|
|
179
|
-
|
|
180
|
-
# JSON 格式(适合导入其他系统)
|
|
181
|
-
speccore report --format json
|
|
182
|
-
|
|
183
|
-
# 包含团队分析和风险分析
|
|
184
|
-
speccore report --team --risk
|
|
132
|
+
.speccore/GLOBAL/ ← 全量层:多项目统一需求管理
|
|
133
|
+
.speccore/ ← 全局层:项目宪法、配置、模式
|
|
134
|
+
期次-XXX/ ← 期次层:这一期做什么
|
|
135
|
+
└── Task-XXX/ ← 任务层:这个功能怎么做
|
|
136
|
+
├── _shared/ ← 共享层:API Contract + 业务规则
|
|
137
|
+
├── backend/ ← 后端 Spec
|
|
138
|
+
└── frontend/ ← 前端多端 Spec(web / h5 / miniapp)
|
|
185
139
|
```
|
|
186
140
|
|
|
187
141
|
---
|
|
188
142
|
|
|
189
|
-
##
|
|
190
|
-
|
|
191
|
-
### 初始化与导入
|
|
192
|
-
|
|
193
|
-
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
194
|
-
| :--- | :--- | :--- | :--- |
|
|
195
|
-
| `speccore init` | 初始化 SpecCore 项目 | `/spec-init` | ✅ |
|
|
196
|
-
| `speccore import` | 导入现有项目 | `/spec-import` | ✅ |
|
|
197
|
-
|
|
198
|
-
### 期次管理
|
|
199
|
-
|
|
200
|
-
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
201
|
-
| :--- | :--- | :--- | :--- |
|
|
202
|
-
| `speccore iteration create` | 创建期次 | `/spec-iteration-create` | ✅ |
|
|
203
|
-
| `speccore iteration split` | 需求拆分(需 AI 传入任务列表) | `/spec-iteration-split` | ⚠️ |
|
|
204
|
-
|
|
205
|
-
### 任务管理
|
|
206
|
-
|
|
207
|
-
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
208
|
-
| :--- | :--- | :--- | :--- |
|
|
209
|
-
| `speccore task new` | 创建原子任务 | `/spec-new-task` | ✅ |
|
|
143
|
+
## 🛠️ 工具适配
|
|
210
144
|
|
|
211
|
-
|
|
145
|
+
| 国内 | 国际 |
|
|
146
|
+
| :--- | :--- |
|
|
147
|
+
| WorkBuddy / Qcoder / Trae | Cursor / Claude Code / Windsurf / Gemini CLI / OpenCode |
|
|
212
148
|
|
|
213
|
-
|
|
214
|
-
| :--- | :--- | :--- | :--- |
|
|
215
|
-
| `speccore plan` | 生成调度方案(DAG 分析) | `/spec-plan` | ✅ |
|
|
216
|
-
| `speccore execute` | 执行任务(需 AI 协同) | `/spec-execute` | ⚠️ |
|
|
149
|
+
SpecCore CLI 原生集成 WorkBuddy(`speccore init` 自动创建 `.workbuddy/` skill 和 memory)。其他工具通过 SpecCore 源项目适配。
|
|
217
150
|
|
|
218
|
-
|
|
151
|
+
> 📚 完整适配说明见 [工具适配说明](docs/工具适配说明.md)
|
|
219
152
|
|
|
220
|
-
|
|
221
|
-
| :--- | :--- | :--- | :--- |
|
|
222
|
-
| `speccore validate` | 合规性检查 | `/spec-validate` | ✅ |
|
|
223
|
-
| `speccore progress` | 进度查看 | `/spec-progress` | ✅ |
|
|
224
|
-
| `speccore status` | 项目状态 | `/spec-status` | ✅ |
|
|
225
|
-
| `speccore health` | 健康度看板(4维度12指标) | `/spec-health` | ✅ |
|
|
226
|
-
| `speccore report` | 生成项目报告 | `/spec-report` | ✅ |
|
|
153
|
+
---
|
|
227
154
|
|
|
228
|
-
|
|
155
|
+
## 📚 文档
|
|
229
156
|
|
|
230
|
-
|
|
|
231
|
-
| :--- | :--- | :--- |
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
157
|
+
| 文档 | 语言 | 内容 |
|
|
158
|
+
| :--- | :--- | :--- |
|
|
159
|
+
| [快速开始指南](docs/快速开始.md) | 🇨🇳 | 安装 → 初始化 → 导入 → 多端 Task → 场景速查 |
|
|
160
|
+
| [Quick Start](docs/quick-start.en.md) | 🇬🇧 | Install → Init → Import → Multi-platform → Scenarios |
|
|
161
|
+
| [命令参考手册](docs/命令参考.md) | 🇨🇳 | 39 个命令完整参数 + 31 种意图映射 + 别名速查 |
|
|
162
|
+
| [Command Reference](docs/commands.en.md) | 🇬🇧 | 39 commands full params + 31 intents + aliases |
|
|
163
|
+
| [工具适配说明](docs/工具适配说明.md) | 🇨🇳 | WorkBuddy 集成原理 + 工作流程 + 安全检查 |
|
|
164
|
+
| [Tool Adaptation](docs/tool-adaptation.en.md) | 🇬🇧 | WorkBuddy integration + workflow + security |
|
|
165
|
+
| [CHANGELOG](CHANGELOG.md) | 🇨🇳 | 版本历史与更新日志(v1.0.0 → v4.0.0) |
|
|
166
|
+
| [README.en.md](README.en.md) | 🇬🇧 | English project overview |
|
|
237
167
|
|
|
238
168
|
---
|
|
239
169
|
|
|
240
|
-
##
|
|
170
|
+
## 常见问题
|
|
241
171
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
│ ├── commands/ # 所有 CLI 命令实现
|
|
254
|
-
│ │ ├── init.ts # 初始化项目
|
|
255
|
-
│ │ ├── import.ts # 导入现有项目
|
|
256
|
-
│ │ ├── iteration/
|
|
257
|
-
│ │ │ ├── create.ts # 创建期次
|
|
258
|
-
│ │ │ └── split.ts # 需求拆分
|
|
259
|
-
│ │ ├── task/
|
|
260
|
-
│ │ │ └── new.ts # 创建任务
|
|
261
|
-
│ │ ├── plan.ts # 生成调度方案
|
|
262
|
-
│ │ ├── execute.ts # 执行任务
|
|
263
|
-
│ │ ├── validate.ts # 合规性检查
|
|
264
|
-
│ │ ├── archive.ts # 归档任务
|
|
265
|
-
│ │ ├── progress.ts # 进度查看
|
|
266
|
-
│ │ ├── status.ts # 项目状态
|
|
267
|
-
│ │ ├── health.ts # 健康度看板
|
|
268
|
-
│ │ ├── report.ts # 生成报告
|
|
269
|
-
│ │ └── config.ts # 配置管理
|
|
270
|
-
│ │
|
|
271
|
-
│ ├── core/ # 核心引擎
|
|
272
|
-
│ │ ├── context.ts # 上下文管理(读取 context.json)
|
|
273
|
-
│ │ ├── state.ts # 状态管理(读取 PROJECT_GRAPH.md)
|
|
274
|
-
│ │ ├── yaml-parser.ts # YAML 解析
|
|
275
|
-
│ │ ├── template-engine.ts # 模板渲染(Handlebars)
|
|
276
|
-
│ │ └── validator.ts # 合规性检查引擎
|
|
277
|
-
│ │
|
|
278
|
-
│ ├── templates/ # 内置模板
|
|
279
|
-
│ │ ├── spec/ # Spec 文件模板
|
|
280
|
-
│ │ │ └── project-readme.md
|
|
281
|
-
│ │ └── code/ # 代码生成模板
|
|
282
|
-
│ │ ├── spring-controller.java
|
|
283
|
-
│ │ ├── spring-service.java
|
|
284
|
-
│ │ ├── spring-test.java
|
|
285
|
-
│ │ └── nest-controller.ts
|
|
286
|
-
│ │
|
|
287
|
-
│ └── utils/
|
|
288
|
-
│ ├── file.ts # 文件工具
|
|
289
|
-
│ ├── git.ts # Git 工具(获取用户名等)
|
|
290
|
-
│ └── logger.ts # 日志输出(含进度条、Spinner)
|
|
291
|
-
│
|
|
292
|
-
└── dist/ # 编译输出(TypeScript → JavaScript)
|
|
293
|
-
```
|
|
172
|
+
| 问题 | 答案 |
|
|
173
|
+
| :--- | :--- |
|
|
174
|
+
| **安装后命令找不到?** | 确保 npm bin 目录在 PATH 中:`export PATH="$(npm bin -g):$PATH"` |
|
|
175
|
+
| **如何更新?** | `npm update -g speccore` |
|
|
176
|
+
| **同一个功能多端怎么管理?** | `speccore new-task --platforms=web,h5,miniapp`,按端执行和统计 |
|
|
177
|
+
| **如何添加新平台?** | `speccore platform-add --name=tablet --tech="React Native"` |
|
|
178
|
+
| **期次/Task 想改名?** | `speccore rename --target=旧名 --new-name=新名` |
|
|
179
|
+
| **批量重命名?** | `speccore rename --batch --pattern="Task-" --replacement="Feature-"` |
|
|
180
|
+
| **手动改了文档,需要同步?** | `speccore sync --task=Task-001` 或 `speccore sync-global` |
|
|
181
|
+
| **需求编号重复?** | `speccore validate --fix` 自动检测修复 |
|
|
182
|
+
| **如何重建需求索引?** | `speccore index-update`(--dry-run 预览) |
|
|
294
183
|
|
|
295
184
|
---
|
|
296
185
|
|
|
@@ -298,73 +187,38 @@ speccore/
|
|
|
298
187
|
|
|
299
188
|
```bash
|
|
300
189
|
# 克隆仓库
|
|
301
|
-
git clone https://github.com/
|
|
302
|
-
cd
|
|
303
|
-
|
|
304
|
-
# 安装依赖
|
|
305
|
-
npm install
|
|
190
|
+
git clone https://github.com/windfallsheng/SpecCore-ts.git
|
|
191
|
+
cd SpecCore-ts/ts-cli
|
|
306
192
|
|
|
307
|
-
# 编译
|
|
308
|
-
npm run build
|
|
193
|
+
# 安装依赖 + 编译
|
|
194
|
+
npm install && npm run build
|
|
309
195
|
|
|
310
|
-
#
|
|
196
|
+
# 开发模式
|
|
311
197
|
npm run watch
|
|
312
198
|
|
|
313
199
|
# 本地测试
|
|
314
|
-
|
|
200
|
+
npm link && speccore --version
|
|
315
201
|
|
|
316
|
-
#
|
|
317
|
-
|
|
318
|
-
speccore --version
|
|
202
|
+
# 运行验证脚本
|
|
203
|
+
bash verify.sh
|
|
319
204
|
```
|
|
320
205
|
|
|
321
206
|
---
|
|
322
207
|
|
|
323
|
-
##
|
|
324
|
-
|
|
325
|
-
### Q: 安装后命令找不到?
|
|
326
|
-
|
|
327
|
-
A: 确保 npm 全局 bin 目录在 PATH 中:
|
|
328
|
-
|
|
329
|
-
```bash
|
|
330
|
-
# 查看全局安装路径
|
|
331
|
-
npm bin -g
|
|
332
|
-
|
|
333
|
-
# 添加到 PATH(macOS/Linux)
|
|
334
|
-
export PATH="$(npm bin -g):$PATH"
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
### Q: 如何更新到最新版本?
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
npm update -g speccore
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
### Q: 如何卸载?
|
|
344
|
-
|
|
345
|
-
```bash
|
|
346
|
-
npm uninstall -g speccore
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
### Q: 与 AI 工具如何配合?
|
|
350
|
-
|
|
351
|
-
A: AI 工具(如 WorkBuddy)通过调用 CLI 命令来执行确定性操作。例如:
|
|
352
|
-
|
|
353
|
-
```bash
|
|
354
|
-
# AI 执行 /spec-validate 时,内部调用:
|
|
355
|
-
speccore validate --json
|
|
208
|
+
## 相关项目
|
|
356
209
|
|
|
357
|
-
|
|
358
|
-
|
|
210
|
+
| 项目 | 说明 | 链接 |
|
|
211
|
+
| :--- | :--- | :--- |
|
|
212
|
+
| **SpecCore 框架** | 规范驱动开发方法论 + Slash Commands + 模板 | [GitHub](https://github.com/windfallsheng/SpecCore) |
|
|
213
|
+
| **SpecCore CLI** | TypeScript CLI 工具(确定性操作执行引擎) | [GitHub](https://github.com/windfallsheng/SpecCore-ts) |
|
|
359
214
|
|
|
360
215
|
---
|
|
361
216
|
|
|
362
|
-
##
|
|
217
|
+
## 版本
|
|
363
218
|
|
|
364
|
-
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
| **SpecCore** | CLI 工具(确定性操作执行引擎) | [windfallsheng/SpecCore-ts](https://github.com/windfallsheng/SpecCore-ts) | [windfullsheng/spec-core-ts](https://gitee.com/windfullsheng/spec-core-ts) |
|
|
219
|
+
v4.0.0 | 🔧 CLI 命令 39 个 | 🧠 意图识别 31 种
|
|
220
|
+
|
|
221
|
+
版本历史见 [CHANGELOG.md](CHANGELOG.md)
|
|
368
222
|
|
|
369
223
|
---
|
|
370
224
|
|
|
@@ -380,18 +234,6 @@ speccore validate --json
|
|
|
380
234
|
|
|
381
235
|
---
|
|
382
236
|
|
|
383
|
-
## 更新日志
|
|
384
|
-
|
|
385
|
-
### v1.0.0 (2026-07-05)
|
|
386
|
-
|
|
387
|
-
- 初始版本发布
|
|
388
|
-
- 支持 14 个 CLI 命令
|
|
389
|
-
- 核心引擎:上下文管理、状态管理、YAML 解析、模板渲染、合规检查
|
|
390
|
-
- 内置模板:Spring Boot Controller/Service/Test、NestJS Controller
|
|
391
|
-
- 支持 JSON/Markdown/HTML 多格式输出
|
|
392
|
-
|
|
393
|
-
---
|
|
394
|
-
|
|
395
237
|
## License
|
|
396
238
|
|
|
397
239
|
[MIT](https://opensource.org/licenses/MIT)
|
package/dist/cli.js
CHANGED
|
@@ -41,6 +41,11 @@ const dashboard_1 = require("./commands/dashboard");
|
|
|
41
41
|
const audit_1 = require("./commands/audit");
|
|
42
42
|
// rename 命令
|
|
43
43
|
const rename_1 = require("./commands/rename");
|
|
44
|
+
// v4.0.0 新增命令
|
|
45
|
+
const new_task_1 = require("./commands/new-task");
|
|
46
|
+
const platform_add_1 = require("./commands/platform-add");
|
|
47
|
+
const index_update_1 = require("./commands/index-update");
|
|
48
|
+
const context_1 = require("./commands/context");
|
|
44
49
|
commander_1.program
|
|
45
50
|
.name('speccore')
|
|
46
51
|
.description('SpecCore - Code by Spec, Not by Vibe.')
|
|
@@ -88,6 +93,9 @@ commander_1.program
|
|
|
88
93
|
.option('--iteration <iteration>', 'Target iteration name')
|
|
89
94
|
.option('--project <name>', 'Project name for global layer import')
|
|
90
95
|
.option('--type <type>', 'Project type: backend, web, h5, miniapp', 'backend')
|
|
96
|
+
.option('--scope <scope>', 'Selective import: all, core, api', 'all')
|
|
97
|
+
.option('--ignore <packages>', 'Ignore specific packages (comma-separated)')
|
|
98
|
+
.option('--update', 'Incremental sync mode')
|
|
91
99
|
.option('--force', 'Force overwrite')
|
|
92
100
|
.action(import_1.importCommand);
|
|
93
101
|
// ================================================================
|
|
@@ -200,6 +208,7 @@ commander_1.program
|
|
|
200
208
|
.option('--status <status>', 'Filter by status')
|
|
201
209
|
.option('--backend', 'Backend tasks only')
|
|
202
210
|
.option('--frontend', 'Frontend tasks only')
|
|
211
|
+
.option('--platform <platform>', 'Filter by frontend platform (web/h5/miniapp)')
|
|
203
212
|
.option('--interactive', 'Interactive selection')
|
|
204
213
|
.option('--dry-run', 'Preview execution plan')
|
|
205
214
|
.option('--resume', 'Resume from last interruption')
|
|
@@ -257,6 +266,7 @@ commander_1.program
|
|
|
257
266
|
.option('--type <type>', 'Filter by task type')
|
|
258
267
|
.option('--task <task>', 'Show specific task progress')
|
|
259
268
|
.option('--detail', 'Show detailed progress')
|
|
269
|
+
.option('--platform <platform>', 'Filter by frontend platform (web/h5/miniapp)')
|
|
260
270
|
.option('--format <format>', 'Output format: text, json, csv', 'text')
|
|
261
271
|
.action(progress_1.progressCommand);
|
|
262
272
|
commander_1.program
|
|
@@ -426,17 +436,45 @@ commander_1.program
|
|
|
426
436
|
.option('--force', 'Skip preview and execute')
|
|
427
437
|
.action(rename_1.renameCommand);
|
|
428
438
|
// ================================================================
|
|
439
|
+
// 🆕 v4.0.0 新增命令
|
|
440
|
+
// ================================================================
|
|
441
|
+
commander_1.program
|
|
442
|
+
.command('new-task')
|
|
443
|
+
.alias('nt')
|
|
444
|
+
.description('Create multi-platform task with --platforms support (v4.0)')
|
|
445
|
+
.option('--name <name>', 'Task name (required)')
|
|
446
|
+
.option('--type <type>', 'Task type: feature, bugfix, research, optimization, migration, document')
|
|
447
|
+
.option('--desc <desc>', 'Task description')
|
|
448
|
+
.option('--platforms <platforms>', 'Frontend platforms: web,h5,miniapp or "all"')
|
|
449
|
+
.option('--backend-only', 'Create backend specs only')
|
|
450
|
+
.option('--frontend-only', 'Create frontend specs only')
|
|
451
|
+
.option('--iteration <iteration>', 'Target iteration')
|
|
452
|
+
.action(new_task_1.newTaskCommand);
|
|
453
|
+
commander_1.program
|
|
454
|
+
.command('platform-add')
|
|
455
|
+
.alias('padd')
|
|
456
|
+
.description('Dynamically add a frontend platform type (v4.0)')
|
|
457
|
+
.option('--name <name>', 'Platform identifier (required, e.g. tablet)')
|
|
458
|
+
.option('--description <desc>', 'Platform display name')
|
|
459
|
+
.option('--tech <tech>', 'Tech stack description')
|
|
460
|
+
.option('--no-sync', 'Skip syncing to existing tasks')
|
|
461
|
+
.action(platform_add_1.platformAddCommand);
|
|
462
|
+
commander_1.program
|
|
463
|
+
.command('index-update')
|
|
464
|
+
.alias('iu')
|
|
465
|
+
.description('Scan requirements and rebuild GLOBAL/INDEX.md (v4.0)')
|
|
466
|
+
.option('--dry-run', 'Preview mode, no actual changes')
|
|
467
|
+
.action(index_update_1.indexUpdateCommand);
|
|
468
|
+
commander_1.program
|
|
469
|
+
.command('context')
|
|
470
|
+
.alias('ctx')
|
|
471
|
+
.description('View task context loading status and dependency chain (v4.0)')
|
|
472
|
+
.option('--task <task>', 'Target task (default: current task)')
|
|
473
|
+
.action(context_1.contextCommand);
|
|
474
|
+
// ================================================================
|
|
429
475
|
// 快捷别名(顶层别名)
|
|
430
476
|
// ================================================================
|
|
431
477
|
// 为常用命令提供顶层快捷访问
|
|
432
|
-
commander_1.program
|
|
433
|
-
.command('nt')
|
|
434
|
-
.description('[Alias] speccore task new')
|
|
435
|
-
.option('-n, --name <name>', 'Task name')
|
|
436
|
-
.option('-t, --type <type>', 'Task type', 'feature')
|
|
437
|
-
.option('-d, --desc <desc>', 'Task description')
|
|
438
|
-
.option('-i, --iteration <iteration>', 'Target iteration')
|
|
439
|
-
.action(new_1.taskNewCommand);
|
|
440
478
|
commander_1.program
|
|
441
479
|
.command('rv')
|
|
442
480
|
.description('[Alias] speccore validate')
|