@ninjaxtools/slopdex 0.9.0 → 0.11.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 +29 -72
- package/README.md +38 -58
- package/dist/cli.js +460 -300
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +42 -40
- package/dist/index.js +351 -230
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +24 -20
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare class CodeIndex {
|
|
|
3
3
|
readonly rootDir: string;
|
|
4
4
|
readonly indexPath: string;
|
|
5
5
|
readonly provider: EmbeddingProvider;
|
|
6
|
-
readonly
|
|
6
|
+
readonly descriptionProvider: DescriptionProvider;
|
|
7
7
|
constructor(options: CodeIndexOptions);
|
|
8
8
|
close(): void;
|
|
9
9
|
status(): IndexStatus;
|
|
@@ -12,13 +12,14 @@ declare class CodeIndex {
|
|
|
12
12
|
updateFiles(options: UpdateFilesOptions): Promise<UpdateStats>;
|
|
13
13
|
updateFromWorkingTree(options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
14
14
|
updateFromGit(options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
15
|
-
|
|
15
|
+
useDescriptions(options?: {
|
|
16
16
|
signal?: AbortSignal;
|
|
17
|
-
}): Promise<
|
|
18
|
-
|
|
17
|
+
}): Promise<DescriptionStats>;
|
|
18
|
+
disableDescriptions(): DescriptionStats;
|
|
19
|
+
searchDescription(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
19
20
|
similaritySearch(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
20
21
|
similarToFunction(functionId: number, options: {
|
|
21
|
-
|
|
22
|
+
includeDescriptions?: boolean;
|
|
22
23
|
limit: number;
|
|
23
24
|
minSimilarity: number;
|
|
24
25
|
maxSimilarity?: number;
|
|
@@ -26,9 +27,9 @@ declare class CodeIndex {
|
|
|
26
27
|
minLines?: number;
|
|
27
28
|
nameRegex?: string;
|
|
28
29
|
}): SimilarityResult[];
|
|
29
|
-
vectorForFunction(functionId: number, kind?: "code" | "
|
|
30
|
+
vectorForFunction(functionId: number, kind?: "code" | "description"): number[];
|
|
30
31
|
searchByVector(vector: readonly number[], options: {
|
|
31
|
-
|
|
32
|
+
descriptionVector?: readonly number[];
|
|
32
33
|
limit: number;
|
|
33
34
|
minSimilarity: number;
|
|
34
35
|
maxSimilarity?: number;
|
|
@@ -83,8 +84,8 @@ interface IndexedFunction extends ParsedCallable {
|
|
|
83
84
|
lastSeenCommit: string | null;
|
|
84
85
|
sourceMode: SourceMode;
|
|
85
86
|
embeddingId: number;
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
description: string | null;
|
|
88
|
+
descriptionEmbeddingId: number | null;
|
|
88
89
|
}
|
|
89
90
|
interface EmbeddingProfile {
|
|
90
91
|
provider: "openai" | "jina" | string;
|
|
@@ -101,31 +102,31 @@ interface EmbeddingProvider {
|
|
|
101
102
|
signal?: AbortSignal;
|
|
102
103
|
}): Promise<number[]>;
|
|
103
104
|
}
|
|
104
|
-
interface
|
|
105
|
+
interface DescriptionProfile {
|
|
105
106
|
provider: string;
|
|
106
107
|
model: string;
|
|
107
108
|
strategyVersion: string;
|
|
108
109
|
}
|
|
109
|
-
interface
|
|
110
|
+
interface DescriptionInput {
|
|
110
111
|
repository: string;
|
|
111
112
|
callable: ParsedCallable;
|
|
112
113
|
fileSource: string;
|
|
113
114
|
}
|
|
114
|
-
interface
|
|
115
|
-
readonly profile:
|
|
116
|
-
|
|
115
|
+
interface DescriptionProvider {
|
|
116
|
+
readonly profile: DescriptionProfile;
|
|
117
|
+
describe(input: DescriptionInput, options?: {
|
|
117
118
|
signal?: AbortSignal;
|
|
118
119
|
}): Promise<string>;
|
|
119
120
|
}
|
|
120
|
-
interface
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
interface DescriptionStats {
|
|
122
|
+
descriptionsCreated: number;
|
|
123
|
+
descriptionsEnabled: boolean;
|
|
123
124
|
}
|
|
124
125
|
interface CodeIndexOptions {
|
|
125
126
|
rootDir: string;
|
|
126
127
|
indexPath?: string;
|
|
127
128
|
provider: EmbeddingProvider;
|
|
128
|
-
|
|
129
|
+
descriptionProvider?: DescriptionProvider;
|
|
129
130
|
onWarning?: (message: string) => void;
|
|
130
131
|
include?: readonly string[];
|
|
131
132
|
exclude?: readonly string[];
|
|
@@ -172,13 +173,13 @@ interface SimilaritySearchOptions {
|
|
|
172
173
|
interface SimilarityScores {
|
|
173
174
|
similarity: number;
|
|
174
175
|
codeSimilarity?: number;
|
|
175
|
-
|
|
176
|
+
descriptionSimilarity?: number;
|
|
176
177
|
}
|
|
177
178
|
interface AnalysisSimilarity {
|
|
178
|
-
similarityMode: "code" | "code-
|
|
179
|
+
similarityMode: "code" | "code-description-average";
|
|
179
180
|
similarityWeights: {
|
|
180
181
|
code: number;
|
|
181
|
-
|
|
182
|
+
description: number;
|
|
182
183
|
};
|
|
183
184
|
}
|
|
184
185
|
interface SimilarityResult extends SimilarityScores {
|
|
@@ -220,8 +221,8 @@ interface CrossSearchResult {
|
|
|
220
221
|
source: IndexedFunction;
|
|
221
222
|
matches: SimilarityResult[];
|
|
222
223
|
scoring?: AnalysisSimilarity & {
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
sourceDescriptionProfile: DescriptionProfile | null;
|
|
225
|
+
targetDescriptionProfile: DescriptionProfile | null;
|
|
225
226
|
};
|
|
226
227
|
}
|
|
227
228
|
type CohesionLocationCategory = "same-file" | "same-folder" | "different-folder";
|
|
@@ -276,7 +277,7 @@ interface CohesionGroup<FunctionValue = IndexedFunction> {
|
|
|
276
277
|
maximumCohesionGap: number;
|
|
277
278
|
members: FunctionValue[];
|
|
278
279
|
}
|
|
279
|
-
interface
|
|
280
|
+
interface CohesionMetrics {
|
|
280
281
|
scope: "repository" | "selected-sources";
|
|
281
282
|
functionsAnalyzed: number;
|
|
282
283
|
candidateFunctions: number;
|
|
@@ -302,12 +303,12 @@ interface CohesionAnalysisOptions {
|
|
|
302
303
|
}) => void;
|
|
303
304
|
}
|
|
304
305
|
interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
305
|
-
schemaVersion:
|
|
306
|
+
schemaVersion: 2;
|
|
306
307
|
repository: {
|
|
307
308
|
generation: number;
|
|
308
309
|
gitCheckpoint: string | null;
|
|
309
310
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
310
|
-
|
|
311
|
+
descriptionProfile: DescriptionProfile | null;
|
|
311
312
|
};
|
|
312
313
|
parameters: AnalysisSimilarity & {
|
|
313
314
|
neighbors: number;
|
|
@@ -318,7 +319,7 @@ interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
|
318
319
|
nameRegex?: string;
|
|
319
320
|
sourceFilter: CrossSearchSourceFilter;
|
|
320
321
|
};
|
|
321
|
-
|
|
322
|
+
metrics: CohesionMetrics;
|
|
322
323
|
pairs: CohesionPair<FunctionValue>[];
|
|
323
324
|
files: CohesionFileReport<FunctionValue>[];
|
|
324
325
|
groups: CohesionGroup<FunctionValue>[];
|
|
@@ -332,9 +333,9 @@ interface IndexStatus {
|
|
|
332
333
|
generation: number;
|
|
333
334
|
gitCheckpoint: string | null;
|
|
334
335
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
336
|
+
descriptionsEnabled: boolean;
|
|
337
|
+
descriptionCount: number;
|
|
338
|
+
descriptionProfile: DescriptionProfile | null;
|
|
338
339
|
indexingErrorCount: number;
|
|
339
340
|
failedFileCount: number;
|
|
340
341
|
}
|
|
@@ -358,7 +359,7 @@ declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
|
358
359
|
readonly provider: "openai";
|
|
359
360
|
readonly model: string;
|
|
360
361
|
readonly dimensions: number;
|
|
361
|
-
readonly strategyVersion: "callable-
|
|
362
|
+
readonly strategyVersion: "callable-v2";
|
|
362
363
|
};
|
|
363
364
|
constructor(options?: OpenAIEmbeddingProviderOptions);
|
|
364
365
|
embedDocuments(inputs: readonly string[], options?: {
|
|
@@ -369,20 +370,20 @@ declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
|
369
370
|
}): Promise<number[]>;
|
|
370
371
|
}
|
|
371
372
|
|
|
372
|
-
interface
|
|
373
|
+
interface OpenAIDescriptionProviderOptions {
|
|
373
374
|
apiKey?: string;
|
|
374
375
|
model?: string;
|
|
375
376
|
baseUrl?: string;
|
|
376
377
|
}
|
|
377
|
-
declare class
|
|
378
|
+
declare class OpenAIDescriptionProvider implements DescriptionProvider {
|
|
378
379
|
#private;
|
|
379
380
|
readonly profile: {
|
|
380
381
|
provider: string;
|
|
381
382
|
model: string;
|
|
382
383
|
strategyVersion: string;
|
|
383
384
|
};
|
|
384
|
-
constructor(options?:
|
|
385
|
-
|
|
385
|
+
constructor(options?: OpenAIDescriptionProviderOptions);
|
|
386
|
+
describe(input: DescriptionInput, options?: {
|
|
386
387
|
signal?: AbortSignal;
|
|
387
388
|
}): Promise<string>;
|
|
388
389
|
}
|
|
@@ -399,7 +400,7 @@ declare class JinaEmbeddingProvider implements EmbeddingProvider {
|
|
|
399
400
|
readonly provider: "jina";
|
|
400
401
|
readonly model: string;
|
|
401
402
|
readonly dimensions: number;
|
|
402
|
-
readonly strategyVersion: "callable-
|
|
403
|
+
readonly strategyVersion: "callable-v2:code-query-passage";
|
|
403
404
|
};
|
|
404
405
|
constructor(options?: JinaEmbeddingProviderOptions);
|
|
405
406
|
embedDocuments(inputs: readonly string[], options?: {
|
|
@@ -428,11 +429,12 @@ declare function updateFiles(index: CodeIndex, options: UpdateFilesOptions): Pro
|
|
|
428
429
|
declare function updateFromGit(index: CodeIndex, options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
429
430
|
declare function updateFromWorkingTree(index: CodeIndex, options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
430
431
|
declare function similaritySearch(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
431
|
-
declare function
|
|
432
|
+
declare function useDescriptions(index: CodeIndex, options?: {
|
|
432
433
|
signal?: AbortSignal;
|
|
433
|
-
}): Promise<
|
|
434
|
-
declare function
|
|
434
|
+
}): Promise<DescriptionStats>;
|
|
435
|
+
declare function disableDescriptions(index: CodeIndex): DescriptionStats;
|
|
436
|
+
declare function searchDescription(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
435
437
|
declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
|
|
436
438
|
declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
|
|
437
439
|
|
|
438
|
-
export { type AnalysisSimilarity, type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type
|
|
440
|
+
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 DescriptionInput, type DescriptionProfile, type DescriptionProvider, 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 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, searchDescription, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree, useDescriptions };
|