@nimbuslab/cli 0.15.0 → 0.16.1
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 +399 -195
- package/package.json +1 -1
- package/src/commands/lola.ts +476 -196
- package/src/commands/update.ts +27 -26
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.
|
|
153
|
+
version: "0.16.1",
|
|
154
154
|
description: "CLI para criar projetos nimbuslab",
|
|
155
155
|
type: "module",
|
|
156
156
|
bin: {
|
|
@@ -2383,16 +2383,6 @@ async function getLatestVersion() {
|
|
|
2383
2383
|
}
|
|
2384
2384
|
}
|
|
2385
2385
|
function detectPackageManager2() {
|
|
2386
|
-
try {
|
|
2387
|
-
const bunResult = spawnSync("bun", ["pm", "ls", "-g"], {
|
|
2388
|
-
encoding: "utf-8",
|
|
2389
|
-
shell: true,
|
|
2390
|
-
timeout: 5000
|
|
2391
|
-
});
|
|
2392
|
-
if (bunResult.stdout && bunResult.stdout.includes(PACKAGE_NAME)) {
|
|
2393
|
-
return "bun";
|
|
2394
|
-
}
|
|
2395
|
-
} catch {}
|
|
2396
2386
|
try {
|
|
2397
2387
|
const npmResult = spawnSync("npm", ["ls", "-g", PACKAGE_NAME, "--json"], {
|
|
2398
2388
|
encoding: "utf-8",
|
|
@@ -2406,22 +2396,19 @@ function detectPackageManager2() {
|
|
|
2406
2396
|
}
|
|
2407
2397
|
}
|
|
2408
2398
|
} catch {}
|
|
2409
|
-
return "unknown";
|
|
2410
|
-
}
|
|
2411
|
-
function getCurrentVersion() {
|
|
2412
2399
|
try {
|
|
2413
2400
|
const bunResult = spawnSync("bun", ["pm", "ls", "-g"], {
|
|
2414
2401
|
encoding: "utf-8",
|
|
2415
2402
|
shell: true,
|
|
2416
2403
|
timeout: 5000
|
|
2417
2404
|
});
|
|
2418
|
-
if (bunResult.stdout) {
|
|
2419
|
-
|
|
2420
|
-
if (match?.[1]) {
|
|
2421
|
-
return match[1];
|
|
2422
|
-
}
|
|
2405
|
+
if (bunResult.stdout && bunResult.stdout.includes(PACKAGE_NAME)) {
|
|
2406
|
+
return "bun";
|
|
2423
2407
|
}
|
|
2424
2408
|
} catch {}
|
|
2409
|
+
return "unknown";
|
|
2410
|
+
}
|
|
2411
|
+
function getCurrentVersion() {
|
|
2425
2412
|
try {
|
|
2426
2413
|
const result = spawnSync("npm", ["ls", "-g", PACKAGE_NAME, "--json"], {
|
|
2427
2414
|
encoding: "utf-8",
|
|
@@ -2435,6 +2422,19 @@ function getCurrentVersion() {
|
|
|
2435
2422
|
}
|
|
2436
2423
|
}
|
|
2437
2424
|
} catch {}
|
|
2425
|
+
try {
|
|
2426
|
+
const bunResult = spawnSync("bun", ["pm", "ls", "-g"], {
|
|
2427
|
+
encoding: "utf-8",
|
|
2428
|
+
shell: true,
|
|
2429
|
+
timeout: 5000
|
|
2430
|
+
});
|
|
2431
|
+
if (bunResult.stdout) {
|
|
2432
|
+
const match = bunResult.stdout.match(new RegExp(`${PACKAGE_NAME.replace("/", "\\/")}@([\\d.]+)`));
|
|
2433
|
+
if (match?.[1]) {
|
|
2434
|
+
return match[1];
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
} catch {}
|
|
2438
2438
|
return "unknown";
|
|
2439
2439
|
}
|
|
2440
2440
|
async function update(args) {
|
|
@@ -2475,7 +2475,7 @@ async function update(args) {
|
|
|
2475
2475
|
const spinner = Y2();
|
|
2476
2476
|
spinner.start("Detectando package manager...");
|
|
2477
2477
|
const detectedPm = detectPackageManager2();
|
|
2478
|
-
const pm = detectedPm === "unknown" ? "
|
|
2478
|
+
const pm = detectedPm === "unknown" ? "npm" : detectedPm;
|
|
2479
2479
|
spinner.stop(`Package manager: ${pm}${detectedPm === "unknown" ? " (padrao)" : ""}`);
|
|
2480
2480
|
spinner.start("Verificando versao atual...");
|
|
2481
2481
|
const currentVersion = getCurrentVersion();
|
|
@@ -2551,6 +2551,16 @@ var LOLA_REPO = "git@github.com:nimbuslab/lola.git";
|
|
|
2551
2551
|
var USER_MEMORY = join3(HOME, ".claude", "USER_MEMORY.md");
|
|
2552
2552
|
var LOLA_MEMORY_URL = "https://lola.nimbuslab.com.br/sse";
|
|
2553
2553
|
var LOLA_MEMORY_NAME = "lola-memory";
|
|
2554
|
+
var GEMINI_DIR = join3(HOME, ".gemini");
|
|
2555
|
+
var GEMINI_SETTINGS = join3(GEMINI_DIR, "GEMINI.md");
|
|
2556
|
+
function hasClaudeCLI() {
|
|
2557
|
+
const result = Bun.spawnSync(["which", "claude"], { stdout: "pipe" });
|
|
2558
|
+
return result.exitCode === 0;
|
|
2559
|
+
}
|
|
2560
|
+
function hasGeminiCLI() {
|
|
2561
|
+
const result = Bun.spawnSync(["which", "gemini"], { stdout: "pipe" });
|
|
2562
|
+
return result.exitCode === 0;
|
|
2563
|
+
}
|
|
2554
2564
|
async function installLolaMemoryMCP() {
|
|
2555
2565
|
console.log();
|
|
2556
2566
|
console.log(import_picocolors7.default.cyan(" Configurando lola-memory MCP..."));
|
|
@@ -2596,210 +2606,147 @@ async function installLolaMemoryMCP() {
|
|
|
2596
2606
|
console.log(import_picocolors7.default.dim(' learn "content" - Salvar conhecimento'));
|
|
2597
2607
|
console.log(import_picocolors7.default.dim(" memory_stats - Ver estatisticas"));
|
|
2598
2608
|
}
|
|
2599
|
-
async function
|
|
2609
|
+
async function installGeminiCLI() {
|
|
2600
2610
|
console.log();
|
|
2601
|
-
console.log(import_picocolors7.default.cyan("
|
|
2602
|
-
|
|
2611
|
+
console.log(import_picocolors7.default.cyan(" Instalando Gemini CLI..."));
|
|
2612
|
+
const result = Bun.spawnSync(["npm", "install", "-g", "@google/gemini-cli"], {
|
|
2613
|
+
stdout: "inherit",
|
|
2614
|
+
stderr: "inherit"
|
|
2615
|
+
});
|
|
2616
|
+
if (result.exitCode !== 0) {
|
|
2617
|
+
console.log(import_picocolors7.default.red(" Erro ao instalar Gemini CLI"));
|
|
2618
|
+
console.log(import_picocolors7.default.dim(" Tente manualmente: npm install -g @google/gemini-cli"));
|
|
2619
|
+
return false;
|
|
2620
|
+
}
|
|
2621
|
+
console.log(import_picocolors7.default.green(" Gemini CLI instalado!"));
|
|
2622
|
+
return true;
|
|
2623
|
+
}
|
|
2624
|
+
async function installGeminiMCP() {
|
|
2603
2625
|
console.log();
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
if (stashPop.exitCode !== 0) {
|
|
2634
|
-
console.log(import_picocolors7.default.yellow(" Aviso: conflito ao restaurar mudancas locais"));
|
|
2635
|
-
console.log(import_picocolors7.default.dim(" Verifique ~/.lola e resolva manualmente: git stash pop"));
|
|
2636
|
-
}
|
|
2637
|
-
}
|
|
2638
|
-
if (result.exitCode !== 0) {
|
|
2639
|
-
console.log(import_picocolors7.default.red(" Erro ao atualizar Lola"));
|
|
2640
|
-
process.exit(1);
|
|
2641
|
-
}
|
|
2642
|
-
console.log(import_picocolors7.default.green(" Atualizado!"));
|
|
2643
|
-
} else {
|
|
2644
|
-
console.log(import_picocolors7.default.cyan(` Instalando Lola em ${LOLA_DIR}...`));
|
|
2645
|
-
const result = Bun.spawnSync(["git", "clone", "--quiet", LOLA_REPO, LOLA_DIR], {
|
|
2646
|
-
stdout: "inherit",
|
|
2647
|
-
stderr: "inherit"
|
|
2648
|
-
});
|
|
2649
|
-
if (result.exitCode !== 0) {
|
|
2650
|
-
console.log(import_picocolors7.default.red(" Erro ao clonar repositorio"));
|
|
2651
|
-
console.log(import_picocolors7.default.dim(" Verifique se tem acesso ao repo nimbuslab/lola"));
|
|
2652
|
-
process.exit(1);
|
|
2653
|
-
}
|
|
2654
|
-
console.log(import_picocolors7.default.green(" Instalado!"));
|
|
2626
|
+
console.log(import_picocolors7.default.cyan(" Configurando MCP no Gemini..."));
|
|
2627
|
+
const settingsPath = join3(GEMINI_DIR, "settings.json");
|
|
2628
|
+
if (!existsSync2(GEMINI_DIR)) {
|
|
2629
|
+
await Bun.$`mkdir -p ${GEMINI_DIR}`;
|
|
2630
|
+
}
|
|
2631
|
+
let settings = {};
|
|
2632
|
+
if (existsSync2(settingsPath)) {
|
|
2633
|
+
try {
|
|
2634
|
+
const content = await Bun.file(settingsPath).text();
|
|
2635
|
+
settings = JSON.parse(content);
|
|
2636
|
+
} catch {}
|
|
2637
|
+
}
|
|
2638
|
+
const mcpServers = settings.mcpServers || {};
|
|
2639
|
+
if (mcpServers[LOLA_MEMORY_NAME]) {
|
|
2640
|
+
console.log(import_picocolors7.default.green(" MCP lola-memory ja configurado no Gemini"));
|
|
2641
|
+
return;
|
|
2642
|
+
}
|
|
2643
|
+
mcpServers[LOLA_MEMORY_NAME] = {
|
|
2644
|
+
url: LOLA_MEMORY_URL
|
|
2645
|
+
};
|
|
2646
|
+
settings.mcpServers = mcpServers;
|
|
2647
|
+
await Bun.write(settingsPath, JSON.stringify(settings, null, 2));
|
|
2648
|
+
console.log(import_picocolors7.default.green(" MCP lola-memory adicionado ao Gemini!"));
|
|
2649
|
+
}
|
|
2650
|
+
async function installGeminiSystemPrompt() {
|
|
2651
|
+
console.log();
|
|
2652
|
+
console.log(import_picocolors7.default.cyan(" Configurando GEMINI.md..."));
|
|
2653
|
+
if (!existsSync2(GEMINI_DIR)) {
|
|
2654
|
+
await Bun.$`mkdir -p ${GEMINI_DIR}`;
|
|
2655
2655
|
}
|
|
2656
|
-
const isWindows = process.platform === "win32";
|
|
2657
2656
|
const lolaAgent = join3(LOLA_DIR, "agents", "claude.md");
|
|
2657
|
+
if (!existsSync2(lolaAgent)) {
|
|
2658
|
+
console.log(import_picocolors7.default.yellow(" Agent Lola nao encontrado"));
|
|
2659
|
+
console.log(import_picocolors7.default.dim(" Rode 'nimbus lola install' primeiro"));
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
let content = await Bun.file(lolaAgent).text();
|
|
2663
|
+
content = content.replace(/^---[\s\S]*?---\n/, "");
|
|
2664
|
+
content = content.replace(/Claude Code/g, "Gemini CLI");
|
|
2665
|
+
content = content.replace(/Claude CLI/g, "Gemini CLI");
|
|
2666
|
+
const geminiContent = `# Lola - Code Agent (Gemini)
|
|
2667
|
+
|
|
2668
|
+
> Este arquivo configura a Lola para o Gemini CLI
|
|
2669
|
+
> Gerado automaticamente por: nimbus lola install
|
|
2670
|
+
|
|
2671
|
+
---
|
|
2672
|
+
|
|
2673
|
+
${content}`;
|
|
2674
|
+
await Bun.write(GEMINI_SETTINGS, geminiContent);
|
|
2675
|
+
console.log(import_picocolors7.default.green(" GEMINI.md criado!"));
|
|
2676
|
+
}
|
|
2677
|
+
async function createGeminiCommand() {
|
|
2678
|
+
const isWindows = process.platform === "win32";
|
|
2679
|
+
const lolaAgent = GEMINI_SETTINGS;
|
|
2658
2680
|
console.log();
|
|
2659
|
-
console.log(import_picocolors7.default.cyan(" Configurando comando lola..."));
|
|
2681
|
+
console.log(import_picocolors7.default.cyan(" Configurando comando lola-gemini..."));
|
|
2660
2682
|
if (isWindows) {
|
|
2661
|
-
const ps5ProfileDir = join3(HOME, "Documents", "WindowsPowerShell");
|
|
2662
2683
|
const ps7ProfileDir = join3(HOME, "Documents", "PowerShell");
|
|
2663
2684
|
const profileName = "Microsoft.PowerShell_profile.ps1";
|
|
2664
|
-
const
|
|
2665
|
-
|
|
2666
|
-
|
|
2685
|
+
const profilePath = join3(ps7ProfileDir, profileName);
|
|
2686
|
+
const lolaGeminiFunction = `
|
|
2687
|
+
# Lola (Gemini) - Code Agent da nimbuslab
|
|
2688
|
+
function lola-gemini {
|
|
2667
2689
|
param([Parameter(ValueFromRemainingArguments=$true)]$args)
|
|
2668
|
-
|
|
2669
|
-
if (Test-Path $agent) {
|
|
2670
|
-
claude --append-system-prompt-file $agent @args
|
|
2671
|
-
} else {
|
|
2672
|
-
Write-Host "Agente Lola nao encontrado. Rode: nimbus lola install"
|
|
2673
|
-
}
|
|
2690
|
+
gemini @args
|
|
2674
2691
|
}
|
|
2675
2692
|
`;
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
{ dir: ps7ProfileDir, name: "PowerShell 7+" }
|
|
2679
|
-
];
|
|
2680
|
-
let addedToAny = false;
|
|
2681
|
-
for (const { dir, name } of profiles) {
|
|
2682
|
-
const profilePath = join3(dir, profileName);
|
|
2683
|
-
if (!existsSync2(dir)) {
|
|
2684
|
-
await Bun.$`mkdir -p ${dir}`;
|
|
2685
|
-
}
|
|
2686
|
-
let profileContent = "";
|
|
2687
|
-
if (existsSync2(profilePath)) {
|
|
2688
|
-
profileContent = await Bun.file(profilePath).text();
|
|
2689
|
-
}
|
|
2690
|
-
if (!profileContent.includes("function lola")) {
|
|
2691
|
-
await Bun.write(profilePath, profileContent + lolaFunction);
|
|
2692
|
-
console.log(import_picocolors7.default.green(` Funcao lola adicionada ao ${name} profile`));
|
|
2693
|
-
addedToAny = true;
|
|
2694
|
-
}
|
|
2693
|
+
if (!existsSync2(ps7ProfileDir)) {
|
|
2694
|
+
await Bun.$`mkdir -p ${ps7ProfileDir}`;
|
|
2695
2695
|
}
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
console.log(import_picocolors7.default.
|
|
2696
|
+
let profileContent = "";
|
|
2697
|
+
if (existsSync2(profilePath)) {
|
|
2698
|
+
profileContent = await Bun.file(profilePath).text();
|
|
2699
|
+
}
|
|
2700
|
+
if (!profileContent.includes("function lola-gemini")) {
|
|
2701
|
+
await Bun.write(profilePath, profileContent + lolaGeminiFunction);
|
|
2702
|
+
console.log(import_picocolors7.default.green(" Funcao lola-gemini adicionada ao PowerShell"));
|
|
2703
2703
|
} else {
|
|
2704
|
-
console.log(import_picocolors7.default.green(" Funcao lola ja existe
|
|
2704
|
+
console.log(import_picocolors7.default.green(" Funcao lola-gemini ja existe"));
|
|
2705
2705
|
}
|
|
2706
2706
|
} else {
|
|
2707
2707
|
const binDir = join3(HOME, ".local", "bin");
|
|
2708
|
-
const
|
|
2709
|
-
if (!existsSync2(
|
|
2708
|
+
const lolaGeminiScript = join3(binDir, "lola-gemini");
|
|
2709
|
+
if (!existsSync2(lolaGeminiScript)) {
|
|
2710
2710
|
await Bun.$`mkdir -p ${binDir}`;
|
|
2711
2711
|
const unixScript = `#!/bin/bash
|
|
2712
|
-
# lola - Code Agent da nimbuslab
|
|
2713
|
-
LOLA_AGENT="${lolaAgent}"
|
|
2712
|
+
# lola-gemini - Code Agent da nimbuslab (Gemini)
|
|
2714
2713
|
|
|
2715
2714
|
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
|
2716
|
-
echo "lola - Code Agent da nimbuslab"
|
|
2717
|
-
echo "Uso: lola [args]"
|
|
2718
|
-
echo " lola
|
|
2719
|
-
echo " lola --resume Resume sessao anterior"
|
|
2715
|
+
echo "lola-gemini - Code Agent da nimbuslab (Gemini)"
|
|
2716
|
+
echo "Uso: lola-gemini [args]"
|
|
2717
|
+
echo " lola-gemini Abre Gemini CLI com a Lola"
|
|
2720
2718
|
exit 0
|
|
2721
2719
|
fi
|
|
2722
2720
|
|
|
2723
|
-
|
|
2724
|
-
exec claude --append-system-prompt-file "$LOLA_AGENT" "$@"
|
|
2725
|
-
else
|
|
2726
|
-
echo "Agente Lola nao encontrado: $LOLA_AGENT"
|
|
2727
|
-
echo "Rode: nimbus lola install"
|
|
2728
|
-
exit 1
|
|
2729
|
-
fi
|
|
2721
|
+
exec gemini "$@"
|
|
2730
2722
|
`;
|
|
2731
|
-
await Bun.write(
|
|
2732
|
-
await Bun.$`chmod +x ${
|
|
2733
|
-
console.log(import_picocolors7.default.green(` Script lola criado em ${
|
|
2734
|
-
const pathEnv = process.env.PATH || "";
|
|
2735
|
-
if (!pathEnv.includes(".local/bin")) {
|
|
2736
|
-
console.log();
|
|
2737
|
-
console.log(import_picocolors7.default.yellow(" IMPORTANTE: Adicione ~/.local/bin ao seu PATH"));
|
|
2738
|
-
console.log(import_picocolors7.default.dim(" Adicione ao seu ~/.bashrc ou ~/.zshrc:"));
|
|
2739
|
-
console.log(import_picocolors7.default.dim(' export PATH="$HOME/.local/bin:$PATH"'));
|
|
2740
|
-
}
|
|
2723
|
+
await Bun.write(lolaGeminiScript, unixScript);
|
|
2724
|
+
await Bun.$`chmod +x ${lolaGeminiScript}`;
|
|
2725
|
+
console.log(import_picocolors7.default.green(` Script lola-gemini criado em ${lolaGeminiScript}`));
|
|
2741
2726
|
} else {
|
|
2742
|
-
console.log(import_picocolors7.default.green(" Script lola ja existe"));
|
|
2727
|
+
console.log(import_picocolors7.default.green(" Script lola-gemini ja existe"));
|
|
2743
2728
|
}
|
|
2744
2729
|
}
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
if (!
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
const gitEmail = gitEmailResult.stdout.toString().trim() || "";
|
|
2754
|
-
const hostname = process.env.HOSTNAME || process.env.COMPUTERNAME || "local";
|
|
2755
|
-
const today = new Date().toISOString().split("T")[0];
|
|
2756
|
-
await Bun.$`mkdir -p ${claudeDir}`;
|
|
2757
|
-
const content = `# User Memory
|
|
2758
|
-
|
|
2759
|
-
Memoria persistente para sessoes Claude Code
|
|
2760
|
-
|
|
2761
|
-
---
|
|
2762
|
-
|
|
2763
|
-
## Dev
|
|
2764
|
-
|
|
2765
|
-
**Nome:** ${gitUser}
|
|
2766
|
-
**Email:** ${gitEmail}
|
|
2767
|
-
**Maquina:** ${hostname}
|
|
2768
|
-
**Instalacao:** ${today}
|
|
2769
|
-
|
|
2770
|
-
---
|
|
2771
|
-
|
|
2772
|
-
## Configuracoes da Lola
|
|
2773
|
-
|
|
2774
|
-
\`\`\`
|
|
2775
|
-
lola_profile: millennial
|
|
2776
|
-
\`\`\`
|
|
2777
|
-
|
|
2778
|
-
---
|
|
2779
|
-
|
|
2780
|
-
## Ultima Sessao
|
|
2781
|
-
|
|
2782
|
-
(sera preenchido automaticamente)
|
|
2783
|
-
|
|
2784
|
-
---
|
|
2785
|
-
`;
|
|
2786
|
-
await Bun.write(USER_MEMORY, content);
|
|
2787
|
-
console.log(import_picocolors7.default.green(` USER_MEMORY.md criado para ${gitUser}!`));
|
|
2730
|
+
}
|
|
2731
|
+
async function setupGemini() {
|
|
2732
|
+
if (!hasGeminiCLI()) {
|
|
2733
|
+
const installed = await installGeminiCLI();
|
|
2734
|
+
if (!installed)
|
|
2735
|
+
return;
|
|
2736
|
+
} else {
|
|
2737
|
+
console.log(import_picocolors7.default.green(" Gemini CLI ja instalado"));
|
|
2788
2738
|
}
|
|
2739
|
+
await installGeminiMCP();
|
|
2740
|
+
await installGeminiSystemPrompt();
|
|
2741
|
+
await createGeminiCommand();
|
|
2789
2742
|
console.log();
|
|
2790
|
-
console.log(import_picocolors7.default.green("
|
|
2791
|
-
console.log();
|
|
2792
|
-
console.log(import_picocolors7.default.bold(" Para usar a Lola:"));
|
|
2793
|
-
console.log(import_picocolors7.default.dim(" lola ") + import_picocolors7.default.white("# Iniciar sessao"));
|
|
2743
|
+
console.log(import_picocolors7.default.green(" Gemini configurado!"));
|
|
2794
2744
|
console.log();
|
|
2795
|
-
console.log(import_picocolors7.default.bold("
|
|
2796
|
-
console.log(import_picocolors7.default.dim(
|
|
2797
|
-
console.log(import_picocolors7.default.dim(
|
|
2798
|
-
console.log(import_picocolors7.default.dim(" memory_stats ") + import_picocolors7.default.white("# Ver estatisticas"));
|
|
2799
|
-
console.log();
|
|
2800
|
-
console.log(import_picocolors7.default.bold(" Para mudar perfil, edite ~/.claude/USER_MEMORY.md:"));
|
|
2801
|
-
console.log(import_picocolors7.default.dim(" lola_profile: millennial|genz|profissional|nerd|chill"));
|
|
2745
|
+
console.log(import_picocolors7.default.bold(" Para usar:"));
|
|
2746
|
+
console.log(import_picocolors7.default.dim(" lola-gemini ") + import_picocolors7.default.white("# Iniciar sessao com Gemini"));
|
|
2747
|
+
console.log(import_picocolors7.default.dim(" gemini ") + import_picocolors7.default.white("# Gemini puro (sem Lola)"));
|
|
2802
2748
|
console.log();
|
|
2749
|
+
console.log(import_picocolors7.default.dim(" Na primeira execucao, faca login com sua conta Google."));
|
|
2803
2750
|
}
|
|
2804
2751
|
async function suggestImprovement(message) {
|
|
2805
2752
|
if (!message) {
|
|
@@ -2901,7 +2848,7 @@ async function onboardDev() {
|
|
|
2901
2848
|
if (!existsSync2(LOLA_DIR)) {
|
|
2902
2849
|
console.log(import_picocolors7.default.yellow(" Lola nao instalada. Instalando primeiro..."));
|
|
2903
2850
|
console.log();
|
|
2904
|
-
await
|
|
2851
|
+
await installLolaBase();
|
|
2905
2852
|
console.log();
|
|
2906
2853
|
}
|
|
2907
2854
|
const gitUser = Bun.spawnSync(["git", "config", "user.name"], { stdout: "pipe" });
|
|
@@ -3121,10 +3068,267 @@ async function runQuiz() {
|
|
|
3121
3068
|
}
|
|
3122
3069
|
console.log();
|
|
3123
3070
|
}
|
|
3071
|
+
async function installInteractive() {
|
|
3072
|
+
console.log();
|
|
3073
|
+
console.log(import_picocolors7.default.cyan(" Lola - Code Agent da nimbuslab"));
|
|
3074
|
+
console.log(import_picocolors7.default.dim(" ==============================="));
|
|
3075
|
+
console.log();
|
|
3076
|
+
const hasClaude = hasClaudeCLI();
|
|
3077
|
+
const hasGemini = hasGeminiCLI();
|
|
3078
|
+
console.log(import_picocolors7.default.dim(" Detectando agents..."));
|
|
3079
|
+
console.log(import_picocolors7.default.dim(` Claude CLI: ${hasClaude ? import_picocolors7.default.green("instalado") : import_picocolors7.default.yellow("nao encontrado")}`));
|
|
3080
|
+
console.log(import_picocolors7.default.dim(` Gemini CLI: ${hasGemini ? import_picocolors7.default.green("instalado") : import_picocolors7.default.yellow("nao encontrado")}`));
|
|
3081
|
+
console.log();
|
|
3082
|
+
const agentChoice = await ve({
|
|
3083
|
+
message: "Qual agent deseja configurar?",
|
|
3084
|
+
options: [
|
|
3085
|
+
{
|
|
3086
|
+
value: "all",
|
|
3087
|
+
label: "Todos (Recomendado)",
|
|
3088
|
+
hint: "Configura Claude e Gemini"
|
|
3089
|
+
},
|
|
3090
|
+
{
|
|
3091
|
+
value: "claude",
|
|
3092
|
+
label: "Apenas Claude",
|
|
3093
|
+
hint: hasClaude ? "Ja instalado" : "Sera instalado"
|
|
3094
|
+
},
|
|
3095
|
+
{
|
|
3096
|
+
value: "gemini",
|
|
3097
|
+
label: "Apenas Gemini",
|
|
3098
|
+
hint: hasGemini ? "Ja instalado" : "Sera instalado"
|
|
3099
|
+
}
|
|
3100
|
+
]
|
|
3101
|
+
});
|
|
3102
|
+
if (pD(agentChoice)) {
|
|
3103
|
+
xe("Instalacao cancelada");
|
|
3104
|
+
process.exit(0);
|
|
3105
|
+
}
|
|
3106
|
+
const choice = agentChoice;
|
|
3107
|
+
await installLolaBase();
|
|
3108
|
+
if (choice === "claude" || choice === "all") {
|
|
3109
|
+
console.log();
|
|
3110
|
+
console.log(import_picocolors7.default.bgBlue(import_picocolors7.default.white(" CLAUDE ")));
|
|
3111
|
+
await setupClaude();
|
|
3112
|
+
}
|
|
3113
|
+
if (choice === "gemini" || choice === "all") {
|
|
3114
|
+
console.log();
|
|
3115
|
+
console.log(import_picocolors7.default.bgMagenta(import_picocolors7.default.white(" GEMINI ")));
|
|
3116
|
+
await setupGemini();
|
|
3117
|
+
}
|
|
3118
|
+
console.log();
|
|
3119
|
+
console.log(import_picocolors7.default.green(" ==============================="));
|
|
3120
|
+
console.log(import_picocolors7.default.green(" Instalacao concluida!"));
|
|
3121
|
+
console.log(import_picocolors7.default.green(" ==============================="));
|
|
3122
|
+
console.log();
|
|
3123
|
+
if (choice === "claude" || choice === "all") {
|
|
3124
|
+
console.log(import_picocolors7.default.dim(" lola ") + import_picocolors7.default.white("# Claude com Lola"));
|
|
3125
|
+
}
|
|
3126
|
+
if (choice === "gemini" || choice === "all") {
|
|
3127
|
+
console.log(import_picocolors7.default.dim(" lola-gemini ") + import_picocolors7.default.white("# Gemini com Lola"));
|
|
3128
|
+
}
|
|
3129
|
+
console.log();
|
|
3130
|
+
console.log(import_picocolors7.default.bold(" lola-memory (compartilhado entre agents):"));
|
|
3131
|
+
console.log(import_picocolors7.default.dim(" remember, learn, memory_stats"));
|
|
3132
|
+
console.log();
|
|
3133
|
+
}
|
|
3134
|
+
async function installLolaBase() {
|
|
3135
|
+
console.log();
|
|
3136
|
+
console.log(import_picocolors7.default.cyan(" Instalando base Lola (~/.lola)..."));
|
|
3137
|
+
const isUpdate = existsSync2(LOLA_DIR);
|
|
3138
|
+
if (isUpdate) {
|
|
3139
|
+
console.log(import_picocolors7.default.dim(` Lola ja instalada em ${LOLA_DIR}`));
|
|
3140
|
+
console.log(import_picocolors7.default.dim(" Atualizando..."));
|
|
3141
|
+
const statusCheck = Bun.spawnSync(["git", "status", "--porcelain"], {
|
|
3142
|
+
cwd: LOLA_DIR,
|
|
3143
|
+
stdout: "pipe"
|
|
3144
|
+
});
|
|
3145
|
+
const hasLocalChanges = statusCheck.stdout.toString().trim().length > 0;
|
|
3146
|
+
if (hasLocalChanges) {
|
|
3147
|
+
console.log(import_picocolors7.default.dim(" Salvando mudancas locais..."));
|
|
3148
|
+
Bun.spawnSync(["git", "stash", "--quiet"], {
|
|
3149
|
+
cwd: LOLA_DIR,
|
|
3150
|
+
stdout: "pipe",
|
|
3151
|
+
stderr: "pipe"
|
|
3152
|
+
});
|
|
3153
|
+
}
|
|
3154
|
+
const result = Bun.spawnSync(["git", "pull", "--quiet"], {
|
|
3155
|
+
cwd: LOLA_DIR,
|
|
3156
|
+
stdout: "inherit",
|
|
3157
|
+
stderr: "inherit"
|
|
3158
|
+
});
|
|
3159
|
+
if (hasLocalChanges) {
|
|
3160
|
+
console.log(import_picocolors7.default.dim(" Restaurando mudancas locais..."));
|
|
3161
|
+
const stashPop = Bun.spawnSync(["git", "stash", "pop", "--quiet"], {
|
|
3162
|
+
cwd: LOLA_DIR,
|
|
3163
|
+
stdout: "pipe",
|
|
3164
|
+
stderr: "pipe"
|
|
3165
|
+
});
|
|
3166
|
+
if (stashPop.exitCode !== 0) {
|
|
3167
|
+
console.log(import_picocolors7.default.yellow(" Aviso: conflito ao restaurar mudancas locais"));
|
|
3168
|
+
console.log(import_picocolors7.default.dim(" Verifique ~/.lola e resolva manualmente: git stash pop"));
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
if (result.exitCode !== 0) {
|
|
3172
|
+
console.log(import_picocolors7.default.red(" Erro ao atualizar Lola"));
|
|
3173
|
+
process.exit(1);
|
|
3174
|
+
}
|
|
3175
|
+
console.log(import_picocolors7.default.green(" Atualizado!"));
|
|
3176
|
+
} else {
|
|
3177
|
+
console.log(import_picocolors7.default.dim(` Clonando em ${LOLA_DIR}...`));
|
|
3178
|
+
const result = Bun.spawnSync(["git", "clone", "--quiet", LOLA_REPO, LOLA_DIR], {
|
|
3179
|
+
stdout: "inherit",
|
|
3180
|
+
stderr: "inherit"
|
|
3181
|
+
});
|
|
3182
|
+
if (result.exitCode !== 0) {
|
|
3183
|
+
console.log(import_picocolors7.default.red(" Erro ao clonar repositorio"));
|
|
3184
|
+
console.log(import_picocolors7.default.dim(" Verifique se tem acesso ao repo nimbuslab/lola"));
|
|
3185
|
+
process.exit(1);
|
|
3186
|
+
}
|
|
3187
|
+
console.log(import_picocolors7.default.green(" Instalado!"));
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
async function setupClaude() {
|
|
3191
|
+
if (!hasClaudeCLI()) {
|
|
3192
|
+
console.log(import_picocolors7.default.yellow(" Claude CLI nao encontrado"));
|
|
3193
|
+
console.log(import_picocolors7.default.dim(" Instale: https://claude.ai/download"));
|
|
3194
|
+
console.log(import_picocolors7.default.dim(" Depois rode 'nimbus lola install' novamente"));
|
|
3195
|
+
return;
|
|
3196
|
+
}
|
|
3197
|
+
console.log(import_picocolors7.default.green(" Claude CLI encontrado"));
|
|
3198
|
+
const isWindows = process.platform === "win32";
|
|
3199
|
+
const lolaAgent = join3(LOLA_DIR, "agents", "claude.md");
|
|
3200
|
+
console.log();
|
|
3201
|
+
console.log(import_picocolors7.default.cyan(" Configurando comando lola..."));
|
|
3202
|
+
if (isWindows) {
|
|
3203
|
+
const ps5ProfileDir = join3(HOME, "Documents", "WindowsPowerShell");
|
|
3204
|
+
const ps7ProfileDir = join3(HOME, "Documents", "PowerShell");
|
|
3205
|
+
const profileName = "Microsoft.PowerShell_profile.ps1";
|
|
3206
|
+
const lolaFunction = `
|
|
3207
|
+
# Lola - Code Agent da nimbuslab
|
|
3208
|
+
function lola {
|
|
3209
|
+
param([Parameter(ValueFromRemainingArguments=$true)]$args)
|
|
3210
|
+
$agent = "$env:USERPROFILE\\.lola\\agents\\claude.md"
|
|
3211
|
+
if (Test-Path $agent) {
|
|
3212
|
+
claude --append-system-prompt-file $agent @args
|
|
3213
|
+
} else {
|
|
3214
|
+
Write-Host "Agente Lola nao encontrado. Rode: nimbus lola install"
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
`;
|
|
3218
|
+
const profiles = [
|
|
3219
|
+
{ dir: ps5ProfileDir, name: "PowerShell 5.x" },
|
|
3220
|
+
{ dir: ps7ProfileDir, name: "PowerShell 7+" }
|
|
3221
|
+
];
|
|
3222
|
+
let addedToAny = false;
|
|
3223
|
+
for (const { dir, name } of profiles) {
|
|
3224
|
+
const profilePath = join3(dir, profileName);
|
|
3225
|
+
if (!existsSync2(dir)) {
|
|
3226
|
+
await Bun.$`mkdir -p ${dir}`;
|
|
3227
|
+
}
|
|
3228
|
+
let profileContent = "";
|
|
3229
|
+
if (existsSync2(profilePath)) {
|
|
3230
|
+
profileContent = await Bun.file(profilePath).text();
|
|
3231
|
+
}
|
|
3232
|
+
if (!profileContent.includes("function lola")) {
|
|
3233
|
+
await Bun.write(profilePath, profileContent + lolaFunction);
|
|
3234
|
+
console.log(import_picocolors7.default.green(` Funcao lola adicionada ao ${name} profile`));
|
|
3235
|
+
addedToAny = true;
|
|
3236
|
+
}
|
|
3237
|
+
}
|
|
3238
|
+
if (addedToAny) {
|
|
3239
|
+
console.log(import_picocolors7.default.yellow(" Reinicie o PowerShell para usar o comando 'lola'"));
|
|
3240
|
+
} else {
|
|
3241
|
+
console.log(import_picocolors7.default.green(" Funcao lola ja existe"));
|
|
3242
|
+
}
|
|
3243
|
+
} else {
|
|
3244
|
+
const binDir = join3(HOME, ".local", "bin");
|
|
3245
|
+
const lolaScript = join3(binDir, "lola");
|
|
3246
|
+
if (!existsSync2(lolaScript)) {
|
|
3247
|
+
await Bun.$`mkdir -p ${binDir}`;
|
|
3248
|
+
const unixScript = `#!/bin/bash
|
|
3249
|
+
# lola - Code Agent da nimbuslab
|
|
3250
|
+
LOLA_AGENT="${lolaAgent}"
|
|
3251
|
+
|
|
3252
|
+
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
|
|
3253
|
+
echo "lola - Code Agent da nimbuslab"
|
|
3254
|
+
echo "Uso: lola [args]"
|
|
3255
|
+
echo " lola Abre Claude CLI com a Lola"
|
|
3256
|
+
echo " lola --resume Resume sessao anterior"
|
|
3257
|
+
exit 0
|
|
3258
|
+
fi
|
|
3259
|
+
|
|
3260
|
+
if [[ -f "$LOLA_AGENT" ]]; then
|
|
3261
|
+
exec claude --append-system-prompt-file "$LOLA_AGENT" "$@"
|
|
3262
|
+
else
|
|
3263
|
+
echo "Agente Lola nao encontrado: $LOLA_AGENT"
|
|
3264
|
+
echo "Rode: nimbus lola install"
|
|
3265
|
+
exit 1
|
|
3266
|
+
fi
|
|
3267
|
+
`;
|
|
3268
|
+
await Bun.write(lolaScript, unixScript);
|
|
3269
|
+
await Bun.$`chmod +x ${lolaScript}`;
|
|
3270
|
+
console.log(import_picocolors7.default.green(` Script lola criado em ${lolaScript}`));
|
|
3271
|
+
const pathEnv = process.env.PATH || "";
|
|
3272
|
+
if (!pathEnv.includes(".local/bin")) {
|
|
3273
|
+
console.log();
|
|
3274
|
+
console.log(import_picocolors7.default.yellow(" IMPORTANTE: Adicione ~/.local/bin ao seu PATH"));
|
|
3275
|
+
console.log(import_picocolors7.default.dim(' export PATH="$HOME/.local/bin:$PATH"'));
|
|
3276
|
+
}
|
|
3277
|
+
} else {
|
|
3278
|
+
console.log(import_picocolors7.default.green(" Script lola ja existe"));
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
await installLolaMemoryMCP();
|
|
3282
|
+
const claudeDir = join3(HOME, ".claude");
|
|
3283
|
+
if (!existsSync2(USER_MEMORY)) {
|
|
3284
|
+
console.log();
|
|
3285
|
+
console.log(import_picocolors7.default.cyan(" Configurando USER_MEMORY.md..."));
|
|
3286
|
+
const gitUserResult = Bun.spawnSync(["git", "config", "user.name"], { stdout: "pipe" });
|
|
3287
|
+
const gitEmailResult = Bun.spawnSync(["git", "config", "user.email"], { stdout: "pipe" });
|
|
3288
|
+
const gitUser = gitUserResult.stdout.toString().trim() || "Dev";
|
|
3289
|
+
const gitEmail = gitEmailResult.stdout.toString().trim() || "";
|
|
3290
|
+
const hostname = process.env.HOSTNAME || process.env.COMPUTERNAME || "local";
|
|
3291
|
+
const today = new Date().toISOString().split("T")[0];
|
|
3292
|
+
await Bun.$`mkdir -p ${claudeDir}`;
|
|
3293
|
+
const content = `# User Memory
|
|
3294
|
+
|
|
3295
|
+
Memoria persistente para sessoes Claude Code
|
|
3296
|
+
|
|
3297
|
+
---
|
|
3298
|
+
|
|
3299
|
+
## Dev
|
|
3300
|
+
|
|
3301
|
+
**Nome:** ${gitUser}
|
|
3302
|
+
**Email:** ${gitEmail}
|
|
3303
|
+
**Maquina:** ${hostname}
|
|
3304
|
+
**Instalacao:** ${today}
|
|
3305
|
+
|
|
3306
|
+
---
|
|
3307
|
+
|
|
3308
|
+
## Configuracoes da Lola
|
|
3309
|
+
|
|
3310
|
+
\`\`\`
|
|
3311
|
+
lola_profile: millennial
|
|
3312
|
+
\`\`\`
|
|
3313
|
+
|
|
3314
|
+
---
|
|
3315
|
+
|
|
3316
|
+
## Ultima Sessao
|
|
3317
|
+
|
|
3318
|
+
(sera preenchido automaticamente)
|
|
3319
|
+
|
|
3320
|
+
---
|
|
3321
|
+
`;
|
|
3322
|
+
await Bun.write(USER_MEMORY, content);
|
|
3323
|
+
console.log(import_picocolors7.default.green(` USER_MEMORY.md criado para ${gitUser}!`));
|
|
3324
|
+
}
|
|
3325
|
+
console.log();
|
|
3326
|
+
console.log(import_picocolors7.default.green(" Claude configurado!"));
|
|
3327
|
+
}
|
|
3124
3328
|
async function lola(args) {
|
|
3125
3329
|
const subcommand = args[0];
|
|
3126
3330
|
if (!subcommand || subcommand === "install" || subcommand === "sync") {
|
|
3127
|
-
await
|
|
3331
|
+
await installInteractive();
|
|
3128
3332
|
} else if (subcommand === "onboard") {
|
|
3129
3333
|
await onboardDev();
|
|
3130
3334
|
} else if (subcommand === "quiz") {
|