-
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
Conversation
…and eliminate duplication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive automated testing infrastructure for the dotfiles installation system. The tests verify correct behavior in both Coder workspace and non-Coder environments, ensuring symlink handling works properly for the .claude directory and related configurations.
- Introduces a Docker-based test script (
test/test-dotfiles.sh) that validates three installation scenarios - Adds GitHub Actions CI workflow for automated testing on push and pull requests
- Refactors
.chezmoiscripts/run_onchange_after_setup-shared-symlinks.sh.tmplto extract reusable functions for symlink management - Documents the testing approach and procedures in
CLAUDE.md
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test-dotfiles.sh | New test script that validates dotfiles installation in non-Coder, Coder fresh install, and Coder existing directory scenarios using Docker |
| .github/workflows/test.yml | CI workflow configuration to run tests automatically on main branch and pull requests |
| .chezmoiscripts/run_onchange_after_setup-shared-symlinks.sh.tmpl | Refactored to extract symlink_claude() and symlink_to_home() functions, improving maintainability and reusability |
| CLAUDE.md | Added comprehensive testing documentation covering local and CI testing procedures |
| shared/claude/skills/README.md | Added placeholder README for the skills directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The third test case was failing because Git inside the Docker container refused to access /workspace/.git due to dubious ownership (mounted from host with different uid/gid). This adds `git config --global --add safe.directory /workspace` before running chezmoi to resolve the issue.
Use `safe.directory '*'` instead of specific path to ensure all Git operations work correctly in the Docker test environment, regardless of mount ownership.
Move git config safe.directory before mise/chezmoi installation to ensure the configuration is in place when chezmoi needs to access the local repository.
… issues Instead of using the mounted /workspace directly, copy it to /tmp inside the container first. This eliminates Git ownership validation errors that occur with Docker volume mounts having different uid/gid.
Summary
Refactors the shared symlinks setup script to intelligently handle
.claudedirectory symlinking and eliminates code duplication. Adds comprehensive Docker-based test suite with CI integration.Changes
Selective
.claudeSymlinking~/.claude): Symlinks entire directory → all content accessible~/.claude: Only symlinks specific subdirectories:agents/commands/skills/CLAUDE.mdCode Refactoring
.claudesymlinking logic intosymlink_claude()functionsymlink_to_home()function/shared/is Coder-only with better commentsTest Suite
test/test-dotfiles.shwith 3 Docker-based tests:/shared/)~/.claude(selective subdirectory symlinks).github/workflows/test.yml)CLAUDE.mdwith testing documentationBug Fixes
skills/directory toshared/claude/lncommand to use-nflag (prevents creating symlinks inside existing directories)Test Results
All tests pass locally:
Testing Instructions