@ninjaxtools/slopdex 0.10.0 → 0.13.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 +31 -14
- package/README.md +45 -18
- package/dist/cli.js +1121 -425
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +86 -41
- package/dist/index.js +812 -370
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +21 -19
- package/package.json +6 -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,14 +12,15 @@ 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
|
-
|
|
19
|
-
|
|
17
|
+
}): Promise<DescriptionStats>;
|
|
18
|
+
reindexFiles(options?: ReindexFilesOptions): Promise<ReindexFilesStats>;
|
|
19
|
+
disableDescriptions(): DescriptionStats;
|
|
20
|
+
searchDescription(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
20
21
|
similaritySearch(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
21
22
|
similarToFunction(functionId: number, options: {
|
|
22
|
-
|
|
23
|
+
includeDescriptions?: boolean;
|
|
23
24
|
limit: number;
|
|
24
25
|
minSimilarity: number;
|
|
25
26
|
maxSimilarity?: number;
|
|
@@ -27,9 +28,11 @@ declare class CodeIndex {
|
|
|
27
28
|
minLines?: number;
|
|
28
29
|
nameRegex?: string;
|
|
29
30
|
}): SimilarityResult[];
|
|
30
|
-
vectorForFunction(functionId: number, kind?: "code" | "
|
|
31
|
+
vectorForFunction(functionId: number, kind?: "code" | "description"): number[];
|
|
32
|
+
vectorForFile(filePath: string): number[];
|
|
31
33
|
searchByVector(vector: readonly number[], options: {
|
|
32
|
-
|
|
34
|
+
descriptionVector?: readonly number[];
|
|
35
|
+
fileDescriptionVector?: readonly number[];
|
|
33
36
|
limit: number;
|
|
34
37
|
minSimilarity: number;
|
|
35
38
|
maxSimilarity?: number;
|
|
@@ -84,8 +87,8 @@ interface IndexedFunction extends ParsedCallable {
|
|
|
84
87
|
lastSeenCommit: string | null;
|
|
85
88
|
sourceMode: SourceMode;
|
|
86
89
|
embeddingId: number;
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
description: string | null;
|
|
91
|
+
descriptionEmbeddingId: number | null;
|
|
89
92
|
}
|
|
90
93
|
interface EmbeddingProfile {
|
|
91
94
|
provider: "openai" | "jina" | string;
|
|
@@ -102,31 +105,51 @@ interface EmbeddingProvider {
|
|
|
102
105
|
signal?: AbortSignal;
|
|
103
106
|
}): Promise<number[]>;
|
|
104
107
|
}
|
|
105
|
-
interface
|
|
108
|
+
interface DescriptionProfile {
|
|
106
109
|
provider: string;
|
|
107
110
|
model: string;
|
|
108
111
|
strategyVersion: string;
|
|
109
112
|
}
|
|
110
|
-
interface
|
|
113
|
+
interface DescriptionInput {
|
|
111
114
|
repository: string;
|
|
112
115
|
callable: ParsedCallable;
|
|
113
116
|
fileSource: string;
|
|
114
117
|
}
|
|
115
|
-
interface
|
|
116
|
-
|
|
117
|
-
|
|
118
|
+
interface DescriptionFileInput {
|
|
119
|
+
repository: string;
|
|
120
|
+
path: string;
|
|
121
|
+
fileSource: string;
|
|
122
|
+
}
|
|
123
|
+
interface DescriptionFileSession {
|
|
124
|
+
describeFile(options?: {
|
|
125
|
+
signal?: AbortSignal;
|
|
126
|
+
}): Promise<string>;
|
|
127
|
+
replayFile(description: string): void;
|
|
128
|
+
describe(callable: ParsedCallable, options?: {
|
|
129
|
+
signal?: AbortSignal;
|
|
130
|
+
}): Promise<string>;
|
|
131
|
+
replay(callable: ParsedCallable, description: string): void;
|
|
132
|
+
}
|
|
133
|
+
interface DescriptionProvider {
|
|
134
|
+
readonly profile: DescriptionProfile;
|
|
135
|
+
describe(input: DescriptionInput, options?: {
|
|
136
|
+
signal?: AbortSignal;
|
|
137
|
+
}): Promise<string>;
|
|
138
|
+
describeFile(input: DescriptionFileInput, options?: {
|
|
118
139
|
signal?: AbortSignal;
|
|
119
140
|
}): Promise<string>;
|
|
141
|
+
startFile?(input: DescriptionFileInput): DescriptionFileSession;
|
|
120
142
|
}
|
|
121
|
-
interface
|
|
122
|
-
|
|
123
|
-
|
|
143
|
+
interface DescriptionStats {
|
|
144
|
+
descriptionsCreated: number;
|
|
145
|
+
fileDescriptionsCreated: number;
|
|
146
|
+
descriptionsEnabled: boolean;
|
|
124
147
|
}
|
|
125
148
|
interface CodeIndexOptions {
|
|
126
149
|
rootDir: string;
|
|
127
150
|
indexPath?: string;
|
|
128
151
|
provider: EmbeddingProvider;
|
|
129
|
-
|
|
152
|
+
descriptionProvider?: DescriptionProvider;
|
|
130
153
|
onWarning?: (message: string) => void;
|
|
131
154
|
include?: readonly string[];
|
|
132
155
|
exclude?: readonly string[];
|
|
@@ -161,6 +184,15 @@ interface UpdateStats {
|
|
|
161
184
|
embeddingsCreated: number;
|
|
162
185
|
checkpoint: string | null;
|
|
163
186
|
}
|
|
187
|
+
interface ReindexFilesOptions {
|
|
188
|
+
includeCallables?: boolean;
|
|
189
|
+
signal?: AbortSignal;
|
|
190
|
+
}
|
|
191
|
+
interface ReindexFilesStats {
|
|
192
|
+
filesReindexed: number;
|
|
193
|
+
fileDescriptionsCreated: number;
|
|
194
|
+
descriptionsCreated: number;
|
|
195
|
+
}
|
|
164
196
|
interface SimilaritySearchOptions {
|
|
165
197
|
query: string;
|
|
166
198
|
/** Restrict result qualified names before ranking and limiting. */
|
|
@@ -173,13 +205,15 @@ interface SimilaritySearchOptions {
|
|
|
173
205
|
interface SimilarityScores {
|
|
174
206
|
similarity: number;
|
|
175
207
|
codeSimilarity?: number;
|
|
176
|
-
|
|
208
|
+
descriptionSimilarity?: number;
|
|
209
|
+
fileDescriptionSimilarity?: number;
|
|
177
210
|
}
|
|
178
211
|
interface AnalysisSimilarity {
|
|
179
|
-
similarityMode: "code" | "code-
|
|
212
|
+
similarityMode: "code" | "code-description-file-average";
|
|
180
213
|
similarityWeights: {
|
|
181
214
|
code: number;
|
|
182
|
-
|
|
215
|
+
description: number;
|
|
216
|
+
fileDescription: number;
|
|
183
217
|
};
|
|
184
218
|
}
|
|
185
219
|
interface SimilarityResult extends SimilarityScores {
|
|
@@ -221,8 +255,8 @@ interface CrossSearchResult {
|
|
|
221
255
|
source: IndexedFunction;
|
|
222
256
|
matches: SimilarityResult[];
|
|
223
257
|
scoring?: AnalysisSimilarity & {
|
|
224
|
-
|
|
225
|
-
|
|
258
|
+
sourceDescriptionProfile: DescriptionProfile | null;
|
|
259
|
+
targetDescriptionProfile: DescriptionProfile | null;
|
|
226
260
|
};
|
|
227
261
|
}
|
|
228
262
|
type CohesionLocationCategory = "same-file" | "same-folder" | "different-folder";
|
|
@@ -277,7 +311,7 @@ interface CohesionGroup<FunctionValue = IndexedFunction> {
|
|
|
277
311
|
maximumCohesionGap: number;
|
|
278
312
|
members: FunctionValue[];
|
|
279
313
|
}
|
|
280
|
-
interface
|
|
314
|
+
interface CohesionMetrics {
|
|
281
315
|
scope: "repository" | "selected-sources";
|
|
282
316
|
functionsAnalyzed: number;
|
|
283
317
|
candidateFunctions: number;
|
|
@@ -303,12 +337,12 @@ interface CohesionAnalysisOptions {
|
|
|
303
337
|
}) => void;
|
|
304
338
|
}
|
|
305
339
|
interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
306
|
-
schemaVersion:
|
|
340
|
+
schemaVersion: 3;
|
|
307
341
|
repository: {
|
|
308
342
|
generation: number;
|
|
309
343
|
gitCheckpoint: string | null;
|
|
310
344
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
311
|
-
|
|
345
|
+
descriptionProfile: DescriptionProfile | null;
|
|
312
346
|
};
|
|
313
347
|
parameters: AnalysisSimilarity & {
|
|
314
348
|
neighbors: number;
|
|
@@ -319,7 +353,7 @@ interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
|
319
353
|
nameRegex?: string;
|
|
320
354
|
sourceFilter: CrossSearchSourceFilter;
|
|
321
355
|
};
|
|
322
|
-
|
|
356
|
+
metrics: CohesionMetrics;
|
|
323
357
|
pairs: CohesionPair<FunctionValue>[];
|
|
324
358
|
files: CohesionFileReport<FunctionValue>[];
|
|
325
359
|
groups: CohesionGroup<FunctionValue>[];
|
|
@@ -333,9 +367,12 @@ interface IndexStatus {
|
|
|
333
367
|
generation: number;
|
|
334
368
|
gitCheckpoint: string | null;
|
|
335
369
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
370
|
+
descriptionsEnabled: boolean;
|
|
371
|
+
descriptionCount: number;
|
|
372
|
+
fileDescriptionCount: number;
|
|
373
|
+
describableFileCount: number;
|
|
374
|
+
staleFileDescriptionCount: number;
|
|
375
|
+
descriptionProfile: DescriptionProfile | null;
|
|
339
376
|
indexingErrorCount: number;
|
|
340
377
|
failedFileCount: number;
|
|
341
378
|
}
|
|
@@ -370,22 +407,29 @@ declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
|
370
407
|
}): Promise<number[]>;
|
|
371
408
|
}
|
|
372
409
|
|
|
373
|
-
interface
|
|
410
|
+
interface OpenAIDescriptionProviderOptions {
|
|
374
411
|
apiKey?: string;
|
|
375
412
|
model?: string;
|
|
376
413
|
baseUrl?: string;
|
|
414
|
+
provider?: DescriptionProviderName;
|
|
377
415
|
}
|
|
378
|
-
declare
|
|
416
|
+
declare const DESCRIPTION_PROVIDER_NAMES: readonly ["openai", "opencode", "opencode-go"];
|
|
417
|
+
type DescriptionProviderName = typeof DESCRIPTION_PROVIDER_NAMES[number];
|
|
418
|
+
declare class OpenAIDescriptionProvider implements DescriptionProvider {
|
|
379
419
|
#private;
|
|
380
420
|
readonly profile: {
|
|
381
|
-
provider:
|
|
421
|
+
provider: "openai" | "opencode" | "opencode-go";
|
|
382
422
|
model: string;
|
|
383
423
|
strategyVersion: string;
|
|
384
424
|
};
|
|
385
|
-
constructor(options?:
|
|
386
|
-
|
|
425
|
+
constructor(options?: OpenAIDescriptionProviderOptions);
|
|
426
|
+
describe(input: DescriptionInput, options?: {
|
|
427
|
+
signal?: AbortSignal;
|
|
428
|
+
}): Promise<string>;
|
|
429
|
+
describeFile(input: DescriptionFileInput, options?: {
|
|
387
430
|
signal?: AbortSignal;
|
|
388
431
|
}): Promise<string>;
|
|
432
|
+
startFile(input: DescriptionFileInput): DescriptionFileSession;
|
|
389
433
|
}
|
|
390
434
|
|
|
391
435
|
interface JinaEmbeddingProviderOptions {
|
|
@@ -428,13 +472,14 @@ declare function openCodeIndex(options: CodeIndexOptions): CodeIndex;
|
|
|
428
472
|
declare function updateFiles(index: CodeIndex, options: UpdateFilesOptions): Promise<UpdateStats>;
|
|
429
473
|
declare function updateFromGit(index: CodeIndex, options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
430
474
|
declare function updateFromWorkingTree(index: CodeIndex, options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
475
|
+
declare function reindexFiles(index: CodeIndex, options?: ReindexFilesOptions): Promise<ReindexFilesStats>;
|
|
431
476
|
declare function similaritySearch(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
432
|
-
declare function
|
|
477
|
+
declare function useDescriptions(index: CodeIndex, options?: {
|
|
433
478
|
signal?: AbortSignal;
|
|
434
|
-
}): Promise<
|
|
435
|
-
declare function
|
|
436
|
-
declare function
|
|
479
|
+
}): Promise<DescriptionStats>;
|
|
480
|
+
declare function disableDescriptions(index: CodeIndex): DescriptionStats;
|
|
481
|
+
declare function searchDescription(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
437
482
|
declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
|
|
438
483
|
declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
|
|
439
484
|
|
|
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
|
|
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 };
|