sillyspec 3.20.3 → 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 -17
- package/.claude/skills/sillyspec-auto/SKILL.md +83 -77
- package/.claude/skills/sillyspec-brainstorm/SKILL.md +44 -17
- package/.claude/skills/sillyspec-commit/SKILL.md +106 -105
- package/.claude/skills/sillyspec-continue/SKILL.md +45 -44
- package/.claude/skills/sillyspec-doctor/SKILL.md +31 -22
- package/.claude/skills/sillyspec-execute/SKILL.md +30 -17
- package/.claude/skills/sillyspec-explore/SKILL.md +109 -96
- package/.claude/skills/sillyspec-knowledge/SKILL.md +270 -0
- package/.claude/skills/sillyspec-plan/SKILL.md +21 -52
- package/.claude/skills/sillyspec-propose/SKILL.md +21 -17
- package/.claude/skills/sillyspec-quick/SKILL.md +21 -17
- package/.claude/skills/sillyspec-resume/SKILL.md +68 -111
- package/.claude/skills/sillyspec-scan/SKILL.md +21 -17
- package/.claude/skills/sillyspec-state/SKILL.md +54 -54
- package/.claude/skills/sillyspec-status/SKILL.md +21 -17
- package/.claude/skills/sillyspec-verify/SKILL.md +21 -17
- package/.claude/skills/sillyspec-workspace/SKILL.md +157 -149
- package/.husky/pre-push +13 -0
- package/CLAUDE.md +18 -0
- package/README.md +198 -186
- package/SKILL.md +90 -87
- package/bin/sillyspec.js +2 -2
- package/docs/brainstorm-plan-contract.md +64 -0
- package/docs/plan-execute-contract.md +123 -0
- package/docs/platform-scan-protocol.md +298 -0
- package/docs/revision-mode.md +115 -0
- package/docs/sillyspec/file-lifecycle/known-implementation-gaps.md +99 -0
- package/docs/sillyspec/file-lifecycle/platform-workflows-sync.md +218 -0
- package/docs/sillyspec/file-lifecycle/stage-artifacts.md +167 -0
- package/docs/sillyspec/file-lifecycle/storage-and-state.md +148 -0
- package/docs/sillyspec/file-lifecycle/worktree-and-guard.md +211 -0
- package/docs/sillyspec/file-lifecycle.md +125 -0
- package/docs/workflow-contract-regression.md +106 -0
- package/docs/worktree-isolation.md +252 -0
- package/package.json +40 -34
- package/packages/dashboard/dist/assets/{index-D1EVTLmc.js → index-Bq_Z2hne.js} +7446 -7446
- package/packages/dashboard/dist/assets/index-O2W5RV4z.css +1 -0
- package/packages/dashboard/dist/index.html +16 -16
- package/packages/dashboard/dist/prototype-dashboard.html +836 -0
- package/packages/dashboard/dist/prototype-overview.html +256 -0
- 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/public/prototype-dashboard.html +836 -0
- package/packages/dashboard/public/prototype-overview.html +256 -0
- package/packages/dashboard/server/executor.js +86 -86
- package/packages/dashboard/server/index.js +588 -508
- package/packages/dashboard/server/parser.js +526 -458
- package/packages/dashboard/server/watcher.js +350 -342
- package/packages/dashboard/src/App.vue +558 -325
- package/packages/dashboard/src/components/ActionBar.vue +93 -84
- package/packages/dashboard/src/components/CommandPalette.vue +96 -92
- package/packages/dashboard/src/components/DetailPanel.vue +137 -137
- package/packages/dashboard/src/components/DocPreview.vue +105 -8
- package/packages/dashboard/src/components/DocTree.vue +75 -19
- package/packages/dashboard/src/components/HResizeHandle.vue +48 -0
- package/packages/dashboard/src/components/LogStream.vue +65 -65
- package/packages/dashboard/src/components/PipelineStage.vue +95 -75
- package/packages/dashboard/src/components/PipelineView.vue +156 -129
- package/packages/dashboard/src/components/ProjectCard.vue +187 -0
- package/packages/dashboard/src/components/ProjectList.vue +210 -210
- package/packages/dashboard/src/components/ProjectOverview.vue +113 -139
- package/packages/dashboard/src/components/StageBadge.vue +67 -53
- package/packages/dashboard/src/components/StepCard.vue +94 -89
- package/packages/dashboard/src/components/VResizeHandle.vue +61 -0
- 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 +192 -164
- package/packages/dashboard/src/composables/useKeyboard.js +119 -119
- package/packages/dashboard/src/composables/useLayout.js +131 -0
- 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 -0
- package/src/change-list.js +52 -0
- package/src/change-risk-profile.js +352 -0
- package/src/classify-change.js +73 -0
- package/src/constants.js +70 -0
- package/src/contract-matrix.js +278 -0
- package/src/db.js +201 -0
- package/src/endpoint-extractor.js +315 -0
- package/src/hooks/claude-pre-tool-use.cjs +125 -0
- package/src/hooks/worktree-guard.js +761 -0
- package/src/index.js +922 -252
- package/src/init.js +431 -375
- package/src/knowledge-match.js +130 -0
- package/src/migrate.js +117 -117
- package/src/modules.js +482 -0
- package/src/progress.js +1734 -508
- package/src/run.js +3465 -652
- package/src/scan-postcheck.js +387 -0
- package/src/setup.js +398 -460
- package/src/stage-contract.js +700 -0
- package/src/stages/archive.js +160 -54
- package/src/stages/brainstorm-auto.js +229 -0
- package/src/stages/brainstorm.js +645 -239
- package/src/stages/doctor.js +365 -312
- package/src/stages/execute.js +625 -264
- package/src/stages/explore.js +34 -0
- package/src/stages/index.js +29 -35
- package/src/stages/knowledge.js +498 -0
- package/src/stages/plan-postcheck.js +511 -0
- package/src/stages/plan.js +582 -279
- package/src/stages/propose.js +174 -115
- package/src/stages/quick.js +102 -63
- package/src/stages/scan.js +558 -141
- package/src/stages/status.js +65 -65
- package/src/stages/verify.js +322 -135
- package/src/sync.js +497 -0
- package/src/task-review.js +346 -0
- package/src/workflow.js +785 -0
- package/src/worktree-apply.js +549 -0
- package/src/worktree-deps.js +185 -0
- package/src/worktree.js +982 -0
- package/templates/workflows/archive-impact.yaml +79 -0
- package/templates/workflows/scan-docs.yaml +132 -0
- package/test/brainstorm-plan-contract.test.mjs +273 -0
- package/test/check-syntax.mjs +26 -0
- package/test/cli-top-level-aliases.test.mjs +174 -0
- package/test/contract-artifacts.test.mjs +323 -0
- package/test/decision-supersede.test.mjs +277 -0
- package/test/knowledge-match.test.mjs +231 -0
- package/test/plan-execute-contract.test.mjs +330 -0
- package/test/plan-optimization.test.mjs +572 -0
- package/test/platform-artifacts.test.mjs +190 -0
- package/test/platform-failure-samples.test.mjs +199 -0
- package/test/platform-recovery-chain.test.mjs +179 -0
- package/test/platform-recovery.test.mjs +167 -0
- package/test/platform-scan-p0.test.mjs +175 -0
- package/test/revision-v1.test.mjs +1145 -0
- package/test/run-sanitize-project-name.test.mjs +51 -0
- package/test/run-scan-postcheck-fail.test.mjs +64 -0
- package/test/run-scan-project-parse.test.mjs +200 -0
- package/test/run-tests.mjs +48 -0
- package/test/scan-docs-yaml-placeholders.test.mjs +84 -0
- package/test/scan-knowledge.test.mjs +175 -0
- package/test/scan-paths.test.mjs +68 -0
- package/test/scan-postcheck-project-priority.test.mjs +85 -0
- package/test/scan-postcheck.test.mjs +197 -0
- package/test/scan-workflow-anyfailed-block.test.mjs +52 -0
- package/test/spec-dir.test.mjs +206 -0
- package/test/stage-contract-failed-post-check.test.mjs +102 -0
- package/test/stage-contract.test.mjs +299 -0
- package/test/stage-definitions.test.mjs +39 -0
- package/test/wait-gates.test.mjs +501 -0
- package/test/workflow-spec-base.test.mjs +142 -0
- package/test/worktree-deps-provision.test.mjs +148 -0
- package/test/worktree-guard.test.mjs +136 -0
- package/test/worktree-native-overlay.test.mjs +188 -0
- package/.sillyspec/changes/archive/2026-04-08-derive-state/design.md +0 -97
- package/.sillyspec/changes/archive/2026-04-08-derive-state/plan.md +0 -51
- package/.sillyspec/changes/archive/2026-04-08-derive-state/proposal.md +0 -29
- package/.sillyspec/changes/archive/2026-04-08-derive-state/requirements.md +0 -34
- package/.sillyspec/changes/archive/2026-04-08-derive-state/tasks.md +0 -13
- package/.sillyspec/changes/archive/2026-04-08-derive-state/verify-result.md +0 -43
- package/.sillyspec/changes/auto-mode/design.md +0 -50
- package/.sillyspec/changes/auto-mode/proposal.md +0 -19
- package/.sillyspec/changes/auto-mode/requirements.md +0 -21
- package/.sillyspec/changes/auto-mode/tasks.md +0 -7
- package/.sillyspec/changes/brainstorm-archive/2026-04-05-dashboard-design.md +0 -206
- package/.sillyspec/changes/brainstorm-archive/2026-04-05-unified-docs-design.md +0 -199
- package/.sillyspec/changes/dashboard/design.md +0 -219
- package/.sillyspec/changes/dashboard/design.md.braindraft +0 -206
- package/.sillyspec/changes/run-command-design/design.md +0 -1230
- package/.sillyspec/changes/unified-docs-design/design.md +0 -199
- package/.sillyspec/docs/sillyspec/scan/.gitkeep +0 -0
- package/.sillyspec/knowledge/INDEX.md +0 -8
- package/.sillyspec/knowledge/uncategorized.md +0 -3
- package/.sillyspec/plans/2026-04-05-dashboard.md +0 -737
- package/.sillyspec/projects/sillyspec.yaml +0 -3
- package/dist/steps/brainstorm/01-load-context.md +0 -30
- package/dist/steps/brainstorm/02-reuse-check.md +0 -6
- package/dist/steps/brainstorm/03-prototype-analysis.md +0 -11
- package/dist/steps/brainstorm/04-module-split.md +0 -23
- package/dist/steps/brainstorm/05-dialog-explore.md +0 -8
- package/dist/steps/brainstorm/06-propose-approaches.md +0 -3
- package/dist/steps/brainstorm/07-present-design.md +0 -3
- package/dist/steps/brainstorm/08-write-design.md +0 -21
- package/dist/steps/brainstorm/09-self-review.md +0 -15
- package/dist/steps/brainstorm/10-user-confirm.md +0 -3
- package/dist/steps/brainstorm/11-output-spec.md +0 -7
- package/dist/steps/brainstorm/manifest.yaml +0 -26
- package/dist/steps/execute/01-load-context.md +0 -41
- package/dist/steps/execute/02-scan-conventions.md +0 -47
- package/dist/steps/execute/03-skill-mcp.md +0 -19
- package/dist/steps/execute/04-assign-task.md +0 -22
- package/dist/steps/execute/04b-prompt-template.md +0 -54
- package/dist/steps/execute/05-write-test.md +0 -7
- package/dist/steps/execute/06-write-code.md +0 -8
- package/dist/steps/execute/07-run-test.md +0 -26
- package/dist/steps/execute/08-fix-issues.md +0 -28
- package/dist/steps/execute/09-next-task.md +0 -33
- package/dist/steps/execute/manifest.yaml +0 -28
- package/dist/steps/plan/01-load-context.md +0 -22
- package/dist/steps/plan/02-anchor-confirm.md +0 -1
- package/dist/steps/plan/03-expand-tasks.md +0 -33
- package/dist/steps/plan/04-mark-order.md +0 -15
- package/dist/steps/plan/05-e2e-planning.md +0 -17
- package/dist/steps/plan/06-self-check.md +0 -16
- package/dist/steps/plan/07-save.md +0 -1
- package/dist/steps/plan/manifest.yaml +0 -18
- package/dist/steps/scan/01-env-detect.md +0 -51
- package/dist/steps/scan/02-tech-stack.md +0 -16
- package/dist/steps/scan/03-conventions.md +0 -16
- package/dist/steps/scan/04-structure.md +0 -19
- package/dist/steps/scan/05-quality.md +0 -18
- package/dist/steps/scan/06-complete.md +0 -49
- package/dist/steps/scan/manifest.yaml +0 -16
- package/dist/steps/verify/01-load-specs.md +0 -28
- package/dist/steps/verify/02-check-tasks.md +0 -1
- package/dist/steps/verify/03-check-design.md +0 -6
- package/dist/steps/verify/04-run-tests.md +0 -7
- package/dist/steps/verify/05-e2e-tests.md +0 -27
- package/dist/steps/verify/05b-e2e-fix.md +0 -33
- package/dist/steps/verify/06-code-quality.md +0 -25
- package/dist/steps/verify/07-lint-check.md +0 -27
- package/dist/steps/verify/08-output-report.md +0 -14
- package/dist/steps/verify/manifest.yaml +0 -22
- package/packages/dashboard/dist/assets/index-DGe8CqeP.css +0 -1
- package/src/derive.js +0 -147
- package/src/step.js +0 -543
package/src/init.js
CHANGED
|
@@ -1,375 +1,431 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync,
|
|
2
|
-
import { join, resolve, dirname, basename } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (existsSync(join(projectDir, '.
|
|
91
|
-
if (existsSync(join(projectDir, '.
|
|
92
|
-
if (existsSync(join(projectDir, '.
|
|
93
|
-
if (existsSync(join(projectDir, '.
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
//
|
|
112
|
-
// .sillyspec
|
|
113
|
-
// .
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
console.log('');
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs';
|
|
2
|
+
import { join, resolve, dirname, basename } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { checkbox, confirm, input } from '@inquirer/prompts';
|
|
5
|
+
import { ProgressManager } from './progress.js';
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
|
|
8
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
10
|
+
|
|
11
|
+
// ── 递归复制目录 ──
|
|
12
|
+
function copyDirSync(src, dst) {
|
|
13
|
+
mkdirSync(dst, { recursive: true });
|
|
14
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
15
|
+
if (entry.name === 'node_modules' || entry.name === '.git') continue;
|
|
16
|
+
const srcPath = join(src, entry.name);
|
|
17
|
+
const dstPath = join(dst, entry.name);
|
|
18
|
+
if (entry.isDirectory()) {
|
|
19
|
+
copyDirSync(srcPath, dstPath);
|
|
20
|
+
} else if (entry.name.endsWith('.md')) {
|
|
21
|
+
writeFileSync(dstPath, readFileSync(srcPath));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// ── 元数据映射 ──
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
const VALID_TOOLS = ['claude', 'cursor', 'openclaw', 'codex', 'gemini', 'opencode'];
|
|
31
|
+
|
|
32
|
+
const TOOL_LABELS = {
|
|
33
|
+
claude: 'Claude Code',
|
|
34
|
+
cursor: 'Cursor',
|
|
35
|
+
openclaw: 'OpenClaw',
|
|
36
|
+
codex: 'OpenAI Codex (通过 AGENTS.md)',
|
|
37
|
+
gemini: 'Gemini CLI (通过 GEMINI.md)',
|
|
38
|
+
opencode: 'OpenCode (通过 INSTRUCTIONS.md)',
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const INSTRUCTION_TOOLS = ['codex', 'gemini', 'opencode'];
|
|
42
|
+
|
|
43
|
+
const INSTRUCTION_FILE_MAP = {
|
|
44
|
+
codex: 'AGENTS.md',
|
|
45
|
+
gemini: 'GEMINI.md',
|
|
46
|
+
opencode: 'INSTRUCTIONS.md',
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const INJECTION_CONTENT = `## SillySpec — 规范驱动开发
|
|
50
|
+
|
|
51
|
+
在执行开发任务时,遵循以下规范:
|
|
52
|
+
|
|
53
|
+
### 代码规范
|
|
54
|
+
- 写代码前先读取 \`.sillyspec/docs/<project>/scan/CONVENTIONS.md\`(代码风格)和 \`.sillyspec/docs/<project>/scan/ARCHITECTURE.md\`(架构)
|
|
55
|
+
- 调用已有方法前,用 grep 确认方法存在,不许编造
|
|
56
|
+
- 遵循 \`.sillyspec/docs/<project>/scan/CONVENTIONS.md\` 中的代码风格
|
|
57
|
+
|
|
58
|
+
### 工作流程
|
|
59
|
+
- 读取 sillyspec.db 确认当前阶段(使用 \`sillyspec progress show\`)
|
|
60
|
+
- 各阶段产出文件位于 \`.sillyspec/changes/<变更名>/\` 下
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
// ── 注入指令文件 ──
|
|
64
|
+
|
|
65
|
+
function injectInstructions(tool, projectDir) {
|
|
66
|
+
const fileName = INSTRUCTION_FILE_MAP[tool];
|
|
67
|
+
if (!fileName) return;
|
|
68
|
+
const filePath = join(projectDir, fileName);
|
|
69
|
+
|
|
70
|
+
// 文件不存在则创建
|
|
71
|
+
if (!existsSync(filePath)) {
|
|
72
|
+
writeFileSync(filePath, INJECTION_CONTENT);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 已存在 SillySpec 标记则跳过
|
|
77
|
+
const content = readFileSync(filePath, 'utf8');
|
|
78
|
+
if (content.includes('## SillySpec')) return;
|
|
79
|
+
|
|
80
|
+
// 追加到末尾
|
|
81
|
+
writeFileSync(filePath, content.trimEnd() + '\n\n' + INJECTION_CONTENT);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ── 检测工具 ──
|
|
85
|
+
|
|
86
|
+
function detectTools(projectDir) {
|
|
87
|
+
const found = [];
|
|
88
|
+
if (existsSync(join(projectDir, '.claude'))) found.push('claude');
|
|
89
|
+
if (existsSync(join(projectDir, '.cursor'))) found.push('cursor');
|
|
90
|
+
if (existsSync(join(projectDir, '.openclaw'))) found.push('openclaw');
|
|
91
|
+
if (existsSync(join(projectDir, 'AGENTS.md'))) found.push('codex');
|
|
92
|
+
if (existsSync(join(projectDir, 'GEMINI.md'))) found.push('gemini');
|
|
93
|
+
if (existsSync(join(projectDir, 'INSTRUCTIONS.md'))) found.push('opencode');
|
|
94
|
+
if (found.length === 0) found.push('claude');
|
|
95
|
+
return found;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── TTY 工具函数 ──
|
|
99
|
+
|
|
100
|
+
function isTTY() {
|
|
101
|
+
return process.stdin.isTTY && process.stdout.isTTY;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// ── 核心安装逻辑 ──
|
|
105
|
+
|
|
106
|
+
async function doInstall(projectDir, tools, subprojects = [], specDir = null) {
|
|
107
|
+
// specDir: 规范目录(默认 projectDir/.sillyspec)
|
|
108
|
+
// projectDir: 源码项目根目录(用于工具检测、指令注入、.gitignore)
|
|
109
|
+
const spec = specDir || join(projectDir, '.sillyspec');
|
|
110
|
+
|
|
111
|
+
// 外部 specDir 时清理旧版本残留的 cwd/.sillyspec/(防止源码污染)。
|
|
112
|
+
// ⚠️ 必须保护真实资产:若本地 .sillyspec 含 changes/(非空)、projects/(非空)
|
|
113
|
+
// 或 sillyspec.db(进度库),说明该项目本身就用 SillySpec 管理,整体删除会丢资产。
|
|
114
|
+
// 此时只清运行时残留,拒绝整删;确无资产时才视为旧残留清理。
|
|
115
|
+
const legacyDir = join(projectDir, '.sillyspec');
|
|
116
|
+
if (specDir && existsSync(legacyDir)) {
|
|
117
|
+
let hasChanges = false;
|
|
118
|
+
try {
|
|
119
|
+
const changesDir = join(legacyDir, 'changes');
|
|
120
|
+
if (existsSync(changesDir)) hasChanges = readdirSync(changesDir).length > 0;
|
|
121
|
+
} catch {}
|
|
122
|
+
let hasProjects = false;
|
|
123
|
+
try {
|
|
124
|
+
const projectsDir = join(legacyDir, 'projects');
|
|
125
|
+
if (existsSync(projectsDir)) hasProjects = readdirSync(projectsDir).length > 0;
|
|
126
|
+
} catch {}
|
|
127
|
+
const hasDb = existsSync(join(legacyDir, 'sillyspec.db'));
|
|
128
|
+
|
|
129
|
+
if (hasChanges || hasProjects || hasDb) {
|
|
130
|
+
// 真实资产存在:拒绝整体删除,仅清理运行时残留
|
|
131
|
+
console.error('❌ [sillyspec] 拒绝删除源码目录的 .sillyspec/:检测到真实资产(changes/、projects/ 或 sillyspec.db)。');
|
|
132
|
+
console.error(' 该项目似乎本身就用 SillySpec 管理。如需改用外部 spec 目录,请先手动迁移/备份。');
|
|
133
|
+
console.error(' 本次仅清理运行时残留(.runtime/、local.yaml、codebase/)。');
|
|
134
|
+
for (const residue of ['.runtime', 'local.yaml', 'codebase']) {
|
|
135
|
+
const p = join(legacyDir, residue);
|
|
136
|
+
if (existsSync(p)) { try { rmSync(p, { recursive: true, force: true }) } catch {} }
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
// 无真实资产:确属旧版本残留,安全删除
|
|
140
|
+
try { rmSync(legacyDir, { recursive: true, force: true }) } catch {}
|
|
141
|
+
if (!existsSync(legacyDir)) console.log('🧹 已清理旧版本残留的源码 .sillyspec/ 目录');
|
|
142
|
+
else console.error('⚠️ 清理残留 .sillyspec/ 失败');
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 创建基础目录
|
|
147
|
+
// spec/projects/ → 项目注册表
|
|
148
|
+
// spec/docs/<name>/ → 统一文档中心
|
|
149
|
+
// spec/knowledge/ → 跨项目共享知识库
|
|
150
|
+
// spec/.runtime/ → progress (gitignored)
|
|
151
|
+
|
|
152
|
+
// 注册当前项目到 projects/
|
|
153
|
+
const projectName = basename(projectDir) || 'project';
|
|
154
|
+
const projectsDir = join(spec, 'projects');
|
|
155
|
+
mkdirSync(projectsDir, { recursive: true });
|
|
156
|
+
const projectYamlPath = join(projectsDir, `${projectName}.yaml`);
|
|
157
|
+
if (!existsSync(projectYamlPath)) {
|
|
158
|
+
// path 相对于 specDir,跨平台可寻址
|
|
159
|
+
writeFileSync(projectYamlPath, `name: ${projectName}\npath: ${projectDir}\nstatus: active\n`);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// 创建 docs/<projectName>/scan/ 子目录(代码扫描结果)
|
|
163
|
+
const scanDir = join(spec, 'docs', projectName, 'scan');
|
|
164
|
+
mkdirSync(scanDir, { recursive: true });
|
|
165
|
+
const gitkeepPath = join(scanDir, '.gitkeep');
|
|
166
|
+
if (!existsSync(gitkeepPath)) writeFileSync(gitkeepPath, '');
|
|
167
|
+
|
|
168
|
+
// 复制 workflow 模板到 workflows/
|
|
169
|
+
const workflowsDir = join(spec, 'workflows');
|
|
170
|
+
const templatesDir = join(__dirname, '..', 'templates', 'workflows');
|
|
171
|
+
if (existsSync(templatesDir)) {
|
|
172
|
+
mkdirSync(workflowsDir, { recursive: true });
|
|
173
|
+
for (const file of readdirSync(templatesDir)) {
|
|
174
|
+
if (file.endsWith('.yaml')) {
|
|
175
|
+
const srcPath = join(templatesDir, file);
|
|
176
|
+
const dstPath = join(workflowsDir, file);
|
|
177
|
+
if (!existsSync(dstPath)) {
|
|
178
|
+
writeFileSync(dstPath, readFileSync(srcPath));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// 创建 shared/workspace 目录
|
|
185
|
+
mkdirSync(join(spec, 'shared'), { recursive: true });
|
|
186
|
+
mkdirSync(join(spec, 'workspace'), { recursive: true });
|
|
187
|
+
|
|
188
|
+
// 创建知识库骨架
|
|
189
|
+
const knowledgeDir = join(spec, 'knowledge');
|
|
190
|
+
mkdirSync(knowledgeDir, { recursive: true });
|
|
191
|
+
const indexPath = join(knowledgeDir, 'INDEX.md');
|
|
192
|
+
if (!existsSync(indexPath)) {
|
|
193
|
+
writeFileSync(indexPath, `# Knowledge Index\n\n> 子代理任务开始前查询此文件,按关键词匹配,只读命中的知识文件。\n> execute/quick 执行中发现的坑自动追加到 uncategorized.md,经用户确认后归类到对应文件。\n\n<!-- 格式:关键词1|关键词2|关键词3 → 文件路径 -->\n<!-- 示例:mybatis-plus|分页|Page → pagination.md -->\n<!-- 示例:跨域|CORS|preflight → cors.md -->\n`);
|
|
194
|
+
}
|
|
195
|
+
const uncatPath = join(knowledgeDir, 'uncategorized.md');
|
|
196
|
+
if (!existsSync(uncatPath)) {
|
|
197
|
+
writeFileSync(uncatPath, `# 未分类知识\n\n> execute/quick 执行中发现的坑暂存于此,用户审阅后归类到对应文件并更新 INDEX.md。\n`);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// 创建 .runtime/ 目录结构(全局状态)
|
|
201
|
+
const runtimeDir = join(spec, '.runtime');
|
|
202
|
+
for (const sub of ['artifacts', 'history', 'logs', 'templates']) {
|
|
203
|
+
mkdirSync(join(runtimeDir, sub), { recursive: true });
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 初始化 SQLite 数据库
|
|
207
|
+
const pm = new ProgressManager({ specDir: spec });
|
|
208
|
+
await pm.init(projectDir);
|
|
209
|
+
|
|
210
|
+
// .gitignore 只在 specDir 在项目内时才修改
|
|
211
|
+
const isExternalSpec = specDir && resolve(spec) !== resolve(projectDir, '.sillyspec');
|
|
212
|
+
if (!isExternalSpec) {
|
|
213
|
+
const gitignorePath = join(projectDir, '.gitignore');
|
|
214
|
+
const ignoreRules = ['.sillyspec/codebase/SCAN-RAW.md', '.sillyspec/local.yaml', '.sillyspec/.runtime/'];
|
|
215
|
+
if (existsSync(gitignorePath)) {
|
|
216
|
+
const content = readFileSync(gitignorePath, 'utf8');
|
|
217
|
+
let updated = content.trimEnd();
|
|
218
|
+
for (const rule of ignoreRules) {
|
|
219
|
+
if (!updated.includes(rule)) {
|
|
220
|
+
updated += '\n' + rule;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
writeFileSync(gitignorePath, updated + '\n');
|
|
224
|
+
} else {
|
|
225
|
+
writeFileSync(gitignorePath, ignoreRules.join('\n') + '\n');
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// 注入指令文件(codex/gemini/opencode)
|
|
230
|
+
for (let i = 0; i < tools.length; i++) {
|
|
231
|
+
const toolName = tools[i];
|
|
232
|
+
if (INSTRUCTION_TOOLS.includes(toolName)) {
|
|
233
|
+
injectInstructions(toolName, projectDir);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// 复制 skills 到各工具目录
|
|
238
|
+
const skillToolDirs = {
|
|
239
|
+
claude: '.claude/skills',
|
|
240
|
+
codex: '.codex/skills',
|
|
241
|
+
openclaw: '.openclaw/skills',
|
|
242
|
+
opencode: '.opencode/skills',
|
|
243
|
+
}
|
|
244
|
+
const skillsSource = join(__dirname, '..', '.claude', 'skills');
|
|
245
|
+
if (existsSync(skillsSource)) {
|
|
246
|
+
const sillyspecSkills = readdirSync(skillsSource).filter(f => f.startsWith('sillyspec-') && statSync(join(skillsSource, f)).isDirectory());
|
|
247
|
+
if (sillyspecSkills.length > 0) {
|
|
248
|
+
for (const [tool, dir] of Object.entries(skillToolDirs)) {
|
|
249
|
+
if (!tools.includes(tool)) continue
|
|
250
|
+
const targetDir = join(projectDir, dir)
|
|
251
|
+
mkdirSync(targetDir, { recursive: true })
|
|
252
|
+
for (const skill of sillyspecSkills) {
|
|
253
|
+
copyDirSync(join(skillsSource, skill), join(targetDir, skill))
|
|
254
|
+
}
|
|
255
|
+
console.log(chalk.green(` ✓ ${TOOL_LABELS[tool]} skills 已同步 (${sillyspecSkills.length} 个)`))
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
} else {
|
|
259
|
+
console.log(chalk.yellow(' ⚠ 未找到 skills 目录(npm 包内无 .claude/skills/),跳过同步'));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ── 安装完成总结 ──
|
|
264
|
+
|
|
265
|
+
function showSummary(version, tools, specDir) {
|
|
266
|
+
const toolLabels = tools.map(t => TOOL_LABELS[t] || t);
|
|
267
|
+
|
|
268
|
+
console.log('');
|
|
269
|
+
console.log(chalk.green(' ═══════════════════════════════════════'));
|
|
270
|
+
console.log(chalk.green(` ✅ SillySpec v${version} 安装完成!`));
|
|
271
|
+
console.log(chalk.green(' ═══════════════════════════════════════'));
|
|
272
|
+
console.log('');
|
|
273
|
+
console.log(` 已安装工具: ${chalk.cyan(toolLabels.join(', '))}`);
|
|
274
|
+
console.log(` 📁 规范目录: ${chalk.cyan(specDir || '.sillyspec')}`);
|
|
275
|
+
console.log('');
|
|
276
|
+
console.log(' 下一步:使用 AI 技能开始工作');
|
|
277
|
+
console.log(' OpenClaw: ' + chalk.bold('/sillyspec:brainstorm'));
|
|
278
|
+
console.log(' Claude Code: ' + chalk.bold('/sillyspec:brainstorm'));
|
|
279
|
+
console.log('');
|
|
280
|
+
console.log(chalk.dim(' 💡 推荐安装 MCP 工具增强 AI 能力:sillyspec setup'));
|
|
281
|
+
console.log('');
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// ── 读取版本号 ──
|
|
285
|
+
|
|
286
|
+
export function getVersion() {
|
|
287
|
+
try {
|
|
288
|
+
const pkg = JSON.parse(readFileSync(resolve(__dirname, '..', 'package.json'), 'utf8'));
|
|
289
|
+
return pkg.version;
|
|
290
|
+
} catch {
|
|
291
|
+
return '?.?.?';
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ── 主命令 ──
|
|
296
|
+
|
|
297
|
+
export async function cmdInit(projectDir, options = {}) {
|
|
298
|
+
const { tool, interactive, specDir } = options;
|
|
299
|
+
const version = getVersion();
|
|
300
|
+
const resolvedSpecDir = specDir ? resolve(specDir) : null;
|
|
301
|
+
|
|
302
|
+
// ── 交互式模式(--interactive 或 -i)──
|
|
303
|
+
if (interactive && isTTY()) {
|
|
304
|
+
// 欢迎画面
|
|
305
|
+
console.log('');
|
|
306
|
+
console.log(chalk.cyan('🤪 SillySpec v' + version + ' — 规范驱动开发'));
|
|
307
|
+
console.log(chalk.cyan(' ===================================='));
|
|
308
|
+
console.log('');
|
|
309
|
+
console.log(' 让 AI 像高级工程师一样工作:');
|
|
310
|
+
console.log(' 先思考、先规划、先验证,再写代码。');
|
|
311
|
+
console.log('');
|
|
312
|
+
console.log(chalk.gray(' 支持的 AI 工具:'));
|
|
313
|
+
console.log(chalk.gray(' Claude Code · Claude Skills · Cursor · Codex CLI · OpenCode · OpenClaw'));
|
|
314
|
+
console.log('');
|
|
315
|
+
|
|
316
|
+
// 工具多选
|
|
317
|
+
const detected = detectTools(projectDir);
|
|
318
|
+
|
|
319
|
+
const toolChoices = VALID_TOOLS.map(v => ({
|
|
320
|
+
name: `${TOOL_LABELS[v]}${v === 'claude' ? ' (推荐)' : ''}`,
|
|
321
|
+
value: v,
|
|
322
|
+
checked: detected.includes(v),
|
|
323
|
+
}));
|
|
324
|
+
|
|
325
|
+
const selectedTools = await checkbox({
|
|
326
|
+
message: '选择要安装的 AI 工具(空格选择,回车确认)',
|
|
327
|
+
choices: toolChoices,
|
|
328
|
+
validate: (answer) => answer.length > 0 || '至少选择一个工具',
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
// 子项目引导(仅交互模式)
|
|
332
|
+
let subprojects = [];
|
|
333
|
+
{
|
|
334
|
+
console.log('');
|
|
335
|
+
console.log(chalk.yellow('📋 添加子项目'));
|
|
336
|
+
console.log(chalk.dim(' 子项目是工作区中的独立项目目录(如 frontend/、backend/)'));
|
|
337
|
+
console.log('');
|
|
338
|
+
|
|
339
|
+
const addMore = await confirm({ message: '现在添加子项目?', default: true });
|
|
340
|
+
if (addMore) {
|
|
341
|
+
let suggestions = [];
|
|
342
|
+
try {
|
|
343
|
+
const entries = readdirSync(projectDir, { withFileTypes: true });
|
|
344
|
+
suggestions = entries
|
|
345
|
+
.filter(e => e.isDirectory() && !e.name.startsWith('.') && e.name !== 'node_modules')
|
|
346
|
+
.map(e => e.name)
|
|
347
|
+
.sort();
|
|
348
|
+
} catch {}
|
|
349
|
+
|
|
350
|
+
if (suggestions.length > 0) {
|
|
351
|
+
console.log('');
|
|
352
|
+
console.log(chalk.dim(` 检测到以下目录:${suggestions.join(', ')}`));
|
|
353
|
+
console.log('');
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
let adding = true;
|
|
357
|
+
while (adding) {
|
|
358
|
+
const name = await input({
|
|
359
|
+
message: '子项目名称(如 frontend,留空结束)',
|
|
360
|
+
default: suggestions.find(s => !subprojects.find(p => p.name === s)) || '',
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
if (!name.trim()) {
|
|
364
|
+
adding = false;
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const pathHint = suggestions.includes(name.trim()) ? `./${name.trim()}` : '';
|
|
369
|
+
const subPath = await input({
|
|
370
|
+
message: '子项目目录路径',
|
|
371
|
+
default: pathHint,
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
const role = await input({
|
|
375
|
+
message: '子项目描述(如 前端 - Vue3 + TypeScript)',
|
|
376
|
+
default: '',
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
let repo = '';
|
|
380
|
+
try {
|
|
381
|
+
const { execSync } = await import('child_process');
|
|
382
|
+
const absPath = resolve(projectDir, subPath.trim() || `./${name.trim()}`);
|
|
383
|
+
repo = execSync('git remote get-url origin', { cwd: absPath, encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
384
|
+
} catch {}
|
|
385
|
+
|
|
386
|
+
subprojects.push({ name: name.trim(), path: subPath.trim() || `./${name.trim()}`, role: role.trim(), repo });
|
|
387
|
+
|
|
388
|
+
const idx = suggestions.indexOf(name.trim());
|
|
389
|
+
if (idx >= 0) suggestions.splice(idx, 1);
|
|
390
|
+
|
|
391
|
+
const again = await confirm({ message: '继续添加子项目?', default: subprojects.length < suggestions.length });
|
|
392
|
+
if (!again) adding = false;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
console.log('');
|
|
398
|
+
await doInstall(projectDir, selectedTools, subprojects, resolvedSpecDir);
|
|
399
|
+
showSummary(version, selectedTools, resolvedSpecDir);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// ── 默认快速模式:检测 → 安装 → 结束 ──
|
|
404
|
+
|
|
405
|
+
let tools = [];
|
|
406
|
+
if (tool) {
|
|
407
|
+
if (!VALID_TOOLS.includes(tool)) {
|
|
408
|
+
console.error(`❌ 未知工具: ${tool}`);
|
|
409
|
+
console.error(`支持的工具: ${VALID_TOOLS.join(', ')}`);
|
|
410
|
+
process.exit(1);
|
|
411
|
+
}
|
|
412
|
+
tools = [tool];
|
|
413
|
+
} else {
|
|
414
|
+
tools = detectTools(projectDir);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
await doInstall(projectDir, tools, [], resolvedSpecDir);
|
|
418
|
+
|
|
419
|
+
console.log('');
|
|
420
|
+
console.log(chalk.green(` ✅ SillySpec v${version} 安装完成!`));
|
|
421
|
+
console.log('');
|
|
422
|
+
const specDisplay = resolvedSpecDir || '.sillyspec';
|
|
423
|
+
console.log(` 📁 规范目录: ${chalk.cyan(specDisplay)}`);
|
|
424
|
+
console.log('');
|
|
425
|
+
console.log(' 下一步:使用 AI 技能开始工作');
|
|
426
|
+
console.log(` OpenClaw: ${chalk.bold('/sillyspec:brainstorm')}`);
|
|
427
|
+
console.log(` Claude Code: ${chalk.bold('/sillyspec:brainstorm')}`);
|
|
428
|
+
console.log('');
|
|
429
|
+
console.log(chalk.dim(' 💡 增强能力:sillyspec setup(安装 MCP 工具)'));
|
|
430
|
+
console.log('');
|
|
431
|
+
}
|