Skip to content

fix: prevent setup --help side effects (#152) - #153

Open
yyiilluu wants to merge 1 commit into
mainfrom
fix/issue-152-setup-help-no-side-effects
Open

fix: prevent setup --help side effects (#152)#153
yyiilluu wants to merge 1 commit into
mainfrom
fix/issue-152-setup-help-no-side-effects

Conversation

@yyiilluu

@yyiilluu yyiilluu commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Handles claude-smart setup --help/-h/help in the Node entrypoint before invoking the destructive setup shell script.
  • Adds a regression test that verifies setup help prints usage, avoids prompts, and does not create setup state directories.

Test Plan

  • uv run --project plugin pytest tests/test_install_scripts.py::test_node_setup_help_prints_usage_without_side_effects -q
  • uv run --project plugin pytest tests/test_install_scripts.py -q
  • npm run build:opencode
  • git diff --check

Fixes #152

Summary by CodeRabbit

  • New Features

    • Added support for setup --help, setup -h, and setup help to display usage information without running setup.
  • Bug Fixes

    • Help requests now exit successfully without producing host-related errors or creating setup files.
  • Tests

    • Added regression coverage to verify help output and ensure no unintended side effects occur.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The setup command now handles --help, -h, and help without running setup. A regression test verifies successful usage output and confirms that no installer state directories are created.

Changes

Setup help handling

Layer / File(s) Summary
Help routing and regression coverage
bin/claude-smart.js, tests/test_install_scripts.py
The CLI prints general help and exits before setup for help arguments. Normal setup passes parsed arguments to runSetup. The regression test checks output, exit status, and absence of .reflexio and .claude-smart side effects.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: wenchanghan, yilu331

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the fix that prevents side effects when running setup help.
Linked Issues check ✅ Passed The change handles setup help flags before setup runs and adds regression coverage for successful, side-effect-free help output [#152].
Out of Scope Changes check ✅ Passed The changes are limited to setup help handling and its regression test, which directly support the linked issue [#152].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-152-setup-help-no-side-effects

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tests/test_install_scripts.py (1)

257-274: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover all supported setup-help forms.

This regression test invokes only --help, but the implementation also supports -h and help. Parameterize the test over all three values so each alias verifies usage output and the absence of side effects.

🤖 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 `@tests/test_install_scripts.py` around lines 257 - 274, Parameterize
test_node_setup_help_prints_usage_without_side_effects over the supported
setup-help arguments --help, -h, and help. Keep the existing assertions for
usage output, successful completion, and absence of .reflexio and .claude-smart
side effects so each alias is validated.
🤖 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.

Nitpick comments:
In `@tests/test_install_scripts.py`:
- Around line 257-274: Parameterize
test_node_setup_help_prints_usage_without_side_effects over the supported
setup-help arguments --help, -h, and help. Keep the existing assertions for
usage output, successful completion, and absence of .reflexio and .claude-smart
side effects so each alias is validated.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ca9b12ce-406f-4ac2-b5f0-2728b97e4106

📥 Commits

Reviewing files that changed from the base of the PR and between 08335bb and bf57ef5.

📒 Files selected for processing (2)
  • bin/claude-smart.js
  • tests/test_install_scripts.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup ignores --help and silently performs a destructive non-idempotent reinstall

1 participant