@jskit-ai/agent-docs 0.1.24 → 0.1.26
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/guide/agent/generators/advanced-cruds.md +29 -0
- package/guide/agent/generators/crud-generators.md +16 -0
- package/package.json +1 -1
- package/patterns/crud-scaffolding.md +7 -0
- package/reference/autogen/packages/crud-server-generator.md +3 -2
- package/reference/autogen/packages/kernel.md +1 -0
- package/templates/app/AGENTS.md +1 -0
|
@@ -109,6 +109,35 @@ So if the CRUD resolves to:
|
|
|
109
109
|
|
|
110
110
|
This is why ownership is such a foundational choice. It becomes part of the generated server contract, not just the database shape.
|
|
111
111
|
|
|
112
|
+
### `--internal` changes HTTP exposure, not CRUD ownership
|
|
113
|
+
|
|
114
|
+
`crud-server-generator scaffold` also supports:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
--internal
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
That flag does **not** change:
|
|
121
|
+
|
|
122
|
+
- the generated repository
|
|
123
|
+
- the generated service
|
|
124
|
+
- the shared resource contract
|
|
125
|
+
- the ownership filter
|
|
126
|
+
- the generated actions
|
|
127
|
+
|
|
128
|
+
It changes only one thing:
|
|
129
|
+
|
|
130
|
+
- the generated CRUD HTTP routes are marked internal, so the public HTTP runtime does not register them
|
|
131
|
+
|
|
132
|
+
This is useful when the entity should already be CRUD-owned but should not have public CRUD URLs yet.
|
|
133
|
+
|
|
134
|
+
So the distinction is:
|
|
135
|
+
|
|
136
|
+
- ownership answers "who owns and can see the rows?"
|
|
137
|
+
- `--internal` answers "do the public HTTP CRUD routes exist right now?"
|
|
138
|
+
|
|
139
|
+
That is why `--internal` is not a permissions shortcut and not a UI setting. It is a server-route exposure choice on top of the same CRUD ownership model.
|
|
140
|
+
|
|
112
141
|
### Ownership controls which owner columns are expected
|
|
113
142
|
|
|
114
143
|
The repository layer ultimately applies visibility through the standard owner columns:
|
|
@@ -262,6 +262,22 @@ npx jskit generate crud-server-generator scaffold \
|
|
|
262
262
|
|
|
263
263
|
This creates an app-local package under `packages/contacts/`.
|
|
264
264
|
|
|
265
|
+
If the table should be CRUD-owned now but should **not** expose public HTTP CRUD routes yet, add:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
--internal
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
That keeps the generated repository, service, actions, provider, shared resource, and CRUD migration ownership chain exactly the same. The only difference is that the generated HTTP CRUD routes are marked internal, so the public HTTP runtime does not register them.
|
|
272
|
+
|
|
273
|
+
Use that when:
|
|
274
|
+
|
|
275
|
+
- other server modules need a proper CRUD-backed table and shared resource contract
|
|
276
|
+
- you want to avoid direct knex
|
|
277
|
+
- you are not ready to expose list/view/create/update/delete URLs yet
|
|
278
|
+
|
|
279
|
+
Do **not** use `--internal` as a substitute for ownership or permissions design. It is only about whether the public HTTP CRUD routes exist.
|
|
280
|
+
|
|
265
281
|
Before generating anything, decide these with the developer:
|
|
266
282
|
|
|
267
283
|
- which operations are allowed for this CRUD
|
package/package.json
CHANGED
|
@@ -19,12 +19,19 @@ Rules:
|
|
|
19
19
|
- For a CRUD-backed entity, start with `jskit generate crud-server-generator scaffold ...`.
|
|
20
20
|
- Unless the table is already owned by a JSKIT baseline package or is an explicit narrow exception recorded in `.jskit/table-ownership.json`, every persisted app-owned table must go through that server CRUD step first.
|
|
21
21
|
- That server scaffold is the crucial first step even if no CRUD UI will be created yet.
|
|
22
|
+
- If the table should be CRUD-owned now but should not expose public CRUD HTTP routes yet, scaffold it with `jskit generate crud-server-generator scaffold ... --internal` instead of dropping to direct knex or a hand-built pseudo-repository.
|
|
22
23
|
- Create the real table directly in the database before scaffolding. `crud-server-generator` reads the live table shape.
|
|
23
24
|
- If `crud-server-generator` is going to own the CRUD, do not hand-write a separate CRUD migration for that table. The generator installs and manages the CRUD migration scaffold itself.
|
|
24
25
|
- Do not scaffold CRUD UI, hand-build CRUD routes, or hand-build CRUD endpoints before the server CRUD package and shared resource file exist.
|
|
25
26
|
- Treat the generated shared resource file as the canonical CRUD contract for later UI scaffolding and CRUD behavior changes.
|
|
26
27
|
- `feature-server-generator` is not the default lane for ordinary persisted entities. Use it for workflows or orchestration that sit on top of CRUD-owned tables, or for rare explicit non-CRUD exceptions.
|
|
27
28
|
|
|
29
|
+
Meaning of `--internal`:
|
|
30
|
+
|
|
31
|
+
- it keeps the generated repository, service, actions, provider, resource, and CRUD migration ownership chain
|
|
32
|
+
- it only suppresses public HTTP CRUD route registration
|
|
33
|
+
- it is not a substitute for ownership columns or action/route permissions
|
|
34
|
+
|
|
28
35
|
Avoid:
|
|
29
36
|
|
|
30
37
|
- writing a hand migration for a CRUD table that JSKIT CRUD scaffolding is supposed to own
|
|
@@ -27,6 +27,7 @@ Local functions
|
|
|
27
27
|
- `resolveAllowedValues(schema = {}, fallbackValues = [])`
|
|
28
28
|
- `resolveGlobalScaffoldCache()`
|
|
29
29
|
- `asRecord(value)`
|
|
30
|
+
- `resolveInternalRouteOption(options = {})`
|
|
30
31
|
- `normalizeRequestedOwnershipFilter(value, { strict = false } = {})`
|
|
31
32
|
- `inferOwnershipFilterFromSnapshot(snapshot)`
|
|
32
33
|
- `assertOwnershipColumnsForFilter(snapshot, filter)`
|
|
@@ -94,7 +95,7 @@ Local functions
|
|
|
94
95
|
- `renderObjectSchemaDefinition(lines = [], { mode = "patch" } = {})`
|
|
95
96
|
- `renderActionInputExpressions({ surfaceRequiresWorkspace = true } = {})`
|
|
96
97
|
- `renderRouteValidatorConstants({ surfaceRequiresWorkspace = true } = {})`
|
|
97
|
-
- `buildReplacementsFromSnapshot({ namespace = "", snapshot, resolvedOwnershipFilter, surfaceRequiresWorkspace = true, surfaceId = "" })`
|
|
98
|
+
- `buildReplacementsFromSnapshot({ namespace = "", snapshot, resolvedOwnershipFilter, surfaceRequiresWorkspace = true, surfaceId = "", routeInternal = false })`
|
|
98
99
|
- `resolveCrudGenerationTableName(options = {})`
|
|
99
100
|
- `createCacheKey({ appRoot, options })`
|
|
100
101
|
- `buildCrudTemplateContext(input = {})`
|
|
@@ -201,7 +202,7 @@ Exports
|
|
|
201
202
|
- `resource`
|
|
202
203
|
- `createTemplateServerFixture(options = {})`
|
|
203
204
|
Local functions
|
|
204
|
-
- `buildTemplateReplacements({ surfaceRequiresWorkspace = true, requiresNamedPermissions = surfaceRequiresWorkspace === true, surfaceId = surfaceRequiresWorkspace ? "admin" : "home" } = {})`
|
|
205
|
+
- `buildTemplateReplacements({ surfaceRequiresWorkspace = true, requiresNamedPermissions = surfaceRequiresWorkspace === true, surfaceId = surfaceRequiresWorkspace ? "admin" : "home", routeInternal = false } = {})`
|
|
205
206
|
- `applyTemplateReplacements(sourceText = "", options = {})`
|
|
206
207
|
- `buildResourceStubSource()`
|
|
207
208
|
- `renderServerTemplateFile(targetServerDirectory, fileName, options)`
|
|
@@ -870,6 +870,7 @@ Local functions
|
|
|
870
870
|
- `normalizeMethod(method)`
|
|
871
871
|
- `normalizePath(pathname)`
|
|
872
872
|
- `normalizeRouterMiddlewareStack(value, { context = "middleware" } = {})`
|
|
873
|
+
- `normalizeRouteInternal(value, { method = "", path = "" } = {})`
|
|
873
874
|
- `normalizeRouteInput(method, path, optionsOrHandler, maybeHandler)`
|
|
874
875
|
|
|
875
876
|
### `server/http/lib/routeRegistration.js`
|
package/templates/app/AGENTS.md
CHANGED
|
@@ -73,6 +73,7 @@ Core rules:
|
|
|
73
73
|
- For CRUD chunks, creating the server CRUD with `jskit generate crud-server-generator scaffold ...` is the crucial first step even if no CRUD UI will be created yet.
|
|
74
74
|
- Unless a table is already owned by a JSKIT baseline package or is an explicit narrow exception recorded in `.jskit/table-ownership.json`, every persisted app-owned table must have its own server CRUD package created first with `jskit generate crud-server-generator scaffold ...`, even if no CRUD UI will ever exist.
|
|
75
75
|
- Treat that as a hard invariant, not a style preference. If a persisted app-owned table does not have generated CRUD ownership, `jskit doctor` is expected to fail.
|
|
76
|
+
- If the table should be CRUD-owned but should not expose public CRUD HTTP routes yet, use `jskit generate crud-server-generator scaffold ... --internal` rather than dropping to direct knex or a hand-built pseudo-repository.
|
|
76
77
|
- For a CRUD table that `crud-server-generator` will own, do not hand-write a separate migration. Create the real table directly in the database first, then scaffold the server CRUD so JSKIT can install and manage the CRUD migration scaffold itself.
|
|
77
78
|
- Do not generate CRUD UI or hand-build CRUD routes before the server CRUD package and shared resource file exist.
|
|
78
79
|
- `feature-server-generator` is for workflows, orchestration, and other non-CRUD server features. Do not use it as the starting point for ordinary persisted entity tables.
|