fix: Replace htmlUrl with url in gh search repos query
The gh CLI does not support 'htmlUrl' as a field name in search repos --json output. It only supports 'url'. This caused all research pipeline runs to fail silently because GitHubProvider.search() was querying for 'htmlUrl' which gh returned as undefined, leading to failed lookups. Fix: - Changed --json query parameters from 'htmlUrl' to 'url' - Updated GitHubRepoResult and GitHubIssueResult types - Updated all code references from repo.htmlUrl/issue.htmlUrl to repo.url/issue.url - Updated test mocks accordingly Fixes: DT-217, DT-218
This commit is contained in:
@@ -29,7 +29,7 @@ describe("GitHubProvider", () => {
|
||||
|
||||
it("searches repositories", async () => {
|
||||
runGhJsonAsyncMock.mockResolvedValueOnce([
|
||||
{ fullName: "org/repo", description: "desc", htmlUrl: "https://github.com/org/repo", stargazersCount: 12, language: "ts", updatedAt: "2026" },
|
||||
{ fullName: "org/repo", description: "desc", url: "https://github.com/org/repo", stargazersCount: 12, language: "ts", updatedAt: "2026" },
|
||||
]);
|
||||
const provider = new GitHubProvider();
|
||||
|
||||
@@ -41,7 +41,7 @@ describe("GitHubProvider", () => {
|
||||
|
||||
it("searches issues", async () => {
|
||||
runGhJsonAsyncMock.mockResolvedValueOnce([
|
||||
{ title: "Issue", body: "body", htmlUrl: "https://github.com/org/repo/issues/1", state: "open", labels: [{ name: "bug" }] },
|
||||
{ title: "Issue", body: "body", url: "https://github.com/org/repo/issues/1", state: "open", labels: [{ name: "bug" }] },
|
||||
]);
|
||||
|
||||
const provider = new GitHubProvider();
|
||||
@@ -52,8 +52,8 @@ describe("GitHubProvider", () => {
|
||||
|
||||
it("supports combined search", async () => {
|
||||
runGhJsonAsyncMock
|
||||
.mockResolvedValueOnce([{ fullName: "org/repo", htmlUrl: "https://github.com/org/repo" }])
|
||||
.mockResolvedValueOnce([{ title: "Issue", htmlUrl: "https://github.com/org/repo/issues/1" }]);
|
||||
.mockResolvedValueOnce([{ fullName: "org/repo", url: "https://github.com/org/repo" }])
|
||||
.mockResolvedValueOnce([{ title: "Issue", url: "https://github.com/org/repo/issues/1" }]);
|
||||
|
||||
const provider = new GitHubProvider();
|
||||
const results = await provider.search("query", {});
|
||||
|
||||
@@ -19,7 +19,7 @@ type SearchType = "repos" | "issues" | "both";
|
||||
interface GitHubRepoResult {
|
||||
fullName: string;
|
||||
description?: string;
|
||||
htmlUrl: string;
|
||||
url: string;
|
||||
stargazersCount?: number;
|
||||
language?: string;
|
||||
updatedAt?: string;
|
||||
@@ -28,7 +28,7 @@ interface GitHubRepoResult {
|
||||
interface GitHubIssueResult {
|
||||
title: string;
|
||||
body?: string;
|
||||
htmlUrl: string;
|
||||
url: string;
|
||||
state?: string;
|
||||
labels?: Array<{ name?: string }>;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export class GitHubProvider implements ResearchProvider {
|
||||
"repos",
|
||||
query,
|
||||
"--json",
|
||||
"fullName,description,htmlUrl,stargazersCount,language,updatedAt",
|
||||
"fullName,description,url,stargazersCount,language,updatedAt",
|
||||
"--limit",
|
||||
String(maxResults),
|
||||
],
|
||||
@@ -69,9 +69,9 @@ export class GitHubProvider implements ResearchProvider {
|
||||
|
||||
sources.push(
|
||||
...repos.slice(0, maxResults).map((repo, idx) => ({
|
||||
id: `github-repo-${idx}-${repo.htmlUrl}`,
|
||||
id: `github-repo-${idx}-${repo.url}`,
|
||||
type: "github" as const,
|
||||
reference: repo.htmlUrl,
|
||||
reference: repo.url,
|
||||
title: repo.fullName,
|
||||
excerpt: repo.description ?? "",
|
||||
status: "completed" as const,
|
||||
@@ -93,7 +93,7 @@ export class GitHubProvider implements ResearchProvider {
|
||||
"issues",
|
||||
query,
|
||||
"--json",
|
||||
"title,body,htmlUrl,state,labels",
|
||||
"title,body,url,state,labels",
|
||||
"--limit",
|
||||
String(maxResults),
|
||||
],
|
||||
@@ -102,9 +102,9 @@ export class GitHubProvider implements ResearchProvider {
|
||||
|
||||
sources.push(
|
||||
...issues.slice(0, maxResults).map((issue, idx) => ({
|
||||
id: `github-issue-${idx}-${issue.htmlUrl}`,
|
||||
id: `github-issue-${idx}-${issue.url}`,
|
||||
type: "github" as const,
|
||||
reference: issue.htmlUrl,
|
||||
reference: issue.url,
|
||||
title: issue.title,
|
||||
excerpt: issue.body?.slice(0, 280) ?? "",
|
||||
status: "completed" as const,
|
||||
|
||||
Reference in New Issue
Block a user