forge

module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0

README

forge

A CLI tool that scaffolds projects from blueprints -- project templates stored in a Git-based registry. Inspired by cookiecutter, with layered defaults inheritance, managed file sync, and remote tool resolution.

Features

  • Blueprint scaffolding -- Create projects from templates with variable substitution via Go text/template
  • Layered defaults -- Inherit config files through _defaults/ directories (registry-wide, category, blueprint)
  • Managed file sync -- Keep files aligned with upstream blueprints using overwrite or three-way merge strategies
  • Registry browsing -- List, search, and inspect blueprints from Git-based registries

Installation

From source
go install github.com/donaldgifford/forge/cmd/forge@latest
From releases

Download the binary for your platform from GitHub Releases.

Build from source
git clone https://github.com/donaldgifford/forge.git
cd forge
make build
./build/bin/forge version

Quick Start

# Create a project from a blueprint
forge create go/api --set project_name=my-service --set go_module=github.com/me/my-service

# List available blueprints
forge list --registry /path/to/registry

# Search blueprints
forge search api --registry /path/to/registry

# Inspect a blueprint
forge info /path/to/blueprint.yaml

# Check for drift against the source blueprint
forge check

# Sync project files with the latest blueprint
forge sync --dry-run
forge sync

# Initialize a new blueprint registry
forge registry init my-registry --name "My Blueprints" --category go --category python

# Add a blueprint to a registry
forge registry blueprint go/grpc-service --registry-dir ./my-registry

# Update registry metadata after blueprint changes
forge registry update --registry-dir ./my-registry

# Clean cached data
forge cache clean

Commands

Command Description
forge create <blueprint> Scaffold a new project from a blueprint
forge list List available blueprints in a registry
forge search <query> Search blueprints by name, description, or tags
forge info <blueprint.yaml> Show detailed blueprint information
forge check Check project for drift against the source blueprint
forge sync Sync project files with the latest blueprint version
forge init Initialize a new blueprint
forge registry init <path> Scaffold a new blueprint registry
forge registry blueprint Scaffold a new blueprint in a registry
forge registry update Sync blueprint metadata in registry.yaml
forge cache clean Clear cached registries

Documentation

Development

Requires Go 1.25.4+ and tools managed via mise.

mise install        # Set up development tools
make check          # Quick pre-commit: lint + test
make ci             # Full CI: lint + test + build
make test-coverage  # Tests with coverage report

License

Apache-2.0

Directories

Path Synopsis
cmd
Package cmd defines the CLI commands for forge.
Package cmd defines the CLI commands for forge.
forge command
Package main is the entry point for the forge CLI.
Package main is the entry point for the forge CLI.
internal
check
Package check compares a local project against its source blueprint for drift.
Package check compares a local project against its source blueprint for drift.
config
Package config handles parsing and validation of blueprint.yaml and registry.yaml files.
Package config handles parsing and validation of blueprint.yaml and registry.yaml files.
create
Package create orchestrates the forge create workflow.
Package create orchestrates the forge create workflow.
defaults
Package defaults resolves layered _defaults/ directory inheritance for forge blueprints.
Package defaults resolves layered _defaults/ directory inheritance for forge blueprints.
getter
Package getter wraps hashicorp/go-getter for fetching registries and tool binaries.
Package getter wraps hashicorp/go-getter for fetching registries and tool binaries.
hooks
Package hooks executes lifecycle hooks for blueprint operations.
Package hooks executes lifecycle hooks for blueprint operations.
info
Package info displays detailed blueprint information.
Package info displays detailed blueprint information.
initcmd
Package initcmd implements the forge init command for scaffolding new blueprints.
Package initcmd implements the forge init command for scaffolding new blueprints.
list
Package list implements the forge list command for browsing registry blueprints.
Package list implements the forge list command for browsing registry blueprints.
lockfile
Package lockfile manages .forge-lock.yaml state tracking for scaffolded projects.
Package lockfile manages .forge-lock.yaml state tracking for scaffolded projects.
prompt
Package prompt handles interactive variable collection for forge blueprints.
Package prompt handles interactive variable collection for forge blueprints.
registry
Package registry handles blueprint resolution, registry indexing, and caching.
Package registry handles blueprint resolution, registry indexing, and caching.
registrycmd
Package registrycmd implements the forge registry init command for scaffolding new registries.
Package registrycmd implements the forge registry init command for scaffolding new registries.
search
Package search implements the forge search command for finding blueprints.
Package search implements the forge search command for finding blueprints.
sync
Package sync implements file synchronization between a local project and its source blueprint.
Package sync implements file synchronization between a local project and its source blueprint.
template
Package template provides the Go text/template rendering engine with custom functions.
Package template provides the Go text/template rendering engine with custom functions.
ui
Package ui provides consistent styled output for the forge CLI.
Package ui provides consistent styled output for the forge CLI.

Jump to

Keyboard shortcuts

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