@wu-framework/cli 0.1.0 → 0.2.1

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
@@ -1,24 +1,56 @@
1
- # wu-cli
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/LuisPadre25/wu-framework/main/wu-logo.png" width="80" alt="Wu CLI" />
3
+ </p>
4
+
5
+ <h1 align="center">Wu CLI</h1>
6
+
7
+ <p align="center">
8
+ <strong>One binary. One port. All your micro-apps.</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@wu-framework/cli"><img src="https://img.shields.io/npm/v/@wu-framework/cli.svg?color=6366f1&label=npm" alt="npm version" /></a>
13
+ <img src="https://img.shields.io/badge/zig-0.15.2-f7a41d" alt="Zig 0.15.2" />
14
+ <img src="https://img.shields.io/badge/frameworks-13-14b8a6" alt="13 frameworks" />
15
+ <img src="https://img.shields.io/badge/dependencies-0-6366f1" alt="zero deps" />
16
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <a href="https://www.wu-framework.com">Documentation</a> &middot;
21
+ <a href="https://www.wu-framework.com/docs/quick-start">Quick Start</a> &middot;
22
+ <a href="https://github.com/LuisPadre25/wu-framework">Wu Framework</a>
23
+ </p>
2
24
 
3
- **One binary. One port. All your micro-apps.**
25
+ ---
4
26
 
5
- Native Zig dev server and CLI toolkit for wu-framework microfrontend applications. Replaces N Vite dev servers with a single process -- one binary that discovers, compiles, and serves every micro-app through a unified HTTP server.
27
+ Native Zig CLI and dev server for [wu-framework](https://www.wu-framework.com) microfrontend applications. Replaces N Vite dev servers with a single process -- one binary that discovers, compiles, builds, and serves every micro-app through a unified HTTP server.
6
28
 
7
- ---
29
+ ## What's New in v0.2.0
30
+
31
+ - **Production build pipeline** -- `wu build` compiles all micro-apps via Vite in parallel and generates a production shell with theme support
32
+ - **Production server** -- `wu serve` serves the built `dist/` folder with proper static file serving and clean Ctrl+C shutdown
33
+ - **Event-driven mounting** -- production shell uses `wu:app:ready` events instead of `await import()`, eliminating Vite code-splitting deadlocks
34
+ - **Theme system** -- generated shells and app templates use CSS custom properties (`--surface`, `--text`, `--border`, etc.) for dark/light theme propagation
35
+ - **wu-framework.com design tokens** -- shells use the official design system: Indigo `#6366f1`, Teal `#14b8a6`, Zinc palette, Inter font, backdrop blur
36
+ - **13 theme-aware app templates** -- all framework templates (React, Vue, Svelte, Solid, Preact, Lit, Angular, Alpine, Qwik, Stencil, HTMX, Stimulus, Vanilla) respond to shell theme changes
37
+ - **Responsive production shell** -- topbar with backdrop blur, sidebar with framework badges, loading spinners, mobile hamburger menu
38
+ - **Correct Vite entry detection** -- `findEntryFromHtml()` parses Vite's generated `index.html` to find the real entry point instead of picking the first JS file
8
39
 
9
40
  ## Features
10
41
 
11
42
  - Native HTTP dev server with SIMD-accelerated request parsing (16 bytes/cycle)
12
43
  - Three-tier compilation: Native Zig JSX (0-2ms) -> Compiler Daemon (10-50ms) -> Node fallback (200-400ms)
13
- - Two-level cache: in-memory (256 entries, mutex-protected) + persistent disk (`.wu-cache/`), 73-138x speedup on warm restart
44
+ - Two-level cache: in-memory (256 entries) + persistent disk (`.wu-cache/`), 73-138x speedup on warm restart
14
45
  - NPM module resolution in pure Zig (package.json `exports`, `module`, `main` fields with conditions)
15
46
  - TypeScript stripping and bare-specifier import rewriting (`react` -> `/@modules/react`)
16
47
  - CSS-as-module imports (`import './style.css'` injects into DOM at runtime)
17
48
  - WebSocket (RFC 6455) + SSE-based HMR with 300ms file-watcher polling
18
49
  - HTTP keep-alive for connection reuse across requests
19
- - Interactive project scaffolding (`wu create`)
50
+ - Interactive project scaffolding (`wu create`) with 13 framework choices
20
51
  - Auto-discovery of micro-apps from directory structure (no config required)
21
- - Framework support: React, Preact, Vue, Svelte, Solid, Lit, Angular, Vanilla JS
52
+ - Production build with parallel Vite compilation and optimized shell generation
53
+ - Production server with static file serving
22
54
 
23
55
  ## Install
24
56
 
@@ -29,14 +61,16 @@ npm install -g @wu-framework/cli
29
61
  Then use it anywhere:
30
62
 
31
63
  ```bash
32
- wu create my-project
64
+ wu create my-project # Interactive scaffolding
33
65
  cd my-project
34
- wu dev
66
+ wu dev # Start dev server on one port
67
+ wu build # Build for production
68
+ wu serve # Serve production build
35
69
  ```
36
70
 
37
71
  ### Build from source
38
72
 
39
- If you prefer to build from source (requires [Zig 0.15.2+](https://ziglang.org/download/)):
73
+ Requires [Zig 0.15.2+](https://ziglang.org/download/):
40
74
 
41
75
  ```bash
42
76
  git clone https://github.com/LuisPadre25/wu-cli.git
@@ -50,22 +84,89 @@ zig build
50
84
  | Command | Description |
51
85
  |---------|-------------|
52
86
  | `wu dev` | Start native dev server (default) or Vite processes (`--vite`) |
53
- | `wu build` | Build all micro-apps in parallel |
54
- | `wu create` | Interactive project scaffolding (name, frameworks, install) |
87
+ | `wu build` | Build all micro-apps via Vite in parallel, generate production shell |
88
+ | `wu serve` | Serve the production `dist/` folder |
89
+ | `wu create` | Interactive project scaffolding (name, frameworks, npm install) |
55
90
  | `wu add <framework> <name>` | Add a new micro-app to an existing project |
56
91
  | `wu info` | Show project configuration and status |
57
- | `wu serve` | Production server (coming soon) |
92
+
93
+ ### `wu create`
94
+
95
+ Interactive guided scaffolding:
96
+
97
+ ```
98
+ $ wu create my-store
99
+
100
+ Wu CLI v0.2.0
101
+ Creating a new Wu project...
102
+
103
+ Project name: my-store
104
+
105
+ Add micro-apps:
106
+ App name: products
107
+ Framework: vue
108
+ App name: orders
109
+ Framework: react
110
+ (empty to finish)
111
+
112
+ Generated:
113
+ shell/ HTML shell with sidebar navigation
114
+ mf-products/ Vue 3 micro-app
115
+ mf-orders/ React micro-app
116
+ wu.config.json Project configuration
117
+
118
+ Installing dependencies...
119
+ Done!
120
+ ```
121
+
122
+ ### `wu build`
123
+
124
+ Builds each micro-app with Vite in parallel and generates a production-ready shell:
125
+
126
+ ```
127
+ $ wu build
128
+
129
+ Wu CLI v0.2.0
130
+ Building 4 micro-apps for production...
131
+
132
+ + shell (static)
133
+ + dashboard 3.1s
134
+ + orders 2.8s
135
+ + products 3.4s
136
+ + settings 4.2s
137
+
138
+ + wu-manifest.json (4 apps)
139
+ + dist/index.html (production shell)
140
+
141
+ + Build complete: 4 app(s) -> dist/ (5.8s)
142
+ ```
143
+
144
+ ### `wu serve`
145
+
146
+ Serves the built `dist/` folder:
147
+
148
+ ```
149
+ $ wu serve
150
+
151
+ Wu CLI v0.2.0
152
+ Serving production build from dist/
153
+
154
+ Local: http://localhost:3000/
155
+ Press Ctrl+C to stop
156
+ ```
58
157
 
59
158
  ## Configuration
60
159
 
61
- wu-cli reads a `wu.config.json` file at the project root. Example:
160
+ wu-cli reads a `wu.config.json` file at the project root:
62
161
 
63
162
  ```json
64
163
  {
164
+ "name": "my-store",
165
+ "version": "0.2.0",
65
166
  "shell": {
66
167
  "dir": "shell",
67
168
  "port": 4321,
68
- "framework": "astro"
169
+ "framework": "html"
69
170
  },
70
171
  "apps": [
71
172
  {
@@ -80,35 +181,42 @@ wu-cli reads a `wu.config.json` file at the project root. Example:
80
181
  "framework": "react",
81
182
  "port": 5005
82
183
  }
83
- ]
184
+ ],
185
+ "proxy": {
186
+ "port": 3000,
187
+ "open_browser": true
188
+ }
84
189
  }
85
190
  ```
86
191
 
87
- Alternatively, wu-cli auto-discovers micro-apps by scanning subdirectories for the presence of both `vite.config.js` and `package.json`. No configuration file is required for basic usage.
192
+ Alternatively, wu-cli auto-discovers micro-apps by scanning subdirectories for `vite.config.js` + `package.json`. No configuration file is required for basic usage.
88
193
 
89
194
  ## Architecture
90
195
 
91
196
  ```
92
- src/
93
- commands/ CLI command handlers (dev, build, create, add, info, serve)
94
- runtime/ Dev server core
95
- config/ Configuration loading and validation
197
+ wu-cli/
198
+ src/
199
+ commands/ CLI command handlers
200
+ dev.zig Native dev server orchestration
201
+ build.zig Production build pipeline (Vite + shell generation)
202
+ serve.zig Production static file server
203
+ create.zig Interactive project scaffolding
204
+ add.zig Add micro-app to existing project
205
+ info.zig Project status display
206
+ templates/ 13 framework app component templates
207
+ runtime/ Dev server core
208
+ dev_server.zig Thread-per-connection HTTP server with keep-alive
209
+ http_parser.zig SIMD HTTP/1.1 parser (16 bytes/cycle)
210
+ resolve.zig NPM module resolution (exports, module, main)
211
+ transform.zig TS stripping + bare-specifier rewriting
212
+ jsx_transform.zig Native JSX -> createElement (React/Preact)
213
+ compile.zig Three-tier compilation with persistent daemon
214
+ cache.zig Two-level mtime cache (memory + disk)
215
+ ws_protocol.zig WebSocket RFC 6455 (frame parsing, masking)
216
+ mime.zig MIME type detection
217
+ config/ Configuration loading and validation
96
218
  ```
97
219
 
98
- ### Runtime modules
99
-
100
- | Module | Purpose |
101
- |--------|---------|
102
- | **dev_server.zig** | Thread-per-connection HTTP server with keep-alive and static file serving |
103
- | **http_parser.zig** | SIMD HTTP/1.1 request parser (16 bytes/cycle vectorized header scanning) |
104
- | **resolve.zig** | NPM module resolution in pure Zig (zero Node.js dependency) |
105
- | **transform.zig** | TypeScript erasure + bare-specifier import rewriting (line-preserving) |
106
- | **jsx_transform.zig** | Native JSX to createElement transformation (React/Preact, ~0-2ms) |
107
- | **compile.zig** | Three-tier framework compilation with persistent daemon process |
108
- | **cache.zig** | Two-level mtime-based cache (in-memory 256 entries + disk `.wu-cache/`) |
109
- | **ws_protocol.zig** | WebSocket RFC 6455 implementation (frame parsing, masking, handshake) |
110
- | **mime.zig** | MIME type detection by file extension |
111
-
112
220
  ## Compilation Pipeline
113
221
 
114
222
  ```
@@ -116,12 +224,14 @@ src/
116
224
  .jsx/.tsx (Solid) ----> Compiler Daemon ----> JS (~10-50ms)
117
225
  .svelte ----> Compiler Daemon ----> JS (~10-50ms)
118
226
  .vue ----> Compiler Daemon ----> JS (~10-50ms)
227
+ .ts (Angular) ----> esbuild bundle ----> JS (~10-50ms)
119
228
  .ts ----> TS Strip ----> JS (~0-1ms)
229
+ .js (Alpine/HTMX/etc) ----> passthrough ----> JS (~0ms)
120
230
  ```
121
231
 
122
232
  The three tiers are tried in order. Native Zig handles React and Preact JSX with zero external processes. The Compiler Daemon keeps a long-running Node.js process for frameworks that require their own compilers (Svelte, Vue, Solid). If the daemon is unavailable, a one-shot `node -e` fallback is used.
123
233
 
124
- Cache hits bypass all tiers entirely: the mtime of the source file is compared against the cached entry, and the cached output is served directly (~3ms).
234
+ Cache hits bypass all tiers: source mtime is compared against the cached entry, and cached output is served directly (~3ms).
125
235
 
126
236
  ## Supported Frameworks
127
237
 
@@ -132,22 +242,46 @@ Cache hits bypass all tiers entirely: the mtime of the source file is compared a
132
242
  | Vue | .vue | Daemon / Node | -- |
133
243
  | Svelte | .svelte | Daemon / Node | -- |
134
244
  | Solid.js | .jsx, .tsx | Daemon / Node | -- |
245
+ | Angular | .ts | esbuild bundle | -- |
135
246
  | Lit | .ts, .js | TS strip only | -- |
247
+ | Alpine.js | .js | Passthrough | -- |
248
+ | Qwik | .jsx | Passthrough | -- |
249
+ | Stencil | .js | Passthrough | -- |
250
+ | HTMX | .js | Passthrough | -- |
251
+ | Stimulus | .js | Passthrough | -- |
136
252
  | Vanilla | .js, .ts | TS strip only | -- |
137
- | Angular | .ts | TS strip only | -- |
253
+
254
+ ## Theme System
255
+
256
+ Generated shells and app templates support dark/light theme switching via CSS custom properties:
257
+
258
+ | Variable | Dark | Light | Purpose |
259
+ |----------|------|-------|---------|
260
+ | `--bg` | `#09090b` | `#fafafa` | Page background |
261
+ | `--surface` | `#111113` | `#ffffff` | Card/panel background |
262
+ | `--border` | `#27272a` | `#d4d4d8` | Borders |
263
+ | `--text` | `#fafafa` | `#09090b` | Primary text |
264
+ | `--text2` | `#a1a1aa` | `#52525b` | Secondary text |
265
+ | `--text-muted` | `#3f3f46` | `#a1a1aa` | Muted/label text |
266
+ | `--accent` | `#6366f1` | `#6366f1` | Brand accent (Indigo) |
267
+ | `--teal` | `#14b8a6` | `#14b8a6` | Status/success accent |
268
+
269
+ All 13 app templates use `var(--surface, #111)` etc. with fallback defaults, so they work both inside a themed shell and standalone.
138
270
 
139
271
  ## Requirements
140
272
 
141
- - **Node.js 16+** -- for installing via npm (`npm install -g @wu-framework/cli`)
273
+ - **Node.js 16+** -- for installing via npm
142
274
  - **Node.js 18+** -- needed at runtime for Svelte, Vue, and Solid compilation (React/Preact use native Zig JSX)
143
275
  - **Zig 0.15.2+** -- only needed if building from source
144
276
 
145
277
  ## Project Stats
146
278
 
147
- - 22 Zig source files, ~2800 lines of runtime code
148
- - ~250-460KB release binary per platform (Windows, Linux, macOS x64/arm64), zero external Zig dependencies
149
- - Single-process architecture replaces 8+ simultaneous Vite dev servers
150
- - Part of the wu-framework microfrontend platform
279
+ - 22 Zig source files, ~3000 lines of runtime code
280
+ - 13 framework app component templates (embedded at compile time)
281
+ - ~250-460KB release binary per platform (Windows, Linux, macOS x64/arm64)
282
+ - Zero external Zig dependencies
283
+ - Single-process architecture replaces 12+ simultaneous Vite dev servers
284
+ - Part of the [wu-framework](https://www.wu-framework.com) microfrontend platform
151
285
 
152
286
  ## License
153
287
 
@@ -155,8 +289,8 @@ MIT
155
289
 
156
290
  ## Author
157
291
 
158
- Luis Garcia -- Creator of wu-framework
292
+ Luis Garcia -- Creator of [wu-framework](https://www.wu-framework.com)
159
293
 
160
294
  ---
161
295
 
162
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and guidelines.
296
+ *2026 Wu Framework*
Binary file
package/bin/wu-darwin-x64 CHANGED
Binary file
package/bin/wu-linux-x64 CHANGED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wu-framework/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Lightning-fast micro-frontend CLI — scaffold, develop, and build multi-framework apps",
5
5
  "license": "MIT",
6
6
  "bin": {