Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Medusa CLI

$ medusa Official Med Risk
Medusa · Workspace & SaaS · MIT · macos / linux / windows

Medusa CLI (medusa / @medusajs/medusa-cli) drives Medusa v2 commerce backends—running local dev servers (develop), executing database and data migrations (db:migrate), syncing module links (--execute-safe-links), and creating admin users. Optimized as a project-local build and migration runner.

FCRS-1.0 Score
73 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
npm install @medusajs/medusa-cli
CLI vs MCP Decision CLI Only

medusa executes local MikroORM schema migrations, builds commerce admin bundles, and runs project code locally.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Supports --execute-safe-links and --skip-scripts for headless migrations, though runtime output is human-formatted logger text rather than --json.

  • db:migrate --execute-safe-links avoids interactive link sync prompts
  • No --json output across runtime/migration commands
Trust & Safety 19 / 25

Pauses on unsafe module link deletions unless --execute-all-links is passed, protecting against accidental database drops.

  • --execute-safe-links only applies non-destructive link updates
Setup & Portability 12 / 15

Installable via npm/npx across macOS, Linux, and Windows, though useful only inside a Medusa project with PostgreSQL.

  • Runs via npx medusa in Node.js commerce projects
Utility & Efficiency 11 / 15

Coordinates dev server, production builds, migrations, and user provisioning in one command interface.

  • Handles develop, build, db:migrate, db:generate, and user
Maintenance & Lineage 8 / 10

Official Medusa monorepo (medusajs/medusa) under MIT license.

  • Maintained by the Medusa core team
Docs & Verifiability 6 / 10

Documented in Medusa v2 CLI reference, though some legacy v1 flags differ from v2.

  • Official docs at docs.medusajs.com/resources/medusa-cli

Security, Auth & Guardrails

Auth Modes
No Auth Config File
Credential Storage

Reads PostgreSQL DATABASE_URL, Redis, and JWT secrets from project .env and medusa-config.ts; does not store cloud user tokens.

Side Effects
Read-Only Local Write Destructive
Cost & Quotas

MIT open-source CLI and commerce framework; free to self-host.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Medusa CLI (medusa) Agent Rules
- Run `npx medusa` from a Medusa project root with a valid `.env` database connection.
- Pass `--execute-safe-links` (or `--skip-links`) on `medusa db:migrate` in CI so link prompts do not hang.
- Back up PostgreSQL before running `db:migrate` or `db:rollback` on staging/production databases.

Agent-Ready Command Recipes

Safe Read-Only Queries

Inspect Medusa CLI subcommands
npx medusa --help

Lists available project-local Medusa commands including develop, build, and db:migrate.

Controlled Writes & Previews

Run database migrations non-interactively
npx medusa db:migrate --execute-safe-links

Applies pending schema migrations and automatically executes safe module link updates without interactive prompts.

Strengths for Agents

  • + --execute-safe-links lets CI and agents run safe schema migrations without blocking on prompts.
  • + Cleanly separates safe link updates from destructive schema changes.

Caveats & Pitfalls

  • ! Project-local tool requiring a configured PostgreSQL database; no --json log mode for db:migrate or develop.
  • ! Commands differ significantly between Medusa v1 and v2.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI