@nimbuslab/cli 0.12.0 → 0.13.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 +271 -123
- package/package.json +1 -1
- package/src/commands/lola.ts +6 -4
- package/src/commands/update.ts +152 -0
- package/src/index.ts +36 -27
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.13.1",
|
|
154
154
|
description: "CLI para criar projetos nimbuslab",
|
|
155
155
|
type: "module",
|
|
156
156
|
bin: {
|
|
@@ -192,7 +192,7 @@ var require_package = __commonJS((exports, module) => {
|
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
// src/index.ts
|
|
195
|
-
var
|
|
195
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
196
196
|
|
|
197
197
|
// node_modules/@clack/core/dist/index.mjs
|
|
198
198
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -833,6 +833,29 @@ ${import_picocolors2.default.gray(d2)} ${t}
|
|
|
833
833
|
|
|
834
834
|
`);
|
|
835
835
|
};
|
|
836
|
+
var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
|
|
837
|
+
const r2 = [`${import_picocolors2.default.gray(o)}`];
|
|
838
|
+
if (t) {
|
|
839
|
+
const [i, ...s] = t.split(`
|
|
840
|
+
`);
|
|
841
|
+
r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
|
|
842
|
+
}
|
|
843
|
+
process.stdout.write(`${r2.join(`
|
|
844
|
+
`)}
|
|
845
|
+
`);
|
|
846
|
+
}, info: (t) => {
|
|
847
|
+
M2.message(t, { symbol: import_picocolors2.default.blue(q) });
|
|
848
|
+
}, success: (t) => {
|
|
849
|
+
M2.message(t, { symbol: import_picocolors2.default.green(D) });
|
|
850
|
+
}, step: (t) => {
|
|
851
|
+
M2.message(t, { symbol: import_picocolors2.default.green(C) });
|
|
852
|
+
}, warn: (t) => {
|
|
853
|
+
M2.message(t, { symbol: import_picocolors2.default.yellow(U) });
|
|
854
|
+
}, warning: (t) => {
|
|
855
|
+
M2.warn(t);
|
|
856
|
+
}, error: (t) => {
|
|
857
|
+
M2.message(t, { symbol: import_picocolors2.default.red(K2) });
|
|
858
|
+
} };
|
|
836
859
|
var J2 = `${import_picocolors2.default.gray(o)} `;
|
|
837
860
|
var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
838
861
|
const n = V2 ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
|
|
@@ -2328,49 +2351,166 @@ function printUpgradePlan(name, plan) {
|
|
|
2328
2351
|
console.log();
|
|
2329
2352
|
}
|
|
2330
2353
|
|
|
2331
|
-
// src/commands/
|
|
2354
|
+
// src/commands/update.ts
|
|
2332
2355
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
2356
|
+
import { execSync, spawnSync } from "child_process";
|
|
2357
|
+
var PACKAGE_NAME = "@nimbuslab/cli";
|
|
2358
|
+
async function getAvailableVersions() {
|
|
2359
|
+
try {
|
|
2360
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}`);
|
|
2361
|
+
if (!res.ok)
|
|
2362
|
+
return [];
|
|
2363
|
+
const data = await res.json();
|
|
2364
|
+
return Object.keys(data.versions || {}).reverse();
|
|
2365
|
+
} catch {
|
|
2366
|
+
return [];
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
async function getLatestVersion() {
|
|
2370
|
+
try {
|
|
2371
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`);
|
|
2372
|
+
if (!res.ok)
|
|
2373
|
+
return null;
|
|
2374
|
+
const data = await res.json();
|
|
2375
|
+
return data.version || null;
|
|
2376
|
+
} catch {
|
|
2377
|
+
return null;
|
|
2378
|
+
}
|
|
2379
|
+
}
|
|
2380
|
+
function getCurrentVersion() {
|
|
2381
|
+
try {
|
|
2382
|
+
const result = spawnSync("npm", ["ls", "-g", PACKAGE_NAME, "--json"], {
|
|
2383
|
+
encoding: "utf-8",
|
|
2384
|
+
shell: true
|
|
2385
|
+
});
|
|
2386
|
+
if (result.stdout) {
|
|
2387
|
+
const data = JSON.parse(result.stdout);
|
|
2388
|
+
return data.dependencies?.[PACKAGE_NAME]?.version || "unknown";
|
|
2389
|
+
}
|
|
2390
|
+
} catch {}
|
|
2391
|
+
return "unknown";
|
|
2392
|
+
}
|
|
2393
|
+
async function update(args) {
|
|
2394
|
+
const flag = args[0];
|
|
2395
|
+
if (flag === "--list" || flag === "-l") {
|
|
2396
|
+
Ie(import_picocolors6.default.cyan("Vers\xF5es dispon\xEDveis"));
|
|
2397
|
+
const spinner2 = Y2();
|
|
2398
|
+
spinner2.start("Buscando vers\xF5es...");
|
|
2399
|
+
const versions = await getAvailableVersions();
|
|
2400
|
+
spinner2.stop("Vers\xF5es encontradas");
|
|
2401
|
+
if (versions.length === 0) {
|
|
2402
|
+
M2.error("N\xE3o foi poss\xEDvel buscar as vers\xF5es");
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
const current = getCurrentVersion();
|
|
2406
|
+
console.log();
|
|
2407
|
+
console.log(import_picocolors6.default.bold("\xDAltimas 10 vers\xF5es:"));
|
|
2408
|
+
versions.slice(0, 10).forEach((v2, i) => {
|
|
2409
|
+
const isCurrent = v2 === current;
|
|
2410
|
+
const prefix = isCurrent ? import_picocolors6.default.green("\u2192 ") : " ";
|
|
2411
|
+
const suffix = isCurrent ? import_picocolors6.default.dim(" (instalada)") : "";
|
|
2412
|
+
const isLatest = i === 0 ? import_picocolors6.default.yellow(" (latest)") : "";
|
|
2413
|
+
console.log(`${prefix}${v2}${suffix}${isLatest}`);
|
|
2414
|
+
});
|
|
2415
|
+
console.log();
|
|
2416
|
+
console.log(import_picocolors6.default.dim(`Total: ${versions.length} vers\xF5es`));
|
|
2417
|
+
console.log(import_picocolors6.default.dim(`Instalar vers\xE3o espec\xEDfica: nimbus update <vers\xE3o>`));
|
|
2418
|
+
return;
|
|
2419
|
+
}
|
|
2420
|
+
const targetVersion = flag || "latest";
|
|
2421
|
+
const isSpecificVersion = flag && flag !== "latest";
|
|
2422
|
+
Ie(import_picocolors6.default.cyan(`Atualizando ${PACKAGE_NAME}`));
|
|
2423
|
+
const spinner = Y2();
|
|
2424
|
+
spinner.start("Verificando vers\xE3o atual...");
|
|
2425
|
+
const currentVersion = getCurrentVersion();
|
|
2426
|
+
spinner.stop(`Vers\xE3o atual: ${currentVersion}`);
|
|
2427
|
+
if (!isSpecificVersion) {
|
|
2428
|
+
spinner.start("Verificando \xFAltima vers\xE3o...");
|
|
2429
|
+
const latest = await getLatestVersion();
|
|
2430
|
+
spinner.stop(`\xDAltima vers\xE3o: ${latest || "desconhecida"}`);
|
|
2431
|
+
if (latest && latest === currentVersion) {
|
|
2432
|
+
M2.success("Voc\xEA j\xE1 est\xE1 na \xFAltima vers\xE3o!");
|
|
2433
|
+
return;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
2436
|
+
const versionText = isSpecificVersion ? targetVersion : "latest";
|
|
2437
|
+
const confirmUpdate = await ye({
|
|
2438
|
+
message: `Atualizar para ${versionText}?`,
|
|
2439
|
+
initialValue: true
|
|
2440
|
+
});
|
|
2441
|
+
if (pD(confirmUpdate) || !confirmUpdate) {
|
|
2442
|
+
xe("Atualiza\xE7\xE3o cancelada");
|
|
2443
|
+
return;
|
|
2444
|
+
}
|
|
2445
|
+
spinner.start("Atualizando...");
|
|
2446
|
+
try {
|
|
2447
|
+
const packageSpec = isSpecificVersion ? `${PACKAGE_NAME}@${targetVersion}` : PACKAGE_NAME;
|
|
2448
|
+
execSync(`npm install -g ${packageSpec}`, {
|
|
2449
|
+
stdio: "pipe",
|
|
2450
|
+
encoding: "utf-8"
|
|
2451
|
+
});
|
|
2452
|
+
spinner.stop("Atualiza\xE7\xE3o conclu\xEDda!");
|
|
2453
|
+
const newVersion = getCurrentVersion();
|
|
2454
|
+
M2.success(`${PACKAGE_NAME} atualizado: ${currentVersion} \u2192 ${newVersion}`);
|
|
2455
|
+
Se(import_picocolors6.default.green("Pronto!"));
|
|
2456
|
+
} catch (error) {
|
|
2457
|
+
spinner.stop("Erro na atualiza\xE7\xE3o");
|
|
2458
|
+
const err = error;
|
|
2459
|
+
M2.error("Falha ao atualizar");
|
|
2460
|
+
if (err.stderr) {
|
|
2461
|
+
console.log(import_picocolors6.default.dim(err.stderr));
|
|
2462
|
+
}
|
|
2463
|
+
console.log();
|
|
2464
|
+
console.log(import_picocolors6.default.yellow("Tente manualmente:"));
|
|
2465
|
+
console.log(import_picocolors6.default.cyan(` npm install -g ${PACKAGE_NAME}${isSpecificVersion ? `@${targetVersion}` : ""}`));
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
// src/commands/lola.ts
|
|
2470
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
2333
2471
|
import { existsSync as existsSync2 } from "fs";
|
|
2334
2472
|
import { join as join3 } from "path";
|
|
2335
|
-
|
|
2473
|
+
import { homedir } from "os";
|
|
2474
|
+
var HOME = homedir();
|
|
2475
|
+
var LOLA_DIR = join3(HOME, ".lola");
|
|
2336
2476
|
var LOLA_REPO = "git@github.com:nimbuslab/lola.git";
|
|
2337
|
-
var USER_MEMORY = join3(
|
|
2477
|
+
var USER_MEMORY = join3(HOME, ".claude", "USER_MEMORY.md");
|
|
2338
2478
|
async function installLola() {
|
|
2339
2479
|
console.log();
|
|
2340
|
-
console.log(
|
|
2341
|
-
console.log(
|
|
2480
|
+
console.log(import_picocolors7.default.cyan(" Lola - Code Agent da nimbuslab"));
|
|
2481
|
+
console.log(import_picocolors7.default.dim(" ==============================="));
|
|
2342
2482
|
console.log();
|
|
2343
2483
|
const isUpdate = existsSync2(LOLA_DIR);
|
|
2344
2484
|
if (isUpdate) {
|
|
2345
|
-
console.log(
|
|
2346
|
-
console.log(
|
|
2485
|
+
console.log(import_picocolors7.default.dim(` Lola ja instalada em ${LOLA_DIR}`));
|
|
2486
|
+
console.log(import_picocolors7.default.cyan(" Atualizando..."));
|
|
2347
2487
|
const result = Bun.spawnSync(["git", "pull", "--quiet"], {
|
|
2348
2488
|
cwd: LOLA_DIR,
|
|
2349
2489
|
stdout: "inherit",
|
|
2350
2490
|
stderr: "inherit"
|
|
2351
2491
|
});
|
|
2352
2492
|
if (result.exitCode !== 0) {
|
|
2353
|
-
console.log(
|
|
2493
|
+
console.log(import_picocolors7.default.red(" Erro ao atualizar Lola"));
|
|
2354
2494
|
process.exit(1);
|
|
2355
2495
|
}
|
|
2356
|
-
console.log(
|
|
2496
|
+
console.log(import_picocolors7.default.green(" Atualizado!"));
|
|
2357
2497
|
} else {
|
|
2358
|
-
console.log(
|
|
2498
|
+
console.log(import_picocolors7.default.cyan(` Instalando Lola em ${LOLA_DIR}...`));
|
|
2359
2499
|
const result = Bun.spawnSync(["git", "clone", "--quiet", LOLA_REPO, LOLA_DIR], {
|
|
2360
2500
|
stdout: "inherit",
|
|
2361
2501
|
stderr: "inherit"
|
|
2362
2502
|
});
|
|
2363
2503
|
if (result.exitCode !== 0) {
|
|
2364
|
-
console.log(
|
|
2365
|
-
console.log(
|
|
2504
|
+
console.log(import_picocolors7.default.red(" Erro ao clonar repositorio"));
|
|
2505
|
+
console.log(import_picocolors7.default.dim(" Verifique se tem acesso ao repo nimbuslab/lola"));
|
|
2366
2506
|
process.exit(1);
|
|
2367
2507
|
}
|
|
2368
|
-
console.log(
|
|
2508
|
+
console.log(import_picocolors7.default.green(" Instalado!"));
|
|
2369
2509
|
}
|
|
2370
|
-
const claudeDir = join3(
|
|
2510
|
+
const claudeDir = join3(HOME, ".claude");
|
|
2371
2511
|
if (!existsSync2(USER_MEMORY)) {
|
|
2372
2512
|
console.log();
|
|
2373
|
-
console.log(
|
|
2513
|
+
console.log(import_picocolors7.default.cyan(" Criando USER_MEMORY.md..."));
|
|
2374
2514
|
await Bun.$`mkdir -p ${claudeDir}`;
|
|
2375
2515
|
const content = `# User Memory
|
|
2376
2516
|
|
|
@@ -2393,29 +2533,29 @@ lola_profile: millennial
|
|
|
2393
2533
|
---
|
|
2394
2534
|
`;
|
|
2395
2535
|
await Bun.write(USER_MEMORY, content);
|
|
2396
|
-
console.log(
|
|
2536
|
+
console.log(import_picocolors7.default.green(" USER_MEMORY.md criado!"));
|
|
2397
2537
|
}
|
|
2398
2538
|
console.log();
|
|
2399
|
-
console.log(
|
|
2539
|
+
console.log(import_picocolors7.default.green(" Instalacao concluida!"));
|
|
2400
2540
|
console.log();
|
|
2401
|
-
console.log(
|
|
2402
|
-
console.log(
|
|
2403
|
-
console.log(
|
|
2541
|
+
console.log(import_picocolors7.default.bold(" Para usar a Lola:"));
|
|
2542
|
+
console.log(import_picocolors7.default.dim(" lola ") + import_picocolors7.default.white("# Iniciar sessao"));
|
|
2543
|
+
console.log(import_picocolors7.default.dim(' lola suggest "x" ') + import_picocolors7.default.white("# Sugerir melhoria"));
|
|
2404
2544
|
console.log();
|
|
2405
|
-
console.log(
|
|
2406
|
-
console.log(
|
|
2545
|
+
console.log(import_picocolors7.default.bold(" Para mudar perfil, edite ~/.claude/USER_MEMORY.md:"));
|
|
2546
|
+
console.log(import_picocolors7.default.dim(" lola_profile: millennial|genz|profissional|nerd|chill"));
|
|
2407
2547
|
console.log();
|
|
2408
2548
|
}
|
|
2409
2549
|
async function suggestImprovement(message) {
|
|
2410
2550
|
if (!message) {
|
|
2411
|
-
console.log(
|
|
2412
|
-
console.log(
|
|
2551
|
+
console.log(import_picocolors7.default.red(" Erro: forne\xE7a uma mensagem"));
|
|
2552
|
+
console.log(import_picocolors7.default.dim(' Uso: nimbus lola suggest "sua sugestao aqui"'));
|
|
2413
2553
|
process.exit(1);
|
|
2414
2554
|
}
|
|
2415
2555
|
const ghCheck = Bun.spawnSync(["which", "gh"]);
|
|
2416
2556
|
if (ghCheck.exitCode !== 0) {
|
|
2417
|
-
console.log(
|
|
2418
|
-
console.log(
|
|
2557
|
+
console.log(import_picocolors7.default.red(" Erro: GitHub CLI (gh) nao encontrado"));
|
|
2558
|
+
console.log(import_picocolors7.default.dim(" Instale: https://cli.github.com"));
|
|
2419
2559
|
process.exit(1);
|
|
2420
2560
|
}
|
|
2421
2561
|
const authCheck = Bun.spawnSync(["gh", "auth", "status"], {
|
|
@@ -2423,8 +2563,8 @@ async function suggestImprovement(message) {
|
|
|
2423
2563
|
stderr: "pipe"
|
|
2424
2564
|
});
|
|
2425
2565
|
if (authCheck.exitCode !== 0) {
|
|
2426
|
-
console.log(
|
|
2427
|
-
console.log(
|
|
2566
|
+
console.log(import_picocolors7.default.red(" Erro: GitHub CLI nao autenticado"));
|
|
2567
|
+
console.log(import_picocolors7.default.dim(" Execute: gh auth login"));
|
|
2428
2568
|
process.exit(1);
|
|
2429
2569
|
}
|
|
2430
2570
|
const gitUser = Bun.spawnSync(["git", "config", "user.name"], { stdout: "pipe" });
|
|
@@ -2432,7 +2572,7 @@ async function suggestImprovement(message) {
|
|
|
2432
2572
|
const userName = gitUser.stdout.toString().trim() || "Dev";
|
|
2433
2573
|
const userEmail = gitEmail.stdout.toString().trim() || "";
|
|
2434
2574
|
console.log();
|
|
2435
|
-
console.log(
|
|
2575
|
+
console.log(import_picocolors7.default.cyan(" Criando sugestao..."));
|
|
2436
2576
|
const date = new Date().toISOString().split("T")[0];
|
|
2437
2577
|
const body = `## Sugestao
|
|
2438
2578
|
|
|
@@ -2464,11 +2604,11 @@ ${message}
|
|
|
2464
2604
|
stderr: "inherit"
|
|
2465
2605
|
});
|
|
2466
2606
|
if (result.exitCode !== 0) {
|
|
2467
|
-
console.log(
|
|
2607
|
+
console.log(import_picocolors7.default.red(" Erro ao criar issue"));
|
|
2468
2608
|
process.exit(1);
|
|
2469
2609
|
}
|
|
2470
2610
|
console.log();
|
|
2471
|
-
console.log(
|
|
2611
|
+
console.log(import_picocolors7.default.green(" Sugestao enviada! Hugo vai revisar."));
|
|
2472
2612
|
console.log();
|
|
2473
2613
|
}
|
|
2474
2614
|
var PROFILES = {
|
|
@@ -2500,18 +2640,18 @@ var PROFILES = {
|
|
|
2500
2640
|
};
|
|
2501
2641
|
async function onboardDev() {
|
|
2502
2642
|
console.log();
|
|
2503
|
-
console.log(
|
|
2504
|
-
console.log(
|
|
2643
|
+
console.log(import_picocolors7.default.cyan(" Lola - Onboarding"));
|
|
2644
|
+
console.log(import_picocolors7.default.dim(" ================="));
|
|
2505
2645
|
console.log();
|
|
2506
2646
|
if (!existsSync2(LOLA_DIR)) {
|
|
2507
|
-
console.log(
|
|
2647
|
+
console.log(import_picocolors7.default.yellow(" Lola nao instalada. Instalando primeiro..."));
|
|
2508
2648
|
console.log();
|
|
2509
2649
|
await installLola();
|
|
2510
2650
|
console.log();
|
|
2511
2651
|
}
|
|
2512
2652
|
const gitUser = Bun.spawnSync(["git", "config", "user.name"], { stdout: "pipe" });
|
|
2513
2653
|
const defaultName = gitUser.stdout.toString().trim() || "";
|
|
2514
|
-
Ie(
|
|
2654
|
+
Ie(import_picocolors7.default.bgCyan(import_picocolors7.default.black(" Bem-vindo a nimbuslab! ")));
|
|
2515
2655
|
const devName = await he({
|
|
2516
2656
|
message: "Qual seu nome?",
|
|
2517
2657
|
placeholder: "Seu nome",
|
|
@@ -2534,7 +2674,7 @@ async function onboardDev() {
|
|
|
2534
2674
|
xe("Onboarding cancelado");
|
|
2535
2675
|
process.exit(0);
|
|
2536
2676
|
}
|
|
2537
|
-
const claudeDir = join3(
|
|
2677
|
+
const claudeDir = join3(HOME, ".claude");
|
|
2538
2678
|
await Bun.$`mkdir -p ${claudeDir}`;
|
|
2539
2679
|
const content = `# User Memory
|
|
2540
2680
|
|
|
@@ -2565,18 +2705,18 @@ lola_profile: ${profile}
|
|
|
2565
2705
|
---
|
|
2566
2706
|
`;
|
|
2567
2707
|
await Bun.write(USER_MEMORY, content);
|
|
2568
|
-
Se(
|
|
2708
|
+
Se(import_picocolors7.default.green("Onboarding concluido!"));
|
|
2569
2709
|
console.log();
|
|
2570
|
-
console.log(
|
|
2571
|
-
console.log(
|
|
2572
|
-
console.log(
|
|
2710
|
+
console.log(import_picocolors7.default.bold(" Resumo:"));
|
|
2711
|
+
console.log(import_picocolors7.default.dim(" Nome: ") + import_picocolors7.default.white(devName));
|
|
2712
|
+
console.log(import_picocolors7.default.dim(" Perfil: ") + import_picocolors7.default.white(PROFILES[profile].label));
|
|
2573
2713
|
console.log();
|
|
2574
|
-
console.log(
|
|
2575
|
-
console.log(
|
|
2576
|
-
console.log(
|
|
2577
|
-
console.log(
|
|
2714
|
+
console.log(import_picocolors7.default.bold(" Proximos passos:"));
|
|
2715
|
+
console.log(import_picocolors7.default.dim(" 1. ") + import_picocolors7.default.white("lola") + import_picocolors7.default.dim(" - Iniciar sessao com a Lola"));
|
|
2716
|
+
console.log(import_picocolors7.default.dim(" 2. ") + import_picocolors7.default.white("nimbus create meu-projeto --fast") + import_picocolors7.default.dim(" - Criar projeto"));
|
|
2717
|
+
console.log(import_picocolors7.default.dim(" 3. ") + import_picocolors7.default.white('lola suggest "sua ideia"') + import_picocolors7.default.dim(" - Sugerir melhoria"));
|
|
2578
2718
|
console.log();
|
|
2579
|
-
console.log(
|
|
2719
|
+
console.log(import_picocolors7.default.dim(" Docs: ~/.lola/README.md"));
|
|
2580
2720
|
console.log();
|
|
2581
2721
|
}
|
|
2582
2722
|
var QUIZ_QUESTIONS = [
|
|
@@ -2671,11 +2811,11 @@ var QUIZ_QUESTIONS = [
|
|
|
2671
2811
|
];
|
|
2672
2812
|
async function runQuiz() {
|
|
2673
2813
|
console.log();
|
|
2674
|
-
console.log(
|
|
2675
|
-
console.log(
|
|
2814
|
+
console.log(import_picocolors7.default.cyan(" Quiz nimbuslab"));
|
|
2815
|
+
console.log(import_picocolors7.default.dim(" =============="));
|
|
2676
2816
|
console.log();
|
|
2677
|
-
console.log(
|
|
2678
|
-
console.log(
|
|
2817
|
+
console.log(import_picocolors7.default.dim(" Teste seus conhecimentos sobre a nimbuslab!"));
|
|
2818
|
+
console.log(import_picocolors7.default.dim(" 8 perguntas sobre valores, filosofia e stack."));
|
|
2679
2819
|
console.log();
|
|
2680
2820
|
let score = 0;
|
|
2681
2821
|
const results = [];
|
|
@@ -2692,11 +2832,11 @@ async function runQuiz() {
|
|
|
2692
2832
|
const isCorrect = answer === q2.correct;
|
|
2693
2833
|
if (isCorrect) {
|
|
2694
2834
|
score++;
|
|
2695
|
-
console.log(
|
|
2835
|
+
console.log(import_picocolors7.default.green(" Correto!"));
|
|
2696
2836
|
} else {
|
|
2697
|
-
console.log(
|
|
2837
|
+
console.log(import_picocolors7.default.red(" Incorreto."));
|
|
2698
2838
|
}
|
|
2699
|
-
console.log(
|
|
2839
|
+
console.log(import_picocolors7.default.dim(` ${q2.explanation}`));
|
|
2700
2840
|
console.log();
|
|
2701
2841
|
results.push({
|
|
2702
2842
|
question: q2.question,
|
|
@@ -2706,23 +2846,23 @@ async function runQuiz() {
|
|
|
2706
2846
|
}
|
|
2707
2847
|
const percentage = Math.round(score / QUIZ_QUESTIONS.length * 100);
|
|
2708
2848
|
const passed = percentage >= 75;
|
|
2709
|
-
console.log(
|
|
2849
|
+
console.log(import_picocolors7.default.bold(" Resultado:"));
|
|
2710
2850
|
console.log();
|
|
2711
2851
|
if (passed) {
|
|
2712
|
-
console.log(
|
|
2852
|
+
console.log(import_picocolors7.default.green(` ${score}/${QUIZ_QUESTIONS.length} (${percentage}%) - Aprovado!`));
|
|
2713
2853
|
console.log();
|
|
2714
2854
|
if (percentage === 100) {
|
|
2715
|
-
console.log(
|
|
2855
|
+
console.log(import_picocolors7.default.cyan(" Perfeito! Voce conhece bem a nimbuslab."));
|
|
2716
2856
|
} else {
|
|
2717
|
-
console.log(
|
|
2857
|
+
console.log(import_picocolors7.default.cyan(" Muito bem! Voce esta pronto para trabalhar."));
|
|
2718
2858
|
}
|
|
2719
2859
|
} else {
|
|
2720
|
-
console.log(
|
|
2860
|
+
console.log(import_picocolors7.default.yellow(` ${score}/${QUIZ_QUESTIONS.length} (${percentage}%) - Precisa revisar`));
|
|
2721
2861
|
console.log();
|
|
2722
|
-
console.log(
|
|
2723
|
-
console.log(
|
|
2724
|
-
console.log(
|
|
2725
|
-
console.log(
|
|
2862
|
+
console.log(import_picocolors7.default.dim(" Revise os conceitos em:"));
|
|
2863
|
+
console.log(import_picocolors7.default.dim(" ~/.lola/core/values.md"));
|
|
2864
|
+
console.log(import_picocolors7.default.dim(" ~/.lola/core/philosophy.md"));
|
|
2865
|
+
console.log(import_picocolors7.default.dim(" ~/.lola/modules/stack.md"));
|
|
2726
2866
|
}
|
|
2727
2867
|
console.log();
|
|
2728
2868
|
}
|
|
@@ -2740,35 +2880,35 @@ async function lola(args) {
|
|
|
2740
2880
|
} else if (subcommand === "help" || subcommand === "--help" || subcommand === "-h") {
|
|
2741
2881
|
showLolaHelp();
|
|
2742
2882
|
} else {
|
|
2743
|
-
console.log(
|
|
2883
|
+
console.log(import_picocolors7.default.red(` Subcomando desconhecido: ${subcommand}`));
|
|
2744
2884
|
showLolaHelp();
|
|
2745
2885
|
process.exit(1);
|
|
2746
2886
|
}
|
|
2747
2887
|
}
|
|
2748
2888
|
function showLolaHelp() {
|
|
2749
2889
|
console.log();
|
|
2750
|
-
console.log(
|
|
2890
|
+
console.log(import_picocolors7.default.bold(" Lola - Code Agent da nimbuslab"));
|
|
2751
2891
|
console.log();
|
|
2752
|
-
console.log(
|
|
2892
|
+
console.log(import_picocolors7.default.bold(" Uso:") + " nimbus lola [subcomando]");
|
|
2753
2893
|
console.log();
|
|
2754
|
-
console.log(
|
|
2755
|
-
console.log(
|
|
2756
|
-
console.log(
|
|
2757
|
-
console.log(
|
|
2758
|
-
console.log(
|
|
2759
|
-
console.log(
|
|
2760
|
-
console.log(
|
|
2894
|
+
console.log(import_picocolors7.default.bold(" Subcomandos:"));
|
|
2895
|
+
console.log(import_picocolors7.default.dim(" install ") + import_picocolors7.default.white("Instalar/atualizar Lola"));
|
|
2896
|
+
console.log(import_picocolors7.default.dim(" sync ") + import_picocolors7.default.white("Alias para install"));
|
|
2897
|
+
console.log(import_picocolors7.default.dim(" onboard ") + import_picocolors7.default.white("Configurar perfil (novos devs)"));
|
|
2898
|
+
console.log(import_picocolors7.default.dim(" quiz ") + import_picocolors7.default.white("Quiz sobre a nimbuslab"));
|
|
2899
|
+
console.log(import_picocolors7.default.dim(' suggest "msg" ') + import_picocolors7.default.white("Sugerir melhoria (cria issue)"));
|
|
2900
|
+
console.log(import_picocolors7.default.dim(" help ") + import_picocolors7.default.white("Mostrar esta ajuda"));
|
|
2761
2901
|
console.log();
|
|
2762
|
-
console.log(
|
|
2763
|
-
console.log(
|
|
2764
|
-
console.log(
|
|
2765
|
-
console.log(
|
|
2766
|
-
console.log(
|
|
2902
|
+
console.log(import_picocolors7.default.bold(" Exemplos:"));
|
|
2903
|
+
console.log(import_picocolors7.default.dim(" $ nimbus lola install"));
|
|
2904
|
+
console.log(import_picocolors7.default.dim(" $ nimbus lola onboard"));
|
|
2905
|
+
console.log(import_picocolors7.default.dim(" $ nimbus lola quiz"));
|
|
2906
|
+
console.log(import_picocolors7.default.dim(' $ nimbus lola suggest "adicionar suporte a X"'));
|
|
2767
2907
|
console.log();
|
|
2768
2908
|
}
|
|
2769
2909
|
|
|
2770
2910
|
// src/index.ts
|
|
2771
|
-
var
|
|
2911
|
+
var PACKAGE_NAME2 = "@nimbuslab/cli";
|
|
2772
2912
|
var pkg = await Promise.resolve().then(() => __toESM(require_package(), 1));
|
|
2773
2913
|
var CURRENT_VERSION = pkg.version;
|
|
2774
2914
|
var LOGO = `
|
|
@@ -2782,7 +2922,7 @@ async function checkForUpdates() {
|
|
|
2782
2922
|
try {
|
|
2783
2923
|
const controller = new AbortController;
|
|
2784
2924
|
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
2785
|
-
const res = await fetch(`https://registry.npmjs.org/${
|
|
2925
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME2}/latest`, {
|
|
2786
2926
|
signal: controller.signal
|
|
2787
2927
|
});
|
|
2788
2928
|
clearTimeout(timeout);
|
|
@@ -2801,23 +2941,23 @@ async function checkForUpdates() {
|
|
|
2801
2941
|
function showUpdateNotice(latestVersion) {
|
|
2802
2942
|
const current = CURRENT_VERSION;
|
|
2803
2943
|
const latest = latestVersion;
|
|
2804
|
-
const command =
|
|
2805
|
-
const line1 = `
|
|
2806
|
-
const line2 = `
|
|
2944
|
+
const command = "nimbus update";
|
|
2945
|
+
const line1 = ` Nova vers\xE3o dispon\xEDvel: ${current} \u2192 ${latest}`;
|
|
2946
|
+
const line2 = ` Atualize com: ${command}`;
|
|
2807
2947
|
const maxLen = Math.max(line1.length, line2.length);
|
|
2808
2948
|
const border = "\u2500".repeat(maxLen + 2);
|
|
2809
|
-
console.log(
|
|
2810
|
-
console.log(
|
|
2811
|
-
console.log(
|
|
2812
|
-
console.log(
|
|
2949
|
+
console.log(import_picocolors8.default.yellow(` \u250C${border}\u2510`));
|
|
2950
|
+
console.log(import_picocolors8.default.yellow(` \u2502`) + import_picocolors8.default.white(line1.padEnd(maxLen + 1)) + import_picocolors8.default.yellow(`\u2502`));
|
|
2951
|
+
console.log(import_picocolors8.default.yellow(` \u2502`) + import_picocolors8.default.cyan(line2.padEnd(maxLen + 1)) + import_picocolors8.default.yellow(`\u2502`));
|
|
2952
|
+
console.log(import_picocolors8.default.yellow(` \u2514${border}\u2518`));
|
|
2813
2953
|
console.log();
|
|
2814
2954
|
}
|
|
2815
2955
|
async function main() {
|
|
2816
2956
|
const args = process.argv.slice(2);
|
|
2817
2957
|
const command = args[0];
|
|
2818
|
-
console.log(
|
|
2819
|
-
console.log(
|
|
2820
|
-
console.log(
|
|
2958
|
+
console.log(import_picocolors8.default.cyan(LOGO));
|
|
2959
|
+
console.log(import_picocolors8.default.white(" nimbuslab CLI"));
|
|
2960
|
+
console.log(import_picocolors8.default.dim(" Create awesome projects"));
|
|
2821
2961
|
console.log();
|
|
2822
2962
|
const latestVersion = await checkForUpdates();
|
|
2823
2963
|
if (latestVersion) {
|
|
@@ -2829,6 +2969,8 @@ async function main() {
|
|
|
2829
2969
|
await analyze(args.slice(1));
|
|
2830
2970
|
} else if (command === "upgrade") {
|
|
2831
2971
|
await upgrade(args.slice(1));
|
|
2972
|
+
} else if (command === "update") {
|
|
2973
|
+
await update(args.slice(1));
|
|
2832
2974
|
} else if (command === "lola") {
|
|
2833
2975
|
await lola(args.slice(1));
|
|
2834
2976
|
} else if (command === "help" || command === "--help" || command === "-h") {
|
|
@@ -2836,58 +2978,64 @@ async function main() {
|
|
|
2836
2978
|
} else if (command === "version" || command === "--version" || command === "-v") {
|
|
2837
2979
|
showVersion();
|
|
2838
2980
|
} else {
|
|
2839
|
-
console.log(
|
|
2981
|
+
console.log(import_picocolors8.default.red(`Comando desconhecido: ${command}`));
|
|
2840
2982
|
showHelp();
|
|
2841
2983
|
process.exit(1);
|
|
2842
2984
|
}
|
|
2843
2985
|
}
|
|
2844
2986
|
function showHelp() {
|
|
2845
2987
|
console.log(`
|
|
2846
|
-
${
|
|
2988
|
+
${import_picocolors8.default.bold("Uso:")} nimbus [comando] [op\xE7\xF5es]
|
|
2847
2989
|
|
|
2848
|
-
${
|
|
2849
|
-
create [
|
|
2850
|
-
analyze [dir]
|
|
2851
|
-
upgrade [
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2990
|
+
${import_picocolors8.default.bold("Comandos:")}
|
|
2991
|
+
create [nome] Criar novo projeto
|
|
2992
|
+
analyze [dir] Analisar stack do projeto
|
|
2993
|
+
upgrade [alvo] Atualizar depend\xEAncias
|
|
2994
|
+
update [vers\xE3o] Atualizar o CLI
|
|
2995
|
+
lola [a\xE7\xE3o] Lola - Code Agent
|
|
2996
|
+
help Mostrar esta ajuda
|
|
2997
|
+
version Mostrar vers\xE3o
|
|
2855
2998
|
|
|
2856
|
-
${
|
|
2999
|
+
${import_picocolors8.default.bold("Templates:")}
|
|
2857
3000
|
--landing Landing page (Next.js 16 + Tailwind 4 + shadcn)
|
|
2858
3001
|
--app Web app (Landing + Better Auth + Drizzle)
|
|
2859
3002
|
--turborepo Monorepo (Turborepo + apps/packages)
|
|
2860
3003
|
|
|
2861
|
-
${
|
|
2862
|
-
analyze .
|
|
2863
|
-
analyze --json Output
|
|
2864
|
-
upgrade --plan
|
|
2865
|
-
upgrade next
|
|
2866
|
-
upgrade tailwind
|
|
3004
|
+
${import_picocolors8.default.bold("Analyze & Upgrade:")}
|
|
3005
|
+
analyze . Detectar stack e mostrar recomenda\xE7\xF5es
|
|
3006
|
+
analyze --json Output em JSON
|
|
3007
|
+
upgrade --plan Mostrar plano de upgrade
|
|
3008
|
+
upgrade next Atualizar Next.js
|
|
3009
|
+
upgrade tailwind Atualizar Tailwind CSS
|
|
3010
|
+
|
|
3011
|
+
${import_picocolors8.default.bold("Update (CLI):")}
|
|
3012
|
+
update Atualizar para \xFAltima vers\xE3o
|
|
3013
|
+
update 0.11.0 Instalar vers\xE3o espec\xEDfica
|
|
3014
|
+
update --list Listar vers\xF5es dispon\xEDveis
|
|
2867
3015
|
|
|
2868
|
-
${
|
|
2869
|
-
-y, --yes
|
|
2870
|
-
--no-git
|
|
2871
|
-
--no-install
|
|
2872
|
-
--template <url>
|
|
3016
|
+
${import_picocolors8.default.bold("Op\xE7\xF5es:")}
|
|
3017
|
+
-y, --yes Aceitar padr\xF5es
|
|
3018
|
+
--no-git N\xE3o inicializar Git
|
|
3019
|
+
--no-install N\xE3o instalar depend\xEAncias
|
|
3020
|
+
--template <url> Usar template customizado
|
|
2873
3021
|
|
|
2874
|
-
${
|
|
2875
|
-
lola install
|
|
2876
|
-
lola suggest
|
|
3022
|
+
${import_picocolors8.default.bold("Lola (Code Agent):")}
|
|
3023
|
+
lola install Instalar/atualizar Lola
|
|
3024
|
+
lola suggest Sugerir melhoria (cria issue)
|
|
2877
3025
|
|
|
2878
|
-
${
|
|
2879
|
-
${
|
|
2880
|
-
${
|
|
2881
|
-
${
|
|
2882
|
-
${
|
|
2883
|
-
${
|
|
2884
|
-
${
|
|
3026
|
+
${import_picocolors8.default.bold("Exemplos:")}
|
|
3027
|
+
${import_picocolors8.default.dim("$")} nimbus create my-landing --landing
|
|
3028
|
+
${import_picocolors8.default.dim("$")} nimbus create my-app --app
|
|
3029
|
+
${import_picocolors8.default.dim("$")} nimbus analyze ./my-project
|
|
3030
|
+
${import_picocolors8.default.dim("$")} nimbus upgrade --plan
|
|
3031
|
+
${import_picocolors8.default.dim("$")} nimbus update
|
|
3032
|
+
${import_picocolors8.default.dim("$")} nimbus lola install
|
|
2885
3033
|
`);
|
|
2886
3034
|
}
|
|
2887
3035
|
function showVersion() {
|
|
2888
|
-
console.log(`${
|
|
3036
|
+
console.log(`${PACKAGE_NAME2} v${CURRENT_VERSION}`);
|
|
2889
3037
|
}
|
|
2890
3038
|
main().catch((err) => {
|
|
2891
|
-
console.error(
|
|
3039
|
+
console.error(import_picocolors8.default.red("Erro:"), err.message);
|
|
2892
3040
|
process.exit(1);
|
|
2893
3041
|
});
|
package/package.json
CHANGED
package/src/commands/lola.ts
CHANGED
|
@@ -2,10 +2,12 @@ import * as p from "@clack/prompts"
|
|
|
2
2
|
import pc from "picocolors"
|
|
3
3
|
import { existsSync } from "node:fs"
|
|
4
4
|
import { join } from "node:path"
|
|
5
|
+
import { homedir } from "node:os"
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const HOME = homedir()
|
|
8
|
+
const LOLA_DIR = join(HOME, ".lola")
|
|
7
9
|
const LOLA_REPO = "git@github.com:nimbuslab/lola.git"
|
|
8
|
-
const USER_MEMORY = join(
|
|
10
|
+
const USER_MEMORY = join(HOME, ".claude", "USER_MEMORY.md")
|
|
9
11
|
|
|
10
12
|
async function installLola(): Promise<void> {
|
|
11
13
|
console.log()
|
|
@@ -49,7 +51,7 @@ async function installLola(): Promise<void> {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
// Verificar USER_MEMORY.md
|
|
52
|
-
const claudeDir = join(
|
|
54
|
+
const claudeDir = join(HOME, ".claude")
|
|
53
55
|
if (!existsSync(USER_MEMORY)) {
|
|
54
56
|
console.log()
|
|
55
57
|
console.log(pc.cyan(" Criando USER_MEMORY.md..."))
|
|
@@ -242,7 +244,7 @@ async function onboardDev(): Promise<void> {
|
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
// Atualizar USER_MEMORY.md
|
|
245
|
-
const claudeDir = join(
|
|
247
|
+
const claudeDir = join(HOME, ".claude")
|
|
246
248
|
await Bun.$`mkdir -p ${claudeDir}`
|
|
247
249
|
|
|
248
250
|
const content = `# User Memory
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as p from "@clack/prompts"
|
|
2
|
+
import pc from "picocolors"
|
|
3
|
+
import { execSync, spawnSync } from "child_process"
|
|
4
|
+
|
|
5
|
+
const PACKAGE_NAME = "@nimbuslab/cli"
|
|
6
|
+
|
|
7
|
+
async function getAvailableVersions(): Promise<string[]> {
|
|
8
|
+
try {
|
|
9
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}`)
|
|
10
|
+
if (!res.ok) return []
|
|
11
|
+
const data = await res.json() as { versions?: Record<string, unknown> }
|
|
12
|
+
return Object.keys(data.versions || {}).reverse()
|
|
13
|
+
} catch {
|
|
14
|
+
return []
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async function getLatestVersion(): Promise<string | null> {
|
|
19
|
+
try {
|
|
20
|
+
const res = await fetch(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`)
|
|
21
|
+
if (!res.ok) return null
|
|
22
|
+
const data = await res.json() as { version?: string }
|
|
23
|
+
return data.version || null
|
|
24
|
+
} catch {
|
|
25
|
+
return null
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function getCurrentVersion(): string {
|
|
30
|
+
try {
|
|
31
|
+
const result = spawnSync("npm", ["ls", "-g", PACKAGE_NAME, "--json"], {
|
|
32
|
+
encoding: "utf-8",
|
|
33
|
+
shell: true,
|
|
34
|
+
})
|
|
35
|
+
if (result.stdout) {
|
|
36
|
+
const data = JSON.parse(result.stdout)
|
|
37
|
+
return data.dependencies?.[PACKAGE_NAME]?.version || "unknown"
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
// ignore
|
|
41
|
+
}
|
|
42
|
+
return "unknown"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function update(args: string[]) {
|
|
46
|
+
const flag = args[0]
|
|
47
|
+
|
|
48
|
+
// nimbus update --list
|
|
49
|
+
if (flag === "--list" || flag === "-l") {
|
|
50
|
+
p.intro(pc.cyan("Versões disponíveis"))
|
|
51
|
+
|
|
52
|
+
const spinner = p.spinner()
|
|
53
|
+
spinner.start("Buscando versões...")
|
|
54
|
+
|
|
55
|
+
const versions = await getAvailableVersions()
|
|
56
|
+
spinner.stop("Versões encontradas")
|
|
57
|
+
|
|
58
|
+
if (versions.length === 0) {
|
|
59
|
+
p.log.error("Não foi possível buscar as versões")
|
|
60
|
+
return
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const current = getCurrentVersion()
|
|
64
|
+
|
|
65
|
+
console.log()
|
|
66
|
+
console.log(pc.bold("Últimas 10 versões:"))
|
|
67
|
+
versions.slice(0, 10).forEach((v, i) => {
|
|
68
|
+
const isCurrent = v === current
|
|
69
|
+
const prefix = isCurrent ? pc.green("→ ") : " "
|
|
70
|
+
const suffix = isCurrent ? pc.dim(" (instalada)") : ""
|
|
71
|
+
const isLatest = i === 0 ? pc.yellow(" (latest)") : ""
|
|
72
|
+
console.log(`${prefix}${v}${suffix}${isLatest}`)
|
|
73
|
+
})
|
|
74
|
+
console.log()
|
|
75
|
+
console.log(pc.dim(`Total: ${versions.length} versões`))
|
|
76
|
+
console.log(pc.dim(`Instalar versão específica: nimbus update <versão>`))
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// nimbus update [version]
|
|
81
|
+
const targetVersion = flag || "latest"
|
|
82
|
+
const isSpecificVersion = flag && flag !== "latest"
|
|
83
|
+
|
|
84
|
+
p.intro(pc.cyan(`Atualizando ${PACKAGE_NAME}`))
|
|
85
|
+
|
|
86
|
+
const spinner = p.spinner()
|
|
87
|
+
|
|
88
|
+
// Verificar versão atual
|
|
89
|
+
spinner.start("Verificando versão atual...")
|
|
90
|
+
const currentVersion = getCurrentVersion()
|
|
91
|
+
spinner.stop(`Versão atual: ${currentVersion}`)
|
|
92
|
+
|
|
93
|
+
// Verificar versão alvo
|
|
94
|
+
if (!isSpecificVersion) {
|
|
95
|
+
spinner.start("Verificando última versão...")
|
|
96
|
+
const latest = await getLatestVersion()
|
|
97
|
+
spinner.stop(`Última versão: ${latest || "desconhecida"}`)
|
|
98
|
+
|
|
99
|
+
if (latest && latest === currentVersion) {
|
|
100
|
+
p.log.success("Você já está na última versão!")
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Confirmar
|
|
106
|
+
const versionText = isSpecificVersion ? targetVersion : "latest"
|
|
107
|
+
const confirmUpdate = await p.confirm({
|
|
108
|
+
message: `Atualizar para ${versionText}?`,
|
|
109
|
+
initialValue: true,
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
if (p.isCancel(confirmUpdate) || !confirmUpdate) {
|
|
113
|
+
p.cancel("Atualização cancelada")
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Executar update
|
|
118
|
+
spinner.start("Atualizando...")
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const packageSpec = isSpecificVersion
|
|
122
|
+
? `${PACKAGE_NAME}@${targetVersion}`
|
|
123
|
+
: PACKAGE_NAME
|
|
124
|
+
|
|
125
|
+
// Usar npm para instalação global (mais estável que bun)
|
|
126
|
+
execSync(`npm install -g ${packageSpec}`, {
|
|
127
|
+
stdio: "pipe",
|
|
128
|
+
encoding: "utf-8",
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
spinner.stop("Atualização concluída!")
|
|
132
|
+
|
|
133
|
+
// Verificar nova versão
|
|
134
|
+
const newVersion = getCurrentVersion()
|
|
135
|
+
|
|
136
|
+
p.log.success(`${PACKAGE_NAME} atualizado: ${currentVersion} → ${newVersion}`)
|
|
137
|
+
p.outro(pc.green("Pronto!"))
|
|
138
|
+
} catch (error) {
|
|
139
|
+
spinner.stop("Erro na atualização")
|
|
140
|
+
|
|
141
|
+
const err = error as Error & { stderr?: string }
|
|
142
|
+
p.log.error("Falha ao atualizar")
|
|
143
|
+
|
|
144
|
+
if (err.stderr) {
|
|
145
|
+
console.log(pc.dim(err.stderr))
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
console.log()
|
|
149
|
+
console.log(pc.yellow("Tente manualmente:"))
|
|
150
|
+
console.log(pc.cyan(` npm install -g ${PACKAGE_NAME}${isSpecificVersion ? `@${targetVersion}` : ""}`))
|
|
151
|
+
}
|
|
152
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,7 @@ import pc from "picocolors"
|
|
|
5
5
|
import { create } from "./commands/create"
|
|
6
6
|
import { analyze } from "./commands/analyze"
|
|
7
7
|
import { upgrade } from "./commands/upgrade"
|
|
8
|
+
import { update } from "./commands/update"
|
|
8
9
|
import { lola } from "./commands/lola"
|
|
9
10
|
|
|
10
11
|
const PACKAGE_NAME = "@nimbuslab/cli"
|
|
@@ -48,10 +49,10 @@ async function checkForUpdates(): Promise<string | null> {
|
|
|
48
49
|
function showUpdateNotice(latestVersion: string) {
|
|
49
50
|
const current = CURRENT_VERSION
|
|
50
51
|
const latest = latestVersion
|
|
51
|
-
const command =
|
|
52
|
+
const command = "nimbus update"
|
|
52
53
|
|
|
53
|
-
const line1 = `
|
|
54
|
-
const line2 = `
|
|
54
|
+
const line1 = ` Nova versão disponível: ${current} → ${latest}`
|
|
55
|
+
const line2 = ` Atualize com: ${command}`
|
|
55
56
|
|
|
56
57
|
const maxLen = Math.max(line1.length, line2.length)
|
|
57
58
|
const border = "─".repeat(maxLen + 2)
|
|
@@ -84,6 +85,8 @@ async function main() {
|
|
|
84
85
|
await analyze(args.slice(1))
|
|
85
86
|
} else if (command === "upgrade") {
|
|
86
87
|
await upgrade(args.slice(1))
|
|
88
|
+
} else if (command === "update") {
|
|
89
|
+
await update(args.slice(1))
|
|
87
90
|
} else if (command === "lola") {
|
|
88
91
|
await lola(args.slice(1))
|
|
89
92
|
} else if (command === "help" || command === "--help" || command === "-h") {
|
|
@@ -91,7 +94,7 @@ async function main() {
|
|
|
91
94
|
} else if (command === "version" || command === "--version" || command === "-v") {
|
|
92
95
|
showVersion()
|
|
93
96
|
} else {
|
|
94
|
-
console.log(pc.red(`
|
|
97
|
+
console.log(pc.red(`Comando desconhecido: ${command}`))
|
|
95
98
|
showHelp()
|
|
96
99
|
process.exit(1)
|
|
97
100
|
}
|
|
@@ -99,15 +102,16 @@ async function main() {
|
|
|
99
102
|
|
|
100
103
|
function showHelp() {
|
|
101
104
|
console.log(`
|
|
102
|
-
${pc.bold("
|
|
105
|
+
${pc.bold("Uso:")} nimbus [comando] [opções]
|
|
103
106
|
|
|
104
|
-
${pc.bold("
|
|
105
|
-
create [
|
|
106
|
-
analyze [dir]
|
|
107
|
-
upgrade [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
${pc.bold("Comandos:")}
|
|
108
|
+
create [nome] Criar novo projeto
|
|
109
|
+
analyze [dir] Analisar stack do projeto
|
|
110
|
+
upgrade [alvo] Atualizar dependências
|
|
111
|
+
update [versão] Atualizar o CLI
|
|
112
|
+
lola [ação] Lola - Code Agent
|
|
113
|
+
help Mostrar esta ajuda
|
|
114
|
+
version Mostrar versão
|
|
111
115
|
|
|
112
116
|
${pc.bold("Templates:")}
|
|
113
117
|
--landing Landing page (Next.js 16 + Tailwind 4 + shadcn)
|
|
@@ -115,29 +119,34 @@ ${pc.bold("Templates:")}
|
|
|
115
119
|
--turborepo Monorepo (Turborepo + apps/packages)
|
|
116
120
|
|
|
117
121
|
${pc.bold("Analyze & Upgrade:")}
|
|
118
|
-
analyze .
|
|
119
|
-
analyze --json Output
|
|
120
|
-
upgrade --plan
|
|
121
|
-
upgrade next
|
|
122
|
-
upgrade tailwind
|
|
123
|
-
|
|
124
|
-
${pc.bold("
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
--
|
|
128
|
-
|
|
122
|
+
analyze . Detectar stack e mostrar recomendações
|
|
123
|
+
analyze --json Output em JSON
|
|
124
|
+
upgrade --plan Mostrar plano de upgrade
|
|
125
|
+
upgrade next Atualizar Next.js
|
|
126
|
+
upgrade tailwind Atualizar Tailwind CSS
|
|
127
|
+
|
|
128
|
+
${pc.bold("Update (CLI):")}
|
|
129
|
+
update Atualizar para última versão
|
|
130
|
+
update 0.11.0 Instalar versão específica
|
|
131
|
+
update --list Listar versões disponíveis
|
|
132
|
+
|
|
133
|
+
${pc.bold("Opções:")}
|
|
134
|
+
-y, --yes Aceitar padrões
|
|
135
|
+
--no-git Não inicializar Git
|
|
136
|
+
--no-install Não instalar dependências
|
|
137
|
+
--template <url> Usar template customizado
|
|
129
138
|
|
|
130
139
|
${pc.bold("Lola (Code Agent):")}
|
|
131
|
-
lola install
|
|
132
|
-
lola suggest
|
|
140
|
+
lola install Instalar/atualizar Lola
|
|
141
|
+
lola suggest Sugerir melhoria (cria issue)
|
|
133
142
|
|
|
134
|
-
${pc.bold("
|
|
143
|
+
${pc.bold("Exemplos:")}
|
|
135
144
|
${pc.dim("$")} nimbus create my-landing --landing
|
|
136
145
|
${pc.dim("$")} nimbus create my-app --app
|
|
137
146
|
${pc.dim("$")} nimbus analyze ./my-project
|
|
138
147
|
${pc.dim("$")} nimbus upgrade --plan
|
|
148
|
+
${pc.dim("$")} nimbus update
|
|
139
149
|
${pc.dim("$")} nimbus lola install
|
|
140
|
-
${pc.dim("$")} nimbus lola suggest "add support for X"
|
|
141
150
|
`)
|
|
142
151
|
}
|
|
143
152
|
|