πͺ MAGE-X
Write Once, Mage Everywhere: Modern Build Automation for Go
| CIΒ /Β CD |
QualityΒ &Β Security |
DocsΒ &Β Meta |
Community |
|
|
|
|
ποΈ Table of Contents
π§© What's Inside
MAGE-X is a comprehensive build automation toolkit that transforms how you manage Go projects. Built on the philosophy of "Write Once, Mage Everywhere," it provides modern development tools with a delightfully friendly user experience.
Perfect for managing 30+ repositories or your first Go project, MAGE-X eliminates build boilerplate and delivers consistency across your entire development workflow.
-
π― Zero-Configuration Excellence
Works out of the box with intelligent defaults. No complex setup, no YAML hellβjust add one import, and you're ready to build, test, and ship.
-
π Interactive Experience
Friendly CLI with guided wizards, auto-completion, and contextual help. Building software should be enjoyable, not a chore.
-
π Multi-Channel Releases
Stable, beta, and edge release channels with automated versioning, GitHub integration, and asset distribution.
-
π§ Recipe System
Pre-built patterns for common development scenariosβfrom fresh project setup to CI/CD pipeline configuration.
-
π‘οΈ Security-First Architecture
Input validation, secure command execution, and minimal dependencies. Built for environments where security matters.
-
π Cross-Platform Excellence
Full support for Linux, macOS, and Windows with optimized parallel execution and CPU-aware builds.
-
π€ AI Agent Ready
Machine-readable guidelines for ChatGPT, Claude, Cursor, and other AI assistants. Your AI follows the same house rules.
-
π Enterprise Features
Audit logging, compliance reporting, and team management capabilities for organizations that need governance.
π Quick Wins
- One-Command Setup: From zero to a production-ready build system in under 30 seconds
- Intelligent Defaults: No configuration required, but infinitely customizable when you need it
- Multi-Project Management: Manage 30+ repositories with consistent tooling and workflows
- Interactive Wizards: Guided setup for new projects, releases, and complex operations
- Recipe Library: Common patterns and best practices built right in
Tip: Run mage interactive after installation to explore features with the guided wizard.
β‘ Quick Start
1. Install MAGE-X
# Install Mage (if not already installed)
go install github.com/magefile/mage@latest
# Add MAGE-X to your project
go get github.com/mrz1836/go-mage
2. Create Your Magefile
//go:build mage
package main
import (
// Import all MAGE-X tasks
_ "github.com/mrz1836/go-mage/pkg/mage"
)
// Default task - just run `mage`
var Default = func() error {
return Build{}.Default()
}
3. Start Building
# Interactive mode (recommended for first use)
mage interactive
# Or dive right in
mage build # Build your project
mage testDefault # Run tests with linting
mage releaseDefault # Create a release
4. Advanced Setup (Optional)
# Interactive project initialization
mage initCLI --name=myapp --module=github.com/user/myapp
# Create configuration file
mage yamlInit
# Explore available recipes
mage recipesList
π Features
Core Excellence
- π§ Command Execution: Secure, interface-based command execution with validation
- π Native Logging: Colored output, progress indicators, and structured logging
- π οΈ Complete Build System: All essential build, test, lint, and release tasks
- π Version Management: Automatic version detection and update infrastructure
Developer Experience
- ποΈ Project Templates: CLI, library, web API, and microservice templates
- π Multi-Channel Releases: Stable, beta, and edge release channels
- βοΈ Configuration Management: Flexible mage.yaml with smart defaults
- π¦ Asset Distribution: Automated building and distribution of release assets
Interactive Features
- π Interactive Mode: Friendly CLI with guided operations
- π§ Interactive Wizard: Step-by-step setup for complex operations
- π Help System: Comprehensive help with auto-completion
- π Recipe System: Common patterns and best practices library
Enterprise Features
- π Audit Logging: Comprehensive activity tracking and compliance reporting
- π‘οΈ Security Scanning: Vulnerability detection and security policy enforcement
- π₯ Team Management: Role-based access and team collaboration features
- π Analytics: Build metrics, performance tracking, and optimization insights
π’ Advanced Features
MAGE-X includes basic enterprise capabilities and extensibility for organizations.
Basic Enterprise Features
Available enterprise-focused functionality:
# Basic audit logging
mage auditShow
# Enterprise configuration
mage configureEnterprise
# Workflow management
mage workflowShow
Currently Available:
- Basic Audit Logging: Track build and deployment activities
- Configuration Management: Centralized project configuration
- Workflow Templates: Basic workflow definitions and execution
- Integration Framework: Foundation for external tool integration
Note: Advanced enterprise features like comprehensive analytics, team management, and security scanning are under development. The current implementation provides a solid foundation with basic enterprise capabilities.
βοΈ Configuration
Basic Configuration
Create .mage.yaml in your project root:
project:
name: myproject
binary: myapp
version: v1.0.0
module: github.com/user/myproject
build:
output: bin
trimpath: true
platforms:
- linux/amd64
- darwin/amd64
- darwin/arm64
- windows/amd64
tags:
- prod
ldflags:
- -s -w
- -X main.version={{.Version}}
- -X main.commit={{.Commit}}
test:
parallel: true
timeout: 10m
race: false
cover: true
covermode: atomic
lint:
golangci_version: v2.3.0
timeout: 5m
tools:
golangci_lint: v2.3.0
fumpt: latest
govulncheck: latest
release:
channels:
- stable
- beta
- edge
github:
owner: mrz
repo: myproject
Environment Variable Overrides
# Build configuration
export BINARY_NAME=myapp
export GO_BUILD_TAGS=prod,feature1
export GOOS=linux
export GOARCH=amd64
# Test configuration
export VERBOSE=true
export TEST_RACE=true
export TEST_TIMEOUT=15m
# Tool configuration
export PARALLEL=8
export LINT_TIMEOUT=10m
export FUZZ_TIME=30s
export BENCH_TIME=10s
π Documentation
For comprehensive documentation, visit the docs directory:
Available Commands
MAGE-X provides a comprehensive set of commands organized by functionality. All commands are available through the mage CLI.
π¦ Build Commands
# Core Build Operations
mage build # Build for current platform (default)
mage buildDocker # Build Docker containers
mage buildClean # Clean build artifacts
mage buildGenerate # Generate code before building
# Build System Management
mage installStdlib # Install Go standard library for cross-compilation
π§ͺ Test Commands
# Test Execution
mage testDefault # Run complete test suite with linting (default)
mage testUnit # Run unit tests only (no linting)
mage testRace # Run tests with race detector
mage testCover # Run tests with coverage analysis
mage testBench # Run benchmark tests
mage testFuzz # Run fuzz tests
mage testIntegration # Run integration tests
π Code Quality & Linting
# Linting and Code Quality
mage lintDefault # Run default linter (default)
mage lintAll # Run all linting checks
mage lintFix # Automatically fix linting issues
π Metrics & Analysis
# Code Analysis
mage metricsLOC # Analyze lines of code
mage metricsCoverage # Generate coverage reports
mage metricsComplexity # Analyze code complexity
π¦ Dependency Management
# Dependency Operations
mage depsUpdate # Update all dependencies (equivalent to "make update")
mage depsTidy # Clean up go.mod and go.sum
mage depsDownload # Download all dependencies
mage depsOutdated # Show outdated dependencies
mage depsAudit # Audit dependencies for vulnerabilities
# Tool Management
mage toolsUpdate # Update all development tools
mage toolsInstall # Install all required development tools
mage toolsCheck # Check if all required tools are available
mage installTools # Install development tools
mage installBinary # Install the project binary
mage uninstall # Remove installed binary
π Module Management
# Go Module Operations
mage modUpdate # Update go.mod file
mage modTidy # Tidy the go.mod file
mage modVerify # Verify module checksums
mage modDownload # Download modules
π Documentation
# Documentation Generation
mage docsGenerate # Generate documentation
mage docsServe # Serve documentation locally
mage docsBuild # Build static documentation
mage docsCheck # Validate documentation
π Git Operations
# Git Workflow
mage gitStatus # Show git repository status
mage gitCommit # Commit changes (interactive)
mage gitTag # Create and push a new tag
mage gitPush # Push changes to remote
π·οΈ Version Management
# Version Control
mage versionShow # Display current version information
mage versionBump # Bump the version (interactive)
mage versionCheck # Check version information
π Release Management
# Release Operations
mage releaseDefault # Create a new release (default)
mage releaseDefault # Create default release
π― Default Targets
# Quick Access Commands
mage # Run default build
mage build # Same as above
mage testDefault # Run complete test suite
mage lintDefault # Run linter
π Command Discovery
Discover available commands using these built-in help features:
# List all available targets
mage -l
# Get help for a specific command (if available)
mage -h <command>
# Show mage version and build info
mage -version
Recipe System
MAGE-X includes a comprehensive recipe system for common development patterns:
# List all available recipes
mage recipesList
# Show recipe details
mage recipesShow fresh-start
# Run a recipe
RECIPE=fresh-start mage recipesRun
# Search for recipes
TERM=docker mage recipesSearch
Available Recipes:
fresh-start - Clean project setup with best practices
ci-setup - GitHub Actions CI/CD configuration
docker-setup - Docker and containerization setup
security-hardening - Security best practices implementation
performance-optimization - Performance tuning and optimization
documentation-boost - Documentation generation and maintenance
π§ͺ Examples & Tests
All examples and tests run via GitHub Actions using Go 1.24+. View the examples directory for complete project demonstrations.
Run Tests
# Quick test suite
mage testDefault
# Comprehensive testing
mage testRace testCover testFuzz
# Performance benchmarks
mage testBench
Example Projects
β‘ Benchmarks
Performance benchmarks for core MAGE-X operations:
| Operation |
Time |
Memory |
Notes |
| Build Detection |
1.2ms |
256KB |
Project type and configuration |
| Command Execution |
0.8ms |
128KB |
Secure command validation |
| Configuration Loading |
2.1ms |
512KB |
YAML parsing and validation |
| Recipe Processing |
3.5ms |
1MB |
Template expansion and validation |
Benchmarks run on Apple M1 Pro (ARM64) with Go 1.24+
All operations show consistent sub-5ms performance with minimal memory allocation
π οΈ Code Standards
MAGE-X follows strict coding standards and best practices:
- Code Quality: 100% test coverage, comprehensive linting, and security scanning
- Go Best Practices: Idiomatic Go code following community standards
- Security First: Input validation, secure command execution, minimal dependencies
- Documentation: Comprehensive godoc coverage and usage examples
- AI Compliance: Machine-readable guidelines for AI assistants
Read more about our code standards and contribution guidelines.
π€ AI Compliance
MAGE-X includes comprehensive AI assistant guidelines:
- AGENTS.md β Complete rules for coding style, workflows, and best practices
- CLAUDE.md β Guidelines for AI assistant integration
- .cursorrules β Machine-readable policies for Cursor and similar tools
- sweep.yaml β Configuration for Sweep AI code review
These files ensure that AI assistants follow the same high standards as human contributors, maintaining code quality and consistency across all contributions.
π₯ Maintainers
π€ Contributing
We welcome contributions from the community! Please read our contributing guidelines and code of conduct.
How Can I Help?
All kinds of contributions are welcome! π
- β Star the project to show your support
- π Report bugs through GitHub issues
- π‘ Suggest features with detailed use cases
- π Improve documentation with examples and clarity
- π§ Submit pull requests with bug fixes or new features
- π¬ Join discussions and help other users
Quick Start for Contributors
# Clone the repository
git clone https://github.com/mrz1836/go-mage.git
cd go-mage
# Install dependencies
go mod download
# Run tests
mage testDefault
# Run linter
mage lintDefault
# Start interactive mode to explore features
mage interactive

π License

This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by the Go community
MAGE-X: Write Once, Mage Everywhere