adhdev 0.9.82-rc.4 → 0.9.82-rc.6

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/dist/cli/index.js CHANGED
@@ -46402,6 +46402,26 @@ function readBooleanValue(...values) {
46402
46402
  }
46403
46403
  return void 0;
46404
46404
  }
46405
+ function readGitSubmodules(value) {
46406
+ if (!Array.isArray(value)) return void 0;
46407
+ const submodules = value.map((entry) => {
46408
+ const submodule = readObjectRecord(entry);
46409
+ const path42 = readStringValue(submodule.path);
46410
+ const commit = readStringValue(submodule.commit);
46411
+ const repoPath = readStringValue(submodule.repoPath, submodule.repo_root);
46412
+ if (!path42 || !commit || !repoPath) return null;
46413
+ return {
46414
+ path: path42,
46415
+ commit,
46416
+ repoPath,
46417
+ dirty: readBooleanValue(submodule.dirty) ?? false,
46418
+ outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
46419
+ lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
46420
+ ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
46421
+ };
46422
+ }).filter((entry) => entry !== null);
46423
+ return submodules.length > 0 ? submodules : void 0;
46424
+ }
46405
46425
  function buildCachedInlineMeshGitStatus(node) {
46406
46426
  const cachedStatus = readObjectRecord(node?.cachedStatus);
46407
46427
  const cachedGit = readObjectRecord(cachedStatus.git);
@@ -46411,6 +46431,7 @@ function buildCachedInlineMeshGitStatus(node) {
46411
46431
  const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
46412
46432
  const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
46413
46433
  if (isGitRepo2 !== void 0) {
46434
+ const submodules2 = readGitSubmodules(cachedGit.submodules);
46414
46435
  return {
46415
46436
  workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
46416
46437
  repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -46429,7 +46450,8 @@ function buildCachedInlineMeshGitStatus(node) {
46429
46450
  hasConflicts: hasConflicts2,
46430
46451
  conflictFiles: conflictFiles2,
46431
46452
  stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
46432
- lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
46453
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
46454
+ ...submodules2 ? { submodules: submodules2 } : {}
46433
46455
  };
46434
46456
  }
46435
46457
  }
@@ -46448,6 +46470,7 @@ function buildCachedInlineMeshGitStatus(node) {
46448
46470
  const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
46449
46471
  const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
46450
46472
  const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
46473
+ const submodules = readGitSubmodules(status.submodules);
46451
46474
  return {
46452
46475
  workspace: readStringValue(status.workspace, node?.workspace) || "",
46453
46476
  repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -46466,7 +46489,8 @@ function buildCachedInlineMeshGitStatus(node) {
46466
46489
  hasConflicts,
46467
46490
  conflictFiles,
46468
46491
  stashCount: readNumberValue(status.stashCount) ?? 0,
46469
- lastCheckedAt: Date.now()
46492
+ lastCheckedAt: Date.now(),
46493
+ ...submodules ? { submodules } : {}
46470
46494
  };
46471
46495
  }
46472
46496
  function applyCachedInlineMeshNodeStatus(status, node) {
@@ -46878,6 +46902,7 @@ var init_router = __esm({
46878
46902
  init_chat_history();
46879
46903
  init_ide_detector();
46880
46904
  init_cli_detector();
46905
+ init_git_status();
46881
46906
  init_logger();
46882
46907
  init_command_log();
46883
46908
  init_js_yaml();
@@ -48785,63 +48810,15 @@ ${block}`);
48785
48810
  continue;
48786
48811
  }
48787
48812
  try {
48788
- const { execFile: execFile3 } = await import("child_process");
48789
- const { promisify: promisify3 } = await import("util");
48790
- const execFileAsync3 = promisify3(execFile3);
48791
- const runGit2 = async (args2) => {
48792
- const result = await execFileAsync3("git", ["-C", node.workspace, ...args2], {
48793
- encoding: "utf8",
48794
- timeout: 1e4
48795
- });
48796
- return result.stdout.trim();
48797
- };
48798
- const branch = await runGit2(["branch", "--show-current"]).catch(() => "");
48799
- const porc = await runGit2(["status", "--porcelain"]).catch(() => "");
48800
- const headCommit = await runGit2(["rev-parse", "--short", "HEAD"]).catch(() => null);
48801
- const headMessage = await runGit2(["log", "-1", "--format=%s"]).catch(() => null);
48802
- const upstream = await runGit2(["rev-parse", "--abbrev-ref", "@{upstream}"]).catch(() => null);
48803
- const aheadBehind = await runGit2(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]).catch(() => "");
48804
- const stashCount = await runGit2(["stash", "list"]).catch(() => "");
48805
- let ahead = 0, behind = 0;
48806
- if (aheadBehind) {
48807
- const parts = aheadBehind.split(/\s+/);
48808
- if (parts.length >= 2) {
48809
- behind = parseInt(parts[0], 10) || 0;
48810
- ahead = parseInt(parts[1], 10) || 0;
48811
- }
48812
- }
48813
- const dirty = porc.length > 0;
48814
- const lines = porc ? porc.split("\n").filter(Boolean) : [];
48815
- let staged = 0, modified = 0, untracked = 0, deleted = 0, renamed2 = 0;
48816
- for (const line of lines) {
48817
- const xy = line.slice(0, 2);
48818
- if (xy[0] !== " " && xy[0] !== "?") staged++;
48819
- if (xy[1] === "M") modified++;
48820
- if (xy[1] === "D") deleted++;
48821
- if (xy[0] === "R" || xy[1] === "R") renamed2++;
48822
- if (xy === "??") untracked++;
48813
+ const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
48814
+ status.git = gitStatus;
48815
+ if (gitStatus.isGitRepo) {
48816
+ const dirty = gitStatus.staged + gitStatus.modified + gitStatus.untracked + gitStatus.deleted + gitStatus.renamed > 0;
48817
+ status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
48818
+ } else {
48819
+ status.health = "degraded";
48820
+ if (gitStatus.error && !status.error) status.error = gitStatus.error;
48823
48821
  }
48824
- status.git = {
48825
- workspace: node.workspace,
48826
- repoRoot: node.workspace,
48827
- isGitRepo: true,
48828
- branch: branch || null,
48829
- headCommit,
48830
- headMessage,
48831
- upstream,
48832
- ahead,
48833
- behind,
48834
- staged,
48835
- modified,
48836
- untracked,
48837
- deleted,
48838
- renamed: renamed2,
48839
- hasConflicts: false,
48840
- conflictFiles: [],
48841
- stashCount: stashCount ? stashCount.split("\n").filter(Boolean).length : 0,
48842
- lastCheckedAt: Date.now()
48843
- };
48844
- status.health = branch ? dirty ? "dirty" : "online" : "degraded";
48845
48822
  } catch {
48846
48823
  if (!applyCachedInlineMeshNodeStatus(status, node)) {
48847
48824
  status.health = "degraded";
@@ -97817,7 +97794,7 @@ var init_adhdev_daemon = __esm({
97817
97794
  init_version();
97818
97795
  init_src();
97819
97796
  init_runtime_defaults();
97820
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.4" });
97797
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.6" });
97821
97798
  AdhdevDaemon = class _AdhdevDaemon {
97822
97799
  localHttpServer = null;
97823
97800
  localWss = null;