scip-query 0.4.1 → 0.4.3

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 (138) hide show
  1. package/dist/{chunk-JHVQB4Y5.js → chunk-334PCFO3.js} +12 -12
  2. package/dist/{chunk-OXX3QF24.js → chunk-46ZTW4AI.js} +2 -2
  3. package/dist/{chunk-24LF6IZB.js → chunk-4YN3PE57.js} +3 -3
  4. package/dist/{chunk-3NJSJ7TE.js → chunk-5YB6UXQ3.js} +4 -15
  5. package/dist/{chunk-Z5VSUOEE.js → chunk-6PVHJ332.js} +2 -2
  6. package/dist/{chunk-EAGKJFDX.js → chunk-7KGTWDAX.js} +3 -3
  7. package/dist/{chunk-PU2254N2.js → chunk-7OGXSMLY.js} +5 -15
  8. package/dist/{chunk-R7HPHMRZ.js → chunk-AEBM56CO.js} +3 -3
  9. package/dist/{chunk-SYQR4QGK.js → chunk-B747RITP.js} +3 -3
  10. package/dist/{chunk-A6XLXV6W.js → chunk-B7LDMCUS.js} +3 -3
  11. package/dist/{chunk-KLNKDX6A.js → chunk-C2VSV54P.js} +4 -4
  12. package/dist/{chunk-VKBOLNYN.js → chunk-DIYEUFVP.js} +10 -8
  13. package/dist/{chunk-RE7POFGI.js → chunk-E74RY6AQ.js} +2 -2
  14. package/dist/{chunk-RL74LF47.js → chunk-FIMTTUGE.js} +2 -2
  15. package/dist/{chunk-ALUFWH3U.js → chunk-FMAYH7GS.js} +116 -269
  16. package/dist/{chunk-MGNMHKX3.js → chunk-FO2CBB7U.js} +10 -2
  17. package/dist/{chunk-7BS4CPJX.js → chunk-HESWGDIV.js} +3 -3
  18. package/dist/{chunk-FVJE4MQL.js → chunk-HL2LXSBW.js} +5 -8
  19. package/dist/{chunk-KG4OFQEN.js → chunk-HW76DVE4.js} +3 -3
  20. package/dist/{chunk-RJ5GULL6.js → chunk-IC5NTO47.js} +2 -2
  21. package/dist/{chunk-VY2L4TP6.js → chunk-J34HAAEQ.js} +3 -3
  22. package/dist/{chunk-PCU455MX.js → chunk-JSXGC2EH.js} +2 -2
  23. package/dist/{chunk-NXUIWD6K.js → chunk-LQXBFCP2.js} +3 -3
  24. package/dist/{chunk-GNAMV3JC.js → chunk-NML6M5AS.js} +3 -3
  25. package/dist/{chunk-UJWI5CBB.js → chunk-NNFP4ZRF.js} +4 -7
  26. package/dist/{chunk-6ECR2FLR.js → chunk-NWXTQGUE.js} +4 -15
  27. package/dist/{chunk-ZVZAIIB5.js → chunk-NYZ6INK3.js} +3 -3
  28. package/dist/{chunk-JKXHHV4B.js → chunk-OMVF3BHY.js} +2 -2
  29. package/dist/{chunk-CBIWNZZZ.js → chunk-PGQXIAJF.js} +3 -3
  30. package/dist/{chunk-J47VSL6I.js → chunk-PKDFXASW.js} +3 -3
  31. package/dist/{chunk-POLELLNM.js → chunk-PSK5BPFE.js} +3 -3
  32. package/dist/{chunk-6CH23IAS.js → chunk-QZ4FRB65.js} +9 -7
  33. package/dist/{chunk-TWVXFKJA.js → chunk-R2QBMQQN.js} +4 -4
  34. package/dist/{chunk-5GCORUNV.js → chunk-T3ALCNCP.js} +30 -17
  35. package/dist/{chunk-QMXSLHZP.js → chunk-T6UVM534.js} +2 -2
  36. package/dist/{chunk-6UZU7DFL.js → chunk-U74VYTLX.js} +3 -3
  37. package/dist/{chunk-XUVPQDXW.js → chunk-UIRCHPOU.js} +4 -4
  38. package/dist/{chunk-43A4UCS7.js → chunk-UNS6ZQVX.js} +3 -3
  39. package/dist/{chunk-J6QXMYAQ.js → chunk-VJMTX3OR.js} +3 -3
  40. package/dist/{chunk-SVLUJSY7.js → chunk-XJSPWHNT.js} +4 -15
  41. package/dist/{chunk-W46L2BXT.js → chunk-XMZAC2VU.js} +2 -2
  42. package/dist/{chunk-ELFGD5EW.js → chunk-Y7FKURZG.js} +3 -3
  43. package/dist/{chunk-TO3L4YNK.js → chunk-YMSJCSRG.js} +5 -1
  44. package/dist/{chunk-DUJNJQPO.js → chunk-YQIWS5V6.js} +3 -3
  45. package/dist/{chunk-KYPXKV64.js → chunk-ZPEI7DRJ.js} +30 -15
  46. package/dist/cli.js +471 -473
  47. package/dist/{db-C4rPbKkI.d.ts → db-6F9R9e_t.d.ts} +0 -4
  48. package/dist/index.d.ts +20 -5
  49. package/dist/index.js +237 -81
  50. package/dist/queries/affected.d.ts +1 -1
  51. package/dist/queries/affected.js +3 -3
  52. package/dist/queries/bottlenecks.d.ts +1 -1
  53. package/dist/queries/bottlenecks.js +3 -3
  54. package/dist/queries/by-kind.d.ts +1 -1
  55. package/dist/queries/by-kind.js +3 -3
  56. package/dist/queries/call-graph.d.ts +1 -1
  57. package/dist/queries/call-graph.js +3 -3
  58. package/dist/queries/change-surface.d.ts +1 -1
  59. package/dist/queries/change-surface.js +3 -3
  60. package/dist/queries/code.d.ts +1 -1
  61. package/dist/queries/code.js +3 -3
  62. package/dist/queries/complexity-hotspots.d.ts +1 -1
  63. package/dist/queries/complexity-hotspots.js +3 -3
  64. package/dist/queries/complexity.d.ts +1 -1
  65. package/dist/queries/complexity.js +3 -3
  66. package/dist/queries/convergence.d.ts +1 -1
  67. package/dist/queries/convergence.js +3 -3
  68. package/dist/queries/coupling.d.ts +1 -1
  69. package/dist/queries/coupling.js +3 -3
  70. package/dist/queries/cycles.d.ts +1 -1
  71. package/dist/queries/cycles.js +3 -3
  72. package/dist/queries/dataflow.d.ts +1 -1
  73. package/dist/queries/dataflow.js +3 -3
  74. package/dist/queries/dead.d.ts +1 -1
  75. package/dist/queries/dead.js +4 -4
  76. package/dist/queries/deep-chains.d.ts +1 -1
  77. package/dist/queries/deep-chains.js +3 -3
  78. package/dist/queries/deps.d.ts +1 -1
  79. package/dist/queries/deps.js +3 -3
  80. package/dist/queries/diff-impact.d.ts +1 -1
  81. package/dist/queries/diff-impact.js +2 -2
  82. package/dist/queries/drift.d.ts +1 -1
  83. package/dist/queries/drift.js +3 -3
  84. package/dist/queries/extract-candidates.d.ts +1 -1
  85. package/dist/queries/extract-candidates.js +3 -3
  86. package/dist/queries/fan.d.ts +1 -1
  87. package/dist/queries/fan.js +3 -3
  88. package/dist/queries/files.d.ts +1 -1
  89. package/dist/queries/files.js +1 -1
  90. package/dist/queries/health.d.ts +1 -1
  91. package/dist/queries/health.js +14 -14
  92. package/dist/queries/hierarchy.d.ts +1 -1
  93. package/dist/queries/hierarchy.js +3 -3
  94. package/dist/queries/hotspots.d.ts +1 -1
  95. package/dist/queries/hotspots.js +3 -3
  96. package/dist/queries/imports.d.ts +1 -1
  97. package/dist/queries/imports.js +3 -3
  98. package/dist/queries/index.d.ts +1 -1
  99. package/dist/queries/index.js +45 -45
  100. package/dist/queries/isolated.d.ts +1 -1
  101. package/dist/queries/isolated.js +4 -4
  102. package/dist/queries/members.d.ts +1 -1
  103. package/dist/queries/members.js +3 -3
  104. package/dist/queries/methods.d.ts +1 -1
  105. package/dist/queries/methods.js +3 -3
  106. package/dist/queries/outline.d.ts +1 -1
  107. package/dist/queries/outline.js +3 -3
  108. package/dist/queries/passthrough-candidates.d.ts +1 -1
  109. package/dist/queries/passthrough-candidates.js +3 -3
  110. package/dist/queries/redundant-reexports.d.ts +1 -1
  111. package/dist/queries/redundant-reexports.js +4 -4
  112. package/dist/queries/refs.d.ts +1 -1
  113. package/dist/queries/refs.js +3 -3
  114. package/dist/queries/similar-chains.d.ts +1 -1
  115. package/dist/queries/similar-chains.js +3 -3
  116. package/dist/queries/similar-files.d.ts +1 -1
  117. package/dist/queries/similar-files.js +3 -3
  118. package/dist/queries/similar-signatures.d.ts +1 -1
  119. package/dist/queries/similar-signatures.js +3 -3
  120. package/dist/queries/similar.d.ts +2 -1
  121. package/dist/queries/similar.js +3 -3
  122. package/dist/queries/slice.d.ts +4 -3
  123. package/dist/queries/slice.js +3 -3
  124. package/dist/queries/stale-abstractions.d.ts +1 -1
  125. package/dist/queries/stale-abstractions.js +3 -3
  126. package/dist/queries/stats.d.ts +1 -1
  127. package/dist/queries/surface.d.ts +1 -1
  128. package/dist/queries/surface.js +3 -3
  129. package/dist/queries/symbols.d.ts +1 -1
  130. package/dist/queries/symbols.js +3 -3
  131. package/dist/queries/system.d.ts +1 -1
  132. package/dist/queries/system.js +3 -3
  133. package/dist/queries/trace.d.ts +1 -1
  134. package/dist/queries/trace.js +3 -3
  135. package/dist/queries/wrapper-candidates.d.ts +1 -1
  136. package/dist/queries/wrapper-candidates.js +3 -3
  137. package/dist/reindex-worker.js +146 -5
  138. package/package.json +3 -1
@@ -628,12 +628,8 @@ declare class ScipDatabase {
628
628
  readonly config: ScipQueryConfig;
629
629
  private pathFilter;
630
630
  constructor(config: ScipQueryConfig, pathFilter?: PathFilter);
631
- /** Attach a gitignore-based path filter for query results */
632
- setPathFilter(filter: PathFilter): void;
633
631
  /** Check if a path should be excluded based on .gitignore rules */
634
632
  isIgnored(relativePath: string): boolean;
635
- /** Filter an array of paths using the gitignore filter */
636
- filterPaths(paths: string[]): string[];
637
633
  /**
638
634
  * The local-symbol predicate: only match symbols that are defined
639
635
  * in files NOT excluded by gitignore. This replaces the old hardcoded
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as ScipSymbol, Q as ScipLocalSymbol, V as SupportedLanguage, X as IndexerConfig, Y as ProjectConfig, Z as WatcherStatus } from './db-C4rPbKkI.js';
2
- export { A as AffectedResult, B as BottleneckResult, a as ByKindResult, C as CallGraphResult, _ as ChangeSurfaceEntry, b as ChangeSurfaceResult, c as CodeResult, d as ComplexityHotspot, e as ComplexityResult, f as ConvergenceResult, g as CouplingResult, h as CycleResult, D as DataflowResult, i as DeadOptions, j as DeadSummary, $ as DeadSymbolResult, k as DeepChainResult, l as DepResult, a0 as DescriptorSuffix, m as DiffImpactResult, a1 as DriftResult, n as DriftSummary, E as ExtractCandidate, F as FanResult, o as FileResult, a2 as HealthAction, H as HealthReport, p as HierarchyNode, q as HotspotResult, I as ImportResult, a3 as IndexerOverrides, a4 as InstallMethod, r as IsolatedResult, M as MemberResult, s as MethodResult, O as OutlineNode, P as PassthroughCandidate, K as RedundantReexport, R as RefResult, S as ScipDatabase, a5 as ScipDescriptor, a6 as ScipQueryConfig, z as SimilarChainResult, y as SimilarFileResult, L as SimilarSignatureGroup, x as SimilarSymbolResult, J as SliceResult, G as StaleAbstraction, t as StatsResult, w as SurfaceResult, u as SymbolResult, v as SystemResult, T as TraceResult, U as UnusedImportResult, a7 as WatchConfig, W as WrapperCandidate, a8 as createGitignoreFilter } from './db-C4rPbKkI.js';
1
+ import { N as ScipSymbol, Q as ScipLocalSymbol, V as SupportedLanguage, X as IndexerConfig, Y as ProjectConfig, Z as WatcherStatus } from './db-6F9R9e_t.js';
2
+ export { A as AffectedResult, B as BottleneckResult, a as ByKindResult, C as CallGraphResult, _ as ChangeSurfaceEntry, b as ChangeSurfaceResult, c as CodeResult, d as ComplexityHotspot, e as ComplexityResult, f as ConvergenceResult, g as CouplingResult, h as CycleResult, D as DataflowResult, i as DeadOptions, j as DeadSummary, $ as DeadSymbolResult, k as DeepChainResult, l as DepResult, a0 as DescriptorSuffix, m as DiffImpactResult, a1 as DriftResult, n as DriftSummary, E as ExtractCandidate, F as FanResult, o as FileResult, a2 as HealthAction, H as HealthReport, p as HierarchyNode, q as HotspotResult, I as ImportResult, a3 as IndexerOverrides, a4 as InstallMethod, r as IsolatedResult, M as MemberResult, s as MethodResult, O as OutlineNode, P as PassthroughCandidate, K as RedundantReexport, R as RefResult, S as ScipDatabase, a5 as ScipDescriptor, a6 as ScipQueryConfig, z as SimilarChainResult, y as SimilarFileResult, L as SimilarSignatureGroup, x as SimilarSymbolResult, J as SliceResult, G as StaleAbstraction, t as StatsResult, w as SurfaceResult, u as SymbolResult, v as SystemResult, T as TraceResult, U as UnusedImportResult, a7 as WatchConfig, W as WrapperCandidate, a8 as createGitignoreFilter } from './db-6F9R9e_t.js';
3
3
  export { stats } from './queries/stats.js';
4
4
  export { files } from './queries/files.js';
5
5
  export { symbols } from './queries/symbols.js';
@@ -43,6 +43,7 @@ export { dataflow } from './queries/dataflow.js';
43
43
  export { slice } from './queries/slice.js';
44
44
  export { redundantReexports } from './queries/redundant-reexports.js';
45
45
  export { similarSignatures } from './queries/similar-signatures.js';
46
+ import { Index } from '@c4312/scip';
46
47
  import 'better-sqlite3';
47
48
 
48
49
  /**
@@ -88,6 +89,22 @@ declare const INDEXER_CONFIGS: Record<SupportedLanguage, IndexerConfig>;
88
89
  /** Get the indexer config for a language */
89
90
  declare function getIndexerConfig(language: SupportedLanguage): IndexerConfig;
90
91
 
92
+ interface MergeScipResult {
93
+ documentCount: number;
94
+ externalSymbolCount: number;
95
+ inputCount: number;
96
+ }
97
+ /**
98
+ * Merge multiple SCIP indices into a single index message.
99
+ *
100
+ * A SCIP index is a code graph snapshot: metadata about one indexed project plus
101
+ * the documents and external symbols discovered by one or more indexers. Merging
102
+ * means producing one unified snapshot so later conversion to SQLite sees the
103
+ * whole repo instead of whichever language indexed last.
104
+ */
105
+ declare function mergeScipIndexes(indexes: readonly Index[]): Index;
106
+ declare function mergeScipFiles(inputPaths: readonly string[], outputPath: string): MergeScipResult;
107
+
91
108
  /**
92
109
  * Check if a binary is available on PATH.
93
110
  */
@@ -224,8 +241,6 @@ declare class Watcher {
224
241
  start(): void;
225
242
  /** Stop watching and clean up */
226
243
  stop(): void;
227
- /** Get current watcher status */
228
- getStatus(): WatcherStatus;
229
244
  private handleFileChange;
230
245
  private triggerReindex;
231
246
  /**
@@ -250,4 +265,4 @@ declare function installSkills(opts?: {
250
265
  quiet?: boolean;
251
266
  }): InstallSkillsResult;
252
267
 
253
- export { INDEXER_CONFIGS, IndexerConfig, ProjectConfig, ScipLocalSymbol, ScipSymbol, SupportedLanguage, Watcher, WatcherStatus, detectLanguages, getIndexerConfig, getScipVersion, initProjectConfig, installSkills, isBinaryAvailable, isIndexerInstalled, isScipInstalled, leafName, loadProjectConfig, parseSymbol, printScipInstallInstructions, reindex, resolveCacheDir, resolveIndexPaths, shortenSymbol, tryInstallIndexer, tryInstallScipCli };
268
+ export { INDEXER_CONFIGS, IndexerConfig, ProjectConfig, ScipLocalSymbol, ScipSymbol, SupportedLanguage, Watcher, WatcherStatus, detectLanguages, getIndexerConfig, getScipVersion, initProjectConfig, installSkills, isBinaryAvailable, isIndexerInstalled, isScipInstalled, leafName, loadProjectConfig, mergeScipFiles, mergeScipIndexes, parseSymbol, printScipInstallInstructions, reindex, resolveCacheDir, resolveIndexPaths, shortenSymbol, tryInstallIndexer, tryInstallScipCli };
package/dist/index.js CHANGED
@@ -1,150 +1,150 @@
1
1
  import "./chunk-FVH3Y44U.js";
2
2
  import {
3
3
  surface
4
- } from "./chunk-UJWI5CBB.js";
4
+ } from "./chunk-NNFP4ZRF.js";
5
5
  import {
6
6
  symbols
7
- } from "./chunk-SYQR4QGK.js";
7
+ } from "./chunk-B747RITP.js";
8
8
  import {
9
9
  system
10
- } from "./chunk-POLELLNM.js";
10
+ } from "./chunk-PSK5BPFE.js";
11
11
  import {
12
12
  trace
13
- } from "./chunk-ZVZAIIB5.js";
13
+ } from "./chunk-NYZ6INK3.js";
14
14
  import {
15
15
  redundantReexports
16
- } from "./chunk-TWVXFKJA.js";
16
+ } from "./chunk-R2QBMQQN.js";
17
17
  import {
18
18
  refs
19
- } from "./chunk-J6QXMYAQ.js";
19
+ } from "./chunk-VJMTX3OR.js";
20
20
  import {
21
21
  similarChains
22
- } from "./chunk-QMXSLHZP.js";
22
+ } from "./chunk-T6UVM534.js";
23
23
  import {
24
24
  similarFiles
25
- } from "./chunk-RE7POFGI.js";
25
+ } from "./chunk-E74RY6AQ.js";
26
26
  import {
27
27
  similarSignatures
28
- } from "./chunk-7BS4CPJX.js";
28
+ } from "./chunk-HESWGDIV.js";
29
29
  import {
30
30
  slice
31
- } from "./chunk-5GCORUNV.js";
31
+ } from "./chunk-T3ALCNCP.js";
32
32
  import {
33
33
  hotspots
34
- } from "./chunk-VY2L4TP6.js";
34
+ } from "./chunk-J34HAAEQ.js";
35
35
  import {
36
36
  importedBy,
37
37
  imports,
38
38
  unusedImports
39
- } from "./chunk-DUJNJQPO.js";
39
+ } from "./chunk-YQIWS5V6.js";
40
40
  import {
41
41
  members
42
- } from "./chunk-GNAMV3JC.js";
42
+ } from "./chunk-NML6M5AS.js";
43
43
  import {
44
44
  methods
45
- } from "./chunk-FVJE4MQL.js";
45
+ } from "./chunk-HL2LXSBW.js";
46
46
  import {
47
47
  outline
48
- } from "./chunk-KYPXKV64.js";
48
+ } from "./chunk-ZPEI7DRJ.js";
49
49
  import {
50
50
  deps,
51
51
  rdeps
52
- } from "./chunk-RJ5GULL6.js";
52
+ } from "./chunk-IC5NTO47.js";
53
53
  import {
54
54
  diffImpact
55
- } from "./chunk-PCU455MX.js";
55
+ } from "./chunk-JSXGC2EH.js";
56
56
  import {
57
57
  fanIn,
58
58
  fanOut,
59
59
  topFanIn,
60
60
  topFanOut
61
- } from "./chunk-24LF6IZB.js";
61
+ } from "./chunk-4YN3PE57.js";
62
62
  import {
63
63
  files
64
- } from "./chunk-MGNMHKX3.js";
64
+ } from "./chunk-FO2CBB7U.js";
65
65
  import {
66
66
  health
67
- } from "./chunk-JHVQB4Y5.js";
67
+ } from "./chunk-334PCFO3.js";
68
68
  import {
69
69
  stats
70
70
  } from "./chunk-74RFWB5T.js";
71
71
  import {
72
72
  wrapperCandidates
73
- } from "./chunk-PU2254N2.js";
73
+ } from "./chunk-7OGXSMLY.js";
74
74
  import {
75
75
  similar,
76
76
  similarAll
77
- } from "./chunk-6CH23IAS.js";
77
+ } from "./chunk-QZ4FRB65.js";
78
78
  import {
79
79
  staleAbstractions
80
- } from "./chunk-SVLUJSY7.js";
80
+ } from "./chunk-XJSPWHNT.js";
81
81
  import {
82
82
  isolated
83
- } from "./chunk-XUVPQDXW.js";
83
+ } from "./chunk-UIRCHPOU.js";
84
84
  import {
85
85
  passthroughCandidates
86
- } from "./chunk-6ECR2FLR.js";
86
+ } from "./chunk-NWXTQGUE.js";
87
87
  import {
88
88
  drift
89
- } from "./chunk-RL74LF47.js";
89
+ } from "./chunk-FIMTTUGE.js";
90
90
  import {
91
91
  extractCandidates
92
- } from "./chunk-3NJSJ7TE.js";
92
+ } from "./chunk-5YB6UXQ3.js";
93
93
  import {
94
94
  hierarchy
95
- } from "./chunk-R7HPHMRZ.js";
95
+ } from "./chunk-AEBM56CO.js";
96
96
  import {
97
97
  complexityHotspots
98
- } from "./chunk-ELFGD5EW.js";
98
+ } from "./chunk-Y7FKURZG.js";
99
99
  import {
100
100
  complexity
101
- } from "./chunk-A6XLXV6W.js";
101
+ } from "./chunk-B7LDMCUS.js";
102
102
  import {
103
103
  convergence
104
- } from "./chunk-J47VSL6I.js";
104
+ } from "./chunk-PKDFXASW.js";
105
105
  import {
106
106
  coupling,
107
107
  topCoupling
108
- } from "./chunk-W46L2BXT.js";
108
+ } from "./chunk-XMZAC2VU.js";
109
109
  import {
110
110
  cycles
111
- } from "./chunk-OXX3QF24.js";
111
+ } from "./chunk-46ZTW4AI.js";
112
112
  import {
113
113
  dataflow
114
- } from "./chunk-EAGKJFDX.js";
114
+ } from "./chunk-7KGTWDAX.js";
115
115
  import {
116
116
  dead
117
- } from "./chunk-KLNKDX6A.js";
118
- import "./chunk-JKXHHV4B.js";
117
+ } from "./chunk-C2VSV54P.js";
118
+ import "./chunk-OMVF3BHY.js";
119
119
  import {
120
120
  deepChains
121
- } from "./chunk-Z5VSUOEE.js";
121
+ } from "./chunk-6PVHJ332.js";
122
122
  import {
123
123
  affected
124
- } from "./chunk-NXUIWD6K.js";
124
+ } from "./chunk-LQXBFCP2.js";
125
125
  import {
126
126
  bottlenecks
127
- } from "./chunk-CBIWNZZZ.js";
127
+ } from "./chunk-PGQXIAJF.js";
128
128
  import {
129
129
  byKind,
130
130
  kindCounts
131
- } from "./chunk-KG4OFQEN.js";
131
+ } from "./chunk-HW76DVE4.js";
132
132
  import {
133
133
  callGraph
134
- } from "./chunk-6UZU7DFL.js";
134
+ } from "./chunk-U74VYTLX.js";
135
135
  import {
136
136
  changeSurface
137
- } from "./chunk-43A4UCS7.js";
137
+ } from "./chunk-UNS6ZQVX.js";
138
138
  import "./chunk-4TYLS5XX.js";
139
139
  import {
140
140
  code
141
- } from "./chunk-VKBOLNYN.js";
142
- import "./chunk-ALUFWH3U.js";
141
+ } from "./chunk-DIYEUFVP.js";
142
+ import "./chunk-FMAYH7GS.js";
143
143
  import {
144
144
  leafName,
145
145
  parseSymbol,
146
146
  shortenSymbol
147
- } from "./chunk-TO3L4YNK.js";
147
+ } from "./chunk-YMSJCSRG.js";
148
148
 
149
149
  // src/db.ts
150
150
  import Database from "better-sqlite3";
@@ -159,18 +159,10 @@ var ScipDatabase = class {
159
159
  this.db = new Database(config.dbPath, { readonly: true });
160
160
  this.db.pragma("busy_timeout = 5000");
161
161
  }
162
- /** Attach a gitignore-based path filter for query results */
163
- setPathFilter(filter) {
164
- this.pathFilter = filter;
165
- }
166
162
  /** Check if a path should be excluded based on .gitignore rules */
167
163
  isIgnored(relativePath) {
168
164
  return this.pathFilter?.isIgnored(relativePath) ?? false;
169
165
  }
170
- /** Filter an array of paths using the gitignore filter */
171
- filterPaths(paths) {
172
- return this.pathFilter?.filter(paths) ?? paths;
173
- }
174
166
  /**
175
167
  * The local-symbol predicate: only match symbols that are defined
176
168
  * in files NOT excluded by gitignore. This replaces the old hardcoded
@@ -254,7 +246,7 @@ var ScipDatabase = class {
254
246
  // src/gitignore-filter.ts
255
247
  import ignore from "ignore";
256
248
  import { readFileSync, existsSync } from "fs";
257
- import { join, dirname } from "path";
249
+ import { dirname, isAbsolute, join, relative, resolve } from "path";
258
250
  function createGitignoreFilter(projectRoot) {
259
251
  const ig = ignore();
260
252
  let loaded = false;
@@ -271,8 +263,8 @@ function createGitignoreFilter(projectRoot) {
271
263
  ig.add(DEFAULT_IGNORES);
272
264
  }
273
265
  return {
274
- isIgnored: (relativePath) => ig.ignores(relativePath),
275
- filter: (paths) => paths.filter((p) => !ig.ignores(p))
266
+ isIgnored: (relativePath) => safeIgnores(ig, projectRoot, relativePath),
267
+ filter: (paths) => paths.filter((p) => !safeIgnores(ig, projectRoot, p))
276
268
  };
277
269
  }
278
270
  function findGitignoreFiles(projectRoot) {
@@ -352,11 +344,36 @@ Thumbs.db
352
344
  # Type definitions (often noise in queries)
353
345
  *.d.ts
354
346
  `;
347
+ function safeIgnores(ig, projectRoot, inputPath) {
348
+ const relativePath = normalizeForIgnore(projectRoot, inputPath);
349
+ if (!relativePath) {
350
+ return false;
351
+ }
352
+ try {
353
+ return ig.ignores(relativePath);
354
+ } catch {
355
+ return false;
356
+ }
357
+ }
358
+ function normalizeForIgnore(projectRoot, inputPath) {
359
+ if (!inputPath || inputPath === ".") {
360
+ return null;
361
+ }
362
+ if (!isAbsolute(inputPath) && !inputPath.startsWith("..")) {
363
+ return inputPath.replaceAll("\\", "/");
364
+ }
365
+ const absolutePath = isAbsolute(inputPath) ? inputPath : resolve(projectRoot, inputPath);
366
+ const relativePath = relative(projectRoot, absolutePath).replaceAll("\\", "/");
367
+ if (!relativePath || relativePath === "." || relativePath.startsWith("..")) {
368
+ return null;
369
+ }
370
+ return relativePath;
371
+ }
355
372
 
356
373
  // src/reindex/index.ts
357
374
  import { execFileSync as execFileSync3 } from "child_process";
358
- import { existsSync as existsSync5, renameSync } from "fs";
359
- import { join as join5 } from "path";
375
+ import { existsSync as existsSync5, renameSync, rmSync } from "fs";
376
+ import { basename, dirname as dirname2, extname as extname2, join as join5 } from "path";
360
377
 
361
378
  // src/scip-cli.ts
362
379
  import { execFileSync as execFileSync2 } from "child_process";
@@ -991,6 +1008,128 @@ function resolveDotnetProject(projectRoot, suffixes) {
991
1008
  return null;
992
1009
  }
993
1010
 
1011
+ // src/reindex/merge.ts
1012
+ import { readFileSync as readFileSync2, writeFileSync } from "fs";
1013
+ import { create } from "@bufbuild/protobuf";
1014
+ import {
1015
+ deserializeSCIP,
1016
+ serializeSCIP,
1017
+ DocumentSchema,
1018
+ IndexSchema,
1019
+ SymbolInformationSchema
1020
+ } from "@c4312/scip";
1021
+ function mergeScipIndexes(indexes) {
1022
+ if (indexes.length === 0) {
1023
+ throw new Error("Cannot merge zero SCIP indexes");
1024
+ }
1025
+ if (indexes.length === 1) {
1026
+ return indexes[0];
1027
+ }
1028
+ const metadata = mergeMetadata(indexes);
1029
+ const documents = mergeDocuments(indexes.flatMap((index) => index.documents ?? []));
1030
+ const externalSymbols = mergeSymbolInfos(indexes.flatMap((index) => index.externalSymbols ?? []));
1031
+ return create(IndexSchema, {
1032
+ metadata,
1033
+ documents,
1034
+ externalSymbols
1035
+ });
1036
+ }
1037
+ function mergeScipFiles(inputPaths, outputPath) {
1038
+ if (inputPaths.length === 0) {
1039
+ throw new Error("Cannot merge zero SCIP files");
1040
+ }
1041
+ const indexes = inputPaths.map((path) => deserializeSCIP(readFileSync2(path)));
1042
+ const merged = mergeScipIndexes(indexes);
1043
+ writeFileSync(outputPath, Buffer.from(serializeSCIP(merged)));
1044
+ return {
1045
+ documentCount: merged.documents.length,
1046
+ externalSymbolCount: merged.externalSymbols.length,
1047
+ inputCount: inputPaths.length
1048
+ };
1049
+ }
1050
+ function mergeMetadata(indexes) {
1051
+ const first = indexes[0]?.metadata;
1052
+ if (!first) {
1053
+ return void 0;
1054
+ }
1055
+ const expectedProjectRoot = first.projectRoot;
1056
+ for (const index of indexes.slice(1)) {
1057
+ const actualProjectRoot = index.metadata?.projectRoot;
1058
+ if (expectedProjectRoot && actualProjectRoot && actualProjectRoot !== expectedProjectRoot) {
1059
+ throw new Error(
1060
+ `Cannot merge SCIP indexes with different project roots: ${expectedProjectRoot} vs ${actualProjectRoot}`
1061
+ );
1062
+ }
1063
+ }
1064
+ return first;
1065
+ }
1066
+ function mergeDocuments(documents) {
1067
+ const byPath = /* @__PURE__ */ new Map();
1068
+ for (const document of documents) {
1069
+ const existing = byPath.get(document.relativePath);
1070
+ if (!existing) {
1071
+ byPath.set(document.relativePath, document);
1072
+ continue;
1073
+ }
1074
+ byPath.set(document.relativePath, create(DocumentSchema, {
1075
+ language: existing.language || document.language,
1076
+ relativePath: existing.relativePath || document.relativePath,
1077
+ occurrences: [...existing.occurrences, ...document.occurrences],
1078
+ symbols: mergeSymbolInfos([...existing.symbols, ...document.symbols]),
1079
+ text: chooseText(existing.text, document.text),
1080
+ positionEncoding: existing.positionEncoding || document.positionEncoding
1081
+ }));
1082
+ }
1083
+ return [...byPath.values()];
1084
+ }
1085
+ function mergeSymbolInfos(symbols2) {
1086
+ const bySymbol = /* @__PURE__ */ new Map();
1087
+ for (const symbol of symbols2) {
1088
+ const existing = bySymbol.get(symbol.symbol);
1089
+ if (!existing) {
1090
+ bySymbol.set(symbol.symbol, symbol);
1091
+ continue;
1092
+ }
1093
+ bySymbol.set(symbol.symbol, create(SymbolInformationSchema, {
1094
+ symbol: existing.symbol,
1095
+ documentation: uniqueStrings([...existing.documentation, ...symbol.documentation]),
1096
+ relationships: mergeRelationships([...existing.relationships, ...symbol.relationships]),
1097
+ kind: existing.kind || symbol.kind,
1098
+ displayName: existing.displayName || symbol.displayName,
1099
+ enclosingSymbol: existing.enclosingSymbol || symbol.enclosingSymbol,
1100
+ signatureDocumentation: existing.signatureDocumentation ?? symbol.signatureDocumentation
1101
+ }));
1102
+ }
1103
+ return [...bySymbol.values()];
1104
+ }
1105
+ function mergeRelationships(relationships) {
1106
+ const seen = /* @__PURE__ */ new Set();
1107
+ const merged = [];
1108
+ for (const relationship of relationships) {
1109
+ const key = [
1110
+ relationship.symbol,
1111
+ relationship.isReference ? "1" : "0",
1112
+ relationship.isImplementation ? "1" : "0",
1113
+ relationship.isTypeDefinition ? "1" : "0",
1114
+ relationship.isDefinition ? "1" : "0"
1115
+ ].join("|");
1116
+ if (seen.has(key)) {
1117
+ continue;
1118
+ }
1119
+ seen.add(key);
1120
+ merged.push(relationship);
1121
+ }
1122
+ return merged;
1123
+ }
1124
+ function chooseText(left, right) {
1125
+ if (!left) return right;
1126
+ if (!right) return left;
1127
+ return left.length >= right.length ? left : right;
1128
+ }
1129
+ function uniqueStrings(values) {
1130
+ return [...new Set(values)];
1131
+ }
1132
+
994
1133
  // src/reindex/index.ts
995
1134
  async function reindex(opts) {
996
1135
  const {
@@ -1026,7 +1165,11 @@ async function reindex(opts) {
1026
1165
  ...process.env,
1027
1166
  NODE_OPTIONS: `--max-old-space-size=${maxHeapMb}`
1028
1167
  };
1029
- for (const lang of languages) {
1168
+ const languageOutputs = languages.map((language, index) => ({
1169
+ language,
1170
+ scipPath: languages.length > 1 ? tempScipPath(outputScip, language, index) : outputScip
1171
+ }));
1172
+ for (const { language: lang, scipPath } of languageOutputs) {
1030
1173
  const config = getIndexerConfig(lang);
1031
1174
  const binaryLabel = describeIndexerBinary(config);
1032
1175
  const projectLocalBinary = resolveProjectLocalIndexerBinary(config, projectRoot);
@@ -1056,7 +1199,7 @@ async function reindex(opts) {
1056
1199
  const indexerEnv = getIndexerExecutionEnv(config, env, resolvedBinary);
1057
1200
  const { binary, args } = config.indexArgs({
1058
1201
  projectRoot,
1059
- outputPath: outputScip,
1202
+ outputPath: scipPath,
1060
1203
  pnpmWorkspaces: opts.pnpmWorkspaces,
1061
1204
  indexerBinary: resolvedBinary
1062
1205
  });
@@ -1075,7 +1218,11 @@ Make sure ${binaryLabel} is installed and available on PATH.`,
1075
1218
  { cause: err }
1076
1219
  );
1077
1220
  }
1078
- moveDefaultOutputIfNeeded(config, projectRoot, outputScip);
1221
+ moveDefaultOutputIfNeeded(config, projectRoot, scipPath);
1222
+ }
1223
+ if (languageOutputs.length > 1) {
1224
+ onStatus(`Merging ${languageOutputs.length} language indexes...`);
1225
+ mergeScipFiles(languageOutputs.map((entry) => entry.scipPath), outputScip);
1079
1226
  }
1080
1227
  onStatus("Converting to SQLite...");
1081
1228
  if (!existsSync5(outputScip)) {
@@ -1090,6 +1237,12 @@ Make sure ${binaryLabel} is installed and available on PATH.`,
1090
1237
  } catch (err) {
1091
1238
  const msg = err instanceof Error ? err.message : String(err);
1092
1239
  throw new Error(`Failed to convert SCIP index to SQLite: ${msg}`, { cause: err });
1240
+ } finally {
1241
+ for (const { scipPath } of languageOutputs) {
1242
+ if (scipPath !== outputScip) {
1243
+ rmSync(scipPath, { force: true });
1244
+ }
1245
+ }
1093
1246
  }
1094
1247
  const durationMs = Date.now() - start;
1095
1248
  onStatus(`Done in ${(durationMs / 1e3).toFixed(1)}s`);
@@ -1104,10 +1257,15 @@ function moveDefaultOutputIfNeeded(config, projectRoot, outputScip) {
1104
1257
  renameSync(defaultOutputPath, outputScip);
1105
1258
  }
1106
1259
  }
1260
+ function tempScipPath(outputScip, language, index) {
1261
+ const extension = extname2(outputScip) || ".scip";
1262
+ const stem = basename(outputScip, extension);
1263
+ return join5(dirname2(outputScip), `${stem}.${index + 1}.${language}${extension}`);
1264
+ }
1107
1265
 
1108
1266
  // src/config.ts
1109
- import { readFileSync as readFileSync2, writeFileSync, existsSync as existsSync6, mkdirSync } from "fs";
1110
- import { join as join6, resolve } from "path";
1267
+ import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, existsSync as existsSync6, mkdirSync } from "fs";
1268
+ import { join as join6, resolve as resolve2 } from "path";
1111
1269
  import { createHash } from "crypto";
1112
1270
  import { homedir } from "os";
1113
1271
  var CONFIG_FILENAME = ".scipquery.json";
@@ -1123,7 +1281,7 @@ function loadProjectConfig(projectRoot) {
1123
1281
  return {};
1124
1282
  }
1125
1283
  try {
1126
- const raw = readFileSync2(configPath, "utf-8");
1284
+ const raw = readFileSync3(configPath, "utf-8");
1127
1285
  return JSON.parse(raw);
1128
1286
  } catch {
1129
1287
  return {};
@@ -1138,10 +1296,10 @@ function resolveWatchConfig(config) {
1138
1296
  function resolveCacheDir(projectRoot, config) {
1139
1297
  const envOverride = process.env["SCIP_QUERY_CACHE_DIR"];
1140
1298
  if (envOverride) return ensureDir(envOverride);
1141
- if (config?.dbPath) return ensureDir(resolve(projectRoot, config.dbPath));
1299
+ if (config?.dbPath) return ensureDir(resolve2(projectRoot, config.dbPath));
1142
1300
  const xdgCache = process.env["XDG_CACHE_HOME"];
1143
1301
  const cacheBase = xdgCache || join6(homedir(), ".cache");
1144
- const projectHash = createHash("sha256").update(resolve(projectRoot)).digest("hex").slice(0, 12);
1302
+ const projectHash = createHash("sha256").update(resolve2(projectRoot)).digest("hex").slice(0, 12);
1145
1303
  const dir = join6(cacheBase, "scip-query", "projects", projectHash);
1146
1304
  return ensureDir(dir);
1147
1305
  }
@@ -1167,7 +1325,7 @@ function initProjectConfig(projectRoot, languages) {
1167
1325
  cooldownMs: 6e4
1168
1326
  }
1169
1327
  };
1170
- writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
1328
+ writeFileSync2(configPath, JSON.stringify(config, null, 2) + "\n");
1171
1329
  return configPath;
1172
1330
  }
1173
1331
  function ensureDir(dir) {
@@ -1178,7 +1336,7 @@ function ensureDir(dir) {
1178
1336
  // src/watch.ts
1179
1337
  import { watch } from "fs";
1180
1338
  import { existsSync as existsSync7, renameSync as renameSync2 } from "fs";
1181
- import { join as join7, relative } from "path";
1339
+ import { join as join7, relative as relative2 } from "path";
1182
1340
  import { fork } from "child_process";
1183
1341
  import ignore2 from "ignore";
1184
1342
  var Watcher = class {
@@ -1250,13 +1408,9 @@ var Watcher = class {
1250
1408
  if (this.cooldownTimer) clearTimeout(this.cooldownTimer);
1251
1409
  this.setStatus({ state: "idle" });
1252
1410
  }
1253
- /** Get current watcher status */
1254
- getStatus() {
1255
- return this.status;
1256
- }
1257
1411
  // ── Internal ─────────────────────────────────────────────
1258
1412
  handleFileChange(filename) {
1259
- const rel = relative(this.projectRoot, join7(this.projectRoot, filename));
1413
+ const rel = relative2(this.projectRoot, join7(this.projectRoot, filename));
1260
1414
  if (this.gitignoreFilter.isIgnored(rel)) return;
1261
1415
  if (this.extraIgnore.ignores(rel)) return;
1262
1416
  if (filename.endsWith("index.db") || filename.endsWith("index.scip") || filename.endsWith("index.db.tmp") || filename.endsWith(".scipquery.json")) {
@@ -1337,10 +1491,10 @@ var Watcher = class {
1337
1491
  * Writes to index.db.tmp, then atomically renames to index.db.
1338
1492
  */
1339
1493
  runReindex() {
1340
- return new Promise((resolve3, reject) => {
1494
+ return new Promise((resolve4, reject) => {
1341
1495
  const start = Date.now();
1342
1496
  const tmpDb = this.indexPaths.dbPath + ".tmp";
1343
- const tmpScip = tempScipPath(this.indexPaths.indexPath);
1497
+ const tmpScip = tempScipPath2(this.indexPaths.indexPath);
1344
1498
  const child = fork(
1345
1499
  new URL("./reindex-worker.js", import.meta.url).pathname,
1346
1500
  [],
@@ -1365,7 +1519,7 @@ var Watcher = class {
1365
1519
  if (existsSync7(tmpScip)) {
1366
1520
  renameSync2(tmpScip, this.indexPaths.indexPath);
1367
1521
  }
1368
- resolve3(Date.now() - start);
1522
+ resolve4(Date.now() - start);
1369
1523
  } catch (err) {
1370
1524
  reject(new Error(`Atomic swap failed: ${err}`));
1371
1525
  }
@@ -1381,7 +1535,7 @@ var Watcher = class {
1381
1535
  this.onStatus(status);
1382
1536
  }
1383
1537
  };
1384
- function tempScipPath(indexPath) {
1538
+ function tempScipPath2(indexPath) {
1385
1539
  return indexPath.endsWith(".scip") ? indexPath.slice(0, -".scip".length) + ".tmp.scip" : indexPath + ".tmp.scip";
1386
1540
  }
1387
1541
 
@@ -1393,7 +1547,7 @@ import {
1393
1547
  readlinkSync,
1394
1548
  unlinkSync
1395
1549
  } from "fs";
1396
- import { join as join8, dirname as dirname2, resolve as resolve2 } from "path";
1550
+ import { join as join8, dirname as dirname3, resolve as resolve3 } from "path";
1397
1551
  import { homedir as homedir2, platform as platform3 } from "os";
1398
1552
  import { fileURLToPath } from "url";
1399
1553
  var IS_WINDOWS3 = platform3() === "win32";
@@ -1408,7 +1562,7 @@ function installSkills(opts = {}) {
1408
1562
  const log = opts.quiet ? () => {
1409
1563
  } : console.log;
1410
1564
  const thisFile = fileURLToPath(import.meta.url);
1411
- const skillsSource = resolve2(dirname2(thisFile), "..", "skills");
1565
+ const skillsSource = resolve3(dirname3(thisFile), "..", "skills");
1412
1566
  const targets = [
1413
1567
  join8(homedir2(), ".claude", "skills"),
1414
1568
  join8(homedir2(), ".codex", "skills")
@@ -1419,7 +1573,7 @@ function installSkills(opts = {}) {
1419
1573
  alreadyLinked: []
1420
1574
  };
1421
1575
  for (const targetDir of targets) {
1422
- const parentDir = dirname2(targetDir);
1576
+ const parentDir = dirname3(targetDir);
1423
1577
  if (!existsSync8(parentDir)) {
1424
1578
  continue;
1425
1579
  }
@@ -1435,7 +1589,7 @@ function installSkills(opts = {}) {
1435
1589
  if (existsSync8(target)) {
1436
1590
  try {
1437
1591
  const existing = readlinkSync(target);
1438
- if (resolve2(existing) === resolve2(source)) {
1592
+ if (resolve3(existing) === resolve3(source)) {
1439
1593
  result.alreadyLinked.push(`${toolName}/${skill}`);
1440
1594
  log(` ok: ${skill} \u2192 ${toolName} (already linked)`);
1441
1595
  continue;
@@ -1498,6 +1652,8 @@ export {
1498
1652
  leafName,
1499
1653
  loadProjectConfig,
1500
1654
  members,
1655
+ mergeScipFiles,
1656
+ mergeScipIndexes,
1501
1657
  methods,
1502
1658
  outline,
1503
1659
  parseSymbol,
@@ -1,4 +1,4 @@
1
- import { S as ScipDatabase, A as AffectedResult } from '../db-C4rPbKkI.js';
1
+ import { S as ScipDatabase, A as AffectedResult } from '../db-6F9R9e_t.js';
2
2
  import 'better-sqlite3';
3
3
 
4
4
  /**
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  affected
3
- } from "../chunk-NXUIWD6K.js";
4
- import "../chunk-ALUFWH3U.js";
5
- import "../chunk-TO3L4YNK.js";
3
+ } from "../chunk-LQXBFCP2.js";
4
+ import "../chunk-FMAYH7GS.js";
5
+ import "../chunk-YMSJCSRG.js";
6
6
  export {
7
7
  affected
8
8
  };