md4ai 0.9.6 → 0.9.8

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.
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
4
10
  var __esm = (fn, res) => function __init() {
5
11
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
6
12
  };
@@ -252,6 +258,9 @@ async function parseFileReferences(filePath, projectRoot) {
252
258
  const target = match[1];
253
259
  if (!target || target.startsWith("http") || target.startsWith("#"))
254
260
  continue;
261
+ const baseName = target.split("/").pop() ?? target;
262
+ if (!target.includes("/") && /^[A-Z]/.test(baseName))
263
+ continue;
255
264
  const resolved = resolveTarget(target, filePath, projectRoot);
256
265
  if (resolved && existsSync2(resolved)) {
257
266
  addRef(refs, relPath, resolved, projectRoot);
@@ -294,6 +303,11 @@ function resolveTarget(target, sourceFilePath, projectRoot) {
294
303
  if (target.startsWith(".claude/") || target.startsWith("docs/")) {
295
304
  return join2(projectRoot, target);
296
305
  }
306
+ if (target.includes("/")) {
307
+ const fromRoot = join2(projectRoot, target);
308
+ if (existsSync2(fromRoot))
309
+ return fromRoot;
310
+ }
297
311
  return resolve2(dirname(sourceFilePath), target);
298
312
  }
299
313
  function addRef(refs, fromRel, resolvedAbsolute, projectRoot) {
@@ -1308,7 +1322,8 @@ async function scanProject(projectRoot) {
1308
1322
  }
1309
1323
  }
1310
1324
  }
1311
- const brokenRefs = allBrokenRefs.map((br) => ({
1325
+ const filteredBroken = allBrokenRefs.filter((br) => classifyFileType(br.from) !== "plan");
1326
+ const brokenRefs = filteredBroken.map((br) => ({
1312
1327
  ...br,
1313
1328
  depth: depthMap.get(br.from) ?? 999
1314
1329
  }));
@@ -1636,7 +1651,7 @@ var CURRENT_VERSION;
1636
1651
  var init_check_update = __esm({
1637
1652
  "dist/check-update.js"() {
1638
1653
  "use strict";
1639
- CURRENT_VERSION = true ? "0.9.6" : "0.0.0-dev";
1654
+ CURRENT_VERSION = true ? "0.9.8" : "0.0.0-dev";
1640
1655
  }
1641
1656
  });
1642
1657
 
@@ -2334,6 +2349,26 @@ function getProcessTable() {
2334
2349
  return [];
2335
2350
  }
2336
2351
  }
2352
+ function detectSessionCwds(processes) {
2353
+ const { readlinkSync } = __require("node:fs");
2354
+ const cwdByTty = /* @__PURE__ */ new Map();
2355
+ const claudeProcs = processes.filter((p) => {
2356
+ const lower = p.args.toLowerCase();
2357
+ return lower.includes("/claude ") || lower.includes("/claude\n") || lower.endsWith("/claude") || lower.includes(" claude ") || lower === "claude" || lower.includes("/.claude/") || lower.includes("claude-code");
2358
+ });
2359
+ for (const proc of claudeProcs) {
2360
+ const tty = proc.tty === "?" ? "" : proc.tty;
2361
+ if (!tty || cwdByTty.has(tty))
2362
+ continue;
2363
+ try {
2364
+ const cwd = readlinkSync(`/proc/${proc.pid}/cwd`, { encoding: "utf-8" });
2365
+ if (cwd)
2366
+ cwdByTty.set(tty, cwd);
2367
+ } catch {
2368
+ }
2369
+ }
2370
+ return cwdByTty;
2371
+ }
2337
2372
  var init_scan_processes = __esm({
2338
2373
  "dist/mcp/scan-processes.js"() {
2339
2374
  "use strict";
@@ -2397,6 +2432,7 @@ async function checkChromeCdp() {
2397
2432
  }
2398
2433
  function buildRows(configs, httpResults, cdpStatus) {
2399
2434
  const processes = getProcessTable();
2435
+ const sessionCwds = detectSessionCwds(processes);
2400
2436
  const rows = [];
2401
2437
  for (const config2 of configs) {
2402
2438
  const { required, missing } = checkEnvVars(config2);
@@ -2415,6 +2451,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2415
2451
  status,
2416
2452
  pid: null,
2417
2453
  session_tty: null,
2454
+ session_cwd: null,
2418
2455
  uptime_seconds: null,
2419
2456
  memory_mb: null,
2420
2457
  env_vars_required: required.length ? required : null,
@@ -2434,6 +2471,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2434
2471
  status: "error",
2435
2472
  pid: null,
2436
2473
  session_tty: null,
2474
+ session_cwd: null,
2437
2475
  uptime_seconds: null,
2438
2476
  memory_mb: null,
2439
2477
  env_vars_required: required,
@@ -2456,6 +2494,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2456
2494
  status: "stopped",
2457
2495
  pid: null,
2458
2496
  session_tty: null,
2497
+ session_cwd: null,
2459
2498
  uptime_seconds: null,
2460
2499
  memory_mb: null,
2461
2500
  env_vars_required: required.length ? required : null,
@@ -2482,6 +2521,7 @@ function buildRows(configs, httpResults, cdpStatus) {
2482
2521
  status: "running",
2483
2522
  pid: match.pid,
2484
2523
  session_tty: match.tty || null,
2524
+ session_cwd: (match.tty ? sessionCwds.get(match.tty) : null) ?? null,
2485
2525
  uptime_seconds: match.uptimeSeconds,
2486
2526
  memory_mb: match.memoryMb,
2487
2527
  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.6",
3
+ "version": "0.9.8",
4
4
  "description": "CLI for MD4AI — scan Claude projects and sync to your dashboard",
5
5
  "type": "module",
6
6
  "bin": {