Skip to content

Feature: Add remote Git catalogs, and renaming of "Hats" to "Presets"+ new integration tests + changlog#18

Merged
joninafta merged 9 commits into
mainfrom
feature/add-gh-rep-branch-catalogs
Sep 23, 2025
Merged

Feature: Add remote Git catalogs, and renaming of "Hats" to "Presets"+ new integration tests + changlog#18
joninafta merged 9 commits into
mainfrom
feature/add-gh-rep-branch-catalogs

Conversation

@joninafta

Copy link
Copy Markdown
Contributor

This pull request introduces a major update focused on renaming "Hats" to "Presets" throughout the extension, adding significant new Git Catalog features, and bumping the version to 0.4.0. It also includes new integration tests and updates to documentation and commands to reflect these changes.

Presets Rename and UI/Command Updates:

  • Renamed all references of "Hats" to "Presets" across the UI, commands, menus, documentation, and sample files, ensuring consistency in both user-facing and internal identifiers. (package.json, README.md, src/extension.ts, [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]

Git Catalog Enhancements:

  • Added branch enumeration using git ls-remote --heads with a quick pick UI when adding a remote repository, and introduced the ability to lock a remote to a specific commit SHA, preventing automatic branch updates. (CHANGELOG.md, CHANGELOG.mdR10-R43)
  • Implemented interactive refresh flow for remotes when a newer branch head is detected, allowing users to update, skip, or lock. Also added a command to list Git remotes and their statuses, and improved commit update detection logic. (CHANGELOG.md, CHANGELOG.mdR10-R43)

Testing and Integration:

  • Introduced a new integration test suite (test/real.integration.test.ts) that uses the actual FileService to verify file system operations, and updated the test:integration script to run this new suite. (CHANGELOG.md, package.json, [1] [2]

Versioning and Metadata:

  • Bumped the extension version to 0.4.0 and documented backward-compatible metadata upgrades for Git Catalog, including the new lockedCommit field and upgrade logic. (CHANGELOG.md, package.json, [1] [2]

Documentation Improvements:

  • Updated the README.md to reflect the rename to "Presets," revised usage instructions, sample structures, troubleshooting, and configuration examples accordingly. (README.md, [1] [2] [3] [4] [5] [6] [7]

These changes collectively improve clarity, add powerful new Git Catalog features, and ensure the extension's terminology and documentation are consistent and up-to-date.

Add GitCatalogService and instantiate during activation.
Introduce commands:
- copilotCatalog.dev.scanGitRepository (clone, scan, select catalogs, update config)
- copilotCatalog.dev.refreshGitRepositories (initial support)
Persist remote metadata and discovered catalog directories.
Validate Git availability and restrict to HTTPS for initial MVP.
Bump extension version to 0.3.6.

Motivation: enable discovering and selectively importing catalog folders
from external Git repos to streamline catalog curation and reuse.
This commit introduces a significant terminology change across the extension, renaming "Hats" to "Presets". This change is intended to make the feature's purpose more intuitive and align with more common industry language for saved configurations or templates.

Key changes include:
- Renaming all instances of "hat" and "hats" to "preset" and "presets" in the UI, commands, and internal code.
- Updating associated icons and file names (e.g., `hat-dark.svg` to `preset-dark.svg`).
- Renaming the example catalog directory from `hats` to `presets`.
- Adding `.clinerules/` to `.gitignore`.
- Updated terminology in the codebase, documentation, and UI to replace "Hats" with "Presets".
- Enhanced Git Catalog features including branch enumeration, commit locking, and interactive refresh flow.
- Added new service APIs for managing presets.
- Updated README and CHANGELOG to reflect changes and new features.
- Added integration tests for new preset functionality.
This change reorganizes the options tree for better usability by moving Git-related commands into a dedicated submenu.

- Creates a new 'Git Repositories' submenu under the 'Catalog' section.
- Moves 'Scan Git Repository', 'Refresh Git Repositories', and 'List Git Remotes' from the 'Developer' section into the new submenu.
- Renames 'Refresh' to 'Refresh All Catalogs' for clarity.
Copilot AI review requested due to automatic review settings September 23, 2025 00:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements a comprehensive renaming of "Hats" to "Presets" throughout the extension, introduces powerful Git catalog features with branch management and commit locking capabilities, and adds integration testing infrastructure. The changes maintain backward compatibility while significantly enhancing the Git-based catalog functionality.

Key changes include:

  • Complete "Hats" to "Presets" terminology update across all user-facing elements and internal code
  • New Git catalog features: branch enumeration, commit locking, and interactive update management
  • Integration test suite with real file system operations testing

Reviewed Changes

Copilot reviewed 16 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/testUtils.ts Updates expected targets to use 'presets' instead of 'hats' directory
test/real.integration.test.ts New integration test suite using actual FileService for real file system operations
test/presets.test.ts Renamed from hats.test.ts with updated PresetService references
test/hats.test.ts Removed file (renamed to presets.test.ts)
test/gitCatalog.integration.test.ts New comprehensive test suite for Git catalog functionality including branch listing and commit locking
test/fileService.mock.ts Enhanced mock with new directory deletion and recursive removal methods
src/utils/security.ts Improved path sanitization regex patterns
src/tree/optionsTreeProvider.ts Updated UI labels and added Git repository management options with tooltips
src/services/presetService.ts Renamed from hatService.ts with complete terminology updates
src/services/gitCatalogService.ts New service implementing Git catalog management with branch enumeration and commit locking
src/services/fileService.ts Simplified implementation with new rm method and updated encoding specification
src/models.ts Updated type definitions from Hat/HatSource to Preset/PresetSource
src/extension.ts Major updates: integrated Git catalog service, renamed preset commands, added Git repository management commands
package.json Version bump to 0.4.0, command renames, and updated test script
README.md Documentation updates reflecting "Presets" terminology
CHANGELOG.md Comprehensive changelog for v0.4.0 with all new features and changes

Comment thread src/services/fileService.ts Outdated
Comment thread src/services/fileService.ts Outdated
Comment thread src/services/fileService.ts Outdated
Comment thread src/services/fileService.ts Outdated
Comment thread src/services/fileService.ts Outdated
Comment thread src/services/gitCatalogService.ts Outdated
Comment thread test/gitCatalog.integration.test.ts Outdated
Copilot AI review requested due to automatic review settings September 23, 2025 00:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 19 out of 24 changed files in this pull request and generated 6 comments.

Comment thread src/utils/security.ts Outdated
Comment thread test/real.integration.test.ts Outdated
Comment thread src/services/gitCatalogService.ts
Comment thread src/extension.ts Outdated
Comment thread test/fileService.mock.ts
Comment thread scripts/verify-version-sync.js Outdated
Introduces the `PresetQuickPickItem` interface to provide strong typing for the preset selection UI. This removes the need for `any` type assertions when applying or deleting presets, improving type safety and code readability.

Additionally, this change adds a validation step in the `GitCatalogService` to ensure that a `lockedCommit` in a remote catalog's configuration points to a valid commit object. This prevents errors if the `lockedCommit` references a tag that is not a commit or an invalid object.
The `verify-version-sync.js` script now errors and exits with a non-zero status code if a version mismatch is detected between `package.json` and `source.extension.vsixmanifest`.

Previously, the script would automatically update the manifest, which could hide versioning issues in CI environments. The new behavior ensures that verification steps fail as expected.

To retain the auto-fixing functionality, a `--fix` flag has been introduced. A corresponding `npm run fix:version` script has been added to `package.json` for convenience.

Additionally, this commit includes:
- Refactoring in `MockFileService` to use a more robust path comparison method.
- Improved error handling in the integration test runner.
Copilot AI review requested due to automatic review settings September 23, 2025 01:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 19 out of 24 changed files in this pull request and generated 1 comment.

Comment thread src/utils/security.ts
@joninafta
joninafta requested a review from Copilot September 23, 2025 03:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 19 out of 24 changed files in this pull request and generated no new comments.

@joninafta
joninafta requested a review from Copilot September 23, 2025 03:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 19 out of 24 changed files in this pull request and generated no new comments.

@joninafta
joninafta merged commit d7d09b2 into main Sep 23, 2025
10 checks passed
@joninafta
joninafta deleted the feature/add-gh-rep-branch-catalogs branch September 23, 2025 04:07
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.

2 participants