@appweaver/skill 0.0.0-stage → 3.1.0
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/LICENSE +21 -0
- package/README.md +29 -2
- package/index.d.ts +39 -0
- package/index.js +105 -0
- package/package.json +41 -3
- package/skill/GUIDELINES.md +383 -0
- package/skill/SKILL.md +121 -0
- package/skill/references/ai.md +231 -0
- package/skill/references/audit.md +220 -0
- package/skill/references/cache.md +233 -0
- package/skill/references/cli.md +760 -0
- package/skill/references/client.md +982 -0
- package/skill/references/configuration.md +1224 -0
- package/skill/references/database.md +349 -0
- package/skill/references/dependency-injection.md +301 -0
- package/skill/references/errors.md +486 -0
- package/skill/references/events.md +203 -0
- package/skill/references/logging.md +157 -0
- package/skill/references/mailer.md +393 -0
- package/skill/references/mcp.md +245 -0
- package/skill/references/modules.md +509 -0
- package/skill/references/patterns.md +1217 -0
- package/skill/references/payments.md +795 -0
- package/skill/references/queue.md +281 -0
- package/skill/references/realtime.md +572 -0
- package/skill/references/resources.md +2238 -0
- package/skill/references/scheduler.md +228 -0
- package/skill/references/security.md +1185 -0
- package/skill/references/sms.md +143 -0
- package/skill/references/spatial.md +197 -0
- package/skill/references/storage.md +500 -0
- package/skill/references/telemetry.md +207 -0
- package/skill/references/templates.md +488 -0
- package/skill/references/timeseries.md +312 -0
- package/skill/references/workflow.md +224 -0
|
@@ -0,0 +1,760 @@
|
|
|
1
|
+
# CLI
|
|
2
|
+
|
|
3
|
+
All long flags are kebab-case, and an option taking a value requires it (`--types-path <path>`). A flag that turns a
|
|
4
|
+
default behavior off is a `--no-*` negation (`--no-registry`, `--no-skill`), so leaving it out keeps the behavior on.
|
|
5
|
+
The short flags have one meaning in every command: `-h` help, `-v` version, `-o` the output of a command, `-p` the
|
|
6
|
+
TypeScript project, `-w` watch, `-y` yes and `-f` force; every other flag has none. A path flag ends with `-path` for a
|
|
7
|
+
file and `-dir` for a directory (`--prisma-schema-path`, `--client-dir`).
|
|
8
|
+
|
|
9
|
+
Every command printing a report takes `--json` (`config print`, `config check`, `doctor`, `module list`, `routes`,
|
|
10
|
+
`run` without a task), printing the same data as one JSON document on one line of stdout, with the same exit code.
|
|
11
|
+
Anything else, the logs and the errors, goes to stderr, so `weaver doctor --json | jq` reads the report alone.
|
|
12
|
+
|
|
13
|
+
The CLI needs only `@appweaver/core`. `generate`, `seed` and `test setup` load the `@appweaver/data` package of the
|
|
14
|
+
project when they run, and exit with `weaver <command> needs the @appweaver/data package` without it.
|
|
15
|
+
|
|
16
|
+
## `weaver` — Top-level
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
weaver <command> [options]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| Option/Command | Alias | Description |
|
|
23
|
+
| ---------------- | ----- | ------------------------------------------------ |
|
|
24
|
+
| `build` | `b` | Build the application |
|
|
25
|
+
| `config` | `cfg` | Inspect the configuration |
|
|
26
|
+
| `doctor` | | Check the project and print what to fix |
|
|
27
|
+
| `openapi` | `oa` | Generate the OpenAPI specification |
|
|
28
|
+
| `resource new` | | Create the files of a new resource |
|
|
29
|
+
| `routes` | | Print the routes, events and tools of the models |
|
|
30
|
+
| `generate` | `g` | Generate the types and the schemas |
|
|
31
|
+
| `migrate` | - | Apply the pending database migrations |
|
|
32
|
+
| `migration` | - | Create the migrations and reset the database |
|
|
33
|
+
| `module` | `mod` | Manage the modules of the project |
|
|
34
|
+
| `run` | `r` | Run a one-shot task, or list the tasks |
|
|
35
|
+
| `seed` | `sd` | Seed the database |
|
|
36
|
+
| `start` | `s` | Start the application |
|
|
37
|
+
| `test` | `t` | Set up, reset and tear down the test environment |
|
|
38
|
+
| `upgrade` | `up` | Upgrade the Appweaver packages |
|
|
39
|
+
| `help [command]` | | Output usage information of a command |
|
|
40
|
+
| `-v, --version` | | Output the current version |
|
|
41
|
+
| `-h, --help` | | Output usage information |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## `weaver build`
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
weaver build|b [options]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Build the application.
|
|
52
|
+
|
|
53
|
+
| Option | Description | Default |
|
|
54
|
+
| ---------------------- | ------------------------------ | --------------------- |
|
|
55
|
+
| `-p, --project <path>` | TypeScript project config file | `tsconfig.build.json` |
|
|
56
|
+
| `-h, --help` | Output usage information | |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## `weaver config`
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
weaver config|cfg <command> [options]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Inspect the configuration of the application. Each subcommand creates the application without starting it, so the
|
|
67
|
+
config sections of the enabled modules (the installed packages and `src/modules/*`) and of the application files are
|
|
68
|
+
all defined.
|
|
69
|
+
|
|
70
|
+
| Command | Description |
|
|
71
|
+
| ------------------ | -------------------------------------------------------------------- |
|
|
72
|
+
| `schema [options]` | Generate the JSON Schema of `appweaver.json` |
|
|
73
|
+
| `print` | Print every config value with its source, the secrets hidden |
|
|
74
|
+
| `check` | Validate the config of every enabled module, exit with 1 on an error |
|
|
75
|
+
|
|
76
|
+
### `weaver config schema`
|
|
77
|
+
|
|
78
|
+
| Option | Description | Default |
|
|
79
|
+
| -------------------------- | ------------------------------ | ------------------------- |
|
|
80
|
+
| `-o, --output-path <path>` | Output path of the JSON Schema | `./appweaver.schema.json` |
|
|
81
|
+
|
|
82
|
+
Writes the JSON Schema of `appweaver.json`, built from the config sections of the enabled modules: every key under its
|
|
83
|
+
camelCase name in the nested object of its section, with its type and default, for `config` and each
|
|
84
|
+
`environments.<env>`. The `$schema` of `appweaver.json` points to it (`"$schema": "./appweaver.schema.json"`), for the
|
|
85
|
+
completion and validation of the module packages' sections too. `weaver generate` writes the same file from the
|
|
86
|
+
sections the modules list, while this command creates the application, so it also finds a section defined in an
|
|
87
|
+
application file outside a module.
|
|
88
|
+
|
|
89
|
+
### `weaver config print`
|
|
90
|
+
|
|
91
|
+
Prints the environment, then every flattened key sorted by name, with its source and value:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Environment: dev
|
|
95
|
+
|
|
96
|
+
SECURITY_JWT_SECRET env "********"
|
|
97
|
+
SERVER_PORT json 5000
|
|
98
|
+
STORAGE_PROVIDER default "auto"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The source is `override` (`configOverrides` of a test), `env` (the environment and the `.env` files), `json` (the
|
|
102
|
+
`appweaver*.json` files) or `default` (the schema default), the one `configSource(key)` of `@appweaver/common` returns.
|
|
103
|
+
A value is hidden when its key ends with `PASSWORD`, `SECRET`, `TOKEN`, `PRIVATE_KEY`, `CREDENTIALS` or `API_KEY`, or
|
|
104
|
+
its schema has the `secret: true` option. The errors of the invalid sections are printed after the table, with exit
|
|
105
|
+
code 1. `--json` prints `{ environment, keys: [{ key, value, source }], errors }`.
|
|
106
|
+
|
|
107
|
+
### `weaver config check`
|
|
108
|
+
|
|
109
|
+
Parses every section and exits with 1, listing the errors, when a value is missing or invalid. An error names only the
|
|
110
|
+
invalid keys, each with its environment variable and JSON path. Run it in CI with the deployed environment, so a bad
|
|
111
|
+
value fails the pipeline instead of the startup:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
NODE_ENV=prod weaver config check
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
`--json` prints `{ environment, valid, errors }`.
|
|
118
|
+
|
|
119
|
+
## `weaver doctor`
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
weaver doctor [--no-database] [--json]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Checks the project and prints each check as `ok`, `warn` or `FAIL`, with the command fixing it. It exits with 1 when a
|
|
126
|
+
check fails, so an agent or a CI step runs it first:
|
|
127
|
+
|
|
128
|
+
| Check | Fails or warns when |
|
|
129
|
+
| ---------------- | ----------------------------------------------------------------------------------------------------- |
|
|
130
|
+
| `runtime` | Node is older than 24.7 (Bun passes) |
|
|
131
|
+
| `packages` | an `@appweaver/*` package of `package.json` is not installed (fail), or they differ in version |
|
|
132
|
+
| `env` | the project has a `.env.example` but no `.env` |
|
|
133
|
+
| `config` | the application fails to load, or a config section is invalid (fail) |
|
|
134
|
+
| `generated` | with `@appweaver/data`: the types or the Prisma schema are missing (fail) or older than a model file |
|
|
135
|
+
| `migrations` | with `@appweaver/data`: migrations are pending, or the status fails; `--no-database` skips it |
|
|
136
|
+
| `sql-migrations` | with `@appweaver/data`: SQL migrations are pending (warn), or one changed after it was applied (fail) |
|
|
137
|
+
| `skill` | a file of the skill (`SKILL.md`, `GUIDELINES.md`, `references/`) differs from `@appweaver/skill` |
|
|
138
|
+
|
|
139
|
+
`--no-database` skips both migration checks, which connect to the database. `--json` prints the checks as
|
|
140
|
+
`[{ name, status, message, hint }]`.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## `weaver openapi`
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
weaver openapi|oa [options]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Generate the OpenAPI specification of the application.
|
|
151
|
+
|
|
152
|
+
| Option | Description | Default |
|
|
153
|
+
| -------------------------- | ------------------------------------------------------ | ---------------- |
|
|
154
|
+
| `-o, --output-path <path>` | Output path of the OpenAPI specification | `./openapi.json` |
|
|
155
|
+
| `--format <format>` | Format of the OpenAPI specification (`json` or `yaml`) | `json` |
|
|
156
|
+
|
|
157
|
+
When `--format yaml` is used and `--output-path` is left at its default, the output path becomes `./openapi.yaml`.
|
|
158
|
+
Missing output directories are created automatically. The command fails with a message when the `@appweaver/web`
|
|
159
|
+
module is not installed or disabled (`APP_MODULES_DISABLED`).
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## `weaver routes`
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
weaver routes [options]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Print every route, realtime event and MCP tool of every model, a section per model and per view of it
|
|
170
|
+
(`Post (view public)`), then the other routes of the application and its modules. Creates the application without
|
|
171
|
+
starting it, like `weaver openapi`, and reads the routes the server registered, so every column is what the server
|
|
172
|
+
enforces:
|
|
173
|
+
|
|
174
|
+
- **Access**: `public`, `authenticated`, or the roles, permissions and auth types the route needs, resolved from its
|
|
175
|
+
own config, the routes it inherits from and the `defaults`. An event or a tool has the access of its action object,
|
|
176
|
+
else of the `events` or `mcp` config, else of the route of its action (`find` for an event). A route of the
|
|
177
|
+
application declaring none of these options shows the security of its OpenAPI schema, or `-` when it has none (its
|
|
178
|
+
own hooks decide).
|
|
179
|
+
- **Cache**: the time-to-live and the scope of a cached route (`cache 60000 ms public`), the `cache.defaultTtl` when
|
|
180
|
+
it sets none, and nothing with `cache.enabled` off.
|
|
181
|
+
|
|
182
|
+
| Option | Description | Default |
|
|
183
|
+
|------------------|-----------------------------------------------------------------|---------|
|
|
184
|
+
| `--model <name>` | Print the ones of a model alone, its views included | - |
|
|
185
|
+
| `--json` | Print the output as JSON on stdout, for scripts and AI agents | false |
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Post
|
|
189
|
+
GET /api/posts/:id find public cache 60000 ms public
|
|
190
|
+
POST /api/posts/query query public cache 60000 ms public
|
|
191
|
+
POST /api/posts create roles Admin,User
|
|
192
|
+
event resource:Post.update update roles Admin
|
|
193
|
+
tool post_query query public
|
|
194
|
+
|
|
195
|
+
Post (view public)
|
|
196
|
+
GET /api/public/posts/:id find public cache 60000 ms public
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
With `--json`, a group is `{ model, view, lines }` and a line `{ kind, method, name, action, access, cache }`, `cache`
|
|
200
|
+
being `{ ttl, scope }`.
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## `weaver generate`
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
weaver generate|g [options]
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Generate the TypeScript types and the Prisma schema of the models, and the JSON Schema of `appweaver.json`. The flags
|
|
211
|
+
select the outputs; with none, it generates all three, the types and the Prisma schema only when `@appweaver/data` is
|
|
212
|
+
enabled.
|
|
213
|
+
|
|
214
|
+
| Option | Description | Default |
|
|
215
|
+
| ----------------------------- | -------------------------------------------------- | ----------------------------------------------- |
|
|
216
|
+
| `--types` | Generate the TypeScript types | — |
|
|
217
|
+
| `--prisma-schema` | Generate the Prisma schema and client | — |
|
|
218
|
+
| `--config-schema` | Generate the JSON Schema of `appweaver.json` | — |
|
|
219
|
+
| `--no-config-schema` | Leave the config schema out of a run without flags | written |
|
|
220
|
+
| `--model-pattern <pattern>` | Glob pattern of the model files | from config (`RESOURCE_MODEL_PATTERN`) |
|
|
221
|
+
| `--types-path <path>` | Output path of the TypeScript types | from config (`RESOURCE_GENERATED_TYPES_PATH`) |
|
|
222
|
+
| `--prisma-schema-path <path>` | Output path of the Prisma schema | from config (`DATABASE_SCHEMA_PATH`) |
|
|
223
|
+
| `--client-dir <dir>` | Output directory of the Prisma client | from config (`DATABASE_CLIENT_OUTPUT_DIR_PATH`) |
|
|
224
|
+
| `--config-schema-path <path>` | Output path of the JSON Schema of `appweaver.json` | `./appweaver.schema.json` |
|
|
225
|
+
| `--no-registry` | Skip registering the model types | registered |
|
|
226
|
+
| `--no-prune` | Keep the framework models not used | pruned |
|
|
227
|
+
| `--verbose` | Print verbose output | `false` |
|
|
228
|
+
|
|
229
|
+
Per model, the type file holds `<Model>`, `<Model>Single`, `<Model>Multiple`, `<Model>Create`, `<Model>Update`,
|
|
230
|
+
`<Model>RelationCreate`, `<Model>RelationUpdate`, `<Model>RelationInput`, `<Model>Query`, `<Model>Sort`,
|
|
231
|
+
`<Model>Aggregate`, `<Model>Series` (the values of its `series` fields, if any), and last `<Model>ResourceService`, the
|
|
232
|
+
`injectService` type of that model. The file ends by
|
|
233
|
+
registering the types of every model in the `ResourceRegistry` of `@appweaver/common`, which lets the factories and
|
|
234
|
+
`injectService` infer them from a model name. `--no-registry` leaves the registration out. Without any model the file
|
|
235
|
+
holds only `export {};`, so the `export * from './generated'` of the types index still compiles.
|
|
236
|
+
|
|
237
|
+
A model with `series` fields gets the `<Model>Series` table of its points in the Prisma schema (see
|
|
238
|
+
[timeseries](./timeseries.md)), left out when another store holds them: `timeseries.provider` set to `memory`, `none` or a
|
|
239
|
+
module path, or `auto` with a module package of another store enabled. `weaver test setup` follows the
|
|
240
|
+
provider of the `test` environment.
|
|
241
|
+
|
|
242
|
+
A spatial field gets its GeoJSON and bounding box columns, and with the `postgis` provider of `spatial.provider` (the
|
|
243
|
+
default on PostgreSQL) its PostGIS geometry column, a GiST index and the `postgis` extension of the datasource (see
|
|
244
|
+
[spatial](./spatial.md)). The types use the geometry types of `@appweaver/common`, i.e. `GeoPoint`.
|
|
245
|
+
|
|
246
|
+
The models come from the project and from the `resources` of the enabled modules (see [modules](./modules.md)). The
|
|
247
|
+
framework models reach the schema only when the project uses them: `Role`, `Permission`, `ApiKey`, `OneTimeToken` and
|
|
248
|
+
`ConnectedAccount` with an auth model, `File` when a model declares `files`, and `Seeder` when the seeders directory
|
|
249
|
+
exists (or an enabled module declares `seeders`). `--no-prune` keeps all of them.
|
|
250
|
+
|
|
251
|
+
The registry belongs to the application: in a module package (`appweaver.module` in its `package.json`) `weaver
|
|
252
|
+
generate` never writes it, and in an application it leaves out, with a warning, the models of a module package whose
|
|
253
|
+
declaration files register them already, so no model is registered twice.
|
|
254
|
+
|
|
255
|
+
The config schema is `appweaver.schema.json`, the JSON Schema the `$schema` of `appweaver.json` points to, built from
|
|
256
|
+
the config sections the enabled modules list in their manifests, so rerun it after adding a module. `weaver generate
|
|
257
|
+
--config-schema` writes it without loading `@appweaver/data`, so it works in an application without a database too.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## `weaver migrate`
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
weaver migrate [options]
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Apply all pending database migrations (`prisma migrate deploy`). It creates no migration and never prompts, which
|
|
268
|
+
makes it the command to run in CI, in containers, and in production. It connects with `database.migrationUrl`, or
|
|
269
|
+
`database.url` when not set (the `url` of `prisma.config.ts` is `migrationUrl()` of `@appweaver/data/config`).
|
|
270
|
+
|
|
271
|
+
On PostgreSQL, it then sets up what the migrations do not hold, with the same URL: the hypertables and policies of the
|
|
272
|
+
`timescale` time series provider and the geometry triggers of the `postgis` spatial provider. The application sets them
|
|
273
|
+
up when it starts too, but only a user owning the tables can, so this lets the application connect as a user that only
|
|
274
|
+
reads and writes the data. The setup loads the models of the build (`./dist/src`), so build before migrating.
|
|
275
|
+
|
|
276
|
+
| Option | Description | Default |
|
|
277
|
+
|-------------------|-------------------------------------------------------------------------|---------|
|
|
278
|
+
| `--no-setup` | Skip the setup of the hypertables and the geometry triggers | set up |
|
|
279
|
+
| `--fix-checksums` | Record the new checksum of a SQL migration changed after it was applied | `false` |
|
|
280
|
+
| `--dry-run` | Print the pending migrations and their SQL without applying them | `false` |
|
|
281
|
+
|
|
282
|
+
After the Prisma migrations it applies the SQL migrations of `database.sqlDirPath` and of the modules
|
|
283
|
+
([database.md](./database.md#sql-migrations)), then sets up the database.
|
|
284
|
+
|
|
285
|
+
`--dry-run` reads the pending migrations from `prisma migrate status` (Prisma has no dry run of `migrate deploy`) and
|
|
286
|
+
prints the `migration.sql` of each one, without changing the database. It exits with an error when `weaver migrate`
|
|
287
|
+
would apply none: on a failed migration to resolve first, diverged histories or an unreachable database. A database
|
|
288
|
+
without a migration history is named, since Prisma migrates it only when it has no tables. Review what a deployment
|
|
289
|
+
applies before running it:
|
|
290
|
+
|
|
291
|
+
```sh
|
|
292
|
+
NODE_ENV=prod weaver migrate --dry-run
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## `weaver migration`
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
weaver migration [options] [command]
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Create and check the database migrations, and reset the database. They are development commands, run against the
|
|
304
|
+
local database.
|
|
305
|
+
|
|
306
|
+
**Subcommands:**
|
|
307
|
+
|
|
308
|
+
| Command | Description |
|
|
309
|
+
| ----------------- | ------------------------------------------------------------ |
|
|
310
|
+
| `new <name>` | Create a new database migration and apply it |
|
|
311
|
+
| `check [options]` | Check whether the models need a new migration, print its SQL |
|
|
312
|
+
| `reset [options]` | Reset the database |
|
|
313
|
+
|
|
314
|
+
### `weaver migration new`
|
|
315
|
+
|
|
316
|
+
Runs `prisma migrate dev --name <name>`: creates the migration of the model changes and applies it to the local
|
|
317
|
+
database. With `--create-only`, the migration is created without being applied, so its `migration.sql` can be edited
|
|
318
|
+
first (custom SQL Prisma does not generate: a trigger, a view, an expression or partial index, an extension), then
|
|
319
|
+
applied by `weaver migration new` again or `weaver migrate`. Prisma drops by the next migration what it can model but
|
|
320
|
+
the Prisma schema does not declare (a column, a plain index), so only add objects Prisma cannot model this way, and
|
|
321
|
+
prefer the SQL migrations for custom SQL: `weaver migration new <name> --sql [--database <type>]` creates
|
|
322
|
+
`database/sql/<timestamp>_<name>[.<database>].sql` instead ([database.md](./database.md#sql-migrations)). The command
|
|
323
|
+
fails before creating a Prisma migration that would drop a column or an index a SQL migration created.
|
|
324
|
+
|
|
325
|
+
With generated columns in the models ([resources.md](./resources.md#generated-columns)), it first creates and applies
|
|
326
|
+
the Prisma migration `<timestamp>_generated_columns` recording them, when they are new or changed: a SQL migration
|
|
327
|
+
creates them, which `prisma migrate dev` would otherwise report as a drift of the database. Commit it with the
|
|
328
|
+
migration created after it. When it cannot be applied (a database without the tables of the models), the command
|
|
329
|
+
removes it and marks it as rolled back, so the next run is not refused with `P3009`.
|
|
330
|
+
|
|
331
|
+
### `weaver migration check`
|
|
332
|
+
|
|
333
|
+
Tells whether the models changed without a migration, like `makemigrations --check` of Django. It builds the Prisma
|
|
334
|
+
schema from the model files without writing it, compares it with the local database (`prisma migrate diff`, read-only)
|
|
335
|
+
and prints the SQL `weaver migration new` would create.
|
|
336
|
+
|
|
337
|
+
| Option | Description | Default |
|
|
338
|
+
| --------------------------- | -------------------------------------------------- | ----------- |
|
|
339
|
+
| `--model-pattern <pattern>` | Glob pattern of the model files | from config |
|
|
340
|
+
| `--no-prune` | Keep the framework models the project does not use | pruned |
|
|
341
|
+
|
|
342
|
+
| Exit code | Meaning |
|
|
343
|
+
| --------- | ---------------------------------------------------------------------------------------- |
|
|
344
|
+
| `0` | No migration is needed |
|
|
345
|
+
| `1` | A migration is needed, its SQL is printed |
|
|
346
|
+
| `2` | The check cannot run: pending migrations (run `weaver migrate`), an unreachable database |
|
|
347
|
+
|
|
348
|
+
```sh
|
|
349
|
+
weaver migration check
|
|
350
|
+
# A migration is needed, it would run:
|
|
351
|
+
#
|
|
352
|
+
# -- AlterTable
|
|
353
|
+
# ALTER TABLE "Category" ADD COLUMN "color" TEXT;
|
|
354
|
+
#
|
|
355
|
+
# Create it with: weaver generate && weaver migration new <name>
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
- The database must have every migration applied, since it stands for the migrations: a change made to it by hand
|
|
359
|
+
shows up as a difference.
|
|
360
|
+
- The schema comes from the models, so the check also catches a model changed without `weaver generate`, and then
|
|
361
|
+
names `weaver generate` in the command to run.
|
|
362
|
+
- In CI, run it after `weaver migrate` on the database of the job, to fail a change that lacks its migration.
|
|
363
|
+
|
|
364
|
+
### `weaver migration reset`
|
|
365
|
+
|
|
366
|
+
Drops the database, recreates it, and re-applies every migration (`prisma migrate reset`). **All data is lost.** Prisma
|
|
367
|
+
refuses the reset for an AI agent when `DATABASE_AI_DANGEROUS_ACTIONS_ENABLED` is `false`, like the `prisma migrate dev`
|
|
368
|
+
of `weaver migration new` and `weaver test setup`, see **Run tests** in [SKILL.md](../SKILL.md).
|
|
369
|
+
|
|
370
|
+
| Option | Description | Default |
|
|
371
|
+
| ------------- | --------------------------------------------------------- | ------- |
|
|
372
|
+
| `-y, --yes` | Skip the confirmation prompt | `false` |
|
|
373
|
+
| `-f, --force` | Allow the reset outside the `dev` and `test` environments | `false` |
|
|
374
|
+
|
|
375
|
+
Without `--force` the command runs only when `NODE_ENV` resolves to `dev` or `test`, and aborts otherwise. Either
|
|
376
|
+
`--force` or `--yes` skips the Prisma confirmation prompt.
|
|
377
|
+
|
|
378
|
+
The SQL migrations of `database.sqlDirPath` are applied after the reset. A project without a Prisma migration yet has
|
|
379
|
+
no table for them, so they are skipped: run `weaver migrate` after the first `weaver migration new`.
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## `weaver module`
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
weaver module|mod <command> [options]
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Add and remove the optional modules of `@appweaver/create` in an existing project, from the templates of the
|
|
390
|
+
installed `@appweaver/cli`, install module packages, and create local modules. A module is enabled when the project
|
|
391
|
+
depends on its packages, `locales` and `docker` when `locales/` and `Dockerfile` exist.
|
|
392
|
+
|
|
393
|
+
| Module | Packages | Requires | Files |
|
|
394
|
+
| ----------- | ----------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
395
|
+
| `redis` | `@appweaver/redis` | — | The Redis service of `docker-compose.yml` |
|
|
396
|
+
| `queue` | `@appweaver/bullmq` | `redis` | — |
|
|
397
|
+
| `scheduler` | `@appweaver/cron` | — | — |
|
|
398
|
+
| `mailer` | `@appweaver/nodemailer` | — | The email templates of `templates/` (`emails/`, `layouts/email`, `partials/email-button`), the `emails` texts of `locales/en.json` |
|
|
399
|
+
| `templates` | `@appweaver/handlebars` | — | `templates/`, the Dockerfile `COPY` of the templates |
|
|
400
|
+
| `locales` | — | — | `locales/en.json` (empty without the mailer), the Dockerfile `COPY` of the translation files |
|
|
401
|
+
| `docker` | — | — | `Dockerfile`, `.dockerignore`, `docker-compose.yml`, `start.sh`, `database/mariadb-init.sh` (MySQL) |
|
|
402
|
+
|
|
403
|
+
### `weaver module list`
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
weaver module list|ls
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
List the modules, whether the project has them enabled, their packages, requirements and description. `--json`
|
|
410
|
+
prints them as `[{ name, enabled, packages, requires, description }]`.
|
|
411
|
+
|
|
412
|
+
### `weaver module new`
|
|
413
|
+
|
|
414
|
+
```
|
|
415
|
+
weaver module new <name> [--dry-run]
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Create a local module in `src/modules/<name>/` (under `APP_SOURCE_PATH`), enabled by `APP_MODULES_PATTERN` without any
|
|
419
|
+
config:
|
|
420
|
+
|
|
421
|
+
| File | Holds |
|
|
422
|
+
| ----------- | ---------------------------------------------------------------------------------------------------- |
|
|
423
|
+
| `module.ts` | The manifest: its name, config, `loggers` and `main`, with commented `providers` and `services` |
|
|
424
|
+
| `config.ts` | Its config section, named after the camelCase of the name (`audit-log` → `auditLog`), with `ENABLED` |
|
|
425
|
+
| `main.ts` | The code run at startup: scheduled jobs, queue workers, event listeners |
|
|
426
|
+
|
|
427
|
+
The name must be kebab-case (`billing`, `audit-log`). The command fails, writing nothing, when a file of the module
|
|
428
|
+
exists. `--dry-run` prints the files without writing them.
|
|
429
|
+
|
|
430
|
+
### `weaver module add`
|
|
431
|
+
|
|
432
|
+
```
|
|
433
|
+
weaver module add <modules...> [options]
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
Add the modules, with the modules they require: their packages to `package.json` (at the versions of the release),
|
|
437
|
+
their values to `appweaver.json`, their files, and what they add to the other enabled modules. An existing file that
|
|
438
|
+
differs is skipped and reported. Adding `locales` restores the `t` calls of the scaffolded templates still holding
|
|
439
|
+
the English texts. The dependencies are installed when `package.json` changed. `--database` picks the database of
|
|
440
|
+
the `data` module (`weaver module add data --database postgresql`), SQLite by default; it is refused once `data` is
|
|
441
|
+
enabled, and reported as ignored when `data` is not added.
|
|
442
|
+
|
|
443
|
+
The command ends with its `Next steps`, what the added modules leave to do by hand. The modules changing the
|
|
444
|
+
database share one migration step, naming what each adds:
|
|
445
|
+
|
|
446
|
+
```
|
|
447
|
+
Next steps:
|
|
448
|
+
- Run "npx weaver generate", then "npx weaver migration new add_data_web" to add to the database: the table of the seeders, the User model with its roles, permissions, API keys and tokens.
|
|
449
|
+
- Run "npm run seed" once the database is migrated, to create the roles and the admin user.
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
| Module | Next steps |
|
|
453
|
+
| ------------ | -------------------------------------------------------------------------------------------- |
|
|
454
|
+
| `data` | The migration of the table of the seeders |
|
|
455
|
+
| `web` | The migration of the `User` model and the auth data model, then the seeders (`npm run seed`) |
|
|
456
|
+
| `payments` | The migration of the models of the payments, and the Stripe keys to set in `.env` |
|
|
457
|
+
| `timeseries` | A migration once a model declares `series` fields, each getting its `<Model>Series` table |
|
|
458
|
+
|
|
459
|
+
A name that is not a scaffold module, with a scope, a `-` or a `/`, is a module package
|
|
460
|
+
(`weaver module add @acme/appweaver-gcs`), installed with
|
|
461
|
+
`npm install --ignore-scripts <package>` (`bun add` on Bun), so its install scripts never run. The command then
|
|
462
|
+
prints the providers of its manifest, selected in the provider key of their contract, and the modules it requires, or
|
|
463
|
+
that the package is not a module (no `appweaver.module` field in its `package.json`, or no valid manifest). With
|
|
464
|
+
`--dry-run` it prints the install command instead.
|
|
465
|
+
|
|
466
|
+
| Option | Description | Default |
|
|
467
|
+
| ------------------- | ------------------------------------------------ | --------- |
|
|
468
|
+
| `--database <type>` | `sqlite`, `postgresql`, `mysql` or `sqlserver` | `sqlite` |
|
|
469
|
+
| `--no-install` | Skip the installation of the dependencies | installed |
|
|
470
|
+
| `--dry-run` | Print the changes without applying them | `false` |
|
|
471
|
+
| `-f, --force` | Overwrite the existing files instead of skipping | `false` |
|
|
472
|
+
| `--verbose` | Print verbose output | `false` |
|
|
473
|
+
|
|
474
|
+
### `weaver module remove`
|
|
475
|
+
|
|
476
|
+
```
|
|
477
|
+
weaver module remove|rm <modules...> [options]
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Remove the modules: their packages, their `appweaver.json` values (the ones changed in the project are kept), their
|
|
481
|
+
files (the whole `templates/`, `locales/` and `database/` directories, the Docker files), and what they added to the
|
|
482
|
+
other enabled modules. Removing `locales` writes the English texts of `locales/en.json` into the templates first.
|
|
483
|
+
Removing `mailer` deletes the `emails` texts of `locales/en.json` that still hold their scaffolded value. A module that
|
|
484
|
+
an enabled module requires is removed only along with it. In `src/` and `database/seeders/` only the unchanged files
|
|
485
|
+
of `web` are deleted (the `User` resource and its admin seeder), the changed ones are kept with a warning, and so is a
|
|
486
|
+
changed e2e test of `web`. Removing `data` deletes `database/` with its migrations and seeders, listing the ones written
|
|
487
|
+
in the project in a warning.
|
|
488
|
+
|
|
489
|
+
The command ends with its `Next steps` when a removed module changed the database (`web`, `payments`): `weaver
|
|
490
|
+
generate`, then `weaver migration new remove_<modules>`, the migration dropping their tables with their data. Removing
|
|
491
|
+
`data` leaves no migrations, so it tells that the database keeps its tables, to drop by hand.
|
|
492
|
+
|
|
493
|
+
| Option | Description | Default |
|
|
494
|
+
| -------------- | ----------------------------------------- | --------- |
|
|
495
|
+
| `--no-install` | Skip the installation of the dependencies | installed |
|
|
496
|
+
| `--dry-run` | Print the changes without applying them | `false` |
|
|
497
|
+
| `--verbose` | Print verbose output | `false` |
|
|
498
|
+
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## `weaver resource new`
|
|
502
|
+
|
|
503
|
+
```
|
|
504
|
+
weaver resource new <name> [--no-service] [--no-routes] [--no-policy] [--dry-run]
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
Creates a resource in `<sourcePath>/resources/<name>/`, where the default patterns of `resource.modelPattern` and the
|
|
508
|
+
others find it. The name is kebab-case and singular (`blog-post` is the `BlogPost` model, its routes under
|
|
509
|
+
`/blog-posts`, the plural `createRoutes` derives: `person` is served under `/people`). It needs `@appweaver/data`:
|
|
510
|
+
|
|
511
|
+
| File | Holds |
|
|
512
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
513
|
+
| `model.ts` | `createModel` with one `name` scalar to replace |
|
|
514
|
+
| `service.ts` | `createService` with a `beforeCreate` hook, left out with `--no-service` (which needs `--no-routes`) |
|
|
515
|
+
| `routes.ts` | `createRoutes` with every route for the `Admin` role, left out with `--no-routes` or without `@appweaver/web` |
|
|
516
|
+
| `policy.ts` | `createPolicy`: the admins read every record, a user the ones they created, an anonymous call none, left out with `--no-policy` |
|
|
517
|
+
|
|
518
|
+
It refuses to overwrite an existing file and prints the next commands, `weaver generate` and
|
|
519
|
+
`weaver migration new add_<name>`.
|
|
520
|
+
|
|
521
|
+
## `weaver run`
|
|
522
|
+
|
|
523
|
+
```
|
|
524
|
+
weaver run|r
|
|
525
|
+
weaver run|r <task> [args...]
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
Run a one-shot task with the application by its name or its file, or list the tasks without one (`weaver run --json`
|
|
529
|
+
lists them as `{ tasks: [{ name, description, module, file }], failed: [{ file, error }] }`; after a task, `--json` is
|
|
530
|
+
an option of the task, and before one it is refused). The server, the
|
|
531
|
+
health listener and the scheduled jobs never start (`SERVER_LISTEN`, `HEALTH_CHECK_PORT` and `SCHEDULER_AUTO_START_JOB`
|
|
532
|
+
are forced off), and the command exits with the number the task returns (`0` otherwise, `1` when it throws). Invalid
|
|
533
|
+
arguments and `--help` exit before the application starts. A task logs like the application (`log.level`,
|
|
534
|
+
`log.levels`), on stderr unless `LOG_STREAM` is set, so its stdout holds what the task prints alone
|
|
535
|
+
(`weaver run export > out.csv`), while the other commands keep the framework logs silent behind their own output.
|
|
536
|
+
|
|
537
|
+
A task is the default export of a file in `src/tasks/` (`APP_TASKS_DIR_PATH`), created with `createTask`. Only `run`
|
|
538
|
+
is required, and the values of the arguments and options are typed from their declarations:
|
|
539
|
+
|
|
540
|
+
```ts
|
|
541
|
+
// src/tasks/orders/count.ts, run with `weaver run orders:count Paid --min 2`
|
|
542
|
+
import { createTask, injectService } from '@appweaver/core';
|
|
543
|
+
|
|
544
|
+
export default createTask({
|
|
545
|
+
description: 'Counts the orders of a status.', // listed by `weaver run`
|
|
546
|
+
arguments: {
|
|
547
|
+
status: { required: true, choices: ['Pending', 'Paid'] } // <status>: 'Pending' | 'Paid'
|
|
548
|
+
},
|
|
549
|
+
options: {
|
|
550
|
+
min: { type: 'number', default: 1 }, // --min <min>: number
|
|
551
|
+
quiet: { type: 'boolean', description: 'Print nothing.' } // --quiet: boolean
|
|
552
|
+
},
|
|
553
|
+
run: async ({ args, options }) => {
|
|
554
|
+
const count = await injectService('Order').count({ status: args.status });
|
|
555
|
+
if (!options.quiet) {
|
|
556
|
+
console.log(`${count} orders`);
|
|
557
|
+
}
|
|
558
|
+
return count >= options.min ? 0 : 1; // the exit code
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
| Field | Description |
|
|
564
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
565
|
+
| `run` | `({ args, options, argv }) => number \| void`, `argv` holding the arguments as given |
|
|
566
|
+
| `name` | Default: the path in the tasks directory (`orders/count.ts` is `orders:count`) |
|
|
567
|
+
| `description` | Listed by `weaver run`, shown by `--help` |
|
|
568
|
+
| `arguments` | Filled in the order of their keys: `description`, `type` (`string`, `number`), `required`, `variadic`, `default`, `choices` |
|
|
569
|
+
| `options` | A camelCase key is a kebab-case flag: `description`, `type` (`string`, `number`, `boolean`), `required`, `default`, `choices` |
|
|
570
|
+
|
|
571
|
+
The required arguments come before the optional ones and have no `default`, only the last one is `variadic`, and no
|
|
572
|
+
key is an integer, otherwise the task fails to run. A task declaring no `arguments` or `options` takes any, read from
|
|
573
|
+
`argv`.
|
|
574
|
+
|
|
575
|
+
```sh
|
|
576
|
+
weaver run # list the tasks with their descriptions
|
|
577
|
+
weaver run orders:count --help # the usage of a task
|
|
578
|
+
weaver run orders:count Pending --quiet # run a task by its name
|
|
579
|
+
weaver run src/tasks/orders/count.ts Paid # run the task of a file
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
The tasks of the enabled modules are listed and run too (see [modules](./modules.md)), a task of the application
|
|
583
|
+
replacing a module task of the same name: `maintenance` of core, and with `@appweaver/payments` the tasks
|
|
584
|
+
`payments-sync-plans [gateway]` (reads the recurring prices of the gateways into the plans) and
|
|
585
|
+
`payments-replay [id]` (processes the failed webhook events again, see [payments](./payments.md)). A plain default function, `(args: string[]) => number | void`, still works,
|
|
586
|
+
receiving the raw arguments. On Node the tasks run from the build output (`dist/src/tasks/`), so build first.
|
|
587
|
+
|
|
588
|
+
---
|
|
589
|
+
|
|
590
|
+
## `weaver seed`
|
|
591
|
+
|
|
592
|
+
```
|
|
593
|
+
weaver seed|sd [options]
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
Seed the database.
|
|
597
|
+
|
|
598
|
+
| Option | Description | Default |
|
|
599
|
+
| ---------------------- | ----------------------------------------------------------------------- | ----------------------------------------- |
|
|
600
|
+
| `--build-project` | Build the project before seeding | `false` |
|
|
601
|
+
| `-p, --project <path>` | TypeScript project config file of `--build-project` | `tsconfig.build.json` |
|
|
602
|
+
| `--seeders-dir <dir>` | Directory of the seeders | from config (`DATABASE_SEEDERS_DIR_PATH`) |
|
|
603
|
+
| `--continue-on-error` | Continue running the seeders when one throws an error | `false` |
|
|
604
|
+
| `--fix-warnings` | Fix the seeder warnings, like a wrong checksum or a deleted seeder file | `false` |
|
|
605
|
+
| `--dry-run` | Print the pending seeders and the warnings to fix without running them | `false` |
|
|
606
|
+
|
|
607
|
+
The seeders of the enabled modules (their `seeders` directory) run first, each recorded under its module name
|
|
608
|
+
(`billing/1-plans`), then the seeders of the application. A missing seeders directory is skipped with a warning, and
|
|
609
|
+
its recorded seeders are not reported as deleted; the command fails only when no directory is accessible.
|
|
610
|
+
|
|
611
|
+
With `--dry-run`, the pending seeders are listed but not run, and nothing is recorded: the warnings are still
|
|
612
|
+
reported, and the `--fix-warnings` fixes printed instead of applied. On a database that is not migrated yet, every
|
|
613
|
+
seeder is listed as pending.
|
|
614
|
+
|
|
615
|
+
---
|
|
616
|
+
|
|
617
|
+
## `weaver start`
|
|
618
|
+
|
|
619
|
+
```
|
|
620
|
+
weaver start|s [options]
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
Start the application.
|
|
624
|
+
|
|
625
|
+
| Option | Description | Default |
|
|
626
|
+
| ---------------------- | ----------------------------------------------------------- | --------------------- |
|
|
627
|
+
| `-w, --watch` | Run in watch mode (recompiles and restarts on file changes) | `false` |
|
|
628
|
+
| `-p, --project <path>` | TypeScript project config file of the watch mode | `tsconfig.build.json` |
|
|
629
|
+
|
|
630
|
+
In watch mode the server also restarts when a file of the template or translation directories (`TEMPLATE_PATH`,
|
|
631
|
+
`LOCALE_PATH`) changes, the Node runtime only while the last build succeeded.
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
## `weaver lint` and `weaver format`
|
|
636
|
+
|
|
637
|
+
```
|
|
638
|
+
weaver lint [--fix] [patterns...]
|
|
639
|
+
weaver format [--check] [patterns...]
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
Run the ESLint (default pattern `.`) and the Prettier (default pattern `./**/*.ts`, written unless `--check`) of the
|
|
643
|
+
project's `@appweaver/tooling` dev dependency. Without the package they exit with 1, naming the install command.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
## `weaver test`
|
|
648
|
+
|
|
649
|
+
```
|
|
650
|
+
weaver test|t [options] [command]
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
Run the tests (`weaver test [patterns...]`), or set up, reset and tear down the test environment (the subcommands). The
|
|
654
|
+
tests run with the Jest of `@appweaver/tooling` on Node and `bun test` on Bun, with `NODE_ENV=test` unless the shell
|
|
655
|
+
sets `NODE_ENV` (the `NODE_ENV` of a `.env` file never applies to them).
|
|
656
|
+
|
|
657
|
+
| Option | Description | Default |
|
|
658
|
+
| ------------- | ---------------------------------------------------------- | ------- |
|
|
659
|
+
| `--e2e` | Run the end-to-end tests (`test/e2e/jest.e2e-config.json`) | `false` |
|
|
660
|
+
| `--coverage` | Collect the coverage | `false` |
|
|
661
|
+
| `-w, --watch` | Run the tests again on every change | `false` |
|
|
662
|
+
|
|
663
|
+
**Subcommands:**
|
|
664
|
+
|
|
665
|
+
| Command | Description |
|
|
666
|
+
| -------------------- | ----------------------------------------------------------------------------------------- |
|
|
667
|
+
| `setup [options]` | Set up the temporary test data: the storage directory, the Prisma schema and the database |
|
|
668
|
+
| `reset [options]` | Reset the test database and/or the storage files |
|
|
669
|
+
| `teardown [options]` | Remove the temporary test directory |
|
|
670
|
+
|
|
671
|
+
### `weaver test setup`
|
|
672
|
+
|
|
673
|
+
Requires `NODE_ENV=test`.
|
|
674
|
+
|
|
675
|
+
| Option | Description | Default |
|
|
676
|
+
| ----------------------------- | ------------------------------------- | ----------------------------------------------- |
|
|
677
|
+
| `--temp-dir <dir>` | Directory of the temporary test data | `./temp` |
|
|
678
|
+
| `--model-pattern <pattern>` | Glob pattern of the model files | from config (`RESOURCE_MODEL_PATTERN`) |
|
|
679
|
+
| `--prisma-schema-path <path>` | Output path of the Prisma schema | from config (`DATABASE_SCHEMA_PATH`) |
|
|
680
|
+
| `--client-dir <dir>` | Output directory of the Prisma client | from config (`DATABASE_CLIENT_OUTPUT_DIR_PATH`) |
|
|
681
|
+
| `--migration-name <name>` | Name of the initial migration | `init_test` |
|
|
682
|
+
| `--verbose` | Print verbose output | `false` |
|
|
683
|
+
|
|
684
|
+
Aborts unless the storage, schema and client paths all resolve inside `--temp-dir`, so a misconfigured test run cannot
|
|
685
|
+
touch the development database or uploads. It resets the test database (`prisma migrate reset --force`) before the
|
|
686
|
+
initial migration, since a PostgreSQL or MySQL test database keeps the tables and migrations of the last run.
|
|
687
|
+
|
|
688
|
+
### `weaver test reset`
|
|
689
|
+
|
|
690
|
+
Requires `NODE_ENV=test`. With no flags, resets both database and storage. The database is reset with
|
|
691
|
+
`prisma migrate reset`, which Prisma refuses to run for an AI agent when `DATABASE_AI_DANGEROUS_ACTIONS_ENABLED` is
|
|
692
|
+
`false`, see **Run tests** in [SKILL.md](../SKILL.md). An agent never changes it itself. The reset drops the whole
|
|
693
|
+
test database, so the e2e Jest config runs the test files one at a time (`"maxWorkers": 1`).
|
|
694
|
+
|
|
695
|
+
| Option | Description | Default |
|
|
696
|
+
| ------------------ | ------------------------------------ | -------- |
|
|
697
|
+
| `--database` | Reset the database | — |
|
|
698
|
+
| `--storage` | Reset the storage files | — |
|
|
699
|
+
| `--temp-dir <dir>` | Directory of the temporary test data | `./temp` |
|
|
700
|
+
| `--verbose` | Print verbose output | `false` |
|
|
701
|
+
|
|
702
|
+
### `weaver test teardown`
|
|
703
|
+
|
|
704
|
+
Requires `NODE_ENV=test`.
|
|
705
|
+
|
|
706
|
+
| Option | Description | Default |
|
|
707
|
+
| ------------------ | ------------------------------------ | -------- |
|
|
708
|
+
| `--temp-dir <dir>` | Directory of the temporary test data | `./temp` |
|
|
709
|
+
| `--verbose` | Print verbose output | `false` |
|
|
710
|
+
|
|
711
|
+
The test database of a server (PostgreSQL, MySQL, SQL Server) is kept, since `weaver test setup` resets it.
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
## `weaver skill`
|
|
716
|
+
|
|
717
|
+
```
|
|
718
|
+
weaver skill sync [--dry-run]
|
|
719
|
+
```
|
|
720
|
+
|
|
721
|
+
`sync` copies the skill files of the project's `@appweaver/skill` dev dependency into the `skills/appweaver/` of every
|
|
722
|
+
agent directory the project has (`.claude`, `.junie`, `.kiro`, `.pi`, `.github`, `.opencode`, `.agents`), replacing the
|
|
723
|
+
files of the previous version. The project's `AGENTS.md` or `CLAUDE.md` is never touched. It exits with 1 when the
|
|
724
|
+
package is not installed (`npm install --save-dev @appweaver/skill`).
|
|
725
|
+
|
|
726
|
+
| Option | Description | Default |
|
|
727
|
+
| ----------- | ---------------------------------------------------------------------- | ------- |
|
|
728
|
+
| `--dry-run` | Print the skill directories that would be written without writing them | `false` |
|
|
729
|
+
|
|
730
|
+
---
|
|
731
|
+
|
|
732
|
+
## `weaver upgrade`
|
|
733
|
+
|
|
734
|
+
```
|
|
735
|
+
weaver upgrade|up [options] [packages...]
|
|
736
|
+
```
|
|
737
|
+
|
|
738
|
+
Upgrade the Appweaver packages. The companion packages installed in the project (Prisma and its adapters, TypeBox,
|
|
739
|
+
TypeScript) are bumped along to the exact versions the target release is built with, read from the
|
|
740
|
+
`scaffoldDependencies` of `@appweaver/cli` in the registry. The libraries of the drivers come with their `@appweaver/*`
|
|
741
|
+
packages. Missing packages are never added and newer ones never downgraded. Run `weaver generate` afterward when Prisma
|
|
742
|
+
is upgraded. The skill files are refreshed by `weaver skill sync` after the install.
|
|
743
|
+
|
|
744
|
+
**Arguments:**
|
|
745
|
+
|
|
746
|
+
| Argument | Description | Default |
|
|
747
|
+
| ---------- | ------------------------------------------------------------------------------ | ------------------------------------- |
|
|
748
|
+
| `packages` | The `@appweaver/*` packages to upgrade (i.e. `@appweaver/core @appweaver/cli`) | All installed `@appweaver/*` packages |
|
|
749
|
+
|
|
750
|
+
**Options:**
|
|
751
|
+
|
|
752
|
+
| Option | Description | Default |
|
|
753
|
+
| ---------------------------- | ------------------------------------------------------------------------------- | -------- |
|
|
754
|
+
| `--no-companions` | Skip upgrading the companion packages | upgraded |
|
|
755
|
+
| `--tooling` | Also upgrade the tooling packages outside `@appweaver/tooling` (`@types/bun`) | `false` |
|
|
756
|
+
| `--no-skill` | Skip upgrading the AI agent skill files in agent dirs (`.claude`, `.agents`, …) | upgraded |
|
|
757
|
+
| `--target-version <version>` | Version to upgrade the packages to | `latest` |
|
|
758
|
+
| `--dry-run` | Print the packages that would be upgraded without installing them | `false` |
|
|
759
|
+
| `-f, --force` | Upgrade despite the peerDependency version mismatches | `false` |
|
|
760
|
+
| `--verbose` | Print verbose output | `false` |
|