@quickback-dev/cli 0.70.45 → 0.72.2
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/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +10 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +7 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +6 -5
- package/dist/commands/mcp.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/access-manifest-diff.d.ts +6 -0
- package/dist/lib/access-manifest-diff.d.ts.map +1 -1
- package/dist/lib/access-manifest-diff.js +10 -0
- package/dist/lib/access-manifest-diff.js.map +1 -1
- package/dist/lib/action-harvest.d.ts.map +1 -1
- package/dist/lib/action-harvest.js +36 -0
- package/dist/lib/action-harvest.js.map +1 -1
- package/dist/lib/api-client.d.ts +8 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/deployment-target.d.ts +13 -0
- package/dist/lib/deployment-target.d.ts.map +1 -1
- package/dist/lib/deployment-target.js +4 -0
- package/dist/lib/deployment-target.js.map +1 -1
- package/dist/lib/file-loader.d.ts +22 -0
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +80 -18
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/file-writer.js +9 -0
- package/dist/lib/file-writer.js.map +1 -1
- package/dist/lib/harness.d.ts +10 -0
- package/dist/lib/harness.d.ts.map +1 -1
- package/dist/lib/harness.js +31 -0
- package/dist/lib/harness.js.map +1 -1
- package/dist/lib/migrations/executor.js +5 -1
- package/dist/lib/migrations/executor.js.map +1 -1
- package/dist/lib/migrations/plan.js +3 -0
- package/dist/lib/migrations/plan.js.map +1 -1
- package/dist/lib/migrations/postprocessors/index.d.ts.map +1 -1
- package/dist/lib/migrations/postprocessors/index.js +23 -2
- package/dist/lib/migrations/postprocessors/index.js.map +1 -1
- package/dist/lib/migrations/postprocessors/tenant-bundle.d.ts +30 -0
- package/dist/lib/migrations/postprocessors/tenant-bundle.d.ts.map +1 -0
- package/dist/lib/migrations/postprocessors/tenant-bundle.js +109 -0
- package/dist/lib/migrations/postprocessors/tenant-bundle.js.map +1 -0
- package/dist/lib/migrations/prior-state.d.ts +13 -1
- package/dist/lib/migrations/prior-state.d.ts.map +1 -1
- package/dist/lib/migrations/prior-state.js +33 -2
- package/dist/lib/migrations/prior-state.js.map +1 -1
- package/dist/lib/migrations/types.d.ts +2 -2
- package/dist/lib/migrations/types.d.ts.map +1 -1
- package/dist/lib/migrations/types.js +3 -0
- package/dist/lib/migrations/types.js.map +1 -1
- package/dist/lib/wrangler-resources.d.ts +14 -1
- package/dist/lib/wrangler-resources.d.ts.map +1 -1
- package/dist/lib/wrangler-resources.js +29 -7
- package/dist/lib/wrangler-resources.js.map +1 -1
- package/dist/skill/docs/api/actions.md +73 -2
- package/dist/skill/docs/api/batch-operations.md +2 -0
- package/dist/skill/docs/api/caching.md +2 -2
- package/dist/skill/docs/api/crud.md +13 -0
- package/dist/skill/docs/api/errors.md +111 -10
- package/dist/skill/docs/api/index.md +24 -0
- package/dist/skill/docs/api/openapi.md +8 -0
- package/dist/skill/docs/api/query-params.md +6 -0
- package/dist/skill/docs/configure/agents.md +73 -1
- package/dist/skill/docs/configure/auth.md +7 -1
- package/dist/skill/docs/configure/bindings.md +55 -0
- package/dist/skill/docs/configure/cloudflare-access.md +191 -0
- package/dist/skill/docs/configure/domains.md +1 -1
- package/dist/skill/docs/configure/index.md +4 -2
- package/dist/skill/docs/configure/providers.md +2 -1
- package/dist/skill/docs/configure/tenancy.md +3 -0
- package/dist/skill/docs/configure/tenant-databases.md +2407 -0
- package/dist/skill/docs/define/access.md +33 -1
- package/dist/skill/docs/define/actions/defining.md +118 -1
- package/dist/skill/docs/define/actions/scoped-db.md +32 -8
- package/dist/skill/docs/define/areas.md +145 -2
- package/dist/skill/docs/define/diagnostics.md +160 -21
- package/dist/skill/docs/define/encryption.md +13 -2
- package/dist/skill/docs/define/fga.md +320 -42
- package/dist/skill/docs/define/firewall.md +4 -0
- package/dist/skill/docs/define/index.md +1 -0
- package/dist/skill/docs/define/read.md +39 -0
- package/dist/skill/docs/define/relationships.md +30 -12
- package/dist/skill/docs/define/schema.md +2 -0
- package/dist/skill/docs/define/scopes.md +393 -9
- package/dist/skill/docs/define/sealed-protocol.md +67 -12
- package/dist/skill/docs/define/transitions.md +4 -1
- package/dist/skill/docs/define/triggers.md +55 -1
- package/dist/skill/docs/platform/api-contract/index.md +4 -2
- package/dist/skill/docs/platform/auth/jwt-optimization.md +13 -1
- package/dist/skill/docs/platform/auth/using-auth.md +1 -1
- package/dist/skill/docs/platform/database/d1.md +112 -3
- package/dist/skill/docs/platform/database/data-migrations.md +3 -1
- package/dist/skill/docs/platform/database/neon.md +10 -2
- package/dist/skill/docs/platform/queues/handlers.md +48 -16
- package/dist/skill/docs/platform/queues/using-queues.md +16 -0
- package/dist/skill/docs/platform/realtime/durable-objects.md +285 -17
- package/dist/skill/docs/platform/realtime/index.md +9 -6
- package/dist/skill/docs/platform/realtime/named-invalidations.md +3 -1
- package/dist/skill/docs/platform/realtime/using-realtime.md +28 -3
- package/dist/skill/docs/platform/schedules/index.md +1 -1
- package/dist/skill/docs/platform/storage/r2.md +10 -1
- package/dist/skill/docs/platform/storage/using-r2.md +42 -1
- package/dist/skill/docs/tooling/output.md +9 -2
- package/dist/skill/docs/ui/account/features/admin.md +5 -3
- package/dist/skill/docs/ui/account/hooks.md +9 -2
- package/dist/skill/docs/ui/admin/index.md +1 -1
- package/package.json +1 -1
- package/src/skill/docs/api/actions.md +73 -2
- package/src/skill/docs/api/batch-operations.md +2 -0
- package/src/skill/docs/api/caching.md +2 -2
- package/src/skill/docs/api/crud.md +13 -0
- package/src/skill/docs/api/errors.md +111 -10
- package/src/skill/docs/api/index.md +24 -0
- package/src/skill/docs/api/openapi.md +8 -0
- package/src/skill/docs/api/query-params.md +6 -0
- package/src/skill/docs/configure/agents.md +73 -1
- package/src/skill/docs/configure/auth.md +7 -1
- package/src/skill/docs/configure/bindings.md +55 -0
- package/src/skill/docs/configure/cloudflare-access.md +191 -0
- package/src/skill/docs/configure/domains.md +1 -1
- package/src/skill/docs/configure/index.md +4 -2
- package/src/skill/docs/configure/providers.md +2 -1
- package/src/skill/docs/configure/tenancy.md +3 -0
- package/src/skill/docs/configure/tenant-databases.md +2407 -0
- package/src/skill/docs/define/access.md +33 -1
- package/src/skill/docs/define/actions/defining.md +118 -1
- package/src/skill/docs/define/actions/scoped-db.md +32 -8
- package/src/skill/docs/define/areas.md +145 -2
- package/src/skill/docs/define/diagnostics.md +160 -21
- package/src/skill/docs/define/encryption.md +13 -2
- package/src/skill/docs/define/fga.md +320 -42
- package/src/skill/docs/define/firewall.md +4 -0
- package/src/skill/docs/define/index.md +1 -0
- package/src/skill/docs/define/read.md +39 -0
- package/src/skill/docs/define/relationships.md +30 -12
- package/src/skill/docs/define/schema.md +2 -0
- package/src/skill/docs/define/scopes.md +393 -9
- package/src/skill/docs/define/sealed-protocol.md +67 -12
- package/src/skill/docs/define/transitions.md +4 -1
- package/src/skill/docs/define/triggers.md +55 -1
- package/src/skill/docs/platform/api-contract/index.md +4 -2
- package/src/skill/docs/platform/auth/jwt-optimization.md +13 -1
- package/src/skill/docs/platform/auth/using-auth.md +1 -1
- package/src/skill/docs/platform/database/d1.md +112 -3
- package/src/skill/docs/platform/database/data-migrations.md +3 -1
- package/src/skill/docs/platform/database/neon.md +10 -2
- package/src/skill/docs/platform/queues/handlers.md +48 -16
- package/src/skill/docs/platform/queues/using-queues.md +16 -0
- package/src/skill/docs/platform/realtime/durable-objects.md +285 -17
- package/src/skill/docs/platform/realtime/index.md +9 -6
- package/src/skill/docs/platform/realtime/named-invalidations.md +3 -1
- package/src/skill/docs/platform/realtime/using-realtime.md +28 -3
- package/src/skill/docs/platform/schedules/index.md +1 -1
- package/src/skill/docs/platform/storage/r2.md +10 -1
- package/src/skill/docs/platform/storage/using-r2.md +42 -1
- package/src/skill/docs/tooling/output.md +9 -2
- package/src/skill/docs/ui/account/features/admin.md +5 -3
- package/src/skill/docs/ui/account/hooks.md +9 -2
- package/src/skill/docs/ui/admin/index.md +1 -1
- package/dist/codex/AGENTS.md +0 -290
- package/dist/commands/build.test.d.ts.map +0 -1
- package/dist/commands/codex.d.ts +0 -16
- package/dist/commands/codex.d.ts.map +0 -1
- package/dist/commands/codex.js +0 -159
- package/dist/commands/codex.js.map +0 -1
- package/dist/commands/compile.d.ts +0 -62
- package/dist/commands/compile.d.ts.map +0 -1
- package/dist/commands/compile.js +0 -830
- package/dist/commands/compile.js.map +0 -1
- package/dist/commands/compile.test.d.ts.map +0 -1
- package/dist/commands/init.d.ts +0 -6
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -405
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/migrate.test.d.ts.map +0 -1
- package/dist/commands/migrations.test.d.ts.map +0 -1
- package/dist/commands/push.test.d.ts.map +0 -1
- package/dist/commands/schema.test.d.ts.map +0 -1
- package/dist/docs/content.d.ts +0 -7
- package/dist/docs/content.d.ts.map +0 -1
- package/dist/docs/content.js +0 -672
- package/dist/docs/content.js.map +0 -1
- package/dist/docs/index.test.d.ts.map +0 -1
- package/dist/lib/action-harvest.test.d.ts.map +0 -1
- package/dist/lib/api-client.test.d.ts.map +0 -1
- package/dist/lib/artifact-routing.test.d.ts.map +0 -1
- package/dist/lib/auth.test.d.ts.map +0 -1
- package/dist/lib/compile-next-steps.test.d.ts.map +0 -1
- package/dist/lib/compiler-floor.test.d.ts.map +0 -1
- package/dist/lib/config-id-splice.test.d.ts.map +0 -1
- package/dist/lib/config-sync.test.d.ts.map +0 -1
- package/dist/lib/copy-public-assets.test.d.ts.map +0 -1
- package/dist/lib/copy-source-apps.test.d.ts.map +0 -1
- package/dist/lib/drizzle-meta-routing.test.d.ts.map +0 -1
- package/dist/lib/file-loader-typescript-fallback.test.d.ts.map +0 -1
- package/dist/lib/file-loader.test.d.ts.map +0 -1
- package/dist/lib/file-writer.test.d.ts.map +0 -1
- package/dist/lib/helpers.d.ts +0 -39
- package/dist/lib/helpers.d.ts.map +0 -1
- package/dist/lib/helpers.js +0 -299
- package/dist/lib/helpers.js.map +0 -1
- package/dist/lib/migrations/drizzle-prompts.test.d.ts.map +0 -1
- package/dist/lib/migrations/drizzle.test.d.ts.map +0 -1
- package/dist/lib/migrations/executor.test.d.ts.map +0 -1
- package/dist/lib/migrations/inventory.test.d.ts.map +0 -1
- package/dist/lib/migrations/lock.test.d.ts.map +0 -1
- package/dist/lib/migrations/paths.test.d.ts.map +0 -1
- package/dist/lib/migrations/plan.test.d.ts.map +0 -1
- package/dist/lib/migrations/postprocessors/index.test.d.ts.map +0 -1
- package/dist/lib/migrations/prompt-runner.test.d.ts.map +0 -1
- package/dist/lib/migrations/staging.test.d.ts.map +0 -1
- package/dist/lib/neon-canary.test.d.ts.map +0 -1
- package/dist/lib/neon-target.test.d.ts.map +0 -1
- package/dist/lib/neon.test.d.ts.map +0 -1
- package/dist/lib/prepare-output.test.d.ts.map +0 -1
- package/dist/lib/prepare-state-output.test.d.ts.map +0 -1
- package/dist/lib/schema-sync/index.test.d.ts.map +0 -1
- package/dist/lib/shell.test.d.ts.map +0 -1
- package/dist/lib/sweep-stale.d.ts +0 -25
- package/dist/lib/sweep-stale.d.ts.map +0 -1
- package/dist/lib/sweep-stale.js +0 -179
- package/dist/lib/sweep-stale.js.map +0 -1
- package/dist/lib/sweep-stale.test.d.ts.map +0 -1
- package/dist/lib/wrangler-resources.test.d.ts.map +0 -1
|
@@ -36,7 +36,7 @@ When `auth.admin` is `false` (the default), the admin surface does not exist for
|
|
|
36
36
|
- **Create an organization** — you name the **owner**; the operator creating it is deliberately not seated (see below)
|
|
37
37
|
- **Seat, re-role and remove members** — manage a tenant's roster without joining it
|
|
38
38
|
|
|
39
|
-
These run on `/auth/v1/admin
|
|
39
|
+
These run on `/api/v1/operator/organizations` (under `/auth/v1/admin/*` before 0.72; see [Moved routes](/api#moved-routes-072)), emitted by Quickback because Better Auth's organization plugin cannot serve them: every one of its endpoints resolves through the *caller's* membership, and an operator administers organizations it does not belong to. Put them behind [Cloudflare Access](/configure/cloudflare-access#the-operator-plane) with one path rule.
|
|
40
40
|
|
|
41
41
|
> **Users sign themselves up.** Self-serve signup stays on — a new account simply has no organization, and lands on a screen saying so until someone invites or seats them. What operators control is *organizations*, not accounts.
|
|
42
42
|
|
|
@@ -56,7 +56,7 @@ The admin panel is restricted to platform roles on the Better Auth user record:
|
|
|
56
56
|
>
|
|
57
57
|
> Equal tier is allowed, so an appmanager can still make another appmanager (the example below). Only a `sysadmin` can grant `sysadmin`.
|
|
58
58
|
>
|
|
59
|
-
>
|
|
59
|
+
> Seating a member (`PUT /api/v1/operator/organizations/:id/members/:userId`) refuses to seat its caller with `403 OPERATOR_SELF_SEAT`: operators are never seated by their own control-plane calls.
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
To grant operator access to a user:
|
|
@@ -89,7 +89,7 @@ providers: {
|
|
|
89
89
|
},
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
With it on, an `appmanager` or `sysadmin` whose session was **not** established by a passkey assertion or a two-factor verification is treated as a plain `user` for that request. Every operator surface refuses with `403 MFA_REQUIRED`: the CMS and `/api/v1/schema`, the `/
|
|
92
|
+
With it on, an `appmanager` or `sysadmin` whose session was **not** established by a passkey assertion or a two-factor verification is treated as a plain `user` for that request. Every operator surface refuses with `403 MFA_REQUIRED`: the CMS and `/api/v1/schema`, the `/api/v1/operator/*` routes, Better Auth's own admin endpoints (`list-users`, `set-role`, `ban-user`), and the sysadmin cross-tenant bypass. The Account UI keeps working, so the enrolment path is short:
|
|
93
93
|
|
|
94
94
|
1. Sign in with a password (or magic link / OTP) as usual.
|
|
95
95
|
2. Register a passkey at `/account/passkeys/setup`.
|
|
@@ -97,6 +97,8 @@ With it on, an `appmanager` or `sysadmin` whose session was **not** established
|
|
|
97
97
|
|
|
98
98
|
How it works: the compiler adds a `session.amr` column (RFC 8176, *Authentication Methods Reference*) and a `session.create.before` hook that stamps `passkey` when the session comes from `/passkey/verify-authentication` and `mfa` when it comes from `/two-factor/verify-*`. Nothing else sets it, and it is not client-settable. The auth middleware reads it on the session lane and copies it into the JWT fast-path claims, so bearer callers are gated identically.
|
|
99
99
|
|
|
100
|
+
Cloudflare Access is recommended additionally for `/api/v1/operator`. It does not replace `operatorMfa`: Better Auth admin endpoints and the other operator powers still need the application second factor. Configuring Access with `operatorMfa` off emits a compile warning.
|
|
101
|
+
|
|
100
102
|
Things to know:
|
|
101
103
|
|
|
102
104
|
- **Requires `passkey` or `twoFactor`.** The compile fails otherwise: without a second factor to enrol, every operator would be locked out.
|
|
@@ -142,6 +142,10 @@ before calling `quickback/hooks/resolve-oauth-context.ts`. Use this trusted
|
|
|
142
142
|
server hook when tenant selection cannot be derived solely from the session's
|
|
143
143
|
active organization.
|
|
144
144
|
|
|
145
|
+
It never runs for an [instance-bound token](/define/scopes#instance-bound-oauth-tokens)
|
|
146
|
+
(audience = a scope kind's resource): that principal is confined to one
|
|
147
|
+
instance and gets no tenant context.
|
|
148
|
+
|
|
145
149
|
```ts title="quickback/hooks/resolve-oauth-context.ts"
|
|
146
150
|
import type { OAuthContextResolver } from '@quickback/compiler';
|
|
147
151
|
|
|
@@ -328,7 +332,7 @@ type HookCtx = {
|
|
|
328
332
|
};
|
|
329
333
|
```
|
|
330
334
|
|
|
331
|
-
`authDb` is the
|
|
335
|
+
`authDb` is the Drizzle connection to the auth DB. Read through it freely; for writes, prefer Better Auth's API (`auth.api.*`; `ctx.auth` in actions), which runs Better Auth's own hooks and revokes sessions. A direct insert, update, or delete on a Better Auth table is flagged [`ACTION_AUTH_DB_WRITE`](/define/diagnostics#action_auth_db_write) — in `hooks/` as a **warning**, never a compile error. Where no endpoint fits, such as the server-side org create below (see the [CSRF caveat](#csrf-caveat-server-side-org-create)), keep the write and mark it with `// quickback-allow ACTION_AUTH_DB_WRITE: <reason>`. `authSchema` is the namespace export of the generated auth schema module; destructure the tables you need.
|
|
332
336
|
|
|
333
337
|
This injection is unique to account hooks. Actions reach AUTH_DB via `c.get("authDb")` ([Scoped DB](/define/actions/scoped-db#reaching-better-auth-tables-authdb)). Trigger handlers on a table file get neither — use `ctx` for the acting user, and do not import `../../auth/schema` from the table file.
|
|
334
338
|
|
|
@@ -393,6 +397,7 @@ export default async (user, { authDb, authSchema }) => {
|
|
|
393
397
|
.where(eq(organization.id, orgId));
|
|
394
398
|
if (existing.length > 0) return;
|
|
395
399
|
|
|
400
|
+
// quickback-allow ACTION_AUTH_DB_WRITE: server-side org create has no Origin for auth.api.createOrganization
|
|
396
401
|
await authDb.insert(organization).values({
|
|
397
402
|
id: orgId,
|
|
398
403
|
name: `${user.name ?? 'Personal'} Workspace`,
|
|
@@ -400,6 +405,7 @@ export default async (user, { authDb, authSchema }) => {
|
|
|
400
405
|
createdAt: new Date(),
|
|
401
406
|
});
|
|
402
407
|
|
|
408
|
+
// quickback-allow ACTION_AUTH_DB_WRITE: membership for the org created above, same reason
|
|
403
409
|
await authDb.insert(member).values({
|
|
404
410
|
id: crypto.randomUUID(),
|
|
405
411
|
userId: user.id,
|
|
@@ -430,6 +436,7 @@ export default async (newSession, { authDb, authSchema }) => {
|
|
|
430
436
|
|
|
431
437
|
if (memberships.length === 0) return;
|
|
432
438
|
|
|
439
|
+
// quickback-allow ACTION_AUTH_DB_WRITE: setActiveOrganization needs a request; this hook has none
|
|
433
440
|
await authDb
|
|
434
441
|
.update(session)
|
|
435
442
|
.set({ activeOrganizationId: memberships[0].organizationId })
|
|
@@ -458,7 +465,7 @@ The compiler-generated wrapper merges your `data` onto the original entity, so y
|
|
|
458
465
|
|
|
459
466
|
`POST /auth/v1/organization/create` (and Better Auth's `auth.api.createOrganization(...)` server helper) require an `Origin` header. A hook running inside `databaseHooks.user.create.after` is server-side — there is no incoming request, so no `Origin`. Calling those APIs from a hook may also validate `Origin` internally and reject.
|
|
460
467
|
|
|
461
|
-
**
|
|
468
|
+
**Here, direct Drizzle writes via `authDb` are the working path.** Mark each with `// quickback-allow ACTION_AUTH_DB_WRITE: <reason>` so the warning records why. Treat the org/member tables as your source of truth and let the SPA call the BA API for user-initiated org creation.
|
|
462
469
|
|
|
463
470
|
## Generated output
|
|
464
471
|
|
|
@@ -217,7 +217,7 @@ The shell is served to any signed-in caller, and the SPA resolves one of six sta
|
|
|
217
217
|
| State | Screen |
|
|
218
218
|
|-------|--------|
|
|
219
219
|
| Not signed in | Redirect to sign-in (the one redirect that remains — it is where you were going anyway) |
|
|
220
|
-
| `sysadmin`, no tenant chosen | Tenant picker, filterable, with **All organizations** as a first-class choice |
|
|
220
|
+
| `sysadmin`, no tenant chosen | Tenant picker (from `GET /api/v1/operator/organizations`), filterable, with **All organizations** as a first-class choice |
|
|
221
221
|
| `sysadmin`, tenant chosen | The CMS, scoped to that tenant |
|
|
222
222
|
| `appmanager`, `access: "sysadmin"` | *"The CMS shows organization data"* → **Go to admin** |
|
|
223
223
|
| Anyone else, `access: "sysadmin"` | *"This CMS is restricted"* — names the config value that would admit them |
|
package/dist/codex/AGENTS.md
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
# Quickback
|
|
2
|
-
|
|
3
|
-
Quickback is two things:
|
|
4
|
-
|
|
5
|
-
1. **Compiler** — Transforms declarative TypeScript definitions into secure, production-ready APIs
|
|
6
|
-
2. **Stack** — A Supabase alternative running entirely on Cloudflare (D1, R2, KV, Durable Objects, Queues, Workers AI)
|
|
7
|
-
|
|
8
|
-
The output is standard TypeScript (Hono, Drizzle, Better Auth) running on your own infrastructure.
|
|
9
|
-
|
|
10
|
-
## Project Structure
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
my-app/
|
|
14
|
-
├── quickback/
|
|
15
|
-
│ ├── quickback.config.ts
|
|
16
|
-
│ └── features/
|
|
17
|
-
│ └── {feature-name}/
|
|
18
|
-
│ ├── {table}.ts # Schema + security (defineTable)
|
|
19
|
-
│ ├── actions/ # One file per action — defineAction({...}) (optional)
|
|
20
|
-
│ │ ├── {action}.ts # Binds to primary table (or standalone if path: is set)
|
|
21
|
-
│ │ └── {table}/{action}.ts # Binds to sibling <table>.ts (multi-table features)
|
|
22
|
-
│ └── lib/ # Feature-local helpers, copied verbatim (optional)
|
|
23
|
-
└── ...
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## quickback.config.ts
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
import { defineConfig, defineRuntime, defineDatabase, defineAuth } from '@quickback/compiler';
|
|
30
|
-
|
|
31
|
-
export default defineConfig({
|
|
32
|
-
name: "my-saas-app",
|
|
33
|
-
providers: {
|
|
34
|
-
runtime: defineRuntime("cloudflare"),
|
|
35
|
-
database: defineDatabase("cloudflare-d1"),
|
|
36
|
-
auth: defineAuth("better-auth"),
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Automatic Audit Fields
|
|
42
|
-
|
|
43
|
-
Quickback auto-injects: `createdAt`, `modifiedAt`, `deletedAt`, `createdBy`, `modifiedBy`, `deletedBy`. Do NOT define these in schemas.
|
|
44
|
-
|
|
45
|
-
## defineTable() — Schema + Security
|
|
46
|
-
|
|
47
|
-
Each feature file exports a Drizzle table and a `defineTable()` default export with security config:
|
|
48
|
-
|
|
49
|
-
```typescript
|
|
50
|
-
import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
|
|
51
|
-
import { defineTable } from "@quickback/compiler";
|
|
52
|
-
|
|
53
|
-
export const todos = sqliteTable("todos", {
|
|
54
|
-
id: integer("id").primaryKey(),
|
|
55
|
-
title: text("title").notNull(),
|
|
56
|
-
description: text("description"),
|
|
57
|
-
completed: integer("completed", { mode: "boolean" }).default(false),
|
|
58
|
-
userId: text("user_id").notNull(),
|
|
59
|
-
organizationId: text("organization_id").notNull(),
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export default defineTable(todos, {
|
|
63
|
-
firewall: [
|
|
64
|
-
{ field: "organizationId", equals: "ctx.activeOrgId" },
|
|
65
|
-
{ field: "userId", equals: "ctx.userId" },
|
|
66
|
-
{ field: "deletedAt", isNull: true },
|
|
67
|
-
],
|
|
68
|
-
read: { access: { roles: ["member", "admin"] } },
|
|
69
|
-
create: { access: { roles: ["member", "admin"] } },
|
|
70
|
-
update: { access: { roles: ["admin"] } },
|
|
71
|
-
delete: { access: { roles: ["admin"] }, mode: "soft" },
|
|
72
|
-
guards: {
|
|
73
|
-
createable: ["title", "description", "completed"],
|
|
74
|
-
updatable: ["title", "description", "completed"],
|
|
75
|
-
},
|
|
76
|
-
masking: {
|
|
77
|
-
userId: { type: "redact", show: { roles: ["admin"] } },
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Four Security Layers
|
|
83
|
-
|
|
84
|
-
Every request passes through: `Request → Firewall → Access → Guards → Database → Masking → Response`
|
|
85
|
-
|
|
86
|
-
### 1. Firewall — Data Isolation
|
|
87
|
-
|
|
88
|
-
Auto WHERE clauses for tenant isolation. Predicates are AND'd:
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
firewall: [
|
|
92
|
-
{ field: 'organizationId', equals: 'ctx.activeOrgId' }, // WHERE organizationId = ctx.activeOrgId
|
|
93
|
-
{ field: 'ownerId', equals: 'ctx.userId' }, // AND ownerId = ctx.userId
|
|
94
|
-
{ field: 'teamId', equals: 'ctx.activeTeamId' }, // AND teamId = ctx.activeTeamId
|
|
95
|
-
{ field: 'deletedAt', isNull: true }, // AND deletedAt IS NULL
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
// Public/system resources opt out of tenant scoping (soft-delete still applied):
|
|
99
|
-
firewall: [{ exception: true }]
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Auto-derived when omitted: scans the schema for `organizationId` / `ownerId` / `teamId` and emits matching predicates. Two or more isolation columns → declare explicitly.
|
|
103
|
-
|
|
104
|
-
### 2. Access — Permission Checks
|
|
105
|
-
|
|
106
|
-
Role-based and record-based (deny by default). Reads (`GET /` and `GET /:id`) gate via `read.access`; mutations gate via `create.access`, `update.access`, `delete.access`, and `upsert.access`.
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
read: { access: { roles: ['member'] } }, // gates GET / and GET /:id
|
|
110
|
-
create: { access: { roles: ['admin'] } },
|
|
111
|
-
update: {
|
|
112
|
-
access: {
|
|
113
|
-
or: [
|
|
114
|
-
{ roles: ['admin'] },
|
|
115
|
-
{ record: { createdBy: { equals: '$ctx.userId' } } },
|
|
116
|
-
],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
delete: { access: { roles: ['admin'] } },
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
> **DSL v2:** `crud.list` and `crud.get` are rejected at compile time. Move them to `read.access`.
|
|
123
|
-
|
|
124
|
-
Operators: `equals`, `notEquals`, `in`, `notIn`, `greaterThan`, `lessThan`
|
|
125
|
-
Context: `$ctx.userId`, `$ctx.activeOrgId`, `$ctx.roles`
|
|
126
|
-
|
|
127
|
-
### 3. Guards — Field Protection
|
|
128
|
-
|
|
129
|
-
```typescript
|
|
130
|
-
guards: {
|
|
131
|
-
createable: ['name', 'description'],
|
|
132
|
-
updatable: ['description'],
|
|
133
|
-
immutable: ['invoiceNumber'],
|
|
134
|
-
protected: { status: ['approve'] }, // Only via named actions
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 4. Masking — PII Redaction
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
masking: {
|
|
142
|
-
ssn: { type: 'ssn', show: { roles: ['admin'] } },
|
|
143
|
-
email: { type: 'email', show: { roles: ['admin'], or: 'owner' } },
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Types: `email`, `phone`, `ssn`, `creditCard`, `name`, `redact`, `custom`
|
|
148
|
-
|
|
149
|
-
## Views — Column Projections
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
views: {
|
|
153
|
-
summary: { fields: ['id', 'name'], access: { roles: ['member'] } },
|
|
154
|
-
full: { fields: ['id', 'name', 'phone', 'ssn'], access: { roles: ['admin'] } },
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
## Validation
|
|
159
|
-
|
|
160
|
-
```typescript
|
|
161
|
-
validation: {
|
|
162
|
-
name: { minLength: 1, maxLength: 100 },
|
|
163
|
-
capacity: { min: 1, max: 1000 },
|
|
164
|
-
roomType: { enum: ['meeting', 'conference'] },
|
|
165
|
-
email: { email: true },
|
|
166
|
-
}
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
## Actions — Custom Business Logic
|
|
170
|
-
|
|
171
|
-
One file per action under `actions/<name>.ts`. The filename is the action name AND URL segment. `actions/<name>.ts` binds to the feature's primary table; `actions/<table>/<name>.ts` binds to a sibling table. Setting `path:` makes the action standalone.
|
|
172
|
-
|
|
173
|
-
```typescript
|
|
174
|
-
// features/todos/actions/complete.ts
|
|
175
|
-
import { z } from "zod";
|
|
176
|
-
import { eq } from "drizzle-orm";
|
|
177
|
-
import { defineAction } from "../.quickback/define-action";
|
|
178
|
-
import { todos } from "../todos";
|
|
179
|
-
|
|
180
|
-
export default defineAction({
|
|
181
|
-
description: "Mark todo as complete",
|
|
182
|
-
input: z.object({ completedAt: z.string().datetime().optional() }),
|
|
183
|
-
access: { roles: ["member", "admin"], record: { completed: { equals: false } } },
|
|
184
|
-
async execute({ db, record, auditFields }) {
|
|
185
|
-
await db.update(todos)
|
|
186
|
-
.set({ completed: true, modifiedAt: auditFields!.modifiedAt })
|
|
187
|
-
.where(eq(todos.id, record.id));
|
|
188
|
-
return { success: true };
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
Record-based (no `path:`): `POST /api/v1/{resource}/:id/{action}`
|
|
194
|
-
Standalone (`path:` set): custom `path` and `method`
|
|
195
|
-
|
|
196
|
-
`execute:` must be an `async (ctx) => { … }` arrow function. Retired (rejected at load time): bundled `actions.ts`, `_feature.ts`, `handlers/` directory, `defineActions()`.
|
|
197
|
-
|
|
198
|
-
### Actions-Only Features (no tables)
|
|
199
|
-
|
|
200
|
-
A feature with no top-level `*.ts` files is "tableless" — every action must be standalone (have `path:`).
|
|
201
|
-
|
|
202
|
-
```typescript
|
|
203
|
-
// quickback/features/utilities/actions/health-check.ts
|
|
204
|
-
import { z } from "zod";
|
|
205
|
-
import { defineAction } from "../.quickback/define-action";
|
|
206
|
-
|
|
207
|
-
export default defineAction({
|
|
208
|
-
description: "Health check",
|
|
209
|
-
path: "/health",
|
|
210
|
-
method: "GET",
|
|
211
|
-
input: z.object({}),
|
|
212
|
-
access: { roles: ["member", "admin"] },
|
|
213
|
-
async execute() { return { ok: true }; },
|
|
214
|
-
});
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Public Actions
|
|
218
|
-
|
|
219
|
-
Use `roles: ["PUBLIC"]` for unauthenticated endpoints. Mandatory audit logged. The wildcard `"*"` is not supported.
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
access: { roles: ["PUBLIC"] } // No auth, audit logged
|
|
223
|
-
access: { roles: ["member"] } // Requires auth + role
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Custom Dependencies
|
|
227
|
-
|
|
228
|
-
```typescript
|
|
229
|
-
export default defineConfig({
|
|
230
|
-
build: {
|
|
231
|
-
dependencies: {
|
|
232
|
-
"fast-xml-parser": "^4.5.0",
|
|
233
|
-
},
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
## CMS Layouts
|
|
239
|
-
|
|
240
|
-
```typescript
|
|
241
|
-
layouts: {
|
|
242
|
-
default: {
|
|
243
|
-
sections: [
|
|
244
|
-
{ label: "Details", columns: 2, fields: ["name", "email"] },
|
|
245
|
-
{ label: "Notes", collapsed: true, fields: ["notes"] },
|
|
246
|
-
],
|
|
247
|
-
},
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## API Reference
|
|
252
|
-
|
|
253
|
-
| Method | Endpoint | Description |
|
|
254
|
-
|--------|----------|-------------|
|
|
255
|
-
| `GET` | `/api/v1/{resource}` | List |
|
|
256
|
-
| `GET` | `/api/v1/{resource}/:id` | Get |
|
|
257
|
-
| `POST` | `/api/v1/{resource}` | Create |
|
|
258
|
-
| `PATCH` | `/api/v1/{resource}/:id` | Update |
|
|
259
|
-
| `DELETE` | `/api/v1/{resource}/:id` | Delete |
|
|
260
|
-
|
|
261
|
-
Query params: `?limit=50&offset=0`, `?status=active`, `?sort=-createdAt`, `?fields=id,name`, `?search=text`
|
|
262
|
-
Filter operators: `.gt`, `.gte`, `.lt`, `.lte`, `.ne`, `.like`, `.in`
|
|
263
|
-
|
|
264
|
-
## Database Dialects
|
|
265
|
-
|
|
266
|
-
| Stack | Import | Table Function |
|
|
267
|
-
|-------|--------|----------------|
|
|
268
|
-
| Cloudflare D1 / SQLite | `drizzle-orm/sqlite-core` | `sqliteTable` |
|
|
269
|
-
| Supabase / PostgreSQL | `drizzle-orm/pg-core` | `pgTable` |
|
|
270
|
-
|
|
271
|
-
## Migrations are generated — never hand-merge them
|
|
272
|
-
|
|
273
|
-
The files under `quickback/drizzle/` (`*.sql`, `meta/_journal.json`, `meta/*_snapshot.json`) are **generated artifacts**, not source. Never hand-edit them, and never resolve a merge or rebase conflict inside them.
|
|
274
|
-
|
|
275
|
-
When integrating a branch: get the feature/schema `.ts` files in first, then run `quickback compile`. The compiler regenerates the migrations from the merged schema and journals them in the correct (append-only) order. Hand-merging migration SQL or snapshots produces schema drift and broken ordering that only surfaces at deploy time. If a migration file conflicts during a merge, take either side to unblock, then recompile and let the compiler restate the migrations.
|
|
276
|
-
|
|
277
|
-
## CLI Commands
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
quickback create <template> <name> # Create project
|
|
281
|
-
quickback compile # Compile definitions
|
|
282
|
-
quickback docs [topic] # Show documentation
|
|
283
|
-
quickback claude install # Install Claude Code skill
|
|
284
|
-
quickback cursor install # Install Cursor rules
|
|
285
|
-
quickback codex install # Install Codex AGENTS.md rules
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
## Full Documentation
|
|
289
|
-
|
|
290
|
-
https://docs.quickback.dev
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.test.d.ts","sourceRoot":"","sources":["../../src/commands/build.test.ts"],"names":[],"mappings":""}
|
package/dist/commands/codex.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex command - manage ChatGPT Codex AGENTS.md rules.
|
|
3
|
-
*
|
|
4
|
-
* Codex reads `AGENTS.md` from the project root (merging up the tree), so unlike
|
|
5
|
-
* Cursor's dedicated .mdc file the rules live in a file the user may also own.
|
|
6
|
-
* We therefore manage only a delimited block, leaving the rest of AGENTS.md
|
|
7
|
-
* untouched.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* quickback codex install # Add/update the Quickback block in ./AGENTS.md
|
|
11
|
-
* quickback codex update # Alias for install (refresh the block)
|
|
12
|
-
* quickback codex remove # Strip the Quickback block
|
|
13
|
-
* quickback codex status # Check installation status
|
|
14
|
-
*/
|
|
15
|
-
export declare function codex(args: string[]): Promise<void>;
|
|
16
|
-
//# sourceMappingURL=codex.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/commands/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwIH,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBzD"}
|
package/dist/commands/codex.js
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Codex command - manage ChatGPT Codex AGENTS.md rules.
|
|
3
|
-
*
|
|
4
|
-
* Codex reads `AGENTS.md` from the project root (merging up the tree), so unlike
|
|
5
|
-
* Cursor's dedicated .mdc file the rules live in a file the user may also own.
|
|
6
|
-
* We therefore manage only a delimited block, leaving the rest of AGENTS.md
|
|
7
|
-
* untouched.
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* quickback codex install # Add/update the Quickback block in ./AGENTS.md
|
|
11
|
-
* quickback codex update # Alias for install (refresh the block)
|
|
12
|
-
* quickback codex remove # Strip the Quickback block
|
|
13
|
-
* quickback codex status # Check installation status
|
|
14
|
-
*/
|
|
15
|
-
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
16
|
-
import { join, dirname } from "path";
|
|
17
|
-
import { fileURLToPath } from "url";
|
|
18
|
-
import pc from "picocolors";
|
|
19
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
-
const __dirname = dirname(__filename);
|
|
21
|
-
const CODEX_BUNDLE = join(__dirname, "..", "codex");
|
|
22
|
-
const AGENTS_FILE = join(process.cwd(), "AGENTS.md");
|
|
23
|
-
const BEGIN = "<!-- BEGIN QUICKBACK RULES (managed by `quickback codex`) -->";
|
|
24
|
-
const END = "<!-- END QUICKBACK RULES -->";
|
|
25
|
-
function bundledRules() {
|
|
26
|
-
const file = join(CODEX_BUNDLE, "AGENTS.md");
|
|
27
|
-
if (!existsSync(file)) {
|
|
28
|
-
console.log(pc.red("\nCodex rules not found in CLI bundle."));
|
|
29
|
-
console.log(pc.dim("This may indicate an incomplete CLI installation."));
|
|
30
|
-
console.log(pc.dim("Try reinstalling: npm install -g @quickback-dev/cli\n"));
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return readFileSync(file, "utf-8").trim();
|
|
34
|
-
}
|
|
35
|
-
function escapeRegExp(s) {
|
|
36
|
-
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
37
|
-
}
|
|
38
|
-
/** Returns the AGENTS.md content with the Quickback block removed (trimmed). */
|
|
39
|
-
function stripBlock(content) {
|
|
40
|
-
const re = new RegExp(`\\n*${escapeRegExp(BEGIN)}[\\s\\S]*?${escapeRegExp(END)}\\n*`, "g");
|
|
41
|
-
return content.replace(re, "\n").trim();
|
|
42
|
-
}
|
|
43
|
-
function hasBlock(content) {
|
|
44
|
-
return content.includes(BEGIN) && content.includes(END);
|
|
45
|
-
}
|
|
46
|
-
function installRules() {
|
|
47
|
-
const rules = bundledRules();
|
|
48
|
-
if (rules === null)
|
|
49
|
-
process.exit(1);
|
|
50
|
-
const block = `${BEGIN}\n${rules}\n${END}`;
|
|
51
|
-
let next;
|
|
52
|
-
if (existsSync(AGENTS_FILE)) {
|
|
53
|
-
const current = readFileSync(AGENTS_FILE, "utf-8");
|
|
54
|
-
if (hasBlock(current)) {
|
|
55
|
-
// Replace the existing managed block in place.
|
|
56
|
-
const re = new RegExp(`${escapeRegExp(BEGIN)}[\\s\\S]*?${escapeRegExp(END)}`);
|
|
57
|
-
next = current.replace(re, block).trimEnd() + "\n";
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
// Preserve the user's AGENTS.md; append our block.
|
|
61
|
-
next = current.trimEnd() + `\n\n${block}\n`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
next = `${block}\n`;
|
|
66
|
-
}
|
|
67
|
-
writeFileSync(AGENTS_FILE, next);
|
|
68
|
-
console.log(pc.green(` ✓ Quickback rules block → ${AGENTS_FILE}`));
|
|
69
|
-
console.log("");
|
|
70
|
-
console.log(pc.green("✓ Quickback rules installed for Codex (AGENTS.md)"));
|
|
71
|
-
console.log(pc.dim("Consider committing AGENTS.md to your repository.\n"));
|
|
72
|
-
}
|
|
73
|
-
async function install() {
|
|
74
|
-
console.log("");
|
|
75
|
-
console.log(pc.bold("Installing Quickback rules for Codex"));
|
|
76
|
-
console.log("");
|
|
77
|
-
installRules();
|
|
78
|
-
}
|
|
79
|
-
async function remove() {
|
|
80
|
-
if (!existsSync(AGENTS_FILE) || !hasBlock(readFileSync(AGENTS_FILE, "utf-8"))) {
|
|
81
|
-
console.log(pc.yellow("\nNo Quickback block found in AGENTS.md.\n"));
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
console.log("");
|
|
85
|
-
console.log(pc.bold("Remove Quickback Codex rules"));
|
|
86
|
-
console.log("");
|
|
87
|
-
const stripped = stripBlock(readFileSync(AGENTS_FILE, "utf-8"));
|
|
88
|
-
if (stripped === "") {
|
|
89
|
-
// The file held only our block — remove it entirely.
|
|
90
|
-
const { rmSync } = await import("fs");
|
|
91
|
-
rmSync(AGENTS_FILE, { force: true });
|
|
92
|
-
console.log(pc.yellow(` ✓ Removed ${AGENTS_FILE}`));
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
writeFileSync(AGENTS_FILE, stripped + "\n");
|
|
96
|
-
console.log(pc.yellow(` ✓ Stripped Quickback block from ${AGENTS_FILE}`));
|
|
97
|
-
}
|
|
98
|
-
console.log("");
|
|
99
|
-
console.log(pc.green("✓ Quickback Codex rules removed.\n"));
|
|
100
|
-
}
|
|
101
|
-
async function status() {
|
|
102
|
-
console.log("");
|
|
103
|
-
console.log(pc.bold("Quickback Codex Rules (AGENTS.md)"));
|
|
104
|
-
console.log("");
|
|
105
|
-
const installed = existsSync(AGENTS_FILE) && hasBlock(readFileSync(AGENTS_FILE, "utf-8"));
|
|
106
|
-
if (installed) {
|
|
107
|
-
console.log(` ${pc.green("●")} Installed`);
|
|
108
|
-
console.log(pc.dim(` ${AGENTS_FILE}`));
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
console.log(` ${pc.dim("○")} Not installed`);
|
|
112
|
-
console.log(pc.dim("Run 'quickback codex install' to install the rules.\n"));
|
|
113
|
-
}
|
|
114
|
-
console.log("");
|
|
115
|
-
}
|
|
116
|
-
function printHelp() {
|
|
117
|
-
console.log(`
|
|
118
|
-
${pc.bold("Quickback Codex Rules (AGENTS.md)")}
|
|
119
|
-
|
|
120
|
-
${pc.bold("USAGE")}
|
|
121
|
-
quickback codex <command>
|
|
122
|
-
|
|
123
|
-
${pc.bold("COMMANDS")}
|
|
124
|
-
${pc.cyan("install")} Add/update the Quickback block in ./AGENTS.md
|
|
125
|
-
${pc.cyan("update")} Refresh the block to the latest version
|
|
126
|
-
${pc.cyan("remove")} Strip the Quickback block
|
|
127
|
-
${pc.cyan("status")} Check installation status
|
|
128
|
-
|
|
129
|
-
${pc.bold("EXAMPLES")}
|
|
130
|
-
${pc.gray("# Install rules")}
|
|
131
|
-
quickback codex install
|
|
132
|
-
`);
|
|
133
|
-
}
|
|
134
|
-
export async function codex(args) {
|
|
135
|
-
const subcommand = args[0];
|
|
136
|
-
switch (subcommand) {
|
|
137
|
-
case "install":
|
|
138
|
-
case "update":
|
|
139
|
-
await install();
|
|
140
|
-
break;
|
|
141
|
-
case "remove":
|
|
142
|
-
case "uninstall":
|
|
143
|
-
await remove();
|
|
144
|
-
break;
|
|
145
|
-
case "status":
|
|
146
|
-
await status();
|
|
147
|
-
break;
|
|
148
|
-
case "--help":
|
|
149
|
-
case "-h":
|
|
150
|
-
case undefined:
|
|
151
|
-
printHelp();
|
|
152
|
-
break;
|
|
153
|
-
default:
|
|
154
|
-
console.log(pc.red(`\nUnknown subcommand: ${subcommand}`));
|
|
155
|
-
printHelp();
|
|
156
|
-
process.exit(1);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
//# sourceMappingURL=codex.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/commands/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,OAA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,GAAG,CAAC;EACZ,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAC;;EAE5C,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;;;EAGhB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;IACjB,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC;IAClB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;IACjB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;IACjB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;;EAEnB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;IACjB,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC;;CAE7B,CAAC,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,IAAc;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;YACX,MAAM,OAAO,EAAE,CAAC;YAChB,MAAM;QACR,KAAK,QAAQ,CAAC;QACd,KAAK,WAAW;YACd,MAAM,MAAM,EAAE,CAAC;YACf,MAAM;QACR,KAAK,QAAQ;YACX,MAAM,MAAM,EAAE,CAAC;YACf,MAAM;QACR,KAAK,QAAQ,CAAC;QACd,KAAK,IAAI,CAAC;QACV,KAAK,SAAS;YACZ,SAAS,EAAE,CAAC;YACZ,MAAM;QACR;YACE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,yBAAyB,UAAU,EAAE,CAAC,CAAC,CAAC;YAC3D,SAAS,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compile Command
|
|
3
|
-
*
|
|
4
|
-
* Loads configuration and features from disk, calls the remote compiler API,
|
|
5
|
-
* writes the generated files to the project root, and runs post-compile commands.
|
|
6
|
-
*
|
|
7
|
-
* Project structure:
|
|
8
|
-
* my-app/
|
|
9
|
-
* ├── quickback/
|
|
10
|
-
* │ ├── quickback.config.ts
|
|
11
|
-
* │ ├── features/...
|
|
12
|
-
* │ └── drizzle/ ← migration SQL + meta (compiler-owned)
|
|
13
|
-
* ├── src/ ← compiled code written here
|
|
14
|
-
* ├── supabase/migrations/ ← for Supabase provider
|
|
15
|
-
* └── package.json
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* `build.outputDir` → the migration staging workspace's `outputRootPath`.
|
|
19
|
-
*
|
|
20
|
-
* The two use different bases, which is the whole reason this exists.
|
|
21
|
-
* `outputDir` is authored relative to the **quickback/ dir** (every other
|
|
22
|
-
* reader does `join(quickbackDir, outputDir)`), while staging resolves its
|
|
23
|
-
* paths against the **project root** and rejects anything containing `..`.
|
|
24
|
-
* Passing the raw value made a legitimate `outputDir: "../src"` — config in
|
|
25
|
-
* `quickback/`, generated tree at `<root>/src`, the standard nested layout —
|
|
26
|
-
* read as a path-escape attempt and fail the compile.
|
|
27
|
-
*
|
|
28
|
-
* Returns a POSIX-style path relative to the project root, or `undefined`
|
|
29
|
-
* when the project doesn't set `outputDir`.
|
|
30
|
-
*/
|
|
31
|
-
export declare function resolveOutputRootPath(projectRoot: string, quickbackDir: string, outputDir: string | undefined): string | undefined;
|
|
32
|
-
export interface CompileOptions {
|
|
33
|
-
/**
|
|
34
|
-
* Whether to splice the schema-driven kitchen-sink block into the
|
|
35
|
-
* user's quickback.config.ts after a successful compile. Defaults
|
|
36
|
-
* to true; the CLI accepts `--no-sync-config` to disable.
|
|
37
|
-
*/
|
|
38
|
-
syncConfig?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Request detailed compiler failure output, including the failing command,
|
|
41
|
-
* exit code, stderr/stdout tails, and any suggested fixes.
|
|
42
|
-
*/
|
|
43
|
-
verbose?: boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Apply safe additive managed-column declarations to authored feature
|
|
46
|
-
* schemas before loading them for compilation.
|
|
47
|
-
*/
|
|
48
|
-
fixSchema?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Continue compiling when an action's input schema fails to harvest,
|
|
51
|
-
* falling back to the compiler's static Zod parser. `--allow-degraded-schemas`.
|
|
52
|
-
*
|
|
53
|
-
* Off by default since v0.63.0: a fallback schema keeps its `properties`
|
|
54
|
-
* and silently loses `required` + `additionalProperties`, so the operation
|
|
55
|
-
* still looks typed while enforcing nothing. That degradation used to be
|
|
56
|
-
* the default and shipped hundreds of unenforced operations
|
|
57
|
-
* before anyone compared the specs structurally.
|
|
58
|
-
*/
|
|
59
|
-
allowDegradedSchemas?: boolean;
|
|
60
|
-
}
|
|
61
|
-
export declare function compile(options?: CompileOptions): Promise<void>;
|
|
62
|
-
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/commands/compile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAyFH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,SAAS,CAGpB;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAszBzE"}
|