@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.js CHANGED
@@ -23835,6 +23835,26 @@ function readBooleanValue(...values) {
23835
23835
  }
23836
23836
  return void 0;
23837
23837
  }
23838
+ function readGitSubmodules(value) {
23839
+ if (!Array.isArray(value)) return void 0;
23840
+ const submodules = value.map((entry) => {
23841
+ const submodule = readObjectRecord(entry);
23842
+ const path28 = readStringValue(submodule.path);
23843
+ const commit = readStringValue(submodule.commit);
23844
+ const repoPath = readStringValue(submodule.repoPath, submodule.repo_root);
23845
+ if (!path28 || !commit || !repoPath) return null;
23846
+ return {
23847
+ path: path28,
23848
+ commit,
23849
+ repoPath,
23850
+ dirty: readBooleanValue(submodule.dirty) ?? false,
23851
+ outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
23852
+ lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
23853
+ ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
23854
+ };
23855
+ }).filter((entry) => entry !== null);
23856
+ return submodules.length > 0 ? submodules : void 0;
23857
+ }
23838
23858
  function buildCachedInlineMeshGitStatus(node) {
23839
23859
  const cachedStatus = readObjectRecord(node?.cachedStatus);
23840
23860
  const cachedGit = readObjectRecord(cachedStatus.git);
@@ -23844,6 +23864,7 @@ function buildCachedInlineMeshGitStatus(node) {
23844
23864
  const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
23845
23865
  const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
23846
23866
  if (isGitRepo2 !== void 0) {
23867
+ const submodules2 = readGitSubmodules(cachedGit.submodules);
23847
23868
  return {
23848
23869
  workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
23849
23870
  repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -23862,7 +23883,8 @@ function buildCachedInlineMeshGitStatus(node) {
23862
23883
  hasConflicts: hasConflicts2,
23863
23884
  conflictFiles: conflictFiles2,
23864
23885
  stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
23865
- lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
23886
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
23887
+ ...submodules2 ? { submodules: submodules2 } : {}
23866
23888
  };
23867
23889
  }
23868
23890
  }
@@ -23881,6 +23903,7 @@ function buildCachedInlineMeshGitStatus(node) {
23881
23903
  const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
23882
23904
  const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
23883
23905
  const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
23906
+ const submodules = readGitSubmodules(status.submodules);
23884
23907
  return {
23885
23908
  workspace: readStringValue(status.workspace, node?.workspace) || "",
23886
23909
  repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -23899,7 +23922,8 @@ function buildCachedInlineMeshGitStatus(node) {
23899
23922
  hasConflicts,
23900
23923
  conflictFiles,
23901
23924
  stashCount: readNumberValue(status.stashCount) ?? 0,
23902
- lastCheckedAt: Date.now()
23925
+ lastCheckedAt: Date.now(),
23926
+ ...submodules ? { submodules } : {}
23903
23927
  };
23904
23928
  }
23905
23929
  function applyCachedInlineMeshNodeStatus(status, node) {
@@ -26182,63 +26206,15 @@ ${block}`);
26182
26206
  continue;
26183
26207
  }
26184
26208
  try {
26185
- const { execFile: execFile3 } = await import("child_process");
26186
- const { promisify: promisify3 } = await import("util");
26187
- const execFileAsync3 = promisify3(execFile3);
26188
- const runGit2 = async (args2) => {
26189
- const result = await execFileAsync3("git", ["-C", node.workspace, ...args2], {
26190
- encoding: "utf8",
26191
- timeout: 1e4
26192
- });
26193
- return result.stdout.trim();
26194
- };
26195
- const branch = await runGit2(["branch", "--show-current"]).catch(() => "");
26196
- const porc = await runGit2(["status", "--porcelain"]).catch(() => "");
26197
- const headCommit = await runGit2(["rev-parse", "--short", "HEAD"]).catch(() => null);
26198
- const headMessage = await runGit2(["log", "-1", "--format=%s"]).catch(() => null);
26199
- const upstream = await runGit2(["rev-parse", "--abbrev-ref", "@{upstream}"]).catch(() => null);
26200
- const aheadBehind = await runGit2(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]).catch(() => "");
26201
- const stashCount = await runGit2(["stash", "list"]).catch(() => "");
26202
- let ahead = 0, behind = 0;
26203
- if (aheadBehind) {
26204
- const parts = aheadBehind.split(/\s+/);
26205
- if (parts.length >= 2) {
26206
- behind = parseInt(parts[0], 10) || 0;
26207
- ahead = parseInt(parts[1], 10) || 0;
26208
- }
26209
- }
26210
- const dirty = porc.length > 0;
26211
- const lines = porc ? porc.split("\n").filter(Boolean) : [];
26212
- let staged = 0, modified = 0, untracked = 0, deleted = 0, renamed = 0;
26213
- for (const line of lines) {
26214
- const xy = line.slice(0, 2);
26215
- if (xy[0] !== " " && xy[0] !== "?") staged++;
26216
- if (xy[1] === "M") modified++;
26217
- if (xy[1] === "D") deleted++;
26218
- if (xy[0] === "R" || xy[1] === "R") renamed++;
26219
- if (xy === "??") untracked++;
26209
+ const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
26210
+ status.git = gitStatus;
26211
+ if (gitStatus.isGitRepo) {
26212
+ const dirty = gitStatus.staged + gitStatus.modified + gitStatus.untracked + gitStatus.deleted + gitStatus.renamed > 0;
26213
+ status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
26214
+ } else {
26215
+ status.health = "degraded";
26216
+ if (gitStatus.error && !status.error) status.error = gitStatus.error;
26220
26217
  }
26221
- status.git = {
26222
- workspace: node.workspace,
26223
- repoRoot: node.workspace,
26224
- isGitRepo: true,
26225
- branch: branch || null,
26226
- headCommit,
26227
- headMessage,
26228
- upstream,
26229
- ahead,
26230
- behind,
26231
- staged,
26232
- modified,
26233
- untracked,
26234
- deleted,
26235
- renamed,
26236
- hasConflicts: false,
26237
- conflictFiles: [],
26238
- stashCount: stashCount ? stashCount.split("\n").filter(Boolean).length : 0,
26239
- lastCheckedAt: Date.now()
26240
- };
26241
- status.health = branch ? dirty ? "dirty" : "online" : "degraded";
26242
26218
  } catch {
26243
26219
  if (!applyCachedInlineMeshNodeStatus(status, node)) {
26244
26220
  status.health = "degraded";