Skip to content

feat(mix): add Elixir Mix command filter#2053

Open
martinstannard wants to merge 1 commit into
rtk-ai:developfrom
martinstannard:feature/mix-filter
Open

feat(mix): add Elixir Mix command filter#2053
martinstannard wants to merge 1 commit into
rtk-ai:developfrom
martinstannard:feature/mix-filter

Conversation

@martinstannard
Copy link
Copy Markdown

Summary

  • Adds a token-optimized filter for Elixir's mix build tool, the primary toolchain for Elixir/Phoenix projects
  • Supports 6 subcommands: mix test, mix compile, mix credo, mix phx.routes, mix ash.codegen, mix ash_postgres.generate_migrations
  • Includes discover integration with per-subcommand savings estimates (70-90%)

What it does

mix test

  • Compact output: passing tests → single summary line; only shows failures with file/line/description
  • Preserves compilation errors before test output (common in Elixir test runs)
  • Handles both ExUnit and doctest output formats
  • TTY-aware: respects verbose flag for full passthrough

mix compile

  • Warnings grouped by file, error details preserved
  • Empty output when clean (no noise)
  • Preserves "Compiling N files" progress line

mix credo

  • Keeps high/medium priority issues with file/line/column/message
  • Hides low-priority (refactoring) suggestions to cut noise
  • Verbose passthrough preserves all priorities

mix phx.routes

  • Full passthrough (routes are already compact and essential for LLM context)

mix ash.codegen / mix ash_postgres.generate_migrations

  • Strips verbose JSON snapshot output from Ash codegen
  • Preserves migration SQL blocks and status summaries
  • Shows "check ok" or "check pending" status clearly

General

  • All commands fall back to raw output on filter failure
  • Non-zero exits still print filtered stdout (credo/dialyzer write reports to stdout on failure)
  • Tracking integration for rtk gain statistics
  • Discover registry: Elixir category with per-subcommand token savings

Token Savings

Subcommand Est. Savings
mix test 90%
mix compile 85%
mix credo 80%
mix phx.routes 70%
mix ash.codegen 88%
mix ash_postgres.generate_migrations 88%

Changes

File +
src/mix_cmd.rs +946 (new module, 24 tests)
src/main.rs +11 (Commands::Mix enum + routing)
src/discover/registry.rs +1 (Elixir category)
src/discover/rules.rs +17 (mix rule entry)

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • 24 unit tests covering: all-pass, failures, multiple failures, compilation errors, verbose passthrough, compile warnings/errors/clean, credo priority filtering, codegen JSON stripping, migration SQL preservation, routes passthrough, help text
  • Manual testing: rtk mix test, rtk mix credo, rtk mix compile, rtk mix phx.routes on real Phoenix project

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 23, 2026

CLA assistant check
All committers have signed the CLA.

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