fix: add code--zh-tw.json mode file for Traditional Chinese (#1364)#1669
fix: add code--zh-tw.json mode file for Traditional Chinese (#1364)#1669ousamabenyounes wants to merge 5 commits intothedotmack:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
Summary by CodeRabbit
WalkthroughAdds a Traditional Chinese mode file and tests, normalizes mode IDs to lowercase in ModeManager (with a new helper), and updates worker-service to use the normalized mode ID when deciding a one-time Chroma wipe. Changes
Sequence Diagram(s)mermaid Client->>ModeManager: loadMode("code--zh-TW") Settings->>WorkerService: provide CLAUDE_MEM_MODE Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@plugin/modes/code--zh-tw.json`:
- Around line 1-24: The mode ID casing mismatch allows a configured modeId like
code--zh-TW to miss the existing file code--zh-tw.json because loadModeFile
resolves `${modeId}.json` verbatim; update the lookup in loadModeFile to
normalize mode IDs (e.g., toLowerCase() or a canonical form) before building the
filename or add a compatibility alias lookup (try `${modeId}.json` then
`${normalizedModeId}.json` and also check for common variants such as swapping
region case) so both code--zh-tw.json and code--zh-TW.json map correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c3704b64-9647-4f08-a95b-dfbb452cea34
📒 Files selected for processing (2)
plugin/modes/code--zh-tw.jsontests/utils/mode-zh-tw.test.ts
…ck#1364) code--zh-TW mode was silently falling back to code--zh (Simplified Chinese) because code--zh-tw.json did not exist. Added the mode file with Traditional Chinese placeholders and explicit 繁體中文 language requirements, using traditional characters like 設定、檔案、開發 rather than simplified equivalents. Generated by Claude Code Vibe coded by ousamabenyounes Co-Authored-By: Claude <noreply@anthropic.com>
…ck (thedotmack#1364) On case-sensitive filesystems, CLAUDE_MEM_MODE=code--zh-TW failed to find code--zh-tw.json and silently fell back to code--zh (Simplified Chinese). - ModeManager.loadMode() now normalizes modeId to lowercase before any file lookup, so code--zh-TW, code--zh-Tw, and code--zh-tw all resolve to code--zh-tw.json - Added 4 regression tests: confirms no mixed-case alias file exists, and that ModeManager handles uppercase/mixed-case mode IDs correctly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23bda78 to
c1452f3
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/services/domain/ModeManager.ts`:
- Around line 134-136: The code currently lowercases mode IDs inside
ModeManager.loadMode (normalizedId = modeId.toLowerCase()), which causes
inconsistent behavior when callers compare raw mode strings before calling
loadMode; add a single public utility (e.g., ModeManager.normalizeModeId) that
performs the normalization (lowercasing and any canonicalization) and update all
call sites (for example where worker-service checks 'local') to call
ModeManager.normalizeModeId(...) before any comparisons, and keep loadMode
calling normalizeModeId internally for safety; update usages of
parseInheritance/normalizedId to use the new normalizeModeId so behavior is
consistent across the codebase.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4a40c7fd-9d55-406d-8b99-cfca21236138
📒 Files selected for processing (3)
plugin/modes/code--zh-tw.jsonsrc/services/domain/ModeManager.tstests/utils/mode-zh-tw.test.ts
✅ Files skipped from review due to trivial changes (1)
- plugin/modes/code--zh-tw.json
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/utils/mode-zh-tw.test.ts
…tw suite Removes repeated join(MODES_DIR, ...) and readFileSync calls across 4 it blocks by hoisting modePath as a const and populating content via beforeEach. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/utils/mode-zh-tw.test.ts`:
- Around line 22-27: The existsSync assertion is currently masked by the
beforeEach reading the file (readFileSync(modePath, 'utf-8')) which throws if
the file is missing; move the file read out of the global beforeEach so the
existence test can run independently: keep or create a beforeEach for tests that
need file content (assigning content = readFileSync(modePath, 'utf-8')) but
remove that read from the global setup used by the 'code--zh-tw.json exists in
plugin/modes/' test, leaving that test to only call existsSync(modePath) and
only read into the content variable inside tests that require the file.
- Around line 55-59: The test 'code--zh-TW.json does NOT exist (only lowercase
filename is canonical)' uses existsSync(upperPath) which is unreliable on
case-insensitive filesystems; update the assertion to read the directory entries
via readdirSync(MODES_DIR) and assert that the exact filename 'code--zh-TW.json'
is not present (e.g., entries.includes('code--zh-TW.json') is false),
referencing MODES_DIR, join, and the test name to locate and replace the
existsSync check.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 506e731e-1318-4c58-bc01-f1da6e070c14
📒 Files selected for processing (1)
tests/utils/mode-zh-tw.test.ts
…ync for case check - Guard readFileSync in beforeEach with existsSync so the file-existence test can assert independently without throwing first - Replace existsSync(upperPath) with readdirSync exact-name check — existsSync is unreliable on case-insensitive filesystems (macOS/Windows) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
CodeRabbit review request: centralise lowercase normalisation behind a public static so all call sites share the same canonicalisation logic. - Add ModeManager.normalizeModeId(modeId) → modeId.toLowerCase() - loadMode() delegates to normalizeModeId instead of inline .toLowerCase() - worker-service.ts 'local' comparison now uses normalizeModeId so LOCAL or Local settings values are handled consistently Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Closed during the April 2026 backlog cleanup. The underlying bug is now tracked in #1961, which is the single canonical issue being addressed by the maintainer. Thanks for taking the time to report — your symptoms and repro are captured in the consolidated ticket. |
Summary
Fixes #1364
Setting
CLAUDE_MEM_MODEtocode--zh-TW(orcode--zh-tw) fell back silently tocode--zh(Simplified Chinese) becausecode--zh-tw.jsonwas missing fromplugin/modes/. The new file:繁體中文 (Traditional Chinese)in all language requirement sectionscode--zh.json,code--ja.json)Usage: set
"CLAUDE_MEM_MODE": "code--zh-tw"in~/.claude-mem/settings.json(lowercase, consistent with other language modes).Verification
tests/utils/mode-zh-tw.test.tsverifying file exists, Traditional Chinese characters present, 繁體中文 language requirement, valid JSON structurefooter,xml_title_placeholder,xml_narrative_placeholder,continuation_instruction,summary_footerFiles changed
plugin/modes/code--zh-tw.jsontests/utils/mode-zh-tw.test.tsGenerated by Claude Code
Vibe coded by ousamabenyounes