Skip to content

feat(cli): foundry inspired features - #255

Merged
0xClandestine merged 13 commits into
devfrom
feat/forge-cli-parity
Jun 2, 2026
Merged

feat(cli): foundry inspired features#255
0xClandestine merged 13 commits into
devfrom
feat/forge-cli-parity

Conversation

@0xClandestine

@0xClandestine 0xClandestine commented Jun 2, 2026

Copy link
Copy Markdown
Owner

Proposed changes

Implements tile-forge CLI parity across the metaltile-cli crate.

Global flags propagated to all subcommands:

  • --verbose/-v (repeatable count: -v, -vv, -vvv)
  • --quiet, --json (machine-readable output)
  • --color always|auto|never (sets CLICOLOR_FORCE/NO_COLOR)
  • --threads/-j (rayon pool size)
  • --profile / TILE_PROFILE env var (selects a named config profile)

Layered TileConfig via figment:

  1. Built-in defaults
  2. extends = "..." base file (tilde-expanded, resolved relative to tile.toml)
  3. tile.toml found by walking up from CWD
  4. [profiles.<name>] section overrides
  5. TILE_* environment variables
  6. CLI flags (applied at harness level)

Config sub-tables ([bench], [build], [runner]) with effective_*() accessors. Env-var interpolation (${VAR} / ${VAR:-default}) applied to string fields. Unknown-key and deprecated-coexistence warnings collected and printed after each command.

New subcommands:

  • tile config [--json] — print effective merged configuration
  • tile clean [--snapshots] [--all] — remove build artefacts
  • tile completions <shell> — emit shell completion scripts (bash/zsh/fish/powershell)

tile build (forge-style):

  • Header: Compiling N kernels with xcrun metal X.Y
  • Spinner while compiling in parallel
  • Footer: xcrun metal X.Y finished in X.XXs + Compiler run successful! / Build FAILED. N error(s).
  • Per-kernel name dtypes ok lines suppressed by default; shown with -v
  • --names/-n: list kernel names + dtypes without compiling

tile test (forge-style):

  • Braille spinner: [⠋] Preparing tests...
  • Per-suite grouping: Ran N tests for <suite> → per-test [PASS]/[FAIL: err=, tol=]Suite result: ok. N passed; M failed; finished in X.XXs
  • Failing tests block re-listed at end
  • Overall: Ran N test suites in X.XXs: M passed, K failed (total N tests)
  • -vv: print generated MSL for failing tests
  • -vvv: print generated MSL for all tests
  • --show-progress: live [N/M] label indicator on stderr before each result
  • --summary: per-suite table (Suite / Passed / Failed / Tests / Time)
  • --detailed (requires --summary): per-test rows (Suite / Test / Result)
  • --fail-fast: stop on first failure
  • --list/-l: list matching tests without running

Other improvements:

  • Positional <path> on bench/test disambiguates: contains / or *--match-path glob, otherwise → --filter substring
  • Structured exit codes: TileExitCode (0 success, 1 test failure, 2 build failure, 3 regression, 10 config error)
  • Harness struct centralises config + global flag access for all commands
  • tile init scaffolds tile.toml with correct sub-table format + CI profile example

Crates affected

  • metaltile-core (IR types, ops)
  • metaltile-macros (proc macros, body parser)
  • metaltile-codegen (MSL lowering, passes)
  • metaltile-runtime (Metal dispatch)
  • metaltile-std (kernel stdlib, op files)
  • metaltile-cli (tile binary)

Testing

Config unit tests added in config.rs. All tests pass.

Checklist

  • PR title uses a conventional-commit prefix
  • make clippy passes clean
  • make fmt-check passes

…mands

Implement tile-forge parity across the CLI and config layer:

- Global flags: --verbose/-v (Count), --quiet, --json, --color, --threads/-j,
  --profile (+ TILE_PROFILE env var)
- Layered TileConfig via figment: defaults → extends base → tile.toml →
  [profiles.<name>] → TILE_* env vars → CLI flags
- Config sub-tables [bench], [build], [runner] with effective_*() accessors
  that take precedence over backward-compat flat fields
- Extends/inheritance: `extends = "~/.metaltile/global.toml"` in tile.toml
- Profile system: `[profiles.ci]` sections with per-profile sub-table overrides
- Env-var interpolation: ${VAR} / ${VAR:-default} in string config values
- Unknown-key warnings and deprecated-field-coexistence warnings
- New subcommands: `tile config` (print effective config), `tile clean`
  (remove build artefacts), `tile completions` (shell completion scripts)
- Positional <path> on bench/test disambiguates to --match-path or --filter
- Structured exit codes via TileExitCode (0/1/2/3/10)
- clap_complete integration for bash/zsh/fish/powershell completions
- add gap-analysis and implementation-plan docs
@github-actions github-actions Bot added the feature New feature label Jun 2, 2026
tile test:
- Group tests by kernel suite with 'Ran N tests for kernel_name' header
- [PASS] / [FAIL: reason] format with per-test accuracy annotation
- Per-suite 'Suite result: ok/FAILED. N passed; M failed; finished in X.XXms'
- Failing tests section re-listed at bottom
- Overall 'Ran N suites in X.XXms: M passed, K failed (total N tests)'
- --fail-fast: stop after first failure
- --list / -l: list matching tests without running them

tile build:
- 'Compiling N kernels with xcrun metal X.Y' header (reads xcrun version)
- Clean per-kernel rows without table borders
- 'xcrun metal X.Y finished in X.XXs' timing footer
- 'Compiler run successful!' or 'Build FAILED. N error(s).' result line
@0xClandestine 0xClandestine changed the title feat(cli): forge CLI parity — global flags, config system, new subcommands feat(cli): foundry inspired features Jun 2, 2026
tile test:
- Spinner label: "Compiling..." → "Preparing tests..."
- -vv: print generated MSL for failing tests
- -vvv: print generated MSL for all tests
- --show-progress: live [N/M] label indicator on stderr
- --summary: per-suite table (Suite/Passed/Failed/Tests/Time)
- --detailed (requires --summary): per-test rows (Suite/Test/Result)

tile build:
- Per-kernel ok lines suppressed at default verbosity (-v to show)
- --names/-n: list kernel names + dtypes without compiling
The paths filter was preventing tile.yml from firing on PRs that only
touch metaltile-cli or other non-ffai/non-mlx paths. The changes job
already gates bench shards at the job level — the trigger-level filter
is redundant and causes silent skips.
…ards

matrix context is not available in job-level if expressions; split the
bench matrix job into bench-ffai and bench-mlx with explicit conditions.
Update bench-merge to depend on both.
@0xClandestine
0xClandestine merged commit 8f6be51 into dev Jun 2, 2026
12 of 13 checks passed
@0xClandestine
0xClandestine deleted the feat/forge-cli-parity branch June 2, 2026 21:33
@ekryski

ekryski commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Some nice changes here. Will rebase #247 on this now that it is merged and ensure kosher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants