Documentation
¶
Overview ¶
Package demo provides a simulated engine for testing TUI interactions without requiring a real git repository.
Index ¶
- func Enabled() bool
- func GetDemoTrunk() string
- func NewDemoEngine(ctx context.Context) (engine.Engine, github.GitCommandRunner, error)
- func NewDemoGitRunner() git.Runner
- type Branch
- type GitHubClient
- func (c *GitHubClient) BatchGetPRChecksStatus(ctx context.Context, branchNames []string) (github.ChecksByBranch, error)
- func (c *GitHubClient) BatchGetPRTitles(_ context.Context, prNumbers []git.PRNumber) (map[git.PRNumber]string, error)
- func (c *GitHubClient) ClosePullRequest(_ context.Context, prNumber git.PRNumber) error
- func (c *GitHubClient) CreatePRComment(_ context.Context, _ git.PRNumber, _ string) (int64, error)
- func (c *GitHubClient) CreatePullRequest(_ context.Context, opts github.CreatePROptions) (*github.PullRequestInfo, error)
- func (c *GitHubClient) DeletePRComment(_ context.Context, _ int64) error
- func (c *GitHubClient) GetAllowedMergeMethods(_ context.Context) (*github.MergeMethodSettings, error)
- func (c *GitHubClient) GetCurrentUser(_ context.Context) (string, error)
- func (c *GitHubClient) GetPRChecksStatus(ctx context.Context, branchName string) (*github.CheckStatus, error)
- func (c *GitHubClient) GetPullRequest(_ context.Context, prNumber git.PRNumber) (*github.PullRequestInfo, error)
- func (c *GitHubClient) GetPullRequestByBranch(_ context.Context, branchName string) (*github.PullRequestInfo, error)
- func (c *GitHubClient) ListPRComments(_ context.Context, _ git.PRNumber) ([]github.PRComment, error)
- func (c *GitHubClient) MergePullRequest(_ context.Context, branchName string, _ github.MergePROptions) error
- func (c *GitHubClient) Repo() github.Repo
- func (c *GitHubClient) UpdatePRComment(_ context.Context, _ int64, _ string) error
- func (c *GitHubClient) UpdatePullRequest(_ context.Context, prNumber git.PRNumber, opts github.UpdatePROptions) ([]string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enabled ¶ added in v0.30.1
func Enabled() bool
Enabled reports whether demo mode was requested via STACKIT_DEMO.
func NewDemoEngine ¶
NewDemoEngine returns an engine backed by a simulated git runner, along with that runner for the GitHub integration to use alongside it.
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 git.PRNumber
PRState git.PRState
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) (github.ChecksByBranch, error)
BatchGetPRChecksStatus returns simulated check status for multiple branches
func (*GitHubClient) BatchGetPRTitles ¶
func (c *GitHubClient) BatchGetPRTitles(_ context.Context, prNumbers []git.PRNumber) (map[git.PRNumber]string, error)
BatchGetPRTitles returns plausible fake titles for demo mode
func (*GitHubClient) ClosePullRequest ¶
ClosePullRequest simulates closing a pull request
func (*GitHubClient) CreatePRComment ¶
CreatePRComment simulates creating a PR comment
func (*GitHubClient) CreatePullRequest ¶
func (c *GitHubClient) CreatePullRequest(_ context.Context, opts github.CreatePROptions) (*github.PullRequestInfo, error)
CreatePullRequest creates a simulated pull request
func (*GitHubClient) DeletePRComment ¶
func (c *GitHubClient) DeletePRComment(_ context.Context, _ int64) error
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) 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, prNumber git.PRNumber) (*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, _ git.PRNumber) ([]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) Repo ¶ added in v0.22.0
func (c *GitHubClient) Repo() github.Repo
Repo returns the repository the client is bound to
func (*GitHubClient) UpdatePRComment ¶
UpdatePRComment simulates updating a PR comment
func (*GitHubClient) UpdatePullRequest ¶
func (c *GitHubClient) UpdatePullRequest(_ context.Context, prNumber git.PRNumber, opts github.UpdatePROptions) ([]string, error)
UpdatePullRequest simulates updating a pull request