Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds glob-pattern support to manifest entry source paths so a single entry can sync and status-check multiple matched files while preserving relative structure under a computed “glob base”.
Changes:
- Added glob expansion support to
syncEntryanddetermineState(viafast-glob) plus helper utilities (isGlobPattern,globBase). - Added Vitest-based test suites covering glob behavior for sync and status.
- Updated CI to run tests and added dependencies/scripts to support test execution.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/sync.test.ts | New tests for glob detection/base extraction and sync behavior across multiple matched files. |
| tests/status.test.ts | New tests for status determination across glob-matched files (missing/outdated/current). |
| src/types.ts | Updated ManifestEntry.source documentation to include glob patterns. |
| src/sync.ts | Implemented glob matching + copy logic; introduced isGlobPattern and globBase. |
| src/commands/status.ts | Implemented glob-aware status checks; exported determineState for testing. |
| package.json | Added fast-glob, vitest, and a test script. |
| package-lock.json | Locked new dependencies; reflects updated dependency tree. |
| .github/workflows/ci.yml | Added npm test step to CI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+62
to
+65
| for (const absMatch of matches) { | ||
| const relPath = path.relative(absBase, absMatch); | ||
| const destFile = path.join(destPath, relPath); | ||
| const sourceDigest = fileHash(absMatch); |
Comment on lines
+20
to
+23
| /** Returns true if the source path contains any glob metacharacter. */ | ||
| export function isGlobPattern(source: string): boolean { | ||
| return /[*?[\]{}]/.test(source); | ||
| } |
Comment on lines
+66
to
+73
| const matches = fg.sync(entry.source, { cwd: cacheDir, absolute: true, onlyFiles: true }); | ||
| if (matches.length === 0) return 'missing'; | ||
| for (const absMatch of matches) { | ||
| const relPath = path.relative(absBase, absMatch); | ||
| const destFile = path.join(destinationPath, relPath); | ||
| if (!fs.existsSync(destFile)) return 'missing'; | ||
| const sourceDigest = fileHash(absMatch); | ||
| const destDigest = fileHash(destFile); |
|
|
||
| // Glob pattern: expand and check each matched file | ||
| if (isGlobPattern(entry.source)) { | ||
| if (!fs.existsSync(cacheDir)) return 'missing'; |
| "vitest": "^4.0.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=16.7.0" |
Comment on lines
49
to
+51
|
|
||
| // Glob pattern: expand matches and copy each file preserving relative structure | ||
| if (isGlobPattern(entry.source)) { |
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.
This pull request adds support for glob patterns in the
sourcefield of manifest entries, allowing users to specify and synchronize multiple files or directories using wildcards. It also introduces new helper functions for glob detection and base path extraction, updates the workflow to run tests, and adds comprehensive tests for the new functionality.Glob pattern support and sync improvements:
skills/canvas/**) in thesourcefield ofManifestEntry, updating both thesyncEntryanddetermineStatelogic to handle multiple file matches and preserve directory structure. (F82ead3fL17, Fb42b1acL58R58, src/types.tsL9-R9)isGlobPatternandglobBaseinsrc/sync.tsto detect glob patterns and extract their non-glob base directory. (F82ead3fL17, tests/sync.test.tsR1-R152)determineStatefunction insrc/commands/status.tsto check for missing, outdated, or current status across all files matched by a glob pattern. (Fb42b1acL58R58)Testing and workflow:
tests/sync.test.tsandtests/status.test.tsto cover glob pattern matching, directory structure preservation, and edge cases for both syncing and status determination. [1] [2]package.jsonto addvitestas the test runner, include atestscript, and addedfast-globas a dependency for glob matching. The CI workflow now runs tests as part of the build. [1] [2]These changes significantly improve the flexibility and reliability of file synchronization by supporting advanced file selection patterns and ensuring correctness through automated testing.