dsh-codebase-chat 0.23.0 → 0.25.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
@@ -79,6 +79,7 @@ declare function getIndex(projectPath: string, progress?: (message: string) => v
79
79
 
80
80
  declare function resolveProjectPath(projectPath?: string): string;
81
81
  declare function findProjectRoot(absProject: string): Promise<string>;
82
+ declare function getCacheDir(): string;
82
83
 
83
84
  /**
84
85
  * Count the exact number of tokens for a given text using the CL100K base
@@ -171,13 +172,52 @@ interface HealthReport {
171
172
  grade: 'A' | 'B' | 'C' | 'D' | 'E';
172
173
  }
173
174
  interface AnalyzeOptions {
174
- /** Restrict analysis to these project-relative paths (e.g. a diff scope). */
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. */
175
178
  files?: Set<string>;
176
179
  }
177
180
  declare function analyzeProject(projectPath: string, opts?: AnalyzeOptions): Promise<HealthReport>;
178
181
  declare function formatHealthReport(r: HealthReport, lang?: 'fr' | 'en'): string;
179
182
  declare function formatHealthReportMd(r: HealthReport, lang?: 'fr' | 'en'): string;
180
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
+
181
221
  type ConfigLang = 'fr' | 'en';
182
222
  /**
183
223
  * Per-project settings read from `.codebase-chat.json` at the project root.
@@ -204,7 +244,7 @@ declare function loadProjectConfig(absProject: string): Promise<ProjectConfig>;
204
244
  declare function clearConfigCache(absProject?: string): void;
205
245
  /** Minimal glob → RegExp: `**` spans directories, `*` one segment, `?` one char. */
206
246
  declare function globToRegExp(glob: string): RegExp;
207
- /** Match a project-relative path (posix separators) against a list of globs. */
247
+ /** Match a project-relative path (posix separators) against a list of globs. Globs without `/` match the basename at any depth (gitignore-style). */
208
248
  declare function matchesAnyGlob(relPath: string, globs: string[] | undefined): boolean;
209
249
 
210
250
  interface DiffScope {
@@ -221,4 +261,43 @@ interface DiffScope {
221
261
  */
222
262
  declare function getChangedFiles(absProject: string, base: string): Promise<DiffScope>;
223
263
 
224
- export { CONFIG_FILE, type CloneGroup, type CodeChunk, type CodeIndex, type ConfigLang, type ContextOptions, type ContextResult, type Cycle, type DiffScope, type HealthReport, type Hotspot, type IndexedFile, type InvertedIndex, type ProjectConfig, type UnusedExport, analyzeProject, buildContext, buildIndex, chunkByTokens, clearConfigCache, cosineSimilarity, countTokens, disposeTreeSitter, embedIndex, ensureTreeSitterForExt, extractChunks, findProjectRoot, formatHealthReport, formatHealthReportMd, getChangedFiles, getEmbedding, getEmbeddings, getExtractor, getIndex, globToRegExp, initTreeSitter, loadIndex, loadProjectConfig, matchesAnyGlob, resolveProjectPath, saveIndex, scoreChunks, selectChunks, treeSitterReady, truncateToTokens };
264
+ interface ToolPromptOptions {
265
+ context: string;
266
+ projectName: string;
267
+ lang?: string;
268
+ style?: string;
269
+ query?: string;
270
+ focus?: string;
271
+ filePath?: string;
272
+ description?: string;
273
+ crea?: boolean;
274
+ creaTheme?: string;
275
+ }
276
+ declare function langInstruction(lang?: string): string;
277
+ declare function normalizeLabels(prompt: string, lang: string): string;
278
+ declare function buildChatPrompt(question: string, context: string, projectName: string, crea?: boolean, creaTheme?: string, lang?: string): string;
279
+ declare function buildSearchPrompt(query: string, context: string, projectName: string, crea?: boolean, creaTheme?: string, lang?: string): string;
280
+ declare function buildExplainPrompt(target: string, context: string, projectName: string, crea?: boolean, creaTheme?: string, lang?: string): string;
281
+ declare function buildRefactorPrompt(filePath: string, description: string, context: string, projectName: string, crea?: boolean, creaTheme?: string, lang?: string): string;
282
+ declare function buildCreaPrompt(theme: string, context: string, projectName: string, lang?: string): string;
283
+ declare function styleInstruction(style?: string, lang?: string): string;
284
+ declare function buildIntelligencePrompt(context: string, projectName: string, focus?: string, style?: string, lang?: string): string;
285
+ declare function buildAuditPrompt(context: string, projectName: string, focus?: string, lang?: string): string;
286
+ declare function brandSignature(lang?: string): string;
287
+ declare function buildAsciiBanner(projectName: string, modeLabel: string, tagline?: string): string;
288
+ declare function buildReportPrompt(context: string, projectName: string, focus?: string, style?: string, lang?: string): string;
289
+ declare function buildTasksPrompt(context: string, projectName: string, focus?: string, style?: string, lang?: string): string;
290
+ declare function buildCeoPrompt(context: string, projectName: string, focus?: string, lang?: string): string;
291
+ declare function buildBuildPrompt(context: string, projectName: string, focus?: string, lang?: string): string;
292
+ declare function buildPlayerPrompt(context: string, projectName: string, focus?: string, lang?: string): string;
293
+ declare function buildGitPrompt(context: string, projectName: string, focus?: string, lang?: string): string;
294
+ declare function buildApplyPrompt(filePath: string, newContent: string, projectName: string, lang?: string): string;
295
+ /**
296
+ * Assemble the full LLM prompt (context + persona + mandatory sections +
297
+ * ASCII banner + citation rules) for a codebase_* tool — the same text the
298
+ * DeepSeek Harness plugin sends, so MCP clients and the CLI get identical
299
+ * reports. Unknown tool names throw.
300
+ */
301
+ declare function buildToolPrompt(tool: string, opts: ToolPromptOptions): string;
302
+
303
+ 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 ToolPromptOptions, type UnusedExport, analyzeImpact, analyzeProject, brandSignature, buildApplyPrompt, buildAsciiBanner, buildAuditPrompt, buildBuildPrompt, buildCeoPrompt, buildChatPrompt, buildContext, buildCreaPrompt, buildExplainPrompt, buildGitPrompt, buildIndex, buildIntelligencePrompt, buildPlayerPrompt, buildRefactorPrompt, buildReportPrompt, buildSearchPrompt, buildTasksPrompt, buildToolPrompt, chunkByTokens, clearConfigCache, cosineSimilarity, countTokens, disposeTreeSitter, embedIndex, ensureTreeSitterForExt, extractChunks, findProjectRoot, formatHealthReport, formatHealthReportMd, formatImpactReport, formatImpactReportMd, getCacheDir, getChangedFiles, getEmbedding, getEmbeddings, getExtractor, getIndex, globToRegExp, initTreeSitter, langInstruction, loadIndex, loadProjectConfig, matchesAnyGlob, normalizeLabels, resolveProjectPath, saveIndex, scoreChunks, selectChunks, styleInstruction, treeSitterReady, truncateToTokens };