core

package
v1.0.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package core provides core CLI commands for devnet-builder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBuildCmd

func NewBuildCmd() *cobra.Command

NewBuildCmd creates the build command.

func NewCompletionCmd

func NewCompletionCmd() *cobra.Command

NewCompletionCmd creates the completion command.

func NewExportKeysCmd

func NewExportKeysCmd() *cobra.Command

NewExportKeysCmd creates the export-keys command.

func NewInitCmd

func NewInitCmd() *cobra.Command

NewInitCmd creates the init command.

func NewLogsCmd

func NewLogsCmd() *cobra.Command

NewLogsCmd creates the logs command.

func NewNetworksCmd

func NewNetworksCmd() *cobra.Command

NewNetworksCmd creates the networks command.

func NewStatusCmd

func NewStatusCmd() *cobra.Command

NewStatusCmd creates the status command.

func NewVersionCmd

func NewVersionCmd() *cobra.Command

NewVersionCmd creates the version command.

func NewVersionsCmd

func NewVersionsCmd() *cobra.Command

NewVersionsCmd creates the versions command.

func ResolveGitHubToken

func ResolveGitHubToken(fileCfg *config.FileConfig) (string, bool)

ResolveGitHubToken resolves the GitHub token from environment or config. Priority: environment variable > config file.

func RunInteractiveVersionSelection

func RunInteractiveVersionSelection(
	ctx context.Context,
	cmd *cobra.Command,
	includeNetworkSelection bool,
	network string,
) (*interactive.SelectionConfig, error)

RunInteractiveVersionSelection orchestrates the unified binary source selection flow. This function unifies the selection logic for both deploy and upgrade commands.

Parameters:

  • ctx: Context for cancellation support
  • cmd: Cobra command for accessing flags and config
  • includeNetworkSelection: true for upgrade (prompts for network), false for deploy (network from config)
  • network: Network type from config (used when includeNetworkSelection is false)

Returns:

  • *interactive.SelectionConfig: User's selections (source, version, network)
  • error: User cancellation (exit code 130), validation failure, or system error

func RunInteractiveVersionSelectionWithMode

func RunInteractiveVersionSelectionWithMode(
	ctx context.Context,
	cmd *cobra.Command,
	includeNetworkSelection bool,
	forUpgrade bool,
	network string,
	skipUpgradeName bool,
) (*interactive.SelectionConfig, error)

RunInteractiveVersionSelectionWithMode orchestrates binary source selection with explicit mode control.

Parameters:

  • ctx: Context for cancellation support
  • cmd: Cobra command for accessing flags and config
  • includeNetworkSelection: true for upgrade (prompts for network), false for deploy (network from config)
  • forUpgrade: true for upgrade command (collects only upgrade target version), false for deploy command (collects export and start versions)
  • network: Network type from config (used when includeNetworkSelection is false)
  • skipUpgradeName: true to skip upgrade name prompt (for --skip-gov mode)

Returns:

  • *interactive.SelectionConfig: User's selections (source, version, network)
  • error: User cancellation (exit code 130), validation failure, or system error

func SetupGitHubClient

func SetupGitHubClient(homeDir string, fileCfg *config.FileConfig) *github.Client

SetupGitHubClient creates a GitHub client with optional caching and token.

This function consolidates duplicate GitHub client setup logic that was previously duplicated between runDeployInteractiveSelection and runUpgradeInteractiveSelection.

Functionality:

  • Parses cache TTL from config with fallback to default
  • Creates cache manager with appropriate TTL
  • Resolves GitHub token from keychain, environment, or config file
  • Builds GitHub client with cache and optional token

Parameters:

  • homeDir: Home directory path for cache storage (e.g., ~/.devnet-builder)
  • fileCfg: Loaded file configuration (may be nil if not loaded)

Returns:

  • Configured GitHub client ready for use with interactive.Selector

Types

type InitJSONResult

type InitJSONResult struct {
	Status            string            `json:"status"`
	ProvisionState    string            `json:"provision_state"`
	ChainID           string            `json:"chain_id,omitempty"`
	Network           string            `json:"network"`
	BlockchainNetwork string            `json:"blockchain_network"`
	Validators        int               `json:"validators"`
	ConfigPaths       map[string]string `json:"config_paths,omitempty"`
	NextCommand       string            `json:"next_command"`
	Error             string            `json:"error,omitempty"`
}

InitJSONResult represents the JSON output for the init command.

type NetworkInfo

type NetworkInfo struct {
	Name        string `json:"name"`
	DisplayName string `json:"display_name"`
	Version     string `json:"version"`
	BinaryName  string `json:"binary_name"`
	Bech32      string `json:"bech32_prefix"`
	BaseDenom   string `json:"base_denom"`
	ChainID     string `json:"default_chain_id"`
	DockerImage string `json:"docker_image"`
}

NetworkInfo represents information about a registered network.

type NetworksResult

type NetworksResult struct {
	Networks []NetworkInfo `json:"networks"`
	Default  string        `json:"default"`
}

NetworksResult represents the JSON output for the networks command.

type NodeStatusResult

type NodeStatusResult struct {
	Index       int    `json:"index"`
	Status      string `json:"status"`
	BlockHeight int64  `json:"block_height"`
	PeerCount   int    `json:"peer_count"`
	CatchingUp  bool   `json:"catching_up"`
	AppVersion  string `json:"app_version,omitempty"`
	Error       string `json:"error,omitempty"`
}

NodeStatusResult represents a node status in the JSON output.

type StatusResult

type StatusResult struct {
	ChainID           string             `json:"chain_id"`
	Network           string             `json:"network"`
	BlockchainNetwork string             `json:"blockchain_network"`
	Mode              string             `json:"mode"`
	DockerImage       string             `json:"docker_image,omitempty"`
	InitialVersion    string             `json:"initial_version,omitempty"`
	CurrentVersion    string             `json:"current_version,omitempty"`
	CreatedAt         time.Time          `json:"created_at"`
	Status            string             `json:"status"`
	Nodes             []NodeStatusResult `json:"nodes"`
}

StatusResult represents the JSON output for the status command.

type VersionInfo

type VersionInfo struct {
	Version       string   `json:"version"`
	GitCommit     string   `json:"git_commit"`
	BuildDate     string   `json:"build_date"`
	GoVersion     string   `json:"go_version"`
	Platform      string   `json:"platform"`
	BuildNetworks string   `json:"build_networks"`
	Networks      []string `json:"networks"` // Actual registered networks
}

VersionInfo contains version details.

Jump to

Keyboard shortcuts

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