@webjsdev/cli 0.10.12 → 0.10.13
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/README.md +1 -1
- package/bin/webjs.js +19 -13
- package/lib/create.js +24 -18
- package/package.json +3 -7
- package/templates/.claude.json +1 -1
- package/templates/AGENTS.md +17 -15
- package/templates/CONVENTIONS.md +5 -5
- package/lib/check-json.js +0 -47
- package/lib/mcp-docs.js +0 -400
- package/lib/mcp-source.js +0 -244
- package/lib/mcp.js +0 -557
- package/resources/AGENTS.md +0 -404
- package/resources/agent-docs/advanced.md +0 -1090
- package/resources/agent-docs/built-ins.md +0 -367
- package/resources/agent-docs/components.md +0 -486
- package/resources/agent-docs/configuration.md +0 -207
- package/resources/agent-docs/framework-dev.md +0 -65
- package/resources/agent-docs/lit-muscle-memory-gotchas.md +0 -456
- package/resources/agent-docs/metadata.md +0 -334
- package/resources/agent-docs/recipes.md +0 -440
- package/resources/agent-docs/service-worker.md +0 -100
- package/resources/agent-docs/ssr-partial-nav-design.md +0 -214
- package/resources/agent-docs/styling.md +0 -235
- package/resources/agent-docs/testing.md +0 -372
- package/resources/agent-docs/typescript.md +0 -334
package/README.md
CHANGED
package/bin/webjs.js
CHANGED
|
@@ -141,7 +141,7 @@ async function main() {
|
|
|
141
141
|
}
|
|
142
142
|
case 'ui': {
|
|
143
143
|
// Delegate to @webjsdev/ui. Bundled as a hard dependency of
|
|
144
|
-
// @webjsdev/cli, so `npm install -g
|
|
144
|
+
// @webjsdev/cli, so `npm install -g webjsdev` pulls it in
|
|
145
145
|
// automatically, and `webjs ui add button` works out of the box
|
|
146
146
|
// without an extra install in user projects.
|
|
147
147
|
const { createRequire } = await import('node:module');
|
|
@@ -157,7 +157,7 @@ async function main() {
|
|
|
157
157
|
entry = userReq.resolve('@webjsdev/ui/bin/webjsui.js');
|
|
158
158
|
} catch {
|
|
159
159
|
console.error('@webjsdev/ui could not be resolved.');
|
|
160
|
-
console.error('Reinstall the CLI: npm install -g
|
|
160
|
+
console.error('Reinstall the CLI: npm install -g webjsdev');
|
|
161
161
|
process.exit(1);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -275,7 +275,9 @@ async function main() {
|
|
|
275
275
|
// identical to the MCP `check` tool. The non-zero exit on violations is
|
|
276
276
|
// preserved (an agent gates on the exit code AND parses the report).
|
|
277
277
|
if (rest.includes('--json')) {
|
|
278
|
-
|
|
278
|
+
// The projector lives in @webjsdev/mcp (the MCP `check` tool's home),
|
|
279
|
+
// so `check --json` and the MCP tool stay byte-identical (#415).
|
|
280
|
+
const { projectCheck } = await import('@webjsdev/mcp/check-report');
|
|
279
281
|
console.log(JSON.stringify(projectCheck(violations)));
|
|
280
282
|
if (violations.length > 0) process.exit(1);
|
|
281
283
|
break;
|
|
@@ -647,19 +649,23 @@ Full docs: https://docs.webjs.com`);
|
|
|
647
649
|
process.exit(1);
|
|
648
650
|
}
|
|
649
651
|
case 'mcp': {
|
|
650
|
-
// Read-only MCP server (#262) over stdio. STDOUT is the JSON-RPC
|
|
651
|
-
// so nothing here may write to stdout: the data functions are
|
|
652
|
-
// and `runMcpServer` routes all diagnostics to stderr. The
|
|
653
|
-
//
|
|
654
|
-
|
|
652
|
+
// Read-only MCP server (#262, #415) over stdio. STDOUT is the JSON-RPC
|
|
653
|
+
// channel, so nothing here may write to stdout: the data functions are
|
|
654
|
+
// read-only and `runMcpServer` routes all diagnostics to stderr. The
|
|
655
|
+
// implementation lives in the standalone `@webjsdev/mcp` package (also
|
|
656
|
+
// runnable directly as `npx @webjsdev/mcp`); `webjs mcp` delegates to it
|
|
657
|
+
// for back-compat. The version advertised in the initialize handshake is
|
|
658
|
+
// @webjsdev/mcp's own, resolved by its bin, so this passes none.
|
|
659
|
+
const { runMcpServer } = await import('@webjsdev/mcp');
|
|
660
|
+
const { createRequire } = await import('node:module');
|
|
661
|
+
const require = createRequire(import.meta.url);
|
|
655
662
|
let version = '0.0.0';
|
|
656
663
|
try {
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
664
|
+
const { readFileSync } = await import('node:fs');
|
|
665
|
+
version = JSON.parse(
|
|
666
|
+
readFileSync(require.resolve('@webjsdev/mcp/package.json'), 'utf8'),
|
|
667
|
+
).version || version;
|
|
661
668
|
} catch {}
|
|
662
|
-
const { runMcpServer } = await import('../lib/mcp.js');
|
|
663
669
|
await runMcpServer({
|
|
664
670
|
stdin: process.stdin,
|
|
665
671
|
stdout: process.stdout,
|
package/lib/create.js
CHANGED
|
@@ -308,6 +308,7 @@ export async function scaffoldApp(name, cwd, opts = {}) {
|
|
|
308
308
|
// tsc --noEmit). Not needed at runtime (Node strips types in place), only
|
|
309
309
|
// to type-check the app.
|
|
310
310
|
typescript: '^5.6.0',
|
|
311
|
+
'@types/node': '^24.0.0',
|
|
311
312
|
'@web/test-runner': '^0.20.0',
|
|
312
313
|
'@web/test-runner-playwright': '^0.11.0',
|
|
313
314
|
'playwright': '^1.59.0',
|
|
@@ -315,14 +316,19 @@ export async function scaffoldApp(name, cwd, opts = {}) {
|
|
|
315
316
|
// assertNoA11yViolations() test helper from @webjsdev/core/testing.
|
|
316
317
|
// Test-only: dynamically imported, never shipped to the app runtime.
|
|
317
318
|
'axe-core': '^4.10.0',
|
|
318
|
-
// tsserver plugin
|
|
319
|
-
//
|
|
320
|
-
//
|
|
321
|
-
|
|
322
|
-
//
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
|
|
319
|
+
// tsserver plugin, wired into tsconfig below. Gives the language
|
|
320
|
+
// INTELLIGENCE (go-to-def, completions, diagnostics, hover inside html``
|
|
321
|
+
// templates) in any tsserver editor with NO editor plugin installed,
|
|
322
|
+
// because editors load tsconfig plugins from node_modules. The `webjs`
|
|
323
|
+
// VS Code extension and webjs.nvim ALSO bundle this plugin (so it works
|
|
324
|
+
// before `npm install` too, and adds template HIGHLIGHTING, which a
|
|
325
|
+
// tsserver plugin can't provide); tsserver dedupes by name, so loading
|
|
326
|
+
// it both ways is a no-op. Standalone, no Lit dependency. Editor-only.
|
|
327
|
+
'@webjsdev/intellisense': 'latest',
|
|
328
|
+
// NOTE: @webjsdev/ui is intentionally NOT pinned. The UI kit is
|
|
329
|
+
// shadcn-style copy-in: `webjs ui add <name>` copies component source
|
|
330
|
+
// into components/ui/ (they import @webjsdev/core, not the kit), and the
|
|
331
|
+
// CLI resolves @webjsdev/ui from its own install.
|
|
326
332
|
},
|
|
327
333
|
}, null, 2) + '\n');
|
|
328
334
|
|
|
@@ -332,6 +338,7 @@ export async function scaffoldApp(name, cwd, opts = {}) {
|
|
|
332
338
|
module: 'NodeNext',
|
|
333
339
|
moduleResolution: 'NodeNext',
|
|
334
340
|
lib: ['ES2022', 'DOM', 'DOM.Iterable'],
|
|
341
|
+
types: ['node'],
|
|
335
342
|
strict: true,
|
|
336
343
|
noEmit: true,
|
|
337
344
|
allowImportingTsExtensions: true,
|
|
@@ -347,17 +354,16 @@ export async function scaffoldApp(name, cwd, opts = {}) {
|
|
|
347
354
|
// SYNTAX errors. Use a `const` object + union for enum-shaped
|
|
348
355
|
// values; write fields + constructor assignments explicitly.
|
|
349
356
|
erasableSyntaxOnly: true,
|
|
350
|
-
// @webjsdev/
|
|
351
|
-
//
|
|
352
|
-
//
|
|
353
|
-
// •
|
|
354
|
-
// •
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
// Editor-only. The framework runs without it.
|
|
357
|
+
// @webjsdev/intellisense (standalone, no Lit dependency) gives the editor,
|
|
358
|
+
// inside html`` templates:
|
|
359
|
+
// • go-to-definition on custom-element tags, attributes, and CSS classes
|
|
360
|
+
// • binding-aware completions (tag names, .prop / ?bool / plain attrs)
|
|
361
|
+
// • diagnostics (value type-checks, unquoted-binding, expressionless .prop)
|
|
362
|
+
// • hover showing the component class / declared member type
|
|
363
|
+
// Editor-only. The framework runs without it. For VS Code / Cursor /
|
|
364
|
+
// Windsurf, the `webjs` extension bundles this automatically.
|
|
359
365
|
plugins: [
|
|
360
|
-
{ name: '@webjsdev/
|
|
366
|
+
{ name: '@webjsdev/intellisense' },
|
|
361
367
|
],
|
|
362
368
|
},
|
|
363
369
|
// `.webjs/routes.d.ts` is the OPT-IN generated route-types overlay (#258):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webjsdev/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "webjs CLI - dev, start, create, db",
|
|
6
6
|
"bin": {
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"bin",
|
|
11
11
|
"lib",
|
|
12
12
|
"templates",
|
|
13
|
-
"README.md"
|
|
14
|
-
"resources"
|
|
13
|
+
"README.md"
|
|
15
14
|
],
|
|
16
15
|
"dependencies": {
|
|
16
|
+
"@webjsdev/mcp": "^0.1.0",
|
|
17
17
|
"@webjsdev/server": "^0.8.0",
|
|
18
18
|
"@webjsdev/ui": "^0.3.1"
|
|
19
19
|
},
|
|
@@ -36,9 +36,5 @@
|
|
|
36
36
|
],
|
|
37
37
|
"engines": {
|
|
38
38
|
"node": ">=24.0.0"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"prepack": "node scripts/copy-mcp-resources.js",
|
|
42
|
-
"postpack": "node scripts/clean-mcp-resources.js"
|
|
43
39
|
}
|
|
44
40
|
}
|
package/templates/.claude.json
CHANGED
package/templates/AGENTS.md
CHANGED
|
@@ -89,14 +89,14 @@ node_modules/@webjsdev/
|
|
|
89
89
|
src/actions.js ← .server.ts scanner, RPC, expose()
|
|
90
90
|
src/auth.js, session.js, cache.js, rate-limit.js, csrf.js
|
|
91
91
|
cli/ webjs CLI (dev / start / build / test / check / create / db)
|
|
92
|
-
|
|
92
|
+
intellisense/ tsserver plugin: go-to-definition + diagnostic suppression
|
|
93
93
|
+ attribute auto-complete for Class.register('tag') elements
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Reaching straight for the source is the fastest way to resolve "why
|
|
97
97
|
doesn't X work?" with no documentation guesswork and no stale blog posts.
|
|
98
98
|
|
|
99
|
-
## Editor TS plugin: `@webjsdev/
|
|
99
|
+
## Editor TS plugin: `@webjsdev/intellisense`
|
|
100
100
|
|
|
101
101
|
This scaffold's `tsconfig.json` lists a single tsserver plugin. It is
|
|
102
102
|
editor-only, not required for the framework to run.
|
|
@@ -104,22 +104,24 @@ editor-only, not required for the framework to run.
|
|
|
104
104
|
```jsonc
|
|
105
105
|
// tsconfig.json (already wired by the scaffold)
|
|
106
106
|
"plugins": [
|
|
107
|
-
{ "name": "@webjsdev/
|
|
107
|
+
{ "name": "@webjsdev/intellisense" }
|
|
108
108
|
]
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
`@webjsdev/
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
`@webjsdev/intellisense` is **standalone** (no Lit dependency): one plugin
|
|
112
|
+
entry, its own template parser. Inside `` html`…` `` templates you get:
|
|
113
|
+
|
|
114
|
+
- Go-to-definition on custom-element tags, attribute / property / event
|
|
115
|
+
names, and CSS classes in `class="…"`.
|
|
116
|
+
- Binding-aware completions: reachable tag names after `<`, and
|
|
117
|
+
prefix-keyed attributes (`.prop` property names, `?bool` / plain
|
|
118
|
+
hyphenated attribute names).
|
|
119
|
+
- Diagnostics: value type-checks against `declare propName: T`, unquoted
|
|
120
|
+
`@`/`.`/`?` bindings, and expressionless `.prop` bindings.
|
|
121
|
+
- Hover showing the component class / declared member type.
|
|
122
|
+
|
|
123
|
+
In VS Code / Cursor / Windsurf, the **`webjs` extension** bundles this
|
|
124
|
+
automatically (no `tsconfig.json` edit, no separate Lit extension).
|
|
123
125
|
|
|
124
126
|
See [docs.webjs.com → Editor setup](https://docs.webjs.com/docs/editor-setup)
|
|
125
127
|
for the full walkthrough.
|
package/templates/CONVENTIONS.md
CHANGED
|
@@ -654,11 +654,11 @@ attribute coercion, reflection). `declare` types the field for
|
|
|
654
654
|
TypeScript without emitting a class-field initializer that would
|
|
655
655
|
clobber the reactive accessor at construction time. The two
|
|
656
656
|
declarations together give you full intelligence in any tsserver-backed
|
|
657
|
-
editor. See the Editor Setup docs for the `
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
657
|
+
editor. See the Editor Setup docs for the standalone `@webjsdev/intellisense`
|
|
658
|
+
(no Lit dependency) that extends this to tag / attribute intelligence
|
|
659
|
+
inside `html\`…\`` templates (go-to-definition, binding-aware completions,
|
|
660
|
+
value/binding diagnostics, hover); in VS Code / Cursor / Windsurf the
|
|
661
|
+
`webjs` extension bundles it automatically.
|
|
662
662
|
|
|
663
663
|
**Rules:**
|
|
664
664
|
- One component per file
|
package/lib/check-json.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared JSON projector for `webjs check` violations (#262).
|
|
3
|
-
*
|
|
4
|
-
* `webjs check --json` and the `webjs mcp` server's `check` tool BOTH return
|
|
5
|
-
* the identical shape, so the projection lives here once. The input is the raw
|
|
6
|
-
* `Violation[]` from `checkConventions(appDir)` (each `{ rule, file, message,
|
|
7
|
-
* fix }`); the output adds a `summary` count plus a per-rule breakdown so an
|
|
8
|
-
* agent consuming the structured output never has to regex-scrape stdout.
|
|
9
|
-
*
|
|
10
|
-
* Pure and side-effect-free: it neither reads files nor prints. The caller owns
|
|
11
|
-
* running `checkConventions` and (for the CLI) the non-zero exit when there are
|
|
12
|
-
* violations.
|
|
13
|
-
*
|
|
14
|
-
* @module check-json
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {{ rule: string, file: string, message: string, fix: string }} Violation
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {{
|
|
23
|
-
* violations: Violation[],
|
|
24
|
-
* summary: { count: number, byRule: Record<string, number> },
|
|
25
|
-
* }} CheckReport
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Project a raw `Violation[]` into the structured `{ violations, summary }`
|
|
30
|
-
* report shared by `check --json` and the MCP `check` tool. `violations` is
|
|
31
|
-
* passed through verbatim (the `{ rule, file, message, fix }` shape), and
|
|
32
|
-
* `summary.byRule` tallies how many violations each rule produced.
|
|
33
|
-
*
|
|
34
|
-
* @param {Violation[]} violations
|
|
35
|
-
* @returns {CheckReport}
|
|
36
|
-
*/
|
|
37
|
-
export function projectCheck(violations) {
|
|
38
|
-
/** @type {Record<string, number>} */
|
|
39
|
-
const byRule = {};
|
|
40
|
-
for (const v of violations) {
|
|
41
|
-
byRule[v.rule] = (byRule[v.rule] || 0) + 1;
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
violations,
|
|
45
|
-
summary: { count: violations.length, byRule },
|
|
46
|
-
};
|
|
47
|
-
}
|