Skip to content

Conversation

@Angelmmiguel
Copy link
Contributor

@Angelmmiguel Angelmmiguel commented Aug 18, 2025

Summary

Refactored AI agents and prompts system to improve maintainability and consistency across the CLI.

Closes #76 . Closes #67

Changes

New Agent Architecture

  • Created unified AIAgentTool interface in src/lib/agents/
  • Consolidated Claude and Gemini implementations with consistent error handling
  • Added proper error types: MissingAIAgentError and InvokeAIAgentError

Centralized Prompts

  • Moved all prompt logic to PromptBuilder class in src/lib/prompt.ts
  • Eliminated duplicate prompts between Claude and Gemini implementations

JSON Parsing Utility

  • Created robust parser in src/utils/json-parser.ts
  • Handles various AI response formats (with/without markdown blocks)
  • Comprehensive error handling with detailed messages

Updated Commands

  • task.ts, iterate.ts, merge.ts now use the new agent system
  • Replaced AIProvider interface with AIAgentTool
  • Updated type definitions from TaskExpansion to IPromptTask

No breaking changes - all public APIs remain the same.

@Angelmmiguel Angelmmiguel requested a review from ereslibre August 18, 2025 10:36
@Angelmmiguel Angelmmiguel self-assigned this Aug 18, 2025
@Angelmmiguel Angelmmiguel added this to the beta milestone Aug 18, 2025
@ereslibre
Copy link
Collaborator

This one closes #67 too, right?

@Angelmmiguel
Copy link
Contributor Author

This one closes #67 too, right?

Good point. I applied a patch to fix this one 😄

@Angelmmiguel Angelmmiguel merged commit 999b873 into main Aug 19, 2025
3 checks passed
@Angelmmiguel Angelmmiguel deleted the 76/ai-agent-tools branch September 11, 2025 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor AI CLI agents into formal interface and classes Fix Gemini CLI JSON parsing errors when expanding tasks

3 participants