indexer-cli 0.3.5 → 0.3.7

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.
@@ -192,3 +192,69 @@ export interface GitOperations {
192
192
  sinceDays?: number;
193
193
  }): Promise<Record<string, number>>;
194
194
  }
195
+ export type ContextPackIntent = "bugfix" | "feature" | "refactor" | "investigation" | "unknown";
196
+ export type ContextPackProfile = "routing" | "balanced" | "deep";
197
+ export interface SelectedScope {
198
+ pathPrefixes: string[];
199
+ confidence: number;
200
+ why: string[];
201
+ }
202
+ export interface ModuleGoal {
203
+ module: string;
204
+ goal: string;
205
+ confidence: number;
206
+ evidenceSources: string[];
207
+ }
208
+ export interface ContextPackDependencyEdge {
209
+ from: string;
210
+ to: string;
211
+ }
212
+ export interface ArchitectureSlice {
213
+ entrypoints: string[];
214
+ relatedModules: string[];
215
+ dependencies: ContextPackDependencyEdge[];
216
+ }
217
+ export interface StructureSliceFile {
218
+ path: string;
219
+ module: string;
220
+ language?: string;
221
+ }
222
+ export interface StructureSliceSymbol {
223
+ file: string;
224
+ name: string;
225
+ kind: string;
226
+ signature?: string;
227
+ }
228
+ export interface StructureSlice {
229
+ files: StructureSliceFile[];
230
+ keySymbols: StructureSliceSymbol[];
231
+ }
232
+ export interface SemanticHit {
233
+ filePath: string;
234
+ score: number;
235
+ primarySymbol?: string;
236
+ reason: string;
237
+ snippet?: string;
238
+ }
239
+ export interface NextRead {
240
+ file: string;
241
+ reason: string;
242
+ }
243
+ export interface PackMeta {
244
+ estimatedTokens: number;
245
+ budget: number;
246
+ profile: ContextPackProfile;
247
+ confidenceBand: "low" | "medium" | "high";
248
+ omitted: string[];
249
+ }
250
+ export interface ContextPackResult {
251
+ task: string;
252
+ intent: ContextPackIntent;
253
+ selected_scope: SelectedScope;
254
+ module_goals: ModuleGoal[];
255
+ architecture_slice: ArchitectureSlice;
256
+ structure_slice: StructureSlice;
257
+ semantic_hits: SemanticHit[];
258
+ next_reads: NextRead[];
259
+ _meta: PackMeta;
260
+ }
@@ -0,0 +1,70 @@
1
+ import type { ContextPackIntent, ContextPackProfile, ContextPackResult, GitOperations, MetadataStore, PackMeta, ProjectId, SnapshotId } from "../core/types.js";
2
+ import type { SearchEngine } from "./searcher.js";
3
+ type ContextPackScope = {
4
+ kind: "all";
5
+ } | {
6
+ kind: "changed";
7
+ } | {
8
+ kind: "relevant-to";
9
+ value: string;
10
+ } | {
11
+ kind: "path-prefix";
12
+ value: string;
13
+ };
14
+ type ContextPackSearch = Pick<SearchEngine, "search">;
15
+ export type ContextPackBuildOptions = {
16
+ budget?: number;
17
+ profile?: ContextPackProfile;
18
+ scope?: string;
19
+ maxModules?: number;
20
+ maxFiles?: number;
21
+ maxSnippets?: number;
22
+ minScore?: number;
23
+ explainSymbols?: boolean;
24
+ excludePathPatterns?: string[];
25
+ includeFixtures?: boolean;
26
+ };
27
+ type ResolvedContextPackOptions = {
28
+ budget: number;
29
+ profile: ContextPackProfile;
30
+ scope: ContextPackScope;
31
+ maxModules: number;
32
+ maxFiles: number;
33
+ maxSnippets: number;
34
+ minScore?: number;
35
+ explainSymbols: boolean;
36
+ excludePathPatterns: string[];
37
+ includeFixtures: boolean;
38
+ evidenceThreshold: number;
39
+ searchTopK: number;
40
+ };
41
+ type ModuleMetric = {
42
+ module: string;
43
+ maxSemanticScore: number;
44
+ hitCount: number;
45
+ symbolOverlap: number;
46
+ dependencyProximity: number;
47
+ pathPrior: number;
48
+ changedBoost: number;
49
+ fileCount: number;
50
+ reasons: string[];
51
+ };
52
+ export type ScoredModule = {
53
+ module: string;
54
+ score: number;
55
+ reasons: string[];
56
+ metrics: Omit<ModuleMetric, "module" | "reasons">;
57
+ };
58
+ export declare function normalizeContextPackIntent(task: string): ContextPackIntent;
59
+ export declare function buildContextPackProfile(options?: ContextPackBuildOptions): ResolvedContextPackOptions;
60
+ export declare function inferContextPackConfidenceBand(confidence: number): PackMeta["confidenceBand"];
61
+ export declare function scoreContextPackModules(metrics: ModuleMetric[]): ScoredModule[];
62
+ export declare class ContextPackBuilder {
63
+ private readonly metadata;
64
+ private readonly search;
65
+ private readonly git;
66
+ private readonly repoRoot;
67
+ constructor(metadata: MetadataStore, search: ContextPackSearch, git: GitOperations, repoRoot: string);
68
+ build(projectId: ProjectId, snapshotId: SnapshotId, task: string, options?: ContextPackBuildOptions): Promise<ContextPackResult>;
69
+ }
70
+ export {};