speccore 5.15.1 → 5.19.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.
Files changed (100) hide show
  1. package/README.en.md +8 -8
  2. package/README.md +16 -17
  3. package/dist/cli.js +298 -14
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/analyze.d.ts.map +1 -1
  6. package/dist/commands/analyze.js +64 -3
  7. package/dist/commands/analyze.js.map +1 -1
  8. package/dist/commands/change.d.ts.map +1 -1
  9. package/dist/commands/change.js.map +1 -1
  10. package/dist/commands/config.d.ts +4 -0
  11. package/dist/commands/config.d.ts.map +1 -1
  12. package/dist/commands/config.js +18 -0
  13. package/dist/commands/config.js.map +1 -1
  14. package/dist/commands/context-output.d.ts +7 -0
  15. package/dist/commands/context-output.d.ts.map +1 -0
  16. package/dist/commands/context-output.js +86 -0
  17. package/dist/commands/context-output.js.map +1 -0
  18. package/dist/commands/dev.d.ts +7 -0
  19. package/dist/commands/dev.d.ts.map +1 -0
  20. package/dist/commands/dev.js +179 -0
  21. package/dist/commands/dev.js.map +1 -0
  22. package/dist/commands/execute.d.ts +3 -0
  23. package/dist/commands/execute.d.ts.map +1 -1
  24. package/dist/commands/execute.js +85 -13
  25. package/dist/commands/execute.js.map +1 -1
  26. package/dist/commands/help-quick.d.ts +3 -0
  27. package/dist/commands/help-quick.d.ts.map +1 -0
  28. package/dist/commands/help-quick.js +66 -0
  29. package/dist/commands/help-quick.js.map +1 -0
  30. package/dist/commands/history.d.ts +1 -0
  31. package/dist/commands/history.d.ts.map +1 -1
  32. package/dist/commands/history.js +26 -0
  33. package/dist/commands/history.js.map +1 -1
  34. package/dist/commands/init.d.ts.map +1 -1
  35. package/dist/commands/init.js +56 -3
  36. package/dist/commands/init.js.map +1 -1
  37. package/dist/commands/iteration/split.js +134 -3
  38. package/dist/commands/iteration/split.js.map +1 -1
  39. package/dist/commands/lifecycle.d.ts.map +1 -1
  40. package/dist/commands/lifecycle.js +43 -2
  41. package/dist/commands/lifecycle.js.map +1 -1
  42. package/dist/commands/merge-check.d.ts +10 -0
  43. package/dist/commands/merge-check.d.ts.map +1 -0
  44. package/dist/commands/merge-check.js +148 -0
  45. package/dist/commands/merge-check.js.map +1 -0
  46. package/dist/commands/pr.d.ts +9 -0
  47. package/dist/commands/pr.d.ts.map +1 -0
  48. package/dist/commands/pr.js +97 -0
  49. package/dist/commands/pr.js.map +1 -0
  50. package/dist/commands/spec.d.ts.map +1 -1
  51. package/dist/commands/spec.js +5 -1
  52. package/dist/commands/spec.js.map +1 -1
  53. package/dist/commands/status-panel.d.ts +2 -0
  54. package/dist/commands/status-panel.d.ts.map +1 -0
  55. package/dist/commands/status-panel.js +143 -0
  56. package/dist/commands/status-panel.js.map +1 -0
  57. package/dist/commands/tracker.d.ts +2 -0
  58. package/dist/commands/tracker.d.ts.map +1 -0
  59. package/dist/commands/tracker.js +28 -0
  60. package/dist/commands/tracker.js.map +1 -0
  61. package/dist/core/code-scanner.d.ts +26 -0
  62. package/dist/core/code-scanner.d.ts.map +1 -0
  63. package/dist/core/code-scanner.js +223 -0
  64. package/dist/core/code-scanner.js.map +1 -0
  65. package/dist/core/constitution-builder.d.ts +2 -0
  66. package/dist/core/constitution-builder.d.ts.map +1 -0
  67. package/dist/core/constitution-builder.js +216 -0
  68. package/dist/core/constitution-builder.js.map +1 -0
  69. package/dist/core/execution-state.d.ts.map +1 -1
  70. package/dist/core/execution-state.js +4 -0
  71. package/dist/core/execution-state.js.map +1 -1
  72. package/dist/core/intent-ai.d.ts +19 -0
  73. package/dist/core/intent-ai.d.ts.map +1 -0
  74. package/dist/core/intent-ai.js +138 -0
  75. package/dist/core/intent-ai.js.map +1 -0
  76. package/dist/core/requirement-tracker.d.ts +24 -0
  77. package/dist/core/requirement-tracker.d.ts.map +1 -0
  78. package/dist/core/requirement-tracker.js +88 -0
  79. package/dist/core/requirement-tracker.js.map +1 -0
  80. package/dist/core/risk-scorer.d.ts +15 -5
  81. package/dist/core/risk-scorer.d.ts.map +1 -1
  82. package/dist/core/risk-scorer.js +135 -6
  83. package/dist/core/risk-scorer.js.map +1 -1
  84. package/dist/core/spec-annotations.d.ts +35 -0
  85. package/dist/core/spec-annotations.d.ts.map +1 -0
  86. package/dist/core/spec-annotations.js +203 -0
  87. package/dist/core/spec-annotations.js.map +1 -0
  88. package/dist/core/unified-config.d.ts +44 -0
  89. package/dist/core/unified-config.d.ts.map +1 -0
  90. package/dist/core/unified-config.js +141 -0
  91. package/dist/core/unified-config.js.map +1 -0
  92. package/package.json +2 -2
  93. package/dist/commands/hooks.d.ts +0 -5
  94. package/dist/commands/hooks.d.ts.map +0 -1
  95. package/dist/commands/hooks.js +0 -22
  96. package/dist/commands/hooks.js.map +0 -1
  97. package/dist/commands/research.d.ts +0 -14
  98. package/dist/commands/research.d.ts.map +0 -1
  99. package/dist/commands/research.js +0 -181
  100. package/dist/commands/research.js.map +0 -1
package/README.en.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  SpecCore is a specification-driven development framework for AI-native teams. 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
- > 💡 **v5.6.3** | 49 Commands | 35 Intent Types | Multi-Platform
11
+ > 💡 **v5.19.0** | 68 Commands | 38 Intent Types | Multi-Platform
12
12
 
13
13
  ---
14
14
 
@@ -21,7 +21,7 @@ SpecCore has two distinct parts:
21
21
  | **Where** | Terminal | AI coding tools (WorkBuddy / Cursor / Claude) |
22
22
  | **How** | `speccore init` | Type `/spec-xxx` |
23
23
  | **Mechanism** | TypeScript, direct file ops | Markdown prompts, AI reads & executes |
24
- | **Count** | 39 CLI commands | 39 Slash Commands |
24
+ | **Count** | 68 CLI commands | 54 Slash Commands |
25
25
  | **When** | Init, validation, batch ops | Daily dev: iteration, execution, review, archive |
26
26
 
27
27
  > 💡 **Remember**: `speccore` prefix → Terminal; `/spec` prefix → AI tool.
@@ -64,7 +64,7 @@ speccore spec "How's the progress?"
64
64
 
65
65
  - **🚀 Quick Init**: One command initializes the full project structure, auto-integrates WorkBuddy
66
66
  - **📱 Multi-Platform**: `--platforms=web,h5,miniapp` per-platform Task management, dynamic platform types
67
- - **🧠 Intent Recognition**: 35 intent types, 200+ keywords, natural language → command matching
67
+ - **🧠 Intent Recognition**: 38 intent types, 200+ keywords, natural language → command matching
68
68
  - **🌐 Global Layer**: Cross-project requirement indexing via GLOBAL/ architecture
69
69
  - **📊 Progress Tracking**: Auto-detect active iteration, per-platform/per-assignee stats
70
70
  - **✅ Auto Compliance**: Scan all Spec files, check required fields and format
@@ -105,7 +105,7 @@ User Input (Natural Language / Slash Command)
105
105
 
106
106
  ---
107
107
 
108
- ## 🔧 CLI Commands Quick Reference (39 total)
108
+ ## 🔧 CLI Commands Quick Reference (68 total)
109
109
 
110
110
  > Run in terminal. All commands start with `speccore`.
111
111
 
@@ -141,7 +141,7 @@ User Input (Natural Language / Slash Command)
141
141
  | `speccore audit` | `/spec-ai-audit` | AI smart audit |
142
142
  | `speccore spec "query"` | `/spec query` | Natural language intent |
143
143
 
144
- > 📋 Full command reference: [Command Reference](docs/commands.en.md) | 🧠 Intent mapping: [Intent Map](docs/commands.en.md#natural-language-intent-mapping-35-types)
144
+ > 📋 Full command reference: [Command Reference](docs/commands.en.md) | 🧠 Intent mapping: [Intent Map](docs/commands.en.md#natural-language-intent-mapping-38-types)
145
145
 
146
146
  ---
147
147
 
@@ -179,12 +179,12 @@ SpecCore natively integrates WorkBuddy.
179
179
  | [SDD Methodology](docs/sdd-methodology.en.md) | What is SDD, why, how |
180
180
  | [Quick Reference](docs/quick-reference.en.md) | One-page: commands + safety + CI |
181
181
  | [Quick Start](docs/quick-start.en.md) | Install → Init → Import → Multi-platform → Scenarios |
182
- | [Command Reference](docs/commands.en.md) | 49 commands full params + 35 intents |
182
+ | [Command Reference](docs/commands.en.md) | 68 commands full params + 38 intents |
183
183
  | [Tool Adaptation](docs/tool-adaptation.en.md) | WorkBuddy integration + workflow + security |
184
184
  | [Usage Guide](docs/usage-guide.en.md) | File safety: manual edit vs CLI command |
185
185
  | [Workspace Layout](docs/workspace-organization.en.md) | Recommended directory structure |
186
186
  | [Migration Guide](docs/migration-guide.en.md) | Shell v3.x → CLI v5.x |
187
- | [CHANGELOG](CHANGELOG.en.md) | Version history (v1.0.0 → v5.6.1) |
187
+ | [CHANGELOG](CHANGELOG.en.md) | Version history (v1.0.0 → v5.19.0) |
188
188
  | [Example](examples/task-management/README.md) | Full demo: req→Spec→generated code |
189
189
  | [README.md](README.md) | 中文项目概述 |
190
190
 
@@ -231,7 +231,7 @@ bash verify.sh # Run tests
231
231
 
232
232
  ## Version
233
233
 
234
- v5.6.3 | 🔧 CLI Commands: 49 | 🧠 Intents: 35
234
+ v5.19.0 | 🔧 CLI Commands: 68 | 🧠 Intents: 38
235
235
 
236
236
  Changelog: [CHANGELOG.en.md](CHANGELOG.en.md)
237
237
 
package/README.md CHANGED
@@ -19,7 +19,7 @@ SpecCore 由两部分组成,**职责明确,互不混淆**:
19
19
  | **在哪里执行** | 终端 / Terminal | AI 编程工具(WorkBuddy / Cursor / Claude 等) |
20
20
  | **怎么用** | `speccore init` | 输入 `/spec-xxx` |
21
21
  | **什么原理** | TypeScript 编译,直接操作文件 | Markdown 指令,AI 读取后执行 |
22
- | **数量** | 54 个 CLI 命令 | 54 个 Slash Command |
22
+ | **数量** | 68 个 CLI 命令 | 54 个 Slash Command |
23
23
  | **何时用** | 项目初始化、文件校验、批量操作 | 日常开发:需求管理、开发执行、审查归档 |
24
24
 
25
25
  > 💡 **简单记忆**:`speccore` 开头 → 终端执行;`/spec` 开头 → AI 工具中执行。
@@ -62,7 +62,7 @@ speccore spec "进度怎么样了"
62
62
 
63
63
  - **🚀 快速初始化**:一行命令初始化完整 SpecCore 项目结构,自动集成 WorkBuddy
64
64
  - **📱 多平台支持**:`--platforms=web,h5,miniapp` 按端管理 Task,动态添加平台类型
65
- - **🧠 意图识别引擎**:36 种意图类型,200+ 关键词,自然语言自动匹配命令
65
+ - **🧠 意图识别引擎**:38 种意图类型,200+ 关键词,自然语言自动匹配命令
66
66
  - **🌐 多项目全量层**:GLOBAL/ 统一管理跨项目需求索引、架构和技术栈
67
67
  - **📊 实时进度追踪**:自动识别活跃期次,统计任务完成率,按平台/人员/类型统计
68
68
  - **✅ 自动合规检查**:扫描所有 Spec 文件,检查必填项和格式
@@ -104,7 +104,7 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
104
104
 
105
105
  ---
106
106
 
107
- ## 🔧 终端命令速查(54 个 CLI 命令)
107
+ ## 🔧 终端命令速查(68 个 CLI 命令)
108
108
 
109
109
  > 在终端中执行,所有命令以 `speccore` 开头。
110
110
 
@@ -126,7 +126,7 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
126
126
 
127
127
  ## 🤖 AI 命令(Slash Command)对应关系
128
128
 
129
- > 在 AI 工具(WorkBuddy / Cursor / Claude Code 等)中输入 `/` + 命令。AI 命令在底层调用对应的 CLI 命令执行。54 个 CLI 命令都有对应的 `/spec-*` 形式。
129
+ > 在 AI 工具(WorkBuddy / Cursor / Claude Code 等)中输入 `/` + 命令。AI 命令在底层调用对应的 CLI 命令执行。68 个 CLI 命令都有对应的 `/spec-*` 形式。
130
130
 
131
131
  | CLI 终端命令 | AI Slash Command | 用途 |
132
132
  | :--- | :--- | :--- |
@@ -146,7 +146,7 @@ SpecCore 采用**确定性逻辑与智能逻辑解耦**的架构:
146
146
  | `speccore audit` | `/spec-ai-audit` | AI 智能审计 |
147
147
  | `speccore spec "查询"` | `/spec 查询` | 自然语言智能入口 |
148
148
 
149
- > 📋 完整命令参数见 [命令参考手册](docs/命令参考.md) | 🧠 36 种意图映射见 [意图映射表](docs/命令参考.md#自然语言意图映射36-种)
149
+ > 📋 完整命令参数见 [命令参考手册](docs/命令参考.md) | 🧠 38 种意图映射见 [意图映射表](docs/命令参考.md#自然语言意图映射36-种)
150
150
 
151
151
  ---
152
152
 
@@ -180,19 +180,18 @@ SpecCore 原生集成 WorkBuddy(`speccore init` 自动创建 `.workbuddy/` ski
180
180
 
181
181
  | 文档 | 内容 |
182
182
  | :--- | :--- |
183
- | [场景实战](docs/场景实战.md) | 25 个真实场景:从零启动→日常开发→CI/CD→变更处理等 |
183
+ | 📊 [**总览**](docs/总览.md) | **命令地图 + 工作流全景 + 理念图解 + 8框架横评** |
184
+ | [快速开始指南](docs/快速开始.md) | 安装 → 7 步核心流程 → 命令速查 |
185
+ | [场景实战](docs/场景实战.md) | 37 个真实场景:从零启动→PR→回滚→选型 |
186
+ | [命令参考手册](docs/命令参考.md) | 全部命令完整参数 |
184
187
  | [SDD 方法论](docs/SDD方法论.md) | SDD 是什么、为什么、怎么做 |
185
- | [速查卡](docs/速查卡.md) | 一页掌握:常用命令 + 安全口诀 + CI 模板 |
186
- | [快速开始指南](docs/快速开始.md) | 安装 → 初始化 → 导入 → 多端 Task → 场景速查 |
187
- | [命令参考手册](docs/命令参考.md) | 54 个命令完整参数 + 36 种意图映射 |
188
- | [工具适配说明](docs/工具适配说明.md) | WorkBuddy 集成原理 + 工作流程 + 安全检查 |
189
- | [使用指南](docs/使用指南.md) | 完整使用方式:💬 自然语言对话 + ⌨️ CLI 命令对照 |
188
+ | [工具适配说明](docs/工具适配说明.md) | WorkBuddy 集成原理 + 安全检查 |
190
189
  | [工作空间组织](docs/工作空间组织.md) | 推荐目录结构 + 多工程协作 |
191
- | [迁移指南](docs/migration-guide.md) | Shell v3.x → CLI v5.x 迁移步骤 |
192
- | [CI/CD 集成](docs/CI-CD与spec注释集成指南.md) | @spec 注释 + GitHub Actions + 工作流 |
193
- | [Spec 加载机制](docs/Spec三层加载机制.md) | 三层 Spec 协同:全局约束 → 期次上下文 → Task 执行 |
190
+ | [迁移指南](docs/migration-guide.md) | Shell v3.x → CLI v5.x 迁移 |
191
+ | [CI/CD 集成](docs/CI-CD与spec注释集成指南.md) | @spec 注释 + GitHub Actions |
192
+ | [Spec 加载机制](docs/Spec三层加载机制.md) | 三层 Spec 协同 |
194
193
  | [示例项目](examples/task-management/README.md) | 完整演示:需求→Spec→生成代码 |
195
- | [CHANGELOG](CHANGELOG.md) | 版本历史与更新日志(v1.0.0 → v5.11.0) |
194
+ | [CHANGELOG](CHANGELOG.md) | 版本历史(v1.0.0 → v5.19.0) |
196
195
  | [README.en.md](README.en.md) | English project overview |
197
196
 
198
197
  ---
@@ -247,7 +246,7 @@ SpecCore 不禁止手动编辑文件,但不同文件的安全级别不同。
247
246
  | `GLOBAL/REQUIREMENT.md` | 改完立即 `speccore sync-global` |
248
247
  | `CHANGELOG.md` | 建议用 `speccore change` 自动追加 |
249
248
 
250
- > 📚 完整指南见 [使用指南](docs/使用指南.md)
249
+
251
250
 
252
251
  ---
253
252
 
@@ -275,7 +274,7 @@ bash verify.sh
275
274
 
276
275
  ## 版本
277
276
 
278
- v5.11.0 | 🔧 CLI 命令 54 个 | 🧠 意图识别 36
277
+ v5.19.0 | 🔧 CLI 命令 68 个 | 🧠 意图识别 38
279
278
 
280
279
  版本历史见 [CHANGELOG.md](CHANGELOG.md)
281
280
 
package/dist/cli.js CHANGED
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  const commander_1 = require("commander");
4
37
  const package_json_1 = require("../package.json");
@@ -20,7 +53,7 @@ const execute_1 = require("./commands/execute");
20
53
  const spec_1 = require("./commands/spec");
21
54
  const goal_1 = require("./commands/goal");
22
55
  const bugfix_1 = require("./commands/bugfix");
23
- const research_1 = require("./commands/research");
56
+ const new_task_1 = require("./commands/new-task");
24
57
  const change_1 = require("./commands/change");
25
58
  const sync_1 = require("./commands/sync");
26
59
  const pattern_1 = require("./commands/pattern");
@@ -29,6 +62,8 @@ const handover_1 = require("./commands/handover");
29
62
  const retro_1 = require("./commands/retro");
30
63
  const template_add_1 = require("./commands/template-add");
31
64
  const help_1 = require("./commands/help");
65
+ const dev_1 = require("./commands/dev");
66
+ const status_panel_1 = require("./commands/status-panel");
32
67
  const demo_1 = require("./commands/demo");
33
68
  const welcome_1 = require("./commands/welcome");
34
69
  const word2spec_1 = require("./commands/word2spec");
@@ -44,27 +79,30 @@ const dashboard_1 = require("./commands/dashboard");
44
79
  const audit_1 = require("./commands/audit");
45
80
  const analyze_1 = require("./commands/analyze");
46
81
  const lifecycle_1 = require("./commands/lifecycle");
82
+ const pr_1 = require("./commands/pr");
83
+ const constitution_builder_1 = require("./core/constitution-builder");
84
+ const context_output_1 = require("./commands/context-output");
47
85
  const done_1 = require("./commands/done");
48
86
  // rename 命令
49
87
  const rename_1 = require("./commands/rename");
50
88
  // v4.0.0 新增命令
51
- const new_task_1 = require("./commands/new-task");
52
89
  const platform_add_1 = require("./commands/platform-add");
53
90
  const index_update_1 = require("./commands/index-update");
54
- const context_1 = require("./commands/context");
55
91
  // v4.6.0 迁移命令
56
92
  const migrate_1 = require("./commands/migrate");
57
93
  // v4.7.0 体验增强
58
94
  const completion_1 = require("./commands/completion");
59
95
  const backup_1 = require("./commands/backup");
60
96
  // v4.8.0 高级功能
61
- const hooks_1 = require("./commands/hooks");
62
97
  const current_1 = require("./commands/current");
63
98
  // v4.9.0 完善
64
99
  const update_1 = require("./commands/update");
65
100
  // v5.3.0 新增
66
101
  const diff_1 = require("./commands/diff");
67
102
  const trace_1 = require("./commands/trace");
103
+ const merge_check_1 = require("./commands/merge-check");
104
+ const history_2 = require("./commands/history");
105
+ const tracker_1 = require("./commands/tracker");
68
106
  // v5.5.0 新增
69
107
  const delete_1 = require("./commands/delete");
70
108
  // v5.6.0 新增
@@ -98,6 +136,54 @@ commander_1.program
98
136
  .description('First-time setup guide (interactive)')
99
137
  .option('--force', 'Force re-initialization')
100
138
  .action(welcome_1.welcomeCommand);
139
+ commander_1.program
140
+ .command('status-panel')
141
+ .alias('sp')
142
+ .description('IDE-style status panel: phase + tasks + progress + next action')
143
+ .action(status_panel_1.statusPanelCommand);
144
+ commander_1.program
145
+ .command('open')
146
+ .alias('opn')
147
+ .description('Open task files in editor')
148
+ .option('-t, --task <task>', 'Task to open')
149
+ .option('-i, --iteration <iteration>', 'Target iteration')
150
+ .action(async (options) => {
151
+ const { getDefaultIteration } = await Promise.resolve().then(() => __importStar(require('./core/context')));
152
+ const it = await getDefaultIteration(options.iteration);
153
+ if (!it)
154
+ return;
155
+ const fs = require('fs');
156
+ const iterDir = `期次-${it}`;
157
+ const entries = fs.readdirSync(iterDir, { withFileTypes: true });
158
+ const task = entries.find((e) => e.isDirectory() && e.name.startsWith(options.task || ''));
159
+ if (task) {
160
+ const { logger } = require('./utils/logger');
161
+ logger.info(`\n📂 ${task.name}:`);
162
+ const files = ['REQ.md', 'TECH.md', 'TASK.md', 'TEST.md', 'API_CONTRACT.yaml'];
163
+ for (const f of files) {
164
+ const path = require('path').join(iterDir, task.name, f.startsWith('API') ? '_shared' : 'backend', f);
165
+ if (fs.existsSync(path))
166
+ logger.info(` ${path}`);
167
+ }
168
+ }
169
+ });
170
+ commander_1.program;
171
+ commander_1.program
172
+ .command('dev')
173
+ .alias('d')
174
+ .description('Smart dev entry: auto-detect phase and suggest next step')
175
+ .option('-i, --iteration <iteration>', 'Target iteration')
176
+ .option('--force', 'Auto-execute the next step')
177
+ .action(dev_1.devCommand);
178
+ commander_1.program;
179
+ commander_1.program;
180
+ commander_1.program
181
+ .command('dev')
182
+ .alias('d')
183
+ .description('Smart dev entry: auto-detect phase and suggest next step')
184
+ .option('-i, --iteration <iteration>', 'Target iteration')
185
+ .option('--force', 'Auto-execute the next step')
186
+ .action(dev_1.devCommand);
101
187
  commander_1.program
102
188
  .command('demo')
103
189
  .alias('dm')
@@ -214,16 +300,30 @@ commander_1.program
214
300
  .command('research')
215
301
  .alias('rs')
216
302
  .description('Technical research: evaluate solutions and compare options')
217
- .option('-n, --name <name>', 'Research topic')
218
- .option('-d, --desc <desc>', 'Research description')
219
- .option('-t, --topic <topic>', 'Research topic (alias for --name)')
220
- .option('--options <options>', 'Comparison options (comma-separated)')
221
- .option('--task-id <id>', 'Task ID')
222
- .option('-i, --iteration <iteration>', 'Target iteration')
223
- .action(research_1.researchCommand);
303
+ .option('-n, --name <name>', 'Research topic');
224
304
  // ================================================================
225
305
  // ⚡ 执行与调度
226
306
  // ================================================================
307
+ commander_1.program
308
+ .command('pr')
309
+ .alias('mr')
310
+ .description('Create Pull Request with task summary')
311
+ .option('-t, --task <task>', 'Target task (auto-detect from branch if omitted)')
312
+ .option('-i, --iteration <iteration>', 'Target iteration')
313
+ .option('--base <branch>', 'Base branch', 'main')
314
+ .option('--draft', 'Create as draft PR')
315
+ .option('--title <title>', 'Custom PR title')
316
+ .action(pr_1.prCommand);
317
+ commander_1.program
318
+ .command('pr')
319
+ .alias('mr')
320
+ .description('Create Pull Request with task summary')
321
+ .option('-t, --task <task>', 'Target task (auto-detect from branch if omitted)')
322
+ .option('-i, --iteration <iteration>', 'Target iteration')
323
+ .option('--base <branch>', 'Base branch', 'main')
324
+ .option('--draft', 'Create as draft PR')
325
+ .option('--title <title>', 'Custom PR title')
326
+ .action(pr_1.prCommand);
227
327
  commander_1.program
228
328
  .command('plan')
229
329
  .alias('pl')
@@ -260,6 +360,9 @@ commander_1.program
260
360
  .option('--force', 'Skip preview and execute directly')
261
361
  .option('--strict', 'Pre-flight check: review req/tech/test before code gen')
262
362
  .option('--base <branch>', 'Base branch for task branching (default: current)')
363
+ .option('--skip <tasks>', 'Comma-separated task IDs to skip')
364
+ .option('--only <tasks>', 'Comma-separated task IDs to execute exclusively (whitelist)')
365
+ .option('--agent <tool>', 'External AI: copilot/claude/cursor/trae/qoder/windsurf/codebuddy')
263
366
  .option('--hotfix', 'Emergency fix: skip reverse sync (30min grace, 24h mandatory)')
264
367
  .action(execute_1.executeCommand);
265
368
  // ================================================================
@@ -368,6 +471,44 @@ commander_1.program
368
471
  // ================================================================
369
472
  // ⚙️ 配置与工具
370
473
  // ================================================================
474
+ commander_1.program
475
+ .command('context')
476
+ .alias('ctx')
477
+ .description('Output task context for any AI tool (Copilot/Claude/GPT)')
478
+ .option('-t, --task <task>', 'Target task')
479
+ .option('-i, --iteration <iteration>', 'Target iteration')
480
+ .action(context_output_1.contextCommand);
481
+ commander_1.program
482
+ .command('context')
483
+ .alias('ctx')
484
+ .description('Output task context for any AI tool (Copilot/Claude/GPT)')
485
+ .option('-t, --task <task>', 'Target task')
486
+ .option('-i, --iteration <iteration>', 'Target iteration')
487
+ .action(context_output_1.contextCommand);
488
+ commander_1.program
489
+ .command('constitution')
490
+ .alias('cn')
491
+ .description('Auto-detect tech stack and generate CONSTITUTION.md rules')
492
+ .action(async () => { await (0, constitution_builder_1.buildConstitution)(process.cwd()); });
493
+ commander_1.program
494
+ .command('context')
495
+ .alias('ctx')
496
+ .description('Output task context for any AI tool (Copilot/Claude/GPT)')
497
+ .option('-t, --task <task>', 'Target task')
498
+ .option('-i, --iteration <iteration>', 'Target iteration')
499
+ .action(context_output_1.contextCommand);
500
+ commander_1.program
501
+ .command('context')
502
+ .alias('ctx')
503
+ .description('Output task context for any AI tool (Copilot/Claude/GPT)')
504
+ .option('-t, --task <task>', 'Target task')
505
+ .option('-i, --iteration <iteration>', 'Target iteration')
506
+ .action(context_output_1.contextCommand);
507
+ commander_1.program
508
+ .command('constitution')
509
+ .alias('cn')
510
+ .description('Auto-detect tech stack and generate CONSTITUTION.md rules')
511
+ .action(async () => { await (0, constitution_builder_1.buildConstitution)(process.cwd()); });
371
512
  commander_1.program
372
513
  .command('config')
373
514
  .alias('cf')
@@ -471,6 +612,11 @@ commander_1.program
471
612
  .description('View global layer status: all projects, requirements, architecture')
472
613
  .option('--project <name>', 'Filter by project name')
473
614
  .action(global_status_1.globalStatusCommand);
615
+ commander_1.program
616
+ .command('ops')
617
+ .alias('op')
618
+ .description('View operation history (command log)')
619
+ .action(history_2.opsCommand);
474
620
  commander_1.program
475
621
  .command('history')
476
622
  .alias('hs')
@@ -569,7 +715,7 @@ commander_1.program
569
715
  .description('View task context loading status and dependency chain (v4.0)')
570
716
  .option('--req <req>')
571
717
  .option('--task <task>', 'Target task (default: current task)')
572
- .action(context_1.contextCommand);
718
+ .action(context_output_1.contextCommand);
573
719
  // ================================================================
574
720
  // 快捷别名(顶层别名)
575
721
  // ================================================================
@@ -606,6 +752,8 @@ commander_1.program
606
752
  .action(done_1.doneCommand);
607
753
  commander_1.program
608
754
  .command('completion [shell]')
755
+ .alias('cmp')
756
+ .alias('cmp')
609
757
  .description('Generate shell completion script (bash/zsh)')
610
758
  .action(completion_1.completionCommand);
611
759
  commander_1.program
@@ -618,8 +766,7 @@ commander_1.program
618
766
  // v4.8.0 高级功能
619
767
  commander_1.program
620
768
  .command('hooks')
621
- .description('Install Git hooks (pre-commit + pre-push)')
622
- .action(hooks_1.hooksCommand);
769
+ .description('Install Git hooks (pre-commit + pre-push)');
623
770
  commander_1.program
624
771
  .command('current')
625
772
  .alias('cr')
@@ -648,6 +795,61 @@ commander_1.program
648
795
  .requiredOption('--source <name>', 'Source iteration/baseline')
649
796
  .requiredOption('--target <name>', 'Target iteration/baseline')
650
797
  .action(diff_1.diffCommand);
798
+ commander_1.program
799
+ .command('tracker')
800
+ .alias('tr')
801
+ .description('View global requirement change tracker')
802
+ .action(tracker_1.trackerCommand);
803
+ commander_1.program
804
+ .command('merge-check')
805
+ .alias('mc')
806
+ .description('Predict merge conflicts across task branches')
807
+ .option('-i, --iteration <iteration>', 'Target iteration')
808
+ .action(async (options) => { const { getDefaultIteration } = await Promise.resolve().then(() => __importStar(require('./core/context'))); const it = await getDefaultIteration(options.iteration); if (it)
809
+ await (0, merge_check_1.mergeCheck)(it); });
810
+ commander_1.program
811
+ .command('rollback')
812
+ .alias('rb')
813
+ .description('Rollback a task: revert branch + archive spec')
814
+ .option('-t, --task <task>', 'Task to rollback')
815
+ .option('-i, --iteration <iteration>', 'Target iteration')
816
+ .option('--reason <reason>', 'Rollback reason')
817
+ .action(async (options) => { const it = await require('../core/context').getDefaultIteration(options.iteration); if (it && options.task)
818
+ await (0, merge_check_1.rollbackTask)(options.task, it, options.reason); });
819
+ commander_1.program
820
+ .command('arch-update')
821
+ .alias('au')
822
+ .description('Auto-update ARCHITECTURE.md with new APIs/tables')
823
+ .option('-i, --iteration <iteration>', 'Source iteration')
824
+ .option('--apis <apis>', 'Comma-separated API paths')
825
+ .option('--tables <tables>', 'Comma-separated table names')
826
+ .action(async (options) => { const it = await require('../core/context').getDefaultIteration(options.iteration); if (it)
827
+ await (0, merge_check_1.updateArchitecture)(it, (options.apis || '').split(',').filter(Boolean), (options.tables || '').split(',').filter(Boolean)); });
828
+ commander_1.program
829
+ .command('merge-check')
830
+ .alias('mc')
831
+ .description('Predict merge conflicts across task branches')
832
+ .option('-i, --iteration <iteration>', 'Target iteration')
833
+ .action(async (options) => { const { getDefaultIteration } = await Promise.resolve().then(() => __importStar(require('./core/context'))); const it = await getDefaultIteration(options.iteration); if (it)
834
+ await (0, merge_check_1.mergeCheck)(it); });
835
+ commander_1.program
836
+ .command('rollback')
837
+ .alias('rb')
838
+ .description('Rollback a task: revert branch + archive spec')
839
+ .option('-t, --task <task>', 'Task to rollback')
840
+ .option('-i, --iteration <iteration>', 'Target iteration')
841
+ .option('--reason <reason>', 'Rollback reason')
842
+ .action(async (options) => { const it = await require('../core/context').getDefaultIteration(options.iteration); if (it && options.task)
843
+ await (0, merge_check_1.rollbackTask)(options.task, it, options.reason); });
844
+ commander_1.program
845
+ .command('arch-update')
846
+ .alias('au')
847
+ .description('Auto-update ARCHITECTURE.md with new APIs/tables')
848
+ .option('-i, --iteration <iteration>', 'Source iteration')
849
+ .option('--apis <apis>', 'Comma-separated API paths')
850
+ .option('--tables <tables>', 'Comma-separated table names')
851
+ .action(async (options) => { const it = await require('../core/context').getDefaultIteration(options.iteration); if (it)
852
+ await (0, merge_check_1.updateArchitecture)(it, (options.apis || '').split(',').filter(Boolean), (options.tables || '').split(',').filter(Boolean)); });
651
853
  commander_1.program
652
854
  .command('trace')
653
855
  .alias('tr')
@@ -681,5 +883,87 @@ commander_1.program
681
883
  .option('--iteration <name>', 'Watch a specific iteration')
682
884
  .action(watch_1.watchCommand);
683
885
  // Parse arguments
886
+ // ── Adaptive welcome panel (no args) ──
887
+ if (process.argv.length <= 2) {
888
+ const { existsSync, readdirSync, readFileSync } = require('fs');
889
+ const { join } = require('path');
890
+ const { logger } = require('./utils/logger');
891
+ const pkg = require('../../package.json');
892
+ let phase = 'init', iteration = '', total = 0, done2 = 0;
893
+ let nextCmd = 'speccore init', nextDesc = '初始化 SpecCore 项目';
894
+ if (existsSync('.speccore')) {
895
+ try {
896
+ const items = readdirSync('.');
897
+ const idirs = items.filter((d) => d.startsWith('期次-')).sort();
898
+ if (idirs.length > 0) {
899
+ iteration = idirs[0].slice(3);
900
+ const base = idirs[0];
901
+ const req = join(base, '00-需求文档', 'REQUIREMENT.md');
902
+ const ana = join(base, '00-需求文档', 'ANALYSIS.md');
903
+ if (!existsSync(req)) {
904
+ phase = 'require';
905
+ nextCmd = 'speccore word2spec -i ' + iteration;
906
+ nextDesc = '导入需求文档';
907
+ }
908
+ else if (!existsSync(ana)) {
909
+ phase = 'analyze';
910
+ nextCmd = 'speccore analyze --iteration=' + iteration;
911
+ nextDesc = '需求分析';
912
+ }
913
+ else {
914
+ const tds = readdirSync(base).filter((d) => d.startsWith('Task-'));
915
+ if (tds.length === 0) {
916
+ phase = 'split';
917
+ nextCmd = 'speccore iteration split --iteration=' + iteration;
918
+ nextDesc = '拆分任务';
919
+ }
920
+ else {
921
+ total = tds.length;
922
+ for (const td of tds) {
923
+ const tm = join(base, td, 'backend', 'TASK.md');
924
+ if (existsSync(tm) && readFileSync(tm, 'utf-8').includes('已完成'))
925
+ done2++;
926
+ }
927
+ if (done2 < total) {
928
+ phase = 'dev';
929
+ nextCmd = 'speccore execute --task=' + tds[done2] + ' --force';
930
+ nextDesc = '执行开发 (' + (done2 + 1) + '/' + total + ')';
931
+ }
932
+ else {
933
+ phase = 'done';
934
+ nextCmd = 'speccore pr';
935
+ nextDesc = '创建 PR 提交代码';
936
+ }
937
+ }
938
+ }
939
+ }
940
+ }
941
+ catch { }
942
+ }
943
+ const icons = { init: '🚀', require: '📝', analyze: '🔍', split: '📦', dev: '💻', done: '✨' };
944
+ const names = { init: '未初始化', require: '待导入需求', analyze: '待分析', split: '待拆分', dev: '开发中', done: '已完成' };
945
+ logger.info('');
946
+ logger.info('┌──────────────────────────────────────────┐');
947
+ logger.info('│ SpecCore · v' + pkg.version + ' · 68 commands │');
948
+ logger.info('├──────────────────────────────────────────┤');
949
+ if (iteration)
950
+ logger.info('│ 期次: ' + iteration.padEnd(33) + '│');
951
+ logger.info('│ 状态: ' + icons[phase] + ' ' + (names[phase] || phase).padEnd(33) + '│');
952
+ if (total > 0) {
953
+ const pct = Math.round(done2 / total * 100);
954
+ const bar = '█'.repeat(Math.round(pct / 10)) + '░'.repeat(10 - Math.round(pct / 10));
955
+ const taskLine = '│ 任务: ' + done2 + '/' + total + ' ' + bar + ' ' + pct + '%';
956
+ logger.info(taskLine.padEnd(46) + '│');
957
+ }
958
+ logger.info('│ │');
959
+ logger.info('│ 👉 下一步: ' + nextCmd.padEnd(33) + '│');
960
+ logger.info('│ ' + nextDesc.padEnd(41) + '│');
961
+ logger.info('│ │');
962
+ logger.info('│ 💡 speccore --help 查看全部命令 │');
963
+ logger.info('│ 📊 speccore status-panel 状态面板 │');
964
+ logger.info('└──────────────────────────────────────────┘');
965
+ logger.info('');
966
+ process.exit(0);
967
+ }
684
968
  commander_1.program.parse();
685
969
  //# sourceMappingURL=cli.js.map