opencode-autognosis 0.1.3 → 0.1.4
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 +15 -1
- package/dist/index.js +25 -77
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode Plugin Entry Point
|
|
3
|
+
*/
|
|
4
|
+
export default function plugin(): {
|
|
5
|
+
tools: any;
|
|
6
|
+
commands: any;
|
|
7
|
+
slashCommands: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
execute: ({ mode, token }: {
|
|
11
|
+
mode: string;
|
|
12
|
+
token?: string;
|
|
13
|
+
}) => Promise<string | undefined>;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,30 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
1
|
import { systemTools } from "./system-tools.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
2
|
+
/**
|
|
3
|
+
* OpenCode Plugin Entry Point
|
|
4
|
+
*/
|
|
5
|
+
export default function plugin() {
|
|
10
6
|
const tools = systemTools();
|
|
11
|
-
//
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
description:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
// Map our internal tool definitions to the format OpenCode expects
|
|
8
|
+
const opencodeTools = Object.entries(tools).reduce((acc, [name, tool]) => {
|
|
9
|
+
acc[name] = {
|
|
10
|
+
description: tool.description,
|
|
11
|
+
parameters: tool.parameters,
|
|
12
|
+
execute: tool.execute,
|
|
13
|
+
};
|
|
14
|
+
return acc;
|
|
15
|
+
}, {});
|
|
16
|
+
return {
|
|
17
|
+
// This is the primary key OpenCode looks for to register custom tools
|
|
18
|
+
tools: opencodeTools,
|
|
19
|
+
// Fallback/Slash command support
|
|
20
|
+
commands: opencodeTools,
|
|
21
|
+
// Explicit slash command registration for /autognosis_init
|
|
22
|
+
slashCommands: [
|
|
23
|
+
{
|
|
24
|
+
name: "autognosis_init",
|
|
25
|
+
description: "Initialize or check the Autognosis environment",
|
|
26
|
+
execute: tools.autognosis_init.execute
|
|
22
27
|
}
|
|
23
|
-
|
|
24
|
-
return {
|
|
25
|
-
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
26
|
-
isError: true,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
});
|
|
28
|
+
]
|
|
30
29
|
};
|
|
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");
|
|
78
30
|
}
|
|
79
|
-
main().catch((error) => {
|
|
80
|
-
console.error("Fatal error in main():", error);
|
|
81
|
-
process.exit(1);
|
|
82
|
-
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-autognosis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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": {
|