This directory contains practical examples of how to use CGE's main features.
Here's a typical workflow using CGE's three main commands:
# Generate a development plan for adding a new feature
./cge plan "Add user authentication with JWT tokens" --output auth_plan.json
# Plan a refactoring task
./cge plan "Refactor the database layer to use repository pattern" --output refactor_plan.json# Preview what changes would be made (dry run)
./cge generate --plan auth_plan.json --dry-run
# Apply changes directly to codebase
./cge generate --plan auth_plan.json --apply
# Generate changes to a separate directory for review
./cge generate --plan auth_plan.json --output-dir ./generated_changes
# Process only specific tasks
./cge generate --plan auth_plan.json --task "authentication" --dry-run# Review the current codebase
./cge review
# Review with automatic fixes
./cge review --auto-fix --max-cycles 5
# Review specific directory with custom commands
./cge review ./src --test-cmd "npm test" --lint-cmd "eslint ."# 1. Plan the feature
./cge plan "Add REST API endpoint for user profile management with CRUD operations" --output profile_api_plan.json
# 2. Review the plan (check the generated JSON)
cat profile_api_plan.json
# 3. Generate the code (dry run first)
./cge generate --plan profile_api_plan.json --dry-run
# 4. Apply the changes
./cge generate --plan profile_api_plan.json --apply
# 5. Review and validate
./cge review --auto-fix# 1. Plan the refactoring
./cge plan "Refactor the monolithic service into microservices architecture" --output microservices_plan.json
# 2. Generate changes incrementally
./cge generate --plan microservices_plan.json --task "user-service" --output-dir ./user_service_changes
./cge generate --plan microservices_plan.json --task "auth-service" --output-dir ./auth_service_changes
# 3. Review each service separately
./cge review ./user_service_changes --test-cmd "go test ./user-service/..."
./cge review ./auth_service_changes --test-cmd "go test ./auth-service/..."# 1. Plan the bug fix
./cge plan "Fix memory leak in the connection pool manager" --output bugfix_plan.json
# 2. Apply the fix
./cge generate --plan bugfix_plan.json --apply
# 3. Validate the fix
./cge review --auto-fix --max-cycles 3- Always start with a dry run: Use
--dry-runto preview changes before applying them - Use descriptive plan names: Clear descriptions help the LLM generate better plans
- Review incrementally: For large changes, process tasks one at a time
- Configure your tools: Set up proper test and lint commands in
codex.toml - Version control: Commit your changes before running CGE commands
- Iterative approach: Use the review command to continuously improve code quality
[commands.review]
test_command = "go test ./..."
lint_command = "golangci-lint run"
max_cycles = 3[commands.review]
test_command = "npm test"
lint_command = "eslint . && prettier --check ."
max_cycles = 5[commands.review]
test_command = "python -m pytest"
lint_command = "flake8 . && black --check ."
max_cycles = 4