{"_id":"@apexkit/cli","_rev":"5-d804520ea047652e418cfeb15a24d1d0","name":"@apexkit/cli","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.0":{"name":"@apexkit/cli","version":"1.0.0","keywords":["apexkit","baas","cli","devtools","sync","watch"],"author":{"name":"deniskipeles"},"license":"MIT","_id":"@apexkit/cli@1.0.0","maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"homepage":"https://github.com/deniskipeles/apexkit-cli#readme","bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"bin":{"apex":"bin/apexkit.js","apexkit":"bin/apexkit.js"},"dist":{"shasum":"710a9377a99df75c818c53d7babd507a5e0822cf","tarball":"https://registry.npmjs.org/@apexkit/cli/-/cli-1.0.0.tgz","fileCount":5,"integrity":"sha512-r6YgmqA3DDV6kzBm3OG1Q34PQCfi+Acecw8+05YzivSmMQq1xJNDljb1BnjKnuQH2SNZNBkvfx8tiA9Gk8xHcg==","signatures":[{"sig":"MEUCIFLCO9FbgXL0txPUebtQVCwmNNnqssQhvyJTA/xmvA39AiEAspOYDNUtjP02Y4YZ8yWa8WfqtCU5oWw/Q47DjJ+v2yQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58891},"main":"./src/index.js","type":"module","engines":{"node":">=18.0.0"},"gitHead":"f6848bb3e3c58aa1630f1f1b89acb965560f41bc","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"apexkit","email":"kipeleskemboi@gmail.com"},"repository":{"url":"git+https://github.com/deniskipeles/apexkit-cli.git","type":"git"},"_npmVersion":"10.9.8","description":"The official CLI and developer sync engine for ApexKit","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ws":"^8.18.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli_1.0.0_1788334108187_0.6684455045759323","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@apexkit/cli","version":"1.0.1","keywords":["apexkit","baas","cli","devtools","sync","watch"],"author":{"name":"deniskipeles"},"license":"MIT","_id":"@apexkit/cli@1.0.1","maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"homepage":"https://github.com/deniskipeles/apexkit-cli#readme","bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"bin":{"apex":"bin/apexkit.js","apexkit":"bin/apexkit.js"},"dist":{"shasum":"fa5bb997c522608c859bdfcb4cb20c94ac586040","tarball":"https://registry.npmjs.org/@apexkit/cli/-/cli-1.0.1.tgz","fileCount":5,"integrity":"sha512-BM42qelCiNLkYDWM91o5TQD7AmfejNLbDy2lcz71EyDgY4cczN1kePGF2ytC1gffgxQ9hf07ZebW8nAg13BJZg==","signatures":[{"sig":"MEUCIQCeS5XcW+7uoC9essCihO8EkFcGn51PWCGgR9uMjFFOlgIgNsfT0yyJR03Oa7MKOIA0zgVo4WChFX3EScBrT0GN1r0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":58887},"main":"./src/index.js","type":"module","engines":{"node":">=18.0.0"},"gitHead":"b6e6a61835095a71712e552809b62ccd514f9732","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"apexkit","email":"kipeleskemboi@gmail.com"},"repository":{"url":"git+https://github.com/deniskipeles/apexkit-cli.git","type":"git"},"_npmVersion":"10.9.8","description":"The official CLI and developer sync engine for ApexKit","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ws":"^8.18.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli_1.0.1_1788334501855_0.5602180185382137","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@apexkit/cli","version":"1.0.2","keywords":["apexkit","baas","cli","devtools","sync","watch"],"author":{"name":"deniskipeles"},"license":"MIT","_id":"@apexkit/cli@1.0.2","maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"homepage":"https://github.com/deniskipeles/apexkit-cli#readme","bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"bin":{"apex":"bin/apexkit.js","apexkit":"bin/apexkit.js"},"dist":{"shasum":"29919bbc71c9cd18d761eb810230e888fb18c7d4","tarball":"https://registry.npmjs.org/@apexkit/cli/-/cli-1.0.2.tgz","fileCount":5,"integrity":"sha512-XdPem92rZe4muGelfZCz+xar0UH6LZUYpLwSX1hpxxbuU/jBH3hOveIt1px32jJOqv+7axLhfpwulKtTX7tpJw==","signatures":[{"sig":"MEQCIHq1hzp5iv2FAvgCok7Ay/fx+12sEZBiCFT75fTHhEtzAiAs+W/9eANFRJaUI6B349VoGew0uGO7XcBN37FhxofXRw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61992},"main":"./src/index.js","type":"module","engines":{"node":">=18.0.0"},"gitHead":"36d379d187717dced13a889af9061f9ccbc3e0e2","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"apexkit","email":"kipeleskemboi@gmail.com"},"repository":{"url":"git+https://github.com/deniskipeles/apexkit-cli.git","type":"git"},"_npmVersion":"10.9.8","description":"The official CLI and developer sync engine for ApexKit","directories":{},"_nodeVersion":"22.23.1","dependencies":{"ws":"^8.18.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli_1.0.2_1788680979686_0.6238669484718564","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@apexkit/cli","version":"1.0.3","keywords":["apexkit","baas","cli","devtools","sync","watch"],"author":{"name":"deniskipeles"},"license":"MIT","_id":"@apexkit/cli@1.0.3","maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"homepage":"https://github.com/deniskipeles/apexkit-cli#readme","bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"bin":{"apex":"bin/apexkit.js","apexkit":"bin/apexkit.js"},"dist":{"shasum":"6b105d22519fd025dede7d8303d62979543768b1","tarball":"https://registry.npmjs.org/@apexkit/cli/-/cli-1.0.3.tgz","fileCount":5,"integrity":"sha512-QRJUepDQ4XWza+EIHW3aICV7Nkh5+BKv145r/Ky6ZPACU/pJuyQ85VVKoLVN+NR2J9Ztsa0PXj6cVvGuibpbAA==","signatures":[{"sig":"MEQCIDn0x6e5o0J4xxuvLQ7x0Qp05tIB3+tHKArgmN2CxjI8AiBvA9wm/97rEr9Ilp7Hn/AGNtxHEnA9pGQ/82tNOKAVcw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":63851},"main":"./src/index.js","type":"module","engines":{"node":">=18.0.0"},"gitHead":"fae46e8e43d18463e7fd2a1287194f7175778457","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"apexkit","email":"kipeleskemboi@gmail.com"},"repository":{"url":"git+https://github.com/deniskipeles/apexkit-cli.git","type":"git"},"_npmVersion":"10.9.2","description":"The official CLI and developer sync engine for ApexKit","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ws":"^8.18.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/cli_1.0.3_1789298761190_0.5714773243134337","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@apexkit/cli","version":"1.0.4","description":"The official CLI and developer sync engine for ApexKit","type":"module","main":"./src/index.js","bin":{"apexkit":"bin/apexkit.js","apex":"bin/apexkit.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/deniskipeles/apexkit-cli.git"},"dependencies":{"ws":"^8.18.0"},"engines":{"node":">=18.0.0"},"keywords":["apexkit","baas","cli","devtools","sync","watch"],"author":{"name":"deniskipeles"},"license":"MIT","bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"homepage":"https://github.com/deniskipeles/apexkit-cli#readme","_id":"@apexkit/cli@1.0.4","gitHead":"09939b2a029a5c601ce88eab40fccfcda4fa88f9","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-9oofNrOPdqHLAAFxNF7HkKgp/4KLuwynhnu3TiDFv4vnfeksUP9uY7LJ+MK2WjwcUu3Ki3sm8dEiuiBS4kMvRg==","shasum":"90ce033f4589f77ff06de08a213e9b3d5c215d52","tarball":"https://registry.npmjs.org/@apexkit/cli/-/cli-1.0.4.tgz","fileCount":5,"unpackedSize":72733,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDR/B5wS7KRbRvqKQz4jB+31DX71IO1/VH3h1n+Czt5XgIgbd7c4aw6J+4YaRCpBhsy6rC2CTKHajNtgXh7ANk46QQ="}]},"_npmUser":{"name":"apexkit","email":"kipeleskemboi@gmail.com"},"directories":{},"maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cli_1.0.4_1789638801081_0.03543967305817164"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-02T07:28:28.005Z","modified":"2026-09-17T09:53:21.345Z","1.0.0":"2026-09-02T07:28:28.330Z","1.0.1":"2026-09-02T07:35:01.999Z","1.0.2":"2026-09-06T07:49:39.823Z","1.0.3":"2026-09-13T11:26:01.353Z","1.0.4":"2026-09-17T09:53:21.221Z"},"bugs":{"url":"https://github.com/deniskipeles/apexkit-cli/issues"},"author":{"name":"deniskipeles"},"license":"MIT","homepage":"https://github.com/deniskipeles/apexkit-cli#readme","keywords":["apexkit","baas","cli","devtools","sync","watch"],"repository":{"type":"git","url":"git+https://github.com/deniskipeles/apexkit-cli.git"},"description":"The official CLI and developer sync engine for ApexKit","maintainers":[{"name":"apexkit","email":"kipeleskemboi@gmail.com"}],"readme":"Here is a complete, production-ready `README.md` for **`@apexkit/cli`**.\n\n---\n\n# `@apexkit/cli`\n\n> The official Command Line Interface and Developer Sync Engine for [ApexKit](https://github.com/deniskipeles/apexkit).\n\n`@apexkit/cli` allows you to develop, test, and synchronize backend scripts, server-side rendered (SSR) templates, custom modules, AI actions, and database schemas directly from your local IDE (VS Code, Cursor, WebStorm, etc.) with real-time live reloading and full TypeScript IntelliSense.\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Configuration (`.env`)](#configuration-env)\n- [CLI Commands](#cli-commands)\n  - [`apexkit init`](#apexkit-init)\n  - [`apexkit create` / `apexkit new`](#apexkit-create--apexkit-new)\n  - [`apexkit watch` (Default)](#apexkit-watch-default)\n  - [`apexkit push`](#apexkit-push)\n  - [`apexkit pull`](#apexkit-pull)\n  - [`apexkit commit`](#apexkit-commit)\n  - [`apexkit status`](#apexkit-status)\n- [Workspace Directory Architecture](#workspace-directory-architecture)\n- [File Metadata Specifications](#file-metadata-specifications)\n- [TypeScript & IDE IntelliSense Setup](#typescript--ide-intellisense-setup)\n- [License](#license)\n\n---\n\n## Installation\n\nYou can install `@apexkit/cli` globally or execute it on-demand with `npx`.\n\n```bash\n# Global installation (recommended)\nnpm install -g @apexkit/cli\n\n# Verify installation\napexkit --version\n```\n\nOr run directly without installing:\n\n```bash\nnpx @apexkit/cli <command>\n```\n\n> **Alias**: Both `apexkit` and `apex` commands are registered automatically upon installation.\n\n---\n\n## Quick Start\n\n### 1. Initialize a Local Workspace\nRun the interactive setup wizard inside an empty folder:\n\n```bash\nmkdir my-apex-app && cd my-apex-app\napexkit init\n```\n\n### 2. Pull Existing Backend Resources\nDownload all remote collections, webhooks, templates, and AI actions from your ApexKit server:\n\n```bash\napexkit pull\n```\n\n### 3. Start Live Development\nStart the bidirectional file watcher:\n\n```bash\napexkit watch\n```\n\nEvery time you edit and save a script, template, or AI action in your editor, it automatically syncs to your live ApexKit instance in under 50ms.\n\n---\n\n## Configuration (`.env`)\n\n`@apexkit/cli` reads configuration from a `.env` file in the root of your workspace:\n\n```env\n# ApexKit Server Endpoint\nAPEXKIT_URL=http://localhost:5000\n\n# Administrative API Key (Root key or Scoped Tenant/Sandbox key)\nAPEXKIT_API_KEY=root_sys_prod_xxxxxxxxxxxx_yyyy\n\n# Execution Context (root | tenant:<tenant_id> | sandbox:<session_id>)\nSCOPE_KEY=root\n```\n\n| Variable | Description | Default |\n| :--- | :--- | :--- |\n| `APEXKIT_URL` | Base URL where your ApexKit server is running. | `http://localhost:5000` |\n| `APEXKIT_API_KEY` | Admin or system API key with write access. | *None (Required)* |\n| `SCOPE_KEY` | Target environment (`root`, `tenant:<id>`, `sandbox:<id>`). | `root` |\n\n---\n\n## CLI Commands\n\n### `apexkit init`\n\nRuns an interactive setup wizard that:\n1. Prompts for your ApexKit server URL, API Key, and target scope.\n2. Generates the `.env` file.\n3. Provisions the standard folder structure (`webhooks/`, `modules/`, `templates/`, `ai_actions/`, `schemas/`).\n4. Generates `apexkit.d.ts` (with full database collection types) and `jsconfig.json` for IDE autocompletion.\n\n```bash\napexkit init\n```\n\n---\n\n### `apexkit create` / `apexkit new`\n\nInteractive scaffolding wizard to create a new webhook, database hook, reusable custom module, or SSR template with boilerplate and type annotations.\n\n```bash\napexkit create\n# or\napexkit new\n# or\napexkit init:file\n```\n\n**Options Scaffolded:**\n- **Webhooks & Endpoints** (REST endpoints with Hono / native Request-Response)\n- **Database Lifecycle Hooks** (`before_create_record`, `after_update_record`, etc.)\n- **System & Auth Hooks** (`before_user_login`, `after_user_create`, etc.)\n- **Reusable Modules** (Imported across scripts via `@/custom/*`)\n- **SSR HTML Templates** (Astro-like Frontmatter + Tailwind + Tera engine)\n\n---\n\n### `apexkit watch` (Default)\n\nStarts a live WebSocket file-watcher. Whenever a `.js`, `.ts`, `.html`, or `.json` file is saved, it is compiled, validated, and pushed directly to the live server.\n\n```bash\n# Start watch mode with auto-commit to SQLite DB\napexkit watch\n# or simply\napexkit\n\n# Start watch mode in transient memory (VFS only, skips DB commit)\napexkit watch --no-auto-commit\n```\n\n---\n\n### `apexkit push`\n\nPerforms an immediate, one-time manual push and commit of local files to the live ApexKit database.\n\n```bash\n# Push scripts & webhooks only (Default)\napexkit push\napexkit push --scripts\napexkit push -s\n\n# Push SSR templates only\napexkit push --templates\napexkit push -t\n\n# Push AI actions only\napexkit push --actions\napexkit push -a\n\n# Push all categories (Scripts, Templates, AI Actions)\napexkit push --all\napexkit push -A\n\n# Combine specific categories\napexkit push --templates --actions\n```\n\n#### Pruning Deleted Remote Items (`--delete-remote`)\nTo delete items from the remote ApexKit database that no longer exist in your local workspace:\n\n```bash\n# Prune all orphaned scripts, templates, and actions\napexkit push --all --delete-remote=all\n\n# Prune only orphaned templates\napexkit push --templates --delete-remote=templates\n\n# Prune only orphaned scripts\napexkit push --scripts --delete-remote=scripts\n```\n\n---\n\n### `apexkit pull`\n\nDownloads all remote assets from your ApexKit instance to your local workspace:\n- Collection schemas & policies (`schemas/`)\n- Webhooks, custom modules, and hooks (`webhooks/`, `modules/`)\n- SSR page templates (`templates/`)\n- AI prompt actions (`ai_actions/`)\n- Generates refreshed `apexkit.d.ts` typings matching your live DB schema.\n\n```bash\napexkit pull\n```\n\n---\n\n### `apexkit commit`\n\nPushes local files into the active server's in-memory Virtual File System (VFS) without persisting changes permanently to the SQLite database. Useful for rapid staging.\n\n```bash\napexkit commit\n```\n\n---\n\n### `apexkit status`\n\nDisplays the active connection information, target scope, server health, and sync settings.\n\n```bash\napexkit status\n```\n\n---\n\n## Workspace Directory Architecture\n\n```\nmy-apex-app/\n├── .env                     # Server URL, API Key, and Scope configuration\n├── jsconfig.json            # Module alias resolution for VS Code / IDEs\n├── apexkit.d.ts             # Auto-generated IntelliSense typings for DB & APIs\n├── package.json             # Workspace package descriptor\n│\n├── webhooks/                # API Endpoints and Database Lifecycle Hooks\n│   ├── handle-payment.js\n│   └── validate-order.ts\n│\n├── modules/\n│   ├── custom/              # Reusable local modules (import via \"@/custom/<name>\")\n│   │   └── formatters.js\n│   └── esm/                 # Third-party ES modules\n│\n├── templates/               # Server-Side Rendered (SSR) HTML Pages\n│   ├── index.html\n│   └── dashboard.html\n│\n├── ai_actions/              # Structured LLM Prompts & RAG Actions\n│   └── summarize-doc.json\n│\n└── schemas/                 # Database Schema Snapshots (JSON)\n    └── collections.json\n```\n\n---\n\n## File Metadata Specifications\n\nApexKit uses a standard file header block to bind scripts and templates to collections, routes, and database triggers.\n\n### 1. Webhooks & Scripts (`.js` / `.ts`)\n\n```typescript\n/** @type {import(\"../apexkit\").FileMetadata} */\nexport const __fileMetadata__ = {\n  \"name\": \"create-profile-on-register\",\n  \"extension\": \"js\",\n  \"type\": \"webhook\",\n  \"path\": \"./webhooks/\",\n  \"trigger_type\": \"after_user_create\",\n  \"target_collection\": \"profiles\",\n  \"active\": true,\n  \"visibility\": \"private\"\n};\n\nexport default async function (event) {\n  const { id, email } = event.record;\n  \n  await $db.records.create(\"profiles\", {\n    user_id: id,\n    display_name: email.split(\"@\")[0]\n  });\n}\n```\n\n### 2. SSR HTML Templates (`.html`)\n\n```html\n<!--\n__fileMetadata__ = {\n  \"name\": \"home\",\n  \"extension\": \"html\",\n  \"type\": \"template\",\n  \"path\": \"./templates/\",\n  \"active\": true\n}\n-->\n<script server lang=\"ts\">\n/// <reference path=\"../apexkit.d.ts\" />\n\nexport default async function(req) {\n  const posts = await $db.records.list(\"posts\", { limit: 10 });\n  return { \n    title: \"ApexKit Portal\", \n    posts: posts.items \n  };\n}\n</script>\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <title>{{ title }}</title>\n  <link rel=\"stylesheet\" href=\"/styles.css\">\n  <script src=\"/static/js/htmx.js\"></script>\n  <script src=\"/static/js/alpine.js\" defer></script>\n</head>\n<body class=\"bg-slate-900 text-slate-100 p-8\">\n  <h1 class=\"text-3xl font-bold text-indigo-400\">{{ title }}</h1>\n  <ul class=\"mt-4 space-y-2\">\n    {% for post in posts %}\n      <li class=\"p-4 bg-slate-800 rounded border border-slate-700\">\n        {{ post.data.title }}\n      </li>\n    {% endfor %}\n  </ul>\n</body>\n</html>\n```\n\n### 3. AI Actions (`.json`)\n\n```json\n{\n  \"action\": {\n    \"slug\": \"content-editor\",\n    \"name\": \"Content Editor\",\n    \"model\": \"gemini-2.5-flash-lite\",\n    \"system_prompt\": \"You are an expert copywriter. Output clean Markdown.\",\n    \"template\": \"Improve the clarity of this text:\\n\\n{{text}}\",\n    \"config\": {\n      \"provider\": \"gemini\",\n      \"grounding\": false,\n      \"streaming\": true\n    }\n  }\n}\n```\n\n---\n\n## TypeScript & IDE IntelliSense Setup\n\n`@apexkit/cli` automatically produces an `apexkit.d.ts` file tailored to your live database. It defines all globals provided by the runtime:\n\n- `$db` – Strongly typed CRUD, Query Engine, and Vector Search.\n- `$root` – Multitenancy management (Root scope only).\n- `$files` – File storage operations (read, save, signed URLs).\n- `$fs` – Virtual file system scratchpad.\n- `$ai` – Local and remote vector embeddings and similarity math.\n- `$cache` – In-memory cache operations with TTL support.\n- `$queue` – Background task orchestration and status tracking.\n- `$realtime` – Real-time WebSocket and SSE event dispatcher.\n- `$wasm` – WebAssembly memory loader and WASI execution.\n- `$util` – Crypto, hashing, base64, and string formatting utilities.\n- `$env` – Environment secrets accessor.\n\n### Enabling Autocomplete in HTML `<script server>` Blocks\nTo ensure VS Code provides autocomplete inside `.html` template scripts, add the reference directive at the top of your `<script server>` block:\n\n```html\n<script server lang=\"ts\">\n/// <reference path=\"../apexkit.d.ts\" />\n\nexport default async function(req) {\n  // Full autocompletion for $db, $http, and database collections\n}\n</script>\n```\n\n---\n\n## License\n\nMIT © [Denis Kipeles](https://github.com/deniskipeles)","readmeFilename":"README.md"}