sillyspec 3.7.7 → 3.7.9

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 (43) hide show
  1. package/.sillyspec/changes/dashboard/design.md +219 -0
  2. package/.sillyspec/plans/2026-04-05-dashboard.md +737 -0
  3. package/.sillyspec/specs/2026-04-05-dashboard-design.md +206 -0
  4. package/bin/sillyspec.js +0 -0
  5. package/package.json +1 -1
  6. package/packages/dashboard/dist/assets/index-Bh-GPjKY.css +1 -0
  7. package/packages/dashboard/dist/assets/index-CrCn5Gg6.js +17 -0
  8. package/packages/dashboard/dist/index.html +16 -0
  9. package/packages/dashboard/index.html +15 -0
  10. package/packages/dashboard/package-lock.json +2164 -0
  11. package/packages/dashboard/package.json +22 -0
  12. package/packages/dashboard/server/executor.js +86 -0
  13. package/packages/dashboard/server/index.js +359 -0
  14. package/packages/dashboard/server/parser.js +154 -0
  15. package/packages/dashboard/server/watcher.js +277 -0
  16. package/packages/dashboard/src/App.vue +154 -0
  17. package/packages/dashboard/src/components/ActionBar.vue +100 -0
  18. package/packages/dashboard/src/components/CommandPalette.vue +117 -0
  19. package/packages/dashboard/src/components/DetailPanel.vue +122 -0
  20. package/packages/dashboard/src/components/LogStream.vue +85 -0
  21. package/packages/dashboard/src/components/PipelineStage.vue +75 -0
  22. package/packages/dashboard/src/components/PipelineView.vue +94 -0
  23. package/packages/dashboard/src/components/ProjectList.vue +152 -0
  24. package/packages/dashboard/src/components/StageBadge.vue +53 -0
  25. package/packages/dashboard/src/components/StepCard.vue +89 -0
  26. package/packages/dashboard/src/composables/useDashboard.js +171 -0
  27. package/packages/dashboard/src/composables/useKeyboard.js +117 -0
  28. package/packages/dashboard/src/composables/useWebSocket.js +129 -0
  29. package/packages/dashboard/src/main.js +5 -0
  30. package/packages/dashboard/src/style.css +132 -0
  31. package/packages/dashboard/vite.config.js +18 -0
  32. package/src/index.js +68 -8
  33. package/src/init.js +23 -1
  34. package/src/progress.js +422 -0
  35. package/src/setup.js +16 -0
  36. package/templates/archive.md +56 -0
  37. package/templates/brainstorm.md +82 -26
  38. package/templates/commit.md +2 -0
  39. package/templates/execute.md +20 -1
  40. package/templates/progress-format.md +90 -0
  41. package/templates/quick.md +36 -3
  42. package/templates/resume-dialog.md +55 -0
  43. package/templates/skills/playwright-e2e/SKILL.md +1 -1
@@ -0,0 +1,219 @@
1
+ # SillySpec Dashboard — 技术方案
2
+
3
+ ## 架构决策
4
+
5
+ | 决策 | 选择 | 理由 |
6
+ |---|---|---|
7
+ | 前端框架 | Vue 3 + Vite | 轻量、打包快、SillySpec 用户已有 Node.js |
8
+ | CSS | Tailwind CSS | 原子化、深色主题变量管理方便 |
9
+ | 后端 | Node.js 原生 http + ws | 不引入 Express,零重依赖 |
10
+ | 文件监听 | chokidar | 跨平台、成熟稳定 |
11
+ | 数据库 | 无 | 纯文件系统,与 SillySpec 哲学一致 |
12
+ | 包结构 | SillySpec 子包 packages/dashboard | 独立 package.json,可单独开发 |
13
+
14
+ ## 文件变更清单
15
+
16
+ ### 新增文件
17
+
18
+ | 文件 | 说明 |
19
+ |---|---|
20
+ | `packages/dashboard/package.json` | 子包配置,依赖 vue/vite/tailwind/chokidar/ws |
21
+ | `packages/dashboard/vite.config.js` | Vite 构建配置,构建产物输出到 dist/ |
22
+ | `packages/dashboard/server/index.js` | HTTP + WebSocket 服务启动入口 |
23
+ | `packages/dashboard/server/watcher.js` | chokidar 监听 .sillyspec/,解析文件变化,emit 事件 |
24
+ | `packages/dashboard/server/api.js` | REST 路由:GET /api/projects, GET /api/project/:name/status |
25
+ | `packages/dashboard/server/executor.js` | CLI 命令执行器(child_process.spawn + stdout 流式推送) |
26
+ | `packages/dashboard/src/main.js` | Vue 应用入口 |
27
+ | `packages/dashboard/src/App.vue` | 根组件,三栏布局 |
28
+ | `packages/dashboard/src/components/ProjectList.vue` | 左栏项目列表 |
29
+ | `packages/dashboard/src/components/PipelineView.vue` | 中栏阶段 pipeline + 时间线 |
30
+ | `packages/dashboard/src/components/StepCard.vue` | 步骤卡片(三级信息密度) |
31
+ | `packages/dashboard/src/components/DetailPanel.vue` | 右栏详情 + 日志 |
32
+ | `packages/dashboard/src/components/LogStream.vue` | 终端风格日志流(等宽字体、语法高亮、搜索过滤) |
33
+ | `packages/dashboard/src/components/CommandPalette.vue` | Cmd+K 命令面板 |
34
+ | `packages/dashboard/src/components/StageBadge.vue` | 阶段状态标签组件 |
35
+ | `packages/dashboard/src/components/ActionBar.vue` | CLI 操作按钮(下一步、阶段切换) |
36
+ | `packages/dashboard/src/composables/useWebSocket.js` | WebSocket 连接管理(自动重连、心跳) |
37
+ | `packages/dashboard/src/composables/useKeyboard.js` | 全局键盘快捷键 |
38
+ | `packages/dashboard/src/styles/theme.css` | CSS 变量(配色、间距、动效) |
39
+ | `packages/dashboard/index.html` | Vite HTML 入口 |
40
+ | `packages/dashboard/tailwind.config.js` | Tailwind 配置(自定义颜色) |
41
+
42
+ ### 修改文件
43
+
44
+ | 文件 | 变更 |
45
+ |---|---|
46
+ | `src/index.js` | 新增 `dashboard` 命令分支 |
47
+ | `package.json` | workspace 引用 packages/dashboard |
48
+
49
+ ## 数据模型
50
+
51
+ ### 前端状态(composable/store)
52
+
53
+ ```javascript
54
+ {
55
+ projects: [
56
+ {
57
+ name: 'my-project',
58
+ path: '/Users/x/my-project',
59
+ currentStage: 'plan',
60
+ stages: {
61
+ brainstorm: { status: 'completed', steps: 10, completedSteps: 10, duration: '25min' },
62
+ plan: { status: 'in-progress', steps: 5, completedSteps: 2, duration: '8min' },
63
+ execute: { status: 'pending', steps: 0, completedSteps: 0 },
64
+ verify: { status: 'pending', steps: 0, completedSteps: 0 }
65
+ },
66
+ lastActive: '2026-04-05T14:30:00Z'
67
+ }
68
+ ],
69
+ activeProject: 'my-project', // 当前选中
70
+ activeStep: 3, // 当前选中步骤
71
+ logs: [], // 实时日志行
72
+ isPanelOpen: true // 右侧面板是否展开
73
+ }
74
+ ```
75
+
76
+ ### WebSocket 消息协议
77
+
78
+ ```javascript
79
+ // 服务端 → 客户端
80
+ { type: 'project:updated', project: { name, stages, currentStage } }
81
+ { type: 'step:updated', project: 'name', step: { id, status, summary } }
82
+ { type: 'log:append', project: 'name', lines: ['> analyzing...', '> done ✅'] }
83
+ { type: 'cli:output', project: 'name', data: 'stdout/stderr 流' }
84
+ { type: 'cli:complete', project: 'name', exitCode: 0 }
85
+
86
+ // 客户端 → 服务端
87
+ { type: 'cli:execute', project: 'name', command: 'sillyspec next' }
88
+ { type: 'project:select', name: 'my-project' }
89
+ ```
90
+
91
+ ### REST API
92
+
93
+ ```
94
+ GET /api/projects → 项目列表(扫描用户目录下的 .sillyspec/)
95
+ GET /api/project/:name → 项目完整状态(STATE.md + progress.json 合并)
96
+ GET /api/project/:name/logs → 最近日志(user-inputs.md)
97
+ ```
98
+
99
+ ## 关键组件实现
100
+
101
+ ### StepCard.vue — 三级信息密度
102
+
103
+ ```vue
104
+ <template>
105
+ <div class="step-card" :class="[statusClass]"
106
+ @mouseenter="hovered = true" @mouseleave="hovered = false"
107
+ @click="select">
108
+ <!-- 低密度:始终显示 -->
109
+ <div class="step-header">
110
+ <span class="step-icon">{{ icon }}</span>
111
+ <span class="step-title">{{ step.title }}</span>
112
+ </div>
113
+
114
+ <!-- 中密度:hover 显示 -->
115
+ <transition name="fade">
116
+ <div v-if="hovered && step.summary?.conclusion" class="step-summary">
117
+ {{ step.summary.conclusion }}
118
+ </div>
119
+ </transition>
120
+
121
+ <!-- 高密度:点击后在右侧 DetailPanel 展示 -->
122
+ </div>
123
+ </template>
124
+ ```
125
+
126
+ ### LogStream.vue — 终端风格日志
127
+
128
+ - 等宽字体(JetBrains Mono / monospace)
129
+ - 新行淡入动画(CSS transition opacity)
130
+ - 搜索过滤:顶部搜索框,实时过滤匹配行
131
+ - 自动滚动到底部,用户上翻时暂停自动滚动
132
+ - ANSI 颜色码支持(使用 ansi-to-html)
133
+
134
+ ### CommandPalette.vue
135
+
136
+ - `Cmd/Ctrl+K` 打开,`Escape` 关闭
137
+ - 模糊搜索项目名、阶段名
138
+ - 选中后跳转视图
139
+ - 参考 shadcn/ui 的 Command 组件风格
140
+
141
+ ## CLI 集成
142
+
143
+ ### src/index.js 新增命令
144
+
145
+ ```javascript
146
+ // 在现有 commander 配置中新增
147
+ program
148
+ .command('dashboard')
149
+ .description('启动可视化仪表盘')
150
+ .option('--port <number>', '端口号', 3456)
151
+ .option('--no-open', '不自动打开浏览器')
152
+ .action(async (options) => {
153
+ const { startServer } = await import('../packages/dashboard/server/index.js');
154
+ await startServer(options);
155
+ });
156
+ ```
157
+
158
+ ### server/index.js 启动流程
159
+
160
+ ```javascript
161
+ async function startServer({ port = 3456, open = true }) {
162
+ // 1. 启动 HTTP 服务,serve 前端静态文件
163
+ const server = http.createServer(handler);
164
+
165
+ // 2. 挂载 WebSocket
166
+ const wss = new WebSocketServer({ server });
167
+
168
+ // 3. 启动文件监听
169
+ const watcher = new ProjectWatcher();
170
+ watcher.on('change', (event) => wss.broadcast(event));
171
+
172
+ // 4. 启动服务
173
+ server.listen(port, () => {
174
+ console.log(`🚀 SillySpec Dashboard: http://localhost:${port}`);
175
+ if (open) openBrowser(`http://localhost:${port}`);
176
+ });
177
+ }
178
+ ```
179
+
180
+ ## 项目发现机制
181
+
182
+ 扫描用户常用项目目录,查找包含 `.sillyspec/` 的目录:
183
+
184
+ ```javascript
185
+ // 优先级:
186
+ // 1. 当前工作目录
187
+ // 2. HOME 目录下第一层子目录
188
+ // 3. 用户可通过设置文件配置额外路径 ~/.sillyspec/dashboard.json
189
+ ```
190
+
191
+ ## 构建与发布
192
+
193
+ ### 开发模式
194
+
195
+ ```bash
196
+ cd packages/dashboard
197
+ npm run dev # Vite dev server + 后端热重载
198
+ ```
199
+
200
+ ### 生产构建
201
+
202
+ ```bash
203
+ cd packages/dashboard
204
+ npm run build # Vite 构建 → dist/
205
+ ```
206
+
207
+ 前端构建产物(dist/)嵌入 npm 包,`sillyspec dashboard` 启动时 serve 静态文件。
208
+
209
+ ### 发布
210
+
211
+ 作为 SillySpec 的子包,跟随主包版本一起发布。不需要独立版本号。
212
+
213
+ ## 代码风格参照
214
+
215
+ - Vue 3 Composition API(`<script setup>`)
216
+ - Tailwind CSS utility-first
217
+ - 组件命名:PascalCase
218
+ - composable 命名:use 前缀
219
+ - 不使用 Vuex/Pinia,composable 管理状态即可(项目规模不需要)