fix(init): install gitignore for runtime artifacts#15
fix(init): install gitignore for runtime artifacts#15bcokdilli wants to merge 5 commits intokomunite:mainfrom
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe pull request refactors the template initialization system to support source-to-destination file mappings via configuration objects, and introduces a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f70e04458e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "CLAUDE.md", | ||
| { source: ".claude", destination: ".claude" }, | ||
| { source: "CLAUDE.md", destination: "CLAUDE.md" }, | ||
| { source: "templates/gitignore", destination: ".gitignore" }, |
There was a problem hiding this comment.
Prevent
--force from clobbering existing .gitignore
Adding .gitignore to TEMPLATE_ITEMS makes it subject to the generic overwrite path, so kalfa init --force now replaces any existing project .gitignore with the minimal template via copyRecursive/fs.copyFileSync. In repos that already have ignore rules, this can silently drop critical patterns (for secrets, build outputs, etc.) when users only intended to refresh Kalfa files, creating a real risk of noisy or unsafe commits.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d237e0d06a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| .map((line) => line.trim()) | ||
| .filter((line) => line.length > 0), | ||
| ); | ||
| const missingEntries = desiredEntries.filter((entry) => !existingEntries.has(entry)); |
There was a problem hiding this comment.
Respect existing unignore rules when merging .gitignore
The merge check only looks for exact matches of each template entry, so an existing negation like !.claude/logs/ is treated as "missing" and .claude/logs/ gets appended anyway. Because .gitignore uses last-match-wins semantics, appending the positive rule at the end overrides the user’s prior unignore rule and silently changes ignore behavior, which contradicts the intent to preserve existing rules.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 356e99f466
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function hasGitignoreRule(existingEntries, entry) { | ||
| return existingEntries.has(entry) || existingEntries.has(`!${entry}`); |
There was a problem hiding this comment.
Recognize anchored unignore rules in gitignore merge
hasGitignoreRule only matches exact entry and !${entry} strings, so existing root-anchored negations like !/.claude/logs/ are treated as missing. In that case mergeGitignore appends .claude/logs/ later in the file, and because .gitignore uses last-match-wins semantics, the appended rule overrides the user’s unignore and changes tracking behavior after kalfa init.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12a05f5591
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| return; | ||
| } | ||
| results.skipped.push(destinationPath); |
There was a problem hiding this comment.
Merge runtime ignores into existing .gitignore
mergeGitignore unconditionally skips when .gitignore already exists, so kalfa init never adds the new runtime patterns (.claude/logs/, .claude/agent-memory/, etc.) for the common upgrade path where projects already have a .gitignore. That means users rerunning init in existing repos still see Kalfa runtime artifacts as untracked changes, which defeats the intended fix outside brand-new directories.
Useful? React with 👍 / 👎.
Summary
.gitignoreduringkalfa init.claude/logs/,.claude/agent-memory/, and.claude/backups/.gitignoreWhy
Fresh installs were leaving Kalfa runtime files as untracked changes in the target project. This surfaced during
/statussmoke testing and makes a clean baseline harder to get afterinit.Validation
.claude/logs/*after init and confirmedgit statusstayed cleanSummary by CodeRabbit
New Features
.gitignorefile configured to exclude runtime artifacts, including logs, agent memory, backups, and related cache files.Tests
.gitignorecreation and validate its content during the initialization process.