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

task

package
v0.7.218 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigExists

func ConfigExists(rootDir string) bool

ConfigExists checks whether .chunk/run.json exists at the given root directory.

func GetDefinitionByNameOrID

func GetDefinitionByNameOrID(cfg *RunConfig, nameOrID string) (string, *string, string, error)

GetDefinitionByNameOrID looks up a definition by name first, then checks if the input is a raw UUID. Returns the definition ID, the chunk environment ID, and the default branch.

func IsValidUUID

func IsValidUUID(s string) bool

IsValidUUID checks if a string is a valid UUID format.

func MapVcsTypeToOrgType

func MapVcsTypeToOrgType(vcsType string) string

MapVcsTypeToOrgType maps a VCS type string to the org type used in run config. "github" and "gh" map to "github"; everything else maps to "circleci".

func SaveRunConfig

func SaveRunConfig(workDir string, cfg *RunConfig) error

SaveRunConfig writes run config to .chunk/run.json.

func TriggerRun

func TriggerRun(ctx context.Context, client *circleci.Client, cfg *RunConfig, params RunParams) (*circleci.RunResponse, error)

Types

type ProjectDetailFunc added in v0.7.28

type ProjectDetailFunc func(ctx context.Context, slug string) (*circleci.ProjectDetail, error)

ProjectDetailFunc fetches project detail by slug (e.g. "gh/org/repo").

type Prompts added in v0.7.28

type Prompts struct {
	Confirm    func(label string, defaultVal bool) (bool, error)
	SelectFrom func(label string, items []string) (int, error)
	PromptText func(label string, defaultVal string) (string, error)
	Warn       func(msg string)
}

Prompts provides the interactive UI operations needed to collect run config.

type RunConfig

type RunConfig struct {
	OrgID       string                   `json:"org_id"`
	ProjectID   string                   `json:"project_id"`
	OrgType     string                   `json:"org_type"`
	Definitions map[string]RunDefinition `json:"definitions"`
}

func CollectRunConfig added in v0.7.28

func CollectRunConfig(
	ctx context.Context,
	prompts Prompts,
	projects []circleci.FollowedProject,
	collabs []circleci.Collaboration,
	fetchDetail ProjectDetailFunc,
	envOrgID string,
) (*RunConfig, error)

CollectRunConfig drives the interactive form to build a RunConfig. It takes already-fetched projects and collaborations plus injected UI and data-fetch dependencies so the logic is testable without a TTY. envOrgID is the org ID read from the environment by the caller; pass "" to skip the mismatch check.

func LoadRunConfig

func LoadRunConfig(workDir string) (*RunConfig, error)

type RunDefinition

type RunDefinition struct {
	DefinitionID       string  `json:"definition_id"`
	Description        string  `json:"description,omitempty"`
	ChunkEnvironmentID *string `json:"chunk_environment_id"`
	DefaultBranch      string  `json:"default_branch"`
}

type RunParams

type RunParams struct {
	Definition     string
	Prompt         string
	Branch         string
	NewBranch      bool
	PipelineAsTool bool
}

Jump to

Keyboard shortcuts

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