Skip to content

Add yarn/bun package install log compression #3

Open

Description

@jee599

Extend pkg_cmd.rs to handle yarn and bun install output. Currently supports npm, pip, cargo.

Activity

  1. osazemeu commented on Sep 5, 2026

    @osazemeu

    Opened #11 for this.

    Scope

    The issue asks to extend pkg_cmd.rs, so that is all the PR does. Worth being explicit that there is currently no route feeding yarn or bun output into compress_pkg_log: main.rs has Commands::Npm and Commands::Pnpm but no Yarn or Bun, and discover/rules.rs has no rewrite prefix for either, so contextzip rewrite "yarn install" exits 1 today. Filed that separately as #14 rather than growing this PR, since it means new Clap variants, two new modules, discover rules and hook docs.

    What the output actually looks like

    Fixtures are real captures rather than synthetic, generated locally from yarn 1.22.22, yarn 4.18.0 and bun 1.4.2 with both streams piped, plus failing installs. A few things that shaped the implementation and are easy to get wrong from memory:

    yarn splits noise from signal structurally, not semantically. warning <path>@<version>: <message> with an unquoted path is the registry's deprecated field echoed back, the direct analogue of npm warn deprecated. warning "<path>" has (unmet|incorrect) peer dependency "<spec>". always opens with a quote. Matching on the quote is far sturdier than matching message text.

    Berry needs a denylist over message codes, never an allowlist. Two cases force it. YN0000 lines carrying a │ are where berry reports build script stdout and stderr, so dropping YN0000 by code eats the stderr of a failed postinstall. And a resolution failure ends with ➤ Errors happened when preparing the environment required to run this command., which has no code at all.

    Step lines are not always /4. yarn remove prints /2, yarn install --audit prints /5, and the source builds that array conditionally so /6 and /7 are reachable.

    Yarn 2 and 3 are where the savings are. They re-emit YN0013 cache lines in a sliding window, around 250 lines for 54 unique packages. Yarn 4 collapses that to one aggregate line, so the 73% measured against a 4.18.0 capture is the floor, not the ceiling.

    bun's Resolving dependencies and Resolved, downloaded and extracted [N] lines are piped-only. They are the non-TTY replacement for the spinner, so piping makes them appear rather than disappear. bun 1.0.x also indents its summary rows by one space and does not singularize the count.

    Measured savings: 65% on yarn classic, 73% on yarn berry, 81% on bun.

    Two things found on the way

    Neither is caused by this change and neither is fixed by it, but both are real:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions