@wu-framework/cli 0.2.5 → 0.3.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/CHANGELOG.md +105 -0
- package/README.md +142 -208
- package/bin/wu-darwin-arm64 +0 -0
- package/bin/wu-darwin-x64 +0 -0
- package/bin/wu-linux-x64 +0 -0
- package/bin/wu-win32-x64.exe +0 -0
- package/package.json +17 -4
- package/bin/wu.exe +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Todos los cambios notables de wu-cli. Formato basado en [Keep a Changelog](https://keepachangelog.com/) y [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [0.3.0] — 2026-05-18
|
|
6
|
+
|
|
7
|
+
Sesión grande de hardening, refactor de UX y documentación. Sin cambios breaking para usuarios que ya tienen `wu.config.json` válido — pero **una excepción**: el campo `cors` del proxy ahora default `false` (antes hardcoded `true`).
|
|
8
|
+
|
|
9
|
+
### Seguridad
|
|
10
|
+
|
|
11
|
+
- **Sentinel ahora usa la IP real del cliente** (`stream.socket.address`). Antes estaba hardcoded a `0x7F000001` (127.0.0.1) — la tabla per-IP era inútil, rate-limit afectaba a todos los usuarios por igual.
|
|
12
|
+
- **XSS en challenge HTML cerrado**. El path del request se interpolaba sin escape en `location.replace('{s}')`. Ahora hay allowlist `[A-Za-z0-9._\-/?=&%+~]`; cualquier otro carácter fallback a `/`.
|
|
13
|
+
- **Path traversal hardened**. El check `indexOf("..")` original miss-eaba `%2e%2e`, `\\`, NUL bytes y absolute paths. Reemplazado por `isPathSafe()` que se aplica post-URL-decode con tests cubriendo 11 vectores conocidos.
|
|
14
|
+
- **Sentinel ya no marca su propio endpoint como sospechoso**. Quitados de `isSuspiciousPath`: `/.well-known/*` (donde vive `/acp.json`), `/robots.txt`, `/sitemap.xml`, `/api/v1/`, `/graphql`. Antes Googlebot pidiendo `/robots.txt` recibía verdict `.throttle`.
|
|
15
|
+
- **Anti-slowloris**: `setSocketTimeouts(stream, 30s)` aplicado a cada conexión aceptada (`READ_TIMEOUT_MS = 30_000`). Cross-platform: `ws2_32.setsockopt` en Windows, `std.posix.setsockopt` en POSIX.
|
|
16
|
+
- **Body-size cap**: `MAX_REQUEST_BYTES = 16 MB`. Check temprano en `handleRequest` antes de leer el body. POST con `Content-Length` mayor → `413 Payload Too Large` + close.
|
|
17
|
+
- **SSE/WebSocket peer-close detection**. `platformReadNonBlocking` ahora devuelve enum `PollResult { bytes, no_data, eof }`. Antes colapsaba EOF + no-data en `0`, dejando threads zombies hasta el siguiente ping (~30s). Los handlers de HMR (SSE) y WS detectan `.eof` y salen inmediatamente.
|
|
18
|
+
- **CORS opt-in en proxy** (**breaking**): el campo `cors: bool` se agrega a `ProxyRule` con default `false`. Antes el proxy inyectaba `Access-Control-Allow-Origin: *` en TODAS las respuestas. Migración: agregá `"cors": true` explícito a las reglas que lo necesiten.
|
|
19
|
+
- **`looksLikeBrowser` reforzado**: ahora exige `Mozilla/5.0` + engine (`AppleWebKit`/`Gecko`/`Trident`) + product token (`Chrome/`, `Firefox/`, `Safari/`, `Edg/`, `OPR/`, `Brave/`, `Vivaldi/`, `SamsungBrowser/`). Antes "Mozilla/5.0" solo era suficiente — cualquier scraper moderno pasaba.
|
|
20
|
+
|
|
21
|
+
### Agregado
|
|
22
|
+
|
|
23
|
+
- **Wizard interactivo con TUI** (`wu create`). Raw mode cross-platform, navegación con ↑↓/jk, Esc/Ctrl+C para cancelar con cleanup del terminal. Sin defaults escondidos en la elección del shell. Confirm explícito antes de `npm install`.
|
|
24
|
+
- **Nuevo módulo `src/cli/tui.zig`** — primitivas: `enterRawMode`, `forceRestore`, `readKey`, ANSI helpers (cursor up, clear line, hide/show cursor).
|
|
25
|
+
- **Nuevo módulo `src/cli/prompts.zig`** — `Menu`, `Text`, `Confirm`. Re-render in-place sin flicker.
|
|
26
|
+
- **`build.zig.zon`** — manifest oficial de paquete Zig (name `.wu_cli`, fingerprint generado por toolchain, `minimum_zig_version = "0.16.0"`).
|
|
27
|
+
- **Cap de disco para `.wu-cache/`** — `MAX_DISK_BYTES = 500 MB`, sweep cada 64 puts. Borra archivos más viejos por mtime hasta dejar 80 % del cap.
|
|
28
|
+
- **LRU en cache de memoria** — antes era round-robin (evictaba hot entries por suerte). Ahora cada entry tiene `last_access: u64` y eviction busca el mínimo. Test cubre que la entry recién-tocada NO se desaloja.
|
|
29
|
+
- **5 logs estructurados en el hot path** (en lugar de `catch {}` silenciosos): parser fail después de Bad Request, static file serve fail, hot-reload bookkeeping OOM, 404 después de fallar shell index (con sugerencia accionable), WS close frame fail.
|
|
30
|
+
- **Convención de discovery**: el directorio llamado **exactamente `shell`** es el shell del proyecto. Todos los frameworks tratados por igual.
|
|
31
|
+
- **Salt en cache key** (`hashPath(path, salt)`). Para .jsx/.tsx, salt = framework — switching `react` ↔ `preact` ya no sirve output stale.
|
|
32
|
+
- **Header `cors` en `wu.config.json`** — opt-in por regla de proxy.
|
|
33
|
+
- **Tests nuevos**: `isPathSafe` (11 vectores), `findCrlfSimd` chunk boundaries (5 casos), LRU eviction, `MAX_REQUEST_BYTES` sanity, `PollResult` exhaustiveness, escape sequences en `parseConfigJson`, browser fingerprint.
|
|
34
|
+
- **Tres documentos nuevos** en `docs/`: `cli.md`, `configuration.md`, `security.md`, `contributing.md` (movido de root).
|
|
35
|
+
- **`CHANGELOG.md`** — este archivo.
|
|
36
|
+
|
|
37
|
+
### Cambiado
|
|
38
|
+
|
|
39
|
+
- **Parser JSON migrado a `std.json`**. El parser hand-rolled no decodificaba escape sequences (`\n`, `\"`) y tenía un desync sutil en `readBool` que pisaba la siguiente key. `WuConfig` ahora owns un `ArenaAllocator`; `cfg.deinit(allocator)` libera todo en un shot.
|
|
40
|
+
- **Hot-reload de config con cap de generaciones**. `_hot_cfgs` y `_hot_app_bufs` antes crecían sin límite. Ahora se capean a 3 generaciones; la más vieja se libera cuando se inserta la 4ª.
|
|
41
|
+
- **Default del shell sin escondites**. `dev_server.zig:49` declaraba `shell_framework = "astro"`. Cambiado a `"vanilla"`. El color del shell en `wu build`/`wu install` ahora usa `frameworkColor(shell.framework)` real, no `fw_astro` hardcoded.
|
|
42
|
+
- **TypeScript ofrecido a 9/12 frameworks** (antes 6/12). Vue, Svelte, Angular, Stencil ya tienen su pregunta `Use TypeScript?`. Sólo HTMX/Alpine/Stimulus quedan JS-only por convención del ecosistema.
|
|
43
|
+
- **`wu create --template <fw>` ahora también respeta el shell**. Antes el quick mode siempre ponía shell vanilla (inconsistente con la elección del usuario). Default del shell ahora = mismo framework que el template; override con `--shell <fw>`.
|
|
44
|
+
- **`dev_server.zig` adelgazado** 10 %: 3655 → 3298 LOC. `handleProxy` extraído a `handlers/proxy.zig` (188 LOC) y `handleHmr`/`handleWsHmr` a `handlers/hmr.zig` (172 LOC). Cuatro helpers promovidos a `pub`: `sendResponse`, `platformRead`, `platformWrite`, `platformReadNonBlocking`.
|
|
45
|
+
- **README reescrito en español** como entry point con links a `docs/`. CONTRIBUTING raíz convertido en stub que apunta a `docs/contributing.md`.
|
|
46
|
+
|
|
47
|
+
### Removido
|
|
48
|
+
|
|
49
|
+
- **TS-strip line-based** (`stripTypeScript` + helpers `isTypeOnlyLine`, `isTypeAlias`, `skipTypeExpression`, tabla `ts_types`). Era código muerto — `.tsx` ya iba al daemon esbuild desde antes. ~325 LOC borradas de `transform.zig` (1074 → 749). Parámetro `is_tsx` eliminado de `compileJsxNative`.
|
|
50
|
+
|
|
51
|
+
### Arreglado
|
|
52
|
+
|
|
53
|
+
- **`shell/package.json` y `shell/index.html` se generaban incompletos**. Bug serio que llevaba meses escondido: `Writer.Allocating.fromArrayListAligned` toma ownership del buffer y deja la `ArrayList` vacía; `writeFile(io, path, buf.items)` escribía array vacío. Además, `index.html` se escribía en 2 `writeFile` al mismo path que se sobreescribían. Fix: `buf = aw.toArrayList()` antes del writeFile, y concat de las dos halves antes del único write.
|
|
54
|
+
- **`discovery.zig` ya no privilegia astro**. Antes: si encuentra `astro.config.mjs`, promueve a shell automáticamente. Ahora: trato igual para todos los frameworks; sólo el directorio `shell/` es el shell.
|
|
55
|
+
- **Verificación SIMD CRLF**: el código era correcto, pero faltaban tests que pin-eraran el invariante de cross-chunk access. Agregados 5 tests que rompen si alguien "optimiza" y quita el check `idx + 1 < data.len`.
|
|
56
|
+
- **Migración a Zig 0.16.0** completa y validada con `zig build`, `zig build test`, `zig build -Doptimize=ReleaseFast`. La verificación de versión la hace ahora el package manager via `build.zig.zon`, no un check runtime en `build.zig`.
|
|
57
|
+
|
|
58
|
+
### Deprecated / Por hacer
|
|
59
|
+
|
|
60
|
+
- **Modo `wu dev --vite`** está deprecated. El modo nativo es el default desde hace versiones y maneja todo. El modo Vite legacy se mantiene por compat pero **no se está manteniendo**.
|
|
61
|
+
- **`stripTypeScript`** ya no existe — `.tsx` debe ir por el daemon esbuild. Si tenés código que lo importaba directamente, falla en compile.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## [0.2.1] — 2026-04-22
|
|
66
|
+
|
|
67
|
+
Versión publicada previa a esta sesión. Reconstruida del README.md anterior.
|
|
68
|
+
|
|
69
|
+
### Agregado
|
|
70
|
+
|
|
71
|
+
- Guided interactive scaffolding (`wu create`) con step-by-step, naming inteligente, summary card
|
|
72
|
+
- Windows UTF-8 fix (Mojibake)
|
|
73
|
+
- React shell con `<WuSlot />` integrado
|
|
74
|
+
- TypeScript por default en plantillas que lo soportan
|
|
75
|
+
- Production build pipeline (`wu build`) — Vite paralelo + shell de producción
|
|
76
|
+
- Production server (`wu serve`) con clean Ctrl+C shutdown
|
|
77
|
+
- Event-driven mounting en shell de producción (`wu:app:ready` events)
|
|
78
|
+
- Theme system con CSS custom properties (`--surface`, `--text`, `--border`, `--accent`)
|
|
79
|
+
- Design tokens de wu-framework.com (Indigo `#6366f1`, Teal `#14b8a6`, Zinc palette, Inter)
|
|
80
|
+
- 13 plantillas theme-aware (React, Vue, Svelte, Solid, Preact, Lit, Angular, Alpine, Qwik, Stencil, HTMX, Stimulus, Vanilla)
|
|
81
|
+
- Responsive production shell — topbar blur, sidebar con badges, spinners, hamburger móvil
|
|
82
|
+
- `findEntryFromHtml()` correcto en build pipeline
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## [0.2.0] — 2026-03-18
|
|
87
|
+
|
|
88
|
+
Primera versión empaquetada en npm.
|
|
89
|
+
|
|
90
|
+
### Agregado
|
|
91
|
+
|
|
92
|
+
- Servidor HTTP nativo en Zig con SIMD parsing
|
|
93
|
+
- Compilación 3-tier (Native Zig JSX → daemon → fallback)
|
|
94
|
+
- Cache de 2 niveles
|
|
95
|
+
- NPM module resolution en Zig puro
|
|
96
|
+
- WebSocket + SSE HMR
|
|
97
|
+
- Auto-discovery de micro-apps
|
|
98
|
+
- HTTP keep-alive
|
|
99
|
+
- Soporte inicial para 13 frameworks
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
[0.3.0]: https://github.com/LuisPadre25/wu-cli/compare/v0.2.1...v0.3.0
|
|
104
|
+
[0.2.1]: https://github.com/LuisPadre25/wu-cli/compare/v0.2.0...v0.2.1
|
|
105
|
+
[0.2.0]: https://github.com/LuisPadre25/wu-cli/releases/tag/v0.2.0
|
package/README.md
CHANGED
|
@@ -5,292 +5,226 @@
|
|
|
5
5
|
<h1 align="center">Wu CLI</h1>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<strong>
|
|
8
|
+
<strong>Un binario. Un puerto. Todas tus micro-apps.</strong>
|
|
9
9
|
</p>
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
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.
|
|
13
|
+
<img src="https://img.shields.io/badge/zig-0.16.0-f7a41d" alt="Zig 0.16.0" />
|
|
14
14
|
<img src="https://img.shields.io/badge/frameworks-13-14b8a6" alt="13 frameworks" />
|
|
15
15
|
<img src="https://img.shields.io/badge/dependencies-0-6366f1" alt="zero deps" />
|
|
16
16
|
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
<p align="center">
|
|
20
|
-
<a href="
|
|
21
|
-
<a href="
|
|
22
|
-
<a href="
|
|
20
|
+
<a href="docs/cli.md">Comandos</a> ·
|
|
21
|
+
<a href="docs/configuration.md">Configuración</a> ·
|
|
22
|
+
<a href="docs/deployment.md">Deployment</a> ·
|
|
23
|
+
<a href="docs/security.md">Seguridad</a> ·
|
|
24
|
+
<a href="docs/contributing.md">Contribuir</a> ·
|
|
25
|
+
<a href="CHANGELOG.md">Changelog</a>
|
|
23
26
|
</p>
|
|
24
27
|
|
|
25
28
|
---
|
|
26
29
|
|
|
27
|
-
|
|
30
|
+
## ¿Qué es wu-cli?
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
**Wu CLI** es un CLI + dev-server nativo en **Zig 0.16** para arquitecturas microfrontend ([wu-framework](https://www.wu-framework.com)). Reemplaza **N procesos Vite** (uno por micro-app) con **un único proceso en un solo puerto** que descubre, compila, sirve y hace HMR. Sin dependencias Zig, binario de ~250-460 KB por plataforma, distribuido vía npm.
|
|
30
33
|
|
|
31
|
-
|
|
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
|
|
34
|
+
## Lo nuevo en v0.2.2
|
|
39
35
|
|
|
40
|
-
|
|
36
|
+
> Versión publicada en npm: **0.2.1**. Las features listadas abajo ya están en `main`; bump pendiente en `src/main.zig` + `build.zig.zon`.
|
|
41
37
|
|
|
42
|
-
|
|
43
|
-
- Three-tier compilation: Native Zig JSX (0-2ms) -> Compiler Daemon (10-50ms) -> Node fallback (200-400ms)
|
|
44
|
-
- Two-level cache: in-memory (256 entries) + persistent disk (`.wu-cache/`), 73-138x speedup on warm restart
|
|
45
|
-
- NPM module resolution in pure Zig (package.json `exports`, `module`, `main` fields with conditions)
|
|
46
|
-
- TypeScript stripping and bare-specifier import rewriting (`react` -> `/@modules/react`)
|
|
47
|
-
- CSS-as-module imports (`import './style.css'` injects into DOM at runtime)
|
|
48
|
-
- WebSocket (RFC 6455) + SSE-based HMR with 300ms file-watcher polling
|
|
49
|
-
- HTTP keep-alive for connection reuse across requests
|
|
50
|
-
- Interactive project scaffolding (`wu create`) with 13 framework choices
|
|
51
|
-
- Auto-discovery of micro-apps from directory structure (no config required)
|
|
52
|
-
- Production build with parallel Vite compilation and optimized shell generation
|
|
53
|
-
- Production server with static file serving
|
|
38
|
+
**Build pipeline:**
|
|
54
39
|
|
|
55
|
-
|
|
40
|
+
- **Shell custom respetado** — si tu `shell/` buildea, su `dist/*` se hoist al root de `dist/` y se inyecta `window.__wu_apps` automáticamente. Antes `wu build` sobreescribía tu shell con un vanilla generado.
|
|
41
|
+
- **`apps.json` runtime-swappable** — emitido en `dist/apps.json`. Cambia el archivo por entorno (dev/staging/prod) para repointar las apps sin rebuild del shell.
|
|
42
|
+
- **`wu.json` por app** — `dist/<app>/wu.json` con el entry exacto (`assets/index-HASH.js`). Evita el probing de 8 paths que rompe en static hosting con MIME errors.
|
|
43
|
+
- **`shell.build_cmd` defaulteado** — si está vacío y `framework != "html"`, se usa `npx vite build`. Antes era silent no-op (el shell "buildeaba" sin producir nada).
|
|
44
|
+
- **Vite plugins completos** — Solid, Preact y Qwik ahora generan vite.config con plugin correcto. Antes JSX se compilaba a `React.createElement` y crasheaba en runtime.
|
|
56
45
|
|
|
57
|
-
|
|
58
|
-
npm install -g @wu-framework/cli
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Then use it anywhere:
|
|
46
|
+
**Resto v0.2.2:**
|
|
62
47
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
wu
|
|
67
|
-
wu
|
|
68
|
-
|
|
69
|
-
|
|
48
|
+
- **TUI interactiva** — `wu create` con menús navegables (↑↓ enter), sin defaults escondidos, raw mode cross-platform.
|
|
49
|
+
- **DoS hardening (dev server)** — read/write timeouts (30s), límite de body (16 MB), detección de peer-close en SSE/WebSocket. `wu dev` ya no se cuelga con slowloris. (Nota: `wu serve` aún no hereda esto.)
|
|
50
|
+
- **Sentinel real** — anti-bot con IP del cliente real (antes hardcoded 127.0.0.1), allowlist de paths legítimos (`/robots.txt`, `/.well-known/*`), challenge HTML libre de XSS.
|
|
51
|
+
- **Cache LRU + cap de disco** — eviction inteligente en memoria, `.wu-cache/` capado a 500 MB con sweep periódico.
|
|
52
|
+
- **Configuración robusta** — parser `wu.config.json` migrado a `std.json` (escape sequences correctos, sin desincronizaciones).
|
|
53
|
+
- **CORS opt-in en proxy** — el `Access-Control-Allow-Origin: *` ya no se inyecta por defecto; ahora es por regla (`cors: true`).
|
|
54
|
+
- **Modularización** — `dev_server.zig` adelgazó 10 % extrayendo `handlers/proxy.zig` y `handlers/hmr.zig`.
|
|
55
|
+
- **`build.zig.zon`** — manifest oficial de paquete Zig (consumible como dependencia, valida versión mínima).
|
|
70
56
|
|
|
71
|
-
|
|
57
|
+
[Ver el changelog completo →](CHANGELOG.md)
|
|
72
58
|
|
|
73
|
-
|
|
59
|
+
## Instalación
|
|
74
60
|
|
|
75
61
|
```bash
|
|
76
|
-
|
|
77
|
-
cd wu-cli
|
|
78
|
-
zig build
|
|
79
|
-
./zig-out/bin/wu create my-project
|
|
62
|
+
npm install -g @wu-framework/cli
|
|
80
63
|
```
|
|
81
64
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
| Command | Description |
|
|
85
|
-
|---------|-------------|
|
|
86
|
-
| `wu dev` | Start native dev server (default) or Vite processes (`--vite`) |
|
|
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) |
|
|
90
|
-
| `wu add <framework> <name>` | Add a new micro-app to an existing project |
|
|
91
|
-
| `wu info` | Show project configuration and status |
|
|
65
|
+
Requiere **Node.js 16+** para instalar. Node.js 18+ a runtime sólo si usas Vue, Svelte, Solid o Angular (React/Preact corren en Zig puro).
|
|
92
66
|
|
|
93
|
-
###
|
|
67
|
+
### Desde fuente
|
|
94
68
|
|
|
95
|
-
|
|
69
|
+
Requiere **Zig 0.16.0**:
|
|
96
70
|
|
|
71
|
+
```bash
|
|
72
|
+
git clone https://github.com/LuisPadre25/wu-cli.git
|
|
73
|
+
cd wu-cli
|
|
74
|
+
zig build -Doptimize=ReleaseFast
|
|
75
|
+
./zig-out/bin/wu --help
|
|
97
76
|
```
|
|
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
77
|
|
|
112
|
-
|
|
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
|
|
78
|
+
## Quick Start
|
|
117
79
|
|
|
118
|
-
|
|
119
|
-
|
|
80
|
+
```bash
|
|
81
|
+
wu create my-shop # Wizard interactivo: nombre, shell, micro-apps, TS
|
|
82
|
+
cd my-shop
|
|
83
|
+
wu dev # Servidor nativo en http://localhost:3000
|
|
84
|
+
wu build # Producción → dist/
|
|
85
|
+
wu serve # Servir dist/
|
|
120
86
|
```
|
|
121
87
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
Builds each micro-app with Vite in parallel and generates a production-ready shell:
|
|
88
|
+
El wizard genera estructura tipo:
|
|
125
89
|
|
|
126
90
|
```
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
+ Build complete: 4 app(s) -> dist/ (5.8s)
|
|
91
|
+
my-shop/
|
|
92
|
+
├── wu.config.json ← configuración del proyecto
|
|
93
|
+
├── package.json ← deps unificadas
|
|
94
|
+
├── shell/ ← el "host" que monta los micro-apps
|
|
95
|
+
│ ├── package.json
|
|
96
|
+
│ ├── index.html
|
|
97
|
+
│ └── src/main.tsx (o .js)
|
|
98
|
+
├── mf-catalog/ ← micro-app 1
|
|
99
|
+
│ ├── package.json
|
|
100
|
+
│ ├── vite.config.js
|
|
101
|
+
│ └── src/App.tsx (o .jsx)
|
|
102
|
+
└── mf-cart/ ← micro-app 2
|
|
103
|
+
└── ...
|
|
142
104
|
```
|
|
143
105
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
Serves the built `dist/` folder:
|
|
147
|
-
|
|
148
|
-
```
|
|
149
|
-
$ wu serve
|
|
106
|
+
## Comandos
|
|
150
107
|
|
|
151
|
-
|
|
152
|
-
|
|
108
|
+
| Comando | Qué hace |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `wu create [name]` | Wizard interactivo (TUI). Con `--template <fw>` modo no-interactivo. |
|
|
111
|
+
| `wu dev` | Servidor de desarrollo nativo. Un solo proceso, un solo puerto. |
|
|
112
|
+
| `wu build` | Compila todos los micro-apps secuencialmente (un Vite a la vez) → `dist/`. |
|
|
113
|
+
| `wu serve` | Static server minimal para validar `dist/` localmente. Sin hardening — no usar en producción. |
|
|
114
|
+
| `wu add <framework> <name>` | Agrega un micro-app a un proyecto existente. |
|
|
115
|
+
| `wu install` | Instala dependencias de todos los micro-apps. |
|
|
116
|
+
| `wu info` | Estado actual del proyecto (apps detectados, puertos, framework del shell). |
|
|
153
117
|
|
|
154
|
-
|
|
155
|
-
Press Ctrl+C to stop
|
|
156
|
-
```
|
|
118
|
+
Referencia completa con todas las flags: **[docs/cli.md](docs/cli.md)**.
|
|
157
119
|
|
|
158
|
-
##
|
|
120
|
+
## Configuración
|
|
159
121
|
|
|
160
|
-
|
|
122
|
+
`wu.config.json` en la raíz del proyecto:
|
|
161
123
|
|
|
162
124
|
```json
|
|
163
125
|
{
|
|
164
|
-
"name": "my-
|
|
165
|
-
"version": "0.2.
|
|
126
|
+
"name": "my-shop",
|
|
127
|
+
"version": "0.2.2",
|
|
166
128
|
"shell": {
|
|
167
129
|
"dir": "shell",
|
|
168
130
|
"port": 4321,
|
|
169
|
-
"framework": "
|
|
131
|
+
"framework": "react"
|
|
170
132
|
},
|
|
171
133
|
"apps": [
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
"dir": "mf-hero",
|
|
175
|
-
"framework": "svelte",
|
|
176
|
-
"port": 5002
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
"name": "orders",
|
|
180
|
-
"dir": "mf-eventlab",
|
|
181
|
-
"framework": "react",
|
|
182
|
-
"port": 5005
|
|
183
|
-
}
|
|
134
|
+
{ "name": "catalog", "dir": "mf-catalog", "framework": "react", "port": 5001 },
|
|
135
|
+
{ "name": "cart", "dir": "mf-cart", "framework": "vue", "port": 5002 }
|
|
184
136
|
],
|
|
185
137
|
"proxy": {
|
|
186
138
|
"port": 3000,
|
|
187
|
-
"open_browser": true
|
|
139
|
+
"open_browser": true,
|
|
140
|
+
"/api": { "target": "http://localhost:8080", "rewrite": true, "cors": false }
|
|
188
141
|
}
|
|
189
142
|
}
|
|
190
143
|
```
|
|
191
144
|
|
|
192
|
-
|
|
145
|
+
Si no existe, `wu` auto-descubre micro-apps escaneando subdirectorios con `vite.config.*` + `package.json`. El directorio llamado **`shell`** se promueve a shell del proyecto.
|
|
193
146
|
|
|
194
|
-
|
|
147
|
+
Schema completo, defaults, ejemplos de proxy: **[docs/configuration.md](docs/configuration.md)**.
|
|
195
148
|
|
|
196
|
-
|
|
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
|
|
218
|
-
```
|
|
149
|
+
## Frameworks soportados
|
|
219
150
|
|
|
220
|
-
|
|
151
|
+
13 frameworks disponibles tanto en el wizard interactivo como en `--template` y `wu add`. Cada micro-app puede usar uno distinto del shell.
|
|
221
152
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
.jsx
|
|
225
|
-
.
|
|
226
|
-
.vue
|
|
227
|
-
.
|
|
228
|
-
.
|
|
229
|
-
.
|
|
230
|
-
|
|
153
|
+
| Framework | Extensiones | Compilación dev | Build (Vite plugin) | TypeScript |
|
|
154
|
+
|---|---|---|---|---|
|
|
155
|
+
| React | .jsx, .tsx | Zig nativo (JSX) → daemon (TSX) | `@vitejs/plugin-react` | ✓ |
|
|
156
|
+
| Preact | .jsx, .tsx | Zig nativo (JSX) → daemon (TSX) | `@preact/preset-vite` | ✓ |
|
|
157
|
+
| Vue | .vue | Daemon (esbuild) | `@vitejs/plugin-vue` | ✓ |
|
|
158
|
+
| Svelte | .svelte | Daemon (esbuild) | `@sveltejs/vite-plugin-svelte` | ✓ |
|
|
159
|
+
| Solid.js | .jsx, .tsx | Daemon (babel-preset-solid) | `vite-plugin-solid` | ✓ |
|
|
160
|
+
| Angular | .ts | Daemon (esbuild bundle) | `@analogjs/vite-plugin-angular` | ✓ |
|
|
161
|
+
| Lit | .ts, .js | Daemon (esbuild TS) | sin plugin | ✓ |
|
|
162
|
+
| Stencil | .js, .tsx | Daemon (JSX/TS) | sin plugin | ✓ |
|
|
163
|
+
| Alpine.js | .js | Passthrough | sin plugin | – |
|
|
164
|
+
| Qwik | .jsx | Daemon (Qwik optimizer) | `qwikVite({csr:true})` | ✓ |
|
|
165
|
+
| HTMX | .js | Passthrough | sin plugin | – |
|
|
166
|
+
| Stimulus | .js | Passthrough | sin plugin | – |
|
|
167
|
+
| Vanilla | .js, .ts | Daemon (esbuild TS para `.ts`) | sin plugin | ✓ |
|
|
231
168
|
|
|
232
|
-
|
|
169
|
+
> **Sobre Qwik:** un comentario antiguo en `create.zig` mantenía Qwik fuera del wizard por incompatibilidad con Shadow DOM. Como los shells actuales **no usan Shadow DOM**, la razón ya no aplica y Qwik está disponible en todos los modos (wizard, `--template`, `wu add`).
|
|
233
170
|
|
|
234
|
-
|
|
171
|
+
## Arquitectura (resumen)
|
|
235
172
|
|
|
236
|
-
|
|
173
|
+
```
|
|
174
|
+
src/
|
|
175
|
+
cli/ args, banner, TUI primitives (raw mode, prompts)
|
|
176
|
+
commands/ dev, build, create, add, install, serve, info
|
|
177
|
+
templates/ 13 plantillas embebidas en el binario
|
|
178
|
+
config/ loader (std.json) + auto-discovery
|
|
179
|
+
runtime/ ← núcleo del dev server
|
|
180
|
+
dev_server.zig thread-per-connection HTTP server (~3.3k LOC)
|
|
181
|
+
handlers/ proxy.zig, hmr.zig (extraídos del monolítico)
|
|
182
|
+
http_parser.zig SIMD HTTP/1.1, 16 bytes/ciclo
|
|
183
|
+
transform.zig reescritura de imports + alias @/ ~/
|
|
184
|
+
jsx_transform.zig JSX nativo en Zig (React/Preact)
|
|
185
|
+
compile.zig pipeline 3-tier (Zig → daemon → fallback)
|
|
186
|
+
resolve.zig resolución NPM pura en Zig
|
|
187
|
+
cache.zig 2 niveles (LRU 256 entradas + disco capado 500MB)
|
|
188
|
+
ws_protocol.zig WebSocket RFC 6455
|
|
189
|
+
hypervisor/ watcher OS-nativo + trie router + transform pool
|
|
190
|
+
sentinel/ anti-bot + ACP (AI Content Protocol)
|
|
191
|
+
```
|
|
237
192
|
|
|
238
|
-
|
|
239
|
-
|-----------|-----------|-------------|------------|
|
|
240
|
-
| React | .jsx, .tsx | Native Zig | Yes |
|
|
241
|
-
| Preact | .jsx, .tsx | Native Zig | Yes |
|
|
242
|
-
| Vue | .vue | Daemon / Node | -- |
|
|
243
|
-
| Svelte | .svelte | Daemon / Node | -- |
|
|
244
|
-
| Solid.js | .jsx, .tsx | Daemon / Node | -- |
|
|
245
|
-
| Angular | .ts | esbuild bundle | -- |
|
|
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 | -- |
|
|
252
|
-
| Vanilla | .js, .ts | TS strip only | -- |
|
|
193
|
+
Detalles: **[docs/contributing.md](docs/contributing.md)**.
|
|
253
194
|
|
|
254
|
-
##
|
|
195
|
+
## Seguridad
|
|
255
196
|
|
|
256
|
-
|
|
197
|
+
Wu integra varias defensas de bajo nivel:
|
|
257
198
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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 |
|
|
199
|
+
- **Anti-slowloris**: timeouts de 30 s en sockets aceptados.
|
|
200
|
+
- **Body-size cap**: 16 MB máx por request, 413 si excede.
|
|
201
|
+
- **Path-traversal**: validación post-URL-decode (`isPathSafe`).
|
|
202
|
+
- **Sentinel**: clasificador zero-alloc para bots; AI agents redirigidos a ACP (`/.well-known/acp.json`).
|
|
203
|
+
- **CORS opt-in**: el proxy no relaja CORS sin consentimiento explícito.
|
|
268
204
|
|
|
269
|
-
|
|
205
|
+
Configuración para producción y modelo de amenazas: **[docs/security.md](docs/security.md)**.
|
|
270
206
|
|
|
271
|
-
##
|
|
207
|
+
## Estadísticas
|
|
272
208
|
|
|
273
|
-
- **
|
|
274
|
-
- **
|
|
275
|
-
- **
|
|
209
|
+
- **40** archivos Zig fuente, **~15k LOC** totales en `src/` (runtime + cli + config + commands)
|
|
210
|
+
- **~250-460 KB** binario release por plataforma (con `-Doptimize=ReleaseFast`)
|
|
211
|
+
- **0** dependencias Zig externas
|
|
212
|
+
- **0** procesos Vite simultáneos en `wu dev` (modo nativo). `wu dev --vite` legacy sí spawnea N procesos.
|
|
276
213
|
|
|
277
|
-
##
|
|
214
|
+
## Requisitos
|
|
278
215
|
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
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
|
|
216
|
+
- **Node.js 16+** para `npm install -g @wu-framework/cli`
|
|
217
|
+
- **Node.js 18+** a runtime sólo para Vue, Svelte, Solid o Angular (React/Preact corren en Zig puro)
|
|
218
|
+
- **Zig 0.16.0** sólo si construyes desde fuente
|
|
285
219
|
|
|
286
|
-
##
|
|
220
|
+
## Licencia
|
|
287
221
|
|
|
288
|
-
MIT
|
|
222
|
+
MIT — ver [LICENSE](LICENSE).
|
|
289
223
|
|
|
290
|
-
##
|
|
224
|
+
## Autor
|
|
291
225
|
|
|
292
|
-
Luis Garcia
|
|
226
|
+
Luis Garcia — creador de [wu-framework](https://www.wu-framework.com).
|
|
293
227
|
|
|
294
228
|
---
|
|
295
229
|
|
|
296
|
-
|
|
230
|
+
*© 2026 Wu Framework*
|
package/bin/wu-darwin-arm64
CHANGED
|
Binary file
|
package/bin/wu-darwin-x64
CHANGED
|
Binary file
|
package/bin/wu-linux-x64
CHANGED
|
Binary file
|
package/bin/wu-win32-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wu-framework/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "Native Zig dev server + CLI for wu-framework microfrontends. One binary, one port, all your micro-apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": "Luis Garcia",
|
|
7
|
+
"homepage": "https://www.wu-framework.com",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/LuisPadre25/wu-cli/issues"
|
|
10
|
+
},
|
|
6
11
|
"bin": {
|
|
7
12
|
"wu": "bin/wu.js"
|
|
8
13
|
},
|
|
9
14
|
"files": [
|
|
10
15
|
"bin/",
|
|
11
16
|
"README.md",
|
|
17
|
+
"CHANGELOG.md",
|
|
12
18
|
"LICENSE"
|
|
13
19
|
],
|
|
14
20
|
"scripts": {
|
|
@@ -20,6 +26,9 @@
|
|
|
20
26
|
"cli",
|
|
21
27
|
"scaffold",
|
|
22
28
|
"dev-server",
|
|
29
|
+
"hmr",
|
|
30
|
+
"vite-alternative",
|
|
31
|
+
"zig",
|
|
23
32
|
"react",
|
|
24
33
|
"vue",
|
|
25
34
|
"svelte",
|
|
@@ -27,11 +36,15 @@
|
|
|
27
36
|
"preact",
|
|
28
37
|
"lit",
|
|
29
38
|
"angular",
|
|
30
|
-
"
|
|
39
|
+
"qwik",
|
|
40
|
+
"stencil",
|
|
41
|
+
"alpine",
|
|
42
|
+
"htmx",
|
|
43
|
+
"stimulus"
|
|
31
44
|
],
|
|
32
45
|
"repository": {
|
|
33
46
|
"type": "git",
|
|
34
|
-
"url": "https://github.com/LuisPadre25/wu-cli"
|
|
47
|
+
"url": "git+https://github.com/LuisPadre25/wu-cli.git"
|
|
35
48
|
},
|
|
36
49
|
"engines": {
|
|
37
50
|
"node": ">=16"
|
package/bin/wu.exe
DELETED
|
Binary file
|