@webjskit/cli 0.1.1 → 0.1.3

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 CHANGED
@@ -7,20 +7,25 @@ Installing this package gives you the `webjs` command.
7
7
 
8
8
  ## Install
9
9
 
10
- Most users won't install globally. Scaffold a new app instead:
10
+ Install once, globally:
11
11
 
12
12
  ```sh
13
- npx @webjskit/cli create my-app
14
- cd my-app
15
- npm install
16
- npm run dev
13
+ npm i -g @webjskit/cli
17
14
  ```
18
15
 
19
- Or globally:
16
+ Then scaffold a new app anywhere:
20
17
 
21
18
  ```sh
22
- npm install -g @webjskit/cli
23
19
  webjs create my-app
20
+ cd my-app && npm install && npm run dev
21
+ # → http://localhost:3000
22
+ ```
23
+
24
+ One-shot without global install:
25
+
26
+ ```sh
27
+ npx @webjskit/cli create my-app
28
+ cd my-app && npm install && npm run dev
24
29
  ```
25
30
 
26
31
  ## Commands
package/lib/create.js CHANGED
@@ -433,8 +433,8 @@ export default function Home() {
433
433
  \${displayH1(html\`Hello from <span class="text-accent italic">${name}</span>.\`)}
434
434
  <p class="text-lede leading-[1.5] text-fg-muted max-w-[56ch] m-0">
435
435
  Edit <code class="font-mono text-[0.9em]">app/page.ts</code> to get started.
436
- Run \${accentLink('#', 'npx webjs test')} to run tests and
437
- \${accentLink('#', 'npx webjs check')} to validate conventions.
436
+ Run \${accentLink('#', 'webjs test')} to run tests and
437
+ \${accentLink('#', 'webjs check')} to validate conventions.
438
438
  </p>
439
439
  </section>
440
440
 
@@ -498,18 +498,26 @@ export class ThemeToggle extends WebComponent {
498
498
  }
499
499
 
500
500
  render() {
501
+ const t = this.state.theme;
502
+ const label = t === 'system' ? 'AUTO' : t === 'light' ? 'LIGHT' : 'DARK';
503
+ const icon = t === 'light' ? ICONS.sun : t === 'dark' ? ICONS.moon : ICONS.system;
501
504
  return html\`
502
505
  <button
503
- class="inline-flex items-center px-3 py-1.5 rounded-full border border-border bg-bg-elev text-fg-muted font-mono text-[11px] leading-none tracking-wider uppercase duration-fast hover:text-fg hover:border-border-strong"
506
+ class="inline-flex items-center justify-center w-9 h-9 p-0 border border-border rounded-full bg-bg-elev text-fg-muted cursor-pointer transition-all duration-150 hover:text-fg hover:border-border-strong active:scale-[0.94] focus-visible:outline-none focus-visible:border-accent focus-visible:ring-[3px] focus-visible:ring-accent-tint"
504
507
  @click=\${() => this.cycle()}
505
- >
506
- \${this.state.theme === 'system' ? 'Auto'
507
- : this.state.theme === 'light' ? 'Light' : 'Dark'}
508
- </button>
508
+ aria-label="Cycle theme (currently \${label})"
509
+ title="Theme: \${label.toLowerCase()}"
510
+ >\${icon}</button>
509
511
  \`;
510
512
  }
511
513
  }
512
514
 
515
+ const ICONS = {
516
+ sun: html\`<svg class="w-4 h-4 stroke-current fill-none" style="stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 3v2M12 19v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M3 12h2M19 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/></svg>\`,
517
+ moon: html\`<svg class="w-4 h-4 stroke-current fill-none" style="stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round" viewBox="0 0 24 24"><path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z"/></svg>\`,
518
+ system: html\`<svg class="w-4 h-4 stroke-current fill-none" style="stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round" viewBox="0 0 24 24"><path d="M3 5h18v11H3zM8 20h8M12 16v4"/></svg>\`,
519
+ };
520
+
513
521
  ThemeToggle.register('theme-toggle');
514
522
  `);
515
523
  } // end if (!isApi)
@@ -564,7 +572,7 @@ ThemeToggle.register('theme-toggle');
564
572
  console.log(`Next steps:
565
573
  cd ${name}
566
574
  npm install${isSaas ? '\n npx prisma migrate dev --name init' : ''}
567
- npx webjs dev
575
+ webjs dev
568
576
 
569
577
  AI-driven development (enforced for all AI agents):
570
578
  ✓ Tests auto-generated with every feature
@@ -572,6 +580,6 @@ AI-driven development (enforced for all AI agents):
572
580
  ✓ Git merges/pushes to main require approval
573
581
  ✓ Commits are automatic, small, and meaningful
574
582
  ✓ No AI attribution in commit messages
575
- ✓ Convention validation via \`npx webjs check\`
583
+ ✓ Convention validation via \`webjs check\`
576
584
  `);
577
585
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjskit/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "webjs CLI — dev, start, create, db",
6
6
  "bin": {
@@ -28,13 +28,13 @@ Quality bar stays the same — just no blocking on questions.
28
28
  ## Mandatory workflow (never skip)
29
29
 
30
30
  1. TESTS: Server tests in test/unit/ (node:test), browser tests in
31
- test/browser/ (WTR + Playwright, real Chromium). Run `npx webjs test`
31
+ test/browser/ (WTR + Playwright, real Chromium). Run `webjs test`
32
32
  after every change. Never deliver code without passing tests.
33
33
 
34
34
  2. DOCS: Update AGENTS.md for API changes. Update docs/ and website/ if
35
35
  they exist. The user should never have to ask for tests or docs.
36
36
 
37
- 3. CONVENTIONS: Run `npx webjs check` and fix violations before committing.
37
+ 3. CONVENTIONS: Run `webjs check` and fix violations before committing.
38
38
 
39
39
  ## Git rules
40
40
 
@@ -27,7 +27,7 @@ Every code change must include:
27
27
  2. Server tests in test/unit/*.test.ts (node:test for actions, queries, utilities)
28
28
  3. Browser tests in test/browser/*.test.js (WTR + Playwright, real Chromium)
29
29
  4. Documentation updates (AGENTS.md for API, docs/ for user guides)
30
- 5. Convention validation: `npx webjs check` must pass
30
+ 5. Convention validation: `webjs check` must pass
31
31
 
32
32
  ## Git rules
33
33
 
@@ -38,7 +38,7 @@ Every code change must include:
38
38
  - NEVER merge any branch without explicit user permission. Always ask:
39
39
  "Ready to merge <branch> into <target>? Delete or keep <branch> after?"
40
40
  Wait for approval AND the delete/keep preference. Applies to ALL merges.
41
- - Run `npx webjs test` before every commit
41
+ - Run `webjs test` before every commit
42
42
 
43
43
  ## Code patterns
44
44
 
@@ -4,9 +4,9 @@
4
4
 
5
5
  ## Test plan
6
6
 
7
- - [ ] Unit tests added/updated (`npx webjs test` passes)
8
- - [ ] E2E tests added/updated for user-facing changes (`npx webjs test --e2e` passes)
9
- - [ ] `npx webjs check` passes (no convention violations)
7
+ - [ ] Unit tests added/updated (`webjs test` passes)
8
+ - [ ] E2E tests added/updated for user-facing changes (`webjs test --e2e` passes)
9
+ - [ ] `webjs check` passes (no convention violations)
10
10
 
11
11
  ## Documentation
12
12
 
@@ -26,7 +26,7 @@ Every code change must include:
26
26
  1. Server tests in test/unit/*.test.ts (node:test)
27
27
  2. Browser tests in test/browser/*.test.js (WTR + Playwright, real Chromium)
28
28
  3. Documentation updates (AGENTS.md, docs/, website/ if they exist)
29
- 4. Convention check: `npx webjs check` must pass
29
+ 4. Convention check: `webjs check` must pass
30
30
 
31
31
  The user should never have to ask for tests or documentation.
32
32
 
@@ -41,7 +41,7 @@ The user should never have to ask for tests or documentation.
41
41
  - NEVER merge any branch without explicit user permission. Always ask:
42
42
  "Ready to merge <branch> into <target>? Delete or keep <branch> after?"
43
43
  Wait for approval AND the delete/keep preference. Applies to ALL merges.
44
- - Run `npx webjs test` before every commit
44
+ - Run `webjs test` before every commit
45
45
 
46
46
  ## Framework specifics
47
47
 
@@ -186,7 +186,7 @@ absolute URLs from `ctx.url`).
186
186
 
187
187
  1. Branch before editing — never push to `main` directly.
188
188
  2. Every code change comes with: unit test(s), AGENTS.md / docs updates if
189
- the feature surface changed, `npx webjs check` passing.
189
+ the feature surface changed, `webjs check` passing.
190
190
  3. Commit and push after each logical unit. No AI attribution trailers.
191
191
  4. When unsure how a framework feature works, `grep` or `cat` the
192
192
  relevant `node_modules/@webjskit/*/src/` file before asking the user.
@@ -32,8 +32,8 @@ This is automatic — the user should never have to ask.
32
32
  - **Bug fix** → add regression test proving the fix
33
33
  - **Refactor** → run existing tests, ensure they pass
34
34
 
35
- After writing code, ALWAYS run `npx webjs test`. If E2E-relevant,
36
- also run `npx webjs test --browser`. Never report a task as done with
35
+ After writing code, ALWAYS run `webjs test`. If E2E-relevant,
36
+ also run `webjs test --browser`. Never report a task as done with
37
37
  failing tests.
38
38
 
39
39
  ### 3. Documentation (mandatory, never skip)
@@ -52,18 +52,18 @@ If this project has a **website/** directory, also:
52
52
 
53
53
  ### 4. Convention validation
54
54
 
55
- After making changes, run `npx webjs check` and fix any violations before
55
+ After making changes, run `webjs check` and fix any violations before
56
56
  reporting the task as done.
57
57
 
58
58
  ## Quick reference
59
59
 
60
60
  ```sh
61
- npx webjs dev # dev server with live reload
62
- npx webjs test # run unit tests
63
- npx webjs test --browser # run unit + E2E tests
64
- npx webjs check # validate conventions
65
- npx webjs build # (optional) production bundle
66
- npx webjs start # production server
61
+ webjs dev # dev server with live reload
62
+ webjs test # run unit tests
63
+ webjs test --browser # run unit + E2E tests
64
+ webjs check # validate conventions
65
+ webjs build # (optional) production bundle
66
+ webjs start # production server
67
67
  ```
68
68
 
69
69
  All API details, recipes, and feature documentation → see **[AGENTS.md](./AGENTS.md)**.
@@ -33,7 +33,7 @@ even if the user doesn't explicitly ask.**
33
33
 
34
34
  2. **Tests** — Unit test for logic, E2E test for user-facing behavior.
35
35
  See the "Testing" section below for what type of test each change needs.
36
- Run `npx webjs test` after every change. Never mark work as done with
36
+ Run `webjs test` after every change. Never mark work as done with
37
37
  failing tests.
38
38
 
39
39
  3. **Documentation updates** — When adding or modifying features:
@@ -43,7 +43,7 @@ even if the user doesn't explicitly ask.**
43
43
  - If a `website/` directory exists, update the landing page for
44
44
  user-facing features.
45
45
 
46
- 3. **Convention check** — Run `npx webjs check` after changes and fix
46
+ 3. **Convention check** — Run `webjs check` after changes and fix
47
47
  any violations before reporting the task as done.
48
48
 
49
49
  ### Autonomous mode (sandbox / bypass permissions)
@@ -529,8 +529,8 @@ This project enforces a git workflow via agent-specific config files
529
529
  `.github/copilot-instructions.md`.
530
530
 
531
531
  **Pre-commit checks:**
532
- - `npx webjs test` must pass
533
- - `npx webjs check` must pass
532
+ - `webjs test` must pass
533
+ - `webjs check` must pass
534
534
  - No unrelated files in the commit
535
535
 
536
536
  ---
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Example browser test — runs in real Chromium via WTR + Playwright.
3
3
  *
4
- * Run: npx webjs test --browser
4
+ * Run: webjs test --browser
5
5
  * npx wtr
6
6
  *
7
7
  * Tests here have full access to real browser APIs: Shadow DOM,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Example E2E test — replace with tests for your user flows.
3
3
  *
4
- * Run: WEBJS_E2E=1 npx webjs test
4
+ * Run: WEBJS_E2E=1 webjs test
5
5
  * Or: WEBJS_E2E=1 node --test test/e2e/*.test.ts
6
6
  *
7
7
  * Requires: puppeteer-core + chromium installed.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Example unit test — replace with tests for your modules.
3
3
  *
4
- * Run: npx webjs test
4
+ * Run: webjs test
5
5
  * Or: node --test test/unit/*.test.ts
6
6
  */
7
7
  import { test } from 'node:test';
@@ -5,9 +5,9 @@
5
5
  * Chromium via Playwright. Server tests (actions, queries) use node:test.
6
6
  *
7
7
  * Run:
8
- * npx webjs test # runs both server + browser tests
9
- * npx webjs test --browser # browser tests only
10
- * npx webjs test --server # server tests only
8
+ * webjs test # runs both server + browser tests
9
+ * webjs test --browser # browser tests only
10
+ * webjs test --server # server tests only
11
11
  */
12
12
  import { playwrightLauncher } from '@web/test-runner-playwright';
13
13