Skip to content

[#274] ✨ - Add CLI setup commands for initial configuration - #275

Merged
efraespada merged 59 commits into
developfrom
feature/274-add-cli-setup-commands-for-initial-configuration
Nov 16, 2025
Merged

efraespada merged 59 commits into
developfrom
feature/274-add-cli-setup-commands-for-initial-configuration

Conversation

@efraespada

@efraespada efraespada commented Nov 16, 2025 •

Copy link
Copy Markdown
Member

#274

What does this PR do?

This pull request addresses the identified issue by introducing a new CLI setup command that streamlines the configuration process for our project. The command automates the creation of necessary GitHub configurations, including the required labels and issue types that our Action needs to function effectively. It also validates repository permissions and ensures proper API connectivity.

Furthermore, the CLI setup command automates Supabase initialization by executing a predefined script that sets up the critical methods, tables, and types, as well as preparing a project cache table for enhanced AI contextual analysis.

In terms of credential management, this update requires validation of key credentials such as the GitHub Personal Access Token, organization-level fine-grained tokens, as well as the Supabase URL and API key.

The implementation of this feature significantly reduces the manual setup process, minimizing the risk of inconsistencies and errors across different repositories and environments. By simplifying the onboarding and initial configuration, it ensures a consistent setup for all projects.

No current limitations or challenges exist regarding this implementation, and it is expected to have a highly positive impact on user experience. This pull request is submitted to bring this important enhancement to the master branch.

Summary of Changes

  • .agent-sessions/session_1763235331644_8853527.json: Added a new session file to record user interactions and metrics.
  • .agent-sessions/session_1763235335017_cveqlr8.json: Added a new session JSON file containing metadata and messages.
  • .agent-sessions/session_1763236315499_je0w7pl.json: Added a new session JSON file containing metadata and message history.
  • .agent-sessions/session_1763236327442_argwhxe.json: Added session metadata and message history for user interactions.
  • .github/ISSUE_TEMPLATE/release.yml: Updated team name in release issue template.
  • .github/workflows/gbf_check_progress.yml: Added a GitHub Actions workflow for checking progress in Git Board.
  • .github/workflows/gbf_update_ai_knowledge.yml: Updated the single-action parameter for the AI knowledge update job.
  • .mcp.json: Added configuration for MCP servers.
  • .mcp.json.example: Added example configuration for MCP servers including stdio and HTTP transports.
  • action.yml: Updated default model for OpenRouter AI operations.
  • docker/Dockerfile: The Dockerfile has been removed from the project.
  • docker/main.py: Removed entire FastAPI application responsible for embedding model initialization and endpoints.
  • docker/requirements.txt: Removed requirements file for Python dependencies.
  • docs/THINK_AS_CLAUDE_USECASE.md: Added detailed documentation for the ThinkAsClaudeUseCase, outlining its architecture, execution flow, components, and error handling.
  • docs/agent-sdk-comparison.md: Added a comprehensive comparison between our Agent SDK and Claude Agent SDK detailing implemented features and differences.
  • docs/agent-sdk-missing-features.md: Added documentation detailing the missing features required to make the agent SDK equivalent to Claude's Agent SDK.
  • docs/mcp-and-subagents-examples.md: Added comprehensive examples and guidelines for implementing MCP and Subagents in the system.
  • docs/mcp-and-subagents-explanation.md: Added comprehensive documentation on the Model Context Protocol (MCP) and Subagents, outlining their functionalities, architectural changes, and usage examples.
  • docs/mcp-testing-guide.md: Added a comprehensive guide for testing MCP with CLI commands and configuration examples.
  • docs/tec-error-detector.md: Added comprehensive documentation for the TEC Error Detector, detailing its features and usage.
  • jest.config.js: Added Jest configuration file for TypeScript testing.
  • package.json: Added testing scripts and updated devDependencies to support Jest.
  • src/agent/tests/base_tool.test.ts: Added comprehensive tests for the BaseTool class, covering input validation and execution.
  • src/agent/tests/budget_manager.test.ts: Added unit tests for the BudgetManager class to validate token and cost limits.
  • src/agent/tests/context_manager.test.ts: Added comprehensive unit tests for the ContextManager class to ensure functionality.
  • src/agent/tests/context_sharing.test.ts: Added tests for ContextSharing functionality including message extraction, sharing, merging, and summarizing.
  • src/agent/tests/mcp_client.test.ts: Added comprehensive unit tests for MCPClient, covering connection, tool invocation, and disconnection functionalities.
  • src/agent/tests/mcp_manager.test.ts: Added unit tests for the MCPManager to ensure proper functionality of configuration loading and server connection.
  • src/agent/tests/message_manager.test.ts: Added comprehensive unit tests for the MessageManager class functionalities.
  • src/agent/tests/metrics_tracker.test.ts: Added unit tests for the MetricsTracker class to ensure correct functionality.
  • src/agent/tests/response_parser.test.ts: Added comprehensive unit tests for ResponseParser functionality.
  • src/agent/tests/retry_manager.test.ts: Added unit tests for the RetryManager class to validate its functionality.
  • src/agent/tests/session_manager.test.ts: Added unit tests for SessionManager functionality.
  • src/agent/tests/subagent_manager.test.ts: Added unit tests for the SubAgentManager to ensure proper functionality.
  • src/agent/tests/tool_executor.test.ts: Added comprehensive tests for ToolExecutor functionality including single and multiple tool executions.
  • src/agent/tests/tool_permissions.test.ts: Added unit tests for ToolPermissionsManager to verify access control strategies.
  • src/agent/tests/tool_registry.test.ts: Added comprehensive unit tests for the ToolRegistry class.
  • src/agent/core/agent.ts: Added the Agent class for the Agent SDK, integrating various functionalities including session management, tool registration, and MCP connections.
  • src/agent/core/budget_manager.ts: Implemented BudgetManager class for tracking and enforcing budget limits.
  • src/agent/core/context_manager.ts: Added ContextManager class for managing conversation context and compression.
  • src/agent/core/context_sharing.ts: Added new ContextSharing class for managing context sharing between agents.
  • src/agent/core/index.ts: Added an index file to export core components.
  • src/agent/core/message_manager.ts: Added MessageManager class for handling conversation messages in the Anthropic Messages API format.
  • src/agent/core/metrics_tracker.ts: Added a MetricsTracker class to monitor various performance metrics.
  • src/agent/core/reasoning_loop.ts: Introduced a new Reasoning Loop class to manage the conversation loop in the Agent SDK, integrating advanced features such as streaming, permissions, context management, metrics tracking, budget handling, and error recovery.
  • src/agent/core/retry_manager.ts: Added RetryManager class for handling retries with exponential backoff and circuit breaker logic.
  • src/agent/core/session_manager.ts: Added a comprehensive session management system to handle agent sessions with persistence.
  • src/agent/core/subagent_manager.ts: Implemented SubAgentManager for managing subagents and their coordination.
  • src/agent/core/tool_permissions.ts: Added ToolPermissionsManager class to manage tool usage permissions for the agent.
  • src/agent/index.ts: Added main exports for the Agent SDK, organizing core components, tools, types, utils, and MCP.
  • src/agent/mcp/index.ts: Added MCP module exports for improved organization and access to core components.
  • src/agent/mcp/mcp_client.ts: Implemented the MCPClient class for managing connections to Model Context Protocol servers, enabling transport configuration and communication.
  • src/agent/mcp/mcp_manager.ts: Added MCPManager class to manage MCP connections and tool registration.
  • src/agent/mcp/mcp_tool.ts: Added MCPToolWrapper class to integrate MCP tools with BaseTool interface.
  • src/agent/mcp/mcp_transport.ts: Added MCPTransport module handling communication with MCP servers via multiple transport methods.
  • src/agent/mcp/types.ts: Added type definitions for Model Context Protocol (MCP).
  • src/agent/reasoning/error_detector/tests/error_detector.test.ts: Added unit tests for the ErrorDetector class to ensure correct functionality and error detection.
  • src/agent/reasoning/error_detector/tests/error_parser.test.ts: Added unit tests for the ErrorParser class to validate error parsing functionality.
  • src/agent/reasoning/error_detector/tests/file_partitioner.test.ts: Added unit tests for the FilePartitioner class to ensure correct behavior in partitioning files by directory.
  • src/agent/reasoning/error_detector/tests/summary_generator.test.ts: Added unit tests for the SummaryGenerator class to validate summary generation functionality.
  • src/agent/reasoning/error_detector/tests/system_prompt_builder.test.ts: Added unit tests for the System Prompt Builder functionality.
  • src/agent/reasoning/error_detector/agent_initializer.ts: Implemented AgentInitializer to initialize agents with tools and repository files for error detection.
  • src/agent/reasoning/error_detector/error_detector.ts: Added a new ErrorDetector class to facilitate error detection in codebases using the Agent SDK.
  • src/agent/reasoning/error_detector/error_parser.ts: Added ErrorParser class to handle parsing errors from agent results and tool calls.
  • src/agent/reasoning/error_detector/file_partitioner.ts: Added the FilePartitioner class to handle file distribution across subagents.
  • src/agent/reasoning/error_detector/file_relationship_analyzer.ts: Added File Relationship Analyzer to analyze file dependencies and consumers.
  • src/agent/reasoning/error_detector/index.ts: Added Error Detector Module with various exports for error handling functionality.
  • src/agent/reasoning/error_detector/subagent_handler.ts: Implemented a Subagent Handler for error detection utilizing parallel processing.
  • src/agent/reasoning/error_detector/summary_generator.ts: Added a new SummaryGenerator class to generate summaries of detected errors.
  • src/agent/reasoning/error_detector/system_prompt_builder.ts: Added a new System Prompt Builder class for generating prompts related to error detection.
  • src/agent/reasoning/error_detector/types.ts: Added types and interfaces for the Error Detector component to manage error analysis effectively.
  • src/agent/reasoning/progress_detector/tests/file_partitioner.test.ts: Added unit tests for the File Partitioner functionality.
  • src/agent/reasoning/progress_detector/tests/progress_detector.test.ts: Added a comprehensive test suite for the ProgressDetector class, covering initialization, progress detection, and various edge cases.
  • src/agent/reasoning/progress_detector/tests/progress_parser.test.ts: Added comprehensive unit tests for the ProgressParser class.
  • src/agent/reasoning/progress_detector/tests/subagent_handler.test.ts: Added comprehensive unit tests for the SubagentHandler to ensure correct functionality.
  • src/agent/reasoning/progress_detector/tests/system_prompt_builder.test.ts: Added comprehensive unit tests for the SystemPromptBuilder class.
  • src/agent/reasoning/progress_detector/agent_initializer.ts: Added AgentInitializer class for managing the initialization of agents with tools and repository files for progress detection.
  • src/agent/reasoning/progress_detector/file_partitioner.ts: Added File Partitioner class to manage file distribution across subagents.
  • src/agent/reasoning/progress_detector/index.ts: Added Progress Detector module to streamline exports of related components and types.
  • src/agent/reasoning/progress_detector/progress_detector.ts: Added Progress Detector class to analyze the progress of tasks based on code changes.
  • src/agent/reasoning/progress_detector/progress_parser.ts: Added ProgressParser class to parse progress data from agent results.
  • src/agent/reasoning/progress_detector/subagent_handler.ts: Added a Subagent Handler for parallel processing and progress detection.
  • src/agent/reasoning/progress_detector/system_prompt_builder.ts: Added a new SystemPromptBuilder class to facilitate the generation of system prompts for progress detection.
  • src/agent/reasoning/progress_detector/types.ts: Added types and interfaces for Progress Detector to facilitate progress detection functionality.
  • src/agent/tools/base_tool.ts: Added a base class for all tools which includes validation and execution methods.
  • src/agent/tools/builtin_tools/tests/report_progress_tool.test.ts: Added unit tests for Report Progress Tool functionalities.
  • src/agent/tools/builtin_tools/index.ts: Added an export file for built-in tools to streamline access.
  • src/agent/tools/builtin_tools/manage_todos_tool.ts: Added a new tool for managing a TODO list with various functionalities.
  • src/agent/tools/builtin_tools/propose_change_tool.ts: Added Propose Change Tool for making modifications to files in a virtual codebase.
  • src/agent/tools/builtin_tools/read_file_tool.ts: Added Read File Tool to read file contents from a repository or virtual codebase.
  • src/agent/tools/builtin_tools/report_errors_tool.ts: Added a new tool for reporting detected errors in a structured format.
  • src/agent/tools/builtin_tools/report_progress_tool.ts: Added Report Progress Tool for structured task progress reporting.
  • src/agent/tools/builtin_tools/search_files_tool.ts: Added Search Files Tool for enhanced file searching capabilities.
  • src/agent/tools/index.ts: Added a new module to export tool-related classes.
  • src/agent/tools/tool_executor.ts: Added ToolExecutor class to enhance tool execution capabilities in the Agent SDK.
  • src/agent/tools/tool_registry.ts: Added Tool Registry class for managing available tools.
  • src/agent/types/agent_types.ts: Added agent types for the Agent SDK to support multi-faceted functionality.
  • src/agent/types/index.ts: Added an index file to aggregate and export types from multiple files.
  • src/agent/types/message_types.ts: Added message types for the Agent SDK compatible with Anthropic Messages API format.
  • src/agent/types/response_schema.ts: Added a JSON schema for agent responses to standardize output format.
  • src/agent/types/tool_types.ts: Added type definitions for tools in the Agent SDK.
  • src/agent/utils/error_handler.ts: Added error handling classes and functionality for the Agent SDK.
  • src/agent/utils/index.ts: Introduced an index file to export all utility functions.
  • src/agent/utils/prompt_builder.ts: Added a new prompt builder class for Agent SDK to construct prompts with tool definitions and conversation history.
  • src/agent/utils/response_parser.ts: Added a new response parser for handling OpenRouter JSON responses.
  • src/agent_tester.ts: Added a new agent tester script with various testing commands for the Agent SDK.
  • src/agent_tester_commands.ts: Added comprehensive command testing suite for the Agent SDK.
  • src/cli.ts: Enhanced CLI with additional commands and improved functionality.
  • src/data/model/execution.ts: Commented out logging of current configuration for cleaner output.
  • src/data/model/single_action.ts: Enhanced SingleAction class by adding new actions and corresponding checks.
  • src/data/model/think_response_schema.ts: Enhanced JSON schema with stricter validation rules and additional properties for TODO updates.
  • src/data/repository/ai_repository.ts: Enhanced AI repository methods with support for streaming responses and improved configurations.
  • src/data/repository/file_repository.ts: Refactored file retrieval process to clone repositories and read files directly from the filesystem, improving performance and adding error handling.
  • src/data/repository/issue_repository.ts: Enhanced issue and label management functionalities by adding new methods for listing, creating, and ensuring labels and issue types.
  • src/data/repository/supabase_repository.ts: Enhanced the SupabaseRepository class with additional error management features and new methods for better cache handling.
  • src/mcp_tester_commands.ts: Added MCP Tester Commands for testing multiple transport methods and tool execution.
  • src/sub_agent_tester_commands.ts: Added a comprehensive CLI command module for testing SubAgent functionalities.
  • src/tec_tester_commands.ts: Added CLI commands for testing error detection system using the Agent SDK.
  • src/usecase/actions/check_progress_use_case.ts: Introduced a new use case for checking the progress of an issue based on branch changes, incorporating AI analysis for progress detection.
  • src/usecase/actions/initial_setup_use_case.ts: Added InitialSetupUseCase to perform setup operations including GitHub access verification, label creation, and Supabase configuration.
  • src/usecase/actions/vector_action_use_case.ts: Enhanced the VectorActionUseCase by implementing multi-branch processing and error detection.
  • src/usecase/single_action_use_case.ts: Enhanced SingleActionUseCase by adding InitialSetup and CheckProgress actions.
  • src/usecase/steps/common/services/file_cache_manager.ts: Removed the debug logging of cached paths after loading from Supabase.
  • src/usecase/steps/common/services/file_search_service.ts: Enhanced search functionality to include content searches and improved code readability.
  • src/usecase/steps/common/think_todo_manager.ts: Commented out logging statements for updated TODOs to reduce console output.
  • src/usecase/steps/common/think_use_case.ts: Refactored the ThinkUseCase to remove direct dependencies on several services and introduced a ReasoningVisualizer for output.
  • src/usecase/steps/common/think_use_case_2.ts: Added a new use case for handling AI-driven code analysis and reasoning, enhancing the overall functionality.
  • src/utils/constants.ts: Added new actions for the workflow management system.
  • src/utils/logger.ts: Enhanced logging system to support structured logging and additional metadata.
  • src/utils/reasoning_visualizer.ts: Added a new ReasoningVisualizer class for visualizing the reasoning process in an AI system.
  • supabase/migrations/20240321000000_create_chunks_table.sql: Removed the entire SQL migration file containing the definition and management of the chunks table.
  • supabase/migrations/20240322000000_create_ai_file_cache_table.sql: Updated the ai_file_cache table schema to include error tracking fields and changed default array initialization.
  • supabase/migrations/20240322000001_add_error_columns_to_ai_file_cache.sql: Added new error-related columns to the ai_file_cache table and updated associated functions.
  • test-mcp-server/index.js: Added a new MCP server implementation that supports various tools for testing.

Detailed Changes

.mcp.json

Added configuration for MCP servers.

Changes:

  • Introduced an MCP server configuration structure.
  • Added a test server entry with details such as name, command, args, and transport.

.mcp.json.example

Added example configuration for MCP servers including stdio and HTTP transports.

Changes:

  • Introduced a new JSON structure for defining MCP servers.
  • Added configuration for 'example-stdio' server with command, args, and environment variables.
  • Introduced configuration for 'example-http' server with a URL and authorization headers.

action.yml

Updated default model for OpenRouter AI operations.

Changes:

  • Changed the default OpenRouter model from 'deepseek/deepseek-chat' to 'openai/gpt-4o-mini'.

jest.config.js

Added Jest configuration file for TypeScript testing.

Changes:

  • Established 'ts-jest' preset for TypeScript support.
  • Set test environment to 'node'.
  • Specified root directory for test files as 'src'.
  • Defined test matching pattern for files in 'tests' directory.
  • Configured coverage collection for TypeScript files in 'src/agent', excluding declaration files and tests.
  • Allowed module file extensions for TypeScript and JavaScript.
  • Added a transform rule for TypeScript files using 'ts-jest'.
  • Enabled verbose output for test runs.

package.json

Added testing scripts and updated devDependencies to support Jest.

Changes:

  • Added new scripts for testing: 'test', 'test:watch', and 'test:coverage'.
  • Updated devDependencies to include Jest and ts-jest.
  • Added type definitions for Jest in devDependencies.

.agent-sessions

.agent-sessions/session_1763235331644_8853527.json

Added a new session file to record user interactions and metrics.

Changes:

  • Created a new JSON file to store session data including metadata and messages.
  • Included session details such as sessionId, createdAt, lastUpdated, messageCount, turnCount, and toolCallCount.
  • Added metrics tracking totalTokens, apiCalls, toolCalls, averageLatency, totalDuration, and errors.
  • Recorded user and assistant messages including content and types.

.agent-sessions/session_1763235335017_cveqlr8.json

Added a new session JSON file containing metadata and messages.

Changes:

  • Created a new session JSON file with ID 'session_1763235335017_cveqlr8'.
  • Included session metadata such as 'createdAt', 'lastUpdated', 'messageCount', and 'turnCount'.
  • Added metrics including 'totalTokens', 'apiCalls', 'toolCalls', 'averageLatency', and 'totalDuration'.
  • Inserted two messages: a user message asking to 'Say hello' and an assistant response.

.agent-sessions/session_1763236315499_je0w7pl.json

Added a new session JSON file containing metadata and message history.

Changes:

  • Created a JSON file to store session details including metadata such as session ID, timestamps, and message counts.
  • Included message details with roles and content for a user-assistant interaction.
  • Added metrics data specifying counts for tokens, API calls, tool calls, and latency.

.agent-sessions/session_1763236327442_argwhxe.json

Added session metadata and message history for user interactions.

Changes:

  • Created a new JSON file to store session data.
  • Included metadata such as sessionId, createdAt, lastUpdated, messageCount, turnCount, toolCallCount, and metrics.
  • Designed the messages array to capture user and assistant interactions.
  • Added first user message: 'Say hello'.
  • Added assistant's response with type and text format.

.github/ISSUE_TEMPLATE

.github/ISSUE_TEMPLATE/release.yml

Updated team name in release issue template.

Changes:

  • Changed description for the release issue from 'git-board-flow' to 'giik'.
  • Updated disclaimer message to reflect the new team name from 'git-board-flow team' to 'giik team'.

.github/workflows

.github/workflows/gbf_check_progress.yml

Added a GitHub Actions workflow for checking progress in Git Board.

Changes:

  • Created a new workflow configuration that triggers on pushes to all branches except master and develop.
  • Defined a job named git-board-check-progress that runs on an Ubuntu environment.
  • Included steps for checking out the repository and running a custom action for checking progress with specified parameters.

.github/workflows/gbf_update_ai_knowledge.yml

Updated the single-action parameter for the AI knowledge update job.

Changes:

  • Changed the value of single-action from vector_action to ai_cache_action.

docker

docker/Dockerfile

The Dockerfile has been removed from the project.

Changes:

  • Deleted the entire Dockerfile.
  • Removed all instructions related to building the Docker image.

docker/main.py

Removed entire FastAPI application responsible for embedding model initialization and endpoints.

Changes:

  • Removed all code related to FastAPI application including startup and shutdown events.
  • Deleted model initialization and resource management logic.
  • Eliminated endpoints for health check, embedding processing, and system information retrieval.
  • Removed logging configuration and related logging statements.

docker/requirements.txt

Removed requirements file for Python dependencies.

Changes:

  • Deleted all lines specifying Python package dependencies.
  • No new dependencies added.

docs

docs/THINK_AS_CLAUDE_USECASE.md

Added detailed documentation for the ThinkAsClaudeUseCase, outlining its architecture, execution flow, components, and error handling.

Changes:

  • Introduced a comprehensive overview of the ThinkAsClaudeUseCase, including its purpose and functionality.
  • Described the overall architecture with a diagram illustrating the main components and their interactions.
  • Detailed the step-by-step execution flow, including phases for preparation, execution, and results processing.
  • Outlined key components such as ThinkCodeManager for the virtual codebase and ThinkTodoManager for task management.
  • Included a section on configuring environment variables and necessary dependencies.
  • Presented logging and error handling mechanisms, highlighting fallbacks in case of SDK failures.
  • Discussed best practices implemented within the use case for efficient operation and organization of tasks.

docs/agent-sdk-comparison.md

Added a comprehensive comparison between our Agent SDK and Claude Agent SDK detailing implemented features and differences.

Changes:

  • Introduced a section on implementation status highlighting features implemented and missing.
  • Listed 17 out of 23 total features implemented, categorized into basic, critical advanced, and important advanced features.
  • Provided a summary of functional parity indicating 100% completion for essential features.
  • Outlined major differences between our SDK and Claude SDK regarding optional features.
  • Concluded with a statement affirming readiness for production use of the Agent SDK.

docs/agent-sdk-missing-features.md

Added documentation detailing the missing features required to make the agent SDK equivalent to Claude's Agent SDK.

Changes:

  • Created a new document listing implemented and missing features of the Agent SDK.
  • Included sections for basic features, advanced features (critical and important), and optional features.
  • Detailed implementation requirements for missing features along with specific files that need modification.
  • Provided a recommended prioritization for feature implementation.
  • Outlined implementation notes including backward compatibility and testing requirements.

docs/mcp-and-subagents-examples.md

Added comprehensive examples and guidelines for implementing MCP and Subagents in the system.

Changes:

  • Introduced examples of connecting with PostgreSQL using MCP.
  • Detailed implementation steps for integrating MCP with existing code.
  • Showed use cases for Subagents in complex code analysis.
  • Provided code samples for creating and executing tasks with Subagents.
  • Included new configuration setup in .mcp.json for MCP servers.
  • Outlined the estimated lines of code and development time for MCP and Subagents.

docs/mcp-and-subagents-explanation.md

Added comprehensive documentation on the Model Context Protocol (MCP) and Subagents, outlining their functionalities, architectural changes, and usage examples.

Changes:

  • Introduced a detailed explanation of the Model Context Protocol (MCP) including its purpose, functioning, advantages, and disadvantages.
  • Included potential architectural changes required for implementing MCP.
  • Provided a section on Subagents, describing their roles, functionality, and implications for the architecture.
  • Added practical examples showing the contrast between current implementation and proposed approaches using MCP and Subagents.
  • Outlined comparisons between implementing MCP and Subagents versus current alternatives.
  • Concluded with recommendations for implementation based on specific needs.

docs/mcp-testing-guide.md

Added a comprehensive guide for testing MCP with CLI commands and configuration examples.

Changes:

  • Introduced a new document for testing MCP with CLI commands.
  • Detailed commands for testing MCP configuration, stdio, HTTP transport, and direct tool execution.
  • Included options and examples for each command to facilitate user understanding.
  • Provided instructions for creating a .mcp.json configuration file.
  • Listed available MCP servers and troubleshooting guidance for common errors.

docs/tec-error-detector.md

Added comprehensive documentation for the TEC Error Detector, detailing its features and usage.

Changes:

  • Created a new document for TEC (TypeScript Error Checker) - Error Detector.
  • Included a description of the Error Detector and its autonomous error detection capabilities.
  • Outlined key features including autonomous analysis, intelligent detection, severity classification, and correction suggestions.
  • Documented CLI commands and options for error detection and quick-check functionalities.
  • Explained the operational flow, detailing initialization, analysis, and results generation steps.
  • Defined severity levels and types of errors that can be detected by the system.
  • Provided example usages for both complete project analysis and focused checks.

src/agent/tests

src/agent/__tests__/base_tool.test.ts

Added comprehensive tests for the BaseTool class, covering input validation and execution.

Changes:

  • Created a TestTool class extending BaseTool for testing purposes.
  • Implemented tests for getting the tool's definition.
  • Added tests for input validation functionality, checking for correct and incorrect inputs.
  • Included tests for executing the tool with validated input, ensuring correct handling of valid and invalid cases.
  • Added a FlexibleTool class in tests to check for additional properties allowance in the input schema.
  • Created an ErrorTool class to test error handling during execution.

src/agent/__tests__/budget_manager.test.ts

Added unit tests for the BudgetManager class to validate token and cost limits.

Changes:

  • Added tests for the 'isExceeded' method to check for token and cost limits.
  • Added tests for the 'shouldWarn' method to validate warning at configured percentage.
  • Added tests for the 'getStatus' method to ensure correct status reporting.

src/agent/__tests__/context_manager.test.ts

Added comprehensive unit tests for the ContextManager class to ensure functionality.

Changes:

  • Created a new test file for ContextManager with 117 lines of tests.
  • Tested the estimateTokens function for both string messages and content blocks.
  • Tested the needsCompression function to verify behavior under various conditions.
  • Tested the compressContext function to ensure proper message compression.
  • Tested the getStats function to return accurate context statistics.

src/agent/__tests__/context_sharing.test.ts

Added tests for ContextSharing functionality including message extraction, sharing, merging, and summarizing.

Changes:

  • Created test suite for ContextSharing with multiple test cases.
  • Added test for extractRelevantMessages to verify extraction of system and recent messages.
  • Included a test to limit the number of extracted messages.
  • Implemented test for sharing context messages between message managers.
  • Added filtering tests to ensure sharing by specific roles works correctly.
  • Created tests for merging contexts, including deduplication and limiting merged messages.
  • Added a test for creating a summary of the context messages.

src/agent/__tests__/mcp_client.test.ts

Added comprehensive unit tests for MCPClient, covering connection, tool invocation, and disconnection functionalities.

Changes:

  • Implemented test cases for the MCPClient class including connection tests for both stdio and HTTP transports.
  • Added error handling tests for missing command and URL in server configurations.
  • Created tests for invoking tools and validating responses, including successful and failure scenarios.
  • Developed tests to retrieve all registered tools from the client.
  • Incorporated disconnect functionality tests to ensure clean disconnection from the server.

src/agent/__tests__/mcp_manager.test.ts

Added unit tests for the MCPManager to ensure proper functionality of configuration loading and server connection.

Changes:

  • Created a new test file for MCPManager with 159 lines of tests.
  • Added tests for loading MCP configuration from a file, checking for valid, missing, and invalid JSON.
  • Implemented tests for connecting to MCP servers, including registering tools and handling already connected servers.
  • Created tests for checking server connection status and retrieving the list of connected servers.

src/agent/__tests__/message_manager.test.ts

Added comprehensive unit tests for the MessageManager class functionalities.

Changes:

  • Created a new test file for MessageManager covering system, user, assistant messages, and tool results.
  • Added tests for adding and managing system messages.
  • Implemented tests for user messages, ensuring message roles and counts are validated.
  • Developed tests for assistant messages, including content conversion to content blocks.
  • Added functionality to test adding tool results and verifying message structure.
  • Released tests for retrieving all messages, assuring immutability, and getting the last message.
  • Included a reset function test to clear all messages.

src/agent/__tests__/metrics_tracker.test.ts

Added unit tests for the MetricsTracker class to ensure correct functionality.

Changes:

  • Created a new test file for MetricsTracker.
  • Included tests for recording API calls with assertions on metrics.
  • Added tests to verify average latency calculation across multiple API calls.
  • Implemented cost calculation tests when configuration is provided.
  • Added tests for recording tool calls and incrementing the count.
  • Included tests for recording errors and ensuring the count increments correctly.
  • Created tests to verify that metrics can be reset successfully.
  • Tested total duration calculation in getMetrics method.

src/agent/__tests__/response_parser.test.ts

Added comprehensive unit tests for ResponseParser functionality.

Changes:

  • Created a new test file for the ResponseParser class.
  • Implemented tests for various response parsing scenarios including simple responses, reasoning, and tool calls.
  • Added error handling tests for invalid response formats.
  • Included validations to ensure ResponseParser's output meets expected criteria.
  • Tested input flexibility for tool calls to accept both 'input' and 'arguments' fields.

src/agent/__tests__/retry_manager.test.ts

Added unit tests for the RetryManager class to validate its functionality.

Changes:

  • Introduced a new test file for RetryManager with 120 lines of tests.
  • Implemented tests for the execute method handling success, retryable errors, non-retryable errors, exponential backoff, and respect for max retries.
  • Added a test for resetting the circuit breaker state.

src/agent/__tests__/session_manager.test.ts

Added unit tests for SessionManager functionality.

Changes:

  • Created a new test file for SessionManager to validate its methods.
  • Implemented setup and teardown logic to manage test sessions directory.
  • Added tests for saving and loading sessions.
  • Included a test for returning null for non-existent sessions.
  • Added a test for deleting sessions to ensure proper functionality.
  • Created a test to list all sessions saved by SessionManager.
  • Added a test to verify that unique session IDs are generated.

src/agent/__tests__/subagent_manager.test.ts

Added unit tests for the SubAgentManager to ensure proper functionality.

Changes:

  • Created a new test file for SubAgentManager functionality.
  • Implemented tests for creating subagents including name uniqueness and context inheritance.
  • Added tests for executing multiple tasks in parallel and handling errors.
  • Included tests for coordinating dependent tasks with validation for execution order.
  • Implemented checks to prevent circular dependencies in task execution.
  • Added tests for sharing context between subagents and verifying messages.
  • Included functionality checks for getting and removing subagents, and clearing all subagents.

src/agent/__tests__/tool_executor.test.ts

Added comprehensive tests for ToolExecutor functionality including single and multiple tool executions.

Changes:

  • Created a new test file for ToolExecutor with 227 lines of tests.
  • Implemented MockTool class to simulate tool behavior in tests.
  • Added tests for single tool execution success and failure cases.
  • Included error handling tests for non-existent tools and throw exceptions.
  • Developed tests for executing multiple tools in parallel and sequentially.
  • Checked tool availability and registered tool names in the registry.

src/agent/__tests__/tool_permissions.test.ts

Added unit tests for ToolPermissionsManager to verify access control strategies.

Changes:

  • Created a new test file for ToolPermissionsManager.
  • Added tests for the default strategy 'all' allowing all tools.
  • Implemented tests for blocklist strategy, verifying both allowed and blocked tools.
  • Included tests for allowlist strategy ensuring only specified tools are allowed.
  • Added a test for the filterAllowed method to check filtering of tools based on permissions.
  • Implemented a test for updating permissions to verify dynamic permission changes.

src/agent/__tests__/tool_registry.test.ts

Added comprehensive unit tests for the ToolRegistry class.

Changes:

  • Created tests for ToolRegistry that cover registration, retrieval, definitions, clearing, and counting of tools.
  • Implemented a MockTool class to facilitate testing of the ToolRegistry.
  • Added tests to check for tool registration, duplicate registration errors, and multiple tool registrations.
  • Included tests for retrieving tools by name and checking if tools exist.
  • Tested the retrieval of all tool definitions and tool names.
  • Tested clearing of all tools and the accuracy of the tool count.

src/agent/core

src/agent/core/agent.ts

Added the Agent class for the Agent SDK, integrating various functionalities including session management, tool registration, and MCP connections.

Changes:

  • Created the Agent class that serves as the main entry point for the Agent SDK.
  • Implemented functionalities for message management, tool registration, and reasoning loops.
  • Added methods for handling session loading, saving, and management.
  • Incorporated support for subagents, allowing the execution of tasks in parallel and coordination among agents.
  • Included logging calls to provide insights into actions taken by the Agent.

src/agent/core/budget_manager.ts

Implemented BudgetManager class for tracking and enforcing budget limits.

Changes:

  • Added BudgetManager class to manage budget configurations.
  • Implemented methods to check if budget is exceeded or if a warning should be shown.
  • Introduced getStatus method to retrieve budget usage stats.
  • Added logStatus method to log current budget status based on metrics.
  • Provided an updateConfig method to allow dynamic configuration updates.

src/agent/core/context_manager.ts

Added ContextManager class for managing conversation context and compression.

Changes:

  • Defined the ContextStats interface for tracking message statistics.
  • Implemented the ContextManager class to handle message context and compression.
  • Added methods to estimate tokens, check compression needs, compress context, get statistics, and modify settings for context length and compression.
  • Introduced logging functionality for debug information when compressing context.

src/agent/core/context_sharing.ts

Added new ContextSharing class for managing context sharing between agents.

Changes:

  • Introduced SharedContext interface to define the structure of shared context.
  • Implemented extractRelevantMessages method to filter and retrieve messages.
  • Created shareContext method for sharing messages between agents with options for filtering and limiting messages.
  • Added mergeContexts method to combine contexts from multiple agents with optional deduplication.
  • Developed createContextSummary method for generating summaries of shared context.

src/agent/core/index.ts

Added an index file to export core components.

Changes:

  • Introduced an index file to streamline exports.
  • Exported components from 'message_manager'.
  • Exported components from 'reasoning_loop'.
  • Exported components from 'agent'.

src/agent/core/message_manager.ts

Added MessageManager class for handling conversation messages in the Anthropic Messages API format.

Changes:

  • Created a new class MessageManager to manage conversation messages.
  • Added methods to handle system, user, and assistant messages.
  • Implemented a method to add tool results as user messages.
  • Provided methods to retrieve messages, count, and reset the message history.
  • Included checks for the presence of a system message and methods to retrieve it.

src/agent/core/metrics_tracker.ts

Added a MetricsTracker class to monitor various performance metrics.

Changes:

  • Created a new file for MetricsTracker functionality.
  • Defined an interface CostConfig for cost configuration.
  • Implemented the MetricsTracker class to track tokens, API calls, tool calls, and latency.
  • Added methods to record API calls, tool calls, errors, retrieve current metrics, reset metrics, and set cost configuration.
  • Included logging for API calls with input and output token counts and latency.

src/agent/core/reasoning_loop.ts

Introduced a new Reasoning Loop class to manage the conversation loop in the Agent SDK, integrating advanced features such as streaming, permissions, context management, metrics tracking, budget handling, and error recovery.

Changes:

  • Added a new file src/agent/core/reasoning_loop.ts with 434 lines of implementation.
  • Implemented the 'ReasoningLoop' class responsible for executing the conversation loop.
  • Integrated classes for message management, tool execution, context management, permissions checking, metrics tracking, and budget control.
  • Included a timeout mechanism for session management.
  • Developed methods for calling APIs with retry logic, handling streaming responses, and executing tools with timeouts.
  • Introduced error handling and logging throughout the execution process.

src/agent/core/retry_manager.ts

Added RetryManager class for handling retries with exponential backoff and circuit breaker logic.

Changes:

  • Created a new file src/agent/core/retry_manager.ts.
  • Implemented the RetryManager class to manage retries.
  • Added a configuration object for retry settings including maxRetries, initialDelay, maxDelay, backoffMultiplier, and retryableErrors.
  • Introduced circuit breaker functionality to manage request retries based on failure conditions.
  • Included exponential backoff strategy for delay between retry attempts.
  • Provided an execute method that wraps a function with retry and error handling logic.
  • Added private helper methods to check for retryable errors and to implement sleep functionality.

src/agent/core/session_manager.ts

Added a comprehensive session management system to handle agent sessions with persistence.

Changes:

  • Implemented SessionManager class to manage agent sessions.
  • Introduced methods for saving, loading, deleting, and listing sessions.
  • Added support for session metadata including creation time, message count, and tool call count.
  • Ensured the sessions directory exists upon initialization.
  • Utilized JSON files for persistent session storage.

src/agent/core/subagent_manager.ts

Implemented SubAgentManager for managing subagents and their coordination.

Changes:

  • Added a class SubAgentManager for handling the creation and management of subagents.
  • Introduced interfaces SubAgentOptions and Task to define options and tasks for subagents.
  • Implemented methods to create subagents, execute tasks in parallel, and coordinate agents with dependencies.
  • Added context sharing functionality between subagents.
  • Included logging for various operations such as creating, executing, and managing subagents.

src/agent/core/tool_permissions.ts

Added ToolPermissionsManager class to manage tool usage permissions for the agent.

Changes:

  • Created a new file tool_permissions.ts with the ToolPermissionsManager class.
  • Implemented methods to check tool access permissions, filter allowed tools, update permissions, and retrieve current permissions.
  • Defined a constructor that initializes permissions with a default strategy if not provided.
  • Added logic for different permission strategies: 'all', 'allowlist', and 'blocklist'.

src/agent

src/agent/index.ts

Added main exports for the Agent SDK, organizing core components, tools, types, utils, and MCP.

Changes:

  • Included a comment header for documentation purposes.
  • Exported core components such as Agent, MessageManager, and others from './core/'.
  • Exported tools including BaseTool, ToolRegistry, and ToolExecutor from './tools/'.
  • Exported all types from './types/'.
  • Exported all utilities from './utils/'.
  • Exported all elements from './mcp/'.
  • Exported additional core components like SubAgentManager and ContextSharing.

src/agent/mcp

src/agent/mcp/index.ts

Added MCP module exports for improved organization and access to core components.

Changes:

  • Added module documentation comment.
  • Exported MCPClient from ./mcp_client.
  • Exported MCPManager from ./mcp_manager.
  • Exported MCPToolWrapper from ./mcp_tool.
  • Exported transport classes: StdioTransport, HTTPTransport, SSETransport, and MCPTransport from ./mcp_transport.
  • Exported all types from ./types.

src/agent/mcp/mcp_client.ts

Implemented the MCPClient class for managing connections to Model Context Protocol servers, enabling transport configuration and communication.

Changes:

  • Added the MCPClient class to handle connections with MCP servers.
  • Implemented connect, initialize, loadTools, loadResources, and loadPrompts methods for managing server resources.
  • Included support for different transport types: stdio, http, and sse.
  • Added logging functionality for connections and tool calls using logInfo and logDebugInfo.
  • Created methods for sending requests to the server and calling tools.
  • Implemented disconnect and disconnectAll methods for managing server connections.
  • Provided methods to retrieve tools, resources, and prompts.

src/agent/mcp/mcp_manager.ts

Added MCPManager class to manage MCP connections and tool registration.

Changes:

  • Created the MCPManager class to manage MCP connections and tools.
  • Implemented methods for loading configuration from a JSON file, initializing connections, connecting to servers, and disconnecting from servers.
  • Added error handling and logging for configuration loading and server connections.
  • Included an interface MCPConfig to type the configuration structure.
  • Introduced methods to get the MCP client, check connection status, retrieve connected servers, and disconnect all servers.
  • Registered MCP tools with a ToolRegistry after establishing a connection to a server.

src/agent/mcp/mcp_tool.ts

Added MCPToolWrapper class to integrate MCP tools with BaseTool interface.

Changes:

  • Created a new file with the MCPToolWrapper class.
  • Imported necessary modules including BaseTool, MCPClient, and MCPTool.
  • Implemented constructor for MCPToolWrapper to initialize mcpClient, serverName, and mcpTool.
  • Defined getName method to return the name of the tool in 'serverName:toolName' format.
  • Defined getDescription method to return the description of the MCP tool.
  • Implemented getInputSchema method to provide a structured schema for tool inputs.
  • Added execute method to asynchronously call the tool through the MCPClient.

src/agent/mcp/mcp_transport.ts

Added MCPTransport module handling communication with MCP servers via multiple transport methods.

Changes:

  • Introduced MCPTransport interface for defining transportation methods.
  • Implemented StdioTransport class for local process communication.
  • Implemented HTTPTransport class for remote MCP server communication via HTTP.
  • Implemented SSETransport class for Server-Sent Events communication.
  • Added connect, send, receive, sendRequest, and close methods to each transport class.
  • Added error handling and logging using logError and logDebugInfo.
  • Included message queuing and handler management in StdioTransport.

src/agent/mcp/types.ts

Added type definitions for Model Context Protocol (MCP).

Changes:

  • Introduced MCPServerConfig interface to define server configuration.
  • Created MCPMessage interface for structured messaging with optional parameters.
  • Defined MCPError interface for error handling in messages.
  • Established MCPTool interface that describes tools with an input schema.
  • Added MCPResource interface to represent resources with URIs.
  • Included MCPPrompt interface for handling prompts and their arguments.
  • Implemented MCPInitializeResult interface to capture initialization results and server information.

src/agent/reasoning/error_detector/tests

src/agent/reasoning/error_detector/__tests__/error_detector.test.ts

Added unit tests for the ErrorDetector class to ensure correct functionality and error detection.

Changes:

  • Created a new test file for ErrorDetector with 216 lines of test code.
  • Added tests to confirm correct initialization of ErrorDetector with given options and defaults.
  • Included tests for the detectErrors method to verify agent initialization, usage of subagents based on file count, and handling of regular queries.
  • Implemented assertions to check error parsing and summary generation.

src/agent/reasoning/error_detector/__tests__/error_parser.test.ts

Added unit tests for the ErrorParser class to validate error parsing functionality.

Changes:

  • Created a new test file for ErrorParser.
  • Implemented multiple test cases to ensure correct parsing of errors from report_errors tool.
  • Tested scenarios including parsing single and multiple errors, handling different severities, ignoring non-relevant tool calls, and dealing with empty result sets.
  • Included a test case for converting invalid type strings to valid IssueType.

src/agent/reasoning/error_detector/__tests__/file_partitioner.test.ts

Added unit tests for the FilePartitioner class to ensure correct behavior in partitioning files by directory.

Changes:

  • Created a new test file for FilePartitioner with various test cases.
  • Implemented tests for partitioning files by top-level directory.
  • Added a test for handling files in the root directory.
  • Included a test to check even distribution of files across partitions.
  • Added a test for handling an empty files array.
  • Implemented a test for partitioning with a single partition.
  • Added a test to ensure files from the same directory are grouped together.

src/agent/reasoning/error_detector/__tests__/summary_generator.test.ts

Added unit tests for the SummaryGenerator class to validate summary generation functionality.

Changes:

  • Created a new test file for the SummaryGenerator class.
  • Implemented tests for generating summary from an empty errors array.
  • Implemented tests for generating summary with errors of different severities.
  • Implemented tests for counting multiple errors of the same type.

src/agent/reasoning/error_detector/__tests__/system_prompt_builder.test.ts

Added unit tests for the System Prompt Builder functionality.

Changes:

  • Introduced test cases to validate the behavior of the SystemPromptBuilder's build method.
  • Test for building prompts with default options.
  • Test for including focus areas in prompts.
  • Test for including error types in prompts.
  • Test for prompts with both focus areas and error types.
  • Test for mandatory workflow instructions in prompts.
  • Test for inclusion of error severity levels in prompts.
  • Test for output format instructions in prompts.

src/agent/reasoning/error_detector

src/agent/reasoning/error_detector/agent_initializer.ts

Implemented AgentInitializer to initialize agents with tools and repository files for error detection.

Changes:

  • Added the AgentInitializer class to handle agent initialization.
  • Defined EXCLUDE_PATTERNS and IGNORE_FILES to manage which files to exclude when loading repository files.
  • Created methods for initializing agents, loading repository files, creating tools, managing TODOs, and searching files.
  • Implemented error logging using logInfo, logWarn, and logDebugInfo for better traceability.
  • Integrated various tools such as ReadFileTool, SearchFilesTool, ProposeChangeTool, ManageTodosTool, and ReportErrorsTool for comprehensive agent functionality.

src/agent/reasoning/error_detector/error_detector.ts

Added a new ErrorDetector class to facilitate error detection in codebases using the Agent SDK.

Changes:

  • Created the ErrorDetector class to manage error detection processes.
  • Imported necessary dependencies including Agent, ErrorParser, and SummaryGenerator.
  • Defined constructor for setting up ErrorDetectionOptions.
  • Implemented the detectErrors method to execute error detection with detailed logging.
  • Included the logic to use subagents based on the number of files and options.
  • Added methods for agent initialization and error parsing.
  • Structured error detection results with errors, summaries, and agent results.

src/agent/reasoning/error_detector/error_parser.ts

Added ErrorParser class to handle parsing errors from agent results and tool calls.

Changes:

  • Introduced a new class ErrorParser for parsing errors.
  • Implemented the static method parseErrors to extract errors from agent results.
  • Utilized structured format from report_errors tool for error extraction.
  • Included comprehensive logging for parsing progress and error validation.
  • Ensured that errors conform to the required fields and types.
  • Added fallback mechanism for invalid issue types using close matches.

src/agent/reasoning/error_detector/file_partitioner.ts

Added the FilePartitioner class to handle file distribution across subagents.

Changes:

  • Created a new class FilePartitioner for partitioning files by directory.
  • Implemented the method partitionFilesByDirectory to group files and balance their distribution.
  • Files are grouped by their top-level directory and distributed among subagents aiming to keep groups balanced in size.
  • Unused groups are filtered out before returning the result.

src/agent/reasoning/error_detector/file_relationship_analyzer.ts

Added File Relationship Analyzer to analyze file dependencies and consumers.

Changes:

  • Created a new class FileRelationshipAnalyzer to analyze relationships for target files.
  • Implemented method analyzeFileRelationships to find consumers and dependencies of a given target file.
  • Added logging for various stages in the analysis process.
  • Utilized FileImportAnalyzer to build relationship maps for files.
  • Included a feature to suggest similar file paths if the target file is not found.

src/agent/reasoning/error_detector/index.ts

Added Error Detector Module with various exports for error handling functionality.

Changes:

  • Created a new file for Error Detector Module.
  • Exported the ErrorDetector class from './error_detector'.
  • Exported types: ErrorDetectionOptions, DetectedError, ErrorDetectionResult from './types'.
  • Included internal exports for testing which consist of multiple components.

src/agent/reasoning/error_detector/subagent_handler.ts

Implemented a Subagent Handler for error detection utilizing parallel processing.

Changes:

  • Created a new file for the Subagent Handler class that handles error detection using subagents.
  • Implemented methods to detect errors with subagents, partition files, create tools for subagents, search files, and combine results from subagents.
  • Logged detailed information during processing, including file partitioning and analysis outcomes.
  • Added exclusion patterns for certain file types to improve error detection relevance.
  • Developed a structured approach to handle tasks and tools assigned to subagents, such as reading files and managing todos.

src/agent/reasoning/error_detector/summary_generator.ts

Added a new SummaryGenerator class to generate summaries of detected errors.

Changes:

  • Created a new file summary_generator.ts containing the SummaryGenerator class.
  • Implemented a static method generateSummary that accepts an array of DetectedError and returns a summary object.
  • Introduced a mechanism to categorize errors by severity and type.
  • No modifications to existing files as this is a new addition.

src/agent/reasoning/error_detector/system_prompt_builder.ts

Added a new System Prompt Builder class for generating prompts related to error detection.

Changes:

  • Introduced a new file to encapsulate the SystemPromptBuilder class.
  • Implemented a static method build that generates system prompts based on provided options.
  • Defined instructions for analyzing the entire codebase or a specific target file.
  • Included comprehensive guidelines on detecting various types of issues like bugs, security vulnerabilities, and configuration errors.
  • Added detailed instructions for mandatory workflows to ensure thorough analysis.

src/agent/reasoning/error_detector/types.ts

Added types and interfaces for the Error Detector component to manage error analysis effectively.

Changes:

  • Introduced an IssueType enum to categorize various types of issues including bugs, security vulnerabilities, performance issues, and more.
  • Defined the ErrorDetectionOptions interface to specify options for error detection, including model selection, repository details, and error types.
  • Created the DetectedError interface to structure error reporting with details such as file, line number, type, severity, description, and suggestions.
  • Established the ErrorDetectionResult interface to format results from error analysis, encapsulating a summary of detected errors and their counts.

src/agent/reasoning/progress_detector/tests

src/agent/reasoning/progress_detector/__tests__/file_partitioner.test.ts

Added unit tests for the File Partitioner functionality.

Changes:

  • Created a new test file for testing the FilePartitioner module.
  • Implemented tests for partitioning files by directory, ensuring correct partitioning behavior.
  • Covered various scenarios including handling root directory files, distributing files evenly, handling empty arrays, and ensuring files from the same directory are grouped together.
  • Added tests for edge cases such as more partitions than files.

src/agent/reasoning/progress_detector/__tests__/progress_detector.test.ts

Added a comprehensive test suite for the ProgressDetector class, covering initialization, progress detection, and various edge cases.

Changes:

  • Created new test file for ProgressDetector with a total of 672 new lines.
  • Implemented tests for constructor initialization with default and provided options.
  • Added tests for the detectProgress method, covering scenarios with different file counts, custom prompts, and subagent handling.
  • Included edge case handling for missing issue numbers and changed files.
  • Tested the behavior of the agent's query method and ensured correct progress reporting.

src/agent/reasoning/progress_detector/__tests__/progress_parser.test.ts

Added comprehensive unit tests for the ProgressParser class.

Changes:

  • Created a new test suite for ProgressParser focusing on the parseProgress method.
  • Added tests to validate parsing of progress from report_progress tool calls.
  • Included tests for handling progress as both numbers and strings.
  • Implemented rounding of progress to the nearest integer.
  • Added boundary tests for progress values (0 and 100).
  • Created tests to ignore non-report_progress tool calls.
  • Added test cases for empty results and invalid progress values (negative and over 100).
  • Tested handling of missing summary and multiple report_progress calls.
  • Included a test for handling NaN progress values.

src/agent/reasoning/progress_detector/__tests__/subagent_handler.test.ts

Added comprehensive unit tests for the SubagentHandler to ensure correct functionality.

Changes:

  • Created a new test file for SubagentHandler with 397 lines of test cases.
  • Mocked dependencies including FilePartitioner, ProgressParser, and SystemPromptBuilder.
  • Implemented multiple test cases for various scenarios including handling progress detection, calculating average progress, and managing limit for concurrent execution.
  • Ensured tests cover edge cases such as empty results and single subagent outputs.
  • Verified that metrics from all subagents are correctly combined and structured.

src/agent/reasoning/progress_detector/__tests__/system_prompt_builder.test.ts

Added comprehensive unit tests for the SystemPromptBuilder class.

Changes:

  • Created a new test file for SystemPromptBuilder.
  • Added tests for building prompts with default options.
  • Included tests for handling issue numbers, descriptions, and changed files.
  • Verified the presence of instructions related to report_progress usage.
  • Implemented tests for scenarios with and without changed files.

src/agent/reasoning/progress_detector

src/agent/reasoning/progress_detector/agent_initializer.ts

Added AgentInitializer class for managing the initialization of agents with tools and repository files for progress detection.

Changes:

  • Created the AgentInitializer class to manage the initialization of agents.
  • Implemented the initialize method to configure agent with tools, retrieve repository files, and handle reported progress.
  • Added methods for loading repository files from GitHub, processing changed files, and ignoring specific file patterns.
  • Introduced tools such as ReadFileTool, SearchFilesTool, and ReportProgressTool for agent functionality.
  • Established interfaces to support structured data returns from agent initialization processes.

src/agent/reasoning/progress_detector/file_partitioner.ts

Added File Partitioner class to manage file distribution across subagents.

Changes:

  • Created a new class FilePartitioner for partitioning files by directory.
  • Implemented partitionFilesByDirectory method to group files based on their top-level directory.
  • Sorted the groups by size to facilitate balanced distribution.
  • Introduced logic to distribute files across a defined number of subagents, ensuring the least loaded subagent receives new files.

src/agent/reasoning/progress_detector/index.ts

Added Progress Detector module to streamline exports of related components and types.

Changes:

  • Introduced a module comment for documentation purposes.
  • Exported ProgressDetector class from './progress_detector'.
  • Exported types ProgressDetectionOptions and ProgressDetectionResult from './types'.
  • Exported internal components: ProgressParser, SystemPromptBuilder, AgentInitializer, SubagentHandler, and FilePartitioner for testing.

src/agent/reasoning/progress_detector/progress_detector.ts

Added Progress Detector class to analyze the progress of tasks based on code changes.

Changes:

  • Created a new class ProgressDetector for detecting task progress.
  • Implemented methods for initializing the agent and detecting progress.
  • Added detailed logging for progress detection, including configuration and results.
  • Introduced support for using subagents when certain conditions are met.
  • Added methods to get agent instance and parse progress results.

src/agent/reasoning/progress_detector/progress_parser.ts

Added ProgressParser class to parse progress data from agent results.

Changes:

  • Introduced ProgressParser class with a static method parseProgress.
  • Implemented logging for debug information and warnings via logDebugInfo and logWarn.
  • Parsed structured progress data exclusively from the report_progress tool.
  • Validates progress values to ensure they fall within the range of 0 to 100.
  • Included default values for progress and summary in case of missing data.

src/agent/reasoning/progress_detector/subagent_handler.ts

Added a Subagent Handler for parallel processing and progress detection.

Changes:

  • Created a new class SubagentHandler to facilitate progress detection using subagents.
  • Implemented methods for detecting progress with subagents, creating tools for subagents, searching files, and combining results.
  • Added EXCLUDE_PATTERNS for excluding specific file types and directories from processing.
  • Established a structure for task creation that assigns specific files to each subagent.
  • Integrated logging for tracking the number of files processed and the results from subagents.

src/agent/reasoning/progress_detector/system_prompt_builder.ts

Added a new SystemPromptBuilder class to facilitate the generation of system prompts for progress detection.

Changes:

  • Created the SystemPromptBuilder class with a static method build.
  • Implemented logic to construct a system prompt based on provided progress detection options.
  • Included dynamic information for issue number, description, and changed files in the prompt.
  • Defined critical instructions for analyzing changes and assessing task progress.

src/agent/reasoning/progress_detector/types.ts

Added types and interfaces for Progress Detector to facilitate progress detection functionality.

Changes:

  • Created interface ProgressDetectionOptions for configuring progress detection settings.
  • Added properties in ProgressDetectionOptions for model, API keys, repository details, issue information, and changed files.
  • Defined interface ProgressDetectionResult to standardize the output of progress detection, including progress percentage, summary, and agent result.

src/agent/tools

src/agent/tools/base_tool.ts

Added a base class for all tools which includes validation and execution methods.

Changes:

  • Created an abstract class BaseTool that all tools will extend.
  • Defined abstract methods: getName, getDescription, getInputSchema, and execute.
  • Implemented a method getDefinition that returns the tool's name, description, and input schema.
  • Added a validateInput method to validate input against the defined schema.
  • Implemented executeWithValidation to run the tool's execution after validating input.

src/agent/tools/index.ts

Added a new module to export tool-related classes.

Changes:

  • Added documentation comment for the module.
  • Exported classes from 'base_tool', 'tool_registry', and 'tool_executor'.

src/agent/tools/tool_executor.ts

Added ToolExecutor class to enhance tool execution capabilities in the Agent SDK.

Changes:

  • Introduced the ToolExecutor class for executing tool calls.
  • Implemented execute() method to handle single tool execution with error handling.
  • Implemented executeAll() for executing multiple tool calls in parallel.
  • Implemented executeAllSequential() for executing multiple tool calls sequentially.
  • Added methods to check tool availability and retrieve available tool names and definitions.

src/agent/tools/tool_registry.ts

Added Tool Registry class for managing available tools.

Changes:

  • Created a new class ToolRegistry to manage a collection of tools.
  • Implemented methods to register a single tool and multiple tools.
  • Added methods to retrieve a tool by name, check for existence, and get all tool definitions.
  • Included methods to get all registered tool names and clear the registry.
  • Provided a method to get the count of registered tools.

src/agent/tools/builtin_tools/tests

src/agent/tools/builtin_tools/__tests__/report_progress_tool.test.ts

Added unit tests for Report Progress Tool functionalities.

Changes:

  • Created a new test file for ReportProgressTool.
  • Implemented tests for getName, getDescription, and getInputSchema methods.
  • Added multiple test cases for the execute method, covering various input scenarios.
  • Included error handling tests for missing and invalid input parameters.
  • Verified correct processing of progress and summary values, including edge cases.

src/agent/tools/builtin_tools

src/agent/tools/builtin_tools/index.ts

Added an export file for built-in tools to streamline access.

Changes:

  • Created a new file index.ts for exporting built-in tools.
  • Added comments to describe the purpose of the file.
  • Exported functions from read_file_tool, search_files_tool, propose_change_tool, and manage_todos_tool.

src/agent/tools/builtin_tools/manage_todos_tool.ts

Added a new tool for managing a TODO list with various functionalities.

Changes:

  • Created a new file manage_todos_tool.ts to implement TODO management functionalities.
  • Defined an interface ManageTodosToolOptions for required functionalities such as creating, updating, and listing TODOs.
  • Implemented the ManageTodosTool class which extends BaseTool and includes methods for managing TODOs.
  • Added methods to create, update, and list TODOs with necessary validation and error handling.
  • Defined input schema for actions to ensure proper usage and type safety.

src/agent/tools/builtin_tools/propose_change_tool.ts

Added Propose Change Tool for making modifications to files in a virtual codebase.

Changes:

  • Introduced a new file propose_change_tool.ts.
  • Defined ChangeType as a type with options: 'create', 'modify', 'delete', and 'refactor'.
  • Created an interface ProposeChangeToolOptions for handling change proposals.
  • Implemented the ProposeChangeTool class extending BaseTool.
  • Added methods for getting the tool's name, description, and input schema.
  • Developed an execute method to validate input and apply proposed changes to files.

src/agent/tools/builtin_tools/read_file_tool.ts

Added Read File Tool to read file contents from a repository or virtual codebase.

Changes:

  • Implemented ReadFileTool class extending BaseTool.
  • Defined ReadFileToolOptions interface for configuration.
  • Added method getName to return the tool name.
  • Included method getDescription for tool description.
  • Created getInputSchema method to define input validation schema.
  • Developed execute method to read file contents and handle errors.

src/agent/tools/builtin_tools/report_errors_tool.ts

Added a new tool for reporting detected errors in a structured format.

Changes:

  • Introduced ReportErrorsTool class which extends BaseTool.
  • Implemented methods to get the tool's name, description, and input schema.
  • Added input validation to ensure errors are reported in a structured format.
  • Included a detailed cleaning and normalization process for error data.
  • Provided support for logging information and reporting error counts.
  • Defined strict formats for required error properties including file, type, severity, and description.

src/agent/tools/builtin_tools/report_progress_tool.ts

Added Report Progress Tool for structured task progress reporting.

Changes:

  • Created ReportProgressTool class that extends BaseTool.
  • Defined ReportProgressToolOptions interface for tool options.
  • Implemented methods: getName, getDescription, getInputSchema, and execute.
  • Validated input for progress and summary including type and range checks.
  • Logged progress and summary information to the logger.
  • Ensured summary is clean from markdown and preserved in plain text.

src/agent/tools/builtin_tools/search_files_tool.ts

Added Search Files Tool for enhanced file searching capabilities.

Changes:

  • Introduced the SearchFilesTool class that extends BaseTool.
  • Implemented methods to get tool name, description, and input schema.
  • Created an execute method that handles file search operations.
  • Added input validation for the search query and max results.
  • Implemented result limiting based on the max_results parameter.
  • Formatted search results into a user-friendly output.

src/agent/types

src/agent/types/agent_types.ts

Added agent types for the Agent SDK to support multi-faceted functionality.

Changes:

  • Introduced various type and interface definitions, including ToolPermissionStrategy, StreamChunk, ToolPermissions, BudgetConfig, TimeoutConfig, RetryConfig, AgentOptions, TurnResult, Metrics, AgentResult, and ParsedResponse.
  • Defined permissions and configuration settings for tools and budget management.
  • Included support for callbacks related to tool calls, tool results, errors, and metrics.
  • Added streaming mechanisms with support for handling streams.
  • Established session management options, including session persistence and identifiers.

src/agent/types/index.ts

Added an index file to aggregate and export types from multiple files.

Changes:

  • Created a documentation comment indicating that the file exports all types.
  • Exported types from 'message_types'.
  • Exported types from 'tool_types'.
  • Exported types from 'agent_types'.

src/agent/types/message_types.ts

Added message types for the Agent SDK compatible with Anthropic Messages API format.

Changes:

  • Created a type MessageRole representing roles in messages: 'system', 'user', 'assistant'.
  • Defined an interface TextContent for text message structure.
  • Defined an interface ToolUseContent for tool usage messages.
  • Defined an interface ToolResultContent for tool result messages.
  • Created a union type ContentBlock to encapsulate different content types.
  • Defined a base interface Message for general message structure.
  • Extended Message interface to create SystemMessage, UserMessage, and AssistantMessage with role-specific attributes.

src/agent/types/response_schema.ts

Added a JSON schema for agent responses to standardize output format.

Changes:

  • Created an exportable constant AGENT_RESPONSE_SCHEMA for defining the structure of agent responses.
  • Defined properties for the agent response, including a string response and an array of tool calls.
  • Specified the required properties and their types for both the response and tool calls.
  • Included descriptions for each property to enhance clarity and usage.
  • Implemented strict mode validation by setting additionalProperties to false.

src/agent/types/tool_types.ts

Added type definitions for tools in the Agent SDK.

Changes:

  • Introduced the ToolDefinition interface to define tools with a name, description, and input schema.
  • Added the ToolCall interface representing a call to a tool with an id and input parameters.
  • Defined the ToolResult interface to encapsulate the result of a tool call, including error handling.
  • Created the ToolExecutionResult interface to represent the outcome of the tool execution, indicating success or failure.

src/agent/utils

src/agent/utils/error_handler.ts

Added error handling classes and functionality for the Agent SDK.

Changes:

  • Introduced AgentError class for custom error representation.
  • Created specialized error classes: ToolExecutionError, APIError, and ValidationError.
  • Implemented the ErrorHandler class for managing and formatting errors.
  • Added static method handle to convert unknown errors to AgentError.
  • Added static method isRetryable to determine if an error is retryable based on status codes.

src/agent/utils/index.ts

Introduced an index file to export all utility functions.

Changes:

  • Added documentation comment for exporting utilities.
  • Exported all utility functions from response_parser, prompt_builder, and error_handler.

src/agent/utils/prompt_builder.ts

Added a new prompt builder class for Agent SDK to construct prompts with tool definitions and conversation history.

Changes:

  • Introduced the PromptBuilder class to create formatted prompts.
  • Implemented the buildPrompt method to generate a prompt from incoming messages and tools.
  • Added support for system messages and a simplified representation of available tools.
  • Included function to limit conversation history to the last five messages.
  • Created a message formatting function to handle different message types (text, tool use, tool result).
  • Defined a schema for the expected response in JSON format.

src/agent/utils/response_parser.ts

Added a new response parser for handling OpenRouter JSON responses.

Changes:

  • Implemented a ResponseParser class for parsing JSON responses.
  • Defined a static method parse to process the response structure.
  • Included error handling for invalid response formats.
  • Extracted text and reasoning from the response object.
  • Parsed tool calls into the response if present, including validation.
  • Introduced a private method generateToolCallId for generating unique IDs for tool calls.
  • Added a validate method to check the integrity of parsed responses.

src

src/agent_tester.ts

Added a new agent tester script with various testing commands for the Agent SDK.

Changes:

  • Introduced a command-line interface using Commander for testing the Agent SDK.
  • Implemented multiple testing commands including testing simple prompts, file reading, full tool integration, streaming, permissions, sessions, metrics, budget limits, retry logic, and all features.
  • Added error handling and success messages for each command execution.
  • Integrated Git repository information retrieval to enhance the functionality of certain tests involving file access.
  • Allowed customization of test parameters through command-line options such as prompt, model, API key, and other specific settings.

src/agent_tester_commands.ts

Added comprehensive command testing suite for the Agent SDK.

Changes:

  • Registered various test commands to test the Agent SDK with different functionalities, including simple tests, file-based tests, full tests with multiple tools, and others.
  • Implemented detailed logging for prompts, model info, and results of the tests.
  • Added commands to test streaming, permissions (blocklist), session persistence, metrics tracking, budget limits, retry logic, and all features.
  • Included error handling for scenarios like missing API keys and repository information.
  • Utilized various tools for reading files, searching files, proposing changes, and managing TODOs within the SDK.

src/cli.ts

Enhanced CLI with additional commands and improved functionality.

Changes:

  • Added imports for new command registration functions: registerAgentTestCommands, registerMCPTestCommands, registerSubAgentTestCommands, and registerTECTestCommands.
  • Modified the build-ai command to include an optional branch name parameter and updated welcome messages.
  • Introduced a new command check-progress to check the progress of a specified issue, including validation for the issue number and optional branch name.
  • Added a setup command for initial setup tasks including creating labels and verifying access, with appropriate messages before execution.
  • Updated the logging within the think command to comment out the logging action.

src/mcp_tester_commands.ts

Added MCP Tester Commands for testing multiple transport methods and tool execution.

Changes:

  • Created a new file src/mcp_tester_commands.ts to handle MCP testing commands.
  • Implemented command to test MCP connection via stdio transport.
  • Implemented command to test MCP connection via HTTP transport.
  • Implemented command to test MCP using a configuration file (.mcp.json).
  • Implemented command to test execution of MCP tools.
  • Added necessary options for API key, model selection, command, prompts, and tool execution parameters.
  • Included error handling and logging for each command to ensure better user feedback.

src/sub_agent_tester_commands.ts

Added a comprehensive CLI command module for testing SubAgent functionalities.

Changes:

  • Created a new file for SubAgent Tester commands with multiple test commands.
  • Implemented command to test subagent creation with options for model, API key, name, prompt, and query.
  • Added command for testing parallel execution of subagents with customizable parameters.
  • Introduced command for testing coordinated execution of subagents with dependency management.
  • Added a command to test context sharing between subagents.
  • Included a command for testing subagents equipped with specific tools.
  • Implemented logging functionality for better tracking and error handling throughout command execution.

src/tec_tester_commands.ts

Added CLI commands for testing error detection system using the Agent SDK.

Changes:

  • Created a new file to implement CLI commands for TEC (TypeScript Error Checker).
  • Imported necessary libraries and modules including dotenv, github, and commander.
  • Added functions to load environment variables and fetch Git repository information.
  • Implemented command tec:detect-errors for detecting errors in the codebase with various options.
  • Implemented command tec:quick-check for a faster error check with fewer turns.
  • Included logging mechanisms to provide user feedback during execution of commands.
  • Integrated detailed output formatting for error summaries and detected errors.

src/data/model

src/data/model/execution.ts

Commented out logging of current configuration for cleaner output.

Changes:

  • Commented out the logging statement that outputs the current configuration.

src/data/model/single_action.ts

Enhanced SingleAction class by adding new actions and corresponding checks.

Changes:

  • Added new actions to the actions array: INITIAL_SETUP and CHECK_PROGRESS.
  • Updated actionsThrowError to include INITIAL_SETUP.
  • Updated actionsWithoutIssue to include INITIAL_SETUP.
  • Introduced new getter method isInitialSetupAction to check for INITIAL_SETUP action.
  • Introduced new getter method isCheckProgressAction to check for CHECK_PROGRESS action.

src/data/model/think_response_schema.ts

Enhanced JSON schema with stricter validation rules and additional properties for TODO updates.

Changes:

  • Added 'additionalProperties: false' to the analyzed_files and proposed_changes schemas.
  • Updated required fields for proposed_changes to include 'suggested_code'.
  • Modified the description of todo_updates to emphasize restrictions and clarify rules regarding TODO creation and updates.
  • Added required fields to todo_updates to ensure 'create' and 'update' are mandatory.
  • Updated required fields in the main schema to include additional properties for improved validation.

src/data/repository

src/data/repository/ai_repository.ts

Enhanced AI repository methods with support for streaming responses and improved configurations.

Changes:

  • Commented out debug logging to reduce log clutter.
  • Added optional parameters for streaming and chunk handling to askJson method.
  • Introduced a new private method handleStreamingResponse for managing API streaming responses.
  • Adjusted askJson to include a max_tokens limit in the request body.
  • Configured the strict option in response format to be customizable rather than hardcoded.
  • Modified askThinkJson to accept an array of messages for conversation history and maintain backward compatibility.

src/data/repository/file_repository.ts

Refactored file retrieval process to clone repositories and read files directly from the filesystem, improving performance and adding error handling.

Changes:

  • Replaced GitHub API file retrieval with a local clone of the repository using Git.
  • Introduced async file system operations using fs/promises for reading files.
  • Added a method to normalize file paths for consistency.
  • Implemented error handling for empty tokens and detailed error logging.
  • Removed unnecessary imports and types related to code block extraction.
  • Introduced a cleanup step for temporary directories after file operations.

src/data/repository/issue_repository.ts

Enhanced issue and label management functionalities by adding new methods for listing, creating, and ensuring labels and issue types.

Changes:

  • Added method listLabelsForRepo to list all labels for a repository.
  • Added method createLabel to create a label in a repository.
  • Added method ensureLabel to check if a label exists, creating it if it doesn't.
  • Added method ensureLabels to ensure all required labels exist based on a configuration.
  • Added method listIssueTypes to list all issue types for an organization.
  • Added method createIssueType to create an issue type for an organization.
  • Added method ensureIssueType to check if an issue type exists, creating it if it doesn't.
  • Added method ensureIssueTypes to ensure all required issue types exist based on a configuration.

src/data/repository/supabase_repository.ts

Enhanced the SupabaseRepository class with additional error management features and new methods for better cache handling.

Changes:

  • Added new properties to AICachedFileInfo interface to track error metrics.
  • Updated setAIFileCache method to include error metrics in the cache.
  • Introduced getDistinctBranches method to fetch unique branches for a specified owner/repository.
  • Implemented getAIFileCacheBySha method to retrieve cached file information based on SHA across branches.
  • Created verifyTableExists and verifyRpcFunctionExists methods for checking the existence of tables and RPC functions in Supabase.

src/usecase/actions

src/usecase/actions/check_progress_use_case.ts

Introduced a new use case for checking the progress of an issue based on branch changes, incorporating AI analysis for progress detection.

Changes:

  • Created the CheckProgressUseCase class implementing ParamUseCase<Execution, Result[]>.
  • Imported necessary modules including Execution, Result, logging utilities, and repositories.
  • Implemented the invoke method to check the progress of an issue.
  • Added error handling for missing AI configurations and issue numbers.
  • Integrated functionality to search for branches related to the issue number.
  • Implemented logic to compare branches and collect changed files.
  • Incorporated a shouldIgnoreFile method to manage files based on ignore patterns.
  • Utilized AI via ProgressDetector for analyzing progress based on changes.
  • Logged key information and errors to track the workflow of the use case.

src/usecase/actions/initial_setup_use_case.ts

Added InitialSetupUseCase to perform setup operations including GitHub access verification, label creation, and Supabase configuration.

Changes:

  • Created the InitialSetupUseCase class implementing the ParamUseCase interface.
  • Implemented the invoke method which orchestrates the setup process.
  • Added methods for verifying GitHub access, ensuring labels, ensuring issue types, and verifying Supabase setup.
  • Included detailed logging to capture the execution flow and errors.
  • Managed success and error states using the Result model.

src/usecase/actions/vector_action_use_case.ts

Enhanced the VectorActionUseCase by implementing multi-branch processing and error detection.

Changes:

  • Added support for processing multiple branches in the method invoke. The method now retrieves a list of branches if none is provided.
  • Refactored the logic within invoke to handle branch processing efficiently, accumulating results for each processed branch.
  • Created a new method prepareCacheOnBranch to encapsulate the logic for preparing AI cache on a specified branch.
  • Implemented a new method removeOrphanedBranches to clean up AI cache entries for branches that no longer exist in GitHub.
  • Introduced error detection functionality using the ErrorDetector class, analyzing code quality and potential issues for each file.
  • Updated the logic for file processing to include error counters and associated metadata, enhancing the results returned.

src/usecase

src/usecase/single_action_use_case.ts

Enhanced SingleActionUseCase by adding InitialSetup and CheckProgress actions.

Changes:

  • Imported InitialSetupUseCase and CheckProgressUseCase.
  • Added conditional branches for handling initial setup and check progress actions in the invoke method.

src/usecase/steps/common/services

src/usecase/steps/common/services/file_cache_manager.ts

Removed the debug logging of cached paths after loading from Supabase.

Changes:

  • Deleted the block of code logging sampled cached paths after loading them from Supabase.
  • Maintained all other functionalities and methods intact.

src/usecase/steps/common/services/file_search_service.ts

Enhanced search functionality to include content searches and improved code readability.

Changes:

  • Updated the searchFiles method to accept an optional repositoryFiles parameter.
  • Modified the searchFiles method description to reflect the inclusion of content search.
  • Introduced a case-insensitive search for file content when the repositoryFiles parameter is provided.
  • Refactored the comparison logic to avoid repeated calls to toLowerCase(), improving efficiency.

src/usecase/steps/common

src/usecase/steps/common/think_todo_manager.ts

Commented out logging statements for updated TODOs to reduce console output.

Changes:

  • Commented out the logInfo statement that logs the status change of a TODO item.
  • Commented out the logDebugInfo statement that logs the update of TODO notes/metadata.

src/usecase/steps/common/think_use_case.ts

Refactored the ThinkUseCase to remove direct dependencies on several services and introduced a ReasoningVisualizer for output.

Changes:

  • Removed references to AiRepository, ThinkCodeManager, ThinkTodoManager, FileImportAnalyzer, FileCacheManager, CodebaseAnalyzer, FileSearchService, and CommentFormatter.
  • Introduced ReasoningVisualizer to handle output responses.
  • Condensed the invoke method by directly retrieving issue descriptions instead of using the getIssueDescription method.
  • Simplified the logic that initializes variables and handles question prompts.

src/usecase/steps/common/think_use_case_2.ts

Added a new use case for handling AI-driven code analysis and reasoning, enhancing the overall functionality.

Changes:

  • Introduced ThinkUseCase class responsible for managing code analysis tasks.
  • Implemented asynchronous processing of AI reasoning involving multiple iterative steps.
  • Added error handling to manage cases when no valid question is provided or API keys are missing.
  • Included logging mechanisms to track progress and issues during reasoning.
  • Integrated various services like FileImportAnalyzer, FileCacheManager, CodebaseAnalyzer, and others to modularize the functionality.
  • Established a mechanism to propose changes based on the analysis and manage TODOs efficiently.

src/utils

src/utils/constants.ts

Added new actions for the workflow management system.

Changes:

  • Introduced action 'INITIAL_SETUP' to represent the initial setup process.
  • Added action 'CHECK_PROGRESS' to facilitate checking the progress of ongoing workflows.

src/utils/logger.ts

Enhanced logging system to support structured logging and additional metadata.

Changes:

  • Added a new interface LogEntry to represent structured log entries.
  • Introduced a new function setStructuredLogging to enable or disable structured logging.
  • Created a helper function formatStructuredLog to format log entries in JSON.
  • Modified logInfo function to accept optional metadata and structured logging.
  • Created logWarn function to streamline warning logs and support structured logging.
  • Updated the logWarning function to call logWarn instead.
  • Revised logError function to handle error messages and metadata with structured logging.
  • Altered logDebugInfo to support metadata and handle structured logging.
  • Refactored logging calls across various functions to utilize structured logging when enabled.

src/utils/reasoning_visualizer.ts

Added a new ReasoningVisualizer class for visualizing the reasoning process in an AI system.

Changes:

  • Introduced the ReasoningVisualizer class with methods for initializing, updating stats, and displaying progress.
  • Implemented methods to show task headers, iteration status, TODOs, general statistics, action results, and completion summaries.
  • Added visual progress bars and emoji representations for different actions.
  • Utilized chalk for colored output in the console.
  • Included methods to handle and visualize various stats related to files read, analyzed, and changes applied.

supabase/migrations

supabase/migrations/20240321000000_create_chunks_table.sql

Removed the entire SQL migration file containing the definition and management of the chunks table.

Changes:

  • Removed the creation of the vector extension.
  • Deleted the chunks table definition including all its fields and constraints.
  • Removed the vector similarity search index for the chunks table.
  • Deleted multiple functions for chunk management including: match_chunks, update_updated_at_column, get_distinct_paths, delete_branch_entries, delete_branch_path_entries, duplicate_branch_entries, duplicate_file_entries, count_branch_entries, and get_vector_of_chunk_content.
  • Eliminated the trigger for updating the updated_at timestamp on the chunks table.

supabase/migrations/20240322000000_create_ai_file_cache_table.sql

Updated the ai_file_cache table schema to include error tracking fields and changed default array initialization.

Changes:

  • Changed default values for 'consumes' and 'consumed_by' from '{}' to 'ARRAY[]::TEXT[]'.
  • Added new columns: 'error_counter_total', 'error_counter_critical', 'error_counter_high', 'error_counter_medium', 'error_counter_low', 'error_types', and 'errors_payload'.
  • Updated return types in functions to include new error tracking fields.
  • Modified various functions to handle new error tracking fields in insert and update operations.

supabase/migrations/20240322000001_add_error_columns_to_ai_file_cache.sql

Added new error-related columns to the ai_file_cache table and updated associated functions.

Changes:

  • Introduced seven new columns to the ai_file_cache table: error_counter_total, error_counter_critical, error_counter_high, error_counter_medium, error_counter_low, error_types, and errors_payload.
  • Set default values for the new columns for existing rows in the ai_file_cache table.
  • Dropped and recreated three functions (get_ai_file_cache, get_ai_file_caches_by_branch, duplicate_ai_file_cache_by_branch) to include new columns.
  • Updated return tables in the modified functions to cover the new error-related columns.

test-mcp-server

test-mcp-server/index.js

Added a new MCP server implementation that supports various tools for testing.

Changes:

  • Created a simple MCP server that uses the Model Context Protocol over stdio.
  • Implemented tool functionalities like echo, add, get_time, and reverse.
  • Added JSON-RPC handling for methods like initialize, tools/list, tools/call, resources/list, and prompts/list.
  • Included error handling for invalid requests and internal errors.
  • Set up graceful handling for stdin close and process termination signals.

…issue types

Added a new CLI command for initial setup, allowing users to create labels, issue types, and verify access to GitHub and Supabase. This enhancement improves the onboarding process and ensures necessary configurations are in place for optimal functionality. Updated related classes and constants to support the new action, streamlining the setup workflow.
…se issue template

Changed the default OpenRouter model from "deepseek/deepseek-chat" to "anthropic/claude-3.5-haiku" in action.yml. Updated the release issue template to reflect the correct team name from "git-board-flow" to "giik". These changes ensure accurate configuration and communication within the project.
Introduced new inputs for Anthropic API key and model in action.yml. Updated the AI class to handle the new parameters and modified GitHub and local action scripts to utilize these inputs. Enhanced the ThinkUseCase to delegate processing to the Claude model when detected, improving AI operation capabilities. Added necessary constants for the new inputs to streamline integration.
Added new properties for Anthropic API key and model in the Ai class, along with corresponding methods to retrieve them. Updated the constructor to accept these new parameters. Enhanced the ThinkUseCase to validate and utilize the Anthropic model, improving AI processing capabilities. Introduced new constants for the Anthropic API key and model in the constants file, and updated CLI options to support these configurations. This update streamlines the integration of the Anthropic API into the workflow.
…issues

Updated the build scripts to exclude the Anthropic Agent SDK from the bundle using the --external flag in ncc. Modified the ThinkAsClaudeUseCase and related files to dynamically import the SDK at runtime, ensuring compatibility with ES module requirements. This change enhances the integration of the SDK while preventing bundling errors, improving the overall functionality of the AI processing capabilities.
…uration

Removed fallback logic to standard ThinkUseCase and updated error handling to ensure that the ThinkAsClaudeUseCase explicitly requires a valid Anthropic API key and model configuration. Enhanced logging for better error reporting when the Agent SDK fails to execute. This change streamlines the integration process and clarifies the requirements for using the Anthropic API.
…mmands

Added "type": "module" to package.json to enable ES module support. Updated tsconfig.json to use "module": "ESNext" and added "moduleResolution": "node". Refactored CLI scripts to utilize ES module imports, improving compatibility and performance. Enhanced CLI commands for building AI containers and deep code analysis, streamlining user interaction and functionality.
…N_SCHEMA validation

Changed the default OpenRouter model in action.yml from "anthropic/claude-3.5-haiku" to "openai/gpt-5-codex". Additionally, updated the THINK_RESPONSE_JSON_SCHEMA to enforce stricter validation by adding required fields and disallowing additional properties in various response structures. These changes improve the configuration accuracy and data integrity within the project.
…sitory and think use case

Changed the default OpenRouter model in action.yml from "openai/gpt-5-codex" to "openai/gpt-4.1". Commented out sensitive logging information in the AiRepository to improve security. In the ThinkUseCase, added mechanisms to track read files and prevent reading the same files multiple times, enhancing the reasoning process and providing clearer warnings for users. These changes aim to improve the overall functionality and security of the AI-driven workflows.
Removed the "type": "module" entry from package.json and changed the module type in tsconfig.json to "commonjs" for compatibility. Updated build scripts to exclude the Anthropic Agent SDK and removed unnecessary files related to the CLI and GitHub action, including action.yml, auth.proto, and various proto files. Enhanced the THINK_RESPONSE_JSON_SCHEMA by adding additionalProperties constraints to improve validation. These changes streamline the project structure and enhance compatibility with existing workflows.
Updated the default OpenRouter model in action.yml from "openai/gpt-4.1" to "openai/gpt-4.1-nano" for improved performance. Refactored the askThinkJson method in AiRepository to support conversation history by accepting an array of messages or a single prompt, enhancing the AI's contextual understanding. Additionally, modified the ThinkUseCase to maintain a conversation history, allowing for more coherent interactions and better error handling during reasoning steps. These changes aim to improve the overall functionality and user experience of the AI-driven workflows.
…logic

Modified the THINK_RESPONSE_JSON_SCHEMA to clarify the rules regarding TODO item creation and updates, emphasizing that new TODOs can only be created in the first iteration. Updated the ThinkUseCase to implement stricter handling of TODO updates, ensuring that attempts to create new TODOs after the first iteration are logged but not processed. Enhanced the visual feedback mechanism for the reasoning process, allowing for better tracking of iterations and actions taken. These changes aim to improve the clarity and functionality of the AI-driven workflows.
…status updates

Added functionality to the ThinkUseCase to link files to active TODOs based on relevant keywords in file paths and content. Improved the reporting of active TODOs by including a status summary and context for related files, highlighting read and unread files, and suggesting potentially relevant files. These enhancements aim to improve task management and user awareness of TODO progress within the workflow.
Implemented critical checks in the ThinkTodoManager to prevent completion actions if there are active TODOs. Enhanced user feedback by providing detailed status updates on active TODOs, including reminders to complete or cancel all tasks before proceeding. Updated documentation to reflect these changes, emphasizing the importance of systematic completion and the handling of related files. These improvements aim to streamline task management and ensure clarity in the workflow process.
…hods

Removed unnecessary properties and methods from the ThinkUseCase class, including AI-related repositories and various service managers that were not utilized. This streamlining aims to enhance code clarity and maintainability, focusing on the essential functionality of the use case. Additionally, updated the version number in the GitHub action and CLI files to reflect the changes made.
Commented out unnecessary logging statements in the ThinkUseCase, CLI, and ReasoningVisualizer to reduce clutter in the output. This change aims to streamline the logging process and improve code readability while maintaining essential functionality. The updates enhance the overall clarity of the codebase.
Removed debug logging statements in the Execution class across CLI and GitHub action files to reduce output clutter. This change aims to enhance code readability while preserving essential functionality.
Implemented a new method in the SupabaseRepository to retrieve AI file cache entries by SHA, allowing for the reuse of descriptions across branches. This enhancement improves the efficiency of the AI caching process by enabling the system to leverage existing data, thereby reducing redundant processing. Additionally, refactored the VectorActionUseCase to streamline cache preparation across multiple branches, enhancing overall functionality and maintainability.
Implemented a new method in the VectorActionUseCase to identify and remove orphaned branches from the Supabase AI file cache that no longer exist in GitHub. This enhancement improves data integrity and optimizes the cache management process. Additionally, added a method in SupabaseRepository to retrieve distinct branches for a given owner and repository, facilitating the orphan branch cleanup process.
…sitories

Eliminated several unused methods from the FileRepository class, including code block extraction and SHA calculation, to streamline the codebase. Introduced a new method in the SupabaseRepository to retrieve distinct branches for a given owner and repository, facilitating better management of orphaned branches. Additionally, updated the VectorActionUseCase to incorporate the new orphan branch removal functionality, improving cache management and data integrity.
Enhanced the FileRepository class to clone GitHub repositories using a temporary directory and read files directly from the filesystem. This update replaces the previous method of fetching repository content via the GitHub API, improving performance and allowing for more efficient file handling. Added error handling for file reading and ensured cleanup of temporary directories after operations.
…pository

Added a new method to normalize file paths in the FileRepository class, ensuring consistent comparison with cached entries. Commented out several logging statements related to repository cloning and cleanup to reduce output clutter. This update enhances code clarity and maintains essential functionality while improving path handling during file operations.
Updated the prepareCacheOnBranch method to include detailed tracking of file processing metrics such as files processed, reused, skipped, generated, and removed. Improved logging to provide clearer progress updates for each branch during cache preparation. This refactor enhances the overall clarity and maintainability of the code while ensuring better monitoring of the caching process across multiple branches.
Introduced new CLI commands for testing the Agent SDK, including simple tests, file reading, and full tests with all tools. Enhanced the AiRepository class to support a maximum token limit for API requests, improving response handling. Updated the build process to ensure compatibility with the new testing features. This update aims to facilitate easier testing and validation of the Agent SDK functionalities.
Added detailed logging for tool execution in the ReasoningLoop and ManageTodosTool classes, providing insights into tool inputs, success status, and error messages. Updated the ManageTodosTool to accept multiple input fields for task descriptions, improving user flexibility. Adjusted conversation history handling in the PromptBuilder to include the last five messages and refined formatting for better readability. Enhanced error handling in the FileRepository to streamline repository content retrieval and cleanup processes.
Updated the Supabase repository and related components to include new error tracking fields in the AI file cache, such as error counters and types. Enhanced the VectorActionUseCase to detect and store error information for files, improving the overall error analysis process. Additionally, modified the SQL migration script to accommodate these new fields, ensuring the database structure supports comprehensive error reporting. This update aims to provide better insights into file errors and improve the robustness of the error detection system.
Enhanced the system prompt and error detection logic in the SystemPromptBuilder and VectorActionUseCase to provide clearer instructions for analyzing a single file. Added critical guidelines to ensure that errors are reported only once and that a final summary is provided after the analysis. This update aims to improve the accuracy and efficiency of error detection processes by preventing redundant error reporting and clarifying the expected workflow.
…ion prompts

Introduced a new command-line option for specifying the branch name during AI cache indexing. Updated the error detection prompts to use a structured format, enhancing clarity and preventing redundant error reporting. This change aims to improve the user experience and accuracy of error analysis in single file operations.
Updated the AgentInitializer to require a repository branch for loading files, throwing an error if not provided. Removed the default branch fetching logic to streamline the process and enhance clarity in error handling. This change aims to improve user experience by ensuring that necessary parameters are explicitly defined before file operations are attempted.
…tection

Refactored the AgentInitializer and related components to retrieve the GitHub Personal Access Token from options instead of the environment. Enforced the requirement for a repository branch, throwing an error if not provided. Enhanced logging to clarify token status and repository loading processes. This update aims to improve user experience by ensuring necessary parameters are explicitly defined and providing clearer feedback during error detection operations.
…nents

Eliminated the anthropic API key and model from the AI class and related components, streamlining the codebase. Updated the action.yml and constants to reflect these changes, ensuring that only the OpenRouter API key and model are utilized. This refactor aims to simplify the AI integration and improve maintainability.
Enhanced error handling in the AI components by refining the logging mechanisms and clarifying error messages. This update aims to provide better insights during error detection processes and improve overall user experience by ensuring that errors are reported more effectively.
Introduced a new command for checking the progress of an issue based on code changes. Implemented the CheckProgressUseCase to analyze the progress by loading repository files and determining changes against the development branch. Enhanced logging for better insights during the progress detection process and updated the SingleAction model to include the new action. This update aims to improve user experience by providing a clear mechanism for tracking issue progress.
…vior

Updated the CheckProgressUseCase across multiple files to set useSubAgents to false, ensuring consistent behavior during progress analysis. This change aims to improve the accuracy of the progress detection logic by eliminating the use of sub-agents.
Renamed the single-action parameter in the gbf_check_progress.yml workflow from 'check_progress' to 'check_progress_action' to enhance clarity and better reflect its purpose. This change aims to improve the readability and maintainability of the workflow configuration.
@docs-page

docs-page Bot commented Nov 16, 2025

Copy link
Copy Markdown

To view this pull requests documentation preview, visit the following URL:

docs.page/landamessenger/git-board-flow~275

Documentation is deployed and generated using docs.page.

@elisalopez elisalopez changed the title Feature/274 add cli setup commands for initial configuration [#274] ✨ - Add CLI setup commands for initial configuration Nov 16, 2025
@elisalopez
elisalopez self-requested a review November 16, 2025 12:29
@elisalopez elisalopez moved this to In Progress in vypdev Nov 16, 2025
@elisalopez
elisalopez changed the base branch from develop to master November 16, 2025 12:29
@efraespada efraespada linked an issue Nov 16, 2025 that may be closed by this pull request
1 task done
@elisalopez
elisalopez changed the base branch from master to develop November 16, 2025 12:30
@elisalopez elisalopez added enhancement New feature or request branched Indicates that a branch has been created for this issue. size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete. priority: low Not urgent, can be addressed later. labels Nov 16, 2025
@elisalopez

Copy link
Copy Markdown
Contributor

✨ Feature Actions

  1. The pull request's title was updated from Feature/274 add cli setup commands for initial configuration to [#274] ✨ - Add CLI setup commands for initial configuration.
  2. The pull request was assigned to @efraespada (creator).
  3. @elisalopez was requested to review the pull request.
  4. The pull request was linked to Landa Messenger Development and moved to the column In Progress.
  5. The base branch was temporarily updated to master.
  6. The description was temporarily modified to include a reference to issue ✨🧑‍💻 - Add CLI setup commands for initial configuration #274.
  7. The base branch was reverted to its original value: develop.
  8. The temporary issue reference ✨🧑‍💻 - Add CLI setup commands for initial configuration #274 was removed from the description.
  9. Priority set to P2 in Landa Messenger Development.
  10. More than 1000 lines changed, so the pull request was resized to size: XXL.
  11. The description has been updated with AI-generated content.

image

🚀 Happy coding!

@efraespada
efraespada merged commit 5851f61 into develop Nov 16, 2025
15 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in vypdev Nov 16, 2025
@elisalopez

Copy link
Copy Markdown
Contributor

✨ Feature Actions

  1. ✨🧑‍💻 - Add CLI setup commands for initial configuration #274 was automatically closed after merging this pull request.

image

🚀 Happy coding!

@efraespada
efraespada deleted the feature/274-add-cli-setup-commands-for-initial-configuration branch September 8, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branched Indicates that a branch has been created for this issue. enhancement New feature or request priority: low Not urgent, can be addressed later. size: XXL Indicates an extremely large task or issue that requires significant time and effort to complete.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

✨🧑‍💻 - Add CLI setup commands for initial configuration

2 participants