@adhdev/daemon-core 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.mjs CHANGED
@@ -23603,6 +23603,26 @@ function readBooleanValue(...values) {
23603
23603
  }
23604
23604
  return void 0;
23605
23605
  }
23606
+ function readGitSubmodules(value) {
23607
+ if (!Array.isArray(value)) return void 0;
23608
+ const submodules = value.map((entry) => {
23609
+ const submodule = readObjectRecord(entry);
23610
+ const path28 = readStringValue(submodule.path);
23611
+ const commit = readStringValue(submodule.commit);
23612
+ const repoPath = readStringValue(submodule.repoPath, submodule.repo_root);
23613
+ if (!path28 || !commit || !repoPath) return null;
23614
+ return {
23615
+ path: path28,
23616
+ commit,
23617
+ repoPath,
23618
+ dirty: readBooleanValue(submodule.dirty) ?? false,
23619
+ outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
23620
+ lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
23621
+ ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
23622
+ };
23623
+ }).filter((entry) => entry !== null);
23624
+ return submodules.length > 0 ? submodules : void 0;
23625
+ }
23606
23626
  function buildCachedInlineMeshGitStatus(node) {
23607
23627
  const cachedStatus = readObjectRecord(node?.cachedStatus);
23608
23628
  const cachedGit = readObjectRecord(cachedStatus.git);
@@ -23612,6 +23632,7 @@ function buildCachedInlineMeshGitStatus(node) {
23612
23632
  const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
23613
23633
  const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
23614
23634
  if (isGitRepo2 !== void 0) {
23635
+ const submodules2 = readGitSubmodules(cachedGit.submodules);
23615
23636
  return {
23616
23637
  workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
23617
23638
  repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -23630,7 +23651,8 @@ function buildCachedInlineMeshGitStatus(node) {
23630
23651
  hasConflicts: hasConflicts2,
23631
23652
  conflictFiles: conflictFiles2,
23632
23653
  stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
23633
- lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
23654
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
23655
+ ...submodules2 ? { submodules: submodules2 } : {}
23634
23656
  };
23635
23657
  }
23636
23658
  }
@@ -23649,6 +23671,7 @@ function buildCachedInlineMeshGitStatus(node) {
23649
23671
  const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
23650
23672
  const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
23651
23673
  const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
23674
+ const submodules = readGitSubmodules(status.submodules);
23652
23675
  return {
23653
23676
  workspace: readStringValue(status.workspace, node?.workspace) || "",
23654
23677
  repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -23667,7 +23690,8 @@ function buildCachedInlineMeshGitStatus(node) {
23667
23690
  hasConflicts,
23668
23691
  conflictFiles,
23669
23692
  stashCount: readNumberValue(status.stashCount) ?? 0,
23670
- lastCheckedAt: Date.now()
23693
+ lastCheckedAt: Date.now(),
23694
+ ...submodules ? { submodules } : {}
23671
23695
  };
23672
23696
  }
23673
23697
  function applyCachedInlineMeshNodeStatus(status, node) {
@@ -25950,63 +25974,15 @@ ${block}`);
25950
25974
  continue;
25951
25975
  }
25952
25976
  try {
25953
- const { execFile: execFile3 } = await import("child_process");
25954
- const { promisify: promisify3 } = await import("util");
25955
- const execFileAsync3 = promisify3(execFile3);
25956
- const runGit2 = async (args2) => {
25957
- const result = await execFileAsync3("git", ["-C", node.workspace, ...args2], {
25958
- encoding: "utf8",
25959
- timeout: 1e4
25960
- });
25961
- return result.stdout.trim();
25962
- };
25963
- const branch = await runGit2(["branch", "--show-current"]).catch(() => "");
25964
- const porc = await runGit2(["status", "--porcelain"]).catch(() => "");
25965
- const headCommit = await runGit2(["rev-parse", "--short", "HEAD"]).catch(() => null);
25966
- const headMessage = await runGit2(["log", "-1", "--format=%s"]).catch(() => null);
25967
- const upstream = await runGit2(["rev-parse", "--abbrev-ref", "@{upstream}"]).catch(() => null);
25968
- const aheadBehind = await runGit2(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]).catch(() => "");
25969
- const stashCount = await runGit2(["stash", "list"]).catch(() => "");
25970
- let ahead = 0, behind = 0;
25971
- if (aheadBehind) {
25972
- const parts = aheadBehind.split(/\s+/);
25973
- if (parts.length >= 2) {
25974
- behind = parseInt(parts[0], 10) || 0;
25975
- ahead = parseInt(parts[1], 10) || 0;
25976
- }
25977
- }
25978
- const dirty = porc.length > 0;
25979
- const lines = porc ? porc.split("\n").filter(Boolean) : [];
25980
- let staged = 0, modified = 0, untracked = 0, deleted = 0, renamed = 0;
25981
- for (const line of lines) {
25982
- const xy = line.slice(0, 2);
25983
- if (xy[0] !== " " && xy[0] !== "?") staged++;
25984
- if (xy[1] === "M") modified++;
25985
- if (xy[1] === "D") deleted++;
25986
- if (xy[0] === "R" || xy[1] === "R") renamed++;
25987
- if (xy === "??") untracked++;
25977
+ const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
25978
+ status.git = gitStatus;
25979
+ if (gitStatus.isGitRepo) {
25980
+ const dirty = gitStatus.staged + gitStatus.modified + gitStatus.untracked + gitStatus.deleted + gitStatus.renamed > 0;
25981
+ status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
25982
+ } else {
25983
+ status.health = "degraded";
25984
+ if (gitStatus.error && !status.error) status.error = gitStatus.error;
25988
25985
  }
25989
- status.git = {
25990
- workspace: node.workspace,
25991
- repoRoot: node.workspace,
25992
- isGitRepo: true,
25993
- branch: branch || null,
25994
- headCommit,
25995
- headMessage,
25996
- upstream,
25997
- ahead,
25998
- behind,
25999
- staged,
26000
- modified,
26001
- untracked,
26002
- deleted,
26003
- renamed,
26004
- hasConflicts: false,
26005
- conflictFiles: [],
26006
- stashCount: stashCount ? stashCount.split("\n").filter(Boolean).length : 0,
26007
- lastCheckedAt: Date.now()
26008
- };
26009
- status.health = branch ? dirty ? "dirty" : "online" : "degraded";
26010
25986
  } catch {
26011
25987
  if (!applyCachedInlineMeshNodeStatus(status, node)) {
26012
25988
  status.health = "degraded";