onveloz 0.0.0-beta.21 → 0.0.0-beta.23

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/dist/index.mjs CHANGED
@@ -943,7 +943,7 @@ const requireAuth = middleware(async (_c, next) => {
943
943
  console.error("Não autorizado. Defina VELOZ_API_KEY ou execute `veloz login`.");
944
944
  process.exit(1);
945
945
  }
946
- const { performLogin: performLogin$1 } = await import("./login-jxR-lGEN.mjs");
946
+ const { performLogin: performLogin$1 } = await import("./login-DEQ5zMzL.mjs");
947
947
  await performLogin$1();
948
948
  }
949
949
  await next();
@@ -4299,215 +4299,19 @@ function parseBuildLine(raw) {
4299
4299
  text: trimmed
4300
4300
  };
4301
4301
  }
4302
- const BAR_WIDTH = 20;
4303
- const BRAND = chalk.rgb(255, 77, 0);
4304
- function renderProgressBar(filled, total, allCached, allDone) {
4305
- const ratio = total > 0 ? filled / total : 0;
4306
- const filledChars = Math.round(ratio * BAR_WIDTH);
4307
- const emptyChars = BAR_WIDTH - filledChars;
4308
- const counter = `${filled}/${total}`;
4309
- if (allCached) return `${BRAND("━".repeat(BAR_WIDTH))} ${BRAND(`${counter} ◆ cached`)}`;
4310
- if (allDone) return `${chalk.green("━".repeat(BAR_WIDTH))} ${chalk.green(`${counter} ✓`)}`;
4311
- return chalk.cyan("━".repeat(filledChars)) + chalk.dim("─".repeat(emptyChars)) + ` ${chalk.dim(counter)}`;
4312
- }
4313
- const SPINNER_FRAMES = [
4314
- "⠋",
4315
- "⠙",
4316
- "⠹",
4317
- "⠸",
4318
- "⠼",
4319
- "⠴",
4320
- "⠦",
4321
- "⠧",
4322
- "⠇",
4323
- "⠏"
4324
- ];
4325
- /**
4326
- * Dashboard-style renderer for compact TTY mode.
4327
- * Redraws the entire build progress block on each update.
4328
- * Includes an integrated spinner that animates via setInterval.
4329
- */
4330
- var BuildProgressRenderer = class {
4331
- stages = /* @__PURE__ */ new Map();
4332
- stageOrder = [];
4333
- platformMessages = [];
4334
- renderLineCount = 0;
4335
- phase = "waiting";
4336
- runtimeHeaderPrinted = false;
4337
- serviceName;
4338
- spinnerFrame = 0;
4339
- spinnerInterval = null;
4340
- spinnerText = "Aguardando início do build...";
4341
- /** External ora spinner reference — used to pause/resume during runtime log output */
4342
- externalSpinner = null;
4343
- constructor(serviceName) {
4344
- this.serviceName = serviceName;
4345
- this.startSpinner();
4346
- }
4347
- setExternalSpinner(spinner$1) {
4348
- this.externalSpinner = spinner$1;
4349
- }
4350
- startSpinner() {
4351
- if (this.spinnerInterval) return;
4352
- this.spinnerInterval = setInterval(() => {
4353
- this.spinnerFrame = (this.spinnerFrame + 1) % SPINNER_FRAMES.length;
4354
- this.render();
4355
- }, 80);
4356
- }
4357
- stopSpinner() {
4358
- if (this.spinnerInterval) {
4359
- clearInterval(this.spinnerInterval);
4360
- this.spinnerInterval = null;
4361
- }
4362
- }
4363
- setBuilding() {
4364
- this.phase = "building";
4365
- this.spinnerText = "Compilando...";
4366
- }
4367
- switchToRuntime() {
4368
- if (this.phase === "runtime") return;
4369
- for (const stage of this.stages.values()) if (stage.steps.size > 0 && stage.steps.size < stage.total) stage.total = stage.steps.size;
4370
- this.stopSpinner();
4371
- this.render();
4372
- this.renderLineCount = 0;
4373
- this.phase = "runtime";
4374
- }
4375
- processLine(raw) {
4376
- const trimmed = raw.trim();
4377
- if (!trimmed) return;
4378
- if (this.phase === "runtime") {
4379
- this.printRuntimeLine(trimmed);
4380
- return;
4381
- }
4382
- if (this.phase === "waiting") {
4383
- this.phase = "building";
4384
- this.spinnerText = "Compilando...";
4385
- }
4386
- const parsed = parseBuildLine(trimmed);
4387
- switch (parsed.kind) {
4388
- case "step": {
4389
- let stage = this.stages.get(parsed.stage);
4390
- if (!stage) {
4391
- stage = {
4392
- name: parsed.stage,
4393
- total: parsed.total,
4394
- steps: /* @__PURE__ */ new Map(),
4395
- stepNumMap: /* @__PURE__ */ new Map(),
4396
- cachedStepNums: /* @__PURE__ */ new Set(),
4397
- doneStepNums: /* @__PURE__ */ new Set()
4398
- };
4399
- this.stages.set(parsed.stage, stage);
4400
- this.stageOrder.push(parsed.stage);
4401
- }
4402
- stage.steps.set(parsed.step, parsed.command);
4403
- stage.stepNumMap.set(parsed.stepNum, parsed.step);
4404
- stage.total = Math.max(stage.total, parsed.total);
4405
- break;
4406
- }
4407
- case "cached":
4408
- for (const stage of this.stages.values()) if (stage.stepNumMap.has(parsed.stepNum)) {
4409
- stage.cachedStepNums.add(parsed.stepNum);
4410
- break;
4411
- }
4412
- break;
4413
- case "done":
4414
- for (const stage of this.stages.values()) if (stage.stepNumMap.has(parsed.stepNum)) {
4415
- stage.doneStepNums.add(parsed.stepNum);
4416
- break;
4417
- }
4418
- break;
4419
- case "platform": {
4420
- const cleaned = cleanDisplayLine(parsed.message);
4421
- if (cleaned) this.platformMessages.push(cleaned);
4422
- break;
4423
- }
4424
- case "output":
4425
- case "other": break;
4426
- }
4427
- this.render();
4428
- }
4429
- printRuntimeLine(line) {
4430
- const parsed = parseBuildLine(line);
4431
- let text = null;
4432
- if (parsed.kind === "platform") text = parsed.message;
4433
- else if (parsed.kind === "other" && parsed.text) text = parsed.text;
4434
- else if (parsed.kind === "output") text = parsed.text;
4435
- if (!text) return;
4436
- if (isHiddenMessage(text)) return;
4437
- if (this.externalSpinner) this.externalSpinner.clear();
4438
- if (!this.runtimeHeaderPrinted) {
4439
- this.runtimeHeaderPrinted = true;
4440
- console.log(chalk.cyan.bold(`\n RUNTIME`));
4441
- }
4442
- console.log(` ${text}`);
4443
- if (this.externalSpinner) this.externalSpinner.render();
4444
- }
4445
- isStageComplete(stage) {
4446
- return stage.steps.size >= stage.total;
4447
- }
4448
- render() {
4449
- if (this.renderLineCount > 0) process.stdout.write(`\x1b[${this.renderLineCount}A\x1b[J`);
4450
- let lines = 0;
4451
- const label = this.serviceName ? `BUILD ${chalk.dim(`(${this.serviceName})`)}` : "BUILD";
4452
- process.stdout.write(`${chalk.cyan.bold(` ${label}`)}\n`);
4453
- lines++;
4454
- for (const msg of this.platformMessages) {
4455
- process.stdout.write(` ${msg}\n`);
4456
- lines++;
4457
- }
4458
- if (this.stageOrder.length > 0) {
4459
- process.stdout.write("\n");
4460
- lines++;
4461
- }
4462
- const maxNameLen = Math.max(...this.stageOrder.map((n) => n.length), 4);
4463
- for (let i = 0; i < this.stageOrder.length; i++) {
4464
- const stageName = this.stageOrder[i];
4465
- const stage = this.stages.get(stageName);
4466
- const complete = this.isStageComplete(stage);
4467
- const allCached = complete && stage.cachedStepNums.size === stage.steps.size;
4468
- const allDone = complete && !allCached;
4469
- const bar = renderProgressBar(stage.steps.size, stage.total, allCached, allDone);
4470
- const paddedName = chalk.bold(stageName.padEnd(maxNameLen));
4471
- process.stdout.write(` ${paddedName} ${bar}\n`);
4472
- lines++;
4473
- const sortedSteps = [...stage.steps.entries()].sort((a, b) => a[0] - b[0]);
4474
- for (const [stepNum, command] of sortedSteps) {
4475
- let stepStatus = "";
4476
- for (const [bkNum, dockerStep] of stage.stepNumMap.entries()) if (dockerStep === stepNum) {
4477
- if (stage.cachedStepNums.has(bkNum)) stepStatus = ` ${BRAND("◆")}`;
4478
- else if (stage.doneStepNums.has(bkNum)) stepStatus = ` ${chalk.green("✓")}`;
4479
- break;
4480
- }
4481
- process.stdout.write(` ${command}${stepStatus}\n`);
4482
- lines++;
4483
- }
4484
- if (i < this.stageOrder.length - 1) {
4485
- process.stdout.write("\n");
4486
- lines++;
4487
- }
4488
- }
4489
- if (this.spinnerInterval) {
4490
- if (!(this.stageOrder.length > 0 && this.stageOrder.every((name) => this.isStageComplete(this.stages.get(name))))) {
4491
- const frame = SPINNER_FRAMES[this.spinnerFrame];
4492
- process.stdout.write(`\n ${chalk.cyan(frame)} ${this.spinnerText}\n`);
4493
- lines += 2;
4494
- }
4495
- }
4496
- this.renderLineCount = lines;
4497
- }
4498
- };
4499
4302
  async function streamDeploymentLogs(deploymentId, serviceId, serviceName) {
4500
4303
  const client = await getClient();
4501
4304
  const isVerbose = process.env.VELOZ_VERBOSE === "true";
4502
4305
  const mcp = isMcpMode();
4503
4306
  const isTTY = !mcp && process.stdout.isTTY;
4504
4307
  const isGHA = !mcp && process.env.GITHUB_ACTIONS === "true";
4308
+ if (isTTY && !isVerbose) {
4309
+ const { renderDeployTUI } = await import("./deploy-tui-U7fsZN6x.mjs");
4310
+ return renderDeployTUI(deploymentId, serviceId, serviceName);
4311
+ }
4505
4312
  const allLogLines = [];
4506
- let buildSpinner = null;
4507
- let renderer = null;
4508
4313
  if (mcp) log(serviceName ? `[deploy] Build: ${serviceName}` : "[deploy] Build iniciando...");
4509
4314
  else if (isGHA) startGroup(serviceName ? `Build: ${serviceName}` : "Build");
4510
- else if (isTTY && !isVerbose) renderer = new BuildProgressRenderer(serviceName);
4511
4315
  else if (isTTY) {
4512
4316
  const header = serviceName ? `Build: ${chalk.bold(serviceName)}` : "Build";
4513
4317
  console.log(chalk.cyan(`\n${header}`));
@@ -4523,29 +4327,7 @@ async function streamDeploymentLogs(deploymentId, serviceId, serviceName) {
4523
4327
  const label = statusLabels[event.content] ?? event.content;
4524
4328
  finalStatus = event.content;
4525
4329
  if (mcp) log(`[deploy] Status: ${label}`);
4526
- else if (renderer) {
4527
- if (event.content === "BUILDING") renderer.setBuilding();
4528
- else if (event.content === "DEPLOYING") {
4529
- renderer.switchToRuntime();
4530
- buildSpinner = ora({
4531
- text: "Publicando...",
4532
- color: "cyan"
4533
- }).start();
4534
- renderer.setExternalSpinner(buildSpinner);
4535
- } else if (event.content === "LIVE") {
4536
- if (buildSpinner) {
4537
- renderer.setExternalSpinner(null);
4538
- buildSpinner.succeed("Publicado");
4539
- buildSpinner = null;
4540
- }
4541
- } else if (TERMINAL_STATUSES.has(event.content) && event.content !== "LIVE") {
4542
- if (buildSpinner) {
4543
- renderer.setExternalSpinner(null);
4544
- buildSpinner.fail(label);
4545
- buildSpinner = null;
4546
- }
4547
- }
4548
- } else {
4330
+ else {
4549
4331
  const icon = statusIcons[event.content] ?? chalk.yellow("●");
4550
4332
  process.stdout.write(`\n${icon} ${chalk.bold(label)}\n`);
4551
4333
  }
@@ -4554,15 +4336,9 @@ async function streamDeploymentLogs(deploymentId, serviceId, serviceName) {
4554
4336
  allLogLines.push(...lines);
4555
4337
  if (mcp) {
4556
4338
  for (const line of lines) if (line.trim()) log(`[build] ${line.trim()}`);
4557
- } else if (renderer) for (const line of lines) renderer.processLine(line);
4558
- else for (const line of lines) if (line.trim()) process.stdout.write(` ${line}\n`);
4339
+ } else for (const line of lines) if (line.trim()) process.stdout.write(` ${line}\n`);
4559
4340
  }
4560
4341
  } catch {
4561
- if (renderer) renderer.stopSpinner();
4562
- if (buildSpinner) {
4563
- buildSpinner.stop();
4564
- buildSpinner = null;
4565
- }
4566
4342
  try {
4567
4343
  finalStatus = (await client.deployments.get({ deploymentId })).status;
4568
4344
  try {
@@ -4572,20 +4348,11 @@ async function streamDeploymentLogs(deploymentId, serviceId, serviceName) {
4572
4348
  } catch {}
4573
4349
  }
4574
4350
  if (isGHA) endGroup();
4575
- if (renderer) renderer.stopSpinner();
4576
4351
  const urls = finalStatus === "LIVE" ? await fetchDeployUrls$1(client, serviceId) : [];
4577
4352
  if (finalStatus === "LIVE") {
4578
- if (buildSpinner) {
4579
- buildSpinner.stop();
4580
- buildSpinner = null;
4581
- }
4582
4353
  success(serviceName ? `Deploy de ${mcp ? serviceName : chalk.bold(serviceName)} concluído! Serviço ativo.` : "Deploy concluído! Serviço ativo.");
4583
4354
  if (urls.length > 0) for (const url of urls) info(mcp ? url : `${chalk.bold(url)}`);
4584
4355
  } else if (TERMINAL_STATUSES.has(finalStatus)) {
4585
- if (buildSpinner) {
4586
- buildSpinner.stop();
4587
- buildSpinner = null;
4588
- }
4589
4356
  const label = statusLabels[finalStatus] ?? finalStatus;
4590
4357
  const hints = getFailureHints$1(finalStatus);
4591
4358
  if (mcp) {
@@ -4654,7 +4421,7 @@ const LOGO_LINES = [
4654
4421
  ];
4655
4422
  const BRAND_COLOR = "#FF4D00";
4656
4423
  function getVersion() {
4657
- return "0.0.0-beta.21";
4424
+ return "0.0.0-beta.23";
4658
4425
  }
4659
4426
  function printBanner(subtitle) {
4660
4427
  const version = getVersion();
@@ -4927,30 +4694,32 @@ var TtyOutput = class {
4927
4694
  this.prevLineCount = this.doRenderProgress(entries, this.prevLineCount);
4928
4695
  }
4929
4696
  doRenderProgress(progressMap, prevLineCount) {
4930
- for (let i = 0; i < prevLineCount; i++) process.stdout.write("\x1B[1A\x1B[2K");
4697
+ const buf = [];
4698
+ if (prevLineCount > 0) buf.push(`\x1b[${prevLineCount}A\x1b[J`);
4931
4699
  let lineCount = 0;
4932
4700
  for (const [, progress] of progressMap) {
4933
4701
  const icon = statusIcons[progress.status] || chalk.gray("○");
4934
4702
  const label = statusLabels[progress.status] || progress.status;
4935
- process.stdout.write(`${icon} ${chalk.bold(progress.serviceName)}: ${label}\n`);
4703
+ buf.push(`${icon} ${chalk.bold(progress.serviceName)}: ${label}\n`);
4936
4704
  lineCount++;
4937
4705
  if (progress.status === "BUILDING" || progress.status === "BUILD_FAILED") {
4938
4706
  const nonEmptyLines = progress.logLines.filter((l) => l.trim());
4939
4707
  if (nonEmptyLines.length > 0) {
4940
4708
  const tail = nonEmptyLines.slice(-3);
4941
4709
  for (const line of tail) {
4942
- process.stdout.write(` ${chalk.dim(line)}\n`);
4710
+ buf.push(` ${chalk.dim(line)}\n`);
4943
4711
  lineCount++;
4944
4712
  }
4945
4713
  } else if (progress.status === "BUILDING") {
4946
- process.stdout.write(` ${chalk.dim("Aguardando logs do build...")}\n`);
4714
+ buf.push(` ${chalk.dim("Aguardando logs do build...")}\n`);
4947
4715
  lineCount++;
4948
4716
  }
4949
4717
  } else if (progress.status === "QUEUED") {
4950
- process.stdout.write(` ${chalk.dim("Na fila para compilação...")}\n`);
4718
+ buf.push(` ${chalk.dim("Na fila para compilação...")}\n`);
4951
4719
  lineCount++;
4952
4720
  }
4953
4721
  }
4722
+ process.stdout.write(buf.join(""));
4954
4723
  return lineCount;
4955
4724
  }
4956
4725
  buildStart(_serviceName) {}
@@ -5678,7 +5447,7 @@ async function autoUpdate() {
5678
5447
  if (process.env.VELOZ_MCP === "true") return;
5679
5448
  const pm = detectPackageManager();
5680
5449
  if (!pm) return;
5681
- const currentVersion = "0.0.0-beta.21";
5450
+ const currentVersion = "0.0.0-beta.23";
5682
5451
  const latestVersion = await fetchLatestVersion();
5683
5452
  if (!latestVersion || latestVersion === currentVersion) return;
5684
5453
  const installCmd = getInstallCommand(pm, latestVersion);
@@ -7233,7 +7002,7 @@ async function pruneRemovedEntries(config, existingConfig, services, databases)
7233
7002
  //#region src/index.ts
7234
7003
  if (process.argv.includes("--mcp")) process.env.VELOZ_MCP = "true";
7235
7004
  const cli = Cli.create("veloz", {
7236
- version: "0.0.0-beta.21",
7005
+ version: "0.0.0-beta.23",
7237
7006
  description: "CLI da plataforma Veloz — deploy rápido para o Brasil",
7238
7007
  env: z.object({ VELOZ_ENV: z.string().optional().describe("Ambiente alvo (ex: preview, staging)") })
7239
7008
  });
@@ -7309,4 +7078,4 @@ registerPull(cli);
7309
7078
  cli.serve();
7310
7079
 
7311
7080
  //#endregion
7312
- export { registerLogin as n, performLogin as t };
7081
+ export { statusLabels as a, registerLogin as c, TERMINAL_STATUSES as i, info as l, isHiddenMessage as n, getClient as o, parseBuildLine as r, performLogin as s, cleanDisplayLine as t, success as u };
@@ -0,0 +1,3 @@
1
+ import { c as registerLogin, s as performLogin } from "./index.mjs";
2
+
3
+ export { performLogin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "onveloz",
3
- "version": "0.0.0-beta.21",
3
+ "version": "0.0.0-beta.23",
4
4
  "description": "CLI da plataforma Veloz — deploy rápido para o Brasil",
5
5
  "keywords": [
6
6
  "brasil",
@@ -33,13 +33,16 @@
33
33
  "form-data": "^4.0.0",
34
34
  "ignore": "^5.3.0",
35
35
  "incur": "^0.3.3",
36
+ "ink": "^6.8.0",
36
37
  "ora": "^8.2.0",
38
+ "react": "^19.2.4",
37
39
  "tar": "^6.2.0",
38
40
  "ws": "^8.20.0",
39
41
  "zod": "^4.1.13"
40
42
  },
41
43
  "devDependencies": {
42
44
  "@types/node": "^22.13.14",
45
+ "@types/react": "^19.2.14",
43
46
  "@types/tar": "^6.1.11",
44
47
  "@types/ws": "^8.18.1",
45
48
  "@veloz/api": "workspace:*",
@@ -1,3 +0,0 @@
1
- import { n as registerLogin, t as performLogin } from "./index.mjs";
2
-
3
- export { performLogin };