bloby-bot 0.51.5 → 0.52.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/bin/cli.js CHANGED
@@ -17,6 +17,23 @@ const CONFIG_PATH = path.join(DATA_DIR, 'config.json');
17
17
  const BIN_DIR = path.join(DATA_DIR, 'bin');
18
18
  const CF_PATH = path.join(BIN_DIR, 'cloudflared');
19
19
 
20
+ // claude-agent-sdk 0.3.x moved @anthropic-ai/sdk + @modelcontextprotocol/sdk to
21
+ // peerDependencies. Upgrading an existing ~/.bloby in place (the old 0.2.x tree had
22
+ // them as regular deps) makes npm's resolver deadlock with ERESOLVE. We declare those
23
+ // peers as direct deps and persist legacy-peer-deps in ~/.bloby/.npmrc so EVERY
24
+ // `npm install` there — updater, self-heal, manual recovery — resolves regardless of
25
+ // which cli version invokes it. (.npmrc is excluded from npm tarballs, so it has to be
26
+ // written at runtime rather than shipped.)
27
+ function ensureNpmrc(dir) {
28
+ try {
29
+ const p = path.join(dir, '.npmrc');
30
+ const cur = fs.existsSync(p) ? fs.readFileSync(p, 'utf-8') : '';
31
+ if (!/^legacy-peer-deps\s*=/m.test(cur)) {
32
+ fs.writeFileSync(p, (cur && !cur.endsWith('\n') ? cur + '\n' : cur) + 'legacy-peer-deps=true\n');
33
+ }
34
+ } catch { /* best-effort */ }
35
+ }
36
+
20
37
  // ── Ensure dependencies exist (self-heal if postinstall/update npm install failed) ──
21
38
  // Check every declared dep, not just one sentinel: a release that adds a new
22
39
  // dep would otherwise silently boot into an `ERR_MODULE_NOT_FOUND` crash loop.
@@ -35,6 +52,7 @@ if (!IS_DEV) {
35
52
  if (missing.length > 0) {
36
53
  console.error(`\n Installing missing dependencies: ${missing.slice(0, 5).join(', ')}${missing.length > 5 ? `, +${missing.length - 5} more` : ''}\n`);
37
54
  try {
55
+ ensureNpmrc(ROOT);
38
56
  execSync('npm install --omit=dev', { cwd: ROOT, stdio: 'inherit' });
39
57
  } catch {
40
58
  console.error('\n ✗ Failed to install dependencies. Run manually:\n cd ~/.bloby && npm install\n');
@@ -1524,6 +1542,7 @@ async function update() {
1524
1542
  // app permanently broken (e.g. crash loop on a new import). Treat as fatal,
1525
1543
  // surface the npm output so the cause is debuggable, and don't claim success.
1526
1544
  try {
1545
+ ensureNpmrc(DATA_DIR);
1527
1546
  execSync('npm install --omit=dev', { cwd: DATA_DIR, stdio: 'pipe', timeout: 300_000 });
1528
1547
  } catch (e) {
1529
1548
  if (e.stdout) process.stderr.write(e.stdout);