@ambasada/cli 0.7.5 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +24 -28
  2. package/dist/ambasada.mjs +1193 -2118
  3. package/package.json +13 -8
package/README.md CHANGED
@@ -1,33 +1,29 @@
1
1
  # @ambasada/cli: `ambasada`
2
2
 
3
- One dependency-free file (`dist/ambasada.mjs`, the templates embedded). `pnpm build`, then `node dist/ambasada.mjs --help`;
4
- from source: `pnpm village --help`. `create-ambasada/` is the tiny `npm create ambasada` bin.
3
+ Build and host apps on Ambasada. One dependency-free file (`dist/ambasada.mjs`, the platform templates embedded).
4
+ `pnpm build`, then `node dist/ambasada.mjs --help`; from source: `pnpm village --help`. The command tree is in
5
+ docs/PLATFORM.md §3.
5
6
 
6
- - `ambasada init [dir] --template next|spa|worker` (default `next`) scaffolds from `templates/` in the repo. A product
7
- is one Cloudflare Worker: Next.js via OpenNext, Vite + React for Lovable/Bolt exports, or bare fetch handlers.
8
- It also writes `.env` for the mock and the app manifest (`/.well-known/ambasada.json`, `src/manifest.ts`).
9
- - Every template is a **mini-app** for the Ambasada app (docs/MINI-APPS.md): the manifest is schema 2 (`id`, `name` ≤ 32,
10
- `subtitle` ≤ 40, `description`, `icon` = a 1024×1024 opaque PNG, `splash`, `accent`, `entry`, `kind`, `category`,
11
- `scopes`, `visibility`), and the page calls `ready()` from `@ambasada/miniapp` (`packages/miniapp`; the worker
12
- template loads it as `<script src="https://hub.ambasada.id/miniapp.js">`) after its first render, padding the page
13
- by `--ambasada-safe-area-*` and `--ambasada-host-bar`.
14
- - `ambasada check [url | dir] [--json]` (`src/check.ts`) says whether a product passes the mini-app checks: the manifest
15
- validates, the icon is a 1024² opaque PNG, the entry has a `width=device-width` viewport, is not dark-only and loads
16
- the SDK. With no argument it reads the current project's static files (no network); with a URL it fetches the live
17
- origin (https, manifest served without redirects, entry 200 in under 3 s). Problems exit 1, warnings don't; `--json`
18
- prints `{ ok, target, problems, warnings }`.
19
- - `ambasada dev` starts the mock Payments API on :8788 and the project's dev server (`next dev`, `vite` or
20
- `wrangler dev`, `src/stack.ts`) on `product.url`, with `AMBASADA_*` pointed at the mock. `--mock-only`: the mock alone.
21
- - `src/storage.ts`: `ambasada db migrate | shell | tables | migrations`, `ambasada kv …`, `ambasada files …` on the app's
22
- D1, KV and R2 through `/v1/dev/{db,kv,files}` (docs/STORAGE.md); `--local` runs the same against wrangler's local
23
- state (`ambasada dev` applies `db/migrations` locally before starting the dev server). `ambasada deploy` sends the
24
- project's Durable Objects and migrations from `wrangler.jsonc` and prints what the first deploy provisioned.
25
- - `src/commands.ts`: login (device code at `/v1/auth/device`, else paste a key; saved in `~/.config/ambasada/config.json`),
26
- init, dev, deploy, link, check, offerings, wallet, ledger, logs, market, steer, webhook, links.
27
- - `src/mock/`: the local mock of the Payments API (fake bank, fake visitor, real receipts and webhook signatures,
28
- canned LLMOK, and a fake Ambasada ID issuer so Sign in with Ambasada works offline: docs/AUTH.md). See the
29
- skill's `reference/test-mode.md`.
30
- - `test/smoke.test.ts`: `worker` and `next` scaffolds run under `ambasada dev` and get paid 1 TON;
31
- `test/templates.test.ts`: the three templates stay in step.
7
+ ```
8
+ init [dir] [--template next|spa|worker] [--village] login | logout | whoami
9
+ dev [--port] [--tunnel] [--mock-only] deploy [--own] [--no-smoke] [--dry-run]
10
+ tunnel | link <url> | check [url|dir] env list|set|unset | logs [--follow]
11
+ db migrate|shell|tables | kv … | files … add <addon> | upgrade [--check]
12
+ ```
13
+
14
+ - `src/commands.ts`: login (device code at `/v1/auth/device`, else a key; saved in `~/.config/ambasada/config.json`,
15
+ the 0.7 `~/.config/village` file is moved there once), init (writes `.env` for the mock, the app manifest and
16
+ `.ambasada/project.json`), dev, link, check, env, logs, add. `src/deploy.ts`: build, workerd smoke test, upload.
17
+ `src/storage.ts`: `db`, `kv`, `files` (docs/STORAGE.md). `src/tunnel.ts`: docs/TUNNEL.md. `src/upgrade.ts`:
18
+ `ambasada upgrade` (docs/PLATFORM.md §3a).
19
+ - `src/mock/`: the platform mock on :8788 (a fake Ambasada ID issuer for Sign in with Ambasada and silent sign-in,
20
+ a fake hub for notifications and app events, the store, files, device login).
21
+ - `src/plugin.ts`: add-ons. A package with `"ambasada": { "plugin": "./dist/cli.mjs" }` among the project's
22
+ dependencies (or in `addons: []` of `ambasada.config.ts`, or `AMBASADA_ADDONS`) is imported and its
23
+ `register(api)` adds a namespace, aliases, mock routes, a dev hook, after-deploy hooks, smoke checks, config keys,
24
+ an init overlay and skills. Today: `@ambasada/village` (`ambasada village …`).
25
+ - `src/check.ts`: the mini-app checks (manifest schema 2, 1024² opaque PNG icon, viewport, light scheme, the SDK).
26
+ - Tests: `test/smoke.test.ts` runs the templates under `ambasada dev` (and a `--village` one through the bank and
27
+ deploy); `test/upgrade.test.ts` upgrades a 0.7 project; `test/templates.test.ts` keeps the templates in step.
32
28
 
33
29
  Built by [CENTYSO](https://centyso.com) for [Ambasada](https://ambasada.id). MIT.