This repository was archived by the owner on Jul 30, 2026. It is now read-only.
Context v1.3.0 - CLI Support
Added
CLI Commands for AI Agents
- New feature: Complete command-line interface for AI coding agents
- Export command:
php index.php --context-export- Full export from CLI - Query commands: Interactive querying of templates, fields, and pages
- Stats command:
php index.php --context-stats- Quick site statistics - Help command:
php index.php --context-help- CLI documentation
Available CLI Commands:
Export:
php index.php --context-export # Full export (JSON + TOON)
php index.php --context-export --toon-only # TOON format only
php index.php --context-export --json-only # JSON format onlyQuery:
php index.php --context-query templates # List all templates
php index.php --context-query fields # List all fields
php index.php --context-query pages [selector] # List pages with optional selectorStats:
php index.php --context-stats # Show statisticsWhy CLI?
- AI agents (Claude Code, Cursor, Windsurf) can export context without admin access
- Query specific data instead of loading all files (saves tokens)
- Automation via cron jobs or CI/CD pipelines
- Faster than navigating admin interface
API Variable Registration
- New:
$contextAPI variable available throughout ProcessWire - Usage:
$context = wire('context');instead of$modules->get('Context') - Methods:
$context->executeExport(),$context->getContextPath()
AGENTS.md Documentation
- New file: Complete documentation for AI coding agents
- Content: CLI commands reference, workflow examples, best practices
- Location:
/site/modules/Context/AGENTS.md - Purpose: Tell Claude Code/agents to read this file for instructions
Changed
Module Autoload
- Changed:
autoloadset totrue(wasfalse) - Reason: Required for CLI command handling
- Impact: Module now loads on every request (minimal performance impact)
Technical Details
New Methods:
ready()- Handles CLI command routinghandleCLI($action, $argv)- CLI command dispatchercliExport($argv)- Export via CLI with progress indicatorscliStats()- Display site statisticscliQuery($argv)- Query templates/fields/pagescliQueryTemplates()- List all templatescliQueryFields()- List all fieldscliQueryPages($argv)- Query pages with selectorscliHelp()- Display CLI helpexportAll($aiPath)- Unified export method for CLI and admingetDirectorySize($path)- Calculate export directory sizeformatBytes($bytes)- Human-readable file sizes
Modified Methods:
init()- Now registers$contextAPI variable
Files Added:
AGENTS.md- AI agent integration guide