@phuetz/code-buddy 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -22
- package/dist/agent/autonomous/agentic-coding-runner.d.ts +2 -2
- package/dist/agent/autonomous/agentic-coding-runner.js +24 -24
- package/dist/agent/autonomous/checkpoint-manager.d.ts +2 -2
- package/dist/agent/base-agent.d.ts +1 -1
- package/dist/agent/base-agent.js +1 -1
- package/dist/agent/hermes-tool-parity-local.js +2 -2
- package/dist/agent/tool-handler.js +2 -2
- package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +4 -0
- package/dist/codebuddy/providers/provider-chatgpt-responses.js +34 -13
- package/dist/codebuddy/providers/provider-openai-compat.js +8 -0
- package/dist/codebuddy/tool-definitions/code-explorer-tools.d.ts +8 -0
- package/dist/codebuddy/tool-definitions/code-explorer-tools.js +24 -0
- package/dist/codebuddy/tool-definitions/graph-tools.d.ts +1 -1
- package/dist/codebuddy/tool-definitions/graph-tools.js +1 -1
- package/dist/codebuddy/tool-definitions/index.d.ts +1 -1
- package/dist/codebuddy/tool-definitions/index.js +2 -2
- package/dist/codebuddy/tools.d.ts +2 -2
- package/dist/codebuddy/tools.js +13 -13
- package/dist/collaboration/ai-colab-manager.js +9 -4
- package/dist/commands/cli/code-explorer-commands.d.ts +7 -0
- package/dist/commands/cli/code-explorer-commands.js +40 -0
- package/dist/commands/cli/native-engine-commands.js +64 -0
- package/dist/commands/handlers/graph-handlers.d.ts +1 -1
- package/dist/commands/handlers/graph-handlers.js +1 -1
- package/dist/config/model-tools.js +1 -1
- package/dist/daemon/autonomous-loop.d.ts +0 -7
- package/dist/daemon/autonomous-loop.js +24 -14
- package/dist/fleet/capability-registry.js +9 -1
- package/dist/fleet/colab-store.d.ts +109 -3
- package/dist/fleet/colab-store.js +181 -6
- package/dist/index.js +28 -11
- package/dist/kanban/colab-kanban-adapter.d.ts +31 -0
- package/dist/kanban/colab-kanban-adapter.js +232 -0
- package/dist/knowledge/community-detector.d.ts +1 -1
- package/dist/knowledge/community-detector.js +1 -1
- package/dist/knowledge/process-detector.d.ts +1 -1
- package/dist/knowledge/process-detector.js +1 -1
- package/dist/plugins/{gitnexus/GitNexusMCPClient.d.ts → code-explorer/CodeExplorerMCPClient.d.ts} +9 -9
- package/dist/plugins/{gitnexus/GitNexusMCPClient.js → code-explorer/CodeExplorerMCPClient.js} +17 -17
- package/dist/plugins/{gitnexus/GitNexusManager.d.ts → code-explorer/CodeExplorerManager.d.ts} +16 -16
- package/dist/plugins/{gitnexus/GitNexusManager.js → code-explorer/CodeExplorerManager.js} +35 -35
- package/dist/plugins/code-explorer/index.d.ts +9 -0
- package/dist/plugins/code-explorer/index.js +8 -0
- package/dist/providers/provider-catalog.js +23 -1
- package/dist/services/prompt-builder.js +9 -9
- package/dist/skills/parser.js +1 -1
- package/dist/tools/{gitnexus-tool.d.ts → code-explorer-tool.d.ts} +9 -9
- package/dist/tools/{gitnexus-tool.js → code-explorer-tool.js} +16 -16
- package/dist/tools/metadata.js +3 -3
- package/dist/tools/registry/code-explorer-tools.d.ts +18 -0
- package/dist/tools/registry/{gitnexus-tools.js → code-explorer-tools.js} +14 -14
- package/dist/tools/registry/graph-tools.d.ts +1 -1
- package/dist/tools/registry/graph-tools.js +1 -1
- package/dist/tools/registry/index.d.ts +1 -1
- package/dist/tools/registry/index.js +6 -6
- package/dist/tools/registry/kanban-tools.d.ts +1 -1
- package/dist/tools/registry/kanban-tools.js +2 -2
- package/package.json +2 -2
- package/dist/codebuddy/tool-definitions/gitnexus-tools.d.ts +0 -8
- package/dist/codebuddy/tool-definitions/gitnexus-tools.js +0 -24
- package/dist/commands/cli/gitnexus-commands.d.ts +0 -7
- package/dist/commands/cli/gitnexus-commands.js +0 -42
- package/dist/plugins/gitnexus/index.d.ts +0 -9
- package/dist/plugins/gitnexus/index.js +0 -8
- package/dist/tools/registry/gitnexus-tools.d.ts +0 -18
package/dist/plugins/{gitnexus/GitNexusMCPClient.d.ts → code-explorer/CodeExplorerMCPClient.d.ts}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CodeExplorer MCP Client
|
|
3
3
|
*
|
|
4
|
-
* Talks to a
|
|
4
|
+
* Talks to a CodeExplorer MCP server to query the code graph.
|
|
5
5
|
* Currently operates in **stub mode** — all methods return empty/default
|
|
6
6
|
* results so the rest of the codebase can integrate without requiring
|
|
7
|
-
* a real
|
|
8
|
-
* in a follow-up once
|
|
7
|
+
* a real CodeExplorer installation. The real MCP transport will be wired
|
|
8
|
+
* in a follow-up once code-explorer is available.
|
|
9
9
|
*
|
|
10
|
-
* Tools exposed by
|
|
10
|
+
* Tools exposed by CodeExplorer MCP:
|
|
11
11
|
* - query — natural-language search over the code graph
|
|
12
12
|
* - context — symbol-level call/import graph + process membership
|
|
13
13
|
* - impact — blast-radius analysis (upstream/downstream)
|
|
@@ -75,17 +75,17 @@ export interface GNProcess {
|
|
|
75
75
|
stepIndex: number;
|
|
76
76
|
}>;
|
|
77
77
|
}
|
|
78
|
-
export declare class
|
|
78
|
+
export declare class CodeExplorerMCPClient {
|
|
79
79
|
private repoName;
|
|
80
80
|
private connected;
|
|
81
81
|
constructor(repoName: string);
|
|
82
82
|
/**
|
|
83
|
-
* Connect to the
|
|
83
|
+
* Connect to the CodeExplorer MCP server.
|
|
84
84
|
*
|
|
85
85
|
* In the real implementation this will use `@modelcontextprotocol/sdk`
|
|
86
86
|
* `StdioClientTransport` with:
|
|
87
87
|
* command: 'npx'
|
|
88
|
-
* args: ['-y', '
|
|
88
|
+
* args: ['-y', 'code-explorer@latest', 'mcp']
|
|
89
89
|
*
|
|
90
90
|
* For now this is a stub that marks the client as connected.
|
|
91
91
|
*/
|
|
@@ -114,7 +114,7 @@ export declare class GitNexusMCPClient {
|
|
|
114
114
|
*/
|
|
115
115
|
impact(target: string, direction?: 'upstream' | 'downstream'): Promise<GNImpactResult>;
|
|
116
116
|
/**
|
|
117
|
-
* Execute a raw Cypher query against the
|
|
117
|
+
* Execute a raw Cypher query against the CodeExplorer graph database.
|
|
118
118
|
*/
|
|
119
119
|
cypher(query: string): Promise<unknown[]>;
|
|
120
120
|
/** Get all detected module clusters with cohesion scores. */
|
package/dist/plugins/{gitnexus/GitNexusMCPClient.js → code-explorer/CodeExplorerMCPClient.js}
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CodeExplorer MCP Client
|
|
3
3
|
*
|
|
4
|
-
* Talks to a
|
|
4
|
+
* Talks to a CodeExplorer MCP server to query the code graph.
|
|
5
5
|
* Currently operates in **stub mode** — all methods return empty/default
|
|
6
6
|
* results so the rest of the codebase can integrate without requiring
|
|
7
|
-
* a real
|
|
8
|
-
* in a follow-up once
|
|
7
|
+
* a real CodeExplorer installation. The real MCP transport will be wired
|
|
8
|
+
* in a follow-up once code-explorer is available.
|
|
9
9
|
*
|
|
10
|
-
* Tools exposed by
|
|
10
|
+
* Tools exposed by CodeExplorer MCP:
|
|
11
11
|
* - query — natural-language search over the code graph
|
|
12
12
|
* - context — symbol-level call/import graph + process membership
|
|
13
13
|
* - impact — blast-radius analysis (upstream/downstream)
|
|
@@ -21,32 +21,32 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { logger } from '../../utils/logger.js';
|
|
23
23
|
// ── Client ──────────────────────────────────────────────────────────
|
|
24
|
-
export class
|
|
24
|
+
export class CodeExplorerMCPClient {
|
|
25
25
|
repoName;
|
|
26
26
|
connected = false;
|
|
27
27
|
constructor(repoName) {
|
|
28
28
|
this.repoName = repoName;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Connect to the
|
|
31
|
+
* Connect to the CodeExplorer MCP server.
|
|
32
32
|
*
|
|
33
33
|
* In the real implementation this will use `@modelcontextprotocol/sdk`
|
|
34
34
|
* `StdioClientTransport` with:
|
|
35
35
|
* command: 'npx'
|
|
36
|
-
* args: ['-y', '
|
|
36
|
+
* args: ['-y', 'code-explorer@latest', 'mcp']
|
|
37
37
|
*
|
|
38
38
|
* For now this is a stub that marks the client as connected.
|
|
39
39
|
*/
|
|
40
40
|
async connect() {
|
|
41
41
|
this.connected = true;
|
|
42
|
-
logger.debug('
|
|
42
|
+
logger.debug('CodeExplorer MCP client connected (stub mode)', {
|
|
43
43
|
repo: this.repoName,
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
/** Disconnect from the MCP server. */
|
|
47
47
|
async disconnect() {
|
|
48
48
|
this.connected = false;
|
|
49
|
-
logger.debug('
|
|
49
|
+
logger.debug('CodeExplorer MCP client disconnected', {
|
|
50
50
|
repo: this.repoName,
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -65,7 +65,7 @@ export class GitNexusMCPClient {
|
|
|
65
65
|
*/
|
|
66
66
|
async query(q) {
|
|
67
67
|
this.assertConnected();
|
|
68
|
-
logger.debug('
|
|
68
|
+
logger.debug('CodeExplorer query', { query: q, repo: this.repoName });
|
|
69
69
|
// Stub: real impl calls callTool('query', { query: q, repo: this.repoName })
|
|
70
70
|
return { processes: [], definitions: [] };
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ export class GitNexusMCPClient {
|
|
|
75
75
|
*/
|
|
76
76
|
async context(symbolName) {
|
|
77
77
|
this.assertConnected();
|
|
78
|
-
logger.debug('
|
|
78
|
+
logger.debug('CodeExplorer context', { symbol: symbolName, repo: this.repoName });
|
|
79
79
|
return {
|
|
80
80
|
symbol: {
|
|
81
81
|
uid: symbolName,
|
|
@@ -96,7 +96,7 @@ export class GitNexusMCPClient {
|
|
|
96
96
|
*/
|
|
97
97
|
async impact(target, direction = 'upstream') {
|
|
98
98
|
this.assertConnected();
|
|
99
|
-
logger.debug('
|
|
99
|
+
logger.debug('CodeExplorer impact', { target, direction, repo: this.repoName });
|
|
100
100
|
return {
|
|
101
101
|
target,
|
|
102
102
|
affected: [],
|
|
@@ -105,11 +105,11 @@ export class GitNexusMCPClient {
|
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
/**
|
|
108
|
-
* Execute a raw Cypher query against the
|
|
108
|
+
* Execute a raw Cypher query against the CodeExplorer graph database.
|
|
109
109
|
*/
|
|
110
110
|
async cypher(query) {
|
|
111
111
|
this.assertConnected();
|
|
112
|
-
logger.debug('
|
|
112
|
+
logger.debug('CodeExplorer cypher', { query, repo: this.repoName });
|
|
113
113
|
return [];
|
|
114
114
|
}
|
|
115
115
|
// ── Resources ───────────────────────────────────────────────────
|
|
@@ -136,8 +136,8 @@ export class GitNexusMCPClient {
|
|
|
136
136
|
// ── Internal ────────────────────────────────────────────────────
|
|
137
137
|
assertConnected() {
|
|
138
138
|
if (!this.connected) {
|
|
139
|
-
throw new Error('
|
|
139
|
+
throw new Error('CodeExplorerMCPClient is not connected. Call connect() first.');
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
//# sourceMappingURL=
|
|
143
|
+
//# sourceMappingURL=CodeExplorerMCPClient.js.map
|
package/dist/plugins/{gitnexus/GitNexusManager.d.ts → code-explorer/CodeExplorerManager.d.ts}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CodeExplorer Manager
|
|
3
3
|
*
|
|
4
|
-
* Handles
|
|
5
|
-
*
|
|
4
|
+
* Handles CodeExplorer indexing, stats retrieval, and MCP server lifecycle.
|
|
5
|
+
* CodeExplorer provides code graph analysis (symbols, relations, processes, clusters)
|
|
6
6
|
* and exposes them via an MCP server for agent consumption.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* const mgr =
|
|
9
|
+
* const mgr = getCodeExplorerManager('/path/to/repo');
|
|
10
10
|
* if (mgr.isInstalled() && !mgr.isRepoIndexed()) {
|
|
11
11
|
* await mgr.analyze();
|
|
12
12
|
* }
|
|
13
13
|
* await mgr.startMCPServer();
|
|
14
14
|
*/
|
|
15
|
-
export interface
|
|
15
|
+
export interface CodeExplorerStats {
|
|
16
16
|
symbols: number;
|
|
17
17
|
relations: number;
|
|
18
18
|
processes: number;
|
|
@@ -20,18 +20,18 @@ export interface GitNexusStats {
|
|
|
20
20
|
indexed: boolean;
|
|
21
21
|
stale: boolean;
|
|
22
22
|
}
|
|
23
|
-
export declare class
|
|
23
|
+
export declare class CodeExplorerManager {
|
|
24
24
|
private repoPath;
|
|
25
25
|
private mcpProcess;
|
|
26
26
|
constructor(repoPath?: string);
|
|
27
|
-
/** Check whether the `
|
|
27
|
+
/** Check whether the `code-explorer` CLI is available on PATH. */
|
|
28
28
|
isInstalled(): boolean;
|
|
29
|
-
/** Check whether the repo has been indexed (`.
|
|
29
|
+
/** Check whether the repo has been indexed (`.codeexplorer/` directory exists). */
|
|
30
30
|
isRepoIndexed(): boolean;
|
|
31
31
|
/**
|
|
32
|
-
* Run `
|
|
32
|
+
* Run `code-explorer analyze` to index the repository.
|
|
33
33
|
*
|
|
34
|
-
* @param options.force - Re-index even if `.
|
|
34
|
+
* @param options.force - Re-index even if `.codeexplorer/` already exists.
|
|
35
35
|
* @param options.withSkills - Also generate skill annotations.
|
|
36
36
|
*/
|
|
37
37
|
analyze(options?: {
|
|
@@ -39,12 +39,12 @@ export declare class GitNexusManager {
|
|
|
39
39
|
withSkills?: boolean;
|
|
40
40
|
}): Promise<void>;
|
|
41
41
|
/**
|
|
42
|
-
* Read stats from `.
|
|
42
|
+
* Read stats from `.codeexplorer/meta.json`.
|
|
43
43
|
* Returns defaults if the index does not exist.
|
|
44
44
|
*/
|
|
45
|
-
getStats():
|
|
45
|
+
getStats(): CodeExplorerStats;
|
|
46
46
|
/**
|
|
47
|
-
* Start the
|
|
47
|
+
* Start the CodeExplorer MCP server as a child process (stdio transport).
|
|
48
48
|
* Only one server is kept alive per manager instance.
|
|
49
49
|
*/
|
|
50
50
|
startMCPServer(): Promise<void>;
|
|
@@ -58,9 +58,9 @@ export declare class GitNexusManager {
|
|
|
58
58
|
dispose(): void;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Get or create a singleton
|
|
61
|
+
* Get or create a singleton CodeExplorerManager for the given repo path.
|
|
62
62
|
* Defaults to `process.cwd()` if no path is provided.
|
|
63
63
|
*/
|
|
64
|
-
export declare function
|
|
64
|
+
export declare function getCodeExplorerManager(repoPath?: string): CodeExplorerManager;
|
|
65
65
|
/** Clear the singleton cache (for testing). */
|
|
66
|
-
export declare function
|
|
66
|
+
export declare function clearCodeExplorerManagerCache(): void;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CodeExplorer Manager
|
|
3
3
|
*
|
|
4
|
-
* Handles
|
|
5
|
-
*
|
|
4
|
+
* Handles CodeExplorer indexing, stats retrieval, and MCP server lifecycle.
|
|
5
|
+
* CodeExplorer provides code graph analysis (symbols, relations, processes, clusters)
|
|
6
6
|
* and exposes them via an MCP server for agent consumption.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* const mgr =
|
|
9
|
+
* const mgr = getCodeExplorerManager('/path/to/repo');
|
|
10
10
|
* if (mgr.isInstalled() && !mgr.isRepoIndexed()) {
|
|
11
11
|
* await mgr.analyze();
|
|
12
12
|
* }
|
|
@@ -26,16 +26,16 @@ const DEFAULT_STATS = {
|
|
|
26
26
|
};
|
|
27
27
|
/** Singleton cache keyed by resolved repo path */
|
|
28
28
|
const instances = new Map();
|
|
29
|
-
export class
|
|
29
|
+
export class CodeExplorerManager {
|
|
30
30
|
repoPath;
|
|
31
31
|
mcpProcess = null;
|
|
32
32
|
constructor(repoPath = process.cwd()) {
|
|
33
33
|
this.repoPath = path.resolve(repoPath);
|
|
34
34
|
}
|
|
35
|
-
/** Check whether the `
|
|
35
|
+
/** Check whether the `code-explorer` CLI is available on PATH. */
|
|
36
36
|
isInstalled() {
|
|
37
37
|
try {
|
|
38
|
-
execSync('
|
|
38
|
+
execSync('code-explorer --version', {
|
|
39
39
|
stdio: 'pipe',
|
|
40
40
|
timeout: 10_000,
|
|
41
41
|
cwd: this.repoPath,
|
|
@@ -46,25 +46,25 @@ export class GitNexusManager {
|
|
|
46
46
|
return false;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
/** Check whether the repo has been indexed (`.
|
|
49
|
+
/** Check whether the repo has been indexed (`.codeexplorer/` directory exists). */
|
|
50
50
|
isRepoIndexed() {
|
|
51
|
-
return fs.existsSync(path.join(this.repoPath, '.
|
|
51
|
+
return fs.existsSync(path.join(this.repoPath, '.codeexplorer'));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Run `
|
|
54
|
+
* Run `code-explorer analyze` to index the repository.
|
|
55
55
|
*
|
|
56
|
-
* @param options.force - Re-index even if `.
|
|
56
|
+
* @param options.force - Re-index even if `.codeexplorer/` already exists.
|
|
57
57
|
* @param options.withSkills - Also generate skill annotations.
|
|
58
58
|
*/
|
|
59
59
|
async analyze(options = {}) {
|
|
60
|
-
const args = ['
|
|
60
|
+
const args = ['analyze'];
|
|
61
61
|
if (options.force)
|
|
62
62
|
args.push('--force');
|
|
63
63
|
if (options.withSkills)
|
|
64
64
|
args.push('--with-skills');
|
|
65
|
-
logger.info(`
|
|
65
|
+
logger.info(`CodeExplorer: analyzing repo at ${this.repoPath}`, { args });
|
|
66
66
|
return new Promise((resolve, reject) => {
|
|
67
|
-
const child = spawn('
|
|
67
|
+
const child = spawn('code-explorer', args, {
|
|
68
68
|
cwd: this.repoPath,
|
|
69
69
|
stdio: 'pipe',
|
|
70
70
|
shell: true,
|
|
@@ -73,22 +73,22 @@ export class GitNexusManager {
|
|
|
73
73
|
child.stdout?.on('data', (chunk) => {
|
|
74
74
|
const line = chunk.toString().trim();
|
|
75
75
|
if (line)
|
|
76
|
-
logger.debug(`
|
|
76
|
+
logger.debug(`CodeExplorer analyze: ${line}`);
|
|
77
77
|
});
|
|
78
78
|
child.stderr?.on('data', (chunk) => {
|
|
79
79
|
stderr += chunk.toString();
|
|
80
80
|
});
|
|
81
81
|
child.on('error', (err) => {
|
|
82
|
-
logger.error('
|
|
83
|
-
reject(new Error(`
|
|
82
|
+
logger.error('CodeExplorer analyze failed to start', { error: err.message });
|
|
83
|
+
reject(new Error(`CodeExplorer analyze failed to start: ${err.message}`));
|
|
84
84
|
});
|
|
85
85
|
child.on('close', (code) => {
|
|
86
86
|
if (code === 0) {
|
|
87
|
-
logger.info('
|
|
87
|
+
logger.info('CodeExplorer: analysis complete');
|
|
88
88
|
resolve();
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
const msg = `
|
|
91
|
+
const msg = `CodeExplorer analyze exited with code ${code}: ${stderr.trim()}`;
|
|
92
92
|
logger.error(msg);
|
|
93
93
|
reject(new Error(msg));
|
|
94
94
|
}
|
|
@@ -96,11 +96,11 @@ export class GitNexusManager {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
99
|
-
* Read stats from `.
|
|
99
|
+
* Read stats from `.codeexplorer/meta.json`.
|
|
100
100
|
* Returns defaults if the index does not exist.
|
|
101
101
|
*/
|
|
102
102
|
getStats() {
|
|
103
|
-
const metaPath = path.join(this.repoPath, '.
|
|
103
|
+
const metaPath = path.join(this.repoPath, '.codeexplorer', 'meta.json');
|
|
104
104
|
if (!fs.existsSync(metaPath)) {
|
|
105
105
|
return { ...DEFAULT_STATS };
|
|
106
106
|
}
|
|
@@ -117,43 +117,43 @@ export class GitNexusManager {
|
|
|
117
117
|
};
|
|
118
118
|
}
|
|
119
119
|
catch (err) {
|
|
120
|
-
logger.warn('
|
|
120
|
+
logger.warn('CodeExplorer: failed to read meta.json', {
|
|
121
121
|
error: err instanceof Error ? err.message : String(err),
|
|
122
122
|
});
|
|
123
123
|
return { ...DEFAULT_STATS };
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
|
-
* Start the
|
|
127
|
+
* Start the CodeExplorer MCP server as a child process (stdio transport).
|
|
128
128
|
* Only one server is kept alive per manager instance.
|
|
129
129
|
*/
|
|
130
130
|
async startMCPServer() {
|
|
131
131
|
if (this.mcpProcess) {
|
|
132
|
-
logger.debug('
|
|
132
|
+
logger.debug('CodeExplorer MCP server already running');
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
logger.info('
|
|
136
|
-
this.mcpProcess = spawn('
|
|
135
|
+
logger.info('CodeExplorer: starting MCP server');
|
|
136
|
+
this.mcpProcess = spawn('code-explorer', ['mcp'], {
|
|
137
137
|
cwd: this.repoPath,
|
|
138
138
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
139
139
|
shell: true,
|
|
140
140
|
});
|
|
141
141
|
this.mcpProcess.on('error', (err) => {
|
|
142
|
-
logger.error('
|
|
142
|
+
logger.error('CodeExplorer MCP server error', { error: err.message });
|
|
143
143
|
this.mcpProcess = null;
|
|
144
144
|
});
|
|
145
145
|
this.mcpProcess.on('close', (code) => {
|
|
146
|
-
logger.debug(`
|
|
146
|
+
logger.debug(`CodeExplorer MCP server exited with code ${code}`);
|
|
147
147
|
this.mcpProcess = null;
|
|
148
148
|
});
|
|
149
149
|
// Give the server a moment to start
|
|
150
150
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
151
|
-
logger.info('
|
|
151
|
+
logger.info('CodeExplorer MCP server started');
|
|
152
152
|
}
|
|
153
153
|
/** Stop the MCP server if running. */
|
|
154
154
|
stopMCPServer() {
|
|
155
155
|
if (this.mcpProcess) {
|
|
156
|
-
logger.debug('
|
|
156
|
+
logger.debug('CodeExplorer: stopping MCP server');
|
|
157
157
|
this.mcpProcess.kill();
|
|
158
158
|
this.mcpProcess = null;
|
|
159
159
|
}
|
|
@@ -172,21 +172,21 @@ export class GitNexusManager {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* Get or create a singleton
|
|
175
|
+
* Get or create a singleton CodeExplorerManager for the given repo path.
|
|
176
176
|
* Defaults to `process.cwd()` if no path is provided.
|
|
177
177
|
*/
|
|
178
|
-
export function
|
|
178
|
+
export function getCodeExplorerManager(repoPath) {
|
|
179
179
|
const resolved = path.resolve(repoPath || process.cwd());
|
|
180
180
|
let manager = instances.get(resolved);
|
|
181
181
|
if (!manager) {
|
|
182
|
-
manager = new
|
|
182
|
+
manager = new CodeExplorerManager(resolved);
|
|
183
183
|
instances.set(resolved, manager);
|
|
184
184
|
}
|
|
185
185
|
return manager;
|
|
186
186
|
}
|
|
187
187
|
/** Clear the singleton cache (for testing). */
|
|
188
|
-
export function
|
|
188
|
+
export function clearCodeExplorerManagerCache() {
|
|
189
189
|
instances.forEach((mgr) => mgr.dispose());
|
|
190
190
|
instances.clear();
|
|
191
191
|
}
|
|
192
|
-
//# sourceMappingURL=
|
|
192
|
+
//# sourceMappingURL=CodeExplorerManager.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeExplorer Plugin — Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Code graph analysis via CodeExplorer MCP server integration.
|
|
5
|
+
*/
|
|
6
|
+
export { CodeExplorerManager, getCodeExplorerManager, clearCodeExplorerManagerCache, } from './CodeExplorerManager.js';
|
|
7
|
+
export { CodeExplorerMCPClient } from './CodeExplorerMCPClient.js';
|
|
8
|
+
export type { GNQueryResult, GNContextResult, GNImpactResult, GNCluster, GNProcess, } from './CodeExplorerMCPClient.js';
|
|
9
|
+
export type { CodeExplorerStats } from './CodeExplorerManager.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CodeExplorer Plugin — Barrel Export
|
|
3
|
+
*
|
|
4
|
+
* Code graph analysis via CodeExplorer MCP server integration.
|
|
5
|
+
*/
|
|
6
|
+
export { CodeExplorerManager, getCodeExplorerManager, clearCodeExplorerManagerCache, } from './CodeExplorerManager.js';
|
|
7
|
+
export { CodeExplorerMCPClient } from './CodeExplorerMCPClient.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -126,7 +126,29 @@ export const RUNTIME_PROVIDER_CATALOG = [
|
|
|
126
126
|
modelEnvKeys: ['MISTRAL_MODEL'],
|
|
127
127
|
defaultBaseURL: 'https://api.mistral.ai/v1',
|
|
128
128
|
defaultModel: 'mistral-large-latest',
|
|
129
|
-
models: [
|
|
129
|
+
models: [
|
|
130
|
+
'mistral-large-latest',
|
|
131
|
+
'mistral-medium-latest',
|
|
132
|
+
'mistral-small-latest',
|
|
133
|
+
'codestral-latest',
|
|
134
|
+
'devstral-latest',
|
|
135
|
+
'magistral-medium-latest',
|
|
136
|
+
'ministral-8b-latest',
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: 'deepseek',
|
|
141
|
+
label: 'DeepSeek',
|
|
142
|
+
authMode: 'api-key',
|
|
143
|
+
apiMode: 'openai-compatible',
|
|
144
|
+
runtimeSupport: 'direct',
|
|
145
|
+
priority: 72,
|
|
146
|
+
apiKeyEnvKeys: ['DEEPSEEK_API_KEY'],
|
|
147
|
+
baseUrlEnvKeys: ['DEEPSEEK_BASE_URL'],
|
|
148
|
+
modelEnvKeys: ['DEEPSEEK_MODEL'],
|
|
149
|
+
defaultBaseURL: 'https://api.deepseek.com/v1',
|
|
150
|
+
defaultModel: 'deepseek-chat',
|
|
151
|
+
models: ['deepseek-chat', 'deepseek-reasoner'],
|
|
130
152
|
},
|
|
131
153
|
{
|
|
132
154
|
id: 'groq',
|
|
@@ -355,7 +355,7 @@ export class PromptBuilder {
|
|
|
355
355
|
}
|
|
356
356
|
catch { /* rules module optional */ }
|
|
357
357
|
}
|
|
358
|
-
// Steer toward Code Explorer (
|
|
358
|
+
// Steer toward Code Explorer (code-explorer) when it is connected. Conditional:
|
|
359
359
|
// when Code Explorer is absent this injects nothing, so the built-in
|
|
360
360
|
// code_graph/codebase_map behaviour is unchanged. Presence is session-
|
|
361
361
|
// stable, so this stays in the cache-stable prefix.
|
|
@@ -364,17 +364,17 @@ export class PromptBuilder {
|
|
|
364
364
|
if (isCodeExplorerAvailable()) {
|
|
365
365
|
systemPrompt +=
|
|
366
366
|
`\n\n<code_explorer_priority>\n` +
|
|
367
|
-
`Code Explorer (
|
|
367
|
+
`Code Explorer (code-explorer) is connected. For ANY question about code relationships — ` +
|
|
368
368
|
`callers/callees, blast radius / impact ("what breaks if I change X"), dead code, cycles, ` +
|
|
369
|
-
`coupling, complexity — PREFER its MCP tools (\`
|
|
370
|
-
`\`
|
|
371
|
-
`over the built-in \`code_graph\` / \`codebase_map\`: the
|
|
369
|
+
`coupling, complexity — PREFER its MCP tools (\`mcp__code-explorer__impact\`, ` +
|
|
370
|
+
`\`mcp__code-explorer__context\`, \`mcp__code-explorer__query\`, \`mcp__code-explorer__find_cycles\`, …) ` +
|
|
371
|
+
`over the built-in \`code_graph\` / \`codebase_map\`: the code-explorer graph is broader and more ` +
|
|
372
372
|
`complete (whole-repo, 14 languages).\n` +
|
|
373
|
-
`Usage: first call \`
|
|
374
|
-
`\`
|
|
375
|
-
`optionally \`direction: "both"\`) and \`repo\` = that path; or \`
|
|
373
|
+
`Usage: first call \`mcp__code-explorer__list_repos\` once to get the repo \`path\`/\`id\`, then call ` +
|
|
374
|
+
`\`mcp__code-explorer__impact\` with the REQUIRED \`target\` = the symbol name (e.g. \`target: "executePlan"\`, ` +
|
|
375
|
+
`optionally \`direction: "both"\`) and \`repo\` = that path; or \`mcp__code-explorer__context\` with \`name\` = ` +
|
|
376
376
|
`the symbol. Always include \`target\`/\`name\` — never call these tools with empty arguments. ` +
|
|
377
|
-
`Use the built-in \`code_graph\`/\`codebase_map\` only as a fallback if a
|
|
377
|
+
`Use the built-in \`code_graph\`/\`codebase_map\` only as a fallback if a code-explorer tool errors.\n` +
|
|
378
378
|
`</code_explorer_priority>`;
|
|
379
379
|
logger.debug('Injected Code Explorer priority directive');
|
|
380
380
|
}
|
package/dist/skills/parser.js
CHANGED
|
@@ -57,7 +57,7 @@ function parseMetadata(yamlContent, sourcePath) {
|
|
|
57
57
|
// Parse allowed-tools (Standard compatibility)
|
|
58
58
|
let allowedTools = parsed['allowed-tools'];
|
|
59
59
|
if (typeof allowedTools === 'string') {
|
|
60
|
-
// Native Engine uses comma separated values like: Bash(
|
|
60
|
+
// Native Engine uses comma separated values like: Bash(code-explorer *), Read, Grep, Glob
|
|
61
61
|
const toolsList = allowedTools.split(',').map(t => t.trim());
|
|
62
62
|
const mappedTools = [];
|
|
63
63
|
for (const t of toolsList) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* CodeExplorer Tool Client
|
|
3
3
|
*
|
|
4
|
-
* Consultative, read-only interface to
|
|
4
|
+
* Consultative, read-only interface to CodeExplorer endpoints (/ask, /push-session, /world-model).
|
|
5
5
|
* Degrades gracefully by returning empty contexts/invariants and detailed notes on timeout/offline.
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface CodeExplorerConfig {
|
|
8
8
|
endpoint?: string;
|
|
9
9
|
apiKey?: string;
|
|
10
10
|
timeoutMs?: number;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface CodeExplorerContext {
|
|
13
13
|
likelyFiles: string[];
|
|
14
14
|
dependentSymbols: string[];
|
|
15
15
|
testsToWatch: string[];
|
|
@@ -19,21 +19,21 @@ export interface WorldModelInvariants {
|
|
|
19
19
|
architecture: string[];
|
|
20
20
|
invariants: string[];
|
|
21
21
|
}
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class CodeExplorerTool {
|
|
23
23
|
private endpoint;
|
|
24
24
|
private apiKey;
|
|
25
25
|
private timeoutMs;
|
|
26
|
-
constructor(config?:
|
|
26
|
+
constructor(config?: CodeExplorerConfig);
|
|
27
27
|
/**
|
|
28
28
|
* Helper to perform HTTP request with timeout and headers.
|
|
29
29
|
*/
|
|
30
30
|
private request;
|
|
31
31
|
/**
|
|
32
|
-
* Lecture seule : interroge
|
|
32
|
+
* Lecture seule : interroge CodeExplorer pour une tâche/texte. Dégrade proprement si indisponible.
|
|
33
33
|
*/
|
|
34
|
-
ask(query: string): Promise<
|
|
34
|
+
ask(query: string): Promise<CodeExplorerContext>;
|
|
35
35
|
/**
|
|
36
|
-
* Pousse le résumé de session vers
|
|
36
|
+
* Pousse le résumé de session vers CodeExplorer (mémoire technique).
|
|
37
37
|
*/
|
|
38
38
|
pushSession(summary: string): Promise<{
|
|
39
39
|
ok: boolean;
|