@brad-frost-web/eddie-brain 0.32.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 +109 -0
- package/dist/analyze/drift-detector.d.ts +30 -0
- package/dist/analyze/drift-detector.d.ts.map +1 -0
- package/dist/analyze/drift-detector.js +310 -0
- package/dist/analyze/drift-detector.js.map +1 -0
- package/dist/analyze/health-scorer.d.ts +71 -0
- package/dist/analyze/health-scorer.d.ts.map +1 -0
- package/dist/analyze/health-scorer.js +420 -0
- package/dist/analyze/health-scorer.js.map +1 -0
- package/dist/analyze/index.d.ts +11 -0
- package/dist/analyze/index.d.ts.map +1 -0
- package/dist/analyze/index.js +11 -0
- package/dist/analyze/index.js.map +1 -0
- package/dist/analyze/naming-validator.d.ts +99 -0
- package/dist/analyze/naming-validator.d.ts.map +1 -0
- package/dist/analyze/naming-validator.js +430 -0
- package/dist/analyze/naming-validator.js.map +1 -0
- package/dist/analyze/slot-contract-validator.d.ts +68 -0
- package/dist/analyze/slot-contract-validator.d.ts.map +1 -0
- package/dist/analyze/slot-contract-validator.js +232 -0
- package/dist/analyze/slot-contract-validator.js.map +1 -0
- package/dist/analyze/token-validator.d.ts +62 -0
- package/dist/analyze/token-validator.d.ts.map +1 -0
- package/dist/analyze/token-validator.js +348 -0
- package/dist/analyze/token-validator.js.map +1 -0
- package/dist/cli/brain.d.ts +12 -0
- package/dist/cli/brain.d.ts.map +1 -0
- package/dist/cli/brain.js +641 -0
- package/dist/cli/brain.js.map +1 -0
- package/dist/cli/formatters/json.d.ts +15 -0
- package/dist/cli/formatters/json.d.ts.map +1 -0
- package/dist/cli/formatters/json.js +18 -0
- package/dist/cli/formatters/json.js.map +1 -0
- package/dist/cli/formatters/terminal.d.ts +19 -0
- package/dist/cli/formatters/terminal.d.ts.map +1 -0
- package/dist/cli/formatters/terminal.js +125 -0
- package/dist/cli/formatters/terminal.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/data/governance-rules.json +94 -0
- package/dist/governance/audit-log.d.ts +17 -0
- package/dist/governance/audit-log.d.ts.map +1 -0
- package/dist/governance/audit-log.js +44 -0
- package/dist/governance/audit-log.js.map +1 -0
- package/dist/governance/index.d.ts +8 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +8 -0
- package/dist/governance/index.js.map +1 -0
- package/dist/governance/permissions.d.ts +26 -0
- package/dist/governance/permissions.d.ts.map +1 -0
- package/dist/governance/permissions.js +75 -0
- package/dist/governance/permissions.js.map +1 -0
- package/dist/governance/rules-engine.d.ts +24 -0
- package/dist/governance/rules-engine.d.ts.map +1 -0
- package/dist/governance/rules-engine.js +111 -0
- package/dist/governance/rules-engine.js.map +1 -0
- package/dist/governance/trust-manager.d.ts +34 -0
- package/dist/governance/trust-manager.d.ts.map +1 -0
- package/dist/governance/trust-manager.js +148 -0
- package/dist/governance/trust-manager.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge-graph/component-index.d.ts +320 -0
- package/dist/knowledge-graph/component-index.d.ts.map +1 -0
- package/dist/knowledge-graph/component-index.js +1033 -0
- package/dist/knowledge-graph/component-index.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +134 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +249 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/learning-history.d.ts +77 -0
- package/dist/knowledge-graph/learning-history.d.ts.map +1 -0
- package/dist/knowledge-graph/learning-history.js +187 -0
- package/dist/knowledge-graph/learning-history.js.map +1 -0
- package/dist/knowledge-graph/relationship-map.d.ts +55 -0
- package/dist/knowledge-graph/relationship-map.d.ts.map +1 -0
- package/dist/knowledge-graph/relationship-map.js +238 -0
- package/dist/knowledge-graph/relationship-map.js.map +1 -0
- package/dist/knowledge-graph/token-taxonomy.d.ts +127 -0
- package/dist/knowledge-graph/token-taxonomy.d.ts.map +1 -0
- package/dist/knowledge-graph/token-taxonomy.js +357 -0
- package/dist/knowledge-graph/token-taxonomy.js.map +1 -0
- package/dist/loop/fix-agent.d.ts +55 -0
- package/dist/loop/fix-agent.d.ts.map +1 -0
- package/dist/loop/fix-agent.js +344 -0
- package/dist/loop/fix-agent.js.map +1 -0
- package/dist/loop/index.d.ts +8 -0
- package/dist/loop/index.d.ts.map +1 -0
- package/dist/loop/index.js +8 -0
- package/dist/loop/index.js.map +1 -0
- package/dist/loop/issue-fetcher.d.ts +51 -0
- package/dist/loop/issue-fetcher.d.ts.map +1 -0
- package/dist/loop/issue-fetcher.js +188 -0
- package/dist/loop/issue-fetcher.js.map +1 -0
- package/dist/loop/observer.d.ts +42 -0
- package/dist/loop/observer.d.ts.map +1 -0
- package/dist/loop/observer.js +220 -0
- package/dist/loop/observer.js.map +1 -0
- package/dist/loop/pacer.d.ts +44 -0
- package/dist/loop/pacer.d.ts.map +1 -0
- package/dist/loop/pacer.js +90 -0
- package/dist/loop/pacer.js.map +1 -0
- package/dist/loop/reporter.d.ts +9 -0
- package/dist/loop/reporter.d.ts.map +1 -0
- package/dist/loop/reporter.js +119 -0
- package/dist/loop/reporter.js.map +1 -0
- package/dist/loop/runner.d.ts +57 -0
- package/dist/loop/runner.d.ts.map +1 -0
- package/dist/loop/runner.js +390 -0
- package/dist/loop/runner.js.map +1 -0
- package/dist/loop/types.d.ts +151 -0
- package/dist/loop/types.d.ts.map +1 -0
- package/dist/loop/types.js +22 -0
- package/dist/loop/types.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +7 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/server.d.ts +12 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +618 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/pipeline/agent-runner.d.ts +34 -0
- package/dist/pipeline/agent-runner.d.ts.map +1 -0
- package/dist/pipeline/agent-runner.js +323 -0
- package/dist/pipeline/agent-runner.js.map +1 -0
- package/dist/pipeline/agents/accessibility-auditor.d.ts +10 -0
- package/dist/pipeline/agents/accessibility-auditor.d.ts.map +1 -0
- package/dist/pipeline/agents/accessibility-auditor.js +69 -0
- package/dist/pipeline/agents/accessibility-auditor.js.map +1 -0
- package/dist/pipeline/agents/code-reviewer.d.ts +10 -0
- package/dist/pipeline/agents/code-reviewer.d.ts.map +1 -0
- package/dist/pipeline/agents/code-reviewer.js +75 -0
- package/dist/pipeline/agents/code-reviewer.js.map +1 -0
- package/dist/pipeline/agents/code-writer.d.ts +10 -0
- package/dist/pipeline/agents/code-writer.d.ts.map +1 -0
- package/dist/pipeline/agents/code-writer.js +103 -0
- package/dist/pipeline/agents/code-writer.js.map +1 -0
- package/dist/pipeline/agents/component-architect.d.ts +13 -0
- package/dist/pipeline/agents/component-architect.d.ts.map +1 -0
- package/dist/pipeline/agents/component-architect.js +81 -0
- package/dist/pipeline/agents/component-architect.js.map +1 -0
- package/dist/pipeline/agents/index.d.ts +16 -0
- package/dist/pipeline/agents/index.d.ts.map +1 -0
- package/dist/pipeline/agents/index.js +24 -0
- package/dist/pipeline/agents/index.js.map +1 -0
- package/dist/pipeline/agents/library-researcher.d.ts +12 -0
- package/dist/pipeline/agents/library-researcher.d.ts.map +1 -0
- package/dist/pipeline/agents/library-researcher.js +85 -0
- package/dist/pipeline/agents/library-researcher.js.map +1 -0
- package/dist/pipeline/agents/quality-gate.d.ts +9 -0
- package/dist/pipeline/agents/quality-gate.d.ts.map +1 -0
- package/dist/pipeline/agents/quality-gate.js +71 -0
- package/dist/pipeline/agents/quality-gate.js.map +1 -0
- package/dist/pipeline/agents/spec-analyst.d.ts +10 -0
- package/dist/pipeline/agents/spec-analyst.d.ts.map +1 -0
- package/dist/pipeline/agents/spec-analyst.js +72 -0
- package/dist/pipeline/agents/spec-analyst.js.map +1 -0
- package/dist/pipeline/agents/story-author.d.ts +9 -0
- package/dist/pipeline/agents/story-author.d.ts.map +1 -0
- package/dist/pipeline/agents/story-author.js +65 -0
- package/dist/pipeline/agents/story-author.js.map +1 -0
- package/dist/pipeline/artifact-store.d.ts +27 -0
- package/dist/pipeline/artifact-store.d.ts.map +1 -0
- package/dist/pipeline/artifact-store.js +77 -0
- package/dist/pipeline/artifact-store.js.map +1 -0
- package/dist/pipeline/conversational-gate.d.ts +26 -0
- package/dist/pipeline/conversational-gate.d.ts.map +1 -0
- package/dist/pipeline/conversational-gate.js +122 -0
- package/dist/pipeline/conversational-gate.js.map +1 -0
- package/dist/pipeline/index.d.ts +14 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +17 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/iteration-tracker.d.ts +29 -0
- package/dist/pipeline/iteration-tracker.d.ts.map +1 -0
- package/dist/pipeline/iteration-tracker.js +102 -0
- package/dist/pipeline/iteration-tracker.js.map +1 -0
- package/dist/pipeline/learning-bridge.d.ts +37 -0
- package/dist/pipeline/learning-bridge.d.ts.map +1 -0
- package/dist/pipeline/learning-bridge.js +118 -0
- package/dist/pipeline/learning-bridge.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +45 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +473 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/templates/architecture.d.ts +27 -0
- package/dist/pipeline/templates/architecture.d.ts.map +1 -0
- package/dist/pipeline/templates/architecture.js +111 -0
- package/dist/pipeline/templates/architecture.js.map +1 -0
- package/dist/pipeline/templates/brief.d.ts +22 -0
- package/dist/pipeline/templates/brief.d.ts.map +1 -0
- package/dist/pipeline/templates/brief.js +121 -0
- package/dist/pipeline/templates/brief.js.map +1 -0
- package/dist/pipeline/templates/component-rules.d.ts +25 -0
- package/dist/pipeline/templates/component-rules.d.ts.map +1 -0
- package/dist/pipeline/templates/component-rules.js +93 -0
- package/dist/pipeline/templates/component-rules.js.map +1 -0
- package/dist/pipeline/templates/index.d.ts +9 -0
- package/dist/pipeline/templates/index.d.ts.map +1 -0
- package/dist/pipeline/templates/index.js +7 -0
- package/dist/pipeline/templates/index.js.map +1 -0
- package/dist/pipeline/tool-handler.d.ts +25 -0
- package/dist/pipeline/tool-handler.d.ts.map +1 -0
- package/dist/pipeline/tool-handler.js +392 -0
- package/dist/pipeline/tool-handler.js.map +1 -0
- package/dist/pipeline/types.d.ts +146 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +27 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/plan/action-types.d.ts +31 -0
- package/dist/plan/action-types.d.ts.map +1 -0
- package/dist/plan/action-types.js +83 -0
- package/dist/plan/action-types.js.map +1 -0
- package/dist/plan/decision-engine.d.ts +57 -0
- package/dist/plan/decision-engine.d.ts.map +1 -0
- package/dist/plan/decision-engine.js +162 -0
- package/dist/plan/decision-engine.js.map +1 -0
- package/dist/plan/index.d.ts +6 -0
- package/dist/plan/index.d.ts.map +1 -0
- package/dist/plan/index.js +6 -0
- package/dist/plan/index.js.map +1 -0
- package/dist/types.d.ts +351 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +26 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/anthropic.d.ts +15 -0
- package/dist/utils/anthropic.d.ts.map +1 -0
- package/dist/utils/anthropic.js +40 -0
- package/dist/utils/anthropic.js.map +1 -0
- package/dist/utils/id.d.ts +8 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/id.js +14 -0
- package/dist/utils/id.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolHandler — Executes eddie-brain tools without MCP transport
|
|
3
|
+
*
|
|
4
|
+
* Replicates the dispatch logic from mcp/server.ts but calls
|
|
5
|
+
* KnowledgeGraph/TokenValidator/NamingValidator/HealthScorer directly.
|
|
6
|
+
* Returns plain strings instead of MCP content objects.
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from 'path';
|
|
9
|
+
import { readFile } from 'fs/promises';
|
|
10
|
+
import { existsSync } from 'fs';
|
|
11
|
+
import { TokenValidator, NamingValidator, SlotContractValidator, HealthScorer } from '../analyze/index.js';
|
|
12
|
+
import { DEFAULT_CONFIG } from '../types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Optional MCP client for design-systems tools.
|
|
15
|
+
* Set via setDesignSystemsMcp() before running the pipeline.
|
|
16
|
+
*/
|
|
17
|
+
let designSystemsMcpHandler = null;
|
|
18
|
+
export function setDesignSystemsMcpHandler(handler) {
|
|
19
|
+
designSystemsMcpHandler = handler;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Execute an eddie-brain tool call and return the result as a string.
|
|
23
|
+
*/
|
|
24
|
+
export async function executeToolCall(toolName, toolInput, knowledgeGraph, rootDir) {
|
|
25
|
+
switch (toolName) {
|
|
26
|
+
case 'eddie_get_component':
|
|
27
|
+
return handleGetComponent(toolInput, knowledgeGraph);
|
|
28
|
+
case 'eddie_get_token':
|
|
29
|
+
return handleGetToken(toolInput, knowledgeGraph);
|
|
30
|
+
case 'eddie_validate_file':
|
|
31
|
+
return handleValidateFile(toolInput, knowledgeGraph, rootDir);
|
|
32
|
+
case 'eddie_check_health':
|
|
33
|
+
return handleCheckHealth(toolInput, knowledgeGraph, rootDir);
|
|
34
|
+
case 'eddie_compose_recipe':
|
|
35
|
+
return handleComposeRecipe(toolInput, knowledgeGraph);
|
|
36
|
+
case 'eddie_get_relationships':
|
|
37
|
+
return handleGetRelationships(toolInput, knowledgeGraph);
|
|
38
|
+
case 'eddie_search':
|
|
39
|
+
return handleSearch(toolInput, knowledgeGraph);
|
|
40
|
+
case 'eddie_suggest_fix':
|
|
41
|
+
return handleSuggestFix(toolInput);
|
|
42
|
+
case 'eddie_read_file':
|
|
43
|
+
return handleReadFile(toolInput, rootDir);
|
|
44
|
+
case 'ds_search_design_knowledge':
|
|
45
|
+
case 'ds_search_chunks':
|
|
46
|
+
case 'ds_browse_by_category':
|
|
47
|
+
return handleDesignSystemsTool(toolName, toolInput);
|
|
48
|
+
default:
|
|
49
|
+
return JSON.stringify({ error: `Unknown tool: ${toolName}` });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build Anthropic API tool definitions for the specified tools.
|
|
54
|
+
*/
|
|
55
|
+
export function buildToolDefinitions(tools) {
|
|
56
|
+
return tools.map(tool => TOOL_DEFINITIONS[tool]).filter(Boolean);
|
|
57
|
+
}
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// Tool Implementations
|
|
60
|
+
// =============================================================================
|
|
61
|
+
async function handleGetComponent(input, kg) {
|
|
62
|
+
const name = input.name;
|
|
63
|
+
const tagName = name.startsWith('ed-') ? name : `ed-${name}`;
|
|
64
|
+
const component = kg.componentIndex.getComponent(tagName);
|
|
65
|
+
if (!component) {
|
|
66
|
+
const all = kg.componentIndex.getAll();
|
|
67
|
+
const matches = all.filter(c => c.tagName.includes(name) || c.displayName.toLowerCase().includes(name.toLowerCase()));
|
|
68
|
+
if (matches.length > 0) {
|
|
69
|
+
return JSON.stringify({
|
|
70
|
+
error: `Component "${tagName}" not found. Did you mean one of these?`,
|
|
71
|
+
suggestions: matches.map(m => ({ tagName: m.tagName, displayName: m.displayName, intent: m.intent })),
|
|
72
|
+
}, null, 2);
|
|
73
|
+
}
|
|
74
|
+
return JSON.stringify({ error: `Component "${tagName}" not found in Eddie.` });
|
|
75
|
+
}
|
|
76
|
+
return JSON.stringify(component, null, 2);
|
|
77
|
+
}
|
|
78
|
+
async function handleGetToken(input, kg) {
|
|
79
|
+
const name = input.name;
|
|
80
|
+
const token = kg.tokenTaxonomy.getToken(name);
|
|
81
|
+
if (!token) {
|
|
82
|
+
const all = kg.tokenTaxonomy.getAll();
|
|
83
|
+
const matches = all.filter(t => t.name.includes(name)).slice(0, 10);
|
|
84
|
+
return JSON.stringify({
|
|
85
|
+
error: `Token "${name}" not found.`,
|
|
86
|
+
suggestions: matches.map(m => ({ name: m.name, tier: m.tier, category: m.category, value: m.value })),
|
|
87
|
+
}, null, 2);
|
|
88
|
+
}
|
|
89
|
+
return JSON.stringify(token, null, 2);
|
|
90
|
+
}
|
|
91
|
+
async function handleValidateFile(input, kg, rootDir) {
|
|
92
|
+
const path = input.path;
|
|
93
|
+
const filePath = resolve(rootDir, path);
|
|
94
|
+
const issues = [];
|
|
95
|
+
const tokenValidator = new TokenValidator();
|
|
96
|
+
const tokenIssues = await tokenValidator.validateFile(filePath, kg.tokenTaxonomy);
|
|
97
|
+
issues.push(...tokenIssues);
|
|
98
|
+
const namingValidator = new NamingValidator();
|
|
99
|
+
const namingIssues = await namingValidator.validateFile(filePath);
|
|
100
|
+
issues.push(...namingIssues);
|
|
101
|
+
const slotValidator = new SlotContractValidator(kg.componentIndex);
|
|
102
|
+
const slotIssues = await slotValidator.validateFile(filePath);
|
|
103
|
+
issues.push(...slotIssues);
|
|
104
|
+
return JSON.stringify({
|
|
105
|
+
file: path,
|
|
106
|
+
issueCount: issues.length,
|
|
107
|
+
issues: issues.map(i => ({
|
|
108
|
+
severity: i.severity,
|
|
109
|
+
message: i.message,
|
|
110
|
+
line: i.line,
|
|
111
|
+
actual: i.actual,
|
|
112
|
+
expected: i.expected,
|
|
113
|
+
autoFixable: i.autoFixable,
|
|
114
|
+
suggestion: i.suggestion,
|
|
115
|
+
})),
|
|
116
|
+
}, null, 2);
|
|
117
|
+
}
|
|
118
|
+
async function handleCheckHealth(input, kg, rootDir) {
|
|
119
|
+
const component = input.component;
|
|
120
|
+
const config = { ...DEFAULT_CONFIG, rootDir };
|
|
121
|
+
if (component) {
|
|
122
|
+
const scorer = new HealthScorer(kg, config);
|
|
123
|
+
const scores = await scorer.scoreComponent(component);
|
|
124
|
+
return JSON.stringify({ type: 'component', component, scores }, null, 2);
|
|
125
|
+
}
|
|
126
|
+
return JSON.stringify({ type: 'system', summary: kg.getSummary() }, null, 2);
|
|
127
|
+
}
|
|
128
|
+
async function handleComposeRecipe(input, kg) {
|
|
129
|
+
const intent = input.intent;
|
|
130
|
+
const terms = intent.toLowerCase().split(/\s+/);
|
|
131
|
+
const recipes = kg.relationshipMap
|
|
132
|
+
.getAll()
|
|
133
|
+
.filter(r => terms.some(t => r.intent.toLowerCase().includes(t)) ||
|
|
134
|
+
terms.some(t => r.name.toLowerCase().includes(t)));
|
|
135
|
+
const components = kg.componentIndex
|
|
136
|
+
.getAll()
|
|
137
|
+
.filter(c => terms.some(t => c.intent.toLowerCase().includes(t)) ||
|
|
138
|
+
terms.some(t => c.tagName.includes(t)) ||
|
|
139
|
+
terms.some(t => c.displayName.toLowerCase().includes(t)))
|
|
140
|
+
.slice(0, 15);
|
|
141
|
+
return JSON.stringify({
|
|
142
|
+
query: intent,
|
|
143
|
+
recipes: recipes.map(r => ({
|
|
144
|
+
name: r.name, intent: r.intent, status: r.status, components: r.components, rules: r.rules,
|
|
145
|
+
})),
|
|
146
|
+
relevantComponents: components.map(c => ({
|
|
147
|
+
tagName: c.tagName, intent: c.intent, properties: c.properties.map(p => p.name), slots: c.slots.map(s => s.name),
|
|
148
|
+
})),
|
|
149
|
+
}, null, 2);
|
|
150
|
+
}
|
|
151
|
+
async function handleGetRelationships(input, kg) {
|
|
152
|
+
const component = input.component;
|
|
153
|
+
const tagName = component.startsWith('ed-') ? component : `ed-${component}`;
|
|
154
|
+
const recipes = kg.relationshipMap.findRecipesFor(tagName);
|
|
155
|
+
const entry = kg.componentIndex.getComponent(tagName);
|
|
156
|
+
return JSON.stringify({
|
|
157
|
+
component: tagName,
|
|
158
|
+
composesWith: entry?.composesWith ?? [],
|
|
159
|
+
childComponents: entry?.childComponents ?? [],
|
|
160
|
+
parentComponent: entry?.parentComponent ?? null,
|
|
161
|
+
recipes: recipes.map(r => ({
|
|
162
|
+
name: r.name, intent: r.intent, status: r.status, components: r.components,
|
|
163
|
+
})),
|
|
164
|
+
}, null, 2);
|
|
165
|
+
}
|
|
166
|
+
async function handleSearch(input, kg) {
|
|
167
|
+
const query = input.query;
|
|
168
|
+
const results = kg.search(query);
|
|
169
|
+
return JSON.stringify({
|
|
170
|
+
query,
|
|
171
|
+
components: results.components.slice(0, 10).map(c => ({
|
|
172
|
+
tagName: c.tagName, intent: c.intent, atomicLevel: c.atomicLevel,
|
|
173
|
+
})),
|
|
174
|
+
recipes: results.recipes.slice(0, 5).map(r => ({
|
|
175
|
+
name: r.name, intent: r.intent, status: r.status,
|
|
176
|
+
})),
|
|
177
|
+
}, null, 2);
|
|
178
|
+
}
|
|
179
|
+
async function handleSuggestFix(input) {
|
|
180
|
+
const issueType = input.issue_type;
|
|
181
|
+
const file = input.file;
|
|
182
|
+
const line = input.line;
|
|
183
|
+
const suggestions = {
|
|
184
|
+
'token-raw-hex': 'Replace the raw hex color with an Eddie token. Use --ed-theme-color-* tokens.',
|
|
185
|
+
'token-raw-px': 'Replace raw pixel value with --ed-spacing-* token.',
|
|
186
|
+
'token-wrong-tier': 'Use semantic (tier 2) tokens (--ed-theme-*) instead of definition (tier 1) tokens.',
|
|
187
|
+
'token-intent-mismatch': 'The token category does not match the CSS property.',
|
|
188
|
+
'token-deprecated': 'This token is deprecated. Search for its replacement.',
|
|
189
|
+
'naming-unclassed': 'Add a BEM class: ed-c-{component}__{element}.',
|
|
190
|
+
'naming-invalid-prefix': 'Class names must start with: ed-c-, ed-l-, ed-u-, ed-r-, or is-/has-.',
|
|
191
|
+
'naming-bad-bem': 'Use BEM format: ed-c-block__element--modifier.',
|
|
192
|
+
};
|
|
193
|
+
return JSON.stringify({
|
|
194
|
+
issue_type: issueType,
|
|
195
|
+
file,
|
|
196
|
+
line: line ?? 'unknown',
|
|
197
|
+
suggestion: suggestions[issueType] ?? 'Review docs/CODE_GUIDELINES.md for conventions.',
|
|
198
|
+
references: [
|
|
199
|
+
'docs/CODE_GUIDELINES.md',
|
|
200
|
+
'docs/TOKENS.md',
|
|
201
|
+
'docs/THEMING.md',
|
|
202
|
+
],
|
|
203
|
+
}, null, 2);
|
|
204
|
+
}
|
|
205
|
+
async function handleReadFile(input, rootDir) {
|
|
206
|
+
const path = input.path;
|
|
207
|
+
// Resolve relative to rootDir, but also allow absolute paths within the repo
|
|
208
|
+
const filePath = path.startsWith('/') ? path : resolve(rootDir, path);
|
|
209
|
+
// Safety: only allow reading within the repo
|
|
210
|
+
const resolvedRoot = resolve(rootDir);
|
|
211
|
+
if (!filePath.startsWith(resolvedRoot)) {
|
|
212
|
+
return JSON.stringify({ error: 'Path is outside the repository.' });
|
|
213
|
+
}
|
|
214
|
+
if (!existsSync(filePath)) {
|
|
215
|
+
return JSON.stringify({ error: `File not found: ${path}` });
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
const content = await readFile(filePath, 'utf-8');
|
|
219
|
+
// Truncate very large files
|
|
220
|
+
const maxChars = 15000;
|
|
221
|
+
const truncated = content.length > maxChars;
|
|
222
|
+
return JSON.stringify({
|
|
223
|
+
path,
|
|
224
|
+
content: truncated ? content.slice(0, maxChars) : content,
|
|
225
|
+
truncated,
|
|
226
|
+
totalLength: content.length,
|
|
227
|
+
}, null, 2);
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
return JSON.stringify({ error: `Failed to read: ${err instanceof Error ? err.message : String(err)}` });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
async function handleDesignSystemsTool(toolName, input) {
|
|
234
|
+
if (!designSystemsMcpHandler) {
|
|
235
|
+
return JSON.stringify({
|
|
236
|
+
error: 'Design systems MCP not connected. Results unavailable.',
|
|
237
|
+
fallback: 'Proceed using Eddie knowledge graph and code guidelines only.',
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
return await designSystemsMcpHandler(toolName, input);
|
|
242
|
+
}
|
|
243
|
+
catch (err) {
|
|
244
|
+
return JSON.stringify({
|
|
245
|
+
error: `Design systems tool failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
246
|
+
fallback: 'Proceed using Eddie knowledge graph and code guidelines only.',
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
// =============================================================================
|
|
251
|
+
// Tool Definitions for Anthropic API
|
|
252
|
+
// =============================================================================
|
|
253
|
+
const TOOL_DEFINITIONS = {
|
|
254
|
+
eddie_get_component: {
|
|
255
|
+
name: 'eddie_get_component',
|
|
256
|
+
description: 'Look up an Eddie component by name. Returns properties, slots, events, intent, guidelines.',
|
|
257
|
+
input_schema: {
|
|
258
|
+
type: 'object',
|
|
259
|
+
properties: {
|
|
260
|
+
name: { type: 'string', description: 'Component name (e.g. "button", "ed-button")' },
|
|
261
|
+
},
|
|
262
|
+
required: ['name'],
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
eddie_get_token: {
|
|
266
|
+
name: 'eddie_get_token',
|
|
267
|
+
description: 'Look up a design token. Returns value, tier, category, intent.',
|
|
268
|
+
input_schema: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
name: { type: 'string', description: 'Token name (e.g. "--ed-theme-color-background-default")' },
|
|
272
|
+
},
|
|
273
|
+
required: ['name'],
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
eddie_validate_file: {
|
|
277
|
+
name: 'eddie_validate_file',
|
|
278
|
+
description: 'Validate a file for token and naming violations. Run on .ts or .scss files.',
|
|
279
|
+
input_schema: {
|
|
280
|
+
type: 'object',
|
|
281
|
+
properties: {
|
|
282
|
+
path: { type: 'string', description: 'Path to the file to validate' },
|
|
283
|
+
},
|
|
284
|
+
required: ['path'],
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
eddie_check_health: {
|
|
288
|
+
name: 'eddie_check_health',
|
|
289
|
+
description: 'Run health scoring on the Eddie design system or a specific component.',
|
|
290
|
+
input_schema: {
|
|
291
|
+
type: 'object',
|
|
292
|
+
properties: {
|
|
293
|
+
component: { type: 'string', description: 'Optional: specific component to score (e.g. "ed-button")' },
|
|
294
|
+
},
|
|
295
|
+
required: [],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
eddie_compose_recipe: {
|
|
299
|
+
name: 'eddie_compose_recipe',
|
|
300
|
+
description: 'Find composition recipes for a UI intent. Returns which components to combine.',
|
|
301
|
+
input_schema: {
|
|
302
|
+
type: 'object',
|
|
303
|
+
properties: {
|
|
304
|
+
intent: { type: 'string', description: 'Natural language description of the UI pattern' },
|
|
305
|
+
},
|
|
306
|
+
required: ['intent'],
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
eddie_get_relationships: {
|
|
310
|
+
name: 'eddie_get_relationships',
|
|
311
|
+
description: 'Get composition recipes involving a specific component.',
|
|
312
|
+
input_schema: {
|
|
313
|
+
type: 'object',
|
|
314
|
+
properties: {
|
|
315
|
+
component: { type: 'string', description: 'Component name (e.g. "ed-button")' },
|
|
316
|
+
},
|
|
317
|
+
required: ['component'],
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
eddie_search: {
|
|
321
|
+
name: 'eddie_search',
|
|
322
|
+
description: 'Search across all Eddie components, tokens, and recipes.',
|
|
323
|
+
input_schema: {
|
|
324
|
+
type: 'object',
|
|
325
|
+
properties: {
|
|
326
|
+
query: { type: 'string', description: 'Search query (e.g. "form input", "accent color")' },
|
|
327
|
+
},
|
|
328
|
+
required: ['query'],
|
|
329
|
+
},
|
|
330
|
+
},
|
|
331
|
+
eddie_suggest_fix: {
|
|
332
|
+
name: 'eddie_suggest_fix',
|
|
333
|
+
description: 'Get a suggested fix for a validation issue.',
|
|
334
|
+
input_schema: {
|
|
335
|
+
type: 'object',
|
|
336
|
+
properties: {
|
|
337
|
+
issue_type: { type: 'string', description: 'Issue type (e.g. "token-raw-hex")' },
|
|
338
|
+
file: { type: 'string', description: 'File path' },
|
|
339
|
+
line: { type: 'number', description: 'Line number' },
|
|
340
|
+
},
|
|
341
|
+
required: ['issue_type', 'file'],
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
eddie_read_file: {
|
|
345
|
+
name: 'eddie_read_file',
|
|
346
|
+
description: 'Read the contents of a file in the Eddie monorepo. Use this to read existing component source code (.ts, .scss, .stories.ts), documentation (docs/*.md), or any other file. Paths are relative to the repo root.',
|
|
347
|
+
input_schema: {
|
|
348
|
+
type: 'object',
|
|
349
|
+
properties: {
|
|
350
|
+
path: { type: 'string', description: 'File path relative to repo root (e.g. "packages/eddie-web-components/components/badge/badge.ts", "docs/CODE_GUIDELINES.md")' },
|
|
351
|
+
},
|
|
352
|
+
required: ['path'],
|
|
353
|
+
},
|
|
354
|
+
},
|
|
355
|
+
ds_search_design_knowledge: {
|
|
356
|
+
name: 'ds_search_design_knowledge',
|
|
357
|
+
description: 'Search design system best practices from major design systems (Material, Spectrum, Carbon, Polaris, etc.). Use this to research how other design systems handle similar components, patterns, and conventions.',
|
|
358
|
+
input_schema: {
|
|
359
|
+
type: 'object',
|
|
360
|
+
properties: {
|
|
361
|
+
query: { type: 'string', description: 'Search query (e.g. "badge component best practices", "size variants")' },
|
|
362
|
+
category: { type: 'string', description: 'Optional category filter', enum: ['figma', 'tokens', 'components', 'documentation', 'workflow', 'governance', 'accessibility', 'tools', 'case-studies', 'foundations'] },
|
|
363
|
+
limit: { type: 'number', description: 'Max results (default 15)' },
|
|
364
|
+
},
|
|
365
|
+
required: ['query'],
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
ds_search_chunks: {
|
|
369
|
+
name: 'ds_search_chunks',
|
|
370
|
+
description: 'Search detailed content chunks from design system knowledge base for specific implementation guidance.',
|
|
371
|
+
input_schema: {
|
|
372
|
+
type: 'object',
|
|
373
|
+
properties: {
|
|
374
|
+
query: { type: 'string', description: 'Search query for specific design system content' },
|
|
375
|
+
limit: { type: 'number', description: 'Max chunks to return (default 8)' },
|
|
376
|
+
},
|
|
377
|
+
required: ['query'],
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
ds_browse_by_category: {
|
|
381
|
+
name: 'ds_browse_by_category',
|
|
382
|
+
description: 'Browse all design system knowledge entries in a category.',
|
|
383
|
+
input_schema: {
|
|
384
|
+
type: 'object',
|
|
385
|
+
properties: {
|
|
386
|
+
category: { type: 'string', description: 'Category to browse', enum: ['figma', 'tokens', 'components', 'documentation', 'workflow', 'governance', 'accessibility', 'tools', 'case-studies', 'foundations'] },
|
|
387
|
+
},
|
|
388
|
+
required: ['category'],
|
|
389
|
+
},
|
|
390
|
+
},
|
|
391
|
+
};
|
|
392
|
+
//# sourceMappingURL=tool-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-handler.js","sourceRoot":"","sources":["../../src/pipeline/tool-handler.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7C;;;GAGG;AACH,IAAI,uBAAuB,GAAmF,IAAI,CAAC;AAEnH,MAAM,UAAU,0BAA0B,CACxC,OAA8E;IAE9E,uBAAuB,GAAG,OAAO,CAAC;AACpC,CAAC;AASD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,QAAmB,EACnB,SAAkC,EAClC,cAA8B,EAC9B,OAAe;IAEf,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,qBAAqB;YACxB,OAAO,kBAAkB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAEvD,KAAK,iBAAiB;YACpB,OAAO,cAAc,CAAC,SAAS,E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AAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,2DAA2D;QACxE,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE;aAC7M;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline Types — Artifacts, agent configuration, and pipeline state
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract between the 8 agents in the component
|
|
5
|
+
* generation pipeline. Each agent consumes input artifacts and produces
|
|
6
|
+
* output artifacts, mediated by the orchestrator.
|
|
7
|
+
*/
|
|
8
|
+
import type { HealthIssue, LearningEntry } from '../types.js';
|
|
9
|
+
/** Names of structured artifacts that flow between agents */
|
|
10
|
+
export type ArtifactName = 'brief.md' | 'component-rules.md' | 'architecture.md' | 'component.ts' | 'component.scss' | 'component.stories.ts';
|
|
11
|
+
/** A single pipeline artifact */
|
|
12
|
+
export interface PipelineArtifact {
|
|
13
|
+
name: ArtifactName | string;
|
|
14
|
+
content: string;
|
|
15
|
+
/** Which agent produced this */
|
|
16
|
+
producedBy: AgentId;
|
|
17
|
+
/** When it was produced */
|
|
18
|
+
timestamp: string;
|
|
19
|
+
/** Version (incremented on each agent revision) */
|
|
20
|
+
version: number;
|
|
21
|
+
}
|
|
22
|
+
/** Agent identifiers matching the 8 pipeline agents */
|
|
23
|
+
export type AgentId = 'spec-analyst' | 'library-researcher' | 'component-architect' | 'code-writer' | 'accessibility-auditor' | 'story-author' | 'code-reviewer' | 'quality-gate';
|
|
24
|
+
/** Pipeline phase */
|
|
25
|
+
export type PipelinePhase = 'understand' | 'build' | 'verify';
|
|
26
|
+
/** Which eddie-brain tools an agent is allowed to call */
|
|
27
|
+
export type EddieTool = 'eddie_get_component' | 'eddie_get_token' | 'eddie_validate_file' | 'eddie_check_health' | 'eddie_compose_recipe' | 'eddie_get_relationships' | 'eddie_search' | 'eddie_suggest_fix' | 'eddie_read_file' | 'ds_search_design_knowledge' | 'ds_search_chunks' | 'ds_browse_by_category';
|
|
28
|
+
/** Static configuration for a single agent */
|
|
29
|
+
export interface AgentConfig {
|
|
30
|
+
id: AgentId;
|
|
31
|
+
name: string;
|
|
32
|
+
phase: PipelinePhase;
|
|
33
|
+
/** System prompt template. Uses {{artifactName}} for substitution. */
|
|
34
|
+
systemPrompt: string;
|
|
35
|
+
/** Which artifacts this agent reads */
|
|
36
|
+
inputArtifacts: Array<ArtifactName | string>;
|
|
37
|
+
/** Which artifacts this agent produces */
|
|
38
|
+
outputArtifacts: Array<ArtifactName | string>;
|
|
39
|
+
/** Which Eddie MCP tools this agent may call */
|
|
40
|
+
tools: EddieTool[];
|
|
41
|
+
/** Maximum iterations for this agent's fix loop */
|
|
42
|
+
maxIterations: number;
|
|
43
|
+
/** If true, pipeline pauses for human review after this agent */
|
|
44
|
+
hasConversationalGate: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Push-back severity from Agent 3's conversational gate */
|
|
47
|
+
export type PushBackLevel = 'BLOCKING' | 'OVERRIDE' | 'SUGGESTION';
|
|
48
|
+
/** A push-back item from the component architect */
|
|
49
|
+
export interface PushBackItem {
|
|
50
|
+
level: PushBackLevel;
|
|
51
|
+
category: string;
|
|
52
|
+
message: string;
|
|
53
|
+
/** What the architect recommends instead */
|
|
54
|
+
recommendation: string;
|
|
55
|
+
}
|
|
56
|
+
/** Record of a single iteration within an agent's fix loop */
|
|
57
|
+
export interface IterationRecord {
|
|
58
|
+
iteration: number;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
/** Health score or issue count at this iteration */
|
|
61
|
+
score: number;
|
|
62
|
+
/** Delta from previous iteration */
|
|
63
|
+
delta: number;
|
|
64
|
+
/** Issues found at this iteration */
|
|
65
|
+
issues: HealthIssue[];
|
|
66
|
+
/** Whether the agent stopped due to diminishing returns */
|
|
67
|
+
stoppedEarly: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Summary of an agent's iteration history */
|
|
70
|
+
export interface IterationSummary {
|
|
71
|
+
agentId: AgentId;
|
|
72
|
+
totalIterations: number;
|
|
73
|
+
maxIterations: number;
|
|
74
|
+
startScore: number;
|
|
75
|
+
endScore: number;
|
|
76
|
+
totalImprovement: number;
|
|
77
|
+
stoppedEarly: boolean;
|
|
78
|
+
records: IterationRecord[];
|
|
79
|
+
}
|
|
80
|
+
/** Status of a single agent run */
|
|
81
|
+
export type AgentStatus = 'pending' | 'running' | 'gated' | 'completed' | 'failed' | 'skipped';
|
|
82
|
+
/** Runtime state for one agent in the pipeline */
|
|
83
|
+
export interface AgentState {
|
|
84
|
+
agentId: AgentId;
|
|
85
|
+
status: AgentStatus;
|
|
86
|
+
startedAt: string | null;
|
|
87
|
+
completedAt: string | null;
|
|
88
|
+
iterations: IterationSummary | null;
|
|
89
|
+
pushBacks: PushBackItem[];
|
|
90
|
+
/** Any error that caused failure */
|
|
91
|
+
error: string | null;
|
|
92
|
+
}
|
|
93
|
+
/** Overall pipeline status */
|
|
94
|
+
export type PipelineStatus = 'idle' | 'running' | 'gated' | 'completed' | 'failed';
|
|
95
|
+
/** Full pipeline state, serializable to disk */
|
|
96
|
+
export interface PipelineState {
|
|
97
|
+
id: string;
|
|
98
|
+
status: PipelineStatus;
|
|
99
|
+
/** The original brief text */
|
|
100
|
+
brief: string;
|
|
101
|
+
/** Target component name (e.g., "ed-progress-bar") */
|
|
102
|
+
componentName: string;
|
|
103
|
+
/** Current phase */
|
|
104
|
+
currentPhase: PipelinePhase;
|
|
105
|
+
/** Current agent */
|
|
106
|
+
currentAgent: AgentId | null;
|
|
107
|
+
/** State per agent */
|
|
108
|
+
agents: Record<AgentId, AgentState>;
|
|
109
|
+
/** All artifacts produced so far */
|
|
110
|
+
artifacts: Record<string, PipelineArtifact>;
|
|
111
|
+
/** Timestamps */
|
|
112
|
+
startedAt: string;
|
|
113
|
+
completedAt: string | null;
|
|
114
|
+
/** Learning entries to record at the end */
|
|
115
|
+
learnings: LearningEntry[];
|
|
116
|
+
}
|
|
117
|
+
/** Configuration for running a pipeline */
|
|
118
|
+
export interface PipelineConfig {
|
|
119
|
+
/** Anthropic API key */
|
|
120
|
+
apiKey: string;
|
|
121
|
+
/** Model to use */
|
|
122
|
+
model: string;
|
|
123
|
+
/** Path to Eddie monorepo root */
|
|
124
|
+
rootDir: string;
|
|
125
|
+
/** Where to write output files */
|
|
126
|
+
outputDir: string;
|
|
127
|
+
/** Whether to pause at conversational gates */
|
|
128
|
+
interactive: boolean;
|
|
129
|
+
/** Override iteration budgets per agent */
|
|
130
|
+
iterationBudgets?: Partial<Record<AgentId, number>>;
|
|
131
|
+
/** Minimum improvement percentage to continue iterating (default: 2) */
|
|
132
|
+
diminishingReturnsThreshold: number;
|
|
133
|
+
}
|
|
134
|
+
/** Default pipeline config (API key must be provided) */
|
|
135
|
+
export declare const DEFAULT_PIPELINE_CONFIG: Omit<PipelineConfig, 'apiKey'>;
|
|
136
|
+
/** Result of running a single agent */
|
|
137
|
+
export interface AgentRunResult {
|
|
138
|
+
artifacts: PipelineArtifact[];
|
|
139
|
+
iterations: IterationRecord[];
|
|
140
|
+
toolCallCount: number;
|
|
141
|
+
pushBacks: PushBackItem[];
|
|
142
|
+
error: string | null;
|
|
143
|
+
}
|
|
144
|
+
/** The ordered sequence of agents in the pipeline */
|
|
145
|
+
export declare const PIPELINE_AGENT_ORDER: AgentId[];
|
|
146
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,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O,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,wEAAwE;IACxE,2BAA2B,EAAE,MAAM,CAAC;CACrC;AAED,yDAAyD;AACzD,eAAO,MAAM,uBAAuB,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,CAMlE,CAAC;AAMF,uCAAuC;AACvC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,qDAAqD;AACrD,eAAO,MAAM,oBAAoB,EAAE,OAAO,EASzC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline Types — Artifacts, agent configuration, and pipeline state
|
|
3
|
+
*
|
|
4
|
+
* These types define the contract between the 8 agents in the component
|
|
5
|
+
* generation pipeline. Each agent consumes input artifacts and produces
|
|
6
|
+
* output artifacts, mediated by the orchestrator.
|
|
7
|
+
*/
|
|
8
|
+
/** Default pipeline config (API key must be provided) */
|
|
9
|
+
export const DEFAULT_PIPELINE_CONFIG = {
|
|
10
|
+
model: 'claude-sonnet-4-20250514',
|
|
11
|
+
rootDir: '.',
|
|
12
|
+
outputDir: './pipeline-output',
|
|
13
|
+
interactive: true,
|
|
14
|
+
diminishingReturnsThreshold: 2,
|
|
15
|
+
};
|
|
16
|
+
/** The ordered sequence of agents in the pipeline */
|
|
17
|
+
export const PIPELINE_AGENT_ORDER = [
|
|
18
|
+
'spec-analyst',
|
|
19
|
+
'library-researcher',
|
|
20
|
+
'component-architect',
|
|
21
|
+
'code-writer',
|
|
22
|
+
'accessibility-auditor',
|
|
23
|
+
'story-author',
|
|
24
|
+
'code-reviewer',
|
|
25
|
+
'quality-gate',
|
|
26
|
+
];
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkMH,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAmC;IACrE,KAAK,EAAE,0BAA0B;IACjC,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,mBAAmB;IAC9B,WAAW,EAAE,IAAI;IACjB,2BAA2B,EAAE,CAAC;CAC/B,CAAC;AAeF,qDAAqD;AACrD,MAAM,CAAC,MAAM,oBAAoB,GAAc;IAC7C,cAAc;IACd,oBAAoB;IACpB,qBAAqB;IACrB,aAAa;IACb,uBAAuB;IACvB,cAAc;IACd,eAAe;IACf,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Type Utilities — Constants and helpers for action planning
|
|
3
|
+
*/
|
|
4
|
+
import { PlannedAction, RiskLevel } from '../types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Map signal types to their default risk levels
|
|
7
|
+
*/
|
|
8
|
+
export declare const ACTION_RISK_MAP: Record<string, RiskLevel>;
|
|
9
|
+
/**
|
|
10
|
+
* Get default risk level for a signal type
|
|
11
|
+
*/
|
|
12
|
+
export declare function getDefaultRiskForSignal(signalType: string): RiskLevel;
|
|
13
|
+
/**
|
|
14
|
+
* Generate human-readable description of a planned action
|
|
15
|
+
*/
|
|
16
|
+
export declare function describeAction(action: PlannedAction): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if an action can be automatically executed without human approval
|
|
19
|
+
*
|
|
20
|
+
* Auto-executable actions:
|
|
21
|
+
* - suggest: no, needs review
|
|
22
|
+
* - notify: yes, just information
|
|
23
|
+
* - draft_pr: no, needs review
|
|
24
|
+
* - create_pr: no, needs review
|
|
25
|
+
* - auto_fix: yes, but recorded
|
|
26
|
+
* - auto_merge: yes, but recorded
|
|
27
|
+
* - update_docs: yes, but recorded
|
|
28
|
+
* - escalate: no, by definition requires human
|
|
29
|
+
*/
|
|
30
|
+
export declare function canAutoExecute(action: PlannedAction): boolean;
|
|
31
|
+
//# sourceMappingURL=action-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["../../src/plan/action-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAc,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAWrD,CAAC;AAEF;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAErE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAgC5D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAqB7D"}
|