Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changes/1789537715855-show-ghe-account-status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bump: patch
---
Show the active GitHub account, login host, and Copilot plan as explicit fields in the startup welcome card and `/status`.
15 changes: 11 additions & 4 deletions src/tui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function statusCard(s: StatusSummary, extra: string[] = [], clients?: ClientStat
// Fold in who's logged in + their Copilot plan when connected: "✓ connected · Can Wang (canwa) ·
// Copilot Enterprise". Each segment is appended only when present, so a failed/pending lookup just
// shows "✓ connected" with no dangling separator.
const ghLine = [gh, s.githubHost, s.identity, s.plan].filter(Boolean).join(" · ");
const web = s.webSearch === "webiq" ? "✓ via WebIQ" : s.webSearch === "copilot" ? "✓ via Copilot (native)" : "✗ unavailable — run /webiq";
// Per-scope + model when we have the file-derived detail; else fall back to the simple flag.
const scope = (sc?: { on: boolean; model?: string }) => sc?.on ? `✓ ${sc.model ? sc.model.replace(/\[1m\]$/, "") : "on"}` : "○";
Expand All @@ -67,7 +66,10 @@ function statusCard(s: StatusSummary, extra: string[] = [], clients?: ClientStat
: `claude ${s.clients.claude ? "✓" : "○"} codex ${s.clients.codex ? "✓" : "○"}`;
const tone: "ok" | "error" = s.github === "connected" ? "ok" : "error";
return { type: "card", title: "status", tone, lines: [
`GitHub login ${ghLine}`,
`GitHub login ${gh}`,
...(s.identity ? [`account ${s.identity}`] : []),
...(s.githubHost ? [`host ${s.githubHost}`] : []),
...(s.plan ? [`plan ${s.plan}`] : []),
`web search ${web}`,
`worker ${s.worker}`,
`clients ${clientsLine}`,
Expand Down Expand Up @@ -350,9 +352,14 @@ export function App({
catch (error) { githubError = error instanceof Error ? error.message : String(error); }
}
let worker = state, restarts: string[] = [];
let liveGithubHost = githubHost;
try {
const s = await statusSource?.();
if (s) { worker = s.workerState; restarts = s.restarts.slice(0, 5).map((r) => ` ${r.reason} exit=${r.exitCode ?? "-"} ${r.stderrTail.slice(0, 60)}`); }
if (s) {
worker = s.workerState;
restarts = s.restarts.slice(0, 5).map((r) => ` ${r.reason} exit=${r.exitCode ?? "-"} ${r.stderrTail.slice(0, 60)}`);
liveGithubHost = s.github?.hasToken ? s.github.host : undefined;
}
} catch { /* daemon momentarily down — show what we have */ }
// Fresh identity/plan for the live card when connected. Best-effort — a failed lookup just omits
// them. Fall back to the startup values so a transient miss doesn't blank a name we already had.
Expand All @@ -363,7 +370,7 @@ export function App({
clients: { claude: status.claude.user || status.claude.project, codex: status.codex.user || status.codex.project },
identity: acct.identity ?? startupStatus?.identity,
plan: acct.plan ?? startupStatus?.plan,
githubHost,
githubHost: liveGithubHost,
});
const extra = [
...(githubError ? [`GitHub check ${githubError}`] : []),
Expand Down
20 changes: 14 additions & 6 deletions tests/tui/app-interaction.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,28 +343,36 @@ describe("TUI: startup status card", () => {
expect(f).toMatch(/web search.*via WebIQ/);
expect(f).toMatch(/worker.*ready/);
});
it("folds the username + Copilot plan into the GitHub line when present", () => {
it("shows the login account and GHE.com domain as explicit welcome fields", () => {
const startupStatus = { github: "connected" as const, webSearch: "webiq" as const, worker: "ready" as const,
clients: { claude: true, codex: false }, identity: "Can Wang (canwa_microsoft)", plan: "Copilot Enterprise" };
clients: { claude: true, codex: false }, identity: "Can Wang (canwa_microsoft)", plan: "Copilot Enterprise", githubHost: "msft.ghe.com" };
const { lastFrame } = render(<App registry={reg()} title="m" startupStatus={startupStatus} />);
const f = lastFrame() ?? "";
expect(f).toMatch(/GitHub login.*connected.*canwa_microsoft.*Copilot Enterprise/);
expect(f).toMatch(/GitHub login.*connected/);
expect(f).toMatch(/account.*Can Wang \(canwa_microsoft\)/);
expect(f).toMatch(/host.*msft\.ghe\.com/);
expect(f).toMatch(/plan.*Copilot Enterprise/);
});
});

describe("TUI: /status folds in identity + plan from accountInfo", () => {
it("shows the fresh username + plan on the live status card", async () => {
it("shows the fresh account and GHE.com domain as explicit fields", async () => {
const accountInfo = vi.fn(async () => ({ identity: "Can Wang (canwa_microsoft)", plan: "Copilot Enterprise" }));
const statusSource = async () => ({ workerState: "ready" as const, restarts: [], github: { ok: true, hasToken: true, checkedAt: 1, detail: "token valid", host: "msft.ghe.com" } });
const { stdin, lastFrame } = render(
<App registry={reg()} title="m" githubStatus={async () => "connected"} webSearchBackend={() => "copilot"} accountInfo={accountInfo} />,
<App registry={reg()} title="m" statusSource={statusSource} githubStatus={async () => "connected"} webSearchBackend={() => "copilot"} accountInfo={accountInfo} />,
);
await tick();
stdin.write("/status");
await tick();
stdin.write("\r");
await tick(80);
expect(accountInfo).toHaveBeenCalled();
expect(lastFrame() ?? "").toMatch(/GitHub login.*connected.*canwa_microsoft.*Copilot Enterprise/);
const frame = lastFrame() ?? "";
expect(frame).toMatch(/GitHub login.*connected/);
expect(frame).toMatch(/account.*Can Wang \(canwa_microsoft\)/);
expect(frame).toMatch(/host.*msft\.ghe\.com/);
expect(frame).toMatch(/plan.*Copilot Enterprise/);
});
});

Expand Down
Loading