Enterprise CLI (npx nexus)
The CLI manages offline content synchronization, schema validation, TypeScript generation, and edge deployments through a Git-like workflow.
“Track local schema modifications against the remote database with colorized diffs and conflict guards.”
CLI Command Catalog
npx nexus init
Scans project, creates .env.local, injects /sw.js, and auto-generates the Next.js revalidation route.
npx nexus pull
Downloads production schemas and compiles offline .nx encrypted binaries.
npx nexus diff
Shows pending changes (Added, Removed, Modified) between your local sandbox and upstream.
npx nexus push
Validates against schema and executes an atomic push transaction to production.
npx nexus init
Runs the interactive initialization wizard:
- Detects your framework (Next.js App Router, Vite, Astro, SvelteKit).
- Validates Project ID & API Key against the Control Plane.
- Writes credentials to
.env.localand updates.gitignore. - Injects the Next.js revalidation route (
app/api/revalidate/route.ts). - Injects the PWA WebPush service worker (
public/sw.js). - Provisions dependencies (
@nexushub/client,@opennextjs/cloudflare).
npx nexus pull
Downloads remote content and creates an encrypted upstream baseline (origin.nx):
| 1 | $ npx nexus pull |
| 2 | ✔ Connected to GN-Apex Edge API |
| 3 | ✔ Pulled 4 pages |
| 4 | ✔ Pulled 2 collections (blog_posts, products) |
| 5 | ✔ Compiled .nexus/origin.nx upstream baseline |
| 6 | ✔ Content synchronized successfully! |
npx nexus diff
Compares your local .nexus/local/*.nx binaries against origin.nx:
| 1 | $ npx nexus diff |
| 2 | Pending Changeset: |
| 3 | + [Added] blog_posts[2]: {"title": "Announcing v2.0", "slug": "v2"} |
| 4 | ~ [Modified] pages.home.hero_title: -"Old Headline" +"The Sovereign Platform" |
| 5 | - [Removed] pages.about.deprecated_field |
| 6 | |
| 7 | Total changes: 3 (use 'npx nexus push' to publish) |
npx nexus push
Validates your local data against the schema and pushes it live. Includes an upstream conflict-checking guard to prevent overwriting coworker changes made in the dashboard:
npx nexus pull, the push will abort with a conflict warning. Run npx nexus pull to re-sync or append --force to overwrite.npx nexus types
Auto-generates strict TypeScript definitions from your CMS schema:
| 1 | $ npx nexus types --output types/nexus.d.ts |
| 2 | ✔ Schema loaded (4 pages, 2 collections) |
| 3 | ✔ Generated types/nexus.d.ts (184 lines) |
| 4 | ✔ Augmented @nexushub/client ContentEngine |
npx nexus deploy
Compiles your Next.js application and deploys it directly to Cloudflare Pages:
- Requests an ephemeral 15-minute scoped deployment token from the Control Plane.
- Provisions a Cloudflare D1 tag cache database (
[project]-tag-cache). - Provisions a Cloudflare R2 cache bucket (
[project]-cache-r2). - Builds standalone output using
opennextjs-cloudflare. - Transfers assets to Cloudflare and binds your custom subdomain.
npx nexus doctor
Runs a diagnostic health check on your local environment (Node version, lockfile integrity, API connectivity, and package installation).