All files / src/seeding/data/tool-hooks readme.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 5616x 16x                                                                                                            
export const filename = 'README.md';
export const content = `# Repoburg Tool Hooks
 
This directory contains TypeScript scripts that can be attached to AI tool execution events.
You can configure these hooks in the "Tool Hooks" section of the Repoburg UI.
 
## How it works
 
1.  **Create a script** in this folder (e.g., \`audit-patch.ts\`).
2.  **Go to UI**: Open Repoburg -> Tool Hooks -> Add Hook.
3.  **Configure**: Select the tool (e.g., \`patch\`), timing (\`before\` or \`after\`), and your script.
 
## Script Interface
 
Your script must **export a default function** that receives the context.
 
### Input Context
 
\`\`\`typescript
interface HookContext {
  hook_type: 'before' | 'after';
  
  action: {
    tool_name: string; // e.g. "patch"
    args: any;         // e.g. { file_path: "src/app.ts", patch_code: "..." }
    
    // Only present for 'after' hooks
    result?: {
      status: 'SUCCESS' | 'FAILURE';
      output?: string;
      error?: string;
    };
  };
 
  plan_context: any; // Shared state of the current AI plan
}
\`\`\`
 
### Output Format
 
Your function should return an object (or void if passive):
 
\`\`\`typescript
interface HookOutput {
  // If true, the AI plan stops immediately.
  should_halt_plan?: boolean;
  
  // Optional message to log in the UI
  message?: string;
  
  // Optional data to merge back into the plan context
  update_context?: Record<string, any>;
}
\`\`\`
`;