@elurjs/universal 0.1.2 → 0.1.4
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/cli/commands.mjs +3 -3
- package/cli/create-app.mjs +211 -14
- package/cli/dev.mjs +50 -0
- package/cli/tck-platform-windows.mjs +450 -0
- package/cli/tck-windows-uia.ps1 +312 -0
- package/cli/vm-agent.ps1 +25 -0
- package/cli/vm-job-server.py +97 -0
- package/cli/vm-job.py +46 -0
- package/docs/ESTADO.md +5 -1
- package/docs/INSTALACION-Y-DEV.md +162 -0
- package/docs/PENDIENTES.md +173 -12
- package/docs/adr/0218-sdui-gateway-live-mcp-y-scaffold.md +1 -0
- package/docs/adr/0220-target-windows-winui3.md +331 -0
- package/docs/adr/0221-shell-tabs-desktop-normativa.md +45 -0
- package/docs/adr/README.md +11 -10
- package/docs/doc-data.json +395 -104
- package/docs/propuestas/demo-google-devfest-a2ui-sdui.md +206 -54
- package/docs/skills/elur-sdui-mcp/SKILL.md +107 -0
- package/examples/natprobe/entry-a11y.ts +52 -0
- package/examples/natprobe/entry-tinput.ts +73 -0
- package/examples/natprobe/entry-tml.ts +46 -0
- package/examples/natprobe/entry.ts +89 -0
- package/examples/uiprops/elur.app.json +8 -0
- package/examples/uiprops/entry.ts +65 -0
- package/native/ed25519/tweetnacl.c +809 -0
- package/native/ed25519/tweetnacl.h +272 -0
- package/package.json +2 -2
- package/src/app/state.ts +1 -1
- package/src/backends/web/index.ts +55 -2
- package/src/ir/catalog.ts +17 -3
- package/src/ir/schema.ts +245 -94
- package/src/native/http.ts +1 -1
- package/src/runtime/environment.ts +1 -1
- package/src/sdui/cryptoModule.ts +1 -1
- package/src/sdui/oracle.ts +5 -0
- package/src/sdui/profile.ts +3 -2
- package/targets/android/app/src/main/java/com/elur/universal/ElurRenderer.kt +55 -3
package/cli/commands.mjs
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export const CLI_COMMANDS = [
|
|
14
14
|
{
|
|
15
|
-
cmd: "`elur build --target web|android|linux [--apk --aab --release --engine hermes --splits --minify]`",
|
|
15
|
+
cmd: "`elur build --target web|android|linux|windows [--apk --aab --release --engine hermes --splits --minify]`",
|
|
16
16
|
fn: "Build completo: bundling, lowering, assets, integración de host, Gradle",
|
|
17
17
|
estado: "Implementado", sub: ["build"],
|
|
18
18
|
},
|
|
@@ -27,7 +27,7 @@ export const CLI_COMMANDS = [
|
|
|
27
27
|
estado: "Implementado (ADR-0137)", sub: ["build"], scripts: ["build-ssg.mjs"],
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
cmd: "`elur dev --target web|android|linux [--json] [--ssr] [--dev-fast] [--no-serve]`",
|
|
30
|
+
cmd: "`elur dev --target web|android|linux|windows [--json] [--ssr] [--dev-fast] [--no-serve]`",
|
|
31
31
|
fn: "Watch → rebuild → push/relaunch (web SSE reload, Android `/data/local/tmp`, Linux GTK4); `--ssr` reinicia el server generado; `--dev-fast` omite HBC/QJSC y regenera `routes.gen.ts`; eventos NDJSON",
|
|
32
32
|
estado: "Implementado (ADR-0111/0141/0213/0214)", sub: ["dev"],
|
|
33
33
|
},
|
|
@@ -38,7 +38,7 @@ export const CLI_COMMANDS = [
|
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
cmd: "`elur create <dir> [--template default|sdui]`",
|
|
41
|
-
fn: "Scaffold de app consumidora (composition root, `elur.app.json`; `--template sdui` genera llaves ed25519, `.
|
|
41
|
+
fn: "Scaffold de app consumidora (composition root, `elur.app.json`; `--template sdui` genera llaves ed25519, `.mcp.json`/`.agents/mcp_config.json`/`.cursor/mcp.json`/`opencode.json` y cliente live A2UI+SDUI)",
|
|
42
42
|
estado: "Implementado (ADR-0103/0218)", sub: ["create"],
|
|
43
43
|
},
|
|
44
44
|
{
|
package/cli/create-app.mjs
CHANGED
|
@@ -82,6 +82,68 @@ if (template === "sdui") {
|
|
|
82
82
|
"elur sdui inspect docs/home.envelope.json";
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// Contexto de entorno/dev/build embebido en el AGENTS.md de todo
|
|
86
|
+
// scaffold — condensa docs/INSTALACION-Y-DEV.md (que además se copia
|
|
87
|
+
// íntegra a docs/ del proyecto).
|
|
88
|
+
const agentsDev = `## Entorno, desarrollo y build
|
|
89
|
+
|
|
90
|
+
Toolchain: el paquete instala el binario \`elur\`
|
|
91
|
+
(\`node_modules/.bin\`); los scripts de \`package.json\` ya lo invocan.
|
|
92
|
+
\`bun run doctor\` valida el entorno (web/android — linux/windows no
|
|
93
|
+
tienen checks aún).
|
|
94
|
+
|
|
95
|
+
Prerequisitos por plataforma:
|
|
96
|
+
- web — bun + navegador.
|
|
97
|
+
- android — JDK 17+, Android SDK (\`ANDROID_HOME\`/\`ANDROID_SDK_ROOT\`
|
|
98
|
+
o \`targets/android/local.properties\` \`sdk.dir\`), \`cmake\` del
|
|
99
|
+
SDK, Gradle via wrapper. Loop dev: device/emulador + \`adb\`; sin
|
|
100
|
+
device online el bundle queda generado sin push.
|
|
101
|
+
- linux — \`libgtk-4-dev\`, \`libsoup-3.0\` dev, \`fontconfig\`,
|
|
102
|
+
\`cmake\`, \`pkg-config\`, compilador C++20, X11/Wayland. El host se
|
|
103
|
+
compila aparte: \`cmake -B targets/linux/build && cmake --build
|
|
104
|
+
targets/linux/build\` (el scaffold no copia \`targets/linux\` — el
|
|
105
|
+
source está en \`node_modules/@elurjs/universal/targets/linux\`).
|
|
106
|
+
- windows — host remoto por SSH: \`ELUR_WIN_SSH=user@host[:port]\`
|
|
107
|
+
habilita el relanzado (scp a \`ELUR_WIN_DIR\` + \`schtasks /run
|
|
108
|
+
/tn ELUR_WIN_TASK\`, ADR-0220).
|
|
109
|
+
|
|
110
|
+
Qué hace cada script:
|
|
111
|
+
- \`bun run dev\` — web: \`targets/web/dist\` + servidor en
|
|
112
|
+
http://localhost:3419 con SSE auto-reload; \`--dev-fast\` omite
|
|
113
|
+
ES5/HBC/QJSC (el host cae a source JS).
|
|
114
|
+
- \`bun run dev:android\` — sin dev-fast (genera además HBC/QJSC); hot
|
|
115
|
+
path: \`adb push generated/elurApp.js\` → \`am start …dev -e appAsset
|
|
116
|
+
elurApp.dev.js -e devSeq <ms>\` — hot reload con snapshot nav+app
|
|
117
|
+
preservado (ADR-0111). Exige el APK \`.dev\` instalado una vez
|
|
118
|
+
(\`bun run build:android\` + \`adb install\`, o \`elur dev --target
|
|
119
|
+
android --full\` que compila, instala y lanza).
|
|
120
|
+
- \`bun run dev:linux\` — \`generated/elurApp.js\` + relanza
|
|
121
|
+
\`targets/linux/build/elur-linux\` si hay binario + display;
|
|
122
|
+
\`--full\` además corre \`cmake --build\` del host.
|
|
123
|
+
- \`bun run gen:routes\` — regenera \`src/routes.gen.ts\` cuando hay
|
|
124
|
+
\`app/\` con \`page.ts\` (\`elur dev\` lo corre solo al detectarlo).
|
|
125
|
+
- Builds — \`build:web\` → \`targets/web/dist\` (app.js IIFE +
|
|
126
|
+
index.html; \`--ssr\`/\`--ssg\` emiten aparte); \`build:android\` →
|
|
127
|
+
assets JS + .hbc/.qjsc + APK debug (\`--aab\`/\`--release\`/
|
|
128
|
+
\`--splits\`/\`--minify\`; release exige \`--engine\`);
|
|
129
|
+
\`build:linux\` → \`generated/\` + registrar de módulos; packaging
|
|
130
|
+
linux: \`bun node_modules/@elurjs/universal/cli/package-linux.mjs
|
|
131
|
+
--format appimage|deb|rpm|flatpak\` (ADR-0186).
|
|
132
|
+
- \`elur dev --target <p>\` watch-reconstruye \`src/\`, \`packages/\` y
|
|
133
|
+
el entry (debounce 400 ms); flags: \`--dev-fast\`, \`--no-serve\`,
|
|
134
|
+
\`--full\`, \`--json\` (NDJSON).
|
|
135
|
+
|
|
136
|
+
Estructura: \`elur.app.json\` (identidad T-2), \`src/entry.ts\`
|
|
137
|
+
(composition root — \`mountApp\` resuelve \`mount.<plataforma>.ts\` en
|
|
138
|
+
build, ADR-0101), \`src/app.ts\` (pantalla raíz con el tag \`\` ui\` \`\`),
|
|
139
|
+
\`generated/\` (salida de build — nunca editar), \`targets/android/\`
|
|
140
|
+
(proyecto Gradle propio; los módulos de paquetes se reintegran en cada
|
|
141
|
+
build por los marcadores BEGIN/END ELUR MODULE *).
|
|
142
|
+
|
|
143
|
+
Referencia completa: \`docs/INSTALACION-Y-DEV.md\` (las rutas
|
|
144
|
+
\`cli/\`/\`targets/\`/\`native/\` que cita son del paquete instalado —
|
|
145
|
+
\`node_modules/@elurjs/universal/\`).`;
|
|
146
|
+
|
|
85
147
|
writeFileSync(join(dest, "package.json"), JSON.stringify({
|
|
86
148
|
name: appName.toLowerCase().replace(/\s+/g, "-"),
|
|
87
149
|
private: true,
|
|
@@ -103,7 +165,8 @@ writeFileSync(join(dest, "elur.app.json"), JSON.stringify({
|
|
|
103
165
|
if (template === "sdui") {
|
|
104
166
|
mkdirSync(join(dest, "keys"), { recursive: true });
|
|
105
167
|
mkdirSync(join(dest, "docs"), { recursive: true });
|
|
106
|
-
mkdirSync(join(dest, ".
|
|
168
|
+
mkdirSync(join(dest, ".agents"), { recursive: true });
|
|
169
|
+
mkdirSync(join(dest, ".cursor"), { recursive: true });
|
|
107
170
|
|
|
108
171
|
const { privateKey, publicKey } = generateKeyPairSync("ed25519");
|
|
109
172
|
const privPem = privateKey.export({ format: "pem", type: "pkcs8" });
|
|
@@ -213,7 +276,7 @@ if (template === "sdui") {
|
|
|
213
276
|
when: { ref: "showGuide" },
|
|
214
277
|
then: {
|
|
215
278
|
type: "text",
|
|
216
|
-
text: "1) bun run gateway 2) bun run dev 3) ejecuta
|
|
279
|
+
text: "1) bun run gateway 2) bun run dev 3) ejecuta antigravity/opencode/claude en esta carpeta: las tools MCP publican en vivo sin recompilar.",
|
|
217
280
|
style: { color: "#FFD166", fontSize: 13 },
|
|
218
281
|
},
|
|
219
282
|
},
|
|
@@ -251,15 +314,22 @@ if (template === "sdui") {
|
|
|
251
314
|
},
|
|
252
315
|
};
|
|
253
316
|
writeFileSync(
|
|
254
|
-
join(dest, ".
|
|
317
|
+
join(dest, ".mcp.json"),
|
|
255
318
|
JSON.stringify(mcpConfig, null, 2) + "\n",
|
|
256
319
|
);
|
|
320
|
+
// Antigravity (App/IDE/CLI comparten config): mcpServers estándar en
|
|
321
|
+
// el archivo MCP del workspace.
|
|
257
322
|
writeFileSync(
|
|
258
|
-
join(dest, ".
|
|
323
|
+
join(dest, ".agents/mcp_config.json"),
|
|
324
|
+
JSON.stringify(mcpConfig, null, 2) + "\n",
|
|
325
|
+
);
|
|
326
|
+
// Cursor: config de proyecto en .cursor/mcp.json — mismo esquema.
|
|
327
|
+
writeFileSync(
|
|
328
|
+
join(dest, ".cursor/mcp.json"),
|
|
259
329
|
JSON.stringify(mcpConfig, null, 2) + "\n",
|
|
260
330
|
);
|
|
261
|
-
// OpenCode usa su propio esquema:
|
|
262
|
-
// command como array plano (no command/args separados).
|
|
331
|
+
// OpenCode v2 usa su propio esquema: "mcp"."servers".<nombre> +
|
|
332
|
+
// type "local" + command como array plano (no command/args separados).
|
|
263
333
|
const oc = mcpConfig.mcpServers["elur-sdui"];
|
|
264
334
|
writeFileSync(
|
|
265
335
|
join(dest, "opencode.json"),
|
|
@@ -267,10 +337,11 @@ if (template === "sdui") {
|
|
|
267
337
|
{
|
|
268
338
|
$schema: "https://opencode.ai/config.json",
|
|
269
339
|
mcp: {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
340
|
+
servers: {
|
|
341
|
+
"elur-sdui": {
|
|
342
|
+
type: "local",
|
|
343
|
+
command: [oc.command, ...oc.args],
|
|
344
|
+
},
|
|
274
345
|
},
|
|
275
346
|
},
|
|
276
347
|
},
|
|
@@ -279,6 +350,94 @@ if (template === "sdui") {
|
|
|
279
350
|
) + "\n",
|
|
280
351
|
);
|
|
281
352
|
|
|
353
|
+
writeFileSync(join(dest, "AGENTS.md"), `# AGENTS — Elur SDUI/A2UI project
|
|
354
|
+
|
|
355
|
+
Este proyecto publica UI en vivo por MCP. Regla principal: los cambios de
|
|
356
|
+
UI en caliente SOLO se hacen con las tools MCP \`sdui_*\`/\`a2ui_*\` (el
|
|
357
|
+
cliente de IA las lanza desde su propia config MCP — ver §Configurar el
|
|
358
|
+
servidor MCP; nunca se corre \`elur sdui mcp\` a mano).
|
|
359
|
+
|
|
360
|
+
## Configurar el servidor MCP (cualquier cliente)
|
|
361
|
+
|
|
362
|
+
\`elur-sdui\` es un servidor MCP **stdio** (protocolo 2024-11-05,
|
|
363
|
+
JSON-RPC 2.0): tu cliente lo lanza como proceso hijo — no es un proceso
|
|
364
|
+
persistente ni un endpoint HTTP; **nunca lo corras a mano**. Este es el
|
|
365
|
+
descriptor canónico que el scaffold ya escribió en las configs conocidas:
|
|
366
|
+
|
|
367
|
+
\`\`\`json
|
|
368
|
+
${JSON.stringify(mcpConfig, null, 2)}
|
|
369
|
+
\`\`\`
|
|
370
|
+
|
|
371
|
+
| Cliente | Archivo de config | Esquema |
|
|
372
|
+
| --- | --- | --- |
|
|
373
|
+
| Claude Code / clientes genéricos | \`.mcp.json\` (proyecto) — ya generado | \`mcpServers\` (el de arriba) |
|
|
374
|
+
| Antigravity (App / IDE / CLI \`agy\`) | \`.agents/mcp_config.json\` (workspace) — ya generado; global: \`~/.gemini/config/mcp_config.json\` | \`mcpServers\` |
|
|
375
|
+
| Cursor | \`.cursor/mcp.json\` (proyecto) — ya generado; global: \`~/.cursor/mcp.json\` | \`mcpServers\` |
|
|
376
|
+
| OpenCode | \`opencode.json\` (proyecto) — ya generado | \`mcp.servers.<nombre>\` + \`type:"local"\` + \`command\` array |
|
|
377
|
+
| Devin | \`~/.config/devin/mcp_config.json\` | \`mcpServers\` |
|
|
378
|
+
| Windsurf | \`~/.codeium/windsurf/mcp_config.json\` | \`mcpServers\` |
|
|
379
|
+
| VS Code | \`.vscode/mcp.json\` | \`servers\` (misma entrada) |
|
|
380
|
+
|
|
381
|
+
Cualquier otro entorno: localiza dónde declara servidores MCP stdio y
|
|
382
|
+
registra el mismo bloque \`elur-sdui\` (en esquema OpenCode sería
|
|
383
|
+
\`{ "type": "local", "command": ["bun", ...args] }\` bajo
|
|
384
|
+
\`mcp.servers\`). Tras registrarlo reinicia el cliente/sesión para que
|
|
385
|
+
cargue las tools — si las \`sdui_*\`/\`a2ui_*\` no aparecen en tu
|
|
386
|
+
sesión, dilo al usuario; **no improvices** con el CLI ni editando
|
|
387
|
+
envelopes.
|
|
388
|
+
|
|
389
|
+
Requisito previo: \`bun install\` hecho (el server vive en el paquete) y
|
|
390
|
+
\`bun run gateway\` corriendo para que publish/serve respondan.
|
|
391
|
+
|
|
392
|
+
## Prohibido para cambiar la UI en vivo
|
|
393
|
+
|
|
394
|
+
- Editar \`docs/*.envelope.json\`: el gateway sirve el último documento
|
|
395
|
+
**publicado**, no el archivo del disco — editarlo no cambia nada.
|
|
396
|
+
- \`elur sdui sign\` + \`curl /publish\` ni envelopes firmados a mano:
|
|
397
|
+
\`sdui_publish\`/\`a2ui_publish\` ya firman Ed25519 con \`keys/app.key\`
|
|
398
|
+
y gestionan rev/seq. Es solo fallback si no hay MCP disponible.
|
|
399
|
+
- Inventar vocabulario: las props/nodos exactos los da \`sdui_catalog\`.
|
|
400
|
+
|
|
401
|
+
## Flujo obligatorio
|
|
402
|
+
|
|
403
|
+
1. \`sdui_catalog\` si no conoces el vocabulario de esta versión.
|
|
404
|
+
2. Construir el envelope SDUI o los mensajes A2UI.
|
|
405
|
+
3. \`sdui_inspect\` / \`a2ui_inspect\` — oráculo Yoga C++ + reglas
|
|
406
|
+
layout/a11y; corrige lo que reporte ANTES de publicar.
|
|
407
|
+
4. \`sdui_publish\` / \`a2ui_publish\` — verás \`rev=N+1\` y
|
|
408
|
+
\`Ed25519 OK\` en la barra de estado de la app.
|
|
409
|
+
5. \`sdui_actions\` — polléala para leer las acciones que el usuario
|
|
410
|
+
envía desde la app (\`a2ui.action\`, formularios, taps).
|
|
411
|
+
|
|
412
|
+
## A2UI
|
|
413
|
+
|
|
414
|
+
- \`createSurface\` una vez; \`updateComponents\` remonta;
|
|
415
|
+
\`updateDataModel\` con \`append:true\` = parche O(1) sin remount —
|
|
416
|
+
úsalo para cambios solo de datos.
|
|
417
|
+
- Refs de evento: \`{ref:"event"}.data.text\` / \`.data.checked\` /
|
|
418
|
+
\`.data.progress\` (es un EventEnvelope, no un valor plano).
|
|
419
|
+
|
|
420
|
+
${agentsDev}
|
|
421
|
+
|
|
422
|
+
## Fronteras
|
|
423
|
+
|
|
424
|
+
- MCP = la superficie server-driven. El shell (\`src/entry.ts\`,
|
|
425
|
+
\`src/app.ts\`, barra de estado) es TypeScript compilado: cambiarlo =
|
|
426
|
+
editar código + \`elur dev\` reconstruye. No se publica por MCP.
|
|
427
|
+
- Nunca tocar \`keys/app.key\` (privada), \`generated/\` ni el gateway.
|
|
428
|
+
- Cada proyecto firma con sus llaves: documentos de otro proyecto se
|
|
429
|
+
rechazan (\`Ed25519 FAIL\`).
|
|
430
|
+
- Prerequisitos: \`bun run gateway\` corriendo + un cliente abierto
|
|
431
|
+
(\`bun run dev\`, \`dev:android\` con APK instalado, o \`dev:linux\`
|
|
432
|
+
con el binario en \`targets/linux/build/elur-linux\`).
|
|
433
|
+
- Guía detallada del flujo y anti-patrones:
|
|
434
|
+
\`docs/skills/elur-sdui-mcp/SKILL.md\`
|
|
435
|
+
`);
|
|
436
|
+
|
|
437
|
+
cpSync(join(root, "docs/skills"), join(dest, "docs/skills"), {
|
|
438
|
+
recursive: true,
|
|
439
|
+
});
|
|
440
|
+
|
|
282
441
|
writeFileSync(join(dest, "src/verify.ts"), `import { ElurTextEncoder } from "@elurjs/universal";
|
|
283
442
|
import { resolveModule } from "@elurjs/universal/native";
|
|
284
443
|
import { CRYPTO_MODULE, moduleVerifier, type SduiSig, type VerifyFn } from "@elurjs/universal/sdui";
|
|
@@ -436,12 +595,15 @@ function swapBody(mounted: MountedSdui): void {
|
|
|
436
595
|
});
|
|
437
596
|
}
|
|
438
597
|
|
|
598
|
+
/** HUD de desarrollo (rev · firma · mounts): true muestra la barra de diagnóstico. */
|
|
599
|
+
const SHOW_HUD = false;
|
|
600
|
+
|
|
439
601
|
function renderShell(): UIResult {
|
|
440
602
|
const header = computed(() =>
|
|
441
603
|
\`[\${Platform.OS}] \${modeBadge.value} · rev=\${revNum.value} · O(1)=\${dataPatches.value} · mounts=\${structuralMounts.value}\`,
|
|
442
604
|
);
|
|
443
|
-
|
|
444
|
-
|
|
605
|
+
const hud = SHOW_HUD
|
|
606
|
+
? ui\`
|
|
445
607
|
<column style=\${{
|
|
446
608
|
padding: 10, gap: 4, backgroundColor: "#0F2942",
|
|
447
609
|
borderBottomWidth: 1, borderColor: "#1E4976",
|
|
@@ -453,6 +615,11 @@ function renderShell(): UIResult {
|
|
|
453
615
|
\${statusText}
|
|
454
616
|
</text>
|
|
455
617
|
</column>
|
|
618
|
+
\`
|
|
619
|
+
: null;
|
|
620
|
+
return ui\`
|
|
621
|
+
<column style=\${{ flex: 1, backgroundColor: "#071626" }}>
|
|
622
|
+
\${hud}
|
|
456
623
|
<column style=\${{ flex: 1 }}>
|
|
457
624
|
\${currentBody}
|
|
458
625
|
</column>
|
|
@@ -463,8 +630,9 @@ function renderShell(): UIResult {
|
|
|
463
630
|
async function applySduiDoc(docName: string, rev: number): Promise<void> {
|
|
464
631
|
const base = gatewayUrl.value;
|
|
465
632
|
const transport = makeTransport(base);
|
|
466
|
-
const plat = (Platform.OS === "android" || Platform.OS === "linux"
|
|
467
|
-
|
|
633
|
+
const plat = (Platform.OS === "android" || Platform.OS === "linux" ||
|
|
634
|
+
Platform.OS === "windows" ? Platform.OS : "web") as
|
|
635
|
+
"web" | "android" | "linux" | "windows";
|
|
468
636
|
const policy = {
|
|
469
637
|
requireSig: true,
|
|
470
638
|
trustedSigners: TRUSTED_SIGNERS,
|
|
@@ -642,6 +810,35 @@ void mountApp(createApp());
|
|
|
642
810
|
`);
|
|
643
811
|
}
|
|
644
812
|
|
|
813
|
+
// Contexto para agentes: la referencia completa de install/dev/build
|
|
814
|
+
// viaja en docs/ del proyecto (las rutas que cita son del paquete
|
|
815
|
+
// instalado — el AGENTS.md lo aclara).
|
|
816
|
+
mkdirSync(join(dest, "docs"), { recursive: true });
|
|
817
|
+
cpSync(
|
|
818
|
+
join(root, "docs/INSTALACION-Y-DEV.md"),
|
|
819
|
+
join(dest, "docs/INSTALACION-Y-DEV.md"),
|
|
820
|
+
);
|
|
821
|
+
|
|
822
|
+
if (template !== "sdui") {
|
|
823
|
+
writeFileSync(join(dest, "AGENTS.md"), `# AGENTS — Elur project
|
|
824
|
+
|
|
825
|
+
App consumidora de \`@elurjs/universal\` (scaffold \`elur create\`,
|
|
826
|
+
ADR-0103). La UI vive en \`src/\` con el tag \`\` ui\` \`\` → IR
|
|
827
|
+
declarativo que \`mountApp\` aplica al backend de cada plataforma
|
|
828
|
+
(web/android/linux/windows).
|
|
829
|
+
|
|
830
|
+
${agentsDev}
|
|
831
|
+
|
|
832
|
+
## Reglas
|
|
833
|
+
|
|
834
|
+
- \`generated/\` y \`targets/*/dist/\` son salida de build — nunca
|
|
835
|
+
editarlos.
|
|
836
|
+
- El toolchain está en el paquete:
|
|
837
|
+
\`node_modules/@elurjs/universal/cli/\` (los scripts de
|
|
838
|
+
\`package.json\` ya lo invocan).
|
|
839
|
+
`);
|
|
840
|
+
}
|
|
841
|
+
|
|
645
842
|
// Copia del host Android (template del framework — excluye outputs).
|
|
646
843
|
const tpl = join(root, "targets/android");
|
|
647
844
|
const out = join(dest, "targets/android");
|
package/cli/dev.mjs
CHANGED
|
@@ -93,6 +93,42 @@ function restartLinuxHost() {
|
|
|
93
93
|
linuxProc.on("exit", () => { /* el próximo rebuild relanza */ });
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
|
+
// ADR-0220: el host Windows corre fuera (VM/otra máquina) — se alcanza
|
|
97
|
+
// por SSH. ELUR_WIN_SSH=user@host[:port] habilita el relanzado; el
|
|
98
|
+
// bundle viaja por scp a ELUR_WIN_DIR y la app se levanta en la sesión
|
|
99
|
+
// interactiva con la scheduled task ELUR_WIN_TASK (debe existir en el
|
|
100
|
+
// host y ejecutar elur-windows.exe sin --shot).
|
|
101
|
+
function winSshTarget() {
|
|
102
|
+
const raw = process.env.ELUR_WIN_SSH;
|
|
103
|
+
if (!raw) return null;
|
|
104
|
+
const at = raw.lastIndexOf(":");
|
|
105
|
+
if (at > 0 && /^\d+$/.test(raw.slice(at + 1))) {
|
|
106
|
+
return { dest: raw.slice(0, at), port: raw.slice(at + 1) };
|
|
107
|
+
}
|
|
108
|
+
return { dest: raw, port: "22" };
|
|
109
|
+
}
|
|
110
|
+
function restartWindowsHost() {
|
|
111
|
+
const sshT = winSshTarget();
|
|
112
|
+
if (!sshT || noServe) return false;
|
|
113
|
+
const winDir = process.env.ELUR_WIN_DIR ?? "C:/elur/generated";
|
|
114
|
+
const task = process.env.ELUR_WIN_TASK ?? "elur-app-dev";
|
|
115
|
+
const genDir = join(process.cwd(), "generated");
|
|
116
|
+
const appName = !devFast && existsSync(join(genDir, "elurApp.es5.qjsc"))
|
|
117
|
+
? "elurApp.es5.qjsc"
|
|
118
|
+
: "elurApp.js";
|
|
119
|
+
const scpArgs = ["-P", sshT.port];
|
|
120
|
+
try {
|
|
121
|
+
run("scp", ...scpArgs, join(genDir, "elurSignals.js"),
|
|
122
|
+
`${sshT.dest}:${winDir}/`);
|
|
123
|
+
run("scp", ...scpArgs, join(genDir, appName),
|
|
124
|
+
`${sshT.dest}:${winDir}/`);
|
|
125
|
+
run("ssh", "-p", sshT.port, sshT.dest,
|
|
126
|
+
`taskkill /f /im elur-windows.exe 2>nul & schtasks /run /tn ${task}`);
|
|
127
|
+
return true;
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
96
132
|
const killSsr = () => { try { ssrProc?.kill("SIGKILL"); } catch { } };
|
|
97
133
|
const killLinux = () => { try { linuxProc?.kill("SIGTERM"); } catch { } };
|
|
98
134
|
const stopWeb = () => {
|
|
@@ -366,6 +402,20 @@ function rebuild() {
|
|
|
366
402
|
});
|
|
367
403
|
return;
|
|
368
404
|
}
|
|
405
|
+
if (target === "windows") {
|
|
406
|
+
run("bun", join(__dirname, "elur.mjs"), "build", "--target", "windows",
|
|
407
|
+
"--app", appEntry,
|
|
408
|
+
...(devFast ? ["--dev-fast"] : []));
|
|
409
|
+
const launched = restartWindowsHost();
|
|
410
|
+
log("dev.build.end", {
|
|
411
|
+
ok: true, ms: Date.now() - t0,
|
|
412
|
+
launch: launched,
|
|
413
|
+
msg: launched
|
|
414
|
+
? "bundle Windows copiado + app relanzada (SSH)"
|
|
415
|
+
: "bundle Windows en generated/ (ELUR_WIN_SSH no definido)",
|
|
416
|
+
});
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
369
419
|
if (full) {
|
|
370
420
|
run("bun", join(__dirname, "elur.mjs"), "build", "--target", "android",
|
|
371
421
|
"--app", appEntry, "--apk",
|