-
Notifications
You must be signed in to change notification settings - Fork 153
Expand file tree
/
Copy path.temp-memory-content.txt
More file actions
105 lines (85 loc) · 4.1 KB
/
.temp-memory-content.txt
File metadata and controls
105 lines (85 loc) · 4.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
## Session ID
(none)
## Project Root
D:\Claude_dms3
## Objective
为 CCW spec 系统添加独立的 category 分类字段,实现 workflow stage 标记与 keywords 的分离,支持按阶段过滤加载 spec 文档。
## Execution Plan
### Source: inferred
<details>
<summary>Full Execution Plan (Click to expand)</summary>
1. 分析当前 spec 系统实现
2. 设计 category 分类方案 (general | exploration | planning | execution)
3. 后端实现:
- spec-index-builder.ts: 添加 category 字段到 SpecIndexEntry
- spec-init.ts: 更新 seed documents 使用 category
- spec-loader.ts: 支持 category 过滤
- commands/spec.ts: 添加 --category 选项
- cli.ts: 注册 --category 选项
4. 前端实现:
- api.ts: 添加 category 类型
- SpecCard.tsx: 显示 category badge
- SpecsSettingsPage.tsx: 添加 category 过滤 UI
5. 测试所有 ccw spec 命令
</details>
## Working Files (Modified)
- D:\Claude_dms3\ccw\src\tools\spec-index-builder.ts (role: core types + parsing)
- D:\Claude_dms3\ccw\src\tools\spec-init.ts (role: seed documents)
- D:\Claude_dms3\ccw\src\tools\spec-loader.ts (role: loading + filtering)
- D:\Claude_dms3\ccw\src\commands\spec.ts (role: CLI command handler)
- D:\Claude_dms3\ccw\src\cli.ts (role: CLI registration)
- D:\Claude_dms3\ccw\frontend\src\lib\api.ts (role: frontend types)
- D:\Claude_dms3\ccw\frontend\src\components\specs\SpecCard.tsx (role: UI display)
- D:\Claude_dms3\ccw\frontend\src\components\specs\index.ts (role: exports)
- D:\Claude_dms3\ccw\frontend\src\pages\SpecsSettingsPage.tsx (role: filtering UI)
## Reference Files (Read-Only)
- D:\Claude_dms3\ccw\src\core\routes\spec-routes.ts (role: API routes)
- D:\Claude_dms3\ccw\frontend\src\hooks\useSystemSettings.ts (role: hooks)
## Last Action
成功测试所有 ccw spec 命令:
- ccw spec help ✅
- ccw spec init ✅
- ccw spec rebuild ✅
- ccw spec list ✅
- ccw spec status ✅
- ccw spec load --category general ✅ (仅加载 general 分类)
- ccw spec load --category planning ✅ (仅加载 planning 分类)
发现并修复 CLI 启动问题:cli.ts 中 run() 函数未被调用,已添加 run(process.argv) 调用。
## Decisions
- 添加 category 为独立字段而非混入 keywords: 清晰的职责分离,keywords 用于主题匹配,category 用于 workflow stage 过滤
- 使用 general 作为默认值: 适用于所有阶段的通用规范
- 前端显示 category badge: 提供可视化分类指示
- SpecIndexEntry 增加 contentLength 字段: 由用户系统优化添加,避免重复读取文件
## Constraints
- 保持向后兼容:category 为可选字段,默认 general
- 不修改现有 spec 文档的 keywords 语义
## Dependencies
(none)
## Known Issues
- 前端构建存在预存 TypeScript 错误(IssuePanel.tsx, IssueManagerPage.tsx),与本功能无关
- esbuild 打包需要正确配置 --packages=external 以避免动态 require 问题
## Changes Made
- spec-index-builder.ts: 添加 SpecCategory 类型、VALID_CATEGORIES、isValidCategory()、buildEntry() 解析 category
- spec-init.ts: SpecFrontmatter 添加 category,SEED_DOCS 使用独立 category 字段
- spec-loader.ts: SpecLoadOptions 添加 category,filterSpecs() 支持 category 过滤
- spec.ts: SpecOptions 添加 category,loadAction() 传递 category 到 loadSpecs
- cli.ts: 添加 --category 选项,修复 run() 未调用问题
- api.ts: SpecEntry 添加 category 类型
- SpecCard.tsx: 添加 SpecCategory 类型、categoryConfig 配置、显示 category badge
- SpecsSettingsPage.tsx: 添加 CategoryFilter 状态、categoryCounts 计算、category 过滤按钮
## Pending
(none - 功能实现完成并测试通过)
## Notes
**Category 设计思路**:
- general: 适用于所有阶段(如编码规范)
- exploration: 代码探索、分析、调试
- planning: 任务规划、需求分析
- execution: 实现、测试、部署
系统级加载示例:ccw spec load --category exploration
**索引验证**:
{
"title": "Architecture Constraints",
"category": "planning",
"keywords": ["architecture", "module", "layer", "pattern"]
}
keywords 不再包含 exploration/planning/execution 标记。