Skip to content

Conversation

@gregpriday
Copy link
Owner

Summary

Implements a lightweight folder-level profile configuration system using .copytree files that focus exclusively on include/exclude patterns. This replaces the need for complex global profiles with simple, per-directory configuration files.

Closes #55

Changes Made

  • Implement FolderProfileLoader for lightweight .copytree* config files
  • Support auto-discovery (.copytree.yml) and named profiles (-p )
  • Add CLI flags: --profile for named profiles
  • Enhance -r/--as-reference to auto-load folder profile
  • Support YAML, JSON, and INI-style configuration formats
  • Integrate with copy command via buildProfileFromCliOptions
  • Add comprehensive unit tests (39 passing)
  • Add integration and E2E test coverage
  • Update fs-extra mock to support mkdtemp

Implementation Notes

Implementation details:

  • Created FolderProfileLoader class in src/config/FolderProfileLoader.js
    • Auto-discovery with priority: .yml > .yaml > .json > (no extension)
    • Named profile support: .copytree-<name>.*
    • Multi-format parsing: YAML, JSON, INI-style
    • Minimal validation: just include/exclude string arrays
    • Helper methods: listProfiles(), exists()
  • Integrated FolderProfileLoader with copy command
    • Modified buildProfileFromCliOptions to be async and load folder profiles
    • Precedence: CLI flags > folder profile > config defaults
    • Auto-discovery with -r/--as-reference flag
    • Named profile loading with -p <name> flag
  • Added --profile <name> flag to CLI in bin/copytree.js
  • Updated -r/--as-reference description to mention auto-loading

Context & rationale:

  • Folder profiles provide a lightweight way to configure CopyTree per-directory
  • No complex schema validation - just include/exclude patterns
  • Integrates seamlessly with existing ignore files and CLI flags
  • Auto-discovery makes it easy to use with -r flag (common workflow)

Follow-up Tasks

  • Integration tests in tests/integration/folderProfile.test.js need to be refactored to use tempfs helpers (currently failing due to fs-extra mocking)
  • E2E tests in tests/e2e/folder-profile.test.js can be run manually to verify CLI behavior
  • Consider adding profile validation command in future (e.g., copytree profile:validate)

gregpriday and others added 3 commits November 21, 2025 17:06
- Implement FolderProfileLoader for lightweight .copytree* config files
- Support auto-discovery (.copytree.yml) and named profiles (-p <name>)
- Add CLI flags: --profile <name> for named profiles
- Enhance -r/--as-reference to auto-load folder profile
- Support YAML, JSON, and INI-style configuration formats
- Integrate with copy command via buildProfileFromCliOptions
- Add comprehensive unit tests (39 passing)
- Add integration and E2E test coverage
- Update fs-extra mock to support mkdtemp
🤖 Generated with GitHub Actions

Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Use jest.requireActual to bypass mocked fs-extra in E2E tests
- Ensures file operations (mkdtemp, ensureDir, writeFile) work correctly
- Allows E2E tests to create and manage real temporary directories
@gregpriday gregpriday merged commit d879083 into develop Nov 21, 2025
5 of 15 checks passed
@gregpriday gregpriday deleted the feature/issue-55-folder-profiles branch November 21, 2025 16:28
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.

Implement folder-level profile configuration system

2 participants