Skip to content

Commit fe5cca4

Browse files
committed
perf(mcp)\!: drop shortStatus from git_inventory output
BREAKING CHANGE: InventoryEntryJson no longer carries `shortStatus`; the markdown output drops the trailing `short:` block. `branchStatus` already contains the full `git status --short -b` body (branch header line followed by porcelain entries), so emitting `shortStatus` separately was shipping the porcelain lines twice. gitStatusSnapshotAsync loses its `shortLine` / `shortOk` fields to match — they have no remaining callers.
1 parent 78cc7aa commit fe5cca4

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/server/git.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,13 @@ function gitStatusFailText(r: { stderr: string; stdout: string }): string {
147147

148148
export async function gitStatusSnapshotAsync(cwd: string): Promise<{
149149
branchLine: string;
150-
shortLine: string;
151150
branchOk: boolean;
152-
shortOk: boolean;
153151
}> {
154152
const r = await spawnGitAsync(cwd, ["status", "--short", "-b"]);
155153
if (!r.ok) {
156-
const text = gitStatusFailText(r);
157-
return { branchOk: false, shortOk: false, branchLine: text, shortLine: text };
154+
return { branchOk: false, branchLine: gitStatusFailText(r) };
158155
}
159-
const full = r.stdout.trimEnd();
160-
const nl = full.indexOf("\n");
161-
const branchLine = full;
162-
const shortLine = nl >= 0 ? full.slice(nl + 1) : "";
163-
return { branchOk: true, shortOk: true, branchLine, shortLine };
156+
return { branchOk: true, branchLine: r.stdout.trimEnd() };
164157
}
165158

166159
export async function gitStatusShortBranchAsync(

src/server/inventory.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export type InventoryEntryJson = {
77
label: string;
88
path: string;
99
branchStatus: string;
10-
shortStatus: string;
1110
detached: boolean;
1211
headAbbrev: string;
1312
upstreamMode: "auto" | "fixed";
@@ -33,7 +32,6 @@ export function makeSkipEntry(
3332
label,
3433
path: abs,
3534
branchStatus: "",
36-
shortStatus: "",
3735
detached: false,
3836
headAbbrev: "",
3937
upstreamMode,
@@ -50,10 +48,7 @@ export function buildInventorySectionMarkdown(e: InventoryEntryJson): string[] {
5048
return [`## ${e.label}`, `path: ${e.path}`, "```text", e.skipReason, "```", ``];
5149
}
5250
const lines: string[] = [];
53-
lines.push(e.branchStatus);
54-
lines.push("");
55-
lines.push("short:");
56-
lines.push(e.shortStatus || "(clean)");
51+
lines.push(e.branchStatus || "(clean)");
5752
lines.push("");
5853
if (e.detached) {
5954
lines.push("branch: (detached HEAD)");
@@ -76,7 +71,6 @@ function buildEntry(params: {
7671
label: string;
7772
absPath: string;
7873
branchStatus: string;
79-
shortStatus: string;
8074
detached: boolean;
8175
headAbbrev: string;
8276
upstreamMode: "auto" | "fixed";
@@ -89,7 +83,6 @@ function buildEntry(params: {
8983
label: params.label,
9084
path: params.absPath,
9185
branchStatus: params.branchStatus,
92-
shortStatus: params.shortStatus,
9386
detached: params.detached,
9487
headAbbrev: params.headAbbrev || "(unknown)",
9588
upstreamMode: params.upstreamMode,
@@ -112,10 +105,9 @@ export async function collectInventoryEntry(
112105
]);
113106

114107
const branchStatus = snap.branchLine;
115-
const shortStatus = snap.shortLine;
116108
const headAbbrev = headR.ok ? headR.stdout.trim() : "";
117109
const detached = !headR.ok || headAbbrev === "HEAD" || headAbbrev.endsWith("/HEAD");
118-
const base = { label, absPath, branchStatus, shortStatus, detached, headAbbrev };
110+
const base = { label, absPath, branchStatus, detached, headAbbrev };
119111

120112
if (fixedRemote !== undefined && fixedBranch !== undefined) {
121113
const ref = `${fixedRemote}/${fixedBranch}`;

0 commit comments

Comments
 (0)