CLI reference
Complete reference for all mog CLI commands, flags, and exit codes.
The mog CLI is available as an npm package. All commands support --json for machine-readable output, making the CLI suitable for use inside agent runners and CI pipelines.
npm install -g mogmd
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (printed to stderr) |
2 | Approval required — an approvalUrl is included in the JSON output |
JSON output
Add --json to any command to get structured output. All JSON responses share this envelope:
// Success
{ "ok": true, "command": "install", "data": { ... } }
// Error
{ "ok": false, "command": "install", "error": "Package not found" }
// Approval required (exit code 2)
{ "ok": false, "command": "buy", "error": "Approval required", "approvalUrl": "https://mog.md/..." }
The data field shape varies per command — see each command below for its specific output shape.
Global options
| Flag | Description |
|---|---|
--version | Print CLI version and exit |
--help | Print help for a command |
mog init
Initialize a mog project in the current directory. Creates a lockfile and prints target-specific setup guidance.
mog init [options]
| Flag | Description | Default |
|---|---|---|
--dir <path> | Project directory | current directory |
--json | Output as JSON | — |
What init does
- Creates an empty
mog.lock.jsonif one doesn't exist - Adds a note to
.gitignore(if inside a git repo) - Auto-detects the target (Cursor, Claude Code, etc.) from the project directory
- Prints getting-started guidance for that target
JSON output (--json)
{
"ok": true,
"command": "init",
"data": {
"target": "cursor",
"lockfile": "/my-project/mog.lock.json",
"created": ["mog.lock.json"]
}
}
mog setup
One-shot onboarding: authenticate (device code by default, or optional web --token, or existing MOG_TOKEN / saved credentials), optionally install mogmd globally when you ran via npx, then run the same project initialization as mog init.
mog setup [options]
mog setup --token "mog_setup_…" # optional shortcut from mog.md Install CLI
| Flag | Description | Default |
|---|---|---|
--token <token> | One-time token from the Install CLI dialog (skips device login) | — |
--dir <path> | Project directory | current directory |
--no-global | Skip global install when using npx | — |
--json | Output as JSON (non-interactive: requires MOG_TOKEN or valid saved session) | — |
Examples
npx mogmd@latest setup
npx mogmd@latest setup --token "mog_setup_…"
MOG_TOKEN=… npx mogmd@latest setup --json
mog setup --token "mog_setup_…" --no-global
mog auth
Authenticate with the mog marketplace using the device code flow (RFC 8628).
mog auth [options]
| Flag | Description |
|---|---|
--logout | Log out and remove stored credentials |
--status | Show current auth status without triggering login |
--force | Re-authenticate even if already signed in |
--json | Output as JSON |
How it works
Running mog auth starts the device flow: it requests a short code from the API, prints a URL and code, and polls until you approve in a browser. Once approved, the token is stored locally. This flow works in fully headless environments — no browser is needed on the CLI host.
Examples
# Start authentication
mog auth
# Check if authenticated
mog auth --status
# Log out
mog auth --logout
Credential storage
- macOS / Linux:
~/.config/mog/credentials.json - Windows:
%USERPROFILE%\.config\mog\credentials.json
JSON output (--json)
{ "ok": true, "command": "auth", "data": { "authenticated": true } }
{ "ok": true, "command": "auth", "data": { "loggedOut": true } }
{ "ok": true, "command": "auth", "data": { "authenticated": false } }
mog search
Search the mog marketplace for packages.
mog search [query] [options]
| Flag | Description | Default |
|---|---|---|
[query] | Full-text search query (optional) | — |
--type <type> | Filter by type: skill, rule, bundle, template, mcp | — |
--target <target> | Filter by agent target: cursor, claude-code, codex, gemini-cli, windsurf, generic | — |
--sort <sort> | Sort order: popular, recent, rated, price_asc, price_desc | popular |
--free | Show only free packages | — |
--page <n> | Page number | 1 |
--json | Output as JSON | — |
Examples
# Free-text search
mog search "react testing"
# Only skills for Cursor
mog search --target cursor --type skill
# Free packages sorted by newest
mog search --free --sort recent
# JSON output for scripting
mog search "testing" --json
JSON output (--json)
{
"ok": true,
"command": "search",
"data": {
"results": [
{
"id": "uuid",
"vendorSlug": "acme",
"slug": "react-testing-skill",
"title": "React Testing Skill",
"description": "...",
"type": "skill",
"targets": ["cursor", "claude-code"],
"priceCents": 0,
"currency": "usd",
"latestVersion": "1.2.0",
"installCount": 124,
"rating": "4.8",
"ratingCount": 12,
"vendorName": "Acme Corp",
"vendorVerified": true
}
],
"total": 1,
"page": 1,
"perPage": 20
}
}
mog buy
Purchase a package without installing it.
mog buy <vendor/package> [options]
Requires authentication.
| Flag | Description |
|---|---|
<vendor/package> | Package identifier, e.g. acme/router-eval |
--max-price <cents> | Maximum price in cents. If the package costs more, the purchase is blocked. |
--auto | Allow automatic purchase within policy limits |
--json | Output as JSON |
Approval required (exit code 2)
If the package price exceeds your spend policy or the --max-price ceiling, the command exits with code 2:
{ "ok": false, "command": "buy", "error": "Approval required", "approvalUrl": "https://mog.md/purchases/approve?listing=..." }
JSON output (--json)
// Successful purchase
{
"ok": true,
"command": "buy",
"data": {
"status": "purchased",
"entitlementId": "uuid",
"orderId": "uuid",
"amountCents": 500
}
}
// Already owned
{ "ok": true, "command": "buy", "data": { "status": "already_owned", "entitlementId": "uuid" } }
mog install
Download, verify, and install a package. Optionally purchase it in the same step with --auto-buy.
mog install <vendor/package> [options]
Requires authentication.
| Flag | Description | Default |
|---|---|---|
<vendor/package> | Package identifier, e.g. acme/router-eval | — |
--target <target> | Installation target: cursor, claude-code, codex, gemini-cli, windsurf, generic. Auto-detected if not specified. | auto |
--auto-buy | Automatically purchase the package if not already owned | — |
--max-price <cents> | Maximum price in cents when using --auto-buy | — |
--preflight | Show what would happen without making any changes | — |
--dir <path> | Installation directory | current directory |
--env <KEY=VALUE> | Set an environment variable for MCP packages (repeatable) | — |
--wire | Auto-create an editor rule pointing to the installed skill | — |
--require-signatures | Fail if the package signature is missing or invalid | — |
--json | Output as JSON | — |
Target auto-detection
If --target is not specified, the CLI detects the environment by checking for marker directories in the current working directory (checked in this order):
.cursor/→ target:cursor.claude/→ target:claude-code.windsurf/→ target:windsurf.gemini/→ target:gemini-cli.codex/→ target:codex.openclaw/→ target:openclaw- (none) → target:
generic
Default install paths
| Target | Default install path |
|---|---|
cursor | .cursor/skills/{slug}/ |
claude-code | .claude/skills/{slug}/ |
codex | mog_modules/{slug}/ |
gemini-cli | .gemini/skills/{slug}/ |
windsurf | .windsurf/skills/{slug}/ |
openclaw | skills/{slug}/ |
generic | mog_modules/{slug}/ |
Package authors can override these defaults in their mog.yaml install_map field.
Wiring skills into your editor (--wire)
After installing a skill package, your AI assistant still needs a pointer to the skill file. The --wire flag creates that pointer automatically:
# Cursor: creates .cursor/rules/{slug}.mdc pointing to the SKILL.md
mog install acme/react-testing-skill --target cursor --wire
# Claude Code: appends a reference to AGENTS.md
mog install acme/react-testing-skill --target claude-code --wire
Without --wire, the CLI prints a "Next steps" block showing the exact file contents to create manually.
MCP server packages
For packages with type: mcp, mog install writes the server configuration to the client's mcpServers config file instead of extracting files. Use --env KEY=VALUE to supply required environment variables non-interactively:
mog install acme/github-mcp-server \
--env GITHUB_TOKEN=ghp_xxx \
--target cursor
# Multiple env vars
mog install acme/slack-mcp \
--env SLACK_TOKEN=xoxb-xxx \
--env SLACK_TEAM_ID=T0123 \
--auto-buy
After installing an MCP package, restart your IDE for the server to be discovered.
What install does
- Fetches the listing and resolves the latest published release
- Checks your entitlement; purchases if
--auto-buyis set - Requests a signed download URL (expires in 5 minutes)
- Downloads the
.ziparchive and verifies the SHA-256 hash - Extracts files to the install path (path traversal protected)
- Writes the entry to
mog.lock.jsonatomically
JSON output (--json)
{
"ok": true,
"command": "install",
"data": {
"package": "acme/router-eval",
"version": "1.0.0",
"target": "cursor",
"installPath": "/my-project/.cursor/skills/router-eval/",
"files": 3
}
}
mog ls
List all packages installed in the current project (reads from mog.lock.json).
mog ls [options]
| Flag | Description | Default |
|---|---|---|
--dir <path> | Project directory to read lockfile from | current directory |
--check-updates | Check for available updates (requires network) | — |
--json | Output as JSON | — |
JSON output (--json)
{
"ok": true,
"command": "ls",
"data": {
"count": 2,
"packages": [
{
"name": "acme/router-eval",
"vendor": "acme",
"slug": "router-eval",
"version": "1.0.0",
"target": "cursor",
"installPath": "/my-project/.cursor/skills/router-eval/",
"installedAt": "2026-01-15T10:00:00.000Z",
"updateChannel": "minor"
}
]
}
}
mog update
Update installed packages to the latest compatible version. Respects the updateChannel field in the lockfile (default: minor — blocks major version bumps).
mog update [vendor/package] [options]
Requires authentication.
| Flag | Description | Default |
|---|---|---|
[vendor/package] | Specific package to update. If omitted, updates all packages. | — |
--dry-run | Show available updates without installing anything | — |
--channel <patch|minor|major> | Override the update channel for this run | lockfile value |
--major | Allow major version upgrades (shorthand for --channel major) | — |
--dir <path> | Project directory | current directory |
--json | Output as JSON | — |
Update channels
| Channel | Allowed updates |
|---|---|
patch | Patch versions only (e.g. 1.0.0 → 1.0.1) |
minor | Patch and minor versions (e.g. 1.0.0 → 1.2.0) — default |
major | All versions including major bumps |
JSON output (--json)
{
"ok": true,
"command": "update",
"data": {
"updated": [{ "name": "acme/router-eval", "from": "1.0.0", "to": "1.1.0" }],
"skipped": [{ "name": "acme/big-upgrade", "version": "2.0.0", "reason": "Major upgrade requires explicit opt-in." }]
}
}
mog uninstall
Remove an installed package and update the lockfile.
mog uninstall <vendor/package> [options]
| Flag | Description | Default |
|---|---|---|
<vendor/package> | Package identifier, e.g. acme/router-eval | — |
--dir <path> | Project directory | current directory |
--json | Output as JSON | — |
Removes the install directory from disk and deletes the entry from mog.lock.json. Does not revoke your entitlement — you can reinstall at any time.
JSON output (--json)
{
"ok": true,
"command": "uninstall",
"data": {
"package": "acme/router-eval",
"removedPath": "/my-project/.cursor/skills/router-eval/"
}
}
mog publish
Build, upload, scan, and publish a package from a local directory.
mog publish [options]
Requires authentication with sell scope (vendor account required).
| Flag | Description | Default |
|---|---|---|
--dir <path> | Package directory to publish | current directory |
--price <dollars> | Price in USD (e.g. 4.99). Only applied on the first upload of this package. | — |
--yes | Skip confirmation prompt | — |
--json | Output as JSON | — |
What publish does
- Reads and validates
mog.yamlin the package directory - Zips the directory (excluding
.git,node_modules,.DS_Store) - Prompts for confirmation (unless
--yes) - Uploads the archive to the API
- Polls the scan pipeline until the scan completes (max 2 minutes)
- Automatically publishes the release if the scan passes
Examples
# Publish from the current directory
mog publish
# Publish a package directory at a specific price
mog publish --dir ./my-skill --price 4.99
# Skip prompts (for CI pipelines)
mog publish --yes --json
JSON output (--json)
{
"ok": true,
"command": "publish",
"data": {
"name": "acme/my-skill",
"version": "1.0.0",
"releaseId": "uuid",
"listingId": "uuid"
}
}
mog outdated
Show available updates without installing anything. Alias for mog update --dry-run.
mog outdated [vendor/package] [options]
| Flag | Description | Default |
|---|---|---|
[vendor/package] | Specific package to check. If omitted, checks all. | — |
--channel <patch|minor|major> | Override update channel for this check | lockfile value |
--major | Include major version upgrades in check | — |
--dir <path> | Project directory | current directory |
--json | Output as JSON | — |
JSON output (--json)
{
"ok": true,
"command": "update",
"data": {
"updated": [{ "name": "acme/router-eval", "from": "1.0.0", "to": "1.1.0" }],
"skipped": [{ "name": "acme/big-upgrade", "version": "2.0.0", "reason": "Major upgrade requires explicit opt-in." }],
"failed": []
}
}
mog doctor
Check project health: installed packages, editor wiring, and configuration.
mog doctor [options]
| Flag | Description | Default |
|---|---|---|
--dir <path> | Project directory | current directory |
--json | Output as JSON | — |
What doctor checks
- Auth — whether you're authenticated
- Lockfile — whether
mog.lock.jsonexists - Target detection — which editor/tool was detected and why
- Installed packages — lists all packages with their paths and types
- Missing files — flags packages whose install path no longer exists
- Wiring — for Cursor, checks that each installed skill has a matching
.cursor/rules/{slug}.mdc; for Claude Code, checks thatAGENTS.mdexists; for OpenClaw, checks thatSKILL.mdexists under each openclaw install path
Exits with code 1 if any issues are found.
Example output
mog doctor
Auth: ✓ authenticated
Lockfile: ✓ mog.lock.json
Target: cursor (.cursor/ directory found)
Packages: 2
Installed packages
acme/react-testing-skill@1.2.0 cursor
→ .cursor/skills/react-testing-skill/
1 issue found:
⚠ react-testing-skill — no .cursor/rules/react-testing-skill.mdc found. Run: mog install acme/react-testing-skill --wire
JSON output (--json)
{
"ok": true,
"command": "doctor",
"data": {
"authenticated": true,
"lockfile": true,
"detectedTarget": "cursor",
"detectedReason": ".cursor/ directory found",
"packages": [
{
"name": "acme/react-testing-skill",
"version": "1.2.0",
"target": "cursor",
"installPath": ".cursor/skills/react-testing-skill/",
"installType": "files"
}
],
"issues": [],
"healthy": true
}
}
mog explain
Show package metadata, install paths for all targets, and agent trigger text — useful for agents and scripts that need to understand a package before installing.
mog explain <vendor/package> [options]
Requires authentication.
| Flag | Description |
|---|---|
<vendor/package> | Package identifier, e.g. acme/react-testing-skill |
--json | Output as JSON |
Example output
React Testing Skill
acme/react-testing-skill@1.2.0
Comprehensive React testing patterns including RTL, Vitest, and MSW
──────────────────────────────────────
Type: skill
License: MIT
Price: Free
Targets: cursor, claude-code
Tags: react, testing, vitest
URL: https://mog.md/packages/acme/react-testing-skill
Install paths by target
cursor .cursor/skills/react-testing-skill/
claude-code .claude/skills/react-testing-skill/
Agent trigger
(first paragraph of README — paste into rules/AGENTS.md)
This skill teaches your AI assistant comprehensive React testing patterns...
Install: mog install acme/react-testing-skill --target cursor
Install + wire: mog install acme/react-testing-skill --target cursor --wire
JSON output (--json)
{
"ok": true,
"command": "explain",
"data": {
"name": "acme/react-testing-skill",
"title": "React Testing Skill",
"description": "Comprehensive React testing patterns...",
"type": "skill",
"license": "MIT",
"targets": ["cursor", "claude-code"],
"installPaths": {
"cursor": ".cursor/skills/react-testing-skill/",
"claude-code": ".claude/skills/react-testing-skill/"
},
"latestVersion": "1.2.0",
"price": "free",
"tags": ["react", "testing", "vitest"],
"agentTrigger": "This skill teaches your AI assistant...",
"url": "https://mog.md/packages/acme/react-testing-skill"
}
}
mog org
Manage organizations. Organizations let teams share a wallet, spend policies, and private packages under a single account.
mog org <subcommand> [options]
The active org context is stored locally. When an org is active, mog buy and mog install --auto-buy use the org wallet instead of your personal wallet.
mog org list
List organizations you are a member of.
mog org list [options]
| Flag | Description |
|---|---|
--json | Output as JSON |
mog org create
Create a new organization.
mog org create <slug> <name> [options]
| Argument/Flag | Description |
|---|---|
<slug> | Org identifier — lowercase letters, numbers, hyphens, 2–39 chars |
<name> | Display name |
--json | Output as JSON |
mog org switch
Set the active org context. All subsequent purchases use the org wallet.
mog org switch <slug> [options]
Pass none or - to clear the org context and revert to your personal wallet.
| Flag | Description |
|---|---|
--json | Output as JSON |
mog org whoami
Show the currently active org context.
mog org whoami [options]
| Flag | Description |
|---|---|
--json | Output as JSON |
mog org invite
Invite a user to the current active org by email.
mog org invite <email> [options]
Requires admin role in the org.
| Flag | Description | Default |
|---|---|---|
--role <admin|member> | Role to assign | member |
--org <slug> | Org slug (overrides active context) | active org |
--json | Output as JSON | — |
mog org wallet
Show the active org's wallet balance and auto top-up settings.
mog org wallet [options]
| Flag | Description | Default |
|---|---|---|
--org <slug> | Org slug (overrides active context) | active org |
--json | Output as JSON | — |
mog keys
Manage Ed25519 package signing keys. When a signing key is registered, mog publish automatically signs every uploaded archive. Buyers can verify your packages have not been tampered with.
mog keys <subcommand> [options]
Requires a vendor account.
mog keys generate
Generate a new Ed25519 signing keypair and save it locally.
mog keys generate [options]
| Flag | Description |
|---|---|
--force | Overwrite an existing key |
--json | Output as JSON |
Key files are stored at:
~/Library/Application Support/mog/signing-key.pem(private, mode 0600)~/Library/Application Support/mog/signing-key.pub.pem(public)
After generating, run mog keys register to activate the key.
mog keys register
Upload your public key to mog.md. Once registered, all future mog publish uploads are automatically signed.
mog keys register [options]
| Flag | Description |
|---|---|
--json | Output as JSON |
mog keys list
List your registered signing keys and key history.
mog keys list [options]
| Flag | Description |
|---|---|
--json | Output as JSON |
mog keys revoke
Revoke your current active signing key. Future uploads will not require signatures until a new key is registered.
mog keys revoke [options]
| Flag | Description |
|---|---|
--json | Output as JSON |
Environment variables
| Variable | Description | Default |
|---|---|---|
MOG_API_URL | Override the API base URL (useful for self-hosting or development) | https://api.mog.md |
MOG_TOKEN | API token. Read before checking the credentials file. | — |