kodevu 0.1.29 → 0.1.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kodevu",
3
- "version": "0.1.29",
3
+ "version": "0.1.30",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Poll SVN revisions or Git commits, send each change diff to a reviewer CLI, and write configurable review reports.",
@@ -13,14 +13,41 @@ export function getReviewWorkspaceRoot(config, backend, targetInfo) {
13
13
  return config.baseDir;
14
14
  }
15
15
 
16
+ function getLanguageDisplayName(lang) {
17
+ if (!lang) return "English";
18
+ const low = lang.toLowerCase();
19
+ if (low.startsWith("zh")) {
20
+ if (low === "zh-tw" || low === "zh-hk") return "Traditional Chinese (繁體中文)";
21
+ return "Simplified Chinese (简体中文)";
22
+ }
23
+ if (low === "jp" || low.startsWith("ja")) return "Japanese (日本語)";
24
+ if (low === "kr" || low.startsWith("ko")) return "Korean (한국어)";
25
+ if (low === "fr") return "French (Français)";
26
+ if (low === "de") return "German (Deutsch)";
27
+ if (low === "es") return "Spanish (Español)";
28
+ if (low === "it") return "Italian (Italiano)";
29
+ if (low === "ru") return "Russian (Русский)";
30
+ return lang;
31
+ }
32
+
16
33
  export function buildPrompt(config, backend, targetInfo, details, reviewDiffPayload) {
17
34
  const fileList = details.changedPaths.map((item) => `${item.action} ${item.relativePath}`).join("\n");
18
35
  const workspaceRoot = getReviewWorkspaceRoot(config, backend, targetInfo);
19
36
  const canReadRelatedFiles = backend.kind === "git" || Boolean(targetInfo.workingCopyPath);
20
37
 
21
- const langInstruction = config.resolvedLang === "zh"
22
- ? "Please use Simplified Chinese for your response."
23
- : `Please use ${config.resolvedLang || "English"} for your response.`;
38
+ const langName = getLanguageDisplayName(config.resolvedLang);
39
+ const lowLang = (config.resolvedLang || "").toLowerCase();
40
+ let langInstruction = `IMPORTANT: Your entire response MUST be in ${langName}. All explanations, comments, and structure should strictly follow the ${langName} language rules.`;
41
+
42
+ if (lowLang.startsWith("zh")) {
43
+ if (lowLang === "zh-tw" || lowLang === "zh-hk") {
44
+ langInstruction += "\n請務必使用繁體中文進行回覆,所有的審查評論和分析都必須以繁體中文呈現。";
45
+ } else {
46
+ langInstruction += "\n请务必使用简体中文进行回复,所有的审查评论和分析都必须以简体中文呈现。";
47
+ }
48
+ }
49
+
50
+
24
51
 
25
52
  return [
26
53
  CORE_REVIEW_INSTRUCTION,
@@ -41,8 +68,18 @@ export function buildPrompt(config, backend, targetInfo, details, reviewDiffPayl
41
68
  `Commit message:\n${details.message || "(empty)"}`,
42
69
  reviewDiffPayload.wasTruncated
43
70
  ? `Diff delivery note: the diff was truncated before being sent to the reviewer to stay within configured size limits. Original diff size was ${reviewDiffPayload.originalLineCount} lines / ${reviewDiffPayload.originalCharCount} chars, and the included excerpt is ${reviewDiffPayload.outputLineCount} lines / ${reviewDiffPayload.outputCharCount} chars. Use the changed file list and inspect related workspace files when needed.`
44
- : `Diff delivery note: the full diff is included. Size is ${reviewDiffPayload.originalLineCount} lines / ${reviewDiffPayload.originalCharCount} chars.`
71
+ : `Diff delivery note: the full diff is included. Size is ${reviewDiffPayload.originalLineCount} lines / ${reviewDiffPayload.originalCharCount} chars.`,
72
+ `--- IMPORTANT LANGUAGE RULE ---\nYou MUST respond strictly in ${langName}. No other language should be used for the explanation and comments.${
73
+ lowLang.startsWith("zh")
74
+ ? lowLang === "zh-tw" || lowLang === "zh-hk"
75
+ ? "\n請務必完全使用繁體中文進行回覆,所有的審查分析、注釋和總結都必須使用繁體中文。"
76
+ : "\n请务必完全使用简体中文进行回复,所有的审查分析、注释和总结都必须使用简体中文。"
77
+ : ""
78
+ }`
79
+
45
80
  ].filter(Boolean).join("\n\n");
81
+
82
+
46
83
  }
47
84
 
48
85
  export function formatTokenUsage(tokenUsage) {