@odla-ai/cli 0.3.0 → 0.5.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.
- package/README.md +104 -30
- package/REQUIREMENTS.md +18 -3
- package/dist/bin.cjs +790 -273
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +1 -1
- package/dist/{chunk-ZU6QJXRQ.js → chunk-7WZIZCGA.js} +790 -270
- package/dist/chunk-7WZIZCGA.js.map +1 -0
- package/dist/index.cjs +796 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +205 -21
- package/dist/index.d.ts +205 -21
- package/dist/index.js +7 -1
- package/llms.txt +311 -53
- package/package.json +14 -6
- package/skills/odla/SKILL.md +103 -0
- package/skills/odla/references/build.md +93 -0
- package/skills/odla/references/sdks.md +94 -0
- package/skills/odla-migrate/SKILL.md +38 -13
- package/skills/odla-migrate/references/phase-0-preflight.md +0 -2
- package/skills/odla-migrate/references/phase-1-static.md +2 -4
- package/skills/odla-migrate/references/phase-2-db.md +25 -17
- package/skills/odla-migrate/references/phase-3-auth.md +106 -20
- package/skills/odla-migrate/references/phase-3b-user-sync.md +57 -0
- package/skills/odla-migrate/references/phase-4-ai.md +6 -5
- package/skills/odla-migrate/references/phase-5-cutover.md +43 -16
- package/skills/odla-migrate/references/secrets-map.md +21 -11
- package/skills/odla-migrate/references/troubleshooting.md +27 -13
- package/skills/odla-o11y-debug/SKILL.md +93 -0
- package/dist/chunk-ZU6QJXRQ.js.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: odla
|
|
3
|
+
description: >
|
|
4
|
+
Build a new app on odla — a realtime database (odla-db) plus AI, Clerk auth,
|
|
5
|
+
and observability on Cloudflare, provisioned by @odla-ai/cli. Use when the user
|
|
6
|
+
wants to create/scaffold an odla app, add odla-db/ai/auth/o11y to a repo, or
|
|
7
|
+
"get started with odla". For moving an existing static or GitHub Pages site to
|
|
8
|
+
odla, use the odla-migrate skill instead.
|
|
9
|
+
runbookOrder:
|
|
10
|
+
- references/build.md
|
|
11
|
+
- references/sdks.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# odla
|
|
15
|
+
|
|
16
|
+
You drive setup and building on **odla** — an agent-operable app platform on
|
|
17
|
+
Cloudflare: a realtime graph database (**odla-db**), multi-provider **AI**,
|
|
18
|
+
**Clerk** auth, and OpenTelemetry **observability**, all provisioned by the
|
|
19
|
+
`@odla-ai/cli`. The human approves a couple of browser-only checkpoints; you do
|
|
20
|
+
everything else.
|
|
21
|
+
|
|
22
|
+
## First: orient (one line, then confirm)
|
|
23
|
+
|
|
24
|
+
Look at the repo before scaffolding:
|
|
25
|
+
|
|
26
|
+
- **An existing site to move** (a built static / GitHub Pages site with its own
|
|
27
|
+
domain) → **stop and use the `odla-migrate` skill** — it keeps the old site
|
|
28
|
+
live and cuts over safely. This skill is for new apps.
|
|
29
|
+
- **Greenfield, or adding a backend** (empty repo, or an app that just needs
|
|
30
|
+
data / auth / AI) → continue here.
|
|
31
|
+
|
|
32
|
+
State which path you're taking and what you'll build in one line; get a nod.
|
|
33
|
+
|
|
34
|
+
## Non-negotiable rules
|
|
35
|
+
|
|
36
|
+
1. **Never print, paste, or commit a secret.** Never `cat` `.dev.vars`,
|
|
37
|
+
`.odla/credentials.local.json`, or `.odla/dev-token.json` — use `ls -l` to
|
|
38
|
+
confirm they exist (and are `0600`). The only value a human ever pastes is a
|
|
39
|
+
Clerk **publishable** key (`pk_…`) — public by design.
|
|
40
|
+
2. **Dev before prod.** Keep `envs: ["dev"]` and verify the tenant
|
|
41
|
+
(`<appId>--dev`) before any write or deploy. Add `prod` only at the explicit
|
|
42
|
+
production checkpoint. The first prod
|
|
43
|
+
`provision --dry-run` review, `provision --yes --push-secrets`, and deploy
|
|
44
|
+
are human checkpoints.
|
|
45
|
+
3. **Rules are default-deny.** A namespace with no rule is invisible; a write
|
|
46
|
+
with no rule is rejected. Never widen a rule just to clear a 403 — edit
|
|
47
|
+
`src/odla/rules.mjs` deliberately, and flag rule changes to the human.
|
|
48
|
+
4. Never `git add -A` without reading `git status` first. Never run
|
|
49
|
+
`provision --rotate-keys` or `provision --rotate-o11y-token` unless the human
|
|
50
|
+
explicitly asks.
|
|
51
|
+
|
|
52
|
+
## The flow
|
|
53
|
+
|
|
54
|
+
You reached this skill because the human ran `npx @odla-ai/cli setup`. Then:
|
|
55
|
+
|
|
56
|
+
First run `npx @odla-ai/cli capabilities --json`; use that contract instead of
|
|
57
|
+
guessing which platform/credential steps need manual work. Then:
|
|
58
|
+
|
|
59
|
+
1. **init** — `npx @odla-ai/cli init --app-id <id> --name "<Name>"` scaffolds
|
|
60
|
+
`odla.config.mjs`, `src/odla/schema.mjs`, `src/odla/rules.mjs` (deny-all).
|
|
61
|
+
2. **build the Worker shell** — install the SDKs, write the app, and create its
|
|
62
|
+
Wrangler config (`references/sdks.md`). With o11y, add `nodejs_compat` and
|
|
63
|
+
`withObservability`. The CLI will refuse secret delivery until the Wrangler
|
|
64
|
+
target exists.
|
|
65
|
+
3. **provision** ⏸ —
|
|
66
|
+
`npx @odla-ai/cli provision --write-dev-vars --push-secrets`. A device code
|
|
67
|
+
prints; the human approves it at https://odla.ai/studio. It creates the app,
|
|
68
|
+
enables services, issues or reuses configured credentials (db key + o11y
|
|
69
|
+
ingest token when enabled), pushes schema + rules, writes `.dev.vars`, and
|
|
70
|
+
transfers Worker secrets through Wrangler stdin.
|
|
71
|
+
4. **run** — `npx wrangler dev` (auto-loads `.dev.vars`); verify locally.
|
|
72
|
+
5. **security** — run the passive `@odla-ai/security` odla profile;
|
|
73
|
+
inspect every lead and keep critical candidate gating enabled.
|
|
74
|
+
6. **ship** ⏸ — after adding `prod`, run `npx @odla-ai/cli provision --dry-run`,
|
|
75
|
+
show the human, then `npx @odla-ai/cli provision --yes --push-secrets` and
|
|
76
|
+
`npx wrangler deploy`.
|
|
77
|
+
|
|
78
|
+
`npx @odla-ai/cli doctor` is an offline config check anytime;
|
|
79
|
+
`npx @odla-ai/cli smoke --env dev` verifies a live deployment.
|
|
80
|
+
|
|
81
|
+
The CLI owns deterministic platform work from `odla.config.mjs`: service
|
|
82
|
+
enablement, credential issuance/storage, `.dev.vars`, and Wrangler secret
|
|
83
|
+
transfer. You own source changes — install `@odla-ai/o11y`, add
|
|
84
|
+
`withObservability`, create the Wrangler config, and choose application-specific
|
|
85
|
+
signals. The human owns device approval, production consent, and explicit
|
|
86
|
+
destructive rotation. If an
|
|
87
|
+
o11y token must be replaced, use
|
|
88
|
+
`provision --rotate-o11y-token --push-secrets` so the cached and deployed values
|
|
89
|
+
move together; Studio rotation is manual recovery only.
|
|
90
|
+
|
|
91
|
+
## Checkpoint protocol
|
|
92
|
+
|
|
93
|
+
At each ⏸ (provision approval, first prod deploy), give the human a 3-line
|
|
94
|
+
summary — what changed / what you verified / what they must do next (approve a
|
|
95
|
+
code, paste a publishable key, run a command) — and wait for a nod.
|
|
96
|
+
|
|
97
|
+
## References
|
|
98
|
+
|
|
99
|
+
- `references/build.md` — the greenfield build, step by step, with the exact
|
|
100
|
+
commands and what to verify at each one.
|
|
101
|
+
- `references/sdks.md` — SDK cheat-sheet (what each does + minimal real usage).
|
|
102
|
+
Every installed SDK also ships `node_modules/@odla-ai/<pkg>/llms.txt` — read
|
|
103
|
+
it for the full, current API.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Build a new odla app (greenfield)
|
|
2
|
+
|
|
3
|
+
Exact commands, verified against `@odla-ai/cli`. ⏸ marks a human step.
|
|
4
|
+
|
|
5
|
+
## 1. Scaffold
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npx @odla-ai/cli init --app-id my-app --name "My App"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Writes `odla.config.mjs`, `src/odla/schema.mjs`, `src/odla/rules.mjs`, and adds
|
|
12
|
+
`.odla/*` + `.dev.vars` to `.gitignore`. Edit `schema.mjs` to declare your
|
|
13
|
+
namespaces (e.g. `notes`). Leave `rules.mjs` as-is for now — provision generates
|
|
14
|
+
deny-all rules from the schema. To turn on auth/observability, add `"o11y"` to
|
|
15
|
+
`services` and an `auth.clerk` block in `odla.config.mjs` (init leaves it
|
|
16
|
+
commented).
|
|
17
|
+
|
|
18
|
+
## 2. Build the Worker shell
|
|
19
|
+
|
|
20
|
+
`npm i` only the SDKs you need and use the local `references/sdks.md` as the
|
|
21
|
+
integration map. Create the Worker entrypoint and `wrangler.jsonc` before any
|
|
22
|
+
deployed-secret transfer. With o11y, install `@odla-ai/o11y`, add
|
|
23
|
+
`"nodejs_compat"` to `compatibility_flags`, and wrap the entrypoint with
|
|
24
|
+
`withObservability`.
|
|
25
|
+
|
|
26
|
+
Each installed package's `node_modules/@odla-ai/<pkg>/llms.txt` is the full API
|
|
27
|
+
contract. The npm artifacts contain everything required for this flow; private
|
|
28
|
+
service source or online documentation is not setup context.
|
|
29
|
+
|
|
30
|
+
## 3. Provision ⏸ device-code approval
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
npx @odla-ai/cli provision --write-dev-vars --push-secrets
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Prints a short device code and a link. ⏸ The human opens https://odla.ai/studio, signs
|
|
37
|
+
in, and approves the code — no secret passes through the chat. Provision then:
|
|
38
|
+
creates the app, enables its services, issues or reuses the db key (and the
|
|
39
|
+
o11y ingest token when o11y is enabled), pushes schema + rules, writes
|
|
40
|
+
`.dev.vars`, and transfers configured Worker secrets through Wrangler stdin.
|
|
41
|
+
Local credential files are `0600` and gitignored. Verify with
|
|
42
|
+
`npx @odla-ai/cli doctor` — it prints the app, envs, services, and flags
|
|
43
|
+
anything unset. `--push-secrets` preflights the Wrangler config and login before
|
|
44
|
+
issuing or rotating a shown-once credential.
|
|
45
|
+
|
|
46
|
+
The CLI stops at the source boundary: it verifies but does not invent your
|
|
47
|
+
application semantics. Do not use Studio to mint a routine o11y token. Manual
|
|
48
|
+
Studio rotation is recovery-only;
|
|
49
|
+
normal replacement is
|
|
50
|
+
`npx @odla-ai/cli provision --rotate-o11y-token --push-secrets` after explicit
|
|
51
|
+
human approval.
|
|
52
|
+
|
|
53
|
+
## 4. Run locally
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
npx wrangler dev
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`wrangler dev` auto-loads `.dev.vars`. Exercise the app. A default-deny `403`
|
|
60
|
+
means the namespace has no rule yet — add one in `src/odla/rules.mjs`
|
|
61
|
+
(deliberately; e.g. `{ notes: { view: "auth.signedIn", create: "auth.signedIn" } }`),
|
|
62
|
+
re-provision to push it, and retry.
|
|
63
|
+
|
|
64
|
+
## 5. Security preflight
|
|
65
|
+
|
|
66
|
+
Install the passive harness and scan before any production secret or deploy:
|
|
67
|
+
|
|
68
|
+
Before installing the exact release, first verify
|
|
69
|
+
`npm view @odla-ai/security@0.1.0 version`. An exact-version `E404` means the
|
|
70
|
+
release is unavailable and blocks this preflight; it is not a clean scan and
|
|
71
|
+
does not prove the package name is absent.
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
npm i -D --save-exact @odla-ai/security@0.1.0
|
|
75
|
+
npx odla-security scan . --profile odla --out .odla/security/pre-ship --fail-on high --fail-on-candidates critical
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Read `.odla/security/pre-ship/REPORT.md`. The CLI makes no model calls and does
|
|
79
|
+
not execute target code. A `candidate` is a review lead, not a confirmed
|
|
80
|
+
vulnerability; do not suppress one merely to clear the gate. Baseline entries
|
|
81
|
+
need a fingerprint, concrete reason, owner, and expiry.
|
|
82
|
+
|
|
83
|
+
## 6. Ship ⏸ human checkpoint
|
|
84
|
+
|
|
85
|
+
Add `"prod"` to `envs`, provision again (prod tenant = the bare `appId`), then:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
npx @odla-ai/cli provision --yes --push-secrets # prod mutation + configured Worker secrets
|
|
89
|
+
npx wrangler deploy
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Verify with `npx @odla-ai/cli smoke --env prod`. Point env vars at the service
|
|
93
|
+
custom domains, never `*.workers.dev` (Workers can't fetch same-account workers.dev).
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# odla SDK cheat-sheet
|
|
2
|
+
|
|
3
|
+
Install only what the app needs. Every package ships an `llms.txt` in
|
|
4
|
+
`node_modules/@odla-ai/<pkg>/` with the full, current API — read it. Minimal
|
|
5
|
+
real usage below.
|
|
6
|
+
|
|
7
|
+
## @odla-ai/db — realtime graph database
|
|
8
|
+
|
|
9
|
+
Data is **namespaces** of rows, declared in `src/odla/schema.mjs`, gated by
|
|
10
|
+
default-deny `src/odla/rules.mjs`. Isomorphic (browser + Worker).
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
// browser client — token from your IdP (Clerk):
|
|
14
|
+
const db = init({ appId, endpoint, getToken });
|
|
15
|
+
const { data } = useQuery({ notes: { $: { order: { createdAt: "asc" } } } });
|
|
16
|
+
transact(db.tx.notes[crypto.randomUUID()].update({ text, createdAt: Date.now() }));
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Worker/admin side: `init({ appId: tenantId, adminToken: env.ODLA_API_KEY, endpoint })`
|
|
20
|
+
— the admin key bypasses rules, so a worker-mediated backend needs none.
|
|
21
|
+
|
|
22
|
+
## @odla-ai/auth-clerk — sign-in (Clerk; runs on Preact or React)
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<ClerkGate publishableKey={pk} appearance={clerkAppearanceFromTokens()}>
|
|
26
|
+
<SignedOut><SignIn routing="hash" /></SignedOut>
|
|
27
|
+
<SignedIn>{/* useClerkAuth().getToken → db init; <UserButton/> signs out */}</SignedIn>
|
|
28
|
+
</ClerkGate>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The publishable key is public; `provision` stores it (`setAuth`). Rules evaluate
|
|
32
|
+
the signed-in user's JWT as `auth` — e.g. `auth.signedIn`, `auth.email`.
|
|
33
|
+
|
|
34
|
+
## @odla-ai/ai — inference (Claude / GPT / Gemini)
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
const { ai } = await initFromPlatform({ platform, appId, env, db });
|
|
38
|
+
await ai.chat({ messages }); // provider/model + key resolved from the platform vault
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
No API key in your code or env — it lives in the tenant vault; `provision`
|
|
42
|
+
stores it when the configured `ai.keyEnv` is set at provision time.
|
|
43
|
+
|
|
44
|
+
## @odla-ai/o11y — observability (Cloudflare Workers)
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
export default withObservability(handler); // traces fetch/cron/bindings
|
|
48
|
+
count("http.requests", 1, { "http.route": path }); // metrics
|
|
49
|
+
recordError(err, { route, code }); // structured errors
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
When `o11y` is in `services`, run
|
|
53
|
+
`npx @odla-ai/cli provision --write-dev-vars --push-secrets`. The CLI enables
|
|
54
|
+
the service, issues or reuses its token, persists it locally, writes
|
|
55
|
+
`.dev.vars`, and transfers `ODLA_O11Y_TOKEN` to the Worker over Wrangler stdin.
|
|
56
|
+
With a token present, the SDK defaults `ODLA_O11Y_ENDPOINT` to
|
|
57
|
+
`https://o11y.odla.ai` and the service label to
|
|
58
|
+
`ODLA_O11Y_SERVICE ?? ODLA_APP_ID`; both remain overrides. First-party hosting
|
|
59
|
+
binds `ODLA_O11Y_COLLECTOR` instead (no public endpoint/token).
|
|
60
|
+
|
|
61
|
+
Source instrumentation remains your job: install the package, wrap with
|
|
62
|
+
`withObservability`, and select useful signals. Never rotate through Studio as
|
|
63
|
+
routine setup. On explicit human request, use
|
|
64
|
+
`provision --rotate-o11y-token --push-secrets` so local and deployed values stay
|
|
65
|
+
in sync.
|
|
66
|
+
|
|
67
|
+
## @odla-ai/security — pre-ship vulnerability harness
|
|
68
|
+
|
|
69
|
+
Run the passive CLI in local/CI development; do not import it into the running
|
|
70
|
+
Worker:
|
|
71
|
+
|
|
72
|
+
Before installing the exact release, require
|
|
73
|
+
`npm view @odla-ai/security@0.1.0 version` to succeed before installing it. An
|
|
74
|
+
exact-version `E404` means the release is unavailable, not that the preflight
|
|
75
|
+
passed, and does not prove the package name is absent.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
npm i -D --save-exact @odla-ai/security@0.1.0
|
|
79
|
+
npx odla-security scan . --profile odla --out .odla/security/pre-ship --fail-on high --fail-on-candidates critical
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Deterministic rules emit leads. Autonomous recon/hunt/validation is an optional
|
|
83
|
+
library flow with separate models, persistent state, and an explicitly injected
|
|
84
|
+
isolated executor; it never falls back to the host shell.
|
|
85
|
+
|
|
86
|
+
## Others
|
|
87
|
+
|
|
88
|
+
- **@odla-ai/ui** — design system: CSS tokens, five themes, component styles,
|
|
89
|
+
chart helpers.
|
|
90
|
+
- **@odla-ai/kg** — ontology-driven knowledge graph: source connectors, LLM
|
|
91
|
+
extraction, provenance-preserving writes.
|
|
92
|
+
- **@odla-ai/blog** — static-first blogging; files in, site out.
|
|
93
|
+
- **@odla-ai/apps** — control-plane SDK (create apps, toggle services); the CLI
|
|
94
|
+
and registry usually handle this for you.
|
|
@@ -5,6 +5,16 @@ description: >
|
|
|
5
5
|
phases, then add a database, Clerk login, and AI. Use when the user wants to
|
|
6
6
|
move a static or GitHub Pages site to Cloudflare/odla, or to add a backend,
|
|
7
7
|
database, login/auth, or AI features to a static site via odla.
|
|
8
|
+
runbookOrder:
|
|
9
|
+
- references/phase-0-preflight.md
|
|
10
|
+
- references/phase-1-static.md
|
|
11
|
+
- references/phase-2-db.md
|
|
12
|
+
- references/phase-3-auth.md
|
|
13
|
+
- references/phase-3b-user-sync.md
|
|
14
|
+
- references/phase-4-ai.md
|
|
15
|
+
- references/phase-5-cutover.md
|
|
16
|
+
- references/troubleshooting.md
|
|
17
|
+
- references/secrets-map.md
|
|
8
18
|
---
|
|
9
19
|
|
|
10
20
|
# odla-migrate
|
|
@@ -15,8 +25,8 @@ handshake approval, DNS). You do everything else.
|
|
|
15
25
|
|
|
16
26
|
## When NOT to use this skill
|
|
17
27
|
|
|
18
|
-
Greenfield odla apps (no existing site to migrate): follow the
|
|
19
|
-
|
|
28
|
+
Greenfield odla apps (no existing site to migrate): read and follow the sibling
|
|
29
|
+
installed skill at `../odla/SKILL.md` instead.
|
|
20
30
|
|
|
21
31
|
## Non-negotiable rules
|
|
22
32
|
|
|
@@ -30,7 +40,11 @@ agent flow" in https://odla.ai/llms.txt instead.
|
|
|
30
40
|
4. Never `git add -A` without reading `git status` first.
|
|
31
41
|
5. Never widen a db rule to silence a 403 — default-deny is the design.
|
|
32
42
|
Any rules change is a human checkpoint.
|
|
33
|
-
6. Never run `provision --rotate-keys`
|
|
43
|
+
6. Never run `provision --rotate-keys` or
|
|
44
|
+
`provision --rotate-o11y-token` unless the human explicitly asks. Pair any
|
|
45
|
+
approved o11y rotation with `--push-secrets` so the Worker is updated in the
|
|
46
|
+
same run. If the final Wrangler transfer fails, use the CLI's printed
|
|
47
|
+
non-rotating `secrets push` retry; never rotate again just to retry delivery.
|
|
34
48
|
|
|
35
49
|
## Phase state machine
|
|
36
50
|
|
|
@@ -42,7 +56,14 @@ Phases run strictly in order; each has a verification gate:
|
|
|
42
56
|
`MIGRATION.md` at the user's repo root is the durable state: create it in
|
|
43
57
|
Phase 0, update it at every gate (phase, what changed, what was verified).
|
|
44
58
|
In a fresh session, read MIGRATION.md first and resume from the recorded
|
|
45
|
-
phase
|
|
59
|
+
phase; `npx @odla-ai/cli doctor` confirms the current config state.
|
|
60
|
+
|
|
61
|
+
## Auth model (one line)
|
|
62
|
+
|
|
63
|
+
Clerk is the **source of truth** for users; odla-db keeps a mirror in the
|
|
64
|
+
app's reserved `$users` namespace (Phase 3 ships login; Phase 3b enables the
|
|
65
|
+
mirror). That per-app `$users` is distinct from odla.ai's own operator
|
|
66
|
+
access list — don't conflate them.
|
|
46
67
|
|
|
47
68
|
## Checkpoint protocol (every phase boundary)
|
|
48
69
|
|
|
@@ -52,18 +73,21 @@ phase. If the CLI offers `odla-ai status`, run it to confirm.
|
|
|
52
73
|
approve, value to paste, command to run themselves).
|
|
53
74
|
3. Wait for explicit approval before entering the next phase.
|
|
54
75
|
|
|
55
|
-
At the very first checkpoint, have the human sign in at https://odla.ai and
|
|
76
|
+
At the very first checkpoint, have the human sign in at https://odla.ai/studio and
|
|
56
77
|
open Docs → "Moving your site to odla" — it explains their side of the whole
|
|
57
78
|
journey in plain language. They need an odla account for the migration anyway,
|
|
58
79
|
so this is a natural first step.
|
|
59
80
|
|
|
60
81
|
## Verification tools
|
|
61
82
|
|
|
62
|
-
- `npx odla-ai
|
|
83
|
+
- `npx @odla-ai/cli capabilities --json` — authoritative automation boundary;
|
|
84
|
+
run once when orienting so source edits and human checkpoints are not confused
|
|
85
|
+
with CLI-owned platform/credential work.
|
|
86
|
+
- `npx @odla-ai/cli doctor` — offline config/schema/rules validation; run
|
|
63
87
|
after any config edit.
|
|
64
|
-
- `npx odla-ai provision --dry-run` — the plan, zero network/file I/O;
|
|
88
|
+
- `npx @odla-ai/cli provision --dry-run` — the plan, zero network/file I/O;
|
|
65
89
|
show it to the human before the first real provision.
|
|
66
|
-
- `npx odla-ai smoke --env dev` — live, read-only: public-config, live
|
|
90
|
+
- `npx @odla-ai/cli smoke --env dev` — live, read-only: public-config, live
|
|
67
91
|
schema diff, a count aggregate. Run after every provision.
|
|
68
92
|
- `wrangler dev` + curl — exercise routes locally before deploying.
|
|
69
93
|
- Parity curls — compare the old and new site on representative paths
|
|
@@ -77,6 +101,7 @@ Read the current phase's file when you enter it — not before:
|
|
|
77
101
|
- references/phase-1-static.md
|
|
78
102
|
- references/phase-2-db.md
|
|
79
103
|
- references/phase-3-auth.md
|
|
104
|
+
- references/phase-3b-user-sync.md (optional: mirror Clerk users into $users)
|
|
80
105
|
- references/phase-4-ai.md
|
|
81
106
|
- references/phase-5-cutover.md
|
|
82
107
|
|
|
@@ -84,8 +109,8 @@ On any failure, read references/troubleshooting.md before improvising.
|
|
|
84
109
|
|
|
85
110
|
## Context bootstrap
|
|
86
111
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
`node_modules/@odla-ai/*/llms.txt` over training memory for
|
|
91
|
-
|
|
112
|
+
This installed skill and its `references/` directory are the complete migration
|
|
113
|
+
runbook; do not fetch a website or private source repository to reconstruct it.
|
|
114
|
+
Read only the current phase file as directed above. After `npm install`, prefer
|
|
115
|
+
`node_modules/@odla-ai/*/llms.txt` over training memory for package APIs — the
|
|
116
|
+
installed artifact is the version this project actually uses.
|
|
@@ -16,8 +16,6 @@ Human obligation: none.
|
|
|
16
16
|
`.github/workflows/*` using deploy-pages.
|
|
17
17
|
- Dynamic wishes: forms posting to third parties, `mailto:` contact,
|
|
18
18
|
localStorage used as a database, TODOs mentioning login/db.
|
|
19
|
-
- If your installed CLI has `npx odla-ai inspect`, run it instead of
|
|
20
|
-
hand-checking; it also does the secret scan below.
|
|
21
19
|
2. Ensure the build outputs to a DEDICATED directory (`dist/`, `_site/`,
|
|
22
20
|
`build/`). If the site is served from the repo root, restructure so a
|
|
23
21
|
build step (even a copy script) produces a clean output dir first.
|
|
@@ -10,9 +10,7 @@ in this session).
|
|
|
10
10
|
## Steps
|
|
11
11
|
|
|
12
12
|
1. `npm i -D wrangler`
|
|
13
|
-
2.
|
|
14
|
-
Otherwise write `wrangler.jsonc` by hand, modeled on
|
|
15
|
-
`examples/demo-app/wrangler.jsonc` in the odla-ai monorepo:
|
|
13
|
+
2. Write `wrangler.jsonc` by hand using this documented shape:
|
|
16
14
|
- `name`: kebab-case app id; `main`: `src/worker.ts`
|
|
17
15
|
- `compatibility_date` (today), `compatibility_flags: ["nodejs_compat"]`
|
|
18
16
|
- `assets: { "directory": "<buildDir>", "binding": "ASSETS",
|
|
@@ -45,4 +43,4 @@ Rollback: delete the dev worker in the Cloudflare dashboard. Pages was
|
|
|
45
43
|
never touched.
|
|
46
44
|
|
|
47
45
|
Done when: parity recorded and the human approves Phase 2 (their next
|
|
48
|
-
obligation: sign in at https://odla.ai and approve a handshake code).
|
|
46
|
+
obligation: sign in at https://odla.ai/studio and approve a handshake code).
|
|
@@ -4,15 +4,22 @@ Goal: the app registered on the platform, a dev odla-db tenant with
|
|
|
4
4
|
schema + deny-all rules, the db key in the dev worker, and first
|
|
5
5
|
`/api/*` routes live in dev.
|
|
6
6
|
|
|
7
|
-
Human obligation: sign in at https://odla.ai and approve the handshake
|
|
7
|
+
Human obligation: sign in at https://odla.ai/studio and approve the handshake
|
|
8
8
|
code when the provision run prints it (it also opens the approval page
|
|
9
9
|
in the browser in interactive terminals).
|
|
10
10
|
|
|
11
11
|
## Steps
|
|
12
12
|
|
|
13
|
-
1. `npm
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
1. Require `npm view @odla-ai/cli@0.5.0 version` to succeed, then run
|
|
14
|
+
`npm i -D --save-exact @odla-ai/cli@0.5.0` and `npm i @odla-ai/db`.
|
|
15
|
+
2. `npx @odla-ai/cli init --app-id <id> --name "<Name>" --env dev --services db`
|
|
16
|
+
Review `odla.config.mjs`. Keep `envs: ["dev"]` — prod is Phase 5. Set
|
|
17
|
+
`links.dev` to the URL the Phase 1 `wrangler deploy` **actually printed** —
|
|
18
|
+
copy it from that output and `curl` it (200) before pasting. NEVER predict or
|
|
19
|
+
remember a workers.dev URL; the worker name and account subdomain must match
|
|
20
|
+
exactly or Studio links to a dead URL. Provision records it so Studio and
|
|
21
|
+
public-config show where the app runs. (`links.prod` is set the same way at
|
|
22
|
+
Phase 5, from the prod deploy's printed URL.)
|
|
16
23
|
3. STOP before touching schema: read "Porting relational code" in
|
|
17
24
|
`node_modules/@odla-ai/db/llms.txt`. The traps are silent: entity ids
|
|
18
25
|
are not attrs (mirror an id attr), there is no NULL (omit on write,
|
|
@@ -23,16 +30,15 @@ in the browser in interactive terminals).
|
|
|
23
30
|
generated deny-all `src/odla/rules.mjs`: the worker mediates all
|
|
24
31
|
access with its app key (which bypasses rules); browsers get nothing
|
|
25
32
|
directly. Loosening a rule is a human checkpoint.
|
|
26
|
-
5. `npx odla-ai doctor` until clean.
|
|
27
|
-
6. `npx odla-ai provision --dry-run` — show the plan to the human.
|
|
28
|
-
7. `npx odla-ai provision --write-dev-vars` — handshake,
|
|
29
|
-
registration, dev db key, schema + rules push; writes
|
|
30
|
-
`.odla/credentials.local.json` (0600) and `.dev.vars
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
`npx odla-ai secrets push --env dev`
|
|
34
|
-
|
|
35
|
-
manual fallback: references/secrets-map.md).
|
|
33
|
+
5. `npx @odla-ai/cli doctor` until clean.
|
|
34
|
+
6. `npx @odla-ai/cli provision --dry-run` — show the plan to the human.
|
|
35
|
+
7. `npx @odla-ai/cli provision --write-dev-vars --push-secrets` — handshake,
|
|
36
|
+
app registration, dev db key, schema + rules push; writes
|
|
37
|
+
`.odla/credentials.local.json` (0600) and `.dev.vars`, then pipes configured
|
|
38
|
+
Worker secrets to Wrangler over stdin. Both local files are gitignored by
|
|
39
|
+
init — confirm with `git status`. Use
|
|
40
|
+
`npx @odla-ai/cli secrets push --env dev` only to retry the secret-transfer
|
|
41
|
+
portion (details and manual fallback: references/secrets-map.md).
|
|
36
42
|
9. Add to `wrangler.jsonc` `env.dev.vars`: `ODLA_ENDPOINT`
|
|
37
43
|
("https://db.odla.ai"), `ODLA_TENANT` ("<appId>--dev"),
|
|
38
44
|
`ODLA_PLATFORM` ("https://odla.ai"), `ODLA_APP_ID`, `ODLA_ENV`
|
|
@@ -40,15 +46,17 @@ in the browser in interactive terminals).
|
|
|
40
46
|
Phase 5. These are vars, not secrets.
|
|
41
47
|
10. Add `/api/*` routes before the assets fall-through, using
|
|
42
48
|
`init({ appId: env.ODLA_TENANT, adminToken: env.ODLA_API_KEY,
|
|
43
|
-
endpoint: env.ODLA_ENDPOINT })` from `@odla-ai/db`.
|
|
44
|
-
`
|
|
49
|
+
endpoint: env.ODLA_ENDPOINT })` from `@odla-ai/db`. Read the installed
|
|
50
|
+
package's `node_modules/@odla-ai/db/llms.txt` for query, transaction, and
|
|
51
|
+
error contracts.
|
|
45
52
|
11. `wrangler dev` + curl each route; then `npm run deploy:app:dev` and
|
|
46
53
|
curl the workers.dev URL.
|
|
47
54
|
|
|
48
55
|
## Verification checklist
|
|
49
56
|
|
|
50
|
-
- [ ] `npx odla-ai smoke --env dev` passes (public-config, schema, aggregate)
|
|
57
|
+
- [ ] `npx @odla-ai/cli smoke --env dev` passes (public-config, schema, aggregate)
|
|
51
58
|
- [ ] Routes work locally and on the deployed dev worker
|
|
59
|
+
- [ ] `links.dev` set — public-config carries the URL and Studio shows it
|
|
52
60
|
- [ ] `git status` shows no credential files staged
|
|
53
61
|
- [ ] MIGRATION.md updated with tenant id + route list
|
|
54
62
|
|