cmd

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cmd contains the cobra command tree for gh-devlake.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute runs the root command.

Types

type ConfigureAllOpts added in v0.3.9

type ConfigureAllOpts struct {
	Token     string
	EnvFile   string
	SkipClean bool
	ReAddLoop bool // true for init wizard (re-prompt), false for configure full (one-shot)
}

ConfigureAllOpts holds parameters for the shared configureAllPhases orchestrator.

type ConnSetupResult added in v0.3.0

type ConnSetupResult struct {
	Plugin       string
	ConnectionID int
	Name         string
	Organization string
	Enterprise   string
}

ConnSetupResult holds the outcome of setting up one connection.

type ConnectionDef added in v0.3.0

type ConnectionDef struct {
	Plugin           string
	DisplayName      string
	Available        bool // false = coming soon
	Endpoint         string
	NeedsOrg         bool
	NeedsEnterprise  bool
	NeedsOrgOrEnt    bool
	SupportsTest     bool
	RateLimitPerHour int          // default rate limit; 0 = use 4500
	EnableGraphql    bool         // send enableGraphql=true in create/test payloads
	RequiredScopes   []string     // PAT scopes needed for this plugin
	ScopeHint        string       // short hint for error messages
	TokenPrompt      string       // label for masked token prompt (e.g. "GitHub PAT")
	OrgPrompt        string       // label for org prompt; empty = not prompted
	EnterprisePrompt string       // label for enterprise prompt; empty = not prompted
	EnvVarNames      []string     // environment variable names for token resolution
	EnvFileKeys      []string     // .devlake.env keys for token resolution
	ScopeFunc        ScopeHandler // nil = scope configuration not yet supported
	ScopeIDField     string       // JSON field name for the scope ID (e.g. "githubId", "id")
	HasRepoScopes    bool         // true = scopes carry a FullName that should be tracked as repos

	// Auth fields
	AuthMethod          string   // "AccessToken" (default when empty), "BasicAuth", etc.
	NeedsUsername       bool     // true for BasicAuth plugins (Jenkins, Bitbucket, Jira)
	UsernamePrompt      string   // label for username prompt (e.g. "Jenkins username")
	UsernameEnvVars     []string // environment variable names for username resolution
	UsernameEnvFileKeys []string // .devlake.env keys for username resolution
	NeedsTokenExpiry    bool     // true = apply zero-date token expiry workaround on create

	// ConnectionFlags declares plugin-specific flags for the connection add command.
	ConnectionFlags []FlagDef
	// ScopeFlags declares plugin-specific flags for the scope add command.
	ScopeFlags []FlagDef
}

ConnectionDef describes a plugin connection type and how to create it.

func AvailableConnections added in v0.3.0

func AvailableConnections() []*ConnectionDef

AvailableConnections returns only available (non-coming-soon) connection defs.

func FindConnectionDef added in v0.3.0

func FindConnectionDef(plugin string) *ConnectionDef

FindConnectionDef returns the def for the given plugin slug, or nil.

func (*ConnectionDef) BuildCreateRequest added in v0.3.0

func (d *ConnectionDef) BuildCreateRequest(name string, params ConnectionParams) *devlake.ConnectionCreateRequest

BuildCreateRequest constructs the API payload for creating this connection.

func (*ConnectionDef) BuildTestRequest added in v0.3.0

func (d *ConnectionDef) BuildTestRequest(name string, params ConnectionParams) *devlake.ConnectionTestRequest

BuildTestRequest constructs the API payload for testing this connection.

func (*ConnectionDef) MenuLabel added in v0.3.0

func (d *ConnectionDef) MenuLabel() string

MenuLabel returns the label for interactive menus.

type ConnectionParams added in v0.3.0

type ConnectionParams struct {
	Token      string
	Username   string // for BasicAuth plugins (Jenkins, Bitbucket, Jira)
	Org        string
	Enterprise string
	Name       string // override default connection name
	Proxy      string // HTTP proxy URL
	Endpoint   string // override default endpoint (e.g. GitHub Enterprise Server)
}

ConnectionParams holds user-supplied values for a single connection.

type FlagDef added in v0.4.0

type FlagDef struct {
	Name        string   // flag name (e.g., "enterprise")
	Description string   // short description shown in contextual help
	Plugins     []string // populated by collection helpers; empty in registry entries
}

FlagDef describes a plugin-specific flag for documentation and runtime validation. When collected from the registry via collectAllScopeFlagDefs or collectAllConnectionFlagDefs, the Plugins field is populated automatically to indicate which plugins use the flag.

type ProjectOpts added in v0.3.7

type ProjectOpts struct {
	ProjectName string
	TimeAfter   string
	Cron        string
	SkipSync    bool
	Wait        bool
	Timeout     time.Duration
	// Pre-resolved fields set by orchestrators (full, init)
	Client    *devlake.Client
	StatePath string
	State     *devlake.State
}

ProjectOpts holds options for the project command.

type ScopeHandler added in v0.3.10

type ScopeHandler func(client *devlake.Client, connID int, org, enterprise string, opts *ScopeOpts) (*devlake.BlueprintConnection, error)

ScopeHandler is a function that configures scopes for a connection. It receives the client, connection ID, org, enterprise, and an options struct. opts may be nil when called interactively; the handler is responsible for prompting for defaults in that case. It returns the BlueprintConnection entry (for project creation) and an error.

type ScopeOpts added in v0.3.7

type ScopeOpts struct {
	Org           string
	Enterprise    string
	Plugin        string
	Repos         string
	ReposFile     string
	Jobs          string
	Projects      string
	ConnectionID  int
	ProjectName   string
	DeployPattern string
	ProdPattern   string
	IncidentLabel string
	TimeAfter     string
	Cron          string
	SkipSync      bool
	Wait          bool
	Timeout       string
}

ScopeOpts holds all options for scope and project commands, replacing the former package-level scope* variables.

Jump to

Keyboard shortcuts

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