@pulso/companion 0.4.9 → 0.4.11

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11245,29 +11245,45 @@ print(result.stdout[:5000])
11245
11245
  }
11246
11246
  case "sys_claude_status": {
11247
11247
  const _home = process.env.HOME || "";
11248
+ const _npmGlobal = execSync3("npm config get prefix 2>/dev/null", { encoding: "utf8" }).trim();
11248
11249
  const _claudePaths = [
11249
11250
  `${_home}/.local/bin/claude`,
11250
11251
  `${_home}/.local/share/claude/versions/latest/claude`,
11251
11252
  "/usr/local/bin/claude",
11252
- "/opt/homebrew/bin/claude"
11253
+ "/opt/homebrew/bin/claude",
11254
+ `${_npmGlobal}/bin/claude`,
11255
+ `${_home}/.npm-global/bin/claude`,
11256
+ `${_home}/.volta/bin/claude`,
11257
+ `${_home}/.nvm/versions/node/$(node --version 2>/dev/null)/bin/claude`
11253
11258
  ];
11254
- let _claudeBin = "claude";
11255
- for (const _p of _claudePaths) {
11256
- try {
11257
- execSync3(`test -x "${_p}"`, { stdio: "ignore" });
11258
- _claudeBin = _p;
11259
- break;
11260
- } catch {
11259
+ let _claudeBin = "";
11260
+ try {
11261
+ _claudeBin = execSync3("which claude 2>/dev/null", {
11262
+ encoding: "utf8",
11263
+ env: { ...process.env, PATH: augmentedPath2() }
11264
+ }).trim();
11265
+ } catch {
11266
+ }
11267
+ if (!_claudeBin) {
11268
+ for (const _p of _claudePaths) {
11269
+ try {
11270
+ execSync3(`test -x "${_p}"`, { stdio: "ignore" });
11271
+ _claudeBin = _p;
11272
+ break;
11273
+ } catch {
11274
+ }
11261
11275
  }
11262
11276
  }
11277
+ if (!_claudeBin) _claudeBin = "claude";
11263
11278
  try {
11264
11279
  const version = await runShell4(`"${_claudeBin}" --version 2>/dev/null`, 5e3);
11265
11280
  let authStatus = "unknown";
11266
11281
  let authDetails;
11267
11282
  try {
11268
11283
  const status = await runShell4(`"${_claudeBin}" auth status 2>&1`, 1e4);
11269
- const jsonLine = status.split("\n").find((l) => l.trimStart().startsWith("{"));
11270
- const trimmed = jsonLine?.trim() ?? status.trim();
11284
+ const jsonStart = status.indexOf("{");
11285
+ const jsonEnd = status.lastIndexOf("}");
11286
+ const trimmed = jsonStart !== -1 && jsonEnd > jsonStart ? status.slice(jsonStart, jsonEnd + 1) : status.trim();
11271
11287
  let parsed = null;
11272
11288
  try {
11273
11289
  parsed = JSON.parse(trimmed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulso/companion",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "type": "module",
5
5
  "description": "Pulso Companion — gives your AI agent real control over your computer",
6
6
  "bin": {