Skip to main content
The BackAnt CLI is the ant command. It scaffolds Flask projects, adds routes and subroutes, and outputs machine-readable JSON for MCP and CI integrations.

Installation

pip install backant-cli
Verify:
ant --help

Command structure

ant [--report] generate <subcommand> [args] [options]
SubcommandDescription
ant generate apiScaffold a new Flask API project
ant generate routeAdd a route to an existing project
ant generate subrouteAdd a subroute to an existing route

Global flags

--report

Suppresses all human-readable output and prints a single JSON object to stdout. Designed for machine consumers — MCP servers, CI pipelines, and scripts.
ant --report generate api shop --json api-spec.json
Output:
{
  "status": "success",
  "project_path": "/home/user/shop",
  "files": [
    "/home/user/shop/api/routes/users_route.py",
    "/home/user/shop/api/services/users_service.py"
  ],
  "errors": []
}
On failure:
{
  "status": "error",
  "project_path": null,
  "files": [],
  "errors": ["Error: Invalid route name 'my-route' (must be a valid Python identifier)."]
}

--help

Available on every command and subcommand:
ant --help
ant generate --help
ant generate api --help
ant generate route --help
ant generate subroute --help

Quick reference

# Scaffold
ant generate api <name>
ant generate api <name> --json <spec>
ant generate api <name> --json <spec> --dry-run
ant generate api <name> --json <spec> --verbose

# Add to existing project (run from project root)
ant generate route <name>
ant generate route <name> --mock '<json>'
ant generate subroute <route> <subroute>
ant generate subroute <route> <subroute> --type POST --mock '<json>'

# Machine-readable output
ant --report generate api <name> --json <spec>
ant --report generate route <name>
ant --report generate subroute <route> <subroute>