20 lines
761 B
JavaScript
20 lines
761 B
JavaScript
// Temporary probe — delete after debugging
|
|
import { execFile } from 'node:child_process';
|
|
const SCRIPT = '/Users/ktg/.claude/plugins/marketplaces/plugin-marketplace/plugins/llm-security/hooks/scripts/pre-bash-destructive.mjs';
|
|
async function test(cmd) {
|
|
return new Promise(resolve => {
|
|
const child = execFile('node', [SCRIPT], {timeout:5000}, (err, stdout, stderr) => {
|
|
resolve({ code: child.exitCode, cmd, line: (stderr || '').split('\n')[0] });
|
|
});
|
|
child.stdin.end(JSON.stringify({ tool_name: 'Bash', tool_input: { command: cmd } }));
|
|
});
|
|
}
|
|
const cmds = [
|
|
'rm -f -r /home',
|
|
'rm -rf /etc',
|
|
'rm --force -r $HOME',
|
|
];
|
|
for (const c of cmds) {
|
|
const r = await test(c);
|
|
console.log('exit=' + r.code, JSON.stringify(c), r.line);
|
|
}
|