@netlify/agent-runner-cli 1.115.0 → 1.116.0-migration-guard-hook.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,4 @@
1
+ import a from"fs";import f from"path";var s=JSON.parse(a.readFileSync(0,"utf-8")),l=s.cwd??process.cwd();s.tool_name!=="apply_patch"&&process.exit(0);function p(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){let t=e;if(typeof t.command=="string")return t.command;if(Array.isArray(t.command)&&typeof t.command[1]=="string")return t.command[1];if(typeof t.input=="string")return t.input;if(typeof t.patch=="string")return t.patch}}var c=p(s.tool_input);c==null&&process.exit(0);function h(e){let t=[],n=null,o=()=>{n&&(t.push({filePath:n.filePath,addedContent:n.added.join(`
2
+ `)}),n=null)};for(let i of e.split(`
3
+ `)){let r=i.match(/^\*\*\* (?:Add|Update) File: (.+)$/);if(r){o(),n={filePath:r[1].trim(),added:[]};continue}if(i.startsWith("*** Delete File:")||i.startsWith("*** End Patch")||i.startsWith("*** Begin Patch")){o();continue}n&&i.startsWith("+")&&n.added.push(i.slice(1))}return o(),t}var d=h(c);d.length===0&&process.exit(0);var u=a.existsSync(f.join(l,"drizzle.config.ts"));u||process.exit(0);var m=/(^|\/)netlify\/database\/migrations\/[^/]+\.sql$/,g=/\b(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|INDEX|VIEW|TYPE|SCHEMA|CONSTRAINT|COLUMN)\b/i,y=d.find(e=>m.test(e.filePath)&&g.test(e.addedContent));y||process.exit(0);process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"This project uses Drizzle ORM (drizzle.config.ts present). Schema migrations MUST be produced by `npx drizzle-kit generate`, not by writing SQL directly. Update db/schema.ts, then run `npx drizzle-kit generate` from the project root. If you need a data-only migration (INSERT/UPDATE/DELETE), write that in a separate .sql file with no DDL statements."}}));process.exit(0);
4
+ //# sourceMappingURL=guard-migration-codex.js.map
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+ import i from"fs";import n from"path";var o=JSON.parse(i.readFileSync(0,"utf-8")),t=o.tool_input??{},s=o.cwd??process.cwd(),e=t.file_path,r=t.content??t.new_string,a=e!=null&&/\/netlify\/database\/migrations\/[^/]+\.sql$/.test(e);a||process.exit(0);var c=i.existsSync(n.join(s,"drizzle.config.ts"));c||process.exit(0);var l=/\b(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|INDEX|VIEW|TYPE|SCHEMA|CONSTRAINT|COLUMN)\b/i;l.test(r??"")||process.exit(0);process.stdout.write(JSON.stringify({decision:"deny",reason:"This project uses Drizzle ORM (drizzle.config.ts present). Schema migrations MUST be produced by `npx drizzle-kit generate`, not by writing SQL directly. Update db/schema.ts, then run `npx drizzle-kit generate` from the project root. If you need a data-only migration (INSERT/UPDATE/DELETE), write that in a separate .sql file with no DDL statements."}));process.exit(0);
2
+ //# sourceMappingURL=guard-migration-gemini.js.map
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,3 @@
1
+ import i from"fs";import s from"path";var o=JSON.parse(i.readFileSync(0,"utf-8")),t=o.tool_input??{},r=o.cwd??process.cwd(),e=t.file_path,a=t.content??t.new_string??(t.edits??[]).map(n=>n.new_string??"").join(`
2
+ `),c=e!=null&&/\/netlify\/database\/migrations\/[^/]+\.sql$/.test(e);c||process.exit(0);var l=i.existsSync(s.join(r,"drizzle.config.ts"));l||process.exit(0);var p=/\b(CREATE|ALTER|DROP|TRUNCATE)\s+(TABLE|INDEX|VIEW|TYPE|SCHEMA|CONSTRAINT|COLUMN)\b/i;p.test(a??"")||process.exit(0);process.stdout.write(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:"This project uses Drizzle ORM (drizzle.config.ts present). Schema migrations MUST be produced by `npx drizzle-kit generate`, not by writing SQL directly. Update db/schema.ts, then run `npx drizzle-kit generate` from the project root. If you need a data-only migration (INSERT/UPDATE/DELETE), write that in a separate .sql file with no DDL statements."}}));process.exit(0);
3
+ //# sourceMappingURL=guard-migration.js.map