@backendkit-labs/codemod 0.0.0-stage → 0.1.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.
package/README.md CHANGED
@@ -1,3 +1,43 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @backendkit-labs/codemod
2
+
3
+ Automated migrations for the breaking releases of `@backendkit-labs/agent-core` and `agent-coding` ([SPEC-0037](../../docs/specs/SPEC-0037-codemods-y-guias-de-migracion.md)). One command per break; it moves imports and flags what needs a decision.
4
+
5
+ ```bash
6
+ npx @backendkit-labs/codemod --list # what there is, and the release that asks for each
7
+ npx @backendkit-labs/codemod coding-split ./src --dry-run # show what would change, write nothing
8
+ npx @backendkit-labs/codemod coding-split ./src # apply it
9
+ ```
10
+
11
+ | Transformation | For | Does |
12
+ |---|---|---|
13
+ | `scope-rename` | the rename of the npm scope | `@bk/agent-core`, `@bk/agent-coding`, `@bk/mcp-server` become `@backendkit-labs/*` |
14
+ | `coding-split` | v0.40.0 (agent-core 0.39) | `Orchestrator`, `QAService` and their types move from `agent-core` to `agent-coding/pipeline`; the subpaths `agent-core/orchestration` and `agent-core/reflection` are replaced |
15
+ | `terminal-app-split` | v0.41.0 (agent-core 0.40) | the 66 names of agent discovery, skill loading, built-in commands, checkpoints, workspaces and trust move to `agent-coding/cli` |
16
+ | `zod4-record` | the move to zod 4 (agent-core 0.33) | `z.record(x)` becomes `z.record(z.string(), x)`; `invalid_type_error` and `required_error` (one `error` in zod 4, with other messages) are flagged |
17
+
18
+ The lists of names are not copied from the changelog: they are the names `agent-core` exported before a release and no longer exports after it, checked against what the destination package exports today.
19
+
20
+ ## What it does, and what it leaves to you
21
+
22
+ It reads each file with the TypeScript parser and edits only the statements it understands (the `import` and `export ... from` of the moves, and the `z.record(...)` calls of `zod4-record`). Spacing, comments, quotes and line endings of everything else stay byte for byte, and running it twice changes nothing.
23
+
24
+ - **Moves** a name from one module to another, joining an import of the destination that is already there, keeping aliases and `type` marks.
25
+ - **Renames** a module that stopped being a subpath.
26
+ - **Flags, never guesses.** A statement it cannot rewrite safely gets a `// TODO(codemod): ...` comment above it and is listed in the summary:
27
+ - a name that no longer exists anywhere (it stays where it is);
28
+ - `import * as core from '...'` followed by `core.Name` for a name that moved;
29
+ - `export { Name } from '...'` of a name that moved.
30
+
31
+ Search for `TODO(codemod)` after a run.
32
+
33
+ It does **not** touch `require()`, dynamic `import()`, or `package.json` (the version ranges), and it does not restructure calls: a break that changes how a function is called (for example the options of `createBaseEngine` that became a hook) is described in the migration guide, not rewritten.
34
+
35
+ ## Options
36
+
37
+ | | |
38
+ |---|---|
39
+ | `[path]` | a folder or a file; default: the current folder. `node_modules`, `dist`, `build`, `.git` and `*.d.ts` are skipped |
40
+ | `--dry-run` | print what would change and write nothing |
41
+ | `--list` | the transformations |
42
+
43
+ Exit code `0` on success, `1` on an unknown transformation or option or a path that does not exist.
package/bin/codemod.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli').main(process.argv.slice(2)).then(code => { process.exitCode = code; });
package/dist/cli.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { MoveReport } from './move-imports';
2
+ import type { Transform } from './transforms';
3
+ export interface Io {
4
+ out(line: string): void;
5
+ err(line: string): void;
6
+ }
7
+ /** The source files under `path` (a file or a folder), leaving out dependencies, build output and declaration files. */
8
+ export declare function collectFiles(path: string): string[];
9
+ /** Runs a transformation over the files: returns the new text of those that change, and what it did. */
10
+ export declare function applyTransform(files: readonly string[], t: Transform): {
11
+ changed: Map<string, string>;
12
+ report: MoveReport;
13
+ };
14
+ export declare function main(argv: string[], io?: Io): Promise<number>;
15
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,EAAE;IACf,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAeD,wHAAwH;AACxH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAenD;AAED,wGAAwG;AACxG,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,GAAG;IAAE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAS3H;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,EAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC9E"}
package/dist/cli.js ADDED
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.collectFiles = collectFiles;
4
+ exports.applyTransform = applyTransform;
5
+ exports.main = main;
6
+ const node_fs_1 = require("node:fs");
7
+ const node_path_1 = require("node:path");
8
+ const transforms_1 = require("./transforms");
9
+ const consoleIo = { out: l => console.log(l), err: l => console.error(l) };
10
+ const USAGE = `Usage: codemod <transformation> [path] [--dry-run]
11
+ codemod --list
12
+
13
+ <transformation> what to run (see --list)
14
+ [path] a folder or a file; default: the current folder
15
+ --dry-run show what would change and write nothing
16
+ --list the transformations and the release that asks for each`;
17
+ const SOURCE = /\.(?:[cm]?[jt]s|[jt]sx)$/;
18
+ const SKIPPED_DIRS = new Set(['node_modules', 'dist', 'build', '.git']);
19
+ /** The source files under `path` (a file or a folder), leaving out dependencies, build output and declaration files. */
20
+ function collectFiles(path) {
21
+ const target = (0, node_path_1.resolve)(path);
22
+ if (!(0, node_fs_1.existsSync)(target))
23
+ throw new Error(`path not found: ${path}`);
24
+ // The long form of the path: Windows can hand out 8.3 names (`MAIRON~1.CUE`) that do not match what the folder lists.
25
+ const real = node_fs_1.realpathSync.native(target);
26
+ if ((0, node_fs_1.statSync)(real).isFile())
27
+ return [real];
28
+ const files = [];
29
+ const walk = (dir) => {
30
+ for (const entry of (0, node_fs_1.readdirSync)(dir, { withFileTypes: true })) {
31
+ if (entry.isDirectory()) {
32
+ if (!SKIPPED_DIRS.has(entry.name))
33
+ walk((0, node_path_1.join)(dir, entry.name));
34
+ }
35
+ else if (entry.isFile() && SOURCE.test(entry.name) && !entry.name.endsWith('.d.ts'))
36
+ files.push((0, node_path_1.join)(dir, entry.name));
37
+ }
38
+ };
39
+ walk(real);
40
+ return files.sort();
41
+ }
42
+ /** Runs a transformation over the files: returns the new text of those that change, and what it did. */
43
+ function applyTransform(files, t) {
44
+ const report = { moved: [], flagged: [] };
45
+ const changed = new Map();
46
+ for (const file of files) {
47
+ const before = (0, node_fs_1.readFileSync)(file, 'utf8');
48
+ const after = t.apply(file, before, report);
49
+ if (after !== before)
50
+ changed.set(file, after);
51
+ }
52
+ return { changed, report };
53
+ }
54
+ async function main(argv, io = consoleIo) {
55
+ const flags = new Set(argv.filter(a => a.startsWith('--')));
56
+ const positional = argv.filter(a => !a.startsWith('--'));
57
+ const unknown = [...flags].filter(f => !['--dry-run', '--list', '--help'].includes(f));
58
+ if (unknown.length > 0) {
59
+ io.err(`unknown option ${unknown[0]}\n${USAGE}`);
60
+ return 1;
61
+ }
62
+ if (flags.has('--help') || argv.length === 0) {
63
+ io.out(USAGE);
64
+ return argv.length === 0 ? 1 : 0;
65
+ }
66
+ if (flags.has('--list')) {
67
+ for (const t of transforms_1.TRANSFORMS)
68
+ io.out(`${t.name}\n ${t.description}\n since ${t.since}`);
69
+ return 0;
70
+ }
71
+ const [name, path = '.'] = positional;
72
+ const transform = name ? (0, transforms_1.findTransform)(name) : undefined;
73
+ if (!transform) {
74
+ io.err(`unknown transformation "${name ?? ''}". Run with --list to see them.`);
75
+ return 1;
76
+ }
77
+ let files;
78
+ try {
79
+ files = collectFiles(path);
80
+ }
81
+ catch (err) {
82
+ io.err(err.message);
83
+ return 1;
84
+ }
85
+ const { changed, report } = applyTransform(files, transform);
86
+ const dry = flags.has('--dry-run');
87
+ if (!dry)
88
+ for (const [file, text] of changed)
89
+ (0, node_fs_1.writeFileSync)(file, text);
90
+ // Paths in the report are relative to what the user pointed at.
91
+ const real = node_fs_1.realpathSync.native((0, node_path_1.resolve)(path));
92
+ const root = (0, node_fs_1.statSync)(real).isFile() ? real.slice(0, Math.max(real.lastIndexOf('/'), real.lastIndexOf('\\'))) : real;
93
+ const short = (line) => line.split(root + '/').join('').split(root + '\\').join('');
94
+ for (const line of report.moved)
95
+ io.out(short(line));
96
+ for (const line of report.flagged)
97
+ io.out(`TODO ${short(line)}`);
98
+ io.out(`${dry ? 'would change' : 'changed'} ${changed.size} file${changed.size === 1 ? '' : 's'}`
99
+ + (report.flagged.length > 0 ? `; ${report.flagged.length} need${report.flagged.length === 1 ? 's' : ''} a decision (search for TODO(codemod))` : ''));
100
+ return 0;
101
+ }
102
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;AAyBA,oCAeC;AAGD,wCASC;AAED,oBAgCC;AAtFD,qCAAuG;AACvG,yCAA0C;AAE1C,6CAAyD;AAQzD,MAAM,SAAS,GAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAE/E,MAAM,KAAK,GAAG;;;;;;2EAM6D,CAAC;AAE5E,MAAM,MAAM,GAAG,0BAA0B,CAAC;AAC1C,MAAM,YAAY,GAAG,IAAI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;UAC3F,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,MAAM,QAAQ,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,wCAAwC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3J,OAAO,CAAC,CAAC;AACb,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { transformText } from './move-imports';
2
+ export type { MoveRule, MoveReport } from './move-imports';
3
+ export { TRANSFORMS, findTransform } from './transforms';
4
+ export type { Transform } from './transforms';
5
+ export { main, collectFiles, applyTransform } from './cli';
6
+ export type { Io } from './cli';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC3D,YAAY,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyTransform = exports.collectFiles = exports.main = exports.findTransform = exports.TRANSFORMS = exports.transformText = void 0;
4
+ var move_imports_1 = require("./move-imports");
5
+ Object.defineProperty(exports, "transformText", { enumerable: true, get: function () { return move_imports_1.transformText; } });
6
+ var transforms_1 = require("./transforms");
7
+ Object.defineProperty(exports, "TRANSFORMS", { enumerable: true, get: function () { return transforms_1.TRANSFORMS; } });
8
+ Object.defineProperty(exports, "findTransform", { enumerable: true, get: function () { return transforms_1.findTransform; } });
9
+ var cli_1 = require("./cli");
10
+ Object.defineProperty(exports, "main", { enumerable: true, get: function () { return cli_1.main; } });
11
+ Object.defineProperty(exports, "collectFiles", { enumerable: true, get: function () { return cli_1.collectFiles; } });
12
+ Object.defineProperty(exports, "applyTransform", { enumerable: true, get: function () { return cli_1.applyTransform; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAAtC,6GAAA,aAAa,OAAA;AAEtB,2CAAyD;AAAhD,wGAAA,UAAU,OAAA;AAAE,2GAAA,aAAa,OAAA;AAElC,6BAA2D;AAAlD,2FAAA,IAAI,OAAA;AAAE,mGAAA,YAAY,OAAA;AAAE,qGAAA,cAAc,OAAA"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Moves named imports from one module to another, the mechanical part of a breaking release (SPEC-0037).
3
+ *
4
+ * It reads the file with the TypeScript parser and changes only the text of the statements it understands: everything else,
5
+ * including spacing, comments, quotes and line endings, stays byte for byte. What it does not understand it does not touch: it
6
+ * leaves a `// TODO(codemod)` above the statement and says so in the report. Running it twice changes nothing.
7
+ */
8
+ export interface MoveRule {
9
+ /** The module the symbols used to come from (`@backendkit-labs/agent-core`). Matched exactly. */
10
+ from: string;
11
+ /** Symbols that now live in `to`. */
12
+ moves: Array<{
13
+ to: string;
14
+ symbols: readonly string[];
15
+ }>;
16
+ /** Symbols that no longer exist anywhere: left in place and flagged. */
17
+ gone?: readonly string[];
18
+ /**
19
+ * For a module that stopped being a subpath: every other name now comes from this module (`agent-core/orchestration`
20
+ * is `agent-coding/pipeline` now). The specifier changes, the names do not.
21
+ */
22
+ renameRest?: string;
23
+ }
24
+ export interface MoveReport {
25
+ /** `file: Symbol -> module`, one per symbol moved. */
26
+ moved: string[];
27
+ /** `file: what needs a person`, one per flagged statement. */
28
+ flagged: string[];
29
+ }
30
+ /** The file with the rules applied, or the same text if there is nothing to do. */
31
+ export declare function transformText(fileName: string, text: string, rules: readonly MoveRule[], report: MoveReport): string;
32
+ //# sourceMappingURL=move-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-imports.d.ts","sourceRoot":"","sources":["../src/move-imports.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACrB,iGAAiG;IACjG,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IACzD,wEAAwE;IACxE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACvB,sDAAsD;IACtD,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAaD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,QAAQ,EAAE,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CA6LpH"}
@@ -0,0 +1,246 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.transformText = transformText;
37
+ const ts = __importStar(require("typescript"));
38
+ const TODO = '// TODO(codemod):';
39
+ const specText = (s) => `${s.typeOnly ? 'type ' : ''}${s.name}${s.alias ? ` as ${s.alias}` : ''}`;
40
+ /** What a named import brings in: the exported name (`propertyName` when aliased), not the local one. */
41
+ const exportedName = (e) => (e.propertyName ?? e.name).text;
42
+ /** The file with the rules applied, or the same text if there is nothing to do. */
43
+ function transformText(fileName, text, rules, report) {
44
+ const sf = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
45
+ const newline = text.includes('\r\n') ? '\r\n' : '\n';
46
+ const edits = [];
47
+ const imports = sf.statements.filter(ts.isImportDeclaration);
48
+ const specifierOf = (d) => d.moduleSpecifier && ts.isStringLiteral(d.moduleSpecifier) ? d.moduleSpecifier.text : undefined;
49
+ const ruleFor = (from) => rules.find(r => r.from === from);
50
+ /** Where a declaration ends up importing from, once its specifier is renamed. */
51
+ const finalSpecifier = (d) => ruleFor(specifierOf(d))?.renameRest ?? specifierOf(d);
52
+ const namedOf = (d) => d.importClause?.namedBindings && ts.isNamedImports(d.importClause.namedBindings) ? d.importClause.namedBindings : undefined;
53
+ // Imports of a target that the file will already have, to join them instead of adding a second one (value and type imports apart).
54
+ const target = (to, typeOnly) => imports.find(d => finalSpecifier(d) === to && !!d.importClause?.isTypeOnly === typeOnly && namedOf(d) !== undefined);
55
+ /** Imports to add, one per target and kind, placed after the first declaration that fed them. */
56
+ const created = new Map();
57
+ /** Names to append to an import that already exists. */
58
+ const appended = new Map();
59
+ const hasComment = (node, message) => (ts.getLeadingCommentRanges(text, node.getFullStart()) ?? []).some(c => text.slice(c.pos, c.end).includes(message));
60
+ const flag = (node, message, line) => {
61
+ if (hasComment(node, message))
62
+ return;
63
+ // The comment goes on its own line above the statement, with the statement's own indentation.
64
+ const lineStart = text.lastIndexOf('\n', node.getStart() - 1) + 1;
65
+ const indent = text.slice(lineStart, node.getStart());
66
+ edits.push({ start: node.getStart(), end: node.getStart(), text: `${TODO} ${message}${newline}${indent}` });
67
+ report.flagged.push(`${fileName}: ${line}`);
68
+ };
69
+ const renameSpecifier = (decl, from, to) => {
70
+ const lit = decl.moduleSpecifier;
71
+ edits.push({ start: lit.getStart() + 1, end: lit.getEnd() - 1, text: to });
72
+ report.moved.push(`${fileName}: ${from} -> ${to}`);
73
+ };
74
+ for (const d of imports) {
75
+ const from = specifierOf(d);
76
+ const rule = ruleFor(from);
77
+ if (!rule || !d.importClause) {
78
+ // `import 'x'` has no names to move; it only follows a renamed module.
79
+ if (rule?.renameRest && !d.importClause)
80
+ renameSpecifier(d, rule.from, rule.renameRest);
81
+ continue;
82
+ }
83
+ const named = namedOf(d);
84
+ const declTypeOnly = !!d.importClause.isTypeOnly;
85
+ const elements = named ? [...named.elements] : [];
86
+ const everything = new Set([...rule.moves.flatMap(m => m.symbols), ...(rule.gone ?? [])]);
87
+ const movedElements = new Set();
88
+ for (const move of rule.moves) {
89
+ const wanted = new Set(move.symbols);
90
+ const hit = elements.filter(e => wanted.has(exportedName(e)));
91
+ if (hit.length === 0)
92
+ continue;
93
+ const specs = hit.map(e => ({
94
+ name: exportedName(e),
95
+ ...(e.propertyName ? { alias: e.name.text } : {}),
96
+ // `import type { A }` makes every name a type; a name marked `type` inside a value import keeps its mark.
97
+ typeOnly: !declTypeOnly && e.isTypeOnly,
98
+ }));
99
+ for (const e of hit)
100
+ movedElements.add(e);
101
+ for (const s of specs)
102
+ report.moved.push(`${fileName}: ${s.name} -> ${move.to}`);
103
+ const existing = target(move.to, declTypeOnly);
104
+ if (existing && existing !== d) {
105
+ appended.set(existing, [...(appended.get(existing) ?? []), ...specs]);
106
+ }
107
+ else {
108
+ const key = `${move.to}|${declTypeOnly}`;
109
+ const entry = created.get(key);
110
+ if (entry)
111
+ entry.specs.push(...specs);
112
+ else
113
+ created.set(key, { to: move.to, typeOnly: declTypeOnly, specs, after: d });
114
+ }
115
+ }
116
+ // A name with no destination that is still imported here: say so, do not guess.
117
+ const goneHere = (rule.gone ?? []).filter(g => elements.some(e => exportedName(e) === g));
118
+ if (goneHere.length > 0) {
119
+ flag(d, `${goneHere.join(', ')} no longer ${goneHere.length === 1 ? 'exists' : 'exist'} in ${rule.from}; see the migration guide`, `${goneHere.join(', ')} (no destination)`);
120
+ }
121
+ // `import * as core from '<from>'` and then `core.Symbol`: a namespace use cannot be rewritten safely.
122
+ const ns = d.importClause.namedBindings && ts.isNamespaceImport(d.importClause.namedBindings) ? d.importClause.namedBindings.name.text : undefined;
123
+ if (ns) {
124
+ const use = findNamespaceUse(sf, ns, everything);
125
+ if (use)
126
+ flag(d, `${ns}.${use} moved out of ${rule.from}; see the migration guide`, `${ns}.${use} (namespace use)`);
127
+ }
128
+ if (movedElements.size > 0) {
129
+ const allMoved = movedElements.size === elements.length;
130
+ if (allMoved && !d.importClause.name)
131
+ edits.push(removeStatement(d));
132
+ else if (allMoved)
133
+ edits.push(dropNamedBindings(d));
134
+ else
135
+ edits.push(...removeElements(named, movedElements));
136
+ }
137
+ if (rule.renameRest && !(movedElements.size > 0 && movedElements.size === elements.length && !d.importClause.name)) {
138
+ renameSpecifier(d, rule.from, rule.renameRest);
139
+ }
140
+ }
141
+ // `export { Symbol } from '<from>'` is the same problem the other way round; `export * from` only follows a renamed module.
142
+ for (const e of sf.statements.filter(ts.isExportDeclaration)) {
143
+ const rule = ruleFor(specifierOf(e));
144
+ if (!rule)
145
+ continue;
146
+ const everything = new Set([...rule.moves.flatMap(m => m.symbols), ...(rule.gone ?? [])]);
147
+ const names = e.exportClause && ts.isNamedExports(e.exportClause) ? e.exportClause.elements.map(exportedName).filter(n => everything.has(n)) : [];
148
+ if (names.length > 0)
149
+ flag(e, `${names.join(', ')} moved out of ${rule.from}; see the migration guide`, `re-export of ${names.join(', ')}`);
150
+ else if (rule.renameRest && e.moduleSpecifier && ts.isStringLiteral(e.moduleSpecifier)) {
151
+ edits.push({ start: e.moduleSpecifier.getStart() + 1, end: e.moduleSpecifier.getEnd() - 1, text: rule.renameRest });
152
+ report.moved.push(`${fileName}: ${rule.from} -> ${rule.renameRest}`);
153
+ }
154
+ }
155
+ // Names joining an import that already exists: after its last element.
156
+ for (const [decl, specs] of appended) {
157
+ const list = namedOf(decl);
158
+ const last = list.elements[list.elements.length - 1];
159
+ edits.push({ start: last.getEnd(), end: last.getEnd(), text: specs.map(s => `, ${specText(s)}`).join('') });
160
+ }
161
+ // New imports: a line of their own after the declaration that fed them, with the quotes and the semicolon of that declaration.
162
+ for (const c of created.values()) {
163
+ const decl = c.after;
164
+ const quote = decl.moduleSpecifier.getText()[0];
165
+ const semi = text.slice(decl.getStart(), decl.getEnd()).trimEnd().endsWith(';') ? ';' : '';
166
+ const lineEnd = text.indexOf('\n', decl.getEnd());
167
+ const insertAt = lineEnd === -1 ? text.length : lineEnd + 1;
168
+ const lineText = `import ${c.typeOnly ? 'type ' : ''}{ ${c.specs.map(specText).join(', ')} } from ${quote}${c.to}${quote}${semi}`;
169
+ edits.push({ start: insertAt, end: insertAt, text: lineEnd === -1 ? `${newline}${lineText}` : `${lineText}${newline}` });
170
+ }
171
+ if (edits.length === 0)
172
+ return text;
173
+ // Applied from the end of the file backwards, so the positions of the ones still to apply do not move.
174
+ edits.sort((a, b) => b.start - a.start || b.end - a.end);
175
+ let out = text;
176
+ for (const e of edits)
177
+ out = out.slice(0, e.start) + e.text + out.slice(e.end);
178
+ return out;
179
+ // ── Text of each edit ────────────────────────────────────────────────────────────────────────────────────
180
+ /** The whole statement and its line break; blank lines around it stay. */
181
+ function removeStatement(d) {
182
+ const start = d.getStart();
183
+ const lineStart = text.lastIndexOf('\n', start - 1) + 1;
184
+ const onlyIndent = text.slice(lineStart, start).trim() === '';
185
+ const end = d.getEnd();
186
+ const rest = text.slice(end);
187
+ const eol = /^[ \t]*(\r?\n|$)/.exec(rest);
188
+ return { start: onlyIndent ? lineStart : start, end: eol ? end + eol[0].length : end, text: '' };
189
+ }
190
+ /** `import Def, { A } from 'x'` with A gone: `import Def from 'x'`. */
191
+ function dropNamedBindings(d) {
192
+ const clause = d.importClause;
193
+ return { start: clause.name.getEnd(), end: clause.namedBindings.getEnd(), text: '' };
194
+ }
195
+ /** The names that move, out of a list: each run of consecutive ones is one cut, so the cuts never overlap. */
196
+ function removeElements(list, moved) {
197
+ const els = list.elements;
198
+ const cuts = [];
199
+ for (let i = 0; i < els.length; i++) {
200
+ if (!moved.has(els[i]))
201
+ continue;
202
+ let j = i;
203
+ while (j + 1 < els.length && moved.has(els[j + 1]))
204
+ j++;
205
+ cuts.push(removeRun(list, i, j));
206
+ i = j;
207
+ }
208
+ return cuts;
209
+ }
210
+ /** Names i..j of a list and their comma; if their line is left empty, the line too. A comment that stays on the line stays. */
211
+ function removeRun(list, i, j) {
212
+ const els = list.elements;
213
+ let start = els[i].getStart();
214
+ let end = els[j].getEnd();
215
+ const after = /^[ ]*,[ ]*/.exec(text.slice(end));
216
+ if (after)
217
+ end += after[0].length;
218
+ // The last name has no comma of its own: take the comma of the one before.
219
+ else if (i > 0)
220
+ start = els[i - 1].getEnd();
221
+ // On its own line: nothing left but whitespace around the cut means the line goes.
222
+ const lineStart = text.lastIndexOf('\n', start - 1) + 1;
223
+ const lineEndAt = text.indexOf('\n', end);
224
+ const lineEnd = lineEndAt === -1 ? text.length : lineEndAt;
225
+ if (text.slice(lineStart, start).trim() === '' && text.slice(end, lineEnd).trim() === '' && lineStart > list.getStart()) {
226
+ return { start: lineStart, end: lineEndAt === -1 ? text.length : lineEndAt + 1, text: '' };
227
+ }
228
+ // The spaces that separated it from the next name go with it, so `{ A, B, C }` minus B is `{ A, C }`.
229
+ return { start, end, text: '' };
230
+ }
231
+ }
232
+ function findNamespaceUse(sf, ns, names) {
233
+ let found;
234
+ const visit = (n) => {
235
+ if (found)
236
+ return;
237
+ if (ts.isPropertyAccessExpression(n) && ts.isIdentifier(n.expression) && n.expression.text === ns && names.has(n.name.text)) {
238
+ found = n.name.text;
239
+ return;
240
+ }
241
+ ts.forEachChild(n, visit);
242
+ };
243
+ visit(sf);
244
+ return found;
245
+ }
246
+ //# sourceMappingURL=move-imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move-imports.js","sourceRoot":"","sources":["../src/move-imports.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,sCA6LC;AAvOD,+CAAiC;AA8BjC,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAMjC,MAAM,QAAQ,GAAG,CAAC,CAAO,EAAU,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAEhH,yGAAyG;AACzG,MAAM,YAAY,GAAG,CAAC,CAA0C,EAAU,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;AAE7G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CAAC,EAAE,CAAC,CAAC;IACV,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { MoveReport } from './move-imports';
2
+ /**
3
+ * The transformations. Each one is data: which symbols moved where in a breaking release. The lists are not written by hand
4
+ * from the changelog: they are the names `agent-core` exported before and no longer exports after that release, checked against
5
+ * what the destination package exports today (SPEC-0037 §8).
6
+ */
7
+ export interface Transform {
8
+ name: string;
9
+ description: string;
10
+ /** The release that broke it, for `--list`. */
11
+ since: string;
12
+ /** The new text of one file (the same text if there is nothing to do). Adds what it did to `report`. */
13
+ apply(fileName: string, text: string, report: MoveReport): string;
14
+ }
15
+ export declare const TRANSFORMS: readonly Transform[];
16
+ export declare const findTransform: (name: string) => Transform | undefined;
17
+ //# sourceMappingURL=transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAY,MAAM,gBAAgB,CAAC;AAG3D;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,wGAAwG;IACxG,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC;CACrE;AA4ED,eAAO,MAAM,UAAU,EAAE,SAAS,SAAS,EAA6D,CAAC;AAEzG,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,SAAS,GAAG,SAAkD,CAAC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findTransform = exports.TRANSFORMS = void 0;
4
+ const move_imports_1 = require("./move-imports");
5
+ const zod4_1 = require("./zod4");
6
+ /** A transformation that is only a list of moves. */
7
+ const byRules = (rules) => (fileName, text, report) => (0, move_imports_1.transformText)(fileName, text, rules, report);
8
+ const CORE = '@backendkit-labs/agent-core';
9
+ const PIPELINE = '@backendkit-labs/agent-coding/pipeline';
10
+ const CLI = '@backendkit-labs/agent-coding/cli';
11
+ /** SPEC-0015 (v0.40.0, `agent-core` 0.39): the coding pipeline leaves `agent-core`. */
12
+ const codingSplit = {
13
+ name: 'coding-split',
14
+ description: 'Orchestrator, QAService and the coding pipeline move from agent-core to agent-coding/pipeline',
15
+ since: 'v0.40.0 (agent-core 0.39.0, agent-coding 0.29.0)',
16
+ apply: byRules([
17
+ {
18
+ from: CORE,
19
+ moves: [{
20
+ to: PIPELINE,
21
+ symbols: ['AgentPipelinePhase', 'CapabilityMatrix', 'OrchestrationResult', 'Orchestrator', 'OrchestratorConfig', 'QAReviewResult', 'QAService', 'QAServiceOptions', 'ReviewAgentIds'],
22
+ }],
23
+ // Exported by agent-core before and by nobody now: nothing to move them to.
24
+ gone: ['ProjectStoreData', 'SessionUpdates'],
25
+ },
26
+ // The subpath `agent-core/orchestration` is gone: its names come from the pipeline now.
27
+ { from: `${CORE}/orchestration`, moves: [], renameRest: PIPELINE },
28
+ // `agent-core/reflection` is gone: the hooks of the audit trail went to the pipeline, the rest is in the root.
29
+ {
30
+ from: `${CORE}/reflection`,
31
+ moves: [{ to: PIPELINE, symbols: ['AuditHook', 'AgentHook', 'TestHook', 'CommitHook', 'BootstrapHook', 'HistoricalLoader', 'LessonsMemoGenerator'] }],
32
+ renameRest: CORE,
33
+ },
34
+ ]),
35
+ };
36
+ /** SPEC-0016 (v0.41.0, `agent-core` 0.40): the terminal app leaves `agent-core`. */
37
+ const terminalAppSplit = {
38
+ name: 'terminal-app-split',
39
+ description: 'Agent discovery, skill loading, built-in commands, checkpoints, workspaces and trust move from agent-core to agent-coding/cli',
40
+ since: 'v0.41.0 (agent-core 0.40.0, agent-coding 0.30.0)',
41
+ apply: byRules([{
42
+ from: CORE,
43
+ moves: [{
44
+ to: CLI,
45
+ symbols: [
46
+ 'AgentDiscoveryConfig', 'AgentPackageFile', 'CheckpointSummary', 'DEFAULT_CONFIG', 'FetchOptions', 'FrameworkConfig', 'FrameworkFeatures',
47
+ 'GitHubProvider', 'InstallOptions', 'InstalledPack', 'LoadedSkills', 'LocalProvider', 'ObsidianProvider', 'ProjectLayerContents', 'ProviderConfig',
48
+ 'RemoteAgentRegistry', 'RemoteRegistryIndex', 'SeedResult', 'SkillLoader', 'SkillManager', 'SkillSourceProvider', 'SkillsShProvider', 'TRUST_FILE',
49
+ 'TrustReason', 'TrustStatus', 'WorkspaceEntry', 'WorkspaceProject', 'WorkspacesConfig', 'addProject', 'buildWorkspaceContext',
50
+ 'canonicalProjectPath', 'compactSession', 'compactSessionContent', 'createCheckpoint', 'createSkillManager', 'createWorkspace', 'deleteWorkspace',
51
+ 'deriveProjectName', 'detectCommonRoot', 'discoverAgents', 'extractSessionFromCheckpoint', 'getLatestCheckpoints', 'globalAgentsDir',
52
+ 'importProject', 'isProjectTrusted', 'listCheckpoints', 'listTrustedProjects', 'loadAgentsFromDir', 'loadFrameworkConfig', 'loadWorkspaces',
53
+ 'migrateFromLegacy', 'parseMdSkill', 'projectAgentsDir', 'projectLayerContents', 'readCheckpoint', 'registerBuiltinCommands', 'removeProject',
54
+ 'runGlobalSeed', 'saveWorkspaces', 'setActiveProject', 'setCommonRoot', 'skillToMd', 'trustFilePath', 'trustProject', 'untrustProject',
55
+ 'untrustedLayerWarning',
56
+ ],
57
+ }],
58
+ }]),
59
+ };
60
+ /** `@bk/*` to `@backendkit-labs/*`: the first rename of the packages. */
61
+ const scopeRename = {
62
+ name: 'scope-rename',
63
+ description: 'Imports of @bk/agent-core, @bk/agent-coding and @bk/mcp-server become @backendkit-labs/*',
64
+ since: 'the rename of the npm scope',
65
+ apply: byRules(['agent-core', 'agent-coding', 'mcp-server'].map(pkg => ({ from: `@bk/${pkg}`, moves: [], renameRest: `@backendkit-labs/${pkg}` }))),
66
+ };
67
+ /** zod 4: `z.record(x)` takes the key schema too. The rest of the move to zod 4 is flagged. */
68
+ const zod4Record = {
69
+ name: 'zod4-record',
70
+ description: 'z.record(x) becomes z.record(z.string(), x); invalid_type_error and required_error are flagged',
71
+ since: 'the move to zod 4 (agent-core 0.33.0)',
72
+ apply: zod4_1.zod4Text,
73
+ };
74
+ exports.TRANSFORMS = [scopeRename, codingSplit, terminalAppSplit, zod4Record];
75
+ const findTransform = (name) => exports.TRANSFORMS.find(t => t.name === name);
76
+ exports.findTransform = findTransform;
77
+ //# sourceMappingURL=transforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.js","sourceRoot":"","sources":["../src/transforms.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAE/C,iCAAkC;AAgBlC,qDAAqD;AACrD,MAAM,OAAO,GAAG,CAAC,KAA0B,EAAsB,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,IAAA,4BAAa,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAE7I,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,QAAQ,GAAG,wCAAwC,CAAC;AAC1D,MAAM,GAAG,GAAG,mCAAmC,CAAC;AAEhD,uFAAuF;AACvF,MAAM,WAAW,GAAc;IAC3B,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,+FAA+F;IAC5G,KAAK,EAAE,kDAAkD;IACzD,KAAK,EAAE,OAAO,CAAC;QACX;YACI,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,CAAC;oBACJ,EAAE,EAAE,QAAQ;oBACZ,OAAO,EAAE,CAAC,oBAAoB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,gBAAgB,CAAC;iBACxL,CAAC;YACF,4EAA4E;YAC5E,IAAI,EAAE,CAAC,kBAAkB,EAAE,gBAAg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 +1,3 @@
1
+ import type { MoveReport } from './move-imports';
2
+ export declare function zod4Text(fileName: string, text: string, report: MoveReport): string;
3
+ //# sourceMappingURL=zod4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod4.d.ts","sourceRoot":"","sources":["../src/zod4.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAmCjD,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAyCnF"}
package/dist/zod4.js ADDED
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.zod4Text = zod4Text;
37
+ const ts = __importStar(require("typescript"));
38
+ /**
39
+ * The part of the move to zod 4 that is mechanical (SPEC-0037 F3). In zod 4 `z.record` takes the key schema too:
40
+ * `z.record(x)` becomes `z.record(z.string(), x)`. What is not mechanical is flagged, not rewritten.
41
+ *
42
+ * It only acts in a file that gets `z` from `zod` or from `@backendkit-labs/agent-core`, and only on that name, so a
43
+ * `.record(...)` of anything else is left alone.
44
+ */
45
+ const ZOD_MODULES = new Set(['zod', 'zod/v4', '@backendkit-labs/agent-core']);
46
+ const TODO = '// TODO(codemod):';
47
+ /** The local names of `z` in a file: `import { z }`, `import { z as zz }`, `import * as z from 'zod'`, `import z from 'zod'`. */
48
+ function zodNames(sf) {
49
+ const names = new Set();
50
+ for (const s of sf.statements) {
51
+ if (!ts.isImportDeclaration(s) || !ts.isStringLiteral(s.moduleSpecifier) || !ZOD_MODULES.has(s.moduleSpecifier.text))
52
+ continue;
53
+ const clause = s.importClause;
54
+ if (!clause || clause.isTypeOnly)
55
+ continue; // a type-only `z` cannot be called
56
+ if (clause.name && s.moduleSpecifier.text !== '@backendkit-labs/agent-core')
57
+ names.add(clause.name.text);
58
+ const b = clause.namedBindings;
59
+ if (b && ts.isNamespaceImport(b) && s.moduleSpecifier.text !== '@backendkit-labs/agent-core')
60
+ names.add(b.name.text);
61
+ if (b && ts.isNamedImports(b))
62
+ for (const e of b.elements)
63
+ if (!e.isTypeOnly && (e.propertyName ?? e.name).text === 'z')
64
+ names.add(e.name.text);
65
+ }
66
+ return names;
67
+ }
68
+ /** The statement of the top level that holds a node. */
69
+ function topLevel(sf, node) {
70
+ let n = node;
71
+ while (n.parent && n.parent !== sf)
72
+ n = n.parent;
73
+ return n;
74
+ }
75
+ function zod4Text(fileName, text, report) {
76
+ const sf = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
77
+ const names = zodNames(sf);
78
+ if (names.size === 0)
79
+ return text;
80
+ const newline = text.includes('\r\n') ? '\r\n' : '\n';
81
+ const edits = [];
82
+ const flagged = new Set();
83
+ const visit = (n) => {
84
+ if (ts.isCallExpression(n) && ts.isPropertyAccessExpression(n.expression) && n.expression.name.text === 'record'
85
+ && ts.isIdentifier(n.expression.expression) && names.has(n.expression.expression.text) && n.arguments.length === 1) {
86
+ const z = n.expression.expression.text;
87
+ const arg = n.arguments[0];
88
+ // A spread could hold both arguments; leave it.
89
+ if (!ts.isSpreadElement(arg)) {
90
+ edits.push({ start: arg.getStart(), end: arg.getStart(), text: `${z}.string(), ` });
91
+ report.moved.push(`${fileName}: ${z}.record(x) -> ${z}.record(${z}.string(), x)`);
92
+ }
93
+ }
94
+ // Zod 4 reads one `error` where zod 3 had two keys; the messages of the library changed too, so a person looks.
95
+ if (ts.isPropertyAssignment(n) && ts.isIdentifier(n.name) && (n.name.text === 'invalid_type_error' || n.name.text === 'required_error')) {
96
+ flagged.add(topLevel(sf, n));
97
+ }
98
+ ts.forEachChild(n, visit);
99
+ };
100
+ visit(sf);
101
+ const message = 'invalid_type_error and required_error are one `error` in zod 4, and its messages changed; see the migration guide';
102
+ for (const s of flagged) {
103
+ const has = (ts.getLeadingCommentRanges(text, s.getFullStart()) ?? []).some(c => text.slice(c.pos, c.end).includes(message));
104
+ if (has)
105
+ continue;
106
+ const lineStart = text.lastIndexOf('\n', s.getStart() - 1) + 1;
107
+ edits.push({ start: s.getStart(), end: s.getStart(), text: `${TODO} ${message}${newline}${text.slice(lineStart, s.getStart())}` });
108
+ report.flagged.push(`${fileName}: invalid_type_error / required_error`);
109
+ }
110
+ if (edits.length === 0)
111
+ return text;
112
+ edits.sort((a, b) => b.start - a.start);
113
+ let out = text;
114
+ for (const e of edits)
115
+ out = out.slice(0, e.start) + e.text + out.slice(e.end);
116
+ return out;
117
+ }
118
+ //# sourceMappingURL=zod4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod4.js","sourceRoot":"","sources":["../src/zod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;IAC/E,OAAO,GAAG,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
- {
2
- "name": "@backendkit-labs/codemod",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@backendkit-labs/codemod",
3
+ "version": "0.1.0",
4
+ "description": "Automated migrations for the breaking releases of @backendkit-labs/agent-core and agent-coding: moves imports, flags what needs a decision",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "codemod": "./bin/codemod.js"
9
+ },
10
+ "files": [
11
+ "dist/",
12
+ "bin/",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "typecheck": "tsc --noEmit",
18
+ "prepublishOnly": "npm run build",
19
+ "test": "jest"
20
+ },
21
+ "devDependencies": {
22
+ "@types/jest": "^29.0.0",
23
+ "@types/node": "^20.0.0",
24
+ "jest": "^29.0.0",
25
+ "ts-jest": "^29.0.0"
26
+ },
27
+ "engines": {
28
+ "node": ">=20.0.0"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/BackendKit-labs/backendkit-agent-framework.git",
33
+ "directory": "packages/codemod"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "license": "MIT",
39
+ "dependencies": {
40
+ "typescript": "^5.4.0"
41
+ }
42
+ }