Skip to content

[#237] Move file path derivation into SyncStrategy#245

Merged
bguidolim merged 2 commits intomainfrom
feature/237-file-path-derivation-to-strategy
Mar 6, 2026
Merged

[#237] Move file path derivation into SyncStrategy#245
bguidolim merged 2 commits intomainfrom
feature/237-file-path-derivation-to-strategy

Conversation

@bguidolim
Copy link
Owner

Context

Configurator.deriveFileRelativePath() duplicated path-derivation logic that already existed in GlobalSyncStrategy.installArtifacts() and ComponentExecutor.installProjectFile(). This broke the strategy pattern by introducing an isGlobalScope branch in scope-agnostic code.

Changes

  • Add fileRelativePath(destination:fileType:) protocol method to SyncStrategy
  • Implement in GlobalSyncStrategy (relative to ~/.claude/) and ProjectSyncStrategy (relative to project root)
  • DRY up GlobalSyncStrategy.installArtifacts to use the new method instead of inlining path logic
  • Delete Configurator.deriveFileRelativePath, replacing it with strategy.fileRelativePath(...)

Testing

  • swift build passes
  • swift test — all 711 tests pass (4 pre-existing PackFetcherTests failures from 1Password SSH agent, unrelated)

Closes #237

- Add `fileRelativePath(destination:fileType:)` to SyncStrategy protocol
- Implement in GlobalSyncStrategy and ProjectSyncStrategy with scope-specific path logic
- Remove `deriveFileRelativePath` from Configurator, eliminating isGlobalScope branch
…Path

- Replace manual baseDirectory + appendingPathComponent with CopyFileType.destinationURL(in:destination:)
@bguidolim bguidolim merged commit e9af199 into main Mar 6, 2026
4 checks passed
@bguidolim bguidolim deleted the feature/237-file-path-derivation-to-strategy branch March 6, 2026 09:18
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.

Move file path derivation for copyPackFile into SyncStrategy protocol

1 participant