@netlify/agent-runner-cli 1.116.0-migration-guard-hook.0 → 1.116.0-migration-guard-hook.2
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.
- package/dist/bin-local.js +100 -86
- package/dist/bin.js +82 -68
- package/dist/hooks/pre-file-write-guard/claude-adapter.js +15 -0
- package/dist/hooks/pre-file-write-guard/codex-adapter.js +16 -0
- package/dist/hooks/pre-file-write-guard/gemini-adapter.js +14 -0
- package/dist/index.js +99 -85
- package/package.json +2 -1
- package/dist/hooks/guard-migration-codex.js +0 -4
- package/dist/hooks/guard-migration-gemini.js +0 -2
- package/dist/hooks/guard-migration.js +0 -3
- /package/dist/hooks/{guard-migration-codex.d.ts → pre-file-write-guard/claude-adapter.d.ts} +0 -0
- /package/dist/hooks/{guard-migration-gemini.d.ts → pre-file-write-guard/codex-adapter.d.ts} +0 -0
- /package/dist/hooks/{guard-migration.d.ts → pre-file-write-guard/gemini-adapter.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/agent-runner-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.116.0-migration-guard-hook.
|
|
4
|
+
"version": "1.116.0-migration-guard-hook.2",
|
|
5
5
|
"description": "CLI tool for running Netlify agents",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"test:integration:create-stage": "vitest run test/integration/create.test.ts",
|
|
44
44
|
"test:integration:skill-invocation": "vitest run test/integration/skill-invocation.test.ts",
|
|
45
45
|
"test:integration:feature-enablement": "vitest run test/integration/feature-enablement.test.ts",
|
|
46
|
+
"test:integration:pre-file-write-guard": "vitest run test/integration/pre-file-write-guard.test.ts",
|
|
46
47
|
"check:types": "tsc --noEmit",
|
|
47
48
|
"postinstall": "node scripts/postinstall.js"
|
|
48
49
|
},
|
|
@@ -1,4 +0,0 @@
|
|
|
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
|
|
@@ -1,2 +0,0 @@
|
|
|
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
|
|
@@ -1,3 +0,0 @@
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|