tag

command module
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 10 Imported by: 0

README

TAG

CI codecov Go Reference Go Report Card

The scaffolding tool that keeps working after day one.

Most scaffolding tools create a project and disappear. TAG stays — generating code into your project as it grows. One binary, Jinja2 templates, built for AI coding agents.

Quick Start

Install
# macOS/Linux
curl -sSfL https://raw.githubusercontent.com/kaikenlabs/tag/main/install.sh | sh

# With Go
go install github.com/kaikenlabs/tag@latest
Scaffold a Project
# From a GitHub template
tag scaffold gh:user/go-api my-service

# From a local template
tag scaffold ./my-template
Generate Code Into It Later
cd my-service
tag generate handler UserAuth
# → creates internal/handlers/user_auth_handler.go

Why TAG

Scaffold and generate in one tool. Most scaffolding tools (Cookiecutter, Yeoman) create a project and walk away. Code generators (Plop, Hygen) only work inside existing projects. TAG does both — scaffold a complete project from a template, then keep generating code into it as your project grows.

Built for AI coding agents. TAG templates include .skills/ files that AI coding assistants understand. Your AI agent can scaffold projects, create generators, and run code generation without manual copy-paste.

Single binary, familiar syntax. One curl to install. No Python, no Node, no runtime. Templates use Jinja2 syntax you already know.

Migrate from Cookiecutter. TAG auto-detects Cookiecutter templates and converts them. Your existing templates keep working.

How It Works

Scaffolding
  1. Pick a template — local, GitHub, GitLab, Bitbucket, or any Git repo
  2. Answer interactive prompts (or pass variables on the command line)
  3. TAG renders every file, runs hooks, and outputs your project
Code Generation
  1. Run tag template init in your project
  2. Create generators in .tag/ with frontmatter — create files, append to files, or inject at markers
  3. Run tag generate <generator> <name> to add code

Features

Template sources GitHub (gh:), GitLab (gl:), Bitbucket (bb:), Git URLs, zips, local paths
Template syntax Jinja2 via Gonja — {{ vars.project_name }}, conditionals, loops (syntax guide)
Generators Create files, append to files, or inject at markers (authoring guide)
Filters Case transforms, inflections, string operations (full list)
Hooks Run commands before/after scaffolding (hooks guide)
Replay Save and reuse inputs for reproducible scaffolds
Library Install, manage, and share templates locally (lib commands)
Shell completion Bash, Zsh, Fish
Cookiecutter compat Auto-detect and convert existing templates (convert guide)
Configuration tag.template.json for variables, hooks, and metadata

Commands

Command Description
tag scaffold [template] [project] Create project from template (no args = picker)
tag generate <generator> <name> Run a generator or bundle
tag template init Initialize TAG in a project
tag template new generator <name> Create a new generator
tag template new bundle <name> Create a new bundle
tag template info <template> Show template metadata
tag template list List available generators and bundles
tag template variables Audit variables across templates
tag template graph Visualize generator dependencies
tag lib add|list|remove|update|edit Manage the template library
tag convert cookiecutter <source> Convert Cookiecutter template
tag test [template-dir] Matrix-test all boolean variable combinations
tag version [--check] Print version, optionally check for updates
tag completion <shell> Output shell completion script

Documentation

Guide Description
Getting Started Installation and first steps
Tutorials Step-by-step guides with working examples
Scaffold Command Project scaffolding reference
Generate Command Code generation reference
Convert Command Cookiecutter migration
Template Authoring Creating templates and generators
Template Syntax Jinja2/Gonja syntax guide
Filter Reference Available template filters
Hooks Guide Pre and post hooks
Configuration Reference tag.template.json schema
Test Command Matrix testing for template validation
Remote References Remote template formats

For AI Coding Agents

If you're an AI agent working with a TAG template, start with .skills/SKILL.md — it has a decision tree, generator anatomy, CLI quick reference, and common pitfalls in an LLM-optimized format. Detailed reference and recipes are in .skills/reference.md and .skills/recipes.md.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
dialect
Package dialect provides canonical type-to-language mapping via dialect registries.
Package dialect provides canonical type-to-language mapping via dialect registries.
extract
Package extract provides functionality to extract generator templates from existing source files by detecting entity name occurrences and replacing them with parameterized template expressions.
Package extract provides functionality to extract generator templates from existing source files by detecting entity name occurrences and replacing them with parameterized template expressions.
library
Package library provides a persistent template library for TAG.
Package library provides a persistent template library for TAG.
lockfile
Package lockfile provides template provenance tracking via a .tag/lock.json file.
Package lockfile provides template provenance tracking via a .tag/lock.json file.
remote
Package remote provides functionality for fetching and caching templates from remote sources.
Package remote provides functionality for fetching and caching templates from remote sources.
replay
Package replay provides functionality for saving and loading scaffold input values.
Package replay provides functionality for saving and loading scaffold input values.
search
Package search provides GitHub repository search for TAG-compatible templates.
Package search provides GitHub repository search for TAG-compatible templates.
template
Package template provides a Jinja2-compatible template engine using Gonja.
Package template provides a Jinja2-compatible template engine using Gonja.
templatetest
Package templatetest provides a test runner for TAG templates.
Package templatetest provides a test runner for TAG templates.
templateupdate
Package templateupdate provides historical template rendering for template lifecycle operations (update, diff, check).
Package templateupdate provides historical template rendering for template lifecycle operations (update, diff, check).
xdg
Package xdg provides XDG Base Directory resolution for TAG.
Package xdg provides XDG Base Directory resolution for TAG.
pkg
app

Jump to

Keyboard shortcuts

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