Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .claude/tasks/2025-07-06-setup-improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## Current Status (July 7, 2025)

**Task**: Improve reliability and testability of dotfiles setup process through TDD approach
**Total PRs Planned**: 10 PRs + 2 Infrastructure PRs
**Total PRs Planned**: 10 PRs + 2 Infrastructure PRs + 1 Critical Fix
**Completed**: 8 PRs (including SSH Installation Testing + Infrastructure PRs)
**Current**: Bash migration experiment (see bash-migration task file)
**Critical Issue Discovered**: setup.zsh references $DOTFILES files before repo is cloned - needs urgent fix
**Current**: Critical setup.zsh bug fix (PR #14 in draft) + bash migration experiment
**Critical Issue**: PR #14 fixes setup.zsh dependency ordering - sourcing files before repo clone

## Completed PRs

Expand Down Expand Up @@ -73,6 +73,15 @@
- **Benefits**: Visible test status in PR UI, early issue detection, no manual test verification
- **Status**: Workflow created, tested, and merged successfully

## Critical Bug Fix

### πŸ”„ PR #14: Fix Setup.zsh Dependency Ordering (Draft)
- **Issue**: setup.zsh sourced `$DOTFILES` files before repository was cloned
- **Impact**: Setup failed immediately on fresh installations - core functionality broken
- **Solution**: Moved all `source "$DOTFILES/..."` commands after git clone (line 128+)
- **Changes**: Basic git check before clone, enhanced initialization after clone
- **Status**: Draft PR created, fixes fundamental setup process ordering

## Key Technical Decisions & Patterns

### Testing Philosophy
Expand Down
15 changes: 8 additions & 7 deletions .claude/tasks/2025-07-07-bash-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

**Task**: Migrate dotfiles installation scripts from custom zsh test framework to industry-standard bash + shellcheck + bats
**Approach**: Complete 3-phase migration for better tooling, maintainability, and reliability
**Current**: Phase 1 - PR #13 (GitHub Installation Testing) in draft review
**Current**: Phase 1 complete (PR #13 merged), now addressing critical setup.zsh bug (PR #14)

## Migration Strategy

### Phase 1: Demonstrate Complete Migration Pattern (In Progress)
### Phase 1: Demonstrate Complete Migration Pattern (COMPLETED)
**Goal**: Create one complete bash + bats example to establish the migration pattern

#### πŸ”„ PR #13: GitHub Installation Testing (Draft)
#### βœ… PR #13: GitHub Installation Testing (MERGED)
- **Files Created**:
- `lib/github-utils.bash` - GitHub SSH utilities (shellcheck clean)
- `bin/install/github.bash` - Bash replacement for github.zsh
Expand All @@ -20,7 +20,7 @@
- `experiment/bash-testing/` - Comparison docs and examples
- **Test Results**: All 20 tests passing, shellcheck compliance verified
- **Benefits Demonstrated**: Better error catching, industry-standard tooling, cleaner syntax
- **Status**: Ready for review, includes CLAUDE.md improvements for PR workflow
- **Status**: MERGED - established complete migration pattern with 20 passing tests

### Phase 2: Systematic Script Migration (Pending)
**Goal**: Migrate remaining installation scripts one-by-one using established pattern
Expand Down Expand Up @@ -103,11 +103,12 @@ test/install/test-{component}-installation.bats # Integration tests

## Discovered Issues

### Critical Setup.zsh Bug
### Critical Setup.zsh Bug (FIXED)
**Issue**: `setup.zsh` references `$DOTFILES` files via `source` commands before the dotfiles repository is cloned
**Impact**: Setup process fails on fresh installations
**Priority**: High - affects core functionality
**Next Steps**: Fix in separate PR after current bash migration PR is reviewed
**Priority**: High - affects core functionality
**Status**: PR #14 created with fix - moved all sourcing after git clone (line 128+)
**Solution**: Basic git check before clone, comprehensive utilities after clone

### Dead Code Prevention
**Pattern**: Every function/utility must have demonstrated usage in the same PR
Expand Down
14 changes: 13 additions & 1 deletion home/.claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,19 @@ EOF
- πŸ€” Why: Problem solved, business value, timing rationale
- πŸ‘€ Usage: How to use new functionality (optional for user-facing changes)
- πŸ‘©β€πŸ”¬ How to validate: Manual steps for reviewers to confirm changes work
- πŸ”— Related links: Context that helps reviewers (docs, issues, PRs, Slack threads)
- πŸ”— Related links: External context that helps reviewers understand background

**Related links guidelines:**
- **ONLY include links that provide valuable context NOT already in the PR**
- **External references**: Documentation, Stack Overflow, RFCs, design docs, external issues
- **Background PRs**: Previous/related PRs that provide important context
- **DO NOT include**:
- Files in the current PR (reviewers can already see them)
- Generic/empty pages (issues page with no relevant issues)
- Links that duplicate information already in PR description
- Internal project files unless they provide critical background context
- **If no useful links exist, omit the entire Related links section** - no section is better than empty section
- **Quality over quantity** - 1-2 highly relevant links better than 5 marginally useful ones

**When to apply:**
- Creating PRs in repos without templates
Expand Down
2 changes: 2 additions & 0 deletions home/.claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"Bash(find:*)",
"Bash(gh pr create:*)",
"Bash(gh pr edit:*)",
"Bash(gh pr ready:*)",
"Bash(gh pr view:*)",
"Bash(git add:*)",
"Bash(git branch:*)",
Expand All @@ -21,6 +22,7 @@
"Bash(git merge origin/trunk)",
"Bash(git pull:*)",
"Bash(git push:*)",
"Bash(git stash:*)",
"Bash(grep:*)",
"Bash(ls:*)",
"Bash(mkdir:*)",
Expand Down
56 changes: 40 additions & 16 deletions setup.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,7 @@

export DOTFILES="$HOME/Repos/ooloth/dotfiles"

# Initialize dynamic machine detection
source "$DOTFILES/bin/lib/machine-detection.zsh"
init_machine_detection

# Initialize dry-run mode utilities
source "$DOTFILES/bin/lib/dry-run-utils.zsh"
parse_dry_run_flags "$@"

# Initialize error handling utilities
source "$DOTFILES/bin/lib/error-handling.zsh"

# Basic error handling - will be enhanced after dotfiles are available
handle_error() {
local exit_code="$1"
local line_number="$2"
Expand Down Expand Up @@ -73,11 +63,20 @@ fi

printf "This is a Mac. But you knew that already.\n\n"

# Run comprehensive prerequisite validation
printf "Running comprehensive prerequisite validation...\n\n"
# Basic prerequisite validation (comprehensive validation after clone)
printf "Running basic prerequisite validation...\n\n"

source "$DOTFILES/bin/lib/prerequisite-validation.zsh"
if ! run_prerequisite_validation; then
# Command Line Tools check (critical for git clone)
if ! command -v git >/dev/null 2>&1; then
printf "❌ Git is not installed. Please install Command Line Developer Tools first.\n"
printf "Run: xcode-select --install\n"
exit 1
fi

printf "βœ… Git is available for cloning dotfiles.\n\n"

# Skip comprehensive validation for now - will run after clone
if false; then
printf "\n❌ Prerequisite validation failed. Please address the issues above and try again.\n"
exit 1
fi
Expand Down Expand Up @@ -129,7 +128,32 @@ else
git clone "https://github.com/ooloth/dotfiles.git" "$DOTFILES"
fi

# # Add all the helpers the install scripts below will reference
# Initialize dotfiles utilities now that repository is available
printf "πŸ”§ Initializing dotfiles utilities...\n\n"

# Initialize dynamic machine detection
source "$DOTFILES/bin/lib/machine-detection.zsh"
init_machine_detection

# Initialize dry-run mode utilities
source "$DOTFILES/bin/lib/dry-run-utils.zsh"
parse_dry_run_flags "$@"

# Initialize enhanced error handling utilities
source "$DOTFILES/bin/lib/error-handling.zsh"

# Run comprehensive prerequisite validation now that utilities are available
printf "Running comprehensive prerequisite validation...\n\n"

source "$DOTFILES/bin/lib/prerequisite-validation.zsh"
if ! run_prerequisite_validation; then
printf "\n❌ Prerequisite validation failed. Please address the issues above and try again.\n"
exit 1
fi

printf "βœ… All prerequisites validated successfully.\n\n"

# Add all the helpers the install scripts below will reference
# source "$DOTFILES/config/zsh/aliases.zsh"
# source "$DOTFILES/config/zsh/utils.zsh"

Expand Down