agroplan-ai-cli 1.0.0 → 1.0.2
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 +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
|
+
var __require = import.meta.require;
|
|
3
4
|
|
|
4
5
|
// src/commands/doctor.ts
|
|
5
6
|
import { existsSync as existsSync4 } from "fs";
|
|
@@ -9,7 +10,7 @@ import { existsSync as existsSync2 } from "fs";
|
|
|
9
10
|
|
|
10
11
|
// src/utils/paths.ts
|
|
11
12
|
import { join, dirname } from "path";
|
|
12
|
-
import { existsSync } from "fs";
|
|
13
|
+
import { existsSync, mkdirSync } from "fs";
|
|
13
14
|
import { homedir } from "os";
|
|
14
15
|
function getHomeAgroplanDir() {
|
|
15
16
|
return join(homedir(), ".agroplan");
|
|
@@ -72,10 +73,10 @@ function getProjectPaths() {
|
|
|
72
73
|
function ensureAgroplanDir() {
|
|
73
74
|
const paths = getProjectPaths();
|
|
74
75
|
if (!existsSync(paths.agroplanDir)) {
|
|
75
|
-
|
|
76
|
+
mkdirSync(paths.agroplanDir, { recursive: true });
|
|
76
77
|
}
|
|
77
78
|
if (!existsSync(paths.logsDir)) {
|
|
78
|
-
|
|
79
|
+
mkdirSync(paths.logsDir, { recursive: true });
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
|
|
@@ -572,8 +573,15 @@ async function setupCommand() {
|
|
|
572
573
|
\uD83D\uDCC2 Criando estrutura de diret\xF3rios...`);
|
|
573
574
|
ensureAgroplanDir();
|
|
574
575
|
console.log("\uD83D\uDCCB Copiando arquivos do backend...");
|
|
575
|
-
|
|
576
|
-
|
|
576
|
+
let templateDir;
|
|
577
|
+
try {
|
|
578
|
+
const packagePath = __require.resolve("agroplan-ai-cli/package.json");
|
|
579
|
+
const packageDir = dirname2(packagePath);
|
|
580
|
+
templateDir = join2(packageDir, "backend-template");
|
|
581
|
+
} catch {
|
|
582
|
+
const cliDir = dirname2(dirname2(dirname2(import.meta.url.replace("file://", ""))));
|
|
583
|
+
templateDir = join2(cliDir, "backend-template");
|
|
584
|
+
}
|
|
577
585
|
if (!existsSync6(templateDir)) {
|
|
578
586
|
console.log("\u274C Template do backend n\xE3o encontrado");
|
|
579
587
|
console.log(` Esperado em: ${templateDir}`);
|