kiro-memory 1.2.2 → 1.3.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-memory",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "Persistent cross-session memory for Kiro CLI. Automatically tracks context, observations, and summaries across coding sessions.",
5
5
  "keywords": [
6
6
  "kiro",
@@ -1287,15 +1287,154 @@ function detectShellRc() {
1287
1287
  if (shell.includes("fish")) return { name: "fish", rcFile: join3(homedir3(), ".config/fish/config.fish") };
1288
1288
  return { name: "bash", rcFile: join3(homedir3(), ".bashrc") };
1289
1289
  }
1290
+ var AUTOFIXABLE_CHECKS = /* @__PURE__ */ new Set([
1291
+ "WSL: npm global prefix",
1292
+ "WSL: npm binary",
1293
+ "Build tools (native modules)",
1294
+ "better-sqlite3"
1295
+ ]);
1296
+ async function tryAutoFix(failedChecks) {
1297
+ const fixable = failedChecks.filter((c) => !c.ok && AUTOFIXABLE_CHECKS.has(c.name));
1298
+ if (fixable.length === 0) return { fixed: false, needsRestart: false };
1299
+ const { rcFile } = detectShellRc();
1300
+ let anyFixed = false;
1301
+ let needsRestart = false;
1302
+ console.log(` \x1B[36mFound ${fixable.length} issue(s) that can be fixed automatically:\x1B[0m
1303
+ `);
1304
+ for (const check of fixable) {
1305
+ console.log(` - ${check.name}: ${check.message}`);
1306
+ }
1307
+ console.log("");
1308
+ const answer = await askUser(" Fix automatically? [Y/n] ");
1309
+ if (answer !== "" && answer !== "y" && answer !== "yes") {
1310
+ console.log("\n Skipped auto-fix. Fix manually and run: kiro-memory install\n");
1311
+ return { fixed: false, needsRestart: false };
1312
+ }
1313
+ console.log("");
1314
+ const prefixCheck = fixable.find((c) => c.name === "WSL: npm global prefix");
1315
+ if (prefixCheck) {
1316
+ console.log(" Fixing npm global prefix...");
1317
+ try {
1318
+ const npmGlobalDir = join3(homedir3(), ".npm-global");
1319
+ mkdirSync3(npmGlobalDir, { recursive: true });
1320
+ execSync(`npm config set prefix "${npmGlobalDir}"`, { stdio: "ignore" });
1321
+ const exportLine = 'export PATH="$HOME/.npm-global/bin:$PATH"';
1322
+ let alreadyInRc = false;
1323
+ if (existsSync3(rcFile)) {
1324
+ const content = readFileSync2(rcFile, "utf8");
1325
+ alreadyInRc = content.includes(".npm-global/bin");
1326
+ }
1327
+ if (!alreadyInRc) {
1328
+ appendFileSync2(rcFile, `
1329
+ # npm global prefix (added by kiro-memory)
1330
+ ${exportLine}
1331
+ `);
1332
+ }
1333
+ process.env.PATH = `${npmGlobalDir}/bin:${process.env.PATH}`;
1334
+ console.log(` \x1B[32m\u2713\x1B[0m npm prefix set to ${npmGlobalDir}`);
1335
+ console.log(` \x1B[32m\u2713\x1B[0m PATH updated in ${rcFile}`);
1336
+ anyFixed = true;
1337
+ } catch (err) {
1338
+ console.log(` \x1B[31m\u2717\x1B[0m Could not fix npm prefix: ${err.message}`);
1339
+ }
1340
+ }
1341
+ const npmBinaryCheck = fixable.find((c) => c.name === "WSL: npm binary");
1342
+ if (npmBinaryCheck) {
1343
+ console.log("\n Fixing npm binary (installing nvm + Node.js 22)...");
1344
+ const nvmDir = join3(homedir3(), ".nvm");
1345
+ try {
1346
+ if (existsSync3(nvmDir)) {
1347
+ console.log(` nvm already installed at ${nvmDir}`);
1348
+ } else {
1349
+ console.log(" Downloading nvm...");
1350
+ execSync("curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash", {
1351
+ stdio: "inherit",
1352
+ timeout: 6e4
1353
+ });
1354
+ console.log(` \x1B[32m\u2713\x1B[0m nvm installed`);
1355
+ }
1356
+ console.log(" Installing Node.js 22 via nvm...");
1357
+ execSync('bash -c "source $HOME/.nvm/nvm.sh && nvm install 22"', {
1358
+ stdio: "inherit",
1359
+ timeout: 12e4
1360
+ });
1361
+ console.log(` \x1B[32m\u2713\x1B[0m Node.js 22 installed`);
1362
+ anyFixed = true;
1363
+ needsRestart = true;
1364
+ } catch (err) {
1365
+ console.log(` \x1B[31m\u2717\x1B[0m Could not install nvm/Node: ${err.message}`);
1366
+ console.log(" Install manually:");
1367
+ console.log(" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash");
1368
+ console.log(" source ~/.bashrc");
1369
+ console.log(" nvm install 22");
1370
+ }
1371
+ }
1372
+ const buildCheck = fixable.find((c) => c.name === "Build tools (native modules)");
1373
+ if (buildCheck) {
1374
+ console.log("\n Fixing build tools (requires sudo)...");
1375
+ try {
1376
+ execSync("sudo apt-get update -qq && sudo apt-get install -y build-essential python3", {
1377
+ stdio: "inherit",
1378
+ timeout: 12e4
1379
+ });
1380
+ console.log(` \x1B[32m\u2713\x1B[0m Build tools installed`);
1381
+ anyFixed = true;
1382
+ } catch (err) {
1383
+ console.log(` \x1B[31m\u2717\x1B[0m Could not install build tools: ${err.message}`);
1384
+ console.log(" Install manually: sudo apt-get install -y build-essential python3");
1385
+ }
1386
+ }
1387
+ const sqliteCheck = fixable.find((c) => c.name === "better-sqlite3");
1388
+ if (sqliteCheck) {
1389
+ console.log("\n Rebuilding better-sqlite3...");
1390
+ try {
1391
+ const globalDir = execSync("npm prefix -g", { encoding: "utf8" }).trim();
1392
+ const sqlitePkg = join3(globalDir, "lib", "node_modules", "kiro-memory");
1393
+ if (existsSync3(sqlitePkg)) {
1394
+ execSync(`cd "${sqlitePkg}" && npm rebuild better-sqlite3`, {
1395
+ stdio: "inherit",
1396
+ timeout: 6e4
1397
+ });
1398
+ } else {
1399
+ execSync("npm rebuild better-sqlite3", { stdio: "inherit", timeout: 6e4 });
1400
+ }
1401
+ console.log(` \x1B[32m\u2713\x1B[0m better-sqlite3 rebuilt`);
1402
+ anyFixed = true;
1403
+ } catch (err) {
1404
+ console.log(` \x1B[31m\u2717\x1B[0m Could not rebuild: ${err.message}`);
1405
+ console.log(" Try: npm install -g kiro-memory --build-from-source");
1406
+ }
1407
+ }
1408
+ console.log("");
1409
+ return { fixed: anyFixed, needsRestart };
1410
+ }
1290
1411
  async function installKiro() {
1291
1412
  console.log("\n=== Kiro Memory - Installation ===\n");
1292
- console.log("[1/3] Running environment checks...");
1293
- const checks = runEnvironmentChecks();
1294
- const { hasErrors } = printChecks(checks);
1413
+ console.log("[1/4] Running environment checks...");
1414
+ let checks = runEnvironmentChecks();
1415
+ let { hasErrors } = printChecks(checks);
1295
1416
  if (hasErrors) {
1296
- console.log("\x1B[31mInstallation aborted.\x1B[0m Fix the issues above and retry.");
1297
- console.log("After fixing, run: kiro-memory install\n");
1298
- process.exit(1);
1417
+ const { fixed, needsRestart } = await tryAutoFix(checks);
1418
+ if (needsRestart) {
1419
+ console.log(" \x1B[33m\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\x1B[0m");
1420
+ console.log(" \x1B[33m\u2502\x1B[0m Node.js was installed via nvm. To activate it: \x1B[33m\u2502\x1B[0m");
1421
+ console.log(" \x1B[33m\u2502\x1B[0m \x1B[33m\u2502\x1B[0m");
1422
+ console.log(" \x1B[33m\u2502\x1B[0m 1. Close and reopen your terminal \x1B[33m\u2502\x1B[0m");
1423
+ console.log(" \x1B[33m\u2502\x1B[0m 2. Run: \x1B[1mnpm install -g kiro-memory\x1B[0m \x1B[33m\u2502\x1B[0m");
1424
+ console.log(" \x1B[33m\u2502\x1B[0m 3. Run: \x1B[1mkiro-memory install\x1B[0m \x1B[33m\u2502\x1B[0m");
1425
+ console.log(" \x1B[33m\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\x1B[0m\n");
1426
+ process.exit(0);
1427
+ }
1428
+ if (fixed) {
1429
+ console.log(" Re-running checks...\n");
1430
+ checks = runEnvironmentChecks();
1431
+ ({ hasErrors } = printChecks(checks));
1432
+ }
1433
+ if (hasErrors) {
1434
+ console.log("\x1B[31mInstallation aborted.\x1B[0m Fix the remaining issues and retry.");
1435
+ console.log("After fixing, run: kiro-memory install\n");
1436
+ process.exit(1);
1437
+ }
1299
1438
  }
1300
1439
  const distDir = DIST_DIR;
1301
1440
  const kiroDir = process.env.KIRO_CONFIG_DIR || join3(homedir3(), ".kiro");
@@ -1303,7 +1442,7 @@ async function installKiro() {
1303
1442
  const settingsDir = join3(kiroDir, "settings");
1304
1443
  const steeringDir = join3(kiroDir, "steering");
1305
1444
  const dataDir = process.env.CONTEXTKIT_DATA_DIR || join3(homedir3(), ".contextkit");
1306
- console.log("[2/3] Installing Kiro configuration...\n");
1445
+ console.log("[2/4] Installing Kiro configuration...\n");
1307
1446
  for (const dir of [agentsDir, settingsDir, steeringDir, dataDir]) {
1308
1447
  mkdirSync3(dir, { recursive: true });
1309
1448
  }
@@ -1330,8 +1469,8 @@ async function installKiro() {
1330
1469
  writeFileSync(steeringDestPath, STEERING_CONTENT, "utf8");
1331
1470
  console.log(` \u2192 Steering: ${steeringDestPath}`);
1332
1471
  console.log(` \u2192 Data dir: ${dataDir}`);
1333
- console.log("\n[3/3] Shell alias setup\n");
1334
- const { name: shellName, rcFile } = detectShellRc();
1472
+ console.log("\n[3/4] Shell alias setup\n");
1473
+ const { rcFile } = detectShellRc();
1335
1474
  const aliasLine = 'alias kiro="kiro-cli --agent contextkit-memory"';
1336
1475
  let aliasAlreadySet = false;
1337
1476
  if (existsSync3(rcFile)) {
@@ -1370,7 +1509,8 @@ ${aliasLine}
1370
1509
  console.log(` echo '${aliasLine}' >> ${rcFile}`);
1371
1510
  }
1372
1511
  }
1373
- console.log("\n\x1B[32m\u2550\u2550\u2550 Installation complete! \u2550\u2550\u2550\x1B[0m\n");
1512
+ console.log("\n[4/4] Done!\n");
1513
+ console.log(" \x1B[32m\u2550\u2550\u2550 Installation complete! \u2550\u2550\u2550\x1B[0m\n");
1374
1514
  console.log(" Start Kiro with memory:");
1375
1515
  if (aliasAlreadySet) {
1376
1516
  console.log(" \x1B[1mkiro\x1B[0m");