Skip to content

feat: add Claude Code bootstrap (dotfiles install --claude)#3

Merged
STiXzoOR merged 16 commits into
mainfrom
feat/claude-bootstrap
Mar 3, 2026
Merged

feat: add Claude Code bootstrap (dotfiles install --claude)#3
STiXzoOR merged 16 commits into
mainfrom
feat/claude-bootstrap

Conversation

@STiXzoOR
Copy link
Copy Markdown
Owner

@STiXzoOR STiXzoOR commented Mar 3, 2026

Summary

  • Add dotfiles install --claude command that idempotently bootstraps Claude Code: native binary, 17 marketplaces, 54 plugins, rules, hooks, settings, QMD, and Obsidian vault integration
  • Implemented across 12 commits with multi-agent code review (4 agents) that caught and fixed 16 findings (P1-P3)
  • 128 tests passing, 0 failures

What's New

Component Files Purpose
Install script scripts/install_claude.sh Idempotent 8-step installer with caching, error tracking, timing
Requirers scripts/requirers.sh require_claude_marketplace / require_claude_plugin helpers
CLI integration bin/dotfiles --claude subcommand, wired into --all
Manifests claude/marketplaces.list, claude/plugins.list Declarative marketplace/plugin lists
Settings claude/settings.template.json Template with $HOME expansion, hooks config
Rules claude/rules/*.md context7, vault-lookback, gnu-tools rules
Hooks claude/hooks/index-sessions.sh Post-session QMD indexing with log rotation
Shell config system/.alias, .env, .path, runcom/.profile cs alias, VAULT_DIR, bash compatibility
Tests bin/dotfiles-test 17 new tests in test_claude_bootstrap()
Docs docs/plans/, docs/solutions/, docs/agents/ Plan, design, solution docs, architecture update

Key Design Decisions

  • Native binary over npm: Removed @anthropic-ai/claude-code from npm.list, uses official installer
  • Subprocess isolation: bash "$ROOT_DIR/scripts/install_claude.sh" (not source) to prevent variable leakage
  • Cache-before-loop: Caches claude plugin marketplace list --json and claude plugin list --json once before iterating (performance)
  • Deep merge settings: jq -s '.[0] * .[1]' preserves user customizations while adding template defaults
  • envsubst for safety: Template $HOME expansion uses envsubst (metacharacter-safe) with sed fallback

Code Review Findings (Fixed)

4 parallel review agents found 16 issues, all addressed in commit 29206b9:

  • P1: Silent failure in require_claude_* (added return 1), loose grep matching (use -Fq), duplicate plugins, mixed $HOME/~
  • P2: Double banner, double-logging, sed vulnerability, help ordering, test gap, world-readable log
  • P3: Code duplication, verbose patterns, manual cleanup, missing docs, unguarded alias, unbounded logs

Full details: docs/solutions/logic-errors/claude-bootstrap-review-batch-fixes.md

Testing

  • 128 tests pass (17 new Claude-specific tests)
  • Syntax validation (bash -n), shellcheck, zsh syntax all clean
  • Pre-commit hooks pass on all commits

Post-Deploy Monitoring & Validation

No additional operational monitoring required: this is a local dotfiles bootstrap command with no server-side components.


Compound Engineered 🤖 Generated with Claude Code

STiXzoOR and others added 16 commits March 3, 2026 12:43
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Idempotent installer that bootstraps Claude Code binary,
marketplaces, plugins, rules, hooks, settings, vault, and QMD.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…add qmd

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Guard zsh-only files (.alias, .fnm, .fzf, .thefuck, .pnpm) behind
  ZSH_VERSION check in .profile — fixes ~15 errors when Claude Code's
  bash tool sources the profile
- Guard typeset -U in .path (zsh-only)
- Parameterize cs alias with $HOME
- Add VAULT_DIR export to .env

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
16 new tests covering install script, manifests, rules, hooks,
settings template, CLI wiring, and security (no hardcoded paths).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
P1 (Critical):
- require_claude_* now return 1 after warn so try_or_track catches failures
- Use grep -Fq for fixed-string matching (prevents substring false positives)
- Remove duplicate plugins (code-review, security-guidance from claude-code-plugins)
- Standardize settings.template.json on $HOME (no mixed ~ paths)

P2 (Important):
- Remove duplicate bot banner from install_claude.sh (CLI already prints it)
- Remove double-logging from settings hook (hook script handles its own log)
- Use envsubst for $HOME expansion (safe against metacharacters), sed fallback
- Alphabetize --claude in install help menu
- Add gnu-tools.md to test_claude_bootstrap rules array
- Move install log from /tmp to ~/.cache/dotfiles/ (private, user-owned)

P3 (Nice-to-have):
- Combine copy_rules/copy_hooks into single copy_claude_files function
- Simplify setup_vault with brace expansion
- Use trap RETURN for tmpfile cleanup in install_claude_binary
- Add claude/ directory entry to architecture.md
- Guard cs alias against missing recall skill venv
- Add log rotation (>1MB truncation) to index-sessions.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Implementation plan with 12 tasks and research appendix
- Design document with architecture decisions
- Solution doc capturing all 16 review findings and prevention strategies

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add Obsidian and gettext (envsubst) to Brewfile
- Expand vault structure with Daily/ and Polaris/ directories
- Add top-of-mind.md starter template for Polaris concept
- Setup QMD collections (notes + sessions) with context descriptions
- Run QMD embed for vector search on first install
- Add QMD MCP server to settings template for Claude Code integration
- Enhance vault-lookback rule with three search modes and tips
- Add 3 new tests (vault templates, QMD MCP config)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e.json

MCP servers belong in ~/.claude.json (via 'claude mcp add'), not in
settings.json. The settings template now only contains env, hooks, and
preferences. QMD MCP is registered via 'claude mcp add --transport stdio'
during bootstrap.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…er-project)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@STiXzoOR STiXzoOR merged commit 7b8f1ef into main Mar 3, 2026
4 checks passed
@STiXzoOR STiXzoOR deleted the feat/claude-bootstrap branch March 3, 2026 11:54
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