@cuzfrog/pi-module-gates 0.13.1 → 0.13.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cuzfrog/pi-module-gates",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "pi extension that controls the entropy of the codebase by enforcing code module boundaries.",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -22,7 +22,7 @@
22
22
  "@earendil-works/pi-coding-agent": "*"
23
23
  },
24
24
  "devDependencies": {
25
- "@earendil-works/pi-coding-agent": "0.75.4",
25
+ "@earendil-works/pi-coding-agent": "0.79.8",
26
26
  "@types/node": "22.19.19",
27
27
  "typescript": "5.9.3",
28
28
  "vitest": "4.1.7"
@@ -9,7 +9,7 @@ argument-hint: <user-instructions>
9
9
  - Find out module descriptor filename in the context.
10
10
  - Find out source root in the context or from configurations.
11
11
  - Derive scripts args from user instructions.
12
- - Call the script to scans the source tree for module descriptors and auto-populates their `frozen` entries with all files in each module directory.
12
+ - Call the script to scans the source tree for module descriptors and auto-populates their `frozen` entries with code files in each module directory.
13
13
 
14
14
  ## Script Usage
15
15
 
@@ -30,6 +30,5 @@ Options:
30
30
  3. Adds those files to the `frozen` frontmatter field
31
31
  4. Preserves existing `frozen` entries, other fields in the frontmatter, and body prose
32
32
 
33
-
34
33
  ## Extra user instructions:
35
34
  "$ARGUMENTS"
@@ -0,0 +1 @@
1
+ export declare const SUPPORTED_EXTENSIONS: Set<string>;
@@ -3,14 +3,26 @@
3
3
  * Auto-freeze all files in module descriptors.
4
4
  *
5
5
  * Scans module descriptor files under a source root and populates each
6
- * descriptor's `frozen` field with every direct file in the module directory.
7
- * Files in nested sub-modules (directories with their own descriptor) are
8
- * excluded from the parent.
6
+ * descriptor's `frozen` field with every direct code file in the module
7
+ * directory. Files in nested sub-modules (directories with their own
8
+ * descriptor) are excluded from the parent.
9
9
  */
10
10
  import { readFileSync, writeFileSync, readdirSync, existsSync } from "node:fs";
11
- import { resolve, relative, join, dirname } from "node:path";
11
+ import { resolve, relative, join, dirname, extname } from "node:path";
12
+ import { pathToFileURL } from "node:url";
12
13
  import { parseArgs } from "node:util";
13
14
 
15
+ const SUPPORTED_EXTENSIONS = new Set([
16
+ ".ts", ".tsx", ".js", ".jsx",
17
+ ".rs",
18
+ ".java",
19
+ ".go",
20
+ ".kt", ".kts",
21
+ ".scala", ".sc",
22
+ ]);
23
+
24
+ export { SUPPORTED_EXTENSIONS };
25
+
14
26
  function main() {
15
27
  const { values } = parseArgs({
16
28
  options: {
@@ -320,6 +332,7 @@ function listDirectFiles(modDir, descriptorName, allModuleDirs) {
320
332
  // Non-module subdirs are skipped too to avoid granularity issues
321
333
  } else {
322
334
  if (entry.name.toLowerCase() === lowerDesc) continue;
335
+ if (!SUPPORTED_EXTENSIONS.has(extname(entry.name).toLowerCase())) continue;
323
336
  files.push(entry.name);
324
337
  }
325
338
  }
@@ -351,4 +364,6 @@ function arraysEqual(a, b) {
351
364
  return sortedA.every((v, i) => v === sortedB[i]);
352
365
  }
353
366
 
354
- main();
367
+ if (import.meta.url === pathToFileURL(resolve(process.argv[1] ?? "")).href) {
368
+ main();
369
+ }