setup

package
v0.183.3 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package githubsetup implements agentdomain.GitHubSetupService for the GitHub Action CI setup flow. Every git/gh command runs through the injected CommandRunner under a 30-second timeout so a wedged subprocess cannot hang the UI.

Index

Constants

View Source
const (
	InferActionVersion          = "v0.49.2"
	CheckoutActionVersion       = "v7.0.1"
	AppTokenActionVersion       = "v3.2.0"
	UploadArtifactActionVersion = "v7.0.1"
	DefaultWorkflowModel        = "ollama_cloud/deepseek-v4-flash:preview"
)

Version pins and defaults for the generated .github/workflows/infer.yml. Bumping any of these is a one-line change picked up by both templates.

View Source
const InstallBranch = "infer/install-github-action"

InstallBranch is the fixed head branch for agent-driven workflow installs. Keeping it stable means a re-install pushes onto the same branch and updates the already-open PR instead of opening a duplicate.

View Source
const InstallSkill = "opentask"

InstallSkill is the catalog skill carrying the infer-action workflow authoring guide and its bundled examples. Mentioning it as "/<name>" in the agent prompt activates it (downloaded from the skills catalog on demand).

Variables

This section is empty.

Functions

func InstallChatPrompt added in v0.182.0

func InstallChatPrompt(repo, context string) string

InstallChatPrompt builds the install task submitted as a regular chat message - the single canonical prompt for installing the OpenTask workflow, used by the /install-opentask shortcut and (via that shortcut) the browser extension's Install tab. repo may be empty (the agent detects the current checkout's repo); context carries extra user/workflow configuration.

Types

type AgentRunFunc added in v0.182.0

type AgentRunFunc func(ctx context.Context, opts agentrunner.Options) (agentrunner.Result, error)

AgentRunFunc matches agentrunner.Run so tests can stub the LLM step.

type CommandRunner

type CommandRunner interface {
	Run(ctx context.Context, name string, args ...string) ([]byte, error)
}

CommandRunner is an injectable interface for running subprocesses. Tests supply a fake runner so no real gh/git calls are needed.

type RealRunner

type RealRunner struct{}

RealRunner shells out using exec.CommandContext.

func (*RealRunner) Run

func (r *RealRunner) Run(ctx context.Context, name string, args ...string) ([]byte, error)

Run returns stdout on success and stderr on failure, so callers that embed the bytes in an error surface the real git/gh diagnostic.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service implements agentdomain.GitHubSetupService.

func NewService

func NewService(runner CommandRunner) *Service

NewService creates a new Service with the given runner.

func (*Service) CheckOrgSecretsExist

func (s *Service) CheckOrgSecretsExist(orgName string) (bool, error)

CheckOrgSecretsExist checks whether INFER_APP_ID and INFER_APP_PRIVATE_KEY secrets exist for the given org.

func (*Service) GenerateGithubActionWorkflowContent

func (s *Service) GenerateGithubActionWorkflowContent() string

GenerateGithubActionWorkflowContent generates the GitHub App-based workflow YAML content with org-level secrets.

func (*Service) GenerateStandardWorkflowContent

func (s *Service) GenerateStandardWorkflowContent() string

GenerateStandardWorkflowContent generates the standard (github-actions[bot]) workflow YAML content.

func (*Service) GetCurrentRepo

func (s *Service) GetCurrentRepo() (string, error)

GetCurrentRepo returns the current GitHub repository name with owner.

func (*Service) InstallWorkflow added in v0.182.0

func (s *Service) InstallWorkflow(ctx context.Context, opts agentdomain.InstallWorkflowOptions) (string, error)

InstallWorkflow clones the target repo, has an LLM agent create or update the infer-action workflow inside the checkout (preserving repo-specific customizations), then commits, pushes and opens - or updates - the install PR. It returns the PR URL.

func (*Service) IsOrgRepo

func (s *Service) IsOrgRepo(repo string) (bool, error)

IsOrgRepo checks whether the given repo belongs to a GitHub organization.

func (*Service) PreparePRCreation

func (s *Service) PreparePRCreation(repo, workflowPath string) (string, error)

PreparePRCreation creates a branch, commits the workflow file, pushes it, and opens a PR creation page. It returns the compare URL.

func (*Service) SetAgentRunner added in v0.182.0

func (s *Service) SetAgentRunner(run AgentRunFunc)

SetAgentRunner overrides the agent runner (tests). Nil restores the default.

func (*Service) SetOrgSecret

func (s *Service) SetOrgSecret(orgName, name, value string) error

SetOrgSecret sets a GitHub organization-level secret.

func (*Service) WriteWorkflowFile

func (s *Service) WriteWorkflowFile(path, content string) error

WriteWorkflowFile writes the workflow content to the specified path.

Jump to

Keyboard shortcuts

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