agroplan-ai-cli 1.0.5 → 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.
- package/dist/index.js +19 -14
- 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
|
-
|
|
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
|
-
|
|
443
|
-
|
|
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
|
-
\
|
|
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++;
|
|
@@ -609,7 +608,6 @@ function openCommand() {
|
|
|
609
608
|
// src/commands/setup.ts
|
|
610
609
|
import { existsSync as existsSync6, cpSync, rmSync } from "fs";
|
|
611
610
|
import { join as join3, dirname as dirname2 } from "path";
|
|
612
|
-
var __dirname = "C:\\Users\\Defal\\Documents\\Projetos\\AgroPlan\\tools\\agroplan-cli\\src\\commands";
|
|
613
611
|
async function setupCommand(force = false, pythonPath) {
|
|
614
612
|
console.log(`\uD83D\uDEE0\uFE0F Configurando AgroPlan AI - API Local
|
|
615
613
|
`);
|
|
@@ -741,9 +739,16 @@ async function setupCommand(force = false, pythonPath) {
|
|
|
741
739
|
return;
|
|
742
740
|
}
|
|
743
741
|
console.log(" \u2705 Servidor web configurado");
|
|
744
|
-
|
|
742
|
+
let version = "1.0.5";
|
|
743
|
+
try {
|
|
744
|
+
const packagePath = __require.resolve("agroplan-ai-cli/package.json");
|
|
745
|
+
const packageJson = __require(packagePath);
|
|
746
|
+
version = packageJson.version || "1.0.5";
|
|
747
|
+
} catch {
|
|
748
|
+
version = "1.0.5";
|
|
749
|
+
}
|
|
745
750
|
saveSetupState({
|
|
746
|
-
version
|
|
751
|
+
version,
|
|
747
752
|
installedAt: new Date().toISOString(),
|
|
748
753
|
backendPath: backendDir,
|
|
749
754
|
python: python.version || "unknown",
|
|
@@ -774,7 +779,7 @@ var COMMANDS = {
|
|
|
774
779
|
open: "Abre o AgroPlan AI no navegador"
|
|
775
780
|
};
|
|
776
781
|
function showHelp() {
|
|
777
|
-
console.log("\uD83C\uDF31 AgroPlan AI - CLI Local v1.0.
|
|
782
|
+
console.log("\uD83C\uDF31 AgroPlan AI - CLI Local v1.0.7");
|
|
778
783
|
console.log(` Launcher para modo local acelerado
|
|
779
784
|
`);
|
|
780
785
|
console.log("\uD83D\uDCCB Comandos dispon\xEDveis:");
|