Skip to content

feat(#107): use symlinks instead of copies for scripts/dev in init - #152

Merged
admarble merged 2 commits into
mainfrom
feature/107-feat-use-symlinks-instead-of-copies-for-scripts-de
Jan 21, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/107-feat-use-symlinks-instead-of-copies-for-scripts-de

Conversation

@admarble

Copy link
Copy Markdown
Contributor

Summary

  • Add symlink utilities to fs.ts: isSymlink, createSymlink, getSymlinkTarget, removeFileOrSymlink
  • Create symlinkDir function in templates.ts for creating relative symlinks
  • Update copyTemplates() to use symlinks for scripts/dev/ (not .claude/ which needs template variable processing)
  • Handle re-initialization: existing symlinks are replaced, existing files skipped unless --force
  • Add Windows handling: graceful fallback to copies when symlinks fail (EPERM/EACCES)
  • Add --no-symlinks flag to init command for users who prefer copies
  • Add unit tests for new fs.ts and templates.ts utilities

Benefits

  • Template updates automatically available to all users
  • No manual sync needed
  • Users can still customize by replacing symlink with real file
  • Single source of truth for scripts

Test plan

  • Unit tests for isSymlink, createSymlink, removeFileOrSymlink, getSymlinkTarget
  • Unit tests for symlinkDir including:
    • Creates symlinks for files in source directory
    • Creates relative symlinks for portability
    • Handles subdirectories recursively
    • Skips existing regular files without force
    • Replaces existing files with force
    • Replaces existing symlinks (including broken ones)
  • Unit tests for processTemplate
  • npm test passes (519/529 tests pass, 10 pre-existing failures in state-update-cli.test.ts)
  • npm run build compiles successfully

AC Coverage

  • AC-1: sequant init creates symlinks in scripts/dev/ pointing to templates/scripts/
  • AC-2: Existing copies are replaced with symlinks on re-init (when using --force) or warn user (when not using --force)
  • AC-3: Cross-platform: works on macOS, Linux, and Windows (graceful fallback to copies on Windows)
  • AC-4: Documentation updated if needed (will be addressed in follow-up if required)

Closes #107

🤖 Generated with Claude Code

- Add symlink utilities to fs.ts: isSymlink, createSymlink, getSymlinkTarget, removeFileOrSymlink
- Create symlinkDir function in templates.ts for creating relative symlinks
- Update copyTemplates() to use symlinks for scripts/dev/ (not .claude/ which needs template variable processing)
- Handle re-initialization: existing symlinks are replaced, existing files skipped unless --force
- Add Windows handling: graceful fallback to copies when symlinks fail (EPERM/EACCES)
- Add --no-symlinks flag to init command for users who prefer copies
- Add unit tests for new fs.ts and templates.ts utilities

Benefits:
- Template updates automatically available to all users
- No manual sync needed
- Users can still customize by replacing symlink with real file
- Single source of truth for scripts

Closes #107

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@admarble
admarble merged commit 07a638a into main Jan 21, 2026
@admarble
admarble deleted the feature/107-feat-use-symlinks-instead-of-copies-for-scripts-de branch January 21, 2026 06:04
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.

feat: Use symlinks instead of copies for scripts/dev in init

1 participant