Skip to content

feat(moshscript): R8 error convention, shell() verb, TUI /run options - #19

Merged
ralyodio merged 1 commit into
mainfrom
feat/moshscript-implementation
Jul 13, 2026
Merged

feat(moshscript): R8 error convention, shell() verb, TUI /run options#19
ralyodio merged 1 commit into
mainfrom
feat/moshscript-implementation

Conversation

@Preshy

@Preshy Preshy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #18 — completing moshscript implementation (issue #16)

The prior PR was a starting point. This addresses the remaining gaps from PRD 0004:

R8 [P0] — Error convention

CLI verbs now return { ok: false, code } on non-zero exit instead of throwing, so scripts can branch on outcomes without try/catch:

const r = install("claude");
if (!r.ok) say(`install failed (exit ${r.code})`);

Only truly fatal spawn errors (ENOENT) still throw. This prevents a single failing verb from crashing the entire script mid-while (alive) loop.

R6 — shell() verb

Added shell(cmd) to the moshscript vocabulary — runs $SHELL -c <cmd> (blocking, spawnSync with inherited stdio). Returns { ok, code } following the R8 convention. Honors --dry-run.

const test = shell("npm test");
if (!test.ok) notify("tests failed!");

R3 — TUI /run options parity

TUI /run now accepts --max N and --dry-run flags, matching the CLI entrypoint. Both share DEFAULT_MAX=3.

/run deploy.mosh --dry-run --max 5

Tests

8 new tests covering:

  • R8 error convention: non-zero exit returns { ok: false }, script continues
  • shell() verb: dry-run narration, real execution, error returns, moshscript integration

Docs

  • README: documented shell() verb + error handling convention
  • TUI /help: updated to show shell() and /run options

Refs #16

- R8 [P0]: CLI verbs return { ok: false, code } on non-zero exit instead
  of throwing, so scripts can branch on outcomes without try/catch.
  Only truly fatal spawn errors (ENOENT) still throw.
- R6: Add shell(cmd) verb — runs $SHELL -c <cmd> (blocking, spawnSync),
  returns { ok, code }. Honors --dry-run.
- R3: TUI /run now accepts --max N and --dry-run flags, matching the CLI
  entrypoint. Both share DEFAULT_MAX=3.
- Tests: 8 new tests covering R8 error convention, shell() in dry-run,
  shell() with real commands, and shell() from moshscript.
- README: document shell() verb, error handling convention.
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@Preshy

Preshy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@ralyodio

@ralyodio
ralyodio merged commit f43c981 into main Jul 13, 2026
1 check passed
@ralyodio
ralyodio deleted the feat/moshscript-implementation branch July 13, 2026 13:54
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.

2 participants