opencode-autognosis 0.1.4 → 0.1.5
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/commands/autognosis/init.toml +13 -0
- package/dist/index.d.ts +1 -15
- package/dist/index.js +75 -25
- package/package.json +2 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
description = "Initialize or check the Autognosis environment"
|
|
2
|
+
|
|
3
|
+
# The command executes the tool via the agent
|
|
4
|
+
# Or it can just be a prompt that calls the tool
|
|
5
|
+
prompt = """
|
|
6
|
+
Please run the autognosis_init tool with the following arguments:
|
|
7
|
+
mode = "{{mode}}"
|
|
8
|
+
token = "{{token}}"
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
[parameters]
|
|
12
|
+
mode = { type = "string", description = "The mode to run in (plan or apply)", default = "plan" }
|
|
13
|
+
token = { type = "string", description = "The confirmation token for apply mode" }
|
package/dist/index.d.ts
CHANGED
|
@@ -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
|
-
};
|
|
1
|
+
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,80 @@
|
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
async function main() {
|
|
6
|
+
const server = new McpServer({
|
|
7
|
+
name: "opencode-autognosis",
|
|
8
|
+
version: "0.1.5",
|
|
9
|
+
});
|
|
6
10
|
const tools = systemTools();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
description:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
|
11
|
+
const register = (toolName, zodSchema) => {
|
|
12
|
+
const toolDef = tools[toolName];
|
|
13
|
+
server.registerTool(toolName, {
|
|
14
|
+
description: toolDef.description,
|
|
15
|
+
inputSchema: zodSchema,
|
|
16
|
+
}, async (args) => {
|
|
17
|
+
try {
|
|
18
|
+
const result = await toolDef.execute(args);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: typeof result === 'string' ? result : JSON.stringify(result, null, 2) }],
|
|
21
|
+
};
|
|
27
22
|
}
|
|
28
|
-
|
|
23
|
+
catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: `Error: ${error.message}` }],
|
|
26
|
+
isError: true,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
});
|
|
29
30
|
};
|
|
31
|
+
register("fast_search", z.object({
|
|
32
|
+
query: z.string(),
|
|
33
|
+
mode: z.enum(["filename", "content"]).optional().default("filename"),
|
|
34
|
+
path: z.string().optional().default(".")
|
|
35
|
+
}).shape);
|
|
36
|
+
register("structural_search", z.object({
|
|
37
|
+
pattern: z.string(),
|
|
38
|
+
path: z.string().optional().default("."),
|
|
39
|
+
plan_id: z.string().optional()
|
|
40
|
+
}).shape);
|
|
41
|
+
register("read_slice", z.object({
|
|
42
|
+
file: z.string(),
|
|
43
|
+
start_line: z.number(),
|
|
44
|
+
end_line: z.number(),
|
|
45
|
+
plan_id: z.string().optional()
|
|
46
|
+
}).shape);
|
|
47
|
+
register("symbol_query", z.object({
|
|
48
|
+
symbol: z.string()
|
|
49
|
+
}).shape);
|
|
50
|
+
register("jump_to_symbol", z.object({
|
|
51
|
+
symbol: z.string(),
|
|
52
|
+
plan_id: z.string().optional()
|
|
53
|
+
}).shape);
|
|
54
|
+
register("autognosis_init", z.object({
|
|
55
|
+
mode: z.enum(["plan", "apply"]).optional().default("plan"),
|
|
56
|
+
token: z.string().optional()
|
|
57
|
+
}).shape);
|
|
58
|
+
register("brief_fix_loop", z.object({
|
|
59
|
+
symbol: z.string(),
|
|
60
|
+
intent: z.string()
|
|
61
|
+
}).shape);
|
|
62
|
+
register("prepare_patch", z.object({
|
|
63
|
+
plan_id: z.string().optional(),
|
|
64
|
+
message: z.string()
|
|
65
|
+
}).shape);
|
|
66
|
+
register("validate_patch", z.object({
|
|
67
|
+
patch_path: z.string(),
|
|
68
|
+
timeout_ms: z.number().optional().default(30000)
|
|
69
|
+
}).shape);
|
|
70
|
+
register("finalize_plan", z.object({
|
|
71
|
+
plan_id: z.string(),
|
|
72
|
+
outcome: z.string()
|
|
73
|
+
}).shape);
|
|
74
|
+
const transport = new StdioServerTransport();
|
|
75
|
+
await server.connect(transport);
|
|
30
76
|
}
|
|
77
|
+
main().catch((error) => {
|
|
78
|
+
console.error("Fatal error in Autognosis MCP Server:", error);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-autognosis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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": {
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"assets",
|
|
13
|
+
"commands",
|
|
13
14
|
"LICENSE",
|
|
14
15
|
"README.md",
|
|
15
16
|
"gemini-extension.json"
|