Thank you for being patient! We're working hard on resolving the issue
@tento-lona/cli/rows-fixtures ships two functions usable as a library — embed
the rows-CLI rendering / REPL inside another tool without
shelling out.
import { formatTable, runRepl } from "@tento-lona/cli/rows-fixtures";
formatTable(sheet, opts?): stringRender a Sheet as a rows × dates grid. Same output as
hydrate but as a string
rather than written to stdout.
import { Sheet, TestBackend } from "@tento-lona/sheets";
import { formatTable } from "@tento-lona/cli/rows-fixtures";
const sheet = await Sheet.from(rawSheet, { backend: new TestBackend() });
const grid = formatTable(sheet);
console.log(grid);
// No ANSI escapes — useful for plain-text logs:
const plain = formatTable(sheet, { color: false });
interface FormatOptions {
color?: boolean; // default: true (honors NO_COLOR)
}
The color: false mode is what --json uses internally for the
embedded snapshot.cells rendering (so snapshot diffs aren't
polluted by escape codes).
runRepl(sheet): Promise<void>Stdin-driven REPL over a hydrated Sheet. Same commands as
watch; useful for embedding the
REPL in a host program that constructs the sheet differently
(e.g. from a database fixture):
import { Sheet } from "@tento-lona/sheets";
import { runRepl } from "@tento-lona/cli/rows-fixtures";
const sheet = await loadSheetFromMyDatabase(); // your code
await runRepl(sheet); // resolves when user types `quit`
The function consumes stdin until quit/exit or EOF. Any
mutations the user makes via set / formula / etc. land on
the same sheet object you passed in — you can inspect /
serialize after the call returns.
Embed (formatTable / runRepl) when:
Sheet yourself (test harness,
database loader, custom backend).Sheet post-quit.Shell out (deno run ...) when:
.sheet.json on disk.--save-on-exit,
fixture path resolution).tento/tento-lona-js/cli/rows-fixtures/src/lib.ts — full library surface (small; mostly
re-exports formatTable + runRepl)