Skip to content

Fix: copy .claude/scripts/ root files during install#155

Open
udhaya10 wants to merge 1 commit intoparcadei:mainfrom
udhaya10:fix/install-dotfile-scripts
Open

Fix: copy .claude/scripts/ root files during install#155
udhaya10 wants to merge 1 commit intoparcadei:mainfrom
udhaya10:fix/install-dotfile-scripts

Conversation

@udhaya10
Copy link
Copy Markdown

@udhaya10 udhaya10 commented Feb 24, 2026

Summary

  • .claude/scripts/ root files (e.g. status.py, status.sh, tldr_stats.py) are never copied to ~/.claude/scripts/ during fresh install, breaking statusLine which references status.py
  • _copy_scripts() only handles opc/scripts/ (different source tree) — .claude/scripts/ root files were missed
  • Wizard never reports scripts install count (silent failure)

Changes

  • New _copy_dotfile_scripts() — copies root-level .py/.sh files from .claude/scripts/ to target
  • Called in both install_opc_integration() and install_opc_integration_symlink()
  • Added missing "Installed N scripts" print line in wizard (both code paths)

Why this approach

Option Verdict
Add to ROOT_SCRIPTS Won't work — ROOT_SCRIPTS maps opc/scripts/, not .claude/scripts/
Copytree whole .claude/scripts/ Conflicts with _copy_scripts() subdirs
New _copy_dotfile_scripts() Clean, no overlap with existing _copy_scripts(), mirrors existing pattern

Zero overlap between the two functions — _copy_scripts() handles subdirs + named root files from opc/scripts/, while _copy_dotfile_scripts() handles root-level files from .claude/scripts/.

Test plan

  • Fresh install (option 2): verify ~/.claude/scripts/status.py exists
  • Symlink install (option 3): verify status.py is copied
  • Wizard output now shows OK Installed N scripts
  • Status line works: echo '{}' | python3 ~/.claude/scripts/status.py

Fixes #154

Summary by CodeRabbit

Release Notes

  • New Features

    • Setup wizard now displays the total count of installed scripts during installation, providing enhanced visibility into the setup process.
  • Improvements

    • Installation process now includes root-level scripts in addition to core scripts, expanding the set of utilities available after setup completion.

_copy_scripts() copies from opc/scripts/ but .claude/scripts/ root
files (status.py, status.sh, tldr_stats.py, etc.) live in a different
source tree and were never deployed. This breaks statusLine which
references ~/.claude/scripts/status.py.

Add _copy_dotfile_scripts() to copy root-level .py/.sh files from
.claude/scripts/ during both copy and symlink installs. Also add
the missing "Installed N scripts" output to the wizard.

Fixes parcadei#154
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Feb 24, 2026

PR author is not in the allowed authors list.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d07ff4b and 1edd02a.

📒 Files selected for processing (2)
  • opc/scripts/setup/claude_integration.py
  • opc/scripts/setup/wizard.py

📝 Walkthrough

Walkthrough

A new helper function _copy_dotfile_scripts() is introduced to copy root-level .claude/scripts/ files (with .py or .sh extensions) into target directories. This function is integrated into both standard and symlink-based installation flows. Additionally, progress reporting is added to display the count of installed scripts in the setup wizard.

Changes

Cohort / File(s) Summary
Script Installation Helper
opc/scripts/setup/claude_integration.py
Introduces _copy_dotfile_scripts() helper to copy root-level scripts from .claude/scripts/ matching .py or .sh extensions. Integrates the helper into install_opc_integration() and install_opc_integration_symlink() installation flows, with corresponding updates to installed_scripts counter.
Installation Progress Reporting
opc/scripts/setup/wizard.py
Adds two status lines to report the count of installed scripts: one after listing installed servers and one in the Claude Code Integration installation path when successful.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

🚥 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 accurately describes the main change: adding functionality to copy root-level .claude/scripts/ files during installation.
Linked Issues check ✅ Passed The PR addresses issue #154 by ensuring status.py and other root-level files under .claude/scripts/ are deployed to ~/.claude/scripts/ during installation.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the missing dotfile scripts issue. The addition of progress reporting in the wizard is a supporting enhancement to the main fix.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

console.print(f" [green]OK[/green] Installed {result['installed_rules']} rules")
console.print(f" [green]OK[/green] Installed {result['installed_agents']} agents")
console.print(f" [green]OK[/green] Installed {result['installed_servers']} MCP servers")
console.print(f" [green]OK[/green] Installed {result['installed_scripts']} scripts")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: The setup wizard will crash with a KeyError during symlink installation because the install_opc_integration_symlink function fails to return the installed_scripts count.
Severity: CRITICAL

Suggested Fix

In the install_opc_integration_symlink function, initialize the result dictionary with "installed_scripts": 0. Then, capture the integer return values from the _copy_scripts and _copy_dotfile_scripts calls and sum them into the result["installed_scripts"] key before returning.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: opc/scripts/setup/wizard.py#L806

Potential issue: The `install_opc_integration_symlink` function does not initialize or
populate the `installed_scripts` key in the dictionary it returns. However, the setup
wizard in `wizard.py` unconditionally accesses `result['installed_scripts']` when a user
chooses the symlink installation option. This discrepancy will cause a `KeyError` and
crash the setup wizard during the installation process, preventing users from completing
the setup with this option. The function calls `_copy_scripts` and
`_copy_dotfile_scripts` but fails to capture and store their return values, which are
the counts of the installed scripts.

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Copy Markdown
Author

@udhaya10 udhaya10 left a comment

Choose a reason for hiding this comment

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

Re: Sentry comment on line 806 — false positive.

result['installed_scripts'] is only accessed after install_opc_integration() (copy path), which initializes it at line 487. The install_opc_integration_symlink() result is consumed at lines 762-780 and 821-829 where only symlinked_dirs and backed_up_dirs are read — never installed_scripts. No KeyError will occur.

PR looks good to merge.

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.

status.py missing from ROOT_SCRIPTS — statusLine broken after install

1 participant