Skip to content

Commit 7fd9052

Browse files
authored
Merge pull request #304 from vypdev/bugfix/303-bugbot-first-message-bugs
[#303] πŸ› - Bugbot first message bugs
2 parents b985008 + 19986d9 commit 7fd9052

File tree

103 files changed

+10568
-3937
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+10568
-3937
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![GitHub Marketplace](https://img.shields.io/badge/marketplace/actions/copilot-github-with-super-powers?logo=github)](https://github.com/marketplace/actions/copilot-github-with-super-powers)
1+
[![GitHub Marketplace](https://img.shields.io/badge/Copilot-Github_with_super_powers-white)](https://github.com/marketplace/actions/copilot-github-with-super-powers)
22
[![codecov](https://codecov.io/gh/vypdev/copilot/branch/master/graph/badge.svg)](https://codecov.io/gh/vypdev/copilot)
33
![Build](https://github.com/vypdev/copilot/actions/workflows/ci_check.yml/badge.svg)
44
![License](https://img.shields.io/github/license/vypdev/copilot)

β€Žbuild/cli/index.jsβ€Ž

Lines changed: 2199 additions & 1601 deletions
Large diffs are not rendered by default.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Labels } from '../model/labels';
2+
import { SizeThresholds } from '../model/size_thresholds';
3+
export interface BranchComparisonFile {
4+
filename: string;
5+
status: string;
6+
additions: number;
7+
deletions: number;
8+
changes: number;
9+
blobUrl: string;
10+
rawUrl: string;
11+
contentsUrl: string;
12+
patch: string | undefined;
13+
}
14+
export interface BranchComparisonCommit {
15+
sha: string;
16+
message: string;
17+
author: {
18+
name: string;
19+
email: string;
20+
date: string;
21+
};
22+
date: string;
23+
}
24+
export interface BranchComparison {
25+
aheadBy: number;
26+
behindBy: number;
27+
totalCommits: number;
28+
files: BranchComparisonFile[];
29+
commits: BranchComparisonCommit[];
30+
}
31+
export interface SizeCategoryResult {
32+
size: string;
33+
githubSize: string;
34+
reason: string;
35+
}
36+
/**
37+
* Repository for comparing branches and computing size categories.
38+
* Isolated to allow unit tests with mocked Octokit and pure size logic.
39+
*/
40+
export declare class BranchCompareRepository {
41+
getChanges: (owner: string, repository: string, head: string, base: string, token: string) => Promise<BranchComparison>;
42+
getSizeCategoryAndReason: (owner: string, repository: string, head: string, base: string, sizeThresholds: SizeThresholds, labels: Labels, token: string) => Promise<SizeCategoryResult>;
43+
}
Lines changed: 12 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
import { Execution } from "../model/execution";
1+
import { Execution } from '../model/execution';
22
import { Labels } from '../model/labels';
3-
import { Result } from "../model/result";
3+
import { Result } from '../model/result';
44
import { SizeThresholds } from '../model/size_thresholds';
5+
/**
6+
* Facade for branch-related operations. Delegates to focused repositories
7+
* (GitCli, Workflow, Merge, BranchCompare) for testability.
8+
*/
59
export declare class BranchRepository {
10+
private readonly gitCliRepository;
11+
private readonly workflowRepository;
12+
private readonly mergeRepository;
13+
private readonly branchCompareRepository;
614
fetchRemoteBranches: () => Promise<void>;
715
getLatestTag: () => Promise<string | undefined>;
816
getCommitTag: (latestTag: string | undefined) => Promise<string | undefined>;
@@ -27,35 +35,6 @@ export declare class BranchRepository {
2735
getListOfBranches: (owner: string, repository: string, token: string) => Promise<string[]>;
2836
executeWorkflow: (owner: string, repository: string, branch: string, workflow: string, inputs: Record<string, unknown>, token: string) => Promise<import("@octokit/plugin-paginate-rest/dist-types/types").OctokitResponse<never, 204>>;
2937
mergeBranch: (owner: string, repository: string, head: string, base: string, timeout: number, token: string) => Promise<Result[]>;
30-
getChanges: (owner: string, repository: string, head: string, base: string, token: string) => Promise<{
31-
aheadBy: number;
32-
behindBy: number;
33-
totalCommits: number;
34-
files: {
35-
filename: string;
36-
status: "modified" | "added" | "removed" | "renamed" | "copied" | "changed" | "unchanged";
37-
additions: number;
38-
deletions: number;
39-
changes: number;
40-
blobUrl: string;
41-
rawUrl: string;
42-
contentsUrl: string;
43-
patch: string | undefined;
44-
}[];
45-
commits: {
46-
sha: string;
47-
message: string;
48-
author: {
49-
name?: string;
50-
email?: string;
51-
date?: string;
52-
};
53-
date: string;
54-
}[];
55-
}>;
56-
getSizeCategoryAndReason: (owner: string, repository: string, head: string, base: string, sizeThresholds: SizeThresholds, labels: Labels, token: string) => Promise<{
57-
size: string;
58-
githubSize: string;
59-
reason: string;
60-
}>;
38+
getChanges: (owner: string, repository: string, head: string, base: string, token: string) => Promise<import("./branch_compare_repository").BranchComparison>;
39+
getSizeCategoryAndReason: (owner: string, repository: string, head: string, base: string, sizeThresholds: SizeThresholds, labels: Labels, token: string) => Promise<import("./branch_compare_repository").SizeCategoryResult>;
6140
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Repository for Git operations executed via CLI (exec).
3+
* Isolated to allow unit tests with mocked @actions/exec and @actions/core.
4+
*/
5+
export declare class GitCliRepository {
6+
fetchRemoteBranches: () => Promise<void>;
7+
getLatestTag: () => Promise<string | undefined>;
8+
getCommitTag: (latestTag: string | undefined) => Promise<string | undefined>;
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Result } from '../model/result';
2+
/**
3+
* Repository for merging branches (via PR or direct merge).
4+
* Isolated to allow unit tests with mocked Octokit.
5+
*/
6+
export declare class MergeRepository {
7+
mergeBranch: (owner: string, repository: string, head: string, base: string, timeout: number, token: string) => Promise<Result[]>;
8+
}

β€Žbuild/cli/src/data/repository/workflow_repository.d.tsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ import { WorkflowRun } from "../model/workflow_run";
33
export declare class WorkflowRepository {
44
getWorkflows: (params: Execution) => Promise<WorkflowRun[]>;
55
getActivePreviousRuns: (params: Execution) => Promise<WorkflowRun[]>;
6+
executeWorkflow: (owner: string, repository: string, branch: string, workflow: string, inputs: Record<string, unknown>, token: string) => Promise<import("@octokit/plugin-paginate-rest/dist-types/types").OctokitResponse<never, 204>>;
67
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type AnswerIssueHelpParams = {
2+
description: string;
3+
projectContextInstruction: string;
4+
};
5+
export declare function getAnswerIssueHelpPrompt(params: AnswerIssueHelpParams): string;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export type BugbotParams = {
2+
projectContextInstruction: string;
3+
owner: string;
4+
repo: string;
5+
headBranch: string;
6+
baseBranch: string;
7+
issueNumber: string;
8+
ignoreBlock: string;
9+
previousBlock: string;
10+
};
11+
export declare function getBugbotPrompt(params: BugbotParams): string;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export type BugbotFixParams = {
2+
projectContextInstruction: string;
3+
owner: string;
4+
repo: string;
5+
headBranch: string;
6+
baseBranch: string;
7+
issueNumber: string;
8+
prNumberLine: string;
9+
findingsBlock: string;
10+
userComment: string;
11+
verifyBlock: string;
12+
};
13+
export declare function getBugbotFixPrompt(params: BugbotFixParams): string;

0 commit comments

Comments
Β (0)