@ninjaxtools/slopdex 0.14.0 → 0.18.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 (54) hide show
  1. package/.agents/skills/slopdex/SKILL.md +14 -11
  2. package/README.md +91 -219
  3. package/dist/chunk-6LHZCHEB.js +1112 -0
  4. package/dist/chunk-6LHZCHEB.js.map +1 -0
  5. package/dist/chunk-BXWO2KMC.js +20 -0
  6. package/dist/chunk-BXWO2KMC.js.map +1 -0
  7. package/dist/chunk-DKRB2XT5.js +33 -0
  8. package/dist/chunk-DKRB2XT5.js.map +1 -0
  9. package/dist/chunk-DTI7SXGL.js +109 -0
  10. package/dist/chunk-DTI7SXGL.js.map +1 -0
  11. package/dist/chunk-IQU3YVZ3.js +85 -0
  12. package/dist/chunk-IQU3YVZ3.js.map +1 -0
  13. package/dist/chunk-JAVPHCZH.js +24 -0
  14. package/dist/chunk-JAVPHCZH.js.map +1 -0
  15. package/dist/chunk-KQRS5P4U.js +10 -0
  16. package/dist/chunk-KQRS5P4U.js.map +1 -0
  17. package/dist/chunk-KUV6PKKL.js +425 -0
  18. package/dist/chunk-KUV6PKKL.js.map +1 -0
  19. package/dist/chunk-MKUTTXZB.js +74 -0
  20. package/dist/chunk-MKUTTXZB.js.map +1 -0
  21. package/dist/chunk-N6D66ASM.js +2217 -0
  22. package/dist/chunk-N6D66ASM.js.map +1 -0
  23. package/dist/chunk-OIKBO3NJ.js +133 -0
  24. package/dist/chunk-OIKBO3NJ.js.map +1 -0
  25. package/dist/chunk-S225GYCL.js +79 -0
  26. package/dist/chunk-S225GYCL.js.map +1 -0
  27. package/dist/chunk-TSURHRFF.js +240 -0
  28. package/dist/chunk-TSURHRFF.js.map +1 -0
  29. package/dist/chunk-VH5VGRCI.js +103 -0
  30. package/dist/chunk-VH5VGRCI.js.map +1 -0
  31. package/dist/cli.js +240 -3561
  32. package/dist/cli.js.map +1 -1
  33. package/dist/code-index-YEFTNG7E.js +14 -0
  34. package/dist/code-index-YEFTNG7E.js.map +1 -0
  35. package/dist/cross-search-FVKDMGP7.js +10 -0
  36. package/dist/cross-search-FVKDMGP7.js.map +1 -0
  37. package/dist/database-KAPV2YMP.js +14 -0
  38. package/dist/database-KAPV2YMP.js.map +1 -0
  39. package/dist/hosted-GHIUHKOU.js +13 -0
  40. package/dist/hosted-GHIUHKOU.js.map +1 -0
  41. package/dist/index.d.ts +109 -2
  42. package/dist/index.js +38 -3583
  43. package/dist/index.js.map +1 -1
  44. package/dist/jina-43RL7C6M.js +12 -0
  45. package/dist/jina-43RL7C6M.js.map +1 -0
  46. package/dist/openai-CYUPNBGB.js +12 -0
  47. package/dist/openai-CYUPNBGB.js.map +1 -0
  48. package/dist/openai-EC6THXKV.js +21 -0
  49. package/dist/openai-EC6THXKV.js.map +1 -0
  50. package/dist/openai-TCRXM66O.js +11 -0
  51. package/dist/openai-TCRXM66O.js.map +1 -0
  52. package/docs/implementation.md +10 -19
  53. package/docs/reference.md +187 -0
  54. package/package.json +4 -3
@@ -0,0 +1,14 @@
1
+ import {
2
+ CodeIndex
3
+ } from "./chunk-N6D66ASM.js";
4
+ import "./chunk-6LHZCHEB.js";
5
+ import "./chunk-TSURHRFF.js";
6
+ import "./chunk-KQRS5P4U.js";
7
+ import "./chunk-BXWO2KMC.js";
8
+ import "./chunk-S225GYCL.js";
9
+ import "./chunk-VH5VGRCI.js";
10
+ import "./chunk-DKRB2XT5.js";
11
+ export {
12
+ CodeIndex
13
+ };
14
+ //# sourceMappingURL=code-index-YEFTNG7E.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,10 @@
1
+ import {
2
+ crossSearch
3
+ } from "./chunk-KUV6PKKL.js";
4
+ import "./chunk-KQRS5P4U.js";
5
+ import "./chunk-VH5VGRCI.js";
6
+ import "./chunk-DKRB2XT5.js";
7
+ export {
8
+ crossSearch
9
+ };
10
+ //# sourceMappingURL=cross-search-FVKDMGP7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ import {
2
+ IndexDatabase,
3
+ readIndexErrorCounts,
4
+ readIndexErrors,
5
+ resetIndexState
6
+ } from "./chunk-6LHZCHEB.js";
7
+ import "./chunk-DKRB2XT5.js";
8
+ export {
9
+ IndexDatabase,
10
+ readIndexErrorCounts,
11
+ readIndexErrors,
12
+ resetIndexState
13
+ };
14
+ //# sourceMappingURL=database-KAPV2YMP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,13 @@
1
+ import {
2
+ CohereReranker,
3
+ JinaReranker
4
+ } from "./chunk-DTI7SXGL.js";
5
+ import "./chunk-BXWO2KMC.js";
6
+ import "./chunk-S225GYCL.js";
7
+ import "./chunk-VH5VGRCI.js";
8
+ import "./chunk-DKRB2XT5.js";
9
+ export {
10
+ CohereReranker,
11
+ JinaReranker
12
+ };
13
+ //# sourceMappingURL=hosted-GHIUHKOU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.d.ts CHANGED
@@ -30,11 +30,93 @@ declare class CodeIndex {
30
30
  nameRegex?: string;
31
31
  }): SimilarityResult[];
32
32
  vectorForFunction(functionId: number, kind?: "code" | "description"): number[];
33
+ get readOnly(): boolean;
34
+ similarityCacheInfo(): {
35
+ cachedSources: number;
36
+ cachedPairs: number;
37
+ };
38
+ /**
39
+ * Incrementally refresh the persisted pairwise-similarity cache for same-index
40
+ * analysis. Only pairs scoring at or above `minSimilarity` (the caller's
41
+ * effective threshold) are stored; queries below the cached floor fall back to
42
+ * live vector search. Only functions whose embeddings changed (plus a merge
43
+ * pass over the remaining functions when the changed set is small) are
44
+ * re-queried; unchanged pairs are reused. Lowering the floor below what is
45
+ * cached re-queries every function, since the missing band cannot be rebuilt
46
+ * incrementally; raising it reuses the cache for free. A per-function state
47
+ * row records the embedding triple, floor, row count, and a completeness flag,
48
+ * so a sparse row set is never mistaken for an unfinished computation. Call
49
+ * before cross-search/cohesion, then read through
50
+ * {@link cachedSimilarToFunction}. Best-effort under concurrent writers: a
51
+ * later refresh repairs any rows raced by an overlapping update.
52
+ */
53
+ refreshSimilarityCache(options?: {
54
+ width?: number;
55
+ /** Minimum similarity stored; pairs below it are never cached. Defaults to -1 (cache everything). */
56
+ minSimilarity?: number;
57
+ signal?: AbortSignal;
58
+ /** Overrides the index-level onProgress for the cache-fill bar. */
59
+ onProgress?: (progress: IndexProgress) => void;
60
+ }): Promise<{
61
+ similarityMode: string;
62
+ width: number;
63
+ minSimilarity: number;
64
+ sourcesRefreshed: number;
65
+ pairsStored: number;
66
+ skipped: boolean;
67
+ }>;
68
+ /**
69
+ * Same-index neighbor lookup backed by {@link refreshSimilarityCache}.
70
+ * Returns cache rows filtered exactly like {@link similarToFunction} and falls
71
+ * back to a live vector query whenever the cache entry is missing, stale,
72
+ * computed at a higher floor than requested, or too truncated to satisfy the
73
+ * filters. A cache entry flagged complete holds every pair above its floor,
74
+ * so short results from it are exact and need no live query.
75
+ *
76
+ * Prefer {@link cachedSimilarityReader} inside per-function loops: it loads
77
+ * the validity snapshot once instead of re-reading it for every function.
78
+ */
79
+ cachedSimilarToFunction(functionId: number, options: {
80
+ includeDescriptions?: boolean;
81
+ limit: number;
82
+ minSimilarity: number;
83
+ maxSimilarity?: number;
84
+ excludePaths?: readonly string[];
85
+ minLines?: number;
86
+ nameRegex?: string;
87
+ }): SimilarityResult[];
88
+ /**
89
+ * Snapshot the similarity-cache validity state (per-mode states, embedding
90
+ * triples, generation) once for a run of neighbor lookups. The returned
91
+ * lookup behaves exactly like {@link cachedSimilarToFunction} but avoids
92
+ * re-reading whole tables per function; refresh the cache first and create
93
+ * one reader per analysis run. Best-effort under concurrent writers, like the
94
+ * refresh itself: a concurrent mutation mid-run is picked up by the next run.
95
+ *
96
+ * A fallback scan doubles as a read-repair: when the entry is fresh but
97
+ * unusable (missing, recorded at a higher floor, or incomplete), the scan is
98
+ * widened to the full cache width and written back, so later lookups hit.
99
+ * Stale entries are left for the refresh, dense-at-max-width entries cannot
100
+ * be improved, and read-only indexes never write.
101
+ */
102
+ cachedSimilarityReader(options?: {
103
+ includeDescriptions?: boolean;
104
+ }): {
105
+ similarToFunction: (functionId: number, query: {
106
+ includeDescriptions?: boolean;
107
+ limit: number;
108
+ minSimilarity: number;
109
+ maxSimilarity?: number;
110
+ excludePaths?: readonly string[];
111
+ minLines?: number;
112
+ nameRegex?: string;
113
+ }) => SimilarityResult[];
114
+ };
33
115
  vectorForFile(filePath: string): number[];
34
116
  searchByVector(vector: readonly number[], options: {
35
117
  descriptionVector?: readonly number[];
36
118
  fileDescriptionVector?: readonly number[];
37
- limit: number;
119
+ limit?: number;
38
120
  minSimilarity: number;
39
121
  maxSimilarity?: number;
40
122
  excludePaths?: readonly string[];
@@ -164,6 +246,12 @@ interface DescriptionStats {
164
246
  fileDescriptionsCreated: number;
165
247
  descriptionsEnabled: boolean;
166
248
  }
249
+ type IndexProgressPhase = "vectors" | "descriptions" | "description-vectors" | "similarity-cache" | "cross-search";
250
+ interface IndexProgress {
251
+ phase: IndexProgressPhase;
252
+ completed: number;
253
+ total: number;
254
+ }
167
255
  interface CodeIndexOptions {
168
256
  rootDir: string;
169
257
  indexPath?: string;
@@ -172,10 +260,16 @@ interface CodeIndexOptions {
172
260
  reranker?: Reranker;
173
261
  descriptionProvider?: DescriptionProvider;
174
262
  onWarning?: (message: string) => void;
263
+ /** Maximum number of concurrent provider requests for vectors and descriptions. */
264
+ parallelism?: number;
265
+ /** Receives vector and description generation progress updates. */
266
+ onProgress?: (progress: IndexProgress) => void;
175
267
  include?: readonly string[];
176
268
  exclude?: readonly string[];
177
269
  maxFileSize?: number;
178
270
  embeddingBatchSize?: number;
271
+ /** Emit a stderr notice for every call made by the default description provider. */
272
+ verbose?: boolean;
179
273
  readOnly?: boolean;
180
274
  }
181
275
  interface UpdateFilesOptions {
@@ -275,6 +369,8 @@ interface CrossSearchOptions {
275
369
  completed: number;
276
370
  total: number;
277
371
  }) => void;
372
+ /** Receives similarity-cache fill progress; defaults to the source index's onProgress. */
373
+ onCacheProgress?: (progress: IndexProgress) => void;
278
374
  }
279
375
  interface CrossSearchMatch extends SimilarityResult {
280
376
  /** Present when cohesion re-ranking is enabled. */
@@ -364,6 +460,8 @@ interface CohesionAnalysisOptions {
364
460
  completed: number;
365
461
  total: number;
366
462
  }) => void;
463
+ /** Receives similarity-cache fill progress; defaults to the source index's onProgress. */
464
+ onCacheProgress?: (progress: IndexProgress) => void;
367
465
  }
368
466
  interface CohesionReport<FunctionValue = IndexedFunction> {
369
467
  schemaVersion: 3;
@@ -418,6 +516,8 @@ interface OpenAIEmbeddingProviderOptions {
418
516
  model?: string;
419
517
  dimensions?: number;
420
518
  baseUrl?: string;
519
+ verbose?: boolean;
520
+ parallelism?: number;
421
521
  }
422
522
  declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
423
523
  #private;
@@ -441,6 +541,9 @@ interface OpenAIDescriptionProviderOptions {
441
541
  model?: string;
442
542
  baseUrl?: string;
443
543
  provider?: DescriptionProviderName;
544
+ verbose?: boolean;
545
+ retryDelayMs?: number;
546
+ parallelism?: number;
444
547
  }
445
548
  declare const DESCRIPTION_PROVIDER_NAMES: readonly ["openai", "opencode", "opencode-go"];
446
549
  type DescriptionProviderName = typeof DESCRIPTION_PROVIDER_NAMES[number];
@@ -466,6 +569,8 @@ interface JinaEmbeddingProviderOptions {
466
569
  model?: string;
467
570
  dimensions?: number;
468
571
  baseUrl?: string;
572
+ verbose?: boolean;
573
+ parallelism?: number;
469
574
  }
470
575
  declare class JinaEmbeddingProvider implements EmbeddingProvider {
471
576
  #private;
@@ -488,6 +593,7 @@ interface HostedRerankerOptions {
488
593
  apiKey?: string;
489
594
  model?: string;
490
595
  baseUrl?: string;
596
+ verbose?: boolean;
491
597
  }
492
598
  interface HostedRerankerSettings {
493
599
  provider: "cohere" | "jina";
@@ -525,6 +631,7 @@ interface OpenAILLMRerankerOptions {
525
631
  model?: string;
526
632
  baseUrl?: string;
527
633
  candidateCount?: number;
634
+ verbose?: boolean;
528
635
  }
529
636
  declare class OpenAILLMReranker implements Reranker {
530
637
  #private;
@@ -571,4 +678,4 @@ declare function searchDescription(index: CodeIndex, options: SimilaritySearchOp
571
678
  declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
572
679
  declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
573
680
 
574
- export { type AnalysisSimilarity, type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, CohereReranker, type CohereRerankerOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type CohesionMetrics, type CohesionPair, type CohesionReport, type CrossSearchMatch, type CrossSearchOptions, type CrossSearchResult, type CrossSearchSourceFilter, type DescriptionFileInput, type DescriptionFileSession, type DescriptionInput, type DescriptionProfile, type DescriptionProvider, type DescriptionProviderName, type DescriptionStats, type EmbeddingProfile, type EmbeddingProvider, GitDivergenceError, GitUnavailableError, IncompatibleIndexError, type IndexStatus, type IndexedFunction, type IndexingError, type IndexingIssue, JinaEmbeddingProvider, type JinaEmbeddingProviderOptions, JinaReranker, type JinaRerankerOptions, OpenAIDescriptionProvider, type OpenAIDescriptionProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, OpenAILLMReranker, type OpenAILLMRerankerOptions, type ParsedCallable, type ReindexFilesOptions, type ReindexFilesStats, type Reranker, type RerankerProfile, type SimilarityResult, type SimilarityScores, type SimilaritySearchOptions, type SourceMode, type SupportedLanguage, type UpdateFilesOptions, type UpdateFromGitOptions, type UpdateFromWorkingTreeOptions, type UpdateStats, analyzeCodeCohesion, analyzeCohesion, cohesionLocation, crossSearch, crossSearchFunctions, disableDescriptions, openCodeIndex, readIndexErrors, reindexFiles, searchDescription, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree, useDescriptions };
681
+ export { type AnalysisSimilarity, type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, CohereReranker, type CohereRerankerOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type CohesionMetrics, type CohesionPair, type CohesionReport, type CrossSearchMatch, type CrossSearchOptions, type CrossSearchResult, type CrossSearchSourceFilter, type DescriptionFileInput, type DescriptionFileSession, type DescriptionInput, type DescriptionProfile, type DescriptionProvider, type DescriptionProviderName, type DescriptionStats, type EmbeddingProfile, type EmbeddingProvider, GitDivergenceError, GitUnavailableError, IncompatibleIndexError, type IndexProgress, type IndexProgressPhase, type IndexStatus, type IndexedFunction, type IndexingError, type IndexingIssue, JinaEmbeddingProvider, type JinaEmbeddingProviderOptions, JinaReranker, type JinaRerankerOptions, OpenAIDescriptionProvider, type OpenAIDescriptionProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, OpenAILLMReranker, type OpenAILLMRerankerOptions, type ParsedCallable, type ReindexFilesOptions, type ReindexFilesStats, type Reranker, type RerankerProfile, type SimilarityResult, type SimilarityScores, type SimilaritySearchOptions, type SourceMode, type SupportedLanguage, type UpdateFilesOptions, type UpdateFromGitOptions, type UpdateFromWorkingTreeOptions, type UpdateStats, analyzeCodeCohesion, analyzeCohesion, cohesionLocation, crossSearch, crossSearchFunctions, disableDescriptions, openCodeIndex, readIndexErrors, reindexFiles, searchDescription, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree, useDescriptions };