agroplan-ai-cli 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -358,7 +358,7 @@ Correja os problemas acima:`);
358
358
  }
359
359
 
360
360
  // src/commands/serve.ts
361
- import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
361
+ import { existsSync as existsSync5, readFileSync as readFileSync3, openSync, closeSync } from "fs";
362
362
  import { spawn } from "child_process";
363
363
  async function serveOnCommand() {
364
364
  console.log(`\uD83D\uDE80 Iniciando API local do AgroPlan AI...
@@ -421,6 +421,8 @@ async function serveOnCommand() {
421
421
  return;
422
422
  }
423
423
  console.log("\uD83C\uDF10 Iniciando servidor uvicorn...");
424
+ const out = openSync(paths.logFile, "a");
425
+ const err = openSync(paths.logFile, "a");
424
426
  const child = spawn(uvicornPath, [
425
427
  "api:app",
426
428
  "--host",
@@ -432,20 +434,16 @@ async function serveOnCommand() {
432
434
  ], {
433
435
  cwd: paths.backend,
434
436
  detached: true,
435
- stdio: ["ignore", "pipe", "pipe"],
437
+ windowsHide: true,
438
+ stdio: ["ignore", out, err],
436
439
  env: {
437
440
  ...process.env,
438
441
  CORS_ORIGINS: "https://agroplan-ai.vercel.app,http://localhost:3000,http://127.0.0.1:3000"
439
442
  }
440
443
  });
441
444
  savePid(child.pid);
442
- const logStream = Bun.file(paths.logFile).writer();
443
- child.stdout?.on("data", (data) => {
444
- logStream.write(data);
445
- });
446
- child.stderr?.on("data", (data) => {
447
- logStream.write(data);
448
- });
445
+ closeSync(out);
446
+ closeSync(err);
449
447
  child.unref();
450
448
  console.log("\u23F3 Aguardando inicializa\xE7\xE3o...");
451
449
  let attempts = 0;
@@ -459,7 +457,8 @@ async function serveOnCommand() {
459
457
  console.log(" URL: http://localhost:8000");
460
458
  console.log(" Health: http://localhost:8000/health");
461
459
  console.log(`
462
- \uD83D\uDCA1 Use 'agroplan serve off' para parar`);
460
+ \uD83C\uDFAF API rodando em segundo plano - voc\xEA pode fechar este terminal!`);
461
+ console.log("\uD83D\uDCA1 Use 'agroplan serve off' para parar");
463
462
  return;
464
463
  }
465
464
  attempts++;
@@ -780,7 +779,7 @@ var COMMANDS = {
780
779
  open: "Abre o AgroPlan AI no navegador"
781
780
  };
782
781
  function showHelp() {
783
- console.log("\uD83C\uDF31 AgroPlan AI - CLI Local v1.0.6");
782
+ console.log("\uD83C\uDF31 AgroPlan AI - CLI Local v1.0.7");
784
783
  console.log(` Launcher para modo local acelerado
785
784
  `);
786
785
  console.log("\uD83D\uDCCB Comandos dispon\xEDveis:");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroplan-ai-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "CLI global para AgroPlan AI - modo local acelerado",
5
5
  "type": "module",
6
6
  "bin": {