Skip to content

feat: add cargo install filtering #69

Description

@FlorianBruniaux

Problem

cargo install outputs verbose compilation logs (dependency resolution, compiling N crates, warnings) when only the final "Installing/Installed/Replacing" lines matter for LLM context.

Evidence

rtk discover on 405 sessions (30 days) shows 53 occurrences of cargo install as the #2 unhandled command by count.

Command                  Count    Example
cargo install               53    cargo install --path . --force

Typical output is 50-200 lines of compilation noise for 2-3 useful lines.

Proposed behavior

rtk cargo install [args] should:

  1. Execute cargo install [args] normally
  2. Filter output to show only:
    • Installing / Installed / Replacing / Compiling rtk v... (the target crate only)
    • Errors and warnings from the target crate
    • Final status line
  3. Strip all intermediate Compiling dependency_name v... lines
  4. Preserve exit code

Example

Before (raw):

  Installing rtk v0.11.0
    Updating crates.io index
     Locking 130 packages to latest compatible versions
      Adding colored v2.2.0 (available: v3.1.1)
      Adding dirs v5.0.1 (available: v6.0.0)
      ... (50+ lines)
   Compiling proc-macro2 v1.0.70
   Compiling unicode-ident v1.0.12
   ... (100+ lines)
   Compiling rtk v0.11.0
    Finished release profile
   Replacing /Users/user/.cargo/bin/rtk
    Replaced package `rtk v0.9.4` with `rtk v0.11.0` (executable `rtk`)

After (rtk filtered):

  Installing rtk v0.11.0 (130 deps)
   Compiling rtk v0.11.0
    Replaced rtk v0.9.4 -> v0.11.0

Estimated savings: 80-90% token reduction.

Notes

This could be handled as a subcommand of the existing rtk cargo module, extending the match in cargo_cmd.rs (or equivalent) to intercept install alongside build, test, clippy, check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions