dsh-codebase-chat 0.23.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/lib/index.js CHANGED
@@ -17,9 +17,11 @@ import {
17
17
  let analyzeProject;
18
18
  let formatHealthReport;
19
19
  let getChangedFiles;
20
+ let analyzeImpact;
21
+ let formatImpactReport;
20
22
  try {
21
- ({ analyzeProject, formatHealthReport, getChangedFiles } = await import("../dist/index.js"));
22
- } catch { analyzeProject = undefined; formatHealthReport = undefined; getChangedFiles = undefined; }
23
+ ({ analyzeProject, formatHealthReport, getChangedFiles, analyzeImpact, formatImpactReport } = await import("../dist/index.js"));
24
+ } catch { analyzeProject = undefined; formatHealthReport = undefined; getChangedFiles = undefined; analyzeImpact = undefined; formatImpactReport = undefined; }
23
25
 
24
26
  let defineTool;
25
27
  let createUserMessage;
@@ -33,14 +35,12 @@ try {
33
35
  const name = "codebase-chat";
34
36
  const inject = ["tools", "commands", "agents", "systemPrompt"];
35
37
 
36
- const VERSION = "0.19.0";
38
+ const VERSION = "0.23.0";
37
39
  const execAsync = promisify(exec);
38
40
 
39
- const PROTECTED_PATHS = [
40
- ...(process.env.DSH_PROTECTED_PATHS ? process.env.DSH_PROTECTED_PATHS.split(/[;|]/).map((p) => p.trim()).filter(Boolean) : []),
41
- "C:\\Users\\shinzarou-eng\\Downloads\\marketing-session-app",
42
- "marketing-session-app"
43
- ];
41
+ const PROTECTED_PATHS = process.env.DSH_PROTECTED_PATHS
42
+ ? process.env.DSH_PROTECTED_PATHS.split(/[;|]/).map((p) => p.trim()).filter(Boolean)
43
+ : [];
44
44
 
45
45
  // Per-project config: .codebase-chat.json at the project root.
46
46
  const projectConfigCache = new Map();
@@ -2268,6 +2268,32 @@ function apply(ctx) {
2268
2268
  }
2269
2269
  );
2270
2270
 
2271
+ registerTool(
2272
+ tools,
2273
+ "codebase_impact",
2274
+ "Blast-radius analysis: which files transitively depend on a target file — what breaks if it changes. Deterministic, returns findings directly, no LLM needed. Use for 'impact', 'what breaks', 'dependents', 'who imports X' requests.",
2275
+ {
2276
+ projectPath: { type: "string", description: "Absolute local path to the project folder. If omitted, the project root is auto-detected from the current working directory." },
2277
+ file: { type: "string", description: "File to analyze — relative path or name (e.g. 'src/store.ts'). Required." },
2278
+ lang: { type: "string", description: "Report language: 'fr' (default) or 'en'." }
2279
+ },
2280
+ (value) => value.markdown || "No report generated.",
2281
+ async (args, exec) => {
2282
+ if (!analyzeImpact) throw new Error("Static analysis module not available.");
2283
+ const projectPath = await resolveProjectPath(args.projectPath);
2284
+ const file = String(args.file || "").trim();
2285
+ if (!file) throw new Error("Missing `file` argument (e.g. 'src/store.ts').");
2286
+ const r = await analyzeImpact(projectPath, file);
2287
+ if (!r.ok) {
2288
+ const msg = r.candidates.length
2289
+ ? `Cible ambiguë "${file}" — candidats : ${r.candidates.join(', ')}`
2290
+ : `Aucun fichier de code ne correspond à "${file}".`;
2291
+ return { projectName: basename(projectPath), lang: args.lang || "fr", markdown: msg };
2292
+ }
2293
+ return { projectName: basename(r.report.projectPath), lang: args.lang || "fr", markdown: formatImpactReport(r.report, args.lang === "en" ? "en" : "fr") };
2294
+ }
2295
+ );
2296
+
2271
2297
  registerTool(
2272
2298
  tools,
2273
2299
  "codebase_intelligence",
@@ -2541,6 +2567,28 @@ function apply(ctx) {
2541
2567
  }
2542
2568
  });
2543
2569
 
2570
+ commands.register({
2571
+ name: "codebase-impact",
2572
+ description: "Analyse d'impact : quels fichiers dépendent de X (rayon d'impact). /codebase-impact <fichier> --project <chemin> [--lang en|fr]",
2573
+ input: { hint: "<fichier>, --project <chemin>, --lang <en|fr>" },
2574
+ async handler(invocation) {
2575
+ if (!analyzeImpact) return { kind: "error", text: "Module d'analyse statique indisponible (build dist manquant)." };
2576
+ const { rawInput } = invocation;
2577
+ const { projectPath, query, filePath, lang } = parseCodebaseInput(rawInput.trim());
2578
+ const file = (filePath || query || "").trim();
2579
+ if (!file) return { kind: "error", text: "Précise un fichier : /codebase-impact src/store.ts" };
2580
+ const absProject = await resolveProjectPath(projectPath);
2581
+ const r = await analyzeImpact(absProject, file);
2582
+ if (!r.ok) {
2583
+ const msg = r.candidates.length
2584
+ ? `Cible ambiguë "${file}" — candidats :\n ${r.candidates.join("\n ")}`
2585
+ : `Aucun fichier de code ne correspond à "${file}".`;
2586
+ return { kind: "error", text: msg };
2587
+ }
2588
+ return { kind: "success", text: formatImpactReport(r.report, lang === "en" ? "en" : "fr") };
2589
+ }
2590
+ });
2591
+
2544
2592
  commands.register({
2545
2593
  name: "codebase-intel",
2546
2594
  description: "Brief d'Intelligence Pro : architecture, graphe de modules, data flow, risques, opportunités et créa. /codebase-intel --project <chemin> [focus] [--style <ouf|punchy|dense|pedagogique|minimal>]",
@@ -2725,7 +2773,7 @@ function apply(ctx) {
2725
2773
  systemPrompt?.section?.({
2726
2774
  name: "codebase-chat",
2727
2775
  order: 130,
2728
- text: `You have access to a powerful codebase plugin (dsh-codebase-chat v${VERSION}). When the user asks about code, files, project structure, architecture, how something works, where something is, or wants to search/explain/refactor/audit/report on code, use the appropriate tool: codebase_chat, codebase_search, codebase_explain, codebase_refactor, codebase_crea, codebase_intelligence, codebase_audit, codebase_report, codebase_ceo, codebase_tasks, codebase_build, codebase_git, codebase_apply, codebase_health, or codebase_player. codebase_health runs a deterministic static analysis (circular deps, dead code, duplication, complexity, health score) and returns findings directly — prefer it when the user asks for measurable code quality. codebase_intelligence is the premium auto-mode: it builds a structured context and asks for a professional, stylish intelligence brief. codebase_ceo is the one-page executive brief: metrics, score cards, top risks, top opportunities, SWOT, killer move, perfect for a board or investor. codebase_audit is the dedicated non-conformity and tech-debt auditor. codebase_report is the executive strategic report: a beautiful, visual, deep assessment (SWOT, score cards, 90-day roadmap, marketing) perfect for boards or clients. codebase_player is the UX / playthrough / player perspective brief: user journey, onboarding, friction, wow moments, gamification, and score cards from a user's point of view.\n\nIf the user asks for raw tasks, a TASKS.md with Avant/Après code blocks, or uses --raw, call codebase_tasks with raw=true. It writes TASKS.md directly in the project and returns the path/content. If the user asks to apply the plan, run the fixes, or says 'apply tasks', call codebase_apply_tasks. Use dryRun=true only if the user asks for a simulation or dry-run. If the user confirms or says 'apply', 'execute', 'yes', or 'oui', call with dryRun=false and apply the patches.\n\nIf no project path is given, first attempt to auto-detect the project root from the current working directory (cwd). Auto-detection walks up the tree looking for package.json, .git or tsconfig.json. Do NOT fall back to any known project (including the 'Dako' alias) unless the user explicitly mentions it. The only recognized alias is 'Dako' for the path 'D:\\Nouveau dossier'; use it only when the user explicitly says 'Dako' or uses --project Dako. If auto-detection fails and no explicit path is provided, ask the user for the path. Always answer in the same language as the user's message. If the user wants a creative idea at the end, set crea=true or use codebase_crea. Users may also use slash commands /codebase, /codebase-search, /codebase-explain, /codebase-refactor, /codebase-crea, /codebase-intel, /codebase-audit, /codebase-report, /codebase-ceo, /codebase-tasks, /codebase-tasks-raw, /codebase-apply-tasks, /codebase-build, /codebase-git, /codebase-apply, /codebase-player.`
2776
+ text: `You have access to a powerful codebase plugin (dsh-codebase-chat v${VERSION}). When the user asks about code, files, project structure, architecture, how something works, where something is, or wants to search/explain/refactor/audit/report on code, use the appropriate tool: codebase_chat, codebase_search, codebase_explain, codebase_refactor, codebase_crea, codebase_intelligence, codebase_audit, codebase_report, codebase_ceo, codebase_tasks, codebase_build, codebase_git, codebase_apply, codebase_health, codebase_impact, or codebase_player. codebase_health runs a deterministic static analysis (circular deps, dead code, duplication, complexity, health score) and returns findings directly. codebase_impact computes the blast radius of a file which files transitively depend on it — deterministic, no LLM — prefer it when the user asks for measurable code quality. codebase_intelligence is the premium auto-mode: it builds a structured context and asks for a professional, stylish intelligence brief. codebase_ceo is the one-page executive brief: metrics, score cards, top risks, top opportunities, SWOT, killer move, perfect for a board or investor. codebase_audit is the dedicated non-conformity and tech-debt auditor. codebase_report is the executive strategic report: a beautiful, visual, deep assessment (SWOT, score cards, 90-day roadmap, marketing) perfect for boards or clients. codebase_player is the UX / playthrough / player perspective brief: user journey, onboarding, friction, wow moments, gamification, and score cards from a user's point of view.\n\nIf the user asks for raw tasks, a TASKS.md with Avant/Après code blocks, or uses --raw, call codebase_tasks with raw=true. It writes TASKS.md directly in the project and returns the path/content. If the user asks to apply the plan, run the fixes, or says 'apply tasks', call codebase_apply_tasks. Use dryRun=true only if the user asks for a simulation or dry-run. If the user confirms or says 'apply', 'execute', 'yes', or 'oui', call with dryRun=false and apply the patches.\n\nIf no project path is given, first attempt to auto-detect the project root from the current working directory (cwd). Auto-detection walks up the tree looking for package.json, .git or tsconfig.json. Do NOT fall back to any known project (including the 'Dako' alias) unless the user explicitly mentions it. The only recognized alias is 'Dako' for the path 'D:\\Nouveau dossier'; use it only when the user explicitly says 'Dako' or uses --project Dako. If auto-detection fails and no explicit path is provided, ask the user for the path. Always answer in the same language as the user's message. If the user wants a creative idea at the end, set crea=true or use codebase_crea. Users may also use slash commands /codebase, /codebase-search, /codebase-explain, /codebase-refactor, /codebase-crea, /codebase-intel, /codebase-audit, /codebase-report, /codebase-ceo, /codebase-tasks, /codebase-tasks-raw, /codebase-apply-tasks, /codebase-build, /codebase-git, /codebase-apply, /codebase-impact, /codebase-player.`
2729
2777
  });
2730
2778
 
2731
2779
  function sameOrigin(req) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-codebase-chat",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Multi-language codebase intelligence for DeepSeek Harness and MCP-compatible IDEs: chat, search, audit, refactor, and board-ready reports from local code.",
5
5
  "homepage": "https://shinzarou-eng.github.io/dsh-codebase-chat",
6
6
  "repository": {
@@ -11,6 +11,9 @@
11
11
  "url": "https://github.com/shinzarou-eng/dsh-codebase-chat/issues"
12
12
  },
13
13
  "type": "module",
14
+ "engines": {
15
+ "node": ">=20"
16
+ },
14
17
  "main": "./dist/index.js",
15
18
  "types": "./dist/index.d.ts",
16
19
  "bin": {