The Bugninja CLI provides a comprehensive interface for managing browser automation projects with built-in project validation and initialization.
Before using any Bugninja commands, you need to initialize a project:
# Initialize a new project
bugninja init my-automation-project
# Initialize with custom directory paths
bugninja init my-project \
--screenshots-dir ./captures \
--tasks-dir ./test-tasks \
--traversals-dir ./sessions
# Note: Cannot overwrite existing projects - delete files firstAfter initialization, your project will have this structure:
my-automation-project/
├── bugninja.toml # Project configuration
├── .env.example # Environment template
├── README.md # Project documentation
├── traversals/ # Recorded browser sessions
├── screenshots/ # Screenshots from automation
└── tasks/ # Task definitions
Initialize a new Bugninja project in the current directory.
Arguments:
<project_name>: Project name (required)
Options:
--screenshots-dir, -s <path>: Screenshots directory (default:./screenshots)--tasks-dir, -t <path>: Tasks directory (default:./tasks)--traversals-dir, -tr <path>: Traversals directory (default:./traversals)
Example:
bugninja init ecommerce-tests --screenshots-dir ./test-capturesRun browser automation tasks. Requires initialized project.
Arguments:
<task>: Task name or ID to run (required)
Options:
--enable-logging: Enable Bugninja logging--info: Show project information before running
Examples:
# Run specific task
bugninja run login-test
# Run with logging enabled
bugninja run login-test --enable-logging
# Show project info and run
bugninja run login-test --infoReplay recorded browser sessions. Requires initialized project.
Arguments:
[task_name]: Task name to replay latest traversal for (optional)
Options:
--traversal, -tr <id>: Replay specific traversal by ID--healing: Enable healing during replay--info: Show project information before replaying
Examples:
# Replay latest traversal for a task
bugninja replay login-test
# Replay with healing enabled
bugninja replay login-test --healing
# Replay specific traversal by ID
bugninja replay --traversal session-123
# Show project info before replaying
bugninja replay login-test --infoShow statistics about automation runs. Requires initialized project.
Options:
--info: Show project information
Examples:
# Show task statistics
bugninja stats
# Show project info
bugninja stats --infoAll commands (except init) require a properly initialized Bugninja project. The CLI will:
- Check for
bugninja.tomlin current or parent directories - Validate project structure and configuration
- Show helpful error messages if project is not found or invalid
Project Not Found:
❌ Not in a Bugninja project.
To initialize a new project, run:
bugninja init <project-name>
Or navigate to an existing Bugninja project directory.
Invalid Project Structure:
❌ Invalid Bugninja project structure in /path/to/project
The project may be corrupted or incomplete.
Delete the project files and reinitialize with:
bugninja init <project-name>
The CLI uses Rich for beautiful, informative output:
- Color-coded messages (green for success, red for errors, blue for info)
- Progress indicators during initialization
- Structured panels for project information
- Clear error messages with actionable guidance
The CLI automatically detects Bugninja projects by:
- Searching current directory for
bugninja.toml - Searching parent directories if not found in current directory
- Validating TOML structure and required fields
- Checking directory permissions and structure
This means you can run commands from any subdirectory within a Bugninja project.
The initialization creates a bugninja.toml file with:
[project]
name = "your-project-name"
[llm]
model = "gpt-4.1"
temperature=0.0
[logging]
level = "INFO"
[paths]
traversals_dir = "./traversals"
screenshots_dir = "./screenshots"
tasks_dir = "./tasks"
# ... other configuration sectionsCopy .env.example to .env and add your API keys:
# Required for LLM functionality
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_KEY=your-api-key-here-
"Not in a Bugninja project"
- Run
bugninja init <project-name>to create a project - Navigate to an existing Bugninja project directory
- Run
-
"Invalid project structure"
- The project may be corrupted
- Delete project files and reinitialize with
bugninja init <project-name>
-
Permission errors during initialization
- Check write permissions in the current directory
- Try running with elevated permissions if needed
-
Configuration file errors
- Ensure
bugninja.tomlis valid TOML - Check for syntax errors in the configuration file
- Ensure
- Use
--helpwith any command for detailed usage information - Check the project README for additional documentation
- Review the
bugninja.tomlconfiguration file for customization options
If you have an existing Bugninja setup:
- Backup your current configuration
- Delete existing project files (or move to different directory)
- Run
bugninja init <project-name> - Copy your existing
.envfile (don't overwrite the template) - Move your existing files to the new directory structure
- Update paths in
bugninja.tomlif needed
The CLI will preserve your existing configuration while adding the new project structure and validation.