Skip to content

Extract shared install logic into lib/common.sh - #2

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784363619-dedupe-install-scripts
Open

Extract shared install logic into lib/common.sh#2
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784363619-dedupe-install-scripts

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

install.sh and uninstall.sh were near-duplicates: they shared the same config block, the remove_link_if_target helper, the GNU Stow guard, the Stow --ignore flags (each repeated twice for Claude + Codex), and the legacy-link cleanup. This factors all of that into a sourced lib/common.sh, leaving each script with only its distinct steps.

The scripts now reduce to:

source ".../lib/common.sh"
require_stow
mkdir -p "$CLAUDE_SKILLS_DIR" "$CODEX_SKILLS_DIR"
stow_skills          # install.sh
stow_skills -D       # uninstall.sh (extra flags passed through to Stow)
remove_legacy_links
# ...script-specific CLAUDE.md link / cleanup...

lib/common.sh computes REPO_DIR from ${BASH_SOURCE[0]} (not $0), so it resolves the repo root correctly whether sourced from either script.

Two behavioral fixes fall out of the consolidation:

  • The shared STOW_IGNORES list adds --ignore='lib', so the new helper directory is not itself symlinked into ~/.claude/skills / ~/.codex/skills.
  • The legacy-skill cleanup is now a single LEGACY_SKILLS array used by both scripts. Previously uninstall.sh was missing the grill-me entry that install.sh had, so a stale grill-me link could survive an uninstall; both scripts now stay in sync.

Verification

  • shellcheck install.sh uninstall.sh lib/common.sh — clean.
  • Ran ./install.sh against temp CLAUDE_HOME/CODEX_HOME: all skills symlinked; lib, README.md, AGENTS.md, install.sh, uninstall.sh correctly excluded; CLAUDE.md linked to AGENTS.md. Re-running is idempotent.
  • Ran ./uninstall.sh: all skill links, CLAUDE.md, and the now-empty skills dirs removed.

Link to Devin session: https://app.devin.ai/sessions/62a9f4fade1c4277bc0e272137e1a8d9
Requested by: @sidwood

install.sh and uninstall.sh duplicated their configuration block, the
remove_link_if_target helper, the GNU Stow guard, the Stow ignore
flags, both Stow invocations, and the legacy-link cleanup.

Move all of it into a sourced lib/common.sh so each script keeps only
its distinct steps. The shared Stow ignore list now also excludes lib,
preventing the new helper directory from being symlinked into the
skills targets.

Consolidating the legacy-skill cleanup into one list fixes a drift bug:
uninstall.sh was missing the grill-me entry that install.sh removed, so
a stale grill-me link would survive uninstall.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sidwood sidwood self-assigned this Jul 18, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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