@localsummer/incspec 0.1.0 → 0.1.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.
- package/README.md +1 -0
- package/commands/init.mjs +1 -1
- package/commands/sync.mjs +4 -4
- package/lib/cursor.mjs +2 -2
- package/package.json +1 -1
- package/templates/AGENTS.md +16 -3
- package/templates/inc-spec-skill/SKILL.md +29 -12
- /package/templates/{cursor-commands → commands}/analyze-codeflow.md +0 -0
- /package/templates/{cursor-commands → commands}/analyze-increment-codeflow.md +0 -0
- /package/templates/{cursor-commands → commands}/apply-increment-code.md +0 -0
- /package/templates/{cursor-commands → commands}/inc-archive.md +0 -0
- /package/templates/{cursor-commands → commands}/merge-to-baseline.md +0 -0
- /package/templates/{cursor-commands → commands}/structured-requirements-collection.md +0 -0
- /package/templates/{cursor-commands → commands}/ui-dependency-collection.md +0 -0
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<p align="center">面向 AI 编程助手的增量规范驱动开发工具</p>
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://github.com/localSummer/IncSpec"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-localSummer%2FIncSpec-blue?style=flat-square&logo=github" /></a>
|
|
7
|
+
<a href="https://www.npmjs.com/package/@localsummer/incspec"><img alt="npm" src="https://img.shields.io/npm/v/@localsummer/incspec?style=flat-square&logo=npm" /></a>
|
|
7
8
|
<a href="https://nodejs.org/"><img alt="node version" src="https://img.shields.io/node/v/@localsummer/incspec?style=flat-square" /></a>
|
|
8
9
|
<a href="./LICENSE"><img alt="License: ISC" src="https://img.shields.io/badge/License-ISC-blue.svg?style=flat-square" /></a>
|
|
9
10
|
</p>
|
package/commands/init.mjs
CHANGED
|
@@ -121,7 +121,7 @@ export async function initCommand(ctx) {
|
|
|
121
121
|
print('');
|
|
122
122
|
print(colorize('下一步:', colors.bold));
|
|
123
123
|
print(colorize(` 1. 运行 'incspec status' 查看工作流状态`, colors.dim));
|
|
124
|
-
print(colorize(` 2. 运行 'incspec
|
|
124
|
+
print(colorize(` 2. 运行 'incspec sync' 同步 Cursor 命令`, colors.dim));
|
|
125
125
|
print(colorize(` 3. 使用 /incspec/inc-analyze 开始第一个工作流`, colors.dim));
|
|
126
126
|
print('');
|
|
127
127
|
}
|
package/commands/sync.mjs
CHANGED
|
@@ -114,12 +114,12 @@ async function syncCursor(ctx) {
|
|
|
114
114
|
{
|
|
115
115
|
name: `当前目录 (${cwd}/.cursor/commands/incspec/)`,
|
|
116
116
|
value: 'project',
|
|
117
|
-
description: '仅对当前目录生效',
|
|
117
|
+
description: colorize('仅对当前目录生效', colors.blue),
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
name: '全局目录 (~/.cursor/commands/incspec/)',
|
|
121
121
|
value: 'global',
|
|
122
|
-
description: '对所有项目生效',
|
|
122
|
+
description: colorize('对所有项目生效', colors.blue),
|
|
123
123
|
},
|
|
124
124
|
];
|
|
125
125
|
|
|
@@ -182,12 +182,12 @@ async function syncClaude(ctx) {
|
|
|
182
182
|
{
|
|
183
183
|
name: `当前目录 (${cwd}/.claude/skills/inc-spec-skill/)`,
|
|
184
184
|
value: 'project',
|
|
185
|
-
description: '仅对当前目录生效',
|
|
185
|
+
description: colorize('仅对当前目录生效', colors.blue),
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
name: '全局目录 (~/.claude/skills/inc-spec-skill/)',
|
|
189
189
|
value: 'global',
|
|
190
|
-
description: '对所有项目生效(推荐)',
|
|
190
|
+
description: colorize('对所有项目生效(推荐)', colors.blue),
|
|
191
191
|
},
|
|
192
192
|
];
|
|
193
193
|
|
package/lib/cursor.mjs
CHANGED
|
@@ -19,8 +19,8 @@ const GLOBAL_CURSOR_DIR = path.join(os.homedir(), '.cursor', 'commands', 'incspe
|
|
|
19
19
|
/** Claude commands source directory (user local) */
|
|
20
20
|
const CLAUDE_COMMANDS_DIR = path.join(os.homedir(), '.claude', 'commands', 'ai-increment');
|
|
21
21
|
|
|
22
|
-
/** Built-in templates directory
|
|
23
|
-
const TEMPLATES_DIR = fileURLToPath(new URL('../templates/
|
|
22
|
+
/** Built-in templates directory */
|
|
23
|
+
const TEMPLATES_DIR = fileURLToPath(new URL('../templates/commands', import.meta.url));
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Command mapping from Claude to Cursor
|
package/package.json
CHANGED
package/templates/AGENTS.md
CHANGED
|
@@ -19,7 +19,7 @@ AI 编码助手使用 IncSpec 进行增量规格驱动开发的操作指南。
|
|
|
19
19
|
- 检查状态: `incspec status`
|
|
20
20
|
- 编号引用: `[S1]` 时序步骤, `[D1]` 依赖, `[C1]` 变更
|
|
21
21
|
- 增量标记: `[N1]` 新增, `[S1-Modified]` 修改, `[S1-Deleted]` 删除
|
|
22
|
-
-
|
|
22
|
+
- 验证时机: 步骤 1/4/6 完成后、归档前执行 `incspec validate`,出错时加 `--strict` 用于 CI
|
|
23
23
|
|
|
24
24
|
## 七步工作流
|
|
25
25
|
|
|
@@ -38,6 +38,8 @@ AI 编码助手使用 IncSpec 进行增量规格驱动开发的操作指南。
|
|
|
38
38
|
|
|
39
39
|
**交付物**: Mermaid 时序图 (`[S1]`-`[Sn]`)、依赖图 (`[D1]`-`[Dn]`)、依赖摘要 (`[R1.x]`-`[R3.x]`)
|
|
40
40
|
|
|
41
|
+
**验证**: 完成后执行 `incspec validate` 检查基线格式(必含时序图和依赖图)
|
|
42
|
+
|
|
41
43
|
### 步骤 2: 收集结构化需求
|
|
42
44
|
|
|
43
45
|
**命令**: `incspec collect-req` (别名: `cr`)
|
|
@@ -75,6 +77,8 @@ AI 编码助手使用 IncSpec 进行增量规格驱动开发的操作指南。
|
|
|
75
77
|
6. 潜在风险与副作用
|
|
76
78
|
7. 建议的测试用例 (至少6个)
|
|
77
79
|
|
|
80
|
+
**验证**: 完成后执行 `incspec validate` 检查增量格式(必含5个模块章节)
|
|
81
|
+
|
|
78
82
|
### 步骤 5: 应用代码变更
|
|
79
83
|
|
|
80
84
|
**命令**: `incspec apply [increment-path]` (别名: `ap`)
|
|
@@ -93,12 +97,16 @@ AI 编码助手使用 IncSpec 进行增量规格驱动开发的操作指南。
|
|
|
93
97
|
|
|
94
98
|
**处理**: 移除增量标记 → 合并新节点 → 重新编号为干净序列 → 输出新基线 v{n+1}
|
|
95
99
|
|
|
100
|
+
**验证**: 完成后执行 `incspec validate` 检查新基线完整性
|
|
101
|
+
|
|
96
102
|
### 步骤 7: 归档工作流产出
|
|
97
103
|
|
|
98
104
|
**命令**: `incspec archive [--yes] [<file>] [--keep]`
|
|
99
105
|
|
|
100
106
|
**目的**: 将已完成的工作流产出归档到 `incspec/archives/YYYY-MM/{module}/`
|
|
101
107
|
|
|
108
|
+
**验证**: 归档前执行 `incspec validate` 确保项目健康,归档后再次验证确保文件移动正确
|
|
109
|
+
|
|
102
110
|
## 目录结构
|
|
103
111
|
|
|
104
112
|
```
|
|
@@ -141,7 +149,8 @@ incspec archive [--yes] [--keep] # 步骤7
|
|
|
141
149
|
# 验证与同步
|
|
142
150
|
incspec validate / v [--strict] # 验证完整性
|
|
143
151
|
incspec sync [--cursor|--claude|--all] [--global|--project] # IDE集成
|
|
144
|
-
incspec reset
|
|
152
|
+
incspec reset # 完全重置工作流(归档所有产出)
|
|
153
|
+
incspec reset --to=<step> # 部分回退到指定步骤(保留1-N,重置N+1至7)
|
|
145
154
|
```
|
|
146
155
|
|
|
147
156
|
## 文件格式示例
|
|
@@ -210,6 +219,10 @@ baseline: home-baseline-v1
|
|
|
210
219
|
| No baseline found | 先完成步骤 1 (analyze) |
|
|
211
220
|
| Previous step not completed | 运行 `incspec status` 检查进度 |
|
|
212
221
|
| Validation failed | 检查文件格式和编号序列 |
|
|
213
|
-
|
|
|
222
|
+
| 工作流卡住或状态异常 | `incspec reset` 完全重置,或 `incspec reset --to=N` 回退到步骤N |
|
|
223
|
+
|
|
224
|
+
**工作流重置**:
|
|
225
|
+
- 完全重置: `incspec reset` - 归档所有产出,回到初始状态
|
|
226
|
+
- 部分回退: `incspec reset --to=N` - 保留步骤1-N,重置N+1至7(示例:`--to=3` 保留1-3,重置4-7)
|
|
214
227
|
|
|
215
228
|
记住: **基线是真相,增量是提案**。通过工作流周期保持它们同步。
|
|
@@ -100,8 +100,10 @@ description: 设计优先的前端功能增量编码工作流。适用于实现
|
|
|
100
100
|
管理命令:
|
|
101
101
|
- `incspec status` - 查看工作流状态
|
|
102
102
|
- `incspec list` - 列出规范文件
|
|
103
|
-
- `incspec validate` -
|
|
104
|
-
- `incspec
|
|
103
|
+
- `incspec validate` - 验证项目健康状态(步骤1/4/6后、归档前执行)
|
|
104
|
+
- `incspec validate --strict` - 严格模式,有错误时退出码为1(用于CI)
|
|
105
|
+
- `incspec reset` - 重置工作流到初始状态
|
|
106
|
+
- `incspec reset --to=N` - 回退到步骤N,保留1-N,重置N+1至7(示例:`--to=3` 保留1-3,重置4-7)
|
|
105
107
|
|
|
106
108
|
## 步骤详情
|
|
107
109
|
|
|
@@ -122,6 +124,8 @@ description: 设计优先的前端功能增量编码工作流。适用于实现
|
|
|
122
124
|
- 组件/Store依赖关系图
|
|
123
125
|
- 数据流摘要
|
|
124
126
|
|
|
127
|
+
**验证:** 完成后执行 `incspec validate` 检查基线格式(必含时序图和依赖图)
|
|
128
|
+
|
|
125
129
|
详见 [references/analyze-codeflow.md](references/analyze-codeflow.md)。
|
|
126
130
|
|
|
127
131
|
### 步骤2: 需求收集
|
|
@@ -164,6 +168,8 @@ description: 设计优先的前端功能增量编码工作流。适用于实现
|
|
|
164
168
|
- 文件修改计划 (新增/修改/删除)
|
|
165
169
|
- 分步实现指导
|
|
166
170
|
|
|
171
|
+
**验证:** 完成后执行 `incspec validate` 检查增量格式(必含5个模块章节)
|
|
172
|
+
|
|
167
173
|
详见 [references/analyze-increment-codeflow.md](references/analyze-increment-codeflow.md)。
|
|
168
174
|
|
|
169
175
|
### 步骤5: 代码应用
|
|
@@ -187,6 +193,8 @@ description: 设计优先的前端功能增量编码工作流。适用于实现
|
|
|
187
193
|
|
|
188
194
|
**输出:** 代表当前系统状态的干净基线(无增量标记)
|
|
189
195
|
|
|
196
|
+
**验证:** 完成后执行 `incspec validate` 检查新基线完整性
|
|
197
|
+
|
|
190
198
|
详见 [references/merge-to-baseline.md](references/merge-to-baseline.md)。
|
|
191
199
|
|
|
192
200
|
### 步骤7: 归档
|
|
@@ -202,6 +210,8 @@ incspec archive <file> --yes # 归档指定文件
|
|
|
202
210
|
incspec archive <file> --keep # 复制而非移动
|
|
203
211
|
```
|
|
204
212
|
|
|
213
|
+
**验证:** 归档前执行 `incspec validate` 确保项目健康,归档后再次验证确保文件移动正确
|
|
214
|
+
|
|
205
215
|
详见 [references/inc-archive.md](references/inc-archive.md)。
|
|
206
216
|
|
|
207
217
|
## 最佳实践
|
|
@@ -219,10 +229,16 @@ incspec archive <file> --keep # 复制而非移动
|
|
|
219
229
|
- 仅在变更范围明确、不涉及复杂依赖时使用快速模式
|
|
220
230
|
|
|
221
231
|
**验证节点:**
|
|
232
|
+
- 步骤1后: `incspec validate` 检查基线格式(必含时序图和依赖图)
|
|
222
233
|
- 步骤2后: 需求中无模糊术语
|
|
223
|
-
- 步骤4后 (完整模式): 编码前审查蓝图
|
|
234
|
+
- 步骤4后 (完整模式): `incspec validate` 检查增量格式 + 编码前审查蓝图
|
|
224
235
|
- 步骤5后: 验证所有文件已正确创建/修改
|
|
225
|
-
- 步骤
|
|
236
|
+
- 步骤6后: `incspec validate` 检查新基线完整性
|
|
237
|
+
- 步骤7前后: 归档前后各执行 `incspec validate` 确保项目健康
|
|
238
|
+
|
|
239
|
+
**工作流重置:**
|
|
240
|
+
- 完全重置: `incspec reset` - 归档所有产出,回到初始状态
|
|
241
|
+
- 部分回退: `incspec reset --to=N` - 保留步骤1-N,重置步骤N+1至7。示例:步骤5发现设计有误 → `--to=3` → 重做步骤4-7
|
|
226
242
|
|
|
227
243
|
**人工确认点:**
|
|
228
244
|
|
|
@@ -241,14 +257,15 @@ incspec archive <file> --keep # 复制而非移动
|
|
|
241
257
|
|
|
242
258
|
## 常见陷阱
|
|
243
259
|
|
|
244
|
-
| 陷阱 | 后果 |
|
|
245
|
-
|
|
246
|
-
| 跳过代码流程分析 | 集成问题,返工 |
|
|
247
|
-
| 接受模糊需求 | 编码时发现歧义 |
|
|
248
|
-
| 遗漏依赖 | 导入错误,运行时失败 |
|
|
249
|
-
| 编码先于设计 | 在不符合架构的实现上浪费精力 |
|
|
250
|
-
| 跳过基线合并 | 对当前系统状态产生混淆 |
|
|
251
|
-
| 忽略归档 | 工作区杂乱,历史丢失 |
|
|
260
|
+
| 陷阱 | 后果 | 解决方案 |
|
|
261
|
+
|------|------|----------|
|
|
262
|
+
| 跳过代码流程分析 | 集成问题,返工 | 始终从步骤1开始,建立准确基线 |
|
|
263
|
+
| 接受模糊需求 | 编码时发现歧义 | 步骤2必须确认,消除所有模糊术语 |
|
|
264
|
+
| 遗漏依赖 | 导入错误,运行时失败 | 完整模式严格执行步骤3 |
|
|
265
|
+
| 编码先于设计 | 在不符合架构的实现上浪费精力 | 完整模式严格执行步骤4,步骤4设计获批后才执行步骤5 |
|
|
266
|
+
| 跳过基线合并 | 对当前系统状态产生混淆 | 每次增量后必须执行步骤6 |
|
|
267
|
+
| 忽略归档 | 工作区杂乱,历史丢失 | 工作流完成后立即执行步骤7 |
|
|
268
|
+
| 工作流状态不一致 | CLI命令执行失败 | 使用 `incspec status` 检查状态,必要时使用 `incspec reset` 修复 |
|
|
252
269
|
|
|
253
270
|
## 参考资源
|
|
254
271
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|