codemodctl 0.1.6 → 0.1.7

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { analyzeCodeowners } from "./codeowner-analysis-CcSOX0Ve.js";
2
+ import { analyzeCodeowners } from "./codeowner-analysis-BNVB1xK_.js";
3
3
  import { defineCommand, runMain } from "citty";
4
4
  import crypto from "node:crypto";
5
5
  import { $ } from "execa";
@@ -136,9 +136,10 @@ async function analyzeFilesByOwner(codeownersPath, rule, projectRoot = process.c
136
136
  const codeowners = new Codeowners(codeownersPath);
137
137
  const gitRootDir = codeowners.codeownersDirectory;
138
138
  const filesByOwner = /* @__PURE__ */ new Map();
139
- await countedFindInFiles(Lang.TypeScript, {
139
+ await countedFindInFiles(rule.language || Lang.TypeScript, {
140
140
  matcher: rule,
141
- paths: [projectRoot]
141
+ paths: [projectRoot],
142
+ languageGlobs: generateLanguageGlobsByLanguage(rule.language)
142
143
  }, (err, matches) => {
143
144
  if (err) {
144
145
  console.error("AST-grep error:", err);
@@ -165,9 +166,10 @@ async function analyzeFilesByOwner(codeownersPath, rule, projectRoot = process.c
165
166
  async function analyzeFilesWithoutOwner(rule, projectRoot = process.cwd()) {
166
167
  const filesByOwner = /* @__PURE__ */ new Map();
167
168
  filesByOwner.set("unassigned", []);
168
- await countedFindInFiles(Lang.TypeScript, {
169
+ await countedFindInFiles(rule.language || Lang.TypeScript, {
169
170
  matcher: rule,
170
- paths: [projectRoot]
171
+ paths: [projectRoot],
172
+ languageGlobs: generateLanguageGlobsByLanguage(rule.language)
171
173
  }, (err, matches) => {
172
174
  if (err) {
173
175
  console.error("AST-grep error:", err);
@@ -238,6 +240,34 @@ async function analyzeCodeowners(options) {
238
240
  totalFiles
239
241
  };
240
242
  }
243
+ function generateExtensionsByLanguage(language) {
244
+ switch (language) {
245
+ case "typescript": return [
246
+ "ts",
247
+ "mts",
248
+ "cts"
249
+ ];
250
+ case "tsx": return [
251
+ "tsx",
252
+ "ts",
253
+ "mts",
254
+ "cts"
255
+ ];
256
+ case "javascript":
257
+ case "jsx":
258
+ case "js": return [
259
+ "js",
260
+ "mjs",
261
+ "cjs"
262
+ ];
263
+ default: return;
264
+ }
265
+ }
266
+ function generateLanguageGlobsByLanguage(language) {
267
+ const extensions = generateExtensionsByLanguage(language);
268
+ if (!extensions) return;
269
+ return extensions.map((extension) => `**/*.${extension}`);
270
+ }
241
271
 
242
272
  //#endregion
243
273
  export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, loadAstGrepRule, normalizeOwnerName };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, loadAstGrepRule, normalizeOwnerName } from "./codeowner-analysis-CcSOX0Ve.js";
2
+ import { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, loadAstGrepRule, normalizeOwnerName } from "./codeowner-analysis-BNVB1xK_.js";
3
3
 
4
4
  export { analyzeCodeowners, analyzeFilesByOwner, analyzeFilesWithoutOwner, calculateOptimalShardCount, distributeFilesAcrossShards, findCodeownersFile, fitsInShard, generateShards, getFileHashPosition, getNumericFileNameSha1, getShardForFilename, getTeamFileInfo, loadAstGrepRule, normalizeOwnerName };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codemodctl",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "CLI tool and utilities for workflow engine operations, file sharding, and codeowner analysis",
5
5
  "type": "module",
6
6
  "exports": {