@jskit-ai/agent-docs 0.1.1
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/DISTR_AGENT.md +25 -0
- package/guide/agent/app-extras/assistant.md +636 -0
- package/guide/agent/app-extras/realtime.md +223 -0
- package/guide/agent/app-setup/a-more-interesting-shell.md +643 -0
- package/guide/agent/app-setup/authentication.md +948 -0
- package/guide/agent/app-setup/console.md +316 -0
- package/guide/agent/app-setup/database-layer.md +775 -0
- package/guide/agent/app-setup/initial-scaffolding.md +714 -0
- package/guide/agent/app-setup/multi-homing.md +655 -0
- package/guide/agent/app-setup/users.md +355 -0
- package/guide/agent/app-setup/working-with-the-jskit-cli.md +983 -0
- package/guide/agent/generators/advanced-cruds.md +923 -0
- package/guide/agent/generators/crud-generators.md +556 -0
- package/guide/agent/generators/intro.md +63 -0
- package/guide/agent/generators/ui-generators.md +648 -0
- package/guide/agent/index.md +39 -0
- package/guide/human/app-extras/assistant.md +695 -0
- package/guide/human/app-extras/realtime.md +270 -0
- package/guide/human/app-setup/a-more-interesting-shell.md +734 -0
- package/guide/human/app-setup/authentication.md +963 -0
- package/guide/human/app-setup/console.md +352 -0
- package/guide/human/app-setup/database-layer.md +822 -0
- package/guide/human/app-setup/initial-scaffolding.md +738 -0
- package/guide/human/app-setup/multi-homing.md +795 -0
- package/guide/human/app-setup/users.md +404 -0
- package/guide/human/app-setup/working-with-the-jskit-cli.md +997 -0
- package/guide/human/generators/advanced-cruds.md +923 -0
- package/guide/human/generators/crud-generators.md +556 -0
- package/guide/human/generators/intro.md +109 -0
- package/guide/human/generators/ui-generators.md +665 -0
- package/guide/human/index.md +39 -0
- package/package.json +28 -0
- package/reference/autogen/KERNEL_MAP.md +536 -0
- package/reference/autogen/README.md +44 -0
- package/reference/autogen/packages/agent-docs.md +13 -0
- package/reference/autogen/packages/assistant-core.md +310 -0
- package/reference/autogen/packages/assistant-runtime.md +219 -0
- package/reference/autogen/packages/assistant.md +73 -0
- package/reference/autogen/packages/auth-core.md +352 -0
- package/reference/autogen/packages/auth-provider-supabase-core.md +223 -0
- package/reference/autogen/packages/auth-web.md +267 -0
- package/reference/autogen/packages/console-core.md +116 -0
- package/reference/autogen/packages/console-web.md +37 -0
- package/reference/autogen/packages/crud-core.md +283 -0
- package/reference/autogen/packages/crud-server-generator.md +220 -0
- package/reference/autogen/packages/crud-ui-generator.md +154 -0
- package/reference/autogen/packages/database-runtime-mysql.md +61 -0
- package/reference/autogen/packages/database-runtime-postgres.md +39 -0
- package/reference/autogen/packages/database-runtime.md +216 -0
- package/reference/autogen/packages/http-runtime.md +213 -0
- package/reference/autogen/packages/kernel.md +1350 -0
- package/reference/autogen/packages/realtime.md +95 -0
- package/reference/autogen/packages/shell-web.md +349 -0
- package/reference/autogen/packages/storage-runtime.md +39 -0
- package/reference/autogen/packages/ui-generator.md +101 -0
- package/reference/autogen/packages/uploads-image-web.md +76 -0
- package/reference/autogen/packages/uploads-runtime.md +85 -0
- package/reference/autogen/packages/users-core.md +307 -0
- package/reference/autogen/packages/users-web.md +473 -0
- package/reference/autogen/packages/workspaces-core.md +415 -0
- package/reference/autogen/packages/workspaces-web.md +372 -0
- package/reference/autogen/tooling/config-eslint.md +52 -0
- package/reference/autogen/tooling/create-app.md +194 -0
- package/reference/autogen/tooling/jskit-catalog.md +27 -0
- package/reference/autogen/tooling/jskit-cli.md +624 -0
- package/reference/autogen/tooling/test-support.md +27 -0
- package/reference/autogen/tooling/testUtils.md +31 -0
- package/templates/APP_BLUEPRINT.md +57 -0
- package/workflow/app-state.md +33 -0
- package/workflow/bootstrap.md +24 -0
- package/workflow/feature-delivery.md +21 -0
- package/workflow/review.md +22 -0
- package/workflow/scoping.md +26 -0
|
@@ -0,0 +1,997 @@
|
|
|
1
|
+
<!-- Generated by `npm run agent-docs:build` from `docs/guide/app-setup/working-with-the-jskit-cli.md`. Do not edit manually. -->
|
|
2
|
+
|
|
3
|
+
# Working with the JSKIT CLI
|
|
4
|
+
|
|
5
|
+
In the first chapter, we used the JSKIT CLI, but only in passing. We created the app, installed dependencies, and moved on.
|
|
6
|
+
|
|
7
|
+
This chapter steps back and treats the CLI as a subject in its own right.
|
|
8
|
+
|
|
9
|
+
That matters because `jskit` is not just "the thing that installs packages". It is the tool that helps you:
|
|
10
|
+
|
|
11
|
+
- discover what JSKIT can do
|
|
12
|
+
- inspect bundles, packages, and generators before using them
|
|
13
|
+
- apply and re-apply JSKIT-managed mutations to your app
|
|
14
|
+
- keep managed files and lock state healthy
|
|
15
|
+
- create your own app-local runtime packages
|
|
16
|
+
|
|
17
|
+
If you understand this chapter early, the rest of the guide becomes much easier to follow.
|
|
18
|
+
|
|
19
|
+
## Recap from previous chapters
|
|
20
|
+
|
|
21
|
+
To get back to the same starting point as the end of the previous chapter, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx @jskit-ai/create-app exampleapp --tenancy-mode none
|
|
25
|
+
cd exampleapp
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If you are already continuing from the previous chapter, you are already in the right place and can skip that setup.
|
|
30
|
+
|
|
31
|
+
One practical note before we start: the discovery commands in this chapter are safe to run right now. Some of the later examples are shown as real commands you will use in later chapters, but you do **not** need to run all of them yet.
|
|
32
|
+
|
|
33
|
+
## What the CLI is actually managing
|
|
34
|
+
|
|
35
|
+
The easiest way to understand `jskit` is to separate it from the other tools in the app.
|
|
36
|
+
|
|
37
|
+
- `jskit` manages JSKIT-owned app mutations
|
|
38
|
+
- `npm install` downloads dependencies from `package.json`
|
|
39
|
+
- `npm run dev` and `npm run build` run Vite
|
|
40
|
+
- `npm run server` runs the backend
|
|
41
|
+
- `npm run db:migrate` runs Knex migrations against the database
|
|
42
|
+
|
|
43
|
+
That separation is crucial.
|
|
44
|
+
|
|
45
|
+
When you run a command such as `npx jskit add package shell-web`, JSKIT updates app-owned files and records what it changed. It does **not** replace npm, Vite, or Knex.
|
|
46
|
+
|
|
47
|
+
The most important record of that managed state lives here:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
.jskit/lock.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
That lock file is the source of truth for installed JSKIT-managed package state. It records things like:
|
|
54
|
+
|
|
55
|
+
- which JSKIT packages are installed
|
|
56
|
+
- which options were used when they were installed
|
|
57
|
+
- which package.json fields were added or changed
|
|
58
|
+
- which managed files or text mutations belong to each package
|
|
59
|
+
|
|
60
|
+
That is why commands such as `update`, `remove`, `position`, `migrations`, and `doctor` all care about `.jskit/lock.json`.
|
|
61
|
+
|
|
62
|
+
## Discover first, change second
|
|
63
|
+
|
|
64
|
+
One of the best habits in JSKIT is to inspect the catalog before mutating the app.
|
|
65
|
+
|
|
66
|
+
### Start with `help`
|
|
67
|
+
|
|
68
|
+
The top-level overview is:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx jskit help
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
That shows the available commands such as:
|
|
75
|
+
|
|
76
|
+
- `list`
|
|
77
|
+
- `show`
|
|
78
|
+
- `add`
|
|
79
|
+
- `update`
|
|
80
|
+
- `remove`
|
|
81
|
+
- `position`
|
|
82
|
+
- `migrations`
|
|
83
|
+
- `create`
|
|
84
|
+
- `doctor`
|
|
85
|
+
|
|
86
|
+
Every command in the CLI also has its own help page. For example:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx jskit help add
|
|
90
|
+
npx jskit help migrations
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
That is the fastest way to check current usage without leaving the terminal.
|
|
94
|
+
|
|
95
|
+
### Use `list` for discovery
|
|
96
|
+
|
|
97
|
+
The broad catalog view is:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npx jskit list
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
By default, this prints three groups:
|
|
104
|
+
|
|
105
|
+
- bundles
|
|
106
|
+
- runtime packages
|
|
107
|
+
- generators
|
|
108
|
+
|
|
109
|
+
That distinction matters.
|
|
110
|
+
|
|
111
|
+
#### Bundles
|
|
112
|
+
|
|
113
|
+
A bundle is a curated install shortcut for several runtime packages that are meant to go together.
|
|
114
|
+
|
|
115
|
+
In the current catalog, `auth-base` is the obvious example. It is a single bundle id, but it expands to several real runtime packages.
|
|
116
|
+
|
|
117
|
+
#### Runtime packages
|
|
118
|
+
|
|
119
|
+
These are the actual packages that change how the app runs. Packages such as `shell-web`, `auth-web`, `users-web`, and `workspaces-web` belong here.
|
|
120
|
+
|
|
121
|
+
These are the things you install with:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx jskit add package ...
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Generators
|
|
128
|
+
|
|
129
|
+
Generators are tooling packages such as `ui-generator`, `crud-server-generator`, and `crud-ui-generator`.
|
|
130
|
+
|
|
131
|
+
They are **not** runtime installs.
|
|
132
|
+
|
|
133
|
+
You do **not** add them with `jskit add`. You run them with:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npx jskit generate ...
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
That distinction is easy to miss at first, and it is one of the main reasons this chapter exists.
|
|
140
|
+
|
|
141
|
+
If you only want one section of the catalog, use a mode:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npx jskit list packages
|
|
145
|
+
npx jskit list generators
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Those two commands are especially useful later in the guide, once you already know roughly what kind of thing you are looking for.
|
|
149
|
+
|
|
150
|
+
If you want bundle members printed inline too, `npx jskit list --full` expands the bundle view. That is useful when you want a quick catalog scan without dropping straight into `show`.
|
|
151
|
+
|
|
152
|
+
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.
|
|
153
|
+
|
|
154
|
+
### Use `show` before you install
|
|
155
|
+
|
|
156
|
+
Once `list` helps you find the right id, `show` is how you inspect it.
|
|
157
|
+
|
|
158
|
+
The basic form is:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npx jskit show <id>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
And the more useful inspection form is:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
npx jskit show <id> --details
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
This command is unusually valuable in JSKIT because packages and bundles do more than "add a dependency". They can:
|
|
171
|
+
|
|
172
|
+
- provide or require capabilities
|
|
173
|
+
- register runtime providers
|
|
174
|
+
- contribute placement entries
|
|
175
|
+
- write files into the app
|
|
176
|
+
- mutate `package.json`, scripts, and text blocks
|
|
177
|
+
|
|
178
|
+
So `show` is the command that answers:
|
|
179
|
+
|
|
180
|
+
- what does this thing actually install?
|
|
181
|
+
- what does it depend on?
|
|
182
|
+
- what runtime surfaces does it contribute?
|
|
183
|
+
- what app-owned files will it write or mutate?
|
|
184
|
+
- what container tokens or import surfaces does it expose?
|
|
185
|
+
|
|
186
|
+
The plain form is useful when you only want to identify something quickly. `--details` is what turns `show` into a real architecture-inspection command.
|
|
187
|
+
|
|
188
|
+
### What `show` is good at
|
|
189
|
+
|
|
190
|
+
There are two especially common cases:
|
|
191
|
+
|
|
192
|
+
- you found a bundle or package in `jskit list` and want to know what it really does before you install it
|
|
193
|
+
- you already know a package changed the shell, the runtime graph, or the app tree, and you want to see *how*
|
|
194
|
+
|
|
195
|
+
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.
|
|
196
|
+
|
|
197
|
+
### A first example: what does `auth-base` actually install?
|
|
198
|
+
|
|
199
|
+
Run:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
npx jskit show auth-base --details
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
This output is short, but it already teaches something important:
|
|
206
|
+
|
|
207
|
+
- `auth-base` is a **bundle**
|
|
208
|
+
- it is not a runtime package by itself
|
|
209
|
+
|
|
210
|
+
It expands to two real runtime packages:
|
|
211
|
+
|
|
212
|
+
- `@jskit-ai/auth-core`
|
|
213
|
+
- `@jskit-ai/auth-web`
|
|
214
|
+
|
|
215
|
+
That is exactly the kind of thing you want to know before you mutate the app. For a bundle, this is often the main question:
|
|
216
|
+
|
|
217
|
+
- *what real packages am I about to get?*
|
|
218
|
+
|
|
219
|
+
`auth-base` is a good example because the bundle name is short and convenient, but the detailed view makes the underlying install explicit. It also helps you keep the mental model straight:
|
|
220
|
+
|
|
221
|
+
- bundles are install shortcuts
|
|
222
|
+
- runtime packages are the things that actually provide capabilities
|
|
223
|
+
|
|
224
|
+
### A richer example: what does `workspaces-web` contribute?
|
|
225
|
+
|
|
226
|
+
Run:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npx jskit show @jskit-ai/workspaces-web --details
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
This is where `--details` becomes much more powerful.
|
|
233
|
+
|
|
234
|
+
The compact form of `show` is fine when you only want the package description. The detailed form can show things like:
|
|
235
|
+
|
|
236
|
+
- provided and required capabilities
|
|
237
|
+
- summary import surfaces / exported subpaths
|
|
238
|
+
- container tokens
|
|
239
|
+
- placement outlets
|
|
240
|
+
- default placement contributions
|
|
241
|
+
- dependency mutations
|
|
242
|
+
- script mutations
|
|
243
|
+
- text mutations
|
|
244
|
+
- file writes
|
|
245
|
+
- runtime providers
|
|
246
|
+
|
|
247
|
+
That makes `show --details` one of the best "read before you write" commands in the whole CLI.
|
|
248
|
+
|
|
249
|
+
### Why `--details` matters
|
|
250
|
+
|
|
251
|
+
The plain form:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npx jskit show @jskit-ai/workspaces-web
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
is mainly for identifying the package at a glance.
|
|
258
|
+
|
|
259
|
+
The detailed form:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
npx jskit show @jskit-ai/workspaces-web --details
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
is for understanding the package as part of the app architecture. It lets you answer concrete questions from one command instead of hunting across descriptors and generated files.
|
|
266
|
+
|
|
267
|
+
That is the version you should prefer when you are making a real install decision.
|
|
268
|
+
|
|
269
|
+
### What `show --details` teaches you
|
|
270
|
+
|
|
271
|
+
The output is not one giant wall of metadata. It is answering several practical questions. You do not need to read every line. Read the sections that answer the question you currently have.
|
|
272
|
+
|
|
273
|
+
#### "What capabilities does this package participate in?"
|
|
274
|
+
|
|
275
|
+
The `Capabilities` section tells you:
|
|
276
|
+
|
|
277
|
+
- what the package provides
|
|
278
|
+
- what it requires from other packages
|
|
279
|
+
|
|
280
|
+
That helps you reason about dependency direction and why some packages bring others with them.
|
|
281
|
+
|
|
282
|
+
For `@jskit-ai/workspaces-web`, the detailed output shows:
|
|
283
|
+
|
|
284
|
+
- it **provides** `workspaces.web`
|
|
285
|
+
- it **requires** `users.web` and `workspaces.core`
|
|
286
|
+
|
|
287
|
+
That immediately tells you this package is not just some loose UI helper. It is the web layer of the workspace feature set, and it expects the users and workspace core layers underneath it.
|
|
288
|
+
|
|
289
|
+
#### "What UI does this package contribute?"
|
|
290
|
+
|
|
291
|
+
The placement sections are often the most useful part of `show --details`.
|
|
292
|
+
|
|
293
|
+
For `@jskit-ai/workspaces-web`, the detailed output shows placement contributions such as:
|
|
294
|
+
|
|
295
|
+
- the workspace selector in `shell-layout:top-left`
|
|
296
|
+
- the pending invites cue in `shell-layout:top-right`
|
|
297
|
+
- the workspace tools widget on the `admin` surface
|
|
298
|
+
- the `Members` and workspace settings menu entries
|
|
299
|
+
|
|
300
|
+
That lets you answer a very concrete question before installing anything:
|
|
301
|
+
|
|
302
|
+
- *what will change in the shell if I add this package?*
|
|
303
|
+
|
|
304
|
+
It also shows placement outlets, such as:
|
|
305
|
+
|
|
306
|
+
- `admin-settings:primary-menu`
|
|
307
|
+
|
|
308
|
+
which helps you understand where later app-owned pages or settings links can attach.
|
|
309
|
+
|
|
310
|
+
#### "What import paths, tokens, or providers does it register?"
|
|
311
|
+
|
|
312
|
+
The detailed output can also show:
|
|
313
|
+
|
|
314
|
+
- summary import surfaces / exported subpaths
|
|
315
|
+
- container tokens
|
|
316
|
+
- runtime providers
|
|
317
|
+
|
|
318
|
+
For `@jskit-ai/workspaces-web`, that includes client tokens such as:
|
|
319
|
+
|
|
320
|
+
- `workspaces.web.workspace.selector`
|
|
321
|
+
- `workspaces.web.workspace.tools.widget`
|
|
322
|
+
- `workspaces.web.members-admin.element`
|
|
323
|
+
|
|
324
|
+
It also shows a short `Summary` section with the main client import surfaces, such as:
|
|
325
|
+
|
|
326
|
+
- `@jskit-ai/workspaces-web/client`
|
|
327
|
+
- `@jskit-ai/workspaces-web/client/providers/WorkspacesWebClientProvider`
|
|
328
|
+
- `@jskit-ai/workspaces-web/client/composables/useWorkspaceRouteContext`
|
|
329
|
+
|
|
330
|
+
That gives you a quick view of the package's client integration surface without reading the source first.
|
|
331
|
+
|
|
332
|
+
This is especially useful when you are asking questions like:
|
|
333
|
+
|
|
334
|
+
- *does this package expose a client entrypoint I can import from?*
|
|
335
|
+
- *does it register a provider, or am I expected to wire components myself?*
|
|
336
|
+
- *what token name should I expect to see in placements or providers?*
|
|
337
|
+
|
|
338
|
+
#### "What app-owned files will it touch?"
|
|
339
|
+
|
|
340
|
+
The `File writes`, `Text mutations`, and `Script mutations` sections answer one of the most practical questions in JSKIT:
|
|
341
|
+
|
|
342
|
+
- *what will this package actually do to my app tree?*
|
|
343
|
+
|
|
344
|
+
For `@jskit-ai/workspaces-web`, the detailed view shows app-owned files such as:
|
|
345
|
+
|
|
346
|
+
- workspace surface route scaffolds
|
|
347
|
+
- workspace settings pages
|
|
348
|
+
- `WorkspaceNotFoundCard.vue`
|
|
349
|
+
- `useWorkspaceNotFoundState.js`
|
|
350
|
+
|
|
351
|
+
It also shows text mutations such as:
|
|
352
|
+
|
|
353
|
+
- appending placement entries to `src/placement.js`
|
|
354
|
+
- registering tokens in `packages/main/src/client/providers/MainClientProvider.js`
|
|
355
|
+
|
|
356
|
+
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.
|
|
357
|
+
|
|
358
|
+
### The kinds of questions this answers well
|
|
359
|
+
|
|
360
|
+
Once you get used to it, `show --details` is the fast answer to questions like:
|
|
361
|
+
|
|
362
|
+
- *what does this bundle really install?*
|
|
363
|
+
- *why did this package add a new shell widget?*
|
|
364
|
+
- *which capabilities does this package provide and require?*
|
|
365
|
+
- *which app-owned files will JSKIT write if I install this?*
|
|
366
|
+
- *where do later pages or placements plug into this package?*
|
|
367
|
+
- *what container tokens or client entrypoints does this package expose?*
|
|
368
|
+
|
|
369
|
+
### How to read the output at a high level
|
|
370
|
+
|
|
371
|
+
Not every package shows every section, and that is normal. A good reading order is:
|
|
372
|
+
|
|
373
|
+
1. `Information`
|
|
374
|
+
- what is this thing?
|
|
375
|
+
2. `Summary`
|
|
376
|
+
- what are the main import paths or public entrypoints?
|
|
377
|
+
3. `Depends on`
|
|
378
|
+
- what else does it need?
|
|
379
|
+
4. `Capabilities`
|
|
380
|
+
- what role does it play in the runtime graph?
|
|
381
|
+
5. `Placement contributions` / `Placement outlets`
|
|
382
|
+
- what UI surfaces does it add?
|
|
383
|
+
6. `File writes` and `Text mutations`
|
|
384
|
+
- what app-owned files will change?
|
|
385
|
+
7. `Runtime providers` and `Container tokens`
|
|
386
|
+
- what does it register internally?
|
|
387
|
+
|
|
388
|
+
That is enough to make `show --details` useful without treating it like a formal spec.
|
|
389
|
+
|
|
390
|
+
### A simple rule of thumb
|
|
391
|
+
|
|
392
|
+
Use:
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
npx jskit show <id>
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
when you only want to identify a package or bundle quickly.
|
|
399
|
+
|
|
400
|
+
Use:
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
npx jskit show <id> --details
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
when you are seriously considering installing it, or when you need to understand why a package changed the shell, the config, or the runtime in a particular way.
|
|
407
|
+
|
|
408
|
+
## Make the terminal nicer: `completion`
|
|
409
|
+
|
|
410
|
+
The CLI also ships with Bash completion:
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
npx jskit completion bash
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
That prints the completion script to stdout.
|
|
417
|
+
|
|
418
|
+
If you only want completion for the current shell session, run:
|
|
419
|
+
|
|
420
|
+
```bash
|
|
421
|
+
source <(npx jskit completion bash)
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
If you want JSKIT completion to keep working in future Bash sessions too, run:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
npx jskit completion bash --install
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
This is not required, but it is genuinely useful once you start using commands such as `add`, `generate`, and `show` frequently.
|
|
431
|
+
|
|
432
|
+
## Installing runtime capability: `add`
|
|
433
|
+
|
|
434
|
+
The install command comes in two main forms:
|
|
435
|
+
|
|
436
|
+
```bash
|
|
437
|
+
npx jskit add package shell-web
|
|
438
|
+
npx jskit add bundle auth-base
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Those two examples look similar, but they do different things.
|
|
442
|
+
|
|
443
|
+
### `add package`
|
|
444
|
+
|
|
445
|
+
Use this when you know the exact runtime package you want:
|
|
446
|
+
|
|
447
|
+
```bash
|
|
448
|
+
npx jskit add package shell-web
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
This is the command the next chapter uses.
|
|
452
|
+
|
|
453
|
+
Important defaults:
|
|
454
|
+
|
|
455
|
+
- short ids such as `shell-web` resolve to `@jskit-ai/shell-web` when available
|
|
456
|
+
- JSKIT records the install in `.jskit/lock.json`
|
|
457
|
+
- JSKIT rewrites app-owned managed files as needed
|
|
458
|
+
- npm install does **not** run unless you ask for it with `--run-npm-install`
|
|
459
|
+
|
|
460
|
+
That last point is why the normal guide flow is still:
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
npx jskit add package shell-web
|
|
464
|
+
npm install
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
`jskit add` changes the app. `npm install` downloads the dependencies that the changed app now requires.
|
|
468
|
+
|
|
469
|
+
### `add bundle`
|
|
470
|
+
|
|
471
|
+
Use this when the catalog already offers a sensible grouped install:
|
|
472
|
+
|
|
473
|
+
```bash
|
|
474
|
+
npx jskit add bundle auth-base
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
Bundles are a convenience layer. They save you from having to remember and install several related runtime packages one by one.
|
|
478
|
+
|
|
479
|
+
This is why `show auth-base --details` is useful first: it lets you see what the bundle will actually install.
|
|
480
|
+
|
|
481
|
+
### Generator packages are different
|
|
482
|
+
|
|
483
|
+
This is worth saying one more time because it causes confusion early on.
|
|
484
|
+
|
|
485
|
+
If `npx jskit list generators` shows a package such as `crud-ui-generator`, that does **not** mean you should run:
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
npx jskit add package crud-ui-generator
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
Generators are tooling packages. You use them through `jskit generate`, not `jskit add`.
|
|
492
|
+
|
|
493
|
+
## Managed-file lifecycle: `update`, `remove`, and `position`
|
|
494
|
+
|
|
495
|
+
Once a package is installed, JSKIT treats it as managed app state, not just as "one more dependency".
|
|
496
|
+
|
|
497
|
+
That state lives in `.jskit/lock.json`, which is why lifecycle commands all start from the lock record for the installed package. In practice, that means JSKIT remembers:
|
|
498
|
+
|
|
499
|
+
- which package is installed
|
|
500
|
+
- which install options were used
|
|
501
|
+
- which files, text mutations, dependency entries, and migrations it owns
|
|
502
|
+
|
|
503
|
+
The easiest way to think about the lifecycle is:
|
|
504
|
+
|
|
505
|
+
1. `jskit add package ...` creates managed state
|
|
506
|
+
2. `jskit update package ...` reapplies that managed state
|
|
507
|
+
3. `jskit position element ...` reapplies just the positioning layer
|
|
508
|
+
4. `jskit remove package ...` removes the managed state
|
|
509
|
+
|
|
510
|
+
That is a better mental model than thinking of these as three unrelated commands.
|
|
511
|
+
|
|
512
|
+
### `update` re-applies one installed package
|
|
513
|
+
|
|
514
|
+
The basic shape is:
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
npx jskit update package workspaces-web
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
This does **not** mean "fetch the newest npm version" in the way people often expect from other ecosystems.
|
|
521
|
+
|
|
522
|
+
In JSKIT, `update package ...` means:
|
|
523
|
+
|
|
524
|
+
- find the installed package in `.jskit/lock.json`
|
|
525
|
+
- reuse the saved lock options unless you override them inline
|
|
526
|
+
- run the normal package-application flow again with forced reapply
|
|
527
|
+
|
|
528
|
+
So `update` is for reapplying package-owned managed changes, not for generic dependency upgrades.
|
|
529
|
+
|
|
530
|
+
The best guide example is the tenancy-mode recovery path from the multi-homing chapter. If you installed `workspaces-core` or `workspaces-web` while the app was still on `tenancyMode = "none"`, then later changed the app to `personal`, the missing gated scaffold does not backfill automatically. The recovery path is:
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
npx jskit update package workspaces-core
|
|
534
|
+
npx jskit update package workspaces-web
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
That works because `update` reuses the saved install record and re-applies the package after the surrounding app state has changed.
|
|
538
|
+
|
|
539
|
+
This is the main kind of problem `update` solves:
|
|
540
|
+
|
|
541
|
+
- a package was installed correctly for the app state at the time
|
|
542
|
+
- the app state changed later
|
|
543
|
+
- the package's managed mutations need to be applied again
|
|
544
|
+
|
|
545
|
+
### `position` re-applies only the placement/positioning layer
|
|
546
|
+
|
|
547
|
+
The positioning command is:
|
|
548
|
+
|
|
549
|
+
```bash
|
|
550
|
+
npx jskit position element workspaces-web
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
This is the focused version of reapply.
|
|
554
|
+
|
|
555
|
+
It reads the installed package from the lock file and reapplies only positioning mutations. That makes it especially useful for placement-heavy packages such as `shell-web` or `workspaces-web`, where a package contributes:
|
|
556
|
+
|
|
557
|
+
- shell placements
|
|
558
|
+
- menu entries
|
|
559
|
+
- outlet-targeted UI elements
|
|
560
|
+
- ordering-sensitive positioned elements
|
|
561
|
+
|
|
562
|
+
Use `position` when:
|
|
563
|
+
|
|
564
|
+
- the package itself is still installed
|
|
565
|
+
- you only need the placement layer refreshed
|
|
566
|
+
- you do **not** want a full package reapply
|
|
567
|
+
|
|
568
|
+
A realistic example is a workspace-heavy shell where the placement registry or surrounding shell files were edited, merged, or recovered and you want JSKIT to re-apply the `workspaces-web` positioned contributions without rerunning the whole install flow:
|
|
569
|
+
|
|
570
|
+
```bash
|
|
571
|
+
npx jskit position element workspaces-web
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
That is why the target word is `element` rather than `package`. This command is about positioned UI contributions, not general package installation.
|
|
575
|
+
|
|
576
|
+
It also does **not** run npm install. This is a focused managed-file repair command, not a dependency-install step.
|
|
577
|
+
|
|
578
|
+
### `remove` removes managed state for one installed package
|
|
579
|
+
|
|
580
|
+
The removal form is:
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
npx jskit remove package workspaces-web
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
This is the inverse side of the lifecycle.
|
|
587
|
+
|
|
588
|
+
`remove` uses the lock record to tear out the managed state that package owns. In practice, that means it:
|
|
589
|
+
|
|
590
|
+
- removes the package's lock entry
|
|
591
|
+
- restores or removes the `package.json` fields JSKIT originally managed
|
|
592
|
+
- removes managed files only when they still match the version JSKIT owns
|
|
593
|
+
|
|
594
|
+
That last part is important. JSKIT is trying to remove package-owned managed state without blindly deleting user-owned edits.
|
|
595
|
+
|
|
596
|
+
Two practical things to remember:
|
|
597
|
+
|
|
598
|
+
- `remove` can refuse to run if other installed packages depend on the target package
|
|
599
|
+
- it does **not** automatically delete app-owned local package directories such as `packages/contacts/`
|
|
600
|
+
|
|
601
|
+
So if you created a local package yourself, `remove` cleans up the JSKIT-managed install state, but it does not assume it should delete the directory you own.
|
|
602
|
+
|
|
603
|
+
### The practical rule of thumb
|
|
604
|
+
|
|
605
|
+
If a package is already installed and you are deciding which command to use, think like this:
|
|
606
|
+
|
|
607
|
+
- use `update` when the package's full managed install state needs to be applied again
|
|
608
|
+
- use `position` when only its placement/positioning contributions need to be refreshed
|
|
609
|
+
- use `remove` when you want JSKIT to cleanly remove the managed package state from the app
|
|
610
|
+
|
|
611
|
+
All three commands make more sense once you see them as one lifecycle around `.jskit/lock.json`, not as isolated CLI tricks.
|
|
612
|
+
|
|
613
|
+
### `doctor` checks managed-state health
|
|
614
|
+
|
|
615
|
+
The health check is:
|
|
616
|
+
|
|
617
|
+
```bash
|
|
618
|
+
npx jskit doctor
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
This is JSKIT's normal app-health check for JSKIT-managed state.
|
|
622
|
+
|
|
623
|
+
It is not a linter, and it is not a test runner. It validates the things that only JSKIT itself can really verify.
|
|
624
|
+
|
|
625
|
+
In the current CLI, that includes checks such as:
|
|
626
|
+
|
|
627
|
+
- installed package entries in `.jskit/lock.json`
|
|
628
|
+
- whether managed files recorded in the lock still exist
|
|
629
|
+
- whether installed packages are still visible in the package registry
|
|
630
|
+
- certain JSKIT-specific app checks, such as invalid raw `mdi-*` icon literals in Vue templates when the app uses Vuetify's `mdi-svg` iconset
|
|
631
|
+
|
|
632
|
+
That last check is narrower than it sounds. `doctor` is looking for the broken case in direct Vue templates, such as:
|
|
633
|
+
|
|
634
|
+
```vue
|
|
635
|
+
<v-icon icon="mdi-paw" />
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
It does not flag the normal menu-metadata case in `src/placement.js`, where a shell menu link may still use:
|
|
639
|
+
|
|
640
|
+
```js
|
|
641
|
+
icon: "mdi-cog-outline"
|
|
642
|
+
```
|
|
643
|
+
|
|
644
|
+
because the shell runtime normalizes that metadata before Vuetify renders it. So if you see a `doctor` icon warning, the fix is usually "switch this Vue component to `@mdi/js`", not "remove every `mdi-*` string from the app."
|
|
645
|
+
|
|
646
|
+
In other words, `doctor` helps catch drift between:
|
|
647
|
+
|
|
648
|
+
- what JSKIT thinks it owns
|
|
649
|
+
- what is actually present on disk
|
|
650
|
+
|
|
651
|
+
That is a different job from:
|
|
652
|
+
|
|
653
|
+
- `npm run lint`, which checks source style and static code rules
|
|
654
|
+
- `npm run test`, which checks behavior
|
|
655
|
+
- `npm run build`, which checks whether the app can compile successfully
|
|
656
|
+
|
|
657
|
+
Those commands can all pass while JSKIT-managed state is still inconsistent. `doctor` is the command that checks that JSKIT's own view of the app still makes sense.
|
|
658
|
+
|
|
659
|
+
That is exactly why the starter scaffold already includes `npx jskit doctor` in `npm run verify`.
|
|
660
|
+
|
|
661
|
+
It belongs there because JSKIT apps are not only source trees. They also have:
|
|
662
|
+
|
|
663
|
+
- descriptor-driven runtime installs
|
|
664
|
+
- lock-file state under `.jskit/lock.json`
|
|
665
|
+
- JSKIT-managed files and mutations written into the app
|
|
666
|
+
|
|
667
|
+
`doctor` is the quick confirmation that those pieces still line up after all the normal quality checks pass.
|
|
668
|
+
|
|
669
|
+
This command belongs in your normal quality gate, not only in emergency debugging.
|
|
670
|
+
|
|
671
|
+
### When to run it manually
|
|
672
|
+
|
|
673
|
+
The most common manual use is simply:
|
|
674
|
+
|
|
675
|
+
```bash
|
|
676
|
+
npx jskit doctor
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
after you have done something that changes JSKIT-managed state.
|
|
680
|
+
|
|
681
|
+
Good times to run it manually include:
|
|
682
|
+
|
|
683
|
+
- after `jskit add`, `update`, `remove`, `create package`, or generator commands
|
|
684
|
+
- after rebasing or resolving conflicts that touched `.jskit/lock.json`, `package.json`, or app-owned managed files
|
|
685
|
+
- after deleting, moving, or renaming files that may have been created by JSKIT
|
|
686
|
+
- when a package appears installed in the lock but starts behaving as if it is missing
|
|
687
|
+
- when you want a fast JSKIT-specific health check without waiting for a full test suite
|
|
688
|
+
|
|
689
|
+
One important nuance: `doctor` is checking for broken JSKIT ownership and visibility, not trying to stop you from editing app-owned files. For example, a managed file that still exists but whose contents changed is normally fine. The problem is when JSKIT expects a managed file to exist and it is gone, or when the installed package state no longer resolves cleanly.
|
|
690
|
+
|
|
691
|
+
### Why `--json` exists
|
|
692
|
+
|
|
693
|
+
If you want machine-readable output, use:
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
npx jskit doctor --json
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
That prints a payload with:
|
|
700
|
+
|
|
701
|
+
- `appRoot`
|
|
702
|
+
- `lockVersion`
|
|
703
|
+
- `installedPackages`
|
|
704
|
+
- `issues`
|
|
705
|
+
|
|
706
|
+
This is useful in CI, editor tooling, or custom scripts where you want to parse the result instead of reading plain text. The exit code still does the simple job, but `--json` gives you the exact issue list in a form that other tools can consume.
|
|
707
|
+
|
|
708
|
+
## Migrations: writing files is not the same as running the database
|
|
709
|
+
|
|
710
|
+
This distinction is one of the most important things to understand in JSKIT.
|
|
711
|
+
|
|
712
|
+
The explicit migration-materialization command is:
|
|
713
|
+
|
|
714
|
+
```bash
|
|
715
|
+
npx jskit migrations changed
|
|
716
|
+
```
|
|
717
|
+
|
|
718
|
+
This command does **not** run Knex against the database.
|
|
719
|
+
|
|
720
|
+
What it does is:
|
|
721
|
+
|
|
722
|
+
- look at installed packages in `.jskit/lock.json`
|
|
723
|
+
- decide which installed packages have managed migrations that need to be materialized
|
|
724
|
+
- write those migration files into your app
|
|
725
|
+
|
|
726
|
+
So this command is about **managed migration files on disk**.
|
|
727
|
+
|
|
728
|
+
In many normal `jskit add` flows, those migration files are already written as part of package application. `jskit migrations changed` is the explicit re-sync command when you want JSKIT to materialize the migration files again based on the current installed package state.
|
|
729
|
+
|
|
730
|
+
The database execution step is still:
|
|
731
|
+
|
|
732
|
+
```bash
|
|
733
|
+
npm run db:migrate
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
That step is about **running** the migration files that already exist.
|
|
737
|
+
|
|
738
|
+
The clean mental model is:
|
|
739
|
+
|
|
740
|
+
1. JSKIT materializes managed migration files
|
|
741
|
+
2. Knex executes them against the database
|
|
742
|
+
|
|
743
|
+
If you remember only one thing from this section, make it this:
|
|
744
|
+
|
|
745
|
+
- `jskit migrations ...` writes or refreshes managed migration files
|
|
746
|
+
- `npm run db:migrate` actually applies migrations to the database
|
|
747
|
+
|
|
748
|
+
Do not confuse those two steps.
|
|
749
|
+
|
|
750
|
+
Here is the practical version:
|
|
751
|
+
|
|
752
|
+
```bash
|
|
753
|
+
# Common install flow for a schema-bearing package
|
|
754
|
+
npx jskit add package users-web
|
|
755
|
+
npm install
|
|
756
|
+
npm run db:migrate
|
|
757
|
+
|
|
758
|
+
# Refresh flow when JSKIT needs to re-materialize managed migration files
|
|
759
|
+
npx jskit migrations changed
|
|
760
|
+
npm run db:migrate
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
In the first flow, package installation usually already wrote the managed migration files. In the second flow, you are explicitly asking JSKIT to write or refresh them again before Knex applies them.
|
|
764
|
+
|
|
765
|
+
## Creating your own local package
|
|
766
|
+
|
|
767
|
+
JSKIT can also scaffold a brand-new app-local runtime package:
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
npx jskit create package contacts
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
If your app is named `exampleapp`, that command creates a package id like:
|
|
774
|
+
|
|
775
|
+
```text
|
|
776
|
+
@exampleapp/contacts
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
and scaffolds a real local package under:
|
|
780
|
+
|
|
781
|
+
```text
|
|
782
|
+
packages/contacts/
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
This is the direct CLI path for creating your own runtime package inside the app.
|
|
786
|
+
|
|
787
|
+
It is for the cases where you are authoring the package yourself:
|
|
788
|
+
|
|
789
|
+
- you want a new package boundary under `packages/`
|
|
790
|
+
- you want to define your own descriptor, providers, routes, or capabilities
|
|
791
|
+
- you are building app-specific runtime code, not installing something prebuilt from the catalog
|
|
792
|
+
|
|
793
|
+
That makes it different from both `add` and `generate`.
|
|
794
|
+
|
|
795
|
+
- `jskit add package ...` installs an existing runtime package from the catalog or from `node_modules`
|
|
796
|
+
- `jskit generate ...` runs a generator that writes app-owned scaffold files for a specific job such as CRUD
|
|
797
|
+
- `jskit create package ...` gives you a blank but valid app-local runtime package to grow yourself
|
|
798
|
+
|
|
799
|
+
### What the command creates
|
|
800
|
+
|
|
801
|
+
The new package is intentionally small. For `contacts`, the scaffold looks like this:
|
|
802
|
+
|
|
803
|
+
```text
|
|
804
|
+
packages/contacts/
|
|
805
|
+
README.md
|
|
806
|
+
package.json
|
|
807
|
+
package.descriptor.mjs
|
|
808
|
+
src/index.js
|
|
809
|
+
src/client/index.js
|
|
810
|
+
src/server/index.js
|
|
811
|
+
src/shared/index.js
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
The command also updates two app-level files:
|
|
815
|
+
|
|
816
|
+
- `package.json`
|
|
817
|
+
- `.jskit/lock.json`
|
|
818
|
+
|
|
819
|
+
That means `create package` is not just "make a folder". It creates a real local JSKIT package and registers it with the app.
|
|
820
|
+
|
|
821
|
+
The important pieces are:
|
|
822
|
+
|
|
823
|
+
- `package.json`
|
|
824
|
+
defines a private local package with exports for `.`, `./client`, `./server`, and `./shared`
|
|
825
|
+
- `package.descriptor.mjs`
|
|
826
|
+
starts as a runtime descriptor with empty `dependsOn`, `capabilities`, `runtime`, `metadata`, and `mutations` sections ready for you to fill in
|
|
827
|
+
- `src/index.js`
|
|
828
|
+
gives the package a top-level module entrypoint, even before you decide what should be exported from it
|
|
829
|
+
- `src/client/index.js`
|
|
830
|
+
exports an empty `routeComponents` map and a no-op `bootClient()` so the package already has a valid client entrypoint
|
|
831
|
+
- `src/server/index.js` and `src/shared/index.js`
|
|
832
|
+
give you the server and shared entrypoints without assuming any implementation yet
|
|
833
|
+
- `README.md`
|
|
834
|
+
reminds you that the next step is to define runtime providers and real exports
|
|
835
|
+
|
|
836
|
+
This is a deliberate contrast with generated CRUD packages. A CRUD generator writes a much more opinionated scaffold: repository code, routes, actions, migrations, and resource definitions. `create package` does not guess any of that. It gives you the smallest valid runtime package boundary.
|
|
837
|
+
|
|
838
|
+
### How the new package fits into the app
|
|
839
|
+
|
|
840
|
+
When you create `contacts`, JSKIT also adds a file dependency to the app root `package.json`:
|
|
841
|
+
|
|
842
|
+
```json
|
|
843
|
+
"@exampleapp/contacts": "file:packages/contacts"
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
and records the package in `.jskit/lock.json` as a `local-package`.
|
|
847
|
+
|
|
848
|
+
That has a few consequences:
|
|
849
|
+
|
|
850
|
+
- the package becomes part of the app's managed JSKIT state
|
|
851
|
+
- `jskit list packages` can see it alongside catalog packages
|
|
852
|
+
- later `update`, `remove`, and related lifecycle commands know this package exists
|
|
853
|
+
- the package is still app-owned, so JSKIT does not assume it can delete your directory just because managed state changes
|
|
854
|
+
|
|
855
|
+
This is the same idea you already saw in the starter app's `packages/main/` package. `create package` is how you make another package like that on purpose, instead of waiting for a generator to create one indirectly.
|
|
856
|
+
|
|
857
|
+
One practical point is easy to miss: the package exists immediately, but it does not do anything interesting until you give the descriptor real runtime hooks. In other words, after `create package`, you still need to add things such as:
|
|
858
|
+
|
|
859
|
+
- client providers
|
|
860
|
+
- server providers
|
|
861
|
+
- routes or UI metadata
|
|
862
|
+
- capabilities or dependency declarations
|
|
863
|
+
|
|
864
|
+
So think of `create package` as "establish the package boundary first, then implement the runtime behavior."
|
|
865
|
+
|
|
866
|
+
Because the command adds a file dependency, the normal follow-up is still:
|
|
867
|
+
|
|
868
|
+
```bash
|
|
869
|
+
npm install
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
or:
|
|
873
|
+
|
|
874
|
+
```bash
|
|
875
|
+
npx jskit create package contacts --run-npm-install
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
JSKIT updates the app files. npm refreshes dependency installation.
|
|
879
|
+
|
|
880
|
+
### When to use it instead of a generator
|
|
881
|
+
|
|
882
|
+
Use `create package` when you are designing the package structure yourself.
|
|
883
|
+
|
|
884
|
+
Good fits include:
|
|
885
|
+
|
|
886
|
+
- a custom integration package that talks to one external API
|
|
887
|
+
- app-specific auth or policy behavior
|
|
888
|
+
- a local runtime package that owns both client and server behavior for one feature area
|
|
889
|
+
- a package that starts small now but may later grow providers, shared helpers, and routes
|
|
890
|
+
|
|
891
|
+
Use a generator when the problem is already understood well enough that JSKIT can scaffold the feature shape for you.
|
|
892
|
+
|
|
893
|
+
For example:
|
|
894
|
+
|
|
895
|
+
- `npx jskit create package contacts`
|
|
896
|
+
gives you an empty-but-valid `packages/contacts/` package boundary
|
|
897
|
+
- `npx jskit generate crud-server-generator scaffold contacts ...`
|
|
898
|
+
creates a CRUD-shaped package with repository, service, route, action, and migration files
|
|
899
|
+
|
|
900
|
+
Those commands can both result in a package under `packages/contacts/`, but they start from very different assumptions.
|
|
901
|
+
|
|
902
|
+
The other contrast is with catalog installs:
|
|
903
|
+
|
|
904
|
+
- `npx jskit add package workspaces-web`
|
|
905
|
+
installs a package someone else already authored
|
|
906
|
+
- `npx jskit create package contacts`
|
|
907
|
+
creates a package that your app will author and own
|
|
908
|
+
|
|
909
|
+
### `--scope`, `--package-id`, and `--description` in practice
|
|
910
|
+
|
|
911
|
+
The three most important inline options are about naming and identity.
|
|
912
|
+
|
|
913
|
+
#### `--scope`
|
|
914
|
+
|
|
915
|
+
By default, JSKIT derives the scope from the app package name.
|
|
916
|
+
|
|
917
|
+
So if your app is `exampleapp`, this:
|
|
918
|
+
|
|
919
|
+
```bash
|
|
920
|
+
npx jskit create package contacts
|
|
921
|
+
```
|
|
922
|
+
|
|
923
|
+
produces:
|
|
924
|
+
|
|
925
|
+
```text
|
|
926
|
+
package id: @exampleapp/contacts
|
|
927
|
+
directory: packages/contacts
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
If you want a different scope, use `--scope`:
|
|
931
|
+
|
|
932
|
+
```bash
|
|
933
|
+
npx jskit create package contacts --scope local
|
|
934
|
+
```
|
|
935
|
+
|
|
936
|
+
which produces:
|
|
937
|
+
|
|
938
|
+
```text
|
|
939
|
+
package id: @local/contacts
|
|
940
|
+
directory: packages/contacts
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
Use this when you want the package id to follow a deliberate local naming convention instead of the app name.
|
|
944
|
+
|
|
945
|
+
#### `--package-id`
|
|
946
|
+
|
|
947
|
+
`--package-id` overrides the full package id directly:
|
|
948
|
+
|
|
949
|
+
```bash
|
|
950
|
+
npx jskit create package contacts --package-id @acme/contacts
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
This is the strongest naming override. Use it when you already know the exact package id you want.
|
|
954
|
+
|
|
955
|
+
In practice, this matters when:
|
|
956
|
+
|
|
957
|
+
- you want the package id to stay stable even if the app name changes
|
|
958
|
+
- you want a different scope than the default inference
|
|
959
|
+
- you are standardizing naming across several related local packages
|
|
960
|
+
|
|
961
|
+
The package directory is derived from the package name part of the package id, so `@acme/contacts` still creates `packages/contacts/`.
|
|
962
|
+
|
|
963
|
+
#### `--description`
|
|
964
|
+
|
|
965
|
+
`--description` fills the generated descriptor description:
|
|
966
|
+
|
|
967
|
+
```bash
|
|
968
|
+
npx jskit create package contacts \
|
|
969
|
+
--description "App-local contact management runtime package."
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
That is useful because the description is part of the package metadata JSKIT can show later when you inspect local packages. It is a small option, but it makes local packages easier to identify once an app has several of them.
|
|
973
|
+
|
|
974
|
+
So a practical mental model is:
|
|
975
|
+
|
|
976
|
+
- `--scope` chooses the default namespace for the generated package id
|
|
977
|
+
- `--package-id` sets the exact package id directly
|
|
978
|
+
- `--description` makes the generated descriptor self-describing
|
|
979
|
+
|
|
980
|
+
## Summary
|
|
981
|
+
|
|
982
|
+
The JSKIT CLI is easiest to understand if you separate four jobs:
|
|
983
|
+
|
|
984
|
+
- `list`, `show`, and `help` are for discovery and inspection
|
|
985
|
+
- `add`, `update`, and `remove` manage installed JSKIT runtime packages
|
|
986
|
+
- `position`, `doctor`, and `migrations` maintain or repair JSKIT-managed state
|
|
987
|
+
- `create package` scaffolds a new app-local runtime package
|
|
988
|
+
|
|
989
|
+
And then keep one more distinction in your head:
|
|
990
|
+
|
|
991
|
+
- JSKIT manages app-owned package mutations and managed files
|
|
992
|
+
- npm installs dependencies
|
|
993
|
+
- Knex runs database migrations
|
|
994
|
+
|
|
995
|
+
That is the mental model the rest of the guide assumes.
|
|
996
|
+
|
|
997
|
+
The next chapter goes back to the normal hands-on flow and uses that model immediately by installing `shell-web`.
|