tool

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllNames

func AllNames() []string

AllNames returns the names of all tools.

func ByCategory

func ByCategory() map[string][]Tool

ByCategory returns tools grouped by category.

func CategoryLabel

func CategoryLabel(cat string) string

CategoryLabel returns a human-readable label for a category.

func CategoryOrder

func CategoryOrder() []string

CategoryOrder returns the display order for categories. If any custom tools are present in the effective catalog, "custom" is appended to the end.

func ResolveDependencyNames

func ResolveDependencyNames(names []string) []string

ResolveDependencyNames takes a list of selected tool names and returns the full list including any transitive dependencies, in dependency order.

func Valid

func Valid(name string) bool

Valid returns true if the tool name is in the catalog.

Types

type ResolvedTool

type ResolvedTool struct {
	Tool
	Tag         string
	DockerLines []string
}

ResolvedTool is a tool with its resolved tag and rendered Docker instructions.

func Resolve

func Resolve(selections []ToolSelection) ([]ResolvedTool, error)

Resolve takes a list of tool selections, resolves dependencies, and returns the full ordered list of tools with their Docker instructions.

func (ResolvedTool) ImageRef

func (rt ResolvedTool) ImageRef() string

ImageRef returns the full image:tag reference for COPY --from.

func (ResolvedTool) Version

func (rt ResolvedTool) Version() string

Version returns Tag with TagSuffix stripped (e.g. "3.13-slim" → "3.13"). Use this in Instructions via `{{.Version}}` when you need the version alone.

type Tool

type Tool struct {
	Name         string            `json:"name"`                    // unique identifier, e.g. "python"
	Category     string            `json:"category,omitempty"`      // "runtime", "package-manager", "cloud", "custom"
	Description  string            `json:"description,omitempty"`   // shown in TUI
	SourceImage  string            `json:"source_image,omitempty"`  // Docker image to COPY from, e.g. "public.ecr.aws/docker/library/python"
	DefaultTag   string            `json:"default_tag,omitempty"`   // e.g. "3.13-slim"
	TagSuffix    string            `json:"tag_suffix,omitempty"`    // image variant suffix, e.g. "-slim", appended to user-provided version
	Instructions []string          `json:"instructions"`            // Dockerfile lines (COPY, RUN, ENV)
	Dependencies []string          `json:"dependencies,omitempty"`  // other tool names auto-included
	PathEntries  []string          `json:"path_entries,omitempty"`  // paths to prepend to PATH in final stage
	EnvVars      map[string]string `json:"env_vars,omitempty"`      // env vars for the final stage
	UpdateSource UpdateSource      `json:"update_source,omitempty"` // registry to query; "" = skip
	UpdateRef    string            `json:"update_ref,omitempty"`    // "owner/repo", npm pkg, pypi project
}

Tool represents a bundled dev tool that can be installed in the container.

JSON tags allow Tool entries to be loaded from ~/.ccodolo/custom-tools.json. The Category field is parsed but always overwritten to "custom" for any tool loaded from that file.

func All

func All() []Tool

All returns all tools in the catalog (built-in plus any custom tools loaded from ~/.ccodolo/custom-tools.json).

func AutoUpdatable added in v0.5.0

func AutoUpdatable() []Tool

AutoUpdatable returns built-in tools that have an UpdateSource declared, meaning their version can be checked and bumped automatically. It always operates on builtinCatalog (never the effective catalog) so that a developer's local custom-tools.json cannot influence automated updates.

func Get

func Get(name string) (Tool, error)

Get returns a tool by name, or an error if not found.

func VersionPinnable

func VersionPinnable() []Tool

VersionPinnable returns tools from the catalog that have a DefaultTag (meaning their version can be meaningfully overridden, either via a multi-stage `COPY --from` image tag or via `{{.Tag}}` / `{{.Version}}` templated into a RUN command).

func (Tool) BuildTag

func (t Tool) BuildTag(version string) string

BuildTag constructs the full image tag from a user-provided version, appending TagSuffix if set and not already present.

func (Tool) DefaultVersion

func (t Tool) DefaultVersion() string

DefaultVersion returns the version part of DefaultTag with the TagSuffix stripped.

type ToolSelection

type ToolSelection struct {
	Name    string
	Version string // empty = use default
}

ToolSelection represents a user's tool choice, optionally with a version override.

type UpdateSource added in v0.5.0

type UpdateSource string

UpdateSource identifies the upstream registry the automated updater queries for new versions. Empty means the tool is excluded from auto-updates.

const (
	UpdateDockerHub UpdateSource = "docker-hub"      // hub.docker.com
	UpdateGitHub    UpdateSource = "github-releases" // api.github.com releases
	UpdateNPM       UpdateSource = "npm"             // registry.npmjs.org
	UpdatePyPI      UpdateSource = "pypi"            // pypi.org
	UpdateQuay      UpdateSource = "quay"            // quay.io
)

Jump to

Keyboard shortcuts

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