ngchat-cli

module
v1.0.0-rc.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT

README

ngchat

Newgrounds Chat in your terminal. One static Go binary for Linux, macOS and Windows: no browser, no Electron, no runtime to install.

  • The whole room, in color. Formatted messages, spoilers, links you can click, /me actions, and a highlighted bar on anything that mentions you.
  • Tab completion for names, slash commands, NG emotes and emoji.
  • Knows when you're away. Unread counts in the window title, a new since divider, and a desktop notification when someone mentions or DMs you.
  • Stays connected. The chat token renews in place every hour, and a dropped connection comes back on its own, marking any gap.
  • Ten themes, five for dark terminals and five for light ones; the default turns light by itself on a light terminal. See them all.

CHANGELOG.md has what each release added, and the roadmap what is coming (emote sprites and channel switching among it).

Install

Grab an archive for your platform from Releases, or build it with Go:

go install github.com/newgrounds-inc/ngchat-cli/cmd/ngchat@v1.0.0-rc.15

Name the version: until v1.0.0 is tagged, @latest still resolves to the old v0.1.0 scaffold.

macOS says it cannot verify ngchat

The release binary is not signed or notarized yet, so Gatekeeper refuses one downloaded through a browser ("Apple could not verify “ngchat” is free of malware…"), from Finder and from a shell alike. Clear the quarantine flag once, in the extracted folder:

xattr -d com.apple.quarantine ngchat
Windows says it protected your PC

The binary is not Authenticode-signed either. Opening a browser-downloaded ngchat.exe from Explorer brings up SmartScreen's "Windows protected your PC"; choose More info, then Run anyway. Running it from Windows Terminal is not blocked. To clear the download mark instead:

Unblock-File .\ngchat.exe

go install builds locally and needs neither. Each release also ships a checksums.txt, which catches a corrupt download but not a swapped one: it is published alongside the archives and is not signed. Builds are reproducible (-trimpath, fixed timestamps), so to verify an archive, build the tagged commit yourself and compare.

Linux and macOS are tested before every release. Windows builds are published and CI tests them, but the TUI gets less hands-on use there, so use Windows Terminal and report what breaks.

Get started

ngchat

The first run plays a short splash, then asks for your username or email, your password, and a two-factor code if your account has one (a TOTP recovery code works at the same prompt). Mistyped the username? esc, or enter on an empty password, goes back. After that it joins #general straight away.

NG Chat is a supporter-only feature. If your account is not one, ngchat exits with the server's notice after connecting.

Command What it does
ngchat login Log in again, as plain terminal prompts (handy for screen readers).
ngchat logout Log this device out on the site, so the stored login stops working everywhere, then forget it locally. If the site cannot be reached it says so and exits non-zero, because the login is still valid there.
ngchat -help Flags, keys and environment variables.

In the chat

Press f1, or type /keys, for this list in the app:

Key What it does
enter send
tab complete @names, /commands, ng emotes and :emoji
pgup / pgdn scroll a page
↑ / ↓ scroll a line (so does the mouse wheel, in terminals that send it as arrows)
end jump to the newest message
home jump to the oldest, on an empty line
ctrl+p / ctrl+n recall earlier messages you sent, and back
ctrl+s reveal or hide spoilers
ctrl+t show or hide timestamps
ctrl+c quit (so do ctrl+d on an empty line and /quit)

Some terminals, GNOME Terminal among them, keep f1 for their own help; /keys always works.

Completion. @ lists who is in the room, / as the first character lists the commands your rank may use, a word starting ng or tf completes NG emote codes, and : completes emoji with the glyph beside each name. tab, shift+tab or the arrows move through the list, enter accepts, esc closes.

Commands. /who lists who is here (mods marked @, away users dimmed), /keys shows the keys, and /quit leaves; those three stay on your machine. Everything else (/me, /slap, /dm, /roll, …) goes to the server.

Scrolling back. New messages never yank you back down. The help row becomes a banner counting what arrived below (↓ 12 new · 1 mention · end to jump); end, typing or sending brings you back.

While you're away. The window title is ngchat · #general, and becomes (3) ngchat, or (@1) ngchat for mentions, while you are scrolled up or in another window. A new since 16:42 divider marks where you stopped reading. Terminals that report focus (most do; tmux needs focus-events on) count while in the background too.

Mentions and DMs are highlighted and ring the terminal bell. In the background they also send a desktop notification (OSC 9: iTerm2, WezTerm, Ghostty). -quiet keeps the highlight and drops the bell and the notification.

Links are clickable in terminals that support OSC 8 hyperlinks (kitty, foot, WezTerm, Ghostty, iTerm2, Windows Terminal, GNOME Terminal). Emotes show as :code: for now; drawing them as images is on the roadmap.

Themes

ngchat follows the site's ngchat theme on a dark terminal and switches to ngchat-light on a light one. NGCHAT_THEME picks any of the ten instead:

  • dark: ngchat, classic, neon, fathom, phosphor
  • light: ngchat-light, inkwell, orchard, orchid, newsprint

The terminal keeps its own background, so pick one of the right kind. docs/themes.md has a screenshot of each.

Accessibility

  • Motion. The opening animation redraws the whole screen 30 times a second until it ends, a few seconds after connecting or on any key. -no-splash or NGCHAT_NO_SPLASH=1 skips it, and a window under about 40×8 never shows it.
  • Screen readers. ngchat draws a full-screen view in the terminal's alternate screen, so the chat is not in the terminal's own scrollback, and the status bar redraws whenever someone starts or stops typing (and each second of a reconnect countdown), which a reader that follows screen changes may announce. There is no plain, line-by-line mode yet; it is on the roadmap. ngchat login asks for your login as ordinary terminal prompts.
  • Color. NO_COLOR is honored, and nothing is told by color alone: mentions keep a reversed bar, errors a ✕, the message of the day its box.
  • Sound. -quiet drops the terminal bell and desktop notifications; mentions stay highlighted.
  • Keys. Everything is on the keyboard; /keys lists the keys.

Options

Flag
-quiet no bell or desktop notification on mentions and DMs
-splash opening animation: random, none, or a name
-no-splash skip the opening animation
-debug also write redacted frames to a log; its path is printed on exit
-version print the version and exit
Variable
NGCHAT_THEME a theme name (see Themes)
NGCHAT_SPLASH opening animation (random, none, or an effect name)
NGCHAT_NO_SPLASH set to skip the opening animation
NGCHAT_TIMES set to show timestamps from launch (ctrl+t still toggles them)
NGCHAT_NO_UPDATE_CHECK set to stop the daily check for a newer release
NO_COLOR set to drop color

Your login, and what ngchat stores

Only the site's long-lived remember cookie is stored; it mints short-lived chat tokens for you. Your password is never written to disk. If the site refuses the cookie (you changed your password), ngchat exits and asks you to run ngchat login again.

ngchat prefers the OS keyring: macOS Keychain, Windows Credential Manager, or on Linux a Secret Service provider over D-Bus (GNOME Keyring, KDE Wallet, or KeePassXC with its Secret Service integration on). When none answers, it says no OS keyring available and writes the cookie to ~/.config/ngchat/credentials.json with mode 0600 instead. That is fine on a headless box or a server only you log into; on a shared desktop, set up a keyring and run ngchat login again to move it.

New releases. At most once a day, ngchat asks GitHub's public API whether a newer release is out and, if so, says so in one line in the chat. A release candidate hears about newer candidates, a stable release only about stable ones. Nothing is downloaded or replaced. The request carries only the version (User-Agent: ngchat/<version>), and the answer is cached in your user cache directory (~/.cache/ngchat/update.json on Linux). NGCHAT_NO_UPDATE_CHECK=1 turns it off, and a local build never checks.

Development

AGENTS.md is the map: commands, the package layout, and a doc per package under docs/internals/. Vocabulary is in CONTEXT.md, decisions in docs/adr/. CI runs vet, the race tests and a GoReleaser snapshot build on every pull request and push to main; a v* tag reruns the Linux and macOS tests and cuts a release.

There is no public dev stack, so a test run against the default endpoints is a real session on the real site. The site's chat-token limiter counts against your account, so a loop that re-mints locks your own browser out of chat too, and a kick or ban earned while testing is a real one. Two tools help:

  • go run ./cmd/demo runs ngchat against a made-up room on loopback, for UI work and for recording; docs/media.md has how the GIF and theme screenshots are made.
  • go run ./cmd/smoke runs the whole stack headlessly against a real server and prints event summaries, never tokens; it is the tool for protocol and auth changes. docs/smoke.md has the details.

NGCHAT_SITE_URL, NGCHAT_WS_URL and NGCHAT_ROUTING_COOKIE exist so Newgrounds staff can point a build at an internal stack, and NGCHAT_NG_COOKIE (a raw cookie header) bypasses the stored login. Both URLs must be https/wss unless the host is loopback, the chat host must be on the site's domain, and a login is stored per site, so pointing at another site never sends it your production cookie.

Security reports: see SECURITY.md.

License

MIT

Directories

Path Synopsis
cmd
demo command
Command demo runs ngchat against a made-up room on loopback, for recording the README's GIF and theme screenshots without a session on the real site or anyone's real messages on a public page (the one real name in the room is there on purpose; see people).
Command demo runs ngchat against a made-up room on loopback, for recording the README's GIF and theme screenshots without a session on the real site or anyone's real messages on a public page (the one real name in the room is there on purpose; see people).
ngchat command
Command ngchat is a minimalist terminal client for Newgrounds Chat.
Command ngchat is a minimalist terminal client for Newgrounds Chat.
smoke command
Command smoke is a headless harness for verifying the client stack against a live stack: mint → connect → authenticate → subscribe → send.
Command smoke is a headless harness for verifying the client stack against a live stack: mint → connect → authenticate → subscribe → send.
Package e2e runs the built ngchat binary in a pseudo-terminal against a fake site and chat server on loopback, and reads the screen back through a terminal emulator (ADR 0009).
Package e2e runs the built ngchat binary in a pseudo-terminal against a fake site and chat server on loopback, and reads the screen back through a terminal emulator (ADR 0009).
internal
auth
Package auth handles credential storage, site login, and chat-JWT minting.
Package auth handles credential storage, site login, and chat-JWT minting.
client
Package client maintains the NG Chat WebSocket session: mint → dial → authenticate → resolve channel → subscribe, plus the heartbeat the server requires and the reconnect/dedupe logic that makes the hourly JWT-expiry disconnect invisible to the UI.
Package client maintains the NG Chat WebSocket session: mint → dial → authenticate → resolve channel → subscribe, plus the heartbeat the server requires and the reconnect/dedupe logic that makes the hourly JWT-expiry disconnect invisible to the UI.
complete
Package complete is the pure completion engine behind the composer's tab-triggered lists (mentions, commands, emotes, emoji).
Package complete is the pure completion engine behind the composer's tab-triggered lists (mentions, commands, emotes, emoji).
complete/gen command
Command gen writes internal/complete/emotes_gen.go from the upstream ngchat checkout, invoked by the //go:generate directive at the top of internal/complete/complete.go.
Command gen writes internal/complete/emotes_gen.go from the upstream ngchat checkout, invoked by the //go:generate directive at the top of internal/complete/complete.go.
protocol
Package protocol holds the NG Chat wire types.
Package protocol holds the NG Chat wire types.
protocol/gen command
Command gen writes internal/protocol/protocol_gen.go from the JSON Schema spec in the upstream ngchat checkout, invoked by the //go:generate directive in internal/protocol/doc.go (ADR 0010).
Command gen writes internal/protocol/protocol_gen.go from the JSON Schema spec in the upstream ngchat checkout, invoked by the //go:generate directive in internal/protocol/doc.go (ADR 0010).
render
Package render converts NG Chat's server-rendered message HTML into ANSI-styled terminal text.
Package render converts NG Chat's server-rendered message HTML into ANSI-styled terminal text.
run
Package run is the one "prepare a run" step shared by cmd/ngchat and cmd/smoke: the environment both read, the site client with its routing cookie, the credential the jar is seeded with, the chat-URL check, and the client.Config that follows.
Package run is the one "prepare a run" step shared by cmd/ngchat and cmd/smoke: the environment both read, the site client with its routing cookie, the credential the jar is seeded with, the chat-URL check, and the client.Config that follows.
splash
Package splash is the opening screen: a piece of pixel art and an Effect that draws it over a full-viewport Stage, the way Omarchy plays Terminal Text Effects over its logo.
Package splash is the opening screen: a piece of pixel art and an Effect that draws it over a full-viewport Stage, the way Omarchy plays Terminal Text Effects over its logo.
theme
Package theme is the color vocabulary the UI draws with.
Package theme is the color vocabulary the UI draws with.
transcript
Package transcript is the chat log: rows appended in order, drawn on demand, and a reader position that survives every redraw.
Package transcript is the chat log: rows appended in order, drawn on demand, and a reader position that survives every redraw.
ui
Package ui is the fullscreen Bubble Tea interface: the splash and the first run's login form, then the status bar, transcript and input line.
Package ui is the fullscreen Bubble Tea interface: the splash and the first run's login form, then the status bar, transcript and input line.
update
Package update tells the user when a newer ngchat release is out.
Package update tells the user when a newer ngchat release is out.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL