codemodctl 0.1.9 → 0.1.10
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.js +2 -1
- package/dist/codeowner-analysis-D1oVulJ6.d.ts +59 -0
- package/dist/{codeowner-analysis-CYaliyNC.js → codeowner-analysis-n5QdN_A3.js} +3 -70
- package/dist/codeowners.d.ts +2 -0
- package/dist/codeowners.js +5 -0
- package/dist/consistent-sharding-D0wYSQBl.d.ts +56 -0
- package/dist/consistent-sharding-DDU9PV2R.js +71 -0
- package/dist/index.d.ts +2 -113
- package/dist/index.js +2 -1
- package/dist/sharding.d.ts +2 -0
- package/dist/sharding.js +4 -0
- package/package.json +9 -11
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import "./consistent-sharding-DDU9PV2R.js";
|
|
3
|
+
import { analyzeCodeowners } from "./codeowner-analysis-n5QdN_A3.js";
|
|
3
4
|
import { defineCommand, runMain } from "citty";
|
|
4
5
|
import crypto from "node:crypto";
|
|
5
6
|
import { $ } from "execa";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/utils/codeowner-analysis.d.ts
|
|
2
|
+
interface ShardResult {
|
|
3
|
+
team: string;
|
|
4
|
+
shard: string;
|
|
5
|
+
shardId: string;
|
|
6
|
+
}
|
|
7
|
+
interface TeamFileInfo {
|
|
8
|
+
team: string;
|
|
9
|
+
fileCount: number;
|
|
10
|
+
files: string[];
|
|
11
|
+
}
|
|
12
|
+
interface CodeownerAnalysisOptions {
|
|
13
|
+
shardSize: number;
|
|
14
|
+
codeownersPath?: string;
|
|
15
|
+
rulePath: string;
|
|
16
|
+
language: string;
|
|
17
|
+
projectRoot?: string;
|
|
18
|
+
}
|
|
19
|
+
interface CodeownerAnalysisResult {
|
|
20
|
+
teams: TeamFileInfo[];
|
|
21
|
+
shards: ShardResult[];
|
|
22
|
+
totalFiles: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Finds and resolves the CODEOWNERS file path
|
|
26
|
+
* Searches in common locations: root, .github/, docs/
|
|
27
|
+
* Returns null if no CODEOWNERS file is found
|
|
28
|
+
*/
|
|
29
|
+
declare function findCodeownersFile(projectRoot?: string, explicitPath?: string): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Normalizes owner name by removing @ prefix and converting to lowercase
|
|
32
|
+
*/
|
|
33
|
+
declare function normalizeOwnerName(owner: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Executes the codemod CLI command and returns applicable file paths
|
|
36
|
+
*/
|
|
37
|
+
declare function getApplicableFiles(rulePath: string, language: string, projectRoot: string): Promise<string[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Analyzes files and groups them by codeowner team
|
|
40
|
+
*/
|
|
41
|
+
declare function analyzeFilesByOwner(codeownersPath: string, language: string, rulePath: string, projectRoot?: string): Promise<Map<string, string[]>>;
|
|
42
|
+
/**
|
|
43
|
+
* Analyzes files without codeowner parsing - assigns all files to "unassigned"
|
|
44
|
+
*/
|
|
45
|
+
declare function analyzeFilesWithoutOwner(language: string, rulePath: string, projectRoot?: string): Promise<Map<string, string[]>>;
|
|
46
|
+
/**
|
|
47
|
+
* Generates shard configuration from team file analysis
|
|
48
|
+
*/
|
|
49
|
+
declare function generateShards(filesByOwner: Map<string, string[]>, shardSize: number): ShardResult[];
|
|
50
|
+
/**
|
|
51
|
+
* Converts file ownership map to team info array
|
|
52
|
+
*/
|
|
53
|
+
declare function getTeamFileInfo(filesByOwner: Map<string, string[]>): TeamFileInfo[];
|
|
54
|
+
/**
|
|
55
|
+
* Main function to analyze codeowners and generate shard configuration
|
|
56
|
+
*/
|
|
57
|
+
declare function analyzeCodeowners(options: CodeownerAnalysisOptions): Promise<CodeownerAnalysisResult>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName };
|
|
@@ -1,77 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
2
|
+
import { calculateOptimalShardCount } from "./consistent-sharding-DDU9PV2R.js";
|
|
3
3
|
import { execSync } from "node:child_process";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import path, { resolve } from "node:path";
|
|
6
6
|
import Codeowners from "codeowners";
|
|
7
7
|
|
|
8
|
-
//#region src/utils/consistent-sharding.ts
|
|
9
|
-
const HASH_RING_SIZE = 1e6;
|
|
10
|
-
/**
|
|
11
|
-
* Generates a numeric hash from a filename using SHA1
|
|
12
|
-
*/
|
|
13
|
-
function getNumericFileNameSha1(filename) {
|
|
14
|
-
return parseInt(crypto.createHash("sha1").update(filename).digest("hex"), 16);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Maps a filename to a consistent position on the hash ring (0 to HASH_RING_SIZE-1)
|
|
18
|
-
* This position remains constant regardless of shard count changes
|
|
19
|
-
*/
|
|
20
|
-
function getFileHashPosition(filename) {
|
|
21
|
-
return getNumericFileNameSha1(filename) % HASH_RING_SIZE;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Gets the shard index for a filename using deterministic hashing
|
|
25
|
-
* Files get assigned to a consistent preferred shard regardless of total count
|
|
26
|
-
*
|
|
27
|
-
* @param filename - The file path to hash
|
|
28
|
-
* @param shardCount - Total number of shards
|
|
29
|
-
* @returns Shard index (0-based)
|
|
30
|
-
*/
|
|
31
|
-
function getShardForFilename(filename, { shardCount }) {
|
|
32
|
-
if (shardCount <= 0) throw new Error("Shard count must be greater than 0");
|
|
33
|
-
return getNumericFileNameSha1(filename) % 10 % shardCount;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Checks if a file belongs to a specific shard
|
|
37
|
-
*
|
|
38
|
-
* @param filename - The file path to check
|
|
39
|
-
* @param shardCount - Total number of shards
|
|
40
|
-
* @param shardIndex - The shard index to check against (0-based)
|
|
41
|
-
* @returns True if file belongs to the specified shard
|
|
42
|
-
*/
|
|
43
|
-
function fitsInShard(filename, { shardCount, shardIndex }) {
|
|
44
|
-
return getShardForFilename(filename, { shardCount }) === shardIndex;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Distributes files across shards using deterministic hashing
|
|
48
|
-
*
|
|
49
|
-
* @param filenames - Array of file paths
|
|
50
|
-
* @param shardCount - Total number of shards
|
|
51
|
-
* @returns Map of shard index to array of filenames
|
|
52
|
-
*/
|
|
53
|
-
function distributeFilesAcrossShards(filenames, shardCount) {
|
|
54
|
-
if (shardCount <= 0) throw new Error("Shard count must be greater than 0");
|
|
55
|
-
const shardMap = /* @__PURE__ */ new Map();
|
|
56
|
-
for (let i = 0; i < shardCount; i++) shardMap.set(i, []);
|
|
57
|
-
for (const filename of filenames) {
|
|
58
|
-
const shardIndex = getShardForFilename(filename, { shardCount });
|
|
59
|
-
shardMap.get(shardIndex).push(filename);
|
|
60
|
-
}
|
|
61
|
-
return shardMap;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Calculate optimal number of shards based on target shard size
|
|
65
|
-
*
|
|
66
|
-
* @param totalFiles - Total number of files
|
|
67
|
-
* @param targetShardSize - Desired number of files per shard
|
|
68
|
-
* @returns Number of shards needed
|
|
69
|
-
*/
|
|
70
|
-
function calculateOptimalShardCount(totalFiles, targetShardSize) {
|
|
71
|
-
return Math.ceil(totalFiles / targetShardSize);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
8
|
//#region src/utils/codeowner-analysis.ts
|
|
76
9
|
/**
|
|
77
10
|
* Finds and resolves the CODEOWNERS file path
|
|
@@ -103,7 +36,7 @@ function normalizeOwnerName(owner) {
|
|
|
103
36
|
*/
|
|
104
37
|
async function getApplicableFiles(rulePath, language, projectRoot) {
|
|
105
38
|
try {
|
|
106
|
-
const command = `npx codemod@latest jssg list-applicable --language ${language} --target ${projectRoot} ${rulePath}`;
|
|
39
|
+
const command = `npx -y codemod@latest jssg list-applicable --language ${language} --target ${projectRoot} ${rulePath}`;
|
|
107
40
|
console.debug(`Executing: ${command}`);
|
|
108
41
|
const applicableFiles = execSync(command, {
|
|
109
42
|
encoding: "utf8",
|
|
@@ -208,4 +141,4 @@ async function analyzeCodeowners(options) {
|
|
|
208
141
|
}
|
|
209
142
|
|
|
210
143
|
//#endregion
|
|
211
|
-
export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner,
|
|
144
|
+
export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName } from "./codeowner-analysis-D1oVulJ6.js";
|
|
2
|
+
export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "./consistent-sharding-DDU9PV2R.js";
|
|
3
|
+
import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName } from "./codeowner-analysis-n5QdN_A3.js";
|
|
4
|
+
|
|
5
|
+
export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//#region src/utils/consistent-sharding.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Generates a numeric hash from a filename using SHA1
|
|
4
|
+
*/
|
|
5
|
+
declare function getNumericFileNameSha1(filename: string): number;
|
|
6
|
+
/**
|
|
7
|
+
* Maps a filename to a consistent position on the hash ring (0 to HASH_RING_SIZE-1)
|
|
8
|
+
* This position remains constant regardless of shard count changes
|
|
9
|
+
*/
|
|
10
|
+
declare function getFileHashPosition(filename: string): number;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the shard index for a filename using deterministic hashing
|
|
13
|
+
* Files get assigned to a consistent preferred shard regardless of total count
|
|
14
|
+
*
|
|
15
|
+
* @param filename - The file path to hash
|
|
16
|
+
* @param shardCount - Total number of shards
|
|
17
|
+
* @returns Shard index (0-based)
|
|
18
|
+
*/
|
|
19
|
+
declare function getShardForFilename(filename: string, {
|
|
20
|
+
shardCount
|
|
21
|
+
}: {
|
|
22
|
+
shardCount: number;
|
|
23
|
+
}): number;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if a file belongs to a specific shard
|
|
26
|
+
*
|
|
27
|
+
* @param filename - The file path to check
|
|
28
|
+
* @param shardCount - Total number of shards
|
|
29
|
+
* @param shardIndex - The shard index to check against (0-based)
|
|
30
|
+
* @returns True if file belongs to the specified shard
|
|
31
|
+
*/
|
|
32
|
+
declare function fitsInShard(filename: string, {
|
|
33
|
+
shardCount,
|
|
34
|
+
shardIndex
|
|
35
|
+
}: {
|
|
36
|
+
shardCount: number;
|
|
37
|
+
shardIndex: number;
|
|
38
|
+
}): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Distributes files across shards using deterministic hashing
|
|
41
|
+
*
|
|
42
|
+
* @param filenames - Array of file paths
|
|
43
|
+
* @param shardCount - Total number of shards
|
|
44
|
+
* @returns Map of shard index to array of filenames
|
|
45
|
+
*/
|
|
46
|
+
declare function distributeFilesAcrossShards(filenames: string[], shardCount: number): Map<number, string[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate optimal number of shards based on target shard size
|
|
49
|
+
*
|
|
50
|
+
* @param totalFiles - Total number of files
|
|
51
|
+
* @param targetShardSize - Desired number of files per shard
|
|
52
|
+
* @returns Number of shards needed
|
|
53
|
+
*/
|
|
54
|
+
declare function calculateOptimalShardCount(totalFiles: number, targetShardSize: number): number;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import crypto from "node:crypto";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/consistent-sharding.ts
|
|
5
|
+
const HASH_RING_SIZE = 1e6;
|
|
6
|
+
/**
|
|
7
|
+
* Generates a numeric hash from a filename using SHA1
|
|
8
|
+
*/
|
|
9
|
+
function getNumericFileNameSha1(filename) {
|
|
10
|
+
return parseInt(crypto.createHash("sha1").update(filename).digest("hex"), 16);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Maps a filename to a consistent position on the hash ring (0 to HASH_RING_SIZE-1)
|
|
14
|
+
* This position remains constant regardless of shard count changes
|
|
15
|
+
*/
|
|
16
|
+
function getFileHashPosition(filename) {
|
|
17
|
+
return getNumericFileNameSha1(filename) % HASH_RING_SIZE;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the shard index for a filename using deterministic hashing
|
|
21
|
+
* Files get assigned to a consistent preferred shard regardless of total count
|
|
22
|
+
*
|
|
23
|
+
* @param filename - The file path to hash
|
|
24
|
+
* @param shardCount - Total number of shards
|
|
25
|
+
* @returns Shard index (0-based)
|
|
26
|
+
*/
|
|
27
|
+
function getShardForFilename(filename, { shardCount }) {
|
|
28
|
+
if (shardCount <= 0) throw new Error("Shard count must be greater than 0");
|
|
29
|
+
return getNumericFileNameSha1(filename) % 10 % shardCount;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a file belongs to a specific shard
|
|
33
|
+
*
|
|
34
|
+
* @param filename - The file path to check
|
|
35
|
+
* @param shardCount - Total number of shards
|
|
36
|
+
* @param shardIndex - The shard index to check against (0-based)
|
|
37
|
+
* @returns True if file belongs to the specified shard
|
|
38
|
+
*/
|
|
39
|
+
function fitsInShard(filename, { shardCount, shardIndex }) {
|
|
40
|
+
return getShardForFilename(filename, { shardCount }) === shardIndex;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Distributes files across shards using deterministic hashing
|
|
44
|
+
*
|
|
45
|
+
* @param filenames - Array of file paths
|
|
46
|
+
* @param shardCount - Total number of shards
|
|
47
|
+
* @returns Map of shard index to array of filenames
|
|
48
|
+
*/
|
|
49
|
+
function distributeFilesAcrossShards(filenames, shardCount) {
|
|
50
|
+
if (shardCount <= 0) throw new Error("Shard count must be greater than 0");
|
|
51
|
+
const shardMap = /* @__PURE__ */ new Map();
|
|
52
|
+
for (let i = 0; i < shardCount; i++) shardMap.set(i, []);
|
|
53
|
+
for (const filename of filenames) {
|
|
54
|
+
const shardIndex = getShardForFilename(filename, { shardCount });
|
|
55
|
+
shardMap.get(shardIndex).push(filename);
|
|
56
|
+
}
|
|
57
|
+
return shardMap;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Calculate optimal number of shards based on target shard size
|
|
61
|
+
*
|
|
62
|
+
* @param totalFiles - Total number of files
|
|
63
|
+
* @param targetShardSize - Desired number of files per shard
|
|
64
|
+
* @returns Number of shards needed
|
|
65
|
+
*/
|
|
66
|
+
function calculateOptimalShardCount(totalFiles, targetShardSize) {
|
|
67
|
+
return Math.ceil(totalFiles / targetShardSize);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,114 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Generates a numeric hash from a filename using SHA1
|
|
4
|
-
*/
|
|
5
|
-
declare function getNumericFileNameSha1(filename: string): number;
|
|
6
|
-
/**
|
|
7
|
-
* Maps a filename to a consistent position on the hash ring (0 to HASH_RING_SIZE-1)
|
|
8
|
-
* This position remains constant regardless of shard count changes
|
|
9
|
-
*/
|
|
10
|
-
declare function getFileHashPosition(filename: string): number;
|
|
11
|
-
/**
|
|
12
|
-
* Gets the shard index for a filename using deterministic hashing
|
|
13
|
-
* Files get assigned to a consistent preferred shard regardless of total count
|
|
14
|
-
*
|
|
15
|
-
* @param filename - The file path to hash
|
|
16
|
-
* @param shardCount - Total number of shards
|
|
17
|
-
* @returns Shard index (0-based)
|
|
18
|
-
*/
|
|
19
|
-
declare function getShardForFilename(filename: string, {
|
|
20
|
-
shardCount
|
|
21
|
-
}: {
|
|
22
|
-
shardCount: number;
|
|
23
|
-
}): number;
|
|
24
|
-
/**
|
|
25
|
-
* Checks if a file belongs to a specific shard
|
|
26
|
-
*
|
|
27
|
-
* @param filename - The file path to check
|
|
28
|
-
* @param shardCount - Total number of shards
|
|
29
|
-
* @param shardIndex - The shard index to check against (0-based)
|
|
30
|
-
* @returns True if file belongs to the specified shard
|
|
31
|
-
*/
|
|
32
|
-
declare function fitsInShard(filename: string, {
|
|
33
|
-
shardCount,
|
|
34
|
-
shardIndex
|
|
35
|
-
}: {
|
|
36
|
-
shardCount: number;
|
|
37
|
-
shardIndex: number;
|
|
38
|
-
}): boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Distributes files across shards using deterministic hashing
|
|
41
|
-
*
|
|
42
|
-
* @param filenames - Array of file paths
|
|
43
|
-
* @param shardCount - Total number of shards
|
|
44
|
-
* @returns Map of shard index to array of filenames
|
|
45
|
-
*/
|
|
46
|
-
declare function distributeFilesAcrossShards(filenames: string[], shardCount: number): Map<number, string[]>;
|
|
47
|
-
/**
|
|
48
|
-
* Calculate optimal number of shards based on target shard size
|
|
49
|
-
*
|
|
50
|
-
* @param totalFiles - Total number of files
|
|
51
|
-
* @param targetShardSize - Desired number of files per shard
|
|
52
|
-
* @returns Number of shards needed
|
|
53
|
-
*/
|
|
54
|
-
declare function calculateOptimalShardCount(totalFiles: number, targetShardSize: number): number;
|
|
55
|
-
//#endregion
|
|
56
|
-
//#region src/utils/codeowner-analysis.d.ts
|
|
57
|
-
interface ShardResult {
|
|
58
|
-
team: string;
|
|
59
|
-
shard: string;
|
|
60
|
-
shardId: string;
|
|
61
|
-
}
|
|
62
|
-
interface TeamFileInfo {
|
|
63
|
-
team: string;
|
|
64
|
-
fileCount: number;
|
|
65
|
-
files: string[];
|
|
66
|
-
}
|
|
67
|
-
interface CodeownerAnalysisOptions {
|
|
68
|
-
shardSize: number;
|
|
69
|
-
codeownersPath?: string;
|
|
70
|
-
rulePath: string;
|
|
71
|
-
language: string;
|
|
72
|
-
projectRoot?: string;
|
|
73
|
-
}
|
|
74
|
-
interface CodeownerAnalysisResult {
|
|
75
|
-
teams: TeamFileInfo[];
|
|
76
|
-
shards: ShardResult[];
|
|
77
|
-
totalFiles: number;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Finds and resolves the CODEOWNERS file path
|
|
81
|
-
* Searches in common locations: root, .github/, docs/
|
|
82
|
-
* Returns null if no CODEOWNERS file is found
|
|
83
|
-
*/
|
|
84
|
-
declare function findCodeownersFile(projectRoot?: string, explicitPath?: string): Promise<string | null>;
|
|
85
|
-
/**
|
|
86
|
-
* Normalizes owner name by removing @ prefix and converting to lowercase
|
|
87
|
-
*/
|
|
88
|
-
declare function normalizeOwnerName(owner: string): string;
|
|
89
|
-
/**
|
|
90
|
-
* Executes the codemod CLI command and returns applicable file paths
|
|
91
|
-
*/
|
|
92
|
-
declare function getApplicableFiles(rulePath: string, language: string, projectRoot: string): Promise<string[]>;
|
|
93
|
-
/**
|
|
94
|
-
* Analyzes files and groups them by codeowner team
|
|
95
|
-
*/
|
|
96
|
-
declare function analyzeFilesByOwner(codeownersPath: string, language: string, rulePath: string, projectRoot?: string): Promise<Map<string, string[]>>;
|
|
97
|
-
/**
|
|
98
|
-
* Analyzes files without codeowner parsing - assigns all files to "unassigned"
|
|
99
|
-
*/
|
|
100
|
-
declare function analyzeFilesWithoutOwner(language: string, rulePath: string, projectRoot?: string): Promise<Map<string, string[]>>;
|
|
101
|
-
/**
|
|
102
|
-
* Generates shard configuration from team file analysis
|
|
103
|
-
*/
|
|
104
|
-
declare function generateShards(filesByOwner: Map<string, string[]>, shardSize: number): ShardResult[];
|
|
105
|
-
/**
|
|
106
|
-
* Converts file ownership map to team info array
|
|
107
|
-
*/
|
|
108
|
-
declare function getTeamFileInfo(filesByOwner: Map<string, string[]>): TeamFileInfo[];
|
|
109
|
-
/**
|
|
110
|
-
* Main function to analyze codeowners and generate shard configuration
|
|
111
|
-
*/
|
|
112
|
-
declare function analyzeCodeowners(options: CodeownerAnalysisOptions): Promise<CodeownerAnalysisResult>;
|
|
113
|
-
//#endregion
|
|
1
|
+
import { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-D0wYSQBl.js";
|
|
2
|
+
import { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName } from "./codeowner-analysis-D1oVulJ6.js";
|
|
114
3
|
export { CodeownerAnalysisOptions, CodeownerAnalysisResult, ShardResult, TeamFileInfo, analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getApplicableFiles, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-DDU9PV2R.js";
|
|
3
|
+
import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, findCodeownersFile, generateShards, getApplicableFiles, getTeamFileInfo, normalizeOwnerName } from "./codeowner-analysis-n5QdN_A3.js";
|
|
3
4
|
|
|
4
5
|
export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getApplicableFiles, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, normalizeOwnerName };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-D0wYSQBl.js";
|
|
2
|
+
export { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename };
|
package/dist/sharding.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { calculateOptimalShardCount, distributeFilesAcrossShards, fitsInShard, getFileHashPosition, getNumericFileNameSha1, getShardForFilename } from "./consistent-sharding-DDU9PV2R.js";
|
|
3
|
+
|
|
4
|
+
export { 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.10",
|
|
4
4
|
"description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -9,16 +9,12 @@
|
|
|
9
9
|
"default": "./dist/index.js"
|
|
10
10
|
},
|
|
11
11
|
"./sharding": {
|
|
12
|
-
"types": "./dist/
|
|
13
|
-
"default": "./dist/
|
|
12
|
+
"types": "./dist/sharding.d.ts",
|
|
13
|
+
"default": "./dist/sharding.js"
|
|
14
14
|
},
|
|
15
15
|
"./codeowners": {
|
|
16
|
-
"types": "./dist/
|
|
17
|
-
"default": "./dist/
|
|
18
|
-
},
|
|
19
|
-
"./utils": {
|
|
20
|
-
"types": "./dist/utils/index.d.ts",
|
|
21
|
-
"default": "./dist/utils/index.js"
|
|
16
|
+
"types": "./dist/codeowners.d.ts",
|
|
17
|
+
"default": "./dist/codeowners.js"
|
|
22
18
|
}
|
|
23
19
|
},
|
|
24
20
|
"bin": {
|
|
@@ -37,8 +33,10 @@
|
|
|
37
33
|
"dependencies": {
|
|
38
34
|
"citty": "^0.1.6",
|
|
39
35
|
"codeowners": "^5.1.1",
|
|
40
|
-
"execa": "
|
|
41
|
-
"glob": "^11.0.0"
|
|
36
|
+
"execa": "catalog:codemods",
|
|
37
|
+
"glob": "^11.0.0",
|
|
38
|
+
"node-fetch": "^3.3.2",
|
|
39
|
+
"yaml": "^2.7.1"
|
|
42
40
|
},
|
|
43
41
|
"devDependencies": {
|
|
44
42
|
"@acme/tsconfig": "workspace:*",
|