Work
CLI
snicol creates, updates, lists, and gets blog posts, notes, and journal entries on snicol.com.
The commands talk to this site's content. An API key from the CMS authorizes each call.
Install
From this repo:
pnpm install
node packages/content/src/bin.ts --helpThe bin name is snicol. Node 22.18 or later runs the TypeScript file directly. The examples on this page write snicol for node packages/content/src/bin.ts.
Set the environment
SNICOL_CONTENT_URL is the site origin, such as https://snicol.com. For a local content server, use http://127.0.0.1:3004.
SNICOL_CONTENT_TOKEN is an API key. The CMS shows it once, when an admin creates it. This is a placeholder, not a working key:
export SNICOL_CONTENT_URL=https://snicol.com
export SNICOL_CONTENT_TOKEN=sk_live_xxxIf either variable is missing, snicol names the missing variable and exits. It does not print the key.
Create and revoke API keys at /cms/collections/api-keys while signed in as an admin. Copy the key before you leave the page. The server stores a hash and a short prefix, not the key. The CMS shows a new API key once. A revoked API key receives 401 on every call.
Sign in as an admin and open the key. Choose Revoke, then save. You cannot undo a revoke.
--slug uses lowercase letters, numbers, and hyphens. list prints at most 100 results.
Blog posts
blog is a post. An API key with the blog scope can create, update, list, and get posts.
snicol blog create
Create a blog post.
Usage
snicol blog create --title <text> --slug <slug> --excerpt <text> --body <text>Flags
--title <text>Required for create.--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>Required for blog create.--body <text>Required for create.--help
--excerpt is required for a blog post. --body is the post text.
Example
snicol blog create --title "Queueing theory" --slug queueing-theory --excerpt "Why queues grow." --body "The first paragraph."snicol blog update
Update a blog post.
Usage
snicol blog update (--id <id> | --slug <slug>) [--title <text>] [--slug <slug>] [--excerpt <text>] [--body <text>]Flags
--title <text>--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>--body <text>--id <id>Numeric id, from list or get.--help
Pass --id or the current --slug, and at least one field to change. To change the slug, pass --id and the new --slug.
Example
snicol blog update --slug queueing-theory --title "Queueing"snicol blog list
List blog posts.
Usage
snicol blog listFlags
--help
list prints at most 100 results.
snicol blog get
Get a blog post.
Usage
snicol blog get (--id <id> | --slug <slug>)Flags
--id <id>Numeric id, from list or get.--slug <slug>Lowercase letters, numbers, and hyphens.--help
Example
snicol blog get --slug queueing-theoryNotes
note is a note. An API key with the note scope can create, update, list, and get notes.
snicol note create
Create a note.
Usage
snicol note create --title <text> --slug <slug> --body <text>Flags
--title <text>Required for create.--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>--body <text>Required for create.--help
--excerpt is optional. --body is the note text.
Example
snicol note create --title "Pins" --slug pins --body "A private note."snicol note update
Update a note.
Usage
snicol note update (--id <id> | --slug <slug>) [--title <text>] [--slug <slug>] [--excerpt <text>] [--body <text>]Flags
--title <text>--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>--body <text>--id <id>Numeric id, from list or get.--help
Pass --id or the current --slug, and at least one field to change. To change the slug, pass --id and the new --slug.
Example
snicol note update --slug pins --excerpt "Pins and tags."snicol note list
List notes.
Usage
snicol note listFlags
--help
list prints at most 100 results.
snicol note get
Get a note.
Usage
snicol note get (--id <id> | --slug <slug>)Flags
--id <id>Numeric id, from list or get.--slug <slug>Lowercase letters, numbers, and hyphens.--help
Example
snicol note get --slug pinsJournal entries
journal is a journal entry. An API key with the journal scope can create a journal entry. API keys cannot list, get, or update journal entries. The server returns 403.
snicol journal create
Create a journal entry.
Usage
snicol journal create --title <text> --slug <slug> --body <text>Flags
--title <text>Required for create.--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>--body <text>Required for create.--help
--excerpt is optional. --body is the entry text.
Example
snicol journal create --title "Tuesday" --slug tuesday --body "A private entry."snicol journal update
Update a journal entry.
Usage
snicol journal update (--id <id> | --slug <slug>) [--title <text>] [--slug <slug>] [--excerpt <text>] [--body <text>]Flags
--title <text>--slug <slug>Lowercase letters, numbers, and hyphens.--excerpt <text>--body <text>--id <id>Numeric id, from list or get.--help
API keys cannot run this command on journal entries. The server returns 403.
snicol journal list
List journal entries.
Usage
snicol journal listFlags
--help
API keys cannot run this command on journal entries. The server returns 403.
snicol journal get
Get a journal entry.
Usage
snicol journal get (--id <id> | --slug <slug>)Flags
--id <id>Numeric id, from list or get.--slug <slug>Lowercase letters, numbers, and hyphens.--help
API keys cannot run this command on journal entries. The server returns 403.