codemodctl 0.1.28 → 0.1.30

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/cli.d.mts ADDED
@@ -0,0 +1,2 @@
1
+
2
+ export { };
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import "./codemod-cli-Bf23tAfy.js";
3
- import { t as analyzeCodeowners } from "./codeowner-analysis-CV8ViyRo.js";
4
- import "./consistent-sharding-jDHVRq1U.js";
5
- import { t as analyzeDirectories } from "./directory-analysis-BrskPjFj.js";
2
+ import { analyzeCodeowners } from "./codeowners.mjs";
3
+ import { analyzeDirectories } from "./directory.mjs";
6
4
  import { defineCommand, runMain } from "citty";
7
5
  import crypto from "node:crypto";
8
6
  import { $ } from "execa";
@@ -118,7 +116,10 @@ const createPrCommand = defineCommand({
118
116
  process.exit(1);
119
117
  }
120
118
  try {
121
- await $`git push origin ${codemodBranchName} --force`;
119
+ await $({ env: process.env.DEBUG ? {
120
+ GIT_TRACE: "1",
121
+ GIT_TRACE_PACKET: "1"
122
+ } : {} })`git push origin ${codemodBranchName} --force`;
122
123
  console.log(`Pushed branch to origin: ${codemodBranchName}`);
123
124
  } catch (error) {
124
125
  console.error("Error: Failed to push changes");
@@ -129,13 +130,15 @@ const createPrCommand = defineCommand({
129
130
  if (body) prData.body = body;
130
131
  if (head && !prData.head) prData.head = head;
131
132
  if (base && !prData.base) prData.base = base;
133
+ const prUrl = `${apiEndpoint}/api/butterflow/v1/tasks/${taskId}/pull-request`;
132
134
  try {
133
- console.debug("Creating pull request...");
134
- console.debug(`Title: ${title}`);
135
- if (body) console.debug(`Body: ${body}`);
136
- if (head) console.debug(`Head: ${head}`);
137
- console.debug(`Base: ${base}`);
138
- const response = await fetch(`${apiEndpoint}/api/butterflow/v1/tasks/${taskId}/pull-request`, {
135
+ console.log("Creating pull request...");
136
+ console.log(` URL: ${prUrl}`);
137
+ console.log(` Title: ${title}`);
138
+ console.log(` Head: ${prData.head ?? head ?? "(not set)"}`);
139
+ console.log(` Base: ${prData.base ?? base ?? "(not set)"}`);
140
+ if (body) console.log(` Body: ${body}`);
141
+ const response = await fetch(prUrl, {
139
142
  method: "POST",
140
143
  headers: {
141
144
  Authorization: `Bearer ${authToken}`,
@@ -145,13 +148,20 @@ const createPrCommand = defineCommand({
145
148
  });
146
149
  if (!response.ok) {
147
150
  const errorText = await response.text();
148
- throw new Error(`HTTP ${response.status}: ${errorText}`);
151
+ console.error(`❌ Failed to create pull request: HTTP ${response.status}`);
152
+ console.error(` Response: ${errorText}`);
153
+ process.exit(1);
149
154
  }
150
155
  await response.json();
151
156
  console.log("✅ Pull request created successfully!");
152
157
  } catch (error) {
153
158
  console.error("❌ Failed to create pull request:");
154
- console.error(error instanceof Error ? error.message : String(error));
159
+ console.error(` URL: ${prUrl}`);
160
+ console.error(` PR data: ${JSON.stringify(prData)}`);
161
+ if (error instanceof TypeError && error.message === "fetch failed") {
162
+ const cause = error.cause;
163
+ console.error(` Cause: ${cause instanceof Error ? cause.message : String(cause ?? "unknown")}`);
164
+ } else console.error(` Error: ${error instanceof Error ? error.message : String(error)}`);
155
165
  process.exit(1);
156
166
  }
157
167
  }
@@ -7,7 +7,7 @@ import { execSync } from "node:child_process";
7
7
  */
8
8
  async function getApplicableFiles(rulePath, language, projectRoot) {
9
9
  try {
10
- const command = `npx -y codemod@1.2.1 jssg list-applicable --allow-fs --allow-fetch --allow-child-process --language ${language} --target ${projectRoot} ${rulePath}`;
10
+ const command = `npx -y codemod@latest jssg list-applicable --allow-fs --allow-fetch --allow-child-process --language ${language} --target ${projectRoot} ${rulePath}`;
11
11
  console.debug(`Executing: ${command}`);
12
12
  const applicableFiles = execSync(command, {
13
13
  encoding: "utf8",
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/utils/codeowner-analysis.d.ts
2
3
  /**
3
4
  * Result for a single team-based shard
@@ -92,4 +93,4 @@ declare function getTeamFileInfo(filesByOwner: Map<string, string[]>): TeamFileI
92
93
  */
93
94
  declare function analyzeCodeowners(options: CodeownerAnalysisOptions): Promise<CodeownerAnalysisResult>;
94
95
  //#endregion
95
- export { analyzeCodeowners as a, findCodeownersFile as c, normalizeOwnerName as d, TeamFileInfo as i, generateShards as l, CodeownerAnalysisResult as n, analyzeFilesByOwner as o, ShardResult as r, analyzeFilesWithoutOwner as s, CodeownerAnalysisOptions as t, getTeamFileInfo as u };
96
+ export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as getApplicableFiles } from "./codemod-cli-Bf23tAfy.js";
2
+ import { t as getApplicableFiles } from "./codemod-cli-D-ormE6R.mjs";
3
3
  import Codeowners from "codeowners";
4
4
  import { existsSync } from "node:fs";
5
5
  import path, { resolve } from "node:path";
@@ -155,4 +155,4 @@ async function analyzeCodeowners(options) {
155
155
  }
156
156
 
157
157
  //#endregion
158
- export { generateShards as a, findCodeownersFile as i, analyzeFilesByOwner as n, getTeamFileInfo as o, analyzeFilesWithoutOwner as r, normalizeOwnerName as s, analyzeCodeowners as t };
158
+ export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName };
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/utils/directory-analysis.d.ts
2
3
  /**
3
4
  * Result for a single directory-based shard
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { t as getApplicableFiles } from "./codemod-cli-Bf23tAfy.js";
3
- import { n as calculateOptimalShardCount, r as distributeFilesAcrossShards } from "./consistent-sharding-jDHVRq1U.js";
2
+ import { t as getApplicableFiles } from "./codemod-cli-D-ormE6R.mjs";
3
+ import { calculateOptimalShardCount, distributeFilesAcrossShards } from "./sharding.mjs";
4
4
  import path from "node:path";
5
5
 
6
6
  //#region src/utils/directory-analysis.ts
@@ -95,4 +95,4 @@ async function analyzeDirectories(options) {
95
95
  }
96
96
 
97
97
  //#endregion
98
- export { createDirectoryShards as n, groupFilesByDirectory as r, analyzeDirectories as t };
98
+ export { analyzeDirectories, createDirectoryShards, groupFilesByDirectory };
@@ -0,0 +1,4 @@
1
+
2
+ import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./sharding.mjs";
3
+ import { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName } from "./codeowners.mjs";
4
+ export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
package/dist/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName } from "./codeowners.mjs";
3
+ import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./sharding.mjs";
4
+
5
+ export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
@@ -1,3 +1,4 @@
1
+
1
2
  //#region src/utils/consistent-sharding.d.ts
2
3
  /**
3
4
  * Generates a numeric hash from a filename using SHA1
@@ -64,4 +65,4 @@ declare function analyzeShardScaling(filenames: string[], oldShardCount: number,
64
65
  stableFiles: number;
65
66
  };
66
67
  //#endregion
67
- export { getFileHashPosition as a, fitsInShard as i, calculateOptimalShardCount as n, getNumericFileNameSha1 as o, distributeFilesAcrossShards as r, getShardForFilename as s, analyzeShardScaling as t };
68
+ export { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
@@ -105,4 +105,4 @@ function analyzeShardScaling(filenames, oldShardCount, newShardCount) {
105
105
  }
106
106
 
107
107
  //#endregion
108
- export { getFileHashPosition as a, fitsInShard as i, calculateOptimalShardCount as n, getNumericFileNameSha1 as o, distributeFilesAcrossShards as r, getShardForFilename as s, analyzeShardScaling as t };
108
+ export { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemodctl",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
5
5
  "type": "module",
6
6
  "exports": {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "bin": {
21
- "codemodctl": "./dist/cli.js"
21
+ "codemodctl": "./dist/cli.mjs"
22
22
  },
23
23
  "files": [
24
24
  "dist"
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/node": "^22.16.5",
36
- "@typescript/native-preview": "7.0.0-dev.20251120.1",
36
+ "@typescript/native-preview": "7.0.0-dev.20260122.3",
37
37
  "oxlint": "^1.29.0",
38
- "tsdown": "^0.15.4",
38
+ "tsdown": "0.20.3",
39
39
  "typescript": "^5.9.3",
40
40
  "vitest": "^4.0.9",
41
41
  "@acme/tsconfig": "0.1.0"
@@ -1 +0,0 @@
1
- export { };
@@ -1,2 +0,0 @@
1
- import { a as analyzeCodeowners, c as findCodeownersFile, d as normalizeOwnerName, i as TeamFileInfo, l as generateShards, n as CodeownerAnalysisResult, o as analyzeFilesByOwner, r as ShardResult, s as analyzeFilesWithoutOwner, t as CodeownerAnalysisOptions, u as getTeamFileInfo } from "./codeowner-analysis-Db2TrMsU.js";
2
- export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName };
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./codemod-cli-Bf23tAfy.js";
3
- import { a as generateShards, i as findCodeownersFile, n as analyzeFilesByOwner, o as getTeamFileInfo, r as analyzeFilesWithoutOwner, s as normalizeOwnerName, t as analyzeCodeowners } from "./codeowner-analysis-CV8ViyRo.js";
4
-
5
- export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName };
package/dist/directory.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./codemod-cli-Bf23tAfy.js";
3
- import "./consistent-sharding-jDHVRq1U.js";
4
- import { n as createDirectoryShards, r as groupFilesByDirectory, t as analyzeDirectories } from "./directory-analysis-BrskPjFj.js";
5
-
6
- export { analyzeDirectories, createDirectoryShards, groupFilesByDirectory };
@@ -1,3 +0,0 @@
1
- import { a as getFileHashPosition, i as fitsInShard, n as calculateOptimalShardCount, o as getNumericFileNameSha1, r as distributeFilesAcrossShards, s as getShardForFilename, t as analyzeShardScaling } from "./consistent-sharding-BzehCX2u.js";
2
- import { a as analyzeCodeowners, c as findCodeownersFile, d as normalizeOwnerName, i as TeamFileInfo, l as generateShards, n as CodeownerAnalysisResult, o as analyzeFilesByOwner, r as ShardResult, s as analyzeFilesWithoutOwner, t as CodeownerAnalysisOptions, u as getTeamFileInfo } from "./codeowner-analysis-Db2TrMsU.js";
3
- export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- import "./codemod-cli-Bf23tAfy.js";
3
- import { a as generateShards, i as findCodeownersFile, n as analyzeFilesByOwner, o as getTeamFileInfo, r as analyzeFilesWithoutOwner, s as normalizeOwnerName, t as analyzeCodeowners } from "./codeowner-analysis-CV8ViyRo.js";
4
- import { a as getFileHashPosition, i as fitsInShard, n as calculateOptimalShardCount, o as getNumericFileNameSha1, r as distributeFilesAcrossShards, s as getShardForFilename, t as analyzeShardScaling } from "./consistent-sharding-jDHVRq1U.js";
5
-
6
- export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
@@ -1,2 +0,0 @@
1
- import { a as getFileHashPosition, i as fitsInShard, n as calculateOptimalShardCount, o as getNumericFileNameSha1, r as distributeFilesAcrossShards, s as getShardForFilename, t as analyzeShardScaling } from "./consistent-sharding-BzehCX2u.js";
2
- export { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
package/dist/sharding.js DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { a as getFileHashPosition, i as fitsInShard, n as calculateOptimalShardCount, o as getNumericFileNameSha1, r as distributeFilesAcrossShards, s as getShardForFilename, t as analyzeShardScaling } from "./consistent-sharding-jDHVRq1U.js";
3
-
4
- export { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };