ctl-core 0.6.12

Shared clap chassis for the *ctl CLIs
Documentation
# Loaded when MISE_ENV contains `dev` (local default via .miserc.toml).
# Compile this checkout. Not used by Version PR.

# The latest stable mise is the floor; CI pins the same version.
min_version = "2026.10.3"

# ctl-core baseline: begin tools
[tools]
"github:crate-ci/committed" = "1.1.11"
lefthook = "2.1.10"
rust = [
  # Pinned stable: build, lint, test.
  { version = "1.99.0", components = "clippy", mr_boxington = true },
  # Formatting only, for rustfmt's unstable options.
  { version = "nightly-2026-09-29", profile = "minimal", components = "rustfmt" },
]
mr-boxington = "1.20.0"
"github:EmbarkStudios/cargo-deny" = "0.20.2"
"github:bnjbvr/cargo-machete" = "0.9.2"
"github:obi1kenobi/cargo-semver-checks" = "0.51.0"
jq = "1.8.2"
# ctl-core baseline: end tools

# mise sets RUSTUP_TOOLCHAIN; without it, rustc resolves rust-toolchain.toml.
# Every package's rust-version must equal the pinned stable.
[tasks."check:toolchain"]
description = "mise.dev.toml, rust-toolchain.toml, and rust-version pin the same stable"
run = [
  '[ "$(rustc -V)" = "$(env -u RUSTUP_TOOLCHAIN RUSTUP_AUTO_INSTALL=0 rustc -V)" ] || { echo "✘ mise.dev.toml and rust-toolchain.toml pin different toolchains"; exit 1; }',
  '''[ -z "$(cargo metadata --no-deps --format-version 1 | jq -r --arg v "$(rustc -V | cut -d' ' -f2)" '.packages[] | select(.rust_version != $v) | .name')" ] || { echo "✘ a rust-version differs from the pinned stable"; exit 1; }''',
]

[tasks.format]
description = "rustfmt check on the formatting nightly"
run = "cargo +nightly-2026-09-29 fmt --all -- --check"

[tasks.lint]
description = "clippy -D warnings"
run = "cargo clippy --all-targets --all-features -- -D warnings"

[tasks."check:features"]
description = "Compile each advertised feature set without extra features"
run = [
  "cargo check --no-default-features",
  "cargo check --no-default-features --features document",
  "cargo check --no-default-features --features render",
  "cargo check --no-default-features --features surface-model",
  "cargo check --no-default-features --features surface-serde",
  "cargo check --no-default-features --features surface-templates",
  "cargo check --no-default-features --features surface",
  "cargo check --no-default-features --features validate",
  "cargo check --no-default-features --features input",
  "cargo check --no-default-features --features fixture",
  "cargo check --no-default-features --features served",
  "cargo check --no-default-features --features baseline",
  "cargo check --no-default-features --features usage",
  "cargo check --no-default-features --features json",
  "cargo check --no-default-features --features cli",
  "cargo check --no-default-features --features view",
  "cargo check --no-default-features --features help",
  "cargo check --no-default-features --features app",
  "cargo check --no-default-features --features app,usage",
  "cargo check --no-default-features --features schema",
]

[tasks.test]
description = "Unit and integration tests"
run = "cargo test --all-features --lib --bins --tests"
# Stops a hung test run instead of holding the gate. The limit also counts
# compile time and waits on the target/ lock, so it sits far above a cold build.
timeout = "30m"

[tasks."test:doc"]
description = "Doc-tests"
run = "cargo test --doc --all-features"
timeout = "30m"

[tasks.deny]
description = "License, ban, and source policy (offline)"
run = "cargo deny check licenses bans sources"

[tasks."deny:advisories"]
description = "RustSec advisories and yanked crates (network)"
run = "cargo deny check advisories"

[tasks.deps]
description = "Unused crate analysis"
run = "cargo-machete --with-metadata"

# CI runs it before packaging; it compares against the release on crates.io.
[tasks.semver]
description = "Public API changes against the last release (network)"
run = "cargo semver-checks"

[tasks.commit-msg]
description = "Lint the git commit-msg file with committed"
usage = 'arg "<file>" help="Path to the commit message file"'
run = 'committed --commit-file "${usage_file}"'

[tasks.commits]
description = "Lint commit messages with committed"
usage = 'arg "[commits]" default="HEAD" help="Commit or range"'
run = 'committed "${usage_commits}"'

[tasks.verify]
description = "Toolchain pins, format, lint, feature sets, tests, doc-tests, deny, unused crates"
depends = [
  "check:toolchain", "format", "lint", "check:features",
  "test", "test:doc", "deny", "deps",
]