@titannio/webtoolkit-cli 1.3.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +639 -0
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +268 -0
  5. package/dist/bundle-audit.d.ts +7 -0
  6. package/dist/bundle-audit.js +111 -0
  7. package/dist/cleaner.d.ts +15 -0
  8. package/dist/cleaner.js +359 -0
  9. package/dist/config-reference.d.ts +8 -0
  10. package/dist/config-reference.js +805 -0
  11. package/dist/config.d.ts +306 -0
  12. package/dist/config.js +173 -0
  13. package/dist/dev-grid.d.ts +7 -0
  14. package/dist/dev-grid.js +181 -0
  15. package/dist/dev-watch.d.ts +13 -0
  16. package/dist/dev-watch.js +184 -0
  17. package/dist/environment.d.ts +10 -0
  18. package/dist/environment.js +172 -0
  19. package/dist/guard-registry.d.ts +1 -0
  20. package/dist/guard-registry.js +17 -0
  21. package/dist/guard-runner.d.ts +4 -0
  22. package/dist/guard-runner.js +36 -0
  23. package/dist/guards/any-guard.d.ts +16 -0
  24. package/dist/guards/any-guard.js +121 -0
  25. package/dist/guards/assert-no-tests-in-dist.d.ts +1 -0
  26. package/dist/guards/assert-no-tests-in-dist.js +56 -0
  27. package/dist/guards/check-mojibake.d.ts +52 -0
  28. package/dist/guards/check-mojibake.js +378 -0
  29. package/dist/guards/code-pattern-guard.d.ts +71 -0
  30. package/dist/guards/code-pattern-guard.js +654 -0
  31. package/dist/guards/dal-service-repository-check.d.ts +13 -0
  32. package/dist/guards/dal-service-repository-check.js +264 -0
  33. package/dist/guards/dependency-cruiser-guard.d.ts +14 -0
  34. package/dist/guards/dependency-cruiser-guard.js +69 -0
  35. package/dist/guards/documentation-guard.d.ts +3 -0
  36. package/dist/guards/documentation-guard.js +370 -0
  37. package/dist/guards/guard-config.d.ts +19 -0
  38. package/dist/guards/guard-config.js +87 -0
  39. package/dist/guards/internal-link-guard.d.ts +12 -0
  40. package/dist/guards/internal-link-guard.js +272 -0
  41. package/dist/guards/package-surface-guard.d.ts +37 -0
  42. package/dist/guards/package-surface-guard.js +234 -0
  43. package/dist/guards/pnpm-workspace-config.d.ts +2 -0
  44. package/dist/guards/pnpm-workspace-config.js +40 -0
  45. package/dist/guards/rebuild-preflight.d.ts +29 -0
  46. package/dist/guards/rebuild-preflight.js +137 -0
  47. package/dist/guards/repository-hygiene-guard.d.ts +12 -0
  48. package/dist/guards/repository-hygiene-guard.js +70 -0
  49. package/dist/guards/schema-guard.d.ts +10 -0
  50. package/dist/guards/schema-guard.js +160 -0
  51. package/dist/guards/singleton-deps-guard.d.ts +21 -0
  52. package/dist/guards/singleton-deps-guard.js +183 -0
  53. package/dist/guards/tsconfig-guard.d.ts +5 -0
  54. package/dist/guards/tsconfig-guard.js +105 -0
  55. package/dist/guards/workspace-manifest-guard.d.ts +21 -0
  56. package/dist/guards/workspace-manifest-guard.js +210 -0
  57. package/dist/jsdoc-report.d.ts +7 -0
  58. package/dist/jsdoc-report.js +456 -0
  59. package/dist/process.d.ts +20 -0
  60. package/dist/process.js +86 -0
  61. package/dist/ready-service.d.ts +7 -0
  62. package/dist/ready-service.js +135 -0
  63. package/dist/release-gate.d.ts +7 -0
  64. package/dist/release-gate.js +35 -0
  65. package/dist/repo-check.d.ts +7 -0
  66. package/dist/repo-check.js +121 -0
  67. package/dist/tasks.d.ts +17 -0
  68. package/dist/tasks.js +195 -0
  69. package/dist/upgrade.d.ts +10 -0
  70. package/dist/upgrade.js +674 -0
  71. package/dist/validate.d.ts +7 -0
  72. package/dist/validate.js +51 -0
  73. package/dist/workspace-tests.d.ts +33 -0
  74. package/dist/workspace-tests.js +529 -0
  75. package/package.json +57 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WebToolkit contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,639 @@
1
+ # @titannio/webtoolkit-cli
2
+
3
+ Portable CLI tools for TypeScript monorepos and web projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -D @titannio/webtoolkit-cli
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ```bash
14
+ webtoolkit clean --level cache --dry-run
15
+ webtoolkit clean --level deep
16
+ webtoolkit clean --level nuclear --no-store-prune --reinstall=never
17
+ webtoolkit check
18
+ webtoolkit build
19
+ webtoolkit test --filter backend
20
+ webtoolkit test-coverage
21
+ webtoolkit release-gate
22
+ webtoolkit validate
23
+ webtoolkit jsdoc-report
24
+ webtoolkit upgrade --verbose
25
+ webtoolkit performance-bundle-audit
26
+ webtoolkit dev-watch --apps=user,admin
27
+ webtoolkit dev-grid --dry-run
28
+ webtoolkit wait-service --url=http://localhost:3001
29
+ webtoolkit env-bootstrap
30
+ webtoolkit env-doctor
31
+ webtoolkit config --help documentation
32
+ webtoolkit config --help guards
33
+ webtoolkit config --json
34
+ webtoolkit config --json guards
35
+ webtoolkit guard documentation
36
+ webtoolkit guard repository-hygiene
37
+ webtoolkit guard package-surface
38
+ webtoolkit run:customTask
39
+ ```
40
+
41
+ Cleanup levels:
42
+
43
+ - `empty`: remove empty directories only.
44
+ - `cache`: remove cache and temporary artifacts.
45
+ - `deep`: remove cache and build artifacts without `node_modules`.
46
+ - `nuclear`: remove cache, build artifacts, `node_modules`, then optionally run package-manager cleanup/reinstall.
47
+
48
+ ## Project Config
49
+
50
+ Create `.webtoolkit-cli/config.json` in the consuming project root when defaults need project-specific paths, package-manager behavior, or configured task recipes. The file must be valid JSON: no comments and no trailing commas.
51
+
52
+ Start with the smallest config that describes what is local to your project:
53
+
54
+ ```json
55
+ {
56
+ "packageManager": "pnpm",
57
+ "cleaner": {
58
+ "workspaceRootNames": ["apps", "packages"],
59
+ "protectedRootNames": ["apps", "scripts"],
60
+ "levels": {
61
+ "deep": {
62
+ "removableSpecificFiles": ["apps/frontend-user/src/setup-env.js"]
63
+ },
64
+ "nuclear": {
65
+ "removableSpecificFiles": ["apps/frontend-user/src/setup-env.js"]
66
+ }
67
+ }
68
+ },
69
+ "tasks": {
70
+ "check": {
71
+ "title": "Project checks",
72
+ "steps": [
73
+ {
74
+ "label": "TypeScript",
75
+ "command": "pnpm",
76
+ "args": ["exec", "tsc", "--noEmit"]
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ The config file is discovered by walking upward from the current working directory.
85
+
86
+ The CLI also exposes its complete configuration reference without requiring a config file:
87
+
88
+ ```bash
89
+ webtoolkit config
90
+ webtoolkit config --help documentation
91
+ webtoolkit config --help guards
92
+ webtoolkit config --json
93
+ webtoolkit config --json documentation
94
+ webtoolkit config --json guards
95
+ ```
96
+
97
+ `--json` emits JSON Schema for tools that need a machine-readable list of supported fields.
98
+
99
+ Every discovered config is validated before a configured command or guard
100
+ starts. Unknown fields, invalid regular expressions, paths that escape the
101
+ project, empty required scopes, unknown builtin names, and steps that define
102
+ both or neither `command` and `builtinGuard` are rejected with config paths in
103
+ the error. Configured scan directories must exist, be directories, and contain
104
+ at least one eligible file; this prevents a missing scope from producing a
105
+ false successful check.
106
+
107
+ ## Config Reference
108
+
109
+ Top-level fields:
110
+
111
+ - `packageManager`: command used for package-manager operations and task steps, usually `pnpm`, `npm`, or `yarn`.
112
+ - `cleaner`: optional cleanup behavior overrides.
113
+ - `tasks`: named recipes used by generic task commands such as `webtoolkit check`, `webtoolkit build`, and `webtoolkit run:<name>`.
114
+ - `guards`: consumer-owned paths, targets, rules, and allowlists for configurable builtin guards.
115
+ - `documentation`: declarative Markdown, collection, paired-document, and coverage-inventory checks.
116
+ - `repoCheck`: repository quality check steps used by `webtoolkit check`.
117
+ - `workspaceTests`: workspace targets used by `webtoolkit test`, `webtoolkit test-coverage`, and `webtoolkit workspace-test`.
118
+ - `releaseGate`: named critical stages used by `webtoolkit release-gate`.
119
+ - `validate`: ordered validation steps used by `webtoolkit validate`.
120
+ - `jsdocReport`: paths and rules used by `webtoolkit jsdoc-report`.
121
+ - `bundleAudit`: frontend build directories used by `webtoolkit performance-bundle-audit`.
122
+ - `upgrade`: dependency upgrade policy used by `webtoolkit upgrade`.
123
+ - `devWatch`: dev app ports and package filters used by `webtoolkit dev-watch`.
124
+ - `devGrid`: terminal row layout used by `webtoolkit dev-grid`.
125
+ - `environment`: Node/Corepack/package-manager policy used by `webtoolkit env-bootstrap` and `webtoolkit env-doctor`.
126
+
127
+ Documentation fields:
128
+
129
+ - `files`: required glob patterns selecting Markdown files to inspect.
130
+ - `excludeDirectories`: optional directory names omitted from repository scanning.
131
+ - `checks`: optional `singleH1`, `headingOrder`, `localLinks`, and reachability rules. The first three default to `true`.
132
+ - `requiredFiles`: exact repository-relative files that must exist.
133
+ - `collections`: document globs with optional index, metadata, and paired-document rules.
134
+ - `inventories`: inventory documents and source globs that must be listed as inline-code paths.
135
+ - Paths and globs are repository-relative. Paired-document targets support `{basename}` and `{stem}`.
136
+ - Run `webtoolkit config --help documentation` or `webtoolkit config --json documentation` for the complete nested reference.
137
+
138
+ Cleaner fields:
139
+
140
+ - `workspaceRootNames`: directory names whose direct children are package/app roots. With `["apps", "packages"]`, paths like `apps/api` and `packages/core` are workspace roots.
141
+ - `protectedRootNames`: top-level directories that must not be removed just because they are empty.
142
+ - `skipEmptyDirNames`: directory names skipped while removing empty directories.
143
+ - `skipArtifactDirNames`: directory names skipped while walking for artifacts.
144
+ - `levels`: per-cleanup-level overrides for `empty`, `cache`, `deep`, and `nuclear`.
145
+
146
+ Cleanup level fields:
147
+
148
+ - `label`: text printed in the summary.
149
+ - `removeEmptyDirs`: whether this level removes empty directories.
150
+ - `removableDirNames`: artifact directory names removable only at the repo root or workspace root.
151
+ - `removableFileNames`: exact file names to remove.
152
+ - `removableFileSuffixes`: file suffixes to remove.
153
+ - `removableFilePrefixes`: file prefixes to remove.
154
+ - `removableFilePatterns`: regex strings matched against file names.
155
+ - `removableSpecificFiles`: project-relative files to remove exactly.
156
+
157
+ Task fields:
158
+
159
+ - `title`: heading printed before the task runs.
160
+ - `failFast`: defaults to `true`; when enabled, later steps are skipped after a failure.
161
+ - `steps`: ordered commands to run.
162
+
163
+ Task step fields:
164
+
165
+ - `label`: human-readable step name.
166
+ - `builtinGuard`: optional builtin guard name for `repoCheck` steps. When present, `command` is not required.
167
+ - `command`: executable to spawn, such as `pnpm`, `node`, or `npm`.
168
+ - `args`: argument array; keep each shell token as a separate string.
169
+ - `cwd`: optional project-relative working directory for the step.
170
+ - `env`: optional environment variables for the step.
171
+ - `appendArgs`: when `true`, extra CLI arguments are appended to this step.
172
+ - `outputMode`: `inherit` by default; use `buffered` to print captured output only on failure.
173
+
174
+ Repo check fields:
175
+
176
+ - `title`: optional heading printed before checks run.
177
+ - `failFast`: defaults to `false`, so every independent check runs and all failures appear in one summary. Set it to `true` to mark later checks as `SKIP` after the first failure.
178
+ - `steps`: ordered task steps. The engine prints each step, tracks duration, and renders a final ASCII summary table.
179
+
180
+ Builtin guards:
181
+
182
+ - `any`
183
+ - `assert-no-tests-in-dist`
184
+ - `code-pattern`
185
+ - `dal-service-repository`
186
+ - `dependency-cruiser`
187
+ - `documentation`
188
+ - `internal-link`
189
+ - `mojibake`
190
+ - `package-surface`
191
+ - `rebuild-preflight`
192
+ - `repository-hygiene`
193
+ - `schema`
194
+ - `singleton-deps`
195
+ - `tsconfig`
196
+ - `workspace-manifest`
197
+
198
+ Configurable guard policy:
199
+
200
+ - `any`: source directories and additional exclusion regexes for AST-based TypeScript `any` keyword detection. Comments, strings, property names, and words merely containing `any` are not violations.
201
+ - `internalLink`: source directories and additional exclusion regexes.
202
+ - `schema`: central schema directory, scanned directories, configured Zod builders, and additional exclusions. Builder calls are recognized through direct and fluent chains.
203
+ - `rebuildPreflight`: named targets with warning text, Turbo filters, and relevant build packages.
204
+ - `repositoryHygiene`: forbidden and explicitly allowed regexes matched against normalized Git-tracked paths.
205
+ - `packageSurface`: post-build package directories and regexes forbidden in the npm dry-run inventory.
206
+ - `tsconfig`: package scope, config files, required includes, compiler options, public aliases, and literal forbidden text. Compiler options and aliases are checked after resolving `extends`.
207
+ - `workspaceManifest`: workspace package roots, internal workspace protocol policy, valid dependency ranges, exclusive runtime dependency sections, unique package names, and explicit provider/consumer peer requirements.
208
+ - `dalServiceRepository`: source root, tsconfig, layer classification, and forbidden layer dependencies.
209
+ - `codePattern`: tsconfig, model directory, and enabled rule scopes/allowlists.
210
+ - These guards fail clearly when their corresponding `guards` block is absent. There are no project-specific builtin profiles.
211
+ - Configured exclusions extend the safe CLI base. They do not replace dependency/build exclusions or common test patterns.
212
+ - Defining `guards.<name>` configures policy but does not execute the guard. Add the builtin to `repoCheck`, call `webtoolkit guard <name>` directly, or place build-dependent checks in `releaseGate`.
213
+ - Run `webtoolkit config --json guards` for the complete nested schema, including required fields and accepted value types.
214
+
215
+ Safe scan defaults:
216
+
217
+ - Source extensions: `.cjs`, `.cts`, `.js`, `.jsx`, `.mjs`, `.mts`, `.ts`, and `.tsx`.
218
+ - Artifact directories: `node_modules`, `dist`, `build`, and `coverage`.
219
+ - Source-policy exclusions: `*.test.*`, `*.test-*`, their `spec` equivalents, `test/`, `tests/`, `__tests__/`, and `*.stories.*`.
220
+
221
+ Complete guard wiring example:
222
+
223
+ ```json
224
+ {
225
+ "guards": {
226
+ "any": {
227
+ "includePaths": ["apps", "packages"]
228
+ },
229
+ "internalLink": {
230
+ "includePaths": ["apps/web/src"]
231
+ },
232
+ "repositoryHygiene": {
233
+ "forbiddenPathPatterns": ["(^|/)\\.env($|\\.)", "\\.(pem|key|p12)$"],
234
+ "allowedPathPatterns": ["(^|/)\\.env\\.example$"]
235
+ },
236
+ "packageSurface": {
237
+ "packageDirectories": ["packages/library"],
238
+ "forbiddenPublishedPatterns": ["(^|/)__tests__/", "\\.(test|spec)\\."]
239
+ },
240
+ "schema": {
241
+ "centralDirectory": "packages/contracts/src/schemas",
242
+ "includePaths": ["apps/api/src", "apps/web/src"],
243
+ "builders": ["object", "enum", "array", "nativeEnum"]
244
+ },
245
+ "tsconfig": {
246
+ "packageScope": "@acme",
247
+ "configs": [
248
+ {
249
+ "path": "tsconfig.json",
250
+ "compilerOptions": {
251
+ "strict": true
252
+ },
253
+ "publicAliases": ["@acme/library"]
254
+ }
255
+ ]
256
+ },
257
+ "workspaceManifest": {
258
+ "packageRoots": ["apps", "packages"],
259
+ "requireWorkspaceProtocol": true,
260
+ "peerRequirements": [
261
+ {
262
+ "dependency": "example-runtime",
263
+ "providers": ["packages/shared-ui"],
264
+ "consumers": ["apps/web"]
265
+ }
266
+ ]
267
+ }
268
+ },
269
+ "repoCheck": {
270
+ "title": "Repository checks",
271
+ "failFast": false,
272
+ "steps": [
273
+ {
274
+ "label": "Repository hygiene",
275
+ "builtinGuard": "repository-hygiene"
276
+ },
277
+ {
278
+ "label": "TypeScript any",
279
+ "builtinGuard": "any"
280
+ },
281
+ {
282
+ "label": "Schema ownership",
283
+ "builtinGuard": "schema"
284
+ },
285
+ {
286
+ "label": "TSConfig policy",
287
+ "builtinGuard": "tsconfig"
288
+ },
289
+ {
290
+ "label": "Workspace manifests",
291
+ "builtinGuard": "workspace-manifest"
292
+ }
293
+ ]
294
+ },
295
+ "releaseGate": {
296
+ "stages": [
297
+ {
298
+ "name": "package-surface",
299
+ "command": "webtoolkit",
300
+ "args": ["guard", "package-surface"]
301
+ }
302
+ ]
303
+ }
304
+ }
305
+ ```
306
+
307
+ `workspaceManifest.packageRoots` are container directories. Their direct
308
+ children containing `package.json` are treated as workspace packages.
309
+ `peerDependencies` plus `devDependencies` is allowed for provider development;
310
+ providers must not keep the configured peer in runtime dependencies, consumers
311
+ must declare it in a runtime dependency section, and runtime dependency
312
+ sections remain mutually exclusive.
313
+
314
+ `repository-hygiene` reads only `git ls-files`; it does not inspect file
315
+ contents or consider ignored local files. Explicit `allowedPathPatterns` take
316
+ precedence over forbidden patterns. Use a dedicated consumer-owned secret
317
+ scanner when content scanning is required. Run it inside a Git worktree with
318
+ at least one tracked file.
319
+
320
+ `package-surface` validates `main`, `module`, `types`, `typings`, string/object
321
+ `bin`, and every file target under `exports`. It verifies both the built file
322
+ and its presence in the JSON inventory from
323
+ `npm pack --dry-run --json --ignore-scripts`, then rejects published paths that
324
+ match `forbiddenPublishedPatterns`. It does not build or publish. Build every
325
+ configured package first and keep this guard outside `repoCheck`. Wildcard or
326
+ unsupported export targets fail with their exact manifest field; `null` export
327
+ targets are intentionally ignored:
328
+
329
+ ```bash
330
+ webtoolkit check
331
+ pnpm run build
332
+ webtoolkit release-gate package-surface
333
+ ```
334
+
335
+ Workspace test fields:
336
+
337
+ - `workspaces`: array of `{ "name", "package", "path" }`. `package` is the package-manager filter name; `path` is project-relative.
338
+ - `errorLogFile`: optional consolidated failure log path. Defaults to `tests_output_errors.log`.
339
+ - `testFilePattern`: optional regex string for test files. Defaults to `\\.(test|spec)\\.(ts|tsx|js|jsx)$`.
340
+ - `ignoreDirNames`: optional directory names skipped while counting test files.
341
+ - `maxFailureExcerptLines`: optional maximum number of lines written per failed workspace.
342
+
343
+ Release gate fields:
344
+
345
+ - `stages`: ordered stages. Each stage needs `name` and either `command`/`args`, `package`/`script`, or `package`/`files`.
346
+ - `package` plus `script` runs `packageManager --filter <package> run <script>`.
347
+ - `package` plus `files` runs `packageManager --filter <package> exec vitest run <files...>`.
348
+
349
+ Validation fields:
350
+
351
+ - `steps`: ordered task steps.
352
+ - `postSteps`: optional ordered task steps run after the main validation steps.
353
+
354
+ JSDoc report fields:
355
+
356
+ - `includePaths`: project-relative directories scanned by default.
357
+ - `excludePatterns`: regex strings skipped during scanning.
358
+ - `reportFile`: Markdown output path used with `--write`, `--report`, or an interactive confirmation.
359
+ - `maxLineLength`: maximum accepted JSDoc line length. `JSDOC_MAX_LINE_LENGTH` overrides this at runtime.
360
+ - `promptForReport`: when `true`, interactive terminals are asked before writing the Markdown report.
361
+
362
+ Bundle audit fields:
363
+
364
+ - `appDirs`: project-relative frontend app directories. Each app is expected to have `dist/assets`.
365
+ - `top`: number of largest assets printed by default.
366
+ - `rawWarningBytes`: raw byte threshold for warning markers.
367
+
368
+ Upgrade fields:
369
+
370
+ - `defaultCooldownDays`: release-age cooldown used unless `--no-cooldown` or `--days=N` is passed.
371
+ - `protectedOverridesFile`: project-relative YAML file with top-level `overrides`, usually `pnpm-workspace.yaml`.
372
+ - `protectedDependencyUpstreamHints`: map of protected package names to upstream packages that should be reviewed before isolated upgrades.
373
+ - `singletonGuardCommand`: optional task step run after protected singleton upgrades.
374
+ - The final upgrade summary reports packages that were not updated and groups them by the deciding filter, such as `Cooldown`, `Major`, or `Protected singleton`.
375
+
376
+ Dev watch fields:
377
+
378
+ - `apps`: map of app keys to `{ "displayName", "port", "filter", "color" }`. `filter` is required for watch mode.
379
+ - `defaultApps`: app keys used when `--apps` is omitted.
380
+ - `backendApp`: optional app key used by `--include-backend`.
381
+ - `host`: optional host used for port checks. Defaults to `127.0.0.1`.
382
+ - `backendPortCleanupGraceMs`: optional wait after killing a stale backend listener.
383
+
384
+ Dev grid fields:
385
+
386
+ - `layout.rows`: ordered terminal rows from top to bottom.
387
+ - each row requires `panes`, ordered from left to right. Panes in the same row receive equal widths, and rows receive equal heights.
388
+ - each pane requires `title` and `command`, and can optionally define:
389
+ - `silentCommand`: command used by `webtoolkit dev-grid --silent`.
390
+ - `fontSize`: positive integer font size applied through a temporary Windows Terminal fragment profile.
391
+ - `fallbackScript` and `silentFallbackScript`: package scripts used when Windows Terminal is unavailable.
392
+ - `preflightCommand`: optional task step run before opening the grid.
393
+ - `layout.rows` is mandatory. The former flat `panes`, `maxPanels`, and per-pane `fullWidth` fields are not accepted.
394
+
395
+ Environment fields:
396
+
397
+ - `requiredNodeMajor`: expected Node major version.
398
+ - `corepackHome`: project-relative Corepack home directory.
399
+
400
+ ## Common Config Patterns
401
+
402
+ Minimal project with only cleaner defaults:
403
+
404
+ ```json
405
+ {
406
+ "packageManager": "pnpm"
407
+ }
408
+ ```
409
+
410
+ Monorepo with apps and packages:
411
+
412
+ ```json
413
+ {
414
+ "packageManager": "pnpm",
415
+ "cleaner": {
416
+ "workspaceRootNames": ["apps", "packages"],
417
+ "protectedRootNames": ["apps", "packages", "scripts"]
418
+ }
419
+ }
420
+ ```
421
+
422
+ Project-specific generated files:
423
+
424
+ ```json
425
+ {
426
+ "cleaner": {
427
+ "levels": {
428
+ "deep": {
429
+ "removableSpecificFiles": ["src/generated/env.d.ts"]
430
+ },
431
+ "nuclear": {
432
+ "removableSpecificFiles": ["src/generated/env.d.ts"]
433
+ }
434
+ }
435
+ }
436
+ }
437
+ ```
438
+
439
+ Task that forwards extra arguments:
440
+
441
+ ```json
442
+ {
443
+ "tasks": {
444
+ "test": {
445
+ "title": "Project tests",
446
+ "steps": [
447
+ {
448
+ "label": "Vitest",
449
+ "command": "pnpm",
450
+ "args": ["exec", "vitest", "run"],
451
+ "appendArgs": true
452
+ }
453
+ ]
454
+ }
455
+ }
456
+ }
457
+ ```
458
+
459
+ Then run:
460
+
461
+ ```bash
462
+ webtoolkit test -- --filter auth
463
+ ```
464
+
465
+ The separator `--` is optional but recommended when forwarding arguments through package scripts.
466
+
467
+ Repo check engine:
468
+
469
+ ```json
470
+ {
471
+ "repoCheck": {
472
+ "title": "Project quality checks",
473
+ "failFast": false,
474
+ "steps": [
475
+ {
476
+ "label": "TypeScript Guard",
477
+ "builtinGuard": "tsconfig"
478
+ },
479
+ {
480
+ "label": "Architecture Lint",
481
+ "builtinGuard": "dependency-cruiser",
482
+ "args": ["src", "--config", ".dependency-cruiser.cjs"]
483
+ }
484
+ ]
485
+ }
486
+ }
487
+ ```
488
+
489
+ Workspace test engine:
490
+
491
+ ```json
492
+ {
493
+ "workspaceTests": {
494
+ "errorLogFile": "tests_output_errors.log",
495
+ "workspaces": [
496
+ { "name": "Core", "package": "@acme/core", "path": "packages/core" },
497
+ { "name": "Backend", "package": "@acme/backend", "path": "apps/backend" }
498
+ ]
499
+ }
500
+ }
501
+ ```
502
+
503
+ Use package scripts inside each workspace:
504
+
505
+ ```json
506
+ {
507
+ "scripts": {
508
+ "test": "webtoolkit workspace-test test",
509
+ "test:coverage": "webtoolkit workspace-test test:coverage"
510
+ }
511
+ }
512
+ ```
513
+
514
+ Release gate engine:
515
+
516
+ ```json
517
+ {
518
+ "releaseGate": {
519
+ "stages": [
520
+ { "name": "core-contracts", "package": "@acme/core", "script": "test:coverage" },
521
+ {
522
+ "name": "backend-critical",
523
+ "package": "@acme/backend",
524
+ "files": ["tests/integration/auth.spec.ts"]
525
+ }
526
+ ]
527
+ }
528
+ }
529
+ ```
530
+
531
+ JSDoc, bundle audit, and upgrade engines:
532
+
533
+ ```json
534
+ {
535
+ "jsdocReport": {
536
+ "includePaths": ["apps/backend", "packages/core"],
537
+ "excludePatterns": ["node_modules", "dist", "\\.test\\.", "\\.spec\\."],
538
+ "reportFile": "temp_jsdocs_check.md",
539
+ "maxLineLength": 250,
540
+ "promptForReport": true
541
+ },
542
+ "bundleAudit": {
543
+ "appDirs": ["apps/frontend"],
544
+ "top": 20,
545
+ "rawWarningBytes": 1000000
546
+ },
547
+ "upgrade": {
548
+ "defaultCooldownDays": 7,
549
+ "protectedOverridesFile": "pnpm-workspace.yaml",
550
+ "protectedDependencyUpstreamHints": {
551
+ "zod": ["@acme/shared-utils"]
552
+ },
553
+ "singletonGuardCommand": {
554
+ "label": "Singleton Guard",
555
+ "command": "pnpm",
556
+ "args": ["exec", "tsx", "scripts/guards/singleton-deps.ts"]
557
+ }
558
+ }
559
+ }
560
+ ```
561
+
562
+ Dev and environment engines:
563
+
564
+ ```json
565
+ {
566
+ "devWatch": {
567
+ "host": "127.0.0.1",
568
+ "backendApp": "backend",
569
+ "defaultApps": ["user"],
570
+ "apps": {
571
+ "backend": { "displayName": "Backend", "port": 3001 },
572
+ "user": {
573
+ "displayName": "Frontend User",
574
+ "filter": "@acme/frontend-user",
575
+ "port": 3002
576
+ }
577
+ }
578
+ },
579
+ "devGrid": {
580
+ "fallbackScript": "dev:concurrent",
581
+ "silentFallbackScript": "dev:concurrent:silent",
582
+ "preflightCommand": {
583
+ "label": "DEV port preflight",
584
+ "command": "webtoolkit",
585
+ "args": ["dev-watch", "--check-only", "--include-backend"]
586
+ },
587
+ "layout": {
588
+ "rows": [
589
+ {
590
+ "panes": [
591
+ {
592
+ "title": "FRONTEND USER",
593
+ "command": "pnpm run dev:frontend-user",
594
+ "silentCommand": "pnpm run dev:frontend-user:silent",
595
+ "fontSize": 15
596
+ }
597
+ ]
598
+ },
599
+ {
600
+ "panes": [
601
+ {
602
+ "title": "BACKEND",
603
+ "command": "pnpm run dev:backend"
604
+ }
605
+ ]
606
+ }
607
+ ]
608
+ }
609
+ },
610
+ "environment": {
611
+ "requiredNodeMajor": 26,
612
+ "corepackHome": ".corepack"
613
+ }
614
+ }
615
+ ```
616
+
617
+ Command resolution:
618
+
619
+ - When a native top-level config block exists, the matching command uses the CLI engine: `repoCheck` for `check`; `workspaceTests` for `test`, `test-coverage`, and `workspace-test`; `releaseGate` for `release-gate`; `validate` for `validate`; `jsdocReport` for `jsdoc-report`; `bundleAudit` for `performance-bundle-audit`; `upgrade` for `upgrade`; `devWatch` for `dev-watch`; `devGrid` for `dev-grid`; `environment` for `env-bootstrap` and `env-doctor`.
620
+ - Without the native block, public task commands fall back to configured task names:
621
+
622
+ - `webtoolkit build` -> `tasks.build`
623
+ - `webtoolkit test` -> `tasks.test`
624
+ - `webtoolkit test-coverage` -> `tasks.testCoverage`
625
+ - `webtoolkit release-gate` -> `tasks.releaseGate`
626
+ - `webtoolkit validate` -> `tasks.validate`
627
+ - `webtoolkit jsdoc-report` -> `tasks.jsdocReport`
628
+ - `webtoolkit upgrade` -> `tasks.upgrade`
629
+ - `webtoolkit performance-bundle-audit` -> `tasks.performanceBundleAudit`
630
+ - `webtoolkit run:<name>` -> `tasks.<name>`
631
+
632
+ ## Avoiding Config Mistakes
633
+
634
+ - Use JSON arrays for `args`; do not write a whole command line as one string.
635
+ - Use project-relative paths in config. Absolute paths make the config machine-specific.
636
+ - Put generated-file cleanup in both `deep` and `nuclear` if both levels should remove it.
637
+ - Only override `removableDirNames` when you want to replace the default artifact directory list.
638
+ - Prefer `webtoolkit <task> --help` before running a newly configured task; it prints the resolved step list.
639
+ - Always test cleanup with `--dry-run` before running a destructive level.
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};