languages

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package languages provides a plugin architecture for supporting multiple programming language ecosystems.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrLanguageNotRegistered is returned when a language is not found in the registry.
	ErrLanguageNotRegistered = errors.New("language not registered")

	// ErrNoLanguageDetected is returned when no supported language is detected.
	ErrNoLanguageDetected = errors.New("no supported language detected")
)

Functions

func DetectLanguage

func DetectLanguage(ctx context.Context, dir string) (string, error)

DetectLanguage attempts to detect which language is present in the given directory. Returns the first language that reports a positive detection.

func DetectLanguages

func DetectLanguages(ctx context.Context, dir string) ([]string, error)

DetectLanguages returns all languages detected in the given directory. Useful for multi-language projects.

func List

func List() []string

List returns all registered language names.

func Register

func Register(lang Language)

Register adds a language implementation to the registry. This is typically called from init() functions in each language package.

Types

type Dependency

type Dependency struct {
	// Name is the primary package/module name
	Name string

	// OldName is used for module replacements (Go-specific)
	OldName string

	// Version is the target version to update to
	Version string

	// Scope is the dependency scope (Maven-specific: compile, test, runtime, etc.)
	Scope string

	// Type is the dependency type (Maven-specific: jar, pom, etc.)
	Type string

	// Replace indicates this is a replacement directive (Go-specific)
	Replace bool

	// Additional metadata can be stored here
	Metadata map[string]any
}

Dependency represents a single dependency to be updated.

type Language

type Language interface {
	// Name returns the language identifier (e.g., "maven", "go", "rust")
	Name() string

	// Detect checks if this language is present in the given directory.
	// Returns true if manifest files for this language are found.
	Detect(ctx context.Context, dir string) (bool, error)

	// Update performs the dependency update using the provided configuration.
	Update(ctx context.Context, cfg *UpdateConfig) error

	// Validate checks if the updates were applied successfully.
	// Returns an error if any dependency wasn't updated to the expected version.
	Validate(ctx context.Context, cfg *UpdateConfig) error

	// GetManifestFiles returns the list of manifest files for this language
	// (e.g., ["go.mod", "go.sum"] for Go, ["pom.xml"] for Maven)
	GetManifestFiles() []string

	// SupportsAnalysis returns true if this language supports dependency analysis.
	SupportsAnalysis() bool
}

Language defines the interface that each language ecosystem must implement. This allows omnibump to support multiple languages (Rust, Go, Maven) with a unified interface.

func Get

func Get(name string) (Language, error)

Get retrieves a language implementation by name.

type UpdateConfig

type UpdateConfig struct {
	// RootDir is the root directory of the project
	RootDir string

	// Dependencies is the list of dependencies to update
	Dependencies []Dependency

	// Properties contains property updates (for build systems that support them)
	Properties map[string]string

	// Tidy indicates whether to run the language's "tidy" command after updates
	Tidy bool

	// ShowDiff indicates whether to show a diff of changes
	ShowDiff bool

	// DryRun indicates whether to only simulate the update without making changes
	DryRun bool

	// Options contains language-specific options as a flexible map
	Options map[string]any
}

UpdateConfig contains all configuration needed to perform a dependency update.

Directories

Path Synopsis
Package golang implements omnibump support for Go projects.
Package golang implements omnibump support for Go projects.
Package java implements omnibump support for Java projects.
Package java implements omnibump support for Java projects.
gradle
Package gradle implements Gradle build tool support for Java projects.
Package gradle implements Gradle build tool support for Java projects.
maven
Package maven implements Maven build tool support for Java projects.
Package maven implements Maven build tool support for Java projects.
Package rust implements omnibump support for Rust projects.
Package rust implements omnibump support for Rust projects.

Jump to

Keyboard shortcuts

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