Skip to content

Commit 745d47c

Browse files
committed
refactor(cli): move gh write adapters into the github module
Relocate github-mutations.ts to github/mutations.ts and export it from the github barrel, so reads and writes live in one cohesive github/ module. Routes import the write adapters via github/index.js. No behavior change.
1 parent 207dcad commit 745d47c

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

packages/cli/src/github/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,13 @@
1+
export {
2+
addReviewers,
3+
closePullRequest,
4+
editTitle,
5+
listCollaborators,
6+
mergePullRequest,
7+
removeReviewers,
8+
reopenPullRequest,
9+
setAutoMerge,
10+
setDraft,
11+
} from "./mutations.js";
112
export { getChecks, getMergeStatus, getPullRequest, getReviews } from "./pull-request.js";
213
export { type GitHubRepo, isGitHubRemote, parseGitHubRepo } from "./repo.js";
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
PULL_REQUEST_MERGE_METHOD,
55
type PullRequestMergeMethod,
66
} from "@stagereview/types/pull-request";
7-
import type { GitHubRepo } from "./github/index.js";
7+
import type { GitHubRepo } from "./repo.js";
88

99
const execFileAsync = promisify(execFile);
1010

1111
/**
1212
* Run a `gh` write command in `repoRoot`. Unlike the read adapters in
13-
* github.ts (which swallow errors to null), writes surface failures so the UI
14-
* can toast them — the user explicitly asked to mutate their PR.
13+
* pull-request.ts (which swallow errors to null), writes surface failures so
14+
* the UI can toast them — the user explicitly asked to mutate their PR.
1515
*/
1616
async function ghWrite(args: string[], repoRoot: string): Promise<void> {
1717
try {

packages/cli/src/routes/pull-request-mutations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
reopenPullRequest,
1515
setAutoMerge,
1616
setDraft,
17-
} from "../github-mutations.js";
17+
} from "../github/index.js";
1818
import type { Route, RouteHandler } from "../server.js";
1919
import { readJsonBody, writeJson } from "./json.js";
2020
import { requireRepo, resolveRun } from "./pull-request-shared.js";

0 commit comments

Comments
 (0)