@quickback-dev/cli 0.72.7 → 0.72.9

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 (79) hide show
  1. package/dist/commands/migrations-baseline.d.ts +2 -0
  2. package/dist/commands/migrations-baseline.d.ts.map +1 -0
  3. package/dist/commands/migrations-baseline.js +29 -0
  4. package/dist/commands/migrations-baseline.js.map +1 -0
  5. package/dist/commands/migrations.d.ts.map +1 -1
  6. package/dist/commands/migrations.js +16 -9
  7. package/dist/commands/migrations.js.map +1 -1
  8. package/dist/index.js +2 -2
  9. package/dist/lib/migrations/baseline.d.ts +26 -0
  10. package/dist/lib/migrations/baseline.d.ts.map +1 -0
  11. package/dist/lib/migrations/baseline.js +258 -0
  12. package/dist/lib/migrations/baseline.js.map +1 -0
  13. package/dist/lib/migrations/sqlite-baseline-worker.d.ts +3 -0
  14. package/dist/lib/migrations/sqlite-baseline-worker.d.ts.map +1 -0
  15. package/dist/lib/migrations/sqlite-baseline-worker.js +86 -0
  16. package/dist/lib/migrations/sqlite-baseline-worker.js.map +1 -0
  17. package/dist/skill/docs/api/actions.md +37 -1
  18. package/dist/skill/docs/api/openapi.md +2 -0
  19. package/dist/skill/docs/api/views.md +5 -1
  20. package/dist/skill/docs/changelog/index.md +29 -0
  21. package/dist/skill/docs/configure/agents.md +16 -0
  22. package/dist/skill/docs/configure/domains.md +1 -1
  23. package/dist/skill/docs/configure/index.md +2 -2
  24. package/dist/skill/docs/configure/single-tenant.md +1 -0
  25. package/dist/skill/docs/define/access.md +2 -0
  26. package/dist/skill/docs/define/scopes.md +1 -1
  27. package/dist/skill/docs/define/views.md +8 -0
  28. package/dist/skill/docs/platform/auth/index.md +10 -1
  29. package/dist/skill/docs/platform/auth/plugins/organization-defaults.md +37 -0
  30. package/dist/skill/docs/platform/auth/security.md +16 -0
  31. package/dist/skill/docs/platform/auth/using-auth.md +2 -0
  32. package/dist/skill/docs/platform/database/schema-baselines.md +86 -0
  33. package/dist/skill/docs/tooling/cli.md +13 -0
  34. package/dist/skill/docs/tooling/cloud-compiler/authentication.md +2 -0
  35. package/dist/skill/docs/tooling/cloud-compiler/endpoints.md +19 -1
  36. package/dist/skill/docs/ui/account/customization.md +2 -2
  37. package/dist/skill/docs/ui/account/environment-variables.md +7 -1
  38. package/dist/skill/docs/ui/account/features/admin.md +2 -2
  39. package/dist/skill/docs/ui/account/features/api-keys.md +1 -1
  40. package/dist/skill/docs/ui/account/features/index.md +10 -8
  41. package/dist/skill/docs/ui/account/features/organizations.md +19 -9
  42. package/dist/skill/docs/ui/account/features/passkeys.md +6 -2
  43. package/dist/skill/docs/ui/account/features/sessions.md +2 -2
  44. package/dist/skill/docs/ui/account/index.md +61 -30
  45. package/dist/skill/docs/ui/account/with-quickback.md +1 -1
  46. package/dist/skill/docs/ui/admin/connecting.md +1 -1
  47. package/dist/skill/docs/ui/admin/index.md +1 -1
  48. package/package.json +1 -1
  49. package/src/skill/docs/api/actions.md +37 -1
  50. package/src/skill/docs/api/openapi.md +2 -0
  51. package/src/skill/docs/api/views.md +5 -1
  52. package/src/skill/docs/changelog/index.md +29 -0
  53. package/src/skill/docs/configure/agents.md +16 -0
  54. package/src/skill/docs/configure/domains.md +1 -1
  55. package/src/skill/docs/configure/index.md +2 -2
  56. package/src/skill/docs/configure/single-tenant.md +1 -0
  57. package/src/skill/docs/define/access.md +2 -0
  58. package/src/skill/docs/define/scopes.md +1 -1
  59. package/src/skill/docs/define/views.md +8 -0
  60. package/src/skill/docs/platform/auth/index.md +10 -1
  61. package/src/skill/docs/platform/auth/plugins/organization-defaults.md +37 -0
  62. package/src/skill/docs/platform/auth/security.md +16 -0
  63. package/src/skill/docs/platform/auth/using-auth.md +2 -0
  64. package/src/skill/docs/platform/database/schema-baselines.md +86 -0
  65. package/src/skill/docs/tooling/cli.md +13 -0
  66. package/src/skill/docs/tooling/cloud-compiler/authentication.md +2 -0
  67. package/src/skill/docs/tooling/cloud-compiler/endpoints.md +19 -1
  68. package/src/skill/docs/ui/account/customization.md +2 -2
  69. package/src/skill/docs/ui/account/environment-variables.md +7 -1
  70. package/src/skill/docs/ui/account/features/admin.md +2 -2
  71. package/src/skill/docs/ui/account/features/api-keys.md +1 -1
  72. package/src/skill/docs/ui/account/features/index.md +10 -8
  73. package/src/skill/docs/ui/account/features/organizations.md +19 -9
  74. package/src/skill/docs/ui/account/features/passkeys.md +6 -2
  75. package/src/skill/docs/ui/account/features/sessions.md +2 -2
  76. package/src/skill/docs/ui/account/index.md +61 -30
  77. package/src/skill/docs/ui/account/with-quickback.md +1 -1
  78. package/src/skill/docs/ui/admin/connecting.md +1 -1
  79. package/src/skill/docs/ui/admin/index.md +1 -1
@@ -4,25 +4,57 @@ A complete authentication and account management frontend that ships with the Qu
4
4
 
5
5
  ## What's Included
6
6
 
7
- Account UI is a single React SPA that contains three distinct sections:
7
+ Account UI is a single React SPA. Every signed-in page renders inside one shell:
8
+
9
+ - **Top bar**: your app's name (links to Home), the organization you're in, an **Open {org} ↗** button, a **CMS** button, and the account menu.
10
+ - **Sidebar**: a **Home** entry, then an **Account** group, then a group for the current organization, then **Platform → Admin** for operators. On mobile the sidebar becomes a slide-out drawer.
11
+
12
+ | Sidebar entry | Path | What's there |
13
+ |---|---|---|
14
+ | **Home** | `/home` | The landing page after sign-in: pending invitations, your organizations with **Open** / **CMS** / settings buttons, and a passkey prompt when you have none |
15
+ | Account → **Profile** | `/profile` | Photo, name, email, and **Delete account** |
16
+ | Account → **Security** | `/security` | Password, passkeys, and connected (Google / Cloudflare) logins |
17
+ | Account → **Sessions** | `/devices` | Signed-in devices; sign out one or all |
18
+ | Account → **API keys** | `/api-keys` | Personal API keys (when the `apiKey` plugin is on) |
19
+ | *Org* → **General** | `/$slug` | Name, slug, logo, metadata; **Leave** and **Delete** |
20
+ | *Org* → **Members** | `/$slug/members` | Members and roles, an **Invite** button, and pending invitations |
21
+ | *Org* → **Teams** | `/$slug/teams` | Teams and the active-team picker (when teams are on) |
22
+ | *Org* → **Billing** | `/$slug/billing` | The organization's subscription (when subscriptions are on) |
23
+ | Platform → **Admin** | `/admin` | Users, organizations, subscriptions (operators only) |
24
+
25
+ The shell collapses with your configuration. Without organizations there is no organization switcher and no org group. With nothing to launch (no organizations, no `account.appUrl`, no CMS), Home is skipped and sign-in lands on **Profile**. Old paths redirect, so existing links keep working: `/dashboard` → `/home`, `/passkeys` and `/connected-accounts` → `/security`, `/$slug/settings` → `/$slug`, `/$slug/invitations` → `/$slug/members`.
8
26
 
9
- ### Account (every user)
27
+ Served on its own domain (e.g., `auth.example.com`) or at `/account/` when embedded alongside the CMS.
10
28
 
11
- Login, signup, profile editing, password management, device sessions, email changes, and account deletion. This is what every user interacts with. After sign-in, Account UI lands on `/profile`.
29
+ ### Getting into the app
12
30
 
13
- When organizations are enabled, `/profile` has **Manage Organizations** (the `/dashboard` org list and invites) and a **Go to…** control that opens the tenant app. The URL is `account.appUrl` plus `account.tenantPattern` with the org slug substituted (the same `getTenantUrl` used on the org dashboard). One org is a single button; several orgs is a picker. The control is hidden when those config values cannot produce a URL.
31
+ There is one rule for every **Open** button: the organization's tenant URL (`account.appUrl` plus `account.tenantPattern` with the slug substituted), else the plain `account.appUrl`, else no button. Opening the app for an organization first makes it the session's active organization, the same way the CMS launch does, so the app never opens into an organization left active by an earlier visit.
14
32
 
15
- When the project also enables the CMS, the profile has a separate CMS action. One membership opens that organization directly; several memberships produce an organization picker. Account UI makes the selected organization active before navigating, so the CMS cannot inherit a different active organization from an earlier session. The action follows `cms.access`: membership is required in `"member"` mode, while only `user.role === "sysadmin"` sees it in `"sysadmin"` mode. A zero-membership sysadmin opens the tenant picker only when `cms.sysadmin: true` explicitly enables cross-tenant scope. When `features.pinnedOrganizationId` is set, the profile targets only that fixed organization and never offers the caller's other memberships.
33
+ Accepting an invitation opens the app for that organization when the project has an app URL. Otherwise it goes to Home.
16
34
 
17
- Served on its own domain (e.g., `auth.example.com`) or at `/account/` when embedded alongside the CMS.
35
+ ### Organizations
36
+
37
+ How the organization switcher in the top bar behaves depends on how many organizations you belong to:
38
+
39
+ | Organizations | Top bar | Home |
40
+ |---|---|---|
41
+ | 0 | No switcher | Pending invitations and an empty state. **Open** goes to the plain `account.appUrl` when set. |
42
+ | 1 | The org's name as a plain label (no menu) | One large **Open {org}** button, plus **Open CMS** and settings |
43
+ | 2+ | A menu. Picking an org opens it in the app; the gear opens its settings. | One row per org with **Open**, **CMS**, and settings |
44
+
45
+ With exactly one organization, the session starts with it active, so the app, the CMS, and org-scoped API calls default to it. The server does this when the session is created ([Organization Defaults](/platform/auth/plugins/organization-defaults)), and Account UI repeats it for older sessions. Neither overrides an organization that is already active. When `features.pinnedOrganizationId` is set, the shell shows only that organization, so it always behaves as a single-organization account.
46
+
47
+ Some slugs are reserved (`home`, `admin`, `api`, `sudo`, …) because they would shadow a route; the slug field says so as you type. See [Organization Defaults](/platform/auth/plugins/organization-defaults#reserved-organization-slugs).
48
+
49
+ **New organization** appears (on Home and in the switcher) only when the project allows self-serve creation with `plugins.organization.allowUserToCreateOrganization: true`. By default the server closes `POST /organization/create`, and operators create organizations from **Admin → Organizations** instead. See [Admin](/ui/account/features/admin).
18
50
 
19
- ### Organization Management (multi-tenant)
51
+ ### CMS launch
20
52
 
21
- `/dashboard` is org management — org list, pending invitations, and the path into org settings (`/$slug`). Personal account settings stay on `/profile`. Only available when `auth.organizations` is enabled.
53
+ When the project also enables the CMS, the top bar and Home have a CMS action. It opens the current organization's CMS directly. Otherwise, one membership opens that organization and several memberships produce a picker. Account UI makes the selected organization active before navigating, so the CMS cannot inherit a different active organization from an earlier session. The action follows `cms.access`: membership is required in `"member"` mode, while only `user.role === "sysadmin"` sees it in `"sysadmin"` mode. A zero-membership sysadmin opens the tenant picker only when `cms.sysadmin: true` explicitly enables cross-tenant scope. When `features.pinnedOrganizationId` is set, the action targets only that fixed organization and never offers the caller's other memberships.
22
54
 
23
- ### Admin Panel (admin users only)
55
+ ### Admin Panel (operators only)
24
56
 
25
- User management dashboard — view all users, search, create accounts, ban/unban, reset passwords, and manage sessions. Only accessible to users with the `admin` role. Can be served on its own domain (e.g., `admin.example.com`) via the `adminDomain` config.
57
+ User management: view all users, search, create accounts, ban/unban, reset passwords, manage sessions, and create organizations with a named owner. It is visible to operator roles (`appmanager`, `sysadmin`) when `auth.admin` is on, and renders inside the same shell. Can be served on its own domain (e.g., `admin.example.com`) via the `adminDomain` config.
26
58
 
27
59
  ## How to Enable
28
60
 
@@ -54,24 +86,23 @@ npx wrangler deploy
54
86
 
55
87
  That's it. The compiler:
56
88
  1. Reads your auth feature flags and branding from the config
57
- 2. Generates a `.env` file with the correct `VITE_*` variables
58
- 3. Builds the SPA from source with Vite (inside Docker)
59
- 4. Excludes routes for disabled features (compile-time tree shaking)
60
- 5. Bundles the built assets into your Worker alongside the API
89
+ 2. Copies the generic prebuilt Account bundle (built once, when the compiler image is built) into `src/apps/account/`
90
+ 3. Emits the per-project values (feature flags, URLs, branding) that the Worker injects into every served page as `window.__QUICKBACK_RUNTIME`
91
+ 4. Serves the assets from your Worker alongside the API
61
92
 
62
- No manual `.env` configuration needed. No separate deployment.
93
+ Compiles never run Vite. No manual `.env` configuration needed. No separate deployment.
63
94
 
64
95
  See [Configuration](/configure) for all `account` options and [Multi-Domain Architecture](/configure/domains) for custom domain setup.
65
96
 
66
- ### Skip SPA Rebuild
97
+ ### Skip Staging the Account Assets
67
98
 
68
- After the first compile, skip rebuilding the Account SPA on subsequent compiles:
99
+ After the first compile, skip copying the Account assets on subsequent compiles:
69
100
 
70
101
  ```typescript
71
102
  account: { build: false, /* ...other options */ }
72
103
  ```
73
104
 
74
- Useful when iterating on API features — saves significant compile time. Set back to `true` (or omit) when you need to update the Account UI.
105
+ Use it while iterating on API features. Set it back to `true` (or omit it) to pick up a newer Account bundle.
75
106
 
76
107
  ### Custom Output Directory
77
108
 
@@ -81,28 +112,28 @@ account: { outputDir: "my-custom-path/account" }
81
112
 
82
113
  Changes where compiled Account assets are placed, instead of the default `src/apps/account/`.
83
114
 
84
- ## Compile-Time Feature Gating
115
+ ## Feature Gating
85
116
 
86
- Auth feature flags control which pages are included in the bundle:
117
+ Auth feature flags control which pages and controls exist:
87
118
 
88
119
  | Flag | Pages Included |
89
120
  |------|---------------|
90
- | `auth.password` | Password login, inline password change on profile |
91
- | `auth.emailOTP` | Email OTP login flow, email-based password reset |
92
- | `auth.passkey` | Passkey setup and management |
93
- | `auth.organizations` | `/dashboard` (org list + invitations), org creation, member management |
94
- | `auth.admin` | Admin panel (user management) |
121
+ | `auth.password` | Password login; **Change password** on Security |
122
+ | `auth.emailOTP` | Email OTP login flow, email-based password reset; on Security, password changes are confirmed with an emailed code |
123
+ | `auth.passkey` | Passkeys on Security, the `/passkeys/setup` prompt, the passkey nudge on Home |
124
+ | `auth.organizations` | The organization switcher, org cards and invitations on Home, the org sidebar group (General, Members, Teams, Billing) |
125
+ | `auth.admin` | Admin panel (user and organization management) |
95
126
 
96
- When a flag is `false`, the corresponding routes **guard themselves at runtime** — each feature route checks its flag from the worker-injected `window.__QUICKBACK_RUNTIME` config in `beforeLoad` and redirects away, and navigation entries for it are hidden. The Account SPA ships as one generic prebuilt bundle; flags decide which surfaces exist for your project.
127
+ When a flag is `false`, the corresponding routes **guard themselves at runtime** — each feature route checks its flag from the worker-injected `window.__QUICKBACK_RUNTIME` config in `beforeLoad` and redirects away, and its sidebar entries and buttons are hidden. The Account SPA ships as one generic prebuilt bundle; flags decide which surfaces exist for your project.
97
128
 
98
129
  ## Features
99
130
 
100
131
  - **Authentication** — Email/password, passkeys (WebAuthn), email OTP, email verification, password reset, and the confirm page that magic-link emails open (`/magic-link`)
101
- - **Account Management** — Profile editing, avatar upload, password changes, device/session management, account deletion
102
- - **Connected Accounts** — Link Google and Cloudflare logins from `/connected-accounts` (linked from profile)
103
- - **Organizations** — Multi-tenant org management with owner/admin/member roles, invitations, and org settings
132
+ - **Account Management** — Profile editing, avatar upload, password changes, session management, account deletion
133
+ - **Connected Accounts** — Link Google and Cloudflare logins on `/security`
134
+ - **Organizations** — Multi-tenant org management with owner/admin/member roles, invitations, teams, billing, and org settings
104
135
  - **Admin Panel** — User management dashboard with search, create, ban/unban, password reset, and session viewing
105
- - **API Keys** — Generate and manage API keys from `/api-keys` (linked from profile)
136
+ - **API Keys** — Generate and manage API keys from `/api-keys`
106
137
  - **CLI Authorization** — Device authorization flow for `quickback login`
107
138
 
108
139
  ## Next Steps
@@ -68,7 +68,7 @@ auth: {
68
68
  password: true, // Email/password login + inline password change
69
69
  emailOTP: false, // Email OTP login flow
70
70
  passkey: true, // WebAuthn passkey setup + management
71
- organizations: true, // /dashboard org list, org management, invitations
71
+ organizations: true, // org switcher, Home org list + invitations, org settings
72
72
  admin: true, // Admin panel (user management)
73
73
  }
74
74
  ```
@@ -138,7 +138,7 @@ This adds a custom domain route to `wrangler.toml`. Both `api.example.com` and `
138
138
 
139
139
  CMS access defaults to `access: "sysadmin"` — only `user.role === "sysadmin"` (the cross-tenant data-plane tier) can use `/cms/*`. Set `access: "member"` to also admit anyone holding an organization membership. `user.role === "appmanager"` opens the CMS in neither mode: it is the control-plane tier and belongs at `/account/admin`. The gate is enforced at multiple layers:
140
140
 
141
- - **Account UI** hides the "Go to CMS" button for callers outside those roles.
141
+ - **Account UI** hides its **CMS** button for callers outside those roles.
142
142
  - **CMS SPA shell** — the Worker redirects unauthenticated requests to login. Sign-in is the only shell-level gate; the app itself is a generic bundle. For a caller `/api/v1/schema` would admit, the Worker also inlines the schema registry in the shell as a non-executing `<script type="application/json" id="__qb-cms-bootstrap">` block, so the CMS starts without fetching it. The block uses the same admission check as `/api/v1/schema`, so it never carries anything that route would refuse. With [Cloudflare Access](/configure/cloudflare-access), it is inlined only when `/api/v1/schema` needs no Access application or the same one the shell request passed. The CMS shell is served `Cache-Control: private, no-store`.
143
143
  - **`/api/v1/schema`** returns `401 AUTH_MISSING` to anonymous callers `403 CMS_ACCESS_DENIED` (naming the role required) to signed-in callers outside those roles, and `403 MFA_REQUIRED` to an operator whose session lacks the second factor `auth.operatorMfa` demands, so schema metadata can't be scraped by hitting the API directly.
144
144
  - **`custom_view` routes** are gated on `userRole: ["appmanager"]` rather than org membership, so saved views can't be listed or modified without platform-control-plane rights.
@@ -181,7 +181,7 @@ Start apps ship that setting. A sysadmin who also holds an organization membersh
181
181
  > **File uploads need valid R2 credentials**
182
182
  >
183
183
  > Profile pictures and organization logos are **Account UI**, not the CMS — they
184
- > live at `/account/profile` and `/account/<slug>/settings`. They only work with
184
+ > live at `/account/profile` and `/account/<slug>` (the organization's General page). They only work with
185
185
  > `account.fileUploads: true`, [managed R2](/platform/storage/r2)
186
186
  > (`defineFileStorage("cloudflare-r2", { managed: true })`), and the
187
187
  > `R2_ACCOUNT_ID` / `R2_ACCESS_KEY_ID` / `R2_SECRET_ACCESS_KEY` secrets. A