Skip to content

feat(cli): coloured, live output for wasit test at a terminal - #35

Merged
dzakwannajmi merged 1 commit into
sow2/s2-paymentfrom
sow2/cli-live-output
Nov 20, 2026
Merged

dzakwannajmi merged 1 commit into
sow2/s2-paymentfrom
sow2/cli-live-output

Conversation

@dzakwannajmi

Copy link
Copy Markdown
Collaborator

Draft, part of the pre-release 0.8.0-beta.1, stacked on #30. Do not merge before the pre-release.

What it changes

At a terminal, wasit test shows its run in Wasit's own look:

  • a header (version, target, network) and two blocks, challenge and payment;
  • one line per check with a mark and a badge that agree: ✓ PASS (green), ✗ FAIL (red), ○ SKIP (yellow), ! ERROR (magenta), and its duration;
  • a spinner line saying what the check in flight is doing (for example X402-10 waiting for an authorization to expire), cut to the terminal's width so it never wraps and is always rewritten in place;
  • a skip that gives the same reason as the skip above it does not repeat it;
  • on a network that is not a test network, the payment block says the checks are refused;
  • at the end, the verdict (CONFORMANT, NOT CONFORMANT, NO VERDICT, UNSUPPORTED), the counts and the run's duration.

wasit mpp-charge and wasit mpp-channel mark their results the same way.

The colours are the palette the site and the dashboard use: exact on a terminal with 24-bit colour, the nearest 256 or 16 colours otherwise. Badge ink is exact black or white, so a terminal that draws bold text in bright colours does not turn it grey.

What does not change

  • A pipe, CI, --json and NO_COLOR get the plain output exactly as before. The old and the new report() were compared over seven result sets, with and without a protocol, as text and as JSON: 28 of 28 identical, exit codes too.
  • FORCE_COLOR=1 colours a pipe without moving the cursor.
  • Every line is sanitised and its secrets redacted before it is styled, so the only escape sequences on screen are Wasit's own.
  • Nothing changes in core or in the payment path.

Tests

  • packages/cli/test/unit/live-output.test.ts, 19 tests: colour detection, the layout, the spinner line at 30, 50, 80 and 200 columns, marks and badges, badge ink at every colour depth, sanitising and redaction, the plain path, and the built binary with FORCE_COLOR, NO_COLOR, CI, a pipe, --json, 256 colours and stellar:pubnet.
  • Full suites on this commit: core 816, cli 270, server 30, action 175, 0 failures (local run, 2026-11-20).
  • Run by hand on a macOS terminal against a local paywall and against wasit serve in its misbehaving modes. Not run on Windows.

At a terminal, `wasit test` now shows its checks in Wasit's own look:
a header, two blocks (challenge, payment), and one line per check with
a mark and a badge that agree (PASS on green, FAIL on red, SKIP on
yellow, ERROR on magenta) and its duration.
A spinner line says what the check in flight is doing, and the verdict,
the counts and the run's duration come at the end. On a network that is
not a test network, the payment block says the checks are refused,
never that funds move. A skip that gives
the same reason as the skip above it does not repeat it. The colours are
the site's and the dashboard's, exact on a terminal with 24-bit colour,
and a badge's ink is given as exact black or white, since a terminal that
draws bold text in bright colours turns bold black into grey.
Every line is cut or wrapped to the terminal's width, so the spinner
line never wraps and is always rewritten in place. `wasit mpp-charge`
and `wasit mpp-channel` mark their results the same way.

Colour is a layer over the same text: every line is sanitised and its
secrets redacted before it is styled, so the only escape sequences on
screen are Wasit's own. A pipe, CI, --json and NO_COLOR get the plain
output exactly as before (compared over every kind of result), and
FORCE_COLOR=1 colours a pipe without moving the cursor.
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
wasit Ready Ready Preview Nov 19, 2026 10:59pm UTC

@dzakwannajmi
dzakwannajmi merged commit c538c6e into sow2/s2-payment Nov 20, 2026
2 checks passed
@dzakwannajmi
dzakwannajmi deleted the sow2/cli-live-output branch November 21, 2026 09:55

This branch was successfully deployed

1 active deployment
Preview — c538c6e1 Deployed Nov 19, 2026 by vercel[bot]
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.

1 participant