feat(github): add project-scoped GitHub CLI account selection (#6277)

A project can pin a GitHub CLI account in vcs.github.account (.openidea/settings.toml, a login, never a token), chosen in Settings > Version Control > GitHub or from the Pull Requests tool window header. With an account chosen, its token is resolved through gh and set as GH_TOKEN in the project environment for the project root and its agent worktrees; a .envrc GH_TOKEN still wins, and the token is cleared when the project closes or loses trust. Copilot keeps billing to its own account through COPILOT_GITHUB_TOKEN.

Automatic (the default) sets no GH_TOKEN and makes no GitHub calls on project open. When the settings page or the Pull Requests window asks for the status with several gh accounts signed in, the project's GitHub remote is probed to suggest a non-active account with access ("Use <login> for this project").

New commands: gh_project_account_status, gh_set_project_account. The gh account listing is shared with the Copilot account selector.

Co-authored-by: dengliu <[email protected]>
Цей коміт міститься в:
Deng Liuтаdengliu authored and GitHub committed 2026-11-27 08:16:10 +08:00
1 джерело 77071238a0
коміт a5e0c41663
29 files changed
+1215 -53

No files matched your search

+79
Переглянути файл
@@ -0,0 +1,79 @@
/**
* Per-project GitHub CLI (`gh`) account selection (`vcs.github.account` in `.openidea/settings.toml`).
* Kept free of editor/markdown imports so `GithubSettingsPage` stays within `settingsWindowBoot`.
*/
import { create } from "zustand";
import type { GhProjectAccountStatus } from "@/bindings";
import { tx } from "@/platform/i18n";
import { call, commands, isTauri } from "@/platform/ipc";
import type { SelectOption } from "@/ui";
interface GhProjectAccountState {
status: GhProjectAccountStatus | null;
loading: boolean;
saving: boolean;
/** Incremented whenever the user changes the project GitHub account so open views reconnect. */
revision: number;
}
export const useGhProjectAccount = create<GhProjectAccountState>(() => ({
status: null,
loading: false,
saving: false,
revision: 0,
}));
export async function loadProjectGithubAccount(): Promise<GhProjectAccountStatus | null> {
if (!isTauri()) return useGhProjectAccount.getState().status;
useGhProjectAccount.setState({ loading: true });
try {
const status = await call(commands.ghProjectAccountStatus());
useGhProjectAccount.setState({ status, loading: false });
return status;
} catch {
useGhProjectAccount.setState({ loading: false });
return null;
}
}
export async function setProjectGithubAccount(account: string): Promise<GhProjectAccountStatus | null> {
if (!isTauri()) {
useGhProjectAccount.setState((s) => ({
status: s.status
? {
...s.status,
configuredAccount: account,
effectiveAccount: account || s.status.accounts.find((a) => a.active)?.login || null,
suggestedAccount: account ? null : s.status.suggestedAccount,
}
: null,
revision: s.revision + 1,
}));
return useGhProjectAccount.getState().status;
}
useGhProjectAccount.setState({ saving: true });
try {
const status = await call(commands.ghSetProjectAccount(account));
useGhProjectAccount.setState((s) => ({ status, saving: false, revision: s.revision + 1 }));
return status;
} catch {
useGhProjectAccount.setState({ saving: false });
return null;
}
}
export function projectAccountOptions(status: GhProjectAccountStatus | null): SelectOption[] {
const accounts = status?.accounts ?? [];
const configured = status?.configuredAccount ?? "";
const activeLogin =
accounts.find((a) => a.active)?.login ?? (!configured ? (status?.effectiveAccount ?? null) : null);
const automaticLabel = activeLogin ? tx`Automatic (${activeLogin})` : tx("Automatic");
return [
{ value: "", label: automaticLabel, verbatim: true },
...accounts.map((a) => ({ value: a.login, label: a.login, verbatim: true })),
...(configured && !accounts.some((a) => a.login === configured)
? [{ value: configured, label: tx`${configured} (not signed in)`, verbatim: true }]
: []),
];
}
+6 -1
Переглянути файл
@@ -224,7 +224,12 @@ export async function connect(
if (seq !== connectSeq) return false;
if (!repository) throw new Error(`Repository ${nameWithOwner(coordinates)} not found`);
const previous = useGhRepository.getState().connection;
if (!sameRepository(previous?.coordinates, coordinates) || previous?.root !== root) resetRepositoryData();
if (
!sameRepository(previous?.coordinates, coordinates) ||
previous?.root !== root ||
previous?.currentUser.login !== currentUser.login
)
resetRepositoryData();
setCurrentRepository({ ...coordinates, id: repository.id, root });
useGhRepository.setState((s) => ({
connection: { coordinates, repository, currentUser, root, remotes },
+75 -8
Переглянути файл
@@ -1,20 +1,87 @@
/**
* Settings › Version Control › GitHub (`GithubSettingsConfigurable`); accounts are gh's, so
* only the pull request option is here. Applies at once, like the Log page.
* Settings › Version Control › GitHub (`GithubSettingsConfigurable`): per-project GitHub CLI
* account selection (`vcs.github.account`) and pull request review options. Applies at once,
* like the Log page.
*/
import { Checkbox } from "@/ui";
import { useEffect, useId } from "react";
import { tx } from "@/platform/i18n";
import { Button, Checkbox, Select, T } from "@/ui";
import {
loadProjectGithubAccount,
projectAccountOptions,
setProjectGithubAccount,
useGhProjectAccount,
} from "../data/account";
import { setReviewDiffSettings, useReviewDiffSettings } from "./settings";
import styles from "./ReviewDiff.module.css";
export function GithubSettingsPage() {
const autoMarkViewed = useReviewDiffSettings((s) => s.autoMarkViewed);
const status = useGhProjectAccount((s) => s.status);
const saving = useGhProjectAccount((s) => s.saving);
const accountHeading = useId();
const prHeading = useId();
const selectId = useId();
useEffect(() => {
void loadProjectGithubAccount();
}, []);
const options = projectAccountOptions(status);
const value = status?.configuredAccount ?? "";
const suggested = !value ? (status?.suggestedAccount ?? null) : null;
return (
<div className={styles.page}>
<Checkbox
checked={autoMarkViewed}
onChange={(v) => setReviewDiffSettings({ autoMarkViewed: v })}
label="Automatically mark opened files as viewed"
/>
<section className={styles.section} aria-labelledby={accountHeading}>
<h2 id={accountHeading} className={styles.heading}>
<T>Account</T>
</h2>
<div className={styles.accountRow}>
<label htmlFor={selectId} className={styles.accountLabel}>
<T>GitHub account</T>:
</label>
<div className={styles.accountControl}>
<div className={styles.accountField}>
<div className={styles.accountSelect}>
<Select
id={selectId}
aria-label="GitHub account"
value={value}
disabled={saving}
options={options}
onChange={(next) => void setProjectGithubAccount(next)}
/>
</div>
{suggested && (
<Button size="small" disabled={saving} onClick={() => void setProjectGithubAccount(suggested)}>
{tx`Use ${suggested} for this project`}
</Button>
)}
</div>
<p className={styles.accountHint}>
{value ? (
<T>
Passes this account&apos;s GH_TOKEN to processes started in this project (terminals, agents, Git, and
run configurations).
</T>
) : (
<T>Uses GitHub CLI&apos;s active account without setting GH_TOKEN in the project environment.</T>
)}
</p>
</div>
</div>
</section>
<section className={styles.section} aria-labelledby={prHeading}>
<h2 id={prHeading} className={styles.heading}>
<T>Pull Requests</T>
</h2>
<Checkbox
checked={autoMarkViewed}
onChange={(v) => setReviewDiffSettings({ autoMarkViewed: v })}
label="Automatically mark opened files as viewed"
/>
</section>
</div>
);
}
+64 -1
Переглянути файл
@@ -29,6 +29,69 @@
.page {
display: flex;
flex-direction: column;
gap: var(--space-2);
gap: var(--space-4);
padding: 4px 0;
}
.section {
display: flex;
flex-direction: column;
gap: var(--space-2);
}
.heading {
margin: 0;
padding-bottom: 4px;
border-bottom: 1px solid var(--border);
color: var(--fg-strong);
font-size: var(--fs-ui);
font-weight: 600;
}
.accountRow {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
align-items: start;
column-gap: var(--space-3);
row-gap: var(--space-1);
}
.accountLabel {
line-height: var(--h-field);
color: var(--fg);
white-space: nowrap;
}
.accountControl {
display: flex;
flex-direction: column;
gap: var(--space-1);
min-width: 0;
}
.accountField {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--space-2);
min-width: 0;
}
.accountSelect {
display: flex;
width: 280px;
max-width: 100%;
min-width: 0;
}
.accountSelect > button {
flex: 1;
min-width: 0;
}
.accountHint {
margin: 0;
max-width: 480px;
color: var(--fg-subtle);
font-size: var(--fs-small);
}
+22 -3
Переглянути файл
@@ -8,7 +8,8 @@ import { getContext, setContext } from "@/platform/context";
import { useProject } from "@/platform/project";
import { maybeEditorService, type EditorInput } from "@/workbench/contributions";
import { activateReviewDiff, toggleReviewDiffViewed } from "./diff";
import { reloadList } from "./data/list";
import { loadProjectGithubAccount, useGhProjectAccount } from "./data/account";
import { reloadList, useGhPrList } from "./data/list";
import { checkoutPullRequest, clearDiffCache, copyUrl, openInBrowser, openInWorktree } from "./data/local";
import { deleteMergedBranch } from "./data/operations";
import { cachedDetails, loadPullRequestData, reloadPullRequest } from "./data/pullRequest";
@@ -99,9 +100,10 @@ export const timeline = {
export function activate(): () => void {
const sync = () => {
const s = useGhRepository.getState();
const acct = useGhProjectAccount.getState().status;
setContext("githubConnected", !!s.connection);
setContext("githubTimelineActive", activeTimelinePullRequest() !== null);
useGithubShell.setState({ headerMenu: headerMenu(s) });
useGithubShell.setState({ headerMenu: headerMenu(s, acct) });
};
sync();
const disposers = [
@@ -112,10 +114,27 @@ export function activate(): () => void {
if (a?.owner !== b?.owner || a?.name !== b?.name) {
resetTabs();
clearDiffCache();
} else if (
s.connection &&
prev.connection &&
s.connection.currentUser.login !== prev.connection.currentUser.login &&
useGhPrList.getState().loaded
) {
void reloadList();
}
}),
useGhProjectAccount.subscribe((s, prev) => {
sync();
if (s.revision !== prev.revision) {
void refreshConnection();
}
}),
useProject.subscribe((s, prev) => {
if (s.project?.root !== prev.project?.root) resetConnection();
if (s.project?.root !== prev.project?.root) {
useGhProjectAccount.setState({ status: null, loading: false, saving: false });
resetConnection();
if (s.project) void loadProjectGithubAccount();
}
}),
activateReviewDiff(),
activateReviewMode(),
+37 -1
Переглянути файл
@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, it } from "vitest";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { act, fireEvent, render, screen } from "@testing-library/react";
import { useSettingsPages } from "@/workbench/contributions";
import { useGhProjectAccount } from "./data/account";
import { activateSettingsPages } from "./settingsPages";
import { GithubSettingsPage } from "./diff/GithubSettingsPage";
import { setReviewDiffSettings, useReviewDiffSettings } from "./diff/settings";
@@ -10,6 +11,11 @@ const KEY = "openidea.github.reviewDiff.v1";
beforeEach(() => {
localStorage.removeItem(KEY);
window.dispatchEvent(new StorageEvent("storage", { key: KEY }));
useGhProjectAccount.setState({ status: null, loading: false, saving: false, revision: 0 });
});
afterEach(() => {
useGhProjectAccount.setState({ status: null, loading: false, saving: false, revision: 0 });
});
describe("GitHub settings pages", () => {
@@ -49,4 +55,34 @@ describe("GitHub settings pages", () => {
window.dispatchEvent(new StorageEvent("storage", { key: KEY }));
expect(useReviewDiffSettings.getState().autoMarkViewed).toBe(false);
});
it("suggests a matching non-active GitHub account and shows the GH_TOKEN scope note once chosen", () => {
useGhProjectAccount.setState({
status: {
ghInstalled: true,
accounts: [
{ login: "alice", active: true },
{ login: "alice-work", active: false },
],
configuredAccount: "",
effectiveAccount: "alice",
suggestedAccount: "alice-work",
},
});
render(<GithubSettingsPage />);
const select = screen.getByRole("button", { name: "GitHub account" });
expect(select).toHaveTextContent("Automatic (alice)");
expect(
screen.getByText("Uses GitHub CLI's active account without setting GH_TOKEN in the project environment."),
).toBeInTheDocument();
fireEvent.click(screen.getByRole("button", { name: "Use alice-work for this project" }));
expect(screen.getByRole("button", { name: "GitHub account" })).toHaveTextContent("alice-work");
expect(useGhProjectAccount.getState().status?.configuredAccount).toBe("alice-work");
expect(
screen.getByText(
"Passes this account's GH_TOKEN to processes started in this project (terminals, agents, Git, and run configurations).",
),
).toBeInTheDocument();
});
});
+1 -1
Переглянути файл
@@ -6,7 +6,7 @@ export function activateSettingsPages(): () => void {
id: "vcs.github",
title: "GitHub",
order: 9,
keywords: ["pull request", "viewed", "review"],
keywords: ["pull request", "viewed", "review", "account", "gh", "token"],
component: lazyComponent(() => import("./diff/GithubSettingsPage").then((m) => m.GithubSettingsPage)),
});
}
+147 -8
Переглянути файл
@@ -5,6 +5,7 @@
* the repository, `#N` tabs and "New Pull Request at {repo}" — in the header.
*/
import { useEffect, useRef, useState, type RefObject } from "react";
import type { GhProjectAccountStatus } from "@/bindings";
import type { GhAvailability } from "@/platform/ipc";
import { executeAction } from "@/platform/actions";
import { GH_MANUAL_INSTALL_URL, installGhTool } from "@/platform/ghTool";
@@ -14,6 +15,12 @@ import { Button, EmptyState, IconButton, Select, Spinner, Tabs, T, showContextMe
import { CreatePanel } from "../create/CreatePanel";
import { DetailsPanel } from "../details/DetailsPanel";
import { ListPanel } from "../list/ListPanel";
import {
loadProjectGithubAccount,
projectAccountOptions,
setProjectGithubAccount,
useGhProjectAccount,
} from "../data/account";
import { reloadList, useGhPrList } from "../data/list";
import { cancelBusy, openInBrowser, useGhBusy } from "../data/local";
import { repositoryDisplayName } from "../data/model";
@@ -29,6 +36,42 @@ import {
import { closeTab, selectTab, tabId, useGhTabs, type GhTabId } from "./store";
import styles from "./ToolWindow.module.css";
function ProjectAccountInline() {
const status = useGhProjectAccount((s) => s.status);
const saving = useGhProjectAccount((s) => s.saving);
if (!status || status.accounts.length === 0) return null;
const suggested = !status.configuredAccount ? status.suggestedAccount : null;
return (
<div className={styles.accountInline}>
{suggested && (
<Button
size="small"
variant="primary"
disabled={saving}
onClick={() => void setProjectGithubAccount(suggested)}
>
{tx`Use ${suggested} for this project`}
</Button>
)}
<Select
aria-label="GitHub account"
value={status.configuredAccount}
disabled={saving}
options={projectAccountOptions(status)}
onChange={(next) => void setProjectGithubAccount(next)}
/>
{status.configuredAccount && (
<div className={styles.hint}>
<T>
Passes this account&apos;s GH_TOKEN to processes started in this project (terminals, agents, Git, and run
configurations).
</T>
</div>
)}
</div>
);
}
function Unavailable({ availability }: { availability: GhAvailability }) {
const [installingGh, setInstallingGh] = useState(false);
const [installError, setInstallError] = useState<string | null>(null);
@@ -101,6 +144,7 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
}
>
<T>Run</T> <code>gh auth login</code> <T>in a terminal, then retry.</T>
<ProjectAccountInline />
</EmptyState>
);
case "notGitHub":
@@ -115,7 +159,8 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
case "error":
return (
<EmptyState title="Could not reach GitHub" actions={retry}>
{availability.message}
<div>{availability.message}</div>
<ProjectAccountInline />
</EmptyState>
);
default:
@@ -123,12 +168,14 @@ function Unavailable({ availability }: { availability: GhAvailability }) {
}
}
/** IntelliJ's repository selector: the repositories (owner always shown) and "View Pull Requests". */
/** IntelliJ's repository selector: the repositories (owner always shown), project account, and "View Pull Requests". */
function RepositorySelector() {
const remotes = useGhRepository((s) => s.remotes);
const defaultRemote = useGhRepository((s) => s.defaultRemote);
const connecting = useGhRepository((s) => s.connecting);
const error = useGhRepository((s) => s.connectionError);
const status = useGhProjectAccount((s) => s.status);
const savingAccount = useGhProjectAccount((s) => s.saving);
const [chosen, setChosen] = useState<string | null>(null);
const value =
chosen ??
@@ -136,6 +183,36 @@ function RepositorySelector() {
const target = remotes.find((r) => nameWithOwner(r) === value);
return (
<div className={styles.selector}>
{status && status.accounts.length > 0 && (
<>
<div className={styles.selectorRow}>
<Select
aria-label="GitHub account"
value={status.configuredAccount}
disabled={savingAccount}
options={projectAccountOptions(status)}
onChange={(next) => void setProjectGithubAccount(next)}
/>
{!status.configuredAccount && status.suggestedAccount && (
<Button
size="small"
disabled={savingAccount}
onClick={() => void setProjectGithubAccount(status.suggestedAccount!)}
>
{tx`Use ${status.suggestedAccount} for this project`}
</Button>
)}
</div>
{status.configuredAccount && (
<div className={styles.hint}>
<T>
Passes this account&apos;s GH_TOKEN to processes started in this project (terminals, agents, Git, and
run configurations).
</T>
</div>
)}
</>
)}
<div className={styles.selectorRow}>
<Select
value={value}
@@ -231,6 +308,7 @@ export function PullRequestsToolWindow() {
const connected = useGhRepository((s) => !!s.connection);
const connecting = useGhRepository((s) => s.connecting);
useEffect(() => {
if (!useGhProjectAccount.getState().status) void loadProjectGithubAccount();
if (!useGhRepository.getState().availability) void refreshConnection();
}, []);
if (!availability)
@@ -297,21 +375,82 @@ export function PullRequestsTabs() {
);
}
/** Title actions: Create Pull Request… (+) and Select Opened Pull Request, while connected. */
/** Title actions: account switcher (when multi-account), Create Pull Request… (+) and Select Opened Pull Request. */
export function PullRequestsHeaderActions() {
const connected = useGhRepository((s) => !!s.connection);
if (!connected) return null;
const connection = useGhRepository((s) => s.connection);
const status = useGhProjectAccount((s) => s.status);
if (!connection) return null;
const showAccount = (status?.accounts.length ?? 0) > 1 || !!status?.configuredAccount;
const activeLogin = connection.currentUser.login || status?.effectiveAccount || "";
const suggested = !status?.configuredAccount ? (status?.suggestedAccount ?? null) : null;
return (
<>
{showAccount && status && activeLogin && (
<button
type="button"
className={styles.accountBadge}
title={suggested ? tx`Use ${suggested} for this project` : tx`GitHub account: @${activeLogin}`}
onClick={(e) => {
const configured = status.configuredAccount;
const defaultLogin = status.accounts.find((a) => a.active)?.login ?? null;
const autoLabel = defaultLogin ? tx`Automatic (${defaultLogin})` : tx("Automatic");
const items: MenuItem[] = [
...(suggested
? [
{
label: tx`Use ${suggested} for this project`,
verbatim: true,
run: () => void setProjectGithubAccount(suggested),
},
{ kind: "separator" as const },
]
: []),
{
label: autoLabel,
verbatim: true,
checked: configured === "",
run: () => void setProjectGithubAccount(""),
},
...status.accounts.map((a) => ({
label: `@${a.login}`,
verbatim: true,
checked: configured === a.login,
run: () => void setProjectGithubAccount(a.login),
})),
];
showContextMenu(e, items);
}}
>
@{activeLogin}
</button>
)}
<IconButton icon="plus" size="small" iconSize={16} action="github.createPullRequest" />
<IconButton icon="locate" size="small" iconSize={16} action="github.selectOpenedPullRequest" />
</>
);
}
/** The "⋮" menu's own items: Change Repository or Account… (connected, several GitHub remotes). */
export function headerMenu(s: Pick<ReturnType<typeof useGhRepository.getState>, "connection" | "remotes">): MenuItem[] {
return s.connection && s.remotes.length > 1 ? CHANGE_REPOSITORY : NONE;
/** The "⋮" menu's own items: suggested account (if any) and Change Repository or Account…. */
export function headerMenu(
s: Pick<ReturnType<typeof useGhRepository.getState>, "connection" | "remotes">,
acct?: GhProjectAccountStatus | null,
): MenuItem[] {
if (!s.connection) return NONE;
const suggested = !acct?.configuredAccount ? (acct?.suggestedAccount ?? null) : null;
const multipleAccounts = (acct?.accounts.length ?? 0) > 1 || !!acct?.configuredAccount;
if (!suggested && s.remotes.length <= 1 && !multipleAccounts) return NONE;
return [
...(suggested
? [
{
label: tx`Use ${suggested} for this project`,
verbatim: true,
run: () => void setProjectGithubAccount(suggested),
},
]
: []),
...CHANGE_REPOSITORY,
];
}
const NONE: MenuItem[] = [];
+28
Переглянути файл
@@ -36,6 +36,34 @@
.tabs {
min-width: 0;
}
.accountBadge {
flex: 0 1 auto;
height: 22px;
min-width: 48px;
max-width: 100px;
padding: 0 6px;
overflow: hidden;
border: 1px solid var(--border);
border-radius: 4px;
background: transparent;
color: var(--fg-secondary);
font-family: var(--font-ui);
font-size: var(--fs-small);
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
}
.accountBadge:hover {
background: var(--bg-hover);
color: var(--fg);
}
.accountInline {
display: flex;
flex-direction: column;
align-items: center;
gap: var(--space-1-5);
margin-top: 8px;
}
/* Repository selector (several GitHub remotes) */
.selector {
+45 -1
Переглянути файл
@@ -7,9 +7,15 @@ import { provideToolWindowService, useContributions, type ToolWindowService } fr
import { activate } from "../index";
import { setCurrentRepository } from "../api/client";
import type { GHRepository, GHUser } from "../api/types";
import { useGhProjectAccount } from "../data/account";
import * as repositoryData from "../data/repository";
import { useGhRepository } from "../data/repository";
import { PullRequestsTabs, PullRequestsToolWindow } from "./PullRequestsToolWindow";
import {
PullRequestsHeaderActions,
PullRequestsTabs,
PullRequestsToolWindow,
headerMenu,
} from "./PullRequestsToolWindow";
import {
closeTab,
contextPullRequest,
@@ -86,6 +92,7 @@ describe("tool window", () => {
vi.restoreAllMocks();
setCurrentRepository(null);
useGhRepository.setState({ connection: null, availability: null, remotes: [] });
useGhProjectAccount.setState({ status: null, loading: false, saving: false, revision: 0 });
resetTabs();
});
@@ -193,4 +200,41 @@ describe("tool window", () => {
await act(async () => openPullRequestTab(4));
expect(screen.getByRole("tab", { name: /#4/ })).toBeTruthy();
});
it("suggests a matching GitHub account in the header menu and shows the active account badge", () => {
const connState = {
connection: {
coordinates: { owner: "org", name: "app" },
repository,
currentUser: { ...me, login: "alice" },
root: null,
remotes: [],
},
remotes: [{ owner: "org", name: "app", remote: "origin", url: "" }],
};
expect(headerMenu(connState, null)).toEqual([]);
const multiStatus = {
ghInstalled: true,
accounts: [
{ login: "alice", active: true },
{ login: "alice-work", active: false },
],
configuredAccount: "",
effectiveAccount: "alice",
suggestedAccount: "alice-work",
};
expect(headerMenu(connState, multiStatus).map((i) => ("label" in i ? i.label : ""))).toEqual([
"Use alice-work for this project",
"Change Repository or Account…",
]);
useGhRepository.setState({
availability: { kind: "ready", repo: {} as never, login: "alice" },
...connState,
});
useGhProjectAccount.setState({ status: multiStatus });
render(<PullRequestsHeaderActions />);
const badge = screen.getByRole("button", { name: "@alice" });
expect(badge).toHaveAttribute("title", "Use alice-work for this project");
});
});