@snipplle/cli
v1.0.0
Published
A CLI to manage Snipplle snippets
Maintainers
Readme
@snipplle/cli
Command-line tool to manage Snipplle snippets: authenticate, initialize projects, pull snippets and collections, and inspect versions — all from your terminal.
Highlights
- Simple login with an API token and optional custom API URL.
- Project initialization with interactive prompts and multi-workspace support.
- Pull single snippets or entire collections to your project source directory.
- Inspect available versions for a snippet.
- Works with Node.js
>= 18and uses familiar oclif ergonomics.
Quick Start
Install globally:
npm install -g @snipplle/cli # or: pnpm add -g @snipplle/cli # or: yarn global add @snipplle/cliLogin using your Snipplle API token:
snipplle login <TOKEN> # optionally specify API URL (defaults to https://snipplle.com/api/cli) snipplle login <TOKEN> -u https://snipplle.com/api/cliInitialize the current project (creates
snipplle.config.json):snipplle init # You'll be asked for snippet source path (e.g. ./src/utils) and workspace slug. # You can also add additional workspace slugs.Pull content:
# Pull a collection snipplle pull -c <workspace_slug>/<collection_slug> # Pull a specific snippet by version tag snipplle pull -s <workspace_slug>/<snippet_slug>@<version_tag>View snippet versions:
snipplle version -s <workspace_slug>/<snippet_slug>
Configuration
There are two configuration files used by the CLI:
Global config at
~/.config/snipplle/config.json(created onlogin):apiUrl: Base API URL, defaults tohttps://snipplle.com/api/cli.token: Your API token.userId: Your Snipplle user ID.
Project config at
./snipplle.config.json(created oninit):src: Relative path where pulled files are saved (e.g../src/utils).workspace.main:{ id, slug }for the main workspace.workspace.additional: Array of{ id, slug }for added workspaces.
Notes:
- If
snipplle.config.jsonalready exists,initwill ask to overwrite. - On
pull, the CLI will create yoursrcdirectory if it doesn’t exist. - Filenames are derived from the snippet or collection path; the file extension is taken from the remote artifact URL.
Usage
$ npm install -g @snipplle/cli
$ snipplle COMMAND
running command...
$ snipplle (--version)
@snipplle/cli/1.0.0 darwin-arm64 node-v22.14.0
$ snipplle --help [COMMAND]
USAGE
$ snipplle COMMAND
...Commands
snipplle help [COMMAND]
Display help for snipplle.
USAGE
$ snipplle help [COMMAND...] [-n]
ARGUMENTS
[COMMAND...] Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for snipplle.See code: @oclif/plugin-help
snipplle init
Initialize Snipplle in the current project
USAGE
$ snipplle init
DESCRIPTION
Initialize Snipplle in the current projectSee code: src/commands/init/index.ts
snipplle login TOKEN
Login to Snipplle
USAGE
$ snipplle login TOKEN [-u <value>]
ARGUMENTS
TOKEN API token
FLAGS
-u, --url=<value> [default: https://studio.snipplle.com/api/cli] API URL
DESCRIPTION
Login to SnipplleSee code: src/commands/login/index.ts
snipplle pull
Pull a snippet or a collection from Snipplle
USAGE
$ snipplle pull [-c <value>] [-s <value>]
FLAGS
-c, --collection=<value> The collection to pull
-s, --snippet=<value> The snippet to pull
DESCRIPTION
Pull a snippet or a collection from Snipplle
EXAMPLES
$ snipplle pull -c workspace_slug/collection_slug
$ snipplle pull -s workspace_slug/snippet_slug@version_tagSee code: src/commands/pull/index.ts
snipplle version
Get the version of Snipplle
USAGE
$ snipplle version [-s <value>]
FLAGS
-s, --snippet=<value> Get the versions of the snippet
DESCRIPTION
Get the version of SnipplleSee code: src/commands/version/index.ts
Troubleshooting
You must specify a snippet or a collection: Provide-sor-cflag topull.You don't have a project config: Runsnipplle initin your project first.Snippet or collection file not found: Check slugs and version tag correctness.- API errors show
statusMessage: Ensure your token is valid and you’re logged in.
Contributing
- Issues: https://github.com/snipplle/snipplle-cli/issues
- Requirements: Node.js
>= 18. - Scripts:
pnpm run build— build TypeScript todist.pnpm test— run test suite.pnpm lint— run ESLint.
Workflow:
- Fork the repo, create a feature branch, add tests if applicable, and open a PR.
License
MIT © Snipplle
Links
- Homepage: https://github.com/snipplle/snipplle-cli
- NPM: https://www.npmjs.com/package/@snipplle/cli
