Skip to content

moshscript: account verbs, aliases, read verbs, and the newer CLI surface - #407

Merged
ralyodio merged 1 commit into
mainfrom
feat/moshscript-tools-auth
Aug 16, 2026
Merged

moshscript: account verbs, aliases, read verbs, and the newer CLI surface#407
ralyodio merged 1 commit into
mainfrom
feat/moshscript-tools-auth

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

The moshscript vocabulary had drifted behind the CLI — 43 verbs against 54 commands — with no way for a script to authenticate, reach the pit's aliases, or read a tool's output as anything but an exit code.

Account

login(), whoami(), requireLogin(), logout(). Local verbs rather than cliVerbs for the same reason the herd is: moshcode whoamiprints, and a script needs to branch on the answer.

src/auth.mjs grows identity() — the verified account as a value — and whoami() now renders it. One verified-identity implementation, two callers, so the CLI and a script can never disagree about what "logged in" means.

  • requireLogin() is the gate, and the one verb here that throws — everything downstream would otherwise fail one call at a time, later and less legibly.
  • login() is idempotent ({ already: true }), so a script you re-run all day never throws a browser tab at someone already signed in, and returns its failure rather than throwing (R8).
  • Flow selection is unchanged: browser/loopback locally, device-code over SSH or headless.

Aliases

alias(), unalias(), runAlias() read and write the pit's own store, so the operator's vocabulary and moshcode's stay one thing rather than two. Expansion follows the pit's rule — leading / is a moshcode command, anything else a shell line, arguments appended rather than substituted.

Read verbs

stocksRead(), cryptoRead(), newsRead() call the same advis0r/feed layer the printed commands render from and hand back parsed data, so a script can rank and threshold instead of scraping stdout. A failed lookup returns null, not a throw.

Plus the surfaces added since

15 CLI verbs: stocks, crypto, advisor, news, rss, plugin, engines, tools, dns, doh, site, serve, template, save, load. 43 → 68 verbs.

Examples

account.mosh, aliases.mosh, research-desk.mosh — all safe under --dry-run, all verified to run.

Testing

  • 18 new tests in test/commands-account-alias.test.mjs
  • Full suite: 1654 pass, 0 fail (4 pre-existing skips)
  • moshcode commands and moshcode help <verb> render every new verb
  • All three examples verified under --dry-run

🤖 Generated with Claude Code

…face
The vocabulary had drifted behind the CLI: 43 verbs against 54 commands, with
no way for a script to authenticate, reach the pit's aliases, or read a tool's
output as anything but exit codes.
Account (login/whoami/requireLogin/logout). Local rather than cliVerbs for the
same reason the herd is: `moshcode whoami` prints, and a script needs to branch
on the answer. src/auth.mjs grows identity() — the verified account as a value —
and whoami() renders it, so the CLI and a script can never disagree about what
"logged in" means. requireLogin() is the gate and the one verb here that throws:
everything downstream would fail one call at a time and much less legibly.
login() is idempotent so a re-run never throws a browser tab at someone already
signed in, and returns its failure rather than throwing (R8).
Aliases (alias/unalias/runAlias) read and write the pit's own store, so the
operator's vocabulary and moshcode's stay one thing. Expansion is the pit's
rule — leading `/` is a moshcode command, else a shell line, arguments appended.
Read verbs (stocksRead/cryptoRead/newsRead) call the same advis0r/feed layer the
printed commands render from and return parsed data, so a script can rank and
threshold instead of scraping stdout.
Plus 15 CLI verbs for surfaces added since: stocks, crypto, advisor, news, rss,
plugin, engines, tools, dns, doh, site, serve, template, save, load. 43 → 68.
Three worked examples, all safe under --dry-run.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

53 finding(s)

HIGH/CRITICAL: 5 | MEDIUM: 42 | LOW: 6

SeverityRuleLocation
HIGHjs-ssrf-outbound-requestapps/pwa/public/sw.js:45
HIGHtls-verification-disabledapps/pwa/src/lib/moshpit-gateway.mjs:299
HIGHsh-remote-script-executioninstall.sh:79
HIGHsh-remote-script-executioninstall.sh:83
HIGHtls-verification-disabledsrc/dns.mjs:741
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:61
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:75
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:101
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:288
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:292
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:337
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:522
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:698
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:700
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:759
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:805
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:875
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:978
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:1086
MEDIUMsql-template-interpolationapps/pwa/src/moshpit.mjs:1222
MEDIUMjs-unescaped-html-sinkapps/pwa/src/routes/moshpit.mjs:1484
MEDIUMjs-timing-unsafe-mac-compareapps/pwa/src/routes/settings-sync.mjs:192
MEDIUMjs-dynamic-code-executionapps/pwa/test/apikey-mask.test.mjs:129
MEDIUMsql-template-interpolationapps/pwa/test/credits-webhook-event-match.test.mjs:111
MEDIUMsql-template-interpolationapps/pwa/test/credits-webhook-event-match.test.mjs:131
MEDIUMsql-template-interpolationapps/pwa/test/moshpit-terms.test.mjs:192
MEDIUMsql-string-concatenationsrc/cli-schema.mjs:128
MEDIUMsql-string-concatenationsrc/cli-schema.mjs:417
MEDIUMsql-string-concatenationsrc/cli-schema.mjs:543
MEDIUMjs-uninitialized-buffersrc/pty.mjs:120
MEDIUMjs-timing-unsafe-mac-comparesrc/settings-sync.mjs:325
MEDIUMinsecure-temp-filetest/dns-disable-restore.test.mjs:93
MEDIUMinsecure-temp-filetest/dns-disable-restore.test.mjs:310
MEDIUMinsecure-temp-filetest/news.test.mjs:693
MEDIUMinsecure-temp-filetest/plugins.test.mjs:152
MEDIUMinsecure-temp-filetest/pty.test.mjs:28
MEDIUMinsecure-temp-filetest/pty.test.mjs:31
MEDIUMinsecure-temp-filetest/pty.test.mjs:40
MEDIUMinsecure-temp-filetest/pty.test.mjs:42
MEDIUMinsecure-temp-filetest/pty.test.mjs:47
MEDIUMinsecure-temp-filetest/pty.test.mjs:48
MEDIUMinsecure-temp-filetest/pty.test.mjs:49
MEDIUMinsecure-temp-filetest/tabs.test.mjs:8
MEDIUMinsecure-temp-filetest/tabs.test.mjs:13
MEDIUMinsecure-temp-filetest/tabs.test.mjs:14
MEDIUMinsecure-temp-filetest/tabs.test.mjs:22
MEDIUMinsecure-temp-filetest/trust.test.mjs:240
LOWsecret-generic-credentialapps/pwa/test/auth-form-email.test.mjs:33
LOWsecret-generic-credentialapps/pwa/test/csrf-input-escaping.test.mjs:101
LOWsecret-generic-credentialapps/pwa/test/require-auth-next.test.mjs:35

…and 3 more. Full results in the Security tab.

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio marked this pull request as ready for review August 16, 2026 09:28
@ralyodio
ralyodio merged commit 09fc528 into mainAug 16, 2026
4 checks passed
@ralyodioralyodio mentioned this pull request Aug 16, 2026
Sign up for freeto 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.

1 participant

@ralyodio