fix(update): use claude plugin update with reinstall fallback#136
fix(update): use claude plugin update with reinstall fallback#136yyiilluu wants to merge 1 commit into
claude plugin update with reinstall fallback#136Conversation
`npx claude-smart update` (Claude Code host) previously stopped services and ran a full reinstall. Use Claude Code's own plugin update path instead: `claude plugin marketplace add` then `claude plugin update`, falling back to the stop+reinstall flow only if the update subcommand fails. Mirrored across the Node (`runUpdate`) and Python (`cmd_update`) entrypoints, and factored the shared post-update bootstrap into `bootstrapClaudeCodeRuntime` / `_finish_claude_code_install`. Check for the `claude` CLI before stopping the backend/dashboard so a missing-CLI abort no longer leaves services stopped.
📝 WalkthroughWalkthroughClaude Code updates now use marketplace/plugin update commands, stop services before updating, fall back to reinstall on failure, and share runtime bootstrap finalization across install and update paths. Tests cover the new command sequences and recovery behavior. ChangesClaude Code update and installation
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bin/claude-smart.js`:
- Around line 2166-2181: Move stopClaudeSmartServices in bin/claude-smart.js to
after successful marketplace registration; reorder marketplace registration
before dashboard/backend shutdown in plugin/src/claude_smart/cli.py; update
tests/test_cli_install.py to expect the new ordering and verify marketplace-add
failure leaves services running.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e446b266-ce59-4bab-9ebf-a05f6fd0e3a5
📒 Files selected for processing (4)
bin/claude-smart.jsplugin/src/claude_smart/cli.pytests/test_cli_install.pytests/test_install_scripts.py
| const pluginRoot = findClaudeCodePluginRoot(); | ||
| if (pluginRoot) { | ||
| stopClaudeSmartServices(pluginRoot); | ||
| } | ||
| process.stdout.write("Updating claude-smart by reinstalling from this package...\n"); | ||
| await runInstall(args, { retryInstallAfterUninstall: true }); | ||
|
|
||
| const setup = configureReflexioSetup(HOST_CLAUDE_CODE); | ||
| process.stdout.write("Updating claude-smart from this package...\n"); | ||
| let code = await runClaude(["plugin", "marketplace", "add", PACKAGE_ROOT], { | ||
| spinnerLabel: "Adding marketplace…", | ||
| }); | ||
| if (code !== 0) { | ||
| process.stderr.write( | ||
| `error: \`claude plugin marketplace add ${PACKAGE_ROOT}\` failed (exit ${code})\n`, | ||
| ); | ||
| process.exit(code); | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Avoid taking services offline before marketplace registration succeeds.
Both implementations exit on marketplace-add failure without restoring the services they already stopped.
bin/claude-smart.js#L2166-L2181: movestopClaudeSmartServicesafter successful marketplace registration.plugin/src/claude_smart/cli.py#L1645-L1666: run marketplace registration before stopping dashboard/backend services.tests/test_cli_install.py#L480-L485: update the expected ordering and cover marketplace-add failure without service shutdown.
📍 Affects 3 files
bin/claude-smart.js#L2166-L2181(this comment)plugin/src/claude_smart/cli.py#L1645-L1666tests/test_cli_install.py#L480-L485
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bin/claude-smart.js` around lines 2166 - 2181, Move stopClaudeSmartServices
in bin/claude-smart.js to after successful marketplace registration; reorder
marketplace registration before dashboard/backend shutdown in
plugin/src/claude_smart/cli.py; update tests/test_cli_install.py to expect the
new ordering and verify marketplace-add failure leaves services running.
What
npx claude-smart update(Claude Code host) previously stopped services and ran a full reinstall. This switches it to Claude Code's own plugin-update path:claude plugin marketplace add <package root>claude plugin update claude-smart@reflexioaiplugin updatesubcommand fails.Mirrored across both entrypoints — Node (
runUpdate) and Python (cmd_update) — and the shared post-update bootstrap is factored intobootstrapClaudeCodeRuntime(Node) /_finish_claude_code_install(Python).Also
claudeCLI existence check now runs before stopping the backend/dashboard, so a missing-CLI abort no longer leaves services stopped.Testing
pytest tests/test_cli_install.py— 23 passedtests/test_install_scripts.py— passedbiome check bin/claude-smart.jsclean;ruff checkon changed Python shows only pre-existing default-ruleset noise (S101/S603)Release note
Sits on top of
Release v0.2.50(version-only bump). Publish 0.2.50 from this HEAD so the release contains this feature.Summary by CodeRabbit
New Features
Bug Fixes
Tests