Skip to content

MS-2424: CLI 1.1 guided flows (init, env, mock, trigger, listen --tunnel, --transcription, join --follow, ai install, commands) - #7

Merged
doluz merged 16 commits into
mainfrom
feature/ms-2424-cli-guided-flows
Nov 27, 2026
Merged

doluz merged 16 commits into
mainfrom
feature/ms-2424-cli-guided-flows

Conversation

@doluz

@doluz doluz commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Draft for review. Linear: MS-2424 (related to MS-2371). Demo video of every flow (4 min 40 s, real build against meetstream mock): added by Sid in a comment.

What

CLI 1.1 guided flows, built as a prototype that runs end to end. It adds no new infrastructure and changes no default.

Command What it does
init Writes a starter project from a template: notetaker (Python), send-a-bot (Python, Node), live-captions (Python), webhook-receiver (Python, Node). In a terminal it asks one question at a time (Esc goes back). Each question is also a flag (--yes --no-input). --list --json prints the catalog. It writes .env (mode 0600) and AGENTS.md. No MeetStream key goes into .env by default (Sid's decision, 24 Nov): the app calls MeetStream through meetstream api with your sign-in. --with-key writes the key and its API URL for a server.
env Fills .env from .env.example and lists empty keys (--check, exit 3). --with-key adds the MeetStream key plus the profile API URL as the last line.
join --transcription <id> Same as -t, with a checked provider list.
join --live-transcription <id> Maps meetstream to meetstream_streaming, and the same for the other providers. The webhook comes from the running listen.
join --follow Prints each status change, then waits for the transcript. With --json it prints NDJSON. Exit 1 if the bot is not admitted, denied or failed; exit 4 if the transcript failed.
transcription providers Post-call and live providers, and which ones need a key in the dashboard.
transcribe --transcription Same as -p. The default stays deepgram.
listen --tunnel cloudflared|ngrok|https://…, --forward-to Runs a tunnel binary the user installed (MeetStream ships none). While listen runs, join with no -c sends events to it, but only when the API can reach that URL (the tunnel URL, or the local URL with the mock).
trigger <event> Sends a sample webhook in the production envelope (bot.notallowed goes out as event: bot.stopped, bot_event: bot.notallowed).
mock A loopback-only fake API with 5 scenarios: happy path, waiting-room timeout, transcript failed, bot removed, Zoom needs setup. No bots, no charges.
ai install Puts SKILL.md in the Claude Code and Codex skills folders and the hosted MCP entry in the Codex and Cursor configs (with a .bak backup). For Claude Code it prints claude mcp add.
api <path> One MeetStream API call with the CLI sign-in (-X, -d, --envelope). On a laptop, the init apps use it, so no key is copied into project files.
commands --json Every command, flag, enum and exit code, for agents and for generating skills.

Why

Plan: https://claude.ai/artifact/NXoHnomdZAxxCaEFqafFyp. Sid approved the names on 24 Nov 2026. The goal is for an agent or a developer to go from an empty folder to a tested notetaker with no live bots, then switch to real bots with one URL change.

How

  • New packages: internal/mock (API stand-in plus the webhook envelopes from the production webhook guide) and internal/templates (go:embed, text/template with [[ ]] delimiters).
  • internal/cli: the new commands, join_flow.go (flag mapping plus --follow) and listen_session.go (~/.meetstream/listen.json, which holds URLs only, plus the tunnel start).
  • mcp add --write now calls a shared mergeMCPFile. The strict backup rule for mcp add is unchanged.

Unchanged (contract):

  • -t, -p (default deepgram), --live-transcript-webhook and --forward work as before.
  • listen --json stdout is still one line per event. The new URL line goes to stderr.

Differences from the plan page:

  • --transcription and --live-transcription cannot be used together, because a bot runs one provider. The CLI exits 2 with a hint.
  • No signing secret: listen and the templates use per-bot callback_url deliveries, which are not signed (workspace endpoints are signed; see question 6).
  • Templates ship in the binary, not in a separate repo.
  • Node.js, not TypeScript.
  • No new request-ID flag, because --idempotency-key already exists.

Not in this PR:

  • The relay (listen without a tunnel, and bots tail).
  • The D1 default-provider decision.

Testing

  • go vet ./... and go test ./... pass on macOS. The 18 new tests are in internal/cli/guided_flows_test.go. They cover:
    • --follow NDJSON and the exit codes for each scenario
    • the flag mapping and conflicts, and that the old -t still works
    • when the listen session fills the callback, and that a dead session is ignored
    • init (all 6 templates render, non-empty folder, errors, key never printed)
    • env, trigger, tunnel URL parsing and the missing-binary case
    • ai install (safe to run again), the commands enums, and the mock's loopback-only rule
  • Manual runs against meetstream mock:
    • The notetaker app received the events, fetched the transcript and printed the notes.
    • send_bot.mjs (Node) ran to the transcript.
    • The live-captions app printed the live lines.
    • The webhook receiver received the trigger events.
    • The waiting-room run exited 1, the transcript-failed run exited 4, and the Zoom run gave the setup error.
  • Not run:
    • a real bot on the production API
    • a real cloudflared or ngrok tunnel
    • Windows CI (runs on this PR)

Questions for review

  1. D1: keep transcribe -p on deepgram, or move it to meetstream in 1.1 with a changelog note?
  2. Can the API serve the provider list (so the CLI drops its built-in copy)?
  3. Record real tst runs as mock fixtures?
  4. Do you agree with the auto-callback rule (fill -c from listen only when the API can reach it)?
  5. ai install prints claude mcp add and does not run it. Keep that rule?
  6. Security (corrected 24 Nov): workspace webhook endpoints ARE signed (X-MeetStream-Signature: sha256=<HMAC of the raw body>), but per-bot callback_url deliveries and live-transcript POSTs are not, and listen/the templates use callback_url. Anyone with a tunnel URL can post fake events. Options: (a) listen verifies signatures when the user points a signed workspace endpoint at it, (b) a per-session secret path in the tunnel URL, (c) sign callback_url deliveries server-side. Which one before we tell people to use --tunnel?

Naming and key decisions (Sid, 24 Nov)

  • Kept: listen --forward-to, join --follow. Hidden: join --agent-config-id (still works). bots summary stays visible.
  • Mixed key mode: no key in project files on a laptop; --with-key for servers (commit caefb7d).

Security review (commits 0fa54e1, 327cd10, 7e965ac)

  • env will not write .env through a symbolic link. When it writes the key, it also writes the profile's API URL, so a project file cannot send the key to another host.
  • listen removes control characters from webhook text before it prints it (no terminal escape injection).
  • The templates check bot_id and transcript_id against ^[A-Za-z0-9_-]{1,128}$ and URL-encode them before they go into an API path.

🤖 Generated with Claude Code

…anscription, join --follow, ai install, commands (MS-2424)

- init: templates (notetaker, send-a-bot, live-captions, webhook-receiver; Python/Node, no packages) embedded in the binary; step menus with Esc back; every question is a flag; writes .env (0600, key never printed) and AGENTS.md
- env: fill .env from .env.example; --check exits 3 on empty keys
- join --transcription / --live-transcription (mapped to *_streaming) / --follow (NDJSON with --json; exit 1 not admitted, 4 transcript failed)
- transcription providers; transcribe --transcription (default stays deepgram)
- listen --tunnel cloudflared|ngrok|https URL, --forward-to; a running listen fills join's callback when the API can reach it
- trigger: sample webhooks in the production envelope
- mock: loopback fake API with 5 scenarios, no bots, no charges
- ai install: SKILL.md + hosted MCP for Claude Code, Codex, Cursor
- commands --json: commands, flags, enums, exit codes

Old flags and listen --json stdout are unchanged. No relay, no default changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@doluz
doluz requested a review from KuramaCommit November 24, 2026 11:43
doluz and others added 12 commits November 24, 2026 17:15
- env: refuse to write .env through a symbolic link; when the CLI writes the API key it also writes the profile's API URL, so a project file cannot send the key to another host
- listen: strip control characters (ESC, C0/C1) from webhook text before printing
- templates: check bot_id and transcript_id against ^[A-Za-z0-9_-]{1,128}$ and URL-encode them before they go into an API path; notetaker ignores events with a bad bot_id; note that the app port must stay on loopback behind listen (webhooks are not signed)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- write MEETSTREAM_API_URL from the profile even when .env.example does not list it, and drop any other MEETSTREAM_API_URL line from the kept user lines
- read "export KEY=value" as KEY
- the warning no longer prints the old URL

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- "export<whitespace>KEY" and "KEY: value" name KEY; keys must match ^[A-Za-z_][A-Za-z0-9_]*$, other lines are dropped with a count
- when the key is written, every MEETSTREAM_API_URL variant (any case) from .env or .env.example is removed and the profile URL is written as the last line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-agent-config-id (MS-2424)

Sid's decision (24 Nov 2026): mixed mode.
- meetstream api <path> [-X] [-d] [--envelope]: one API call with the CLI sign-in; relative paths only
- init/env write no MeetStream key by default; --with-key writes the key and its profile API URL (for servers)
- templates (Python, Node): with no key in .env they call MeetStream through "meetstream api"; the CLI keeps the shell's API URL, so a URL in .env cannot redirect the sign-in; with a key they call the API directly
- .env.example, READMEs and AGENTS.md explain laptop vs server
- join --agent-config-id is hidden (same as --agent-config; still works)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- live: add sarvam_streaming and jigsawstack_streaming (Google Meet only)
- post-call: add aws_transcribe (not for US-region bots); meeting_captions is join only
- transcribe refuses meeting_captions and *_streaming providers with a usage hint (the server rejects them)
- transcription providers --json notes that the API has no transcribe default

Checked against meetstream-codebase origin/main dc873422a (read only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dioStatus/TranscriptStatus in /detail

Found by the cross-harness tests: skills correctly teach waiting for Done; the mock stopped at Stopped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tus message); mock matches production

- api: GetTranscript treats HTTP 202 from get_transcript as "not ready" and keeps polling; before, the
  202 JSON message ("Transcript is still being processed") was returned as the transcript. Affects
  `transcript --wait` and `join --follow` against production (1.0.1 has the same code). Tests added.
- mock: get_transcript answers 202 while processing (was 404), 409 for bots never admitted;
  adds GET /bots/{bot_id}/get_transcript (in the API spec); POST /transcribe answers 200 (was 202).

Found by the cross-harness tests (agents that handled the real 202 failed against the old mock).
Production behaviour checked in meetstream-codebase get_transcript Lambda (origin/main dc873422a).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… production

/mia CRUD with production validation, in-meeting commands (send_message,
send_image, send_command, pause/resume, update_mia acks), bridge sockets
(bot id in the path only for agent bots, ready handshakes, 0x04 24 kHz frames,
command replies), custom-function calls, raw/sentence/word_level live posts,
an agent-controls scenario, and GET /__mock/journal for tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ys; PUT validates custom functions; tool URLs rechecked; public tool URL rewrite for tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- listen --forward-to copies X-MeetStream-* headers and User-Agent (G3)
- join --live-transcription sends transcription_mode sentence; new
  --transcription-mode raw|sentence|word_level (validated, live providers
  only); listen human output and the live-captions template skip
  is_final:false POSTs, --json keeps every event (G4)
- transcript --wait / join --follow: no transcript_id and a terminal bot
  asks GET /bots/{id}/get_transcript once; 409 returns at once (G7)
- 202 on audio/video/streams/audio-streams/chats/screenshots is a
  NotReadyError, exit 3; 507 unchanged (G8)
- terminal status regex anchored to whole values, adds kicked, cancelled,
  mediaexpired; RecordingPermissionDenied is not terminal (G9)
- init templates read words[].text, punctuated_word, word, then flat
  transcript/text (G10)
- mia apply maps a saved mia get --json (agent_config wrapper, PascalCase)
  to the snake_case body POST/PUT read (G17)
- SKILL.md, README and commands --json enum updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…98Z), as production sends them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@doluz

doluz commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

New commits (MS-2488 and the cross-harness tests):

  • CLI fixes from the cross-surface audit (eef8cf4):
    • listen --forward-to keeps the X-MeetStream-* signature headers.
    • join --live-transcription sends transcription_mode: sentence by default; change it with --transcription-mode. listen and the live-captions template skip raw interim results.
    • A 202 (not ready) on chats, audio, video and screenshots exits 3 instead of printing the message as data.
    • transcript --wait returns a 409 (not admitted) at once instead of polling for 15 minutes.
    • The terminal-status regex is anchored, so RecordingPermissionDenied no longer counts as an end, and cancelled and mediaexpired exit.
    • init templates read words[].text.
    • mia get → mia apply works (PascalCase keys are converted to snake_case).
  • Mock (f204131, b241468, 1ccafa9, acd9a8a): it now matches production for the agent stack, live transcription modes, bridge sockets and custom functions. It has a request journal for tests, behind the token and an exact loopback Host check. Timestamps carry a zone.
  • Already on this branch: the 1.0.1 bug where transcript --wait printed a 202 "still processing" body as the transcript. The released 1.0.1 still has it.

Testing:

  • go vet ./... clean; go test ./... passes; new tests in internal/cli/ms2488_test.go, internal/api/ms2488_test.go and internal/mock/agents_test.go.
  • Live run against the real API with test meetings: the CLI-only notetaker and the CLI-only hosted agent both passed.

🤖 Generated with Claude Code

doluz and others added 3 commits November 27, 2026 18:23
…fore meeting_ready are dropped (as seen live on Google Meet)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…pped (live: +0.5 s dropped, +5 s posted)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eady

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@doluz
doluz marked this pull request as ready for review November 27, 2026 14:02
@doluz
doluz merged commit 54eaf1a into main Nov 27, 2026
5 checks passed
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.

1 participant