@getparallel/parx 0.8.0 → 0.9.0

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 CHANGED
@@ -6,6 +6,10 @@ changes). Entries are generated by `npm run release` from the git history of `ap
6
6
 
7
7
  <!-- Notes written under «## Unreleased» are used as the next entry instead of the git log. -->
8
8
 
9
+ ## 0.9.0 (2026-10-18)
10
+
11
+ - Al acabar una tarea que cambia la web, la abre, enseña los enlaces y pregunta si la publica
12
+
9
13
  ## 0.8.0 (2026-10-18)
10
14
 
11
15
  - Publicar desde parx (t464): la web construida con parx sale en <nombre>.getparallel.net o en su dominio
package/dist/cli.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import { createInterface } from 'node:readline/promises';
3
3
  import { existsSync, statSync } from 'node:fs';
4
4
  import { homedir, hostname } from 'node:os';
5
- import { basename, resolve } from 'node:path';
5
+ import { basename, join, resolve } from 'node:path';
6
+ import { pathToFileURL } from 'node:url';
6
7
  import { parseArgs } from 'node:util';
7
8
  import { randomUUID } from 'node:crypto';
8
9
  import { ALIAS_COMANDO, ALIAS_SI_NO, COMANDOS, t, USO } from "./textos.js";
@@ -17,7 +18,7 @@ import { deshacerUltimo, permitirCarpeta } from "./herramientas.js";
17
18
  import { Registro } from "./registro.js";
18
19
  import { Pantalla } from "./ui.js";
19
20
  import { Remoto } from "./remoto.js";
20
- import { VistaPrevia } from "./vista.js";
21
+ import { VistaPrevia, raizWeb, recogerWeb } from "./vista.js";
21
22
  import { anadirCarpeta, carpetasDelServicio, instalarServicio, quitarCarpeta, quitarServicio, reiniciarServicio, rutaDelRegistro, servicioEnMarcha, servicioInstalado, servir } from "./servicio.js";
22
23
  import { qrEnTexto } from "./qr.js";
23
24
  import { acciones, bloqueDeBienvenida, bloqueDeLaPersona, bloqueDeTabla, duracion, Superficie } from "./tui.js";
@@ -381,6 +382,60 @@ async function principal() {
381
382
  return { error: e instanceof ErrorDeParallel ? e.codigo : 'red' };
382
383
  }
383
384
  };
385
+ const webDelProyecto = () => {
386
+ const w = raizWeb(raiz);
387
+ if (!w)
388
+ return null;
389
+ const lista = recogerWeb(w.abs);
390
+ if (!lista.some((a) => a.ruta === 'index.html'))
391
+ return null;
392
+ return { ...w, huella: lista.map((a) => `${a.ruta}:${a.hash}`).join('\n') };
393
+ };
394
+ let huellaWeb = webDelProyecto()?.huella ?? null;
395
+ let webPublicada = null;
396
+ const publicarLaWeb = async () => {
397
+ if (!remoto?.encendido)
398
+ await encenderRemoto(false);
399
+ const r0 = remoto;
400
+ if (!r0?.encendido || !r0.id) {
401
+ pantalla.escribir(t('publicar.sin_remoto'));
402
+ return;
403
+ }
404
+ const subida = await actualizarVista(true);
405
+ if (!subida) {
406
+ pantalla.escribir(t('vista.sin_web'));
407
+ return;
408
+ }
409
+ if ('error' in subida) {
410
+ pantalla.error(t('vista.no_subida', { motivo: subida.error }));
411
+ return;
412
+ }
413
+ try {
414
+ const p = await publicarWebRemota(cred.servidor, cred.token, r0.id);
415
+ webPublicada = { url: p.url };
416
+ pantalla.escribir(t('publicar.lista', { url: c.marca(p.url) }));
417
+ abrirNavegador(p.url);
418
+ }
419
+ catch (e) {
420
+ pantalla.error(t('publicar.error', { motivo: e instanceof ErrorDeParallel ? `${e.codigo}${e.detalle ? ` ${e.detalle}` : ''}` : 'red' }));
421
+ }
422
+ };
423
+ const ofrecerLaWeb = async (w) => {
424
+ const local = pathToFileURL(join(w.abs, 'index.html')).href;
425
+ abrirNavegador(local);
426
+ soloAqui(() => pantalla.escribir(t('web.lista', { url: c.marca(local) })));
427
+ if (remoto?.encendido) {
428
+ const r = await actualizarVista(true);
429
+ if (r && !('error' in r))
430
+ soloAqui(() => pantalla.escribir(c.gris(t('web.en_el_movil', { url: r.url }))));
431
+ }
432
+ const r = await pantalla.preguntar(webPublicada ? t('web.publicar_otra_vez', { url: webPublicada.url }) : t('web.publicar_pregunta'), { tipo: 'dos' });
433
+ if (r === 'no') {
434
+ soloAqui(() => pantalla.escribir(c.gris(t('web.luego'))));
435
+ return;
436
+ }
437
+ await publicarLaWeb();
438
+ };
384
439
  let bienvenida;
385
440
  let consejosDeEntrada = [];
386
441
  const confirmarNuevaEnMarcha = async () => {
@@ -476,8 +531,14 @@ async function principal() {
476
531
  superficie?.descansar();
477
532
  remoto?.fijarEstado('libre', null);
478
533
  }
479
- if (remoto?.encendido)
534
+ const web = superficie ? webDelProyecto() : null;
535
+ if (web && web.huella !== huellaWeb) {
536
+ huellaWeb = web.huella;
537
+ await ofrecerLaWeb(web);
538
+ }
539
+ else if (remoto?.encendido) {
480
540
  void actualizarVista();
541
+ }
481
542
  if (!sugeridaMision && sesion.diario.some((d) => d.ficheros.length) && superficie) {
482
543
  sugeridaMision = true;
483
544
  soloAqui(() => pantalla.escribir(c.gris(t('mision.sugerencia'))));
@@ -1341,6 +1402,8 @@ async function principal() {
1341
1402
  break;
1342
1403
  }
1343
1404
  case 'preview': {
1405
+ if (!remoto?.encendido)
1406
+ await encenderRemoto(false);
1344
1407
  if (!remoto?.encendido) {
1345
1408
  pantalla.escribir(t('vista.sin_remoto'));
1346
1409
  break;
@@ -1355,27 +1418,7 @@ async function principal() {
1355
1418
  break;
1356
1419
  }
1357
1420
  case 'publish': {
1358
- const r0 = remoto;
1359
- if (!r0?.encendido || !r0.id) {
1360
- pantalla.escribir(t('publicar.sin_remoto'));
1361
- break;
1362
- }
1363
- const subida = await actualizarVista(true);
1364
- if (!subida) {
1365
- pantalla.escribir(t('vista.sin_web'));
1366
- break;
1367
- }
1368
- if ('error' in subida) {
1369
- pantalla.error(t('vista.no_subida', { motivo: subida.error }));
1370
- break;
1371
- }
1372
- try {
1373
- const p = await publicarWebRemota(cred.servidor, cred.token, r0.id);
1374
- pantalla.escribir(t('publicar.lista', { url: c.marca(p.url) }));
1375
- }
1376
- catch (e) {
1377
- pantalla.error(t('publicar.error', { motivo: e instanceof ErrorDeParallel ? `${e.codigo}${e.detalle ? ` ${e.detalle}` : ''}` : 'red' }));
1378
- }
1421
+ await publicarLaWeb();
1379
1422
  break;
1380
1423
  }
1381
1424
  case 'autoupdate': {
package/dist/textos.js CHANGED
@@ -243,8 +243,13 @@ export const TEXTOS = {
243
243
  'vista.sin_web': 'No web to preview: there is no index.html here or in dist/, build/ or out/.',
244
244
  'vista.no_subida': 'The preview could not be uploaded: {motivo}.',
245
245
  'publicar.lista': 'Live at {url} · the same address every time you /publish. Your own domain: from Sessions on your phone.',
246
- 'publicar.sin_remoto': 'Turn on /remote first: publishing goes through your Parallel account.',
246
+ 'publicar.sin_remoto': 'Publishing needs /remote (your Parallel account) and it could not be turned on.',
247
247
  'publicar.error': 'Could not publish: {motivo}.',
248
+ 'web.lista': 'Your web is ready and open in your browser: {url}',
249
+ 'web.en_el_movil': 'On your phone: {url}',
250
+ 'web.publicar_pregunta': 'Publish it online? It gets an address like name.getparallel.net, with HTTPS.',
251
+ 'web.publicar_otra_vez': 'Publish the new version at {url}?',
252
+ 'web.luego': 'Not published. Whenever you want: /publish.',
248
253
  'servicio.on': 'Your Mac is ready. From Sessions on your phone you can start a task in: {carpetas}. It starts again every time you log in.',
249
254
  'servicio.off': 'The service is off. Your phone can no longer start tasks on this Mac.',
250
255
  'servicio.anadida': 'Added {ruta}. Your phone can start tasks there.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getparallel/parx",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "parx: the coding agent of Parallel in your terminal. Reads and edits your project, runs commands and tests, and does coding tasks end to end. Mac, Windows and Linux.",
5
5
  "keywords": [
6
6
  "parx",