feat: worktree の ignore ファイル引き継ぎに symlink モードを追加し既定化 - #45
Merged
Merged
Conversation
git worktree 作成時、`.gitignore` された未追跡ファイル(node_modules/ や .env など)の引き継ぎ方法を `ignoredFiles: 'symlink' | 'copy' | 'none'` で切り替え られるようにする。既定を 'symlink' に変更。 - 'symlink'(既定): 元へリンクを張るだけで複製コストゼロ・即起動。実体共有。 - 'copy': 実体を複製し worktree 完全独立(従来の挙動)。大きいと重い。 - 'none': 引き継がない。 非推奨の `copyIgnored` は後方互換で解釈(true→copy / false→none)。 設定→モードの解決は純関数 resolveIgnoredFilesMode() に切り出し。
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概要
git worktree を切るとき、
.gitignoreされた未追跡ファイル(node_modules/や.envなど)はこれまで常に 実体コピー(fs.cp)でリポジトリルートから複製していました。node_modules/が巨大だとこのコピーが重く、セッション起動が遅くなります。引き継ぎ方法を設定
ignoredFilesで切り替えられるようにし、既定をシンボリックリンクに変更しました。symlink(既定)fs.symlink)copyfs.cp、従来の挙動)none変更点
src/core/worktree.ts:IgnoredFilesMode型を追加。WorktreeOptions.copyIgnored(boolean)をignoredFiles(3値、既定'symlink')へ変更。src/core/config.ts: 設定にignoredFilesを追加+検証。設定→モードを解決する純関数resolveIgnoredFilesMode()を追加。非推奨のcopyIgnoredは後方互換で解釈(true→copy/false→none、ignoredFilesがあればそちら優先)。src/utils/worktree-manager.ts: モードに応じてsymlink/cpを切替。--directoryが返す末尾/を剥がしてから実体化(path.joinが末尾スラッシュを保持しsymlinkが ENOENT になるため)。ベストエフォート(1件失敗で worktree 作成を止めない)は維持。src/index.tsx:resolveIgnoredFilesMode(config)を注入。後方互換
~/.codiva/config.jsonの既存copyIgnored設定はそのまま動作します(true→copy、false→none)。symlinkモードになります。テスト計画
resolveIgnoredFilesMode(既定・3値・copyIgnored後方互換・優先順位)の単体テストtoConfigのignoredFiles検証(有効値・不正値ドロップ・全キー統合)lstatでリンク確認+内容読み取り)/ copy モード(非リンク+独立性)/ none スキップ /.codiva非リンクnpm run typecheck/npm run lint/npm test(677 tests pass)