Skip to content

fix(multi-get): support brace expansion patterns in glob matching#424

Open
antonio-mello-ai wants to merge 1 commit intotobi:mainfrom
antonio-mello-ai:fix/multi-get-brace-expansion
Open

fix(multi-get): support brace expansion patterns in glob matching#424
antonio-mello-ai wants to merge 1 commit intotobi:mainfrom
antonio-mello-ai:fix/multi-get-brace-expansion

Conversation

@antonio-mello-ai
Copy link
Copy Markdown
Contributor

Summary

  • Brace expansion patterns like {doc1,doc2}.md or collection/{a,b}.md were incorrectly parsed as comma-separated file lists instead of being passed to the glob matcher (picomatch). The comma-detection heuristic checked for * and ? but not {, so any pattern containing {a,b} was split on the comma and treated as two separate file lookups.
  • matchFilesByGlob only matched against qmd://collection/path (virtual path) and path (relative to collection root), but not collection/path — so glob patterns prefixed with a collection name never matched anything.

Changes

  1. src/store.ts (findDocuments): Add !pattern.includes('{') to the isCommaSeparated check so brace patterns route to picomatch
  2. src/cli/qmd.ts (multiGet): Same fix for the CLI code path
  3. src/store.ts (matchFilesByGlob): Add collection/path as a third matching target alongside virtual_path and path
  4. test/store.test.ts: 4 new tests covering brace expansion, collection-prefixed brace patterns, and collection/path glob matching

Test plan

  • All 205 store tests pass (including 4 new)
  • All 56 MCP tests pass
  • Build succeeds cleanly

🤖 Generated with Claude Code

Brace expansion patterns like `{doc1,doc2}.md` or `collection/{a,b}.md`
were incorrectly parsed as comma-separated file lists instead of being
passed to the glob matcher (picomatch). This happened because the
comma-detection heuristic only checked for `*` and `?` but not `{`.

Also adds `collection/path` matching in `matchFilesByGlob` so patterns
like `my-collection/{file1,file2}.md` work — previously the glob only
matched against `qmd://collection/path` (virtual) and `path` (relative
to collection root), missing the `collection/path` form.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@antonio-mello-ai
Copy link
Copy Markdown
Contributor Author

Friendly ping — this has been open for ~2 weeks. CI is green, 4 new tests passing. Happy to address any feedback. Thanks!

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.

1 participant