Documentation
¶
Overview ¶
Package demo provides a simulated engine for testing TUI interactions without requiring a real git repository.
Index ¶
- func GetDemoChecksStatus(branchName string) string
- func GetDemoCurrentBranch() string
- func GetDemoPrInfo(branchName string) *engine.PrInfo
- func GetDemoTrunk() string
- func NewDemoEngine() (engine.Engine, error)
- func NewDemoGitRunner() git.Runner
- type Branch
- type GitHubClient
- func (c *GitHubClient) BatchGetPRChecksStatus(ctx context.Context, branchNames []string) (map[string]*github.CheckStatus, error)
- func (c *GitHubClient) BatchGetPRTitles(_ context.Context, _, _ string, prNumbers []int) (map[int]string, error)
- func (c *GitHubClient) ClosePullRequest(_ context.Context, _, _ string, prNumber int) error
- func (c *GitHubClient) CreatePRComment(_ context.Context, _, _ string, _ int, _ string) (int64, error)
- func (c *GitHubClient) CreatePullRequest(_ context.Context, owner, repo string, opts github.CreatePROptions) (*github.PullRequestInfo, error)
- func (c *GitHubClient) DeletePRComment(_ context.Context, _, _ string, _ int64) error
- func (c *GitHubClient) GetAllowedMergeMethods(_ context.Context) (*github.MergeMethodSettings, error)
- func (c *GitHubClient) GetCurrentUser(_ context.Context) (string, error)
- func (c *GitHubClient) GetOwnerRepo() (string, string)
- func (c *GitHubClient) GetPRChecksStatus(ctx context.Context, branchName string) (*github.CheckStatus, error)
- func (c *GitHubClient) GetPullRequest(_ context.Context, _, _ string, prNumber int) (*github.PullRequestInfo, error)
- func (c *GitHubClient) GetPullRequestByBranch(_ context.Context, _, _, branchName string) (*github.PullRequestInfo, error)
- func (c *GitHubClient) ListPRComments(_ context.Context, _, _ string, _ int) ([]github.PRComment, error)
- func (c *GitHubClient) MergePullRequest(_ context.Context, branchName string, _ github.MergePROptions) error
- func (c *GitHubClient) UpdatePRComment(_ context.Context, _, _ string, _ int64, _ string) error
- func (c *GitHubClient) UpdatePullRequest(_ context.Context, _, _ string, prNumber int, opts github.UpdatePROptions) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDemoChecksStatus ¶
GetDemoChecksStatus returns the simulated checks status for a branch
func GetDemoCurrentBranch ¶
func GetDemoCurrentBranch() string
GetDemoCurrentBranch returns the simulated current branch
func GetDemoPrInfo ¶
GetDemoPrInfo returns simulated PR info for a branch
func NewDemoEngine ¶
NewDemoEngine creates a new demo engine using the standard engine implementation but with a simulated Git runner.
func NewDemoGitRunner ¶
NewDemoGitRunner creates a new demo git runner with simulated data.
Types ¶
type Branch ¶
type Branch struct {
Name string
Parent string
SHA string
PRNumber int
PRState string // OPEN, MERGED, CLOSED
PRTitle string
IsDraft bool
Checks string // PASSING, FAILING, PENDING, NONE
Commits int
Added int
Deleted int
Scope string
}
Branch represents a simulated branch with PR info
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient implements github.Client for demo mode
func NewDemoGitHubClient ¶
func NewDemoGitHubClient() *GitHubClient
NewDemoGitHubClient creates a new demo GitHub client
func (*GitHubClient) BatchGetPRChecksStatus ¶
func (c *GitHubClient) BatchGetPRChecksStatus(ctx context.Context, branchNames []string) (map[string]*github.CheckStatus, error)
BatchGetPRChecksStatus returns simulated check status for multiple branches
func (*GitHubClient) BatchGetPRTitles ¶
func (c *GitHubClient) BatchGetPRTitles(_ context.Context, _, _ string, prNumbers []int) (map[int]string, error)
BatchGetPRTitles returns plausible fake titles for demo mode
func (*GitHubClient) ClosePullRequest ¶
ClosePullRequest simulates closing a pull request
func (*GitHubClient) CreatePRComment ¶
func (c *GitHubClient) CreatePRComment(_ context.Context, _, _ string, _ int, _ string) (int64, error)
CreatePRComment simulates creating a PR comment
func (*GitHubClient) CreatePullRequest ¶
func (c *GitHubClient) CreatePullRequest(_ context.Context, owner, repo string, opts github.CreatePROptions) (*github.PullRequestInfo, error)
CreatePullRequest creates a simulated pull request
func (*GitHubClient) DeletePRComment ¶
DeletePRComment simulates deleting a PR comment
func (*GitHubClient) GetAllowedMergeMethods ¶
func (c *GitHubClient) GetAllowedMergeMethods(_ context.Context) (*github.MergeMethodSettings, error)
GetAllowedMergeMethods returns simulated allowed merge methods
func (*GitHubClient) GetCurrentUser ¶
func (c *GitHubClient) GetCurrentUser(_ context.Context) (string, error)
GetCurrentUser returns a simulated GitHub username
func (*GitHubClient) GetOwnerRepo ¶
func (c *GitHubClient) GetOwnerRepo() (string, string)
GetOwnerRepo returns the repository owner and name
func (*GitHubClient) GetPRChecksStatus ¶
func (c *GitHubClient) GetPRChecksStatus(ctx context.Context, branchName string) (*github.CheckStatus, error)
GetPRChecksStatus returns simulated check status for a single branch
func (*GitHubClient) GetPullRequest ¶
func (c *GitHubClient) GetPullRequest(_ context.Context, _, _ string, prNumber int) (*github.PullRequestInfo, error)
GetPullRequest returns a simulated PR by number
func (*GitHubClient) GetPullRequestByBranch ¶
func (c *GitHubClient) GetPullRequestByBranch(_ context.Context, _, _, branchName string) (*github.PullRequestInfo, error)
GetPullRequestByBranch returns a simulated PR for a branch
func (*GitHubClient) ListPRComments ¶
func (c *GitHubClient) ListPRComments(_ context.Context, _, _ string, _ int) ([]github.PRComment, error)
ListPRComments simulates listing PR comments
func (*GitHubClient) MergePullRequest ¶
func (c *GitHubClient) MergePullRequest(_ context.Context, branchName string, _ github.MergePROptions) error
MergePullRequest simulates merging a pull request using the specified merge method
func (*GitHubClient) UpdatePRComment ¶
UpdatePRComment simulates updating a PR comment
func (*GitHubClient) UpdatePullRequest ¶
func (c *GitHubClient) UpdatePullRequest(_ context.Context, _, _ string, prNumber int, opts github.UpdatePROptions) ([]string, error)
UpdatePullRequest simulates updating a pull request