Skip to content

fix: Make directory task include also support toml files#10219

Merged
jdx merged 2 commits into
jdx:mainfrom
davidolrik:remote-toml-tasks
Jun 6, 2026
Merged

fix: Make directory task include also support toml files#10219
jdx merged 2 commits into
jdx:mainfrom
davidolrik:remote-toml-tasks

Conversation

@davidolrik

@davidolrik davidolrik commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

In the docs it states that

You can include directories of tasks from git repositories using the git:: URL syntax:

[task_config]
includes = [
    "git::ssh://git@github.com/myorg/shared-tasks.git//tasks?ref=v1.0.0"
]

This PR makes that true

Summary by CodeRabbit

  • New Features

    • Remote git includes now support importing individual .toml task files and mixed directory imports that load both TOML-defined and executable tasks.
  • Documentation

    • Rewrote Remote Git Includes docs with clearer URL/path/ref guidance, examples, caching behavior, and instructions to disable cache.
  • Tests

    • Added end-to-end tests covering remote TOML includes (directory and standalone file) with cache-clearing scenarios.

@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Linter diff in the way? Review this PR in Change Stack to focus on meaningful changes and expand context only when needed.

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR extends remote git includes to support individual TOML task files alongside directory includes. The implementation now partitions discovered files into TOML and executable scripts, loading TOML tasks first. Comprehensive E2E tests verify the functionality, and documentation is updated to explain the new capability with examples.

Changes

Remote TOML Task File Includes

Layer / File(s) Summary
Core directory include logic for TOML and executable files
src/config/mod.rs
load_tasks_includes collects directory entries, partitions them into .toml task files and executable scripts, loads TOML files first via load_task_file, then processes executable scripts via Task::from_path while preserving task.dir assignment and Tera rendering.
E2E test infrastructure and scenarios
e2e/helpers/scripts/git_http_backend_server.py, e2e/tasks/test_task_remote_git_includes
Test repository is augmented with xtasks/tasks.toml (simple and table-form TOML tasks) and xtasks/standalone/standalone.toml. New test scenarios clear cache and verify that remote directory includes load both executable and TOML-based tasks, and that direct TOML file includes discover and run standalone TOML tasks.
User documentation
docs/tasks/task-configuration.md
"Remote Git Includes" section now documents that git:: includes can target directories or individual .toml files, with expanded SSH/HTTPS examples, explicit ref usage, path/ref format details, cloning/cache location under MISE_CACHE_DIR/remote-git-tasks-cache, and cache-disable controls (MISE_TASK_REMOTE_NO_CACHE / --no-cache).

🎯 3 (Moderate) | ⏱️ ~20 minutes

"🐰 I hopped through crates and files,
TOML and scripts hand-in-hand,
Cache cleared, tests ran with smiles,
Remote includes now understand,
Little tasks roam far-off land."

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: enabling directory task includes to support TOML files from git repositories, which is the core objective of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@davidolrik davidolrik changed the title feat: Make directory task include also support toml files fix: Make directory task include also support toml files Jun 4, 2026
@greptile-apps

greptile-apps Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes directory-based task_config.includes to also load .toml task files alongside executable scripts, closing the gap between documentation and implementation. It also updates the docs to clarify the directory vs. single-file behaviour and adds end-to-end tests for both scenarios.

  • src/config/mod.rs: load_tasks_includes now partitions directory-scanned files into toml and executable sets, loading each through the appropriate path (load_task_file for .toml, Task::from_path for executables).
  • e2e/helpers/scripts/git_http_backend_server.py: Adds co-located tasks.toml (for the directory-include test) and standalone/standalone.toml (for the direct-file-include test) to the fixture repo before committing.
  • e2e/tasks/test_task_remote_git_includes: Two new test sections verify task listing and execution for both the directory+toml and standalone-toml scenarios, with cache clears between sections.

Confidence Score: 5/5

The change is well-scoped, covered by new e2e tests, and matches the documented behaviour — safe to merge.

The core logic correctly partitions files and reuses the existing, tested load_task_file path for toml files in a directory. The e2e tests exercise both the mixed-directory case and the direct-file case. No data-loss, auth, or correctness issues were found in the changed code.

No files require special attention beyond the self-referential doc link noted in docs/tasks/task-configuration.md.

Important Files Changed

Filename Overview
src/config/mod.rs Extends load_tasks_includes to partition directory-scanned files into toml and executable sets, then loads each through the appropriate path. Logic is sound; one minor asymmetry noted in task_config_dir template handling vs executable path (pre-existing, not introduced here).
e2e/helpers/scripts/git_http_backend_server.py Adds tasks.toml (co-located with executables) and standalone/standalone.toml to the test repo before the git commit, correctly providing fixtures for both new test scenarios.
e2e/tasks/test_task_remote_git_includes Adds two well-structured test sections: directory include with co-located toml tasks and direct single-file toml include; each section properly clears cache beforehand and verifies both task listing and execution.
docs/tasks/task-configuration.md Updates Remote Git Includes docs to mention toml file support; adds examples for both SSH and HTTPS with direct .toml paths. Contains a self-referential anchor link in the new paragraph.

Reviews (8): Last reviewed commit: "fix: Clarify URL format placeholder for ..." | Re-trigger Greptile

Comment thread src/config/mod.rs
Comment thread src/config/mod.rs
Comment on lines +2330 to +2332
for path in toml_files {
tasks.extend(load_task_file(config, &path, config_root, task_config_dir).await?);
}

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.

P2 config_root for directory-resident .toml tasks differs from neighbouring executable tasks

load_task_file sets task.config_root to the config_root parameter, which here is the parent config's root (the directory containing mise.toml). Executable tasks loaded from the same directory get root (the scanned directory itself) as their root via Task::from_path. Any relative path used in a toml task's run, dir, or similar fields will therefore resolve against the parent config root instead of the toml file's own directory, which is likely surprising and inconsistent with what script-based tasks in the same include directory do. The single-file toml path at line 2304 has the same characteristic, but the inconsistency becomes more visible now that both file types can coexist in one directory.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/config/mod.rs (1)

2325-2332: ⚡ Quick win

Make directory file loading order deterministic.

Task precedence can become filesystem-order dependent here. Please sort each bucket (toml_files, exec_files) before loading so overrides are stable across platforms.

Suggested diff
-        let (toml_files, exec_files): (Vec<_>, Vec<_>) = all_files
+        let (mut toml_files, mut exec_files): (Vec<_>, Vec<_>) = all_files
             .into_iter()
             .filter(|p| is_toml(p) || file::is_executable(p))
             .partition(|p| is_toml(p));
+        toml_files.sort();
+        exec_files.sort();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/config/mod.rs` around lines 2325 - 2332, The code partitions all_files
into toml_files and exec_files but doesn't sort them, making load order
nondeterministic; sort both vectors (toml_files and exec_files) after
partitioning (e.g., call sort_unstable or sort on the Vec<PathBuf> using their
Ord impl or a string key) before iterating and calling load_task_file so file
loading/override precedence is stable; ensure you still iterate toml_files first
and then exec_files if that ordering is required.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/tasks/task-configuration.md`:
- Line 761: The in-page anchor for the "task toml file format" link is
incorrect: update the link target in the sentence that currently reads "Included
`.toml` files use the [task toml file format](`#task-config-includes`)" to point
to the actual section anchor `### task_config.includes` (i.e. change the
fragment to `#task_config.includes`) so the link matches the generated header ID
and fixes the MD051 lint error.

---

Nitpick comments:
In `@src/config/mod.rs`:
- Around line 2325-2332: The code partitions all_files into toml_files and
exec_files but doesn't sort them, making load order nondeterministic; sort both
vectors (toml_files and exec_files) after partitioning (e.g., call sort_unstable
or sort on the Vec<PathBuf> using their Ord impl or a string key) before
iterating and calling load_task_file so file loading/override precedence is
stable; ensure you still iterate toml_files first and then exec_files if that
ordering is required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 51733c89-fd4b-4948-b988-9775d64e2ba7

📥 Commits

Reviewing files that changed from the base of the PR and between 7011751 and 1f06f29.

📒 Files selected for processing (4)
  • docs/tasks/task-configuration.md
  • e2e/helpers/scripts/git_http_backend_server.py
  • e2e/tasks/test_task_remote_git_includes
  • src/config/mod.rs

Comment thread docs/tasks/task-configuration.md
@davidolrik davidolrik force-pushed the remote-toml-tasks branch from 1f06f29 to 5188034 Compare June 5, 2026 05:31

@coderabbitai coderabbitai Bot 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.

♻️ Duplicate comments (1)
docs/tasks/task-configuration.md (1)

761-761: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix broken in-page anchor and invalid markdown syntax.

The link has two issues:

  1. Backticks around the URL make the markdown syntax invalid
  2. The fragment doesn't match the section anchor

Remove the backticks and update the fragment to match the generated anchor for ### task_config.includes.

🔗 Proposed fix
-Included `.toml` files use the [task toml file format](`#task-config-includes`) (the keys are task names — there is no `[tasks.…]` prefix). The repository will be cloned and cached in `MISE_CACHE_DIR/remote-git-tasks-cache`. Tasks from the include will be loaded as if they were local. You can disable caching with `MISE_TASK_REMOTE_NO_CACHE=true` or the `--no-cache` flag.
+Included `.toml` files use the [task toml file format](`#task_configincludes`) (the keys are task names — there is no `[tasks.…]` prefix). The repository will be cloned and cached in `MISE_CACHE_DIR/remote-git-tasks-cache`. Tasks from the include will be loaded as if they were local. You can disable caching with `MISE_TASK_REMOTE_NO_CACHE=true` or the `--no-cache` flag.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/tasks/task-configuration.md` at line 761, Update the markdown link in
the sentence that currently reads "Included `.toml` files use the [task toml
file format](`#task-config-includes`)" by removing the backticks around the URL
and fixing the fragment to the generated anchor for the section named
"task_config.includes" (change the link target to "`#task_config.includes`"); keep
the inline `.toml` code span but ensure the link syntax is valid and points to
the correct anchor.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@docs/tasks/task-configuration.md`:
- Line 761: Update the markdown link in the sentence that currently reads
"Included `.toml` files use the [task toml file format](`#task-config-includes`)"
by removing the backticks around the URL and fixing the fragment to the
generated anchor for the section named "task_config.includes" (change the link
target to "`#task_config.includes`"); keep the inline `.toml` code span but ensure
the link syntax is valid and points to the correct anchor.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 10c2a47a-daac-430c-9ffb-763f53b0c1c4

📥 Commits

Reviewing files that changed from the base of the PR and between 1f06f29 and 5188034.

📒 Files selected for processing (4)
  • docs/tasks/task-configuration.md
  • e2e/helpers/scripts/git_http_backend_server.py
  • e2e/tasks/test_task_remote_git_includes
  • src/config/mod.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • e2e/tasks/test_task_remote_git_includes
  • e2e/helpers/scripts/git_http_backend_server.py
  • src/config/mod.rs

@davidolrik davidolrik force-pushed the remote-toml-tasks branch 2 times, most recently from 18e6807 to 9538884 Compare June 6, 2026 07:33

@coderabbitai coderabbitai Bot 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/tasks/task-configuration.md (1)

747-747: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clarify the URL format placeholder for the ref parameter.

The format shows ?<ref> but the examples use ?ref=v1.0.0, where ref is the query parameter name. Consider updating to ?ref=<ref> to make it explicit that ref is the parameter name and <ref> is the value placeholder.

📝 Suggested clarification
-URL format: `git::<protocol>://<url>//<path>?<ref>`
+URL format: `git::<protocol>://<url>//<path>?ref=<ref>`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/tasks/task-configuration.md` at line 747, Update the URL format example
to explicitly show the query parameter name by replacing the ambiguous `?<ref>`
with `?ref=<ref>` so it matches the examples (e.g., `?ref=v1.0.0`); ensure the
documentation line `URL format: git::<protocol>://<url>//<path>?<ref>` is
changed to `URL format: git::<protocol>://<url>//<path>?ref=<ref>` and update
any nearby examples or references to use the same `?ref=<ref>` notation for
consistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@docs/tasks/task-configuration.md`:
- Line 747: Update the URL format example to explicitly show the query parameter
name by replacing the ambiguous `?<ref>` with `?ref=<ref>` so it matches the
examples (e.g., `?ref=v1.0.0`); ensure the documentation line `URL format:
git::<protocol>://<url>//<path>?<ref>` is changed to `URL format:
git::<protocol>://<url>//<path>?ref=<ref>` and update any nearby examples or
references to use the same `?ref=<ref>` notation for consistency.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5d2c07c7-70c4-456d-9188-73fab10ced8e

📥 Commits

Reviewing files that changed from the base of the PR and between 18e6807 and 9538884.

📒 Files selected for processing (4)
  • docs/tasks/task-configuration.md
  • e2e/helpers/scripts/git_http_backend_server.py
  • e2e/tasks/test_task_remote_git_includes
  • src/config/mod.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • e2e/tasks/test_task_remote_git_includes
  • e2e/helpers/scripts/git_http_backend_server.py
  • src/config/mod.rs

@davidolrik davidolrik force-pushed the remote-toml-tasks branch 2 times, most recently from 5d933a8 to d230e4d Compare June 6, 2026 21:24
@greptile-apps

greptile-apps Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@davidolrik davidolrik force-pushed the remote-toml-tasks branch 2 times, most recently from f299d22 to 6efedf7 Compare June 6, 2026 22:07
@davidolrik davidolrik force-pushed the remote-toml-tasks branch from 6efedf7 to ed25ce1 Compare June 6, 2026 22:13
@jdx jdx merged commit d579146 into jdx:main Jun 6, 2026
34 checks passed
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