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/index.js CHANGED
@@ -45414,6 +45414,26 @@ function readBooleanValue(...values) {
45414
45414
  }
45415
45415
  return void 0;
45416
45416
  }
45417
+ function readGitSubmodules(value) {
45418
+ if (!Array.isArray(value)) return void 0;
45419
+ const submodules = value.map((entry) => {
45420
+ const submodule = readObjectRecord(entry);
45421
+ const path35 = readStringValue(submodule.path);
45422
+ const commit = readStringValue(submodule.commit);
45423
+ const repoPath = readStringValue(submodule.repoPath, submodule.repo_root);
45424
+ if (!path35 || !commit || !repoPath) return null;
45425
+ return {
45426
+ path: path35,
45427
+ commit,
45428
+ repoPath,
45429
+ dirty: readBooleanValue(submodule.dirty) ?? false,
45430
+ outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
45431
+ lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
45432
+ ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
45433
+ };
45434
+ }).filter((entry) => entry !== null);
45435
+ return submodules.length > 0 ? submodules : void 0;
45436
+ }
45417
45437
  function buildCachedInlineMeshGitStatus(node) {
45418
45438
  const cachedStatus = readObjectRecord(node?.cachedStatus);
45419
45439
  const cachedGit = readObjectRecord(cachedStatus.git);
@@ -45423,6 +45443,7 @@ function buildCachedInlineMeshGitStatus(node) {
45423
45443
  const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
45424
45444
  const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
45425
45445
  if (isGitRepo2 !== void 0) {
45446
+ const submodules2 = readGitSubmodules(cachedGit.submodules);
45426
45447
  return {
45427
45448
  workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
45428
45449
  repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -45441,7 +45462,8 @@ function buildCachedInlineMeshGitStatus(node) {
45441
45462
  hasConflicts: hasConflicts2,
45442
45463
  conflictFiles: conflictFiles2,
45443
45464
  stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
45444
- lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
45465
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
45466
+ ...submodules2 ? { submodules: submodules2 } : {}
45445
45467
  };
45446
45468
  }
45447
45469
  }
@@ -45460,6 +45482,7 @@ function buildCachedInlineMeshGitStatus(node) {
45460
45482
  const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
45461
45483
  const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
45462
45484
  const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
45485
+ const submodules = readGitSubmodules(status.submodules);
45463
45486
  return {
45464
45487
  workspace: readStringValue(status.workspace, node?.workspace) || "",
45465
45488
  repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -45478,7 +45501,8 @@ function buildCachedInlineMeshGitStatus(node) {
45478
45501
  hasConflicts,
45479
45502
  conflictFiles,
45480
45503
  stashCount: readNumberValue(status.stashCount) ?? 0,
45481
- lastCheckedAt: Date.now()
45504
+ lastCheckedAt: Date.now(),
45505
+ ...submodules ? { submodules } : {}
45482
45506
  };
45483
45507
  }
45484
45508
  function applyCachedInlineMeshNodeStatus(status, node) {
@@ -45890,6 +45914,7 @@ var init_router = __esm({
45890
45914
  init_chat_history();
45891
45915
  init_ide_detector();
45892
45916
  init_cli_detector();
45917
+ init_git_status();
45893
45918
  init_logger();
45894
45919
  init_command_log();
45895
45920
  init_js_yaml();
@@ -47797,63 +47822,15 @@ ${block}`);
47797
47822
  continue;
47798
47823
  }
47799
47824
  try {
47800
- const { execFile: execFile3 } = await import("child_process");
47801
- const { promisify: promisify3 } = await import("util");
47802
- const execFileAsync3 = promisify3(execFile3);
47803
- const runGit2 = async (args2) => {
47804
- const result = await execFileAsync3("git", ["-C", node.workspace, ...args2], {
47805
- encoding: "utf8",
47806
- timeout: 1e4
47807
- });
47808
- return result.stdout.trim();
47809
- };
47810
- const branch = await runGit2(["branch", "--show-current"]).catch(() => "");
47811
- const porc = await runGit2(["status", "--porcelain"]).catch(() => "");
47812
- const headCommit = await runGit2(["rev-parse", "--short", "HEAD"]).catch(() => null);
47813
- const headMessage = await runGit2(["log", "-1", "--format=%s"]).catch(() => null);
47814
- const upstream = await runGit2(["rev-parse", "--abbrev-ref", "@{upstream}"]).catch(() => null);
47815
- const aheadBehind = await runGit2(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]).catch(() => "");
47816
- const stashCount = await runGit2(["stash", "list"]).catch(() => "");
47817
- let ahead = 0, behind = 0;
47818
- if (aheadBehind) {
47819
- const parts = aheadBehind.split(/\s+/);
47820
- if (parts.length >= 2) {
47821
- behind = parseInt(parts[0], 10) || 0;
47822
- ahead = parseInt(parts[1], 10) || 0;
47823
- }
47824
- }
47825
- const dirty = porc.length > 0;
47826
- const lines = porc ? porc.split("\n").filter(Boolean) : [];
47827
- let staged = 0, modified = 0, untracked = 0, deleted = 0, renamed2 = 0;
47828
- for (const line of lines) {
47829
- const xy = line.slice(0, 2);
47830
- if (xy[0] !== " " && xy[0] !== "?") staged++;
47831
- if (xy[1] === "M") modified++;
47832
- if (xy[1] === "D") deleted++;
47833
- if (xy[0] === "R" || xy[1] === "R") renamed2++;
47834
- if (xy === "??") untracked++;
47825
+ const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
47826
+ status.git = gitStatus;
47827
+ if (gitStatus.isGitRepo) {
47828
+ const dirty = gitStatus.staged + gitStatus.modified + gitStatus.untracked + gitStatus.deleted + gitStatus.renamed > 0;
47829
+ status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
47830
+ } else {
47831
+ status.health = "degraded";
47832
+ if (gitStatus.error && !status.error) status.error = gitStatus.error;
47835
47833
  }
47836
- status.git = {
47837
- workspace: node.workspace,
47838
- repoRoot: node.workspace,
47839
- isGitRepo: true,
47840
- branch: branch || null,
47841
- headCommit,
47842
- headMessage,
47843
- upstream,
47844
- ahead,
47845
- behind,
47846
- staged,
47847
- modified,
47848
- untracked,
47849
- deleted,
47850
- renamed: renamed2,
47851
- hasConflicts: false,
47852
- conflictFiles: [],
47853
- stashCount: stashCount ? stashCount.split("\n").filter(Boolean).length : 0,
47854
- lastCheckedAt: Date.now()
47855
- };
47856
- status.health = branch ? dirty ? "dirty" : "online" : "degraded";
47857
47834
  } catch {
47858
47835
  if (!applyCachedInlineMeshNodeStatus(status, node)) {
47859
47836
  status.health = "degraded";
@@ -66644,7 +66621,7 @@ var init_adhdev_daemon = __esm({
66644
66621
  init_version();
66645
66622
  init_src();
66646
66623
  init_runtime_defaults();
66647
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.4" });
66624
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.6" });
66648
66625
  AdhdevDaemon = class _AdhdevDaemon {
66649
66626
  localHttpServer = null;
66650
66627
  localWss = null;