snip is a local command-line tool for saving, searching, and reusing code snippets. Everything stays on your machine: snippets are stored in a SQLite database under your home directory, so you can build a personal library of patterns, commands, and boilerplate without a cloud service.
Typical workflow:
- Add snippets with a title, optional language label, and tags; paste code from the terminal or pass it with
-c. - List and search by keywords across titles, code, and tags.
- Get a snippet by numeric ID to print it with syntax highlighting.
| Command | Purpose |
|---|---|
snip add |
Save a snippet (-t title, optional -c code, --lang, --tags) |
snip list / snip ls |
Show all snippets, newest first |
snip search / snip s |
Search by keyword |
snip get <id> |
Show a snippet; copy to clipboard unless --no-copy |
snip health |
Quick sanity check that the CLI runs |
The CLI is implemented in TypeScript and runs on Node.js when you develop from source; release binaries are standalone executables.
Extended guides live under docs/:
When a release tag is pushed (for example v0.1.0), Release Binaries builds standalone executables and uploads them to the GitHub Releases page. The tag must match the version in package.json: the workflow checks that v plus package.json’s version equals the pushed tag (e.g. version 0.1.0 with tag v0.1.0).
Download the file for your OS, make it executable on macOS and Linux, put it on your PATH, and run it. The published filenames are:
| Platform | Asset |
|---|---|
| macOS (Apple Silicon, arm64) | snip-macos-arm64 |
| Linux (x64) | snip-linux-x64 |
| Windows (x64) | snip-windows-x64.exe |
You do not need Node.js installed to use these builds.
- Open the latest release and download snip-macos-arm64.
- In Terminal, allow execution and install on your PATH (example uses
/usr/local/binand the command namesnip):
chmod +x snip-macos-arm64
xattr -d com.apple.quarantine ./snip-macos-arm64
sudo mv snip-macos-arm64 /usr/local/bin/snip- Confirm:
snip --version
snip health- Download snip-linux-x64 from the latest release.
- Install to a directory on your
PATH:
chmod +x snip-linux-x64
mv snip-linux-x64 ~/.local/bin/snipEnsure ~/.local/bin is on your PATH, then run snip --version and snip health.
- Download snip-windows-x64.exe from the latest release.
- Optionally rename it to
snip.exe. - Place the file in a folder that is on your user or system PATH, or run it by full path. Open a new terminal and run
snip --versionandsnip health.
- Node.js 20 or newer
- npm (comes with Node.js)
git clone <your-repo-url>
cd snip
npm install
npm run build
npm linkAfter npm link, the snip command is globally available in your shell.
snip --help
snip --version
snip healthExpected output for health:
snip is workingOn first run, any snip command creates a local SQLite database at
~/.snip/snippets.db and automatically creates the ~/.snip directory when
it does not exist.
If startup reports that the database is corrupt, delete
~/.snip/snippets.db and run the command again to recreate it.
- Make changes in
src/ - Rebuild with
npm run build - Re-run commands (for example
snip health)
Run ESLint:
npm run lintCheck formatting with Prettier:
npm run format:checkRewrite files in place with Prettier:
npm run formatUse release.sh to bump package.json, tag, and push so Release Binaries can build and publish the prebuilt binaries. The release workflow expects the Git tag to match v plus the version field in package.json; the script keeps those in sync.
- You are on
mainwith the changes you want in the release already merged (the script refuses other branches). - Your branch is up to date with
origin/main(pull before running if needed). - You have permission to push to
mainand to create tags on the remote.
-
Choose a SemVer version (for example
1.2.3). -
From the repo root, run:
./release.sh 1.2.3You can pass the version with or without a leading v (./release.sh v1.2.3 is the same).
If the script is not executable yet: chmod +x release.sh, or run bash release.sh 1.2.3.
- Runs
npm version <version> --no-git-tag-versionsopackage.jsonmatches the new version. - Commits that change with message
chore: bump version to vX.Y.Z. - Creates a Git tag
vX.Y.Zon that commit. - Pushes
maintoorigin, then pushes the tag.
After the tag push, GitHub Actions builds the platform binaries and attaches them to the GitHub Release. Watch progress under the repository’s Actions tab (the script prints a link derived from your origin remote).
npm unlink -g snipReleased under the MIT License.