@agentbrain/mcp-server 1.4.13 → 1.4.20
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 +41 -4
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/tools/{save-handoff.d.ts → detect-doom-loop.d.ts} +8 -12
- package/dist/tools/detect-doom-loop.d.ts.map +1 -0
- package/dist/tools/detect-doom-loop.js +41 -0
- package/dist/tools/detect-doom-loop.js.map +1 -0
- package/dist/tools/load-context.d.ts +4 -0
- package/dist/tools/load-context.d.ts.map +1 -1
- package/dist/tools/load-context.js +26 -6
- package/dist/tools/load-context.js.map +1 -1
- package/dist/tools/load-spec.d.ts.map +1 -0
- package/dist/tools/load-spec.js +51 -0
- package/dist/tools/load-spec.js.map +1 -0
- package/dist/tools/save-handoff.js +2 -2
- package/dist/tools/save-handoff.js.map +1 -1
- package/package.json +1 -1
- package/dist/index.d.ts +0 -3
- package/dist/tools/__tests__/load-task-context.test.d.ts +0 -2
- package/dist/tools/__tests__/load-task-context.test.d.ts.map +0 -1
- package/dist/tools/__tests__/load-task-context.test.js +0 -71
- package/dist/tools/__tests__/load-task-context.test.js.map +0 -1
- package/dist/tools/load-standards.d.ts +0 -31
- package/dist/tools/load-task-context.d.ts +0 -36
- package/dist/tools/load-task-context.d.ts.map +0 -1
- package/dist/tools/load-task-context.js +0 -57
- package/dist/tools/load-task-context.js.map +0 -1
- package/dist/tools/scan-repo.d.ts +0 -33
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ This MCP server lets **Claude Desktop**, **Cursor**, and **Windsurf** access Age
|
|
|
8
8
|
|
|
9
9
|
- 🔍 Scan your repository structure
|
|
10
10
|
- 📖 Load comprehensive codebase context
|
|
11
|
+
- 📝 Load task specifications
|
|
11
12
|
- 📋 Read coding standards
|
|
12
13
|
- 💾 Save session handoffs
|
|
13
14
|
|
|
@@ -87,9 +88,10 @@ Then reopen it.
|
|
|
87
88
|
|
|
88
89
|
1. Start a new conversation in Claude Desktop
|
|
89
90
|
2. Look for the **🔌 icon** in the toolbar or bottom of the chat
|
|
90
|
-
3. Click it - you should see "agentbrain" with
|
|
91
|
+
3. Click it - you should see "agentbrain" with 5 tools:
|
|
91
92
|
- `scan_repo`
|
|
92
93
|
- `load_context`
|
|
94
|
+
- `load_spec`
|
|
93
95
|
- `load_standards`
|
|
94
96
|
- `save_handoff`
|
|
95
97
|
|
|
@@ -219,7 +221,7 @@ Look for MCP tools in the Windsurf interface, then ask:
|
|
|
219
221
|
|
|
220
222
|
## Available Tools
|
|
221
223
|
|
|
222
|
-
Once configured, your agent can use these
|
|
224
|
+
Once configured, your agent can use these 5 tools:
|
|
223
225
|
|
|
224
226
|
### 1. `scan_repo` - Analyze Repository Structure
|
|
225
227
|
|
|
@@ -251,7 +253,41 @@ Once configured, your agent can use these 4 tools:
|
|
|
251
253
|
|
|
252
254
|
---
|
|
253
255
|
|
|
254
|
-
### 3. `
|
|
256
|
+
### 3. `load_spec` - Load Task Specification
|
|
257
|
+
|
|
258
|
+
**What it does:** Loads a task specification file by name, or lists all available specs if no task is specified.
|
|
259
|
+
|
|
260
|
+
**Parameters:**
|
|
261
|
+
- `repoPath` (required): Path to repository
|
|
262
|
+
- `task` (optional): Task description or slug (e.g., "add-oauth-authentication")
|
|
263
|
+
|
|
264
|
+
**Example prompts:**
|
|
265
|
+
- "Load the spec for add-oauth-authentication"
|
|
266
|
+
- "Show me available specs"
|
|
267
|
+
- "Load the task spec for user authentication"
|
|
268
|
+
|
|
269
|
+
**Returns:**
|
|
270
|
+
If task specified: The spec content
|
|
271
|
+
If no task: List of all available specs in agentbrain/specs/
|
|
272
|
+
|
|
273
|
+
**Cost:** Free - reads from disk
|
|
274
|
+
|
|
275
|
+
**Note:** Specs must be created first using `agentbrain spec` CLI command.
|
|
276
|
+
|
|
277
|
+
**Example usage:**
|
|
278
|
+
```typescript
|
|
279
|
+
// List all specs
|
|
280
|
+
load_spec({ repoPath: "/path/to/project" })
|
|
281
|
+
// Returns: "Available specs:\n\n- add-oauth-authentication\n- implement-notifications"
|
|
282
|
+
|
|
283
|
+
// Load specific spec
|
|
284
|
+
load_spec({ repoPath: "/path/to/project", task: "add-oauth-authentication" })
|
|
285
|
+
// Returns: Full spec content with problem, approach, acceptance criteria, etc.
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
### 4. `load_standards` - Load Coding Standards
|
|
255
291
|
|
|
256
292
|
**What it does:** Loads the coding standards file for your specific agent (CLAUDE.md, .cursor/rules, or .windsurfrules).
|
|
257
293
|
|
|
@@ -266,7 +302,7 @@ Once configured, your agent can use these 4 tools:
|
|
|
266
302
|
|
|
267
303
|
---
|
|
268
304
|
|
|
269
|
-
###
|
|
305
|
+
### 5. `save_handoff` - Save Session Handoff
|
|
270
306
|
|
|
271
307
|
**What it does:** Analyzes your recent git changes and creates a handoff document for the next session.
|
|
272
308
|
|
|
@@ -484,6 +520,7 @@ This gives your agent full project awareness immediately.
|
|
|
484
520
|
**Q: Does this cost money?**
|
|
485
521
|
A: Depends on the tool:
|
|
486
522
|
- `scan_repo` - Free
|
|
523
|
+
- `load_spec` - Free
|
|
487
524
|
- `load_standards` - Free
|
|
488
525
|
- `load_context` (cached) - Free
|
|
489
526
|
- `load_context` (first time) - ~$0.02-0.05
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,8 @@ import { scanRepo, scanRepoSchema } from './tools/scan-repo.js';
|
|
|
7
7
|
import { loadStandards, loadStandardsSchema } from './tools/load-standards.js';
|
|
8
8
|
import { loadContext, loadContextSchema } from './tools/load-context.js';
|
|
9
9
|
import { saveHandoff, saveHandoffSchema } from './tools/save-handoff.js';
|
|
10
|
-
import {
|
|
10
|
+
import { loadSpecTool, loadSpecSchema } from './tools/load-spec.js';
|
|
11
|
+
import { detectDoomLoop, detectDoomLoopSchema } from './tools/detect-doom-loop.js';
|
|
11
12
|
// Create MCP server
|
|
12
13
|
const server = new Server({
|
|
13
14
|
name: 'agentbrain',
|
|
@@ -24,7 +25,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
24
25
|
scanRepoSchema,
|
|
25
26
|
loadStandardsSchema,
|
|
26
27
|
loadContextSchema,
|
|
27
|
-
|
|
28
|
+
loadSpecSchema,
|
|
29
|
+
detectDoomLoopSchema,
|
|
28
30
|
saveHandoffSchema,
|
|
29
31
|
],
|
|
30
32
|
};
|
|
@@ -57,25 +59,37 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
57
59
|
],
|
|
58
60
|
};
|
|
59
61
|
}
|
|
60
|
-
case '
|
|
61
|
-
const result = await
|
|
62
|
+
case 'load_spec': {
|
|
63
|
+
const result = await loadSpecTool(args);
|
|
62
64
|
return {
|
|
63
65
|
content: [
|
|
64
66
|
{
|
|
65
67
|
type: 'text',
|
|
66
|
-
text:
|
|
68
|
+
text: result.slug
|
|
69
|
+
? `${result.content}\n\n---\n\n[Loaded spec: ${result.slug}]`
|
|
70
|
+
: result.content,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case 'detect_doom_loop': {
|
|
76
|
+
const result = await detectDoomLoop(args);
|
|
77
|
+
return {
|
|
78
|
+
content: [
|
|
79
|
+
{
|
|
80
|
+
type: 'text',
|
|
81
|
+
text: JSON.stringify(result, null, 2),
|
|
67
82
|
},
|
|
68
83
|
],
|
|
69
84
|
};
|
|
70
85
|
}
|
|
71
|
-
case '
|
|
72
|
-
const
|
|
73
|
-
const result = await loadTaskContext(typedArgs);
|
|
86
|
+
case 'save_handoff': {
|
|
87
|
+
const result = await saveHandoff(args);
|
|
74
88
|
return {
|
|
75
89
|
content: [
|
|
76
90
|
{
|
|
77
91
|
type: 'text',
|
|
78
|
-
text:
|
|
92
|
+
text: `Handoff saved to ${result.filePath}\n\nTokens used: ${result.tokensUsed}\n\n---\n\n${result.content}`,
|
|
79
93
|
},
|
|
80
94
|
],
|
|
81
95
|
};
|
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,WAAW,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAExE,OAAO,EAAE,
|
|
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,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;AAGl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CAAA;QAC5C,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAA;QACxE,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE,EAAE,CAAC;YACtD,OAAO,EAAE,IAAI;SACd,CAAA;IACH,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,eAAe;AACf,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAA;IAC5C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAE/B,oEAAoE;IACpE,OAAO,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAA;AACzD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,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"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DoomLoopResult } from '@agentbrain/core';
|
|
2
|
+
export interface DetectDoomLoopInput {
|
|
2
3
|
repo_path: string;
|
|
3
|
-
goal?: string;
|
|
4
4
|
commit_count?: number;
|
|
5
|
+
threshold?: number;
|
|
5
6
|
}
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
filePath: string;
|
|
9
|
-
tokensUsed: number;
|
|
10
|
-
}
|
|
11
|
-
export declare function saveHandoff(input: SaveHandoffInput): Promise<SaveHandoffOutput>;
|
|
12
|
-
export declare const saveHandoffSchema: {
|
|
7
|
+
export declare function detectDoomLoop(input: DetectDoomLoopInput): Promise<DoomLoopResult>;
|
|
8
|
+
export declare const detectDoomLoopSchema: {
|
|
13
9
|
name: string;
|
|
14
10
|
description: string;
|
|
15
11
|
inputSchema: {
|
|
@@ -19,11 +15,11 @@ export declare const saveHandoffSchema: {
|
|
|
19
15
|
type: string;
|
|
20
16
|
description: string;
|
|
21
17
|
};
|
|
22
|
-
|
|
18
|
+
commit_count: {
|
|
23
19
|
type: string;
|
|
24
20
|
description: string;
|
|
25
21
|
};
|
|
26
|
-
|
|
22
|
+
threshold: {
|
|
27
23
|
type: string;
|
|
28
24
|
description: string;
|
|
29
25
|
};
|
|
@@ -31,4 +27,4 @@ export declare const saveHandoffSchema: {
|
|
|
31
27
|
required: string[];
|
|
32
28
|
};
|
|
33
29
|
};
|
|
34
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=detect-doom-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-doom-loop.d.ts","sourceRoot":"","sources":["../../src/tools/detect-doom-loop.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AActD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CAMxF;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;CAsBhC,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// MCP tool: detect_doom_loop - detect files modified repeatedly
|
|
2
|
+
import { analyzeDoomLoop } from '@agentbrain/core';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { resolve } from 'node:path';
|
|
5
|
+
/**
|
|
6
|
+
* Expand path: handles ~, relative paths, etc.
|
|
7
|
+
*/
|
|
8
|
+
function expandPath(path) {
|
|
9
|
+
if (path.startsWith('~/') || path === '~') {
|
|
10
|
+
return path.replace('~', homedir());
|
|
11
|
+
}
|
|
12
|
+
return resolve(path);
|
|
13
|
+
}
|
|
14
|
+
export async function detectDoomLoop(input) {
|
|
15
|
+
const { repo_path, commit_count = 10, threshold = 4 } = input;
|
|
16
|
+
const expandedPath = expandPath(repo_path);
|
|
17
|
+
return await analyzeDoomLoop(expandedPath, commit_count, threshold);
|
|
18
|
+
}
|
|
19
|
+
export const detectDoomLoopSchema = {
|
|
20
|
+
name: 'detect_doom_loop',
|
|
21
|
+
description: 'Detect doom loops by analyzing git history for files modified repeatedly in recent commits. Returns files appearing in 4+ of last 10 commits.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
repo_path: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'Absolute path to the repository',
|
|
28
|
+
},
|
|
29
|
+
commit_count: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
description: 'Number of recent commits to analyze (default: 10)',
|
|
32
|
+
},
|
|
33
|
+
threshold: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
description: 'Minimum commits for a file to be flagged (default: 4)',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
required: ['repo_path'],
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=detect-doom-loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect-doom-loop.js","sourceRoot":"","sources":["../../src/tools/detect-doom-loop.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC;;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;AAQD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAA0B;IAC7D,MAAM,EAAE,SAAS,EAAE,YAAY,GAAG,EAAE,EAAE,SAAS,GAAG,CAAC,EAAE,GAAG,KAAK,CAAA;IAE7D,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;IAE1C,OAAO,MAAM,eAAe,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;AACrE,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EACT,+IAA+I;IACjJ,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,mDAAmD;aACjE;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uDAAuD;aACrE;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAA"}
|
|
@@ -6,6 +6,10 @@ export interface LoadContextOutput {
|
|
|
6
6
|
content: string;
|
|
7
7
|
fromCache: boolean;
|
|
8
8
|
tokensUsed: number;
|
|
9
|
+
stale?: boolean;
|
|
10
|
+
cached_sha?: string;
|
|
11
|
+
current_sha?: string;
|
|
12
|
+
message?: string;
|
|
9
13
|
}
|
|
10
14
|
export declare function loadContext(input: LoadContextInput): Promise<LoadContextOutput>;
|
|
11
15
|
export declare const loadContextSchema: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-context.d.ts","sourceRoot":"","sources":["../../src/tools/load-context.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"load-context.d.ts","sourceRoot":"","sources":["../../src/tools/load-context.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAwFrF;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAkB7B,CAAA"}
|
|
@@ -3,7 +3,7 @@ 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
|
-
import { loadAIConfig, generateContext, getCachedDoc, getGitHash } from '@agentbrain/core';
|
|
6
|
+
import { loadAIConfig, generateContext, getCachedDoc, getGitHash, loadCache } from '@agentbrain/core';
|
|
7
7
|
/**
|
|
8
8
|
* Expand path: handles ~, relative paths, etc.
|
|
9
9
|
*/
|
|
@@ -18,6 +18,8 @@ export async function loadContext(input) {
|
|
|
18
18
|
// Expand path to handle ~, relative paths, etc.
|
|
19
19
|
const expandedPath = expandPath(repo_path);
|
|
20
20
|
const contextDir = join(expandedPath, 'agentbrain');
|
|
21
|
+
// Get current git hash for staleness check
|
|
22
|
+
const currentGitHash = await getGitHash(expandedPath);
|
|
21
23
|
// Try to load from disk first
|
|
22
24
|
const contextPath = join(contextDir, 'context.md');
|
|
23
25
|
const depMapPath = join(contextDir, 'dependency-map.md');
|
|
@@ -29,25 +31,42 @@ export async function loadContext(input) {
|
|
|
29
31
|
const depMap = await readFile(depMapPath, 'utf-8');
|
|
30
32
|
const patterns = await readFile(patternsPath, 'utf-8');
|
|
31
33
|
const combined = `# Repository Context\n\n${context}\n\n---\n\n# Dependency Map\n\n${depMap}\n\n---\n\n# Patterns\n\n${patterns}`;
|
|
34
|
+
// Check if cached git hash matches current HEAD
|
|
35
|
+
const cache = await loadCache(expandedPath);
|
|
36
|
+
const isStale = cache && cache.gitHash !== currentGitHash;
|
|
32
37
|
return {
|
|
33
38
|
content: combined,
|
|
34
39
|
fromCache: true,
|
|
35
40
|
tokensUsed: 0,
|
|
41
|
+
...(isStale && {
|
|
42
|
+
stale: true,
|
|
43
|
+
cached_sha: cache.gitHash,
|
|
44
|
+
current_sha: currentGitHash,
|
|
45
|
+
message: 'Context may be outdated. Run agentbrain init to refresh.',
|
|
46
|
+
}),
|
|
36
47
|
};
|
|
37
48
|
}
|
|
38
49
|
// Need to generate - requires API key
|
|
39
50
|
const aiConfig = await loadAIConfig();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const cachedPatterns = await getCachedDoc(expandedPath, gitHash, 'patterns');
|
|
51
|
+
// Check cache validity (using currentGitHash from above)
|
|
52
|
+
const cachedContext = await getCachedDoc(expandedPath, currentGitHash, 'context');
|
|
53
|
+
const cachedDepMap = await getCachedDoc(expandedPath, currentGitHash, 'dependency-map');
|
|
54
|
+
const cachedPatterns = await getCachedDoc(expandedPath, currentGitHash, 'patterns');
|
|
45
55
|
if (!force_refresh && cachedContext && cachedDepMap && cachedPatterns) {
|
|
46
56
|
const combined = `# Repository Context\n\n${cachedContext.content}\n\n---\n\n# Dependency Map\n\n${cachedDepMap.content}\n\n---\n\n# Patterns\n\n${cachedPatterns.content}`;
|
|
57
|
+
// Check if cached git hash matches current HEAD
|
|
58
|
+
const cache = await loadCache(expandedPath);
|
|
59
|
+
const isStale = cache && cache.gitHash !== currentGitHash;
|
|
47
60
|
return {
|
|
48
61
|
content: combined,
|
|
49
62
|
fromCache: true,
|
|
50
63
|
tokensUsed: 0,
|
|
64
|
+
...(isStale && {
|
|
65
|
+
stale: true,
|
|
66
|
+
cached_sha: cache.gitHash,
|
|
67
|
+
current_sha: currentGitHash,
|
|
68
|
+
message: 'Context may be outdated. Run agentbrain init to refresh.',
|
|
69
|
+
}),
|
|
51
70
|
};
|
|
52
71
|
}
|
|
53
72
|
// Generate new context
|
|
@@ -59,6 +78,7 @@ export async function loadContext(input) {
|
|
|
59
78
|
const combined = result.docs
|
|
60
79
|
.map((doc) => `# ${doc.type}\n\n${doc.content}`)
|
|
61
80
|
.join('\n\n---\n\n');
|
|
81
|
+
// Newly generated content is never stale
|
|
62
82
|
return {
|
|
63
83
|
content: combined,
|
|
64
84
|
fromCache: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-context.js","sourceRoot":"","sources":["../../src/tools/load-context.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,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,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
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ACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,aAAa,EAAE;gBACb,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,4DAA4D;aAC1E;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-spec.d.ts","sourceRoot":"","sources":["../../src/tools/load-spec.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;CAmB1B,CAAA;AAED,wBAAsB,YAAY,CAChC,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAqC7C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// MCP tool: load_spec - Load specification files
|
|
2
|
+
import { listSpecs, loadSpec } from '@agentbrain/core';
|
|
3
|
+
export const loadSpecSchema = {
|
|
4
|
+
name: 'load_spec',
|
|
5
|
+
description: 'Load a specification file by task name, or list all available specs if no task provided',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
repoPath: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'Absolute path to the repository',
|
|
12
|
+
},
|
|
13
|
+
task: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
description: 'Optional: Task description or slug to load specific spec (e.g., "add-stripe-webhook-handler")',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
required: ['repoPath'],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export async function loadSpecTool(input) {
|
|
22
|
+
const { repoPath, task } = input;
|
|
23
|
+
// If no task provided, list all available specs
|
|
24
|
+
if (!task) {
|
|
25
|
+
const specs = await listSpecs(repoPath);
|
|
26
|
+
if (specs.length === 0) {
|
|
27
|
+
return {
|
|
28
|
+
content: 'No specs found. Run `agentbrain spec "<task>"` to create your first specification.',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
content: `Available specs:\n\n${specs.map((s) => `- ${s}`).join('\n')}\n\nTo load a spec, provide the task slug as the "task" parameter.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Convert task to slug format (kebab-case)
|
|
36
|
+
const slug = task
|
|
37
|
+
.toLowerCase()
|
|
38
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
39
|
+
.replace(/^-+|-+$/g, '');
|
|
40
|
+
const content = await loadSpec(repoPath, slug);
|
|
41
|
+
if (!content) {
|
|
42
|
+
return {
|
|
43
|
+
content: `Spec not found: ${slug}\n\nRun \`agentbrain spec "${task}"\` to create it.`,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
content,
|
|
48
|
+
slug,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=load-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-spec.js","sourceRoot":"","sources":["../../src/tools/load-spec.ts"],"names":[],"mappings":"AAAA,iDAAiD;AAEjD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAOtD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,yFAAyF;IAC3F,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,+FAA+F;aAClG;SACF;QACD,QAAQ,EAAE,CAAC,UAAU,CAAC;KACvB;CACF,CAAA;AAED,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAoB;IAEpB,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IAEhC,gDAAgD;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAA;QAEvC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO;gBACL,OAAO,EACL,oFAAoF;aACvF,CAAA;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,uBAAuB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,oEAAoE;SAC1I,CAAA;IACH,CAAC;IAED,2CAA2C;IAC3C,MAAM,IAAI,GAAG,IAAI;SACd,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;IAE1B,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE,mBAAmB,IAAI,8BAA8B,IAAI,mBAAmB;SACtF,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI;KACL,CAAA;AACH,CAAC"}
|
|
@@ -35,13 +35,13 @@ export async function saveHandoff(input) {
|
|
|
35
35
|
await writeFile(filePath, result.doc.content, 'utf-8');
|
|
36
36
|
return {
|
|
37
37
|
content: result.doc.content,
|
|
38
|
-
filePath: 'agentbrain/handoff.md',
|
|
38
|
+
filePath: '.agentbrain/handoff.md',
|
|
39
39
|
tokensUsed: result.tokenCount,
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export const saveHandoffSchema = {
|
|
43
43
|
name: 'save_handoff',
|
|
44
|
-
description: 'Generate and save handoff document from git diff and recent commits. Creates agentbrain/handoff.md with session summary.',
|
|
44
|
+
description: 'Generate and save handoff document from git diff and recent commits. Creates .agentbrain/handoff.md with session summary.',
|
|
45
45
|
inputSchema: {
|
|
46
46
|
type: 'object',
|
|
47
47
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-handoff.js","sourceRoot":"","sources":["../../src/tools/save-handoff.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACnD,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,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAEhE;;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;AAcD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAuB;IACvD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,GAAG,KAAK,CAAA;IAEnD,gDAAgD;IAChD,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;IAE1C,iBAAiB;IACjB,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;IAErC,mBAAmB;IACnB,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;QACnC,QAAQ,EAAE,YAAY;QACtB,QAAQ;QACR,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d,WAAW,EAAE,iEAAiE;aAC/E;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;CACF,CAAA"}
|
package/package.json
CHANGED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-task-context.test.d.ts","sourceRoot":"","sources":["../../../src/tools/__tests__/load-task-context.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from '@jest/globals';
|
|
2
|
-
import { loadTaskContextSchema } from '../load-task-context.js';
|
|
3
|
-
// Simple unit tests for MCP tool schema and basic validation
|
|
4
|
-
// Full integration tests would require mocking the entire core module
|
|
5
|
-
describe('loadTaskContextSchema', () => {
|
|
6
|
-
it('has correct tool name', () => {
|
|
7
|
-
expect(loadTaskContextSchema.name).toBe('load_task_context');
|
|
8
|
-
});
|
|
9
|
-
it('has valid input schema structure', () => {
|
|
10
|
-
expect(loadTaskContextSchema.inputSchema).toBeDefined();
|
|
11
|
-
expect(loadTaskContextSchema.inputSchema.type).toBe('object');
|
|
12
|
-
expect(loadTaskContextSchema.inputSchema.properties).toBeDefined();
|
|
13
|
-
expect(loadTaskContextSchema.inputSchema.required).toBeDefined();
|
|
14
|
-
});
|
|
15
|
-
it('has required fields in schema', () => {
|
|
16
|
-
const required = loadTaskContextSchema.inputSchema.required;
|
|
17
|
-
expect(Array.isArray(required)).toBe(true);
|
|
18
|
-
expect(required).toContain('repo_path');
|
|
19
|
-
expect(required).toContain('task');
|
|
20
|
-
});
|
|
21
|
-
it('has optional max_files parameter', () => {
|
|
22
|
-
const properties = loadTaskContextSchema.inputSchema.properties;
|
|
23
|
-
expect(properties).toHaveProperty('max_files');
|
|
24
|
-
expect(properties.max_files.type).toBe('number');
|
|
25
|
-
const required = loadTaskContextSchema.inputSchema.required;
|
|
26
|
-
expect(required).not.toContain('max_files');
|
|
27
|
-
});
|
|
28
|
-
it('has repo_path parameter with correct type', () => {
|
|
29
|
-
const properties = loadTaskContextSchema.inputSchema.properties;
|
|
30
|
-
expect(properties.repo_path).toBeDefined();
|
|
31
|
-
expect(properties.repo_path.type).toBe('string');
|
|
32
|
-
expect(properties.repo_path.description).toBeDefined();
|
|
33
|
-
});
|
|
34
|
-
it('has task parameter with correct type', () => {
|
|
35
|
-
const properties = loadTaskContextSchema.inputSchema.properties;
|
|
36
|
-
expect(properties.task).toBeDefined();
|
|
37
|
-
expect(properties.task.type).toBe('string');
|
|
38
|
-
expect(properties.task.description).toBeDefined();
|
|
39
|
-
});
|
|
40
|
-
it('describes near-zero cost feature', () => {
|
|
41
|
-
expect(loadTaskContextSchema.description).toContain('cached summaries');
|
|
42
|
-
});
|
|
43
|
-
it('mentions re-use of cached data', () => {
|
|
44
|
-
expect(loadTaskContextSchema.description.toLowerCase()).toContain('re-use');
|
|
45
|
-
});
|
|
46
|
-
it('has clear description', () => {
|
|
47
|
-
expect(loadTaskContextSchema.description.length).toBeGreaterThan(20);
|
|
48
|
-
expect(loadTaskContextSchema.description).toContain('task');
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
describe('load-task-context module exports', () => {
|
|
52
|
-
it('exports loadTaskContext function', async () => {
|
|
53
|
-
const module = await import('../load-task-context.js');
|
|
54
|
-
expect(module.loadTaskContext).toBeDefined();
|
|
55
|
-
expect(typeof module.loadTaskContext).toBe('function');
|
|
56
|
-
});
|
|
57
|
-
it('exports loadTaskContextSchema object', async () => {
|
|
58
|
-
const module = await import('../load-task-context.js');
|
|
59
|
-
expect(module.loadTaskContextSchema).toBeDefined();
|
|
60
|
-
expect(typeof module.loadTaskContextSchema).toBe('object');
|
|
61
|
-
});
|
|
62
|
-
it('exports LoadTaskContextInput type', async () => {
|
|
63
|
-
const module = await import('../load-task-context.js');
|
|
64
|
-
expect(module).toBeDefined();
|
|
65
|
-
});
|
|
66
|
-
it('exports LoadTaskContextOutput type', async () => {
|
|
67
|
-
const module = await import('../load-task-context.js');
|
|
68
|
-
expect(module).toBeDefined();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
//# sourceMappingURL=load-task-context.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-task-context.test.js","sourceRoot":"","sources":["../../../src/tools/__tests__/load-task-context.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAA;AAE/D,6DAA6D;AAC7D,sEAAsE;AAEtE,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAA;QACvD,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC7D,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,CAAA;QAClE,MAAM,CAAC,qBAAqB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;IAClE,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,QAAQ,GAAG,qBAAqB,CAAC,WAAW,CAAC,QAAQ,CAAA;QAC3D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;QACvC,MAA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CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;QACjD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;QACtD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;IAC9B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,oCAAoC,EAAE,KAAK,IAAI,EAAE;QAClD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,yBAAyB,CAAC,CAAA;QACtD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AgentTarget } from '@agentbrain/core';
|
|
2
|
-
export interface LoadStandardsInput {
|
|
3
|
-
repo_path: string;
|
|
4
|
-
agent: AgentTarget;
|
|
5
|
-
}
|
|
6
|
-
export interface LoadStandardsOutput {
|
|
7
|
-
content: string;
|
|
8
|
-
filePath: string;
|
|
9
|
-
agent: AgentTarget;
|
|
10
|
-
}
|
|
11
|
-
export declare function loadStandards(input: LoadStandardsInput): Promise<LoadStandardsOutput>;
|
|
12
|
-
export declare const loadStandardsSchema: {
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
inputSchema: {
|
|
16
|
-
type: string;
|
|
17
|
-
properties: {
|
|
18
|
-
repo_path: {
|
|
19
|
-
type: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
agent: {
|
|
23
|
-
type: string;
|
|
24
|
-
enum: string[];
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
required: string[];
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=load-standards.d.ts.map
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export interface LoadTaskContextInput {
|
|
2
|
-
repo_path: string;
|
|
3
|
-
task: string;
|
|
4
|
-
max_files?: number;
|
|
5
|
-
}
|
|
6
|
-
export interface LoadTaskContextOutput {
|
|
7
|
-
content: string;
|
|
8
|
-
selectedFiles: number;
|
|
9
|
-
totalFilesScored: number;
|
|
10
|
-
tokensUsed: number;
|
|
11
|
-
cost: number;
|
|
12
|
-
}
|
|
13
|
-
export declare function loadTaskContext(input: LoadTaskContextInput): Promise<LoadTaskContextOutput>;
|
|
14
|
-
export declare const loadTaskContextSchema: {
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
inputSchema: {
|
|
18
|
-
type: string;
|
|
19
|
-
properties: {
|
|
20
|
-
repo_path: {
|
|
21
|
-
type: string;
|
|
22
|
-
description: string;
|
|
23
|
-
};
|
|
24
|
-
task: {
|
|
25
|
-
type: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
max_files: {
|
|
29
|
-
type: string;
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
required: string[];
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=load-task-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-task-context.d.ts","sourceRoot":"","sources":["../../src/tools/load-task-context.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAsB,eAAe,CACnC,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,qBAAqB,CAAC,CAwBhC;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CAuBjC,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// MCP tool: load_task_context - load task-focused context
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import { homedir } from 'node:os';
|
|
4
|
-
import { loadAIConfig, generateTaskContext } from '@agentbrain/core';
|
|
5
|
-
/**
|
|
6
|
-
* Expand path: handles ~, relative paths, etc.
|
|
7
|
-
*/
|
|
8
|
-
function expandPath(path) {
|
|
9
|
-
if (path.startsWith('~/') || path === '~') {
|
|
10
|
-
return path.replace('~', homedir());
|
|
11
|
-
}
|
|
12
|
-
return resolve(path);
|
|
13
|
-
}
|
|
14
|
-
export async function loadTaskContext(input) {
|
|
15
|
-
const { repo_path, task, max_files = 20 } = input;
|
|
16
|
-
// Expand path to handle ~, relative paths, etc.
|
|
17
|
-
const expandedPath = expandPath(repo_path);
|
|
18
|
-
// Load AI config
|
|
19
|
-
const aiConfig = await loadAIConfig();
|
|
20
|
-
// Generate task-focused context
|
|
21
|
-
const result = await generateTaskContext({
|
|
22
|
-
repoPath: expandedPath,
|
|
23
|
-
aiConfig,
|
|
24
|
-
task,
|
|
25
|
-
maxFiles: max_files,
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
content: result.content,
|
|
29
|
-
selectedFiles: result.selectedFiles.length,
|
|
30
|
-
totalFilesScored: result.totalFilesScored,
|
|
31
|
-
tokensUsed: result.tokens,
|
|
32
|
-
cost: result.cost,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
export const loadTaskContextSchema = {
|
|
36
|
-
name: 'load_task_context',
|
|
37
|
-
description: 'Generate task-focused context by scoring cached file summaries against a specific task. Near-zero cost on repeat calls since it re-uses cached summaries.',
|
|
38
|
-
inputSchema: {
|
|
39
|
-
type: 'object',
|
|
40
|
-
properties: {
|
|
41
|
-
repo_path: {
|
|
42
|
-
type: 'string',
|
|
43
|
-
description: 'Absolute path to the repository',
|
|
44
|
-
},
|
|
45
|
-
task: {
|
|
46
|
-
type: 'string',
|
|
47
|
-
description: 'Description of the task (e.g., "add OAuth login to auth module", "fix bug in payment processing")',
|
|
48
|
-
},
|
|
49
|
-
max_files: {
|
|
50
|
-
type: 'number',
|
|
51
|
-
description: 'Maximum number of relevant files to include (default: 20)',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
required: ['repo_path', 'task'],
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
//# sourceMappingURL=load-task-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-task-context.js","sourceRoot":"","sources":["../../src/tools/load-task-context.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAEpE;;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;AAgBD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,KAA2B;IAE3B,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,CAAA;IAEjD,gDAAgD;IAChD,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,CAAA;IAE1C,iBAAiB;IACjB,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;IAErC,gCAAgC;IAChC,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC;QACvC,QAAQ,EAAE,YAAY;QACtB,QAAQ;QACR,IAAI;QACJ,QAAQ,EAAE,SAAS;KACpB,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM;QAC1C,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;QACzC,UAAU,EAAE,MAAM,CAAC,MAAM;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,2JAA2J;IAC7J,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,mGAAmG;aACtG;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2DAA2D;aACzE;SACF;QACD,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;KAChC;CACF,CAAA"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export interface ScanRepoInput {
|
|
2
|
-
repo_path: string;
|
|
3
|
-
max_files?: number;
|
|
4
|
-
}
|
|
5
|
-
export interface ScanRepoOutput {
|
|
6
|
-
totalFiles: number;
|
|
7
|
-
relevantFiles: Array<{
|
|
8
|
-
path: string;
|
|
9
|
-
language: string;
|
|
10
|
-
size: number;
|
|
11
|
-
}>;
|
|
12
|
-
scannedAt: string;
|
|
13
|
-
}
|
|
14
|
-
export declare function scanRepo(input: ScanRepoInput): Promise<ScanRepoOutput>;
|
|
15
|
-
export declare const scanRepoSchema: {
|
|
16
|
-
name: string;
|
|
17
|
-
description: string;
|
|
18
|
-
inputSchema: {
|
|
19
|
-
type: string;
|
|
20
|
-
properties: {
|
|
21
|
-
repo_path: {
|
|
22
|
-
type: string;
|
|
23
|
-
description: string;
|
|
24
|
-
};
|
|
25
|
-
max_files: {
|
|
26
|
-
type: string;
|
|
27
|
-
description: string;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
required: string[];
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=scan-repo.d.ts.map
|