@aroman22/codegraph-vba 1.11.0 → 1.12.0

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/README.md CHANGED
@@ -574,6 +574,7 @@ codegraph-vba daemon # Manage background daemons — pick one t
574
574
  codegraph-vba telemetry [on|off] # Show or change anonymous usage telemetry
575
575
  codegraph-vba upgrade [version] # Update to the latest release (--check, --force)
576
576
  codegraph-vba version # Print the installed version (also -v, --version)
577
+ codegraph-vba stats vba-rules [--json] # List every VBA extractor rule (concern, id, description, pattern, counts)
577
578
  codegraph-vba help [command] # Show help, optionally for one command
578
579
  ```
579
580
 
@@ -0,0 +1,64 @@
1
+ /**
2
+ * `codegraph stats vba-rules` — issue #168.
3
+ *
4
+ * Pure shape function over `VBA_RULE_TABLES` (the orchestrator's
5
+ * aggregated view of every per-concern classifier's declarative
6
+ * rule table, declared in `src/extraction/vba-extractor.ts`).
7
+ *
8
+ * The output reports **static rule counts** (the size of each
9
+ * classifier's `RULES` array), NOT per-rule runtime emission counts.
10
+ * The orchestrator does NOT track per-rule emission counts at the
11
+ * rule-table level today — the only instrumentation in the VBA
12
+ * pipeline is `vba-timing.ts` (per-stage wall-clock timings, gated
13
+ * by `CODEGRAPH_VBA_TIMING`) and the `VbaClassifier.count`
14
+ * per-classifier total. Neither attribute "rule X fired N times",
15
+ * so the field name `ruleCount` keeps the static-only semantics
16
+ * explicit. Anything resembling a runtime emission count would be
17
+ * fabricated — keep it that way until the orchestrator actually
18
+ * records it.
19
+ *
20
+ * Pattern serialization:
21
+ * - single `RegExp` → its `.source` (a string)
22
+ * - `RegExp[]` (alternatives) → `string[]` of `.source`, preserving
23
+ * declaration order. Matches `defineRuleAlternatives` semantics:
24
+ * a rule matches when ANY alternative matches, in array order.
25
+ *
26
+ * Concern order follows the insertion order of the `VBA_RULE_TABLES`
27
+ * object literal — the orchestrator exports it as `{ implements,
28
+ * procedures, declarations, dims, 'enums-consts', 'call-sweep' }`.
29
+ * The CLI command surfaces that exact order so the JSON output is
30
+ * stable run-to-run (no JSON-key sorting surprises) and matches the
31
+ * dispatch order the orchestrator documents in
32
+ * `src/extraction/vba-extractor.ts:REQUIRED_DISPATCH_TABLES`.
33
+ */
34
+ /**
35
+ * One rule as serialized for `codegraph stats vba-rules`.
36
+ *
37
+ * `pattern` is intentionally a `string | string[]` (NOT a `RegExp`):
38
+ * `JSON.stringify` would reduce a `RegExp` to `{}`. Serializing the
39
+ * `.source` keeps the output copy-pasteable for debugging
40
+ * ("what does this rule actually match against?") without losing
41
+ * the structure that distinguishes single-RegExp rules from
42
+ * alternatives.
43
+ */
44
+ export interface StatsVbaRule {
45
+ readonly id: string;
46
+ readonly description: string;
47
+ /** Single RegExp → its `.source`. RegExp[] → array of `.source`s in order. */
48
+ readonly pattern: string | string[];
49
+ /** Optional structural gate from the rule (e.g. `'class'`, `'module'`). */
50
+ readonly requires?: string;
51
+ /** Optional scan mode (e.g. `'masked'`, `'unmasked'`, `'both'`). */
52
+ readonly scan?: string;
53
+ }
54
+ export interface StatsVbaConcern {
55
+ readonly concern: string;
56
+ readonly ruleCount: number;
57
+ readonly rules: readonly StatsVbaRule[];
58
+ }
59
+ export interface StatsVbaRulesOutput {
60
+ readonly concerns: readonly StatsVbaConcern[];
61
+ readonly totalRules: number;
62
+ }
63
+ export declare function buildStatsVbaRules(): StatsVbaRulesOutput;
64
+ //# sourceMappingURL=stats-vba-rules.d.ts.map
@@ -60,8 +60,8 @@ import type { VbaExtractorContext } from './context';
60
60
  * - `scan?` `'masked'` = run on the string-literal-masked line
61
61
  * (so call patterns inside `"..."` are ignored), the
62
62
  * default. `'unmasked'` = run on the original line (so
63
- * SQL patterns inside `"..."` are caught). `'both'` =
64
- * dispatcher calls the rule twice, once with each line.
63
+ * SQL patterns inside `"..."` are caught). `'both'` tries
64
+ * the masked line first, then the original line if needed.
65
65
  * - `emit` The per-match side effect. Receives the
66
66
  * `RegExpExecArray` from the pattern, the shared
67
67
  * `VbaExtractorContext`, the original (or masked) line,
@@ -122,4 +122,8 @@ export declare function defineRuleAlternatives<T = unknown>(spec: Omit<VbaExtrac
122
122
  * each classifier re-implementing the same boilerplate.
123
123
  */
124
124
  export declare function matchRule(pattern: RegExp | RegExp[], line: string): RegExpMatchArray | null;
125
+ export declare function matchRuleForScan(rule: VbaExtractionRule, line: string, maskedLine: string): {
126
+ match: RegExpMatchArray;
127
+ line: string;
128
+ } | null;
125
129
  //# sourceMappingURL=rules.d.ts.map
@@ -23,6 +23,7 @@ export declare function maskStringContent(line: string): string;
23
23
  export declare function escapeRegExpLiteral(value: string): string;
24
24
  export declare function parseConstDeclarations(body: string): Array<{
25
25
  name: string;
26
+ asType: string;
26
27
  value: string | null;
27
28
  }>;
28
29
  export declare function splitOutsideVbaStrings(value: string, separator: string): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aroman22/codegraph-vba",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Local-first code intelligence for AI agents (MCP). Self-contained — bundles its own runtime.",
5
5
  "bin": {
6
6
  "codegraph-vba": "npm-shim.js"
@@ -15,12 +15,12 @@
15
15
  "./package.json": "./package.json"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@aroman22/codegraph-vba-darwin-arm64": "1.11.0",
19
- "@aroman22/codegraph-vba-darwin-x64": "1.11.0",
20
- "@aroman22/codegraph-vba-linux-arm64": "1.11.0",
21
- "@aroman22/codegraph-vba-linux-x64": "1.11.0",
22
- "@aroman22/codegraph-vba-win32-arm64": "1.11.0",
23
- "@aroman22/codegraph-vba-win32-x64": "1.11.0"
18
+ "@aroman22/codegraph-vba-darwin-arm64": "1.12.0",
19
+ "@aroman22/codegraph-vba-darwin-x64": "1.12.0",
20
+ "@aroman22/codegraph-vba-linux-arm64": "1.12.0",
21
+ "@aroman22/codegraph-vba-linux-x64": "1.12.0",
22
+ "@aroman22/codegraph-vba-win32-arm64": "1.12.0",
23
+ "@aroman22/codegraph-vba-win32-x64": "1.12.0"
24
24
  },
25
25
  "files": [
26
26
  "npm-shim.js",