@nimbuslab/cli 0.13.3 → 0.13.5
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 +30 -13
- package/package.json +1 -1
- package/src/commands/lola.ts +37 -14
package/dist/index.js
CHANGED
|
@@ -150,7 +150,7 @@ var require_src = __commonJS((exports, module) => {
|
|
|
150
150
|
var require_package = __commonJS((exports, module) => {
|
|
151
151
|
module.exports = {
|
|
152
152
|
name: "@nimbuslab/cli",
|
|
153
|
-
version: "0.13.
|
|
153
|
+
version: "0.13.5",
|
|
154
154
|
description: "CLI para criar projetos nimbuslab",
|
|
155
155
|
type: "module",
|
|
156
156
|
bin: {
|
|
@@ -2512,8 +2512,9 @@ async function installLola() {
|
|
|
2512
2512
|
console.log();
|
|
2513
2513
|
console.log(import_picocolors7.default.cyan(" Configurando comando lola..."));
|
|
2514
2514
|
if (isWindows) {
|
|
2515
|
-
const
|
|
2516
|
-
const
|
|
2515
|
+
const ps5ProfileDir = join3(HOME, "Documents", "WindowsPowerShell");
|
|
2516
|
+
const ps7ProfileDir = join3(HOME, "Documents", "PowerShell");
|
|
2517
|
+
const profileName = "Microsoft.PowerShell_profile.ps1";
|
|
2517
2518
|
const lolaFunction = `
|
|
2518
2519
|
# Lola - Code Agent da nimbuslab
|
|
2519
2520
|
function lola {
|
|
@@ -2526,19 +2527,35 @@ function lola {
|
|
|
2526
2527
|
}
|
|
2527
2528
|
}
|
|
2528
2529
|
`;
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2530
|
+
const profiles = [
|
|
2531
|
+
{ dir: ps5ProfileDir, name: "PowerShell 5.x" },
|
|
2532
|
+
{ dir: ps7ProfileDir, name: "PowerShell 7+" }
|
|
2533
|
+
];
|
|
2534
|
+
let addedToAny = false;
|
|
2535
|
+
for (const { dir, name } of profiles) {
|
|
2536
|
+
const profilePath = join3(dir, profileName);
|
|
2537
|
+
if (!existsSync2(dir)) {
|
|
2538
|
+
await Bun.$`mkdir -p ${dir}`;
|
|
2539
|
+
}
|
|
2540
|
+
let profileContent = "";
|
|
2541
|
+
if (existsSync2(profilePath)) {
|
|
2542
|
+
profileContent = await Bun.file(profilePath).text();
|
|
2543
|
+
}
|
|
2544
|
+
if (!profileContent.includes("function lola")) {
|
|
2545
|
+
await Bun.write(profilePath, profileContent + lolaFunction);
|
|
2546
|
+
console.log(import_picocolors7.default.green(` Funcao lola adicionada ao ${name} profile`));
|
|
2547
|
+
addedToAny = true;
|
|
2548
|
+
}
|
|
2535
2549
|
}
|
|
2536
|
-
if (
|
|
2537
|
-
await Bun.write(psProfile, profileContent + lolaFunction);
|
|
2538
|
-
console.log(import_picocolors7.default.green(" Funcao lola adicionada ao PowerShell profile"));
|
|
2550
|
+
if (addedToAny) {
|
|
2539
2551
|
console.log(import_picocolors7.default.yellow(" Reinicie o PowerShell para usar o comando 'lola'"));
|
|
2552
|
+
console.log();
|
|
2553
|
+
console.log(import_picocolors7.default.yellow(" IMPORTANTE (Windows):"));
|
|
2554
|
+
console.log(import_picocolors7.default.dim(" Se o comando 'lola' nao funcionar, execute primeiro:"));
|
|
2555
|
+
console.log(import_picocolors7.default.cyan(" Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser"));
|
|
2556
|
+
console.log(import_picocolors7.default.dim(" Isso habilita execucao de scripts no PowerShell."));
|
|
2540
2557
|
} else {
|
|
2541
|
-
console.log(import_picocolors7.default.green(" Funcao lola ja existe
|
|
2558
|
+
console.log(import_picocolors7.default.green(" Funcao lola ja existe nos profiles do PowerShell"));
|
|
2542
2559
|
}
|
|
2543
2560
|
} else {
|
|
2544
2561
|
const binDir = join3(HOME, ".local", "bin");
|
package/package.json
CHANGED
package/src/commands/lola.ts
CHANGED
|
@@ -59,8 +59,10 @@ async function installLola(): Promise<void> {
|
|
|
59
59
|
|
|
60
60
|
if (isWindows) {
|
|
61
61
|
// Windows: adicionar função ao PowerShell profile
|
|
62
|
-
|
|
63
|
-
const
|
|
62
|
+
// PowerShell 5.x usa WindowsPowerShell, PowerShell 7+ usa PowerShell
|
|
63
|
+
const ps5ProfileDir = join(HOME, "Documents", "WindowsPowerShell")
|
|
64
|
+
const ps7ProfileDir = join(HOME, "Documents", "PowerShell")
|
|
65
|
+
const profileName = "Microsoft.PowerShell_profile.ps1"
|
|
64
66
|
|
|
65
67
|
const lolaFunction = `
|
|
66
68
|
# Lola - Code Agent da nimbuslab
|
|
@@ -75,23 +77,44 @@ function lola {
|
|
|
75
77
|
}
|
|
76
78
|
`
|
|
77
79
|
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
// Adicionar função em ambos os profiles (PS 5.x e 7+)
|
|
81
|
+
const profiles = [
|
|
82
|
+
{ dir: ps5ProfileDir, name: "PowerShell 5.x" },
|
|
83
|
+
{ dir: ps7ProfileDir, name: "PowerShell 7+" },
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
let addedToAny = false
|
|
87
|
+
|
|
88
|
+
for (const { dir, name } of profiles) {
|
|
89
|
+
const profilePath = join(dir, profileName)
|
|
90
|
+
|
|
91
|
+
// Criar diretório se não existir
|
|
92
|
+
if (!existsSync(dir)) {
|
|
93
|
+
await Bun.$`mkdir -p ${dir}`
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Verificar se já tem a função no profile
|
|
97
|
+
let profileContent = ""
|
|
98
|
+
if (existsSync(profilePath)) {
|
|
99
|
+
profileContent = await Bun.file(profilePath).text()
|
|
100
|
+
}
|
|
82
101
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
if (!profileContent.includes("function lola")) {
|
|
103
|
+
await Bun.write(profilePath, profileContent + lolaFunction)
|
|
104
|
+
console.log(pc.green(` Funcao lola adicionada ao ${name} profile`))
|
|
105
|
+
addedToAny = true
|
|
106
|
+
}
|
|
87
107
|
}
|
|
88
108
|
|
|
89
|
-
if (
|
|
90
|
-
await Bun.write(psProfile, profileContent + lolaFunction)
|
|
91
|
-
console.log(pc.green(" Funcao lola adicionada ao PowerShell profile"))
|
|
109
|
+
if (addedToAny) {
|
|
92
110
|
console.log(pc.yellow(" Reinicie o PowerShell para usar o comando 'lola'"))
|
|
111
|
+
console.log()
|
|
112
|
+
console.log(pc.yellow(" IMPORTANTE (Windows):"))
|
|
113
|
+
console.log(pc.dim(" Se o comando 'lola' nao funcionar, execute primeiro:"))
|
|
114
|
+
console.log(pc.cyan(" Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser"))
|
|
115
|
+
console.log(pc.dim(" Isso habilita execucao de scripts no PowerShell."))
|
|
93
116
|
} else {
|
|
94
|
-
console.log(pc.green(" Funcao lola ja existe
|
|
117
|
+
console.log(pc.green(" Funcao lola ja existe nos profiles do PowerShell"))
|
|
95
118
|
}
|
|
96
119
|
} else {
|
|
97
120
|
// Linux/macOS: criar script em ~/.local/bin
|