codemodctl 0.1.17 → 0.1.19
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.ts +1 -1
- package/dist/cli.js +10 -13
- package/dist/{consistent-sharding-BfgFDhwr.js → consistent-sharding-BVHk7fEf.js} +1 -5
- package/dist/{directory-analysis-WCzArWS4.js → directory-analysis-CxsEy7Sj.js} +3 -4
- package/dist/directory.js +2 -2
- package/dist/index.js +1 -1
- package/dist/sharding.js +1 -1
- package/package.json +2 -2
package/dist/cli.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { };
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./codemod-cli-DailrcEf.js";
|
|
3
3
|
import { analyzeCodeowners } from "./codeowner-analysis-DlwMGduk.js";
|
|
4
|
-
import "./consistent-sharding-
|
|
5
|
-
import { analyzeDirectories } from "./directory-analysis-
|
|
4
|
+
import "./consistent-sharding-BVHk7fEf.js";
|
|
5
|
+
import { analyzeDirectories } from "./directory-analysis-CxsEy7Sj.js";
|
|
6
6
|
import { defineCommand, runMain } from "citty";
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import { $ } from "execa";
|
|
@@ -111,7 +111,7 @@ const createPrCommand = defineCommand({
|
|
|
111
111
|
process.exit(1);
|
|
112
112
|
}
|
|
113
113
|
try {
|
|
114
|
-
await $`git commit -m ${commitMessage}`;
|
|
114
|
+
await $`git commit --no-verify -m ${commitMessage}`;
|
|
115
115
|
} catch (error) {
|
|
116
116
|
console.error("Error: Failed to commit changes");
|
|
117
117
|
console.error(error);
|
|
@@ -164,7 +164,7 @@ const gitCommand = defineCommand({
|
|
|
164
164
|
name: "git",
|
|
165
165
|
description: "Git operations"
|
|
166
166
|
},
|
|
167
|
-
subCommands: {
|
|
167
|
+
subCommands: { "create-pr": createPrCommand }
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
//#endregion
|
|
@@ -241,15 +241,14 @@ const codeownerCommand = defineCommand({
|
|
|
241
241
|
console.warn(`Warning: Failed to parse existing state: ${parseError}`);
|
|
242
242
|
existingState = void 0;
|
|
243
243
|
}
|
|
244
|
-
const
|
|
244
|
+
const result = await analyzeCodeowners({
|
|
245
245
|
shardSize,
|
|
246
246
|
codeownersPath,
|
|
247
247
|
rulePath: codemodFilePath,
|
|
248
248
|
projectRoot: process.cwd(),
|
|
249
249
|
language,
|
|
250
250
|
existingState
|
|
251
|
-
};
|
|
252
|
-
const result = await analyzeCodeowners(analysisOptions);
|
|
251
|
+
});
|
|
253
252
|
const stateOutput = `${stateProp}=${JSON.stringify(result.shards)}\n`;
|
|
254
253
|
console.log(`Writing state output to: ${stateOutputsPath}`);
|
|
255
254
|
await writeFile(stateOutputsPath, stateOutput, { flag: "a" });
|
|
@@ -338,15 +337,14 @@ const directoryCommand = defineCommand({
|
|
|
338
337
|
console.warn(`Warning: Failed to parse existing state: ${parseError}`);
|
|
339
338
|
existingState = void 0;
|
|
340
339
|
}
|
|
341
|
-
const
|
|
340
|
+
const result = await analyzeDirectories({
|
|
342
341
|
shardSize,
|
|
343
342
|
target,
|
|
344
343
|
rulePath: codemodFilePath,
|
|
345
344
|
projectRoot: process.cwd(),
|
|
346
345
|
language,
|
|
347
346
|
existingState
|
|
348
|
-
};
|
|
349
|
-
const result = await analyzeDirectories(analysisOptions);
|
|
347
|
+
});
|
|
350
348
|
const stateOutput = `${stateProp}=${JSON.stringify(result.shards)}\n`;
|
|
351
349
|
console.log(`Writing state output to: ${stateOutputsPath}`);
|
|
352
350
|
await writeFile(stateOutputsPath, stateOutput, { flag: "a" });
|
|
@@ -375,7 +373,7 @@ const shardCommand = defineCommand({
|
|
|
375
373
|
|
|
376
374
|
//#endregion
|
|
377
375
|
//#region src/cli.ts
|
|
378
|
-
|
|
376
|
+
runMain(defineCommand({
|
|
379
377
|
meta: {
|
|
380
378
|
name: "codemodctl",
|
|
381
379
|
version: "0.1.0",
|
|
@@ -385,8 +383,7 @@ const main = defineCommand({
|
|
|
385
383
|
git: gitCommand,
|
|
386
384
|
shard: shardCommand
|
|
387
385
|
}
|
|
388
|
-
});
|
|
389
|
-
runMain(main);
|
|
386
|
+
}));
|
|
390
387
|
|
|
391
388
|
//#endregion
|
|
392
389
|
export { };
|
|
@@ -93,11 +93,7 @@ function calculateOptimalShardCount(totalFiles, targetShardSize) {
|
|
|
93
93
|
*/
|
|
94
94
|
function analyzeShardScaling(filenames, oldShardCount, newShardCount) {
|
|
95
95
|
let reassignedFiles = 0;
|
|
96
|
-
for (const filename of filenames) {
|
|
97
|
-
const oldShard = getShardForFilename(filename, { shardCount: oldShardCount });
|
|
98
|
-
const newShard = getShardForFilename(filename, { shardCount: newShardCount });
|
|
99
|
-
if (oldShard !== newShard) reassignedFiles++;
|
|
100
|
-
}
|
|
96
|
+
for (const filename of filenames) if (getShardForFilename(filename, { shardCount: oldShardCount }) !== getShardForFilename(filename, { shardCount: newShardCount })) reassignedFiles++;
|
|
101
97
|
const stableFiles = filenames.length - reassignedFiles;
|
|
102
98
|
const reassignmentPercentage = filenames.length > 0 ? reassignedFiles / filenames.length * 100 : 0;
|
|
103
99
|
return {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { getApplicableFiles } from "./codemod-cli-DailrcEf.js";
|
|
3
|
-
import { calculateOptimalShardCount, distributeFilesAcrossShards } from "./consistent-sharding-
|
|
3
|
+
import { calculateOptimalShardCount, distributeFilesAcrossShards } from "./consistent-sharding-BVHk7fEf.js";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
//#region src/utils/directory-analysis.ts
|
|
@@ -61,7 +61,7 @@ function createDirectoryShards(filesByDirectory, shardSize, existingState) {
|
|
|
61
61
|
shard: shardIndex + 1,
|
|
62
62
|
shardCount,
|
|
63
63
|
_meta_files: shardFiles.sort(),
|
|
64
|
-
name: `${directory} ${shardIndex + 1}/${shardCount}`
|
|
64
|
+
name: `${directory} (${shardIndex + 1}/${shardCount})`
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -81,8 +81,7 @@ async function analyzeDirectories(options) {
|
|
|
81
81
|
console.log("Analyzing files with CLI command...");
|
|
82
82
|
const applicableFiles = await getApplicableFiles(rulePath, language, projectRoot);
|
|
83
83
|
console.log("Grouping files by directory...");
|
|
84
|
-
const
|
|
85
|
-
const filesByDirectory = groupFilesByDirectory(applicableFiles, resolvedTarget, projectRoot);
|
|
84
|
+
const filesByDirectory = groupFilesByDirectory(applicableFiles, path.resolve(projectRoot, target), projectRoot);
|
|
86
85
|
if (filesByDirectory.size === 0) throw new Error(`No files found in subdirectories of target: ${target}`);
|
|
87
86
|
console.log(`Found ${filesByDirectory.size} subdirectories in target`);
|
|
88
87
|
console.log("Generating directory-based shards...");
|
package/dist/directory.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./codemod-cli-DailrcEf.js";
|
|
3
|
-
import "./consistent-sharding-
|
|
4
|
-
import { analyzeDirectories, createDirectoryShards, groupFilesByDirectory } from "./directory-analysis-
|
|
3
|
+
import "./consistent-sharding-BVHk7fEf.js";
|
|
4
|
+
import { analyzeDirectories, createDirectoryShards, groupFilesByDirectory } from "./directory-analysis-CxsEy7Sj.js";
|
|
5
5
|
|
|
6
6
|
export { analyzeDirectories, createDirectoryShards, groupFilesByDirectory };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "./codemod-cli-DailrcEf.js";
|
|
3
3
|
import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getTeamFileInfo, normalizeOwnerName } from "./codeowner-analysis-DlwMGduk.js";
|
|
4
|
-
import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-
|
|
4
|
+
import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-BVHk7fEf.js";
|
|
5
5
|
|
|
6
6
|
export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
|
package/dist/sharding.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-
|
|
2
|
+
import { analyzeShardScaling, calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-BVHk7fEf.js";
|
|
3
3
|
|
|
4
4
|
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.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^22.16.5",
|
|
36
|
-
"tsdown": "^0.
|
|
36
|
+
"tsdown": "^0.15.4",
|
|
37
37
|
"typescript": "^5.7.2",
|
|
38
38
|
"vitest": "^3.0.5",
|
|
39
39
|
"@acme/tsconfig": "0.1.0"
|