opencode-autognosis 0.1.2 → 0.1.3
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.d.ts +1 -312
- package/dist/index.js +77 -32
- package/gemini-extension.json +12 -0
- package/package.json +8 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,312 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
tools: {
|
|
3
|
-
"/autognosis_init": {
|
|
4
|
-
name: string;
|
|
5
|
-
description: string;
|
|
6
|
-
parameters: {
|
|
7
|
-
type: string;
|
|
8
|
-
properties: {
|
|
9
|
-
mode: {
|
|
10
|
-
type: string;
|
|
11
|
-
enum: string[];
|
|
12
|
-
default: string;
|
|
13
|
-
};
|
|
14
|
-
token: {
|
|
15
|
-
type: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
required: string[];
|
|
19
|
-
};
|
|
20
|
-
execute: (args: any) => Promise<string | undefined>;
|
|
21
|
-
};
|
|
22
|
-
autognosis_init: {
|
|
23
|
-
description: string;
|
|
24
|
-
parameters: {
|
|
25
|
-
type: string;
|
|
26
|
-
properties: {
|
|
27
|
-
mode: {
|
|
28
|
-
type: string;
|
|
29
|
-
enum: string[];
|
|
30
|
-
default: string;
|
|
31
|
-
};
|
|
32
|
-
token: {
|
|
33
|
-
type: string;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
required: string[];
|
|
37
|
-
};
|
|
38
|
-
execute: ({ mode, token }: {
|
|
39
|
-
mode: string;
|
|
40
|
-
token?: string;
|
|
41
|
-
}) => Promise<string | undefined>;
|
|
42
|
-
};
|
|
43
|
-
fast_search: {
|
|
44
|
-
description: string;
|
|
45
|
-
parameters: {
|
|
46
|
-
type: string;
|
|
47
|
-
properties: {
|
|
48
|
-
query: {
|
|
49
|
-
type: string;
|
|
50
|
-
};
|
|
51
|
-
mode: {
|
|
52
|
-
type: string;
|
|
53
|
-
enum: string[];
|
|
54
|
-
default: string;
|
|
55
|
-
};
|
|
56
|
-
path: {
|
|
57
|
-
type: string;
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
required: string[];
|
|
61
|
-
};
|
|
62
|
-
execute: ({ query, mode, path: searchPath }: {
|
|
63
|
-
query: string;
|
|
64
|
-
mode?: string;
|
|
65
|
-
path?: string;
|
|
66
|
-
}) => Promise<string>;
|
|
67
|
-
};
|
|
68
|
-
structural_search: {
|
|
69
|
-
description: string;
|
|
70
|
-
parameters: {
|
|
71
|
-
type: string;
|
|
72
|
-
properties: {
|
|
73
|
-
pattern: {
|
|
74
|
-
type: string;
|
|
75
|
-
};
|
|
76
|
-
path: {
|
|
77
|
-
type: string;
|
|
78
|
-
default: string;
|
|
79
|
-
};
|
|
80
|
-
plan_id: {
|
|
81
|
-
type: string;
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
required: string[];
|
|
85
|
-
};
|
|
86
|
-
execute: ({ pattern, path: searchPath, plan_id }: {
|
|
87
|
-
pattern: string;
|
|
88
|
-
path?: string;
|
|
89
|
-
plan_id?: string;
|
|
90
|
-
}) => Promise<string>;
|
|
91
|
-
};
|
|
92
|
-
read_slice: {
|
|
93
|
-
description: string;
|
|
94
|
-
parameters: {
|
|
95
|
-
type: string;
|
|
96
|
-
properties: {
|
|
97
|
-
file: {
|
|
98
|
-
type: string;
|
|
99
|
-
};
|
|
100
|
-
start_line: {
|
|
101
|
-
type: string;
|
|
102
|
-
};
|
|
103
|
-
end_line: {
|
|
104
|
-
type: string;
|
|
105
|
-
};
|
|
106
|
-
plan_id: {
|
|
107
|
-
type: string;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
required: string[];
|
|
111
|
-
};
|
|
112
|
-
execute: ({ file, start_line, end_line, plan_id }: {
|
|
113
|
-
file: string;
|
|
114
|
-
start_line: number;
|
|
115
|
-
end_line: number;
|
|
116
|
-
plan_id?: string;
|
|
117
|
-
}) => Promise<string>;
|
|
118
|
-
};
|
|
119
|
-
symbol_query: {
|
|
120
|
-
description: string;
|
|
121
|
-
parameters: {
|
|
122
|
-
type: string;
|
|
123
|
-
properties: {
|
|
124
|
-
symbol: {
|
|
125
|
-
type: string;
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
required: string[];
|
|
129
|
-
};
|
|
130
|
-
execute: ({ symbol }: {
|
|
131
|
-
symbol: string;
|
|
132
|
-
}) => Promise<string>;
|
|
133
|
-
};
|
|
134
|
-
jump_to_symbol: {
|
|
135
|
-
description: string;
|
|
136
|
-
parameters: {
|
|
137
|
-
type: string;
|
|
138
|
-
properties: {
|
|
139
|
-
symbol: {
|
|
140
|
-
type: string;
|
|
141
|
-
};
|
|
142
|
-
plan_id: {
|
|
143
|
-
type: string;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
required: string[];
|
|
147
|
-
};
|
|
148
|
-
execute: ({ symbol, plan_id }: {
|
|
149
|
-
symbol: string;
|
|
150
|
-
plan_id?: string;
|
|
151
|
-
}) => Promise<string>;
|
|
152
|
-
};
|
|
153
|
-
brief_fix_loop: {
|
|
154
|
-
description: string;
|
|
155
|
-
parameters: {
|
|
156
|
-
type: string;
|
|
157
|
-
properties: {
|
|
158
|
-
symbol: {
|
|
159
|
-
type: string;
|
|
160
|
-
};
|
|
161
|
-
intent: {
|
|
162
|
-
type: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
required: string[];
|
|
166
|
-
};
|
|
167
|
-
execute: ({ symbol, intent }: {
|
|
168
|
-
symbol: string;
|
|
169
|
-
intent: string;
|
|
170
|
-
}) => Promise<string>;
|
|
171
|
-
};
|
|
172
|
-
prepare_patch: {
|
|
173
|
-
description: string;
|
|
174
|
-
parameters: {
|
|
175
|
-
type: string;
|
|
176
|
-
properties: {
|
|
177
|
-
plan_id: {
|
|
178
|
-
type: string;
|
|
179
|
-
};
|
|
180
|
-
message: {
|
|
181
|
-
type: string;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
required: string[];
|
|
185
|
-
};
|
|
186
|
-
execute: ({ plan_id, message }: {
|
|
187
|
-
plan_id?: string;
|
|
188
|
-
message: string;
|
|
189
|
-
}) => Promise<string>;
|
|
190
|
-
};
|
|
191
|
-
validate_patch: {
|
|
192
|
-
description: string;
|
|
193
|
-
parameters: {
|
|
194
|
-
type: string;
|
|
195
|
-
properties: {
|
|
196
|
-
patch_path: {
|
|
197
|
-
type: string;
|
|
198
|
-
};
|
|
199
|
-
timeout_ms: {
|
|
200
|
-
type: string;
|
|
201
|
-
default: number;
|
|
202
|
-
};
|
|
203
|
-
};
|
|
204
|
-
required: string[];
|
|
205
|
-
};
|
|
206
|
-
execute: ({ patch_path, timeout_ms }: {
|
|
207
|
-
patch_path: string;
|
|
208
|
-
timeout_ms?: number;
|
|
209
|
-
}) => Promise<string>;
|
|
210
|
-
};
|
|
211
|
-
finalize_plan: {
|
|
212
|
-
description: string;
|
|
213
|
-
parameters: {
|
|
214
|
-
type: string;
|
|
215
|
-
properties: {
|
|
216
|
-
plan_id: {
|
|
217
|
-
type: string;
|
|
218
|
-
};
|
|
219
|
-
outcome: {
|
|
220
|
-
type: string;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
required: string[];
|
|
224
|
-
};
|
|
225
|
-
execute: ({ plan_id, outcome }: {
|
|
226
|
-
plan_id: string;
|
|
227
|
-
outcome: string;
|
|
228
|
-
}) => Promise<string>;
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
commands: {
|
|
232
|
-
autognosis_init: {
|
|
233
|
-
name: string;
|
|
234
|
-
description: string;
|
|
235
|
-
parameters: {
|
|
236
|
-
type: string;
|
|
237
|
-
properties: {
|
|
238
|
-
mode: {
|
|
239
|
-
type: string;
|
|
240
|
-
enum: string[];
|
|
241
|
-
default: string;
|
|
242
|
-
};
|
|
243
|
-
token: {
|
|
244
|
-
type: string;
|
|
245
|
-
};
|
|
246
|
-
};
|
|
247
|
-
required: string[];
|
|
248
|
-
};
|
|
249
|
-
execute: (args: any) => Promise<string | undefined>;
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
slashCommands: {
|
|
253
|
-
name: string;
|
|
254
|
-
description: string;
|
|
255
|
-
parameters: {
|
|
256
|
-
type: string;
|
|
257
|
-
properties: {
|
|
258
|
-
mode: {
|
|
259
|
-
type: string;
|
|
260
|
-
enum: string[];
|
|
261
|
-
default: string;
|
|
262
|
-
};
|
|
263
|
-
token: {
|
|
264
|
-
type: string;
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
required: string[];
|
|
268
|
-
};
|
|
269
|
-
execute: (args: any) => Promise<string | undefined>;
|
|
270
|
-
}[];
|
|
271
|
-
chatCommands: {
|
|
272
|
-
autognosis_init: {
|
|
273
|
-
name: string;
|
|
274
|
-
description: string;
|
|
275
|
-
parameters: {
|
|
276
|
-
type: string;
|
|
277
|
-
properties: {
|
|
278
|
-
mode: {
|
|
279
|
-
type: string;
|
|
280
|
-
enum: string[];
|
|
281
|
-
default: string;
|
|
282
|
-
};
|
|
283
|
-
token: {
|
|
284
|
-
type: string;
|
|
285
|
-
};
|
|
286
|
-
};
|
|
287
|
-
required: string[];
|
|
288
|
-
};
|
|
289
|
-
execute: (args: any) => Promise<string | undefined>;
|
|
290
|
-
};
|
|
291
|
-
};
|
|
292
|
-
intentions: {
|
|
293
|
-
intent: string;
|
|
294
|
-
name: string;
|
|
295
|
-
description: string;
|
|
296
|
-
parameters: {
|
|
297
|
-
type: string;
|
|
298
|
-
properties: {
|
|
299
|
-
mode: {
|
|
300
|
-
type: string;
|
|
301
|
-
enum: string[];
|
|
302
|
-
default: string;
|
|
303
|
-
};
|
|
304
|
-
token: {
|
|
305
|
-
type: string;
|
|
306
|
-
};
|
|
307
|
-
};
|
|
308
|
-
required: string[];
|
|
309
|
-
};
|
|
310
|
-
execute: (args: any) => Promise<string | undefined>;
|
|
311
|
-
}[];
|
|
312
|
-
};
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,82 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { z } from "zod";
|
|
1
4
|
import { systemTools } from "./system-tools.js";
|
|
2
|
-
|
|
5
|
+
async function main() {
|
|
6
|
+
const server = new McpServer({
|
|
7
|
+
name: "opencode-autognosis",
|
|
8
|
+
version: "0.1.3",
|
|
9
|
+
});
|
|
3
10
|
const tools = systemTools();
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
autognosis_init: initMetadata
|
|
22
|
-
},
|
|
23
|
-
// Pattern 2: Array-based commands
|
|
24
|
-
slashCommands: [initMetadata],
|
|
25
|
-
// Pattern 3: Chat-specific commands
|
|
26
|
-
chatCommands: {
|
|
27
|
-
autognosis_init: initMetadata
|
|
28
|
-
},
|
|
29
|
-
// Pattern 4: Intentions (common in some agent frameworks)
|
|
30
|
-
intentions: [
|
|
31
|
-
{
|
|
32
|
-
...initMetadata,
|
|
33
|
-
intent: "initialize_autognosis"
|
|
11
|
+
// Helper to wrap our existing tool execution into MCP format
|
|
12
|
+
const wrapTool = (toolName, zodSchema) => {
|
|
13
|
+
server.registerTool(toolName, {
|
|
14
|
+
description: tools[toolName].description,
|
|
15
|
+
inputSchema: zodSchema,
|
|
16
|
+
}, async (args) => {
|
|
17
|
+
try {
|
|
18
|
+
const result = await tools[toolName].execute(args);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: typeof result === 'string' ? result : JSON.stringify(result, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
34
28
|
}
|
|
35
|
-
|
|
29
|
+
});
|
|
36
30
|
};
|
|
31
|
+
// Register tools with proper Zod schemas
|
|
32
|
+
wrapTool("autognosis_init", z.object({
|
|
33
|
+
mode: z.enum(["plan", "apply"]).optional().default("plan"),
|
|
34
|
+
token: z.string().optional()
|
|
35
|
+
}).shape);
|
|
36
|
+
wrapTool("fast_search", z.object({
|
|
37
|
+
query: z.string(),
|
|
38
|
+
mode: z.enum(["filename", "content"]).optional().default("filename"),
|
|
39
|
+
path: z.string().optional()
|
|
40
|
+
}).shape);
|
|
41
|
+
wrapTool("structural_search", z.object({
|
|
42
|
+
pattern: z.string(),
|
|
43
|
+
path: z.string().optional(),
|
|
44
|
+
plan_id: z.string().optional()
|
|
45
|
+
}).shape);
|
|
46
|
+
wrapTool("read_slice", z.object({
|
|
47
|
+
file: z.string(),
|
|
48
|
+
start_line: z.number(),
|
|
49
|
+
end_line: z.number(),
|
|
50
|
+
plan_id: z.string().optional()
|
|
51
|
+
}).shape);
|
|
52
|
+
wrapTool("symbol_query", z.object({
|
|
53
|
+
symbol: z.string()
|
|
54
|
+
}).shape);
|
|
55
|
+
wrapTool("jump_to_symbol", z.object({
|
|
56
|
+
symbol: z.string(),
|
|
57
|
+
plan_id: z.string().optional()
|
|
58
|
+
}).shape);
|
|
59
|
+
wrapTool("brief_fix_loop", z.object({
|
|
60
|
+
symbol: z.string(),
|
|
61
|
+
intent: z.string()
|
|
62
|
+
}).shape);
|
|
63
|
+
wrapTool("prepare_patch", z.object({
|
|
64
|
+
plan_id: z.string().optional(),
|
|
65
|
+
message: z.string()
|
|
66
|
+
}).shape);
|
|
67
|
+
wrapTool("validate_patch", z.object({
|
|
68
|
+
patch_path: z.string(),
|
|
69
|
+
timeout_ms: z.number().optional()
|
|
70
|
+
}).shape);
|
|
71
|
+
wrapTool("finalize_plan", z.object({
|
|
72
|
+
plan_id: z.string(),
|
|
73
|
+
outcome: z.string()
|
|
74
|
+
}).shape);
|
|
75
|
+
const transport = new StdioServerTransport();
|
|
76
|
+
await server.connect(transport);
|
|
77
|
+
console.error("Autognosis MCP Server running on stdio");
|
|
37
78
|
}
|
|
79
|
+
main().catch((error) => {
|
|
80
|
+
console.error("Fatal error in main():", error);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-autognosis",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Autognosis extension for Gemini CLI",
|
|
5
|
+
"mcpServers": {
|
|
6
|
+
"autognosis": {
|
|
7
|
+
"command": "node",
|
|
8
|
+
"args": ["${extensionPath}/dist/index.js"],
|
|
9
|
+
"cwd": "${extensionPath}"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-autognosis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Transforms OpenCode agents into 'miniature engineers' with deep codebase awareness. Includes fast structural search (ast-grep), instant symbol navigation (ctags), and a disciplined 'Plan → Execute → Patch' workflow.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -11,14 +11,19 @@
|
|
|
11
11
|
"dist",
|
|
12
12
|
"assets",
|
|
13
13
|
"LICENSE",
|
|
14
|
-
"README.md"
|
|
14
|
+
"README.md",
|
|
15
|
+
"gemini-extension.json"
|
|
15
16
|
],
|
|
16
17
|
"scripts": {
|
|
17
18
|
"build": "tsc -p tsconfig.json",
|
|
18
19
|
"prepublishOnly": "npm run build"
|
|
19
20
|
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
23
|
+
"zod": "^3.0.0"
|
|
24
|
+
},
|
|
20
25
|
"devDependencies": {
|
|
21
|
-
"@types/node": "^
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
22
27
|
"typescript": "^5.0.0"
|
|
23
28
|
}
|
|
24
29
|
}
|