speccore 1.0.0
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 +401 -0
- package/README.md +401 -0
- package/bin/speccore +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +450 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/archive.d.ts +10 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +138 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/audit.d.ts +10 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +278 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/baseline.d.ts +13 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +227 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/bugfix.d.ts +13 -0
- package/dist/commands/bugfix.d.ts.map +1 -0
- package/dist/commands/bugfix.js +181 -0
- package/dist/commands/bugfix.js.map +1 -0
- package/dist/commands/change.d.ts +14 -0
- package/dist/commands/change.d.ts.map +1 -0
- package/dist/commands/change.js +150 -0
- package/dist/commands/change.js.map +1 -0
- package/dist/commands/config.d.ts +7 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +110 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dashboard.d.ts +9 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +209 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/demo.d.ts +10 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +151 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/execute.d.ts +18 -0
- package/dist/commands/execute.d.ts.map +1 -0
- package/dist/commands/execute.js +127 -0
- package/dist/commands/execute.js.map +1 -0
- package/dist/commands/global-status.d.ts +9 -0
- package/dist/commands/global-status.d.ts.map +1 -0
- package/dist/commands/global-status.js +135 -0
- package/dist/commands/global-status.js.map +1 -0
- package/dist/commands/goal.d.ts +15 -0
- package/dist/commands/goal.d.ts.map +1 -0
- package/dist/commands/goal.js +282 -0
- package/dist/commands/goal.js.map +1 -0
- package/dist/commands/handover.d.ts +11 -0
- package/dist/commands/handover.d.ts.map +1 -0
- package/dist/commands/handover.js +169 -0
- package/dist/commands/handover.js.map +1 -0
- package/dist/commands/health.d.ts +7 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +80 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/help.d.ts +10 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +93 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/history.d.ts +9 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +87 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/impact.d.ts +12 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +238 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/import.d.ts +15 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +366 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +564 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/iteration/create.d.ts +7 -0
- package/dist/commands/iteration/create.d.ts.map +1 -0
- package/dist/commands/iteration/create.js +141 -0
- package/dist/commands/iteration/create.js.map +1 -0
- package/dist/commands/iteration/split.d.ts +9 -0
- package/dist/commands/iteration/split.d.ts.map +1 -0
- package/dist/commands/iteration/split.js +165 -0
- package/dist/commands/iteration/split.js.map +1 -0
- package/dist/commands/iteration-from-global.d.ts +11 -0
- package/dist/commands/iteration-from-global.d.ts.map +1 -0
- package/dist/commands/iteration-from-global.js +294 -0
- package/dist/commands/iteration-from-global.js.map +1 -0
- package/dist/commands/plan.d.ts +12 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +126 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/progress.d.ts +10 -0
- package/dist/commands/progress.d.ts.map +1 -0
- package/dist/commands/progress.js +89 -0
- package/dist/commands/progress.js.map +1 -0
- package/dist/commands/rename.d.ts +14 -0
- package/dist/commands/rename.d.ts.map +1 -0
- package/dist/commands/rename.js +298 -0
- package/dist/commands/rename.js.map +1 -0
- package/dist/commands/report.d.ts +10 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +124 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/research.d.ts +14 -0
- package/dist/commands/research.d.ts.map +1 -0
- package/dist/commands/research.js +181 -0
- package/dist/commands/research.js.map +1 -0
- package/dist/commands/retro.d.ts +10 -0
- package/dist/commands/retro.d.ts.map +1 -0
- package/dist/commands/retro.js +130 -0
- package/dist/commands/retro.js.map +1 -0
- package/dist/commands/spec.d.ts +8 -0
- package/dist/commands/spec.d.ts.map +1 -0
- package/dist/commands/spec.js +155 -0
- package/dist/commands/spec.js.map +1 -0
- package/dist/commands/status.d.ts +7 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +48 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync-global.d.ts +13 -0
- package/dist/commands/sync-global.d.ts.map +1 -0
- package/dist/commands/sync-global.js +218 -0
- package/dist/commands/sync-global.js.map +1 -0
- package/dist/commands/sync.d.ts +13 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +170 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/task/new.d.ts +13 -0
- package/dist/commands/task/new.d.ts.map +1 -0
- package/dist/commands/task/new.js +195 -0
- package/dist/commands/task/new.js.map +1 -0
- package/dist/commands/template-add.d.ts +12 -0
- package/dist/commands/template-add.d.ts.map +1 -0
- package/dist/commands/template-add.js +65 -0
- package/dist/commands/template-add.js.map +1 -0
- package/dist/commands/validate.d.ts +10 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +37 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/welcome.d.ts +9 -0
- package/dist/commands/welcome.d.ts.map +1 -0
- package/dist/commands/welcome.js +166 -0
- package/dist/commands/welcome.js.map +1 -0
- package/dist/core/context.d.ts +31 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +145 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/global-layer.d.ts +124 -0
- package/dist/core/global-layer.d.ts.map +1 -0
- package/dist/core/global-layer.js +456 -0
- package/dist/core/global-layer.js.map +1 -0
- package/dist/core/index.d.ts +8 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +24 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/intent-recognition.d.ts +48 -0
- package/dist/core/intent-recognition.d.ts.map +1 -0
- package/dist/core/intent-recognition.js +485 -0
- package/dist/core/intent-recognition.js.map +1 -0
- package/dist/core/state.d.ts +26 -0
- package/dist/core/state.d.ts.map +1 -0
- package/dist/core/state.js +187 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/template-engine.d.ts +28 -0
- package/dist/core/template-engine.d.ts.map +1 -0
- package/dist/core/template-engine.js +57 -0
- package/dist/core/template-engine.js.map +1 -0
- package/dist/core/validator.d.ts +26 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +246 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/core/yaml-parser.d.ts +25 -0
- package/dist/core/yaml-parser.d.ts.map +1 -0
- package/dist/core/yaml-parser.js +113 -0
- package/dist/core/yaml-parser.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/file.d.ts +29 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +126 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/git.d.ts +25 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +77 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/logger.d.ts +41 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +184 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
# SpecCore
|
|
2
|
+
|
|
3
|
+
> **Code by Spec, Not by Vibe.**
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/speccore)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
SpecCore 是 [SpecCore](https://github.com/spec-core/spec-core) 规范驱动开发框架的官方命令行工具。它将确定性操作(文件创建、目录管理、格式校验、状态统计)从 AI 中剥离,由代码直接执行,提升效率并降低 Token 消耗。
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 一分钟了解
|
|
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 负责执行 |
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 特性亮点
|
|
25
|
+
|
|
26
|
+
- **🚀 快速初始化**:一行命令初始化完整的 SpecCore 项目结构
|
|
27
|
+
- **📁 智能目录管理**:自动创建期次、任务、共享资源目录,符合规范
|
|
28
|
+
- **✅ 自动合规检查**:扫描所有 Spec 文件,检查必填项和格式
|
|
29
|
+
- **📊 实时进度追踪**:自动识别活跃期次,统计任务完成率
|
|
30
|
+
- **🏥 健康度看板**:4 维度 12 指标评估项目健康状态
|
|
31
|
+
- **📈 一键报告**:支持 Markdown/HTML/JSON 格式输出项目报告
|
|
32
|
+
- **🧠 上下文感知**:自动读取 `.speccore/local/context.json`,智能填充默认值
|
|
33
|
+
- **🔄 确定性执行**:文件操作、格式校验、状态统计全部本地代码执行,零 Token 消耗
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 设计理念
|
|
38
|
+
|
|
39
|
+
SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
|
|
40
|
+
|
|
41
|
+
| 逻辑类型 | 职责 | 执行方 | 示例 |
|
|
42
|
+
| :--- | :--- | :--- | :--- |
|
|
43
|
+
| **确定性逻辑** | 结构化操作 | CLI 代码 | 创建目录、移动文件、解析 YAML、校验格式、统计状态 |
|
|
44
|
+
| **智能逻辑** | 理解与决策 | AI | 理解需求、拆分任务、生成代码、审查产出 |
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
用户输入 (Slash Command)
|
|
48
|
+
│
|
|
49
|
+
▼
|
|
50
|
+
┌───────────────────────────────────────┐
|
|
51
|
+
│ AI 层 (智能决策) │
|
|
52
|
+
│ - 理解用户意图 │
|
|
53
|
+
│ - 决定执行哪些操作 │
|
|
54
|
+
│ - 生成代码内容 │
|
|
55
|
+
└───────────────────────────────────────┘
|
|
56
|
+
│ 调用 CLI 命令
|
|
57
|
+
▼
|
|
58
|
+
┌───────────────────────────────────────┐
|
|
59
|
+
│ CLI 层 (确定性执行) │
|
|
60
|
+
│ - 创建目录结构 │
|
|
61
|
+
│ - 读写文件 │
|
|
62
|
+
│ - 解析 YAML │
|
|
63
|
+
│ - 校验格式 │
|
|
64
|
+
│ - 输出 JSON 结果 │
|
|
65
|
+
└───────────────────────────────────────┘
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**核心收益**:目录检查、YAML 解析、状态统计由代码确定执行,AI 只负责"解读结果"和"格式化输出",Token 消耗大幅降低。
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 环境要求
|
|
73
|
+
|
|
74
|
+
- **Node.js**: >= 18.0.0
|
|
75
|
+
- **操作系统**: macOS / Linux / Windows
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
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. 验证合规性
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# 验证所有任务
|
|
162
|
+
speccore validate
|
|
163
|
+
|
|
164
|
+
# 自动修复可修复的问题
|
|
165
|
+
speccore validate --fix
|
|
166
|
+
|
|
167
|
+
# JSON 格式输出(AI 可直接读取)
|
|
168
|
+
speccore validate --format json
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### 6. 生成报告
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# Markdown 格式(默认)
|
|
175
|
+
speccore report
|
|
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
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
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` | ✅ |
|
|
210
|
+
|
|
211
|
+
### 执行与调度
|
|
212
|
+
|
|
213
|
+
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
214
|
+
| :--- | :--- | :--- | :--- |
|
|
215
|
+
| `speccore plan` | 生成调度方案(DAG 分析) | `/spec-plan` | ✅ |
|
|
216
|
+
| `speccore execute` | 执行任务(需 AI 协同) | `/spec-execute` | ⚠️ |
|
|
217
|
+
|
|
218
|
+
### 验证与审查
|
|
219
|
+
|
|
220
|
+
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
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` | ✅ |
|
|
227
|
+
|
|
228
|
+
### 归档与配置
|
|
229
|
+
|
|
230
|
+
| 命令 | 说明 | 对应 Slash Command | 确定性 |
|
|
231
|
+
| :--- | :--- | :--- | :--- |
|
|
232
|
+
| `speccore archive` | 归档任务 | `/spec-archive` | ✅ |
|
|
233
|
+
| `speccore config` | 配置管理 | `/spec-config` | ✅ |
|
|
234
|
+
|
|
235
|
+
- **✅** 纯确定性逻辑,可完全由代码执行
|
|
236
|
+
- **⚠️** 需要 AI 参与理解/生成(如需求拆分、代码生成)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## 项目结构
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
speccore/
|
|
244
|
+
├── package.json
|
|
245
|
+
├── tsconfig.json
|
|
246
|
+
├── README.md
|
|
247
|
+
├── bin/
|
|
248
|
+
│ └── speccore # CLI 入口脚本
|
|
249
|
+
├── src/
|
|
250
|
+
│ ├── index.ts # 入口文件
|
|
251
|
+
│ ├── cli.ts # CLI 命令注册(Commander.js)
|
|
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
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 开发指南
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
# 克隆仓库
|
|
301
|
+
git clone https://github.com/spec-core/speccore.git
|
|
302
|
+
cd speccore
|
|
303
|
+
|
|
304
|
+
# 安装依赖
|
|
305
|
+
npm install
|
|
306
|
+
|
|
307
|
+
# 编译 TypeScript
|
|
308
|
+
npm run build
|
|
309
|
+
|
|
310
|
+
# 开发模式(监听文件变化自动编译)
|
|
311
|
+
npm run watch
|
|
312
|
+
|
|
313
|
+
# 本地测试
|
|
314
|
+
node bin/speccore --version
|
|
315
|
+
|
|
316
|
+
# 链接到全局(开发测试)
|
|
317
|
+
npm link
|
|
318
|
+
speccore --version
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
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
|
|
356
|
+
|
|
357
|
+
# AI 读取 JSON 结果,生成用户友好的中文报告
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
---
|
|
361
|
+
|
|
362
|
+
## 相关项目
|
|
363
|
+
|
|
364
|
+
| 项目 | 说明 | GitHub | Gitee |
|
|
365
|
+
| :--- | :--- | :--- | :--- |
|
|
366
|
+
| **SpecCore** | 规范驱动开发框架(方法论 + 文件模板 + Slash Commands) | [windfallsheng/SpecCore](https://github.com/windfallsheng/SpecCore) | [windfullsheng/spec-core](https://gitee.com/windfullsheng/spec-core) |
|
|
367
|
+
| **SpecCore** | CLI 工具(确定性操作执行引擎) | [windfallsheng/SpecCore-ts](https://github.com/windfallsheng/SpecCore-ts) | [windfullsheng/spec-core-ts](https://gitee.com/windfullsheng/spec-core-ts) |
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 贡献指南
|
|
372
|
+
|
|
373
|
+
欢迎提交 Issue 和 Pull Request!
|
|
374
|
+
|
|
375
|
+
1. Fork 本仓库
|
|
376
|
+
2. 创建特性分支:`git checkout -b feature/my-feature`
|
|
377
|
+
3. 提交更改:`git commit -m 'feat: add some feature'`
|
|
378
|
+
4. 推送分支:`git push origin feature/my-feature`
|
|
379
|
+
5. 创建 Pull Request
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
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
|
+
## License
|
|
396
|
+
|
|
397
|
+
[MIT](https://opensource.org/licenses/MIT)
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
<p align="center">Built with ❤️ by the SpecCore Team</p>
|
package/bin/speccore
ADDED
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|