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 | 45x 45x 45x 45x 45x 45x 45x 45x 45x | import { Entity, Column } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
import { BaseEntity } from './base.entity';
import { ToolHookTiming } from './enums';
/**
* ToolHook defines a custom script that runs before or after a tool execution.
* Hooks allow extending Repoburg's behavior without modifying core code.
*
* Use hooks for:
* - Logging/monitoring (after hooks)
* - Validation/modification of inputs (before hooks)
* - Custom post-processing of outputs (after hooks)
*
* Hook scripts are stored as TypeScript files and executed via VM sandbox.
* Use POST /tool-hooks/test to test a hook with a sample payload.
*/
@Entity('tool_hooks')
export class ToolHook extends BaseEntity {
@ApiProperty({
description: 'Name of the tool this hook attaches to',
example: 'create_file',
})
@Column()
tool_name: string;
@ApiProperty({
description: 'When to execute this hook (before or after tool execution)',
enum: ToolHookTiming,
enumName: 'ToolHookTiming',
example: ToolHookTiming.BEFORE,
})
@Column()
timing: 'before' | 'after';
@ApiProperty({
description: 'Filename of the hook script (stored in .repoburg/hooks/)',
example: 'create_file_validator.ts',
})
@Column()
script_filename: string;
@ApiProperty({
description: 'Whether this hook is active/enabled',
example: true,
default: true,
})
@Column({ default: true })
is_active: boolean;
}
|