@abeedoo/gho
v1.0.2
Published
Minimal CLI for managing Ghost CMS posts, pages, and tags
Readme
@abeedoo/gho
Minimal CLI for managing Ghost CMS posts, pages, and tags. Zero dependencies.
Install
npm install -g @abeedoo/ghoOr use with npx:
npx @abeedoo/gho list postsSetup
Get your Admin API key from Ghost Admin → Settings → Integrations → Add custom integration.
Configure credentials using any of these methods (checked in priority order):
1. Environment variables
export GHOST_URL=https://your-ghost-site.com
export GHOST_ADMIN_API_KEY=your-id:your-secret2. --env flag
gho --env /path/to/config list posts3. .gho file (recommended)
Create a .gho file in your project root:
GHOST_URL=https://your-ghost-site.com
GHOST_ADMIN_API_KEY=your-id:your-secretAdd .gho to your .gitignore — it contains secrets.
4. .env file
Falls back to .env if no .gho file is found:
GHOST_URL=https://your-ghost-site.com
GHOST_ADMIN_API_KEY=your-id:your-secretMulti-site config
Your .gho file can contain multiple sites using [section] headers:
# Default site (used when no --site flag)
GHOST_URL=https://myblog.com
GHOST_ADMIN_API_KEY=id:secret
[staging]
GHOST_URL=https://staging.myblog.com
GHOST_ADMIN_API_KEY=id:secret
[client-blog]
GHOST_URL=https://client.example.com
GHOST_ADMIN_API_KEY=id:secretUse with the --site flag:
gho --site staging list posts
gho --site client-blog publish my-post
gho list posts # uses defaultCommands
List content
gho list posts # all posts
gho list posts --status draft # drafts only
gho list posts --status published # published only
gho list pages # all pagesCreate a draft
gho draft my-post-slug "My Post Title" content.mdCreates a draft post from a markdown file. If the file starts with # Title, the first line is stripped (the title comes from the argument). If a post with that slug already exists, it's replaced.
Publish / Unpublish
gho publish my-post-slug
gho unpublish my-post-slugGet post details
gho get my-post-slugShows title, status, URL, preview link, tags, and excerpt.
Update content
gho update my-post-slug updated-content.mdReplaces the post content from a markdown file. Preserves title, tags, and status.
Delete
gho delete my-post-slugList tags
gho tagsShows all tags with post counts, sorted by usage.
How It Works
Uses Ghost's Admin API with JWT authentication. The CLI constructs JWTs from your Admin API key using Node's built-in crypto module — no external dependencies.
Posts are created using Ghost's mobiledoc format with a markdown card, which means your markdown is rendered by Ghost's markdown engine (including code blocks, links, images, etc.).
License
MIT — Clifford Meece
