@jskit-ai/agent-docs 0.1.63 → 0.1.65
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/app-setup/authentication.md +6 -5
- package/guide/agent/app-setup/initial-scaffolding.md +2 -1
- package/guide/agent/app-setup/quickstart.md +3 -2
- package/guide/agent/app-setup/working-with-the-jskit-cli.md +49 -35
- package/package.json +1 -1
- package/reference/autogen/packages/auth-core.md +1 -0
- package/reference/autogen/packages/auth-provider-local-core.md +5 -1
- package/reference/autogen/tooling/jskit-cli.md +51 -0
|
@@ -18,7 +18,7 @@ If you are already continuing from the previous chapter, you are already in the
|
|
|
18
18
|
|
|
19
19
|
**Default: Start With Local Auth**
|
|
20
20
|
|
|
21
|
-
The default auth path does not require a Supabase project or a database. It uses `auth-local`,
|
|
21
|
+
The default auth path does not require a Supabase project or a database. It uses the local provider package, `auth-provider-local-core`, together with `auth-web`. The local provider stores credentials and sessions in `.jskit/auth/` by default.
|
|
22
22
|
|
|
23
23
|
That is the recommended first step for most apps. After the app's core flow is working, switch to Supabase or add richer auth methods only if the product needs them.
|
|
24
24
|
|
|
@@ -27,11 +27,12 @@ That is the recommended first step for most apps. After the app's core flow is w
|
|
|
27
27
|
From inside `exampleapp`, run:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npx jskit add
|
|
30
|
+
npx jskit add package auth-provider-local-core
|
|
31
|
+
npx jskit add package auth-web
|
|
31
32
|
npm install
|
|
32
33
|
```
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
These package installs add the provider-neutral auth core, the auth web layer, and the local provider. They give the app working register, login, logout, session, and password recovery flows without requiring an external auth service.
|
|
35
36
|
|
|
36
37
|
The final `npm install` matters for the same reason it did in the shell chapter: `jskit add` rewrites the scaffold and updates `package.json`, but `npm install` is what actually downloads the newly referenced runtime packages.
|
|
37
38
|
|
|
@@ -468,7 +469,7 @@ At this point the guide has shown three distinct layers of client state:
|
|
|
468
469
|
|
|
469
470
|
That progression is intentional. Packages keep their operational runtimes internally, but the app-facing shared state they surface to Vue code is store-based.
|
|
470
471
|
|
|
471
|
-
## What
|
|
472
|
+
## What the local auth install adds to the app
|
|
472
473
|
|
|
473
474
|
The interesting part of this chapter is that authentication appears in several different layers at once: environment config, public routing config, shell placements, and app-owned view wrappers.
|
|
474
475
|
|
|
@@ -527,7 +528,7 @@ config.surfaceDefinitions.auth = {
|
|
|
527
528
|
|
|
528
529
|
That `requiresAuth: false` line is important. The auth surface must stay public, otherwise users would need to be logged in before they could reach the login page.
|
|
529
530
|
|
|
530
|
-
The local provider does not need an app database profile mode or OAuth config. The stock login UI asks `/api/session` for the active provider capabilities and renders only what the selected provider actually supports. With
|
|
531
|
+
The local provider does not need an app database profile mode or OAuth config. The stock login UI asks `/api/session` for the active provider capabilities and renders only what the selected provider actually supports. With the local provider, that means email/password login, registration, sign-out, session refresh, and password recovery when recovery is configured.
|
|
531
532
|
|
|
532
533
|
Later, if you switch to Supabase, the Supabase provider can append the app-owned OAuth visibility config and profile mode settings it needs.
|
|
533
534
|
|
|
@@ -53,7 +53,8 @@ npx @jskit-ai/create-app exampleapp --tenancy-mode none
|
|
|
53
53
|
cd exampleapp
|
|
54
54
|
npm install
|
|
55
55
|
|
|
56
|
-
npx jskit add
|
|
56
|
+
npx jskit add package auth-provider-local-core
|
|
57
|
+
npx jskit add package auth-web
|
|
57
58
|
|
|
58
59
|
npx jskit add package database-runtime-mysql \
|
|
59
60
|
--db-host "$DB_HOST" \
|
|
@@ -48,7 +48,8 @@ npx @jskit-ai/create-app testapp --tenancy-mode personal
|
|
|
48
48
|
cd testapp
|
|
49
49
|
npm install
|
|
50
50
|
|
|
51
|
-
npx jskit add
|
|
51
|
+
npx jskit add package auth-provider-local-core
|
|
52
|
+
npx jskit add package auth-web
|
|
52
53
|
|
|
53
54
|
npx jskit add package database-runtime-mysql \
|
|
54
55
|
--db-host "$DB_HOST" \
|
|
@@ -82,7 +83,7 @@ npm install
|
|
|
82
83
|
npm run db:migrate
|
|
83
84
|
```
|
|
84
85
|
|
|
85
|
-
Keep authentication deliberately basic while the product is still taking shape. Start with `auth-
|
|
86
|
+
Keep authentication deliberately basic while the product is still taking shape. Start with the local provider and `auth-web`, build the app's core workflows, then add Supabase, OAuth, OTP, provider linking, app-user projection, or workspace/account complexity when the product actually needs those features.
|
|
86
87
|
|
|
87
88
|
At this point you have:
|
|
88
89
|
|
|
@@ -9,7 +9,7 @@ This chapter steps back and treats the CLI as a subject in its own right.
|
|
|
9
9
|
That matters because `jskit` is not just "the thing that installs packages". It is the tool that helps you:
|
|
10
10
|
|
|
11
11
|
- discover what JSKIT can do
|
|
12
|
-
- inspect
|
|
12
|
+
- inspect packages, generators, and any catalog shortcuts before using them
|
|
13
13
|
- apply and re-apply JSKIT-managed mutations to your app
|
|
14
14
|
- keep managed files and lock state healthy
|
|
15
15
|
- create your own app-local runtime packages
|
|
@@ -28,7 +28,7 @@ The easiest way to understand `jskit` is to separate it from the other tools in
|
|
|
28
28
|
|
|
29
29
|
That separation is crucial.
|
|
30
30
|
|
|
31
|
-
When you run a command such as `npx jskit add
|
|
31
|
+
When you run a command such as `npx jskit add package auth-provider-local-core`, JSKIT updates app-owned files and records what it changed. It does **not** replace npm, Vite, or Knex.
|
|
32
32
|
|
|
33
33
|
The most important record of that managed state lives here:
|
|
34
34
|
|
|
@@ -98,6 +98,22 @@ npx jskit app adopt-managed-scripts
|
|
|
98
98
|
|
|
99
99
|
That command rewrites known old scaffold values to the thin wrapper form above.
|
|
100
100
|
|
|
101
|
+
For older apps that were installed before JSKIT source mutations replaced raw source appends, run the source migration after updating JSKIT packages:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx jskit app update-packages
|
|
105
|
+
npx jskit app migrate-source-mutations --dry-run
|
|
106
|
+
npx jskit app migrate-source-mutations
|
|
107
|
+
npm run verify
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
That migration is the one upgrade script for JSKIT-owned legacy source mutation shapes. It currently normalizes:
|
|
111
|
+
|
|
112
|
+
- `packages/main/src/client/providers/MainClientProvider.js`: moves legacy appended `registerMainClientComponent(...)` calls before `class MainClientProvider`, which is the layout produced by current descriptor `mutations.source` installs.
|
|
113
|
+
- `src/pages/**` CRUD form field modules: folds legacy `UI_CREATE_FORM_FIELDS.push(...)` and `UI_EDIT_FORM_FIELDS.push(...)` calls into the corresponding array literals.
|
|
114
|
+
|
|
115
|
+
The command is idempotent, so rerunning it should report that the source files are already current.
|
|
116
|
+
|
|
101
117
|
## Discover first, change second
|
|
102
118
|
|
|
103
119
|
One of the best habits in JSKIT is to inspect the catalog before mutating the app.
|
|
@@ -151,9 +167,7 @@ That distinction matters.
|
|
|
151
167
|
|
|
152
168
|
#### Bundles
|
|
153
169
|
|
|
154
|
-
A bundle is a curated install shortcut for several runtime packages that are meant to go together.
|
|
155
|
-
|
|
156
|
-
In the current catalog, `auth-local` is the obvious example. It is a single bundle id, but it expands to several real runtime packages.
|
|
170
|
+
A bundle is a curated install shortcut for several runtime packages that are meant to go together. Bundles can still appear in the catalog for compatibility and quick inspection, but the guide uses explicit package installs so the real runtime packages stay visible.
|
|
157
171
|
|
|
158
172
|
#### Runtime packages
|
|
159
173
|
|
|
@@ -188,7 +202,7 @@ npx jskit list generators
|
|
|
188
202
|
|
|
189
203
|
Those two commands are especially useful later in the guide, once you already know roughly what kind of thing you are looking for.
|
|
190
204
|
|
|
191
|
-
If you want bundle members printed inline too, `npx jskit list --full` expands the bundle view. That is useful when you
|
|
205
|
+
If you want bundle members printed inline too, `npx jskit list --full` expands the bundle view. That is useful when you are auditing a shortcut, but package ids are still the normal install vocabulary in this guide.
|
|
192
206
|
|
|
193
207
|
One more detail is worth noticing. In repos that contain local package descriptors, `list packages` can also show app-local or repo-local packages in addition to the published catalog. So `list` is not only a remote catalog browser. It is also a view of what this app can currently see.
|
|
194
208
|
|
|
@@ -208,7 +222,7 @@ And the more useful inspection form is:
|
|
|
208
222
|
npx jskit show <id> --details
|
|
209
223
|
```
|
|
210
224
|
|
|
211
|
-
This command is unusually valuable in JSKIT because packages and
|
|
225
|
+
This command is unusually valuable in JSKIT because packages and catalog shortcuts do more than "add a dependency". They can:
|
|
212
226
|
|
|
213
227
|
- provide or require capabilities
|
|
214
228
|
- register runtime providers
|
|
@@ -230,39 +244,42 @@ The plain form is useful when you only want to identify something quickly. `--de
|
|
|
230
244
|
|
|
231
245
|
There are two especially common cases:
|
|
232
246
|
|
|
233
|
-
- you found a
|
|
247
|
+
- you found a package or shortcut in `jskit list` and want to know what it really does before you install it
|
|
234
248
|
- you already know a package changed the shell, the runtime graph, or the app tree, and you want to see *how*
|
|
235
249
|
|
|
236
250
|
That second case matters just as much as the first one. Later in the guide, chapters explain package behavior one feature at a time. `show --details` is the generic command that lets you inspect those same package contracts directly.
|
|
237
251
|
|
|
238
|
-
### A first example:
|
|
252
|
+
### A first example: inspect the local auth provider
|
|
239
253
|
|
|
240
254
|
Run:
|
|
241
255
|
|
|
242
256
|
```bash
|
|
243
|
-
npx jskit show auth-local --details
|
|
257
|
+
npx jskit show auth-provider-local-core --details
|
|
244
258
|
```
|
|
245
259
|
|
|
246
260
|
This output is short, but it already teaches something important:
|
|
247
261
|
|
|
248
|
-
- `auth-local` is a **
|
|
249
|
-
- it
|
|
262
|
+
- `auth-provider-local-core` is a **runtime package**
|
|
263
|
+
- it selects the local auth provider
|
|
264
|
+
- it depends on the provider-neutral `auth-core`
|
|
250
265
|
|
|
251
|
-
|
|
266
|
+
The default local auth install uses two direct package commands:
|
|
252
267
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
268
|
+
```bash
|
|
269
|
+
npx jskit add package auth-provider-local-core
|
|
270
|
+
npx jskit add package auth-web
|
|
271
|
+
```
|
|
256
272
|
|
|
257
|
-
That is exactly the kind of thing you want to know before you mutate the app
|
|
273
|
+
That is exactly the kind of thing you want to know before you mutate the app:
|
|
258
274
|
|
|
259
|
-
-
|
|
275
|
+
- which package selects the active provider?
|
|
276
|
+
- which package adds the web auth routes and login UI?
|
|
260
277
|
|
|
261
|
-
|
|
278
|
+
It also helps you keep the mental model straight:
|
|
262
279
|
|
|
263
|
-
- bundles are install shortcuts
|
|
264
280
|
- runtime packages are the things that actually provide capabilities
|
|
265
|
-
- provider
|
|
281
|
+
- `auth-provider-local-core` provides the selected `auth.provider`
|
|
282
|
+
- `auth-web` consumes the selected provider and adds the web surface
|
|
266
283
|
|
|
267
284
|
### A richer example: what does `workspaces-web` contribute?
|
|
268
285
|
|
|
@@ -381,7 +398,7 @@ This is especially useful when you are asking questions like:
|
|
|
381
398
|
|
|
382
399
|
#### "What app-owned files will it touch?"
|
|
383
400
|
|
|
384
|
-
The `File writes`, `Text mutations`, and `Script mutations` sections answer one of the most practical questions in JSKIT:
|
|
401
|
+
The `File writes`, `Text mutations`, `Source mutations`, and `Script mutations` sections answer one of the most practical questions in JSKIT:
|
|
385
402
|
|
|
386
403
|
- *what will this package actually do to my app tree?*
|
|
387
404
|
|
|
@@ -395,7 +412,11 @@ For `@jskit-ai/workspaces-web`, the detailed view shows app-owned files such as:
|
|
|
395
412
|
It also shows text mutations such as:
|
|
396
413
|
|
|
397
414
|
- appending placement entries to `src/placement.js`
|
|
398
|
-
|
|
415
|
+
|
|
416
|
+
And it shows source mutations such as:
|
|
417
|
+
|
|
418
|
+
- adding imports to `packages/main/src/client/providers/MainClientProvider.js`
|
|
419
|
+
- registering component tokens in `packages/main/src/client/providers/MainClientProvider.js`
|
|
399
420
|
|
|
400
421
|
That matters because JSKIT packages are not only libraries. Many of them also write scaffold files into the app and extend app-owned provider files.
|
|
401
422
|
|
|
@@ -424,7 +445,7 @@ Not every package shows every section, and that is normal. A good reading order
|
|
|
424
445
|
- what role does it play in the runtime graph?
|
|
425
446
|
5. `Placement contributions` / `Placement outlets`
|
|
426
447
|
- what UI surfaces does it add?
|
|
427
|
-
6. `File writes` and `
|
|
448
|
+
6. `File writes`, `Text mutations`, and `Source mutations`
|
|
428
449
|
- what app-owned files will change?
|
|
429
450
|
7. `Runtime providers` and `Container tokens`
|
|
430
451
|
- what does it register internally?
|
|
@@ -475,14 +496,13 @@ This is not required, but it is genuinely useful once you start using commands s
|
|
|
475
496
|
|
|
476
497
|
## Installing runtime capability: `add`
|
|
477
498
|
|
|
478
|
-
The install command
|
|
499
|
+
The install command you will use most often is:
|
|
479
500
|
|
|
480
501
|
```bash
|
|
481
502
|
npx jskit add package users-web
|
|
482
|
-
npx jskit add bundle auth-local
|
|
483
503
|
```
|
|
484
504
|
|
|
485
|
-
|
|
505
|
+
That command installs one runtime package and its dependency chain.
|
|
486
506
|
|
|
487
507
|
### `add package`
|
|
488
508
|
|
|
@@ -518,15 +538,9 @@ npm run devlinks
|
|
|
518
538
|
|
|
519
539
|
### `add bundle`
|
|
520
540
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
```bash
|
|
524
|
-
npx jskit add bundle auth-local
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
Bundles are a convenience layer. They save you from having to remember and install several related runtime packages one by one.
|
|
541
|
+
Bundles are a convenience layer for catalog shortcuts. Prefer package commands in setup docs and normal app work, especially for auth, because provider ownership is clearer when the selected provider package is installed explicitly.
|
|
528
542
|
|
|
529
|
-
|
|
543
|
+
If you do use a bundle shortcut, inspect it first with `npx jskit show <bundle-id> --details` so you can see the real packages and capabilities it will install.
|
|
530
544
|
|
|
531
545
|
### Generator packages are different
|
|
532
546
|
|
package/package.json
CHANGED
|
@@ -312,6 +312,7 @@ Exports
|
|
|
312
312
|
- `logoutOutputValidator`
|
|
313
313
|
- `oauthProviderCatalogEntryOutputValidator`
|
|
314
314
|
- `authDeniedOutputSchema`
|
|
315
|
+
- `authCapabilitiesOutputSchema`
|
|
315
316
|
- `sessionOutputValidator`
|
|
316
317
|
- `sessionUnavailableOutputValidator`
|
|
317
318
|
- `createCommandMessages({ fields = {}, defaultMessage = "Invalid value." } = {})`
|
|
@@ -47,18 +47,22 @@ Local functions
|
|
|
47
47
|
Exports
|
|
48
48
|
- `createLocalAuthService`
|
|
49
49
|
- `createLocalFileBackend`
|
|
50
|
+
- `hashPassword`
|
|
51
|
+
- `normalizePasswordStrategy`
|
|
52
|
+
- `verifyPassword`
|
|
50
53
|
|
|
51
54
|
### `src/server/lib/passwords.js`
|
|
52
55
|
Exports
|
|
53
56
|
- `hashPassword(password)`
|
|
54
57
|
- `verifyPassword(password, record)`
|
|
58
|
+
- `normalizePasswordStrategy(strategy = null)`
|
|
55
59
|
Local functions
|
|
56
60
|
- `base64url(buffer)`
|
|
57
61
|
- `fromBase64url(value)`
|
|
58
62
|
|
|
59
63
|
### `src/server/lib/service.js`
|
|
60
64
|
Exports
|
|
61
|
-
- `createLocalAuthService({ backend, config, profileProjector = null })`
|
|
65
|
+
- `createLocalAuthService({ backend, config, profileProjector = null, passwordStrategy = null })`
|
|
62
66
|
Local functions
|
|
63
67
|
- `nowSeconds()`
|
|
64
68
|
- `isoFromNow(seconds)`
|
|
@@ -138,6 +138,7 @@ Exports
|
|
|
138
138
|
Local functions
|
|
139
139
|
- `normalizePackageKind(rawValue, descriptorPath)`
|
|
140
140
|
- `validateFileMutationShape(descriptor, descriptorPath)`
|
|
141
|
+
- `validateSourceMutationShape(descriptor, descriptorPath)`
|
|
141
142
|
- `validateLifecycleHookSpec(spec = {}, descriptorPath, label = "lifecycle hook")`
|
|
142
143
|
- `validateLifecycleShape(descriptor, descriptorPath)`
|
|
143
144
|
|
|
@@ -187,6 +188,9 @@ Exports
|
|
|
187
188
|
- `applyTextMutations`
|
|
188
189
|
- `partitionPreFileConfigTextMutations`
|
|
189
190
|
- `resolvePositioningMutations`
|
|
191
|
+
- `applySourceMutations`
|
|
192
|
+
- `partitionPreFileConfigSourceMutations`
|
|
193
|
+
- `resolvePositioningSourceMutations`
|
|
190
194
|
|
|
191
195
|
### `src/server/cliRuntime/mutations/fileMutations.js`
|
|
192
196
|
Exports
|
|
@@ -201,6 +205,32 @@ Exports
|
|
|
201
205
|
Exports
|
|
202
206
|
- `normalizeMutationRelativeFilePath(value = "")`
|
|
203
207
|
|
|
208
|
+
### `src/server/cliRuntime/mutations/sourceMutations.js`
|
|
209
|
+
Exports
|
|
210
|
+
- `applySourceMutations(packageEntry, appRoot, sourceMutations, options, managedSource, touchedFiles, { dryRun = false } = {})`
|
|
211
|
+
- `partitionPreFileConfigSourceMutations(sourceMutations = [])`
|
|
212
|
+
- `resolvePositioningSourceMutations(descriptorMutations = {})`
|
|
213
|
+
Local functions
|
|
214
|
+
- `createSourceFile(relativeFile, sourceText)`
|
|
215
|
+
- `normalizeSourceText(value = "")`
|
|
216
|
+
- `insertText(sourceText, index, text)`
|
|
217
|
+
- `appendBlock(sourceText, block)`
|
|
218
|
+
- `renderImportMutation(mutation, options, packageId, mutationId)`
|
|
219
|
+
- `sourceAlreadyHasImport(sourceFile, rendered)`
|
|
220
|
+
- `ensureImport(sourceText, relativeFile, mutation, options, packageId, mutationId)`
|
|
221
|
+
- `normalizeSourceArg(value = "")`
|
|
222
|
+
- `callExpressionMatches(callExpression, callee, expectedArgs, uniqueArgIndex)`
|
|
223
|
+
- `renderCallMutation(mutation, options, packageId, mutationId)`
|
|
224
|
+
- `ensureCall(sourceText, relativeFile, mutation, options, packageId, mutationId)`
|
|
225
|
+
- `sourceHasAssignmentToTarget(sourceFile, target)`
|
|
226
|
+
- `renderAssignmentStatement(target, value)`
|
|
227
|
+
- `ensureAssignment(sourceText, relativeFile, mutation, options, packageId, mutationId)`
|
|
228
|
+
- `ensureExportConst(sourceText, relativeFile, mutation, options, packageId, mutationId)`
|
|
229
|
+
- `applySourceMutationToContent(sourceText, relativeFile, mutation, options, packageId)`
|
|
230
|
+
- `createManagedSourceRecord(relativeFile, mutation)`
|
|
231
|
+
- `isPositioningSourceMutation(value = {})`
|
|
232
|
+
- `isPreFileConfigSourceMutation(value = {})`
|
|
233
|
+
|
|
204
234
|
### `src/server/cliRuntime/mutations/surfaceTargets.js`
|
|
205
235
|
Exports
|
|
206
236
|
- `resolveSurfaceTargetPathsForMutation({ appRoot, packageId, mutation, configContext } = {})`
|
|
@@ -401,6 +431,27 @@ Local functions
|
|
|
401
431
|
- `replaceWithSymlink(targetPath = "", sourceDir = "", { packageName = "" } = {})`
|
|
402
432
|
- `maybeLinkCompanionPackages({ appRoot = "", repoRoot = "", stdout, createCliError })`
|
|
403
433
|
|
|
434
|
+
### `src/server/commandHandlers/appCommands/migrateSourceMutations.js`
|
|
435
|
+
Exports
|
|
436
|
+
- `buildCrudFormFieldPushMigration(sourceText = "")`
|
|
437
|
+
- `buildMainClientProviderMigration(sourceText = "")`
|
|
438
|
+
- `runAppMigrateSourceMutationsCommand(_ctx = {}, { appRoot = "", options = {}, stdout })`
|
|
439
|
+
Local functions
|
|
440
|
+
- `createSourceFile(sourceText = "")`
|
|
441
|
+
- `readStringLiteralValue(node)`
|
|
442
|
+
- `readRegisterMainClientComponentToken(statement)`
|
|
443
|
+
- `escapeRegExp(value = "")`
|
|
444
|
+
- `findMatchingDelimiter(sourceText = "", openIndex = -1, openChar = "(", closeChar = ")")`
|
|
445
|
+
- `readLineIndent(sourceText = "", index = 0)`
|
|
446
|
+
- `readFormFieldKey(sourceText = "")`
|
|
447
|
+
- `readFormFieldKeys(sourceText = "")`
|
|
448
|
+
- `formatArrayEntry(entrySource = "", indent = " ")`
|
|
449
|
+
- `findFormFieldArrayDeclaration(sourceText = "", arrayName = "")`
|
|
450
|
+
- `findFormFieldPushCalls(sourceText = "", arrayName = "")`
|
|
451
|
+
- `buildArrayContentWithAddedEntries(existingContent = "", entries = [], indent = "")`
|
|
452
|
+
- `applyTextReplacements(sourceText = "", replacements = [])`
|
|
453
|
+
- `collectCrudFormFieldCandidateFiles(appRoot = "")`
|
|
454
|
+
|
|
404
455
|
### `src/server/commandHandlers/appCommands/preparePreviewUser.js`
|
|
405
456
|
Exports
|
|
406
457
|
- `runAppPreparePreviewUserCommand(_ctx = {}, { appRoot = "", options = {}, stdout = process.stdout })`
|