@adhdev/daemon-core 0.9.82-rc.265 → 0.9.82-rc.267
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/git/git-types.d.ts +2 -81
- package/dist/index.js +210 -130
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +210 -130
- package/dist/index.mjs.map +1 -1
- package/dist/repo-mesh-types.d.ts +2 -18
- package/package.json +2 -1
- package/src/commands/router.ts +17 -135
- package/src/git/git-types.ts +15 -95
- package/src/repo-mesh-types.ts +6 -18
package/dist/index.mjs
CHANGED
|
@@ -260,10 +260,10 @@ function readInjected(value) {
|
|
|
260
260
|
}
|
|
261
261
|
function getDaemonBuildInfo() {
|
|
262
262
|
if (cached) return cached;
|
|
263
|
-
const commit = readInjected(true ? "
|
|
264
|
-
const commitShort = readInjected(true ? "
|
|
265
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
266
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
263
|
+
const commit = readInjected(true ? "bf805cc2b4d63e722d2e330fa10a9890db3b4668" : void 0) ?? "unknown";
|
|
264
|
+
const commitShort = readInjected(true ? "bf805cc2" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
265
|
+
const version = readInjected(true ? "0.9.82-rc.267" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
266
|
+
const builtAt = readInjected(true ? "2026-06-14T20:01:43.506Z" : void 0);
|
|
267
267
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
268
268
|
return cached;
|
|
269
269
|
}
|
|
@@ -38755,6 +38755,207 @@ function getAvailableIdeIds() {
|
|
|
38755
38755
|
init_config();
|
|
38756
38756
|
init_cli_detector();
|
|
38757
38757
|
init_git_status();
|
|
38758
|
+
|
|
38759
|
+
// ../mesh-shared/dist/index.mjs
|
|
38760
|
+
function readRecord5(value) {
|
|
38761
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
38762
|
+
}
|
|
38763
|
+
function readString6(...values) {
|
|
38764
|
+
for (const value of values) {
|
|
38765
|
+
if (typeof value !== "string") continue;
|
|
38766
|
+
const trimmed = value.trim();
|
|
38767
|
+
if (trimmed) return trimmed;
|
|
38768
|
+
}
|
|
38769
|
+
return void 0;
|
|
38770
|
+
}
|
|
38771
|
+
function readNumber(...values) {
|
|
38772
|
+
for (const value of values) {
|
|
38773
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
38774
|
+
}
|
|
38775
|
+
return void 0;
|
|
38776
|
+
}
|
|
38777
|
+
function readBoolean(...values) {
|
|
38778
|
+
for (const value of values) {
|
|
38779
|
+
if (typeof value === "boolean") return value;
|
|
38780
|
+
}
|
|
38781
|
+
return void 0;
|
|
38782
|
+
}
|
|
38783
|
+
function joinRepoPath(root, relativePath) {
|
|
38784
|
+
const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
|
|
38785
|
+
const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
|
|
38786
|
+
if (!normalizedPath) return void 0;
|
|
38787
|
+
if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
|
|
38788
|
+
if (!normalizedRoot) return void 0;
|
|
38789
|
+
return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
|
|
38790
|
+
}
|
|
38791
|
+
function scoreGitUpstreamFreshness(status) {
|
|
38792
|
+
switch (status) {
|
|
38793
|
+
case "fresh":
|
|
38794
|
+
return 30;
|
|
38795
|
+
case "no_upstream":
|
|
38796
|
+
return 4;
|
|
38797
|
+
case "unchecked":
|
|
38798
|
+
case void 0:
|
|
38799
|
+
return 0;
|
|
38800
|
+
case "stale":
|
|
38801
|
+
return -10;
|
|
38802
|
+
case "unavailable":
|
|
38803
|
+
return -15;
|
|
38804
|
+
default:
|
|
38805
|
+
return 0;
|
|
38806
|
+
}
|
|
38807
|
+
}
|
|
38808
|
+
function readGitSubmodules(value, parentRepoRoot) {
|
|
38809
|
+
if (!Array.isArray(value)) return void 0;
|
|
38810
|
+
const submodules = value.map((entry) => {
|
|
38811
|
+
const submodule = readRecord5(entry);
|
|
38812
|
+
const path39 = readString6(submodule.path);
|
|
38813
|
+
const commit = readString6(submodule.commit);
|
|
38814
|
+
const repoPath = readString6(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path39);
|
|
38815
|
+
if (!path39 || !commit) return null;
|
|
38816
|
+
const result = {
|
|
38817
|
+
path: path39,
|
|
38818
|
+
commit,
|
|
38819
|
+
dirty: readBoolean(submodule.dirty) ?? false,
|
|
38820
|
+
outOfSync: readBoolean(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
38821
|
+
lastCheckedAt: readNumber(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now()
|
|
38822
|
+
};
|
|
38823
|
+
if (repoPath) result.repoPath = repoPath;
|
|
38824
|
+
const error = readString6(submodule.error);
|
|
38825
|
+
if (error) result.error = error;
|
|
38826
|
+
return result;
|
|
38827
|
+
}).filter((entry) => entry !== null);
|
|
38828
|
+
return submodules.length > 0 ? submodules : void 0;
|
|
38829
|
+
}
|
|
38830
|
+
function hasGitStatusEvidence(status) {
|
|
38831
|
+
return readBoolean(status.isGitRepo) !== void 0 || Boolean(readString6(status.branch, status.upstream, status.upstreamStatus, status.upstream_status, status.headCommit)) || Boolean(readString6(status.repoRoot, status.repo_root, status.workspace)) || readNumber(
|
|
38832
|
+
status.ahead,
|
|
38833
|
+
status.behind,
|
|
38834
|
+
status.staged,
|
|
38835
|
+
status.modified,
|
|
38836
|
+
status.untracked,
|
|
38837
|
+
status.deleted,
|
|
38838
|
+
status.renamed,
|
|
38839
|
+
status.lastCheckedAt,
|
|
38840
|
+
status.last_checked_at
|
|
38841
|
+
) !== void 0 || Array.isArray(status.submodules) && status.submodules.length > 0;
|
|
38842
|
+
}
|
|
38843
|
+
function normalizeGitStatus(status, node, options) {
|
|
38844
|
+
const explicitIsGitRepo = readBoolean(status.isGitRepo);
|
|
38845
|
+
if (!Object.keys(status).length || !hasGitStatusEvidence(status)) return void 0;
|
|
38846
|
+
const isGitRepo = explicitIsGitRepo ?? true;
|
|
38847
|
+
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((entry) => typeof entry === "string") : [];
|
|
38848
|
+
const conflictCount = readNumber(status.conflicts) ?? conflictFiles.length;
|
|
38849
|
+
const hasConflicts = readBoolean(status.hasConflicts) ?? conflictCount > 0;
|
|
38850
|
+
const repoRoot = readString6(status.repoRoot, status.repo_root, node.repoRoot, node.repo_root, status.workspace, node.workspace) || void 0;
|
|
38851
|
+
const submodules = readGitSubmodules(status.submodules, repoRoot);
|
|
38852
|
+
const upstreamStatus = readString6(status.upstreamStatus, status.upstream_status);
|
|
38853
|
+
const upstreamFetchedAt = readNumber(status.upstreamFetchedAt, status.upstream_fetched_at);
|
|
38854
|
+
const upstreamFetchError = readString6(status.upstreamFetchError, status.upstream_fetch_error);
|
|
38855
|
+
const error = readString6(status.error);
|
|
38856
|
+
const staged = readNumber(status.staged) ?? 0;
|
|
38857
|
+
const modified = readNumber(status.modified) ?? 0;
|
|
38858
|
+
const untracked = readNumber(status.untracked) ?? 0;
|
|
38859
|
+
const deleted = readNumber(status.deleted) ?? 0;
|
|
38860
|
+
const renamed = readNumber(status.renamed) ?? 0;
|
|
38861
|
+
return {
|
|
38862
|
+
workspace: readString6(status.workspace, node.workspace) || "",
|
|
38863
|
+
repoRoot: repoRoot ?? null,
|
|
38864
|
+
isGitRepo,
|
|
38865
|
+
branch: readString6(status.branch) ?? null,
|
|
38866
|
+
headCommit: readString6(status.headCommit) ?? null,
|
|
38867
|
+
headMessage: readString6(status.headMessage) ?? null,
|
|
38868
|
+
upstream: readString6(status.upstream) ?? null,
|
|
38869
|
+
upstreamStatus: upstreamStatus ?? "unchecked",
|
|
38870
|
+
...upstreamFetchedAt !== void 0 ? { upstreamFetchedAt } : {},
|
|
38871
|
+
...upstreamFetchError ? { upstreamFetchError } : {},
|
|
38872
|
+
ahead: readNumber(status.ahead) ?? 0,
|
|
38873
|
+
behind: readNumber(status.behind) ?? 0,
|
|
38874
|
+
staged,
|
|
38875
|
+
modified,
|
|
38876
|
+
untracked,
|
|
38877
|
+
deleted,
|
|
38878
|
+
renamed,
|
|
38879
|
+
dirty: readBoolean(status.dirty, status.isDirty, status.is_dirty) ?? (staged + modified + untracked + deleted + renamed > 0 || hasConflicts),
|
|
38880
|
+
hasConflicts,
|
|
38881
|
+
conflictFiles,
|
|
38882
|
+
stashCount: readNumber(status.stashCount, status.stash_count) ?? 0,
|
|
38883
|
+
lastCheckedAt: options?.lastCheckedAt ?? readNumber(status.lastCheckedAt, status.last_checked_at) ?? Date.now(),
|
|
38884
|
+
...submodules ? { submodules } : {},
|
|
38885
|
+
...error ? { error } : {}
|
|
38886
|
+
};
|
|
38887
|
+
}
|
|
38888
|
+
function scoreGitStatusCandidate(git) {
|
|
38889
|
+
if (!git) return Number.NEGATIVE_INFINITY;
|
|
38890
|
+
let score = 0;
|
|
38891
|
+
if (git.isGitRepo === true) score += 50;
|
|
38892
|
+
if (git.isGitRepo === false) score -= 10;
|
|
38893
|
+
if (git.branch) score += 20;
|
|
38894
|
+
if (git.headCommit) score += 20;
|
|
38895
|
+
if (git.upstream) score += 10;
|
|
38896
|
+
score += scoreGitUpstreamFreshness(git.upstreamStatus);
|
|
38897
|
+
if (typeof git.ahead === "number") score += 2;
|
|
38898
|
+
if (typeof git.behind === "number") score += 2;
|
|
38899
|
+
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
38900
|
+
if (git.error) score -= 20;
|
|
38901
|
+
return score;
|
|
38902
|
+
}
|
|
38903
|
+
function pickBestTransitGitStatus(node, options) {
|
|
38904
|
+
const rawGit = readRecord5(node.lastGit ?? node.last_git);
|
|
38905
|
+
const gitResult = readRecord5(rawGit.result);
|
|
38906
|
+
const directStatus = readRecord5(rawGit.status);
|
|
38907
|
+
const nestedStatus = readRecord5(gitResult.status);
|
|
38908
|
+
const rawProbe = readRecord5(node.lastProbe ?? node.last_probe);
|
|
38909
|
+
const probeGit = readRecord5(rawProbe.git);
|
|
38910
|
+
const probeGitResult = readRecord5(probeGit.result);
|
|
38911
|
+
const probeDirectStatus = readRecord5(probeGit.status);
|
|
38912
|
+
const probeNestedStatus = readRecord5(probeGitResult.status);
|
|
38913
|
+
const lastCheckedAt = options?.lastCheckedAt;
|
|
38914
|
+
let best = null;
|
|
38915
|
+
for (const status of [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus]) {
|
|
38916
|
+
const normalized = normalizeGitStatus(status, node, { lastCheckedAt: lastCheckedAt ?? Date.now() });
|
|
38917
|
+
if (!normalized) continue;
|
|
38918
|
+
const score = scoreGitStatusCandidate(normalized);
|
|
38919
|
+
if (!best || score > best.score) best = { git: normalized, score };
|
|
38920
|
+
}
|
|
38921
|
+
return best?.git;
|
|
38922
|
+
}
|
|
38923
|
+
function summarizeGitShape(status) {
|
|
38924
|
+
const record = readRecord5(status);
|
|
38925
|
+
if (!Object.keys(record).length) return null;
|
|
38926
|
+
const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => {
|
|
38927
|
+
const sub = readRecord5(entry);
|
|
38928
|
+
return {
|
|
38929
|
+
path: readString6(sub.path) ?? null,
|
|
38930
|
+
commit: readString6(sub.commit)?.slice(0, 12) ?? null,
|
|
38931
|
+
dirty: readBoolean(sub.dirty) ?? false,
|
|
38932
|
+
outOfSync: readBoolean(sub.outOfSync, sub.out_of_sync) ?? false
|
|
38933
|
+
};
|
|
38934
|
+
}) : [];
|
|
38935
|
+
return {
|
|
38936
|
+
isGitRepo: readBoolean(record.isGitRepo),
|
|
38937
|
+
workspace: readString6(record.workspace) ?? null,
|
|
38938
|
+
repoRoot: readString6(record.repoRoot, record.repo_root) ?? null,
|
|
38939
|
+
branch: readString6(record.branch) ?? null,
|
|
38940
|
+
upstream: readString6(record.upstream) ?? null,
|
|
38941
|
+
upstreamStatus: readString6(record.upstreamStatus, record.upstream_status) ?? null,
|
|
38942
|
+
headCommit: readString6(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
|
|
38943
|
+
ahead: readNumber(record.ahead) ?? null,
|
|
38944
|
+
behind: readNumber(record.behind) ?? null,
|
|
38945
|
+
dirtyCounts: {
|
|
38946
|
+
staged: readNumber(record.staged) ?? 0,
|
|
38947
|
+
modified: readNumber(record.modified) ?? 0,
|
|
38948
|
+
untracked: readNumber(record.untracked) ?? 0,
|
|
38949
|
+
deleted: readNumber(record.deleted) ?? 0,
|
|
38950
|
+
renamed: readNumber(record.renamed) ?? 0
|
|
38951
|
+
},
|
|
38952
|
+
lastCheckedAt: readNumber(record.lastCheckedAt, record.last_checked_at) ?? null,
|
|
38953
|
+
submoduleCount: submodules.length,
|
|
38954
|
+
submodules
|
|
38955
|
+
};
|
|
38956
|
+
}
|
|
38957
|
+
|
|
38958
|
+
// src/commands/router.ts
|
|
38758
38959
|
init_logger();
|
|
38759
38960
|
|
|
38760
38961
|
// src/logging/command-log.ts
|
|
@@ -39014,7 +39215,7 @@ function runGit2(repoRoot, args) {
|
|
|
39014
39215
|
return "";
|
|
39015
39216
|
}
|
|
39016
39217
|
}
|
|
39017
|
-
function
|
|
39218
|
+
function readRecord6(repoRoot) {
|
|
39018
39219
|
const path39 = resolve18(repoRoot, PREVIEW_DEPLOY_RECORD);
|
|
39019
39220
|
if (!existsSync31(path39)) return null;
|
|
39020
39221
|
try {
|
|
@@ -39054,7 +39255,7 @@ function readCurrentMainCommit(repoRoot) {
|
|
|
39054
39255
|
}
|
|
39055
39256
|
function buildPreviewFreshness(repoRoot) {
|
|
39056
39257
|
const current = readCurrentMainCommit(repoRoot);
|
|
39057
|
-
const record =
|
|
39258
|
+
const record = readRecord6(repoRoot);
|
|
39058
39259
|
const lastPreviewCommit = normalizeCommit(record?.lastPreviewCommit);
|
|
39059
39260
|
const targets = readTargetFreshness(record, current.currentMainCommit);
|
|
39060
39261
|
let status = "unknown";
|
|
@@ -39823,37 +40024,6 @@ function readBooleanValue(...values) {
|
|
|
39823
40024
|
}
|
|
39824
40025
|
return void 0;
|
|
39825
40026
|
}
|
|
39826
|
-
function summarizeRepoMeshDebugGit(git) {
|
|
39827
|
-
const record = readObjectRecord(git);
|
|
39828
|
-
if (!Object.keys(record).length) return null;
|
|
39829
|
-
const submodules = Array.isArray(record.submodules) ? record.submodules.map((entry) => ({
|
|
39830
|
-
path: readStringValue(entry?.path) ?? null,
|
|
39831
|
-
commit: readStringValue(entry?.commit)?.slice(0, 12) ?? null,
|
|
39832
|
-
dirty: readBooleanValue(entry?.dirty) ?? false,
|
|
39833
|
-
outOfSync: readBooleanValue(entry?.outOfSync, entry?.out_of_sync) ?? false
|
|
39834
|
-
})) : [];
|
|
39835
|
-
return {
|
|
39836
|
-
isGitRepo: readBooleanValue(record.isGitRepo),
|
|
39837
|
-
workspace: readStringValue(record.workspace) ?? null,
|
|
39838
|
-
repoRoot: readStringValue(record.repoRoot, record.repo_root) ?? null,
|
|
39839
|
-
branch: readStringValue(record.branch) ?? null,
|
|
39840
|
-
upstream: readStringValue(record.upstream) ?? null,
|
|
39841
|
-
upstreamStatus: readStringValue(record.upstreamStatus, record.upstream_status) ?? null,
|
|
39842
|
-
headCommit: readStringValue(record.headCommit, record.head_commit)?.slice(0, 12) ?? null,
|
|
39843
|
-
ahead: readNumberValue(record.ahead) ?? null,
|
|
39844
|
-
behind: readNumberValue(record.behind) ?? null,
|
|
39845
|
-
dirtyCounts: {
|
|
39846
|
-
staged: readNumberValue(record.staged) ?? 0,
|
|
39847
|
-
modified: readNumberValue(record.modified) ?? 0,
|
|
39848
|
-
untracked: readNumberValue(record.untracked) ?? 0,
|
|
39849
|
-
deleted: readNumberValue(record.deleted) ?? 0,
|
|
39850
|
-
renamed: readNumberValue(record.renamed) ?? 0
|
|
39851
|
-
},
|
|
39852
|
-
lastCheckedAt: readNumberValue(record.lastCheckedAt, record.last_checked_at) ?? null,
|
|
39853
|
-
submoduleCount: submodules.length,
|
|
39854
|
-
submodules
|
|
39855
|
-
};
|
|
39856
|
-
}
|
|
39857
40027
|
function summarizeRepoMeshStatusDebug(status) {
|
|
39858
40028
|
const nodes = Array.isArray(status?.nodes) ? status.nodes : [];
|
|
39859
40029
|
return {
|
|
@@ -39877,7 +40047,7 @@ function summarizeRepoMeshStatusDebug(status) {
|
|
|
39877
40047
|
} : null,
|
|
39878
40048
|
gitProbePending: node?.gitProbePending === true,
|
|
39879
40049
|
launchReady: node?.launchReady === true,
|
|
39880
|
-
git:
|
|
40050
|
+
git: summarizeGitShape(node?.git),
|
|
39881
40051
|
branchConvergence: node?.branchConvergence ?? node?.branch_convergence ?? null
|
|
39882
40052
|
}))
|
|
39883
40053
|
};
|
|
@@ -39889,34 +40059,6 @@ function logRepoMeshStatusDebug(event, fields) {
|
|
|
39889
40059
|
LOG.info("MeshStatusDebug", `[RepoMeshStatusDebug] ${event}`);
|
|
39890
40060
|
}
|
|
39891
40061
|
}
|
|
39892
|
-
function joinRepoPath(root, relativePath) {
|
|
39893
|
-
const normalizedRoot = typeof root === "string" ? root.trim().replace(/[\\/]+$/, "") : "";
|
|
39894
|
-
const normalizedPath = typeof relativePath === "string" ? relativePath.trim() : "";
|
|
39895
|
-
if (!normalizedPath) return void 0;
|
|
39896
|
-
if (/^(?:[A-Za-z]:[\\/]|\/)/.test(normalizedPath)) return normalizedPath;
|
|
39897
|
-
if (!normalizedRoot) return void 0;
|
|
39898
|
-
return `${normalizedRoot}/${normalizedPath.replace(/^[\\/]+/, "")}`;
|
|
39899
|
-
}
|
|
39900
|
-
function readGitSubmodules(value, parentRepoRoot) {
|
|
39901
|
-
if (!Array.isArray(value)) return void 0;
|
|
39902
|
-
const submodules = value.map((entry) => {
|
|
39903
|
-
const submodule = readObjectRecord(entry);
|
|
39904
|
-
const path39 = readStringValue(submodule.path);
|
|
39905
|
-
const commit = readStringValue(submodule.commit);
|
|
39906
|
-
const repoPath = readStringValue(submodule.repoPath, submodule.repo_root) ?? joinRepoPath(parentRepoRoot, path39);
|
|
39907
|
-
if (!path39 || !commit || !repoPath) return null;
|
|
39908
|
-
return {
|
|
39909
|
-
path: path39,
|
|
39910
|
-
commit,
|
|
39911
|
-
repoPath,
|
|
39912
|
-
dirty: readBooleanValue(submodule.dirty) ?? false,
|
|
39913
|
-
outOfSync: readBooleanValue(submodule.outOfSync, submodule.out_of_sync) ?? false,
|
|
39914
|
-
lastCheckedAt: readNumberValue(submodule.lastCheckedAt, submodule.last_checked_at) ?? Date.now(),
|
|
39915
|
-
...readStringValue(submodule.error) ? { error: readStringValue(submodule.error) } : {}
|
|
39916
|
-
};
|
|
39917
|
-
}).filter((entry) => entry !== null);
|
|
39918
|
-
return submodules.length > 0 ? submodules : void 0;
|
|
39919
|
-
}
|
|
39920
40062
|
function buildMeshNodeDisplayLabel(node, nodeId, providerPriority) {
|
|
39921
40063
|
const explicit = readStringValue(node.machineLabel, node.machine_label, node.machineNickname, node.machine_nickname, node.alias);
|
|
39922
40064
|
if (explicit) return explicit;
|
|
@@ -40031,72 +40173,10 @@ function buildMeshNodeMachineIdentity(node, opts) {
|
|
|
40031
40173
|
};
|
|
40032
40174
|
}
|
|
40033
40175
|
function normalizeInlineMeshGitStatus(status, node, options) {
|
|
40034
|
-
|
|
40035
|
-
if (!Object.keys(status).length || isGitRepo === void 0) return void 0;
|
|
40036
|
-
const conflictFiles = Array.isArray(status.conflictFiles) ? status.conflictFiles.filter((value) => typeof value === "string") : [];
|
|
40037
|
-
const conflictCount = readNumberValue(status.conflicts) ?? conflictFiles.length;
|
|
40038
|
-
const hasConflicts = readBooleanValue(status.hasConflicts) ?? conflictCount > 0;
|
|
40039
|
-
const repoRoot = readStringValue(status.repoRoot, status.repo_root, node?.repoRoot, node?.repo_root, status.workspace, node?.workspace) || void 0;
|
|
40040
|
-
const submodules = readGitSubmodules(status.submodules, repoRoot);
|
|
40041
|
-
return {
|
|
40042
|
-
workspace: readStringValue(status.workspace, node?.workspace) || "",
|
|
40043
|
-
repoRoot: repoRoot ?? null,
|
|
40044
|
-
isGitRepo,
|
|
40045
|
-
branch: readStringValue(status.branch) ?? null,
|
|
40046
|
-
headCommit: readStringValue(status.headCommit) ?? null,
|
|
40047
|
-
headMessage: readStringValue(status.headMessage) ?? null,
|
|
40048
|
-
upstream: readStringValue(status.upstream) ?? null,
|
|
40049
|
-
upstreamStatus: readStringValue(status.upstreamStatus, status.upstream_status) ?? (readStringValue(status.upstream) ? "unchecked" : "no_upstream"),
|
|
40050
|
-
upstreamFetchedAt: readNumberValue(status.upstreamFetchedAt, status.upstream_fetched_at),
|
|
40051
|
-
upstreamFetchError: readStringValue(status.upstreamFetchError, status.upstream_fetch_error),
|
|
40052
|
-
ahead: readNumberValue(status.ahead) ?? 0,
|
|
40053
|
-
behind: readNumberValue(status.behind) ?? 0,
|
|
40054
|
-
staged: readNumberValue(status.staged) ?? 0,
|
|
40055
|
-
modified: readNumberValue(status.modified) ?? 0,
|
|
40056
|
-
untracked: readNumberValue(status.untracked) ?? 0,
|
|
40057
|
-
deleted: readNumberValue(status.deleted) ?? 0,
|
|
40058
|
-
renamed: readNumberValue(status.renamed) ?? 0,
|
|
40059
|
-
hasConflicts,
|
|
40060
|
-
conflictFiles,
|
|
40061
|
-
stashCount: readNumberValue(status.stashCount) ?? 0,
|
|
40062
|
-
lastCheckedAt: options?.lastCheckedAt ?? readNumberValue(status.lastCheckedAt) ?? Date.now(),
|
|
40063
|
-
...submodules ? { submodules } : {}
|
|
40064
|
-
};
|
|
40065
|
-
}
|
|
40066
|
-
function scoreInlineMeshGitStatus(git) {
|
|
40067
|
-
if (!git) return Number.NEGATIVE_INFINITY;
|
|
40068
|
-
let score = 0;
|
|
40069
|
-
if (readBooleanValue(git.isGitRepo) === true) score += 50;
|
|
40070
|
-
if (readBooleanValue(git.isGitRepo) === false) score -= 10;
|
|
40071
|
-
if (readStringValue(git.branch)) score += 20;
|
|
40072
|
-
if (readStringValue(git.headCommit)) score += 20;
|
|
40073
|
-
if (readStringValue(git.upstream)) score += 10;
|
|
40074
|
-
if (readStringValue(git.upstreamStatus)) score += 5;
|
|
40075
|
-
if (readNumberValue(git.ahead) !== void 0) score += 2;
|
|
40076
|
-
if (readNumberValue(git.behind) !== void 0) score += 2;
|
|
40077
|
-
if (Array.isArray(git.submodules) && git.submodules.length > 0) score += 4 + git.submodules.length;
|
|
40078
|
-
if (readStringValue(git.error)) score -= 20;
|
|
40079
|
-
return score;
|
|
40176
|
+
return normalizeGitStatus(status, readObjectRecord(node), options);
|
|
40080
40177
|
}
|
|
40081
40178
|
function buildInlineMeshTransitGitStatus(node) {
|
|
40082
|
-
|
|
40083
|
-
const gitResult = readObjectRecord(rawGit.result);
|
|
40084
|
-
const directStatus = readObjectRecord(rawGit.status);
|
|
40085
|
-
const nestedStatus = readObjectRecord(gitResult.status);
|
|
40086
|
-
const rawProbe = readObjectRecord(node?.lastProbe ?? node?.last_probe);
|
|
40087
|
-
const probeGit = readObjectRecord(rawProbe.git);
|
|
40088
|
-
const probeGitResult = readObjectRecord(probeGit.result);
|
|
40089
|
-
const probeDirectStatus = readObjectRecord(probeGit.status);
|
|
40090
|
-
const probeNestedStatus = readObjectRecord(probeGitResult.status);
|
|
40091
|
-
const candidates = [directStatus, nestedStatus, probeDirectStatus, probeNestedStatus];
|
|
40092
|
-
let best = null;
|
|
40093
|
-
for (const status of candidates) {
|
|
40094
|
-
const normalized = normalizeInlineMeshGitStatus(status, node, { lastCheckedAt: Date.now() });
|
|
40095
|
-
if (!normalized) continue;
|
|
40096
|
-
const score = scoreInlineMeshGitStatus(normalized);
|
|
40097
|
-
if (!best || score > best.score) best = { git: normalized, score };
|
|
40098
|
-
}
|
|
40099
|
-
return best?.git;
|
|
40179
|
+
return pickBestTransitGitStatus(readObjectRecord(node), { lastCheckedAt: Date.now() });
|
|
40100
40180
|
}
|
|
40101
40181
|
function shouldRefreshStalePendingAggregate(snapshot, options) {
|
|
40102
40182
|
if (options?.requireDirectPeerTruth !== true || !Array.isArray(snapshot?.nodes)) return false;
|