nerdgram1337
v2.7.0
Published
Command-line client for a local NerdGram1337 server
Maintainers
Readme
nerdgram1337
nerdgram is the command-line client for NerdGram1337, a local app for Mermaid diagrams. The npm package name is nerdgram1337. The command it installs is nerdgram.
List, search, and edit diagrams on a NerdGram server that is already running. lint and render of a .mmd file that is already on disk do not need the server. convert of a saved export does not need the server.
Install
Node.js 20 or newer, and npm 10 or newer.
npm install -g nerdgram1337npx nerdgram1337 --helpnpm install -g puts nerdgram on your PATH. npx runs that command without a global install. The package is public.
The install also downloads Mermaid and Puppeteer's chrome-headless-shell. Offline lint uses Mermaid's parser. Offline render uses that shell, which is the large part of the download. Commands that only call the API do not launch it.
Use
When NERDGRAM_URL is unset, the URL is http://127.0.0.1 and the PORT environment variable, or 8787 when PORT is unset. --url overrides that. NERDGRAM_TOKEN is an automation token from Settings, or from nerdgram token create on that machine. --token overrides it. --json prints one JSON object. The process exits 1 when the command fails.
export NERDGRAM_URL=http://127.0.0.1:8787
export NERDGRAM_TOKEN=ng_your_token
nerdgram --help
nerdgram list
nerdgram mcp
nerdgram search Atlanta
nerdgram get Welcome.mmd -o Welcome.mmd
nerdgram put Notes.mmd ./Notes.mmd
nerdgram lint Welcome.mmd
nerdgram convert netbox export.json -o campus.network.json
nerdgram diff Welcome.mmd --from current --to current --format md
nerdgram baseline Welcome.mmd --name "Baseline"
nerdgram replace CORE-SW1 ATL-CORE-01 --dry-run
nerdgram replace CORE-SW1 ATL-CORE-01 --yes
nerdgram render Welcome.mmd -o Welcome.svg
nerdgram token create --name ci --scope read-write
nerdgram token list
nerdgram token revoke <id>
nerdgram sync status
nerdgram sync login --client-id Iv1.yourClientId
nerdgram sync connect --name nerdgram-diagrams
nerdgram sync disconnectnerdgram token and nerdgram sync do not use NERDGRAM_TOKEN. token create prints the token once. token list prints the id, the scope, the state, the token prefix, and the name. sync login prints the GitHub device code and waits. sync connect creates the repository. The default is private. --public makes the repository public. --confirm-non-empty is required when that repository already has commits. sync login and sync disconnect have to reach this machine. In Docker, run those with docker exec nerdgram1337.
render of a local .mmd file does not need a server. --server sends it to the API instead. lint of a local file does not need a server either. lint exits 1 when a diagnostic is an error.
The app still has to be reachable for every other command. NerdGram is a single-user app. The API is a tool port for programs you trust, not an always-on multi-user server. The browser routes have no token, so anyone who can reach the port can use them. The default URL is loopback. Point NERDGRAM_URL at another machine only when that machine has opened its Host setting to you.
The full command list is in the command-line tool page. Release notes are in the changelog.
License
MIT © Ryan Thomas Huff
