X402 Automation and Tooling

By X402 Team | Last Updated: February 2026

Direct Answer

X402 automation includes Git hooks for status validation, scripts for batch creation and reporting, CI/CD pipelines for content deployment, linting tools for markdown quality, and link checkers for verification—all optional enhancements to the core file-based workflow.

Detailed Explanation

Automation Philosophy

Start Manual, Automate Pain Points

X402 is designed to work without automation:
  • Core workflow is simple file operations
  • No tooling required to get started
  • Automation adds value only when pain is clear
  • Build tools incrementally based on actual needs

When to Automate

Consider automation when:
  • Team repeats same task frequently (>5 times/week)
  • Manual process causes errors regularly
  • Quality checks are skipped due to tedium
  • Reporting takes significant time
  • Onboarding new team members is slow

Git Hooks

Pre-Commit Hook

Validates content before committing.

Purpose:

  • Catch incomplete items
  • Verify template compliance
  • Check for placeholder text
  • Enforce naming conventions

Implementation:

#!/bin/bash

.git/hooks/pre-commit

Check for placeholder text

if git diff --cached | grep -E '\[TODO\]|\[TBD\]|\[PLACEHOLDER\]'; then echo "Error: Found placeholder text. Please complete before committing." exit 1 fi

Check for unchecked quality standards in staged files

staged_md_files=$(git diff --cached --name-only --diff-filter=ACM | grep '\.md$')

for file in $staged_md_files; do if [ -f "$file" ]; then # Skip INDEX files if [[ "$file" == "INDEX.md" ]]; then continue fi

# Check if file has quality standards section if grep -q "## Quality Standards" "$file"; then # Check for unchecked boxes if grep -A 10 "## Quality Standards" "$file" | grep -q "- \[ \]"; then echo "Error: $file has unchecked quality standards" exit 1 fi fi fi done

echo "✓ Pre-commit checks passed" exit 0

Install:

chmod +x .git/hooks/pre-commit

Post-Commit Hook

Updates tracking and sends notifications.

Purpose:

  • Log batch progress
  • Notify team of completions
  • Update external systems
  • Generate change summaries

Implementation:

#!/bin/bash

.git/hooks/post-commit

Get commit message

commit_msg=$(git log -1 --pretty=%B)

Check if batch completed

if echo "$commit_msg" | grep -q "Complete batch"; then echo "🎉 Batch completed!"

# Optional: Send notification # curl -X POST https://slack.com/api/chat.postMessage \ # -H "Authorization: Bearer $SLACK_TOKEN" \ # -d "text=Batch completed: $commit_msg" fi

Log to tracking file

echo "$(date +%Y-%m-%d) - $commit_msg" >> .x402-history.log

Pre-Push Hook

Validates before pushing to remote.

Purpose:

  • Ensure INDEX.md files are updated
  • Verify no work-in-progress content
  • Check all commits have messages
  • Validate batch status consistency

Implementation:

#!/bin/bash

.git/hooks/pre-push

Check that INDEX files are staged if batch content changed

batch_dirs=$(git diff --name-only origin/main...HEAD | grep -oE 'batch-[0-9]+' | sort -u)

for batch in $batch_dirs; do # Check if INDEX.md was updated if ! git diff --name-only origin/main...HEAD | grep -q "$batch/INDEX.md"; then echo "Warning: $batch has changes but INDEX.md not updated" read -p "Continue anyway? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi done

echo "✓ Pre-push checks passed" exit 0

Batch Management Scripts

Create New Batch

Automates batch setup.

Script: scripts/new-batch.sh

#!/bin/bash

Get next batch number

last_batch=$(ls -d batch-
2>/dev/null | sort -V | tail -1 | grep -oE '[0-9]+') next_num=$((last_batch + 1)) batch_name=$(printf "batch-%03d" $next_num)

Get batch description

echo "Enter batch description:" read description

Create batch directory

mkdir -p "$batch_name"

Create INDEX.md

cat > "$batch_name/INDEX.md" <<EOF

Batch $(printf "%03d" $next_num) — $description

Status: In Progress

Content Items

  • [ ] Item 1
  • [ ] Item 2
  • [ ] Item 3

Notes

Add notes about this batch here. EOF

Update main INDEX.md

echo "- [ ] $batch_name — In Progress (0/3 titles)" >> INDEX.md

echo "✓ Created $batch_name" echo "Next steps:" echo "1. Edit $batch_name/INDEX.md to add content items" echo "2. Update main INDEX.md with accurate item count" echo "3. Start creating content"

Usage:

chmod +x scripts/new-batch.sh
./scripts/new-batch.sh

Batch Status Report

Generates current status overview.

Script: scripts/batch-report.sh

#!/bin/bash

echo "X402 Batch Status Report" echo "Generated: $(date)" echo "========================" echo

Overall stats

total_batches=$(ls -d batch- 2>/dev/null | wc -l) completed_batches=$(grep -c "\[x\]" INDEX.md || echo 0) in_progress=$((total_batches - completed_batches))

echo "Overall Statistics:" echo " Total Batches: $total_batches" echo " Completed: $completed_batches" echo " In Progress: $in_progress" echo

Per-batch details

echo "Batch Details:" for batch_dir in batch-
/; do batch_name=${batch_dir%/}

if [ -f "$batch_dir/INDEX.md" ]; then total_items=$(grep -c "^- \[" "$batch_dir/INDEX.md" || echo 0) completed_items=$(grep -c "^- \[x\]" "$batch_dir/INDEX.md" || echo 0) status=$(grep "Status:" "$batch_dir/INDEX.md" | sed 's/.Status: //')

echo " $batch_name: $completed_items/$total_items items ($status)" fi done

Usage:

./scripts/batch-report.sh

Find Unchecked Items

Quickly locate pending work.

Script: scripts/find-pending.sh

#!/bin/bash

echo "Pending Items Across All Batches:" echo "=================================" echo

for batch_dir in batch-/; do batch_name=${batch_dir%/}

if [ -f "$batch_dir/INDEX.md" ]; then unchecked=$(grep "^- \[ \]" "$batch_dir/INDEX.md")

if [ -n "$unchecked" ]; then echo "$batch_name:" echo "$unchecked" | sed 's/^/ /' echo fi fi done

Content Quality Tools

Markdown Linter

Enforces consistent markdown formatting.

Tool: markdownlint

# Install
npm install -g markdownlint-cli

Create config: .markdownlint.json

{ "default": true, "MD013": false, "MD033": false, "MD041": false }

Run linter

markdownlint batch-/.md

Add to pre-commit hook:

# In .git/hooks/pre-commit
markdownlint $(git diff --cached --name-only --diff-filter=ACM | grep '\.md$')

Spell Checker

Catches spelling errors.

Tool: cspell

# Install
npm install -g cspell

Create config: .cspell.json

{ "version": "0.2", "language": "en", "words": ["X402", "markdown", "workflow"], "ignorePaths": [ ".git", "node_modules" ] }

Run spell check

cspell "batch-/.md"

Link Checker

Verifies all links work.

Tool: markdown-link-check

# Install
npm install -g markdown-link-check

Check links in all markdown files

find batch- -name ".md" -exec markdown-link-check {} \;

Script: scripts/check-links.sh

#!/bin/bash

echo "Checking all markdown links..."

failed_files=()

for file in batch-/.md; do if ! markdown-link-check "$file" -q; then failed_files+=("$file") fi done

if [ ${#failed_files[@]} -eq 0 ]; then echo "✓ All links are valid" exit 0 else echo "✗ Broken links found in:" printf '%s\n' "${failed_files[@]}" exit 1 fi

CI/CD Integration

GitHub Actions Workflow

Automate quality checks on pull requests.

File: .github/workflows/quality-check.yml

name: Content Quality Check

on: pull_request: paths:

  • 'batch-*/.md'
  • 'INDEX.md'

jobs: quality-check: runs-on: ubuntu-latest

steps:

  • uses: actions/checkout@v3

  • name: Setup Node.js
uses: actions/setup-node@v3 with: node-version: '18'
  • name: Install tools
run: | npm install -g markdownlint-cli cspell markdown-link-check
  • name: Lint markdown
run: markdownlint batch-/.md
  • name: Check spelling
run: cspell "batch-/.md"
  • name: Validate links
run: | for file in batch-/.md; do markdown-link-check "$file" done
  • name: Check for placeholders
run: | if grep -r "\[TODO\]|\[TBD\]" batch-/; then echo "Found placeholder text" exit 1 fi
  • name: Verify quality standards
run: | ./scripts/check-quality-standards.sh

Deploy Static Site

Build and deploy documentation.

File: .github/workflows/deploy.yml

name: Deploy Documentation

on: push: branches:

  • main

jobs: deploy: runs-on: ubuntu-latest

steps:

  • uses: actions/checkout@v3

  • name: Setup Hugo
uses: peaceiris/actions-hugo@v2 with: hugo-version: 'latest'
  • name: Build site
run: hugo --minify
  • name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public

Reporting and Analytics

Progress Dashboard

Generate HTML dashboard.

Script: scripts/generate-dashboard.sh

#!/bin/bash

cat > dashboard.html <<'EOF' <!DOCTYPE html> <html> <head> <title>X402 Progress Dashboard</title> <style> body { font-family: sans-serif; margin: 40px; } .batch { margin: 20px 0; padding: 15px; border: 1px solid #ddd; } .complete { background: #d4edda; } .in-progress { background: #fff3cd; } .progress-bar { height: 20px; background: #e9ecef; border-radius: 4px; } .progress-fill { height: 100%; background: #28a745; border-radius: 4px; } </style> </head> <body> <h1>X402 Content Production Dashboard</h1> <p>Generated: $(date)</p> EOF

for batch_dir in batch-/; do batch_name=${batch_dir%/}

if [ -f "$batch_dir/INDEX.md" ]; then total=$(grep -c "^- \[" "$batch_dir/INDEX.md") completed=$(grep -c "^- \[x\]" "$batch_dir/INDEX.md") percent=$((completed 100 / total)) status=$(grep "Status:" "$batch_dir/INDEX.md" | sed 's/.Status: //')

class="in-progress" [ "$status" = "Complete" ] && class="complete"

cat >> dashboard.html <<EOF <div class="batch $class"> <h2>$batch_name</h2> <p>Status: $status | Progress: $completed/$total items</p> <div class="progress-bar"> <div class="progress-fill" style="width: ${percent}%"></div> </div> </div> EOF fi done

cat >> dashboard.html <<'EOF' </body> </html> EOF

echo "✓ Dashboard generated: dashboard.html"

Velocity Tracking

Track completion rate over time.

Script: scripts/velocity-report.sh

#!/bin/bash

echo "Content Velocity Report" echo "=======================" echo

Get commits per week for last 12 weeks

for i in {0..11}; do start_date=$(date -d "$((i 7)) days ago" +%Y-%m-%d) end_date=$(date -d "$(((i - 1) 7)) days ago" +%Y-%m-%d)

commits=$(git log --since="$start_date" --until="$end_date" --oneline | wc -l) items=$(git log --since="$start_date" --until="$end_date" --grep="Complete:" --oneline | wc -l)

echo "Week of $start_date: $commits commits, $items items completed" done

Text Editor Integration

VS Code Extensions

Recommended extensions for X402 work:
// .vscode/extensions.json
{
  "recommendations": [
    "yzhang.markdown-all-in-one",
    "davidanson.vscode-markdownlint",
    "streetsidesoftware.code-spell-checker",
    "bierner.markdown-preview-github-styles"
  ]
}

VS Code Tasks

Automate common operations.
// .vscode/tasks.json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Create New Batch",
      "type": "shell",
      "command": "./scripts/new-batch.sh"
    },
    {
      "label": "Batch Status Report",
      "type": "shell",
      "command": "./scripts/batch-report.sh"
    },
    {
      "label": "Check Links",
      "type": "shell",
      "command": "./scripts/check-links.sh"
    }
  ]
}

Advanced Automation

Content Templates from CLI

Generate content from templates via command line.

Script: scripts/new-content.sh

#!/bin/bash

batch=$1 title=$2

if [ -z "$batch" ] || [ -z "$title" ]; then echo "Usage: $0 <batch-name> <content-title>" exit 1 fi

Convert title to filename

filename=$(echo "$title" | tr '[:upper:]' '[:lower:]' | tr ' ' '-').md

Copy template

cp templates/blueprint-template.md "$batch/$filename"

Replace placeholder

sed -i "s/\[Content Title\]/$title/" "$batch/$filename"

echo "✓ Created $batch/$filename" echo "Don't forget to update $batch/INDEX.md"

Automatic Index Updates

Update INDEX files automatically.

Script: scripts/update-index.sh

#!/bin/bash

batch=$1

if [ -z "$batch" ]; then echo "Usage: $0 <batch-name>" exit 1 fi

Count items

total=$(grep -c "^- \[" "$batch/INDEX.md") completed=$(grep -c "^- \[x\]" "$batch/INDEX.md")

Update main INDEX.md

sed -i "s/\($batch.\)([0-9]\/[0-9] titles)/\1($completed\/$total titles)/" INDEX.md

Update batch status if all complete

if [ "$completed" -eq "$total" ]; then sed -i "s/\($batch.
\)\[ \]/\1[x]/" INDEX.md sed -i "s/Status: In Progress/Status: Complete/" "$batch/INDEX.md" fi

echo "✓ Updated index for $batch ($completed/$total)"

Tool Recommendations by Team Size

Solo Creator

  • Git hooks for quality checks
  • Basic markdown linter
  • Spell checker
  • Manual batch management

Small Team (2-5)

  • All solo tools
  • Batch status scripts
  • Link checker
  • Basic CI/CD for PR checks

Medium Team (6-15)

  • All small team tools
  • Automated reporting dashboard
  • Full CI/CD pipeline
  • Slack/Discord notifications
  • Velocity tracking

Large Team (16+)

  • All medium team tools
  • Project management integration
  • Advanced analytics
  • Custom tooling for workflows
  • Dedicated DevOps support

Related Questions

  • What is X402?
  • X402 best practices
  • X402 team collaboration
  • How to implement X402?

Quality Standards

  • [x] Meets brand voice requirements
  • [x] Follows formatting standards
  • [x] Includes all required elements
  • [x] Ready for production

Start Building with X402

Get our free X402 Implementation Starter Kit with ready-to-use templates, code examples, and best practices.

What is included:

  • Quick-start implementation templates
  • API integration examples
  • Configuration best practices guide

Get the Free Starter Kit