ngchat-cli

module
v1.0.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 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.

It joins #general, renders the server's formatted messages as ANSI, shows who is around, pings you on mentions and DMs, tab-completes names, commands, emotes and emoji, and renews its chat token in place every hour, so an evening's session never drops. Emote sprites (Kitty graphics) and channel switching are on the roadmap; CHANGELOG.md has what each release added.

Install

Grab a binary from Releases, or:

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

Until v1.0.0 is tagged, @latest resolves to the old v0.1.0 scaffold rather than the current release candidate, so name the version.

Each release ships a checksums.txt next to the archives. It catches a corrupt download, not a swapped one: it is published from the same release as the archives and is not signed. Builds are reproducible (-trimpath, fixed timestamps), so the way to verify an archive is to build the tagged commit yourself and compare.

The Linux and macOS tests gate every release. Windows builds are best-effort: they are published and CI runs the tests there, but nobody exercises the TUI on Windows regularly, so use Windows Terminal and report what breaks.

Use

ngchat            # join #general
ngchat -quiet     # same, without the terminal bell on mentions and DMs
ngchat -debug     # also write redacted frames to a log; path printed on exit
ngchat -no-splash # skip the opening animation (NGCHAT_NO_SPLASH=1 does the same)
ngchat -version   # print the version and exit

The first run asks for your username or email, password, and a two-factor code if your account uses one (a TOTP recovery code works at the same prompt). If your account is set to log in with email only, enter your email address at the first prompt. Mistyped it? Press Enter with no password to go back.

ngchat login repeats that on demand. ngchat logout logs this device out on the site, so the stored cookie stops working everywhere, then clears it locally; if the site cannot be reached it says so and exits non-zero, because the cookie is still valid there.

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

What is stored, and where

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 prints 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 you alone log into; on a shared desktop, set up a keyring and run ngchat login again to move it.

A login is stored per site: pointing NGCHAT_SITE_URL at a dev stack asks for a login there and never sends the production cookie to it. Both NGCHAT_SITE_URL and NGCHAT_WS_URL must be https/wss unless the host is loopback, and the chat host must be on the site's domain.

In the terminal

  • Keys. ctrl+s reveals spoilers, ctrl+t toggles timestamps, pgup/pgdn scrolls, end jumps back to the newest message, ctrl+c quits. Scrolled up while chat carries on? The help row turns into a "more messages below" banner; typing or sending follows again.
  • Tab completion. @ opens a list of who is in the room (tab/shift+tab or the up/down arrows move, enter accepts, esc closes; a window under about 9 rows previews the candidate in the line instead). / as the first character completes the slash commands your rank may use (aliases match, the full name is inserted). A word starting ng…/tf… completes NG "dank meme" emote shortcodes from an embedded list, and :shortname completes emoji from an embedded catalog, each row showing the glyph next to its shortname.
  • Slash commands. /who lists who is in the channel (mods marked @, away users dimmed). Everything else (/me, /slap, /dm, /roll, ...) goes to the server, which parses it.
  • Mentions and DMs are highlighted and ring the terminal bell; -quiet keeps the highlight and drops the bell.
  • Links are clickable in terminals that speak OSC 8 hyperlinks (kitty, foot, WezTerm, Ghostty, iTerm2, Windows Terminal, GNOME Terminal).
  • Emotes render as :shortcode: for now; the site's classes point at CSS sprites, and sprites over the Kitty graphics protocol are on the roadmap.
  • Colors follow the site's ngchat theme (orange status bar, soft gold names, copper mods, your own name in blue). NGCHAT_THEME=classic is the legacy gold-on-black. The terminal's own background is kept, so a light background will look off. NO_COLOR is honored.
  • The opening animation ends on any key; -no-splash or NGCHAT_NO_SPLASH=1 drops it, and a window under about 40×8 never shows it.

Development

Build and test against production, the default endpoints: there is no public dev stack. Remember that a test run is a real session on the real site. The site's chat-token limiter counts against your account before it checks anything else, 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. NGCHAT_SITE_URL, NGCHAT_WS_URL and NGCHAT_ROUTING_COOKIE exist so Newgrounds staff can point a build at an internal stack; they do nothing useful outside the company.

NGCHAT_NG_COOKIE (a raw cookie header) bypasses the stored login. go run ./cmd/smoke runs the whole stack headlessly (mint, connect, authenticate, subscribe, send) and prints event summaries, never tokens; it is the right tool for protocol or auth changes, since the TUI takes over the screen. docs/smoke.md has the details.

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. Security reports: see SECURITY.md.

License

MIT

Directories

Path Synopsis
cmd
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.
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 hand-ports the NG Chat wire types from the server's Zod schemas (ngchat repo, src/shared/protocol).
Package protocol hand-ports the NG Chat wire types from the server's Zod schemas (ngchat repo, src/shared/protocol).
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.
splash
Package splash is the opening screen: a piece of pixel art and an Effect that draws it in over time, the way Omarchy plays one Terminal Text Effects run over its logo.
Package splash is the opening screen: a piece of pixel art and an Effect that draws it in over time, the way Omarchy plays one Terminal Text Effects run over its logo.
theme
Package theme is the color vocabulary the UI draws with.
Package theme is the color vocabulary the UI draws with.
ui
Package ui is the fullscreen Bubble Tea interface: status bar, message viewport, input line.
Package ui is the fullscreen Bubble Tea interface: status bar, message viewport, input line.

Jump to

Keyboard shortcuts

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