@ninjaxtools/slopdex 0.6.0 → 0.9.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 +181 -245
- package/README.md +197 -97
- package/dist/cli.js +1088 -234
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +109 -11
- package/dist/index.js +916 -196
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +161 -0
- package/package.json +11 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,22 @@ declare class CodeIndex {
|
|
|
3
3
|
readonly rootDir: string;
|
|
4
4
|
readonly indexPath: string;
|
|
5
5
|
readonly provider: EmbeddingProvider;
|
|
6
|
+
readonly summaryProvider: SummaryProvider;
|
|
6
7
|
constructor(options: CodeIndexOptions);
|
|
7
8
|
close(): void;
|
|
8
9
|
status(): IndexStatus;
|
|
9
10
|
allFunctions(): IndexedFunction[];
|
|
11
|
+
indexErrors(): IndexingError[];
|
|
10
12
|
updateFiles(options: UpdateFilesOptions): Promise<UpdateStats>;
|
|
11
13
|
updateFromWorkingTree(options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
12
14
|
updateFromGit(options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
15
|
+
useSummaries(options?: {
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}): Promise<SummaryStats>;
|
|
18
|
+
searchSummary(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
13
19
|
similaritySearch(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
14
20
|
similarToFunction(functionId: number, options: {
|
|
21
|
+
includeSummaries?: boolean;
|
|
15
22
|
limit: number;
|
|
16
23
|
minSimilarity: number;
|
|
17
24
|
maxSimilarity?: number;
|
|
@@ -19,8 +26,9 @@ declare class CodeIndex {
|
|
|
19
26
|
minLines?: number;
|
|
20
27
|
nameRegex?: string;
|
|
21
28
|
}): SimilarityResult[];
|
|
22
|
-
vectorForFunction(functionId: number): number[];
|
|
29
|
+
vectorForFunction(functionId: number, kind?: "code" | "summary"): number[];
|
|
23
30
|
searchByVector(vector: readonly number[], options: {
|
|
31
|
+
summaryVector?: readonly number[];
|
|
24
32
|
limit: number;
|
|
25
33
|
minSimilarity: number;
|
|
26
34
|
maxSimilarity?: number;
|
|
@@ -31,9 +39,27 @@ declare class CodeIndex {
|
|
|
31
39
|
sourceFunctions(filter: CrossSearchSourceFilter): Promise<IndexedFunction[]>;
|
|
32
40
|
}
|
|
33
41
|
|
|
34
|
-
type SupportedLanguage = "typescript" | "tsx" | "
|
|
42
|
+
type SupportedLanguage = "python" | "javascript" | "jsx" | "typescript" | "tsx" | "rust" | "go" | "java" | "c";
|
|
35
43
|
type CallableKind = "function" | "method" | "constructor" | "generator";
|
|
36
44
|
type SourceMode = "git" | "working-tree";
|
|
45
|
+
interface IndexingIssue {
|
|
46
|
+
path: string;
|
|
47
|
+
language: SupportedLanguage | null;
|
|
48
|
+
scope: "file" | "function";
|
|
49
|
+
code: "parse-error" | "parse-failed" | "extraction-error" | "read-error" | "file-too-large";
|
|
50
|
+
message: string;
|
|
51
|
+
qualifiedName: string | null;
|
|
52
|
+
startLine: number | null;
|
|
53
|
+
startColumn: number | null;
|
|
54
|
+
endLine: number | null;
|
|
55
|
+
endColumn: number | null;
|
|
56
|
+
source: string | null;
|
|
57
|
+
}
|
|
58
|
+
interface IndexingError extends IndexingIssue {
|
|
59
|
+
id: number;
|
|
60
|
+
sourceMode: SourceMode;
|
|
61
|
+
indexedCommit: string | null;
|
|
62
|
+
}
|
|
37
63
|
interface ParsedCallable {
|
|
38
64
|
path: string;
|
|
39
65
|
language: SupportedLanguage;
|
|
@@ -57,6 +83,8 @@ interface IndexedFunction extends ParsedCallable {
|
|
|
57
83
|
lastSeenCommit: string | null;
|
|
58
84
|
sourceMode: SourceMode;
|
|
59
85
|
embeddingId: number;
|
|
86
|
+
summary: string | null;
|
|
87
|
+
summaryEmbeddingId: number | null;
|
|
60
88
|
}
|
|
61
89
|
interface EmbeddingProfile {
|
|
62
90
|
provider: "openai" | "jina" | string;
|
|
@@ -73,10 +101,31 @@ interface EmbeddingProvider {
|
|
|
73
101
|
signal?: AbortSignal;
|
|
74
102
|
}): Promise<number[]>;
|
|
75
103
|
}
|
|
104
|
+
interface SummaryProfile {
|
|
105
|
+
provider: string;
|
|
106
|
+
model: string;
|
|
107
|
+
strategyVersion: string;
|
|
108
|
+
}
|
|
109
|
+
interface SummaryInput {
|
|
110
|
+
repository: string;
|
|
111
|
+
callable: ParsedCallable;
|
|
112
|
+
fileSource: string;
|
|
113
|
+
}
|
|
114
|
+
interface SummaryProvider {
|
|
115
|
+
readonly profile: SummaryProfile;
|
|
116
|
+
summarize(input: SummaryInput, options?: {
|
|
117
|
+
signal?: AbortSignal;
|
|
118
|
+
}): Promise<string>;
|
|
119
|
+
}
|
|
120
|
+
interface SummaryStats {
|
|
121
|
+
summariesCreated: number;
|
|
122
|
+
summariesEnabled: boolean;
|
|
123
|
+
}
|
|
76
124
|
interface CodeIndexOptions {
|
|
77
125
|
rootDir: string;
|
|
78
126
|
indexPath?: string;
|
|
79
127
|
provider: EmbeddingProvider;
|
|
128
|
+
summaryProvider?: SummaryProvider;
|
|
80
129
|
onWarning?: (message: string) => void;
|
|
81
130
|
include?: readonly string[];
|
|
82
131
|
exclude?: readonly string[];
|
|
@@ -113,25 +162,42 @@ interface UpdateStats {
|
|
|
113
162
|
}
|
|
114
163
|
interface SimilaritySearchOptions {
|
|
115
164
|
query: string;
|
|
165
|
+
/** Restrict result qualified names before ranking and limiting. */
|
|
166
|
+
nameRegex?: string;
|
|
116
167
|
limit?: number;
|
|
117
168
|
minSimilarity?: number;
|
|
118
169
|
maxSimilarity?: number;
|
|
119
170
|
signal?: AbortSignal;
|
|
120
171
|
}
|
|
121
|
-
interface
|
|
122
|
-
function: IndexedFunction;
|
|
172
|
+
interface SimilarityScores {
|
|
123
173
|
similarity: number;
|
|
174
|
+
codeSimilarity?: number;
|
|
175
|
+
summarySimilarity?: number;
|
|
176
|
+
}
|
|
177
|
+
interface AnalysisSimilarity {
|
|
178
|
+
similarityMode: "code" | "code-summary-average";
|
|
179
|
+
similarityWeights: {
|
|
180
|
+
code: number;
|
|
181
|
+
summary: number;
|
|
182
|
+
};
|
|
124
183
|
}
|
|
125
|
-
|
|
184
|
+
interface SimilarityResult extends SimilarityScores {
|
|
185
|
+
function: IndexedFunction;
|
|
186
|
+
}
|
|
187
|
+
type CrossSearchSourceFilter = ({
|
|
126
188
|
type: "all";
|
|
127
189
|
path?: string;
|
|
128
190
|
} | {
|
|
129
191
|
type: "changed-since";
|
|
130
192
|
commit: string;
|
|
131
193
|
path?: string;
|
|
194
|
+
uncommitted?: boolean;
|
|
132
195
|
} | {
|
|
133
196
|
type: "uncommitted";
|
|
134
197
|
path?: string;
|
|
198
|
+
}) & {
|
|
199
|
+
/** Restrict source qualified names; does not restrict target candidates. */
|
|
200
|
+
nameRegex?: string;
|
|
135
201
|
};
|
|
136
202
|
interface CrossSearchOptions {
|
|
137
203
|
source: CodeIndex;
|
|
@@ -153,6 +219,10 @@ interface CrossSearchOptions {
|
|
|
153
219
|
interface CrossSearchResult {
|
|
154
220
|
source: IndexedFunction;
|
|
155
221
|
matches: SimilarityResult[];
|
|
222
|
+
scoring?: AnalysisSimilarity & {
|
|
223
|
+
sourceSummaryProfile: SummaryProfile | null;
|
|
224
|
+
targetSummaryProfile: SummaryProfile | null;
|
|
225
|
+
};
|
|
156
226
|
}
|
|
157
227
|
type CohesionLocationCategory = "same-file" | "same-folder" | "different-folder";
|
|
158
228
|
interface CohesionLocation {
|
|
@@ -174,11 +244,10 @@ interface CohesionFunctionReference {
|
|
|
174
244
|
lineCount: number;
|
|
175
245
|
source?: string;
|
|
176
246
|
}
|
|
177
|
-
interface CohesionPair<FunctionValue = IndexedFunction> {
|
|
247
|
+
interface CohesionPair<FunctionValue = IndexedFunction> extends SimilarityScores {
|
|
178
248
|
rank: number;
|
|
179
249
|
left: FunctionValue;
|
|
180
250
|
right: FunctionValue;
|
|
181
|
-
similarity: number;
|
|
182
251
|
reciprocal: boolean | null;
|
|
183
252
|
semanticWeight: number;
|
|
184
253
|
separationWeight: number;
|
|
@@ -192,9 +261,8 @@ interface CohesionFileReport<FunctionValue = IndexedFunction> {
|
|
|
192
261
|
sameFolderAffinity: number;
|
|
193
262
|
externalAffinity: number;
|
|
194
263
|
externalAffinityRatio: number;
|
|
195
|
-
strongestExternalMatch?: {
|
|
264
|
+
strongestExternalMatch?: SimilarityScores & {
|
|
196
265
|
function: FunctionValue;
|
|
197
|
-
similarity: number;
|
|
198
266
|
cohesionGap: number;
|
|
199
267
|
};
|
|
200
268
|
}
|
|
@@ -239,8 +307,9 @@ interface CohesionReport<FunctionValue = IndexedFunction> {
|
|
|
239
307
|
generation: number;
|
|
240
308
|
gitCheckpoint: string | null;
|
|
241
309
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
310
|
+
summaryProfile: SummaryProfile | null;
|
|
242
311
|
};
|
|
243
|
-
parameters: {
|
|
312
|
+
parameters: AnalysisSimilarity & {
|
|
244
313
|
neighbors: number;
|
|
245
314
|
limit: number;
|
|
246
315
|
minSimilarity: number;
|
|
@@ -263,8 +332,15 @@ interface IndexStatus {
|
|
|
263
332
|
generation: number;
|
|
264
333
|
gitCheckpoint: string | null;
|
|
265
334
|
embeddingProfile: Required<EmbeddingProfile>;
|
|
335
|
+
summariesEnabled: boolean;
|
|
336
|
+
summaryCount: number;
|
|
337
|
+
summaryProfile: SummaryProfile | null;
|
|
338
|
+
indexingErrorCount: number;
|
|
339
|
+
failedFileCount: number;
|
|
266
340
|
}
|
|
267
341
|
|
|
342
|
+
declare function readIndexErrors(indexPath: string): IndexingError[];
|
|
343
|
+
|
|
268
344
|
declare function analyzeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport>;
|
|
269
345
|
declare function cohesionLocation(leftPath: string, rightPath: string): CohesionLocation;
|
|
270
346
|
|
|
@@ -293,6 +369,24 @@ declare class OpenAIEmbeddingProvider implements EmbeddingProvider {
|
|
|
293
369
|
}): Promise<number[]>;
|
|
294
370
|
}
|
|
295
371
|
|
|
372
|
+
interface OpenAISummaryProviderOptions {
|
|
373
|
+
apiKey?: string;
|
|
374
|
+
model?: string;
|
|
375
|
+
baseUrl?: string;
|
|
376
|
+
}
|
|
377
|
+
declare class OpenAISummaryProvider implements SummaryProvider {
|
|
378
|
+
#private;
|
|
379
|
+
readonly profile: {
|
|
380
|
+
provider: string;
|
|
381
|
+
model: string;
|
|
382
|
+
strategyVersion: string;
|
|
383
|
+
};
|
|
384
|
+
constructor(options?: OpenAISummaryProviderOptions);
|
|
385
|
+
summarize(input: SummaryInput, options?: {
|
|
386
|
+
signal?: AbortSignal;
|
|
387
|
+
}): Promise<string>;
|
|
388
|
+
}
|
|
389
|
+
|
|
296
390
|
interface JinaEmbeddingProviderOptions {
|
|
297
391
|
apiKey?: string;
|
|
298
392
|
model?: string;
|
|
@@ -334,7 +428,11 @@ declare function updateFiles(index: CodeIndex, options: UpdateFilesOptions): Pro
|
|
|
334
428
|
declare function updateFromGit(index: CodeIndex, options?: UpdateFromGitOptions): Promise<UpdateStats>;
|
|
335
429
|
declare function updateFromWorkingTree(index: CodeIndex, options?: UpdateFromWorkingTreeOptions): Promise<UpdateStats>;
|
|
336
430
|
declare function similaritySearch(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
431
|
+
declare function useSummaries(index: CodeIndex, options?: {
|
|
432
|
+
signal?: AbortSignal;
|
|
433
|
+
}): Promise<SummaryStats>;
|
|
434
|
+
declare function searchSummary(index: CodeIndex, options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
|
|
337
435
|
declare function crossSearchFunctions(options: CrossSearchOptions): AsyncGenerator<CrossSearchResult, any, any>;
|
|
338
436
|
declare function analyzeCodeCohesion(options: CohesionAnalysisOptions): Promise<CohesionReport<IndexedFunction>>;
|
|
339
437
|
|
|
340
|
-
export { type CallableKind, CodeIndex, CodeIndexError, type CodeIndexOptions, type CohesionAnalysisOptions, type CohesionFileReport, type CohesionFunctionReference, type CohesionGroup, type CohesionJsonReport, type CohesionLocation, type CohesionLocationCategory, type CohesionPair, type CohesionReport, type CohesionSummary, type CrossSearchOptions, type CrossSearchResult, type CrossSearchSourceFilter, type EmbeddingProfile, type EmbeddingProvider, GitDivergenceError, GitUnavailableError, IncompatibleIndexError, type IndexStatus, type IndexedFunction, JinaEmbeddingProvider, type JinaEmbeddingProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, type ParsedCallable, type SimilarityResult, type SimilaritySearchOptions, type SourceMode, type SupportedLanguage, type UpdateFilesOptions, type UpdateFromGitOptions, type UpdateFromWorkingTreeOptions, type UpdateStats, analyzeCodeCohesion, analyzeCohesion, cohesionLocation, crossSearch, crossSearchFunctions, openCodeIndex, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree };
|
|
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 CohesionPair, type CohesionReport, type CohesionSummary, type CrossSearchOptions, type CrossSearchResult, type CrossSearchSourceFilter, type EmbeddingProfile, type EmbeddingProvider, GitDivergenceError, GitUnavailableError, IncompatibleIndexError, type IndexStatus, type IndexedFunction, type IndexingError, type IndexingIssue, JinaEmbeddingProvider, type JinaEmbeddingProviderOptions, OpenAIEmbeddingProvider, type OpenAIEmbeddingProviderOptions, OpenAISummaryProvider, type OpenAISummaryProviderOptions, type ParsedCallable, type SimilarityResult, type SimilarityScores, type SimilaritySearchOptions, type SourceMode, type SummaryInput, type SummaryProfile, type SummaryProvider, type SummaryStats, type SupportedLanguage, type UpdateFilesOptions, type UpdateFromGitOptions, type UpdateFromWorkingTreeOptions, type UpdateStats, analyzeCodeCohesion, analyzeCohesion, cohesionLocation, crossSearch, crossSearchFunctions, openCodeIndex, readIndexErrors, searchSummary, similaritySearch, updateFiles, updateFromGit, updateFromWorkingTree, useSummaries };
|