-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(shared-symlinks): selective .claude subdirectory symlinking and eliminate duplication #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
53dc7a6
refactor(shared-symlinks): selective .claude subdirectory symlinking …
fx e478562
test: add Docker-based CI test suite and skills directory
fx 1f257d0
fix: use ln -n flag to prevent symlinks inside existing directories
fx 817eea9
fix(test): use local repository for third test to verify current bran…
fx 4a26cea
fix(shared-symlinks): add nullglob for safe glob expansion and improv…
fx 2110ba2
fix(test): add safe.directory config for Docker mount ownership
fx 0116521
fix(test): mark all directories as safe for Git in test environment
fx e811182
fix(test): configure safe.directory before installing tools
fx 27c58b5
fix(test): copy repo to temp location to avoid Docker mount ownership…
fx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # GitHub Copilot Instructions | ||
|
|
||
| ## Code Reviews | ||
|
|
||
| ### Test Suite Conventions | ||
|
|
||
| - Do not suggest refactoring test scripts to use `install.sh` when the test intentionally bypasses it to test specific chezmoi behavior (e.g., selective symlinking with pre-existing directories) | ||
| - Tests may directly invoke chezmoi commands when they need to control the environment state before installation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Test Dotfiles | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run dotfiles tests | ||
| run: | | ||
| chmod +x test/test-dotfiles.sh | ||
| ./test/test-dotfiles.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| # Skills directory |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # Dotfiles Testing | ||
|
|
||
| This directory contains automated tests for the dotfiles installation system. | ||
|
|
||
| ## Test Suite | ||
|
|
||
| The `test-dotfiles.sh` script validates dotfiles installation in three scenarios: | ||
|
|
||
| 1. **Non-Coder Environment**: Verifies direct symlinking from dotfiles repository | ||
| 2. **Coder Fresh Install**: Verifies `/shared/` directory seeding and full directory symlink | ||
| 3. **Coder Existing ~/.claude**: Verifies selective subdirectory symlinking when `~/.claude` already exists | ||
|
|
||
| ## Requirements | ||
|
|
||
| ### Docker Image | ||
|
|
||
| The tests use a custom Docker image: `ghcr.io/fx/docker/devcontainer:latest` | ||
|
|
||
| This image is built from the [fx/docker](https://github.com/fx/docker) repository and provides a consistent test environment with: | ||
| - Base Linux distribution for testing | ||
| - Common development tools | ||
| - User environment similar to actual workspaces | ||
|
|
||
| **Note**: The image is publicly available from GitHub Container Registry. If you need to build it locally or use a different image, modify the `IMAGE` variable in `test-dotfiles.sh`. | ||
|
|
||
| ### Docker | ||
|
|
||
| Docker must be installed and running: | ||
|
|
||
| ```bash | ||
| # Check if Docker is running | ||
| docker info | ||
|
|
||
| # Start Docker if needed | ||
| sudo service docker start | ||
| ``` | ||
|
|
||
| ## Running Tests | ||
|
|
||
| ### Local Testing | ||
|
|
||
| ```bash | ||
| # From repository root | ||
| ./test/test-dotfiles.sh | ||
|
|
||
| # Or with sudo if needed | ||
| sudo ./test/test-dotfiles.sh | ||
| ``` | ||
|
|
||
| ### CI Testing | ||
|
|
||
| Tests run automatically via GitHub Actions on: | ||
| - Push to `main` branch | ||
| - Pull requests to `main` branch | ||
|
|
||
| See `.github/workflows/test.yml` for CI configuration. | ||
|
|
||
| ## Test Scenarios Explained | ||
|
|
||
| ### Test 1: Non-Coder Environment | ||
|
|
||
| Simulates installation on a personal machine where `/shared/` directory doesn't exist. Verifies that `~/.claude` becomes a symlink directly to the dotfiles repository. | ||
|
|
||
| ### Test 2: Coder Fresh Install | ||
|
|
||
| Simulates first-time installation in a Coder workspace. Verifies: | ||
| - `/shared/home/default/.claude` is seeded from dotfiles | ||
| - `~/.claude` is a symlink to `/shared/home/default/.claude` | ||
|
|
||
| ### Test 3: Coder Existing ~/.claude | ||
|
|
||
| Simulates installation when user already has a `~/.claude` directory with custom content. Verifies: | ||
| - `~/.claude` remains a real directory (not symlink) | ||
| - User files are preserved | ||
| - Only subdirectories (`agents`, `commands`, `skills`) and `CLAUDE.md` are symlinked |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.