Skip to content

Comments

feat(task): support glob patterns in task_config.includes#7870

Merged
jdx merged 2 commits intomainfrom
feat/task-includes-glob
Jan 28, 2026
Merged

feat(task): support glob patterns in task_config.includes#7870
jdx merged 2 commits intomainfrom
feat/task-includes-glob

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Jan 28, 2026

Summary

  • Adds support for glob patterns in task_config.includes
  • Patterns containing *, ?, or [ are now expanded using glob matching
  • Non-glob paths continue to work as before (literal path matching)

Example:

[task_config]
includes = ["tasks/*.toml", "extra-tasks.toml"]

This allows users to include all task files from a directory without listing each one individually.

Fixes: #7860

Test plan

  • Added e2e test test_task_includes_glob that verifies:
    • Glob patterns like tasks/*.toml discover all matching files
    • Tasks from glob-matched files are properly loaded and executable
    • Mixing glob patterns with literal paths works correctly

🤖 Generated with Claude Code


Note

Adds glob expansion for task includes, enabling patterns like tasks/*.toml.

  • Introduces is_glob_pattern and expand_task_include to resolve includes to concrete paths
  • Updates load_file_tasks and task_includes_for_dir to expand globs (while keeping git:: URLs handled separately)
  • Ensures both directories and individual TOML task files from glob matches are loaded and executed
  • Adds e2e test test_task_includes_glob validating discovery, execution, and mixing glob with literal paths

Written by Cursor Bugbot for commit 4a0649c. This will update automatically on new commits. Configure here.

Adds support for glob patterns like `tasks/*.toml` in the
`task_config.includes` configuration option. Previously, each
include path was treated as a literal path. Now patterns containing
`*`, `?`, or `[` are expanded using glob matching.

Example:
```toml
[task_config]
includes = ["tasks/*.toml"]
```

Fixes: #7860

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 28, 2026 14:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds glob pattern support to task_config.includes, allowing users to include multiple task files using wildcard patterns like tasks/*.toml instead of listing each file individually.

Changes:

  • Modified task include resolution to detect and expand glob patterns (containing *, ?, or [)
  • Changed from filter_map to flat_map to handle one-to-many pattern-to-path mapping
  • Added e2e test validating glob pattern expansion and mixing glob with literal paths

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/config/mod.rs Implements glob pattern detection and expansion for task includes
e2e/tasks/test_task_includes_glob Tests glob pattern functionality with multiple task files and mixed path types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return vec![];
}
// Check if pattern contains glob characters
if p.contains('*') || p.contains('?') || p.contains('[') {
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The glob detection logic is incomplete. Glob patterns can also contain ] (closing bracket for character classes) and { or } (for brace expansion like {a,b}). Additionally, escaped glob characters (e.g., \*) would be incorrectly treated as glob patterns. Consider using a more robust detection method or checking if the glob function returns multiple results to determine if expansion occurred.

Copilot uses AI. Check for mistakes.
// Check if pattern contains glob characters
if p.contains('*') || p.contains('?') || p.contains('[') {
// Use glob expansion
glob(dir, &p).unwrap_or_default()
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

Using unwrap_or_default() silently ignores glob errors, making it difficult for users to debug invalid patterns. Consider logging the error or propagating it so users receive feedback when their glob pattern is malformed.

Suggested change
glob(dir, &p).unwrap_or_default()
glob(dir, &p).unwrap_or_else(|err| {
eprintln!(
"Failed to expand glob pattern '{}' in '{}': {}",
p,
dir.display(),
err
);
Vec::new()
})

Copilot uses AI. Check for mistakes.
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

- Extract helper functions `is_glob_pattern` and `expand_task_include`
  to reduce code duplication
- Add `]`, `{`, `}` to glob metacharacter detection
- Log warnings for glob errors instead of silently ignoring them
- Apply glob expansion to `load_file_tasks` so globs work in global
  config includes, not just local configs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx enabled auto-merge (squash) January 28, 2026 15:14
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.8 x -- echo 20.7 ± 0.3 20.0 22.7 1.00
mise x -- echo 21.5 ± 0.3 20.5 22.3 1.04 ± 0.02

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.8 env 20.1 ± 0.5 19.4 25.4 1.00
mise env 20.9 ± 0.3 20.1 22.2 1.04 ± 0.03

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.8 hook-env 20.4 ± 0.2 19.8 21.4 1.00
mise hook-env 21.3 ± 0.4 20.5 26.9 1.05 ± 0.02

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.1.8 ls 18.2 ± 0.2 17.5 19.6 1.00
mise ls 19.1 ± 0.3 18.4 20.3 1.05 ± 0.02

xtasks/test/perf

Command mise-2026.1.8 mise Variance
install (cached) 112ms 113ms +0%
ls (cached) 68ms 68ms +0%
bin-paths (cached) 73ms 73ms +0%
task-ls (cached) 291ms 292ms +0%

@jdx jdx merged commit db623ff into main Jan 28, 2026
35 checks passed
@jdx jdx deleted the feat/task-includes-glob branch January 28, 2026 15:24
mise-en-dev added a commit that referenced this pull request Jan 28, 2026
### 🚀 Features

- **(doctor)** add backend mismatch warnings by @jdx in
[#7847](#7847)
- **(http)** add rename_exe support for archive extraction by @jdx in
[#7874](#7874)
- **(http)** send x-mise-ci header for CI environment tracking by @jdx
in [#7875](#7875)
- **(install)** auto-install plugins from [plugins] config section by
@jdx in [#7856](#7856)
- **(registry)** add vercel by @mikecurtis in
[#7844](#7844)
- **(task)** support glob patterns in task_config.includes by @jdx in
[#7870](#7870)
- **(task)** add task templates for reusable task definitions by @jdx in
[#7873](#7873)

### 🐛 Bug Fixes

- **(backend)** change registry mismatch log from info to debug by @jdx
in [#7858](#7858)
- **(ci)** use squash merge for auto-merge-release workflow by @jdx in
[7e5e71e](7e5e71e)
- **(ci)** remove --auto flag to merge immediately when CI passes by
@jdx in
[23ed2ed](23ed2ed)
- **(github)** select platform-matching provenance file for SLSA
verification by @jdx in [#7853](#7853)
- **(go)** filter out version "1" from available versions by @jdx in
[#7871](#7871)
- **(install)** skip CurDir components when detecting archive structure
by @jdx in [#7868](#7868)
- **(pipx)** ensure Python minor version symlink exists for postinstall
hooks by @jdx in [#7869](#7869)
- **(registry)** prevent duplicate -stable suffix in Flutter download
URLs by @jdx in [#7872](#7872)
- **(task)** pass env to usage parser for env-backed arguments by @jdx
in [#7848](#7848)
- **(task)** propagate MISE_ENV to child tasks when using -E flag by
@jdx in
[06ee776](06ee776)
- **(vfox-dotnet)** use os.execute() to fix Windows installation by
@prodrigues1912 in [#7843](#7843)

### 📚 Documentation

- update cache-behavior with env_cache information by @jdx in
[#7849](#7849)

### ◀️ Revert

- remove task inheritance from parent configs in monorepos by @jdx in
[#7851](#7851)
- Revert "fix(ci): remove --auto flag to merge immediately when CI
passes" by @jdx in
[0606187](0606187)

### 📦 Registry

- add mago
([aqua:carthage-software/mago](https://github.com/carthage-software/mago))
by @scop in [#7845](#7845)

### Chore

- **(ci)** auto-merge release branch into main daily at 4am CST by @jdx
in [#7852](#7852)

### New Contributors

- @mikecurtis made their first contribution in
[#7844](#7844)
- @prodrigues1912 made their first contribution in
[#7843](#7843)
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