a template starter repo for sveltekit projects
0

Configure Feed

Select the types of activity you want to include in your feed.

suede / .opencode / tools / deciduous.ts
1.1 kB 39 lines
1// OpenCode Custom Tool: Deciduous Decision Graph 2// Wraps the deciduous CLI for direct graph operations from OpenCode 3// 4// This tool allows agents to interact with the decision graph without 5// needing to use the bash tool directly. 6 7import { tool } from '@opencode-ai/plugin'; 8 9export default tool({ 10 description: 11 'Manage the deciduous decision graph - add nodes, create edges, query the graph, and sync', 12 args: { 13 command: tool.schema 14 .string() 15 .describe( 16 'The deciduous subcommand and arguments to run. Examples: ' + 17 '\'add goal "Title" -c 90\', ' + 18 '\'link 1 2 -r "reason"\', ' + 19 "'nodes', 'edges', 'graph', 'pulse', 'sync'" 20 ) 21 }, 22 async execute(args, context) { 23 const proc = Bun.spawn(['sh', '-c', `deciduous ${args.command}`], { 24 cwd: context.directory, 25 stdout: 'pipe', 26 stderr: 'pipe' 27 }); 28 29 const stdout = await new Response(proc.stdout).text(); 30 const stderr = await new Response(proc.stderr).text(); 31 const exitCode = await proc.exited; 32 33 if (exitCode !== 0) { 34 return `Error (exit ${exitCode}):\n${stderr}\n${stdout}`; 35 } 36 37 return stdout || '(no output)'; 38 } 39});