@agentbrain/mcp-server 1.4.74 → 1.4.76
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/index.js +52 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/load-blueprint.d.ts +19 -0
- package/dist/tools/load-blueprint.d.ts.map +1 -0
- package/dist/tools/load-blueprint.js +152 -0
- package/dist/tools/load-blueprint.js.map +1 -0
- package/dist/tools/load-decisions.d.ts +19 -0
- package/dist/tools/load-decisions.d.ts.map +1 -0
- package/dist/tools/load-decisions.js +138 -0
- package/dist/tools/load-decisions.js.map +1 -0
- package/dist/tools/load-guardrails.d.ts +19 -0
- package/dist/tools/load-guardrails.d.ts.map +1 -0
- package/dist/tools/load-guardrails.js +149 -0
- package/dist/tools/load-guardrails.js.map +1 -0
- package/dist/tools/load-standards.d.ts.map +1 -1
- package/dist/tools/load-standards.js +135 -4
- package/dist/tools/load-standards.js.map +1 -1
- package/dist/tools/preflight-check.d.ts +24 -0
- package/dist/tools/preflight-check.d.ts.map +1 -0
- package/dist/tools/preflight-check.js +279 -0
- package/dist/tools/preflight-check.js.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,6 +13,10 @@ import { setupRepo, setupRepoSchema } from './tools/setup-repo.js';
|
|
|
13
13
|
import { saveContext, saveContextSchema } from './tools/save-context.js';
|
|
14
14
|
import { saveError, saveErrorSchema } from './tools/save-error.js';
|
|
15
15
|
import { generateContext, generateContextSchema } from './tools/generate-context.js';
|
|
16
|
+
import { loadBlueprint, loadBlueprintSchema } from './tools/load-blueprint.js';
|
|
17
|
+
import { loadGuardrails, loadGuardrailsSchema } from './tools/load-guardrails.js';
|
|
18
|
+
import { loadDecisions, loadDecisionsSchema } from './tools/load-decisions.js';
|
|
19
|
+
import { preflightCheck, preflightCheckSchema } from './tools/preflight-check.js';
|
|
16
20
|
import { existsSync } from 'node:fs';
|
|
17
21
|
import { join, resolve } from 'node:path';
|
|
18
22
|
import { homedir } from 'node:os';
|
|
@@ -60,6 +64,10 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
60
64
|
detectDoomLoopSchema,
|
|
61
65
|
saveHandoffSchema,
|
|
62
66
|
generateContextSchema,
|
|
67
|
+
loadBlueprintSchema,
|
|
68
|
+
loadGuardrailsSchema,
|
|
69
|
+
loadDecisionsSchema,
|
|
70
|
+
preflightCheckSchema,
|
|
63
71
|
],
|
|
64
72
|
};
|
|
65
73
|
});
|
|
@@ -230,6 +238,50 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
230
238
|
],
|
|
231
239
|
};
|
|
232
240
|
}
|
|
241
|
+
case 'load_blueprint': {
|
|
242
|
+
const result = await loadBlueprint(args);
|
|
243
|
+
return {
|
|
244
|
+
content: [
|
|
245
|
+
{
|
|
246
|
+
type: 'text',
|
|
247
|
+
text: result,
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
case 'load_guardrails': {
|
|
253
|
+
const result = await loadGuardrails(args);
|
|
254
|
+
return {
|
|
255
|
+
content: [
|
|
256
|
+
{
|
|
257
|
+
type: 'text',
|
|
258
|
+
text: result,
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
case 'load_decisions': {
|
|
264
|
+
const result = await loadDecisions(args);
|
|
265
|
+
return {
|
|
266
|
+
content: [
|
|
267
|
+
{
|
|
268
|
+
type: 'text',
|
|
269
|
+
text: result,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
case 'preflight_check': {
|
|
275
|
+
const result = await preflightCheck(args);
|
|
276
|
+
return {
|
|
277
|
+
content: [
|
|
278
|
+
{
|
|
279
|
+
type: 'text',
|
|
280
|
+
text: result,
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
};
|
|
284
|
+
}
|
|
233
285
|
default:
|
|
234
286
|
throw new Error(`Unknown tool: ${name}`);
|
|
235
287
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,wBAAwB;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE/D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAE9E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEnE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElF,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAElE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAElE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,wBAAwB;AAExB,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CA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,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LoadBlueprintInput {
|
|
2
|
+
repo_path: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const loadBlueprintSchema: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
repo_path: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function loadBlueprint(input: LoadBlueprintInput): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=load-blueprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-blueprint.d.ts","sourceRoot":"","sources":["../../src/tools/load-blueprint.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;CAClB;AAqCD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAc/B,CAAA;AA+ED,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkD9E"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// MCP tool: load_blueprint - Load workspace Blueprint from cloud
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
// ══════════════════════════════════════════════════════════════
|
|
5
|
+
// Environment & Configuration
|
|
6
|
+
// ══════════════════════════════════════════════════════════════
|
|
7
|
+
const BASE_URL = process.env.AGENTBRAIN_API_BASE_URL?.replace(/\/$/, '') ?? 'https://www.useagentbrain.com/api/v1';
|
|
8
|
+
const BLUEPRINT_URL = `${BASE_URL}/blueprint`;
|
|
9
|
+
/**
|
|
10
|
+
* Expand path: handles ~, relative paths, etc.
|
|
11
|
+
*/
|
|
12
|
+
function expandPath(path) {
|
|
13
|
+
if (path.startsWith('~/') || path === '~') {
|
|
14
|
+
return path.replace('~', homedir());
|
|
15
|
+
}
|
|
16
|
+
if (!path.startsWith('/')) {
|
|
17
|
+
return join(process.cwd(), path);
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
// ══════════════════════════════════════════════════════════════
|
|
22
|
+
// Schema
|
|
23
|
+
// ══════════════════════════════════════════════════════════════
|
|
24
|
+
export const loadBlueprintSchema = {
|
|
25
|
+
name: 'load_blueprint',
|
|
26
|
+
description: 'Load workspace Blueprint — architectural patterns, folder conventions, golden path examples, and forbidden patterns. Load at session start alongside load_context().',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
repo_path: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Absolute path to repository',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['repo_path'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// ══════════════════════════════════════════════════════════════
|
|
39
|
+
// Formatting
|
|
40
|
+
// ══════════════════════════════════════════════════════════════
|
|
41
|
+
function formatBlueprint(content) {
|
|
42
|
+
const workspaceName = content.workspace_name || 'Workspace';
|
|
43
|
+
let output = `# Blueprint — ${workspaceName}\n\n`;
|
|
44
|
+
// Folder Conventions
|
|
45
|
+
if (content.folder_conventions) {
|
|
46
|
+
const fc = content.folder_conventions;
|
|
47
|
+
if (fc.business_logic || fc.new_features || fc.shared_utilities) {
|
|
48
|
+
output += '## Folder Conventions\n';
|
|
49
|
+
if (fc.business_logic)
|
|
50
|
+
output += `Business logic: ${fc.business_logic}\n`;
|
|
51
|
+
if (fc.new_features)
|
|
52
|
+
output += `New features: ${fc.new_features}\n`;
|
|
53
|
+
if (fc.shared_utilities)
|
|
54
|
+
output += `Shared utilities: ${fc.shared_utilities}\n`;
|
|
55
|
+
output += '\n';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Preferred Patterns
|
|
59
|
+
if (content.preferred_patterns) {
|
|
60
|
+
const pp = content.preferred_patterns;
|
|
61
|
+
if (pp.state_management || pp.data_fetching || pp.auth || pp.error_handling) {
|
|
62
|
+
output += '## Preferred Patterns\n';
|
|
63
|
+
if (pp.state_management)
|
|
64
|
+
output += `State management: ${pp.state_management}\n`;
|
|
65
|
+
if (pp.data_fetching)
|
|
66
|
+
output += `Data fetching: ${pp.data_fetching}\n`;
|
|
67
|
+
if (pp.auth)
|
|
68
|
+
output += `Auth: ${pp.auth}\n`;
|
|
69
|
+
if (pp.error_handling)
|
|
70
|
+
output += `Error handling: ${pp.error_handling}\n`;
|
|
71
|
+
output += '\n';
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Golden Path Examples
|
|
75
|
+
if (content.golden_path_examples && content.golden_path_examples.length > 0) {
|
|
76
|
+
output += '## Golden Path Examples\n';
|
|
77
|
+
for (const example of content.golden_path_examples) {
|
|
78
|
+
output += `- ${example.label}: ${example.path}\n`;
|
|
79
|
+
}
|
|
80
|
+
output += '\n';
|
|
81
|
+
}
|
|
82
|
+
// Forbidden Patterns
|
|
83
|
+
if (content.forbidden_patterns && content.forbidden_patterns.length > 0) {
|
|
84
|
+
output += '## Forbidden Patterns\n';
|
|
85
|
+
for (const pattern of content.forbidden_patterns) {
|
|
86
|
+
output += `- ${pattern.pattern}: ${pattern.reason}\n`;
|
|
87
|
+
}
|
|
88
|
+
output += '\n';
|
|
89
|
+
}
|
|
90
|
+
// Architecture Notes
|
|
91
|
+
if (content.architecture_notes) {
|
|
92
|
+
output += '## Architecture Notes\n';
|
|
93
|
+
output += `${content.architecture_notes}\n`;
|
|
94
|
+
}
|
|
95
|
+
return output;
|
|
96
|
+
}
|
|
97
|
+
function isContentEmpty(content) {
|
|
98
|
+
const fc = content.folder_conventions;
|
|
99
|
+
const pp = content.preferred_patterns;
|
|
100
|
+
const hasFolderConventions = fc && (fc.business_logic || fc.new_features || fc.shared_utilities);
|
|
101
|
+
const hasPreferredPatterns = pp && (pp.state_management || pp.data_fetching || pp.auth || pp.error_handling);
|
|
102
|
+
const hasGoldenPaths = content.golden_path_examples && content.golden_path_examples.length > 0;
|
|
103
|
+
const hasForbiddenPatterns = content.forbidden_patterns && content.forbidden_patterns.length > 0;
|
|
104
|
+
const hasNotes = !!content.architecture_notes;
|
|
105
|
+
return !(hasFolderConventions || hasPreferredPatterns || hasGoldenPaths || hasForbiddenPatterns || hasNotes);
|
|
106
|
+
}
|
|
107
|
+
// ══════════════════════════════════════════════════════════════
|
|
108
|
+
// Main Tool Function
|
|
109
|
+
// ══════════════════════════════════════════════════════════════
|
|
110
|
+
export async function loadBlueprint(input) {
|
|
111
|
+
const apiKey = process.env.AGENTBRAIN_API_KEY;
|
|
112
|
+
if (!apiKey) {
|
|
113
|
+
return `Blueprint requires an API key.
|
|
114
|
+
Add AGENTBRAIN_API_KEY to your MCP config env block.
|
|
115
|
+
Get your key at useagentbrain.com/settings`;
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const res = await fetch(BLUEPRINT_URL, {
|
|
119
|
+
method: 'GET',
|
|
120
|
+
headers: {
|
|
121
|
+
'x-api-key': apiKey,
|
|
122
|
+
'Content-Type': 'application/json',
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
if (res.status === 401) {
|
|
126
|
+
return 'Invalid AGENTBRAIN_API_KEY. Check your MCP config env block.';
|
|
127
|
+
}
|
|
128
|
+
if (res.status === 404) {
|
|
129
|
+
return `No Blueprint found for this workspace.
|
|
130
|
+
Create one at useagentbrain.com/settings → Blueprint tab.`;
|
|
131
|
+
}
|
|
132
|
+
if (!res.ok) {
|
|
133
|
+
const json = (await res.json());
|
|
134
|
+
return json.error ?? 'Failed to load Blueprint from AgentBrain.';
|
|
135
|
+
}
|
|
136
|
+
const json = (await res.json());
|
|
137
|
+
if (!json.data) {
|
|
138
|
+
return `No Blueprint found for this workspace.
|
|
139
|
+
Create one at useagentbrain.com/settings → Blueprint tab.`;
|
|
140
|
+
}
|
|
141
|
+
const content = json.data.content;
|
|
142
|
+
if (isContentEmpty(content)) {
|
|
143
|
+
return `Blueprint exists but has no content yet.
|
|
144
|
+
Fill it out at useagentbrain.com/settings → Blueprint tab.`;
|
|
145
|
+
}
|
|
146
|
+
return formatBlueprint(content);
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
return err instanceof Error ? err.message : 'Failed to load Blueprint.';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=load-blueprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-blueprint.js","sourceRoot":"","sources":["../../src/tools/load-blueprint.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,iEAAiE;AACjE,8BAA8B;AAC9B,iEAAiE;AAEjE,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,sCAAsC,CAAA;AAEnG,MAAM,aAAa,GAAG,GAAG,QAAQ,YAAY,CAAA;AAE7C;;GAEG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IACrC,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1B,OA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|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
repo_path: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function loadDecisions(input: LoadDecisionsInput): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=load-decisions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-decisions.d.ts","sourceRoot":"","sources":["../../src/tools/load-decisions.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;CAClB;AA+BD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;CAc/B,CAAA;AAuED,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkD9E"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// MCP tool: load_decisions - Load workspace Decisions from cloud
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
// ══════════════════════════════════════════════════════════════
|
|
5
|
+
// Environment & Configuration
|
|
6
|
+
// ══════════════════════════════════════════════════════════════
|
|
7
|
+
const BASE_URL = process.env.AGENTBRAIN_API_BASE_URL?.replace(/\/$/, '') ?? 'https://www.useagentbrain.com/api/v1';
|
|
8
|
+
const DECISIONS_URL = `${BASE_URL}/decisions`;
|
|
9
|
+
/**
|
|
10
|
+
* Expand path: handles ~, relative paths, etc.
|
|
11
|
+
*/
|
|
12
|
+
function expandPath(path) {
|
|
13
|
+
if (path.startsWith('~/') || path === '~') {
|
|
14
|
+
return path.replace('~', homedir());
|
|
15
|
+
}
|
|
16
|
+
if (!path.startsWith('/')) {
|
|
17
|
+
return join(process.cwd(), path);
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
// ══════════════════════════════════════════════════════════════
|
|
22
|
+
// Schema
|
|
23
|
+
// ══════════════════════════════════════════════════════════════
|
|
24
|
+
export const loadDecisionsSchema = {
|
|
25
|
+
name: 'load_decisions',
|
|
26
|
+
description: 'Load workspace Decisions — why tech choices were made, rejected alternatives, and non-obvious code decisions. Load before any refactor or architectural change.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
repo_path: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Absolute path to repository',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['repo_path'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// ══════════════════════════════════════════════════════════════
|
|
39
|
+
// Formatting
|
|
40
|
+
// ══════════════════════════════════════════════════════════════
|
|
41
|
+
function formatDecisions(content) {
|
|
42
|
+
const workspaceName = content.workspace_name || 'Workspace';
|
|
43
|
+
let output = `# Decisions — ${workspaceName}\n\n`;
|
|
44
|
+
// Tech Decisions
|
|
45
|
+
if (content.tech_decisions && content.tech_decisions.length > 0) {
|
|
46
|
+
output += '## Tech Decisions\n';
|
|
47
|
+
for (const decision of content.tech_decisions) {
|
|
48
|
+
output += `- ${decision.technology}: ${decision.reason}\n`;
|
|
49
|
+
}
|
|
50
|
+
output += '\n';
|
|
51
|
+
}
|
|
52
|
+
// Rejected Alternatives
|
|
53
|
+
if (content.rejected_alternatives && content.rejected_alternatives.length > 0) {
|
|
54
|
+
output += '## Rejected Alternatives\n';
|
|
55
|
+
output += '⛔ Do not suggest these — already tried:\n';
|
|
56
|
+
for (const alternative of content.rejected_alternatives) {
|
|
57
|
+
output += `- ${alternative.what_was_tried}: ${alternative.why_rejected}\n`;
|
|
58
|
+
}
|
|
59
|
+
output += '\n';
|
|
60
|
+
}
|
|
61
|
+
// Non-Obvious Code Decisions
|
|
62
|
+
if (content.code_decisions && content.code_decisions.length > 0) {
|
|
63
|
+
output += '## Non-Obvious Code Decisions\n';
|
|
64
|
+
for (const decision of content.code_decisions) {
|
|
65
|
+
output += `- ${decision.file_path}:\n ${decision.explanation}\n`;
|
|
66
|
+
}
|
|
67
|
+
output += '\n';
|
|
68
|
+
}
|
|
69
|
+
// Source of Truth Priority
|
|
70
|
+
if (content.source_of_truth_priority || content.conflict_resolution_rule) {
|
|
71
|
+
output += '## Source of Truth Priority\n';
|
|
72
|
+
if (content.source_of_truth_priority && content.source_of_truth_priority.length > 0) {
|
|
73
|
+
output += 'When docs conflict, use this order:\n';
|
|
74
|
+
content.source_of_truth_priority.forEach((source, index) => {
|
|
75
|
+
output += `${index + 1}. ${source}\n`;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (content.conflict_resolution_rule) {
|
|
79
|
+
output += `When conflict found: ${content.conflict_resolution_rule}\n`;
|
|
80
|
+
}
|
|
81
|
+
output += '\n';
|
|
82
|
+
}
|
|
83
|
+
return output;
|
|
84
|
+
}
|
|
85
|
+
function isContentEmpty(content) {
|
|
86
|
+
const hasTechDecisions = content.tech_decisions && content.tech_decisions.length > 0;
|
|
87
|
+
const hasRejectedAlternatives = content.rejected_alternatives && content.rejected_alternatives.length > 0;
|
|
88
|
+
const hasCodeDecisions = content.code_decisions && content.code_decisions.length > 0;
|
|
89
|
+
const hasSourceOfTruth = (content.source_of_truth_priority && content.source_of_truth_priority.length > 0) ||
|
|
90
|
+
!!content.conflict_resolution_rule;
|
|
91
|
+
return !(hasTechDecisions || hasRejectedAlternatives || hasCodeDecisions || hasSourceOfTruth);
|
|
92
|
+
}
|
|
93
|
+
// ══════════════════════════════════════════════════════════════
|
|
94
|
+
// Main Tool Function
|
|
95
|
+
// ══════════════════════════════════════════════════════════════
|
|
96
|
+
export async function loadDecisions(input) {
|
|
97
|
+
const apiKey = process.env.AGENTBRAIN_API_KEY;
|
|
98
|
+
if (!apiKey) {
|
|
99
|
+
return `Decisions requires an API key.
|
|
100
|
+
Add AGENTBRAIN_API_KEY to your MCP config env block.
|
|
101
|
+
Get your key at useagentbrain.com/settings`;
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const res = await fetch(DECISIONS_URL, {
|
|
105
|
+
method: 'GET',
|
|
106
|
+
headers: {
|
|
107
|
+
'x-api-key': apiKey,
|
|
108
|
+
'Content-Type': 'application/json',
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
if (res.status === 401) {
|
|
112
|
+
return 'Invalid AGENTBRAIN_API_KEY. Check your MCP config env block.';
|
|
113
|
+
}
|
|
114
|
+
if (res.status === 404) {
|
|
115
|
+
return `No Decisions found for this workspace.
|
|
116
|
+
Create one at useagentbrain.com/settings → Decisions tab.`;
|
|
117
|
+
}
|
|
118
|
+
if (!res.ok) {
|
|
119
|
+
const json = (await res.json());
|
|
120
|
+
return json.error ?? 'Failed to load Decisions from AgentBrain.';
|
|
121
|
+
}
|
|
122
|
+
const json = (await res.json());
|
|
123
|
+
if (!json.data) {
|
|
124
|
+
return `No Decisions found for this workspace.
|
|
125
|
+
Create one at useagentbrain.com/settings → Decisions tab.`;
|
|
126
|
+
}
|
|
127
|
+
const content = json.data.content;
|
|
128
|
+
if (isContentEmpty(content)) {
|
|
129
|
+
return `Decisions exists but has no content yet.
|
|
130
|
+
Fill it out at useagentbrain.com/settings → Decisions tab.`;
|
|
131
|
+
}
|
|
132
|
+
return formatDecisions(content);
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
return err instanceof Error ? err.message : 'Failed to load Decisions.';
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=load-decisions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-decisions.js","sourceRoot":"","sources":["../../src/tools/load-decisions.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE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ACrC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,WAAW,EAAE,MAAM;gBACnB,cAAc,EAAE,kBAAkB;aACnC;SACF,CAAC,CAAA;QAEF,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO,8DAA8D,CAAA;QACvE,CAAC;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YACvB,OAAO;0DAC6C,CAAA;QACtD,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAA;YAC9C,OAAO,IAAI,CAAC,KAAK,IAAI,2CAA2C,CAAA;QAClE,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAA;QAE9C,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;0DAC6C,CAAA;QACtD,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAEjC,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO;2DAC8C,CAAA;QACvD,CAAC;QAED,OAAO,eAAe,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,2BAA2B,CAAA;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LoadGuardrailsInput {
|
|
2
|
+
repo_path: string;
|
|
3
|
+
}
|
|
4
|
+
export declare const loadGuardrailsSchema: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
repo_path: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare function loadGuardrails(input: LoadGuardrailsInput): Promise<string>;
|
|
19
|
+
//# sourceMappingURL=load-guardrails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-guardrails.d.ts","sourceRoot":"","sources":["../../src/tools/load-guardrails.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;CAClB;AAkCD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;CAchC,CAAA;AAkFD,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkDhF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// MCP tool: load_guardrails - Load workspace Guardrails from cloud
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
// ══════════════════════════════════════════════════════════════
|
|
5
|
+
// Environment & Configuration
|
|
6
|
+
// ══════════════════════════════════════════════════════════════
|
|
7
|
+
const BASE_URL = process.env.AGENTBRAIN_API_BASE_URL?.replace(/\/$/, '') ?? 'https://www.useagentbrain.com/api/v1';
|
|
8
|
+
const GUARDRAILS_URL = `${BASE_URL}/guardrails`;
|
|
9
|
+
/**
|
|
10
|
+
* Expand path: handles ~, relative paths, etc.
|
|
11
|
+
*/
|
|
12
|
+
function expandPath(path) {
|
|
13
|
+
if (path.startsWith('~/') || path === '~') {
|
|
14
|
+
return path.replace('~', homedir());
|
|
15
|
+
}
|
|
16
|
+
if (!path.startsWith('/')) {
|
|
17
|
+
return join(process.cwd(), path);
|
|
18
|
+
}
|
|
19
|
+
return path;
|
|
20
|
+
}
|
|
21
|
+
// ══════════════════════════════════════════════════════════════
|
|
22
|
+
// Schema
|
|
23
|
+
// ══════════════════════════════════════════════════════════════
|
|
24
|
+
export const loadGuardrailsSchema = {
|
|
25
|
+
name: 'load_guardrails',
|
|
26
|
+
description: 'Load workspace Guardrails — protected files, sensitive data rules, team boundaries, and invariants. Load before any file modification.',
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
repo_path: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Absolute path to repository',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['repo_path'],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
// ══════════════════════════════════════════════════════════════
|
|
39
|
+
// Formatting
|
|
40
|
+
// ══════════════════════════════════════════════════════════════
|
|
41
|
+
function formatGuardrails(content) {
|
|
42
|
+
const workspaceName = content.workspace_name || 'Workspace';
|
|
43
|
+
let output = `# Guardrails — ${workspaceName}\n\n`;
|
|
44
|
+
// Protected Files
|
|
45
|
+
if (content.protected_files && content.protected_files.length > 0) {
|
|
46
|
+
output += '## Protected Files\n';
|
|
47
|
+
output += '⚠️ Never modify these files:\n';
|
|
48
|
+
for (const file of content.protected_files) {
|
|
49
|
+
output += `- ${file.path}: ${file.reason}\n`;
|
|
50
|
+
}
|
|
51
|
+
output += '\n';
|
|
52
|
+
}
|
|
53
|
+
// Sensitive Data
|
|
54
|
+
if (content.sensitive_data && content.sensitive_data.length > 0) {
|
|
55
|
+
output += '## Sensitive Data\n';
|
|
56
|
+
output += '🔒 Never log or expose these fields:\n';
|
|
57
|
+
for (const data of content.sensitive_data) {
|
|
58
|
+
output += `- ${data.field}: ${data.rule}\n`;
|
|
59
|
+
}
|
|
60
|
+
output += '\n';
|
|
61
|
+
}
|
|
62
|
+
// Team Boundaries
|
|
63
|
+
if (content.team_boundaries && content.team_boundaries.length > 0) {
|
|
64
|
+
output += '## Team Boundaries\n';
|
|
65
|
+
output += '👥 Requires approval before changes:\n';
|
|
66
|
+
for (const boundary of content.team_boundaries) {
|
|
67
|
+
output += `- ${boundary.path} → ${boundary.owner}: ${boundary.rule}\n`;
|
|
68
|
+
}
|
|
69
|
+
output += '\n';
|
|
70
|
+
}
|
|
71
|
+
// Invariants
|
|
72
|
+
if (content.invariants && content.invariants.length > 0) {
|
|
73
|
+
output += '## Invariants\n';
|
|
74
|
+
output += '🔴 Must always be true:\n';
|
|
75
|
+
for (const invariant of content.invariants) {
|
|
76
|
+
output += `- ${invariant}\n`;
|
|
77
|
+
}
|
|
78
|
+
output += '\n';
|
|
79
|
+
}
|
|
80
|
+
// Refactor Rules
|
|
81
|
+
if (content.refactor_scope || content.ask_before_refactoring !== undefined || content.refactor_notes) {
|
|
82
|
+
output += '## Refactor Rules\n';
|
|
83
|
+
if (content.refactor_scope) {
|
|
84
|
+
output += `Scope: ${content.refactor_scope}\n`;
|
|
85
|
+
}
|
|
86
|
+
if (content.ask_before_refactoring !== undefined) {
|
|
87
|
+
output += `Ask before refactoring outside scope: ${content.ask_before_refactoring ? 'yes' : 'no'}\n`;
|
|
88
|
+
}
|
|
89
|
+
if (content.refactor_notes) {
|
|
90
|
+
output += `${content.refactor_notes}\n`;
|
|
91
|
+
}
|
|
92
|
+
output += '\n';
|
|
93
|
+
}
|
|
94
|
+
return output;
|
|
95
|
+
}
|
|
96
|
+
function isContentEmpty(content) {
|
|
97
|
+
const hasProtectedFiles = content.protected_files && content.protected_files.length > 0;
|
|
98
|
+
const hasSensitiveData = content.sensitive_data && content.sensitive_data.length > 0;
|
|
99
|
+
const hasTeamBoundaries = content.team_boundaries && content.team_boundaries.length > 0;
|
|
100
|
+
const hasInvariants = content.invariants && content.invariants.length > 0;
|
|
101
|
+
const hasRefactorRules = !!(content.refactor_scope || content.ask_before_refactoring !== undefined || content.refactor_notes);
|
|
102
|
+
return !(hasProtectedFiles || hasSensitiveData || hasTeamBoundaries || hasInvariants || hasRefactorRules);
|
|
103
|
+
}
|
|
104
|
+
// ══════════════════════════════════════════════════════════════
|
|
105
|
+
// Main Tool Function
|
|
106
|
+
// ══════════════════════════════════════════════════════════════
|
|
107
|
+
export async function loadGuardrails(input) {
|
|
108
|
+
const apiKey = process.env.AGENTBRAIN_API_KEY;
|
|
109
|
+
if (!apiKey) {
|
|
110
|
+
return `Guardrails requires an API key.
|
|
111
|
+
Add AGENTBRAIN_API_KEY to your MCP config env block.
|
|
112
|
+
Get your key at useagentbrain.com/settings`;
|
|
113
|
+
}
|
|
114
|
+
try {
|
|
115
|
+
const res = await fetch(GUARDRAILS_URL, {
|
|
116
|
+
method: 'GET',
|
|
117
|
+
headers: {
|
|
118
|
+
'x-api-key': apiKey,
|
|
119
|
+
'Content-Type': 'application/json',
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
if (res.status === 401) {
|
|
123
|
+
return 'Invalid AGENTBRAIN_API_KEY. Check your MCP config env block.';
|
|
124
|
+
}
|
|
125
|
+
if (res.status === 404) {
|
|
126
|
+
return `No Guardrails found for this workspace.
|
|
127
|
+
Create one at useagentbrain.com/settings → Guardrails tab.`;
|
|
128
|
+
}
|
|
129
|
+
if (!res.ok) {
|
|
130
|
+
const json = (await res.json());
|
|
131
|
+
return json.error ?? 'Failed to load Guardrails from AgentBrain.';
|
|
132
|
+
}
|
|
133
|
+
const json = (await res.json());
|
|
134
|
+
if (!json.data) {
|
|
135
|
+
return `No Guardrails found for this workspace.
|
|
136
|
+
Create one at useagentbrain.com/settings → Guardrails tab.`;
|
|
137
|
+
}
|
|
138
|
+
const content = json.data.content;
|
|
139
|
+
if (isContentEmpty(content)) {
|
|
140
|
+
return `Guardrails exists but has no content yet.
|
|
141
|
+
Fill it out at useagentbrain.com/settings → Guardrails tab.`;
|
|
142
|
+
}
|
|
143
|
+
return formatGuardrails(content);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
return err instanceof Error ? err.message : 'Failed to load Guardrails.';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=load-guardrails.js.map
|
|
@@ -0,0 +1 @@
|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AI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,OAAO;2DAC8C,CAAA;QACvD,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAA;QAEjC,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO;4DAC+C,CAAA;QACxD,CAAC;QAED,OAAO,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,4BAA4B,CAAA;IAC1E,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-standards.d.ts","sourceRoot":"","sources":["../../src/tools/load-standards.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"load-standards.d.ts","sourceRoot":"","sources":["../../src/tools/load-standards.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAyBnD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,WAAW,CAAA;CACnB;AAiID,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAsD3F;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;CAmB/B,CAAA"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
// MCP tool: load_standards - read standards file
|
|
1
|
+
// MCP tool: load_standards - read standards file (cloud or local)
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
4
|
import { join, resolve } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { AGENT_FILE_PATHS } from '@agentbrain/core';
|
|
7
|
+
// ══════════════════════════════════════════════════════════════
|
|
8
|
+
// Environment & Configuration
|
|
9
|
+
// ══════════════════════════════════════════════════════════════
|
|
10
|
+
const BASE_URL = process.env.AGENTBRAIN_API_BASE_URL?.replace(/\/$/, '') ?? 'https://www.useagentbrain.com/api/v1';
|
|
11
|
+
const STANDARDS_URL = `${BASE_URL}/standards`;
|
|
7
12
|
/**
|
|
8
13
|
* Expand path: handles ~, relative paths, etc.
|
|
9
14
|
*/
|
|
@@ -13,14 +18,140 @@ function expandPath(path) {
|
|
|
13
18
|
}
|
|
14
19
|
return resolve(path);
|
|
15
20
|
}
|
|
21
|
+
// ══════════════════════════════════════════════════════════════
|
|
22
|
+
// Formatting
|
|
23
|
+
// ══════════════════════════════════════════════════════════════
|
|
24
|
+
function formatStandards(content) {
|
|
25
|
+
const workspaceName = content.workspace_name || 'Workspace';
|
|
26
|
+
let output = `# Standards — ${workspaceName}\n\n`;
|
|
27
|
+
// Test Strategy
|
|
28
|
+
if (content.test_strategy) {
|
|
29
|
+
const ts = content.test_strategy;
|
|
30
|
+
if (ts.framework || ts.always_test || ts.never_test || ts.coverage_goal || ts.required) {
|
|
31
|
+
output += '## Test Strategy\n';
|
|
32
|
+
if (ts.framework)
|
|
33
|
+
output += `Framework: ${ts.framework}\n`;
|
|
34
|
+
if (ts.always_test)
|
|
35
|
+
output += `Always test: ${ts.always_test}\n`;
|
|
36
|
+
if (ts.never_test)
|
|
37
|
+
output += `Never test: ${ts.never_test}\n`;
|
|
38
|
+
if (ts.coverage_goal)
|
|
39
|
+
output += `Coverage goal: ${ts.coverage_goal}\n`;
|
|
40
|
+
if (ts.required)
|
|
41
|
+
output += `Required: ${ts.required}\n`;
|
|
42
|
+
output += '\n';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// PR Requirements
|
|
46
|
+
if (content.pr_requirements) {
|
|
47
|
+
const pr = content.pr_requirements;
|
|
48
|
+
if (pr.max_pr_size || pr.commit_format || pr.description_required !== undefined || pr.tests_required !== undefined) {
|
|
49
|
+
output += '## PR Requirements\n';
|
|
50
|
+
if (pr.max_pr_size)
|
|
51
|
+
output += `Max PR size: ${pr.max_pr_size}\n`;
|
|
52
|
+
if (pr.commit_format)
|
|
53
|
+
output += `Commit format: ${pr.commit_format}\n`;
|
|
54
|
+
if (pr.description_required !== undefined)
|
|
55
|
+
output += `Description required: ${pr.description_required ? 'yes' : 'no'}\n`;
|
|
56
|
+
if (pr.tests_required !== undefined)
|
|
57
|
+
output += `Tests required: ${pr.tests_required ? 'yes' : 'no'}\n`;
|
|
58
|
+
output += '\n';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Code Style
|
|
62
|
+
if (content.code_style) {
|
|
63
|
+
const cs = content.code_style;
|
|
64
|
+
if (cs.max_function_length || cs.naming_conventions || cs.comment_style || cs.forbidden_patterns) {
|
|
65
|
+
output += '## Code Style\n';
|
|
66
|
+
if (cs.max_function_length)
|
|
67
|
+
output += `Max function length: ${cs.max_function_length}\n`;
|
|
68
|
+
if (cs.naming_conventions)
|
|
69
|
+
output += `Naming conventions: ${cs.naming_conventions}\n`;
|
|
70
|
+
if (cs.comment_style)
|
|
71
|
+
output += `Comment style: ${cs.comment_style}\n`;
|
|
72
|
+
if (cs.forbidden_patterns)
|
|
73
|
+
output += `Forbidden patterns: ${cs.forbidden_patterns}\n`;
|
|
74
|
+
output += '\n';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Definition of Done
|
|
78
|
+
if (content.definition_of_done && content.definition_of_done.length > 0) {
|
|
79
|
+
output += '## Definition of Done\n';
|
|
80
|
+
output += 'Before marking any task complete, verify ALL of these:\n';
|
|
81
|
+
for (const item of content.definition_of_done) {
|
|
82
|
+
output += `- ${item}\n`;
|
|
83
|
+
}
|
|
84
|
+
output += '\n';
|
|
85
|
+
}
|
|
86
|
+
// Run Commands
|
|
87
|
+
if (content.run_commands) {
|
|
88
|
+
const rc = content.run_commands;
|
|
89
|
+
if (rc.dev || rc.test || rc.build || rc.lint || rc.typecheck) {
|
|
90
|
+
output += '## Run Commands\n';
|
|
91
|
+
if (rc.dev)
|
|
92
|
+
output += `Dev: ${rc.dev}\n`;
|
|
93
|
+
if (rc.test)
|
|
94
|
+
output += `Test: ${rc.test}\n`;
|
|
95
|
+
if (rc.build)
|
|
96
|
+
output += `Build: ${rc.build}\n`;
|
|
97
|
+
if (rc.lint)
|
|
98
|
+
output += `Lint: ${rc.lint}\n`;
|
|
99
|
+
if (rc.typecheck)
|
|
100
|
+
output += `Type check: ${rc.typecheck}\n`;
|
|
101
|
+
output += '\n';
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return output;
|
|
105
|
+
}
|
|
106
|
+
function isContentEmpty(content) {
|
|
107
|
+
const hasTestStrategy = content.test_strategy && Object.values(content.test_strategy).some(v => v);
|
|
108
|
+
const hasPRRequirements = content.pr_requirements && Object.values(content.pr_requirements).some(v => v !== undefined);
|
|
109
|
+
const hasCodeStyle = content.code_style && Object.values(content.code_style).some(v => v);
|
|
110
|
+
const hasDefinitionOfDone = content.definition_of_done && content.definition_of_done.length > 0;
|
|
111
|
+
const hasRunCommands = content.run_commands && Object.values(content.run_commands).some(v => v);
|
|
112
|
+
return !(hasTestStrategy || hasPRRequirements || hasCodeStyle || hasDefinitionOfDone || hasRunCommands);
|
|
113
|
+
}
|
|
114
|
+
// ══════════════════════════════════════════════════════════════
|
|
115
|
+
// Main Tool Function
|
|
116
|
+
// ══════════════════════════════════════════════════════════════
|
|
16
117
|
export async function loadStandards(input) {
|
|
17
118
|
const { repo_path, agent } = input;
|
|
18
|
-
// Expand path to handle ~, relative paths, etc.
|
|
19
119
|
const expandedPath = expandPath(repo_path);
|
|
120
|
+
const apiKey = process.env.AGENTBRAIN_API_KEY;
|
|
121
|
+
// ── Cloud mode with fallback ──────────────────────────────
|
|
122
|
+
if (apiKey) {
|
|
123
|
+
try {
|
|
124
|
+
const res = await fetch(STANDARDS_URL, {
|
|
125
|
+
method: 'GET',
|
|
126
|
+
headers: {
|
|
127
|
+
'x-api-key': apiKey,
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
// If 200 with content, use cloud version
|
|
132
|
+
if (res.ok) {
|
|
133
|
+
const json = (await res.json());
|
|
134
|
+
if (json.data && !isContentEmpty(json.data.content)) {
|
|
135
|
+
return {
|
|
136
|
+
content: formatStandards(json.data.content),
|
|
137
|
+
filePath: 'cloud:standards',
|
|
138
|
+
agent,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// 404 or empty content → fall back to local file
|
|
143
|
+
}
|
|
144
|
+
catch (err) {
|
|
145
|
+
// Network error → fall back to local file
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
// ── Local disk mode (no API key OR cloud fallback) ────────
|
|
20
149
|
const relativePath = AGENT_FILE_PATHS[agent];
|
|
21
150
|
const filePath = join(expandedPath, relativePath);
|
|
22
151
|
if (!existsSync(filePath)) {
|
|
23
|
-
throw new Error(
|
|
152
|
+
throw new Error(apiKey
|
|
153
|
+
? `No Standards found. Create one at useagentbrain.com/settings → Standards tab or create a local standards file.`
|
|
154
|
+
: `Standards file not found: ${relativePath}. Run "agentbrain standards" to generate it.`);
|
|
24
155
|
}
|
|
25
156
|
const content = await readFile(filePath, 'utf-8');
|
|
26
157
|
return {
|
|
@@ -31,7 +162,7 @@ export async function loadStandards(input) {
|
|
|
31
162
|
}
|
|
32
163
|
export const loadStandardsSchema = {
|
|
33
164
|
name: 'load_standards',
|
|
34
|
-
description: 'Load coding standards
|
|
165
|
+
description: 'Load coding standards (test/PR requirements). With AGENTBRAIN_API_KEY set, fetches from cloud first, falls back to local file. Without API key, reads from disk only.',
|
|
35
166
|
inputSchema: {
|
|
36
167
|
type: 'object',
|
|
37
168
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-standards.js","sourceRoot":"","sources":["../../src/tools/load-standards.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"load-standards.js","sourceRoot":"","sources":["../../src/tools/load-standards.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAElE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGnD,iEAAiE;AACjE,8BAA8B;AAC9B,iEAAiE;AAEjE,MAAM,QAAQ,GACZ,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,sCAAsC,CAAA;AAEnG,MAAM,aAAa,GAAG,GAAG,QAAQ,YAAY,CAAA;AAE7C;;GAEG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAA;IACrC,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAA;AACtB,CAAC;AAuDD,iEAAiE;AACjE,aAAa;AACb,iEAAiE;AAEjE,SAAS,eAAe,CAAC,OAAyB;IAChD,MAAM,aAAa,GAAG,OAAO,CAAC,cAAc,IAAI,WAAW,CAAA;IAC3D,IAAI,MAAM,GAAG,iBAAiB,aAAa,MAAM,CAAA;IAEjD,gBAAgB;IAChB,IAAI,OAAO,CAAC,aA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+
export interface PreflightCheckInput {
|
|
2
|
+
repo_path: string;
|
|
3
|
+
task?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const preflightCheckSchema: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: string;
|
|
10
|
+
properties: {
|
|
11
|
+
repo_path: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
task: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
required: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare function preflightCheck(input: PreflightCheckInput): Promise<string>;
|
|
24
|
+
//# sourceMappingURL=preflight-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-check.d.ts","sourceRoot":"","sources":["../../src/tools/preflight-check.ts"],"names":[],"mappings":"AAoCA,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAwBD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;CAyBhC,CAAA;AA8GD,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAqJhF"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
// MCP tool: preflight_check - Load everything before starting a task
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { loadContext } from './load-context.js';
|
|
5
|
+
import { loadBlueprint } from './load-blueprint.js';
|
|
6
|
+
import { loadGuardrails } from './load-guardrails.js';
|
|
7
|
+
import { loadStandards } from './load-standards.js';
|
|
8
|
+
import { loadDecisions } from './load-decisions.js';
|
|
9
|
+
// ══════════════════════════════════════════════════════════════
|
|
10
|
+
// Environment & Configuration
|
|
11
|
+
// ══════════════════════════════════════════════════════════════
|
|
12
|
+
const BASE_URL = process.env.AGENTBRAIN_API_BASE_URL?.replace(/\/$/, '') ?? 'https://www.useagentbrain.com/api/v1';
|
|
13
|
+
const SPECS_URL = `${BASE_URL}/specs`;
|
|
14
|
+
/**
|
|
15
|
+
* Expand path: handles ~, relative paths, etc.
|
|
16
|
+
*/
|
|
17
|
+
function expandPath(path) {
|
|
18
|
+
if (path.startsWith('~/') || path === '~') {
|
|
19
|
+
return path.replace('~', homedir());
|
|
20
|
+
}
|
|
21
|
+
if (!path.startsWith('/')) {
|
|
22
|
+
return join(process.cwd(), path);
|
|
23
|
+
}
|
|
24
|
+
return path;
|
|
25
|
+
}
|
|
26
|
+
// ══════════════════════════════════════════════════════════════
|
|
27
|
+
// Schema
|
|
28
|
+
// ══════════════════════════════════════════════════════════════
|
|
29
|
+
export const preflightCheckSchema = {
|
|
30
|
+
name: 'preflight_check',
|
|
31
|
+
description: 'Run before starting ANY task. Loads codebase context, workspace Playbook (Blueprint, Guardrails, Standards, Decisions), and active spec in one parallel call. Returns a targeted briefing for your task.\n\n' +
|
|
32
|
+
'Use this instead of calling load_context(), load_blueprint(), load_guardrails(), load_standards(), load_decisions(), and load_spec() separately.\n\n' +
|
|
33
|
+
'Usage:\n' +
|
|
34
|
+
'preflight_check({\n' +
|
|
35
|
+
' repo_path: "/path/to/repo",\n' +
|
|
36
|
+
' task: "what you are about to build"\n' +
|
|
37
|
+
'})',
|
|
38
|
+
inputSchema: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
properties: {
|
|
41
|
+
repo_path: {
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'Absolute path to repository',
|
|
44
|
+
},
|
|
45
|
+
task: {
|
|
46
|
+
type: 'string',
|
|
47
|
+
description: 'Optional: What you are about to do (e.g., "implement Stripe webhook handler", "refactor auth module"). Used to filter relevant context.',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
required: ['repo_path'],
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
// ══════════════════════════════════════════════════════════════
|
|
54
|
+
// Helpers
|
|
55
|
+
// ══════════════════════════════════════════════════════════════
|
|
56
|
+
async function fetchActiveSpec(apiKey) {
|
|
57
|
+
try {
|
|
58
|
+
const res = await fetch(SPECS_URL, {
|
|
59
|
+
method: 'GET',
|
|
60
|
+
headers: {
|
|
61
|
+
'x-api-key': apiKey,
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
if (!res.ok)
|
|
66
|
+
return null;
|
|
67
|
+
const json = (await res.json());
|
|
68
|
+
if (!json.data)
|
|
69
|
+
return null;
|
|
70
|
+
const spec = json.data;
|
|
71
|
+
const approach = Array.isArray(spec.answers.approach)
|
|
72
|
+
? spec.answers.approach.map((a) => `- ${a}`).join('\n')
|
|
73
|
+
: spec.answers.approach;
|
|
74
|
+
const doneCriteria = Array.isArray(spec.answers.done_criteria)
|
|
75
|
+
? spec.answers.done_criteria.map((d) => `- [ ] ${d}`).join('\n')
|
|
76
|
+
: spec.answers.done_criteria;
|
|
77
|
+
return `**${spec.title}** (${spec.status})
|
|
78
|
+
|
|
79
|
+
Problem: ${spec.answers.problem}
|
|
80
|
+
|
|
81
|
+
Approach:
|
|
82
|
+
${approach}
|
|
83
|
+
|
|
84
|
+
Done Criteria:
|
|
85
|
+
${doneCriteria}`;
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isRelevantSection(section, task) {
|
|
92
|
+
const taskLower = task.toLowerCase();
|
|
93
|
+
const sectionLower = section.toLowerCase();
|
|
94
|
+
// Auth-related tasks
|
|
95
|
+
if (taskLower.includes('auth') && sectionLower.includes('auth'))
|
|
96
|
+
return true;
|
|
97
|
+
// Billing/payment tasks
|
|
98
|
+
if ((taskLower.includes('billing') || taskLower.includes('stripe') || taskLower.includes('payment')) &&
|
|
99
|
+
(sectionLower.includes('billing') || sectionLower.includes('stripe') || sectionLower.includes('payment'))) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
// Database tasks
|
|
103
|
+
if ((taskLower.includes('database') || taskLower.includes('migration') || taskLower.includes('schema')) &&
|
|
104
|
+
(sectionLower.includes('database') || sectionLower.includes('migration') || sectionLower.includes('schema'))) {
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
// API tasks
|
|
108
|
+
if ((taskLower.includes('api') || taskLower.includes('endpoint') || taskLower.includes('route')) &&
|
|
109
|
+
(sectionLower.includes('api') || sectionLower.includes('endpoint') || sectionLower.includes('route'))) {
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
function filterContent(content, task) {
|
|
115
|
+
if (!task)
|
|
116
|
+
return content;
|
|
117
|
+
const lines = content.split('\n');
|
|
118
|
+
const filtered = [];
|
|
119
|
+
let currentSection = '';
|
|
120
|
+
let includeSection = false;
|
|
121
|
+
for (const line of lines) {
|
|
122
|
+
// New section header
|
|
123
|
+
if (line.startsWith('##')) {
|
|
124
|
+
currentSection = line;
|
|
125
|
+
includeSection = isRelevantSection(line, task);
|
|
126
|
+
if (includeSection) {
|
|
127
|
+
filtered.push(line);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (includeSection) {
|
|
131
|
+
// Include content from relevant sections
|
|
132
|
+
filtered.push(line);
|
|
133
|
+
}
|
|
134
|
+
else if (line.startsWith('#') || line.trim() === '') {
|
|
135
|
+
// Always include top-level headers and blank lines
|
|
136
|
+
filtered.push(line);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return filtered.join('\n');
|
|
140
|
+
}
|
|
141
|
+
// ══════════════════════════════════════════════════════════════
|
|
142
|
+
// Main Tool Function
|
|
143
|
+
// ══════════════════════════════════════════════════════════════
|
|
144
|
+
export async function preflightCheck(input) {
|
|
145
|
+
const { repo_path, task } = input;
|
|
146
|
+
const expandedPath = expandPath(repo_path);
|
|
147
|
+
const apiKey = process.env.AGENTBRAIN_API_KEY;
|
|
148
|
+
let output = '# Preflight Check ✓\n\n';
|
|
149
|
+
const errors = [];
|
|
150
|
+
// ── Parallel fetch all sources ────────────────────────────────
|
|
151
|
+
const results = await Promise.allSettled([
|
|
152
|
+
// Load slim context summary
|
|
153
|
+
loadContext({ repo_path, full: false }),
|
|
154
|
+
// Load workspace documents
|
|
155
|
+
apiKey ? loadBlueprint({ repo_path }) : Promise.resolve(null),
|
|
156
|
+
apiKey ? loadGuardrails({ repo_path }) : Promise.resolve(null),
|
|
157
|
+
apiKey ? loadStandards({ repo_path, agent: 'claude-code' }) : Promise.resolve(null),
|
|
158
|
+
apiKey ? loadDecisions({ repo_path }) : Promise.resolve(null),
|
|
159
|
+
// Load active spec
|
|
160
|
+
apiKey ? fetchActiveSpec(apiKey) : Promise.resolve(null),
|
|
161
|
+
]);
|
|
162
|
+
// Extract results
|
|
163
|
+
const [contextResult, blueprintResult, guardrailsResult, standardsResult, decisionsResult, specResult] = results;
|
|
164
|
+
const context = contextResult.status === 'fulfilled' ? contextResult.value.content : null;
|
|
165
|
+
const blueprint = blueprintResult.status === 'fulfilled' ? blueprintResult.value : null;
|
|
166
|
+
const guardrails = guardrailsResult.status === 'fulfilled' ? guardrailsResult.value : null;
|
|
167
|
+
const standards = standardsResult.status === 'fulfilled' ? standardsResult.value?.content : null;
|
|
168
|
+
const decisions = decisionsResult.status === 'fulfilled' ? decisionsResult.value : null;
|
|
169
|
+
const spec = specResult.status === 'fulfilled' ? specResult.value : null;
|
|
170
|
+
// Track errors
|
|
171
|
+
if (contextResult.status === 'rejected')
|
|
172
|
+
errors.push(`Context: ${contextResult.reason}`);
|
|
173
|
+
if (blueprintResult.status === 'rejected')
|
|
174
|
+
errors.push(`Blueprint: ${blueprintResult.reason}`);
|
|
175
|
+
if (guardrailsResult.status === 'rejected')
|
|
176
|
+
errors.push(`Guardrails: ${guardrailsResult.reason}`);
|
|
177
|
+
if (standardsResult.status === 'rejected')
|
|
178
|
+
errors.push(`Standards: ${standardsResult.reason}`);
|
|
179
|
+
if (decisionsResult.status === 'rejected')
|
|
180
|
+
errors.push(`Decisions: ${decisionsResult.reason}`);
|
|
181
|
+
// ── Build output ───────────────────────────────────────────────
|
|
182
|
+
// Active Spec
|
|
183
|
+
if (spec) {
|
|
184
|
+
output += '## Active Spec\n';
|
|
185
|
+
output += spec + '\n\n';
|
|
186
|
+
}
|
|
187
|
+
else if (apiKey) {
|
|
188
|
+
output += '## Active Spec\n';
|
|
189
|
+
output += 'No active spec. Create one at useagentbrain.com/specs\n\n';
|
|
190
|
+
}
|
|
191
|
+
// Codebase Context
|
|
192
|
+
if (context) {
|
|
193
|
+
// Extract branch info
|
|
194
|
+
const contextLines = context.split('\n');
|
|
195
|
+
const branchLineIndex = contextLines.findIndex((l) => l.includes('## Current Branch'));
|
|
196
|
+
const branch = branchLineIndex >= 0 ? contextLines[branchLineIndex + 1]?.trim() : 'unknown';
|
|
197
|
+
output += '## Codebase Context\n';
|
|
198
|
+
output += `Branch: ${branch}\n`;
|
|
199
|
+
// Extract 2-3 line summary from context
|
|
200
|
+
const lines = context.split('\n').filter((l) => l.trim() && !l.startsWith('#'));
|
|
201
|
+
const summary = lines.slice(0, 3).join('\n');
|
|
202
|
+
if (summary) {
|
|
203
|
+
output += summary + '\n';
|
|
204
|
+
}
|
|
205
|
+
output += '\n';
|
|
206
|
+
}
|
|
207
|
+
// How We Build Here (Blueprint)
|
|
208
|
+
if (blueprint && !blueprint.includes('requires an API key') && !blueprint.includes('no content yet')) {
|
|
209
|
+
output += '## How We Build Here\n';
|
|
210
|
+
const filtered = task ? filterContent(blueprint, task) : blueprint;
|
|
211
|
+
// Remove the top-level title
|
|
212
|
+
const content = filtered.replace(/^# Blueprint.*\n\n/, '');
|
|
213
|
+
output += content + '\n';
|
|
214
|
+
}
|
|
215
|
+
// Guardrails for This Task
|
|
216
|
+
if (guardrails && !guardrails.includes('requires an API key') && !guardrails.includes('no content yet')) {
|
|
217
|
+
const isRefactor = task?.toLowerCase().includes('refactor');
|
|
218
|
+
output += isRefactor ? '## Guardrails (Refactoring)\n' : '## Guardrails for This Task\n';
|
|
219
|
+
const filtered = task ? filterContent(guardrails, task) : guardrails;
|
|
220
|
+
// Remove the top-level title
|
|
221
|
+
const content = filtered.replace(/^# Guardrails.*\n\n/, '');
|
|
222
|
+
output += content + '\n';
|
|
223
|
+
}
|
|
224
|
+
// Decisions to Know
|
|
225
|
+
if (decisions && !decisions.includes('requires an API key') && !decisions.includes('No Decisions found')) {
|
|
226
|
+
output += '## Decisions to Know\n';
|
|
227
|
+
const filtered = task ? filterContent(decisions, task) : decisions;
|
|
228
|
+
// Remove the top-level title
|
|
229
|
+
const content = filtered.replace(/^# Decisions.*\n\n/, '');
|
|
230
|
+
output += content + '\n';
|
|
231
|
+
}
|
|
232
|
+
// Standards (emphasize for test/PR/review tasks)
|
|
233
|
+
const isTestOrPR = task?.toLowerCase().match(/test|pr|review|done/);
|
|
234
|
+
if (standards && isTestOrPR) {
|
|
235
|
+
output += '## Standards & Definition of Done\n';
|
|
236
|
+
const filtered = task ? filterContent(standards, task) : standards;
|
|
237
|
+
// Remove the top-level title
|
|
238
|
+
const content = filtered.replace(/^# Standards.*\n\n/, '');
|
|
239
|
+
output += content + '\n';
|
|
240
|
+
}
|
|
241
|
+
else if (standards) {
|
|
242
|
+
// Extract just Definition of Done for other tasks
|
|
243
|
+
const dodMatch = standards.match(/## Definition of Done\n([\s\S]*?)(?=\n##|\n$|$)/);
|
|
244
|
+
if (dodMatch) {
|
|
245
|
+
output += '## Definition of Done\n';
|
|
246
|
+
output += dodMatch[1].trim() + '\n\n';
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// ── Footer ─────────────────────────────────────────────────────
|
|
250
|
+
// No API key message
|
|
251
|
+
if (!apiKey) {
|
|
252
|
+
output += '\n---\n\n';
|
|
253
|
+
output +=
|
|
254
|
+
'💡 Add AGENTBRAIN_API_KEY to your MCP config to load Blueprint, Guardrails, Standards, and Decisions.\n';
|
|
255
|
+
output += 'Get your key at useagentbrain.com/settings\n\n';
|
|
256
|
+
}
|
|
257
|
+
// No Playbook message
|
|
258
|
+
if (apiKey &&
|
|
259
|
+
blueprint?.includes('no content yet') &&
|
|
260
|
+
guardrails?.includes('no content yet') &&
|
|
261
|
+
decisions?.includes('No Decisions found')) {
|
|
262
|
+
output += '\n---\n\n';
|
|
263
|
+
output += '💡 No Playbook found for this workspace.\n';
|
|
264
|
+
output += 'Create one at useagentbrain.com/playbook to give your agent architectural guidance.\n\n';
|
|
265
|
+
}
|
|
266
|
+
// Errors
|
|
267
|
+
if (errors.length > 0) {
|
|
268
|
+
output += '\n---\n\n';
|
|
269
|
+
output += '⚠️ Some sources failed to load:\n';
|
|
270
|
+
for (const error of errors) {
|
|
271
|
+
output += `- ${error}\n`;
|
|
272
|
+
}
|
|
273
|
+
output += '\n';
|
|
274
|
+
}
|
|
275
|
+
output += '---\n';
|
|
276
|
+
output += 'Ready. Proceed with task.\n';
|
|
277
|
+
return output;
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=preflight-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preflight-check.js","sourceRoot":"","sources":["../../src/tools/preflight-check.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,iEAAiE;AACjE,8BAA8B;AAC9B,iEAAiE;AAEjE,MA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