Skip to content

CLI

hotaru is Hotaru on the command line (SI-559): your stream, search, stars, labels, the agent chat and live updates, from a terminal, a cron job or another agent. hotaru mcp gives a local agent Hotaru’s tools (agents.md); hotaru tui is the full-screen client (tui.md). It talks to the API through @hotaru/sdk, like every other client (api.md), and depends on nothing else: no core, no database.

Install

From npm, as @kogakure/hotaru. It needs Node 22 or newer:

Terminal window
npx @kogakure/hotaru --help # try it without installing; or: pnpm dlx @kogakure/hotaru --help
npm install -g @kogakure/hotaru # the hotaru command
hotaru --version

From the repository, without building:

Terminal window
pnpm hotaru status # runs apps/cli/src/main.ts; Node strips the types

The package is one file: pnpm build:cli bundles the CLI, the SDK, zod and pi-tui into apps/cli/dist/hotaru.js, so it installs with no dependencies. pnpm --filter @kogakure/hotaru package builds it and packs the .tgz into apps/cli/dist/, which installs anywhere with npm install -g ./kogakure-hotaru-0.1.0.tgz. Releases are published from GitHub Actions (Releasing the CLI).

It needs Node 22 or newer. For a machine without Node, pnpm --filter @kogakure/hotaru build:binary also makes apps/cli/dist/hotaru, a single executable with Node inside (Node’s single executable applications). It runs on the platform it was built on: build it on Linux for a Linux server. On macOS the build signs it ad hoc so it may run.

Servers

The CLI talks to one or more servers, such as your laptop and your VPS. Each needs an API token: Settings → API tokens in the web app, or pnpm user token on the server (auth.md). A read token can look; star, label and send need a write token.

Terminal window
pbpaste | hotaru server add vps https://hotaru.example.com --token-stdin
echo hotaru_… | hotaru server add local http://localhost:5173 --token-stdin
hotaru server list # * marks the default; tokens are never printed
hotaru server use local # the default from now on
hotaru feed --server vps # this once
hotaru server remove local

The first server added is the default. --token TOKEN works too, but lands in your shell history.

The config is ~/.config/hotaru/config.json ($XDG_CONFIG_HOME/hotaru/, %APPDATA%\hotaru\ on Windows), or the file HOTARU_CONFIG names. It holds the tokens, so the CLI writes it readable only by you (mode 0600), and hotaru doctor warns when it isn’t.

{ "default": "vps", "servers": { "vps": { "url": "https://hotaru.example.com", "token": "hotaru_…" } } }

Without a config, for scripts and containers: HOTARU_URL and HOTARU_TOKEN. HOTARU_URL wins over the config unless --server names a server; HOTARU_TOKEN alone replaces the configured server’s token. HOTARU_SERVER picks a configured server like --server.

Commands

Command What it does
status The server and its health, your account, the token’s scope and how many items are unread
feed The stream, newest first, one line per item: its ID, when, unread ● and starred ★, source and title. --unread, --starred, --filtered, --sort foryou|signal|…, --limit, --cursor for the next page, --tag/--keyword/--topic (IDs), --min-signal/--min-facts/--max-hype (0–1), --long for the link and summary
search <words…> All your items, best match first, the hits in «». --source, --type article|video, --from/--to (a day or an ISO time), --starred, --read/--unread, --newest, --limit, --offset
star <id…> Stars items; --remove takes the stars back
label <id> [signal] [facts] [hype] Without labels: shows the item’s labels. With labels: sets them. The ones you name are on, the others off, because a label says what you think of all three (feedback.md). --clear takes them all off
send <message…> Sends a message to the agent and prints its answer. - (or a pipe) reads the message from stdin. --item ID sends an item along (up to 5), --no-wait doesn’t wait, --timeout (default 300 s)
watch Counts new items as they arrive, until Ctrl-C. feed --unread lists them
tui Hotaru full screen: the stream live, a reader, stars, labels, search and the agent chat with its changes to confirm, night and day (tui.md). Not with --json
mcp Serves Hotaru’s tools to a local agent (Pi, Claude Code, Codex) over MCP on stdin and stdout. The agent starts it: agents.md. --read-only offers only the tools that look
doctor Checks the config, the server, the token, whether server and CLI agree on the API, and live updates; says what to fix
server list, add <name> <url>, use <name>, remove <name>

hotaru <command> --help lists a command’s options. Item IDs come from feed and search.

send waits for the agent’s answer over the chat’s live events. It also asks for the whole chat every 5 s, in case a proxy holds the events back. When the agent asks to change something that needs your OK (chat.md), send lists it; confirm it in the web app. A failed answer prints the reason and exits with 1.

watch follows GET /api/v1/events, whose events say how many items arrived, not which (the stream is sorted by date, not by arrival). After a dropped connection it reconnects by itself and asks how many items arrived meanwhile, so none go uncounted. A refused token stops it.

For scripts and agents: --json

Every command takes --json. Then stdout carries only JSON, one object per line, and nothing goes to stderr:

  • Results are the API’s own responses where a command makes one call (feed prints the stream page, search the search response), else a small object (status, star, label, send, doctor, server). The fields: api.md, or GET /api/v1/openapi.json.
  • watch prints one object per arrival: {"event":"items","count":2,"total":5,"at":"…"}.
  • Errors are JSON too: {"error":{"code":"api","status":403,"message":"This token can’t start work. Create a cron or write token."}}. code is usage (a wrong command or option), config, api (the server said no; status is its HTTP status), network (no answer), response (an answer this CLI doesn’t understand: another version) or internal.
  • doctor prints {"ok":false,"checks":[{"name":"token","status":"fail","detail":"…"}]}.

Exit codes: 0 worked, 1 failed, 2 a usage mistake. status exits with 1 when the server is unhealthy, doctor when a check fails.

Terminal window
hotaru feed --unread --json | jq -r '.items[].itemId' | xargs hotaru star
hotaru send --json "What happened with the EU AI Act this week?" | jq -r .reply

Code

apps/cli/src/: cli.ts finds the command, parses its options with node:util’s parseArgs and handles --json and errors for all of them. Each command is an entry in commands.ts that prints through ctx.out(data, text). config.ts holds the servers. build.ts bundles with esbuild.

Adding a command: add it to commands and give it a case in cli.spec.ts. The test fails until every command prints only JSON with --json, both when it works and when it fails. apps/web/e2e/cli.e2e.ts runs the CLI against the real server.

Releasing the CLI

A v* tag publishes the CLI: .github/workflows/release-cli.yml checks that the tag matches apps/cli/package.json’s version, runs the CLI’s type check and tests, packs it, installs the package on its own to run hotaru --version, publishes it to npm with trusted publishing and attaches the .tgz to the GitHub Release. Trusted publishing means npm trusts this workflow through OpenID Connect: there is no npm token on a laptop or in the repository’s secrets, and every version gets a provenance statement that links it to the commit it was built from. publishConfig pins the public registry, so a local npm config can’t send a publish elsewhere.

Terminal window
# bump "version" in apps/cli/package.json (and the other packages), add the CHANGELOG entry, merge
git tag v0.2.0 && git push origin v0.2.0

Once, on npmjs.com, before the first release:

  1. Sign in to the npm account that owns the @kogakure scope (a scope belongs to the user or organization of that name: make sure kogakure on npm is yours, or create it), with two-factor authentication on.

  2. Check whether npm lets you add a trusted publisher before the package exists. If it does, set it up for @kogakure/hotaru (step 3) and let the workflow publish 0.1.0, with provenance, and nothing ever runs on a laptop. If it doesn’t, the package needs one version first. Two ways:

    • A bootstrap version keeps 0.1.0 coming from the workflow: publish a placeholder such as 0.0.0-bootstrap once by hand (npm login --registry https://registry.npmjs.org/, npm publish <tgz> --tag bootstrap, then npm logout --registry https://registry.npmjs.org/, which revokes the login’s token), add the trusted publisher, and deprecate the placeholder (npm deprecate @kogakure/[email protected] "placeholder").
    • 0.1.0 by hand the same way (pnpm --filter @kogakure/hotaru pack, npm publish kogakure-hotaru-0.1.0.tgz). It is then the one version without provenance; the workflow skips it on the v0.1.0 tag and still makes the GitHub Release.

    Either way, the login lasts only for that one publish, and every later version comes from the workflow.

  3. On the package page: Settings → Trusted publishing → GitHub Actions. Organization or user kogakure, repository hotaru, workflow file release-cli.yml, environment npm. Save.

  4. Same page, Publishing access: choose “Require two-factor authentication and disallow tokens”. Trusted publishing keeps working; tokens, also leaked ones, no longer can publish.

  5. On GitHub: Settings → Environments → New environment npm. Optional: required reviewers, so each publish waits for your approval, and a deployment rule that allows only v* tags.

Nothing else is needed: no NPM_TOKEN secret. The first run shows the provenance badge on the package page.