@siphon_npm/core
v0.18.0
Published
The runtime modules every siphon CLI shares: output, typed errors, host sessions, cache, concurrency, rich documents, terminal media and selection refs.
Readme
@siphon/core
The modules every siphon CLI was copying. One fix here lands in all of them.
Install into a CLI repo
Use the public package behind the family's stable import alias:
"dependencies": { "@siphon/core": "npm:@siphon_npm/core@^0.15.0" }For unpublished core development, use the repository's swap-core-dep.mjs
script to move a consumer to the local worktree and restore the published
dependency before committing. A committed file: path makes the CLI installable
only on the machine whose sibling checkout happens to satisfy it.
Modules
| Import | What it is |
|---|---|
| @siphon/core/args | Fail-closed argument grammar, aliases, numeric/enum validation and output mode selection |
| @siphon/core/types | Envelope shape, structured collection coverage, typed errors and exit-code mapping |
| @siphon/core/envelope | Building and emitting that envelope without losing partial data or collection coverage |
| @siphon/core/output | One record model routed to terminal, JSON, JSONL, CSV, Markdown and text; --fields projects records without erasing coverage |
| @siphon/core/csv | Stable flat-record CSV with escaped scalar and nested JSON cells |
| @siphon/core/fields | --fields projection over records |
| @siphon/core/document | Typed headings, nested lists, tables/infoboxes, figures, TeX math and section-scoped links |
| @siphon/core/selection | Numeric refs (3, 1-4, 5,6, all) against the last listing |
| @siphon/core/cache | On-disk JSON cache with shape guard and age-based gc |
| @siphon/core/semaphore | Bounded mapLimit plus settleLimit/requireAny for first-class ordered partial fan-out receipts |
| @siphon/core/images | Automatic terminal protocols plus role-aware icon/thumbnail/screenshot grids, sharp variant selection and cursor-safe horizontal layout |
| @siphon/core/listing | Source-safe enrichment, tri-state values, stable tiered sorting, post-acquisition limits and source-extent notices |
| @siphon/core/pageall | Numbered or opaque-cursor walking with no implicit page ceiling, stable de-duplication and explicit source-end/caller-limit/client-cap/no-progress receipts |
| @siphon/core/math | Zero-dependency TeX-to-terminal layout with source-preserving fallback |
| @siphon/core/host-session | One concurrency, truthful per-attempt accounting, bounded retry/backoff, body-inclusive timeout, singleflight, cache and Retry-After boundary for API and asset GETs |
| @siphon/core/spinner | stderr-only, TTY-gated progress plus HostSession lifecycle counts; machine modes stay silent |
| @siphon/core/timeframe | --since / --until parsing |
| @siphon/core/selftest | Selftest harness and report shape |
| @siphon/core/cookies-script | Path to browser-cookies.mjs, which CLIs spawn |
math returns ordinary terminal lines rather than an image or DOM overlay:
import { renderMath } from "@siphon/core/math";
renderMath(String.raw`\frac{a+b}{c}`, { display: true, width: 80 });
// ["a+b", "───", " c"]The module handles common TeX notation and matrices. Unsupported or malformed
input remains visible as source; the canonical RichDocument still stores TeX.
Where each module came from
The copies had drifted. Where they disagreed the version carrying the bug fix won, so adopting the package fixes the laggards rather than freezing their bugs in place. Each divergence and its evidence is in this branch's commit messages.
@siphon/core/highlight
Marking text rather than colouring it. A foreground colour SAYS something about a value; a marker says "look here", and doing both with one mechanism means one of them loses.
import { mark, markMatches, swipe } from "@siphon/core/highlight";
mark("SOLD OUT", { colour: "orange" }); // light wash, dark ink
markMatches(headline, /\d+%/, { base: dim }); // re-opens the surrounding colour
swipe("Reuters", { colour: "blue", style: "curly" }); // keeps the text's own colourLight palette on purpose — a dark wash reads as a label, a light one as ink
under a pen. Falls back to the 256-colour cube where 48;2 would be silently
ignored, degrades swipe to a plain underline without 58; support, and
NO_COLOR removes the mark entirely, because a highlight IS colour.
