snipforge
v0.2.0
Published
Save and retrieve code snippets from the terminal
Maintainers
Readme
SnipForge CLI
Save and retrieve code snippets from your terminal. Everything is stored locally — no account, no internet required.
Installation
npm install -g snipforge
# or with any other package manager
pnpm add -g snipforge
yarn global add snipforge
bun add -g snipforgeVerify it works:
snipforge --versionRequirements: Node.js 18+ (no Bun required).
Commands
snipforge add — Save a snippet
From a file:
snipforge add src/hooks/useDebounce.tsReads the file, auto-detects the language from the file extension, then asks for a title and optional tags.
From stdin (pipe):
cat src/utils/format.ts | snipforge add --title "Format currency"
pbpaste | snipforge add --title "CSS grid trick" --tags "css,layout"--title is required when piping. --tags is optional (comma-separated).
Interactive paste:
snipforge addAsks for title and tags first, then prompts you to paste code. Press Ctrl+D when done.
snipforge list — Browse your snippets
snipforge listSLUG TITLE LANG TAGS
use-debounce-a3f2 useDebounce hook typescript react, hooks
format-currency-9k1 Format currency typescript utils
css-grid-trick-b4e8 CSS grid trick css css, layoutsnipforge get <slug> — Retrieve a snippet
snipforge get use-debounce-a3f2Prints the code to stdout. Pipe it anywhere:
snipforge get use-debounce-a3f2 | pbcopy # copy to clipboard (macOS)
snipforge get use-debounce-a3f2 | xclip -selection clipboard # copy to clipboard (Linux)
snipforge get use-debounce-a3f2 > src/hooks/useDebounce.ts # write to a fileStorage
Snippets are saved to ~/.snipforge/snippets.db — a plain SQLite file on your machine. Nothing leaves your computer.
The VS Code extension uses the same file, so snippets saved from either tool are immediately visible in the other. No sync step needed.
Development
If you want to contribute or run from source:
git clone https://github.com/swayamyadav05/snipforge
cd SnipForge
bun install # Bun is only needed for the dev environment
node apps/cli/build.mjs # build
node apps/cli/dist/snipforge.js --help # run without installing