Help us shape the future of Go! Take the 2026 Go Developer Survey

demo

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package demo provides a simulated engine for testing TUI interactions without requiring a real git repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDemoChecksStatus

func GetDemoChecksStatus(branchName string) string

GetDemoChecksStatus returns the simulated checks status for a branch

func GetDemoCurrentBranch

func GetDemoCurrentBranch() string

GetDemoCurrentBranch returns the simulated current branch

func GetDemoPrInfo

func GetDemoPrInfo(branchName string) *engine.PrInfo

GetDemoPrInfo returns simulated PR info for a branch

func GetDemoTrunk

func GetDemoTrunk() string

GetDemoTrunk returns the simulated trunk branch

func NewDemoEngine

func NewDemoEngine() (engine.Engine, error)

NewDemoEngine creates a new demo engine using the standard engine implementation but with a simulated Git runner.

func NewDemoGitRunner

func NewDemoGitRunner() git.Runner

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  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

func GetDemoBranches

func GetDemoBranches() []Branch

GetDemoBranches returns the demo branch data

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 []int) (map[int]string, error)

BatchGetPRTitles returns plausible fake titles for demo mode

func (*GitHubClient) ClosePullRequest

func (c *GitHubClient) ClosePullRequest(_ context.Context, prNumber int) error

ClosePullRequest simulates closing a pull request

func (*GitHubClient) CreatePRComment

func (c *GitHubClient) CreatePRComment(_ context.Context, _ int, _ string) (int64, error)

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 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, _ 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) Repo added in v0.22.0

func (c *GitHubClient) Repo() github.Repo

Repo returns the repository the client is bound to

func (*GitHubClient) UpdatePRComment

func (c *GitHubClient) UpdatePRComment(_ context.Context, _ int64, _ string) error

UpdatePRComment simulates updating a PR comment

func (*GitHubClient) UpdatePullRequest

func (c *GitHubClient) UpdatePullRequest(_ context.Context, prNumber int, opts github.UpdatePROptions) ([]string, error)

UpdatePullRequest simulates updating a pull request

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL