@buoy-design/cli 0.1.0 → 0.1.2
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/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +235 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/baseline.d.ts +39 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +298 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/check.d.ts +16 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +168 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/ci.d.ts +2 -2
- package/dist/commands/ci.d.ts.map +1 -1
- package/dist/commands/ci.js +124 -142
- package/dist/commands/ci.js.map +1 -1
- package/dist/commands/compare.d.ts +3 -0
- package/dist/commands/compare.d.ts.map +1 -0
- package/dist/commands/compare.js +170 -0
- package/dist/commands/compare.js.map +1 -0
- package/dist/commands/drift.d.ts +1 -1
- package/dist/commands/drift.d.ts.map +1 -1
- package/dist/commands/drift.js +79 -121
- package/dist/commands/drift.js.map +1 -1
- package/dist/commands/explain.d.ts +3 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +212 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/graph.d.ts +3 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/commands/graph.js +430 -0
- package/dist/commands/graph.js.map +1 -0
- package/dist/commands/index.d.ts +14 -8
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +14 -8
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +404 -237
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/plugins.d.ts.map +1 -1
- package/dist/commands/plugins.js +32 -41
- package/dist/commands/plugins.js.map +1 -1
- package/dist/commands/scan.d.ts +1 -1
- package/dist/commands/scan.d.ts.map +1 -1
- package/dist/commands/scan.js +107 -219
- package/dist/commands/scan.js.map +1 -1
- package/dist/commands/status.d.ts +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +114 -122
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tokens.d.ts +3 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +261 -0
- package/dist/commands/tokens.js.map +1 -0
- package/dist/config/auto-detect.d.ts +21 -0
- package/dist/config/auto-detect.d.ts.map +1 -0
- package/dist/config/auto-detect.js +278 -0
- package/dist/config/auto-detect.js.map +1 -0
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +17 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +63 -63
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +20 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/constants.d.ts +36 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +37 -0
- package/dist/constants.js.map +1 -0
- package/dist/detect/frameworks.d.ts +11 -2
- package/dist/detect/frameworks.d.ts.map +1 -1
- package/dist/detect/frameworks.js +78 -78
- package/dist/detect/frameworks.js.map +1 -1
- package/dist/detect/index.d.ts +1 -0
- package/dist/detect/index.d.ts.map +1 -1
- package/dist/detect/index.js +3 -0
- package/dist/detect/index.js.map +1 -1
- package/dist/detect/monorepo-patterns.d.ts +54 -0
- package/dist/detect/monorepo-patterns.d.ts.map +1 -0
- package/dist/detect/monorepo-patterns.js +209 -0
- package/dist/detect/monorepo-patterns.js.map +1 -0
- package/dist/detect/project-detector.d.ts +1 -1
- package/dist/detect/project-detector.d.ts.map +1 -1
- package/dist/detect/project-detector.js +132 -0
- package/dist/detect/project-detector.js.map +1 -1
- package/dist/explain/agents.d.ts +31 -0
- package/dist/explain/agents.d.ts.map +1 -0
- package/dist/explain/agents.js +507 -0
- package/dist/explain/agents.js.map +1 -0
- package/dist/hooks/index.d.ts +26 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +283 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/dist/integrations/github-formatter.d.ts +55 -0
- package/dist/integrations/github-formatter.d.ts.map +1 -0
- package/dist/integrations/github-formatter.js +391 -0
- package/dist/integrations/github-formatter.js.map +1 -0
- package/dist/integrations/github.d.ts +95 -0
- package/dist/integrations/github.d.ts.map +1 -0
- package/dist/integrations/github.js +281 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/index.d.ts +4 -0
- package/dist/integrations/index.d.ts.map +1 -0
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/index.js.map +1 -0
- package/dist/output/formatters.d.ts.map +1 -1
- package/dist/output/formatters.js +5 -10
- package/dist/output/formatters.js.map +1 -1
- package/dist/scan/orchestrator.d.ts +76 -0
- package/dist/scan/orchestrator.d.ts.map +1 -0
- package/dist/scan/orchestrator.js +247 -0
- package/dist/scan/orchestrator.js.map +1 -0
- package/dist/services/ai-analysis.d.ts +54 -0
- package/dist/services/ai-analysis.d.ts.map +1 -0
- package/dist/services/ai-analysis.js +239 -0
- package/dist/services/ai-analysis.js.map +1 -0
- package/dist/services/drift-analysis.d.ts +77 -0
- package/dist/services/drift-analysis.d.ts.map +1 -0
- package/dist/services/drift-analysis.js +145 -0
- package/dist/services/drift-analysis.js.map +1 -0
- package/package.json +17 -5
- package/dist/commands/__tests__/ci.test.d.ts +0 -2
- package/dist/commands/__tests__/ci.test.d.ts.map +0 -1
- package/dist/commands/__tests__/ci.test.js +0 -33
- package/dist/commands/__tests__/ci.test.js.map +0 -1
- package/dist/commands/bootstrap.d.ts +0 -3
- package/dist/commands/bootstrap.d.ts.map +0 -1
- package/dist/commands/bootstrap.js +0 -458
- package/dist/commands/bootstrap.js.map +0 -1
- package/dist/plugins/index.d.ts +0 -3
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/index.js +0 -3
- package/dist/plugins/index.js.map +0 -1
- package/dist/plugins/loader.d.ts +0 -11
- package/dist/plugins/loader.d.ts.map +0 -1
- package/dist/plugins/loader.js +0 -77
- package/dist/plugins/loader.js.map +0 -1
- package/dist/plugins/registry.d.ts +0 -15
- package/dist/plugins/registry.d.ts.map +0 -1
- package/dist/plugins/registry.js +0 -32
- package/dist/plugins/registry.js.map +0 -1
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { basename, resolve } from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the target from user input
|
|
6
|
+
* Returns null if no input and not --all (meaning run scan mode)
|
|
7
|
+
*/
|
|
8
|
+
export function resolveTarget(input, all) {
|
|
9
|
+
if (all) {
|
|
10
|
+
return {
|
|
11
|
+
type: "all",
|
|
12
|
+
path: process.cwd(),
|
|
13
|
+
name: "design-system",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (!input) {
|
|
17
|
+
// No input = scan mode, handled separately
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
// Drift signal reference
|
|
21
|
+
if (input.startsWith("drift:")) {
|
|
22
|
+
const driftId = input.slice(6);
|
|
23
|
+
return {
|
|
24
|
+
type: "drift",
|
|
25
|
+
path: driftId,
|
|
26
|
+
name: `drift-${driftId}`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
// File or directory
|
|
30
|
+
const resolved = resolve(input);
|
|
31
|
+
if (!existsSync(resolved)) {
|
|
32
|
+
throw new Error(`Target not found: ${input}`);
|
|
33
|
+
}
|
|
34
|
+
const stats = require("fs").statSync(resolved);
|
|
35
|
+
return {
|
|
36
|
+
type: stats.isDirectory() ? "directory" : "file",
|
|
37
|
+
path: resolved,
|
|
38
|
+
name: basename(resolved),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build quick/high-level prompts for --all or --quick mode
|
|
43
|
+
*/
|
|
44
|
+
function buildQuickPrompt(agent, targetDesc) {
|
|
45
|
+
const prompts = {
|
|
46
|
+
"git-archaeologist": `Analyze ${targetDesc}. Quick git history overview:
|
|
47
|
+
1. Check recent commits (last 20) for patterns
|
|
48
|
+
2. Who are the main contributors?
|
|
49
|
+
3. Any recent major changes?
|
|
50
|
+
Keep response under 300 words. Focus on key insights only.`,
|
|
51
|
+
"structure-analyst": `Analyze ${targetDesc}. Quick architecture overview:
|
|
52
|
+
1. What's the high-level structure?
|
|
53
|
+
2. Key directories and their purposes?
|
|
54
|
+
3. Main patterns or frameworks used?
|
|
55
|
+
Keep response under 300 words. Focus on architecture insights only.`,
|
|
56
|
+
"code-reader": `Analyze ${targetDesc}. Quick code overview:
|
|
57
|
+
1. What are the main technologies?
|
|
58
|
+
2. Any obvious TODOs or FIXMEs?
|
|
59
|
+
3. Code quality observations?
|
|
60
|
+
Keep response under 300 words. Focus on key observations only.`,
|
|
61
|
+
"convention-detective": `Analyze ${targetDesc}. Quick conventions check:
|
|
62
|
+
1. What frameworks/patterns are used?
|
|
63
|
+
2. Are conventions consistent?
|
|
64
|
+
3. Any obvious anti-patterns?
|
|
65
|
+
Keep response under 300 words. Focus on pattern insights only.`,
|
|
66
|
+
};
|
|
67
|
+
return prompts[agent] || "";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Build the prompt for each investigation agent
|
|
71
|
+
*/
|
|
72
|
+
function buildAgentPrompt(agent, target, quick) {
|
|
73
|
+
// Special handling for scan results
|
|
74
|
+
if (target.type === "scan" && target.scanData) {
|
|
75
|
+
return buildScanAgentPrompt(agent, target.scanData);
|
|
76
|
+
}
|
|
77
|
+
const targetDesc = target.type === "all"
|
|
78
|
+
? "the design system in this codebase"
|
|
79
|
+
: target.type === "drift"
|
|
80
|
+
? `drift signal ${target.path}`
|
|
81
|
+
: `${target.path}`;
|
|
82
|
+
// Quick mode uses shorter, more focused prompts
|
|
83
|
+
if (quick || target.type === "all") {
|
|
84
|
+
return buildQuickPrompt(agent, targetDesc);
|
|
85
|
+
}
|
|
86
|
+
const prompts = {
|
|
87
|
+
"git-archaeologist": `You are investigating: ${targetDesc}
|
|
88
|
+
|
|
89
|
+
Your mission: Uncover the history of this code through git forensics.
|
|
90
|
+
|
|
91
|
+
Tasks:
|
|
92
|
+
1. Run git log to see the history of changes to this target
|
|
93
|
+
2. Run git blame on relevant files to see line-by-line attribution
|
|
94
|
+
3. Find the original commits that introduced this code
|
|
95
|
+
4. Look for refactoring commits (messages with "refactor", "move", "rename")
|
|
96
|
+
5. Check for PR/issue references in commit messages (#123 patterns)
|
|
97
|
+
6. Identify the author(s) and time periods of major changes
|
|
98
|
+
|
|
99
|
+
Focus your output on:
|
|
100
|
+
- When and why this was originally created
|
|
101
|
+
- Key evolutionary moments (major refactors, ownership changes)
|
|
102
|
+
- Any PR/issue discussions that reveal intent
|
|
103
|
+
- Clues from commit messages about constraints or decisions
|
|
104
|
+
|
|
105
|
+
Be concise. Focus on insights that explain WHY things are the way they are.`,
|
|
106
|
+
"structure-analyst": `You are investigating: ${targetDesc}
|
|
107
|
+
|
|
108
|
+
Your mission: Understand how this fits into the codebase architecture.
|
|
109
|
+
|
|
110
|
+
Tasks:
|
|
111
|
+
1. Find what imports or depends on this (search for import statements)
|
|
112
|
+
2. Find what this imports or depends on
|
|
113
|
+
3. Examine the directory structure - why is it located here?
|
|
114
|
+
4. Look for related files (tests, stories, types, styles)
|
|
115
|
+
5. Check if this is part of a larger pattern (similar files nearby)
|
|
116
|
+
6. Identify the architectural "layer" this belongs to
|
|
117
|
+
|
|
118
|
+
Focus your output on:
|
|
119
|
+
- The dependency graph (what uses this, what this uses)
|
|
120
|
+
- Why the current location makes sense (or doesn't)
|
|
121
|
+
- Related files that provide context
|
|
122
|
+
- The architectural role this plays
|
|
123
|
+
|
|
124
|
+
Be concise. Focus on structural insights that explain the design.`,
|
|
125
|
+
"code-reader": `You are investigating: ${targetDesc}
|
|
126
|
+
|
|
127
|
+
Your mission: Read the actual code for clues about purpose and constraints.
|
|
128
|
+
|
|
129
|
+
Tasks:
|
|
130
|
+
1. Read the file(s) carefully
|
|
131
|
+
2. Extract all comments, especially TODO, HACK, FIXME, NOTE, WARNING
|
|
132
|
+
3. Analyze naming conventions - what do names reveal?
|
|
133
|
+
4. Look for defensive code, error handling, edge cases
|
|
134
|
+
5. Identify hardcoded values and speculate why they exist
|
|
135
|
+
6. Note unusual patterns that might have backstory
|
|
136
|
+
|
|
137
|
+
Focus your output on:
|
|
138
|
+
- The core purpose (1-2 sentences)
|
|
139
|
+
- Revealing comments (quote them verbatim)
|
|
140
|
+
- What the code structure tells us about constraints
|
|
141
|
+
- Oddities that suggest workarounds or history
|
|
142
|
+
|
|
143
|
+
Be concise. Focus on what the code itself reveals about intent.`,
|
|
144
|
+
"convention-detective": `You are investigating: ${targetDesc}
|
|
145
|
+
|
|
146
|
+
Your mission: Compare against known patterns and project conventions.
|
|
147
|
+
|
|
148
|
+
Tasks:
|
|
149
|
+
1. Identify the framework/library being used (React, Vue, Tailwind, etc.)
|
|
150
|
+
2. Check if this follows standard patterns for that ecosystem
|
|
151
|
+
3. Look for deviations from conventions - intentional or accidental?
|
|
152
|
+
4. Compare to similar code elsewhere in this project
|
|
153
|
+
5. Identify potential workarounds for known limitations
|
|
154
|
+
6. Note anti-patterns that might indicate tech debt
|
|
155
|
+
|
|
156
|
+
Focus your output on:
|
|
157
|
+
- What conventions/patterns this should follow
|
|
158
|
+
- Where it deviates and possible reasons why
|
|
159
|
+
- How it compares to similar code in the same repo
|
|
160
|
+
- Signs of workarounds or intentional divergence
|
|
161
|
+
|
|
162
|
+
Be concise. Focus on pattern analysis that explains design choices.`,
|
|
163
|
+
};
|
|
164
|
+
return prompts[agent] || "";
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Build prompts for explaining scan results (drift signals)
|
|
168
|
+
*/
|
|
169
|
+
function buildScanAgentPrompt(agent, scanData) {
|
|
170
|
+
const prompts = {
|
|
171
|
+
"drift-analyst": `You are analyzing Buoy scan results for this codebase.
|
|
172
|
+
|
|
173
|
+
Here are the scan results:
|
|
174
|
+
|
|
175
|
+
${scanData}
|
|
176
|
+
|
|
177
|
+
Your mission: Analyze the PATTERNS in these drift signals.
|
|
178
|
+
|
|
179
|
+
Tasks:
|
|
180
|
+
1. Group related drift signals (same component, same type, same root cause)
|
|
181
|
+
2. Identify the most impactful issues (what affects the most code)
|
|
182
|
+
3. Look for systemic problems vs one-off issues
|
|
183
|
+
4. Note which components or areas have the most drift
|
|
184
|
+
|
|
185
|
+
Focus your output on:
|
|
186
|
+
- Patterns you see across multiple signals
|
|
187
|
+
- The severity distribution and what it means
|
|
188
|
+
- Components or areas that need the most attention
|
|
189
|
+
- Whether this looks like gradual drift or sudden changes
|
|
190
|
+
|
|
191
|
+
Be concise. Focus on insights that help prioritize fixes.`,
|
|
192
|
+
"root-cause-investigator": `You are analyzing Buoy scan results for this codebase.
|
|
193
|
+
|
|
194
|
+
Here are the scan results:
|
|
195
|
+
|
|
196
|
+
${scanData}
|
|
197
|
+
|
|
198
|
+
Your mission: Investigate the ROOT CAUSES of drift.
|
|
199
|
+
|
|
200
|
+
Tasks:
|
|
201
|
+
1. For hardcoded values: Why might developers be bypassing tokens?
|
|
202
|
+
2. For naming issues: What convention conflicts exist?
|
|
203
|
+
3. For orphaned components: Why aren't these in the design system?
|
|
204
|
+
4. For deprecated patterns: What's blocking migration?
|
|
205
|
+
|
|
206
|
+
Focus your output on:
|
|
207
|
+
- The likely reasons behind each type of drift
|
|
208
|
+
- Whether issues stem from tooling, process, or knowledge gaps
|
|
209
|
+
- Common root causes that explain multiple signals
|
|
210
|
+
- What's intentional vs accidental
|
|
211
|
+
|
|
212
|
+
Be concise. Focus on WHY drift is happening, not just WHAT drifted.`,
|
|
213
|
+
"impact-assessor": `You are analyzing Buoy scan results for this codebase.
|
|
214
|
+
|
|
215
|
+
Here are the scan results:
|
|
216
|
+
|
|
217
|
+
${scanData}
|
|
218
|
+
|
|
219
|
+
Your mission: Assess the IMPACT and RISK of this drift.
|
|
220
|
+
|
|
221
|
+
Tasks:
|
|
222
|
+
1. Which drift signals pose the highest risk?
|
|
223
|
+
2. What's the blast radius of each issue?
|
|
224
|
+
3. Which fixes would have the most positive impact?
|
|
225
|
+
4. What happens if this drift continues unchecked?
|
|
226
|
+
|
|
227
|
+
Focus your output on:
|
|
228
|
+
- Risk assessment for the critical and warning signals
|
|
229
|
+
- Which components are most heavily affected
|
|
230
|
+
- The cumulative effect of the drift patterns
|
|
231
|
+
- Priority order for addressing issues
|
|
232
|
+
|
|
233
|
+
Be concise. Focus on impact and risk, not just listing issues.`,
|
|
234
|
+
"fix-strategist": `You are analyzing Buoy scan results for this codebase.
|
|
235
|
+
|
|
236
|
+
Here are the scan results:
|
|
237
|
+
|
|
238
|
+
${scanData}
|
|
239
|
+
|
|
240
|
+
Your mission: Develop a FIX STRATEGY for the drift.
|
|
241
|
+
|
|
242
|
+
Tasks:
|
|
243
|
+
1. Group fixes that can be done together (same root cause)
|
|
244
|
+
2. Identify quick wins vs larger refactors
|
|
245
|
+
3. Suggest the order of operations for fixes
|
|
246
|
+
4. Note any fixes that might have dependencies
|
|
247
|
+
|
|
248
|
+
Focus your output on:
|
|
249
|
+
- Concrete fix strategies, not vague suggestions
|
|
250
|
+
- Which fixes can be automated vs need manual work
|
|
251
|
+
- The logical order for addressing drift
|
|
252
|
+
- Potential risks or gotchas with fixes
|
|
253
|
+
|
|
254
|
+
Be concise. Focus on actionable fix strategies.`,
|
|
255
|
+
};
|
|
256
|
+
return prompts[agent] || "";
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Build the synthesis prompt for scan results
|
|
260
|
+
*/
|
|
261
|
+
function buildScanSynthesisPrompt(scanData, findings) {
|
|
262
|
+
const findingsText = findings
|
|
263
|
+
.filter((f) => f.success)
|
|
264
|
+
.map((f) => `## ${f.agent}\n\n${f.output}`)
|
|
265
|
+
.join("\n\n---\n\n");
|
|
266
|
+
return `You are synthesizing an analysis of Buoy scan results.
|
|
267
|
+
|
|
268
|
+
Original scan data:
|
|
269
|
+
${scanData}
|
|
270
|
+
|
|
271
|
+
Four agents have analyzed these results. Here are their findings:
|
|
272
|
+
|
|
273
|
+
${findingsText}
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
Your mission: Create a clear, ACTIONABLE summary for the developer.
|
|
278
|
+
|
|
279
|
+
Create a response with this EXACT structure:
|
|
280
|
+
|
|
281
|
+
# Design System Health Report
|
|
282
|
+
|
|
283
|
+
## Summary
|
|
284
|
+
|
|
285
|
+
[2-3 sentences: How healthy is this codebase? What's the overall drift situation?]
|
|
286
|
+
|
|
287
|
+
## Key Findings
|
|
288
|
+
|
|
289
|
+
[3-5 bullet points of the most important insights from the analysis]
|
|
290
|
+
|
|
291
|
+
## Recommendations
|
|
292
|
+
|
|
293
|
+
[Numbered list of 3-5 specific, actionable recommendations. Each should have:]
|
|
294
|
+
- A clear action title
|
|
295
|
+
- Confidence level: (High Confidence), (Medium Confidence), or (Low Confidence)
|
|
296
|
+
- 2-3 sentences explaining the fix and its impact
|
|
297
|
+
- Specific files or components affected if known
|
|
298
|
+
|
|
299
|
+
Order by priority - most impactful fixes first.
|
|
300
|
+
|
|
301
|
+
## Quick Wins
|
|
302
|
+
|
|
303
|
+
[2-3 small fixes that can be done immediately with high confidence]
|
|
304
|
+
|
|
305
|
+
## Open Questions
|
|
306
|
+
|
|
307
|
+
[2-3 things that need human judgment or more investigation]
|
|
308
|
+
|
|
309
|
+
Be direct. Be specific. Make the recommendations genuinely useful.
|
|
310
|
+
Focus on what the developer should DO, not just what's wrong.`;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Build the synthesis prompt that combines all findings
|
|
314
|
+
*/
|
|
315
|
+
function buildSynthesisPrompt(target, findings) {
|
|
316
|
+
const findingsText = findings
|
|
317
|
+
.filter((f) => f.success)
|
|
318
|
+
.map((f) => `## ${f.agent}\n\n${f.output}`)
|
|
319
|
+
.join("\n\n---\n\n");
|
|
320
|
+
return `You are synthesizing an investigation about: ${target.name}
|
|
321
|
+
|
|
322
|
+
Four agents have investigated this target. Here are their findings:
|
|
323
|
+
|
|
324
|
+
${findingsText}
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
Your mission: Build a coherent, ACTIONABLE explanation.
|
|
329
|
+
|
|
330
|
+
Create a response with this EXACT structure:
|
|
331
|
+
|
|
332
|
+
# ${target.name}
|
|
333
|
+
|
|
334
|
+
## What We Found
|
|
335
|
+
|
|
336
|
+
[2-3 paragraphs explaining the history and context. Why does this exist?
|
|
337
|
+
How did it evolve? What constraints shaped it?]
|
|
338
|
+
|
|
339
|
+
## Recommendations
|
|
340
|
+
|
|
341
|
+
[Numbered list of 2-4 specific, actionable recommendations. Each should have:]
|
|
342
|
+
- A clear action title
|
|
343
|
+
- Confidence level: (High Confidence), (Medium Confidence), or (Low Confidence)
|
|
344
|
+
- 2-3 sentences explaining WHY this action makes sense based on the evidence
|
|
345
|
+
- Code example if applicable (use diff format for changes)
|
|
346
|
+
|
|
347
|
+
Focus on recommendations that are:
|
|
348
|
+
- Grounded in evidence from the investigation
|
|
349
|
+
- Actually useful (not just "consider refactoring")
|
|
350
|
+
- Prioritized by confidence and impact
|
|
351
|
+
|
|
352
|
+
## Open Questions
|
|
353
|
+
|
|
354
|
+
[2-3 bullet points of things that remain unclear and might need human input]
|
|
355
|
+
|
|
356
|
+
Be direct. Be specific. Make the recommendations genuinely useful.`;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Run a single agent using the Claude CLI
|
|
360
|
+
*/
|
|
361
|
+
async function runAgent(agent, prompt, options = {}) {
|
|
362
|
+
const timeout = options.timeout || 60000;
|
|
363
|
+
return new Promise((resolve) => {
|
|
364
|
+
// Use --print flag for non-interactive mode, disable MCP to speed up
|
|
365
|
+
const args = ["-p", prompt, "--output-format", "text", "--no-mcp"];
|
|
366
|
+
const child = spawn("claude", args, {
|
|
367
|
+
cwd: process.cwd(),
|
|
368
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
369
|
+
env: {
|
|
370
|
+
PATH: process.env.PATH,
|
|
371
|
+
HOME: process.env.HOME,
|
|
372
|
+
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY,
|
|
373
|
+
// Skip project detection to speed up
|
|
374
|
+
CLAUDE_CODE_SKIP_PROJECT_DETECTION: "1",
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
let stdout = "";
|
|
378
|
+
let stderr = "";
|
|
379
|
+
const timer = setTimeout(() => {
|
|
380
|
+
child.kill("SIGTERM");
|
|
381
|
+
const partialInfo = stdout.length > 0 ? ` (got ${stdout.length} chars)` : "";
|
|
382
|
+
const stderrInfo = stderr.length > 0 ? ` stderr: ${stderr.slice(0, 100)}` : "";
|
|
383
|
+
resolve({
|
|
384
|
+
agent,
|
|
385
|
+
success: false,
|
|
386
|
+
output: stdout,
|
|
387
|
+
error: `Agent timed out after ${timeout / 1000}s${partialInfo}${stderrInfo}`,
|
|
388
|
+
});
|
|
389
|
+
}, timeout);
|
|
390
|
+
child.stdout.on("data", (data) => {
|
|
391
|
+
stdout += data.toString();
|
|
392
|
+
});
|
|
393
|
+
child.stderr.on("data", (data) => {
|
|
394
|
+
stderr += data.toString();
|
|
395
|
+
});
|
|
396
|
+
child.on("close", (code) => {
|
|
397
|
+
clearTimeout(timer);
|
|
398
|
+
if (code === 0) {
|
|
399
|
+
resolve({ agent, success: true, output: stdout.trim() });
|
|
400
|
+
}
|
|
401
|
+
else {
|
|
402
|
+
resolve({
|
|
403
|
+
agent,
|
|
404
|
+
success: false,
|
|
405
|
+
output: stdout.trim(),
|
|
406
|
+
error: stderr.trim() || `Agent exited with code ${code}`,
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
child.on("error", (err) => {
|
|
411
|
+
clearTimeout(timer);
|
|
412
|
+
resolve({
|
|
413
|
+
agent,
|
|
414
|
+
success: false,
|
|
415
|
+
output: "",
|
|
416
|
+
error: `Failed to spawn claude: ${err.message}`,
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Run all investigation agents in parallel, then synthesize
|
|
423
|
+
*/
|
|
424
|
+
export async function runExplainAgents(target, options = {}) {
|
|
425
|
+
// Use different agents for scan mode vs file/directory mode
|
|
426
|
+
const agents = target.type === "scan"
|
|
427
|
+
? ["drift-analyst", "root-cause-investigator", "impact-assessor", "fix-strategist"]
|
|
428
|
+
: ["git-archaeologist", "structure-analyst", "code-reader", "convention-detective"];
|
|
429
|
+
// Timeouts depend on scope and quick mode
|
|
430
|
+
// --all on large codebases needs more time
|
|
431
|
+
const agentTimeout = options.quick ? 60000 : (target.type === "all" ? 180000 : 120000);
|
|
432
|
+
const synthesizerTimeout = options.quick ? 90000 : 300000;
|
|
433
|
+
// Run investigation agents in parallel
|
|
434
|
+
const investigationPromises = agents.map(async (agent) => {
|
|
435
|
+
options.onProgress?.(agent, "started");
|
|
436
|
+
const prompt = buildAgentPrompt(agent, target, options.quick);
|
|
437
|
+
const result = await runAgent(agent, prompt, { timeout: agentTimeout, verbose: options.verbose });
|
|
438
|
+
options.onProgress?.(agent, result.success ? "completed" : "failed");
|
|
439
|
+
return result;
|
|
440
|
+
});
|
|
441
|
+
const findings = await Promise.all(investigationPromises);
|
|
442
|
+
// Run synthesizer with all findings (longer timeout since it processes everything)
|
|
443
|
+
options.onProgress?.("synthesizer", "started");
|
|
444
|
+
const synthesisPrompt = target.type === "scan" && target.scanData
|
|
445
|
+
? buildScanSynthesisPrompt(target.scanData, findings)
|
|
446
|
+
: buildSynthesisPrompt(target, findings);
|
|
447
|
+
const synthesisResult = await runAgent("synthesizer", synthesisPrompt, {
|
|
448
|
+
timeout: synthesizerTimeout,
|
|
449
|
+
verbose: options.verbose,
|
|
450
|
+
});
|
|
451
|
+
options.onProgress?.("synthesizer", synthesisResult.success ? "completed" : "failed");
|
|
452
|
+
// If synthesis failed, build a fallback from the findings
|
|
453
|
+
let synthesis;
|
|
454
|
+
if (synthesisResult.success) {
|
|
455
|
+
synthesis = synthesisResult.output;
|
|
456
|
+
}
|
|
457
|
+
else if (synthesisResult.output && synthesisResult.output.length > 100) {
|
|
458
|
+
// Partial output is available - use it
|
|
459
|
+
synthesis = `${synthesisResult.output}\n\n---\n*Note: Synthesis was interrupted but partial analysis above may be useful.*`;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
// Build manual summary from individual findings
|
|
463
|
+
synthesis = buildFallbackSynthesis(target, findings);
|
|
464
|
+
}
|
|
465
|
+
return {
|
|
466
|
+
target,
|
|
467
|
+
findings,
|
|
468
|
+
synthesis,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Build a fallback synthesis when the synthesizer agent fails
|
|
473
|
+
*/
|
|
474
|
+
function buildFallbackSynthesis(target, findings) {
|
|
475
|
+
const successfulFindings = findings.filter((f) => f.success);
|
|
476
|
+
if (successfulFindings.length === 0) {
|
|
477
|
+
return `# Analysis Failed
|
|
478
|
+
|
|
479
|
+
Unable to complete analysis of ${target.name}. All investigation agents failed.
|
|
480
|
+
|
|
481
|
+
Please try again or check your network connection.`;
|
|
482
|
+
}
|
|
483
|
+
let output = `# ${target.name}
|
|
484
|
+
|
|
485
|
+
*Note: Full synthesis unavailable. Showing individual agent findings.*
|
|
486
|
+
|
|
487
|
+
`;
|
|
488
|
+
for (const finding of successfulFindings) {
|
|
489
|
+
const agentTitle = finding.agent
|
|
490
|
+
.split("-")
|
|
491
|
+
.map((w) => w.charAt(0).toUpperCase() + w.slice(1))
|
|
492
|
+
.join(" ");
|
|
493
|
+
output += `## ${agentTitle}\n\n`;
|
|
494
|
+
output += finding.output;
|
|
495
|
+
output += "\n\n---\n\n";
|
|
496
|
+
}
|
|
497
|
+
output += `## Next Steps
|
|
498
|
+
|
|
499
|
+
Review the findings above and look for:
|
|
500
|
+
- Patterns that appear in multiple agent reports
|
|
501
|
+
- High-confidence observations vs speculation
|
|
502
|
+
- Actionable items you can address immediately
|
|
503
|
+
|
|
504
|
+
Run with \`--verbose\` for full agent output.`;
|
|
505
|
+
return output;
|
|
506
|
+
}
|
|
507
|
+
//# sourceMappingURL=agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/explain/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAsB9C;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB,EAAE,GAAY;IACnE,IAAI,GAAG,EAAE,CAAC;QACR,OAAO;YACL,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE;YACnB,IAAI,EAAE,eAAe;SACtB,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,2CAA2C;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yBAAyB;IACzB,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/B,OAAO;YACL,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO;YACb,IAAI,EAAE,SAAS,OAAO,EAAE;SACzB,CAAC;IACJ,CAAC;IAED,oBAAoB;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IA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I;;;;;;;8CAOkC,CAAC;IAE7C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lint-staged configuration for package.json
|
|
3
|
+
*/
|
|
4
|
+
export declare const LINT_STAGED_CONFIG: {
|
|
5
|
+
"*.{tsx,jsx,ts,js,vue,svelte}": string[];
|
|
6
|
+
};
|
|
7
|
+
export type HookSystem = "git" | "husky" | "pre-commit" | "lint-staged";
|
|
8
|
+
/**
|
|
9
|
+
* Detect which hook system is in use
|
|
10
|
+
*/
|
|
11
|
+
export declare function detectHookSystem(projectRoot: string): HookSystem | null;
|
|
12
|
+
export interface SetupHooksResult {
|
|
13
|
+
success: boolean;
|
|
14
|
+
hookSystem: HookSystem | null;
|
|
15
|
+
message: string;
|
|
16
|
+
filePath?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Setup pre-commit hooks for the project
|
|
20
|
+
*/
|
|
21
|
+
export declare function setupHooks(projectRoot: string): SetupHooksResult;
|
|
22
|
+
/**
|
|
23
|
+
* Generate a standalone pre-commit hook script for .buoy/hooks/
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateStandaloneHook(projectRoot: string): SetupHooksResult;
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAuCA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;CAE9B,CAAC;AAmBF,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,CAAC;AAExE;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA8BvE;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CA2BhE;AAgLD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAoB5E"}
|