Skip to content

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Nov 12, 2025

Summary

Adds a comprehensive mise task validate command that validates tasks for common errors and issues.

Validation Checks

The command performs 11 types of validation:

  1. Circular Dependencies - Detects dependency cycles between tasks
  2. Missing Task References - Finds dependencies that reference non-existent tasks
  3. Usage Spec Parsing - Validates #USAGE and #MISE directives
  4. Timeout Format - Checks timeout values are valid durations
  5. Alias Conflicts - Detects duplicate aliases across tasks
  6. File Existence - Verifies file-based tasks exist and warns if not executable
  7. Directory Templates - Validates directory paths and template rendering
  8. Shell Commands - Checks shell executables exist (for absolute paths)
  9. Source Glob Patterns - Validates glob patterns for task sources
  10. Output Glob Patterns - Validates glob patterns for task outputs
  11. Run Entry Validation - Ensures tasks reference valid dependencies and have content

Features

  • Human-readable output with colored error/warning indicators
  • JSON output format for CI/CD integration (--json)
  • Filter by severity (--errors-only)
  • Validate specific tasks or all tasks
  • Support for hidden tasks (--hidden)
  • Smart detection of meta-tasks (tasks with only dependencies)

Exit Codes

  • 0: All validations passed (or only warnings)
  • 1: One or more errors found

Examples

# Validate all tasks
mise task validate

# Validate specific tasks
mise task validate build test

# JSON output for CI integration
mise task validate --json

# Only show errors (skip warnings)
mise task validate --errors-only

Test Coverage

  • Comprehensive e2e test suite (e2e/tasks/test_task_validate)
  • Tests all validation rules
  • Tests output formats (human-readable and JSON)
  • Tests filtering options

🤖 Generated with Claude Code


Note

Adds mise tasks validate to validate tasks (human/JSON output, errors-only), with docs, manpage, completions, and e2e tests.

  • CLI/Backend:
    • Implement src/cli/tasks/validate.rs and wire into src/cli/tasks/mod.rs as validate subcommand.
    • Performs 11 validations (circular deps, missing refs, usage parsing, timeout, alias conflicts, file/dir, shell, glob patterns, run entries) with human and --json output and --errors-only filter.
  • Docs/Specs:
    • Add docs/cli/tasks/validate.md and list command in docs/cli/index.md, docs/cli/tasks.md.
    • Update man page man/man1/mise.1 and usage spec mise.usage.kdl.
    • Expose in VitePress command map docs/.vitepress/cli_commands.ts.
  • Completions:
    • Update Fig spec xtasks/fig/src/mise.ts to include tasks validate with options and args.
  • Tests:
    • Add e2e coverage e2e/tasks/test_task_validate exercising success, failures, JSON output, and flags.

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

Adds a comprehensive validation command for tasks that checks for common
errors and issues including:

- Circular dependencies between tasks
- Missing task references in dependencies
- Invalid #USAGE and #MISE directive parsing
- Invalid timeout format validation
- Duplicate alias detection across tasks
- File existence verification for file-based tasks
- Directory path and template validation
- Shell command validation
- Invalid glob pattern detection in sources/outputs
- Run entry validation and empty task detection

Features:
- Human-readable output with colored error/warning indicators
- JSON output format for CI/CD integration (--json)
- Filter by severity (--errors-only)
- Validate specific tasks or all tasks
- Support for hidden tasks (--hidden)
- Smart detection of meta-tasks (tasks with only dependencies)

Exit codes:
- 0: All validations passed (or only warnings)
- 1: One or more errors found

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings November 12, 2025 21:44
@jdx jdx changed the title feat(cli): add mise task validate command for task validation feat(tasks): add mise task validate command for task validation Nov 12, 2025
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 introduces a new mise task validate command that performs comprehensive validation of task configurations to detect common errors and issues before runtime.

Key changes:

  • Implements 11 validation checks including circular dependencies, missing references, timeout formats, alias conflicts, file existence, glob patterns, and more
  • Supports both human-readable and JSON output formats for CI/CD integration
  • Includes filtering options (--errors-only, --hidden) and specific task validation

Reviewed Changes

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

File Description
src/cli/tasks/validate.rs New module implementing the task validation command with 11 validation checks
src/cli/tasks/mod.rs Registers the new validate subcommand in the tasks CLI module
e2e/tasks/test_task_validate Comprehensive end-to-end test suite covering all validation scenarios

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

category: "not-executable".to_string(),
message: format!("Task file is not executable: {}", file::display_path(file)),
details: Some(
"Consider making the file executable or setting 'hide=false'".to_string(),
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The suggestion mentions 'hide=false' but should be 'hide=true' since the default is hide=false and executable files without this flag would typically be auto-discovered as tasks.

Suggested change
"Consider making the file executable or setting 'hide=false'".to_string(),
"Consider making the file executable or setting 'hide=true'".to_string(),

Copilot uses AI. Check for mistakes.
jdx added 2 commits November 12, 2025 15:52
…e file warning

- Only report duplicate alias conflicts once (for the first task alphabetically)
  instead of reporting for each task with the conflicting alias
- Fix non-executable file warning to suggest 'chmod +x' instead of the
  confusing 'hide=false' suggestion which doesn't address executability
autofix-ci bot and others added 3 commits November 12, 2025 22:03
Fixes bug where validate_run_entries only checked task names and display
names but not aliases, causing false positive errors when run entries
referenced tasks by their aliases. Now uses a shared task_exists() helper
that checks all three (name, display_name, and aliases) consistently.
@jdx jdx enabled auto-merge (squash) November 12, 2025 22:26
@jdx jdx disabled auto-merge November 12, 2025 22:26
Fixes inconsistency where task_exists() helper checked task aliases but
get_specific_tasks() didn't, preventing users from running commands like
`mise task validate b` when `b` is a task alias. Now both functions use
the same lookup logic (name, display_name, and aliases).

Added e2e test verifying task validation works with both task names and
their aliases on the command line.
.to_string(),
),
});
}
Copy link

Choose a reason for hiding this comment

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

Bug: Incorrect Validation Flags Platform-Specific Execution

The no-execution validation incorrectly fails tasks that have platform-specific run entries. The check uses task.run().is_empty() which returns different fields based on platform (either run or run_windows). A task with only run_windows defined will fail validation on non-Windows platforms even though it's valid, and vice versa. The validation should check both task.run and task.run_windows are empty instead of using the platform-dependent task.run() method.

Fix in Cursor Fix in Web

@jdx jdx enabled auto-merge (squash) November 12, 2025 22:33
@jdx jdx merged commit 3ed2de8 into main Nov 12, 2025
29 checks passed
@jdx jdx deleted the feat/task-validate branch November 12, 2025 22:40
@github-actions
Copy link

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.11.3 x -- echo 19.5 ± 0.8 18.3 24.3 1.00
mise x -- echo 19.7 ± 0.7 18.5 25.9 1.01 ± 0.06

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.11.3 env 18.8 ± 0.6 18.0 24.6 1.00
mise env 19.3 ± 0.9 18.2 25.4 1.02 ± 0.06

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.11.3 hook-env 19.2 ± 0.8 18.1 24.7 1.00
mise hook-env 20.4 ± 1.0 18.9 28.5 1.06 ± 0.07

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.11.3 ls 16.7 ± 0.6 15.6 21.0 1.00
mise ls 16.8 ± 0.7 15.8 21.6 1.01 ± 0.06

xtasks/test/perf

Command mise-2025.11.3 mise Variance
install (cached) 108ms 109ms +0%
ls (cached) 65ms 65ms +0%
bin-paths (cached) 74ms 74ms +0%
task-ls (cached) 436ms 445ms -2%

jdx pushed a commit that referenced this pull request Nov 13, 2025
### 📦 Registry

- add xcsift by @alexey1312 in
[#6923](#6923)
- add tools: magika & xxh by @IceCodeNew in
[#6909](#6909)
- add aliases to aqua-backend tools by @IceCodeNew in
[#6910](#6910)

### 🚀 Features

- **(tasks)** add `mise task validate` command for task validation by
@jdx in [#6958](#6958)

### 🐛 Bug Fixes

- **(cli)** intercept --help flag to show task help instead of executing
task by @jdx in [#6955](#6955)
- remove temporary files after install by @vmeurisse in
[#6948](#6948)

### 📚 Documentation

- **(snapcraft)** update `summary` & `description` shown in snapcraft.io
by @phanect in [#6926](#6926)
- Change package example in go.md by @nachtjasmin in
[#6862](#6862)
- paranoid mode does not untrust global config by @iloveitaly in
[#6952](#6952)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#6932](#6932)

### New Contributors

- @iloveitaly made their first contribution in
[#6952](#6952)
- @nachtjasmin made their first contribution in
[#6862](#6862)
- @IceCodeNew made their first contribution in
[#6910](#6910)
- @alexey1312 made their first contribution in
[#6923](#6923)

## 📦 Aqua Registry Updates

#### New Packages (6)

- [`CrociDB/bulletty`](https://github.com/CrociDB/bulletty)
- [`Gaurav-Gosain/tuios`](https://github.com/Gaurav-Gosain/tuios)
- [`ck-zhang/reddix`](https://github.com/ck-zhang/reddix)
- [`hokaccha/spannerdef`](https://github.com/hokaccha/spannerdef)
-
[`lasantosr/intelli-shell`](https://github.com/lasantosr/intelli-shell)
-
[`zerocore-ai/microsandbox`](https://github.com/zerocore-ai/microsandbox)

#### Updated Packages (4)

- [`cue-lang/cue`](https://github.com/cue-lang/cue)
- [`flutter/flutter`](https://github.com/flutter/flutter)
- [`phiresky/ripgrep-all`](https://github.com/phiresky/ripgrep-all)
- [`topgrade-rs/topgrade`](https://github.com/topgrade-rs/topgrade)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Bump to 2025.11.4 with aqua-registry additions/updates,
dependency/tooling refresh, updated completions/docs, and
packaging/version files.
> 
> - **Release/Versioning**:
> - Bump to `2025.11.4` in `Cargo.toml`, `default.nix`,
`packaging/rpm/mise.spec`, `snapcraft.yaml`, and `README.md`.
> - **Aqua Registry**:
> - *New packages*: `CrociDB/bulletty`, `Gaurav-Gosain/tuios`,
`ck-zhang/reddix`, `hokaccha/spannerdef`, `lasantosr/intelli-shell`,
`zerocore-ai/microsandbox` (owner change + aliases).
> - *Updates*: `cue-lang/cue` (version rules), `flutter/flutter`
(channelized URLs), `phiresky/ripgrep-all` (version/asset rules),
`topgrade-rs/topgrade` (extensive version/asset overrides).
> - **Dependencies/Tooling**:
> - `Cargo.lock`: bump `aws-lc-*`, `hyper 1.8.0`, `indicatif 0.18.3`,
`luajit-src`, `num-bigint-dig`, `crypto-common`, `usage-lib`, etc.
> - `mise.lock`: update `bun`, `cargo-binstall`, `cargo-edit`, `node`,
`pre-commit`, `usage-cli`.
> - **Completions**:
> - Update usage spec cache filenames to
`usage__usage_spec_mise_2025_11_4.spec` in `completions/*`.
> - **Docs**:
> - Add `CHANGELOG.md` entry for `2025.11.4`; bump stars to `21.3k` in
`docs/.vitepress/stars.data.ts`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
a1e62ee. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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