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,93 +1,93 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="h-12 flex items-center justify-between px-5 relative" style="background: rgba(17,17,19,0.9); backdrop-filter: blur(20px); border-top: 1px solid #F0F0F3;">
|
|
3
|
-
<!-- Ambient top glow -->
|
|
4
|
-
<div class="absolute inset-x-0 top-0 h-px" style="background: linear-gradient(90deg, transparent, rgba(251,191,36,0.1), transparent);"></div>
|
|
5
|
-
|
|
6
|
-
<!-- Left: Status -->
|
|
7
|
-
<div class="flex items-center gap-3">
|
|
8
|
-
<div v-if="project" class="flex items-center gap-2">
|
|
9
|
-
<span class="text-[11px] font-[JetBrains_Mono,monospace]" style="color: #6B7280;">{{ project.name }}</span>
|
|
10
|
-
<span style="color: #F0F0F3;">|</span>
|
|
11
|
-
<StageBadge v-if="project.state?.currentStage" :status="getProjectStatus()" :label="stageLabel()" />
|
|
12
|
-
</div>
|
|
13
|
-
<div v-else class="text-[10px] font-[JetBrains_Mono,monospace]" style="color: #D1D1D6;">
|
|
14
|
-
未选择项目
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<!-- Center: Execution -->
|
|
19
|
-
<div class="flex items-center gap-2">
|
|
20
|
-
<div v-if="isExecuting" class="flex items-center gap-2">
|
|
21
|
-
<div class="w-1 h-1 rounded-full animate-pulse-dot" style="background: #D97706;" />
|
|
22
|
-
<span class="text-[10px] font-[JetBrains_Mono,monospace]" style="color: #D97706;">执行中...</span>
|
|
23
|
-
</div>
|
|
24
|
-
<div v-else-if="executionResult" class="flex items-center gap-1.5">
|
|
25
|
-
<span class="text-[10px] font-[JetBrains_Mono,monospace]" :style="{ color: executionResult.exitCode === 0 ? '#16A34A' : '#DC2626' }">
|
|
26
|
-
{{ executionResult.exitCode === 0 ? '● 完成' : `● 失败 (${executionResult.exitCode})` }}
|
|
27
|
-
</span>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
|
|
31
|
-
<!-- Right: Actions -->
|
|
32
|
-
<div class="flex items-center gap-1">
|
|
33
|
-
<n-button quaternary size="tiny" @click="$emit('toggle-panel')" title="切换详情面板">
|
|
34
|
-
<template #icon>
|
|
35
|
-
<svg :class="['w-3.5 h-3.5 transition-transform duration-200', { 'rotate-180': !isPanelOpen }]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
36
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
37
|
-
</svg>
|
|
38
|
-
</template>
|
|
39
|
-
</n-button>
|
|
40
|
-
|
|
41
|
-
<n-button v-if="isExecuting" size="tiny" type="error" @click="$emit('kill')">
|
|
42
|
-
停止
|
|
43
|
-
</n-button>
|
|
44
|
-
|
|
45
|
-
<n-button quaternary size="tiny" @click="$emit('open-palette')" title="命令面板 (⌘K)">
|
|
46
|
-
<template #icon>
|
|
47
|
-
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
48
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
49
|
-
</svg>
|
|
50
|
-
</template>
|
|
51
|
-
</n-button>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
|
|
56
|
-
<script setup>
|
|
57
|
-
import StageBadge from './StageBadge.vue'
|
|
58
|
-
|
|
59
|
-
const props = defineProps({
|
|
60
|
-
project: { type: Object, default: null },
|
|
61
|
-
isExecuting: { type: Boolean, default: false },
|
|
62
|
-
executionResult: { type: Object, default: null },
|
|
63
|
-
isPanelOpen: { type: Boolean, default: true }
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
const emit = defineEmits(['execute', 'kill', 'toggle-panel', 'open-palette'])
|
|
67
|
-
|
|
68
|
-
function getProjectStatus() {
|
|
69
|
-
if (!props.project?.state) return 'pending'
|
|
70
|
-
const stage = props.project.state.currentStage
|
|
71
|
-
const steps = props.project.state.progress?.stages?.[stage]?.steps || []
|
|
72
|
-
if (steps.some(s => s.status === 'failed')) return 'failed'
|
|
73
|
-
if (steps.some(s => s.status === 'blocked')) return 'blocked'
|
|
74
|
-
if (steps.some(s => s.status === 'in-progress')) return 'in-progress'
|
|
75
|
-
if (steps.every(s => s.status === 'completed')) return 'completed'
|
|
76
|
-
return 'pending'
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function stageLabel() {
|
|
80
|
-
const stage = props.project?.state?.currentStage
|
|
81
|
-
const labels = {
|
|
82
|
-
scan: '代码扫描',
|
|
83
|
-
brainstorm: '头脑风暴',
|
|
84
|
-
plan: '规划',
|
|
85
|
-
execute: '执行',
|
|
86
|
-
verify: '验证',
|
|
87
|
-
archive: '归档',
|
|
88
|
-
quick: '快速任务',
|
|
89
|
-
explore: '自由探索'
|
|
90
|
-
}
|
|
91
|
-
return labels[stage] || stage || '未知'
|
|
92
|
-
}
|
|
93
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="h-12 flex items-center justify-between px-5 relative" style="background: rgba(17,17,19,0.9); backdrop-filter: blur(20px); border-top: 1px solid #F0F0F3;">
|
|
3
|
+
<!-- Ambient top glow -->
|
|
4
|
+
<div class="absolute inset-x-0 top-0 h-px" style="background: linear-gradient(90deg, transparent, rgba(251,191,36,0.1), transparent);"></div>
|
|
5
|
+
|
|
6
|
+
<!-- Left: Status -->
|
|
7
|
+
<div class="flex items-center gap-3">
|
|
8
|
+
<div v-if="project" class="flex items-center gap-2">
|
|
9
|
+
<span class="text-[11px] font-[JetBrains_Mono,monospace]" style="color: #6B7280;">{{ project.name }}</span>
|
|
10
|
+
<span style="color: #F0F0F3;">|</span>
|
|
11
|
+
<StageBadge v-if="project.state?.currentStage" :status="getProjectStatus()" :label="stageLabel()" />
|
|
12
|
+
</div>
|
|
13
|
+
<div v-else class="text-[10px] font-[JetBrains_Mono,monospace]" style="color: #D1D1D6;">
|
|
14
|
+
未选择项目
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<!-- Center: Execution -->
|
|
19
|
+
<div class="flex items-center gap-2">
|
|
20
|
+
<div v-if="isExecuting" class="flex items-center gap-2">
|
|
21
|
+
<div class="w-1 h-1 rounded-full animate-pulse-dot" style="background: #D97706;" />
|
|
22
|
+
<span class="text-[10px] font-[JetBrains_Mono,monospace]" style="color: #D97706;">执行中...</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div v-else-if="executionResult" class="flex items-center gap-1.5">
|
|
25
|
+
<span class="text-[10px] font-[JetBrains_Mono,monospace]" :style="{ color: executionResult.exitCode === 0 ? '#16A34A' : '#DC2626' }">
|
|
26
|
+
{{ executionResult.exitCode === 0 ? '● 完成' : `● 失败 (${executionResult.exitCode})` }}
|
|
27
|
+
</span>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<!-- Right: Actions -->
|
|
32
|
+
<div class="flex items-center gap-1">
|
|
33
|
+
<n-button quaternary size="tiny" @click="$emit('toggle-panel')" title="切换详情面板">
|
|
34
|
+
<template #icon>
|
|
35
|
+
<svg :class="['w-3.5 h-3.5 transition-transform duration-200', { 'rotate-180': !isPanelOpen }]" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
36
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
|
|
37
|
+
</svg>
|
|
38
|
+
</template>
|
|
39
|
+
</n-button>
|
|
40
|
+
|
|
41
|
+
<n-button v-if="isExecuting" size="tiny" type="error" @click="$emit('kill')">
|
|
42
|
+
停止
|
|
43
|
+
</n-button>
|
|
44
|
+
|
|
45
|
+
<n-button quaternary size="tiny" @click="$emit('open-palette')" title="命令面板 (⌘K)">
|
|
46
|
+
<template #icon>
|
|
47
|
+
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
48
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
|
49
|
+
</svg>
|
|
50
|
+
</template>
|
|
51
|
+
</n-button>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script setup>
|
|
57
|
+
import StageBadge from './StageBadge.vue'
|
|
58
|
+
|
|
59
|
+
const props = defineProps({
|
|
60
|
+
project: { type: Object, default: null },
|
|
61
|
+
isExecuting: { type: Boolean, default: false },
|
|
62
|
+
executionResult: { type: Object, default: null },
|
|
63
|
+
isPanelOpen: { type: Boolean, default: true }
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const emit = defineEmits(['execute', 'kill', 'toggle-panel', 'open-palette'])
|
|
67
|
+
|
|
68
|
+
function getProjectStatus() {
|
|
69
|
+
if (!props.project?.state) return 'pending'
|
|
70
|
+
const stage = props.project.state.currentStage
|
|
71
|
+
const steps = props.project.state.progress?.stages?.[stage]?.steps || []
|
|
72
|
+
if (steps.some(s => s.status === 'failed')) return 'failed'
|
|
73
|
+
if (steps.some(s => s.status === 'blocked')) return 'blocked'
|
|
74
|
+
if (steps.some(s => s.status === 'in-progress')) return 'in-progress'
|
|
75
|
+
if (steps.every(s => s.status === 'completed')) return 'completed'
|
|
76
|
+
return 'pending'
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function stageLabel() {
|
|
80
|
+
const stage = props.project?.state?.currentStage
|
|
81
|
+
const labels = {
|
|
82
|
+
scan: '代码扫描',
|
|
83
|
+
brainstorm: '头脑风暴',
|
|
84
|
+
plan: '规划',
|
|
85
|
+
execute: '执行',
|
|
86
|
+
verify: '验证',
|
|
87
|
+
archive: '归档',
|
|
88
|
+
quick: '快速任务',
|
|
89
|
+
explore: '自由探索'
|
|
90
|
+
}
|
|
91
|
+
return labels[stage] || stage || '未知'
|
|
92
|
+
}
|
|
93
|
+
</script>
|
|
@@ -1,96 +1,96 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<n-modal :show="isOpen" @update:show="$emit('close')" :mask-closable="true" transform-origin="center" style="max-width: 480px;">
|
|
3
|
-
<div class="overflow-hidden rounded-md" style="background: #FFFFFF; border: 1px solid #E5E5EA; box-shadow: 0 25px 60px rgba(0,0,0,0.1);">
|
|
4
|
-
<!-- Search -->
|
|
5
|
-
<div class="px-4 py-3" style="border-bottom: 1px solid #F0F0F3;">
|
|
6
|
-
<n-input v-model:value="searchQuery" placeholder="搜索项目或命令..." ref="searchInput" @keydown="handleKeydown" size="small">
|
|
7
|
-
<template #prefix>
|
|
8
|
-
<svg class="w-3.5 h-3.5" style="color: #6B7280;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
9
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
|
|
10
|
-
</svg>
|
|
11
|
-
</template>
|
|
12
|
-
</n-input>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<!-- Results -->
|
|
16
|
-
<div class="max-h-72 overflow-y-auto">
|
|
17
|
-
<n-empty v-if="filteredItems.length === 0" description="无结果" style="padding: 40px 0;" />
|
|
18
|
-
<div v-else class="py-0.5">
|
|
19
|
-
<div
|
|
20
|
-
v-for="(item, index) in filteredItems"
|
|
21
|
-
:key="item.id"
|
|
22
|
-
:class="['px-4 py-2.5 cursor-pointer transition-colors duration-100 flex items-center gap-3']"
|
|
23
|
-
:style="{ background: selectedIndex === index ? 'rgba(217,119,6,0.06)' : 'transparent' }"
|
|
24
|
-
@click="selectItem(item)"
|
|
25
|
-
@mouseenter="selectedIndex = index"
|
|
26
|
-
>
|
|
27
|
-
<div class="w-6 h-6 rounded-sm flex items-center justify-center text-[10px] font-[JetBrains_Mono,monospace] flex-shrink-0" style="background: #F0F0F3; border: 1px solid #F0F0F3; color: #6B7280;">
|
|
28
|
-
{{ item.type === 'project' ? '□' : '◇' }}
|
|
29
|
-
</div>
|
|
30
|
-
<div class="flex-1 min-w-0">
|
|
31
|
-
<div class="text-[12px] font-medium truncate font-[JetBrains_Mono,monospace]" style="color: #1C1C1E;">{{ item.title }}</div>
|
|
32
|
-
<div class="text-[10px] truncate" style="color: #6B7280;">{{ item.subtitle }}</div>
|
|
33
|
-
</div>
|
|
34
|
-
<StageBadge v-if="item.status" :status="item.status" size="sm" />
|
|
35
|
-
</div>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
<!-- Footer -->
|
|
40
|
-
<div class="px-4 py-2 flex items-center gap-4 text-[9px] font-mono-log" style="border-top: 1px solid #F0F0F3; color: #D1D1D6;">
|
|
41
|
-
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">↑↓</kbd> 导航</span>
|
|
42
|
-
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">↵</kbd> 打开</span>
|
|
43
|
-
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">esc</kbd> 关闭</span>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</n-modal>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script setup>
|
|
50
|
-
import { ref, computed, watch, nextTick } from 'vue'
|
|
51
|
-
import StageBadge from './StageBadge.vue'
|
|
52
|
-
|
|
53
|
-
const props = defineProps({ isOpen: { type: Boolean, default: false }, projects: { type: Array, default: () => [] } })
|
|
54
|
-
const emit = defineEmits(['close', 'select-project', 'select-stage'])
|
|
55
|
-
|
|
56
|
-
const searchQuery = ref('')
|
|
57
|
-
const searchInput = ref(null)
|
|
58
|
-
const selectedIndex = ref(0)
|
|
59
|
-
|
|
60
|
-
const stageNames = [
|
|
61
|
-
{ id: 'scan', name: '代码扫描' },
|
|
62
|
-
{ id: 'brainstorm', name: '头脑风暴' },
|
|
63
|
-
{ id: 'plan', name: '规划' },
|
|
64
|
-
{ id: 'execute', name: '执行' },
|
|
65
|
-
{ id: 'verify', name: '验证' },
|
|
66
|
-
{ id: 'archive', name: '归档' },
|
|
67
|
-
{ id: 'quick', name: '快速任务' },
|
|
68
|
-
{ id: 'explore', name: '自由探索' }
|
|
69
|
-
]
|
|
70
|
-
|
|
71
|
-
const filteredItems = computed(() => {
|
|
72
|
-
const items = []
|
|
73
|
-
for (const project of props.projects) {
|
|
74
|
-
const pm = !searchQuery.value || project.name.toLowerCase().includes(searchQuery.value.toLowerCase()) || project.path.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
75
|
-
if (pm) items.push({ id: `project-${project.name}`, type: 'project', title: project.name, subtitle: project.path, data: project, status: getProjectStatus(project) })
|
|
76
|
-
for (const stage of stageNames) {
|
|
77
|
-
const sm = !searchQuery.value || stage.name.toLowerCase().includes(searchQuery.value.toLowerCase()) || stage.id.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
78
|
-
if (sm || pm) items.push({ id: `stage-${project.name}-${stage.id}`, type: 'stage', title: `${project.name} / ${stage.name}`, subtitle: `Jump to ${stage.name}`, data: { project, stage: stage.id }, status: getStageStatus(project, stage.id) })
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return items
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
function getProjectStatus(p) { const s = p.state?.progress?.stages?.[p.state?.currentStage]?.steps || []; if (s.some(x => x.status === 'failed')) return 'failed'; if (s.some(x => x.status === 'in-progress')) return 'in-progress'; if (s.every(x => x.status === 'completed')) return 'completed'; return 'pending' }
|
|
85
|
-
function getStageStatus(p, id) { const s = p.state?.progress?.stages?.[id]?.steps || []; if (!s.length) return 'pending'; if (s.some(x => x.status === 'failed')) return 'failed'; if (s.some(x => x.status === 'in-progress')) return 'in-progress'; if (s.every(x => x.status === 'completed')) return 'completed'; return 'pending' }
|
|
86
|
-
function close() { searchQuery.value = ''; selectedIndex.value = 0; emit('close') }
|
|
87
|
-
function selectItem(item) { if (item.type === 'project') emit('select-project', item.data); else emit('select-stage', item.data); close() }
|
|
88
|
-
function handleKeydown(e) {
|
|
89
|
-
if (e.key === 'ArrowDown') { e.preventDefault(); selectedIndex.value = Math.min(selectedIndex.value + 1, filteredItems.value.length - 1) }
|
|
90
|
-
else if (e.key === 'ArrowUp') { e.preventDefault(); selectedIndex.value = Math.max(selectedIndex.value - 1, 0) }
|
|
91
|
-
else if (e.key === 'Enter') { e.preventDefault(); if (filteredItems.value[selectedIndex.value]) selectItem(filteredItems.value[selectedIndex.value]) }
|
|
92
|
-
else if (e.key === 'Escape') { e.preventDefault(); close() }
|
|
93
|
-
}
|
|
94
|
-
watch(filteredItems, () => { selectedIndex.value = 0 })
|
|
95
|
-
watch(() => props.isOpen, (v) => { if (v) { nextTick(() => { searchInput.value?.focus() }) } })
|
|
96
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<n-modal :show="isOpen" @update:show="$emit('close')" :mask-closable="true" transform-origin="center" style="max-width: 480px;">
|
|
3
|
+
<div class="overflow-hidden rounded-md" style="background: #FFFFFF; border: 1px solid #E5E5EA; box-shadow: 0 25px 60px rgba(0,0,0,0.1);">
|
|
4
|
+
<!-- Search -->
|
|
5
|
+
<div class="px-4 py-3" style="border-bottom: 1px solid #F0F0F3;">
|
|
6
|
+
<n-input v-model:value="searchQuery" placeholder="搜索项目或命令..." ref="searchInput" @keydown="handleKeydown" size="small">
|
|
7
|
+
<template #prefix>
|
|
8
|
+
<svg class="w-3.5 h-3.5" style="color: #6B7280;" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
9
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/>
|
|
10
|
+
</svg>
|
|
11
|
+
</template>
|
|
12
|
+
</n-input>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<!-- Results -->
|
|
16
|
+
<div class="max-h-72 overflow-y-auto">
|
|
17
|
+
<n-empty v-if="filteredItems.length === 0" description="无结果" style="padding: 40px 0;" />
|
|
18
|
+
<div v-else class="py-0.5">
|
|
19
|
+
<div
|
|
20
|
+
v-for="(item, index) in filteredItems"
|
|
21
|
+
:key="item.id"
|
|
22
|
+
:class="['px-4 py-2.5 cursor-pointer transition-colors duration-100 flex items-center gap-3']"
|
|
23
|
+
:style="{ background: selectedIndex === index ? 'rgba(217,119,6,0.06)' : 'transparent' }"
|
|
24
|
+
@click="selectItem(item)"
|
|
25
|
+
@mouseenter="selectedIndex = index"
|
|
26
|
+
>
|
|
27
|
+
<div class="w-6 h-6 rounded-sm flex items-center justify-center text-[10px] font-[JetBrains_Mono,monospace] flex-shrink-0" style="background: #F0F0F3; border: 1px solid #F0F0F3; color: #6B7280;">
|
|
28
|
+
{{ item.type === 'project' ? '□' : '◇' }}
|
|
29
|
+
</div>
|
|
30
|
+
<div class="flex-1 min-w-0">
|
|
31
|
+
<div class="text-[12px] font-medium truncate font-[JetBrains_Mono,monospace]" style="color: #1C1C1E;">{{ item.title }}</div>
|
|
32
|
+
<div class="text-[10px] truncate" style="color: #6B7280;">{{ item.subtitle }}</div>
|
|
33
|
+
</div>
|
|
34
|
+
<StageBadge v-if="item.status" :status="item.status" size="sm" />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<!-- Footer -->
|
|
40
|
+
<div class="px-4 py-2 flex items-center gap-4 text-[9px] font-mono-log" style="border-top: 1px solid #F0F0F3; color: #D1D1D6;">
|
|
41
|
+
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">↑↓</kbd> 导航</span>
|
|
42
|
+
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">↵</kbd> 打开</span>
|
|
43
|
+
<span><kbd class="px-1 rounded-sm" style="background: #F0F0F3; border: 1px solid #F0F0F3;">esc</kbd> 关闭</span>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</n-modal>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script setup>
|
|
50
|
+
import { ref, computed, watch, nextTick } from 'vue'
|
|
51
|
+
import StageBadge from './StageBadge.vue'
|
|
52
|
+
|
|
53
|
+
const props = defineProps({ isOpen: { type: Boolean, default: false }, projects: { type: Array, default: () => [] } })
|
|
54
|
+
const emit = defineEmits(['close', 'select-project', 'select-stage'])
|
|
55
|
+
|
|
56
|
+
const searchQuery = ref('')
|
|
57
|
+
const searchInput = ref(null)
|
|
58
|
+
const selectedIndex = ref(0)
|
|
59
|
+
|
|
60
|
+
const stageNames = [
|
|
61
|
+
{ id: 'scan', name: '代码扫描' },
|
|
62
|
+
{ id: 'brainstorm', name: '头脑风暴' },
|
|
63
|
+
{ id: 'plan', name: '规划' },
|
|
64
|
+
{ id: 'execute', name: '执行' },
|
|
65
|
+
{ id: 'verify', name: '验证' },
|
|
66
|
+
{ id: 'archive', name: '归档' },
|
|
67
|
+
{ id: 'quick', name: '快速任务' },
|
|
68
|
+
{ id: 'explore', name: '自由探索' }
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
const filteredItems = computed(() => {
|
|
72
|
+
const items = []
|
|
73
|
+
for (const project of props.projects) {
|
|
74
|
+
const pm = !searchQuery.value || project.name.toLowerCase().includes(searchQuery.value.toLowerCase()) || project.path.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
75
|
+
if (pm) items.push({ id: `project-${project.name}`, type: 'project', title: project.name, subtitle: project.path, data: project, status: getProjectStatus(project) })
|
|
76
|
+
for (const stage of stageNames) {
|
|
77
|
+
const sm = !searchQuery.value || stage.name.toLowerCase().includes(searchQuery.value.toLowerCase()) || stage.id.toLowerCase().includes(searchQuery.value.toLowerCase())
|
|
78
|
+
if (sm || pm) items.push({ id: `stage-${project.name}-${stage.id}`, type: 'stage', title: `${project.name} / ${stage.name}`, subtitle: `Jump to ${stage.name}`, data: { project, stage: stage.id }, status: getStageStatus(project, stage.id) })
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return items
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
function getProjectStatus(p) { const s = p.state?.progress?.stages?.[p.state?.currentStage]?.steps || []; if (s.some(x => x.status === 'failed')) return 'failed'; if (s.some(x => x.status === 'in-progress')) return 'in-progress'; if (s.every(x => x.status === 'completed')) return 'completed'; return 'pending' }
|
|
85
|
+
function getStageStatus(p, id) { const s = p.state?.progress?.stages?.[id]?.steps || []; if (!s.length) return 'pending'; if (s.some(x => x.status === 'failed')) return 'failed'; if (s.some(x => x.status === 'in-progress')) return 'in-progress'; if (s.every(x => x.status === 'completed')) return 'completed'; return 'pending' }
|
|
86
|
+
function close() { searchQuery.value = ''; selectedIndex.value = 0; emit('close') }
|
|
87
|
+
function selectItem(item) { if (item.type === 'project') emit('select-project', item.data); else emit('select-stage', item.data); close() }
|
|
88
|
+
function handleKeydown(e) {
|
|
89
|
+
if (e.key === 'ArrowDown') { e.preventDefault(); selectedIndex.value = Math.min(selectedIndex.value + 1, filteredItems.value.length - 1) }
|
|
90
|
+
else if (e.key === 'ArrowUp') { e.preventDefault(); selectedIndex.value = Math.max(selectedIndex.value - 1, 0) }
|
|
91
|
+
else if (e.key === 'Enter') { e.preventDefault(); if (filteredItems.value[selectedIndex.value]) selectItem(filteredItems.value[selectedIndex.value]) }
|
|
92
|
+
else if (e.key === 'Escape') { e.preventDefault(); close() }
|
|
93
|
+
}
|
|
94
|
+
watch(filteredItems, () => { selectedIndex.value = 0 })
|
|
95
|
+
watch(() => props.isOpen, (v) => { if (v) { nextTick(() => { searchInput.value?.focus() }) } })
|
|
96
|
+
</script>
|