{
  "markdown": "# @cm64/cli\n\nStateless command-line tool for [CM64 Studio](https://build.cm64.io). Build, manage, and deploy web applications from your terminal or AI agent.\n\n## Install\n\n```bash\nnpm install -g @cm64/cli\n```\n\n## Quick Start\n\nThe local-first workflow: pull the project to disk, edit with your editor, push back.\n\n```bash\n# 1. Login (one time)\ncm64 login                                # email + verification code\n# cm64 login cm64_pat_abc123              # ...or paste an existing PAT\n\n# 2. Pick a project\ncm64 projects                             # list yours\ncm64 use my-app.cm64.site                 # set active (id or domain works)\n\n# 3. The loop\ncm64 pull                                 # → ./my-app.cm64.site/ + writes .cm64.workspace inside it\n# edit files in your editor of choice\ncd ./my-app.cm64.site                     # any cm64 commands from inside resolve to this project\ncm64 push                                 # diffs against server, refuses to resurrect deleted files\ncm64 push --check                         # preview what would change without uploading\n\n# 4. Ship\ncm64 snapshot \"v1.0\"                      # named checkpoint\ncm64 deploy latest                        # pin to production\n```\n\nUseful one-liners:\n\n```bash\ncm64 status -v                            # snapshot pin, dynamic pages, last push, env keys, db counts\ncm64 doctor                               # missing meta titles, OG images, no production pin, bad JSON\ncm64 debug --function voteStory --since 2026-05-08\ncm64 invalidate-cache                     # flush framework caches when something looks stale\ncm64 learn seo                            # read a skill (also: cm64 learn with no arg = system prompt + skills index)\n```\n\n## How It Works\n\nEach command is a single HTTP POST to `/api/cli`. No sessions, no persistent connections, no MCP protocol overhead. Token and project ID stored locally in `~/.cm64/config.json`.\n\n## For AI Models\n\nSee [SKILL.md](./SKILL.md) for comprehensive AI model documentation.\n\n## Commands\n\n### Workflow (use these every day)\n- `cm64 pull [path]` — Pull project (or one file/folder) to disk\n- `cm64 push [path]` — Push local changes; warns if local files were deleted server-side\n- `cm64 sync` — Bidirectional reconcile (`cm64 sync --help` for the full conflict policy)\n- `cm64 use <id|domain>` — Set active project\n- `cm64 status [-v]` — Context check (`-v` = full info)\n- `cm64 info [-v]` — Project metadata\n- `cm64 doctor` — Health checks (missing titles, OG, snapshots, bad JSON)\n- `cm64 invalidate-cache [-t all|components|site]` — Flush framework caches\n- `cm64 rename <from> <to>` — Move/rename a file (auto-flushes route cache for pages)\n- `cm64 delete <class/name>` — Delete from server\n\n### Context\n- `cm64 learn` — System prompt + skills index (no arg)\n- `cm64 learn <skill>` — Read full skill docs\n- `cm64 skills` — List available skills\n- `cm64 buildme` — Read/update BUILDME.md\n\n### Assets\n- `cm64 upload <name> -f <file>` — Upload to S3\n- `cm64 assets` — List assets\n\n### Deploy\n- `cm64 snapshot <name>` — Create snapshot\n- `cm64 deploy <id|latest>` — Pin to production\n- `cm64 history <class/name>` — Version history\n- `cm64 restore <class/name> --version <id>` — Roll back\n\n### Data\n- `cm64 users` — App end-users\n- `cm64 analytics` — Product analytics\n- `cm64 debug [--function x] [--source function|component]` — Server-side function logs\n- `cm64 database [list]` — List the active project's declared databases (read-only)\n- `cm64 database query <name> [--search x] [--filter k=v] [--sort f] [--order asc|desc] [--page n] [--limit n]` — Paginated read of a database\n- `cm64 database get <name> <id>` — Fetch one document by id\n- `cm64 database count <name> [--filter k=v]` — Count documents\n\nThe `database` commands are **read-only** and **project-scoped**: a database name is resolved against the active project's own config, and local (`jason`) collections are tenant-prefixed server-side — you can only ever read your own project's data, never another project's.\n\n### Setup (mostly first-time)\n- `cm64 register` — Create account\n- `cm64 login [token]` — Authenticate\n- `cm64 projects` — List projects\n- `cm64 create <name>` — Create project\n\n### Advanced (remote-only escape hatches)\nOnce you've pulled, your local editor + grep replace these. They're hidden from `cm64 help` by default — see `cm64 help --advanced`:\n`ls`, `read`, `write`, `write-many`, `edit`, `diff`, `search`, `glob`.\n\n**Singular vs plural**: server class is always singular (`function/foo.js`, not `functions/foo.js`). The CLI silently normalizes typed plurals at the parser level — type whatever, it works.\n\n## Flags\n\n- `--json` — Structured JSON output\n- `--force` — Skip conflict detection\n- `-f <file>` — Read content from local file\n\n## Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `CM64_TOKEN` | Auth token (overrides config) |\n| `CM64_ENDPOINT` | API endpoint (default: `https://build.cm64.io/api/cli`) |\n| `CM64_PROJECT` | Active project ID (highest priority — overrides workspace file and global config) |\n\n## Project Resolution\n\nThe active project is resolved in this order — first match wins:\n\n1. **`CM64_PROJECT` env var** — per-shell override.\n2. **`.cm64.workspace` file** in the cwd or any ancestor directory — per-directory pin. `cm64 pull` writes this automatically into the project root, so future commands inside that tree resolve to the right project regardless of what other terminals are doing.\n3. **`~/.cm64/config.json`** — global, shared across all terminals on the machine.\n\n`cm64 status` prints `Project source: env|workspace|global` so you can tell at a glance which one is active. `cm64 use` updates both the global config and any nearby `.cm64.workspace` file (so it's never silently ignored when you run it from inside a pinned directory).\n\n## Claude Code Integration\n\nAdd to your Claude Code MCP config to use `cm64` commands directly:\n\n```json\n{\n  \"mcpServers\": {\n    \"cm64\": {\n      \"command\": \"cm64\",\n      \"args\": [\"--mcp\", \"--token\", \"cm64_pat_abc123\"]\n    }\n  }\n}\n```\n\nOr use the CLI directly — Claude Code can run `cm64` commands via its shell tool.\n\n## Generate a Token\n\nVisit [https://build.cm64.io/settings/tokens](https://build.cm64.io/settings/tokens) to create a Personal Access Token.\n\n## License\n\nMIT\n",
  "bytes": 6302,
  "sha": "7a09bc9ecf415fa88d19a39f1b4caa2ea3493e29e8399d8a813c3dbfa3cf22d2",
  "repo_slug": "cm64-studio/cm64-cli",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_cm64_studio_cm64_cli_cm64_2a6d0134/readme"
}