adhdev 0.9.82-rc.8 → 0.9.82-rc.9
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/cli/index.js +73 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +73 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js +31 -5
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -264,8 +264,14 @@ async function getGitRepoStatus(workspace, options = {}) {
|
|
|
264
264
|
const includeSubmodules = options.includeSubmodules !== false;
|
|
265
265
|
try {
|
|
266
266
|
const repo = await resolveGitRepository(workspace, options);
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
let parsed = await readPorcelainStatus(repo, options);
|
|
268
|
+
let upstreamProbe = getInitialUpstreamProbe(parsed);
|
|
269
|
+
if (options.refreshUpstream) {
|
|
270
|
+
upstreamProbe = await refreshTrackedUpstream(repo, parsed, options);
|
|
271
|
+
if (upstreamProbe.upstreamStatus === "fresh") {
|
|
272
|
+
parsed = await readPorcelainStatus(repo, options);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
269
275
|
const head = await readHead(repo, options);
|
|
270
276
|
const stashCount = await readStashCount(repo, options);
|
|
271
277
|
let submodules;
|
|
@@ -280,6 +286,9 @@ async function getGitRepoStatus(workspace, options = {}) {
|
|
|
280
286
|
headCommit: head.commit,
|
|
281
287
|
headMessage: head.message,
|
|
282
288
|
upstream: parsed.upstream,
|
|
289
|
+
upstreamStatus: parsed.upstream ? upstreamProbe.upstreamStatus : "no_upstream",
|
|
290
|
+
upstreamFetchedAt: upstreamProbe.upstreamFetchedAt,
|
|
291
|
+
upstreamFetchError: upstreamProbe.upstreamFetchError,
|
|
283
292
|
ahead: parsed.ahead,
|
|
284
293
|
behind: parsed.behind,
|
|
285
294
|
staged: parsed.staged,
|
|
@@ -304,6 +313,60 @@ async function getGitRepoStatus(workspace, options = {}) {
|
|
|
304
313
|
);
|
|
305
314
|
}
|
|
306
315
|
}
|
|
316
|
+
async function readPorcelainStatus(repo, options) {
|
|
317
|
+
const statusOutput = await runGit(repo, ["status", "--porcelain=v2", "--branch"], options);
|
|
318
|
+
return parsePorcelainV2Status(statusOutput.stdout);
|
|
319
|
+
}
|
|
320
|
+
function getInitialUpstreamProbe(parsed) {
|
|
321
|
+
return {
|
|
322
|
+
upstreamStatus: parsed.upstream ? "unchecked" : "no_upstream"
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
async function refreshTrackedUpstream(repo, parsed, options) {
|
|
326
|
+
if (!parsed.upstream || !parsed.branch) {
|
|
327
|
+
return { upstreamStatus: "no_upstream" };
|
|
328
|
+
}
|
|
329
|
+
const remoteName = await readBranchRemote(repo, parsed.branch, options) ?? inferRemoteName(parsed.upstream);
|
|
330
|
+
if (!remoteName) {
|
|
331
|
+
return {
|
|
332
|
+
upstreamStatus: "stale",
|
|
333
|
+
upstreamFetchError: `Unable to resolve remote for upstream '${parsed.upstream}'`
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
await runGit(repo, ["fetch", "--quiet", "--prune", "--no-tags", remoteName], options);
|
|
338
|
+
return {
|
|
339
|
+
upstreamStatus: "fresh",
|
|
340
|
+
upstreamFetchedAt: Date.now()
|
|
341
|
+
};
|
|
342
|
+
} catch (error48) {
|
|
343
|
+
return {
|
|
344
|
+
upstreamStatus: "stale",
|
|
345
|
+
upstreamFetchError: formatGitError(error48)
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function readBranchRemote(repo, branch, options) {
|
|
350
|
+
try {
|
|
351
|
+
const result = await runGit(repo, ["config", "--get", `branch.${branch}.remote`], options);
|
|
352
|
+
return result.stdout.trim() || null;
|
|
353
|
+
} catch {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
function inferRemoteName(upstream) {
|
|
358
|
+
const [remoteName] = upstream.split("/");
|
|
359
|
+
return remoteName?.trim() || null;
|
|
360
|
+
}
|
|
361
|
+
function formatGitError(error48) {
|
|
362
|
+
if (error48 instanceof GitCommandError) {
|
|
363
|
+
return error48.stderr || error48.message;
|
|
364
|
+
}
|
|
365
|
+
if (error48 instanceof Error) {
|
|
366
|
+
return error48.message;
|
|
367
|
+
}
|
|
368
|
+
return String(error48);
|
|
369
|
+
}
|
|
307
370
|
function parsePorcelainV2Status(output) {
|
|
308
371
|
const parsed = {
|
|
309
372
|
branch: null,
|
|
@@ -398,6 +461,7 @@ function emptyStatus(workspace, lastCheckedAt, error48) {
|
|
|
398
461
|
headCommit: null,
|
|
399
462
|
headMessage: null,
|
|
400
463
|
upstream: null,
|
|
464
|
+
upstreamStatus: "unavailable",
|
|
401
465
|
ahead: 0,
|
|
402
466
|
behind: 0,
|
|
403
467
|
staged: 0,
|
|
@@ -690,6 +754,9 @@ function createGitCompactSummary(status, diffSummary) {
|
|
|
690
754
|
isGitRepo: status.isGitRepo,
|
|
691
755
|
repoRoot: status.repoRoot,
|
|
692
756
|
branch: status.branch,
|
|
757
|
+
upstreamStatus: status.upstreamStatus,
|
|
758
|
+
upstreamFetchedAt: status.upstreamFetchedAt,
|
|
759
|
+
upstreamFetchError: status.upstreamFetchError,
|
|
693
760
|
dirty: status.staged > 0 || status.modified > 0 || status.untracked > 0 || status.deleted > 0 || status.renamed > 0 || conflictCount > 0 || changedFiles > 0,
|
|
694
761
|
changedFiles,
|
|
695
762
|
ahead: status.ahead,
|
|
@@ -1017,7 +1084,7 @@ function serviceNotImplemented(command) {
|
|
|
1017
1084
|
}
|
|
1018
1085
|
function createDefaultGitCommandServices() {
|
|
1019
1086
|
return {
|
|
1020
|
-
getStatus: ({ workspace }) => getGitRepoStatus(workspace),
|
|
1087
|
+
getStatus: ({ workspace, refreshUpstream }) => getGitRepoStatus(workspace, { refreshUpstream }),
|
|
1021
1088
|
getDiffSummary: ({ workspace }) => getGitDiffSummary(workspace),
|
|
1022
1089
|
getDiffFile: ({ workspace, path: filePath }) => getGitFileDiff(workspace, filePath),
|
|
1023
1090
|
createSnapshot: ({ workspace, reason, sessionId, turnId }) => defaultSnapshotStore.create({
|
|
@@ -1102,7 +1169,7 @@ async function handleGitCommand(command, args, services = defaultGitCommandServi
|
|
|
1102
1169
|
switch (command) {
|
|
1103
1170
|
case "git_status": {
|
|
1104
1171
|
if (!services.getStatus) return serviceNotImplemented(command);
|
|
1105
|
-
const status = await runService(() => services.getStatus({ workspace }));
|
|
1172
|
+
const status = await runService(() => services.getStatus({ workspace, refreshUpstream: optionalBoolean(args?.refreshUpstream) }));
|
|
1106
1173
|
return "success" in status ? status : { success: true, status };
|
|
1107
1174
|
}
|
|
1108
1175
|
case "git_diff_summary": {
|
|
@@ -47981,7 +48048,7 @@ ${block}`);
|
|
|
47981
48048
|
continue;
|
|
47982
48049
|
}
|
|
47983
48050
|
try {
|
|
47984
|
-
const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4 });
|
|
48051
|
+
const gitStatus = await getGitRepoStatus(node.workspace, { timeoutMs: 1e4, refreshUpstream: true });
|
|
47985
48052
|
status.git = gitStatus;
|
|
47986
48053
|
if (gitStatus.isGitRepo) {
|
|
47987
48054
|
status.health = deriveMeshNodeHealthFromGit(gitStatus);
|
|
@@ -66847,7 +66914,7 @@ var init_adhdev_daemon = __esm({
|
|
|
66847
66914
|
init_version();
|
|
66848
66915
|
init_src();
|
|
66849
66916
|
init_runtime_defaults();
|
|
66850
|
-
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.
|
|
66917
|
+
pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.82-rc.9" });
|
|
66851
66918
|
AdhdevDaemon = class _AdhdevDaemon {
|
|
66852
66919
|
localHttpServer = null;
|
|
66853
66920
|
localWss = null;
|