@procedures/lib 0.0.0-stage → 0.2.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -2
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/cli-flags.d.ts +27 -0
  6. package/dist/cli-flags.d.ts.map +1 -0
  7. package/dist/cli-flags.js +33 -0
  8. package/dist/cli-flags.js.map +1 -0
  9. package/dist/dag/builder.d.ts +18 -0
  10. package/dist/dag/builder.d.ts.map +1 -0
  11. package/dist/dag/builder.js +35 -0
  12. package/dist/dag/builder.js.map +1 -0
  13. package/dist/dag/index.d.ts +12 -0
  14. package/dist/dag/index.d.ts.map +1 -0
  15. package/dist/dag/index.js +12 -0
  16. package/dist/dag/index.js.map +1 -0
  17. package/dist/git/index.d.ts +5 -0
  18. package/dist/git/index.d.ts.map +1 -0
  19. package/dist/git/index.js +5 -0
  20. package/dist/git/index.js.map +1 -0
  21. package/dist/git/ref-parser.d.ts +34 -0
  22. package/dist/git/ref-parser.d.ts.map +1 -0
  23. package/dist/git/ref-parser.js +70 -0
  24. package/dist/git/ref-parser.js.map +1 -0
  25. package/dist/index.d.ts +14 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +19 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/module.d.ts +22 -0
  30. package/dist/module.d.ts.map +1 -0
  31. package/dist/module.js +180 -0
  32. package/dist/module.js.map +1 -0
  33. package/dist/procedures/core/catch.d.ts +33 -0
  34. package/dist/procedures/core/catch.d.ts.map +1 -0
  35. package/dist/procedures/core/catch.js +118 -0
  36. package/dist/procedures/core/catch.js.map +1 -0
  37. package/dist/procedures/core/index.d.ts +9 -0
  38. package/dist/procedures/core/index.d.ts.map +1 -0
  39. package/dist/procedures/core/index.js +8 -0
  40. package/dist/procedures/core/index.js.map +1 -0
  41. package/dist/procedures/dag/index.d.ts +5 -0
  42. package/dist/procedures/dag/index.d.ts.map +1 -0
  43. package/dist/procedures/dag/index.js +5 -0
  44. package/dist/procedures/dag/index.js.map +1 -0
  45. package/dist/procedures/dag/traverse.d.ts +54 -0
  46. package/dist/procedures/dag/traverse.d.ts.map +1 -0
  47. package/dist/procedures/dag/traverse.js +252 -0
  48. package/dist/procedures/dag/traverse.js.map +1 -0
  49. package/dist/procedures/ecosystem/index.d.ts +7 -0
  50. package/dist/procedures/ecosystem/index.d.ts.map +1 -0
  51. package/dist/procedures/ecosystem/index.js +6 -0
  52. package/dist/procedures/ecosystem/index.js.map +1 -0
  53. package/dist/procedures/ecosystem/procedures.d.ts +63 -0
  54. package/dist/procedures/ecosystem/procedures.d.ts.map +1 -0
  55. package/dist/procedures/ecosystem/procedures.js +215 -0
  56. package/dist/procedures/ecosystem/procedures.js.map +1 -0
  57. package/dist/procedures/lib/audit.d.ts +29 -0
  58. package/dist/procedures/lib/audit.d.ts.map +1 -0
  59. package/dist/procedures/lib/audit.js +236 -0
  60. package/dist/procedures/lib/audit.js.map +1 -0
  61. package/dist/procedures/lib/index.d.ts +8 -0
  62. package/dist/procedures/lib/index.d.ts.map +1 -0
  63. package/dist/procedures/lib/index.js +8 -0
  64. package/dist/procedures/lib/index.js.map +1 -0
  65. package/dist/procedures/lib/new.d.ts +20 -0
  66. package/dist/procedures/lib/new.d.ts.map +1 -0
  67. package/dist/procedures/lib/new.js +205 -0
  68. package/dist/procedures/lib/new.js.map +1 -0
  69. package/dist/procedures/lib/rename.d.ts +28 -0
  70. package/dist/procedures/lib/rename.d.ts.map +1 -0
  71. package/dist/procedures/lib/rename.js +267 -0
  72. package/dist/procedures/lib/rename.js.map +1 -0
  73. package/dist/procedures/lib/scan.d.ts +14 -0
  74. package/dist/procedures/lib/scan.d.ts.map +1 -0
  75. package/dist/procedures/lib/scan.js +102 -0
  76. package/dist/procedures/lib/scan.js.map +1 -0
  77. package/dist/register.d.ts +7 -0
  78. package/dist/register.d.ts.map +1 -0
  79. package/dist/register.js +9 -0
  80. package/dist/register.js.map +1 -0
  81. package/dist/scoped-input.d.ts +17 -0
  82. package/dist/scoped-input.d.ts.map +1 -0
  83. package/dist/scoped-input.js +23 -0
  84. package/dist/scoped-input.js.map +1 -0
  85. package/dist/types.d.ts +248 -0
  86. package/dist/types.d.ts.map +1 -0
  87. package/dist/types.js +231 -0
  88. package/dist/types.js.map +1 -0
  89. package/dist/workspace.d.ts +46 -0
  90. package/dist/workspace.d.ts.map +1 -0
  91. package/dist/workspace.js +98 -0
  92. package/dist/workspace.js.map +1 -0
  93. package/package.json +87 -3
  94. package/src/cli-flags.ts +49 -0
  95. package/src/dag/builder.ts +44 -0
  96. package/src/dag/index.ts +23 -0
  97. package/src/git/index.ts +11 -0
  98. package/src/git/ref-parser.ts +83 -0
  99. package/src/index.ts +56 -0
  100. package/src/module.ts +232 -0
  101. package/src/procedures/core/catch.ts +142 -0
  102. package/src/procedures/core/index.ts +9 -0
  103. package/src/procedures/dag/index.ts +5 -0
  104. package/src/procedures/dag/traverse.ts +281 -0
  105. package/src/procedures/ecosystem/index.ts +12 -0
  106. package/src/procedures/ecosystem/procedures.ts +317 -0
  107. package/src/procedures/lib/audit.ts +307 -0
  108. package/src/procedures/lib/index.ts +8 -0
  109. package/src/procedures/lib/new.ts +253 -0
  110. package/src/procedures/lib/rename.ts +355 -0
  111. package/src/procedures/lib/scan.ts +143 -0
  112. package/src/register.ts +11 -0
  113. package/src/types.ts +526 -0
  114. package/src/workspace.ts +110 -0
@@ -0,0 +1,205 @@
1
+ /**
2
+ * lib.new procedure
3
+ *
4
+ * Creates a new client package in the workspace, at packages/<name>, with the
5
+ * structure the other client packages have: cue-config files, src/module.ts (the procedures as
6
+ * data), src/register.ts (the only file with a side effect), src/index.ts, src/types.ts, the
7
+ * "./module" and "./register" exports and the "client.procedures" field. Importing the package
8
+ * root registers nothing (ARCHITECTURE-PROPOSALS-2026-10, P9). `mark procedure new` then adds
9
+ * procedures to the module, and they compile.
10
+ * Uses fs.* and shell.* procedures via ctx.client.call() for all operations.
11
+ *
12
+ * After it, run `pnpm install` and `pnpm build` in the workspace root.
13
+ */
14
+ import { join } from "node:path";
15
+ import { packagesDir, resolveWorkspaceRoot } from "../../workspace.js";
16
+ // The root registers nothing: `import "<package>/register"` or `createRegistry()` registers the procedures
17
+ const INDEX_TS = `// The root registers nothing: import "<package>/register", or give the module to createRegistry()
18
+ export * from "./module.js";
19
+ export * from "./types.js";
20
+ `;
21
+ // \`mark procedure new\` appends the types of each procedure, and adds the zod import then.
22
+ // An unused import here would fail noUnusedLocals (deep dive CLI-13).
23
+ const TYPES_TS = `/**
24
+ * Type definitions of the procedures of this package
25
+ *
26
+ * mark procedure new adds the types of each new procedure here.
27
+ */
28
+
29
+ export {};
30
+ `;
31
+ /** The names of a package folder in code: "my-package" gives "myPackage" and "MyPackage". */
32
+ function codeNames(name) {
33
+ const pascal = name
34
+ .split(/[^A-Za-z0-9]+/)
35
+ .filter(Boolean)
36
+ .map((part) => part[0].toUpperCase() + part.slice(1))
37
+ .join("");
38
+ return { camel: pascal[0].toLowerCase() + pascal.slice(1), pascal };
39
+ }
40
+ function moduleTs(name, packageName) {
41
+ const { camel, pascal } = codeNames(name);
42
+ return `/**
43
+ * The procedures of ${packageName} as data. Importing this file registers nothing.
44
+ *
45
+ * Scaffold a procedure with: mark procedure new <name> --path packages/${name}
46
+ */
47
+
48
+ import { defineModule, registerModules, PROCEDURE_REGISTRY, type ProcedureModule, type ProcedureRegistry } from "@procedures/client";
49
+
50
+ export const ${camel}Module: ProcedureModule = defineModule("${packageName}", []);
51
+
52
+ export default ${camel}Module;
53
+
54
+ /**
55
+ * This function registers the procedures of ${packageName} in a registry. The default is the
56
+ * global registry.
57
+ */
58
+ export function register${pascal}Procedures(registry: ProcedureRegistry = PROCEDURE_REGISTRY): void {
59
+ registerModules(registry, [${camel}Module]);
60
+ }
61
+ `;
62
+ }
63
+ function registerTs(name, packageName) {
64
+ const { pascal } = codeNames(name);
65
+ return `/**
66
+ * Importing this file registers the procedures of ${packageName} in the global registry:
67
+ * \`import "${packageName}/register"\`. The package root registers nothing.
68
+ */
69
+
70
+ import { register${pascal}Procedures } from "./module.js";
71
+
72
+ export * from "./module.js";
73
+
74
+ register${pascal}Procedures();
75
+ `;
76
+ }
77
+ /**
78
+ * Run the workspace's cue-config CLI (not npx: a new package has no node_modules,
79
+ * and npx would download an unrelated package from the registry).
80
+ */
81
+ async function runCueConfig(cueCli, args, cwd, ctx) {
82
+ const result = await ctx.client.call(["shell", "run"], { command: process.execPath, args: [cueCli, ...args], cwd });
83
+ if (!result.success) {
84
+ throw new Error(`cue-config ${args.join(" ")} failed (exit ${result.exitCode}): ${result.stderr || result.stdout}`);
85
+ }
86
+ }
87
+ /**
88
+ * Create a new client package in the workspace
89
+ */
90
+ export async function libNew(input, ctx) {
91
+ const operations = [];
92
+ const created = [];
93
+ const errors = [];
94
+ const packageName = `@procedures/${input.name}`;
95
+ let rootPath;
96
+ try {
97
+ rootPath = resolveWorkspaceRoot(input.rootPath);
98
+ }
99
+ catch (error) {
100
+ return {
101
+ success: false,
102
+ packageName,
103
+ packagePath: "",
104
+ created: [],
105
+ operations: [],
106
+ errors: [error instanceof Error ? error.message : String(error)],
107
+ };
108
+ }
109
+ const packagePath = join(packagesDir(rootPath), input.name);
110
+ const cueCli = join(rootPath, "node_modules", "@mark1russell7", "cue", "dist", "cli.js");
111
+ // Check if package already exists
112
+ const existsResult = await ctx.client.call(["fs", "exists"], { path: packagePath });
113
+ if (existsResult.exists) {
114
+ return {
115
+ success: false,
116
+ packageName,
117
+ packagePath,
118
+ created: [],
119
+ operations: [],
120
+ errors: [`Package directory already exists: ${packagePath}`],
121
+ };
122
+ }
123
+ const files = [
124
+ join(packagePath, "src", "index.ts"),
125
+ join(packagePath, "src", "module.ts"),
126
+ join(packagePath, "src", "register.ts"),
127
+ join(packagePath, "src", "types.ts"),
128
+ join(packagePath, "dependencies.json"),
129
+ join(packagePath, "package.json"),
130
+ join(packagePath, "tsconfig.json"),
131
+ join(packagePath, ".gitignore"),
132
+ ];
133
+ if (input.dryRun) {
134
+ return {
135
+ success: true,
136
+ packageName,
137
+ packagePath,
138
+ created: [`${packagePath}/`, `${join(packagePath, "src")}/`, ...files],
139
+ operations: [
140
+ "Would create packages/" + input.name + " with src/index.ts, src/module.ts, src/register.ts and src/types.ts",
141
+ `Would run cue-config init --preset ${input.preset}`,
142
+ "Would run cue-config generate",
143
+ `Would set the package name to ${packageName}, the exports, client.procedures and the client dependency`,
144
+ "Then run pnpm install and pnpm build in the workspace root",
145
+ ],
146
+ errors: [],
147
+ };
148
+ }
149
+ try {
150
+ // Step 1: Create the folders and the source files
151
+ operations.push("Creating directory structure");
152
+ await ctx.client.call(["fs", "mkdir"], { path: join(packagePath, "src"), recursive: true });
153
+ created.push(`${packagePath}/`, `${join(packagePath, "src")}/`);
154
+ for (const [file, content] of [
155
+ [join(packagePath, "src", "index.ts"), INDEX_TS],
156
+ [join(packagePath, "src", "module.ts"), moduleTs(input.name, packageName)],
157
+ [join(packagePath, "src", "register.ts"), registerTs(input.name, packageName)],
158
+ [join(packagePath, "src", "types.ts"), TYPES_TS],
159
+ ]) {
160
+ await ctx.client.call(["fs", "write"], { path: file, content });
161
+ created.push(file);
162
+ }
163
+ // Step 2: cue-config init and generate (dependencies.json, package.json, tsconfig.json, .gitignore)
164
+ operations.push(`Running cue-config init --preset ${input.preset}`);
165
+ await runCueConfig(cueCli, ["init", "--preset", input.preset, "--force"], packagePath, ctx);
166
+ created.push(join(packagePath, "dependencies.json"));
167
+ operations.push("Running cue-config generate");
168
+ await runCueConfig(cueCli, ["generate"], packagePath, ctx);
169
+ created.push(join(packagePath, "package.json"), join(packagePath, "tsconfig.json"), join(packagePath, ".gitignore"));
170
+ // Step 3: cue-config writes the CUE default name ("unnamed") and no client fields.
171
+ // Set what a client package needs (see documentation/BUGS-2026-07.md, C5).
172
+ operations.push("Setting the package fields");
173
+ const pkgJsonPath = join(packagePath, "package.json");
174
+ const pkgReadResult = await ctx.client.call(["fs", "read.json"], { path: pkgJsonPath });
175
+ const pkgJson = (pkgReadResult.data ?? {});
176
+ pkgJson["name"] = packageName;
177
+ pkgJson["exports"] = {
178
+ ".": { types: "./dist/index.d.ts", import: "./dist/index.js" },
179
+ "./module": { types: "./dist/module.d.ts", import: "./dist/module.js" },
180
+ "./register": { types: "./dist/register.d.ts", import: "./dist/register.js" },
181
+ };
182
+ // Only the register entry has a side effect, so a bundler can drop the rest
183
+ pkgJson["sideEffects"] = ["./dist/register.js"];
184
+ pkgJson["client"] = { procedures: "./dist/register.js" };
185
+ pkgJson["dependencies"] = {
186
+ ...(pkgJson["dependencies"] ?? {}),
187
+ "@procedures/client": "workspace:*",
188
+ zod: "^4.6.5",
189
+ };
190
+ await ctx.client.call(["fs", "write"], { path: pkgJsonPath, content: JSON.stringify(pkgJson, null, 2) + "\n" });
191
+ operations.push(`Created ${packageName}. Next: run pnpm install and pnpm build in ${rootPath}`);
192
+ }
193
+ catch (error) {
194
+ errors.push(error instanceof Error ? error.message : String(error));
195
+ }
196
+ return {
197
+ success: errors.length === 0,
198
+ packageName,
199
+ packagePath,
200
+ created,
201
+ operations,
202
+ errors,
203
+ };
204
+ }
205
+ //# sourceMappingURL=new.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new.js","sourceRoot":"","sources":["../../../src/procedures/lib/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AASvE,2GAA2G;AAC3G,MAAM,QAAQ,GAAG;;;CAGhB,CAAC;AAEF,4FAA4F;AAC5F,sEAAsE;AACtE,MAAM,QAAQ,GAAG;;;;;;;CAOhB,CAAC;AAEF,6FAA6F;AAC7F,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,MAAM,GAAG,IAAI;SAChB,K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GAAG,EAAE,QAAQ;SACd,CAAC;QACF,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CACnB,CAAC,IAAI,EAAE,OAAO,CAAC,EACf,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CACxE,CAAC;QACF,UAAU,CAAC,IAAI,CAAC,WAAW,WAAW,8CAA8C,QAAQ,EAAE,CAAC,CAAC;IAClG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,IAAI,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,WAAW;QACX,WAAW;QACX,OAAO;QACP,UAAU;QACV,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * lib.rename Procedure
3
+ *
4
+ * Renames a package across the entire codebase using ts-morph for AST-based
5
+ * import updates and direct file manipulation for package.json updates.
6
+ *
7
+ * Uses:
8
+ * - ts-morph: AST manipulation for TypeScript imports
9
+ * - File system operations for package.json updates
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * await client.call(["lib", "rename"], {
14
+ * oldName: "client",
15
+ * newName: "@procedures/client",
16
+ * dryRun: true, // Preview changes without applying
17
+ * });
18
+ * ```
19
+ *
20
+ * The search root is `rootPath`, or else the workspace that contains client-lib.
21
+ */
22
+ import type { ProcedureContext } from "@procedures/client";
23
+ import type { LibRenameInput, LibRenameOutput } from "../../types.js";
24
+ /**
25
+ * Execute the lib.rename procedure
26
+ */
27
+ export declare function libRename(input: LibRenameInput, ctx: ProcedureContext): Promise<LibRenameOutput>;
28
+ //# sourceMappingURL=rename.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/rename.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AA0OpF;;GAEG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CA6FtG"}
@@ -0,0 +1,267 @@
1
+ /**
2
+ * lib.rename Procedure
3
+ *
4
+ * Renames a package across the entire codebase using ts-morph for AST-based
5
+ * import updates and direct file manipulation for package.json updates.
6
+ *
7
+ * Uses:
8
+ * - ts-morph: AST manipulation for TypeScript imports
9
+ * - File system operations for package.json updates
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * await client.call(["lib", "rename"], {
14
+ * oldName: "client",
15
+ * newName: "@procedures/client",
16
+ * dryRun: true, // Preview changes without applying
17
+ * });
18
+ * ```
19
+ *
20
+ * The search root is `rootPath`, or else the workspace that contains client-lib.
21
+ */
22
+ import { Project, SyntaxKind } from "ts-morph";
23
+ import { resolveWorkspaceRoot } from "../../workspace.js";
24
+ // The folders that hold no source of the workspace
25
+ const IGNORE = ["**/node_modules/**", "**/dist/**", "**/.git/**"];
26
+ /**
27
+ * Find all package.json files under a root path (excluding node_modules)
28
+ */
29
+ async function findPackageJsonFiles(rootPath, ctx) {
30
+ const result = await ctx.client.call(["fs", "glob"], { pattern: "**/package.json", cwd: rootPath, absolute: true, ignore: IGNORE });
31
+ // fs.glob returns `matches`. (Before, this read `files`, which does not exist: deep dive DATA-7.)
32
+ return result.matches;
33
+ }
34
+ /**
35
+ * Find all TypeScript files under a root path (excluding node_modules, dist)
36
+ */
37
+ async function findTypeScriptFiles(rootPath, ctx) {
38
+ const result = await ctx.client.call(["fs", "glob"], { pattern: "**/*.{ts,tsx}", cwd: rootPath, absolute: true, ignore: IGNORE });
39
+ return result.matches;
40
+ }
41
+ /**
42
+ * Update package.json name field
43
+ */
44
+ async function updatePackageJsonName(pkgPath, oldName, newName, dryRun, ctx) {
45
+ try {
46
+ const result = await ctx.client.call(["fs", "read.json"], { path: pkgPath });
47
+ const pkg = result.data;
48
+ if (pkg.name === oldName) {
49
+ if (!dryRun) {
50
+ pkg.name = newName;
51
+ await ctx.client.call(["fs", "write"], { path: pkgPath, content: JSON.stringify(pkg, null, 2) + "\n" });
52
+ }
53
+ return {
54
+ type: "package-name",
55
+ file: pkgPath,
56
+ oldValue: oldName,
57
+ newValue: newName,
58
+ };
59
+ }
60
+ }
61
+ catch {
62
+ // Skip files we can't parse
63
+ }
64
+ return null;
65
+ }
66
+ /**
67
+ * Update package.json dependencies
68
+ */
69
+ async function updatePackageJsonDependencies(pkgPath, oldName, newName, dryRun, ctx) {
70
+ const changes = [];
71
+ try {
72
+ const result = await ctx.client.call(["fs", "read.json"], { path: pkgPath });
73
+ const pkg = result.data;
74
+ let modified = false;
75
+ const depFields = ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"];
76
+ for (const field of depFields) {
77
+ const deps = pkg[field];
78
+ if (deps && oldName in deps) {
79
+ const oldValue = deps[oldName];
80
+ let newValue = oldValue;
81
+ // The repository of a git dependency has the name of the package without its scope
82
+ const bare = (name) => name.replace(/^@[^/]+\//, "");
83
+ if (oldValue.includes(`github:mark1russell7/${bare(oldName)}`)) {
84
+ newValue = oldValue.replace(`github:mark1russell7/${bare(oldName)}`, `github:mark1russell7/${bare(newName)}`);
85
+ }
86
+ if (!dryRun) {
87
+ delete deps[oldName];
88
+ deps[newName] = newValue;
89
+ }
90
+ changes.push({
91
+ type: "dependency",
92
+ file: pkgPath,
93
+ field,
94
+ oldValue: `"${oldName}": "${oldValue}"`,
95
+ newValue: `"${newName}": "${newValue}"`,
96
+ });
97
+ modified = true;
98
+ }
99
+ }
100
+ if (modified && !dryRun) {
101
+ await ctx.client.call(["fs", "write"], { path: pkgPath, content: JSON.stringify(pkg, null, 2) + "\n" });
102
+ }
103
+ }
104
+ catch {
105
+ // Skip files we can't parse
106
+ }
107
+ return changes;
108
+ }
109
+ /**
110
+ * Update TypeScript imports using ts-morph
111
+ */
112
+ function updateTypeScriptImports(tsFiles, oldName, newName, dryRun) {
113
+ const changes = [];
114
+ // Create ts-morph project
115
+ const project = new Project({
116
+ skipAddingFilesFromTsConfig: true,
117
+ skipFileDependencyResolution: true,
118
+ });
119
+ // Add files to project
120
+ for (const filePath of tsFiles) {
121
+ try {
122
+ project.addSourceFileAtPath(filePath);
123
+ }
124
+ catch {
125
+ // Skip files we can't add
126
+ }
127
+ }
128
+ // Process each source file
129
+ for (const sourceFile of project.getSourceFiles()) {
130
+ let fileModified = false;
131
+ // Find all import declarations
132
+ const importDecls = sourceFile.getImportDeclarations();
133
+ for (const importDecl of importDecls) {
134
+ const moduleSpecifier = importDecl.getModuleSpecifierValue();
135
+ // Check if this import matches the old package name
136
+ // Match exact name or subpath imports (e.g., "client" or "client/something")
137
+ if (moduleSpecifier === oldName || moduleSpecifier.startsWith(`${oldName}/`)) {
138
+ const newSpecifier = moduleSpecifier.replace(oldName, newName);
139
+ changes.push({
140
+ type: "import",
141
+ file: sourceFile.getFilePath(),
142
+ line: importDecl.getStartLineNumber(),
143
+ oldValue: `from "${moduleSpecifier}"`,
144
+ newValue: `from "${newSpecifier}"`,
145
+ });
146
+ if (!dryRun) {
147
+ importDecl.setModuleSpecifier(newSpecifier);
148
+ fileModified = true;
149
+ }
150
+ }
151
+ }
152
+ // Also check dynamic imports (import())
153
+ const callExpressions = sourceFile.getDescendantsOfKind(SyntaxKind.CallExpression);
154
+ for (const call of callExpressions) {
155
+ const expression = call.getExpression();
156
+ if (expression.getKind() === SyntaxKind.ImportKeyword) {
157
+ const args = call.getArguments();
158
+ if (args.length > 0) {
159
+ const arg = args[0];
160
+ if (arg.getKind() === SyntaxKind.StringLiteral) {
161
+ const value = arg.getText().slice(1, -1); // Remove quotes
162
+ if (value === oldName || value.startsWith(`${oldName}/`)) {
163
+ const newValue = value.replace(oldName, newName);
164
+ changes.push({
165
+ type: "dynamic-import",
166
+ file: sourceFile.getFilePath(),
167
+ line: call.getStartLineNumber(),
168
+ oldValue: `import("${value}")`,
169
+ newValue: `import("${newValue}")`,
170
+ });
171
+ if (!dryRun) {
172
+ arg.replaceWithText(`"${newValue}"`);
173
+ fileModified = true;
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ }
180
+ // Save if modified
181
+ if (fileModified && !dryRun) {
182
+ sourceFile.saveSync();
183
+ }
184
+ }
185
+ return changes;
186
+ }
187
+ /**
188
+ * Execute the lib.rename procedure
189
+ */
190
+ export async function libRename(input, ctx) {
191
+ const { oldName, newName, dryRun = false } = input;
192
+ const changes = [];
193
+ const errors = [];
194
+ // Resolve path: the given root, else the workspace that contains client-lib
195
+ let resolvedRoot;
196
+ try {
197
+ resolvedRoot = resolveWorkspaceRoot(input.rootPath);
198
+ }
199
+ catch (error) {
200
+ return {
201
+ success: false,
202
+ changes: [],
203
+ errors: [error instanceof Error ? error.message : String(error)],
204
+ summary: { packageNames: 0, dependencies: 0, imports: 0, total: 0 },
205
+ };
206
+ }
207
+ const existsResult = await ctx.client.call(["fs", "exists"], { path: resolvedRoot });
208
+ if (!existsResult.exists) {
209
+ return {
210
+ success: false,
211
+ changes: [],
212
+ errors: [`Root path does not exist: ${resolvedRoot}`],
213
+ summary: { packageNames: 0, dependencies: 0, imports: 0, total: 0 },
214
+ };
215
+ }
216
+ console.error(`[lib.rename] ${dryRun ? "[DRY RUN] " : ""}Renaming "${oldName}" → "${newName}"`);
217
+ console.error(`[lib.rename] Scanning ${resolvedRoot}...`);
218
+ // Find all package.json files
219
+ const packageJsonFiles = await findPackageJsonFiles(resolvedRoot, ctx);
220
+ console.error(`[lib.rename] Found ${packageJsonFiles.length} package.json files`);
221
+ // Find all TypeScript files
222
+ const tsFiles = await findTypeScriptFiles(resolvedRoot, ctx);
223
+ console.error(`[lib.rename] Found ${tsFiles.length} TypeScript files`);
224
+ // 1. Update package.json name field (find the package being renamed)
225
+ for (const pkgPath of packageJsonFiles) {
226
+ const change = await updatePackageJsonName(pkgPath, oldName, newName, dryRun, ctx);
227
+ if (change) {
228
+ changes.push(change);
229
+ console.error(`[lib.rename] ${dryRun ? "Would update" : "Updated"} package name: ${pkgPath}`);
230
+ }
231
+ }
232
+ // 2. Update package.json dependencies
233
+ for (const pkgPath of packageJsonFiles) {
234
+ const depChanges = await updatePackageJsonDependencies(pkgPath, oldName, newName, dryRun, ctx);
235
+ changes.push(...depChanges);
236
+ if (depChanges.length > 0) {
237
+ console.error(`[lib.rename] ${dryRun ? "Would update" : "Updated"} ${depChanges.length} dependencies in: ${pkgPath}`);
238
+ }
239
+ }
240
+ // 3. Update TypeScript imports using ts-morph
241
+ try {
242
+ const importChanges = updateTypeScriptImports(tsFiles, oldName, newName, dryRun);
243
+ changes.push(...importChanges);
244
+ if (importChanges.length > 0) {
245
+ console.error(`[lib.rename] ${dryRun ? "Would update" : "Updated"} ${importChanges.length} TypeScript imports`);
246
+ }
247
+ }
248
+ catch (error) {
249
+ const errorMessage = error instanceof Error ? error.message : String(error);
250
+ errors.push(`Error updating TypeScript imports: ${errorMessage}`);
251
+ }
252
+ // Build summary
253
+ const summary = {
254
+ packageNames: changes.filter((c) => c.type === "package-name").length,
255
+ dependencies: changes.filter((c) => c.type === "dependency").length,
256
+ imports: changes.filter((c) => c.type === "import" || c.type === "dynamic-import").length,
257
+ total: changes.length,
258
+ };
259
+ console.error(`[lib.rename] Summary: ${summary.packageNames} package names, ${summary.dependencies} dependencies, ${summary.imports} imports`);
260
+ return {
261
+ success: errors.length === 0,
262
+ changes,
263
+ errors,
264
+ summary,
265
+ };
266
+ }
267
+ //# sourceMappingURL=rename.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rename.js","sourceRoot":"","sources":["../../../src/procedures/l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CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,MAAM;QACnE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC,MAAM;QACzF,KAAK,EAAE,OAAO,CAAC,MAAM;KACtB,CAAC;IAEF,OAAO,CAAC,KAAK,CAAC,yBAAyB,OAAO,CAAC,YAAY,mBAAmB,OAAO,CAAC,YAAY,kBAAkB,OAAO,CAAC,OAAO,UAAU,CAAC,CAAC;IAE/I,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,OAAO;QACP,MAAM;QACN,OAAO;KACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * lib.scan procedure
3
+ *
4
+ * Scans the packages of the workspace (`<root>/packages/*`). The root is the pnpm
5
+ * workspace that contains client-lib, unless the input gives `rootPath`.
6
+ * All packages share one git repository, so the branch and the remote are read once.
7
+ */
8
+ import type { ProcedureContext } from "@procedures/client";
9
+ import type { LibScanInput, LibScanOutput } from "../../types.js";
10
+ /**
11
+ * Scan the workspace packages
12
+ */
13
+ export declare function libScan(input: LibScanInput, ctx: ProcedureContext): Promise<LibScanOutput>;
14
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/procedures/lib/scan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAe,MAAM,gBAAgB,CAAC;AAqE/E;;GAEG;AACH,wBAAsB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CA4DhG"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * lib.scan procedure
3
+ *
4
+ * Scans the packages of the workspace (`<root>/packages/*`). The root is the pnpm
5
+ * workspace that contains client-lib, unless the input gives `rootPath`.
6
+ * All packages share one git repository, so the branch and the remote are read once.
7
+ */
8
+ import { join } from "node:path";
9
+ import { extractEcosystemDeps, packagesDir, resolveWorkspaceRoot } from "../../workspace.js";
10
+ /**
11
+ * Read and parse package.json from a directory using fs.read.json
12
+ */
13
+ async function readPackageJson(dirPath, ctx) {
14
+ try {
15
+ const result = await ctx.client.call(["fs", "read.json"], { path: join(dirPath, "package.json") });
16
+ return result.data;
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ }
22
+ /**
23
+ * Read the branch and the origin remote of the repository that holds the workspace
24
+ */
25
+ async function readRepositoryInfo(rootPath, ctx) {
26
+ try {
27
+ const status = await ctx.client.call(["git", "status"], { cwd: rootPath });
28
+ let remote;
29
+ try {
30
+ const result = await ctx.client.call(["git", "remote"], { cwd: rootPath, name: "origin" });
31
+ remote = result.url;
32
+ }
33
+ catch {
34
+ // No remote configured - that's fine
35
+ }
36
+ return remote === undefined ? { branch: status.branch } : { branch: status.branch, remote };
37
+ }
38
+ catch (error) {
39
+ return { warning: `Git not initialized: ${error instanceof Error ? error.message : String(error)}` };
40
+ }
41
+ }
42
+ /**
43
+ * Scan the workspace packages
44
+ */
45
+ export async function libScan(input, ctx) {
46
+ const packages = {};
47
+ const warnings = [];
48
+ let rootPath;
49
+ try {
50
+ rootPath = resolveWorkspaceRoot(input.rootPath);
51
+ }
52
+ catch (error) {
53
+ warnings.push({
54
+ path: input.rootPath ?? process.cwd(),
55
+ issue: error instanceof Error ? error.message : String(error),
56
+ });
57
+ return { packages, warnings };
58
+ }
59
+ const dir = packagesDir(rootPath);
60
+ let entries;
61
+ try {
62
+ const result = await ctx.client.call(["fs", "readdir"], { path: dir });
63
+ entries = result.entries.filter((entry) => entry.type === "directory");
64
+ }
65
+ catch (error) {
66
+ warnings.push({
67
+ path: dir,
68
+ issue: `Failed to list workspace packages: ${error instanceof Error ? error.message : String(error)}`,
69
+ });
70
+ return { packages, warnings };
71
+ }
72
+ const repository = await readRepositoryInfo(rootPath, ctx);
73
+ if (repository.warning) {
74
+ warnings.push({ path: rootPath, issue: repository.warning });
75
+ }
76
+ for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
77
+ const pkgPath = join(dir, entry.name);
78
+ const pkg = await readPackageJson(pkgPath, ctx);
79
+ if (!pkg) {
80
+ warnings.push({ path: pkgPath, issue: "Failed to read package.json" });
81
+ continue;
82
+ }
83
+ if (!pkg.name) {
84
+ warnings.push({ path: pkgPath, issue: "package.json has no name" });
85
+ continue;
86
+ }
87
+ const info = {
88
+ name: pkg.name,
89
+ repoPath: pkgPath,
90
+ mark1russell7Deps: extractEcosystemDeps(pkg),
91
+ };
92
+ if (repository.branch !== undefined) {
93
+ info.currentBranch = repository.branch;
94
+ }
95
+ if (repository.remote !== undefined) {
96
+ info.gitRemote = repository.remote;
97
+ }
98
+ packages[pkg.name] = info;
99
+ }
100
+ return { packages, warnings };
101
+ }
102
+ //# sourceMappingURL=scan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.js","sourceRoot":"","sources":["../../../src/procedures/lib/scan.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AA4B7F;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,OAAe,EAAE,GAAqB;IACnE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAClC,CAAC,IAAI,EAAE,WAAW,CAAC,EACnB,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,cAAc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