dsh-codebase-chat 0.22.0 → 0.24.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/README.md +189 -200
- package/dist/cli.js +369 -62
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +64 -2
- package/dist/index.js +364 -61
- package/dist/index.js.map +1 -1
- package/lib/index.js +96 -20
- package/package.json +12 -10
package/dist/index.d.ts
CHANGED
|
@@ -57,12 +57,16 @@ interface ContextOptions {
|
|
|
57
57
|
instruction?: string;
|
|
58
58
|
/** Enable local semantic embeddings for retrieval */
|
|
59
59
|
embed?: boolean;
|
|
60
|
+
/** Git ref (branch/tag/SHA) — scope retrieval to files changed vs this ref */
|
|
61
|
+
diff?: string;
|
|
60
62
|
}
|
|
61
63
|
interface ContextResult {
|
|
62
64
|
absProject: string;
|
|
63
65
|
context: string;
|
|
64
66
|
chunks: CodeChunk[];
|
|
65
67
|
tokenCount: number;
|
|
68
|
+
/** Project-relative files in scope when `diff` was requested */
|
|
69
|
+
diffFiles?: string[];
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
declare function buildContext(options: ContextOptions): Promise<ContextResult>;
|
|
@@ -75,6 +79,7 @@ declare function getIndex(projectPath: string, progress?: (message: string) => v
|
|
|
75
79
|
|
|
76
80
|
declare function resolveProjectPath(projectPath?: string): string;
|
|
77
81
|
declare function findProjectRoot(absProject: string): Promise<string>;
|
|
82
|
+
declare function getCacheDir(): string;
|
|
78
83
|
|
|
79
84
|
/**
|
|
80
85
|
* Count the exact number of tokens for a given text using the CL100K base
|
|
@@ -166,10 +171,53 @@ interface HealthReport {
|
|
|
166
171
|
score: number;
|
|
167
172
|
grade: 'A' | 'B' | 'C' | 'D' | 'E';
|
|
168
173
|
}
|
|
169
|
-
|
|
174
|
+
interface AnalyzeOptions {
|
|
175
|
+
/** Restrict *reported findings* to these project-relative paths (e.g. a diff
|
|
176
|
+
* scope). The import graph and usage checks still run on the whole project
|
|
177
|
+
* so cycles/uses crossing the scope boundary are detected. */
|
|
178
|
+
files?: Set<string>;
|
|
179
|
+
}
|
|
180
|
+
declare function analyzeProject(projectPath: string, opts?: AnalyzeOptions): Promise<HealthReport>;
|
|
170
181
|
declare function formatHealthReport(r: HealthReport, lang?: 'fr' | 'en'): string;
|
|
171
182
|
declare function formatHealthReportMd(r: HealthReport, lang?: 'fr' | 'en'): string;
|
|
172
183
|
|
|
184
|
+
interface ImpactDependent {
|
|
185
|
+
file: string;
|
|
186
|
+
depth: number;
|
|
187
|
+
}
|
|
188
|
+
interface ImpactReport {
|
|
189
|
+
projectPath: string;
|
|
190
|
+
query: string;
|
|
191
|
+
target: string;
|
|
192
|
+
exportedSymbols: {
|
|
193
|
+
name: string;
|
|
194
|
+
line: number;
|
|
195
|
+
}[];
|
|
196
|
+
dependents: ImpactDependent[];
|
|
197
|
+
directCount: number;
|
|
198
|
+
totalFiles: number;
|
|
199
|
+
/** Share of the project's code files that transitively depend on the target. */
|
|
200
|
+
percent: number;
|
|
201
|
+
inCycle: boolean;
|
|
202
|
+
isEntry: boolean;
|
|
203
|
+
risk: 'low' | 'medium' | 'high';
|
|
204
|
+
}
|
|
205
|
+
type ImpactResult = {
|
|
206
|
+
ok: true;
|
|
207
|
+
report: ImpactReport;
|
|
208
|
+
} | {
|
|
209
|
+
ok: false;
|
|
210
|
+
query: string;
|
|
211
|
+
candidates: string[];
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Blast-radius analysis: which files break if `query` changes. Reverse BFS on
|
|
215
|
+
* the local import graph — deterministic, no LLM.
|
|
216
|
+
*/
|
|
217
|
+
declare function analyzeImpact(projectPath: string, query: string): Promise<ImpactResult>;
|
|
218
|
+
declare function formatImpactReport(r: ImpactReport, lang?: 'fr' | 'en'): string;
|
|
219
|
+
declare function formatImpactReportMd(r: ImpactReport, lang?: 'fr' | 'en'): string;
|
|
220
|
+
|
|
173
221
|
type ConfigLang = 'fr' | 'en';
|
|
174
222
|
/**
|
|
175
223
|
* Per-project settings read from `.codebase-chat.json` at the project root.
|
|
@@ -199,4 +247,18 @@ declare function globToRegExp(glob: string): RegExp;
|
|
|
199
247
|
/** Match a project-relative path (posix separators) against a list of globs. */
|
|
200
248
|
declare function matchesAnyGlob(relPath: string, globs: string[] | undefined): boolean;
|
|
201
249
|
|
|
202
|
-
|
|
250
|
+
interface DiffScope {
|
|
251
|
+
/** Project-relative paths (forward slashes) changed vs the base ref. */
|
|
252
|
+
files: Set<string>;
|
|
253
|
+
/** False when the project is not a git repo or git is unavailable. */
|
|
254
|
+
ok: boolean;
|
|
255
|
+
/** Why the scope could not be computed (when ok === false). */
|
|
256
|
+
error?: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Files changed vs a git ref — committed diffs, staged/unstaged edits and
|
|
260
|
+
* untracked files. Used to scope retrieval and audits to "what changed".
|
|
261
|
+
*/
|
|
262
|
+
declare function getChangedFiles(absProject: string, base: string): Promise<DiffScope>;
|
|
263
|
+
|
|
264
|
+
export { CONFIG_FILE, type CloneGroup, type CodeChunk, type CodeIndex, type ConfigLang, type ContextOptions, type ContextResult, type Cycle, type DiffScope, type HealthReport, type Hotspot, type ImpactDependent, type ImpactReport, type ImpactResult, type IndexedFile, type InvertedIndex, type ProjectConfig, type UnusedExport, analyzeImpact, analyzeProject, buildContext, buildIndex, chunkByTokens, clearConfigCache, cosineSimilarity, countTokens, disposeTreeSitter, embedIndex, ensureTreeSitterForExt, extractChunks, findProjectRoot, formatHealthReport, formatHealthReportMd, formatImpactReport, formatImpactReportMd, getCacheDir, getChangedFiles, getEmbedding, getEmbeddings, getExtractor, getIndex, globToRegExp, initTreeSitter, loadIndex, loadProjectConfig, matchesAnyGlob, resolveProjectPath, saveIndex, scoreChunks, selectChunks, treeSitterReady, truncateToTokens };
|