@webjsdev/cli 0.10.10 → 0.10.11

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/bin/webjs.js CHANGED
@@ -255,10 +255,12 @@ async function main() {
255
255
 
256
256
  if (rest.includes('--rules')) {
257
257
  console.log('webjs check, correctness rules:');
258
- console.log(' Every rule catches objectively broken code (a crash, a');
259
- console.log(' security leak, or a build/type-strip failure) and always');
260
- console.log(' runs. Project conventions (layout, style, process) are');
261
- console.log(' guidance in CONVENTIONS.md, not rules here.\n');
258
+ console.log(' Every rule catches code that is wrong to ship: a crash, a');
259
+ console.log(' security leak, a build/type-strip failure, or (the one');
260
+ console.log(' sentinel-based rule, no-scaffold-placeholder) unreplaced');
261
+ console.log(' scaffold example content. They always run. Project');
262
+ console.log(' conventions (layout, style, process) are guidance in');
263
+ console.log(' CONVENTIONS.md, not rules here.\n');
262
264
  for (const r of RULES) {
263
265
  console.log(` ${r.name.padEnd(30)} ${r.description}`);
264
266
  }
package/lib/create.js CHANGED
@@ -685,7 +685,8 @@ export type ActionResult<T> =
685
685
  .replace(/`/g, '\\`')
686
686
  .replace(/\$\{/g, '\\${');
687
687
 
688
- await writeFile(join(appDir, 'app', 'layout.ts'), `import { html, cspNonce } from '@webjsdev/core';
688
+ await writeFile(join(appDir, 'app', 'layout.ts'), `// webjs-scaffold-placeholder. This is the example app chrome (brand, nav, content-width container). Adapt it to your app, then delete this line. webjs check fails while the marker remains.
689
+ import { html, cspNonce } from '@webjsdev/core';
689
690
  import '@webjsdev/core/client-router';
690
691
  import '../components/theme-toggle.ts';
691
692
  // Webjs UI components are tiered:
@@ -846,11 +847,19 @@ ${SHADCN_THEME}
846
847
  <span>${name}</span>
847
848
  </a>
848
849
  <nav class="flex gap-4 items-center">
850
+ <!-- Example nav. Replace with the real navigation for your app. -->
849
851
  \${navLink('/', 'Home')}
850
852
  <theme-toggle></theme-toggle>
851
853
  </nav>
852
854
  </header>
853
855
 
856
+ <!--
857
+ Content shell. The max-w-[760px] cap is a comfortable READING width,
858
+ right for prose, forms, and marketing. For a full-bleed app, dashboard,
859
+ or board, REPLACE it: widen the cap (for example max-w-[1400px]) or
860
+ drop the cap and mx-auto for an edge-to-edge layout. A wide layout left
861
+ inside the 760px reading column overflows into a horizontal scrollbar.
862
+ -->
854
863
  <main class="block max-w-[760px] mx-auto px-4 sm:px-6 pt-[72px] pb-12 min-h-screen">
855
864
  \${children}
856
865
  </main>
@@ -858,7 +867,8 @@ ${SHADCN_THEME}
858
867
  }
859
868
  `);
860
869
 
861
- await writeFile(join(appDir, 'app', 'page.ts'), `import { html } from '@webjsdev/core';
870
+ await writeFile(join(appDir, 'app', 'page.ts'), `// webjs-scaffold-placeholder. This is the example homepage. Replace it with your app's real page, then delete this line. webjs check fails while the marker remains.
871
+ import { html } from '@webjsdev/core';
862
872
  import { rubric, displayH1, accentLink } from '../lib/utils/ui.ts';
863
873
  import { buttonClass } from '../components/ui/button.ts';
864
874
  import { badgeClass } from '../components/ui/badge.ts';
@@ -1076,6 +1086,10 @@ For AI agents, read this before editing scaffolded files:
1076
1086
  Replace them with the app the user actually asked for. Don't ship
1077
1087
  the scaffold's example User model or "Hello from …" page as the
1078
1088
  final product.
1089
+ • This fresh app intentionally FAILS \`webjs check\` with two
1090
+ no-scaffold-placeholder violations (app/page.ts, app/layout.ts).
1091
+ That is the signal to replace the example content. Delete each
1092
+ marker comment line as you do, and the check goes green.
1079
1093
  • Use Prisma + SQLite for app data. It's already wired up. Define
1080
1094
  real models in prisma/schema.prisma and run \`webjs db migrate\`.
1081
1095
  NEVER store app data in JSON files, in-memory arrays, or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjsdev/cli",
3
- "version": "0.10.10",
3
+ "version": "0.10.11",
4
4
  "type": "module",
5
5
  "description": "webjs CLI - dev, start, create, db",
6
6
  "bin": {
@@ -6,10 +6,12 @@ node_modules
6
6
  # `.webjs/` is ignored EXCEPT for `.webjs/vendor/`, which holds the committed
7
7
  # importmap manifest (and optionally downloaded bundle bytes) the server needs
8
8
  # at boot without reaching api.jspm.io. DO NOT collapse to `**/.webjs`: parent
9
- # exclusion blocks child negations and the vendor files would never ship.
10
- .webjs/*
11
- !.webjs/vendor/
12
- !.webjs/vendor/**
9
+ # exclusion blocks child negations and the vendor files would never ship. The
10
+ # `**/` prefix matches `.webjs/` at any depth so a nested build context does
11
+ # not ship the per-machine cache, mirroring the `.gitignore` pattern.
12
+ **/.webjs/*
13
+ !**/.webjs/vendor/
14
+ !**/.webjs/vendor/**
13
15
 
14
16
  dist
15
17
  build
@@ -14,7 +14,19 @@ now (`app/page.ts` printing "Hello from {{APP_NAME}}", the example `User`
14
14
  model in `prisma/schema.prisma`, the `theme-toggle` component, the
15
15
  example users module in api/saas templates) are **starting-point
16
16
  references, not the final product**. Your job is to replace them with
17
- the app the user actually asked for.
17
+ the app the user actually asked for. That includes adapting
18
+ `app/layout.ts`, not just the page. Set the real brand, replace the
19
+ example `Home` nav, and pick a content-width container that fits. The
20
+ default `<main class="max-w-[760px]">` is a reading column for prose and
21
+ forms, so for a full-bleed app, dashboard, or board, widen the cap or
22
+ remove it (keep the theme tokens). A wide layout left in the 760px
23
+ reading column overflows into a horizontal scrollbar. This is ENFORCED:
24
+ the example `app/page.ts` and `app/layout.ts` carry a
25
+ `webjs-scaffold-placeholder` marker comment, and `webjs check` fails
26
+ while any marker remains, so this freshly scaffolded app fails the check
27
+ until you replace the example content (or deliberately keep it) and
28
+ delete the marker line. The delivered app must contain only what the
29
+ user asked for, never leftover scaffold code.
18
30
 
19
31
  **Non-negotiables for every webjs app:**
20
32
 
@@ -449,15 +461,18 @@ URLs or transitive deps drift. Pin is a deliberate developer action,
449
461
  like `npm install` itself.
450
462
 
451
463
  **Do NOT modify the `.webjs/` lines in `.gitignore` / `.dockerignore`.**
452
- The scaffolded pattern is three lines (`.webjs/*` + `!.webjs/vendor/`
453
- + `!.webjs/vendor/**`) and is structurally load-bearing. Collapsing it
454
- to a single `.webjs/` excludes the parent directory; once the parent
455
- is excluded, git cannot re-include `.webjs/vendor/` via a child
456
- negation (gitignore semantics: parent exclusion blocks child
457
- negations). The breakage is invisible: `webjs vendor pin` runs, writes
458
- files, and git silently ignores them. Production then has no
459
- importmap.json and the server falls back to calling api.jspm.io on
460
- every cold start. The `gitignore-vendor-not-ignored` lint rule
464
+ The scaffolded `.gitignore` pattern is three lines (`**/.webjs/*` +
465
+ `!**/.webjs/vendor/` + `!**/.webjs/vendor/**`) and is structurally
466
+ load-bearing. Collapsing it to a single `.webjs/` excludes the parent
467
+ directory; once the parent is excluded, git cannot re-include
468
+ `.webjs/vendor/` via a child negation (gitignore semantics: parent
469
+ exclusion blocks child negations). The breakage is invisible: `webjs
470
+ vendor pin` runs, writes files, and git silently ignores them.
471
+ Production then has no importmap.json and the server falls back to
472
+ calling api.jspm.io on every cold start. The `**/` prefix matters too:
473
+ it ignores `.webjs/` at any depth, so an app nested below its repo root
474
+ (a monorepo package) does not leak its generated `.webjs/routes.d.ts`
475
+ into `git status`. The `gitignore-vendor-not-ignored` lint rule
461
476
  (`webjs check`) verifies the pattern with `git check-ignore` and will
462
477
  fail CI if it regresses.
463
478
 
@@ -308,11 +308,28 @@ When the user asks the agent to build their actual app:
308
308
  need a theme picker.
309
309
  4. **Delete the example users module** (api/saas templates) if the app
310
310
  doesn't use it.
311
- 5. **Keep:** the Prisma setup, the test config, the agent config files
311
+ 5. **Adapt `app/layout.ts` to the app, not just the page.** Set the real
312
+ brand, replace the example `Home` nav with the app's navigation, and
313
+ pick a content-width container that fits. The default
314
+ `<main class="max-w-[760px]">` is a reading column for prose, forms,
315
+ and marketing. Widen it or drop the cap for a full-bleed app,
316
+ dashboard, or board, or a wide layout overflows into an unnecessary
317
+ horizontal scrollbar. Keep the design tokens and theme setup, those
318
+ are infrastructure.
319
+ 6. **Keep:** the Prisma setup, the test config, the agent config files
312
320
  (`AGENTS.md`, `CONVENTIONS.md`, `CLAUDE.md`, `.cursorrules`, etc.),
313
321
  `lib/prisma.server.ts`, the directory conventions, the design tokens in
314
322
  `app/layout.ts`. These are the infrastructure, not the example app.
315
323
 
324
+ This is enforced, not just advised. The example `app/page.ts` and
325
+ `app/layout.ts` carry a `webjs-scaffold-placeholder` marker comment, and
326
+ the `no-scaffold-placeholder` check fails while any marker remains, so a
327
+ freshly scaffolded app fails `webjs check` until you address each
328
+ placeholder. The marker is acknowledge-and-remove: replace the example
329
+ content, or deliberately keep it, and in either case delete the marker
330
+ line. So the delivered app contains only what the user asked for, never
331
+ leftover scaffold code.
332
+
316
333
  The scaffold exists so the agent doesn't reinvent the directory layout,
317
334
  the Prisma wiring, the test runner config, or the convention files. It
318
335
  does NOT exist so the agent ships the example homepage.