Merged
Conversation
…ssenger/git-board-flow into chore/239-improve-asking
…ssenger/git-board-flow into chore/239-improve-asking
…ssenger/git-board-flow into chore/239-improve-asking
…e askJson method to utilize it for structured responses
Implemented a new CLI command 'think' that allows users to perform deep code analysis and receive change proposals based on AI reasoning. This includes options for issue processing, branch selection, and various AI configurations. The command integrates with the AI repository to fetch structured responses and utilizes a JSON schema for the AI's reasoning process.
…ogging in 'think' command Updated the 'think' command to include a helper function for cleaning CLI arguments, ensuring proper handling of inputs with '=' prefixes. Improved logging for file search and reading operations, providing clearer feedback on search results and file processing. Adjusted issue number parsing to ensure defaults are handled correctly.
…sis capabilities Increased the maximum iterations for analysis from 10 to 30 and the maximum files to analyze from 20 to 50, allowing for deeper code analysis. Introduced a new limit for consecutive searches without progress, set to 3, to enhance user guidance during file searches. Updated logging and context messages to provide clearer feedback and suggestions based on search results and analysis progress.
…ent formatting Updated the 'think' command to improve the analysis process by adding new private methods for formatting reasoning comments and handling proposed changes. Enhanced logging for better visibility of actions taken during analysis. Removed unused variables and methods to clean up the codebase, ensuring a more efficient implementation.
Added support for managing TODO items within the 'think' command, allowing users to create and update tasks as part of the analysis process. Introduced a new schema for TODO updates, enabling the AI to track progress on tasks and provide structured feedback. Improved the reasoning process by integrating TODO management, ensuring a more organized approach to code analysis and task completion.
Updated the comment generation process in the 'think' command and GitHub Action to improve clarity and organization. Introduced sections for final analysis, proposed changes, and detailed reasoning steps, with collapsible content for better readability. Enhanced the handling of TODO lists and file analysis summaries, ensuring a more structured output for users. This refactor aims to streamline the analysis process and provide comprehensive insights into the code evaluation.
Enhanced the 'think' command and GitHub Action to detect programming languages from file paths, improving the formatting of suggested code snippets. Removed redundant context sections in comments for better clarity. This update aims to streamline the output and enhance user experience by providing more accurate code representations.
Added a new functionality to the 'think' command that generates a detailed codebase analysis, including file descriptions and relationships. This feature enhances the reasoning process by providing context about the code structure before the main analysis loop. Introduced a JSON schema for structured responses and improved the askJson method to accommodate schema parameters. This update aims to facilitate better understanding and navigation of the codebase during analysis.
…capabilities Updated the 'think' command to include new methods for extracting imports from various programming languages and resolving relative import paths. Introduced caching mechanisms to store and retrieve file analysis data, improving performance and efficiency during codebase analysis. This refactor aims to streamline the analysis process and provide more accurate insights into file dependencies and relationships.
Eliminated Docker-related inputs and configurations from the action and execution models, streamlining the codebase. Updated the CLI and action files to reflect the removal of Docker dependencies, enhancing clarity and reducing complexity. This refactor aims to simplify the overall architecture and improve maintainability.
Eliminated the classic token input from the action configuration and all related workflows, streamlining authentication processes. Updated the codebase to reflect this change, enhancing clarity and reducing complexity in token management. This refactor aims to simplify the overall architecture and improve maintainability.
Refactored the SupabaseRepository to replace the chunked file management system with a dedicated AI file cache. Introduced new methods for setting, retrieving, and managing AI file cache entries, enhancing the efficiency of file analysis and storage. Updated related use cases to utilize the new caching mechanism, improving overall performance and maintainability of the codebase.
…ion use case Updated the VectorActionUseCase to implement a structured schema for AI-generated file descriptions, improving the accuracy and consistency of descriptions. Enhanced the caching mechanism to track files needing analysis based on SHA mismatches and cache misses, providing better insights into the analysis process. Additionally, integrated a new prompt for detailed codebase analysis, streamlining the AI's understanding of file functionalities. This refactor aims to improve the overall efficiency and clarity of the code analysis workflow.
…case Refactored the VectorActionUseCase to delegate responsibilities to dedicated services for file import analysis, caching, and codebase analysis. Introduced FileImportAnalyzer, FileCacheManager, and CodebaseAnalyzer to streamline the extraction of imports, SHA calculation, and description generation. This modular approach enhances code maintainability and clarity, while improving the overall efficiency of the analysis workflow. Additionally, removed redundant methods from the use case, consolidating functionality into the new services.
Enhanced the FileCacheManager and VectorActionUseCase to include a normalization process for file paths, ensuring consistent comparison and storage. Introduced a private method to normalize paths by removing leading './' and standardizing separators. Updated relevant methods to utilize normalized paths for cache lookups and storage, improving the reliability of file caching and analysis processes. Additionally, added logging for cache misses and potential path mismatches to aid in debugging.
…workflows Added support for OpenRouter API configuration in the CLI and VectorActionUseCase, allowing for dynamic API key and model input through environment variables. Updated the logging mechanism to enhance debugging capabilities by commenting out sensitive information. Removed the deprecated ChunkedFileChunk model to streamline the codebase, ensuring a more efficient file handling process. This refactor aims to improve the overall functionality and maintainability of the AI-driven workflows.
Removed the ChunkedFile model and associated methods from the codebase, replacing them with a dedicated AI cache management system. Updated the VectorActionUseCase and related classes to utilize the new AI cache methods for file handling, enhancing performance and maintainability. Adjusted logging messages to reflect the new terminology and improved clarity in cache operations. This refactor aims to streamline the AI-driven workflows and improve overall code efficiency.
…or consistency Updated the codebase to replace references to vector actions with AI cache actions, enhancing clarity and consistency across the application. This includes renaming methods, constants, and descriptions in the CLI and related classes. The changes aim to streamline the AI cache management process and improve overall code maintainability.
|
To view this pull requests documentation preview, visit the following URL: docs.page/landamessenger/git-board-flow~272 Documentation is deployed and generated using docs.page. |
Closed
1 task
Contributor
🔧 Chore Actions
🚀 Happy coding! |
Contributor
🔧 Chore Actions
🚀 Happy coding! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


#239
What does this PR do?
This pull request addresses the issue where the "Ask" feature is not yet functional. The changes included in this PR aim to implement the necessary components and logic to ensure the feature operates as expected. By completing this task, the feature will be ready for use, providing the intended functionality to users. This enhancement aligns with the expected impact of having a fully working feature, resolving the current inefficiency where the feature is non-operational.
Summary of Changes
classic-tokeninput from the workflow.classic-tokeninput from GitHub workflow.classic-tokeninput from the workflow.classic-tokeninput from the workflow.ChunkedFileclass.ChunkedFileChunkclass and its associated logic.SingleActionclass to replaceVECTORrelated actions withAI_CACHEandTHINKactions.askThinkJsonmethod.AskActionUseCasewithThinkUseCase.AskActionUseCasehas been removed.FileCacheManagerto handle AI file caching in Supabase.FileSearchServiceclass for building file indexes and searching files.ThinkCodeManagerto manage virtual code state by applying proposed changes and tracking modifications.ThinkTodoManagerto manage TODO list functionality for the reasoning process, including creation, updating, and tracking of TODOs.Detailed Changes
action.ymlRemoved deprecated Docker and classic token configurations.
Changes:
classic-tokeninput field.docker-container-name,docker-domain,docker-port,docker-cache-os, anddocker-cache-arch.package.jsonUpdated the binary command name in bin configuration.
Changes:
git-board-flowtogiik..github/workflows
.github/workflows/gbf_commit.ymlRemoved the
classic-tokeninput from the workflow.Changes:
classic-tokeninput, which was previously sourced fromsecrets.CLASSIC_TOKEN..github/workflows/gbf_issue.ymlRemoved unused
classic-tokeninput from GitHub workflow.Changes:
classic-token: ${{ secrets.CLASSIC_TOKEN }}..github/workflows/gbf_issue_comment.ymlRemoved the 'classic-token' input from the workflow.
Changes:
classic-token: ${{ secrets.CLASSIC_TOKEN }}..github/workflows/gbf_pull_request.ymlRemoved the
classic-tokeninput from the workflow.Changes:
classic-token: ${{ secrets.CLASSIC_TOKEN }}line.classic-tokenis no longer required for the job configuration..github/workflows/gbf_pull_request_review_comment.ymlRemoved the
classic-tokeninput from the workflow.Changes:
classic-token: ${{ secrets.CLASSIC_TOKEN }}line..github/workflows/gbf_update_ai_knowledge.ymlSimplified the GitHub workflow by removing unnecessary environment variables and the DOCKER_HOST setup step.
Changes:
Set up DOCKER_HOST as outputstep.DOCKER_HOSTandRUNNER_TEMPenvironment variables from theUpdate AI knowledgestep.classic-tokeninput from theUpdate AI knowledgestep..github/workflows/release_workflow.ymlRemoved the 'compile-vector-server' job and simplified the workflow dependencies.
Changes:
docs
docs/ai-container-system.mdUpdated GitHub Actions workflow to use a new action name.
Changes:
single-actionvalue fromvector_actiontoai_cache_actionin the GitHub Actions workflow.src/actions
src/actions/github_action.tsRemoved Docker-related configurations and classic token from the GitHub action setup.
Changes:
DockerConfig.dockerContainerName,dockerDomain,dockerPort,dockerCacheOs,dockerCacheArch.classicTokenfrom token configurations.DockerConfiginstantiation fromExecutionobject initialization.src/actions/local_action.tsRemoved Docker-related configuration and classic token support.
Changes:
DockerConfigimport and Docker-related configuration (dockerContainerName, dockerDomain, dockerPort, dockerCacheOs, dockerCacheArch).classicTokenfrom theTokensconfiguration.src
src/cli.tsRefactored CLI commands and improved AI-related functionality.
Changes:
compile-vector-servercommand.build-aicommand: renamed action to AI_CACHE_LOCAL, added OpenRouter API key and model support, and removed classic token option.ask-aicommand tothinkand updated its description for deep code analysis.thinkcommand.thinkcommand to handle both issue and non-issue scenarios.thinkcommand.src/data/model
src/data/model/ai_response_schema.tsAdded JSON schema for enforcing structured AI responses.
Changes:
AI_RESPONSE_JSON_SCHEMAto validate AI responses.text_response,action,related_files, andcomplete.actionas an enum with values 'none' and 'analyze_files'.src/data/model/chunked_file.tsRemoved the
ChunkedFileclass.Changes:
ChunkedFileclass definition.path,index,type,content,chunks,shasum, andvector.src/data/model/chunked_file_chunk.tsEntire file removed, including the
ChunkedFileChunkclass and its associated logic.Changes:
ChunkedFileChunkclass.src/data/model/codebase_analysis_schema.tsAdded JSON schema for codebase analysis responses.
Changes:
CODEBASE_ANALYSIS_JSON_SCHEMAconstant.path,description, andrelationshipsproperties.pathanddescriptionas required properties.additionalProperties: falseto enforce strict schema validation.src/data/model/docker_config.tsEntire DockerConfig class has been removed.
Changes:
DockerConfigclass and all its associated methods and properties.src/data/model/execution.tsRemoved DockerConfig-related code and dependencies.
Changes:
DockerConfigfrom './docker_config'.dockerConfigfield from theExecutionclass.dockerConfigparameter from theExecutionclass constructor.src/data/model/single_action.tsUpdated
SingleActionclass to replaceVECTORrelated actions withAI_CACHEandTHINKactions.Changes:
ACTIONS.COMPILE_VECTOR_SERVER,ACTIONS.VECTOR,ACTIONS.VECTOR_LOCAL, andACTIONS.VECTOR_REMOVALwithACTIONS.AI_CACHE,ACTIONS.AI_CACHE_LOCAL, andACTIONS.THINKin theactionsarray.actionsThrowErrorarray to includeACTIONS.AI_CACHEinstead ofACTIONS.VECTOR.actionsWithoutIssuearray to includeACTIONS.AI_CACHE,ACTIONS.AI_CACHE_LOCAL, andACTIONS.THINKinstead ofACTIONS.VECTOR,ACTIONS.VECTOR_LOCAL, andACTIONS.COMPILE_VECTOR_SERVER.isCompileVectorServerAction,isVectorAction,isVectorLocalAction, andisVectorRemovalActionmethods.isAiCacheAction,isAiCacheLocalAction, andisThinkActionmethods.src/data/model/think_response.tsAdded new interfaces for modeling responses and todos in the think system.
Changes:
FileAnalysisinterface for file analysis results.ProposedChangeinterface for code change proposals.ThinkResponseinterface for encapsulating response data.ThinkStepinterface for tracking steps in the think process.ThinkTodoIteminterface for individual todo items.ThinkTodoListinterface for managing a collection of todo items.src/data/model/think_response_schema.tsAdded a JSON schema for structured AI reasoning and analysis responses.
Changes:
reasoning,action,files_to_search,files_to_read,analyzed_files,proposed_changes,complete,final_analysis, andtodo_updates.reasoning,action, andcomplete.action,relevance,change_type, andstatusfields.src/data/model/tokens.tsSimplified the Tokens class by removing the classicToken property.
Changes:
src/data/repository
src/data/repository/ai_repository.tsEnhanced AI repository with support for JSON schema-based responses and added new
askThinkJsonmethod.Changes:
OpenRouterResponseinterface.AI_RESPONSE_JSON_SCHEMAandTHINK_RESPONSE_JSON_SCHEMAimports.askmethod.askmethod.askJsonmethod to support optional schema input and schema name.askThinkJsonmethod to handle responses usingTHINK_RESPONSE_JSON_SCHEMA.askJsonand directly parsed the API response.askJsonandaskThinkJsonmethods to enforce JSON schema validation.src/data/repository/docker_repository.tsRemoved the entire DockerRepository class and related functionality.
Changes:
src/data/repository/file_repository.tsRemoved chunked content processing functionality.
Changes:
ChunkedFilefrom '../model/chunked_file'.getChunkedRepositoryContentfunction.getChunksByLinesfunction.getChunksByBlocksfunction.src/data/repository/supabase_repository.tsRefactored SupabaseRepository to focus on AI file caching, replacing chunk-based operations with file cache operations.
Changes:
ChunkedFileandChunkedFileChunkimports and related functions.AICachedFileInfointerface to define AI file cache structure.CHUNKS_TABLEtoAI_FILE_CACHE_TABLEfor AI file cache operations.setChunkedFile,removeChunksByShasum,getChunkedFileByShasum,getChunks,getChunksByShasum,updateVector,matchChunks,duplicateChunksByBranch,removeChunksByBranch,removeChunksByPath, andgetVectorOfChunkContent.setAIFileCache,getAIFileCache,getAIFileCachesByBranch,removeAIFileCacheByPath,duplicateAIFileCacheByBranch, andremoveAIFileCacheByBranch.getShasumByPathandgetDistinctPathsto use AI file cache data.src/usecase/actions
src/usecase/actions/prepare_ai_container_use_case.tsThe file has been removed entirely.
Changes:
PrepareAIContainerUseCaseclass.invokemethod which handled Docker image preparation logic.Execution,Result,DockerRepository,logError,logInfo, andParamUseCase.buildAndPushImagemethod.src/usecase/actions/vector_action_removal_use_case.tsRenamed method and updated terminology for clarity and consistency.
Changes:
removeChunksByBranchtoremoveAICacheByBranch.invoketo useremoveAICacheByBranch.removeChunksByBranchtoremoveAIFileCacheByBranch.src/usecase/actions/vector_action_use_case.tsRefactored VectorActionUseCase to use AI repositories and services for file analysis and caching, replacing Docker-based chunk processing.
Changes:
checkAICacheInSupabase,uploadAICacheToSupabase,duplicateAICacheToBranch.invokemethod.CODE_INSTRUCTION_BLOCK,CODE_INSTRUCTION_LINE).src/usecase
src/usecase/issue_comment_use_case.tsReplaced
AskActionUseCasewithThinkUseCase.Changes:
AskActionUseCasetoThinkUseCase.AskActionUseCaseinvocation withThinkUseCasein theinvokemethod.src/usecase/single_action_use_case.tsRefactored SingleActionUseCase to remove unused imports, modify action logic, and add a new use case.
Changes:
AskActionUseCase.PrepareAIContainerUseCase.ThinkUseCasefor new action handling.isCompileVectorServerAction.isVectorActionwithisAiCacheAction.isThinkActionusingThinkUseCase.src/usecase/steps/common
src/usecase/steps/common/ask_ai_use_case.tsEntire file
AskActionUseCasehas been removed.Changes:
AskActionUseCaseclass and its implementation.AiResponse,ChunkedFileChunk,Execution,Result, and various repositories.logDebugInfo,logError,logInfo, andlogSingleLine.getRelatedFilesmethod used for file retrieval.src/usecase/steps/common/think_code_manager.tsAdded a new class
ThinkCodeManagerto manage virtual code state by applying proposed changes and tracking modifications.Changes:
ThinkCodeManagerclass to handle virtual code state.src/usecase/steps/common/think_todo_manager.tsAdded a new class
ThinkTodoManagerto manage TODO list functionality for the reasoning process, including creation, updating, and tracking of TODOs.Changes:
ThinkTodoManagerclass to manage TODOs.initializemethod to start with optional initial TODOs.createTodomethod to add new TODOs.updateTodomethod to modify existing TODOs.getAllTodos,getTodosByStatus,getActiveTodos.getStatsmethod for TODO completion statistics.getContextForAImethod to format TODO list for AI context.linkTodoToChangesmethod to associate TODOs with changes.autoUpdateFromChangesmethod to automatically update TODO status based on progress.getSummarymethod to generate a report of TODOs.src/usecase/steps/common/think_use_case.tsAdded a new 'ThinkUseCase' class for advanced code analysis and reasoning.
Changes:
src/usecase/steps/common/services
src/usecase/steps/common/services/codebase_analyzer.tsAdded a new service for analyzing codebase structure, generating file descriptions, and managing file relationships using AI and caching.
Changes:
CodebaseAnalyzerclass to handle codebase analysis.generateCodebaseAnalysismethod to analyze and describe code files, using AI for descriptions and caching for efficiency.FileImportAnalyzerandFileCacheManagerfor building relationship maps and managing cache.src/usecase/steps/common/services/comment_formatter.tsAdded a new service for formatting GitHub comments and code changes.
Changes:
CommentFormatterclass to handle GitHub comment formatting.formatReasoningCommentmethod to generate comprehensive analysis comments.formatProposedChangefor detailed formatting of individual changes.detectLanguageFromPathto determine programming language from file extensions.getActionEmoji,formatActionName, andgetChangeTypeEmojifor emoji-based UI enhancements.src/usecase/steps/common/services/file_cache_manager.tsAdded a new service
FileCacheManagerto handle AI file caching in Supabase.Changes:
normalizePathmethod to standardize file paths.calculateFileSHAmethod to compute SHA256 hash of file content.initSupabaseRepositorymethod to initialize Supabase repository.loadAICachemethod to load AI cache from Supabase.getCachedFilemethod to retrieve cached file info by path.saveAICacheEntrymethod to save cache entries to Supabase.logInfo,logDebugInfo, andlogErrorfor better visibility.src/usecase/steps/common/services/file_import_analyzer.tsAdded a new service for analyzing file imports and building file relationship maps across multiple programming languages.
Changes:
extractImportsFromFilemethod to extract imports from files in various programming languages (e.g., TypeScript, Python, Java, Go, Rust, Ruby, PHP, Swift, Dart).resolveRelativePathmethod to resolve relative import paths to absolute paths.buildRelationshipMapmethod to construct a map of file relationships (consumes and consumed_by) by analyzing imports across all files in a repository.src/usecase/steps/common/services/file_search_service.tsAdded a new
FileSearchServiceclass for building file indexes and searching files.Changes:
buildFileIndexmethod to create a file index for quick lookup by filename or directory.searchFilesmethod to search files using search terms (filename, directory, or pattern).src/usecase/steps/common/services/types.tsAdded shared types for codebase analysis services.
Changes:
CachedFileInfointerface to store file-related information including path, SHA, description, and relationships.FileRelationshipMapinterface to manage relationships between files using Maps.src/usecase/steps/issue
src/usecase/steps/issue/close_issue_after_merging_use_case.tsUpdated method name and error message for removing AI file cache.
Changes:
removeChunksByBranchtoremoveAIFileCacheByBranch.src/usecase/steps/issue/prepare_branches_use_case.tsRenamed method and function for clarity, updated related function calls.
Changes:
duplicateChunksByBranchtoduplicateAICacheByBranch.duplicateChunksByBranchtoduplicateAIFileCacheByBranch.duplicateChunksByBranchwas called toduplicateAICacheByBranch.src/usecase/steps/issue_comment
src/usecase/steps/issue_comment/check_issue_comment_language_use_case.tsAdded logging for issue number before updating the comment.
Changes:
logInfostatement to log the issue number before callingupdateComment.src/utils
src/utils/constants.tsUpdated constants for command name, removed Docker-related keys, and added AI-related actions and prompts.
Changes:
COMMANDfrom 'git-board-flow' to 'giik'.TITLEfrom 'Git Board Flow' to 'Giik'.DOCKER_CONTAINER_NAME,DOCKER_DOMAIN,DOCKER_PORT,DOCKER_CACHE_OS,DOCKER_CACHE_ARCH, andCLASSIC_TOKEN.ACTIONSto include AI-related actions:AI_CACHE,AI_CACHE_LOCAL, andTHINK.COMPILE_VECTOR_SERVER,VECTOR,VECTOR_LOCAL, andVECTOR_REMOVALfromACTIONS.PROMPTSsection with a detailed technical code analysis prompt.supabase/migrations
supabase/migrations/20240322000000_create_ai_file_cache_table.sqlAdded a new SQL migration script to create and manage the ai_file_cache table for storing AI-generated file descriptions and relationships.
Changes:
ai_file_cachetable with fields for owner, repository, branch, file_name, path, sha, description, consumes, consumed_by, created_at, and last_updated.last_updatedtimestamp on row updates.