Skip to content
Open
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
7 changes: 7 additions & 0 deletions changes/site-target-client-compatibility.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"githits": patch
"@githits/mcp": none
---

- **Prepare standalone-site compatibility** - Resolve requests and responses
recognize the reserved site target kind ahead of backend activation.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "./package-intelligence-service.js";
import type { TokenProvider } from "./token-provider.js";

export type ResolveTargetKind = "PACKAGE" | "REPOSITORY";
export type ResolveTargetKind = "PACKAGE" | "REPOSITORY" | "SITE";

export interface ResolveTargetParams {
name: string;
Expand Down
18 changes: 17 additions & 1 deletion packages/mcp/src/shared/resolve-target-request.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ describe("buildResolveTargetParams", () => {
});
});

it("accepts every resolver target kind", () => {
for (const [preferKind, expected] of [
["package", "PACKAGE"],
["repository", "REPOSITORY"],
["site", "SITE"],
] as const) {
expect(
buildResolveTargetParams({
name: "documentation",
preferKind,
includeDetailedFields: false,
}).preferredKinds,
).toEqual([expected]);
}
});

it("rejects empty names and unsupported enums", () => {
expect(() =>
buildResolveTargetParams({ name: " ", includeDetailedFields: false }),
Expand All @@ -78,7 +94,7 @@ describe("buildResolveTargetParams", () => {
expect(() =>
buildResolveTargetParams({
name: "x",
preferKind: "site",
preferKind: "workspace",
includeDetailedFields: false,
}),
).toThrow("prefer-kind expects package or repository");
Expand Down
1 change: 1 addition & 0 deletions packages/mcp/src/shared/resolve-target-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function parsePreferredKind(
if (!kind) return undefined;
if (kind === "package") return "PACKAGE";
if (kind === "repository") return "REPOSITORY";
if (kind === "site") return "SITE";
throw new InvalidPackageSpecError(
`prefer-kind expects package or repository. Got '${value}'.`,
);
Expand Down
23 changes: 23 additions & 0 deletions packages/mcp/src/shared/resolve-target-response.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,29 @@ describe("formatResolveTargetTerminal", () => {
expect(output).toContain("githits search '<query>'");
});

it("renders standalone documentation sites as a known target kind", () => {
const site = candidate({
kind: "SITE",
canonicalKey:
"site:developer.apple.com/design/human-interface-guidelines",
displayName: "Apple Human Interface Guidelines",
stars: undefined,
downloadsLastMonth: undefined,
documentationUrl:
"https://developer.apple.com/design/human-interface-guidelines",
codeAvailable: false,
});

const output = formatResolveTargetTerminal(
result({ best: site, candidates: [site], protectedMatches: [] }),
{ name: "Apple human interface guidelines", useColors: false },
);

expect(output).toContain(
"site:developer.apple.com/design/human-interface-guidelines [exact] · site · docs",
);
});

it("appends missing protected and best candidates after ranked candidates", () => {
const protectedExtra = {
kind: "PACKAGE",
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/src/shared/resolve-target-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function formatResolveTargetTerminal(
}

const KNOWN_CONFIDENCE_VALUES = new Set(["exact", "high", "medium", "low"]);
const KNOWN_KIND_VALUES = new Set(["package", "repository"]);
const KNOWN_KIND_VALUES = new Set(["package", "repository", "site"]);

function formatCandidate(
target: ResolveTargetReference,
Expand Down