feat(FN-1236): migrate GitHub PR workflows to gh authentication

- Require gh-authenticated paths for task pr-create and dashboard PR routes
- Switch dashboard command and extension GitHub tools to use the gh auth client instead of token-based auth
- Update CLI and dashboard tests to cover gh-only createPr and import behavior
- Refresh README guidance and add a changeset removing the GitHub token requirement for PR flows
This commit is contained in:
gsxdsm
2026-04-08 15:40:39 -07:00
parent a47db4fa6b
commit d66300c794
10 changed files with 348 additions and 398 deletions

View File

@@ -75,10 +75,11 @@ describe("GitHubClient", () => {
base: "main",
};
it("creates PR using gh CLI when available", async () => {
it("createPr succeeds with gh CLI only (no token)", async () => {
mockRunGh.mockReturnValue("https://github.com/test-owner/test-repo/pull/42\n");
const ghOnlyClient = new GitHubClient();
const result = await client.createPr(mockPrParams);
const result = await ghOnlyClient.createPr(mockPrParams);
expect(mockRunGh).toHaveBeenCalledWith([
"pr", "create",
@@ -181,12 +182,12 @@ describe("GitHubClient", () => {
vi.restoreAllMocks();
});
it("throws error when gh CLI fails and no token available", async () => {
it("throws gh-auth-focused error when gh CLI fails and no token is available", async () => {
mockRunGh.mockImplementation(() => {
throw new Error("gh command failed: not authenticated");
throw new Error("GitHub CLI is not authenticated. Run 'gh auth login'.");
});
await expect(client.createPr(mockPrParams)).rejects.toThrow();
await expect(client.createPr(mockPrParams)).rejects.toThrow("gh auth login");
});
});

View File

@@ -4255,7 +4255,7 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
}
// Create the PR
const client = new GitHubClient(githubToken);
const client = new GitHubClient();
const prInfo = await client.createPr({
owner,
@@ -4543,7 +4543,7 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
}
// Fetch fresh PR status + merge readiness
const client = new GitHubClient(githubToken);
const client = new GitHubClient();
const mergeStatus = await client.getPrMergeStatus(owner, repo, task.prInfo.number);
const prInfo = {