md4ai 0.9.7 → 0.9.9

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.
@@ -1645,7 +1645,7 @@ var CURRENT_VERSION;
1645
1645
  var init_check_update = __esm({
1646
1646
  "dist/check-update.js"() {
1647
1647
  "use strict";
1648
- CURRENT_VERSION = true ? "0.9.7" : "0.0.0-dev";
1648
+ CURRENT_VERSION = true ? "0.9.9" : "0.0.0-dev";
1649
1649
  }
1650
1650
  });
1651
1651
 
@@ -2255,6 +2255,7 @@ var init_read_configs = __esm({
2255
2255
 
2256
2256
  // dist/mcp/scan-processes.js
2257
2257
  import { execFileSync as execFileSync4 } from "node:child_process";
2258
+ import { readlinkSync } from "node:fs";
2258
2259
  function parsePsOutput(output) {
2259
2260
  const lines = output.trim().split("\n").slice(1);
2260
2261
  const entries = [];
@@ -2343,6 +2344,25 @@ function getProcessTable() {
2343
2344
  return [];
2344
2345
  }
2345
2346
  }
2347
+ function detectSessionCwds(processes) {
2348
+ const cwdByTty = /* @__PURE__ */ new Map();
2349
+ const claudeProcs = processes.filter((p) => {
2350
+ const lower = p.args.toLowerCase();
2351
+ return lower.includes("/claude ") || lower.includes("/claude\n") || lower.endsWith("/claude") || lower.includes(" claude ") || lower === "claude" || lower.includes("/.claude/") || lower.includes("claude-code");
2352
+ });
2353
+ for (const proc of claudeProcs) {
2354
+ const tty = proc.tty === "?" ? "" : proc.tty;
2355
+ if (!tty || cwdByTty.has(tty))
2356
+ continue;
2357
+ try {
2358
+ const cwd = readlinkSync(`/proc/${proc.pid}/cwd`, { encoding: "utf-8" });
2359
+ if (cwd)
2360
+ cwdByTty.set(tty, cwd);
2361
+ } catch {
2362
+ }
2363
+ }
2364
+ return cwdByTty;
2365
+ }
2346
2366
  var init_scan_processes = __esm({
2347
2367
  "dist/mcp/scan-processes.js"() {
2348
2368
  "use strict";
@@ -2406,6 +2426,7 @@ async function checkChromeCdp() {
2406
2426
  }
2407
2427
  function buildRows(configs, httpResults, cdpStatus) {
2408
2428
  const processes = getProcessTable();
2429
+ const sessionCwds = detectSessionCwds(processes);
2409
2430
  const rows = [];
2410
2431
  for (const config2 of configs) {
2411
2432
  const { required, missing } = checkEnvVars(config2);
@@ -2424,6 +2445,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2424
2445
  status,
2425
2446
  pid: null,
2426
2447
  session_tty: null,
2448
+ session_cwd: null,
2427
2449
  uptime_seconds: null,
2428
2450
  memory_mb: null,
2429
2451
  env_vars_required: required.length ? required : null,
@@ -2443,6 +2465,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2443
2465
  status: "error",
2444
2466
  pid: null,
2445
2467
  session_tty: null,
2468
+ session_cwd: null,
2446
2469
  uptime_seconds: null,
2447
2470
  memory_mb: null,
2448
2471
  env_vars_required: required,
@@ -2465,6 +2488,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2465
2488
  status: "stopped",
2466
2489
  pid: null,
2467
2490
  session_tty: null,
2491
+ session_cwd: null,
2468
2492
  uptime_seconds: null,
2469
2493
  memory_mb: null,
2470
2494
  env_vars_required: required.length ? required : null,
@@ -2491,6 +2515,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2491
2515
  status: "running",
2492
2516
  pid: match.pid,
2493
2517
  session_tty: match.tty || null,
2518
+ session_cwd: (match.tty ? sessionCwds.get(match.tty) : null) ?? null,
2494
2519
  uptime_seconds: match.uptimeSeconds,
2495
2520
  memory_mb: match.memoryMb,
2496
2521
  env_vars_required: required.length ? required : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md4ai",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {