@quickback-dev/cli 0.9.5

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 (122) hide show
  1. package/README.md +7 -0
  2. package/dist/commands/claude.d.ts +13 -0
  3. package/dist/commands/claude.d.ts.map +1 -0
  4. package/dist/commands/claude.js +305 -0
  5. package/dist/commands/claude.js.map +1 -0
  6. package/dist/commands/compile.d.ts +18 -0
  7. package/dist/commands/compile.d.ts.map +1 -0
  8. package/dist/commands/compile.js +326 -0
  9. package/dist/commands/compile.js.map +1 -0
  10. package/dist/commands/create.d.ts +18 -0
  11. package/dist/commands/create.d.ts.map +1 -0
  12. package/dist/commands/create.js +798 -0
  13. package/dist/commands/create.js.map +1 -0
  14. package/dist/commands/cursor.d.ts +11 -0
  15. package/dist/commands/cursor.d.ts.map +1 -0
  16. package/dist/commands/cursor.js +156 -0
  17. package/dist/commands/cursor.js.map +1 -0
  18. package/dist/commands/docs.d.ts +10 -0
  19. package/dist/commands/docs.d.ts.map +1 -0
  20. package/dist/commands/docs.js +93 -0
  21. package/dist/commands/docs.js.map +1 -0
  22. package/dist/commands/example.d.ts +7 -0
  23. package/dist/commands/example.d.ts.map +1 -0
  24. package/dist/commands/example.js +153 -0
  25. package/dist/commands/example.js.map +1 -0
  26. package/dist/commands/init.d.ts +6 -0
  27. package/dist/commands/init.d.ts.map +1 -0
  28. package/dist/commands/init.js +383 -0
  29. package/dist/commands/init.js.map +1 -0
  30. package/dist/commands/login.d.ts +16 -0
  31. package/dist/commands/login.d.ts.map +1 -0
  32. package/dist/commands/login.js +287 -0
  33. package/dist/commands/login.js.map +1 -0
  34. package/dist/commands/logout.d.ts +7 -0
  35. package/dist/commands/logout.d.ts.map +1 -0
  36. package/dist/commands/logout.js +19 -0
  37. package/dist/commands/logout.js.map +1 -0
  38. package/dist/commands/mcp.d.ts +21 -0
  39. package/dist/commands/mcp.d.ts.map +1 -0
  40. package/dist/commands/mcp.js +331 -0
  41. package/dist/commands/mcp.js.map +1 -0
  42. package/dist/commands/whoami.d.ts +7 -0
  43. package/dist/commands/whoami.d.ts.map +1 -0
  44. package/dist/commands/whoami.js +37 -0
  45. package/dist/commands/whoami.js.map +1 -0
  46. package/dist/cursor/quickback.mdc +277 -0
  47. package/dist/docs/content.d.ts +7 -0
  48. package/dist/docs/content.d.ts.map +1 -0
  49. package/dist/docs/content.js +577 -0
  50. package/dist/docs/content.js.map +1 -0
  51. package/dist/examples/recruitment.tar.gz +0 -0
  52. package/dist/index.d.ts +12 -0
  53. package/dist/index.d.ts.map +1 -0
  54. package/dist/index.js +188 -0
  55. package/dist/index.js.map +1 -0
  56. package/dist/lib/api-client.d.ts +103 -0
  57. package/dist/lib/api-client.d.ts.map +1 -0
  58. package/dist/lib/api-client.js +231 -0
  59. package/dist/lib/api-client.js.map +1 -0
  60. package/dist/lib/api-client.test.d.ts +2 -0
  61. package/dist/lib/api-client.test.d.ts.map +1 -0
  62. package/dist/lib/api-client.test.js +133 -0
  63. package/dist/lib/api-client.test.js.map +1 -0
  64. package/dist/lib/artifact-routing.d.ts +8 -0
  65. package/dist/lib/artifact-routing.d.ts.map +1 -0
  66. package/dist/lib/artifact-routing.js +34 -0
  67. package/dist/lib/artifact-routing.js.map +1 -0
  68. package/dist/lib/artifact-routing.test.d.ts +2 -0
  69. package/dist/lib/artifact-routing.test.d.ts.map +1 -0
  70. package/dist/lib/artifact-routing.test.js +37 -0
  71. package/dist/lib/artifact-routing.test.js.map +1 -0
  72. package/dist/lib/async-utils.d.ts +6 -0
  73. package/dist/lib/async-utils.d.ts.map +1 -0
  74. package/dist/lib/async-utils.js +26 -0
  75. package/dist/lib/async-utils.js.map +1 -0
  76. package/dist/lib/auth.d.ts +55 -0
  77. package/dist/lib/auth.d.ts.map +1 -0
  78. package/dist/lib/auth.js +102 -0
  79. package/dist/lib/auth.js.map +1 -0
  80. package/dist/lib/compiler-stubs.d.ts +108 -0
  81. package/dist/lib/compiler-stubs.d.ts.map +1 -0
  82. package/dist/lib/compiler-stubs.js +142 -0
  83. package/dist/lib/compiler-stubs.js.map +1 -0
  84. package/dist/lib/drizzle-meta-routing.test.d.ts +2 -0
  85. package/dist/lib/drizzle-meta-routing.test.d.ts.map +1 -0
  86. package/dist/lib/drizzle-meta-routing.test.js +123 -0
  87. package/dist/lib/drizzle-meta-routing.test.js.map +1 -0
  88. package/dist/lib/file-loader.d.ts +165 -0
  89. package/dist/lib/file-loader.d.ts.map +1 -0
  90. package/dist/lib/file-loader.js +577 -0
  91. package/dist/lib/file-loader.js.map +1 -0
  92. package/dist/lib/file-loader.test.d.ts +2 -0
  93. package/dist/lib/file-loader.test.d.ts.map +1 -0
  94. package/dist/lib/file-loader.test.js +75 -0
  95. package/dist/lib/file-loader.test.js.map +1 -0
  96. package/dist/lib/file-writer.d.ts +30 -0
  97. package/dist/lib/file-writer.d.ts.map +1 -0
  98. package/dist/lib/file-writer.js +122 -0
  99. package/dist/lib/file-writer.js.map +1 -0
  100. package/dist/lib/helpers.d.ts +39 -0
  101. package/dist/lib/helpers.d.ts.map +1 -0
  102. package/dist/lib/helpers.js +299 -0
  103. package/dist/lib/helpers.js.map +1 -0
  104. package/dist/lib/markdown-renderer.d.ts +8 -0
  105. package/dist/lib/markdown-renderer.d.ts.map +1 -0
  106. package/dist/lib/markdown-renderer.js +151 -0
  107. package/dist/lib/markdown-renderer.js.map +1 -0
  108. package/dist/lib/shell.d.ts +15 -0
  109. package/dist/lib/shell.d.ts.map +1 -0
  110. package/dist/lib/shell.js +32 -0
  111. package/dist/lib/shell.js.map +1 -0
  112. package/dist/skill/SKILL.md +887 -0
  113. package/dist/skill/agents/quickback-specialist/AGENT.md +298 -0
  114. package/dist/templates/registry.d.ts +36 -0
  115. package/dist/templates/registry.d.ts.map +1 -0
  116. package/dist/templates/registry.js +181 -0
  117. package/dist/templates/registry.js.map +1 -0
  118. package/package.json +55 -0
  119. package/src/cursor/quickback.mdc +277 -0
  120. package/src/examples/recruitment.tar.gz +0 -0
  121. package/src/skill/SKILL.md +887 -0
  122. package/src/skill/agents/quickback-specialist/AGENT.md +298 -0
@@ -0,0 +1,277 @@
1
+ ---
2
+ description: Quickback API engine - use when defining tables, schemas, security (Firewall, Access, Guards, Masking), actions, views, validation, or deploying Quickback projects
3
+ globs: quickback/**/*.ts
4
+ ---
5
+
6
+ # Quickback
7
+
8
+ Quickback is two things:
9
+
10
+ 1. **Compiler** — Transforms declarative TypeScript definitions into secure, production-ready APIs
11
+ 2. **Stack** — A Supabase alternative running entirely on Cloudflare (D1, R2, KV, Durable Objects, Queues, Workers AI)
12
+
13
+ The output is standard TypeScript (Hono, Drizzle, Better Auth) running on your own infrastructure.
14
+
15
+ ## Project Structure
16
+
17
+ ```
18
+ my-app/
19
+ ├── quickback/
20
+ │ ├── quickback.config.ts
21
+ │ └── features/
22
+ │ └── {feature-name}/
23
+ │ ├── {table}.ts # Schema + security (defineTable)
24
+ │ ├── actions.ts # Custom actions (optional)
25
+ │ └── handlers/ # Action handlers (optional)
26
+ └── ...
27
+ ```
28
+
29
+ ## quickback.config.ts
30
+
31
+ ```typescript
32
+ import { defineConfig, defineRuntime, defineDatabase, defineAuth } from '@quickback/compiler';
33
+
34
+ export default defineConfig({
35
+ name: "my-saas-app",
36
+ providers: {
37
+ runtime: defineRuntime("cloudflare"),
38
+ database: defineDatabase("cloudflare-d1"),
39
+ auth: defineAuth("better-auth"),
40
+ },
41
+ });
42
+ ```
43
+
44
+ ## Automatic Audit Fields
45
+
46
+ Quickback auto-injects: `createdAt`, `modifiedAt`, `deletedAt`, `createdBy`, `modifiedBy`, `deletedBy`. Do NOT define these in schemas.
47
+
48
+ ## defineTable() — Schema + Security
49
+
50
+ Each feature file exports a Drizzle table and a `defineTable()` default export with security config:
51
+
52
+ ```typescript
53
+ import { sqliteTable, text, integer } from "drizzle-orm/sqlite-core";
54
+ import { defineTable } from "@quickback/compiler";
55
+
56
+ export const todos = sqliteTable("todos", {
57
+ id: integer("id").primaryKey(),
58
+ title: text("title").notNull(),
59
+ description: text("description"),
60
+ completed: integer("completed", { mode: "boolean" }).default(false),
61
+ userId: text("user_id").notNull(),
62
+ organizationId: text("organization_id").notNull(),
63
+ });
64
+
65
+ export default defineTable(todos, {
66
+ firewall: { organization: {}, owner: {} },
67
+ crud: {
68
+ list: { access: { roles: ["member", "admin"] } },
69
+ get: { access: { roles: ["member", "admin"] } },
70
+ create: { access: { roles: ["member", "admin"] } },
71
+ update: { access: { roles: ["admin"] } },
72
+ delete: { access: { roles: ["admin"] }, mode: "soft" },
73
+ },
74
+ guards: {
75
+ createable: ["title", "description", "completed"],
76
+ updatable: ["title", "description", "completed"],
77
+ },
78
+ masking: {
79
+ userId: { type: "redact", show: { roles: ["admin"] } },
80
+ },
81
+ });
82
+ ```
83
+
84
+ ## Four Security Layers
85
+
86
+ Every request passes through: `Request → Firewall → Access → Guards → Database → Masking → Response`
87
+
88
+ ### 1. Firewall — Data Isolation
89
+
90
+ Auto WHERE clauses for tenant isolation:
91
+
92
+ ```typescript
93
+ firewall: {
94
+ organization: {}, // WHERE organizationId = ctx.activeOrgId
95
+ owner: {}, // AND userId = ctx.userId
96
+ team: {}, // WHERE teamId = ctx.activeTeamId
97
+ softDelete: {}, // AND deletedAt IS NULL
98
+ exception: true, // No filtering (public)
99
+ }
100
+ ```
101
+
102
+ ### 2. Access — Permission Checks
103
+
104
+ Role-based and record-based (deny by default):
105
+
106
+ ```typescript
107
+ crud: {
108
+ list: { access: { roles: ['member'] } },
109
+ update: {
110
+ access: {
111
+ or: [
112
+ { roles: ['admin'] },
113
+ { record: { createdBy: { equals: '$ctx.userId' } } },
114
+ ],
115
+ },
116
+ },
117
+ }
118
+ ```
119
+
120
+ Operators: `equals`, `notEquals`, `in`, `notIn`, `greaterThan`, `lessThan`
121
+ Context: `$ctx.userId`, `$ctx.activeOrgId`, `$ctx.roles`
122
+
123
+ ### 3. Guards — Field Protection
124
+
125
+ ```typescript
126
+ guards: {
127
+ createable: ['name', 'description'],
128
+ updatable: ['description'],
129
+ immutable: ['invoiceNumber'],
130
+ protected: { status: ['approve'] }, // Only via named actions
131
+ }
132
+ ```
133
+
134
+ ### 4. Masking — PII Redaction
135
+
136
+ ```typescript
137
+ masking: {
138
+ ssn: { type: 'ssn', show: { roles: ['admin'] } },
139
+ email: { type: 'email', show: { roles: ['admin'], or: 'owner' } },
140
+ }
141
+ ```
142
+
143
+ Types: `email`, `phone`, `ssn`, `creditCard`, `name`, `redact`, `custom`
144
+
145
+ ## Views — Column Projections
146
+
147
+ ```typescript
148
+ views: {
149
+ summary: { fields: ['id', 'name'], access: { roles: ['member'] } },
150
+ full: { fields: ['id', 'name', 'phone', 'ssn'], access: { roles: ['admin'] } },
151
+ }
152
+ ```
153
+
154
+ ## Validation
155
+
156
+ ```typescript
157
+ validation: {
158
+ name: { minLength: 1, maxLength: 100 },
159
+ capacity: { min: 1, max: 1000 },
160
+ roomType: { enum: ['meeting', 'conference'] },
161
+ email: { email: true },
162
+ }
163
+ ```
164
+
165
+ ## Actions — Custom Business Logic
166
+
167
+ Separate `actions.ts` file:
168
+
169
+ ```typescript
170
+ import { todos } from './todos';
171
+ import { defineActions } from '@quickback/compiler';
172
+ import { z } from 'zod';
173
+
174
+ export default defineActions(todos, {
175
+ complete: {
176
+ description: "Mark todo as complete",
177
+ input: z.object({ completedAt: z.string().datetime().optional() }),
178
+ guard: { roles: ["member", "admin"] },
179
+ execute: async ({ db, record, ctx, input }) => {
180
+ await db.update(todos).set({ completed: true }).where(eq(todos.id, record.id));
181
+ return { success: true };
182
+ },
183
+ },
184
+ });
185
+ ```
186
+
187
+ Record-based: `POST /api/v1/{resource}/:id/{action}`
188
+ Standalone: `standalone: true`, custom `path` and `method`
189
+
190
+ ### Actions-Only Features (no tables)
191
+
192
+ ```typescript
193
+ // quickback/features/utilities/actions.ts
194
+ import { defineActions } from '@quickback/compiler';
195
+ import { z } from 'zod';
196
+
197
+ export default defineActions(null, {
198
+ healthCheck: {
199
+ standalone: true,
200
+ path: "/health",
201
+ method: "GET",
202
+ input: z.object({}),
203
+ guard: { roles: ["member", "admin"] },
204
+ handler: "./handlers/health-check",
205
+ },
206
+ });
207
+ ```
208
+
209
+ All actions must have `standalone: true` when there is no table.
210
+
211
+ ### Public Actions
212
+
213
+ Use `roles: ["PUBLIC"]` for unauthenticated endpoints. Mandatory audit logged. The wildcard `"*"` is not supported.
214
+
215
+ ```typescript
216
+ access: { roles: ["PUBLIC"] } // No auth, audit logged
217
+ access: { roles: ["member"] } // Requires auth + role
218
+ ```
219
+
220
+ ## Custom Dependencies
221
+
222
+ ```typescript
223
+ export default defineConfig({
224
+ build: {
225
+ dependencies: {
226
+ "fast-xml-parser": "^4.5.0",
227
+ },
228
+ },
229
+ });
230
+ ```
231
+
232
+ ## CMS Layouts
233
+
234
+ ```typescript
235
+ layouts: {
236
+ default: {
237
+ sections: [
238
+ { label: "Details", columns: 2, fields: ["name", "email"] },
239
+ { label: "Notes", collapsed: true, fields: ["notes"] },
240
+ ],
241
+ },
242
+ }
243
+ ```
244
+
245
+ ## API Reference
246
+
247
+ | Method | Endpoint | Description |
248
+ |--------|----------|-------------|
249
+ | `GET` | `/api/v1/{resource}` | List |
250
+ | `GET` | `/api/v1/{resource}/:id` | Get |
251
+ | `POST` | `/api/v1/{resource}` | Create |
252
+ | `PATCH` | `/api/v1/{resource}/:id` | Update |
253
+ | `DELETE` | `/api/v1/{resource}/:id` | Delete |
254
+
255
+ Query params: `?limit=50&offset=0`, `?status=active`, `?sort=-createdAt`, `?fields=id,name`, `?search=text`
256
+ Filter operators: `.gt`, `.gte`, `.lt`, `.lte`, `.ne`, `.like`, `.in`
257
+
258
+ ## Database Dialects
259
+
260
+ | Stack | Import | Table Function |
261
+ |-------|--------|----------------|
262
+ | Cloudflare D1 / SQLite | `drizzle-orm/sqlite-core` | `sqliteTable` |
263
+ | Supabase / PostgreSQL | `drizzle-orm/pg-core` | `pgTable` |
264
+
265
+ ## CLI Commands
266
+
267
+ ```bash
268
+ quickback create <template> <name> # Create project
269
+ quickback compile # Compile definitions
270
+ quickback docs [topic] # Show documentation
271
+ quickback claude install # Install Claude Code skill
272
+ quickback cursor install # Install Cursor rules
273
+ ```
274
+
275
+ ## Full Documentation
276
+
277
+ https://docs.quickback.dev
Binary file