@aroman22/codegraph-vba 1.11.0 → 1.13.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 +1 -0
- package/dist/cli/stats-vba-rules.d.ts +64 -0
- package/dist/db/queries.d.ts +4 -2
- package/dist/extraction/vba/constants.d.ts +6 -0
- package/dist/extraction/vba/context.d.ts +1 -0
- package/dist/extraction/vba/rules.d.ts +6 -2
- package/dist/extraction/vba/text-utils.d.ts +1 -0
- package/dist/resolution/vba-runtime-objects.d.ts +3 -0
- package/dist/types.d.ts +4 -3
- package/package.json +7 -7
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
|
package/dist/db/queries.d.ts
CHANGED
|
@@ -534,8 +534,9 @@ export declare class QueryBuilder {
|
|
|
534
534
|
referenceKind: string;
|
|
535
535
|
}>): void;
|
|
536
536
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
537
|
+
* Park refs a completed resolution pass could not resolve as `failed`, or
|
|
538
|
+
* as `declined-runtime` when the resolver recognizes built-in runtime noise.
|
|
539
|
+
* Parked rows are invisible to the pending
|
|
539
540
|
* count/batch readers (so drain loops and the #1187 orphan sweep still
|
|
540
541
|
* terminate) but stay queryable by name_tail so a later sync can retry them
|
|
541
542
|
* when a changed file introduces a symbol that could satisfy them. name_tail
|
|
@@ -546,6 +547,7 @@ export declare class QueryBuilder {
|
|
|
546
547
|
fromNodeId: string;
|
|
547
548
|
referenceName: string;
|
|
548
549
|
referenceKind: string;
|
|
550
|
+
status?: 'failed' | 'declined-runtime';
|
|
549
551
|
}>): void;
|
|
550
552
|
/**
|
|
551
553
|
* Failed refs whose name tail matches one of the given symbol names — the
|
|
@@ -25,6 +25,12 @@ export declare const PROCEDURE_END_RE: RegExp;
|
|
|
25
25
|
export declare const PRIMITIVE_TYPES: Set<string>;
|
|
26
26
|
/** Keywords we never want to match as call receivers. */
|
|
27
27
|
export declare const CALL_KEYWORD_BLACKLIST: Set<string>;
|
|
28
|
+
/**
|
|
29
|
+
* VBA reserved words that cannot name an unqualified user-code target.
|
|
30
|
+
* Stored lowercase so source casing cannot change classification.
|
|
31
|
+
*/
|
|
32
|
+
export declare const VBA_KEYWORDS: Set<string>;
|
|
33
|
+
export declare function isVbaKeyword(name: string): boolean;
|
|
28
34
|
/**
|
|
29
35
|
* Access runtime objects and singletons. Calls on these receivers are
|
|
30
36
|
* real VBA calls but the targets are NOT user-defined modules or
|
|
@@ -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
|
-
*
|
|
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[];
|
|
@@ -37,4 +37,7 @@ export declare const RUNTIME_OBJECTS: ReadonlySet<string>;
|
|
|
37
37
|
* defensively so a bracketed receiver (`[DAO]`) still matches.
|
|
38
38
|
*/
|
|
39
39
|
export declare function isRuntimeObject(receiver: string | null | undefined): boolean;
|
|
40
|
+
/** Canonical VBA and Access built-in functions that never resolve to project code. */
|
|
41
|
+
export declare const VBA_STDLIB_FUNCTIONS: ReadonlySet<string>;
|
|
42
|
+
export declare function isVbaStdlibFunction(name: string | null | undefined): boolean;
|
|
40
43
|
//# sourceMappingURL=vba-runtime-objects.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -175,7 +175,7 @@ export interface ExtractionError {
|
|
|
175
175
|
* layer. The legacy `EdgeKind` literal `'references'` is preserved as
|
|
176
176
|
* `references` here via `EdgeKind` — back-compat for any push site this
|
|
177
177
|
* round does not reclassify (e.g. the Implements emitter). New literals:
|
|
178
|
-
* - `
|
|
178
|
+
* - `calls` paren-form `Name(...)` or statement-form Sub call
|
|
179
179
|
* - `qualified-call` `Receiver.Member(...)` (qualified-paren) or
|
|
180
180
|
* `Receiver.Member args` (qualified-statement)
|
|
181
181
|
* - `property-get` `Me.Name` (dot access, read)
|
|
@@ -190,12 +190,13 @@ export interface ExtractionError {
|
|
|
190
190
|
* - `dao-query` `DoCmd.OpenQuery "X"` argument
|
|
191
191
|
* `dao-field-get` / `dao-field-set` are deliberately deferred to round-4.
|
|
192
192
|
*/
|
|
193
|
-
|
|
193
|
+
/** `calls` is the canonical kind for unresolved procedure and function calls. */
|
|
194
|
+
export type ReferenceKind = EdgeKind | 'function_ref' | 'qualified-call' | 'property-get' | 'property-set' | 'bang-get' | 'bang-set' | 'unqualified-ident' | 'member-with' | 'dao-query';
|
|
194
195
|
/**
|
|
195
196
|
* Runtime guard for whether a `ReferenceKind` literal is also an `EdgeKind`
|
|
196
197
|
* literal (i.e. the value flows from an unresolved-ref row straight onto the
|
|
197
198
|
* kind column of a resolved edge without remapping). Round-3 (issue #108)
|
|
198
|
-
* introduced shape-based classifier literals (`
|
|
199
|
+
* introduced shape-based classifier literals (`qualified-call`,
|
|
199
200
|
* `property-get`, …) that are valid as a `ReferenceKind` but are NOT valid
|
|
200
201
|
* edge kinds — edges still use the `calls`/`references` family of literals.
|
|
201
202
|
* The resolver uses this guard to fall back to `'references'` for the edge
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aroman22/codegraph-vba",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.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.
|
|
19
|
-
"@aroman22/codegraph-vba-darwin-x64": "1.
|
|
20
|
-
"@aroman22/codegraph-vba-linux-arm64": "1.
|
|
21
|
-
"@aroman22/codegraph-vba-linux-x64": "1.
|
|
22
|
-
"@aroman22/codegraph-vba-win32-arm64": "1.
|
|
23
|
-
"@aroman22/codegraph-vba-win32-x64": "1.
|
|
18
|
+
"@aroman22/codegraph-vba-darwin-arm64": "1.13.0",
|
|
19
|
+
"@aroman22/codegraph-vba-darwin-x64": "1.13.0",
|
|
20
|
+
"@aroman22/codegraph-vba-linux-arm64": "1.13.0",
|
|
21
|
+
"@aroman22/codegraph-vba-linux-x64": "1.13.0",
|
|
22
|
+
"@aroman22/codegraph-vba-win32-arm64": "1.13.0",
|
|
23
|
+
"@aroman22/codegraph-vba-win32-x64": "1.13.0"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"npm-shim.js",
|