sillyspec 3.20.2 → 3.20.4
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/.claude/skills/sillyspec-archive/SKILL.md +21 -21
- package/.claude/skills/sillyspec-auto/SKILL.md +83 -83
- package/.claude/skills/sillyspec-brainstorm/SKILL.md +44 -44
- package/.claude/skills/sillyspec-commit/SKILL.md +106 -106
- package/.claude/skills/sillyspec-continue/SKILL.md +45 -45
- package/.claude/skills/sillyspec-doctor/SKILL.md +31 -31
- package/.claude/skills/sillyspec-execute/SKILL.md +30 -30
- package/.claude/skills/sillyspec-explore/SKILL.md +109 -109
- package/.claude/skills/sillyspec-knowledge/SKILL.md +269 -269
- package/.claude/skills/sillyspec-plan/SKILL.md +21 -21
- package/.claude/skills/sillyspec-propose/SKILL.md +21 -21
- package/.claude/skills/sillyspec-quick/SKILL.md +21 -21
- package/.claude/skills/sillyspec-resume/SKILL.md +68 -68
- package/.claude/skills/sillyspec-scan/SKILL.md +21 -21
- package/.claude/skills/sillyspec-state/SKILL.md +54 -54
- package/.claude/skills/sillyspec-status/SKILL.md +21 -21
- package/.claude/skills/sillyspec-verify/SKILL.md +21 -21
- package/.claude/skills/sillyspec-workspace/SKILL.md +157 -157
- package/.husky/pre-push +13 -13
- package/CLAUDE.md +18 -18
- package/README.md +198 -188
- package/SKILL.md +90 -91
- package/bin/sillyspec.js +2 -2
- package/docs/brainstorm-plan-contract.md +64 -64
- package/docs/plan-execute-contract.md +123 -123
- package/docs/platform-scan-protocol.md +298 -298
- package/docs/revision-mode.md +115 -115
- package/docs/sillyspec/file-lifecycle/known-implementation-gaps.md +99 -99
- package/docs/sillyspec/file-lifecycle/platform-workflows-sync.md +218 -218
- package/docs/sillyspec/file-lifecycle/stage-artifacts.md +167 -167
- package/docs/sillyspec/file-lifecycle/storage-and-state.md +148 -148
- package/docs/sillyspec/file-lifecycle/worktree-and-guard.md +211 -193
- package/docs/sillyspec/file-lifecycle.md +125 -125
- package/docs/workflow-contract-regression.md +106 -106
- package/docs/worktree-isolation.md +252 -252
- package/package.json +40 -40
- package/packages/dashboard/dist/assets/index-Bq_Z2hne.js +7446 -7446
- package/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -1
- package/packages/dashboard/dist/index.html +16 -16
- package/packages/dashboard/index.html +15 -15
- package/packages/dashboard/package-lock.json +2384 -2384
- package/packages/dashboard/package.json +25 -25
- package/packages/dashboard/server/executor.js +86 -86
- package/packages/dashboard/server/index.js +588 -588
- package/packages/dashboard/server/parser.js +526 -526
- package/packages/dashboard/server/watcher.js +344 -344
- package/packages/dashboard/src/App.vue +558 -558
- package/packages/dashboard/src/components/ActionBar.vue +93 -93
- package/packages/dashboard/src/components/CommandPalette.vue +96 -96
- package/packages/dashboard/src/components/DetailPanel.vue +137 -137
- package/packages/dashboard/src/components/LogStream.vue +65 -65
- package/packages/dashboard/src/components/PipelineStage.vue +95 -95
- package/packages/dashboard/src/components/PipelineView.vue +156 -156
- package/packages/dashboard/src/components/ProjectList.vue +210 -210
- package/packages/dashboard/src/components/StageBadge.vue +67 -67
- package/packages/dashboard/src/components/StepCard.vue +94 -94
- package/packages/dashboard/src/components/detail/DocsDetail.vue +48 -48
- package/packages/dashboard/src/components/detail/GitDetail.vue +61 -61
- package/packages/dashboard/src/components/detail/TechDetail.vue +43 -43
- package/packages/dashboard/src/composables/useDashboard.js +170 -170
- package/packages/dashboard/src/composables/useKeyboard.js +119 -119
- package/packages/dashboard/src/composables/useWebSocket.js +129 -129
- package/packages/dashboard/src/main.js +8 -8
- package/packages/dashboard/src/style.css +132 -132
- package/packages/dashboard/vite.config.js +18 -18
- package/src/brainstorm-postcheck.js +158 -158
- package/src/change-list.js +52 -52
- package/src/change-risk-profile.js +352 -352
- package/src/classify-change.js +73 -73
- package/src/constants.js +70 -70
- package/src/contract-matrix.js +278 -278
- package/src/db.js +201 -201
- package/src/endpoint-extractor.js +315 -315
- package/src/hooks/claude-pre-tool-use.cjs +125 -125
- package/src/hooks/worktree-guard.js +653 -653
- package/src/index.js +922 -900
- package/src/init.js +431 -431
- package/src/knowledge-match.js +130 -130
- package/src/migrate.js +117 -117
- package/src/modules.js +482 -482
- package/src/progress.js +1734 -1734
- package/src/run.js +3465 -3358
- package/src/scan-postcheck.js +387 -383
- package/src/setup.js +398 -398
- package/src/stage-contract.js +700 -700
- package/src/stages/archive.js +160 -160
- package/src/stages/brainstorm-auto.js +229 -229
- package/src/stages/brainstorm.js +645 -645
- package/src/stages/doctor.js +365 -365
- package/src/stages/execute.js +625 -625
- package/src/stages/explore.js +34 -34
- package/src/stages/index.js +29 -29
- package/src/stages/knowledge.js +498 -498
- package/src/stages/plan-postcheck.js +511 -513
- package/src/stages/plan.js +582 -582
- package/src/stages/propose.js +174 -174
- package/src/stages/quick.js +82 -82
- package/src/stages/scan.js +558 -558
- package/src/stages/status.js +65 -65
- package/src/stages/verify.js +322 -322
- package/src/sync.js +497 -497
- package/src/task-review.js +346 -346
- package/src/workflow.js +785 -785
- package/src/worktree-apply.js +549 -549
- package/src/worktree-deps.js +185 -0
- package/src/worktree.js +982 -932
- package/templates/workflows/archive-impact.yaml +79 -79
- package/templates/workflows/scan-docs.yaml +132 -132
- package/test/brainstorm-plan-contract.test.mjs +273 -273
- package/test/check-syntax.mjs +26 -26
- package/test/contract-artifacts.test.mjs +323 -323
- package/test/decision-supersede.test.mjs +277 -277
- package/test/knowledge-match.test.mjs +231 -231
- package/test/plan-execute-contract.test.mjs +330 -330
- package/test/plan-optimization.test.mjs +572 -572
- package/test/platform-artifacts.test.mjs +166 -166
- package/test/platform-failure-samples.test.mjs +199 -199
- package/test/platform-recovery-chain.test.mjs +167 -167
- package/test/platform-recovery.test.mjs +136 -136
- package/test/platform-scan-p0.test.mjs +168 -168
- package/test/revision-v1.test.mjs +1145 -1145
- package/test/run-scan-project-parse.test.mjs +200 -200
- package/test/run-tests.mjs +48 -48
- package/test/scan-knowledge.test.mjs +175 -175
- package/test/scan-paths.test.mjs +68 -68
- package/test/scan-postcheck.test.mjs +197 -197
- package/test/spec-dir.test.mjs +206 -206
- package/test/stage-contract.test.mjs +299 -299
- package/test/stage-definitions.test.mjs +39 -39
- package/test/wait-gates.test.mjs +496 -496
- package/test/worktree-deps-provision.test.mjs +148 -0
- package/test/worktree-guard.test.mjs +71 -71
- package/test/worktree-native-overlay.test.mjs +188 -188
|
@@ -1,558 +1,558 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<n-config-provider :theme-overrides="themeOverrides">
|
|
3
|
-
<div class="h-screen w-screen flex flex-col overflow-hidden font-[DM_Sans,sans-serif] relative" style="background-color: #F5F5F7;">
|
|
4
|
-
<!-- Ambient background -->
|
|
5
|
-
<div class="absolute inset-0 pointer-events-none" style="background: radial-gradient(ellipse 60% 40% at 10% 20%, rgba(251,191,36,0.04) 0%, transparent 70%), radial-gradient(ellipse 50% 50% at 90% 80%, rgba(251,191,36,0.02) 0%, transparent 70%);" />
|
|
6
|
-
|
|
7
|
-
<!-- 上层:多项目概览区域 -->
|
|
8
|
-
<div
|
|
9
|
-
class="relative overflow-hidden flex-shrink-0"
|
|
10
|
-
:style="{ height: layout.overviewHeight + '%' }"
|
|
11
|
-
>
|
|
12
|
-
<!-- 项目概览 -->
|
|
13
|
-
<ProjectOverview
|
|
14
|
-
:projects="dashboard.state.projects"
|
|
15
|
-
:active-project="dashboard.state.activeProject"
|
|
16
|
-
@select="handleSelectProject"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
|
|
20
|
-
<!-- 垂直拖动分割线 -->
|
|
21
|
-
<div
|
|
22
|
-
class="h-[6px] flex-shrink-0 cursor-row-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
23
|
-
:class="{ 'bg-[#D97706]': isDragging }"
|
|
24
|
-
style="background: #2A3040;"
|
|
25
|
-
@mousedown="startDragVertical"
|
|
26
|
-
>
|
|
27
|
-
<div class="absolute inset-0 flex items-center justify-center pointer-events-none">
|
|
28
|
-
<div class="w-10 h-1 bg-white/30 rounded-full"></div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<!-- 下层:详情区域 -->
|
|
33
|
-
<div class="flex-1 overflow-hidden flex flex-col">
|
|
34
|
-
<!-- 详情内容 -->
|
|
35
|
-
<div class="flex-1 flex overflow-hidden">
|
|
36
|
-
<!-- 左栏:项目信息 -->
|
|
37
|
-
<div
|
|
38
|
-
class="detail-column flex-shrink-0 bg-white overflow-hidden"
|
|
39
|
-
:style="{ width: layout.columnWidths[0] + '%', minWidth: '150px' }"
|
|
40
|
-
:class="{ 'fade-in': projectSwitched }"
|
|
41
|
-
>
|
|
42
|
-
<div v-if="activeProject" class="project-info">
|
|
43
|
-
<div class="detail-section-title">项目信息</div>
|
|
44
|
-
<div class="detail-item">
|
|
45
|
-
<div class="detail-label">项目名称</div>
|
|
46
|
-
<div class="detail-value">{{ activeProject.name }}</div>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="detail-item">
|
|
49
|
-
<div class="detail-label">路径</div>
|
|
50
|
-
<div class="detail-value detail-path">{{ shortPath }}</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="detail-item">
|
|
53
|
-
<div class="detail-label">当前阶段</div>
|
|
54
|
-
<div class="detail-value">{{ currentStageLabel }}</div>
|
|
55
|
-
</div>
|
|
56
|
-
<div class="detail-item">
|
|
57
|
-
<div class="detail-label">进度</div>
|
|
58
|
-
<div class="detail-value">{{ progressLabel }}</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
<div v-else class="text-gray-400 text-sm">选择项目查看详情</div>
|
|
62
|
-
</div>
|
|
63
|
-
|
|
64
|
-
<!-- 水平拖动分割线 1 -->
|
|
65
|
-
<div
|
|
66
|
-
class="w-[4px] flex-shrink-0 cursor-col-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
67
|
-
style="background: #E5E7EB;"
|
|
68
|
-
@mousedown="startDragHorizontal(0)"
|
|
69
|
-
></div>
|
|
70
|
-
|
|
71
|
-
<!-- 中栏:Pipeline -->
|
|
72
|
-
<div
|
|
73
|
-
class="pipeline-column flex-1 bg-white overflow-hidden"
|
|
74
|
-
:style="{ minWidth: '200px' }"
|
|
75
|
-
>
|
|
76
|
-
<PipelineView
|
|
77
|
-
:project="dashboard.state.activeProject"
|
|
78
|
-
:active-step="dashboard.state.activeStep"
|
|
79
|
-
:active-tab="dashboard.state.activeTab"
|
|
80
|
-
:docs="dashboard.state.docs"
|
|
81
|
-
:selected-doc-file="dashboard.state.selectedDocFile"
|
|
82
|
-
:doc-content="dashboard.state.docContent"
|
|
83
|
-
:doc-loading="dashboard.state.docLoading"
|
|
84
|
-
@select-step="handleSelectStep"
|
|
85
|
-
@switch-tab="handleSwitchTab"
|
|
86
|
-
@select-doc-file="handleSelectDocFile"
|
|
87
|
-
/>
|
|
88
|
-
</div>
|
|
89
|
-
|
|
90
|
-
<!-- 水平拖动分割线 2 -->
|
|
91
|
-
<div
|
|
92
|
-
class="w-[4px] flex-shrink-0 cursor-col-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
93
|
-
style="background: #E5E7EB;"
|
|
94
|
-
@mousedown="startDragHorizontal(1)"
|
|
95
|
-
></div>
|
|
96
|
-
|
|
97
|
-
<!-- 右栏:日志/详情 -->
|
|
98
|
-
<div
|
|
99
|
-
class="activity-column flex-shrink-0 bg-white overflow-hidden flex flex-col"
|
|
100
|
-
:style="{ width: layout.columnWidths[2] + '%', minWidth: '200px' }"
|
|
101
|
-
>
|
|
102
|
-
<div class="detail-section-title px-4 pt-4">最近活动</div>
|
|
103
|
-
<div class="flex-1 overflow-y-auto px-4 pb-4">
|
|
104
|
-
<div
|
|
105
|
-
v-for="(log, i) in recentLogs"
|
|
106
|
-
:key="i"
|
|
107
|
-
class="log-entry"
|
|
108
|
-
:class="{ success: log.includes('✅'), error: log.includes('❌') }"
|
|
109
|
-
>
|
|
110
|
-
{{ log }}
|
|
111
|
-
</div>
|
|
112
|
-
<div v-if="recentLogs.length === 0" class="text-gray-400 text-sm">暂无活动</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
|
|
117
|
-
<!-- Bottom: Action Bar -->
|
|
118
|
-
<ActionBar
|
|
119
|
-
:project="dashboard.state.activeProject"
|
|
120
|
-
:is-executing="dashboard.state.executingProject !== null"
|
|
121
|
-
:execution-result="executionResult"
|
|
122
|
-
@execute="handleExecute"
|
|
123
|
-
@kill="handleKill"
|
|
124
|
-
@open-palette="isCommandPaletteOpen = true"
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
<!-- Command Palette Overlay -->
|
|
129
|
-
<CommandPalette
|
|
130
|
-
:is-open="isCommandPaletteOpen"
|
|
131
|
-
:projects="dashboard.state.projects"
|
|
132
|
-
@close="isCommandPaletteOpen = false"
|
|
133
|
-
@select-project="handleSelectProject"
|
|
134
|
-
@select-stage="handleSelectStage"
|
|
135
|
-
/>
|
|
136
|
-
|
|
137
|
-
<!-- 尺寸指示器 -->
|
|
138
|
-
<div
|
|
139
|
-
v-if="isDragging"
|
|
140
|
-
class="fixed bottom-5 left-5 bg-black/70 text-white px-3 py-2 rounded text-xs font-mono z-50"
|
|
141
|
-
>
|
|
142
|
-
{{ sizeIndicatorText }}
|
|
143
|
-
</div>
|
|
144
|
-
</div>
|
|
145
|
-
</n-config-provider>
|
|
146
|
-
</template>
|
|
147
|
-
|
|
148
|
-
<script setup>
|
|
149
|
-
import { ref, computed, onMounted } from 'vue'
|
|
150
|
-
import { useWebSocket } from './composables/useWebSocket.js'
|
|
151
|
-
import { useDashboard } from './composables/useDashboard.js'
|
|
152
|
-
import { useLayout } from './composables/useLayout.js'
|
|
153
|
-
import PipelineView from './components/PipelineView.vue'
|
|
154
|
-
import ProjectOverview from './components/ProjectOverview.vue'
|
|
155
|
-
import ActionBar from './components/ActionBar.vue'
|
|
156
|
-
import CommandPalette from './components/CommandPalette.vue'
|
|
157
|
-
|
|
158
|
-
// Composables
|
|
159
|
-
const ws = useWebSocket()
|
|
160
|
-
const dashboard = useDashboard()
|
|
161
|
-
const layoutManager = useLayout()
|
|
162
|
-
|
|
163
|
-
// 解构 layout
|
|
164
|
-
const { layout, isDragging, startDrag, endDrag } = layoutManager
|
|
165
|
-
|
|
166
|
-
// 状态
|
|
167
|
-
const isCommandPaletteOpen = ref(false)
|
|
168
|
-
const executionResult = ref(null)
|
|
169
|
-
const projectSwitched = ref(false)
|
|
170
|
-
const dragState = ref({
|
|
171
|
-
active: false,
|
|
172
|
-
type: null,
|
|
173
|
-
startX: 0,
|
|
174
|
-
startY: 0,
|
|
175
|
-
startValue: 0
|
|
176
|
-
})
|
|
177
|
-
|
|
178
|
-
// 尺寸指示器文本
|
|
179
|
-
const sizeIndicatorText = computed(() => {
|
|
180
|
-
if (dragState.value.type === 'vertical') {
|
|
181
|
-
return `概览 ${Math.round(layout.overviewHeight)}% | 详情 ${Math.round(100 - layout.overviewHeight)}%`
|
|
182
|
-
} else if (dragState.value.type === 'horizontal') {
|
|
183
|
-
return `三栏: ${Math.round(layout.columnWidths[0])}% | ${Math.round(layout.columnWidths[1])}% | ${Math.round(layout.columnWidths[2])}%`
|
|
184
|
-
}
|
|
185
|
-
return ''
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
// 当前项目
|
|
189
|
-
const activeProject = computed(() => dashboard.state.activeProject)
|
|
190
|
-
|
|
191
|
-
// 项目短路径
|
|
192
|
-
const shortPath = computed(() => {
|
|
193
|
-
const path = activeProject.value?.path || ''
|
|
194
|
-
return path.replace(/^\/Users\/[^/]+/, '~')
|
|
195
|
-
})
|
|
196
|
-
|
|
197
|
-
// 当前阶段标签
|
|
198
|
-
const currentStageLabel = computed(() => {
|
|
199
|
-
const stage = activeProject.value?.state?.currentStage
|
|
200
|
-
if (!stage) return '未开始'
|
|
201
|
-
const stageNames = {
|
|
202
|
-
scan: '代码扫描',
|
|
203
|
-
brainstorm: '需求探索',
|
|
204
|
-
plan: '实现计划',
|
|
205
|
-
execute: '波次执行',
|
|
206
|
-
verify: '验证确认',
|
|
207
|
-
archive: '归档变更',
|
|
208
|
-
quick: '快速任务',
|
|
209
|
-
explore: '自由探索'
|
|
210
|
-
}
|
|
211
|
-
return stageNames[stage] || stage
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
// 进度标签
|
|
215
|
-
const progressLabel = computed(() => {
|
|
216
|
-
const progress = activeProject.value?.state?.progress
|
|
217
|
-
if (!progress) return '-'
|
|
218
|
-
const currentStage = activeProject.value?.state?.currentStage
|
|
219
|
-
const stageProgress = currentStage ? progress.stages?.[currentStage] : null
|
|
220
|
-
if (!stageProgress) return '-'
|
|
221
|
-
if (stageProgress.completedSteps !== undefined && stageProgress.steps !== undefined) {
|
|
222
|
-
return `${stageProgress.completedSteps}/${stageProgress.steps} 步骤`
|
|
223
|
-
}
|
|
224
|
-
return stageProgress.status || '-'
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
// 最近日志(最近 10 条)
|
|
228
|
-
const recentLogs = computed(() => {
|
|
229
|
-
const logs = dashboard.state.logs || []
|
|
230
|
-
return logs.slice(-10).reverse()
|
|
231
|
-
})
|
|
232
|
-
|
|
233
|
-
// 垂直拖动(概览 ↔ 详情)
|
|
234
|
-
function startDragVertical(e) {
|
|
235
|
-
e.preventDefault()
|
|
236
|
-
dragState.value = {
|
|
237
|
-
active: true,
|
|
238
|
-
type: 'vertical',
|
|
239
|
-
startY: e.clientY,
|
|
240
|
-
startValue: layout.overviewHeight
|
|
241
|
-
}
|
|
242
|
-
document.body.classList.add('resizing')
|
|
243
|
-
startDrag('vertical')
|
|
244
|
-
|
|
245
|
-
const onMove = (ev) => {
|
|
246
|
-
const deltaY = ev.clientY - dragState.value.startY
|
|
247
|
-
const windowHeight = window.innerHeight
|
|
248
|
-
const deltaPercent = (deltaY / windowHeight) * 100
|
|
249
|
-
const newHeight = dragState.value.startValue + deltaPercent
|
|
250
|
-
layout.overviewHeight = Math.max(15, Math.min(75, newHeight))
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const onUp = () => {
|
|
254
|
-
document.body.classList.remove('resizing')
|
|
255
|
-
dragState.value.active = false
|
|
256
|
-
dragState.value.type = null
|
|
257
|
-
window.removeEventListener('mousemove', onMove)
|
|
258
|
-
window.removeEventListener('mouseup', onUp)
|
|
259
|
-
endDrag()
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
window.addEventListener('mousemove', onMove)
|
|
263
|
-
window.addEventListener('mouseup', onUp)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
// 水平拖动(三栏分割)
|
|
267
|
-
function startDragHorizontal(colIndex) {
|
|
268
|
-
return (e) => {
|
|
269
|
-
e.preventDefault()
|
|
270
|
-
dragState.value = {
|
|
271
|
-
active: true,
|
|
272
|
-
type: 'horizontal',
|
|
273
|
-
colIndex,
|
|
274
|
-
startX: e.clientX,
|
|
275
|
-
startWidths: [...layout.columnWidths]
|
|
276
|
-
}
|
|
277
|
-
document.body.classList.add('resizing')
|
|
278
|
-
startDrag('horizontal')
|
|
279
|
-
|
|
280
|
-
const onMove = (ev) => {
|
|
281
|
-
const deltaX = ev.clientX - dragState.value.startX
|
|
282
|
-
const containerWidth = document.querySelector('.flex-1.flex.overflow-hidden').offsetWidth
|
|
283
|
-
const deltaPercent = (deltaX / containerWidth) * 100
|
|
284
|
-
|
|
285
|
-
if (colIndex === 0) {
|
|
286
|
-
// 左栏 ↔ 中栏
|
|
287
|
-
const newWidth1 = ((dragState.value.startWidths[0] * containerWidth / 100) + deltaX) / containerWidth * 100
|
|
288
|
-
const newWidth2 = ((dragState.value.startWidths[1] * containerWidth / 100) - deltaX) / containerWidth * 100
|
|
289
|
-
if (newWidth1 >= 10 && newWidth2 >= 10) {
|
|
290
|
-
layout.columnWidths[0] = newWidth1
|
|
291
|
-
layout.columnWidths[1] = newWidth2
|
|
292
|
-
}
|
|
293
|
-
} else {
|
|
294
|
-
// 中栏 ↔ 右栏
|
|
295
|
-
const newWidth2 = ((dragState.value.startWidths[1] * containerWidth / 100) + deltaX) / containerWidth * 100
|
|
296
|
-
const newWidth3 = ((dragState.value.startWidths[2] * containerWidth / 100) - deltaX) / containerWidth * 100
|
|
297
|
-
if (newWidth2 >= 10 && newWidth3 >= 10) {
|
|
298
|
-
layout.columnWidths[1] = newWidth2
|
|
299
|
-
layout.columnWidths[2] = newWidth3
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const onUp = () => {
|
|
305
|
-
document.body.classList.remove('resizing')
|
|
306
|
-
dragState.value.active = false
|
|
307
|
-
dragState.value.type = null
|
|
308
|
-
window.removeEventListener('mousemove', onMove)
|
|
309
|
-
window.removeEventListener('mouseup', onUp)
|
|
310
|
-
endDrag()
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
window.addEventListener('mousemove', onMove)
|
|
314
|
-
window.addEventListener('mouseup', onUp)
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// WebSocket 事件处理
|
|
319
|
-
onMounted(() => {
|
|
320
|
-
ws.on('projects:init', handleProjectsUpdate)
|
|
321
|
-
ws.on('projects:updated', handleProjectsUpdate)
|
|
322
|
-
ws.on('project:update', (project) => {
|
|
323
|
-
dashboard.updateProject(project)
|
|
324
|
-
})
|
|
325
|
-
ws.on('cli:output', (data) => {
|
|
326
|
-
if (data.projectName === dashboard.activeProjectName.value) {
|
|
327
|
-
dashboard.appendLog(data.output)
|
|
328
|
-
}
|
|
329
|
-
})
|
|
330
|
-
ws.on('cli:complete', (data) => {
|
|
331
|
-
if (data.projectName === dashboard.activeProjectName.value) {
|
|
332
|
-
dashboard.setExecuting(null)
|
|
333
|
-
executionResult.value = { exitCode: data.exitCode, signal: data.signal }
|
|
334
|
-
}
|
|
335
|
-
})
|
|
336
|
-
ws.on('cli:started', (data) => {
|
|
337
|
-
if (data.projectName === dashboard.activeProjectName.value) {
|
|
338
|
-
dashboard.setExecuting(data.projectName)
|
|
339
|
-
executionResult.value = null
|
|
340
|
-
}
|
|
341
|
-
})
|
|
342
|
-
ws.on('cli:killed', (data) => {
|
|
343
|
-
if (data.projectName === dashboard.activeProjectName.value) {
|
|
344
|
-
dashboard.setExecuting(null)
|
|
345
|
-
executionResult.value = { exitCode: -1, signal: 'SIGTERM' }
|
|
346
|
-
}
|
|
347
|
-
})
|
|
348
|
-
ws.on('scan:paths', (paths) => { scanPaths.value = paths })
|
|
349
|
-
ws.on('docs:tree', (docs) => { dashboard.updateDocs(docs) })
|
|
350
|
-
})
|
|
351
|
-
|
|
352
|
-
function handleProjectsUpdate(projects) {
|
|
353
|
-
const previousPath = dashboard.activeProjectPath.value
|
|
354
|
-
dashboard.updateProjects(projects)
|
|
355
|
-
|
|
356
|
-
if (!previousPath && dashboard.state.activeProject?.path) {
|
|
357
|
-
ws.send({ type: 'docs:get', data: { projectPath: dashboard.state.activeProject.path } })
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function handleSelectProject(project) {
|
|
362
|
-
dashboard.selectProject(project)
|
|
363
|
-
dashboard.selectDocFile(null)
|
|
364
|
-
dashboard.setDocContent('')
|
|
365
|
-
// 触发淡入动画
|
|
366
|
-
projectSwitched.value = false
|
|
367
|
-
setTimeout(() => { projectSwitched.value = true }, 10)
|
|
368
|
-
setTimeout(() => { projectSwitched.value = false }, 210)
|
|
369
|
-
if (project?.path) {
|
|
370
|
-
ws.send({ type: 'docs:get', data: { projectPath: project.path } })
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
function handleSelectStage({ project, stage }) { dashboard.selectProject(project) }
|
|
375
|
-
function handleSelectStep(step) { dashboard.selectStep(step) }
|
|
376
|
-
function handleSwitchTab(tab) { dashboard.setActiveTab(tab) }
|
|
377
|
-
function handleSelectDocFile(file) {
|
|
378
|
-
dashboard.selectDocFile(file)
|
|
379
|
-
dashboard.setDocLoading(true)
|
|
380
|
-
fetch(`/api/docs/content?path=${encodeURIComponent(file.path)}`)
|
|
381
|
-
.then(r => r.ok ? r.text() : '')
|
|
382
|
-
.then(content => {
|
|
383
|
-
dashboard.setDocContent(content)
|
|
384
|
-
dashboard.setDocLoading(false)
|
|
385
|
-
})
|
|
386
|
-
.catch(() => {
|
|
387
|
-
dashboard.setDocContent('')
|
|
388
|
-
dashboard.setDocLoading(false)
|
|
389
|
-
})
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function handleExecute() {
|
|
393
|
-
const projectName = dashboard.activeProjectName.value
|
|
394
|
-
if (!projectName) return
|
|
395
|
-
const progress = dashboard.state.activeProject?.state?.progress
|
|
396
|
-
const stages = ['scan', 'brainstorm', 'plan', 'execute', 'verify', 'archive']
|
|
397
|
-
const currentStage = dashboard.state.activeProject?.state?.currentStage
|
|
398
|
-
|| stages.find(stage => progress?.stages?.[stage]?.status !== 'completed')
|
|
399
|
-
|| 'scan'
|
|
400
|
-
dashboard.clearLogs()
|
|
401
|
-
ws.send({ type: 'cli:execute', data: { projectName, command: `run ${currentStage}` } })
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function handleKill() {
|
|
405
|
-
const projectName = dashboard.activeProjectName.value
|
|
406
|
-
if (!projectName) return
|
|
407
|
-
ws.send({ type: 'cli:kill', data: { projectName } })
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
const themeOverrides = {
|
|
411
|
-
common: {
|
|
412
|
-
primaryColor: '#D97706',
|
|
413
|
-
primaryColorHover: '#F59E0B',
|
|
414
|
-
primaryColorPressed: '#B45309',
|
|
415
|
-
borderRadius: '6px',
|
|
416
|
-
fontFamily: 'DM Sans, sans-serif',
|
|
417
|
-
fontFamilyMono: 'JetBrains Mono, monospace'
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
</script>
|
|
421
|
-
|
|
422
|
-
<style>
|
|
423
|
-
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
424
|
-
|
|
425
|
-
body {
|
|
426
|
-
font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
427
|
-
-webkit-font-smoothing: antialiased;
|
|
428
|
-
-moz-osx-smoothing: grayscale;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
#app { width: 100vw; height: 100vh; overflow: hidden; min-width: 0; }
|
|
432
|
-
|
|
433
|
-
/* 拖动时禁用选择 */
|
|
434
|
-
body.resizing {
|
|
435
|
-
user-select: none;
|
|
436
|
-
}
|
|
437
|
-
body.resizing * {
|
|
438
|
-
cursor: inherit !important;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
/* 响应式:小窗口时调整布局 */
|
|
442
|
-
@media (max-width: 1280px) {
|
|
443
|
-
.detail-section-title {
|
|
444
|
-
font-size: 11px;
|
|
445
|
-
}
|
|
446
|
-
.detail-value {
|
|
447
|
-
font-size: 13px;
|
|
448
|
-
}
|
|
449
|
-
.log-entry {
|
|
450
|
-
font-size: 11px;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/* 项目信息样式 */
|
|
455
|
-
.detail-column,
|
|
456
|
-
.activity-column {
|
|
457
|
-
padding: 18px 20px;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
.pipeline-column {
|
|
461
|
-
border-left: 1px solid #EEF0F4;
|
|
462
|
-
border-right: 1px solid #EEF0F4;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
.pipeline-column > * {
|
|
466
|
-
min-width: 0;
|
|
467
|
-
padding-left: 18px;
|
|
468
|
-
padding-right: 18px;
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
.activity-column {
|
|
472
|
-
gap: 12px;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
.activity-column .detail-section-title {
|
|
476
|
-
padding: 0;
|
|
477
|
-
margin-bottom: 0;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
.activity-column > .flex-1 {
|
|
481
|
-
padding: 0;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
.project-info {
|
|
485
|
-
min-width: 0;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.detail-section-title {
|
|
489
|
-
font-size: 12px;
|
|
490
|
-
font-weight: 600;
|
|
491
|
-
color: #9CA3AF;
|
|
492
|
-
text-transform: uppercase;
|
|
493
|
-
margin-bottom: 12px;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
.detail-item {
|
|
497
|
-
margin-bottom: 16px;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.detail-label {
|
|
501
|
-
font-size: 11px;
|
|
502
|
-
color: #9CA3AF;
|
|
503
|
-
margin-bottom: 4px;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
.detail-value {
|
|
507
|
-
font-size: 14px;
|
|
508
|
-
color: #1A1A1A;
|
|
509
|
-
font-weight: 500;
|
|
510
|
-
min-width: 0;
|
|
511
|
-
overflow-wrap: anywhere;
|
|
512
|
-
word-break: break-word;
|
|
513
|
-
line-height: 1.45;
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.detail-path {
|
|
517
|
-
font-size: 12px;
|
|
518
|
-
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
519
|
-
white-space: normal;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
/* 日志条目样式 */
|
|
523
|
-
.log-entry {
|
|
524
|
-
font-family: 'JetBrains Mono', monospace;
|
|
525
|
-
font-size: 12px;
|
|
526
|
-
padding: 8px;
|
|
527
|
-
background: #F9FAFB;
|
|
528
|
-
border-radius: 4px;
|
|
529
|
-
margin-bottom: 8px;
|
|
530
|
-
color: #374151;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
.log-entry.success {
|
|
534
|
-
color: #047857;
|
|
535
|
-
background: #D1FAE5;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
.log-entry.error {
|
|
539
|
-
color: #DC2626;
|
|
540
|
-
background: #FEE2E2;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/* 淡入动画 */
|
|
544
|
-
.fade-in {
|
|
545
|
-
animation: fadeIn 0.2s ease-out;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
@keyframes fadeIn {
|
|
549
|
-
from {
|
|
550
|
-
opacity: 0;
|
|
551
|
-
transform: translateY(4px);
|
|
552
|
-
}
|
|
553
|
-
to {
|
|
554
|
-
opacity: 1;
|
|
555
|
-
transform: translateY(0);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<n-config-provider :theme-overrides="themeOverrides">
|
|
3
|
+
<div class="h-screen w-screen flex flex-col overflow-hidden font-[DM_Sans,sans-serif] relative" style="background-color: #F5F5F7;">
|
|
4
|
+
<!-- Ambient background -->
|
|
5
|
+
<div class="absolute inset-0 pointer-events-none" style="background: radial-gradient(ellipse 60% 40% at 10% 20%, rgba(251,191,36,0.04) 0%, transparent 70%), radial-gradient(ellipse 50% 50% at 90% 80%, rgba(251,191,36,0.02) 0%, transparent 70%);" />
|
|
6
|
+
|
|
7
|
+
<!-- 上层:多项目概览区域 -->
|
|
8
|
+
<div
|
|
9
|
+
class="relative overflow-hidden flex-shrink-0"
|
|
10
|
+
:style="{ height: layout.overviewHeight + '%' }"
|
|
11
|
+
>
|
|
12
|
+
<!-- 项目概览 -->
|
|
13
|
+
<ProjectOverview
|
|
14
|
+
:projects="dashboard.state.projects"
|
|
15
|
+
:active-project="dashboard.state.activeProject"
|
|
16
|
+
@select="handleSelectProject"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- 垂直拖动分割线 -->
|
|
21
|
+
<div
|
|
22
|
+
class="h-[6px] flex-shrink-0 cursor-row-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
23
|
+
:class="{ 'bg-[#D97706]': isDragging }"
|
|
24
|
+
style="background: #2A3040;"
|
|
25
|
+
@mousedown="startDragVertical"
|
|
26
|
+
>
|
|
27
|
+
<div class="absolute inset-0 flex items-center justify-center pointer-events-none">
|
|
28
|
+
<div class="w-10 h-1 bg-white/30 rounded-full"></div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<!-- 下层:详情区域 -->
|
|
33
|
+
<div class="flex-1 overflow-hidden flex flex-col">
|
|
34
|
+
<!-- 详情内容 -->
|
|
35
|
+
<div class="flex-1 flex overflow-hidden">
|
|
36
|
+
<!-- 左栏:项目信息 -->
|
|
37
|
+
<div
|
|
38
|
+
class="detail-column flex-shrink-0 bg-white overflow-hidden"
|
|
39
|
+
:style="{ width: layout.columnWidths[0] + '%', minWidth: '150px' }"
|
|
40
|
+
:class="{ 'fade-in': projectSwitched }"
|
|
41
|
+
>
|
|
42
|
+
<div v-if="activeProject" class="project-info">
|
|
43
|
+
<div class="detail-section-title">项目信息</div>
|
|
44
|
+
<div class="detail-item">
|
|
45
|
+
<div class="detail-label">项目名称</div>
|
|
46
|
+
<div class="detail-value">{{ activeProject.name }}</div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="detail-item">
|
|
49
|
+
<div class="detail-label">路径</div>
|
|
50
|
+
<div class="detail-value detail-path">{{ shortPath }}</div>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="detail-item">
|
|
53
|
+
<div class="detail-label">当前阶段</div>
|
|
54
|
+
<div class="detail-value">{{ currentStageLabel }}</div>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="detail-item">
|
|
57
|
+
<div class="detail-label">进度</div>
|
|
58
|
+
<div class="detail-value">{{ progressLabel }}</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
<div v-else class="text-gray-400 text-sm">选择项目查看详情</div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<!-- 水平拖动分割线 1 -->
|
|
65
|
+
<div
|
|
66
|
+
class="w-[4px] flex-shrink-0 cursor-col-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
67
|
+
style="background: #E5E7EB;"
|
|
68
|
+
@mousedown="startDragHorizontal(0)"
|
|
69
|
+
></div>
|
|
70
|
+
|
|
71
|
+
<!-- 中栏:Pipeline -->
|
|
72
|
+
<div
|
|
73
|
+
class="pipeline-column flex-1 bg-white overflow-hidden"
|
|
74
|
+
:style="{ minWidth: '200px' }"
|
|
75
|
+
>
|
|
76
|
+
<PipelineView
|
|
77
|
+
:project="dashboard.state.activeProject"
|
|
78
|
+
:active-step="dashboard.state.activeStep"
|
|
79
|
+
:active-tab="dashboard.state.activeTab"
|
|
80
|
+
:docs="dashboard.state.docs"
|
|
81
|
+
:selected-doc-file="dashboard.state.selectedDocFile"
|
|
82
|
+
:doc-content="dashboard.state.docContent"
|
|
83
|
+
:doc-loading="dashboard.state.docLoading"
|
|
84
|
+
@select-step="handleSelectStep"
|
|
85
|
+
@switch-tab="handleSwitchTab"
|
|
86
|
+
@select-doc-file="handleSelectDocFile"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<!-- 水平拖动分割线 2 -->
|
|
91
|
+
<div
|
|
92
|
+
class="w-[4px] flex-shrink-0 cursor-col-resize hover:bg-[#D97706] active:bg-[#D97706] relative z-20 transition-colors duration-200"
|
|
93
|
+
style="background: #E5E7EB;"
|
|
94
|
+
@mousedown="startDragHorizontal(1)"
|
|
95
|
+
></div>
|
|
96
|
+
|
|
97
|
+
<!-- 右栏:日志/详情 -->
|
|
98
|
+
<div
|
|
99
|
+
class="activity-column flex-shrink-0 bg-white overflow-hidden flex flex-col"
|
|
100
|
+
:style="{ width: layout.columnWidths[2] + '%', minWidth: '200px' }"
|
|
101
|
+
>
|
|
102
|
+
<div class="detail-section-title px-4 pt-4">最近活动</div>
|
|
103
|
+
<div class="flex-1 overflow-y-auto px-4 pb-4">
|
|
104
|
+
<div
|
|
105
|
+
v-for="(log, i) in recentLogs"
|
|
106
|
+
:key="i"
|
|
107
|
+
class="log-entry"
|
|
108
|
+
:class="{ success: log.includes('✅'), error: log.includes('❌') }"
|
|
109
|
+
>
|
|
110
|
+
{{ log }}
|
|
111
|
+
</div>
|
|
112
|
+
<div v-if="recentLogs.length === 0" class="text-gray-400 text-sm">暂无活动</div>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<!-- Bottom: Action Bar -->
|
|
118
|
+
<ActionBar
|
|
119
|
+
:project="dashboard.state.activeProject"
|
|
120
|
+
:is-executing="dashboard.state.executingProject !== null"
|
|
121
|
+
:execution-result="executionResult"
|
|
122
|
+
@execute="handleExecute"
|
|
123
|
+
@kill="handleKill"
|
|
124
|
+
@open-palette="isCommandPaletteOpen = true"
|
|
125
|
+
/>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<!-- Command Palette Overlay -->
|
|
129
|
+
<CommandPalette
|
|
130
|
+
:is-open="isCommandPaletteOpen"
|
|
131
|
+
:projects="dashboard.state.projects"
|
|
132
|
+
@close="isCommandPaletteOpen = false"
|
|
133
|
+
@select-project="handleSelectProject"
|
|
134
|
+
@select-stage="handleSelectStage"
|
|
135
|
+
/>
|
|
136
|
+
|
|
137
|
+
<!-- 尺寸指示器 -->
|
|
138
|
+
<div
|
|
139
|
+
v-if="isDragging"
|
|
140
|
+
class="fixed bottom-5 left-5 bg-black/70 text-white px-3 py-2 rounded text-xs font-mono z-50"
|
|
141
|
+
>
|
|
142
|
+
{{ sizeIndicatorText }}
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</n-config-provider>
|
|
146
|
+
</template>
|
|
147
|
+
|
|
148
|
+
<script setup>
|
|
149
|
+
import { ref, computed, onMounted } from 'vue'
|
|
150
|
+
import { useWebSocket } from './composables/useWebSocket.js'
|
|
151
|
+
import { useDashboard } from './composables/useDashboard.js'
|
|
152
|
+
import { useLayout } from './composables/useLayout.js'
|
|
153
|
+
import PipelineView from './components/PipelineView.vue'
|
|
154
|
+
import ProjectOverview from './components/ProjectOverview.vue'
|
|
155
|
+
import ActionBar from './components/ActionBar.vue'
|
|
156
|
+
import CommandPalette from './components/CommandPalette.vue'
|
|
157
|
+
|
|
158
|
+
// Composables
|
|
159
|
+
const ws = useWebSocket()
|
|
160
|
+
const dashboard = useDashboard()
|
|
161
|
+
const layoutManager = useLayout()
|
|
162
|
+
|
|
163
|
+
// 解构 layout
|
|
164
|
+
const { layout, isDragging, startDrag, endDrag } = layoutManager
|
|
165
|
+
|
|
166
|
+
// 状态
|
|
167
|
+
const isCommandPaletteOpen = ref(false)
|
|
168
|
+
const executionResult = ref(null)
|
|
169
|
+
const projectSwitched = ref(false)
|
|
170
|
+
const dragState = ref({
|
|
171
|
+
active: false,
|
|
172
|
+
type: null,
|
|
173
|
+
startX: 0,
|
|
174
|
+
startY: 0,
|
|
175
|
+
startValue: 0
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
// 尺寸指示器文本
|
|
179
|
+
const sizeIndicatorText = computed(() => {
|
|
180
|
+
if (dragState.value.type === 'vertical') {
|
|
181
|
+
return `概览 ${Math.round(layout.overviewHeight)}% | 详情 ${Math.round(100 - layout.overviewHeight)}%`
|
|
182
|
+
} else if (dragState.value.type === 'horizontal') {
|
|
183
|
+
return `三栏: ${Math.round(layout.columnWidths[0])}% | ${Math.round(layout.columnWidths[1])}% | ${Math.round(layout.columnWidths[2])}%`
|
|
184
|
+
}
|
|
185
|
+
return ''
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
// 当前项目
|
|
189
|
+
const activeProject = computed(() => dashboard.state.activeProject)
|
|
190
|
+
|
|
191
|
+
// 项目短路径
|
|
192
|
+
const shortPath = computed(() => {
|
|
193
|
+
const path = activeProject.value?.path || ''
|
|
194
|
+
return path.replace(/^\/Users\/[^/]+/, '~')
|
|
195
|
+
})
|
|
196
|
+
|
|
197
|
+
// 当前阶段标签
|
|
198
|
+
const currentStageLabel = computed(() => {
|
|
199
|
+
const stage = activeProject.value?.state?.currentStage
|
|
200
|
+
if (!stage) return '未开始'
|
|
201
|
+
const stageNames = {
|
|
202
|
+
scan: '代码扫描',
|
|
203
|
+
brainstorm: '需求探索',
|
|
204
|
+
plan: '实现计划',
|
|
205
|
+
execute: '波次执行',
|
|
206
|
+
verify: '验证确认',
|
|
207
|
+
archive: '归档变更',
|
|
208
|
+
quick: '快速任务',
|
|
209
|
+
explore: '自由探索'
|
|
210
|
+
}
|
|
211
|
+
return stageNames[stage] || stage
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
// 进度标签
|
|
215
|
+
const progressLabel = computed(() => {
|
|
216
|
+
const progress = activeProject.value?.state?.progress
|
|
217
|
+
if (!progress) return '-'
|
|
218
|
+
const currentStage = activeProject.value?.state?.currentStage
|
|
219
|
+
const stageProgress = currentStage ? progress.stages?.[currentStage] : null
|
|
220
|
+
if (!stageProgress) return '-'
|
|
221
|
+
if (stageProgress.completedSteps !== undefined && stageProgress.steps !== undefined) {
|
|
222
|
+
return `${stageProgress.completedSteps}/${stageProgress.steps} 步骤`
|
|
223
|
+
}
|
|
224
|
+
return stageProgress.status || '-'
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
// 最近日志(最近 10 条)
|
|
228
|
+
const recentLogs = computed(() => {
|
|
229
|
+
const logs = dashboard.state.logs || []
|
|
230
|
+
return logs.slice(-10).reverse()
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
// 垂直拖动(概览 ↔ 详情)
|
|
234
|
+
function startDragVertical(e) {
|
|
235
|
+
e.preventDefault()
|
|
236
|
+
dragState.value = {
|
|
237
|
+
active: true,
|
|
238
|
+
type: 'vertical',
|
|
239
|
+
startY: e.clientY,
|
|
240
|
+
startValue: layout.overviewHeight
|
|
241
|
+
}
|
|
242
|
+
document.body.classList.add('resizing')
|
|
243
|
+
startDrag('vertical')
|
|
244
|
+
|
|
245
|
+
const onMove = (ev) => {
|
|
246
|
+
const deltaY = ev.clientY - dragState.value.startY
|
|
247
|
+
const windowHeight = window.innerHeight
|
|
248
|
+
const deltaPercent = (deltaY / windowHeight) * 100
|
|
249
|
+
const newHeight = dragState.value.startValue + deltaPercent
|
|
250
|
+
layout.overviewHeight = Math.max(15, Math.min(75, newHeight))
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const onUp = () => {
|
|
254
|
+
document.body.classList.remove('resizing')
|
|
255
|
+
dragState.value.active = false
|
|
256
|
+
dragState.value.type = null
|
|
257
|
+
window.removeEventListener('mousemove', onMove)
|
|
258
|
+
window.removeEventListener('mouseup', onUp)
|
|
259
|
+
endDrag()
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
window.addEventListener('mousemove', onMove)
|
|
263
|
+
window.addEventListener('mouseup', onUp)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 水平拖动(三栏分割)
|
|
267
|
+
function startDragHorizontal(colIndex) {
|
|
268
|
+
return (e) => {
|
|
269
|
+
e.preventDefault()
|
|
270
|
+
dragState.value = {
|
|
271
|
+
active: true,
|
|
272
|
+
type: 'horizontal',
|
|
273
|
+
colIndex,
|
|
274
|
+
startX: e.clientX,
|
|
275
|
+
startWidths: [...layout.columnWidths]
|
|
276
|
+
}
|
|
277
|
+
document.body.classList.add('resizing')
|
|
278
|
+
startDrag('horizontal')
|
|
279
|
+
|
|
280
|
+
const onMove = (ev) => {
|
|
281
|
+
const deltaX = ev.clientX - dragState.value.startX
|
|
282
|
+
const containerWidth = document.querySelector('.flex-1.flex.overflow-hidden').offsetWidth
|
|
283
|
+
const deltaPercent = (deltaX / containerWidth) * 100
|
|
284
|
+
|
|
285
|
+
if (colIndex === 0) {
|
|
286
|
+
// 左栏 ↔ 中栏
|
|
287
|
+
const newWidth1 = ((dragState.value.startWidths[0] * containerWidth / 100) + deltaX) / containerWidth * 100
|
|
288
|
+
const newWidth2 = ((dragState.value.startWidths[1] * containerWidth / 100) - deltaX) / containerWidth * 100
|
|
289
|
+
if (newWidth1 >= 10 && newWidth2 >= 10) {
|
|
290
|
+
layout.columnWidths[0] = newWidth1
|
|
291
|
+
layout.columnWidths[1] = newWidth2
|
|
292
|
+
}
|
|
293
|
+
} else {
|
|
294
|
+
// 中栏 ↔ 右栏
|
|
295
|
+
const newWidth2 = ((dragState.value.startWidths[1] * containerWidth / 100) + deltaX) / containerWidth * 100
|
|
296
|
+
const newWidth3 = ((dragState.value.startWidths[2] * containerWidth / 100) - deltaX) / containerWidth * 100
|
|
297
|
+
if (newWidth2 >= 10 && newWidth3 >= 10) {
|
|
298
|
+
layout.columnWidths[1] = newWidth2
|
|
299
|
+
layout.columnWidths[2] = newWidth3
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const onUp = () => {
|
|
305
|
+
document.body.classList.remove('resizing')
|
|
306
|
+
dragState.value.active = false
|
|
307
|
+
dragState.value.type = null
|
|
308
|
+
window.removeEventListener('mousemove', onMove)
|
|
309
|
+
window.removeEventListener('mouseup', onUp)
|
|
310
|
+
endDrag()
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
window.addEventListener('mousemove', onMove)
|
|
314
|
+
window.addEventListener('mouseup', onUp)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// WebSocket 事件处理
|
|
319
|
+
onMounted(() => {
|
|
320
|
+
ws.on('projects:init', handleProjectsUpdate)
|
|
321
|
+
ws.on('projects:updated', handleProjectsUpdate)
|
|
322
|
+
ws.on('project:update', (project) => {
|
|
323
|
+
dashboard.updateProject(project)
|
|
324
|
+
})
|
|
325
|
+
ws.on('cli:output', (data) => {
|
|
326
|
+
if (data.projectName === dashboard.activeProjectName.value) {
|
|
327
|
+
dashboard.appendLog(data.output)
|
|
328
|
+
}
|
|
329
|
+
})
|
|
330
|
+
ws.on('cli:complete', (data) => {
|
|
331
|
+
if (data.projectName === dashboard.activeProjectName.value) {
|
|
332
|
+
dashboard.setExecuting(null)
|
|
333
|
+
executionResult.value = { exitCode: data.exitCode, signal: data.signal }
|
|
334
|
+
}
|
|
335
|
+
})
|
|
336
|
+
ws.on('cli:started', (data) => {
|
|
337
|
+
if (data.projectName === dashboard.activeProjectName.value) {
|
|
338
|
+
dashboard.setExecuting(data.projectName)
|
|
339
|
+
executionResult.value = null
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
ws.on('cli:killed', (data) => {
|
|
343
|
+
if (data.projectName === dashboard.activeProjectName.value) {
|
|
344
|
+
dashboard.setExecuting(null)
|
|
345
|
+
executionResult.value = { exitCode: -1, signal: 'SIGTERM' }
|
|
346
|
+
}
|
|
347
|
+
})
|
|
348
|
+
ws.on('scan:paths', (paths) => { scanPaths.value = paths })
|
|
349
|
+
ws.on('docs:tree', (docs) => { dashboard.updateDocs(docs) })
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
function handleProjectsUpdate(projects) {
|
|
353
|
+
const previousPath = dashboard.activeProjectPath.value
|
|
354
|
+
dashboard.updateProjects(projects)
|
|
355
|
+
|
|
356
|
+
if (!previousPath && dashboard.state.activeProject?.path) {
|
|
357
|
+
ws.send({ type: 'docs:get', data: { projectPath: dashboard.state.activeProject.path } })
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function handleSelectProject(project) {
|
|
362
|
+
dashboard.selectProject(project)
|
|
363
|
+
dashboard.selectDocFile(null)
|
|
364
|
+
dashboard.setDocContent('')
|
|
365
|
+
// 触发淡入动画
|
|
366
|
+
projectSwitched.value = false
|
|
367
|
+
setTimeout(() => { projectSwitched.value = true }, 10)
|
|
368
|
+
setTimeout(() => { projectSwitched.value = false }, 210)
|
|
369
|
+
if (project?.path) {
|
|
370
|
+
ws.send({ type: 'docs:get', data: { projectPath: project.path } })
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function handleSelectStage({ project, stage }) { dashboard.selectProject(project) }
|
|
375
|
+
function handleSelectStep(step) { dashboard.selectStep(step) }
|
|
376
|
+
function handleSwitchTab(tab) { dashboard.setActiveTab(tab) }
|
|
377
|
+
function handleSelectDocFile(file) {
|
|
378
|
+
dashboard.selectDocFile(file)
|
|
379
|
+
dashboard.setDocLoading(true)
|
|
380
|
+
fetch(`/api/docs/content?path=${encodeURIComponent(file.path)}`)
|
|
381
|
+
.then(r => r.ok ? r.text() : '')
|
|
382
|
+
.then(content => {
|
|
383
|
+
dashboard.setDocContent(content)
|
|
384
|
+
dashboard.setDocLoading(false)
|
|
385
|
+
})
|
|
386
|
+
.catch(() => {
|
|
387
|
+
dashboard.setDocContent('')
|
|
388
|
+
dashboard.setDocLoading(false)
|
|
389
|
+
})
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function handleExecute() {
|
|
393
|
+
const projectName = dashboard.activeProjectName.value
|
|
394
|
+
if (!projectName) return
|
|
395
|
+
const progress = dashboard.state.activeProject?.state?.progress
|
|
396
|
+
const stages = ['scan', 'brainstorm', 'plan', 'execute', 'verify', 'archive']
|
|
397
|
+
const currentStage = dashboard.state.activeProject?.state?.currentStage
|
|
398
|
+
|| stages.find(stage => progress?.stages?.[stage]?.status !== 'completed')
|
|
399
|
+
|| 'scan'
|
|
400
|
+
dashboard.clearLogs()
|
|
401
|
+
ws.send({ type: 'cli:execute', data: { projectName, command: `run ${currentStage}` } })
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
function handleKill() {
|
|
405
|
+
const projectName = dashboard.activeProjectName.value
|
|
406
|
+
if (!projectName) return
|
|
407
|
+
ws.send({ type: 'cli:kill', data: { projectName } })
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const themeOverrides = {
|
|
411
|
+
common: {
|
|
412
|
+
primaryColor: '#D97706',
|
|
413
|
+
primaryColorHover: '#F59E0B',
|
|
414
|
+
primaryColorPressed: '#B45309',
|
|
415
|
+
borderRadius: '6px',
|
|
416
|
+
fontFamily: 'DM Sans, sans-serif',
|
|
417
|
+
fontFamilyMono: 'JetBrains Mono, monospace'
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
</script>
|
|
421
|
+
|
|
422
|
+
<style>
|
|
423
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
424
|
+
|
|
425
|
+
body {
|
|
426
|
+
font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
427
|
+
-webkit-font-smoothing: antialiased;
|
|
428
|
+
-moz-osx-smoothing: grayscale;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
#app { width: 100vw; height: 100vh; overflow: hidden; min-width: 0; }
|
|
432
|
+
|
|
433
|
+
/* 拖动时禁用选择 */
|
|
434
|
+
body.resizing {
|
|
435
|
+
user-select: none;
|
|
436
|
+
}
|
|
437
|
+
body.resizing * {
|
|
438
|
+
cursor: inherit !important;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/* 响应式:小窗口时调整布局 */
|
|
442
|
+
@media (max-width: 1280px) {
|
|
443
|
+
.detail-section-title {
|
|
444
|
+
font-size: 11px;
|
|
445
|
+
}
|
|
446
|
+
.detail-value {
|
|
447
|
+
font-size: 13px;
|
|
448
|
+
}
|
|
449
|
+
.log-entry {
|
|
450
|
+
font-size: 11px;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/* 项目信息样式 */
|
|
455
|
+
.detail-column,
|
|
456
|
+
.activity-column {
|
|
457
|
+
padding: 18px 20px;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.pipeline-column {
|
|
461
|
+
border-left: 1px solid #EEF0F4;
|
|
462
|
+
border-right: 1px solid #EEF0F4;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.pipeline-column > * {
|
|
466
|
+
min-width: 0;
|
|
467
|
+
padding-left: 18px;
|
|
468
|
+
padding-right: 18px;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.activity-column {
|
|
472
|
+
gap: 12px;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.activity-column .detail-section-title {
|
|
476
|
+
padding: 0;
|
|
477
|
+
margin-bottom: 0;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.activity-column > .flex-1 {
|
|
481
|
+
padding: 0;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.project-info {
|
|
485
|
+
min-width: 0;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.detail-section-title {
|
|
489
|
+
font-size: 12px;
|
|
490
|
+
font-weight: 600;
|
|
491
|
+
color: #9CA3AF;
|
|
492
|
+
text-transform: uppercase;
|
|
493
|
+
margin-bottom: 12px;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.detail-item {
|
|
497
|
+
margin-bottom: 16px;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.detail-label {
|
|
501
|
+
font-size: 11px;
|
|
502
|
+
color: #9CA3AF;
|
|
503
|
+
margin-bottom: 4px;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.detail-value {
|
|
507
|
+
font-size: 14px;
|
|
508
|
+
color: #1A1A1A;
|
|
509
|
+
font-weight: 500;
|
|
510
|
+
min-width: 0;
|
|
511
|
+
overflow-wrap: anywhere;
|
|
512
|
+
word-break: break-word;
|
|
513
|
+
line-height: 1.45;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.detail-path {
|
|
517
|
+
font-size: 12px;
|
|
518
|
+
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
519
|
+
white-space: normal;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/* 日志条目样式 */
|
|
523
|
+
.log-entry {
|
|
524
|
+
font-family: 'JetBrains Mono', monospace;
|
|
525
|
+
font-size: 12px;
|
|
526
|
+
padding: 8px;
|
|
527
|
+
background: #F9FAFB;
|
|
528
|
+
border-radius: 4px;
|
|
529
|
+
margin-bottom: 8px;
|
|
530
|
+
color: #374151;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.log-entry.success {
|
|
534
|
+
color: #047857;
|
|
535
|
+
background: #D1FAE5;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.log-entry.error {
|
|
539
|
+
color: #DC2626;
|
|
540
|
+
background: #FEE2E2;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/* 淡入动画 */
|
|
544
|
+
.fade-in {
|
|
545
|
+
animation: fadeIn 0.2s ease-out;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
@keyframes fadeIn {
|
|
549
|
+
from {
|
|
550
|
+
opacity: 0;
|
|
551
|
+
transform: translateY(4px);
|
|
552
|
+
}
|
|
553
|
+
to {
|
|
554
|
+
opacity: 1;
|
|
555
|
+
transform: translateY(0);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
</style>
|