Skip to content

abeedoolabs/gho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

@abeedoo/gho

Minimal CLI for managing Ghost CMS posts, pages, and tags. Zero dependencies.

npm · GitHub

Install

npm install -g @abeedoo/gho

Or use with npx:

npx @abeedoo/gho list posts

Setup

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-secret

2. --env flag

gho --env /path/to/config list posts

3. .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-secret

Add .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-secret

Multi-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:secret

Use with the --site flag:

gho --site staging list posts
gho --site client-blog publish my-post
gho list posts                          # uses default

Commands

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 pages

Create a draft

gho draft my-post-slug "My Post Title" content.md

Creates 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-slug

Get post details

gho get my-post-slug

Shows title, status, URL, preview link, tags, and excerpt.

Update content

gho update my-post-slug updated-content.md

Replaces the post content from a markdown file. Preserves title, tags, and status.

Delete

gho delete my-post-slug

List tags

gho tags

Shows 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors