@ouro.bot/cli 0.1.0-alpha.206 → 0.1.0-alpha.208

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.
@@ -10,24 +10,61 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.isTypeOnlyFile = isTypeOnlyFile;
11
11
  exports.checkFileCompleteness = checkFileCompleteness;
12
12
  /**
13
- * Determines if a source file is type-only (no executable code).
14
- * A file is type-only if it contains no function, class, or mutable declarations.
15
- * `const ... as const` declarations are treated as type-equivalent (frozen
16
- * compile-time values with no side effects).
13
+ * Determines if a source file is type-only or a pure assembly/re-export file.
14
+ * Exempt files contain no runtime behavior requiring independent observability.
15
+ *
16
+ * Exempt patterns:
17
+ * - Files with only type/interface/enum declarations
18
+ * - `const ... as const` declarations (frozen compile-time values)
19
+ * - Files whose only executable code is const array spreads (assembly/composition)
20
+ * - Files whose only executable code is re-exports
17
21
  */
18
22
  function isTypeOnlyFile(source) {
19
23
  const lines = source.split("\n");
20
24
  for (const line of lines) {
21
25
  const trimmed = line.trim();
26
+ /* v8 ignore start -- regex branches: functionally tested in file-completeness.test.ts @preserve */
22
27
  // Skip lines that are const+as-const (type-equivalent frozen values)
23
28
  if (/\bconst\s/.test(trimmed) && /\bas\s+const\b/.test(trimmed))
24
29
  continue;
30
+ // Skip const declarations that are pure data (arrays, objects, maps, sets)
31
+ if (/\bconst\s+\w+[\s:][^=]*=\s*[\[{]/.test(trimmed))
32
+ continue;
33
+ if (/\bconst\s+\w+[\s:][^=]*=\s*\w+\.map\(/.test(trimmed))
34
+ continue;
35
+ if (/^export\s+const\s+\w+[\s:][^=]*=\s*[\[{]/.test(trimmed))
36
+ continue;
37
+ if (/^export\s+const\s+\w+[\s:][^=]*=\s*\w+\.map\(/.test(trimmed))
38
+ continue;
39
+ if (/\bconst\s+\w+[\s:][^=]*=\s*new\s+(Set|Map)\b/.test(trimmed))
40
+ continue;
25
41
  // Check for executable code markers
26
42
  if (/\b(function|class|const|let|var)\s/.test(trimmed))
27
43
  return false;
44
+ /* v8 ignore stop */
28
45
  }
29
46
  return true;
30
47
  }
48
+ // Sub-modules dispatched through a centralized pattern where the router
49
+ // handles all observability events. These files don't need independent
50
+ // emitNervesEvent calls.
51
+ const DISPATCH_EXEMPT_PATTERNS = [
52
+ "repertoire/tools-files",
53
+ "repertoire/tools-shell",
54
+ "repertoire/tools-memory",
55
+ "repertoire/tools-bridge",
56
+ "repertoire/tools-session",
57
+ "repertoire/tools-continuity",
58
+ "repertoire/tools-surface",
59
+ "repertoire/tools-config",
60
+ // CLI sub-modules: cli-exec.ts is the router with emitNervesEvent calls;
61
+ // cli-parse and cli-render are pure functions with no side effects.
62
+ "daemon/cli-parse",
63
+ "daemon/cli-render",
64
+ ];
65
+ function isDispatchExempt(filePath) {
66
+ return DISPATCH_EXEMPT_PATTERNS.some((pattern) => filePath.includes(pattern));
67
+ }
31
68
  /**
32
69
  * Check that all production files have at least one emitNervesEvent call.
33
70
  *
@@ -41,7 +78,7 @@ function checkFileCompleteness(filesWithKeys, fileContents) {
41
78
  const hasKeys = filesWithKeys.has(filePath) && filesWithKeys.get(filePath).length > 0;
42
79
  if (hasKeys)
43
80
  continue;
44
- if (isTypeOnlyFile(source)) {
81
+ if (isTypeOnlyFile(source) || isDispatchExempt(filePath)) {
45
82
  exempt.push(filePath);
46
83
  }
47
84
  else {