CLI Commands Reference

Complete reference for all available GTM Toolkit command-line tools and options.

Available Commands
All implemented CLI commands in GTM Toolkit
# Core Commands
gtm-toolkit init
gtm-toolkit generate
gtm-toolkit lint
gtm-toolkit audit
# AI Commands
gtm-toolkit analyze
gtm-toolkit suggestions
gtm-toolkit fix
gtm-toolkit init
✓ Available
Initialize GTM Toolkit in your project
Usage
gtm-toolkit init [options]
Options
-f, --framework <type>
Specify framework (nextjs, nuxt, astro)
--analytics <type>
Analytics provider (ga4, posthog, both)
--skip-install
Skip npm package installation
Examples
gtm-toolkit init
gtm-toolkit init --framework nextjs
gtm-toolkit init --analytics ga4 --skip-install
gtm-toolkit generate
✓ Available
Generate SEO files (robots.txt, sitemap.xml, metadata)
Usage
gtm-toolkit generate [options]
Options
-r, --robots
Generate robots.txt
-s, --sitemap
Generate sitemap.xml
-m, --meta
Generate meta tags template
--all
Generate all file types
Examples
gtm-toolkit generate --all
gtm-toolkit generate --robots
gtm-toolkit generate --sitemap
gtm-toolkit lint
✓ Available
Validate content against SEO rules and best practices
Usage
gtm-toolkit lint [path] [options]
Options
--format <type>
Output format (console, json)
--fail-on-error
Exit with error code if issues found
Examples
gtm-toolkit lint content/blog/
gtm-toolkit lint content/ --format json > lint-results.json
gtm-toolkit lint content/ --fail-on-error
gtm-toolkit audit
✓ Available
Comprehensive content and SEO audit with scoring
Usage
gtm-toolkit audit [options]
Options
-c, --content
Audit content SEO
-t, --technical
Audit technical SEO
--all
Run all audits
Examples
gtm-toolkit audit --all
gtm-toolkit audit --content
gtm-toolkit audit --technical
Global Options
Options available for all commands
Common Flags
--help, -h
Show command help
--version, -V
Show version information
Environment Variables
CLAUDE_API_KEY
Claude AI API key for AI features
💡 Quick Tips
  • • Use gtm-toolkit <command> --help for detailed command help
  • • Set CLAUDE_API_KEY environment variable to enable AI features
  • • Redirect stdout to capture JSON output in CI pipelines (e.g., > lint.json)
Example Workflow
Common usage patterns and command combinations

1. Initial Setup

gtm-toolkit init --framework nextjs
gtm-toolkit generate --all

2. Content Optimization Workflow

# First, audit your content
gtm-toolkit audit --all
# Generate AI-powered suggestions
gtm-toolkit suggestions content/ --format json --output fix-plan.json
# Preview the fixes
gtm-toolkit fix --dry-run --plan fix-plan.json
# Apply high-confidence fixes
gtm-toolkit fix --auto --confidence high --backup --plan fix-plan.json

3. CI/CD Integration

# Lint content and fail build on errors
gtm-toolkit lint content/ --format json --fail-on-error
# Generate SEO files for deployment
gtm-toolkit generate --all