Skip to content

feat(cli): add VBA rule-table stats#175

Merged
ardelperal merged 3 commits into
mainfrom
feat/168-vba-rule-stats
Jul 18, 2026
Merged

feat(cli): add VBA rule-table stats#175
ardelperal merged 3 commits into
mainfrom
feat/168-vba-rule-stats

Conversation

@ardelperal

Copy link
Copy Markdown
Owner

Closes #168

Summary

  • add \codegraph-vba stats vba-rules [--json]\ for static VBA rule introspection
  • expose concern and total rule counts without fabricating runtime emission counts
  • document and test human-readable and machine-readable output

TDD evidence

  • RED: test import failed before the stats module existed
  • GREEN: 13/13 new tests passed
  • Focused CLI/extraction sweep: 51/51 passed
  • VBA rule/invariant sweep: 93/93 passed

  • pm run build`n
    Independent final review found no blocking or important findings.

codegraph-vba-bot and others added 3 commits July 18, 2026 12:59
…#168)

Option A from the issue: build the tooling instead of marking
VBA_RULE_TABLES as @internal. The new subcommand lists every
declarative rule the VBA extractor dispatches with concern, id,
plain-English description, serialized pattern, per-concern count,
and the cross-concern total. --json prints a machine-readable
envelope; the default mode is a human-readable listing.

Important: the output reports STATIC rule counts (size of each
classifier's RULES array), not per-rule runtime emission counts.
vba-extractor.ts does not track per-rule emission counts at the
orchestrator level today (the only instrumentation is
vba-timing.ts per-stage wall-clock timings and VbaClassifier.count
per-classifier totals). Anything resembling 'rule X fired N times'
would be invented; keep it absent until real instrumentation
exists. The unit test pins that boundary explicitly.

Files:
  - src/cli/stats-vba-rules.ts (new) — pure buildStatsVbaRules()
    over VBA_RULE_TABLES; serializes single RegExp as .source
    string and RegExp[] alternatives as string[] preserving order.
  - src/bin/codegraph.ts — new 'stats' parent + 'vba-rules'
    subcommand with --json, following the existing 'status' command
    pattern.
  - __tests__/stats-vba-rules.test.ts (new) — 13 tests covering the
    unit shape, JSON envelope contract, CLI integration end-to-end
    against the built binary, and a regression guard that no
    fabricated emission-count field sneaks in.
  - README.md — added the new command to the CLI reference.
  - CHANGELOG.md — friendly user-facing entry under [Unreleased]
    > New Features.

Installer files left untouched per the issue's scope.
@ardelperal ardelperal added the enhancement New feature or request label Jul 18, 2026
@ardelperal
ardelperal merged commit 4ece18b into main Jul 18, 2026
5 checks passed
@ardelperal
ardelperal deleted the feat/168-vba-rule-stats branch July 18, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: vba-extractor — resolve VBA_RULE_TABLES export contract

1 participant