A terminal spinner that animates in its own task: 91 animations, status text, nothing drawn off a terminal
Formerly @mplx/clispinner.
[decks]
"@skiffyard/clispinner" = "^0.4.0"| Version | Status | Kind | Pin | Requires | Engines | Capabilities |
|---|---|---|---|---|---|---|
| 0.4.0 | live | git | 20c3e665cd88 | - | jennifer >=0.27.0 | - |
MIT
0.4.0Times a client asked this registry where to find this deck. Not downloads: the registry only stores metadata, and the code is fetched from its repository directly, so we never see an install and cannot count one. Repeated builds inflate these numbers; installs from an existing lockfile do not appear at all. Counted in UTC.
A terminal spinner for Jennifer. The animation runs in its own spawned task, so the caller carries on with the slow work while it spins.
This deck is part of Skiffyard, small community decks for Jennifer.
[decks]
"@skiffyard/clispinner" = "^0.4.0"jvc install vendors it to vendor/skiffyard/clispinner/. Import it by its scoped name, not by a path into vendor/:
import "@skiffyard/clispinner/" as spinner;
def sp as spinner.Spinner init spinner.startSpinner(
spinner.options("dots", "resolving the dependency graph"));
$sp = spinner.statusSpinner($sp, "fetching @acme/demo 0.1.0");
$sp = spinner.updateSpinner($sp, spinner.options("bouncingBar", "vendoring"));
spinner.finishSpinner($sp, "ok", "installed 3 decks");| Call | Does |
|---|---|
startSpinner(opts) | launch the animation; returns a handle immediately |
updateSpinner(sp, opts) | replace animation, speed, label and stream; restarts the frame index |
statusSpinner(sp, msg) | replace the text to the right of the spinner |
removeSpinner(sp) | stop the task, erase the block, restore the cursor; returns frames drawn |
finishSpinner(sp, mark, msg) | removeSpinner, then print mark msg as a line that stays |
options(name, label) | an Options with defaults filled in |
spinnerNames() | all 91 animation names, sorted |
spinnerSize(name) | the animation's Size (cols, rows) |
Every verb takes the handle because the handle carries the command channel. spawn deep-copies its scope at launch, so the task never sees later writes to the caller's variables; the channel is the only shared state. removeSpinner blocks until the task has finished and closes the channel, so sending to a removed spinner throws a closed error. Always call removeSpinner or finishSpinner: a running spinner keeps the cursor hidden.
def o as spinner.Options init spinner.options("dots", "working");
$o.speed = 40; # ms per frame; 0 uses the animation's own
$o.stream = spinner.STDOUT; # default spinner.STDERRBuild options with options(name, label): the struct will gain fields, the call will not. An unknown or empty name falls back to dots instead of throwing, so user input can be passed through; has(name) in src/frames.j validates it. Any stream other than STDOUT becomes STDERR, and a negative speed becomes 0.
Whether the stream is a terminal is checked once, at startSpinner. Off a terminal (piped, redirected) nothing is written, but the task still runs and accepts commands, so calling code needs no branch. removeSpinner then returns 0. Changing the stream with updateSpinner does not repeat the check.
Each animation carries its measured size, because len counts runes, not terminal columns: moon is one emoji plus a space, 2 runes and 3 columns. material is 20 columns by 1 row.
The block never wraps, because a redraw erases only the rows the last block occupied and a wrapped row would stay on screen:
…).\n breaks are honoured within that budget; long lines are broken mid-word; text past the last row is dropped and the cut marked with ….soccerVertical in a nine-row window draws eight rows). Without this the terminal scrolls and the erase cannot reach the top rows.Width and height are read on every frame. When they cannot be read the spinner assumes 80 columns by 24 rows (FALLBACK_COLS, FALLBACK_ROWS). Status width is counted in runes, so wide characters in a status can still overflow.
spinner.statusSpinner($sp, "resolving\n @acme/alpha\n @acme/beta");90 animations are ported from cli-spinners (MIT), so dots or line looks the way users expect. Frames are padded to the animation's width so the status column does not move. soccerVertical (2 columns by 12 rows) is this deck's own: soccerHeader turned on its side, the only multi-row animation. src/frames.j is generated from upstream's spinners.json; regenerate it instead of editing it by hand.
tools/check-all.sh # the full gate, as CI runs it
jennifer test src/clispinner_test.j # API and state machine
jennifer test src/frames_test.j # the catalogue
tools/check-docs.sh # docs against the code
tools/pack.sh dist # build the release archive
jennifer lint demo.j # the demo is outside the gate
./demo.j # the tour; needs a terminal
./demo.j multiline # soccerVertical and a multi-row status
./demo.j names # list every spinnerThe tests run off a terminal, so nothing is drawn. The state machine is tested through its pure functions (applyCommand, advance, currentFrame, renderBlock) and the task through the command round trip.
MIT, see LICENSE. Copyright (C) 2026 mplx <[email protected]>. Animation data from cli-spinners, MIT.