ghagga-core 3.2.0 → 3.3.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.
Files changed (79) hide show
  1. package/dist/agents/issue-triage.d.ts +143 -0
  2. package/dist/agents/issue-triage.d.ts.map +1 -0
  3. package/dist/agents/issue-triage.js +230 -0
  4. package/dist/agents/issue-triage.js.map +1 -0
  5. package/dist/agents/prompts.d.ts +41 -1
  6. package/dist/agents/prompts.d.ts.map +1 -1
  7. package/dist/agents/prompts.js +123 -2
  8. package/dist/agents/prompts.js.map +1 -1
  9. package/dist/enhance/prompt.d.ts +1 -1
  10. package/dist/enhance/prompt.d.ts.map +1 -1
  11. package/dist/graph/builder.d.ts +13 -1
  12. package/dist/graph/builder.d.ts.map +1 -1
  13. package/dist/graph/builder.js +305 -6
  14. package/dist/graph/builder.js.map +1 -1
  15. package/dist/graph/call-chain.d.ts +27 -0
  16. package/dist/graph/call-chain.d.ts.map +1 -1
  17. package/dist/graph/call-chain.js +113 -18
  18. package/dist/graph/call-chain.js.map +1 -1
  19. package/dist/graph/changed-symbols.d.ts +57 -0
  20. package/dist/graph/changed-symbols.d.ts.map +1 -0
  21. package/dist/graph/changed-symbols.js +123 -0
  22. package/dist/graph/changed-symbols.js.map +1 -0
  23. package/dist/graph/extractors/index.d.ts +3 -3
  24. package/dist/graph/extractors/index.d.ts.map +1 -1
  25. package/dist/graph/extractors/index.js +2 -2
  26. package/dist/graph/extractors/index.js.map +1 -1
  27. package/dist/graph/extractors/javascript.d.ts.map +1 -1
  28. package/dist/graph/extractors/javascript.js +89 -3
  29. package/dist/graph/extractors/javascript.js.map +1 -1
  30. package/dist/graph/extractors/rust.d.ts.map +1 -1
  31. package/dist/graph/extractors/rust.js +7 -2
  32. package/dist/graph/extractors/rust.js.map +1 -1
  33. package/dist/graph/extractors/types.d.ts +7 -1
  34. package/dist/graph/extractors/types.d.ts.map +1 -1
  35. package/dist/graph/extractors/typescript.d.ts.map +1 -1
  36. package/dist/graph/extractors/typescript.js +95 -4
  37. package/dist/graph/extractors/typescript.js.map +1 -1
  38. package/dist/graph/index.d.ts +8 -3
  39. package/dist/graph/index.d.ts.map +1 -1
  40. package/dist/graph/index.js +4 -2
  41. package/dist/graph/index.js.map +1 -1
  42. package/dist/graph/loader.d.ts +29 -0
  43. package/dist/graph/loader.d.ts.map +1 -1
  44. package/dist/graph/loader.js +70 -1
  45. package/dist/graph/loader.js.map +1 -1
  46. package/dist/graph/narrow-symbols.d.ts +73 -0
  47. package/dist/graph/narrow-symbols.d.ts.map +1 -0
  48. package/dist/graph/narrow-symbols.js +195 -0
  49. package/dist/graph/narrow-symbols.js.map +1 -0
  50. package/dist/graph/schema.d.ts +117 -4
  51. package/dist/graph/schema.d.ts.map +1 -1
  52. package/dist/graph/schema.js +67 -3
  53. package/dist/graph/schema.js.map +1 -1
  54. package/dist/graph/scip/builder.d.ts +64 -0
  55. package/dist/graph/scip/builder.d.ts.map +1 -0
  56. package/dist/graph/scip/builder.js +268 -0
  57. package/dist/graph/scip/builder.js.map +1 -0
  58. package/dist/graph/scip/merge.d.ts +66 -0
  59. package/dist/graph/scip/merge.d.ts.map +1 -0
  60. package/dist/graph/scip/merge.js +98 -0
  61. package/dist/graph/scip/merge.js.map +1 -0
  62. package/dist/index.d.ts +5 -2
  63. package/dist/index.d.ts.map +1 -1
  64. package/dist/index.js +3 -1
  65. package/dist/index.js.map +1 -1
  66. package/dist/pipeline/prepare-graph.d.ts +23 -1
  67. package/dist/pipeline/prepare-graph.d.ts.map +1 -1
  68. package/dist/pipeline/prepare-graph.js +119 -3
  69. package/dist/pipeline/prepare-graph.js.map +1 -1
  70. package/dist/pipeline/prepare.d.ts.map +1 -1
  71. package/dist/pipeline/prepare.js +2 -0
  72. package/dist/pipeline/prepare.js.map +1 -1
  73. package/dist/providers/cli-bridge.d.ts.map +1 -1
  74. package/dist/providers/cli-bridge.js +1 -0
  75. package/dist/providers/cli-bridge.js.map +1 -1
  76. package/dist/types.d.ts +21 -0
  77. package/dist/types.d.ts.map +1 -1
  78. package/dist/types.js.map +1 -1
  79. package/package.json +3 -1
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Symbol-Precise Blast-Radius Narrowing (scip-symbol-exclusion, design v3 SAFE)
3
+ *
4
+ * A PURE SUBTRACTIVE POST-FILTER over `computeBlastRadius` — never an
5
+ * alternative inclusion path. `computeBlastRadius`/`buildReverseIndex`
6
+ * (blast-radius.ts) stay BYTE-IDENTICAL; this module only removes
7
+ * provably-unaffected DIRECT (depth-1) dependents from that result.
8
+ *
9
+ * Three fail-closed pillars, each independently load-bearing:
10
+ * - Pillar 0 (`isExactCommitFresh`): symbol-line attribution is only valid
11
+ * when the graph was indexed at the EXACT SAME commit as the diff's
12
+ * post-image — a stale graph shifts lines and silently maps changed
13
+ * lines to the WRONG symbol (Pillar 1 cannot catch this: a symbol WAS
14
+ * found, just the wrong one). ANY doubt about freshness ⇒ no exclusion.
15
+ * - Pillar 1 (`hasUnattributedChanges`): changed-symbol data always comes
16
+ * from `computeChangedSymbolsComplete`; any changed file with even one
17
+ * unattributed line forces conservative-include of every dependent
18
+ * reaching it.
19
+ * - Pillar 2 (`canExcludeEdge`): a pure, fail-closed ENUMERATED WHITELIST
20
+ * on B's (the changed file's) language + builtVia. DEFAULT false — only
21
+ * explicitly enumerated cells return true. This is a whitelist, not a
22
+ * `!== python` blacklist (that was JD-001, a confirmed BLOCKER: it
23
+ * wrongly allowed go/kotlin/csharp/php under SCIP).
24
+ *
25
+ * Any single uncertainty at any layer resolves to INCLUDE. Never narrows a
26
+ * directly-changed file, and — because condition (2) below forces include
27
+ * on ANY transitive hop — only ever prunes DIRECT (depth-1) dependents;
28
+ * transitive dependents are always included (documented, not a bug).
29
+ */
30
+ import { isGraphStale } from './schema.js';
31
+ // ─── Pillar 2: canExcludeEdge — fail-closed enumerated whitelist ────
32
+ /**
33
+ * SCIP-dense whitelist (D2/spec): languages where SCIP symbol extraction is
34
+ * empirically dense enough to trust for exclusion. Go has partial SCIP
35
+ * fidelity (JD-001 guard: must stay excluded from this set). Python's
36
+ * scip-python fidelity is unverified. Any language NOT in this set —
37
+ * including future/unknown languages — resolves to conservative-include.
38
+ */
39
+ const SCIP_DENSE_LANGUAGES = new Set([
40
+ 'typescript',
41
+ 'javascript',
42
+ 'rust',
43
+ 'java',
44
+ ]);
45
+ /**
46
+ * Regex-dense whitelist: languages where the regex extractor's
47
+ * `importSymbols` is dense enough to trust for exclusion WITHOUT an
48
+ * additional per-edge precondition.
49
+ */
50
+ const REGEX_DENSE_LANGUAGES = new Set([
51
+ 'typescript',
52
+ 'javascript',
53
+ 'java',
54
+ ]);
55
+ /**
56
+ * Regex languages where `importSymbols` is sparse/alias-only in general,
57
+ * but MAY be trusted for exclusion IF the specific edge A→B happens to
58
+ * carry a populated `importSymbols[B]` entry (already enforced by the
59
+ * universal precondition below — this set just says "these two languages
60
+ * are eligible for that precondition-gated allowance", Go is NOT).
61
+ */
62
+ const REGEX_CONDITIONAL_LANGUAGES = new Set(['python', 'rust']);
63
+ /**
64
+ * Pure, fail-closed gate for a single edge A→B (A depends on changed file
65
+ * B). DEFAULT return is `false`; only the explicitly enumerated cells in
66
+ * the D2 table return `true`. Gates on B's language — NEVER A's — because
67
+ * the carve-out is about B's extracted-symbol fidelity, not A's.
68
+ */
69
+ export function canExcludeEdge(aNode, bPath, bNode, builtVia) {
70
+ // Universal preconditions — any false ⇒ false immediately.
71
+ if (builtVia !== 'scip' && builtVia !== 'regex')
72
+ return false;
73
+ if (bNode.reExportsAll && bNode.reExportsAll.length > 0)
74
+ return false;
75
+ const usedSymbols = aNode.importSymbols?.[bPath];
76
+ if (!usedSymbols || usedSymbols.length === 0)
77
+ return false;
78
+ if (!bNode.symbolRanges || Object.keys(bNode.symbolRanges).length === 0)
79
+ return false;
80
+ const bLang = bNode.language;
81
+ if (builtVia === 'scip') {
82
+ return SCIP_DENSE_LANGUAGES.has(bLang);
83
+ }
84
+ // builtVia === 'regex'
85
+ if (REGEX_DENSE_LANGUAGES.has(bLang))
86
+ return true;
87
+ if (REGEX_CONDITIONAL_LANGUAGES.has(bLang)) {
88
+ // Universal precondition already enforced aNode.importSymbols[bPath]
89
+ // is present and non-empty above — that IS the "importSymbols[B]
90
+ // present on edge A→B" requirement from the spec for python/rust.
91
+ return true;
92
+ }
93
+ return false;
94
+ }
95
+ // ─── Pillar 0: isExactCommitFresh ───────────────────────────────
96
+ /**
97
+ * True ONLY when `metadata.lastIndexedCommit` is present, EQUALS
98
+ * `currentHead`, and the graph is not stale-by-age. ANY doubt (absent
99
+ * metadata, head mismatch, empty currentHead, stale-by-age) ⇒ false —
100
+ * fails safe, never assumes freshness.
101
+ */
102
+ export function isExactCommitFresh(metadata, currentHead) {
103
+ if (!metadata)
104
+ return false;
105
+ if (!metadata.lastIndexedCommit)
106
+ return false;
107
+ if (!currentHead)
108
+ return false;
109
+ if (metadata.lastIndexedCommit !== currentHead)
110
+ return false;
111
+ if (isGraphStale(metadata))
112
+ return false;
113
+ return true;
114
+ }
115
+ // ─── narrowBySymbols — the post-filter ──────────────────────────
116
+ /**
117
+ * Compute the set of dependents to EXCLUDE from the blast radius.
118
+ *
119
+ * For each candidate dependent A (never a directly-changed file), A is
120
+ * excluded ONLY if, for EVERY direct import target B of A that is itself
121
+ * a changed file:
122
+ * - `changedByFile` has a complete entry for B with `hasUnattributedChanges === false`, AND
123
+ * - `canExcludeEdge(A, B)` is true, AND
124
+ * - `importSymbols[A][B] ∩ changedSymbols[B]` is empty.
125
+ *
126
+ * A is included (never excluded) on ANY of:
127
+ * - transitive-only reach (some blast-radius file M ∈ A's reachable set
128
+ * is NOT one of A's DIRECT imports and is a changed file — approximated
129
+ * here by A having no direct changed-file import at all while still
130
+ * being in the BFS-derived `dependents` list, i.e. reached only via an
131
+ * intermediate),
132
+ * - any reached direct-changed-file B with unattributed changes,
133
+ * - an empty `importSymbols[A][B]` (side-effect/namespace import — treated
134
+ * as "uncertain", never as "uses nothing"),
135
+ * - any gating uncertainty at all.
136
+ *
137
+ * `dependents` MUST NOT include any file in `changedFileSet` — narrowing
138
+ * never touches directly-changed files (callers must filter/verify this;
139
+ * this function additionally defends by skipping any candidate that is
140
+ * itself in `changedFileSet`).
141
+ */
142
+ export function narrowBySymbols(dependents, changedByFile, graph, builtVia, _blastFiles, changedFileSet) {
143
+ const excluded = new Set();
144
+ if (builtVia !== 'scip' && builtVia !== 'regex')
145
+ return excluded;
146
+ for (const aPath of dependents) {
147
+ // Never narrow a directly-changed file, even if passed in by mistake.
148
+ if (changedFileSet.has(aPath))
149
+ continue;
150
+ const aNode = graph.nodes[aPath];
151
+ if (!aNode)
152
+ continue;
153
+ // Direct import targets of A that are themselves changed files.
154
+ const directChangedTargets = aNode.imports.filter((target) => changedFileSet.has(target));
155
+ // Transitive-only reach: A is a dependent (per BFS) but has NO direct
156
+ // import edge into any changed file — it must have been reached via an
157
+ // intermediate hop. Per D3 cond (2), always include.
158
+ if (directChangedTargets.length === 0)
159
+ continue;
160
+ let allEdgesSafe = true;
161
+ for (const bPath of directChangedTargets) {
162
+ const bNode = graph.nodes[bPath];
163
+ if (!bNode) {
164
+ allEdgesSafe = false;
165
+ break;
166
+ }
167
+ const complete = changedByFile.get(bPath);
168
+ if (!complete || complete.hasUnattributedChanges) {
169
+ allEdgesSafe = false;
170
+ break;
171
+ }
172
+ if (!canExcludeEdge(aNode, bPath, bNode, builtVia)) {
173
+ allEdgesSafe = false;
174
+ break;
175
+ }
176
+ const used = aNode.importSymbols?.[bPath];
177
+ if (!used || used.length === 0) {
178
+ // Empty-set-safe rule: an empty importSymbols entry is uncertain
179
+ // (side-effect/namespace import), never "uses nothing".
180
+ allEdgesSafe = false;
181
+ break;
182
+ }
183
+ const usesChangedSymbol = used.some((s) => complete.changedSymbols.has(s));
184
+ if (usesChangedSymbol) {
185
+ allEdgesSafe = false;
186
+ break;
187
+ }
188
+ }
189
+ if (allEdgesSafe) {
190
+ excluded.add(aPath);
191
+ }
192
+ }
193
+ return excluded;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QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3E,IAAI,iBAAiB,EAAE,CAAC;gBACtB,YAAY,GAAG,KAAK,CAAC;gBACrB,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -8,7 +8,23 @@
8
8
  * - Validation functions for runtime type checking
9
9
  * - Constants for limits, patterns, and language support
10
10
  */
11
- export type SupportedLanguage = 'typescript' | 'javascript' | 'python' | 'go' | 'java' | 'rust';
11
+ /**
12
+ * Languages that have a regex-based extractor (see `extractors/index.ts`).
13
+ * `Record<RegexSupportedLanguage, Extractor>` stays exhaustive: adding a new
14
+ * regex-capable language forces a compile error until an extractor exists.
15
+ */
16
+ export type RegexSupportedLanguage = 'typescript' | 'javascript' | 'python' | 'go' | 'java' | 'rust';
17
+ /**
18
+ * Languages only reachable via a SCIP indexer — no regex extractor exists
19
+ * (or ever will, e.g. Kotlin/C#/PHP). `--fallback-regex` cannot index files
20
+ * in these languages.
21
+ */
22
+ export type ScipOnlyLanguage = 'kotlin' | 'csharp' | 'php';
23
+ export type SupportedLanguage = RegexSupportedLanguage | ScipOnlyLanguage;
24
+ /** Runtime enumeration of `RegexSupportedLanguage`, for tests/tooling. */
25
+ export declare const REGEX_SUPPORTED_LANGUAGES: readonly RegexSupportedLanguage[];
26
+ /** Runtime enumeration of `ScipOnlyLanguage`, for tests/tooling. */
27
+ export declare const SCIP_ONLY_LANGUAGES: readonly ScipOnlyLanguage[];
12
28
  export interface DependencyGraph {
13
29
  /** Schema version for forward compatibility */
14
30
  version: number;
@@ -24,8 +40,41 @@ export interface GraphNode {
24
40
  language: SupportedLanguage;
25
41
  /** Relative paths of files this file imports from */
26
42
  imports: string[];
27
- /** Exported symbol names (for cross-reference) */
43
+ /**
44
+ * Per-import-target referenced symbol names, keyed by the SAME resolved
45
+ * path space as `imports` (i.e. `importSymbols[target]` is only
46
+ * meaningful when `target` also appears in `imports`). Additive/optional
47
+ * — populated where the extractor/occurrence data provides named symbols
48
+ * (TS/JS/Java dense; Go mostly alias-only; Python/Rust absent). Empty or
49
+ * unknown symbol lists OMIT the key entirely rather than storing `[]`.
50
+ * NEVER used to alter `imports` or any blast-radius/analyzer behavior —
51
+ * strictly additive advisory data for the Symbol Impact review context.
52
+ */
53
+ importSymbols?: Record<string, string[]>;
54
+ /**
55
+ * Locally-defined exported symbol names only (for cross-reference).
56
+ * Re-exported names (`export ... from`) are EXCLUDED — see
57
+ * `reExportedSymbols`/`reExportsAll` for those. Prior to the barrel
58
+ * re-export split (D3), this field also contained re-exported names;
59
+ * this is a behavior change for `export { x } from './b'`-style lines.
60
+ */
28
61
  exports: string[];
62
+ /**
63
+ * Symbol names re-exported via named or type-only `export ... from`
64
+ * (e.g. `export { X } from './b'`, `export type { X } from './b'`).
65
+ * Additive/optional — omitted when a file has no such re-exports.
66
+ * Distinguishes re-exported names from `exports` (locally-defined),
67
+ * per D3's safety primitive for a future conservative always-include
68
+ * exclusion fallback.
69
+ */
70
+ reExportedSymbols?: string[];
71
+ /**
72
+ * Resolved source paths of wildcard re-exports (`export * from './b'`).
73
+ * Additive/optional — omitted when a file has no wildcard re-exports.
74
+ * Individual re-exported symbol names are NOT enumerated for wildcards
75
+ * (D4) — only the source is recorded.
76
+ */
77
+ reExportsAll?: string[];
29
78
  /** Cross-file function/method calls */
30
79
  calls: Array<{
31
80
  target: string;
@@ -33,6 +82,20 @@ export interface GraphNode {
33
82
  }>;
34
83
  /** True if file matches test patterns */
35
84
  isTest: boolean;
85
+ /**
86
+ * Per-symbol full-body source line-range, 1-based INCLUSIVE, keyed by
87
+ * the SAME displayName space as `importSymbols` VALUES and `exports` —
88
+ * i.e. `symbolRanges[name]` uses the same identifier a downstream
89
+ * consumer compares against `importSymbols[target]` entries. Additive/
90
+ * optional — populated ONLY by the SCIP builder, from Definition-role
91
+ * occurrences' `enclosingRange`/`typedEnclosingRange` (TS/JS/Rust/Java
92
+ * dense, Go partial, C#/PHP absent — see graph/scip/builder.ts D2/D6).
93
+ * The regex-based builder NEVER populates this field. A symbol with no
94
+ * captured range is simply omitted from this map (never fabricated) —
95
+ * its changes cannot be attributed downstream and degrade
96
+ * conservatively (`hasUnattributedChanges`, see graph/changed-symbols.ts).
97
+ */
98
+ symbolRanges?: Record<string, [number, number]>;
36
99
  }
37
100
  export interface GraphMetadata {
38
101
  /** Full SHA of the commit that was last indexed */
@@ -47,6 +110,40 @@ export interface GraphMetadata {
47
110
  languages: string[];
48
111
  /** Indexing duration in milliseconds */
49
112
  indexDurationMs: number;
113
+ /**
114
+ * Languages detected but NOT indexed (informational only — never a
115
+ * staleness/warning trigger). Additive/optional for backward compatibility
116
+ * with older `metadata.json` producers.
117
+ */
118
+ skippedLanguages?: string[];
119
+ /**
120
+ * Graph schema version this metadata was written for (mirrors
121
+ * `DependencyGraph.version`). Additive/optional; used to detect a
122
+ * metadata/graph mismatch (e.g. stale metadata next to a rebuilt graph).
123
+ */
124
+ graphVersion?: number;
125
+ /**
126
+ * Which build path produced this graph: `'scip'` when at least one SCIP
127
+ * indexer succeeded for the run, `'regex'` when `--fallback-regex` was
128
+ * used (scip-symbol-exclusion D5). Builds are all-or-nothing per run, so
129
+ * a single graph-level field suffices — never per-node. Additive/
130
+ * optional for backward compatibility with older `metadata.json`
131
+ * producers; ABSENT or unrecognized MUST be treated as the most
132
+ * conservative case (no symbol-precise exclusion), never defaulted to
133
+ * either value.
134
+ *
135
+ * No `schemaVersion` bump was needed to introduce this field: a
136
+ * pre-existing `metadata.json` written before `builtVia` existed simply
137
+ * omits the key, `metadata?.builtVia` reads `undefined`, and the
138
+ * `applyBlastRadius` wiring (prepare-graph.ts) gates narrowing on
139
+ * `builtVia` being truthy — so a legacy/absent value already fails
140
+ * closed (no narrowing) without any version check. Verified at the
141
+ * integration-wiring level in
142
+ * `pipeline/prepare-graph-narrow.test.ts` (legacy/absent `builtVia`,
143
+ * `null` metadata, and missing `lastIndexedCommit` all assert
144
+ * zero narrowing).
145
+ */
146
+ builtVia?: 'scip' | 'regex';
50
147
  }
51
148
  export interface BlastRadiusMetadata {
52
149
  /** Whether blast-radius was enabled for this review */
@@ -61,6 +158,13 @@ export interface BlastRadiusMetadata {
61
158
  fallbackReason?: string;
62
159
  /** Whether the graph was stale (>7 days old) */
63
160
  graphStale?: boolean;
161
+ /**
162
+ * Number of direct (depth-1) dependents removed by symbol-precise
163
+ * narrowing (scip-symbol-exclusion), additive/optional. Absent or 0 when
164
+ * narrowing is disabled, not applicable (no `builtVia`/not
165
+ * exact-commit-fresh), or found nothing to narrow.
166
+ */
167
+ narrowedDependents?: number;
64
168
  }
65
169
  export interface GraphLoader {
66
170
  /** Load the dependency graph. Returns null if unavailable. */
@@ -70,7 +174,7 @@ export interface GraphLoader {
70
174
  }
71
175
  /** Current graph schema version */
72
176
  export declare const GRAPH_VERSION = 1;
73
- /** Maximum graph.json size in bytes (5 MB) */
177
+ /** Maximum graph.json size in bytes (20 MB) */
74
178
  export declare const MAX_GRAPH_SIZE_BYTES: number;
75
179
  /** Maximum files in a blast-radius result before falling back to full diff */
76
180
  export declare const MAX_BLAST_RADIUS_FILES = 50;
@@ -80,7 +184,16 @@ export declare const DEFAULT_TRAVERSAL_DEPTH = 3;
80
184
  export declare const GRAPH_STALE_DAYS = 7;
81
185
  /** Regex patterns that identify test files across supported languages */
82
186
  export declare const TEST_FILE_PATTERNS: RegExp[];
83
- /** Directories excluded from graph indexing */
187
+ /**
188
+ * Directories excluded from graph indexing.
189
+ *
190
+ * `.worktrees`, `.ghagga`, and `.tools` were added for nested marker
191
+ * detection (D2): once the marker walk descends beyond repo root, it can
192
+ * hit git worktree checkouts, ghagga's own output dir, and vendored-tool
193
+ * directories (e.g. a `.tools/codeql/` with 100k+ files) that fan out
194
+ * horizontally at shallow depth — a depth bound alone doesn't stop those,
195
+ * so they need an explicit name exclusion (defense in depth).
196
+ */
84
197
  export declare const EXCLUDED_DIRS: Set<string>;
85
198
  /** Map from file extension to supported language */
86
199
  export declare const LANGUAGE_EXTENSIONS: Record<string, SupportedLanguage>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/graph/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAIhG,MAAM,WAAW,eAAe;IAC9B,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAEhB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAC;IAEhB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IAEb,wBAAwB;IACxB,QAAQ,EAAE,iBAAiB,CAAC;IAE5B,qDAAqD;IACrD,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,kDAAkD;IAClD,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEjD,yCAAyC;IACzC,MAAM,EAAE,OAAO,CAAC;CACjB;AAID,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,iBAAiB,EAAE,MAAM,CAAC;IAE1B,yBAAyB;IACzB,aAAa,EAAE,MAAM,CAAC;IAEtB,+BAA+B;IAC/B,aAAa,EAAE,MAAM,CAAC;IAEtB,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAElB,wBAAwB;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB,wCAAw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M,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,IAAI,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IAExC,wDAAwD;IACxD,YAAY,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CAC/C;AAID,mCAAmC;AACnC,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,+CAA+C;AAC/C,eAAO,MAAM,oBAAoB,QAAmB,CAAC;AAErD,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,yEAAyE;AACzE,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAUtC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,aAaxB,CAAC;AAEH,oDAAoD;AACpD,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAejE,CAAC;AAIF;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAwDnE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAapE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAM7D"}
@@ -8,11 +8,22 @@
8
8
  * - Validation functions for runtime type checking
9
9
  * - Constants for limits, patterns, and language support
10
10
  */
11
+ /** Runtime enumeration of `RegexSupportedLanguage`, for tests/tooling. */
12
+ export const REGEX_SUPPORTED_LANGUAGES = [
13
+ 'typescript',
14
+ 'javascript',
15
+ 'python',
16
+ 'go',
17
+ 'java',
18
+ 'rust',
19
+ ];
20
+ /** Runtime enumeration of `ScipOnlyLanguage`, for tests/tooling. */
21
+ export const SCIP_ONLY_LANGUAGES = ['kotlin', 'csharp', 'php'];
11
22
  // ─── Constants ──────────────────────────────────────────────────
12
23
  /** Current graph schema version */
13
24
  export const GRAPH_VERSION = 1;
14
- /** Maximum graph.json size in bytes (5 MB) */
15
- export const MAX_GRAPH_SIZE_BYTES = 5 * 1024 * 1024;
25
+ /** Maximum graph.json size in bytes (20 MB) */
26
+ export const MAX_GRAPH_SIZE_BYTES = 20 * 1024 * 1024;
16
27
  /** Maximum files in a blast-radius result before falling back to full diff */
17
28
  export const MAX_BLAST_RADIUS_FILES = 50;
18
29
  /** Default BFS traversal depth for reverse dependency lookup */
@@ -27,8 +38,20 @@ export const TEST_FILE_PATTERNS = [
27
38
  /_test\.go$/,
28
39
  /Test\.java$/,
29
40
  /_test\.rs$/,
41
+ /Test\.kt$/,
42
+ /Tests\.cs$/,
43
+ /Test\.php$/,
30
44
  ];
31
- /** Directories excluded from graph indexing */
45
+ /**
46
+ * Directories excluded from graph indexing.
47
+ *
48
+ * `.worktrees`, `.ghagga`, and `.tools` were added for nested marker
49
+ * detection (D2): once the marker walk descends beyond repo root, it can
50
+ * hit git worktree checkouts, ghagga's own output dir, and vendored-tool
51
+ * directories (e.g. a `.tools/codeql/` with 100k+ files) that fan out
52
+ * horizontally at shallow depth — a depth bound alone doesn't stop those,
53
+ * so they need an explicit name exclusion (defense in depth).
54
+ */
32
55
  export const EXCLUDED_DIRS = new Set([
33
56
  'node_modules',
34
57
  'vendor',
@@ -39,6 +62,9 @@ export const EXCLUDED_DIRS = new Set([
39
62
  'dist',
40
63
  '.next',
41
64
  '.turbo',
65
+ '.worktrees',
66
+ '.ghagga',
67
+ '.tools',
42
68
  ]);
43
69
  /** Map from file extension to supported language */
44
70
  export const LANGUAGE_EXTENSIONS = {
@@ -52,6 +78,10 @@ export const LANGUAGE_EXTENSIONS = {
52
78
  '.go': 'go',
53
79
  '.java': 'java',
54
80
  '.rs': 'rust',
81
+ '.kt': 'kotlin',
82
+ '.kts': 'kotlin',
83
+ '.cs': 'csharp',
84
+ '.php': 'php',
55
85
  };
56
86
  // ─── Utility Functions ──────────────────────────────────────────
57
87
  /**
@@ -105,6 +135,40 @@ export function validateGraph(json) {
105
135
  return null;
106
136
  if (typeof node.isTest !== 'boolean')
107
137
  return null;
138
+ // importSymbols is additive/optional — permissive spot-check only:
139
+ // when present it must be a plain object whose values are string
140
+ // arrays. Absence is always valid (older producers, non-TS builds).
141
+ if (node.importSymbols !== undefined) {
142
+ if (typeof node.importSymbols !== 'object' || node.importSymbols === null)
143
+ return null;
144
+ for (const value of Object.values(node.importSymbols)) {
145
+ if (!Array.isArray(value))
146
+ return null;
147
+ }
148
+ }
149
+ // reExportedSymbols/reExportsAll are additive/optional — permissive
150
+ // spot-check only: when present, must be a string array. Absence is
151
+ // always valid (older producers, files with no re-exports).
152
+ if (node.reExportedSymbols !== undefined && !Array.isArray(node.reExportedSymbols)) {
153
+ return null;
154
+ }
155
+ if (node.reExportsAll !== undefined && !Array.isArray(node.reExportsAll)) {
156
+ return null;
157
+ }
158
+ // symbolRanges is additive/optional — permissive spot-check only: when
159
+ // present, must be a plain object whose values are [number, number]
160
+ // tuples. Absence is always valid (older producers, regex-built
161
+ // graphs, files with no captured ranges).
162
+ if (node.symbolRanges !== undefined) {
163
+ if (typeof node.symbolRanges !== 'object' || node.symbolRanges === null)
164
+ return null;
165
+ for (const value of Object.values(node.symbolRanges)) {
166
+ if (!Array.isArray(value) || value.length !== 2)
167
+ return null;
168
+ if (typeof value[0] !== 'number' || typeof value[1] !== 'number')
169
+ return null;
170
+ }
171
+ }
108
172
  }
109
173
  return json;
110
174
  }
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/graph/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA2FH,mEAAmE;AAEnE,mCAAmC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAG,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I,CAAC;IACvD,IAAI,OAAO,GAAG,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEzD,OAAO,IAAqB,CAAC;AAC/B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,QAAuB;IAClD,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;IACrD,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAChD,OAAO,QAAQ,GAAG,gBAAgB,CAAC;AACrC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * SCIP → DependencyGraph Mapper
3
+ *
4
+ * Builds a v1 DependencyGraph from a parsed SCIP `Index` (as produced by
5
+ * `scip-go` and other SCIP-conformant indexers). Pure function: no
6
+ * filesystem access — the caller supplies the already-parsed Index (or
7
+ * raw bytes, via `parseScipIndex`).
8
+ *
9
+ * Unlike the regex-based `buildGraph()` (../builder.ts), this mapper
10
+ * resolves cross-file references by SCIP symbol identity rather than
11
+ * import-statement string matching, which lets it follow full
12
+ * module-path references a regex extractor cannot (e.g. Go's
13
+ * `example.com/module/pkg` import form).
14
+ *
15
+ * Algorithm:
16
+ * Pass A: build `symbolId -> definingDocPath` from every non-local
17
+ * symbol defined in each document (via `Document.symbols` and
18
+ * Definition-role occurrences).
19
+ * Pass B: for each document, for each non-definition (reference)
20
+ * occurrence, resolve `occ.symbol` through the Pass A map. If
21
+ * it resolves to a *different* in-index document, record that
22
+ * document's path as an import. Symbols with no entry in the
23
+ * map (external/stdlib symbols, e.g. those only present in
24
+ * `Index.externalSymbols`) are dropped — no edge is produced.
25
+ *
26
+ * `calls` is always `[]` in v1 (parity with the regex baseline — call-graph
27
+ * extraction is out of scope here). `SymbolInformation.relationships`
28
+ * (implements/type-definition/etc.) are intentionally ignored: v1 only
29
+ * models reference-based edges.
30
+ *
31
+ * Pass B additionally accumulates `importSymbols` (see schema.ts):
32
+ * alongside `importSet.add(targetPath)`, resolved reference occurrences are
33
+ * grouped into `Map<targetPath, Set<symbolId>>`, DEDUPED BY `occ.symbol`
34
+ * IDENTITY (not by rendered displayName — two distinct symbols that happen
35
+ * to render the same display name must stay as two separate entries). The
36
+ * displayName (from Pass A's `displayNameMap`, falling back to the raw
37
+ * symbol id) is only resolved at emit time.
38
+ */
39
+ import { type Index } from '@scip-code/scip';
40
+ import { type DependencyGraph } from '../schema.js';
41
+ /**
42
+ * Parse raw SCIP index bytes (the contents of an `index.scip` file)
43
+ * into a typed `Index` message.
44
+ */
45
+ export declare function parseScipIndex(bytes: Uint8Array): Index;
46
+ export interface BuildGraphFromScipOptions {
47
+ /**
48
+ * Called for every SCIP document whose `language` cannot be mapped to a
49
+ * `SupportedLanguage` (D5) — the document is dropped from the graph, same
50
+ * as before, but the caller now gets a chance to report it instead of the
51
+ * drop happening silently. Core stays console-free: pass a callback that
52
+ * wires to `tui.warn` at the call site.
53
+ */
54
+ onUnmappedDoc?: (relativePath: string, language: string) => void;
55
+ }
56
+ /**
57
+ * Build a complete DependencyGraph from a parsed SCIP Index.
58
+ *
59
+ * @param index - Parsed SCIP Index (see `parseScipIndex`)
60
+ * @param opts - Optional hooks (see `BuildGraphFromScipOptions`)
61
+ * @returns Complete v1 DependencyGraph
62
+ */
63
+ export declare function buildGraphFromScip(index: Index, opts?: BuildGraphFromScipOptions): DependencyGraph;
64
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../../src/graph/scip/builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAIH,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,eAAe,EAKrB,MAAM,cAAc,CAAC;AAItB;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAEvD;AAsGD,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,IAAI,CAAC,EAAE,yBAAyB,GAC/B,eAAe,CAkIjB"}