refactor: optimize issue and PR fetching by using parallel execution

- Updated the list-issues and list-prs handlers to fetch open and closed issues, as well as open and merged PRs in parallel, improving performance.
- Removed the redundant 'issues' and 'prs' properties from the result interfaces to streamline the response structure.
- Added 'skipTests' flag in integration tests to indicate tests that should be skipped, enhancing test management.
This commit is contained in:
Test User
2025-12-22 13:13:47 -05:00
parent 0c508ce130
commit edef4c7cee
3 changed files with 43 additions and 37 deletions

View File

@@ -28,7 +28,6 @@ export interface GitHubIssue {
export interface ListIssuesResult {
success: boolean;
issues?: GitHubIssue[];
openIssues?: GitHubIssue[];
closedIssues?: GitHubIssue[];
error?: string;
@@ -54,23 +53,26 @@ export function createListIssuesHandler() {
return;
}
// Fetch open issues
const { stdout: openStdout } = await execAsync(
'gh issue list --state open --json number,title,state,author,createdAt,labels,url,body --limit 100',
{
cwd: projectPath,
env: execEnv,
}
);
// Fetch open and closed issues in parallel
const [openResult, closedResult] = await Promise.all([
execAsync(
'gh issue list --state open --json number,title,state,author,createdAt,labels,url,body --limit 100',
{
cwd: projectPath,
env: execEnv,
}
),
execAsync(
'gh issue list --state closed --json number,title,state,author,createdAt,labels,url,body --limit 50',
{
cwd: projectPath,
env: execEnv,
}
),
]);
// Fetch closed issues
const { stdout: closedStdout } = await execAsync(
'gh issue list --state closed --json number,title,state,author,createdAt,labels,url,body --limit 50',
{
cwd: projectPath,
env: execEnv,
}
);
const { stdout: openStdout } = openResult;
const { stdout: closedStdout } = closedResult;
const openIssues: GitHubIssue[] = JSON.parse(openStdout || '[]');
const closedIssues: GitHubIssue[] = JSON.parse(closedStdout || '[]');
@@ -79,7 +81,6 @@ export function createListIssuesHandler() {
success: true,
openIssues,
closedIssues,
issues: [...openIssues, ...closedIssues],
});
} catch (error) {
logError(error, 'List GitHub issues failed');

View File

@@ -32,7 +32,6 @@ export interface GitHubPR {
export interface ListPRsResult {
success: boolean;
prs?: GitHubPR[];
openPRs?: GitHubPR[];
mergedPRs?: GitHubPR[];
error?: string;
@@ -58,23 +57,24 @@ export function createListPRsHandler() {
return;
}
// Fetch open PRs
const { stdout: openStdout } = await execAsync(
'gh pr list --state open --json number,title,state,author,createdAt,labels,url,isDraft,headRefName,reviewDecision,mergeable,body --limit 100',
{
cwd: projectPath,
env: execEnv,
}
);
// Fetch merged PRs
const { stdout: mergedStdout } = await execAsync(
'gh pr list --state merged --json number,title,state,author,createdAt,labels,url,isDraft,headRefName,reviewDecision,mergeable,body --limit 50',
{
cwd: projectPath,
env: execEnv,
}
);
const [openResult, mergedResult] = await Promise.all([
execAsync(
'gh pr list --state open --json number,title,state,author,createdAt,labels,url,isDraft,headRefName,reviewDecision,mergeable,body --limit 100',
{
cwd: projectPath,
env: execEnv,
}
),
execAsync(
'gh pr list --state merged --json number,title,state,author,createdAt,labels,url,isDraft,headRefName,reviewDecision,mergeable,body --limit 50',
{
cwd: projectPath,
env: execEnv,
}
),
]);
const { stdout: openStdout } = openResult;
const { stdout: mergedStdout } = mergedResult;
const openPRs: GitHubPR[] = JSON.parse(openStdout || '[]');
const mergedPRs: GitHubPR[] = JSON.parse(mergedStdout || '[]');
@@ -83,7 +83,6 @@ export function createListPRsHandler() {
success: true,
openPRs,
mergedPRs,
prs: [...openPRs, ...mergedPRs],
});
} catch (error) {
logError(error, 'List GitHub PRs failed');

View File

@@ -146,6 +146,7 @@ describe('auto-mode-service.ts (integration)', () => {
category: 'test',
description: 'Test without worktree',
status: 'pending',
skipTests: true,
});
const mockProvider = {
@@ -181,6 +182,7 @@ describe('auto-mode-service.ts (integration)', () => {
category: 'ui',
description: 'Execute this feature',
status: 'pending',
skipTests: true,
});
const mockProvider = {
@@ -327,6 +329,7 @@ describe('auto-mode-service.ts (integration)', () => {
category: 'test',
description: 'Auto feature 1',
status: 'pending',
skipTests: true,
});
await createTestFeature(testRepo.path, 'auto-2', {
@@ -334,6 +337,7 @@ describe('auto-mode-service.ts (integration)', () => {
category: 'test',
description: 'Auto feature 2',
status: 'pending',
skipTests: true,
});
const mockProvider = {
@@ -520,6 +524,7 @@ describe('auto-mode-service.ts (integration)', () => {
description: 'Feature with skip planning',
status: 'pending',
planningMode: 'skip',
skipTests: true,
});
const mockProvider = {
@@ -555,6 +560,7 @@ describe('auto-mode-service.ts (integration)', () => {
status: 'pending',
planningMode: 'lite',
requirePlanApproval: false,
skipTests: true,
});
const mockProvider = {