opencode-autognosis 0.1.1 → 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 CHANGED
@@ -1,241 +1 @@
1
- export default function plugin(): {
2
- tools: {
3
- "/autognosis_init": {
4
- execute: (args: any) => Promise<string | undefined>;
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
- };
21
- autognosis_init: {
22
- description: string;
23
- parameters: {
24
- type: string;
25
- properties: {
26
- mode: {
27
- type: string;
28
- enum: string[];
29
- default: string;
30
- };
31
- token: {
32
- type: string;
33
- };
34
- };
35
- required: string[];
36
- };
37
- execute: ({ mode, token }: {
38
- mode: string;
39
- token?: string;
40
- }) => Promise<string | undefined>;
41
- };
42
- fast_search: {
43
- description: string;
44
- parameters: {
45
- type: string;
46
- properties: {
47
- query: {
48
- type: string;
49
- };
50
- mode: {
51
- type: string;
52
- enum: string[];
53
- default: string;
54
- };
55
- path: {
56
- type: string;
57
- };
58
- };
59
- required: string[];
60
- };
61
- execute: ({ query, mode, path: searchPath }: {
62
- query: string;
63
- mode?: string;
64
- path?: string;
65
- }) => Promise<string>;
66
- };
67
- structural_search: {
68
- description: string;
69
- parameters: {
70
- type: string;
71
- properties: {
72
- pattern: {
73
- type: string;
74
- };
75
- path: {
76
- type: string;
77
- default: string;
78
- };
79
- plan_id: {
80
- type: string;
81
- };
82
- };
83
- required: string[];
84
- };
85
- execute: ({ pattern, path: searchPath, plan_id }: {
86
- pattern: string;
87
- path?: string;
88
- plan_id?: string;
89
- }) => Promise<string>;
90
- };
91
- read_slice: {
92
- description: string;
93
- parameters: {
94
- type: string;
95
- properties: {
96
- file: {
97
- type: string;
98
- };
99
- start_line: {
100
- type: string;
101
- };
102
- end_line: {
103
- type: string;
104
- };
105
- plan_id: {
106
- type: string;
107
- };
108
- };
109
- required: string[];
110
- };
111
- execute: ({ file, start_line, end_line, plan_id }: {
112
- file: string;
113
- start_line: number;
114
- end_line: number;
115
- plan_id?: string;
116
- }) => Promise<string>;
117
- };
118
- symbol_query: {
119
- description: string;
120
- parameters: {
121
- type: string;
122
- properties: {
123
- symbol: {
124
- type: string;
125
- };
126
- };
127
- required: string[];
128
- };
129
- execute: ({ symbol }: {
130
- symbol: string;
131
- }) => Promise<string>;
132
- };
133
- jump_to_symbol: {
134
- description: string;
135
- parameters: {
136
- type: string;
137
- properties: {
138
- symbol: {
139
- type: string;
140
- };
141
- plan_id: {
142
- type: string;
143
- };
144
- };
145
- required: string[];
146
- };
147
- execute: ({ symbol, plan_id }: {
148
- symbol: string;
149
- plan_id?: string;
150
- }) => Promise<string>;
151
- };
152
- brief_fix_loop: {
153
- description: string;
154
- parameters: {
155
- type: string;
156
- properties: {
157
- symbol: {
158
- type: string;
159
- };
160
- intent: {
161
- type: string;
162
- };
163
- };
164
- required: string[];
165
- };
166
- execute: ({ symbol, intent }: {
167
- symbol: string;
168
- intent: string;
169
- }) => Promise<string>;
170
- };
171
- prepare_patch: {
172
- description: string;
173
- parameters: {
174
- type: string;
175
- properties: {
176
- plan_id: {
177
- type: string;
178
- };
179
- message: {
180
- type: string;
181
- };
182
- };
183
- required: string[];
184
- };
185
- execute: ({ plan_id, message }: {
186
- plan_id?: string;
187
- message: string;
188
- }) => Promise<string>;
189
- };
190
- validate_patch: {
191
- description: string;
192
- parameters: {
193
- type: string;
194
- properties: {
195
- patch_path: {
196
- type: string;
197
- };
198
- timeout_ms: {
199
- type: string;
200
- default: number;
201
- };
202
- };
203
- required: string[];
204
- };
205
- execute: ({ patch_path, timeout_ms }: {
206
- patch_path: string;
207
- timeout_ms?: number;
208
- }) => Promise<string>;
209
- };
210
- finalize_plan: {
211
- description: string;
212
- parameters: {
213
- type: string;
214
- properties: {
215
- plan_id: {
216
- type: string;
217
- };
218
- outcome: {
219
- type: string;
220
- };
221
- };
222
- required: string[];
223
- };
224
- execute: ({ plan_id, outcome }: {
225
- plan_id: string;
226
- outcome: string;
227
- }) => Promise<string>;
228
- };
229
- };
230
- commands: {
231
- autognosis_init: {
232
- description: string;
233
- execute: (args: any) => Promise<string | undefined>;
234
- };
235
- };
236
- slashCommands: {
237
- name: string;
238
- description: string;
239
- execute: (args: any) => Promise<string | undefined>;
240
- }[];
241
- };
1
+ export {};
package/dist/index.js CHANGED
@@ -1,31 +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
- export default function plugin() {
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
- const initExecutor = async (args) => {
5
- return await tools.autognosis_init.execute(args || {});
6
- };
7
- return {
8
- tools: {
9
- ...tools,
10
- // Some versions might look for tools with slashes
11
- "/autognosis_init": {
12
- ...tools.autognosis_init,
13
- execute: initExecutor
14
- }
15
- },
16
- // Common keys for slash command registration
17
- commands: {
18
- autognosis_init: {
19
- description: "Initialize or check the Autognosis environment",
20
- execute: initExecutor
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
+ };
21
22
  }
22
- },
23
- slashCommands: [
24
- {
25
- name: "autognosis_init",
26
- description: "Initialize or check the Autognosis environment",
27
- execute: initExecutor
23
+ catch (error) {
24
+ return {
25
+ content: [{ type: "text", text: `Error: ${error.message}` }],
26
+ isError: true,
27
+ };
28
28
  }
29
- ]
29
+ });
30
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");
31
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.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": "^25.1.0",
26
+ "@types/node": "^20.0.0",
22
27
  "typescript": "^5.0.0"
23
28
  }
24
29
  }