refactor(source-control): GitManager reads provider resolvers, not host kinds (#17617)
Co-authored-by: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
c85dc64268
commit
49f849ecce
11 files changed
+190
-107
No files matched your search
@@ -23,6 +23,7 @@ import { decodeJsonResult } from "@t3tools/shared/schemaJson";
|
||||
import { isSshRemoteUrl } from "@t3tools/shared/sourceControl";
|
||||
|
||||
import * as GitHubApi from "./GitHubApi.ts";
|
||||
import * as GitHubChangeRequestTemplate from "./gitHubChangeRequestTemplate.ts";
|
||||
import {
|
||||
decodeGitHubPullRequestEntries,
|
||||
type NormalizedGitHubPullRequestRecord,
|
||||
@@ -939,6 +940,18 @@ export const make = Effect.gen(function* () {
|
||||
|
||||
return SourceControlProvider.SourceControlProvider.of({
|
||||
kind: "github",
|
||||
// `gh pr list --head` filters on the head ref name alone and accepts anything, so an
|
||||
// `owner:branch` or `remote:branch` selector silently lists zero pull requests while
|
||||
// spending a GraphQL call; the bare branch is always among the selectors. Without the owner,
|
||||
// a bare branch also lists same-named branches on other forks (`main`, `patch-1`), so read a
|
||||
// full page and let the owner check pick the right head. gh fetches up to 100 in one
|
||||
// request, and GitHub prices a first:100 connection like first:1.
|
||||
headBranchProbe: ({ headSelectors }) => ({
|
||||
headSelectors: headSelectors.filter((selector) => !selector.includes(":")),
|
||||
limit: 100,
|
||||
}),
|
||||
readChangeRequestTemplate: ({ cwd, treeish }) =>
|
||||
GitHubChangeRequestTemplate.detect(cwd, treeish, git.execute),
|
||||
resolveLink: (input) => {
|
||||
// Automatic enrichment must not send ambient CLI credentials to a host from message text.
|
||||
if (input.url.host !== "github.com") return undefined;
|
||||
|
||||
Reference in new issue
Block a user