Something went wrong

Thank you for being patient! We're working hard on resolving the issue

watch (REPL) - Lona Docs Log in

watch [<fixture-path>] [--save-on-exit <out.json>]

Drop into a stdin-driven REPL over a hydrated Sheet. Default fixture is tento/tento-lona-js/sheets/tests.shared/sheets/formula-simple-seeded.sheet.json.

deno run --allow-read --allow-write --unstable-sloppy-imports \
  tento/tento-lona-js/cli/rows-fixtures/src/lona-rows.deno.ts \
  watch --save-on-exit /tmp/sheet.json

With --save-on-exit <path>: on quit, RawSheet.serialize(sheet) writes a fresh .sheet.json to <path>. The saved snapshot excludes derived (formula) cells — they recompute on re-hydrate.

REPL commands

All commands are whitespace-tokenized. Quoted labels are supported: set "Weight Plus 10" ymd-2026-4-18 210. Quotes mid-token are preserved verbatim, so formula expressions like (* (rows["Weight"]) 2) pass through unchanged.

Dates use the NaiveDate.Partial string form (ymd-2026-4-18, yw-2026-1, ym-2026-4, y-2026).

set <rowLabel> <date> <value>

Write a cell on a source row. Dispatches by variant:

  • NumberRowNumber.parseFloat(value)setNumber
  • CheckmarkRowparseBool(value) (true/1/yes vs. false/0/no) → setChecked
  • TextRow → raw string → setText
  • Any other variant → error

After the write, the REPL re-prints the table. Events fire inline (when events on) before the re-print.

get <rowLabel> <date>

Read a cell. Prints either <label> <date> = <JSON value> (bold label) or (empty) in dim.

formula <rowLabel> <expression>

Rewrite a FormulaRow's Lisp expression. Triggers rebindFormulaRow + a full recompute across the sheet's observed range. If the new expression would form a cycle (self-reference or circular dependency), setExpression throws and the REPL prints a red error: line without mutating state.

label <rowLabel> <newLabel>

Rename a row. The Sheet's subscription to RowLegendChanged auto-rewrites rows["<old>"]rows["<new>"] in every dependent formula and recomputes.

tree

Indented text tree of the sheet's rows with type tags.

table

Reprint the rows × dates grid. Useful after an event stream scrolled the previous output out of view.

events on|off

Toggle inline event logging. On by default. Logged events use the format [event] <class> <rowLabel?> <date?|path>. Off doesn't disable mutations — only their console output.

help / ?

Print the command list with one-line summaries and a date-format hint.

quit / exit

Leave the REPL. Closes stdin; triggers --save-on-exit when set.

Edge cases

  • REPL event stream timing: events print synchronously on mutation — the REPL does not batch. When a command cascades (e.g. a formula recompute), you'll see several [event] lines before the table reprints.
  • save-on-exit format: output JSON excludes derived-row cells (formulas). On reload, the formula engine recomputes them from seeded source cells. Label renames that auto-rewrote formula text survive the round-trip: the rewritten formula is what gets saved.
  • --verify is not available: per-op invariant checking runs only inside ops fixture tests (default on) to avoid paying the cost on every REPL keystroke.

See also

  • hydrate — non-interactive rendering
  • ops — scripted execution instead of interactive
  • formatTable + runRepl library entry — Library Surface