Add eject command to decouple from update mechanism#2
Conversation
Adds /5:eject command that sets ejected flag in .5/version.json. When ejected, update checks, statusline indicators, /5:update, and --upgrade installs are all skipped. Reversible by removing the ejected field from version.json. https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
|
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. 📝 WalkthroughWalkthroughA new Changes
Sequence DiagramsequenceDiagram
participant User
participant Eject as 5:eject Command
participant FileSystem as File System
participant SettingsFile as .claude/settings.json
User->>Eject: Invoke 5:eject
Eject->>FileSystem: Read .5/version.json
alt File exists
FileSystem-->>Eject: Version data
Eject->>User: Request confirmation<br/>(show files to be deleted)
alt User confirms
User-->>Eject: Confirmed
Eject->>FileSystem: Delete update files<br/>(.5/ directory, hooks, cache)
FileSystem-->>Eject: Deleted
Eject->>SettingsFile: Read settings
SettingsFile-->>Eject: Settings data
Eject->>Eject: Remove check-updates.js<br/>from hooks.SessionStart
Eject->>SettingsFile: Write updated settings
SettingsFile-->>Eject: Written
Eject->>User: Report success<br/>(show version, reinstall command)
else User cancels
User-->>Eject: Cancelled
Eject->>User: Abort
end
else File not found
FileSystem-->>Eject: Not found
Eject->>User: Report: Already ejected
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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.
🧹 Nitpick comments (2)
src/hooks/check-updates.js (1)
42-45: Consider strict equality check for consistency.The check uses truthy evaluation (
if (versionData.ejected)), whilebin/install.js(line 86) uses strict equality (data.ejected === true). For consistency across the codebase and to guard against unexpected truthy values, consider aligning with the stricter pattern.Suggested change
// Skip if ejected - if (versionData.ejected) { + if (versionData.ejected === true) { process.exit(0); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/check-updates.js` around lines 42 - 45, Change the loose truthy check on versionData.ejected to a strict boolean comparison: replace the if (versionData.ejected) branch with if (versionData.ejected === true) to match the pattern used elsewhere (e.g., bin/install.js) so the ejected check only triggers on an explicit true value; update the conditional around process.exit(0) accordingly in the file containing the versionData.ejected check.src/hooks/statusline.js (1)
53-68: Consider strict equality check for consistency.Same observation as in
check-updates.js: this uses truthy evaluation whilebin/install.jsusesdata.ejected === true. For consistency, consider usingversionData.ejected !== trueinstead.Suggested change
// Skip update indicator if ejected - if (!versionData.ejected) { + if (versionData.ejected !== true) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/hooks/statusline.js` around lines 53 - 68, Replace the truthy negation check for ejection with a strict boolean comparison: in the block that reads cacheFile and sets updateIndicator, change the condition from if (!versionData.ejected) to if (versionData.ejected !== true) so it matches the explicit style used elsewhere (refer to the symbol versionData.ejected), leaving the rest of the logic that reads cacheFile, parses latest, compares via compareVersions(installed, latest) and sets updateIndicator unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/hooks/check-updates.js`:
- Around line 42-45: Change the loose truthy check on versionData.ejected to a
strict boolean comparison: replace the if (versionData.ejected) branch with if
(versionData.ejected === true) to match the pattern used elsewhere (e.g.,
bin/install.js) so the ejected check only triggers on an explicit true value;
update the conditional around process.exit(0) accordingly in the file containing
the versionData.ejected check.
In `@src/hooks/statusline.js`:
- Around line 53-68: Replace the truthy negation check for ejection with a
strict boolean comparison: in the block that reads cacheFile and sets
updateIndicator, change the condition from if (!versionData.ejected) to if
(versionData.ejected !== true) so it matches the explicit style used elsewhere
(refer to the symbol versionData.ejected), leaving the rest of the logic that
reads cacheFile, parses latest, compares via compareVersions(installed, latest)
and sets updateIndicator unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2892f2bb-3fa1-4233-9d1e-e706c982c06f
📒 Files selected for processing (5)
bin/install.jssrc/commands/5/eject.mdsrc/commands/5/update.mdsrc/hooks/check-updates.jssrc/hooks/statusline.js
Eject now permanently removes update-related files: - .claude/hooks/check-updates.js - .claude/commands/5/update.md and eject.md - .5/version.json and .update-cache.json - check-updates hook entry from settings.json Reverts the flag-based approach (ejected field in version.json). To restore updates after eject, reinstall with npx 5-phase-workflow. https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
Documents /5:eject in the commands table, project structure, and a new Ejecting subsection under Updating. https://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
Summary
/5:ejectcommand that permanently removes update infrastructure from the installationcheck-updates.jshook,update.mdcommand,eject.mdcommand,version.json,.update-cache.jsoncheck-updates.jshook entry from.claude/settings.jsonnpx 5-phase-workflowTest plan
npm test— all existing tests pass/5:ejectand verify all update files are deletedsettings.jsonno longer contains check-updates hook entrynpx 5-phase-workflowrestores full functionalityhttps://claude.ai/code/session_01UTjW3dbQ44EZmQtuNj9GUM
Summary by CodeRabbit
New Features
5:ejectcommand enabling permanent removal of the update mechanism from installations, with automatic cleanup of related files and settings, user confirmation, and reinstallation instructions.Documentation