vibe-splain 3.4.2 → 4.0.0
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/README.md +110 -158
- package/dist/commands/install.d.ts +0 -5
- package/dist/commands/install.js +5 -55
- package/dist/commands/serve.js +1 -1
- package/dist/export/ArtifactBundleWriter.js +3 -3
- package/dist/export/ExportOrchestrator.d.ts +2 -20
- package/dist/export/ExportOrchestrator.js +5 -116
- package/dist/export/Watcher.js +5 -5
- package/dist/export/renderers/AgentMarkdownRenderer.d.ts +1 -1
- package/dist/export/renderers/GraphRenderer.d.ts +2 -2
- package/dist/export/renderers/HtmlRenderer.d.ts +1 -1
- package/dist/export/renderers/HtmlRenderer.js +1 -1
- package/dist/export/renderers/JsonRenderer.d.ts +1 -1
- package/dist/export/renderers/RawAnalysisRenderer.d.ts +1 -1
- package/dist/export/renderers/Renderer.d.ts +1 -1
- package/dist/export/renderers/ValidationRenderer.d.ts +1 -1
- package/dist/index.js +1425 -6511
- package/dist/mcp/server.js +6 -46
- package/dist/mcp/tools/get_file_context.js +1 -1
- package/dist/mcp/tools/get_project_map.js +1 -1
- package/dist/mcp/tools/get_strategic_overview.js +1 -1
- package/dist/mcp/tools/get_wild_discoveries.js +1 -1
- package/dist/mcp/tools/inspect_pillar.js +1 -1
- package/dist/mcp/tools/mark_stale.js +1 -1
- package/dist/mcp/tools/scan_project.d.ts +2 -3
- package/dist/mcp/tools/scan_project.js +12 -13
- package/dist/mcp/tools/set_project_brief.js +1 -1
- package/dist/mcp/tools/write_decision_card.d.ts +1 -1
- package/dist/mcp/tools/write_decision_card.js +2 -2
- package/dist/ui/index.html +1 -1
- package/package.json +9 -14
- package/dist/commands/bundle.d.ts +0 -4
- package/dist/commands/bundle.js +0 -68
- package/dist/commands/export.d.ts +0 -1
- package/dist/commands/export.js +0 -19
- package/dist/commands/gc.d.ts +0 -3
- package/dist/commands/gc.js +0 -59
- package/dist/commands/hook.d.ts +0 -9
- package/dist/commands/hook.js +0 -84
- package/dist/commands/importBundle.d.ts +0 -4
- package/dist/commands/importBundle.js +0 -80
- package/dist/commands/network.d.ts +0 -1
- package/dist/commands/network.js +0 -91
- package/dist/commands/scan.d.ts +0 -13
- package/dist/commands/scan.js +0 -97
- package/dist/export/renderers/DeltaRenderer.d.ts +0 -6
- package/dist/export/renderers/DeltaRenderer.js +0 -22
- package/dist/hook/preToolUse.d.ts +0 -30
- package/dist/hook/preToolUse.js +0 -81
- package/dist/hook-entry.d.ts +0 -2
- package/dist/hook-entry.js +0 -8
- package/dist/hook.d.ts +0 -1
- package/dist/hook.js +0 -337
- package/dist/mcp/BudgetGuard.d.ts +0 -13
- package/dist/mcp/BudgetGuard.js +0 -55
- package/dist/mcp/SessionScope.d.ts +0 -26
- package/dist/mcp/SessionScope.js +0 -56
- package/dist/mcp/tools/apply_patch.d.ts +0 -37
- package/dist/mcp/tools/apply_patch.js +0 -103
- package/dist/mcp/tools/explainSpecialistScope.d.ts +0 -15
- package/dist/mcp/tools/explainSpecialistScope.js +0 -30
- package/dist/mcp/tools/get_call_chain.d.ts +0 -42
- package/dist/mcp/tools/get_call_chain.js +0 -50
- package/dist/mcp/tools/get_file_skeleton.d.ts +0 -23
- package/dist/mcp/tools/get_file_skeleton.js +0 -124
- package/dist/mcp/tools/hydration/get_evidence_slice.d.ts +0 -31
- package/dist/mcp/tools/hydration/get_evidence_slice.js +0 -57
- package/dist/mcp/tools/hydration/get_project_summary.d.ts +0 -23
- package/dist/mcp/tools/hydration/get_project_summary.js +0 -58
- package/dist/mcp/tools/hydration/get_start_here.d.ts +0 -23
- package/dist/mcp/tools/hydration/get_start_here.js +0 -52
- package/dist/mcp/tools/prepareTaskContext.d.ts +0 -38
- package/dist/mcp/tools/prepareTaskContext.js +0 -93
- package/dist/mcp/tools/read_file.d.ts +0 -31
- package/dist/mcp/tools/read_file.js +0 -90
- package/dist/mcp/tools/set_session_scope.d.ts +0 -19
- package/dist/mcp/tools/set_session_scope.js +0 -40
- package/dist/mcp/tools/submit_receipt.d.ts +0 -68
- package/dist/mcp/tools/submit_receipt.js +0 -94
- package/dist/mcp/tools/work_orders.d.ts +0 -79
- package/dist/mcp/tools/work_orders.js +0 -126
- package/dist/mcp/tools/yield_for_scope_expansion.d.ts +0 -29
- package/dist/mcp/tools/yield_for_scope_expansion.js +0 -59
- package/dist/store/BlobStore.d.ts +0 -22
- package/dist/store/BlobStore.js +0 -96
- package/dist/store/PointerStore.d.ts +0 -52
- package/dist/store/PointerStore.js +0 -154
package/dist/mcp/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
3
|
import { CallToolRequestSchema, ListToolsRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
-
import { initParser } from '@
|
|
4
|
+
import { initParser } from '@vibesplain/brain';
|
|
5
5
|
import { handleScanProject, scanProjectTool } from './tools/scan_project.js';
|
|
6
6
|
import { handleGetProjectMap, getProjectMapTool } from './tools/get_project_map.js';
|
|
7
7
|
import { handleSetProjectBrief, setProjectBriefTool } from './tools/set_project_brief.js';
|
|
@@ -11,16 +11,6 @@ import { handleGetStrategicOverview, getStrategicOverviewTool } from './tools/ge
|
|
|
11
11
|
import { handleInspectPillar, inspectPillarTool } from './tools/inspect_pillar.js';
|
|
12
12
|
import { handleGetWildDiscoveries, getWildDiscoveriesTool } from './tools/get_wild_discoveries.js';
|
|
13
13
|
import { handleMarkStale, markStaleTool } from './tools/mark_stale.js';
|
|
14
|
-
import { handleGetFileSkeleton, getFileSkeletonTool } from './tools/get_file_skeleton.js';
|
|
15
|
-
import { handleReadFile, readFileTool } from './tools/read_file.js';
|
|
16
|
-
import { handleCreateWorkOrder, createWorkOrderTool, handleSpawnWorker, spawnWorkerTool } from './tools/work_orders.js';
|
|
17
|
-
import { handleSetSessionScope, setSessionScopeTool } from './tools/set_session_scope.js';
|
|
18
|
-
import { handleYieldForScopeExpansion, yieldForScopeExpansionTool } from './tools/yield_for_scope_expansion.js';
|
|
19
|
-
import { handleGetStartHere, getStartHereTool } from './tools/hydration/get_start_here.js';
|
|
20
|
-
import { handleGetProjectSummary, getProjectSummaryTool } from './tools/hydration/get_project_summary.js';
|
|
21
|
-
import { handleGetEvidenceSlice, getEvidenceSliceTool } from './tools/hydration/get_evidence_slice.js';
|
|
22
|
-
import { handlePrepareTaskContext, prepareTaskContextTool } from './tools/prepareTaskContext.js';
|
|
23
|
-
import { handleExplainSpecialistScope, explainSpecialistScopeTool } from './tools/explainSpecialistScope.js';
|
|
24
14
|
// ⚠️ CRITICAL: Never use console.log() anywhere in this codebase.
|
|
25
15
|
// stdout is owned by the MCP SDK for protocol messages.
|
|
26
16
|
// Use console.error() for all diagnostic output.
|
|
@@ -34,21 +24,6 @@ const ALL_TOOLS = [
|
|
|
34
24
|
inspectPillarTool,
|
|
35
25
|
getWildDiscoveriesTool,
|
|
36
26
|
markStaleTool,
|
|
37
|
-
// Phase 2: Skeletons + Hydration
|
|
38
|
-
getFileSkeletonTool,
|
|
39
|
-
readFileTool,
|
|
40
|
-
getStartHereTool,
|
|
41
|
-
getProjectSummaryTool,
|
|
42
|
-
getEvidenceSliceTool,
|
|
43
|
-
// Phase 3: Worker Delegation
|
|
44
|
-
createWorkOrderTool,
|
|
45
|
-
spawnWorkerTool,
|
|
46
|
-
// Phase 4: Scope & Escalation
|
|
47
|
-
setSessionScopeTool,
|
|
48
|
-
yieldForScopeExpansionTool,
|
|
49
|
-
// Specialist Network v0
|
|
50
|
-
prepareTaskContextTool,
|
|
51
|
-
explainSpecialistScopeTool,
|
|
52
27
|
];
|
|
53
28
|
const TOOL_HANDLERS = {
|
|
54
29
|
scan_project: handleScanProject,
|
|
@@ -60,33 +35,18 @@ const TOOL_HANDLERS = {
|
|
|
60
35
|
inspect_pillar: handleInspectPillar,
|
|
61
36
|
get_wild_discoveries: handleGetWildDiscoveries,
|
|
62
37
|
mark_stale: handleMarkStale,
|
|
63
|
-
// Phase 2
|
|
64
|
-
get_file_skeleton: handleGetFileSkeleton,
|
|
65
|
-
read_file: handleReadFile,
|
|
66
|
-
get_start_here: handleGetStartHere,
|
|
67
|
-
get_project_summary: handleGetProjectSummary,
|
|
68
|
-
get_evidence_slice: handleGetEvidenceSlice,
|
|
69
|
-
// Phase 3
|
|
70
|
-
create_work_order: handleCreateWorkOrder,
|
|
71
|
-
spawn_worker: handleSpawnWorker,
|
|
72
|
-
// Phase 4
|
|
73
|
-
set_session_scope: handleSetSessionScope,
|
|
74
|
-
yield_for_scope_expansion: handleYieldForScopeExpansion,
|
|
75
|
-
// Specialist Network v0
|
|
76
|
-
vibe_prepare_task_context: handlePrepareTaskContext,
|
|
77
|
-
vibe_explain_specialist_scope: handleExplainSpecialistScope,
|
|
78
38
|
};
|
|
79
39
|
export async function startMCPServer(options = {}) {
|
|
80
40
|
// Initialize Tree-Sitter WASM once at startup
|
|
81
41
|
await initParser();
|
|
82
|
-
console.error('[
|
|
83
|
-
const server = new Server({ name: '
|
|
42
|
+
console.error('[vibesplain] Tree-Sitter parser initialized');
|
|
43
|
+
const server = new Server({ name: 'vibesplain', version: '4.0.0' }, { capabilities: { tools: {}, prompts: {} } });
|
|
84
44
|
// Register prompts
|
|
85
45
|
server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
86
46
|
prompts: [
|
|
87
47
|
{
|
|
88
48
|
name: 'build_dossier',
|
|
89
|
-
description: 'Build a full architectural dossier using
|
|
49
|
+
description: 'Build a full architectural dossier using vibesplain (replaces the need to copy-paste the README prompt)',
|
|
90
50
|
}
|
|
91
51
|
]
|
|
92
52
|
}));
|
|
@@ -187,7 +147,7 @@ When done, share the exact file:// UI link returned by scan_project. Never inven
|
|
|
187
147
|
}
|
|
188
148
|
catch (err) {
|
|
189
149
|
const message = err instanceof Error ? err.message : String(err);
|
|
190
|
-
console.error(`[
|
|
150
|
+
console.error(`[vibesplain] Tool ${name} error:`, message);
|
|
191
151
|
return {
|
|
192
152
|
content: [{ type: 'text', text: `Error: ${message}` }],
|
|
193
153
|
isError: true,
|
|
@@ -196,7 +156,7 @@ When done, share the exact file:// UI link returned by scan_project. Never inven
|
|
|
196
156
|
});
|
|
197
157
|
const transport = new StdioServerTransport();
|
|
198
158
|
await server.connect(transport);
|
|
199
|
-
console.error('[
|
|
159
|
+
console.error('[vibesplain] MCP server running on stdio');
|
|
200
160
|
// Process stays alive — do NOT call process.exit() here
|
|
201
161
|
}
|
|
202
162
|
//# sourceMappingURL=server.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'fs/promises';
|
|
2
2
|
import { join, relative, isAbsolute } from 'path';
|
|
3
|
-
import { getFileAnalysis, readAnalysis } from '@
|
|
3
|
+
import { getFileAnalysis, readAnalysis } from '@vibesplain/brain';
|
|
4
4
|
export const getFileContextTool = {
|
|
5
5
|
name: 'get_file_context',
|
|
6
6
|
description: 'Returns PRE-EXTRACTED evidence for a file so you do not have to read the whole thing and paraphrase its header comment. Returns: gravity/heat scores + signals, importedBy (named fan-in — use this for blastRadius), hotSpans (the gnarliest function bodies, comment-stripped, each with a reason), smellSpans (located tech debt with ±3 lines of context), and signature (the exported API surface). Base your evidence on hotSpans/smellSpans — NEVER on header comments. Pass { full: true } only if you truly need the raw source.',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readDossier } from '@
|
|
1
|
+
import { readDossier } from '@vibesplain/brain';
|
|
2
2
|
export const getProjectMapTool = {
|
|
3
3
|
name: 'get_project_map',
|
|
4
4
|
description: 'Returns the project map produced by scan_project: the detected stack, entrypoints, the FIXED set of architectural pillars (you may NOT invent others — write_decision_card rejects unknown pillars), the Start-Here files (highest gravity = most depended-upon), and the Wild-Discovery candidates (highest heat = most tech debt). BEFORE writing any card you MUST: read this map, write a 3-5 sentence project brief, and persist it via set_project_brief.',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readDossier } from '@
|
|
1
|
+
import { readDossier } from '@vibesplain/brain';
|
|
2
2
|
export const getStrategicOverviewTool = {
|
|
3
3
|
name: 'get_strategic_overview',
|
|
4
4
|
description: 'Returns the current state of the dossier without evidence snippets (to save tokens). Use this to see what has already been analyzed and what is stale. Check stalePaths to know which files need re-analysis.',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readDossier } from '@
|
|
1
|
+
import { readDossier } from '@vibesplain/brain';
|
|
2
2
|
export const getWildDiscoveriesTool = {
|
|
3
3
|
name: 'get_wild_discoveries',
|
|
4
4
|
description: 'Returns Decision Cards that are both high-heat (heat ≥ 60) AND/OR high-severity (severity ≥ 4) — the files that are load-bearing AND smelly. These are the highest-leverage things to understand and fix first.',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readDossier } from '@
|
|
1
|
+
import { readDossier } from '@vibesplain/brain';
|
|
2
2
|
export const inspectPillarTool = {
|
|
3
3
|
name: 'inspect_pillar',
|
|
4
4
|
description: 'Returns all Decision Cards for a specific pillar including full evidence snippets. Use when you need deep detail on a specific area of the codebase.',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { scanProject } from '@
|
|
2
|
-
import type { Dossier } from '@
|
|
1
|
+
import { scanProject } from '@vibesplain/brain';
|
|
2
|
+
import type { Dossier } from '@vibesplain/brain';
|
|
3
3
|
export declare const scanProjectTool: {
|
|
4
4
|
name: string;
|
|
5
5
|
description: string;
|
|
@@ -24,7 +24,6 @@ export interface ScanRun {
|
|
|
24
24
|
result: Awaited<ReturnType<typeof scanProject>>;
|
|
25
25
|
dossier: Dossier;
|
|
26
26
|
scanId: string;
|
|
27
|
-
manifestPointer: unknown;
|
|
28
27
|
}
|
|
29
28
|
export declare function performScan(projectRoot: string, options?: any): Promise<ScanRun>;
|
|
30
29
|
export declare function handleScanProject(args: Record<string, unknown>, options?: any): Promise<unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { scanProject, readDossier } from '@
|
|
1
|
+
import { scanProject, readDossier } from '@vibesplain/brain';
|
|
2
2
|
import { ExportOrchestrator } from '../../export/ExportOrchestrator.js';
|
|
3
3
|
import { startWatcher } from '../../export/Watcher.js';
|
|
4
4
|
export const scanProjectTool = {
|
|
@@ -45,32 +45,31 @@ export async function performScan(projectRoot, options = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
const scanId = `scan_${Date.now()}`;
|
|
47
47
|
const orchestrator = new ExportOrchestrator(projectRoot);
|
|
48
|
-
|
|
48
|
+
await orchestrator.writeBundle(dossier, {
|
|
49
49
|
format: options.format,
|
|
50
50
|
budget: options.budget ? parseInt(options.budget, 10) : undefined,
|
|
51
51
|
scope: options.scope,
|
|
52
|
-
}, result.store, result.graph
|
|
53
|
-
return { result, dossier, scanId
|
|
52
|
+
}, result.store, result.graph);
|
|
53
|
+
return { result, dossier, scanId };
|
|
54
54
|
}
|
|
55
55
|
export async function handleScanProject(args, options = {}) {
|
|
56
56
|
const projectRoot = args.projectRoot;
|
|
57
57
|
if (!projectRoot)
|
|
58
58
|
throw new Error('projectRoot is required');
|
|
59
|
-
console.error(`[
|
|
60
|
-
const { result, scanId
|
|
59
|
+
console.error(`[vibesplain] Scanning project: ${projectRoot}`);
|
|
60
|
+
const { result, scanId } = await performScan(projectRoot, options);
|
|
61
61
|
// Watch the real-source files for staleness. MCP serve mode keeps this alive
|
|
62
62
|
// for the session; headless callers pass watch:false so the persistent
|
|
63
63
|
// chokidar watcher never pins the event loop open and the process can exit.
|
|
64
64
|
if (options.watch !== false) {
|
|
65
65
|
await startWatcher(projectRoot, result.files.map(f => f.path));
|
|
66
66
|
}
|
|
67
|
-
console.error(`[
|
|
68
|
-
const validation = result.validation ?? { passed: true, errors: 0, warnings: 0, reportPath: '.
|
|
67
|
+
console.error(`[vibesplain] Scan complete. ${result.totalFilesScanned} files, ${result.realSourceCount} real-source, ${result.wildCandidates.length} wild candidates.`);
|
|
68
|
+
const validation = result.validation ?? { passed: true, errors: 0, warnings: 0, reportPath: '.vibesplain/validation_report.json' };
|
|
69
69
|
return {
|
|
70
70
|
ok: true,
|
|
71
71
|
message: 'Scan complete.',
|
|
72
72
|
scanId,
|
|
73
|
-
manifestPointer,
|
|
74
73
|
validation: result.fullValidationReport || {
|
|
75
74
|
passed: validation.passed,
|
|
76
75
|
errors: validation.errors,
|
|
@@ -78,10 +77,10 @@ export async function handleScanProject(args, options = {}) {
|
|
|
78
77
|
reportPath: validation.reportPath,
|
|
79
78
|
},
|
|
80
79
|
artifacts: {
|
|
81
|
-
analysis: '.
|
|
82
|
-
dossier: '.
|
|
83
|
-
graph: '.
|
|
84
|
-
html: '.
|
|
80
|
+
analysis: '.vibesplain/analysis.json',
|
|
81
|
+
dossier: '.vibesplain/dossier.json',
|
|
82
|
+
graph: '.vibesplain/graph.json',
|
|
83
|
+
html: '.vibesplain/ui/index.html',
|
|
85
84
|
},
|
|
86
85
|
projectRoot: result.projectRoot,
|
|
87
86
|
totalFilesScanned: result.totalFilesScanned,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readDossier, validateMermaidNodeCount, readAnalysis } from '@
|
|
1
|
+
import { readDossier, validateMermaidNodeCount, readAnalysis } from '@vibesplain/brain';
|
|
2
2
|
import { ExportOrchestrator } from '../../export/ExportOrchestrator.js';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { createHash } from 'crypto';
|
|
@@ -138,7 +138,7 @@ export async function handleWriteDecisionCard(args, options = {}) {
|
|
|
138
138
|
budget: options.budget ? parseInt(options.budget, 10) : undefined,
|
|
139
139
|
scope: options.scope,
|
|
140
140
|
});
|
|
141
|
-
console.error(`[
|
|
141
|
+
console.error(`[vibesplain] Card written: "${title}" [${category} sev${severity}] in "${pillar}"${isWild ? ' (Wild Discovery)' : ''}`);
|
|
142
142
|
// Keep the loop going: compute what is still undocumented.
|
|
143
143
|
const documented = new Set([...dossier.pillars.flatMap(p => p.decisions), ...dossier.wildDiscoveries]
|
|
144
144
|
.map(c => c.primaryFile).filter(Boolean));
|