@ninjaxtools/slopdex 0.13.0 → 0.15.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/.agents/skills/slopdex/SKILL.md +35 -33
- package/README.md +50 -38
- package/dist/cli.js +641 -469
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +98 -2
- package/dist/index.js +426 -28
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +14 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare class CodeIndex {
|
|
|
3
3
|
readonly rootDir: string;
|
|
4
4
|
readonly indexPath: string;
|
|
5
5
|
readonly provider: EmbeddingProvider;
|
|
6
|
+
readonly reranker: Reranker | undefined;
|
|
6
7
|
readonly descriptionProvider: DescriptionProvider;
|
|
7
8
|
constructor(options: CodeIndexOptions);
|
|
8
9
|
close(): void;
|
|
@@ -105,6 +106,24 @@ interface EmbeddingProvider {
|
|
|
105
106
|
signal?: AbortSignal;
|
|
106
107
|
}): Promise<number[]>;
|
|
107
108
|
}
|
|
109
|
+
interface RerankerProfile {
|
|
110
|
+
provider: string;
|
|
111
|
+
model: string;
|
|
112
|
+
}
|
|
113
|
+
interface Reranker {
|
|
114
|
+
readonly profile: RerankerProfile;
|
|
115
|
+
/** Preferred embedding-ranked candidate pool size for this reranker. */
|
|
116
|
+
readonly candidateCount?: number;
|
|
117
|
+
/** Maximum candidate/result count accepted by this reranker. */
|
|
118
|
+
readonly maximumCandidateCount?: number;
|
|
119
|
+
rerank(query: string, documents: readonly string[], options?: {
|
|
120
|
+
limit?: number;
|
|
121
|
+
signal?: AbortSignal;
|
|
122
|
+
}): Promise<Array<{
|
|
123
|
+
index: number;
|
|
124
|
+
score: number;
|
|
125
|
+
}>>;
|
|
126
|
+
}
|
|
108
127
|
interface DescriptionProfile {
|
|
109
128
|
provider: string;
|
|
110
129
|
model: string;
|
|
@@ -149,12 +168,16 @@ interface CodeIndexOptions {
|
|
|
149
168
|
rootDir: string;
|
|
150
169
|
indexPath?: string;
|
|
151
170
|
provider: EmbeddingProvider;
|
|
171
|
+
/** Optional second-stage ranker for natural-language query searches. */
|
|
172
|
+
reranker?: Reranker;
|
|
152
173
|
descriptionProvider?: DescriptionProvider;
|
|
153
174
|
onWarning?: (message: string) => void;
|
|
154
175
|
include?: readonly string[];
|
|
155
176
|
exclude?: readonly string[];
|
|
156
177
|
maxFileSize?: number;
|
|
157
178
|
embeddingBatchSize?: number;
|
|
179
|
+
/** Emit a stderr notice for every call made by the default description provider. */
|
|
180
|
+
verbose?: boolean;
|
|
158
181
|
readOnly?: boolean;
|
|
159
182
|
}
|
|
160
183
|
interface UpdateFilesOptions {
|
|
@@ -218,6 +241,8 @@ interface AnalysisSimilarity {
|
|
|
218
241
|
}
|
|
219
242
|
interface SimilarityResult extends SimilarityScores {
|
|
220
243
|
function: IndexedFunction;
|
|
244
|
+
/** Provider relevance score when a second-stage reranker ordered this result. */
|
|
245
|
+
rerankScore?: number;
|
|
221
246
|
}
|
|
222
247
|
type CrossSearchSourceFilter = ({
|
|
223
248
|
type: "all";
|
|
@@ -243,6 +268,8 @@ interface CrossSearchOptions {
|
|
|
243
268
|
maxSimilarity?: number;
|
|
244
269
|
includeSymmetricDuplicates?: boolean;
|
|
245
270
|
crossFileOnly?: boolean;
|
|
271
|
+
/** Re-rank each source's semantic matches from greatest to least physical path distance. */
|
|
272
|
+
cohesion?: boolean;
|
|
246
273
|
minLines?: number;
|
|
247
274
|
nameRegex?: string;
|
|
248
275
|
signal?: AbortSignal;
|
|
@@ -251,9 +278,13 @@ interface CrossSearchOptions {
|
|
|
251
278
|
total: number;
|
|
252
279
|
}) => void;
|
|
253
280
|
}
|
|
281
|
+
interface CrossSearchMatch extends SimilarityResult {
|
|
282
|
+
/** Present when cohesion re-ranking is enabled. */
|
|
283
|
+
physicalDistance?: number;
|
|
284
|
+
}
|
|
254
285
|
interface CrossSearchResult {
|
|
255
286
|
source: IndexedFunction;
|
|
256
|
-
matches:
|
|
287
|
+
matches: CrossSearchMatch[];
|
|
257
288
|
scoring?: AnalysisSimilarity & {
|
|
258
289
|
sourceDescriptionProfile: DescriptionProfile | null;
|
|
259
290
|
targetDescriptionProfile: DescriptionProfile | null;
|
|
@@ -389,6 +420,7 @@ interface OpenAIEmbeddingProviderOptions {
|
|
|
389
420
|
model?: string;
|
|
390
421
|
dimensions?: number;
|
|
391
422
|
baseUrl?: string;
|
|
423
|
+
verbose?: boolean;
|
|
392
424
|
}
|
|
393
425
|
declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
394
426
|
#private;
|
|
@@ -412,6 +444,7 @@ interface OpenAIDescriptionProviderOptions {
|
|
|
412
444
|
model?: string;
|
|
413
445
|
baseUrl?: string;
|
|
414
446
|
provider?: DescriptionProviderName;
|
|
447
|
+
verbose?: boolean;
|
|
415
448
|
}
|
|
416
449
|
declare const DESCRIPTION_PROVIDER_NAMES: readonly ["openai", "opencode", "opencode-go"];
|
|
417
450
|
type DescriptionProviderName = typeof DESCRIPTION_PROVIDER_NAMES[number];
|
|
@@ -437,6 +470,7 @@ interface JinaEmbeddingProviderOptions {
|
|
|
437
470
|
model?: string;
|
|
438
471
|
dimensions?: number;
|
|
439
472
|
baseUrl?: string;
|
|
473
|
+
verbose?: boolean;
|
|
440
474
|
}
|
|
441
475
|
declare class JinaEmbeddingProvider implements EmbeddingProvider {
|
|
442
476
|
#private;
|
|
@@ -455,6 +489,68 @@ declare class JinaEmbeddingProvider implements EmbeddingProvider {
|
|
|
455
489
|
}): Promise<number[]>;
|
|
456
490
|
}
|
|
457
491
|
|
|
492
|
+
interface HostedRerankerOptions {
|
|
493
|
+
apiKey?: string;
|
|
494
|
+
model?: string;
|
|
495
|
+
baseUrl?: string;
|
|
496
|
+
verbose?: boolean;
|
|
497
|
+
}
|
|
498
|
+
interface HostedRerankerSettings {
|
|
499
|
+
provider: "cohere" | "jina";
|
|
500
|
+
apiKeyName: "COHERE_API_KEY" | "JINA_API_KEY";
|
|
501
|
+
defaultModel: string;
|
|
502
|
+
defaultUrl: string;
|
|
503
|
+
returnDocuments?: boolean;
|
|
504
|
+
}
|
|
505
|
+
declare abstract class HostedReranker implements Reranker {
|
|
506
|
+
#private;
|
|
507
|
+
readonly profile: {
|
|
508
|
+
readonly provider: "jina" | "cohere";
|
|
509
|
+
readonly model: string;
|
|
510
|
+
};
|
|
511
|
+
protected constructor(options: HostedRerankerOptions, settings: HostedRerankerSettings);
|
|
512
|
+
rerank(query: string, documents: readonly string[], options?: {
|
|
513
|
+
limit?: number;
|
|
514
|
+
signal?: AbortSignal;
|
|
515
|
+
}): Promise<Array<{
|
|
516
|
+
index: number;
|
|
517
|
+
score: number;
|
|
518
|
+
}>>;
|
|
519
|
+
}
|
|
520
|
+
type CohereRerankerOptions = HostedRerankerOptions;
|
|
521
|
+
declare class CohereReranker extends HostedReranker {
|
|
522
|
+
constructor(options?: CohereRerankerOptions);
|
|
523
|
+
}
|
|
524
|
+
type JinaRerankerOptions = HostedRerankerOptions;
|
|
525
|
+
declare class JinaReranker extends HostedReranker {
|
|
526
|
+
constructor(options?: JinaRerankerOptions);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
interface OpenAILLMRerankerOptions {
|
|
530
|
+
apiKey?: string;
|
|
531
|
+
model?: string;
|
|
532
|
+
baseUrl?: string;
|
|
533
|
+
candidateCount?: number;
|
|
534
|
+
verbose?: boolean;
|
|
535
|
+
}
|
|
536
|
+
declare class OpenAILLMReranker implements Reranker {
|
|
537
|
+
#private;
|
|
538
|
+
readonly profile: {
|
|
539
|
+
readonly provider: "openai";
|
|
540
|
+
readonly model: string;
|
|
541
|
+
};
|
|
542
|
+
readonly candidateCount: number;
|
|
543
|
+
readonly maximumCandidateCount = 100;
|
|
544
|
+
constructor(options?: OpenAILLMRerankerOptions);
|
|
545
|
+
rerank(query: string, documents: readonly string[], options?: {
|
|
546
|
+
limit?: number;
|
|
547
|
+
signal?: AbortSignal;
|
|
548
|
+
}): Promise<Array<{
|
|
549
|
+
index: number;
|
|
550
|
+
score: number;
|
|
551
|
+
}>>;
|
|
552
|
+
}
|
|
553
|
+
|
|
458
554
|
declare class CodeIndexError extends Error {
|
|
459
555
|
constructor(message: string, options?: ErrorOptions);
|
|
460
556
|
}
|
|
@@ -482,4 +578,4 @@ declare function searchDescription(index: CodeIndex, options: SimilaritySearchOp
|
|
|
482
578
|
declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
|
|
483
579
|
declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
|
|
484
580
|
|
|
485
|
-
export { type AnalysisSimilarity, type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type CohesionMetrics, type CohesionPair, type CohesionReport, 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, OpenAIDescriptionProvider, type OpenAIDescriptionProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, type ParsedCallable, type ReindexFilesOptions, type ReindexFilesStats, 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 };
|
|
581
|
+
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 };
|