@webjsdev/cli 0.10.39 → 0.10.41

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 (71) hide show
  1. package/bin/webjs.js +4 -46
  2. package/lib/app-tasks.js +13 -7
  3. package/lib/create.js +306 -487
  4. package/lib/doctor.js +73 -26
  5. package/package.json +5 -1
  6. package/templates/.agents/rules/workflow.md +61 -271
  7. package/templates/.agents/skills/webjs/SKILL.md +226 -0
  8. package/templates/.agents/skills/webjs/references/auth-and-sessions.md +220 -0
  9. package/templates/.agents/skills/webjs/references/built-ins.md +200 -0
  10. package/templates/.agents/skills/webjs/references/client-router-and-streaming.md +204 -0
  11. package/templates/.agents/skills/webjs/references/components.md +167 -0
  12. package/templates/.agents/skills/webjs/references/data-and-actions.md +187 -0
  13. package/templates/.agents/skills/webjs/references/muscle-memory-gotchas.md +170 -0
  14. package/templates/.agents/skills/webjs/references/optimistic-ui.md +128 -0
  15. package/templates/.agents/skills/webjs/references/routing-and-pages.md +158 -0
  16. package/templates/.agents/skills/webjs/references/runtime.md +80 -0
  17. package/templates/.agents/skills/webjs/references/service-worker.md +78 -0
  18. package/templates/.agents/skills/webjs/references/styling.md +123 -0
  19. package/templates/.agents/skills/webjs/references/testing.md +125 -0
  20. package/templates/.agents/skills/webjs/references/typescript.md +148 -0
  21. package/templates/.claude/hooks/check-server-imports.mjs +1 -1
  22. package/templates/.claude/hooks/require-tests-with-src.sh +1 -1
  23. package/templates/.claude/settings.json +0 -14
  24. package/templates/.cursorrules +21 -189
  25. package/templates/.github/copilot-instructions.md +7 -185
  26. package/templates/.github/pull_request_template.md +1 -1
  27. package/templates/AGENTS.md +59 -1484
  28. package/templates/CLAUDE.md +0 -1
  29. package/templates/CONVENTIONS.md +32 -1383
  30. package/templates/GEMINI.md +11 -0
  31. package/templates/gallery/app/apple-icon.ts +0 -1
  32. package/templates/gallery/app/examples/todo/page.ts +0 -1
  33. package/templates/gallery/app/features/async-render/page.ts +0 -1
  34. package/templates/gallery/app/features/boundaries/page.ts +0 -1
  35. package/templates/gallery/app/features/broadcast/page.ts +0 -1
  36. package/templates/gallery/app/features/caching/page.ts +0 -1
  37. package/templates/gallery/app/features/client-router/page.ts +0 -1
  38. package/templates/gallery/app/features/client-router/second/page.ts +0 -1
  39. package/templates/gallery/app/features/components/page.ts +0 -1
  40. package/templates/gallery/app/features/directives/page.ts +0 -1
  41. package/templates/gallery/app/features/env/page.ts +0 -1
  42. package/templates/gallery/app/features/file-storage/page.ts +0 -1
  43. package/templates/gallery/app/features/forms/page.ts +0 -1
  44. package/templates/gallery/app/features/metadata/page.ts +0 -1
  45. package/templates/gallery/app/features/optimistic-ui/page.ts +0 -1
  46. package/templates/gallery/app/features/rate-limit/page.ts +0 -1
  47. package/templates/gallery/app/features/route-handler/page.ts +0 -1
  48. package/templates/gallery/app/features/routing/page.ts +0 -1
  49. package/templates/gallery/app/features/server-actions/page.ts +0 -1
  50. package/templates/gallery/app/features/service-worker/page.ts +0 -1
  51. package/templates/gallery/app/features/sessions/page.ts +0 -1
  52. package/templates/gallery/app/features/websockets/page.ts +0 -1
  53. package/templates/gallery/app/global-error.ts +0 -1
  54. package/templates/gallery/app/global-not-found.ts +0 -1
  55. package/templates/gallery/app/icon.ts +0 -1
  56. package/templates/gallery/app/manifest.ts +0 -1
  57. package/templates/gallery/app/opengraph-image.ts +0 -1
  58. package/templates/gallery/app/robots.ts +0 -1
  59. package/templates/gallery/app/sitemap.ts +0 -1
  60. package/templates/gallery/app/twitter-image.ts +0 -1
  61. package/templates/gallery/modules/async-render/components/server-clock.ts +7 -6
  62. package/templates/public/favicon.svg +5 -0
  63. package/templates/public/sw.js +1 -1
  64. package/templates/scripts/clear-gallery.mjs +95 -0
  65. package/lib/clear-placeholders.js +0 -98
  66. package/lib/design-bar.js +0 -67
  67. package/templates/.claude/hooks/design-review-before-stop.sh +0 -36
  68. package/templates/.claude/hooks/route-skills.sh +0 -35
  69. package/templates/.claude/skills/webjs-design-review/SKILL.md +0 -84
  70. package/templates/LAYOUT-REFERENCE.md +0 -96
  71. package/templates/lib/utils/ui.ts +0 -83
package/bin/webjs.js CHANGED
@@ -4,7 +4,6 @@ import { spawn } from 'node:child_process';
4
4
  import { fileURLToPath } from 'node:url';
5
5
  import { resolveBin } from '../lib/resolve-bin.js';
6
6
  import { dbGenerateTtyHint } from '../lib/db-hints.js';
7
- import { DESIGN_REMINDER, hasUiLayout } from '../lib/design-bar.js';
8
7
  import { checkNodeInline, nodeInlineMessage } from '../lib/node-preflight.js';
9
8
  import { loadAppEnv, resolvePort } from '../lib/port.js';
10
9
  import { planDevSupervisor } from '../lib/dev-supervisor.js';
@@ -47,7 +46,7 @@ const USAGE = `webjs commands:
47
46
  (--no-hot: run in-process, no hot-reload supervisor)
48
47
  webjs start [--port 8080] Start production server (serves source directly, no build step)
49
48
  webjs test [--server|--browser] Run server + browser tests
50
- webjs check [--json] [--clear-placeholders] Run correctness checks (--json emits structured violations; --clear-placeholders strips scaffold markers)
49
+ webjs check [--json] Run correctness checks (--json emits structured violations)
51
50
  webjs mcp Start the read-only MCP server (routes / actions / components / check)
52
51
  webjs doctor Verify project health (Node, tsconfig, env, vendor pins, importmap coherence, @webjsdev versions, git hook, page/layout elision)
53
52
  webjs types Generate .webjs/routes.d.ts (typed Route union + per-route params)
@@ -412,37 +411,12 @@ async function main() {
412
411
  case 'check': {
413
412
  const { checkConventions, RULES } = await import('@webjsdev/server/check');
414
413
 
415
- // --clear-placeholders: acknowledge the whole scaffold gallery in one
416
- // command (strip the marker comment lines, keep the demo code), instead of
417
- // one hand-edit per file. The gate then reflects only real violations.
418
- if (rest.includes('--clear-placeholders')) {
419
- const { clearPlaceholders } = await import('../lib/clear-placeholders.js');
420
- const report = clearPlaceholders(process.cwd());
421
- const total = report.reduce((n, r) => n + r.markers, 0);
422
- if (report.length === 0) {
423
- console.log('webjs check: no scaffold-placeholder markers found (nothing to clear).');
424
- } else {
425
- console.log(`webjs check: cleared ${total} scaffold-placeholder marker(s) across ${report.length} file(s):`);
426
- for (const r of report) console.log(` ${r.file}`);
427
- console.log('\nThe demo code is kept. Delete any gallery route/module you do not want, then re-run `webjs check`.');
428
- // Re-surface the design bar the cleared markers carried. The
429
- // layout/home marker was the just-in-time "adapt this chrome" reminder;
430
- // stripping it silently is how an app ends up shipping the scaffold
431
- // shell. Print the bar so clearing the markers cannot quietly drop it,
432
- // but only for a UI app (the api template has no layout / no chrome).
433
- if (hasUiLayout(process.cwd())) console.log(DESIGN_REMINDER);
434
- }
435
- break;
436
- }
437
-
438
414
  if (rest.includes('--rules')) {
439
415
  console.log('webjs check, correctness rules:');
440
416
  console.log(' Every rule catches code that is wrong to ship: a crash, a');
441
- console.log(' security leak, a build/type-strip failure, or (the one');
442
- console.log(' sentinel-based rule, no-scaffold-placeholder) unreplaced');
443
- console.log(' scaffold example content. They always run. Project');
444
- console.log(' conventions (layout, style, process) are guidance in');
445
- console.log(' CONVENTIONS.md, not rules here.\n');
417
+ console.log(' security leak, or a build/type-strip failure. They always');
418
+ console.log(' run. Project conventions (layout, style, process) are');
419
+ console.log(' guidance in CONVENTIONS.md, not rules here.\n');
446
420
  for (const r of RULES) {
447
421
  console.log(` ${r.name.padEnd(30)} ${r.description}`);
448
422
  }
@@ -469,28 +443,12 @@ async function main() {
469
443
  console.log('webjs check: all checks pass ✓');
470
444
  } else {
471
445
  console.log(`webjs check: ${violations.length} violation(s) found\n`);
472
- // A fresh scaffold trips no-scaffold-placeholder on every unadapted demo
473
- // file at once. Printing an identical block per file drowns the real
474
- // feature violations, so collapse the sentinel to ONE grouped summary
475
- // (with a one-command clear) and print every other rule per-violation.
476
- // The returned violations and --json are unchanged; only this human
477
- // printout groups, so agents/tools still see one entry per file.
478
- const PLACEHOLDER = 'no-scaffold-placeholder';
479
- const placeholders = violations.filter((v) => v.rule === PLACEHOLDER);
480
446
  for (const v of violations) {
481
- if (v.rule === PLACEHOLDER) continue;
482
447
  console.log(` ✗ [${v.rule}] ${v.file}`);
483
448
  console.log(` ${v.message}`);
484
449
  if (v.fix) console.log(` Fix: ${v.fix}`);
485
450
  console.log();
486
451
  }
487
- if (placeholders.length > 0) {
488
- console.log(` ✗ [${PLACEHOLDER}] ${placeholders.length} file(s) still carry scaffold example content:`);
489
- for (const v of placeholders) console.log(` ${v.file}`);
490
- console.log(' Fix: adapt or delete each file, then remove its marker comment line.');
491
- console.log(' Keeping the gallery? Run `webjs check --clear-placeholders` to clear all markers at once.');
492
- console.log();
493
- }
494
452
  process.exit(1);
495
453
  }
496
454
  break;
package/lib/app-tasks.js CHANGED
@@ -4,15 +4,20 @@ import { join } from 'node:path';
4
4
  /**
5
5
  * Read the dev/start task orchestration from an app's `package.json` `"webjs"`
6
6
  * block (#550). This is what lets `webjs dev` / `webjs start` behave identically
7
- * to `npm run dev` / `npm run start`: the orchestration (Tailwind's watcher, a
8
- * `db migrate` before prod boot) moves OUT of `concurrently` + `pre*` npm hooks
7
+ * to `npm run dev` / `npm run start`: the orchestration (a Tailwind compile, a
8
+ * `db migrate` before boot) moves OUT of `concurrently` + `pre*` npm hooks
9
9
  * and INTO the framework primitive, so a bare `webjs dev` is not a degraded run.
10
10
  *
11
+ * Reads only `before` / `parallel` here (the CLI-run tasks). The dev-only
12
+ * `regenerate` key (#967, on-request rebuilds of a stale served output like
13
+ * `public/tailwind.css`) is read by the SERVER, not this reader, so the scaffold
14
+ * keeps its static CSS fresh WITHOUT a `--watch` under `parallel`.
15
+ *
11
16
  * Shape:
12
17
  * "webjs": {
13
18
  * "dev": {
14
- * "before": ["webjs db migrate"],
15
- * "parallel": ["tailwindcss -i ./public/input.css -o ./public/tailwind.css --watch"]
19
+ * "before": ["webjs db migrate", "tailwindcss -i ./public/input.css -o ./public/tailwind.css --minify"]
20
+ * // dev.regenerate keeps the CSS fresh on request (server-read, see dev-regenerate.js)
16
21
  * },
17
22
  * "start": { "before": ["webjs db migrate"] }
18
23
  * }
@@ -20,9 +25,10 @@ import { join } from 'node:path';
20
25
  * `before` commands run sequentially to completion BEFORE the server boots (the
21
26
  * old `predev` / `prestart` hooks: a one-shot `webjs db migrate`).
22
27
  * `parallel` (dev only) commands run as long-lived child processes ALONGSIDE the
23
- * server (the old `concurrently` watchers: Tailwind). Returns normalized arrays
24
- * (never undefined) so callers iterate without guards, and a missing/empty
25
- * config yields empty arrays so a plain app runs `webjs dev`/`start` unchanged.
28
+ * server (the old `concurrently` watchers), for a genuinely long-lived side
29
+ * process. Returns normalized arrays (never undefined) so callers iterate
30
+ * without guards, and a missing/empty config yields empty arrays so a plain app
31
+ * runs `webjs dev`/`start` unchanged.
26
32
  *
27
33
  * Pure (reads one file, never spawns / prints / exits) so it is unit-testable
28
34
  * without a process, matching `lib/port.js` and `lib/dev-supervisor.js`.