Skip to content

feat(install): add --dry-run and --help flags to install.sh#19

Open
Arvuno wants to merge 3 commits into
withkynam:mainfrom
Arvuno:feat/arvuno/install-dry-run-flag
Open

feat(install): add --dry-run and --help flags to install.sh#19
Arvuno wants to merge 3 commits into
withkynam:mainfrom
Arvuno:feat/arvuno/install-dry-run-flag

Conversation

@Arvuno

@Arvuno Arvuno commented Jun 17, 2026

Copy link
Copy Markdown

The installer unconditionally copies files, creates symlinks, and removes any existing .claude / .codex / .agents directories. There was no way to preview the plan before running it for real, which made the script hard to evaluate in CI smoke checks and awkward for humans who want to see what would change.

This change adds two flags:

  • --dry-run: parse the manifest, count files/skills/hooks, and print the install summary without touching the working tree. Backups, copies, symlink creation, and the .vc-installed-files / .vc-version writes are all skipped.
  • --help: print usage and exit 0.
  • Unknown arguments: print an error to stderr and exit 64 (EX_USAGE) so calling scripts can detect bad input.

No behavior change for the default invocation (no flags). The exit status from a successful dry-run is 0, matching the success path of the real installer.

Summary by CodeRabbit

  • New Features
    • Added --dry-run mode to preview installation changes without making actual modifications.
    • Dry-run mode displays backup operations, file copies, and symlink creation that would be performed.
    • Added help option (-h) to display usage information.
    • Installation summary now uses improved counting method for better accuracy.

Typo Fix Bot and others added 3 commits June 5, 2026 06:02
The install summary was using `ls`/`wc` on the destination filesystem to
count agents, skills, and hooks. That undercounts because the kit ships
the same content under both `.claude/` and `.codex/`, and the previous
counter only walked `.claude/`. The summary also claimed
"(Claude Code + Codex)" while only counting Claude.

Drive the counts off `$FILES`, the resolver output that the install loop
just wrote to `.vc-installed-files`. That output is the authoritative
list of what the manifest produced, so the summary now matches reality
across both runtimes and is independent of `ls`/`wc` quirks on the host.

Smoke-tested the regex on a small fixture:
  AGENT=3 (matches .claude/agents/* + .codex/agents/*)
  SKILL=3 (matches SKILL.md anywhere)
  HOOK=3 (matches top-level *.cjs under any hooks/ dir)
`set -o pipefail` was aborting the installer when a category had no
matches. Append `|| true` to the grep stage so `wc -l` can still report 0.

Reported-by: CodeRabbit review (PR withkynam#17, major)
The installer unconditionally copies files, creates symlinks, and
removes any existing .claude / .codex / .agents directories. There
was no way to preview the plan before running it for real, which
made the script hard to evaluate in CI smoke checks and awkward for
humans who want to see what would change.

This change adds two flags:
- --dry-run: parse the manifest, count files/skills/hooks, and print
  the install summary without touching the working tree. Backups,
  copies, symlink creation, and the .vc-installed-files / .vc-version
  writes are all skipped.
- --help: print usage and exit 0.
- Unknown arguments: print an error to stderr and exit 64 (EX_USAGE)
  so calling scripts can detect bad input.

No behavior change for the default invocation (no flags). The exit
status from a successful dry-run is 0, matching the success path of
the real installer.
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

install.sh gains a --dry-run flag. Argument parsing sets a DRY_RUN variable and prints a banner. All write operations—backup directory creation, file copying, symlink creation, and .vc-installed-files/.vc-version metadata writes—are skipped when DRY_RUN=true. The summary counts are recalculated from the FILES list via grep with || true to tolerate zero matches under set -o pipefail.

Changes

Dry-run mode in install.sh

Layer / File(s) Summary
CLI flag parsing and DRY_RUN setup
install.sh
Adds --dry-run/-h argument parsing, initializes DRY_RUN=false, and prints an informational banner when dry-run mode is active.
Dry-run guards across backup, copy, symlink, and post-install
install.sh
Wraps backup creation/removal, the per-file copy loop, symlink mkdir/rm/ln operations, and .vc-installed-files/.vc-version writes in DRY_RUN conditionals; switches agent/skill/hook count calculation from ls queries to grep over the FILES list with `

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hop hop, before we leap,
let's see what changes run deep.
--dry-run says "just pretend!"*
No files moved, no links to mend.
Count what would be, then stand tall —
a rabbit checks before the fall! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description omits required sections from the template including Type, Related Issues, Checklist items, and AI Disclosure. Fill out all required sections: select Type checkbox, link Related Issues if applicable, complete all Checklist items, and disclose any AI tool usage.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding --dry-run and --help flags to install.sh.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch feat/arvuno/install-dry-run-flag

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.

❤️ Share

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

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
install.sh (1)

230-233: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Dry-run prints a false “backed up” success message

When HAS_EXISTING=true and DRY_RUN=true, Line 232 says the previous setup was backed up, but no backup was created in dry-run mode. This is misleading for users and automation logs.

Suggested patch
 if [ "$HAS_EXISTING" = true ]; then
   echo ""
-  echo -e "  ${YELLOW}Previous setup backed up to ${CYAN}$BACKUP_DIR/${NC}"
+  if [ "$DRY_RUN" = true ]; then
+    echo -e "  ${YELLOW}Previous setup would be backed up to ${CYAN}$BACKUP_DIR/${NC}"
+  else
+    echo -e "  ${YELLOW}Previous setup backed up to ${CYAN}$BACKUP_DIR/${NC}"
+  fi
   echo -e "  ${YELLOW}Your process/ directory was preserved (plans, context, features).${NC}"
 fi
🤖 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 `@install.sh` around lines 230 - 233, The backup success message at line 232 is
printed unconditionally when HAS_EXISTING is true, but in dry-run mode no backup
is actually created. Add a condition to check if DRY_RUN is not set to true
before printing the echo statements that claim the backup was successful. This
ensures users only see the backup confirmation message when a backup was
actually performed.
🤖 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.

Outside diff comments:
In `@install.sh`:
- Around line 230-233: The backup success message at line 232 is printed
unconditionally when HAS_EXISTING is true, but in dry-run mode no backup is
actually created. Add a condition to check if DRY_RUN is not set to true before
printing the echo statements that claim the backup was successful. This ensures
users only see the backup confirmation message when a backup was actually
performed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d1b22e6-9960-4d47-ae30-b0be86983af9

📥 Commits

Reviewing files that changed from the base of the PR and between 188cf83 and 541abca.

📒 Files selected for processing (1)
  • install.sh

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.

1 participant