@quickback-dev/cli 0.10.2 → 0.10.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.
- package/dist/commands/compile.d.ts +9 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +56 -16
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/create.js +108 -55
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +22 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/cursor/quickback.mdc +61 -46
- package/dist/docs/content.js +18 -18
- package/dist/docs/content.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts +34 -2
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +31 -2
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/api-client.test.js +58 -0
- package/dist/lib/api-client.test.js.map +1 -1
- package/dist/lib/config-sync.d.ts +55 -0
- package/dist/lib/config-sync.d.ts.map +1 -0
- package/dist/lib/config-sync.js +207 -0
- package/dist/lib/config-sync.js.map +1 -0
- package/dist/lib/config-sync.test.d.ts +2 -0
- package/dist/lib/config-sync.test.d.ts.map +1 -0
- package/dist/lib/config-sync.test.js +151 -0
- package/dist/lib/config-sync.test.js.map +1 -0
- package/dist/lib/file-loader.d.ts +39 -5
- package/dist/lib/file-loader.d.ts.map +1 -1
- package/dist/lib/file-loader.js +226 -63
- package/dist/lib/file-loader.js.map +1 -1
- package/dist/lib/file-loader.test.js +212 -1
- package/dist/lib/file-loader.test.js.map +1 -1
- package/dist/lib/prepare-output.d.ts +31 -0
- package/dist/lib/prepare-output.d.ts.map +1 -0
- package/dist/lib/prepare-output.js +95 -0
- package/dist/lib/prepare-output.js.map +1 -0
- package/dist/lib/prepare-output.test.d.ts +2 -0
- package/dist/lib/prepare-output.test.d.ts.map +1 -0
- package/dist/lib/prepare-output.test.js +105 -0
- package/dist/lib/prepare-output.test.js.map +1 -0
- package/dist/lib/sweep-stale.d.ts +25 -0
- package/dist/lib/sweep-stale.d.ts.map +1 -0
- package/dist/lib/sweep-stale.js +179 -0
- package/dist/lib/sweep-stale.js.map +1 -0
- package/dist/lib/sweep-stale.test.d.ts +2 -0
- package/dist/lib/sweep-stale.test.d.ts.map +1 -0
- package/dist/lib/sweep-stale.test.js +130 -0
- package/dist/lib/sweep-stale.test.js.map +1 -0
- package/dist/skill/SKILL.md +327 -103
- package/dist/skill/agents/quickback-specialist/AGENT.md +93 -81
- package/package.json +14 -14
- package/src/cursor/quickback.mdc +61 -46
- package/src/skill/SKILL.md +327 -103
- package/src/skill/agents/quickback-specialist/AGENT.md +93 -81
|
@@ -21,8 +21,10 @@ my-app/
|
|
|
21
21
|
│ └── features/
|
|
22
22
|
│ └── {feature-name}/
|
|
23
23
|
│ ├── {table}.ts # Schema + security (defineTable)
|
|
24
|
-
│ ├── actions
|
|
25
|
-
│
|
|
24
|
+
│ ├── actions/ # One file per action — defineAction({...}) (optional)
|
|
25
|
+
│ │ ├── {action}.ts # Binds to primary table (or standalone if path: is set)
|
|
26
|
+
│ │ └── {table}/{action}.ts # Binds to sibling <table>.ts (multi-table features)
|
|
27
|
+
│ └── lib/ # Feature-local helpers, copied verbatim (optional)
|
|
26
28
|
└── ...
|
|
27
29
|
```
|
|
28
30
|
|
|
@@ -63,10 +65,13 @@ export const todos = sqliteTable("todos", {
|
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
export default defineTable(todos, {
|
|
66
|
-
firewall:
|
|
68
|
+
firewall: [
|
|
69
|
+
{ field: "organizationId", equals: "ctx.activeOrgId" },
|
|
70
|
+
{ field: "userId", equals: "ctx.userId" },
|
|
71
|
+
{ field: "deletedAt", isNull: true },
|
|
72
|
+
],
|
|
73
|
+
read: { access: { roles: ["member", "admin"] } },
|
|
67
74
|
crud: {
|
|
68
|
-
list: { access: { roles: ["member", "admin"] } },
|
|
69
|
-
get: { access: { roles: ["member", "admin"] } },
|
|
70
75
|
create: { access: { roles: ["member", "admin"] } },
|
|
71
76
|
update: { access: { roles: ["admin"] } },
|
|
72
77
|
delete: { access: { roles: ["admin"] }, mode: "soft" },
|
|
@@ -87,25 +92,30 @@ Every request passes through: `Request → Firewall → Access → Guards → Da
|
|
|
87
92
|
|
|
88
93
|
### 1. Firewall — Data Isolation
|
|
89
94
|
|
|
90
|
-
Auto WHERE clauses for tenant isolation:
|
|
95
|
+
Auto WHERE clauses for tenant isolation. Predicates are AND'd:
|
|
91
96
|
|
|
92
97
|
```typescript
|
|
93
|
-
firewall:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
firewall: [
|
|
99
|
+
{ field: 'organizationId', equals: 'ctx.activeOrgId' }, // WHERE organizationId = ctx.activeOrgId
|
|
100
|
+
{ field: 'ownerId', equals: 'ctx.userId' }, // AND ownerId = ctx.userId
|
|
101
|
+
{ field: 'teamId', equals: 'ctx.activeTeamId' }, // AND teamId = ctx.activeTeamId
|
|
102
|
+
{ field: 'deletedAt', isNull: true }, // AND deletedAt IS NULL
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
// Public/system resources opt out of tenant scoping (soft-delete still applied):
|
|
106
|
+
firewall: [{ exception: true }]
|
|
100
107
|
```
|
|
101
108
|
|
|
109
|
+
Auto-derived when omitted: scans the schema for `organizationId` / `ownerId` / `teamId` and emits matching predicates. Two or more isolation columns → declare explicitly.
|
|
110
|
+
|
|
102
111
|
### 2. Access — Permission Checks
|
|
103
112
|
|
|
104
|
-
Role-based and record-based (deny by default)
|
|
113
|
+
Role-based and record-based (deny by default). Reads (`GET /` and `GET /:id`) gate via `read.access`; mutations gate via `crud.{create,update,delete}.access`.
|
|
105
114
|
|
|
106
115
|
```typescript
|
|
116
|
+
read: { access: { roles: ['member'] } }, // gates GET / and GET /:id
|
|
107
117
|
crud: {
|
|
108
|
-
|
|
118
|
+
create: { access: { roles: ['admin'] } },
|
|
109
119
|
update: {
|
|
110
120
|
access: {
|
|
111
121
|
or: [
|
|
@@ -114,9 +124,12 @@ crud: {
|
|
|
114
124
|
],
|
|
115
125
|
},
|
|
116
126
|
},
|
|
127
|
+
delete: { access: { roles: ['admin'] } },
|
|
117
128
|
}
|
|
118
129
|
```
|
|
119
130
|
|
|
131
|
+
> **DSL v2:** `crud.list` and `crud.get` are rejected at compile time. Move them to `read.access`.
|
|
132
|
+
|
|
120
133
|
Operators: `equals`, `notEquals`, `in`, `notIn`, `greaterThan`, `lessThan`
|
|
121
134
|
Context: `$ctx.userId`, `$ctx.activeOrgId`, `$ctx.roles`
|
|
122
135
|
|
|
@@ -164,50 +177,52 @@ validation: {
|
|
|
164
177
|
|
|
165
178
|
## Actions — Custom Business Logic
|
|
166
179
|
|
|
167
|
-
|
|
180
|
+
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.
|
|
168
181
|
|
|
169
182
|
```typescript
|
|
170
|
-
|
|
171
|
-
import {
|
|
172
|
-
import {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
// features/todos/actions/complete.ts
|
|
184
|
+
import { z } from "zod";
|
|
185
|
+
import { eq } from "drizzle-orm";
|
|
186
|
+
import { defineAction } from "../.quickback/define-action";
|
|
187
|
+
import { todos } from "../todos";
|
|
188
|
+
|
|
189
|
+
export default defineAction({
|
|
190
|
+
description: "Mark todo as complete",
|
|
191
|
+
input: z.object({ completedAt: z.string().datetime().optional() }),
|
|
192
|
+
access: { roles: ["member", "admin"], record: { completed: { equals: false } } },
|
|
193
|
+
async execute({ db, record, auditFields }) {
|
|
194
|
+
await db.update(todos)
|
|
195
|
+
.set({ completed: true, modifiedAt: auditFields!.modifiedAt })
|
|
196
|
+
.where(eq(todos.id, record.id));
|
|
197
|
+
return { success: true };
|
|
183
198
|
},
|
|
184
199
|
});
|
|
185
200
|
```
|
|
186
201
|
|
|
187
|
-
Record-based: `POST /api/v1/{resource}/:id/{action}`
|
|
188
|
-
Standalone
|
|
202
|
+
Record-based (no `path:`): `POST /api/v1/{resource}/:id/{action}`
|
|
203
|
+
Standalone (`path:` set): custom `path` and `method`
|
|
204
|
+
|
|
205
|
+
`execute:` must be an `async (ctx) => { … }` arrow function. Retired (rejected at load time): bundled `actions.ts`, `_feature.ts`, `handlers/` directory, `defineActions()`.
|
|
189
206
|
|
|
190
207
|
### Actions-Only Features (no tables)
|
|
191
208
|
|
|
209
|
+
A feature with no top-level `*.ts` files is "tableless" — every action must be standalone (have `path:`).
|
|
210
|
+
|
|
192
211
|
```typescript
|
|
193
|
-
// quickback/features/utilities/actions.ts
|
|
194
|
-
import {
|
|
195
|
-
import {
|
|
196
|
-
|
|
197
|
-
export default
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
handler: "./handlers/health-check",
|
|
205
|
-
},
|
|
212
|
+
// quickback/features/utilities/actions/health-check.ts
|
|
213
|
+
import { z } from "zod";
|
|
214
|
+
import { defineAction } from "../.quickback/define-action";
|
|
215
|
+
|
|
216
|
+
export default defineAction({
|
|
217
|
+
description: "Health check",
|
|
218
|
+
path: "/health",
|
|
219
|
+
method: "GET",
|
|
220
|
+
input: z.object({}),
|
|
221
|
+
access: { roles: ["member", "admin"] },
|
|
222
|
+
async execute() { return { ok: true }; },
|
|
206
223
|
});
|
|
207
224
|
```
|
|
208
225
|
|
|
209
|
-
All actions must have `standalone: true` when there is no table.
|
|
210
|
-
|
|
211
226
|
### Public Actions
|
|
212
227
|
|
|
213
228
|
Use `roles: ["PUBLIC"]` for unauthenticated endpoints. Mandatory audit logged. The wildcard `"*"` is not supported.
|