export declare const filename = "eslint-hook.ts";
export declare const content = "/**\n * ESLint Validation Hook\n * \n * Usage: Attach as 'after' hook to 'create_file', 'overwrite_file', 'patch'.\n * \n * With native tool calling, errors should be returned in the result object\n * instead of pushing to validationErrors. This hook is kept for reference\n * but may need adjustment based on your use case.\n */\nimport { exec } from 'child_process';\nimport { promisify } from 'util';\n\nconst execAsync = promisify(exec);\n\n// Redefining types locally since this runs in a standalone VM context\nexport interface HookContext {\n  action: {\n    tool_name: string;\n    args: { file_path?: string; [key: string]: any };\n    result?: {\n      status: 'SUCCESS' | 'FAILURE';\n      output?: string;\n      error?: string;\n    };\n  };\n  plan_context: {\n    flags: {\n      should_halt: boolean;\n      halt_reason?: string;\n    };\n  };\n}\n\nexport default async function(context: HookContext) {\n  const filePath = context.action.args.file_path;\n  if (!filePath) return;\n\n  console.log(`[Hook] Running ESLint on ${filePath}`);\n\n  try {\n    // Adjust command as needed for your project structure\n    // We use --no-color to keep error message clean for AI\n    await execAsync(`npx eslint \"${filePath}\" --no-color`);\n    console.log(`[Hook] ESLint passed for ${filePath}`);\n  } catch (e: any) {\n    const errorOutput = e.stdout || e.stderr || e.message;\n    \n    console.log(`[Hook] ESLint failed for ${filePath}`);\n\n    // Log the error - it will be captured in execution logs\n    // The AI will see this in the tool result via native tool calling\n    console.error(`ESLint check failed:\\n${errorOutput}`);\n    \n    // Optionally halt the plan if ESLint fails critically\n    // context.plan_context.flags.should_halt = true;\n    // context.plan_context.flags.halt_reason = `ESLint failed: ${errorOutput}`;\n  }\n}\n";
