@adhdev/daemon-standalone 0.9.82-rc.4 → 0.9.82-rc.5

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
@@ -45812,6 +45812,26 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
45812
45812
  }
45813
45813
  return void 0;
45814
45814
  }
45815
+ function readGitSubmodules(value) {
45816
+ if (!Array.isArray(value)) return void 0;
45817
+ const submodules = value.map((entry) => {
45818
+ const submodule = readObjectRecord(entry);
45819
+ const path28 = readStringValue(submodule.path);
45820
+ const commit = readStringValue(submodule.commit);
45821
+ const repoPath = readStringValue(submodule.repoPath, submodule.repo_root);
45822
+ if (!path28 || !commit || !repoPath) return null;
45823
+ return {
45824
+ path: path28,
45825
+ commit,
45826
+ repoPath,
45827
+ dirty: readBooleanValue(submodule.dirty) ?? false,
45828
+ outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
45829
+ lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
45830
+ ...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
45831
+ };
45832
+ }).filter((entry) => entry !== null);
45833
+ return submodules.length > 0 ? submodules : void 0;
45834
+ }
45815
45835
  function buildCachedInlineMeshGitStatus(node) {
45816
45836
  const cachedStatus = readObjectRecord(node?.cachedStatus);
45817
45837
  const cachedGit = readObjectRecord(cachedStatus.git);
@@ -45821,6 +45841,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
45821
45841
  const hasConflicts2 = readBooleanValue(cachedGit.hasConflicts) ?? conflictCount2 > 0;
45822
45842
  const isGitRepo2 = readBooleanValue(cachedGit.isGitRepo);
45823
45843
  if (isGitRepo2 !== void 0) {
45844
+ const submodules2 = readGitSubmodules(cachedGit.submodules);
45824
45845
  return {
45825
45846
  workspace: readStringValue(cachedGit.workspace, node?.workspace) || "",
45826
45847
  repoRoot: readStringValue(cachedGit.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -45839,7 +45860,8 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
45839
45860
  hasConflicts: hasConflicts2,
45840
45861
  conflictFiles: conflictFiles2,
45841
45862
  stashCount: readNumberValue(cachedGit.stashCount) ?? 0,
45842
- lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now()
45863
+ lastCheckedAt: readNumberValue(cachedGit.lastCheckedAt) ?? Date.now(),
45864
+ ...submodules2 ? { submodules: submodules2 } : {}
45843
45865
  };
45844
45866
  }
45845
45867
  }
@@ -45858,6 +45880,7 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
45858
45880
  const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
45859
45881
  const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
45860
45882
  const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
45883
+ const submodules = readGitSubmodules(status.submodules);
45861
45884
  return {
45862
45885
  workspace: readStringValue(status.workspace, node?.workspace) || "",
45863
45886
  repoRoot: readStringValue(status.repoRoot, node?.repoRoot, node?.workspace) || null,
@@ -45876,7 +45899,8 @@ ${(0, import_node_path.resolve)(workspace || os17.tmpdir())}`;
45876
45899
  hasConflicts,
45877
45900
  conflictFiles,
45878
45901
  stashCount: readNumberValue(status.stashCount) ?? 0,
45879
- lastCheckedAt: Date.now()
45902
+ lastCheckedAt: Date.now(),
45903
+ ...submodules ? { submodules } : {}
45880
45904
  };
45881
45905
  }
45882
45906
  function applyCachedInlineMeshNodeStatus(status, node) {
@@ -48159,63 +48183,15 @@ ${block}`);
48159
48183
  continue;
48160
48184
  }
48161
48185
  try {
48162
- const { execFile: execFile3 } = await import("child_process");
48163
- const { promisify: promisify3 } = await import("util");
48164
- const execFileAsync3 = promisify3(execFile3);
48165
- const runGit2 = async (args2) => {
48166
- const result = await execFileAsync3("git", ["-C", node.workspace, ...args2], {
48167
- encoding: "utf8",
48168
- timeout: 1e4
48169
- });
48170
- return result.stdout.trim();
48171
- };
48172
- const branch = await runGit2(["branch", "--show-current"]).catch(() => "");
48173
- const porc = await runGit2(["status", "--porcelain"]).catch(() => "");
48174
- const headCommit = await runGit2(["rev-parse", "--short", "HEAD"]).catch(() => null);
48175
- const headMessage = await runGit2(["log", "-1", "--format=%s"]).catch(() => null);
48176
- const upstream = await runGit2(["rev-parse", "--abbrev-ref", "@{upstream}"]).catch(() => null);
48177
- const aheadBehind = await runGit2(["rev-list", "--left-right", "--count", "@{upstream}...HEAD"]).catch(() => "");
48178
- const stashCount = await runGit2(["stash", "list"]).catch(() => "");
48179
- let ahead = 0, behind = 0;
48180
- if (aheadBehind) {
48181
- const parts = aheadBehind.split(/\s+/);
48182
- if (parts.length >= 2) {
48183
- behind = parseInt(parts[0], 10) || 0;
48184
- ahead = parseInt(parts[1], 10) || 0;
48185
- }
48186
- }
48187
- const dirty = porc.length > 0;
48188
- const lines = porc ? porc.split("\n").filter(Boolean) : [];
48189
- let staged = 0, modified = 0, untracked = 0, deleted = 0, renamed = 0;
48190
- for (const line of lines) {
48191
- const xy = line.slice(0, 2);
48192
- if (xy[0] !== " " && xy[0] !== "?") staged++;
48193
- if (xy[1] === "M") modified++;
48194
- if (xy[1] === "D") deleted++;
48195
- if (xy[0] === "R" || xy[1] === "R") renamed++;
48196
- if (xy === "??") untracked++;
48186
+ const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
48187
+ status.git = gitStatus;
48188
+ if (gitStatus.isGitRepo) {
48189
+ const dirty = gitStatus.staged + gitStatus.modified + gitStatus.untracked + gitStatus.deleted + gitStatus.renamed > 0;
48190
+ status.health = gitStatus.branch ? dirty ? "dirty" : "online" : "degraded";
48191
+ } else {
48192
+ status.health = "degraded";
48193
+ if (gitStatus.error && !status.error) status.error = gitStatus.error;
48197
48194
  }
48198
- status.git = {
48199
- workspace: node.workspace,
48200
- repoRoot: node.workspace,
48201
- isGitRepo: true,
48202
- branch: branch || null,
48203
- headCommit,
48204
- headMessage,
48205
- upstream,
48206
- ahead,
48207
- behind,
48208
- staged,
48209
- modified,
48210
- untracked,
48211
- deleted,
48212
- renamed,
48213
- hasConflicts: false,
48214
- conflictFiles: [],
48215
- stashCount: stashCount ? stashCount.split("\n").filter(Boolean).length : 0,
48216
- lastCheckedAt: Date.now()
48217
- };
48218
- status.health = branch ? dirty ? "dirty" : "online" : "degraded";
48219
48195
  } catch {
48220
48196
  if (!applyCachedInlineMeshNodeStatus(status, node)) {
48221
48197
  status.health = "degraded";