Conversation
📝 WalkthroughWalkthroughAdds support for alternative CLAUDE.md filenames via a new settings field, UI for managing alt names, a patch implementation that injects fallback filename lookup into CLAUDE.md readers, and documentation describing patch creation and registration workflows. Changes
Sequence DiagramsequenceDiagram
actor User
participant App as App.tsx
participant Menu as MainMenu
participant View as ClaudeMdAltNamesView
participant Context as SettingsContext
participant Patcher as PatchSystem
participant Writer as writeAgentsMd()
User->>App: open app
App->>Menu: render menu
User->>Menu: select CLAUDE_MD_ALT_NAMES
Menu->>App: navigate to view
App->>View: render ClaudeMdAltNamesView
User->>View: add/edit/delete alt name
View->>Context: update claudeMdAltNames
Context->>Patcher: settings changed (claudeMdAltNames)
Patcher->>Writer: apply agents-md patch with altNames
Writer->>Writer: locate CLAUDE.md reader pattern
Writer->>Writer: inject alt-name lookup logic
Writer->>Patcher: return patched file
Patcher->>Patcher: persist patched file
Patcher->>View: changes persisted
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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: 2
🤖 Fix all issues with AI agents
In @.claude/skills/patch-creation/SKILL.md:
- Around line 188-191: The example regex is too permissive—update the pattern
variable (currently defined as /(\someConfig\s*=\s*)\d+/) to a whitespace-free,
minified-friendly form (e.g., match "someConfig=" directly) so the replacement
only targets minified code; adjust the pattern symbol name `pattern` and ensure
the `file.match(pattern)` usage still captures the same group for replacement.
In `@README.md`:
- Around line 422-429: The example JSON for settings.claudeMdAltNames includes
an invalid empty string filename; update the example list used in the README
(the JSON block showing "settings": { "claudeMdAltNames": [...] }) to remove the
empty string so only valid filenames remain (e.g., ["AGENTS.md", "context.md"]).
🧹 Nitpick comments (2)
src/patches/agentsMd.ts (1)
159-177: Consider making the fallback pattern more specific.The fallback pattern
/(\})(}catch)/is quite generic and could potentially match unintended locations within the function body if there are nested structures with}}catch. While limiting the search tofile.slice(funcStart)helps, a more specific pattern could improve robustness.That said, given the documented examples and that this is a fallback for older CC versions, this may be acceptable as-is if it works reliably in practice.
src/ui/components/ClaudeMdAltNamesView.tsx (1)
70-82: Stale closure on delete index adjustment.After
updateSettingsremoves an item,altNamesstill reflects the old state within this render cycle. The adjustment logic on lines 79-81 usesaltNames.length - 1(the pre-deletion length), which may setselectedIndexone position higher than intended.For example, if you have 3 items and delete the last one (index 2),
altNames.length - 1is still 2, soselectedIndex >= 2is true, and it gets set toMath.max(0, 3 - 2) = 1, which is correct. However, the logic is fragile if the timing changes.Consider using the length after deletion for clarity:
♻️ Suggested improvement
} else if (input === 'd') { // Delete if (altNames.length > 0) { + const newLength = altNames.length - 1; updateSettings(s => { if (!s.claudeMdAltNames) return; s.claudeMdAltNames = s.claudeMdAltNames.filter( (_, index) => index !== selectedIndex ); }); - if (selectedIndex >= altNames.length - 1) { - setSelectedIndex(Math.max(0, altNames.length - 2)); + if (selectedIndex >= newLength) { + setSelectedIndex(Math.max(0, newLength - 1)); } }
This PR makes Claude Code automatically use
AGENTS.mdifCLAUDE.mddoesn't exist. No hooks or prompts required. Just runnpx tweakcc@latest --apply.Closes #391
Closes anthropics/claude-code#6235
You can even add custom file names to be used when
CLAUDE.mddoesn't exist.