### Build local development binary with OAuth defaults Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/gmail-setup.md Create a local development binary with OAuth defaults built in by copying the env example, editing it, building, and running. ```sh cp .herald-dev.env.example .herald-dev.env $EDITOR .herald-dev.env make build ./bin/herald -config ~/.herald/conf.yaml ``` -------------------------------- ### Install and run local docs dev server Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/index.md Run these commands from the docs directory to install dependencies and start the local development server. ```sh cd docs npm install npm run dev ``` -------------------------------- ### Recommended live setup for MCP server Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/mcp.md Starts the daemon, checks status, and smoke-tests the MCP server. The daemon must be running for daemon-backed tools. ```sh herald serve -config ~/.herald/conf.yaml herald status echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | herald mcp -config ~/.herald/conf.yaml ``` -------------------------------- ### Install Herald CLI with Go Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/getting-started.md Installs the primary CLI binary as `herald` and runs the demo mode. The `mcp` and `ssh` subcommands replace older standalone command names for new setups. ```sh go install github.com/herald-email/herald-mail-app/cmd/herald@latest herald --demo ``` -------------------------------- ### Install and run Herald MCP server Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/mcp.md Installs the Herald CLI and starts the MCP server with a specified config file. The server speaks JSON-RPC over stdio and reads the SQLite cache. ```sh go install github.com/herald-email/herald-mail-app/cmd/herald@latest herald mcp -config ~/.herald/conf.yaml ``` -------------------------------- ### Install Herald via Homebrew and run demo Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/getting-started.md Installs the herald CLI from the herald-email/herald tap, trusts the tap, installs the package, and runs the demo mode. Use `herald` without flags to connect real accounts. ```sh brew tap herald-email/herald brew trust herald-email/herald brew install herald herald --demo # When you are ready to connect real accounts: herald ``` -------------------------------- ### Install from source and run demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/index.md For source installs or development: install via `go install`, run demo mode, or build from a checkout with `make build`. Source-built OAuth flows need local Google OAuth defaults or runtime variables. ```sh go install github.com/herald-email/herald-mail-app/cmd/herald@latest herald --demo # Or build from a checkout: git clone https://github.com/herald-email/herald-mail-app.git cd herald-mail-app make build ./bin/herald --demo ``` -------------------------------- ### Install Herald with Homebrew Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/gmail-setup.md Install Herald via Homebrew tap and trust the repository before installing. ```sh brew tap herald-email/herald brew trust herald-email/herald brew install herald ``` -------------------------------- ### Install vhs prerequisite Source: https://github.com/herald-email/herald-mail-app/blob/main/CLAUDE.md Install the vhs tool using Homebrew. ```bash brew install vhs ``` -------------------------------- ### Install Herald via go install or build from checkout Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Install the Herald binary using `go install` or build it from a source checkout. Use `./bin/herald` instead of `herald` when testing the checkout binary. ```bash go install github.com/herald-email/herald-mail-app/cmd/herald@latest # Or build from a checkout: go build -o bin/herald ./cmd/herald ``` -------------------------------- ### Install and run herald ssh Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/ssh-mode.md Install the Herald CLI and start SSH mode with a config file and address. The `-config` flag specifies the configuration file, and `-addr` sets the listening address. ```sh go install github.com/herald-email/herald-mail-app/cmd/herald@latest herald ssh -config ~/.herald/conf.yaml -addr :2222 ``` -------------------------------- ### Run Herald without demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/index.md Run `herald` to connect real accounts. Herald opens the setup wizard if `~/.herald/conf.yaml` is missing or empty. ```sh herald ``` -------------------------------- ### Install Herald MCP server with go install Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/mcp-setup.md Installs the primary Herald CLI, which includes the MCP server, from the latest version. ```sh go install github.com/herald-email/herald-mail-app/cmd/herald@latest ``` -------------------------------- ### Install and run Herald in browser with ttyd Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Install ttyd via Homebrew and start a writable browser terminal for Herald in demo mode. The -W flag is required for keyboard input; open http://localhost:7681 to use it. ```bash brew install ttyd ttyd -W ./bin/herald --demo ``` -------------------------------- ### Install VHS and ffmpeg Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/demo-gifs.md Prerequisites for generating demo media. ```sh brew install vhs ffmpeg ``` -------------------------------- ### Start a basic test lab Source: https://github.com/herald-email/herald-mail-app/blob/main/internal/testmail/README.md Initializes a local test lab and retrieves account configurations for Alice and Bob. ```go lab := testmail.Start(t) alice := lab.Account(testmail.DefaultAliceAddress) bob := lab.Account(testmail.DefaultBobAddress) cfg := alice.Config(filepath.Join(t.TempDir(), "alice-cache.db")) ``` -------------------------------- ### Build docs after copy-drift check Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/index.md From the repository root, run `make docs-copy-drift` before publishing to catch retired setup and tab-navigation wording. Then use `npm run build` from `docs/` to verify the docs compile. ```sh make docs-copy-drift ``` ```sh npm run build ``` -------------------------------- ### Install Herald from Source with Go Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Installs the primary CLI from source (Go 1.25+ required) or builds from a checkout. The canonical install path is 'github.com/herald-email/herald-mail-app/cmd/herald'. First launch uses demo mode; connect real accounts later. ```bash # Install the primary CLI from source (Go 1.25+ required) go install github.com/herald-email/herald-mail-app/cmd/herald@latest herald --demo # Or build from a checkout git clone https://github.com/herald-email/herald-mail-app.git cd herald-mail-app make build ./bin/herald --demo # Connect real accounts when ready ./bin/herald ``` -------------------------------- ### Install and run Herald demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Install Herald via Homebrew tap and run demo mode with a fake inbox and demo calendar. No mailbox, calendar account, Ollama, or API key required. ```bash brew tap herald-email/herald brew trust herald-email/herald brew install herald herald --demo ``` -------------------------------- ### Install Go Module Dependencies Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Commands to install the required experimental and stable packages for TUI testing. ```bash go get github.com/charmbracelet/x/vt@latest go get github.com/charmbracelet/x/exp/teatest@latest go get charm.land/bubbletea/v2@latest go get github.com/creack/pty@latest ``` -------------------------------- ### Install Legacy Wrapper Packages with Go Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Installs the legacy wrapper binaries 'herald-mcp-server' and 'herald-ssh-server' for existing configs and scripts that still call the old binary names. ```bash go install github.com/herald-email/herald-mail-app/cmd/herald-mcp-server@latest go install github.com/herald-email/herald-mail-app/cmd/herald-ssh-server@latest ``` -------------------------------- ### Handle missing configuration file Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/SSH_TESTPLAN.md Attempts to start the server with a non-existent configuration file to verify error handling. ```bash /tmp/herald-test ssh -config /nonexistent/proton.yaml -addr :2223 ``` -------------------------------- ### Install VHS and FFmpeg and regenerate demo GIFs Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/demo-mode.md Installs VHS and FFmpeg, then regenerates demo GIFs. Run from the repository root because the tapes reference ./bin/herald. Demo tapes live in demos/*.tape, canonical GIFs go to assets/demo/*.gif, and docs-facing copies go to docs/public/demo/*.gif. ```sh brew install vhs ffmpeg make docs-media ``` -------------------------------- ### Run Herald demo with local theme YAML Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/themes.md Use this command to launch Herald in demo mode with a local theme file. The example uses the installable slug 'my-jade-signal' to avoid conflicting with the reserved built-in 'jade-signal' theme. ```sh ./bin/herald --demo -theme ./jade-signal-baseline.yaml ``` -------------------------------- ### Install Herald via Homebrew on macOS Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Default macOS install path. Installs the 'herald' binary with 'mcp' and 'ssh' subcommands, plus compatibility wrappers 'herald-mcp-server' and 'herald-ssh-server'. Includes bundled Google OAuth defaults for Gmail and Google Calendar. First launch uses demo mode; connect real accounts later. ```bash brew tap herald-email/herald brew trust herald-email/herald brew install herald # First launch the safe demo herald --demo # Then connect real accounts when ready herald ``` -------------------------------- ### Install macOS command line tools for CGO Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/troubleshooting.md Installs macOS command line tools required for CGO and the C compiler needed by go-sqlite3. ```sh xcode-select --install ``` -------------------------------- ### Ollama configuration example Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/troubleshooting.md Example Ollama configuration for Herald. ```yaml ollama: host: "http://localhost:11434" model: "gemma3:4b" embedding_model: "nomic-embed-text-v2-moe" ``` -------------------------------- ### Build and run Herald in demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/demo-mode.md Builds Herald and starts demo mode with synthetic data. No mailbox, calendar account, Ollama, or API key is required. Useful for trying the interface, recording demos, and testing visual changes without touching real accounts. ```sh make build ./bin/herald --demo ``` -------------------------------- ### Herald example YAML config with credentials, server, SMTP, and optional ollama Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/getting-started.md Example configuration file. The ollama block is optional and can be omitted until local AI is enabled. Herald warns if the config file is readable by group or other users; use chmod 600 ~/.herald/conf.yaml for credentials stored in YAML. ```yaml credentials: username: "your@email.com" password: "your-password-or-app-password" server: host: "imap.fastmail.com" port: 993 smtp: host: "smtp.fastmail.com" port: 587 ollama: host: "http://localhost:11434" model: "gemma3:4b" embedding_model: "nomic-embed-text-v2-moe" ``` -------------------------------- ### Start a named scenario Source: https://github.com/herald-email/herald-mail-app/blob/main/internal/testmail/README.md Initializes a test lab with a pre-defined scenario, such as a Calendly invite, to provide a realistic fixture shape. ```go seeded := testmail.StartScenario(t, testmail.ScenarioCalendlyInvite) alice := seeded.Lab.Account(testmail.DefaultAliceAddress) ref := seeded.Refs["invite"] cfg := alice.Config(filepath.Join(t.TempDir(), "alice-cache.db")) ``` -------------------------------- ### Install Herald via Homebrew Source: https://github.com/herald-email/herald-mail-app/blob/main/RELEASE.md Installs the release-built Herald binary via Homebrew. The formula uses immutable versioned release assets and must not point at mutable beta-latest assets. ```bash brew tap herald-email/herald brew install herald herald --version ``` -------------------------------- ### Build from local checkout and run MCP server Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/mcp.md Builds the Herald CLI from a local checkout and runs the MCP server, substituting ./bin/herald for herald in examples. ```sh go build -o bin/herald ./cmd/herald ./bin/herald mcp -config ~/.herald/conf.yaml ``` -------------------------------- ### Build from local checkout and run herald ssh Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/ssh-mode.md Build the primary CLI from a local checkout and run SSH mode, substituting `./bin/herald` for `herald` in the examples. ```sh go build -o bin/herald ./cmd/herald ./bin/herald ssh -config ~/.herald/conf.yaml -addr :2222 ``` -------------------------------- ### Start the SSH server in tmux Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/SSH_TESTPLAN.md Initialize a tmux session and start the Herald SSH server on port 2222. ```bash # Pane A — server tmux new-session -d -s ssh_test tmux send-keys -t ssh_test '/tmp/herald-test ssh -config proton.yaml -addr :2222' Enter sleep 2 # wait for server to initialise ``` -------------------------------- ### Start Herald daemon with herald serve Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/mcp.md Starts the Herald daemon so daemon-backed MCP tools can mutate mail. The -config flag points to the configuration file; if the daemon is not running, those tools fail gracefully with a daemon-not-running message. ```sh herald serve -config ~/.herald/conf.yaml ``` -------------------------------- ### Run Herald MCP server with config Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/mcp-setup.md Starts the MCP server using the same config path as the TUI. ```sh herald mcp -config ~/.herald/conf.yaml ``` -------------------------------- ### Start Herald daemon and check status Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Start the Herald daemon and check its status. Live IMAP/SMTP actions require the daemon running. ```bash herald serve -config ~/.herald/conf.yaml herald status ``` -------------------------------- ### Run Herald in demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Starts Herald with a fictional mailbox and demo data. Use --demo to avoid touching real accounts. From a source checkout, use ./bin/herald --demo. ```bash herald --demo # or, from a source checkout: ./bin/herald --demo ``` -------------------------------- ### Proton Configuration File Source: https://github.com/herald-email/herald-mail-app/blob/main/CLAUDE.md Example configuration for proton.yaml, including credentials, server, SMTP, and Ollama settings. Ensure file permissions are set to 600. ```yaml credentials: username: "your_email@mail.com" password: "your_password" server: host: "127.0.0.1" # IMAP host (ProtonMail Bridge default) port: 1143 # IMAP port (use 993 for standard TLS) smtp: host: "127.0.0.1" # SMTP host (ProtonMail Bridge default) port: 1025 # SMTP port ollama: host: "http://localhost:11434" # Ollama API base URL model: "gemma2" # Model for classification and chat ``` -------------------------------- ### PTY allocation with github.com/creack/pty Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Shows how to allocate a PTY with github.com/creack/pty, set the terminal size, and read/write to the TUI process. Use this to spawn TUI binaries for testing. The example includes resizing the PTY after startup. ```go import ( "os/exec" "github.com/creack/pty" ) cmd := exec.Command("./my-tui") cmd.Env = append(os.Environ(), "TERM=xterm-256color") // Start with specific size ptmx, err := pty.StartWithSize(cmd, &pty.Winsize{ Rows: 24, Cols: 80, }) defer ptmx.Close() // ptmx is an *os.File — read for output, write for input // Read: ptmx.Read(buf) → TUI's stdout/stderr // Write: ptmx.Write([]byte("\x1b[B")) → send Down arrow to TUI // Resize pty.Setsize(ptmx, &pty.Winsize{Rows: 40, Cols: 120}) ``` -------------------------------- ### CLI discovery and compatibility commands Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/SSH_TESTPLAN.md Commands to verify the installation and versioning of the Herald CLI and SSH server components. ```bash /tmp/herald-test --help /tmp/herald-test ssh --version /tmp/herald-ssh-server-test --version ``` -------------------------------- ### Install tmux - Bash Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Installs tmux on macOS or Ubuntu/Debian and verifies the version. Requires tmux 3.0+ for best compatibility. ```bash # macOS brew install tmux # Ubuntu/Debian apt install tmux # Verify tmux -V # should be 3.0+ for best compatibility ``` -------------------------------- ### Rebuild project with make build Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/troubleshooting.md Rebuilds the project after installing the required tools. ```sh make build ``` -------------------------------- ### Command bar layout example Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/superpowers/specs/2026-04-03-sp6-compose-ai-assistant-design.md Shows the terminal layout of the Compose AI panel with the command bar, suggestion area, word diff, and action hints. The panel is compact for common terminal sizes and open by default. ```text AI Translate: Spanish v Style: Friendly v [Fix] [Shorten] [Expand] Undo Ask: > make this warmer ────────────────────────────────────────────────────────────────────────────── ┌─ AI Assist · Suggestion replaces draft ────────────────────────────────────┐ │ Suggestion (edit freely) │ │ Hi Alice, ... │ │ Changes · word diff │ │ ~~Hey~~ Hi Alice, ... │ │ Accept ctrl+enter │ Discard esc │ Undo ctrl+z │ Tab original/suggestion └────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### tmux workflow for testing the TUI at specific terminal sizes Source: https://github.com/herald-email/herald-mail-app/blob/main/AGENTS.md A step-by-step workflow to build a test binary, start a headless tmux session at a specific size, launch the app, capture screenshots, send keystrokes, resize, and kill the session. Use this to verify layout at different terminal sizes. ```bash # 1. Build a test binary go build -o /tmp/herald-test . # 2. Start a headless session at a specific size (WIDTHxHEIGHT) tmux new-session -d -s test -x 220 -y 50 # 3. Launch the app inside it tmux send-keys -t test 'env -u NO_COLOR TERM=xterm-256color COLORTERM=truecolor /tmp/herald-test -config proton.yaml' Enter sleep 5 # wait for IMAP connect + initial load # 4. Capture a screenshot (plain text, ANSI escape codes included with -e) tmux capture-pane -t test -p -e > /tmp/cap.txt cat /tmp/cap.txt # 5. Send keystrokes to navigate (no Enter suffix = no newline) tmux send-keys -t test '1' '' # switch to Timeline tab sleep 0.5 tmux send-keys -t test 'jjjj' '' # navigate down sleep 0.3 tmux send-keys -t test '' '' # open body preview (Enter) sleep 2 tmux capture-pane -t test -p -e > /tmp/cap_body.txt # 6. Resize and re-test tmux resize-window -t test -x 80 -y 24 sleep 0.3 tmux capture-pane -t test -p -e > /tmp/cap_80.txt # 7. Kill the session when done tmux kill-session -t test ``` -------------------------------- ### Subject suggestion overlay example Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/superpowers/specs/2026-04-03-sp6-compose-ai-assistant-design.md Shows the overlay that appears when Ctrl+J is pressed from anywhere in compose, displaying the suggested subject and a Tab-to-accept hint. ```text Subject: [Quick sync tomorrow?] ✨ Suggested: "Meeting request: project updates" — Tab to accept ``` -------------------------------- ### Run TUI to populate cache Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/MCP_TESTPLAN.md Starts the Herald TUI with a Proton config to sync email into the cache. Press q once sync is complete. ```bash ./bin/herald -config proton.yaml # Press q once sync is complete ``` -------------------------------- ### Start demo tmux session Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTPLAN.md Creates a tmux session named 'mp' with a 220x50 pane and launches the demo TUI. Waits 5 seconds for startup. ```bash tmux kill-session -t mp 2>/dev/null || true tmux new-session -d -s mp -x 220 -y 50 tmux send-keys -t mp '/tmp/herald --demo' Enter sleep 5 ``` -------------------------------- ### Run demo mode in browser with ttyd Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/demo-mode.md Starts a browser demo by combining demo mode with ttyd. The -W flag enables write access for the terminal. ```sh ttyd -W ./bin/herald --demo ``` -------------------------------- ### Normal development build with .herald-dev.env Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/development/local-oauth-builds.md Sets up a local development build that embeds Google OAuth credentials from .herald-dev.env. The build succeeds even if a variable is missing, and OAuth setup later reports 'Google OAuth credentials are not configured'. ```sh cp .herald-dev.env.example .herald-dev.env $EDITOR .herald-dev.env make build ./bin/herald ``` ```sh HERALD_GOOGLE_CLIENT_ID=your-dev-client-id.apps.googleusercontent.com HERALD_GOOGLE_CLIENT_SECRET=your-dev-client-secret ``` -------------------------------- ### Herald CLI commands for daemon management Source: https://github.com/herald-email/herald-mail-app/blob/main/VISION.md CLI mirrors Ollama's UX. Commands: serve starts daemon in foreground (use launchd/systemd for autostart), status shows running daemon info, stop performs graceful shutdown, sync triggers incremental IMAP sync. ```bash herald serve # start daemon (foreground; launchd/systemd for autostart) herald status # show running daemon info herald stop # graceful shutdown herald sync # trigger incremental IMAP sync ``` -------------------------------- ### Start onboarding tmux session Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTPLAN.md Removes any existing onboarding config, creates a tmux session named 'mp-onboard', and launches the TUI with a fresh config file. Waits 3 seconds. ```bash rm -f /tmp/herald-onboard.yaml tmux kill-session -t mp-onboard 2>/dev/null || true tmux new-session -d -s mp-onboard -x 220 -y 50 tmux send-keys -t mp-onboard '/tmp/herald -config /tmp/herald-onboard.yaml' Enter sleep 3 ``` -------------------------------- ### Initialize addons and open terminal Source: https://github.com/herald-email/herald-mail-app/blob/main/tools/ttyd-image-harness/index.html Initializes the FitAddon and ImageAddon, loads them into the terminal, opens it in the DOM, fits it to the container, and focuses it. ```javascript const fitAddon = new FitAddon(); const imageAddon = new ImageAddon({ enableSizeReports: true, iipSupport: true, sixelSupport: true, sixelScrolling: true, showPlaceholder: true, }); terminal.loadAddon(fitAddon); terminal.loadAddon(imageAddon); terminal.open(document.getElementById("terminal")); fitAddon.fit(); terminal.focus(); ``` -------------------------------- ### Export OAuth credentials for one-off run Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/gmail-setup.md Export Google OAuth credentials in the same shell before launching Herald for a one-off local run. ```sh export HERALD_GOOGLE_CLIENT_ID="your-client-id.apps.googleusercontent.com" export HERALD_GOOGLE_CLIENT_SECRET="your-client-secret" ./bin/herald -config ~/.herald/conf.yaml ``` -------------------------------- ### Run Herald in demo mode Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/first-5-minutes.md Starts Herald in demo mode, which uses synthetic mail and does not connect to a real inbox. The demo mode keeps the same visible status bar, key hints, mouse support, and ? help as normal sessions. ```sh herald --demo ``` -------------------------------- ### Use a specific host key path Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/ssh-mode.md Start SSH mode with a custom host key path using the `-host-key` flag. ```sh herald ssh -host-key .ssh/host_ed25519 ``` -------------------------------- ### Herald CLI flags: -help, -debug, -verbose, -config, --demo Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/getting-started.md Shows common Herald command-line flags. Use ./bin/herald --demo for a source checkout before real setup, and ./bin/herald when launching against real accounts. -debug and -verbose both enable DEBUG-level file logging; Herald does not write logs to the terminal to avoid corrupting the TUI. ```sh herald -help herald -debug herald -verbose herald -config custom.yaml herald --demo ``` -------------------------------- ### Use daemon backend with herald ssh Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/ssh-mode.md Start the Herald daemon and then run SSH mode with the `-daemon` flag to connect to the daemon instead of opening IMAP per SSH session. ```sh herald serve -config ~/.herald/conf.yaml herald ssh -config ~/.herald/conf.yaml -daemon http://127.0.0.1:7272 ``` -------------------------------- ### GitHub Actions CI Configuration Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Example workflow for running TUI integration tests in a GitHub Actions environment using tmux. ```yaml name: TUI Integration Tests on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version: "1.22" - name: Install tmux run: sudo apt-get install -y tmux - name: Build run: go build -o my-tui-app . - name: Run TUI tests run: go test -v -run TestTUI -count=1 -timeout 60s ``` -------------------------------- ### Start live tmux session Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTPLAN.md Creates a tmux session named 'mp-live' and launches the TUI with a config file. Waits 8 seconds for startup. ```bash tmux kill-session -t mp-live 2>/dev/null || true tmux new-session -d -s mp-live -x 220 -y 50 tmux send-keys -t mp-live '/tmp/herald -config ~/.herald/conf.yaml' Enter sleep 8 ``` -------------------------------- ### WebSocket setup and global send/input functions Source: https://github.com/herald-email/herald-mail-app/blob/main/tools/ttyd-image-harness/index.html Creates the WebSocket connection to the ttyd server, defines a helper to send text commands, and exposes global functions for sending data and simulating input. ```javascript const socket = new WebSocket(`${protocol}//${location.host}/ws`, ["tty"]); socket.binaryType = "arraybuffer"; const encode = new TextEncoder(); const sendText = (command, payload) => { if (socket.readyState === WebSocket.OPEN) { socket.send(encode.encode(command + payload)); } }; window.heraldHarnessSendData = (data) => { sendText("0", data); return socket.readyState; }; window.heraldHarnessInput = (data) => { terminal.focus(); if (typeof terminal.input === "function") { terminal.input(data, true); } else { terminal.paste(data); } return socket.readyState; }; ``` -------------------------------- ### Herald daemon subcommands: serve, status, stop, sync Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/advanced/daemon.md Shows the main Herald binary subcommands for managing the daemon. `serve` starts the daemon in the foreground, `status` checks its state, `stop` sends SIGTERM, and `sync` triggers a sync for INBOX or a specified folder. ```sh ./bin/herald serve -config ~/.herald/conf.yaml ./bin/herald status ./bin/herald stop ./bin/herald sync ./bin/herald sync Archive ``` -------------------------------- ### Example classification_prompts and classification_actions YAML configuration Source: https://github.com/herald-email/herald-mail-app/blob/main/VISION.md Declarative configuration for classification prompts and actions. Prompts define AI extraction or tagging; actions trigger notify, command, or webhook with template variables like {{.Sender}} and {{.Subject}}. ```yaml classification_prompts: - name: project-tagger prompt: | Given this email, respond with exactly one project name: infra, backend, frontend, hiring, other Sender: {sender} Subject: {subject} Tag: categories: [infra, backend, frontend, hiring, other] - name: order-extractor prompt: | If this email contains an order or tracking number, extract it. Respond with ONLY the number, or "none" if not found. Sender: {sender} Subject: {subject} Number: extract: true classification_actions: - category: imp action: notify title: "Important email" body: "From {{.Sender}}: {{.Subject}}" - category: txn prompt: order-extractor action: command command: "echo '{{.ExtractedData}}' >> ~/orders.log" - category: infra prompt: project-tagger action: webhook url: "https://hooks.slack.com/services/XXX" body: '{"text": "Infra email from {{.Sender}}: {{.Subject}}"}' ``` -------------------------------- ### YAML config sketch for multi-account sources Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/superpowers/specs/2026-05-22-source-platform-architecture.md Example YAML configuration showing the new sources structure with mail and calendar sources. Includes provider-specific auth blocks (imap, smtp, google) and account-level compose signature. This is a sketch for the proposed config direction. ```yaml sources: - id: work-mail kind: mail provider: imap display_name: Work Mail account_id: work credentials: username: user@example.com password: ref-or-secret imap: host: imap.example.com port: 993 smtp: host: smtp.example.com port: 587 compose: signature: text: "-- \nWork signature" - id: work-calendar kind: calendar provider: google_calendar display_name: Work Calendar account_id: work google: refresh_token: ref-or-secret ``` -------------------------------- ### Go tmux harness for TUI integration tests Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Provides a tmux-based test harness for TUI integration tests. It creates a unique session, waits for initial render, and offers helpers for screenshots, key sending, text input, resizing, and content assertions. Tests automatically skip if tmux is not installed. ```go package myapp_test import ( "fmt" "os" "os/exec" "strings" "testing" "time" ) type tmuxHarness struct { session string t *testing.T width int height int } func newTmuxHarness(t *testing.T, binary string, width, height int) *tmuxHarness { t.Helper() // Check tmux is available if _, err := exec.LookPath("tmux"); err != nil { t.Skip("tmux not found, skipping integration test") } // Unique session name for parallel test safety session := fmt.Sprintf("test-%s-%d", t.Name(), os.Getpid()) // tmux session names can't have dots or colons session = strings.NewReplacer(".", "-", ":", "-", "/", "-").Replace(session) h := &tmuxHarness{session: session, t: t, width: width, height: height} err := exec.Command("tmux", "new-session", "-d", "-s", session, "-x", fmt.Sprint(width), "-y", fmt.Sprint(height), binary, ).Run() if err != nil { t.Fatalf("failed to start tmux session: %v", err) } // Cleanup on test end t.Cleanup(func() { exec.Command("tmux", "kill-session", "-t", session).Run() }) // Wait for initial render time.Sleep(500 * time.Millisecond) return h } func (h *tmuxHarness) screenshot() string { h.t.Helper() out, err := exec.Command("tmux", "capture-pane", "-t", h.session, "-p").Output() if err != nil { h.t.Fatalf("capture-pane failed: %v", err) } return string(out) } func (h *tmuxHarness) sendKeys(keys ...string) { h.t.Helper() args := append([]string{"send-keys", "-t", h.session}, keys...) if err := exec.Command("tmux", args...).Run(); err != nil { h.t.Fatalf("send-keys failed: %v", err) } time.Sleep(200 * time.Millisecond) } func (h *tmuxHarness) sendText(text string) { h.t.Helper() if err := exec.Command("tmux", "send-keys", "-t", h.session, "-l", text).Run(); err != nil { h.t.Fatalf("send-keys -l failed: %v", err) } time.Sleep(200 * time.Millisecond) } func (h *tmuxHarness) resize(width, height int) { h.t.Helper() exec.Command("tmux", "resize-window", "-t", h.session, "-x", fmt.Sprint(width), "-y", fmt.Sprint(height), ).Run() h.width = width h.height = height time.Sleep(200 * time.Millisecond) } func (h *tmuxHarness) waitForContent(text string, timeout time.Duration) bool { h.t.Helper() deadline := time.Now().Add(timeout) for time.Now().Before(deadline) { if strings.Contains(h.screenshot(), text) { return true } time.Sleep(100 * time.Millisecond) } return false } func (h *tmuxHarness) requireContent(text string) { h.t.Helper() if !strings.Contains(h.screenshot(), text) { h.t.Errorf("expected screen to contain %q\n\nActual screen:\n%s", text, h.screenshot()) } } func (h *tmuxHarness) requireNoContent(text string) { h.t.Helper() if strings.Contains(h.screenshot(), text) { h.t.Errorf("expected screen NOT to contain %q\n\nActual screen:\n%s", text, h.screenshot()) } } // --- Tests --- func TestTUI_InitialRender(t *testing.T) { h := newTmuxHarness(t, "./my-tui-app", 80, 24) h.requireContent("Welcome") } func TestTUI_Navigation(t *testing.T) { h := newTmuxHarness(t, "./my-tui-app", 80, 24) h.waitForContent("Item 1", 3*time.Second) h.sendKeys("Down", "Down") h.requireContent("> Item 3") } func TestTUI_TextInput(t *testing.T) { h := newTmuxHarness(t, "./my-tui-app", 80, 24) h.waitForContent("Search:", 3*time.Second) h.sendText("query term") h.requireContent("query term") // Clear and retype for i := 0; i < 10; i++ { h.sendKeys("BSpace") } h.sendText("new query") h.requireContent("new query") h.requireNoContent("query term") } func TestTUI_Resize(t *testing.T) { h := newTmuxHarness(t, "./my-tui-app", 80, 24) h.waitForContent("Ready", 3*time.Second) h.resize(40, 12) h.requireContent("Ready") // still renders after resize } ``` -------------------------------- ### Initialize Emulator Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Create a standard or thread-safe virtual terminal emulator instance. ```go // Emulator is the main type. NOT concurrency-safe. e := vt.NewEmulator(80, 24) // width, height in cells // SafeEmulator wraps Emulator with a mutex. Use this from agent goroutines. se := vt.NewSafeEmulator(80, 24) ``` -------------------------------- ### Generate demo media Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/development/regenerate-screenshots.md Builds the project and generates documentation media from the repository root. ```sh make build make build-mcp make docs-media ``` -------------------------------- ### ttyd options: custom port, basic auth, real accounts Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Alternative ttyd invocations: custom port with -p 8080, basic auth with -c user:pass, and real account setup by dropping --demo. ```bash ttyd -W -p 8080 ./bin/herald --demo # Custom port ttyd -W -c user:pass ./bin/herald --demo # Basic auth ttyd -W ./bin/herald # Real account setup when ready ``` -------------------------------- ### TUI snapshot test with teatest and golden file Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/superpowers/specs/2026-04-01-sp5-contacts-tests-autocomplete-design.md Example snapshot test that initializes the app with a stub backend, waits for expected content using teatest.WaitFor, and compares the final output against a golden file. Uses a fixed terminal size of 120x40 and a 3-second timeout with 50ms polling. ```go func TestSnapshot_TimelinePopulated(t *testing.T) { backend := &stubBackend{emails: mockEmails()} m := app.New(testConfig(), backend) tm := teatest.NewTestModel(t, m, teatest.WithInitialTermSize(120, 40)) teatest.WaitFor(t, tm.Output(), func(bts []byte) bool { return bytes.Contains(bts, []byte("alice@example.com")) }, teatest.WithCheckInterval(50*time.Millisecond), teatest.WithDuration(3*time.Second)) requireGolden(t, "testdata/snapshots/timeline_populated.txt", tm.FinalOutput(t)) } ``` -------------------------------- ### Set up local OAuth build Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/troubleshooting.md Sets up a local development build with OAuth credentials from .herald-dev.env. ```sh cp .herald-dev.env.example .herald-dev.env $EDITOR .herald-dev.env make build ./bin/herald ``` -------------------------------- ### Local theme YAML file example Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/reference/config.md A validated theme file is copied to ~/.herald/themes/.yaml with private permissions. The example defines a theme named quiet-slate that inherits herald-dark and sets a focused panel border color. ```yaml version: 1 name: quiet-slate display_name: Quiet Slate inherits: herald-dark roles: focus.panel_border_focused: fg: "#55c2ff" ``` -------------------------------- ### Build, run, and develop Herald with Makefile and CLI flags Source: https://github.com/herald-email/herald-mail-app/blob/main/AGENTS.md Shows common commands for building, running, and developing the Herald app. Includes CLI flags like -debug, -verbose, -config, and -help. Use make deps, make fmt, and make test for development tasks. ```bash # Build and run make build && ./bin/herald # Or run directly make run # CLI flags ./bin/herald -debug # Enable debug logging in the Herald user log directory ./bin/herald -verbose # Alias for -debug (same behavior today) ./bin/herald -config custom.yaml # Custom config file ./bin/herald -help # Development make deps # Install dependencies make fmt # Format code make test # Run tests ``` -------------------------------- ### GET /v1/search/all Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Performs a cross-folder search. ```APIDOC ## GET /v1/search/all ### Description Performs a cross-folder search. ### Method GET ### Endpoint /v1/search/all ### Parameters #### Query Parameters - **q** (string) - Optional - Search query. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### TUI Testing Workflow with tmux Source: https://github.com/herald-email/herald-mail-app/blob/main/CLAUDE.md A step-by-step workflow to build a test binary, launch it in a headless tmux session, interact with the TUI, and capture output for verification. ```bash # 1. Build a test binary go build -o /tmp/herald-test . # 2. Start a headless session at a specific size (WIDTHxHEIGHT) tmux new-session -d -s test -x 220 -y 50 # 3. Launch the app inside it tmux send-keys -t test '/tmp/herald-test -config proton.yaml' Enter sleep 5 # wait for IMAP connect + initial load # 4. Capture a screenshot (plain text, ANSI escape codes included with -e) tmux capture-pane -t test -p -e > /tmp/cap.txt cat /tmp/cap.txt # 5. Send keystrokes to navigate (no Enter suffix = no newline) tmux send-keys -t test '1' '' # switch to Timeline tab sleep 0.5 tmux send-keys -t test 'jjjj' '' # navigate down sleep 0.3 tmux send-keys -t test '' '' # open body preview (Enter) sleep 2 tmux capture-pane -t test -p -e > /tmp/cap_body.txt # 6. Resize and re-test tmux resize-window -t test -x 80 -y 24 sleep 0.3 tmux capture-pane -t test -p -e > /tmp/cap_80.txt # 7. Kill the session when done tmux kill-session -t test ``` -------------------------------- ### GET /v1/folders/status Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Retrieves the status of folders. ```APIDOC ## GET /v1/folders/status ### Description Retrieves the status of folders. ### Method GET ### Endpoint /v1/folders/status ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### GET /v1/folders Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Retrieves the list of folders. ```APIDOC ## GET /v1/folders ### Description Retrieves the list of folders. ### Method GET ### Endpoint /v1/folders ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### Open deep link with --demo --open Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/features/notifications.md Use `--open` for deterministic testing of deep links. ```bash herald --demo --open 'herald://mail/search?folder=INBOX&q=invoice' ``` -------------------------------- ### Build Herald binaries Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/MCP_TESTPLAN.md Builds the main Herald binary and the MCP server compatibility wrapper. ```bash go build -o /tmp/herald-test ./cmd/herald go build -o /tmp/herald-mcp-server-test ./cmd/herald-mcp-server # compatibility wrapper ``` -------------------------------- ### GET /v1/stats Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Retrieves sender statistics. Optionally filter by folder. ```APIDOC ## GET /v1/stats ### Description Retrieves sender statistics. ### Method GET ### Endpoint /v1/stats ### Parameters #### Query Parameters - **folder** (string) - Optional - Folder to filter stats. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### GET /v1/emails/{id}/attachments Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Lists attachments for a specific email. ```APIDOC ## GET /v1/emails/{id}/attachments ### Description Lists attachments for a specific email. ### Method GET ### Endpoint /v1/emails/{id}/attachments ### Parameters #### Path Parameters - **id** (string) - Required - The email ID. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### Run demo with Kitty image protocol Source: https://github.com/herald-email/herald-mail-app/blob/main/README.md Runs demo mode with the Kitty image protocol for terminal image rendering. Requires a Kitty-protocol terminal like Ghostty or Kitty. ```bash ./bin/herald --demo -image-protocol=kitty ``` -------------------------------- ### Build Herald CLI from local checkout Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/mcp-setup.md Builds the same primary CLI from a local checkout, outputting to `bin/herald`. Use `./bin/herald` instead of `herald` when testing the checkout binary. ```sh go build -o bin/herald ./cmd/herald ``` -------------------------------- ### Uninstall Homebrew package Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/uninstall.md Removes the Herald release binaries installed via Homebrew on macOS. ```sh brew uninstall herald ``` -------------------------------- ### Run ttyd image harness probes (custom, themed, stock) Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/TUI_TESTING.md Run the repository custom ttyd harness probe from the repo root. The default custom mode is the reliable browser-raster regression lane; the themed variant sets HERALD_THEME=jade-signal to catch regressions where -theme full-screen background styling mutates native image overlay escape bytes; the stock variant sets TTYD_MODE=stock to compare against the manual ttyd frontend. Each probe drives the demo to Step 5, captures a browser screenshot, and writes pixel-component metrics. ```bash make build env -u NO_COLOR COLORTERM=truecolor \ PORT=7682 EVIDENCE_DIR=reports/ttyd-custom-image-preview \ tools/ttyd-image-harness/probe.sh ``` ```bash make build env -u NO_COLOR COLORTERM=truecolor \ HERALD_THEME=jade-signal PORT=7684 EVIDENCE_DIR=reports/ttyd-themed-image-preview \ tools/ttyd-image-harness/probe.sh ``` ```bash make build env -u NO_COLOR COLORTERM=truecolor \ TTYD_MODE=stock PORT=7683 EVIDENCE_DIR=reports/ttyd-stock-image-preview \ tools/ttyd-image-harness/probe.sh ``` -------------------------------- ### GET /v1/emails/{id}/body Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Retrieves the body of a specific email by its ID. ```APIDOC ## GET /v1/emails/{id}/body ### Description Retrieves the body of a specific email. ### Method GET ### Endpoint /v1/emails/{id}/body ### Parameters #### Path Parameters - **id** (string) - Required - The email ID. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### GET /v1/emails/by-sender Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md Retrieves emails grouped by sender. Optionally filter by folder. ```APIDOC ## GET /v1/emails/by-sender ### Description Retrieves emails grouped by sender. ### Method GET ### Endpoint /v1/emails/by-sender ### Parameters #### Query Parameters - **folder** (string) - Optional - Folder to filter emails. ### Response #### Success Response (200) No response body documented. ``` -------------------------------- ### Build Herald from a local checkout Source: https://github.com/herald-email/herald-mail-app/blob/main/docs/src/content/docs/getting-started.md Clones the repository, builds the binary, and runs demo mode. For Gmail or Google Calendar OAuth from a source checkout, prepare local OAuth defaults before building or export runtime credentials. ```sh git clone https://github.com/herald-email/herald-mail-app.git cd herald-mail-app make build ./bin/herald --demo ``` -------------------------------- ### Build Herald binaries Source: https://github.com/herald-email/herald-mail-app/blob/main/engineering/testplans/SSH_TESTPLAN.md Compile the Herald and SSH server binaries for testing purposes. ```bash go build -o /tmp/herald-test ./cmd/herald go build -o /tmp/herald-ssh-server-test ./cmd/herald-ssh-server # compatibility wrapper ``` -------------------------------- ### GET /v1/ws Source: https://github.com/herald-email/herald-mail-app/blob/main/ARCHITECTURE.md WebSocket endpoint for push events. Streams ProgressEvent, NewEmailsEvent, and ValidIDsEvent. ```APIDOC ## GET /v1/ws ### Description WebSocket endpoint for push events. ### Method GET ### Endpoint /v1/ws ### Response #### Success Response (101) WebSocket connection established. ### Events - **ProgressEvent** - Sync progress updates. - **NewEmailsEvent** - New email notifications. - **ValidIDsEvent** - Valid ID updates. ```