Skip to content

feat: Add Auggie CLI engine support#27

Merged
moazbuilds merged 173 commits intomoazbuilds:mainfrom
AlexFigures:feature/add-auggie-cli-support
Nov 20, 2025
Merged

feat: Add Auggie CLI engine support#27
moazbuilds merged 173 commits intomoazbuilds:mainfrom
AlexFigures:feature/add-auggie-cli-support

Conversation

@AlexFigures
Copy link
Copy Markdown

@AlexFigures AlexFigures commented Nov 13, 2025

🎯 Overview

This PR adds complete integration for Auggie CLI (@augmentcode/auggie) as a new engine provider in CodeMachine.

✨ Features

  • ✅ Full engine implementation with metadata, auth, execution, and telemetry modules
  • ✅ Authentication via Auggie CLI session (~/.augment/session.json)
  • ✅ JSON output format support with proper parsing
  • ✅ Workspace-root based execution
  • ✅ Immediate log file creation to prevent connection timeouts
  • ✅ Comprehensive unit tests (5 tests, all passing)
  • ✅ Updated README with Auggie CLI documentation

🔧 Technical Details

Engine Implementation

  • Uses --print --quiet --output-format json flags for automation
  • Handles Auggie's single-result JSON format: {"type":"result","result":"..."}
  • Supports model override via --model flag
  • Registered with order: 5 in engine registry
  • Compatible with all CodeMachine workflows and orchestration patterns

Files Added

src/infra/engines/providers/auggie/
├── auth.ts                    # Authentication logic
├── config.ts                  # Configuration types
├── execution/
│   ├── commands.ts           # CLI command builder
│   ├── executor.ts           # High-level executor
│   ├── index.ts              # Module exports
│   └── runner.ts             # Core execution logic
├── index.ts                   # Engine module export
├── metadata.ts                # Engine metadata
└── telemetryParser.ts         # Telemetry parsing (placeholder)

tests/unit/infra/
└── auggie-registry.spec.ts    # Unit tests

Files Modified

  • README.md - Added Auggie CLI documentation
  • src/infra/engines/core/registry.ts - Registered Auggie engine
  • src/infra/engines/index.ts - Exported Auggie module
  • src/agents/runner/runner.ts - Fixed log file creation timing

🐛 Fixes

  1. Log file creation timing - Moved log file creation to agent registration (instead of first data output) to prevent 120s timeout errors
  2. Removed unused helpers - Cleaned up unused formatToolUse and formatStepEvent functions
  3. Linting - All ESLint checks passing with zero warnings

✅ Testing

Unit Tests

npm test -- tests/unit/infra/auggie-registry.spec.ts
  • ✅ 5/5 tests passing
  • ✅ Engine registration
  • ✅ Metadata validation
  • ✅ Auth and run methods
  • ✅ Engine ordering

Integration Testing

  • ✅ Tested with real Auggie CLI
  • ✅ Works with codemachine start (workflows)
  • ✅ Works with codemachine run (direct execution)
  • ✅ Works with orchestration (parallel & sequential)
  • ✅ Log streaming works correctly
  • ✅ No timeout errors

Code Quality

npm run lint    # ✅ Passing
npm run build   # ✅ Passing
npm test        # ✅ Passing

📚 Usage Examples

Workflow Configuration

{
  "agentId": "code-generation",
  "engine": "auggie",
  "model": "claude-3-5-sonnet"
}

Agent Configuration

{
  "code-generator": {
    "engine": "auggie",
    "model": "claude-3-5-sonnet"
  }
}

CLI Usage

# Authenticate
codemachine auth login
# Select "Auggie CLI"

# Run workflow
codemachine start

# Direct execution
codemachine run "code-generator 'Create a login component'"

# Engine-specific (note: requires additional fix for engine override)
codemachine auggie run "code-generator 'test'"

🔮 Future Improvements

  1. Engine-specific CLI commands - Currently codemachine auggie run doesn't force Auggie engine (requires passing engine parameter through coordinator)
  2. Telemetry support - Auggie doesn't return token/cost data yet; placeholder parser ready for future updates
  3. Streaming support - If Auggie adds streaming in future, the parser can be extended

📝 Checklist

  • Code follows project style guidelines
  • All tests passing
  • Linting passing (zero warnings)
  • Build successful
  • Documentation updated (README)
  • Integration tested with real Auggie CLI
  • No breaking changes
  • Commit message follows conventional commits

🙏 Notes

This PR is ready for review and merge. The implementation follows the same patterns as existing engines (OpenCode, Claude, CCR) and integrates seamlessly with CodeMachine's architecture.

Tested on:

  • Node.js v23.11.0
  • npm 11.6.0
  • Auggie CLI latest version

Pull Request opened by Augment Code with guidance from the PR author

moazbuilds and others added 30 commits October 10, 2025 03:05
updating definition
…d executions

The profile parameter was redundant as the agentId is sufficient for authentication purposes. This simplifies the API surface and reduces unnecessary configuration options across all engine providers (Claude, Cursor, Codex) and their execution flows.

Fixing json codex starting bug "can't find 'git-commit' profile"
…chitecture output paths

- Split tracking functions into template.ts and steps.ts for better organization
- Add new functions for tracking not completed steps
- Update all references from .codemachine/plan/ to .codemachine/artifacts/
- Add new output format templates for architecture and plan generation
- Implement glob pattern support in placeholder resolution
implement fallback agent execution when a step is marked as incomplete
add notCompletedFallback field to workflow step types
introduce fallback execution logic before original step runs
- Add plan-fallback and task-fallback agents to handle incomplete executions
- Increase default timeout from 10 to 30 minutes across all providers
- Refactor prompt placeholder processing into modular components
- Implement structured task output with manifest files
- Add support for optional placeholders with fallback behavior
Update placeholder configuration and template files to use consistent naming for task fallback files and variables. This ensures proper file resolution and variable interpolation in the task breakdown process.
Add markdown templates for codemachine workflows, agents, output formats, and fallback agents. These templates define the structure and behavior for various components in the codemachine system including task verification, git commit workflows, and agent-specific instructions.

The templates provide consistent formatting and guidelines for:
- Workflow definitions
- Agent roles and responsibilities
- Output format specifications
- Fallback agent behavior
…uration

- Standardize agent prompt file naming and paths
- Add context manager agent to workflow
- Update task verification workflow with detailed signaling
- Consolidate output format placeholders
- Adjust workflow loop steps for new context manager
refactor(validation): update task verification to use behavior.json
docs: update agent prompts to use context and code_fallback placeholders
build: add new placeholder paths for context and code_fallback files
…tructions

- Clarify the issues detected section with more specific error details
- Improve fix instructions with concrete action steps
- Update success workflow to use task list file instead of direct JSON output
Enable resuming long workflows by starting from the last
incomplete step tracked in .codemachine/template.json when
resumeFromLastStep is true.

Add getResumeStartIndex to compute the starting index based on
notCompletedSteps. Update workflow runner to begin iteration from
the computed index and log a resume notice. Expose the helper via
shared workflows index.

This improves reliability after interruptions without breaking
existing behavior (feature disabled by default).
…ete step

- Change resume behavior to use first incomplete step instead of last
- Add default values for tracking fields in template and step functions
- Add reasoning level validation and spinner logging to step command
- Bump package version to 0.3.0
- Replace 'plan' directory with 'artifacts' in workspace initialization
- Add promptPath validation for fallback agents
- Improve tool call handling in cursor engine runner
- Update workflow templates to use cursor engine by default
- Refactor loop behavior to use behavior.json instead of triggers
- Update README with new installation instructions and features
- Convert synchronous loop handling functions to async/await pattern
- Add detailed error logging for template tracking operations
- Improve file path handling with path.join() for cross-platform compatibility
- Enhance documentation for timestamp format in tracking interfaces
- Update tests to handle async loop evaluation
- Add update-notifier package to check for updates daily
- Include dim color in chalk palette for CLI styling
- Update version from 0.1.0 to 0.3.0
- Enhance error messages with resume workflow instructions
- Add comprehensive CONTRIBUTING.md with contribution guidelines and workflow documentation
…ings

- Rename architecture agent to standard naming convention
- Streamline workflow engine configurations by removing redundant model specifications
Update README with improved formatting, updated statistics, and added comparison table
Remove docs directory from gitignore as documentation is now tracked
Update documentation templates to reflect the new plan artifacts directory path from `.codemachine/artifacts/` to `.codemachine/artifacts/plan/` for consistency
…oopTrigger

remove outdated engine authentication by removing profile-specific configuration
Remove deprecated loopTrigger from module metadata and workflow configs
- Simplify start command to run workflow queue directly in headless mode
- improve DIM and update npm notifier
- make CLI path in main menu dynamic
…tion

- Introduce trigger behavior type and evaluation logic
- Implement trigger controller and execution handling
- Add iteration-checker module with trigger capability
- Support dynamic agent triggering during workflow execution
moazbuilds and others added 22 commits November 5, 2025 19:56
Add more specific patterns to exclude from version control including cache files, logs and temporary files
Update workflow steps to use 'cursor' engine with 'grok' model for
plan-agent, task-breakdown, code-generation, runtime-prep, task-sanity-check,
and git-commit steps. Change context-manager to use 'ccr' engine.
Remove engine and fallback from plan-agent.
…ption

Proper-lockfile requires the target file to exist. Added file creation logic and changed error handling to throw instead of degrade silently to prevent data corruption from concurrent access.
Replace async file operations with sync ones during registry file creation to ensure atomicity
Add validation for empty/invalid registry files to handle edge cases
Switch engine assignments for various steps to improve consistency and reliability
   - Add loopReason field to display task progress (e.g., "Cycle 2 - Task 5/50")
   - Update task verification workflow to report progress as "Task X/Y"
   - Pass loop reason from workflow execution to UI state
   - Fix bug where loopReason was cleared during agent reset
…d rules

Expand the anchor insertion documentation with specific formatting requirements, placement rules, and workflow instructions. Add verification steps and example to ensure compliance.
- Increment index before accessing next argument in publish script for clarity
- Replace tseslint.config with defineConfig for better type safety in eslint config
Integrate OpenCode CLI as a native engine provider alongside Claude, Codex, Cursor, and CCR. This enables users to run `codemachine opencode run` and use `--engine opencode` in workflow steps.

Key features:
- JSON event streaming with consistent log markers
- Non-interactive execution via environment guardrails (OPENCODE_PERMISSION, OPENCODE_DISABLE_LSP_DOWNLOAD)
- Registry-based provider pattern matching existing engines
- Comprehensive documentation updates across README, CLI reference, and workflow guides

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Refactor auth system to use XDG-compliant paths under OPENCODE_HOME
- Add support for multiple authentication providers in OpenCode CLI
- Improve user guidance during auth flow with interactive prompts
- Centralize all OpenCode data under ~/.codemachine/opencode
- Update README to credit contributor for OpenCode integration
Add process group killing for Unix systems to handle Node.js wrapper scripts
Improve logging and error handling for process termination
Handle race conditions between abort signals and process events
feat: add OpenCode CLI as first-class engine integration
Move telemetry parsing logic into dedicated provider modules for better maintainability
Improve telemetry capture by handling provider-specific formats consistently
Ensure environment variables from process.env are included when resolving runner environment to prevent missing variables
Update CCR engine name to 'Claude Code Router' and Claude engine name to 'Claude Code' to better reflect their purpose and functionality
Remove special logout handling for CCR in CLI command
Replace .credentials.json with simple .enable marker file
Update related auth functions to reflect new simpler approach
- Replace 'any' with 'unknown' and add proper type guards
- Update eslint config to use tseslint.config
- Rename CCR engine display name to 'Claude Code Router'
Add complete integration for Auggie CLI (@augmentcode/auggie) as a new engine provider.

Features:
- Full engine implementation with metadata, auth, execution, and telemetry modules
- Authentication via Auggie CLI session (~/.augment/session.json)
- JSON output format support with proper parsing
- Workspace-root based execution
- Immediate log file creation to prevent connection timeouts
- Comprehensive unit tests (5 tests, all passing)
- Updated README with Auggie CLI documentation

Technical Details:
- Uses --print --quiet --output-format json flags for automation
- Handles Auggie's single-result JSON format: {"type":"result","result":"..."}
- Supports model override via --model flag
- Registered with order: 5 in engine registry
- Compatible with all CodeMachine workflows and orchestration patterns

Fixes:
- Log file creation moved to agent registration to prevent 120s timeout
- Removed unused helper functions from runner
- All linting and tests passing

Testing:
- Unit tests: 5/5 passing
- Integration tested with real Auggie CLI
- Works with workflows, direct execution, and orchestration
@moazbuilds moazbuilds self-requested a review November 13, 2025 19:58
@moazbuilds
Copy link
Copy Markdown
Owner

Thank you for the contribution, great work!
I'm still reviewing it, but I wanted to ask about the specific issue you encountered that required adding this part:

// Create log file immediately to prevent "Can't connect to agent" errors
// This ensures the log file exists before the engine starts producing output
loggerService.write(monitoringAgentId, ''); // Empty write to create the file

The system is supposed to wait up to 120 seconds to connect to the agent, which is a long time. So if it's still throwing a "Can't connect to agent" error after 120 seconds, understanding the root cause is important. Could you clarify what type of error you were facing that made this workaround necessary?

@moazbuilds moazbuilds added the Engine Support Integrate new AI engines (e.g., Codex, OpenCode) label Nov 18, 2025
moazbuilds added a commit that referenced this pull request Nov 20, 2025
Added Auggie CLI as a new engine provider with full integration.

Changes include:
   - New Auggie engine provider implementation
   - Updated engine registry and index
   - Added tests for Auggie registry

Co-authored-by: AlexFigures
@moazbuilds moazbuilds merged commit 1681aa2 into moazbuilds:main Nov 20, 2025
developerisnow pushed a commit to developerisnow/CodeMachine-CLI that referenced this pull request Jan 4, 2026
Added Auggie CLI as a new engine provider with full integration.

Changes include:
   - New Auggie engine provider implementation
   - Updated engine registry and index
   - Added tests for Auggie registry

Co-authored-by: AlexFigures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Support Integrate new AI engines (e.g., Codex, OpenCode)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants