@ninjaxtools/slopdex 0.11.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/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ declare class CodeIndex {
15
15
  useDescriptions(options?: {
16
16
  signal?: AbortSignal;
17
17
  }): Promise<DescriptionStats>;
18
+ reindexFiles(options?: ReindexFilesOptions): Promise<ReindexFilesStats>;
18
19
  disableDescriptions(): DescriptionStats;
19
20
  searchDescription(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
20
21
  similaritySearch(options: SimilaritySearchOptions): Promise<SimilarityResult[]>;
@@ -28,8 +29,10 @@ declare class CodeIndex {
28
29
  nameRegex?: string;
29
30
  }): SimilarityResult[];
30
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;
@@ -112,14 +115,34 @@ interface DescriptionInput {
112
115
  callable: ParsedCallable;
113
116
  fileSource: string;
114
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
+ }
115
133
  interface DescriptionProvider {
116
134
  readonly profile: DescriptionProfile;
117
135
  describe(input: DescriptionInput, options?: {
118
136
  signal?: AbortSignal;
119
137
  }): Promise<string>;
138
+ describeFile(input: DescriptionFileInput, options?: {
139
+ signal?: AbortSignal;
140
+ }): Promise<string>;
141
+ startFile?(input: DescriptionFileInput): DescriptionFileSession;
120
142
  }
121
143
  interface DescriptionStats {
122
144
  descriptionsCreated: number;
145
+ fileDescriptionsCreated: number;
123
146
  descriptionsEnabled: boolean;
124
147
  }
125
148
  interface CodeIndexOptions {
@@ -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. */
@@ -174,12 +206,14 @@ 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-description-average";
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 {
@@ -303,7 +337,7 @@ interface CohesionAnalysisOptions {
303
337
  }) => void;
304
338
  }
305
339
  interface CohesionReport<FunctionValue = IndexedFunction> {
306
- schemaVersion: 2;
340
+ schemaVersion: 3;
307
341
  repository: {
308
342
  generation: number;
309
343
  gitCheckpoint: string | null;
@@ -335,6 +369,9 @@ interface IndexStatus {
335
369
  embeddingProfile: Required<EmbeddingProfile>;
336
370
  descriptionsEnabled: boolean;
337
371
  descriptionCount: number;
372
+ fileDescriptionCount: number;
373
+ describableFileCount: number;
374
+ staleFileDescriptionCount: number;
338
375
  descriptionProfile: DescriptionProfile | null;
339
376
  indexingErrorCount: number;
340
377
  failedFileCount: number;
@@ -374,11 +411,14 @@ interface OpenAIDescriptionProviderOptions {
374
411
  apiKey?: string;
375
412
  model?: string;
376
413
  baseUrl?: string;
414
+ provider?: DescriptionProviderName;
377
415
  }
416
+ declare const DESCRIPTION_PROVIDER_NAMES: readonly ["openai", "opencode", "opencode-go"];
417
+ type DescriptionProviderName = typeof DESCRIPTION_PROVIDER_NAMES[number];
378
418
  declare class OpenAIDescriptionProvider implements DescriptionProvider {
379
419
  #private;
380
420
  readonly profile: {
381
- provider: string;
421
+ provider: "openai" | "opencode" | "opencode-go";
382
422
  model: string;
383
423
  strategyVersion: string;
384
424
  };
@@ -386,6 +426,10 @@ declare class OpenAIDescriptionProvider implements DescriptionProvider {
386
426
  describe(input: DescriptionInput, options?: {
387
427
  signal?: AbortSignal;
388
428
  }): Promise<string>;
429
+ describeFile(input: DescriptionFileInput, options?: {
430
+ signal?: AbortSignal;
431
+ }): Promise<string>;
432
+ startFile(input: DescriptionFileInput): DescriptionFileSession;
389
433
  }
390
434
 
391
435
  interface JinaEmbeddingProviderOptions {
@@ -428,6 +472,7 @@ 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
477
  declare function useDescriptions(index: CodeIndex, options?: {
433
478
  signal?: AbortSignal;
@@ -437,4 +482,4 @@ declare function searchDescription(index: CodeIndex, options: SimilaritySearchOp
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 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 };
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 };