From 9baf55bc30d4643b5a902b9596cde8c487c716ff Mon Sep 17 00:00:00 2001 From: Andrew Charneski Date: Tue, 17 Dec 2024 01:11:09 -0500 Subject: [PATCH] wip --- build.gradle.kts | 2 +- docs/coding_standards.md | 2 +- docs/feature_roadmap.md | 18 +- .../aicoder/actions/user_documentation.md | 2 +- .../aicoder/actions/BaseAction.kt | 18 +- .../actions}/EnhancedChatSocketManager.kt | 3 +- .../aicoder/actions/FileContextAction.kt | 6 +- .../actions}/ModelSelectionDialog.kt | 2 +- .../aicoder/actions/SelectionAction.kt | 8 +- .../actions}/SessionProxyApp.kt | 6 +- .../actions/agent}/CommandAutofixAction.kt | 13 +- .../agent}/DocumentedMassPatchAction.kt | 16 +- .../agent}/DocumentedMassPatchServer.kt | 12 +- .../actions/agent}/MassPatchAction.kt | 18 +- .../actions/agent}/MultiStepPatchAction.kt | 13 +- .../actions/agent}/OutlineAction.kt | 11 +- .../actions/agent}/OutlineConfigDialog.kt | 5 +- .../actions/agent}/ShellCommandAction.kt | 13 +- .../actions/agent}/SimpleCommandAction.kt | 15 +- .../agent}/WebDevelopmentAssistantAction.kt | 17 +- .../actions/chat}/CodeChatAction.kt | 15 +- .../actions/chat}/DiffChatAction.kt | 17 +- .../actions/chat}/GenericChatAction.kt | 20 +- .../actions/chat}/LargeOutputChatAction.kt | 15 +- .../actions/chat/MultiCodeChatAction.kt | 215 +++++++++++++ .../actions/chat}/MultiDiffChatAction.kt | 16 +- .../actions/dev}/ApplyPatchAction.kt | 6 +- .../actions/dev/LineFilterChatAction.kt | 16 +- .../aicoder/actions/dev/PrintTreeAction.kt | 10 +- .../actions/editor}/CustomEditAction.kt | 8 +- .../actions/editor}/DescribeAction.kt | 14 +- .../actions/editor}/PasteAction.kt | 8 +- .../actions/editor}/RecentCodeEditsAction.kt | 8 +- .../actions/editor}/RedoLast.kt | 6 +- .../find/FindResultsModificationAction.kt | 19 +- .../find/FindResultsModificationDialog.kt | 3 +- .../CreateFileFromDescriptionAction.kt | 11 +- .../actions/generate}/CreateImageAction.kt | 13 +- .../generate}/GenerateDocumentationAction.kt | 15 +- .../generate}/GenerateRelatedFileAction.kt | 11 +- .../actions/git/ChatWithCommitAction.kt | 14 +- .../actions/git/ChatWithCommitDiffAction.kt | 18 +- .../git/ChatWithWorkingCopyDiffAction.kt | 16 +- .../actions/git/ReplicateCommitAction.kt | 16 +- .../CreateProjectorFromQueryIndexAction.kt | 14 +- .../knowledge/DocumentDataExtractorAction.kt | 18 +- .../DocumentDataExtractorConfigDialog.kt | 2 +- .../knowledge/SaveAsQueryIndexAction.kt | 10 +- .../legacy/AppendTextWithChatAction.kt | 8 +- .../aicoder/actions/legacy/CommentsAction.kt | 6 +- .../aicoder/actions/legacy/DocAction.kt | 12 +- .../actions/legacy/ImplementStubAction.kt | 12 +- .../legacy/InsertImplementationAction.kt | 16 +- .../actions/legacy}/OpenWebPageAction.kt | 4 +- .../actions/legacy/RenameVariablesAction.kt | 10 +- .../legacy/ReplaceWithSuggestionsAction.kt | 8 +- .../actions/legacy/VoiceToTextAction.kt | 8 +- .../markdown/MarkdownImplementActionGroup.kt | 10 +- .../actions/markdown/MarkdownListAction.kt | 16 +- .../actions/plan/AutoPlanChatAction.kt | 18 +- .../aicoder/actions/plan/PlanAheadAction.kt | 16 +- .../aicoder/actions/plan/PlanChatAction.kt | 16 +- .../aicoder/actions/plan/PlanConfigDialog.kt | 6 +- .../aicoder/actions/plan/PrePlanAction.kt | 16 +- .../aicoder/actions/plan/SingleTaskAction.kt | 16 +- .../actions/problems/AnalyzeProblemAction.kt | 24 +- .../actions/test/TestResultAutofixAction.kt | 16 +- .../aicoder/actions/generic/BaseAction.kt | 28 -- .../actions/generic/MultiCodeChatAction.kt | 209 ------------ .../simiacryptus/aicoder/AppServer.kt | 6 +- .../aicoder/config/AppSettingsComponent.kt | 6 +- .../aicoder/config/AppSettingsConfigurable.kt | 4 +- .../aicoder/config/AppSettingsState.kt | 5 +- .../simiacryptus/aicoder/config/MRUItems.kt | 2 +- .../simiacryptus/aicoder/config/Name.kt | 4 +- .../aicoder/config/SimpleEnvelope.kt | 2 +- .../config/StaticAppSettingsConfigurable.kt | 18 +- .../simiacryptus/aicoder/config/UIAdapter.kt | 4 +- .../simiacryptus/aicoder/config/UsageTable.kt | 4 +- .../aicoder/ui/SettingsWidgetFactory.kt | 13 +- .../aicoder/ui/TokenCountWidgetFactory.kt | 2 +- .../simiacryptus/aicoder/util/BlockComment.kt | 6 +- .../simiacryptus/aicoder/util/BrowseUtil.kt | 6 +- .../aicoder/util/CodeChatSocketManager.kt | 2 +- .../aicoder/util/CodeProcessingUtils.kt | 2 +- .../aicoder/util/ComputerLanguage.kt | 2 +- .../simiacryptus/aicoder/util/FileUtils.kt | 2 +- .../aicoder/util/IdeaChatClient.kt | 4 +- .../aicoder/util/IdeaOpenAIClient.kt | 4 +- .../simiacryptus/aicoder/util/IndentedText.kt | 2 +- .../aicoder/util/LanguageUtils.kt | 4 +- .../simiacryptus/aicoder/util/LineComment.kt | 2 +- .../aicoder/util/PluginStartupActivity.kt | 9 +- .../aicoder/util/SessionManager.kt | 2 +- .../simiacryptus/aicoder/util/StringUtil.kt | 2 +- .../simiacryptus/aicoder/util/TextBlock.kt | 2 +- .../aicoder/util/TextBlockFactory.kt | 4 +- .../simiacryptus/aicoder/util/UITools.kt | 10 +- .../aicoder/util/psi/PsiClassContext.kt | 302 +++++++++--------- .../simiacryptus/aicoder/util/psi/PsiUtil.kt | 2 +- .../aicoder/util/psi/PsiVisitorBase.kt | 4 +- src/main/resources/META-INF/plugin.xml | 156 ++++----- 102 files changed, 907 insertions(+), 921 deletions(-) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/BaseAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions}/EnhancedChatSocketManager.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/FileContextAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions}/ModelSelectionDialog.kt (95%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/SelectionAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions}/SessionProxyApp.kt (90%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/CommandAutofixAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/DocumentedMassPatchAction.kt (95%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/DocumentedMassPatchServer.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/MassPatchAction.kt (96%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/MultiStepPatchAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/OutlineAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/OutlineConfigDialog.kt (98%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/ShellCommandAction.kt (95%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/SimpleCommandAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/agent}/WebDevelopmentAssistantAction.kt (98%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/chat}/CodeChatAction.kt (85%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/chat}/DiffChatAction.kt (94%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/chat}/GenericChatAction.kt (82%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/chat}/LargeOutputChatAction.kt (90%) create mode 100644 src/main/kotlin/aicoder/actions/chat/MultiCodeChatAction.kt rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/chat}/MultiDiffChatAction.kt (96%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions => aicoder/actions/dev}/ApplyPatchAction.kt (96%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/dev/LineFilterChatAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/dev/PrintTreeAction.kt (87%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/code => aicoder/actions/editor}/CustomEditAction.kt (93%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/code => aicoder/actions/editor}/DescribeAction.kt (88%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/code => aicoder/actions/editor}/PasteAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/code => aicoder/actions/editor}/RecentCodeEditsAction.kt (87%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/code => aicoder/actions/editor}/RedoLast.kt (83%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/find/FindResultsModificationAction.kt (93%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/find/FindResultsModificationDialog.kt (94%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/generate}/CreateFileFromDescriptionAction.kt (94%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/generate}/CreateImageAction.kt (95%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/generate}/GenerateDocumentationAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions/generic => aicoder/actions/generate}/GenerateRelatedFileAction.kt (95%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/git/ChatWithCommitAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/git/ChatWithCommitDiffAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/git/ReplicateCommitAction.kt (97%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/knowledge/DocumentDataExtractorAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt (98%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt (93%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/AppendTextWithChatAction.kt (90%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/CommentsAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/DocAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/ImplementStubAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/InsertImplementationAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus/aicoder/actions => aicoder/actions/legacy}/OpenWebPageAction.kt (71%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/RenameVariablesAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt (93%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/legacy/VoiceToTextAction.kt (95%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/markdown/MarkdownImplementActionGroup.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/markdown/MarkdownListAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/AutoPlanChatAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/PlanAheadAction.kt (89%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/PlanChatAction.kt (91%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/PlanConfigDialog.kt (99%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/PrePlanAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/plan/SingleTaskAction.kt (93%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/problems/AnalyzeProblemAction.kt (92%) rename src/main/kotlin/{com/github/simiacryptus => }/aicoder/actions/test/TestResultAutofixAction.kt (96%) delete mode 100644 src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/BaseAction.kt delete mode 100644 src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiCodeChatAction.kt rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/AppServer.kt (93%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/AppSettingsComponent.kt (98%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/AppSettingsConfigurable.kt (87%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/AppSettingsState.kt (97%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/MRUItems.kt (98%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/Name.kt (62%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/SimpleEnvelope.kt (50%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/UIAdapter.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/config/UsageTable.kt (98%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt (97%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt (99%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/BlockComment.kt (92%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/BrowseUtil.kt (86%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/CodeChatSocketManager.kt (97%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/CodeProcessingUtils.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/ComputerLanguage.kt (99%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/FileUtils.kt (92%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/IdeaChatClient.kt (98%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/IdeaOpenAIClient.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/IndentedText.kt (97%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/LanguageUtils.kt (91%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/LineComment.kt (97%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/PluginStartupActivity.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/SessionManager.kt (90%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/StringUtil.kt (94%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/TextBlock.kt (91%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/TextBlockFactory.kt (82%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/UITools.kt (99%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/psi/PsiClassContext.kt (96%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/psi/PsiUtil.kt (99%) rename src/main/kotlin/com/{github => }/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt (92%) diff --git a/build.gradle.kts b/build.gradle.kts index c05a65e5..3ad128c5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ plugins { } -group = "com.github.simiacryptus" +group = "com.simiacryptus" version = properties("pluginVersion") repositories { diff --git a/docs/coding_standards.md b/docs/coding_standards.md index 08fa6d8c..6e55167a 100644 --- a/docs/coding_standards.md +++ b/docs/coding_standards.md @@ -15,7 +15,7 @@ to ensure consistency, readability, and maintainability of the codebase. - **Classes and Interfaces**: Use PascalCase and be descriptive. Example: `StaticAppSettingsConfigurable`. - **Functions and Variables**: Use camelCase and be descriptive. Example: `buildComponent`. - **Constants**: Use UPPER_SNAKE_CASE. Example: `API_PROVIDER`. -- **Packages**: Use lowercase and avoid underscores. Example: `com.github.simiacryptus.aicoder.util`. +- **Packages**: Use lowercase and avoid underscores. Example: `com.simiacryptus.aicoder.util`. ## Formatting diff --git a/docs/feature_roadmap.md b/docs/feature_roadmap.md index 02ab4dea..35807151 100644 --- a/docs/feature_roadmap.md +++ b/docs/feature_roadmap.md @@ -1325,7 +1325,7 @@ This roadmap is a living document and will be updated periodically to reflect pr # kotlin\com\github\simiacryptus\aicoder\ApplicationEvents.kt -Creating a feature development roadmap for the `ApplicationEvents` class within the `com.github.simiacryptus.aicoder` package involves outlining the future enhancements, improvements, and additions planned for this component. The roadmap will be structured into short-term, mid-term, and long-term goals, considering the current functionalities such as application activation handling, initialization of services like `OutputInterceptor`, `ClientManager`, and various `ApplicationServices`. +Creating a feature development roadmap for the `ApplicationEvents` class within the `com.simiacryptus.aicoder` package involves outlining the future enhancements, improvements, and additions planned for this component. The roadmap will be structured into short-term, mid-term, and long-term goals, considering the current functionalities such as application activation handling, initialization of services like `OutputInterceptor`, `ClientManager`, and various `ApplicationServices`. #### Short-Term Goals (0-3 Months) @@ -1524,7 +1524,7 @@ This roadmap provides a structured approach to developing new features for the ` # kotlin\com\github\simiacryptus\aicoder\config\SimpleEnvelope.kt -Creating a feature development roadmap for the `SimpleEnvelope` class within the `com.github.simiacryptus.aicoder.config` package involves outlining a series of enhancements and new functionalities that can be added to make the class more robust, versatile, and useful in various applications. Here's a proposed roadmap: +Creating a feature development roadmap for the `SimpleEnvelope` class within the `com.simiacryptus.aicoder.config` package involves outlining a series of enhancements and new functionalities that can be added to make the class more robust, versatile, and useful in various applications. Here's a proposed roadmap: #### Phase 1: Basic Enhancements @@ -1617,7 +1617,7 @@ This roadmap is subject to change based on user feedback, technological advancem # kotlin\com\github\simiacryptus\aicoder\config\Name.kt -Creating a feature development roadmap for the `Name` annotation within the `com.github.simiacryptus.aicoder.config` package involves outlining a series of planned enhancements and functionalities that will be added over time. This roadmap will guide the development process, ensuring that the annotation becomes more versatile and useful in various coding scenarios. Here's a proposed roadmap: +Creating a feature development roadmap for the `Name` annotation within the `com.simiacryptus.aicoder.config` package involves outlining a series of planned enhancements and functionalities that will be added over time. This roadmap will guide the development process, ensuring that the annotation becomes more versatile and useful in various coding scenarios. Here's a proposed roadmap: #### Phase 1: Initial Release @@ -2293,7 +2293,7 @@ Creating a feature development roadmap is an iterative process that requires fle # kotlin\com\github\simiacryptus\aicoder\util\LineComment.kt -The `LineComment` class and its nested `Factory` class, as part of the `com.github.simiacryptus.aicoder.util` package, provide a structured way to handle line comments within text blocks, particularly useful in the context of code generation or analysis. The development roadmap for enhancing these classes and their functionalities can be structured into several phases, focusing on improving usability, flexibility, and integration capabilities. +The `LineComment` class and its nested `Factory` class, as part of the `com.simiacryptus.aicoder.util` package, provide a structured way to handle line comments within text blocks, particularly useful in the context of code generation or analysis. The development roadmap for enhancing these classes and their functionalities can be structured into several phases, focusing on improving usability, flexibility, and integration capabilities. #### Phase 1: Core Functionality Enhancements @@ -4374,7 +4374,7 @@ This roadmap is subject to change based on user feedback and technological advan # resources\sources\kt\com\github\simiacryptus\aicoder\ApplicationEvents.kt -Creating a feature development roadmap for the `ApplicationEvents` class within the `com.github.simiacryptus.aicoder` package involves outlining the future enhancements, improvements, and additions planned for this component. The roadmap will guide the development process, ensuring that the class evolves to meet the needs of its users effectively. Here's a proposed roadmap: +Creating a feature development roadmap for the `ApplicationEvents` class within the `com.simiacryptus.aicoder` package involves outlining the future enhancements, improvements, and additions planned for this component. The roadmap will guide the development process, ensuring that the class evolves to meet the needs of its users effectively. Here's a proposed roadmap: #### Phase 1: Initial Setup and Integration @@ -4912,7 +4912,7 @@ This roadmap is a starting point and may evolve based on user needs, technologic # resources\sources\kt\com\github\simiacryptus\aicoder\config\Name.kt -Creating a feature development roadmap for the `Name` annotation within the `com.github.simiacryptus.aicoder.config` package involves outlining a series of planned enhancements and functionalities that will be added over time. This roadmap will guide the development process, ensuring that the annotation becomes more versatile and useful for its intended purpose. Here's a proposed roadmap: +Creating a feature development roadmap for the `Name` annotation within the `com.simiacryptus.aicoder.config` package involves outlining a series of planned enhancements and functionalities that will be added over time. This roadmap will guide the development process, ensuring that the annotation becomes more versatile and useful for its intended purpose. Here's a proposed roadmap: #### Phase 1: Initial Release @@ -4968,7 +4968,7 @@ This roadmap is a living document and should be revisited regularly to adjust th # resources\sources\kt\com\github\simiacryptus\aicoder\config\SimpleEnvelope.kt -Creating a feature development roadmap for the `SimpleEnvelope` class within the `com.github.simiacryptus.aicoder.config` package involves outlining a series of enhancements and new functionalities that can be added to make the class more robust, versatile, and useful in various applications. Here's a proposed roadmap: +Creating a feature development roadmap for the `SimpleEnvelope` class within the `com.simiacryptus.aicoder.config` package involves outlining a series of enhancements and new functionalities that can be added to make the class more robust, versatile, and useful in various applications. Here's a proposed roadmap: #### Phase 1: Basic Enhancements @@ -5124,7 +5124,7 @@ This roadmap is a living document and should be revisited and revised based on u # resources\sources\kt\com\github\simiacryptus\aicoder\ui\EditorMenu.kt -Developing a feature for a software project, especially one that integrates with complex platforms like IntelliJ IDEA (as suggested by the provided code snippet), requires careful planning and execution. Below is a structured roadmap to guide the development of a new feature for the `com.github.simiacryptus.aicoder.ui` package, focusing on enhancing the editor menu with additional actions based on user settings. +Developing a feature for a software project, especially one that integrates with complex platforms like IntelliJ IDEA (as suggested by the provided code snippet), requires careful planning and execution. Below is a structured roadmap to guide the development of a new feature for the `com.simiacryptus.aicoder.ui` package, focusing on enhancing the editor menu with additional actions based on user settings. #### Phase 1: Requirements Gathering and Analysis @@ -5609,7 +5609,7 @@ This roadmap is iterative and cyclical; the insights gained from the evaluation # resources\sources\kt\com\github\simiacryptus\aicoder\util\ComputerLanguage.kt -Developing a feature roadmap for the `ComputerLanguage` enum and its associated classes within the `com.github.simiacryptus.aicoder.util` package involves planning enhancements, optimizations, and new capabilities that can be added to improve its functionality, usability, and integration capabilities. Here's a proposed development roadmap: +Developing a feature roadmap for the `ComputerLanguage` enum and its associated classes within the `com.simiacryptus.aicoder.util` package involves planning enhancements, optimizations, and new capabilities that can be added to improve its functionality, usability, and integration capabilities. Here's a proposed development roadmap: #### Phase 1: Core Enhancements diff --git a/docs/src/main/kotlin/com/github/simiacryptus/aicoder/actions/user_documentation.md b/docs/src/main/kotlin/com/github/simiacryptus/aicoder/actions/user_documentation.md index f558a427..fd180411 100644 --- a/docs/src/main/kotlin/com/github/simiacryptus/aicoder/actions/user_documentation.md +++ b/docs/src/main/kotlin/com/github/simiacryptus/aicoder/actions/user_documentation.md @@ -83,7 +83,7 @@ The action is implemented as a simple override of `actionPerformed()` that calls ### Dependencies -- Requires `com.github.simiacryptus.aicoder.util.BrowseUtil` for browser handling +- Requires `com.simiacryptus.aicoder.util.BrowseUtil` for browser handling - Uses Java's `URI` class for URL representation diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt b/src/main/kotlin/aicoder/actions/BaseAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt rename to src/main/kotlin/aicoder/actions/BaseAction.kt index e5686792..aaa97c39 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/BaseAction.kt +++ b/src/main/kotlin/aicoder/actions/BaseAction.kt @@ -1,16 +1,16 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions -import com.github.simiacryptus.aicoder.util.IdeaChatClient -import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient -import com.github.simiacryptus.aicoder.util.UITools +/** + * Base action class providing common functionality for AI Coder actions. + * Handles API client initialization and common UI operations. + */ import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.util.IdeaChatClient +import com.simiacryptus.aicoder.util.IdeaOpenAIClient +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.ChatClient - /** - * Base action class providing common functionality for AI Coder actions. - * Handles API client initialization and common UI operations. - */ import org.slf4j.LoggerFactory import javax.swing.Icon @@ -73,4 +73,4 @@ abstract class BaseAction( } } } -} \ No newline at end of file +} diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/EnhancedChatSocketManager.kt b/src/main/kotlin/aicoder/actions/EnhancedChatSocketManager.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/EnhancedChatSocketManager.kt rename to src/main/kotlin/aicoder/actions/EnhancedChatSocketManager.kt index 9aa6ad54..a8c77704 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/EnhancedChatSocketManager.kt +++ b/src/main/kotlin/aicoder/actions/EnhancedChatSocketManager.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions import com.simiacryptus.jopenai.ChatClient import com.simiacryptus.jopenai.models.ApiModel @@ -8,7 +8,6 @@ import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.core.platform.model.StorageInterface import com.simiacryptus.skyenet.webui.application.ApplicationServer import com.simiacryptus.skyenet.webui.chat.ChatSocketManager -import com.simiacryptus.skyenet.webui.session.SessionTask class EnhancedChatSocketManager( session: Session, diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt b/src/main/kotlin/aicoder/actions/FileContextAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt rename to src/main/kotlin/aicoder/actions/FileContextAction.kt index b453af5a..1fee84d6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/FileContextAction.kt +++ b/src/main/kotlin/aicoder/actions/FileContextAction.kt @@ -1,7 +1,5 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.fileEditor.FileEditorManager @@ -9,6 +7,8 @@ import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.LocalFileSystem import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import org.slf4j.LoggerFactory import java.io.File import java.nio.file.Path diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ModelSelectionDialog.kt b/src/main/kotlin/aicoder/actions/ModelSelectionDialog.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ModelSelectionDialog.kt rename to src/main/kotlin/aicoder/actions/ModelSelectionDialog.kt index 57d74d4c..16901771 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ModelSelectionDialog.kt +++ b/src/main/kotlin/aicoder/actions/ModelSelectionDialog.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/SelectionAction.kt b/src/main/kotlin/aicoder/actions/SelectionAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/SelectionAction.kt rename to src/main/kotlin/aicoder/actions/SelectionAction.kt index fc7ce1f1..d0cfbd0e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/SelectionAction.kt +++ b/src/main/kotlin/aicoder/actions/SelectionAction.kt @@ -1,8 +1,5 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.LanguageUtils -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.command.WriteCommandAction @@ -16,6 +13,9 @@ import com.intellij.psi.PsiElement import com.intellij.psi.PsiFile import com.intellij.psi.PsiManager import com.intellij.psi.PsiRecursiveElementVisitor +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.LanguageUtils +import com.simiacryptus.aicoder.util.UITools abstract class SelectionAction( private val requiresSelection: Boolean = true diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SessionProxyApp.kt b/src/main/kotlin/aicoder/actions/SessionProxyApp.kt similarity index 90% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SessionProxyApp.kt rename to src/main/kotlin/aicoder/actions/SessionProxyApp.kt index 123c6fd6..22343942 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SessionProxyApp.kt +++ b/src/main/kotlin/aicoder/actions/SessionProxyApp.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session @@ -8,7 +8,6 @@ import com.simiacryptus.skyenet.webui.application.AppInfoData import com.simiacryptus.skyenet.webui.application.ApplicationServer import com.simiacryptus.skyenet.webui.chat.ChatServer import com.simiacryptus.skyenet.webui.session.SocketManager -import java.net.URL class SessionProxyServer : ApplicationServer( applicationName = "AI Coding Assistant", @@ -28,7 +27,8 @@ class SessionProxyServer : ApplicationServer( }.toMap() override fun newSession(user: User?, session: Session) = - chats[session]?.newSession(user, session) ?: agents[session] ?: throw IllegalStateException("No agent found for session $session") + chats[session]?.newSession(user, session) ?: agents[session] + ?: throw IllegalStateException("No agent found for session $session") companion object { private val log = org.slf4j.LoggerFactory.getLogger(SessionProxyServer::class.java) diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CommandAutofixAction.kt b/src/main/kotlin/aicoder/actions/agent/CommandAutofixAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CommandAutofixAction.kt rename to src/main/kotlin/aicoder/actions/agent/CommandAutofixAction.kt index a01dbba1..4e44aa7d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CommandAutofixAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/CommandAutofixAction.kt @@ -1,13 +1,10 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent /** * Action that provides automated fixing of command execution issues through AI assistance */ -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys @@ -15,6 +12,10 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.ui.ComboBox import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.general.CmdPatchApp import com.simiacryptus.skyenet.apps.general.PatchApp diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchAction.kt b/src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchAction.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchAction.kt rename to src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchAction.kt index 01ab08da..0de0ff0b 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchAction.kt @@ -1,10 +1,8 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.generate.items import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project @@ -12,6 +10,10 @@ import com.intellij.openapi.ui.DialogWrapper import com.intellij.ui.CheckBoxList import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.JBTextArea +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils.Companion.isLLMIncludableFile import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.webui.application.AppInfoData @@ -121,7 +123,7 @@ class DocumentedMassPatchAction : BaseAction() { return Settings(dialog.userSettings, project) } - class ConfigDialog(project: Project?, private val settingsUI: SettingsUI, title: String) + class ConfigDialog(project: Project?, private val settingsUI: SettingsUI, title: String) : DialogWrapper(project) { val userSettings = UserSettings() diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchServer.kt b/src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchServer.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchServer.kt rename to src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchServer.kt index 7542b474..f7ee911b 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DocumentedMassPatchServer.kt +++ b/src/main/kotlin/aicoder/actions/agent/DocumentedMassPatchServer.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ChatClient @@ -22,10 +22,10 @@ import java.util.concurrent.Semaphore import java.util.concurrent.atomic.AtomicReference class DocumentedMassPatchServer( - val config: DocumentedMassPatchAction.Settings, - val api: ChatClient, - val autoApply: Boolean - /** + val config: DocumentedMassPatchAction.Settings, + val api: ChatClient, + val autoApply: Boolean + /** * Server for handling documented mass code patches * @param config Settings containing project and file configurations * @param api ChatClient for AI interactions diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MassPatchAction.kt b/src/main/kotlin/aicoder/actions/agent/MassPatchAction.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MassPatchAction.kt rename to src/main/kotlin/aicoder/actions/agent/MassPatchAction.kt index 05c87669..3e614356 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MassPatchAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/MassPatchAction.kt @@ -1,12 +1,9 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.MassPatchAction.Settings -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.MassPatchAction.Settings +import aicoder.actions.generate.items import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project @@ -14,6 +11,11 @@ import com.intellij.openapi.ui.DialogWrapper import com.intellij.ui.CheckBoxList import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.JBTextArea +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils.Companion.isLLMIncludableFile import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt b/src/main/kotlin/aicoder/actions/agent/MultiStepPatchAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt rename to src/main/kotlin/aicoder/actions/agent/MultiStepPatchAction.kt index d43e4d1c..cde9ac34 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiStepPatchAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/MultiStepPatchAction.kt @@ -1,15 +1,16 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent import ai.grazie.utils.mpp.UUID -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ChatClient diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineAction.kt b/src/main/kotlin/aicoder/actions/agent/OutlineAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineAction.kt rename to src/main/kotlin/aicoder/actions/agent/OutlineAction.kt index 6e3fc363..fdd92b0e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/OutlineAction.kt @@ -1,12 +1,13 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.skyenet.apps.general.OutlineApp import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.webui.application.AppInfoData diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineConfigDialog.kt b/src/main/kotlin/aicoder/actions/agent/OutlineConfigDialog.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineConfigDialog.kt rename to src/main/kotlin/aicoder/actions/agent/OutlineConfigDialog.kt index 379adc1a..42cec9f8 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/OutlineConfigDialog.kt +++ b/src/main/kotlin/aicoder/actions/agent/OutlineConfigDialog.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.config.AppSettingsState +import aicoder.actions.ModelSelectionDialog import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.ValidationInfo @@ -8,6 +8,7 @@ import com.intellij.ui.components.JBList import com.intellij.ui.dsl.builder.Align import com.intellij.ui.dsl.builder.bindSelected import com.intellij.ui.dsl.builder.panel +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.models.ChatModel import com.simiacryptus.jopenai.models.chatModel import javax.swing.* diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ShellCommandAction.kt b/src/main/kotlin/aicoder/actions/agent/ShellCommandAction.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ShellCommandAction.kt rename to src/main/kotlin/aicoder/actions/agent/ShellCommandAction.kt index 6fed9431..ae492d55 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/ShellCommandAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/ShellCommandAction.kt @@ -1,13 +1,14 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.code.CodingAgent diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SimpleCommandAction.kt b/src/main/kotlin/aicoder/actions/agent/SimpleCommandAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SimpleCommandAction.kt rename to src/main/kotlin/aicoder/actions/agent/SimpleCommandAction.kt index 934f1965..f480662c 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/SimpleCommandAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/SimpleCommandAction.kt @@ -1,14 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.agent -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils import com.simiacryptus.diff.FileValidationUtils.Companion.filteredWalk import com.simiacryptus.diff.FileValidationUtils.Companion.isGitignore @@ -277,7 +278,7 @@ class SimpleCommandAction : BaseAction() { model = AppSettingsState.instance.smartModel.chatModel() ).answer( listOf( - "We are working on executing the following directive:\n\n${tripleTilde}\n$userMessage\n${tripleTilde}\n\nFocus on the task at hand:\n ${ + "We are working on executing the following directive:\n\n$tripleTilde\n$userMessage\n$tripleTilde\n\nFocus on the task at hand:\n ${ planTask.message?.replace( "\n", "\n " diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/WebDevelopmentAssistantAction.kt b/src/main/kotlin/aicoder/actions/agent/WebDevelopmentAssistantAction.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/WebDevelopmentAssistantAction.kt rename to src/main/kotlin/aicoder/actions/agent/WebDevelopmentAssistantAction.kt index d000e46a..5ff0bb80 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/WebDevelopmentAssistantAction.kt +++ b/src/main/kotlin/aicoder/actions/agent/WebDevelopmentAssistantAction.kt @@ -1,14 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.generic - -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient -import com.github.simiacryptus.aicoder.util.UITools +package aicoder.actions.agent + +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.IdeaOpenAIClient +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ChatClient diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt b/src/main/kotlin/aicoder/actions/chat/CodeChatAction.kt similarity index 85% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt rename to src/main/kotlin/aicoder/actions/chat/CodeChatAction.kt index fae06b86..01742c8f 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CodeChatAction.kt +++ b/src/main/kotlin/aicoder/actions/chat/CodeChatAction.kt @@ -1,15 +1,16 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.chat -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.LanguageUtils +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.fileEditor.FileDocumentManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.CodeChatSocketManager +import com.simiacryptus.aicoder.util.LanguageUtils import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt b/src/main/kotlin/aicoder/actions/chat/DiffChatAction.kt similarity index 94% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt rename to src/main/kotlin/aicoder/actions/chat/DiffChatAction.kt index 7b6d3f57..d743d918 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/DiffChatAction.kt +++ b/src/main/kotlin/aicoder/actions/chat/DiffChatAction.kt @@ -1,12 +1,7 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.chat -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -15,6 +10,12 @@ import com.intellij.openapi.editor.Document import com.intellij.openapi.editor.Editor import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.util.TextRange +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.CodeChatSocketManager +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.addApplyDiffLinks import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt b/src/main/kotlin/aicoder/actions/chat/GenericChatAction.kt similarity index 82% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt rename to src/main/kotlin/aicoder/actions/chat/GenericChatAction.kt index ea68126e..89a29678 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenericChatAction.kt +++ b/src/main/kotlin/aicoder/actions/chat/GenericChatAction.kt @@ -1,13 +1,13 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.chat -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session @@ -34,8 +34,12 @@ class GenericChatAction : BaseAction() { progress.text = "Setting up chat session..." val session = Session.newGlobalID() - SessionProxyServer.metadataStorage.setSessionName(null, session, "${javaClass.simpleName} @ ${SimpleDateFormat("HH:mm:ss").format(System.currentTimeMillis())}") - SessionProxyServer.agents[session] = ChatSocketManager( + aicoder.actions.SessionProxyServer.metadataStorage.setSessionName( + null, + session, + "${javaClass.simpleName} @ ${SimpleDateFormat("HH:mm:ss").format(System.currentTimeMillis())}" + ) + aicoder.actions.SessionProxyServer.agents[session] = ChatSocketManager( session = session, model = model, initialAssistantPrompt = "", diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/LargeOutputChatAction.kt b/src/main/kotlin/aicoder/actions/chat/LargeOutputChatAction.kt similarity index 90% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/LargeOutputChatAction.kt rename to src/main/kotlin/aicoder/actions/chat/LargeOutputChatAction.kt index 9222b0e6..e5085a11 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/LargeOutputChatAction.kt +++ b/src/main/kotlin/aicoder/actions/chat/LargeOutputChatAction.kt @@ -1,20 +1,21 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.chat -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.EnhancedChatSocketManager +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.actors.LargeOutputActor import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.webui.application.AppInfoData import com.simiacryptus.skyenet.webui.application.ApplicationServer -import com.simiacryptus.skyenet.webui.chat.ChatSocketManager import org.slf4j.LoggerFactory import java.text.SimpleDateFormat diff --git a/src/main/kotlin/aicoder/actions/chat/MultiCodeChatAction.kt b/src/main/kotlin/aicoder/actions/chat/MultiCodeChatAction.kt new file mode 100644 index 00000000..74c9dd15 --- /dev/null +++ b/src/main/kotlin/aicoder/actions/chat/MultiCodeChatAction.kt @@ -0,0 +1,215 @@ +package aicoder.actions.chat + +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.MultiStepPatchAction +import aicoder.actions.agent.toFile +import com.intellij.openapi.actionSystem.ActionUpdateThread +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.PlatformDataKeys +import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.diff.addApplyFileDiffLinks +import com.simiacryptus.jopenai.API +import com.simiacryptus.jopenai.ChatClient +import com.simiacryptus.jopenai.models.chatModel +import com.simiacryptus.jopenai.util.GPT4Tokenizer +import com.simiacryptus.skyenet.Retryable +import com.simiacryptus.skyenet.core.actors.SimpleActor +import com.simiacryptus.skyenet.core.platform.Session +import com.simiacryptus.skyenet.core.platform.model.User +import com.simiacryptus.skyenet.core.util.getModuleRootForFile +import com.simiacryptus.skyenet.util.MarkdownUtil +import com.simiacryptus.skyenet.webui.application.AppInfoData +import com.simiacryptus.skyenet.webui.application.ApplicationInterface +import com.simiacryptus.skyenet.webui.application.ApplicationServer +import org.slf4j.LoggerFactory +import java.io.File +import java.nio.file.Path +import java.text.SimpleDateFormat +import java.util.* + +/** + * Action that enables multi-file code chat functionality. + * Allows users to select multiple files and discuss them with an AI assistant. + * Supports code modifications through patch application. + * + * @see BaseAction + */ + +class MultiCodeChatAction : BaseAction() { + override fun getActionUpdateThread() = ActionUpdateThread.BGT + + override fun handle(event: AnActionEvent) { + var root: Path? = null + val codeFiles: MutableSet = mutableSetOf() + fun codeSummary() = codeFiles.filter { + root!!.resolve(it).toFile().exists() + }.associateWith { root!!.resolve(it).toFile().readText(Charsets.UTF_8) } + .entries.joinToString("\n\n") { (path, code) -> + val extension = path.toString().split('.').lastOrNull()?.let { /*escapeHtml4*/(it)/*.indent(" ")*/ } + "# $path\n```$extension\n$code\n```" + } + + val dataContext = event.dataContext + val virtualFiles = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext) + val folder = UITools.getSelectedFolder(event) + root = if (null != folder) { + folder.toFile.toPath() + } else { + getModuleRootForFile(UITools.getSelectedFile(event)?.parent?.toFile ?: throw RuntimeException("")).toPath() + } + val files = getFiles(virtualFiles, root!!) + codeFiles.addAll(files) + + try { + UITools.runAsync(event.project, "Initializing Chat", true) { progress -> + progress.isIndeterminate = true + progress.text = "Setting up chat session..." + val session = Session.newGlobalID() + SessionProxyServer.metadataStorage.setSessionName( + null, + session, + "${javaClass.simpleName} @ ${SimpleDateFormat("HH:mm:ss").format(System.currentTimeMillis())}" + ) + SessionProxyServer.chats[session] = PatchApp(root.toFile(), { codeSummary() }, codeFiles) + ApplicationServer.appInfoMap[session] = AppInfoData( + applicationName = "Code Chat", + singleInput = false, + stickyInput = true, + loadImages = false, + showMenubar = false + ) + val server = AppServer.getServer(event.project) + launchBrowser(server, session.toString()) + } + } catch (e: Throwable) { + UITools.error(log, "Failed to initialize chat session", e) + } + } + + private fun launchBrowser(server: AppServer, session: String) { + + Thread { + Thread.sleep(500) + try { + val uri = server.server.uri.resolve("/#$session") + BaseAction.log.info("Opening browser to $uri") + BrowseUtil.browse(uri) + } catch (e: Throwable) { + log.warn("Error opening browser", e) + } + }.start() + } + + override fun isEnabled(event: AnActionEvent): Boolean { + UITools.getSelectedFile(event) ?: return false + return super.isEnabled(event) + } + + /** Application class that handles the chat interface and code modifications */ + private inner class PatchApp( + override val root: File, + val codeSummary: () -> String, + val codeFiles: Set = setOf(), + ) : ApplicationServer( + applicationName = "Multi-file Patch Chat", + path = "/patchChat", + showMenubar = false, + ) { + override val singleInput = false + override val stickyInput = true + + private val mainActor: SimpleActor + get() = SimpleActor( + prompt = (""" + You are a helpful AI that helps people with coding. + + You will be answering questions about the following code: + + """.trimIndent() + codeSummary()).trim(), + model = AppSettingsState.instance.smartModel.chatModel() + ) + + /** + * Handles user messages in the chat interface + * + * @throws RuntimeException if API calls fail + * @throws IOException if file operations fail + */ + override fun userMessage( + session: Session, + user: User?, + userMessage: String, + ui: ApplicationInterface, + api: API + ) { + val settings = getSettings(session, user) ?: MultiStepPatchAction.AutoDevApp.Settings() + if (api is ChatClient) api.budget = settings.budget ?: 2.00 + val task = ui.newTask() + val codex = GPT4Tokenizer() + val api = (api as ChatClient).getChildClient().apply { + val createFile = task.createFile(".logs/api-${UUID.randomUUID()}.log") + createFile.second?.apply { + logStreams += this.outputStream().buffered() + task.verbose("API log: $this") + } + } + task.echo(MarkdownUtil.renderMarkdown(userMessage)) + task.verbose(MarkdownUtil.renderMarkdown(codeFiles.joinToString("\n") { path -> + "* $path - ${codex.estimateTokenCount(root.resolve(path.toFile()).readText())} tokens" + })) + val toInput = { it: String -> listOf(codeSummary(), it) } + Retryable( + ui = ui, + task = task, + process = { content -> + "
" + MarkdownUtil.renderMarkdown(mainActor.answer(toInput(userMessage), api = api)) { + ui.socketManager?.addApplyFileDiffLinks( + root = root.toPath(), + response = it, + handle = { newCodeMap -> + newCodeMap.forEach { (path, newCode) -> + content.append("$path Updated") + } + }, + ui = ui, + api = api, + )!! + } + "
" + + }, + ) + } + } + + /** + * Recursively collects files from the selected virtual files + * + * @param virtualFiles Array of selected virtual files + * @param root Project root path + * @return Set of relative paths to the selected files + */ + private fun getFiles( + virtualFiles: Array?, + root: Path + ): Set { + val codeFiles = mutableSetOf() + virtualFiles?.forEach { file -> + if (file.isDirectory && !file.name.startsWith(".")) { + getFiles(file.children, root) + } else { + codeFiles.add(root.relativize(file.toNioPath())) + } + } + return codeFiles + } + + companion object { + private val log = LoggerFactory.getLogger(MultiCodeChatAction::class.java) + + } +} \ No newline at end of file diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiDiffChatAction.kt b/src/main/kotlin/aicoder/actions/chat/MultiDiffChatAction.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiDiffChatAction.kt rename to src/main/kotlin/aicoder/actions/chat/MultiDiffChatAction.kt index 45880601..48958321 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiDiffChatAction.kt +++ b/src/main/kotlin/aicoder/actions/chat/MultiDiffChatAction.kt @@ -1,15 +1,17 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.chat -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.MultiStepPatchAction.AutoDevApp.Settings -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.MultiStepPatchAction.AutoDevApp.Settings +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ChatClient diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/ApplyPatchAction.kt b/src/main/kotlin/aicoder/actions/dev/ApplyPatchAction.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/ApplyPatchAction.kt rename to src/main/kotlin/aicoder/actions/dev/ApplyPatchAction.kt index 693507b0..be973873 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/ApplyPatchAction.kt +++ b/src/main/kotlin/aicoder/actions/dev/ApplyPatchAction.kt @@ -1,13 +1,15 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions.dev -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.ui.Messages import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiManager +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.IterativePatchUtil + /** * Action that allows applying a patch to selected files in the IDE. */ diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt b/src/main/kotlin/aicoder/actions/dev/LineFilterChatAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt rename to src/main/kotlin/aicoder/actions/dev/LineFilterChatAction.kt index 491b8f92..598283ee 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/LineFilterChatAction.kt +++ b/src/main/kotlin/aicoder/actions/dev/LineFilterChatAction.kt @@ -1,12 +1,7 @@ -package com.github.simiacryptus.aicoder.actions.dev +package aicoder.actions.dev -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -14,6 +9,11 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.editor.Editor import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt b/src/main/kotlin/aicoder/actions/dev/PrintTreeAction.kt similarity index 87% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt rename to src/main/kotlin/aicoder/actions/dev/PrintTreeAction.kt index 531662d3..3e8ed56c 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/dev/PrintTreeAction.kt +++ b/src/main/kotlin/aicoder/actions/dev/PrintTreeAction.kt @@ -1,12 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.dev +package aicoder.actions.dev -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.psi.PsiUtil +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.psi.PsiUtil import org.slf4j.LoggerFactory /** diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.kt b/src/main/kotlin/aicoder/actions/editor/CustomEditAction.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.kt rename to src/main/kotlin/aicoder/actions/editor/CustomEditAction.kt index 0857f4cc..d7cea7c6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/CustomEditAction.kt +++ b/src/main/kotlin/aicoder/actions/editor/CustomEditAction.kt @@ -1,12 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.code +package aicoder.actions.editor -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy import javax.swing.JOptionPane diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/DescribeAction.kt b/src/main/kotlin/aicoder/actions/editor/DescribeAction.kt similarity index 88% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/DescribeAction.kt rename to src/main/kotlin/aicoder/actions/editor/DescribeAction.kt index e9fc280e..8cf9c8d2 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/DescribeAction.kt +++ b/src/main/kotlin/aicoder/actions/editor/DescribeAction.kt @@ -1,10 +1,6 @@ -package com.github.simiacryptus.aicoder.actions.code +package aicoder.actions.editor -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.IndentedText -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -14,6 +10,10 @@ import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.IndentedText +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy @@ -82,7 +82,7 @@ class DescribeAction : SelectionAction() { state.language?.name ?: state.editor?.virtualFile?.extension ?: "", AppSettingsState.instance.humanLanguage ).text ?: throw IllegalStateException("Failed to generate description") - val wrapping = com.github.simiacryptus.aicoder.util.StringUtil.lineWrapping(description.trim(), 120) + val wrapping = com.simiacryptus.aicoder.util.StringUtil.lineWrapping(description.trim(), 120) val numberOfLines = wrapping.trim().split("\n").reversed().dropWhile { it.isEmpty() }.size val commentStyle = if (numberOfLines == 1) { state.language?.lineComment diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/PasteAction.kt b/src/main/kotlin/aicoder/actions/editor/PasteAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/PasteAction.kt rename to src/main/kotlin/aicoder/actions/editor/PasteAction.kt index d0a8a3b6..b0a3a72c 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/PasteAction.kt +++ b/src/main/kotlin/aicoder/actions/editor/PasteAction.kt @@ -1,13 +1,13 @@ -package com.github.simiacryptus.aicoder.actions.code +package aicoder.actions.editor // ... keep existing imports -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage import com.simiacryptus.jopenai.ChatClient import com.simiacryptus.jopenai.models.ChatModel import com.simiacryptus.jopenai.models.chatModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RecentCodeEditsAction.kt b/src/main/kotlin/aicoder/actions/editor/RecentCodeEditsAction.kt similarity index 87% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RecentCodeEditsAction.kt rename to src/main/kotlin/aicoder/actions/editor/RecentCodeEditsAction.kt index 03236bb9..85692442 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RecentCodeEditsAction.kt +++ b/src/main/kotlin/aicoder/actions/editor/RecentCodeEditsAction.kt @@ -1,13 +1,13 @@ -package com.github.simiacryptus.aicoder.actions.code +package aicoder.actions.editor -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.ActionGroup import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.UITools class RecentCodeEditsAction : ActionGroup() { override fun getActionUpdateThread() = ActionUpdateThread.BGT diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RedoLast.kt b/src/main/kotlin/aicoder/actions/editor/RedoLast.kt similarity index 83% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RedoLast.kt rename to src/main/kotlin/aicoder/actions/editor/RedoLast.kt index 23dac9ef..a3aefda6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/code/RedoLast.kt +++ b/src/main/kotlin/aicoder/actions/editor/RedoLast.kt @@ -1,10 +1,10 @@ -package com.github.simiacryptus.aicoder.actions.code +package aicoder.actions.editor -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.util.UITools.retry +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys +import com.simiacryptus.aicoder.util.UITools.retry /** * The RedoLast action is an IntelliJ action that allows users to redo the last AI Coder action they performed in the editor. diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationAction.kt b/src/main/kotlin/aicoder/actions/find/FindResultsModificationAction.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationAction.kt rename to src/main/kotlin/aicoder/actions/find/FindResultsModificationAction.kt index 6c9cdf54..d62b4ba2 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationAction.kt +++ b/src/main/kotlin/aicoder/actions/find/FindResultsModificationAction.kt @@ -1,14 +1,8 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.find.FindResultsModificationDialog -import com.github.simiacryptus.aicoder.actions.generic.MultiDiffChatAction.Companion.patchEditorPrompt -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.psi.PsiUtil +import aicoder.actions.agent.toFile +import aicoder.actions.chat.MultiDiffChatAction.Companion.patchEditorPrompt +import aicoder.actions.find.FindResultsModificationDialog import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.findPsiFile @@ -16,6 +10,11 @@ import com.intellij.psi.PsiDocumentManager import com.intellij.psi.PsiFile import com.intellij.usages.Usage import com.intellij.usages.UsageView +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.psi.PsiUtil import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.TabbedDisplay diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationDialog.kt b/src/main/kotlin/aicoder/actions/find/FindResultsModificationDialog.kt similarity index 94% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationDialog.kt rename to src/main/kotlin/aicoder/actions/find/FindResultsModificationDialog.kt index 38ded65c..6d2eec3b 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/find/FindResultsModificationDialog.kt +++ b/src/main/kotlin/aicoder/actions/find/FindResultsModificationDialog.kt @@ -1,10 +1,9 @@ -package com.github.simiacryptus.aicoder.actions.find +package aicoder.actions.find import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.ValidationInfo import com.intellij.ui.dsl.builder.* -import com.intellij.ui.dsl.gridLayout.HorizontalAlign import javax.swing.JComponent class FindResultsModificationDialog( diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateFileFromDescriptionAction.kt b/src/main/kotlin/aicoder/actions/generate/CreateFileFromDescriptionAction.kt similarity index 94% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateFileFromDescriptionAction.kt rename to src/main/kotlin/aicoder/actions/generate/CreateFileFromDescriptionAction.kt index ce8a9b48..d739c164 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateFileFromDescriptionAction.kt +++ b/src/main/kotlin/aicoder/actions/generate/CreateFileFromDescriptionAction.kt @@ -1,22 +1,21 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.generate -import com.github.simiacryptus.aicoder.actions.FileContextAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.ApiModel.* import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.util.ClientUtil.toContentList import java.io.File import javax.swing.JTextArea -class CreateFileFromDescriptionAction : FileContextAction(false, true) { +class CreateFileFromDescriptionAction : aicoder.actions.FileContextAction(false, true) { override fun getActionUpdateThread() = ActionUpdateThread.BGT private val log = Logger.getInstance(CreateFileFromDescriptionAction::class.java) companion object { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateImageAction.kt b/src/main/kotlin/aicoder/actions/generate/CreateImageAction.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateImageAction.kt rename to src/main/kotlin/aicoder/actions/generate/CreateImageAction.kt index ccef9a12..19616a6d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/CreateImageAction.kt +++ b/src/main/kotlin/aicoder/actions/generate/CreateImageAction.kt @@ -1,10 +1,7 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.generate -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.AppSettingsState.Companion.imageModel -import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys @@ -13,6 +10,10 @@ import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager import com.intellij.util.ui.JBUI +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.AppSettingsState.Companion.imageModel +import com.simiacryptus.aicoder.util.IdeaOpenAIClient +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.actors.ImageActor import com.simiacryptus.skyenet.core.actors.ImageResponse diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateDocumentationAction.kt b/src/main/kotlin/aicoder/actions/generate/GenerateDocumentationAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateDocumentationAction.kt rename to src/main/kotlin/aicoder/actions/generate/GenerateDocumentationAction.kt index ff0b0350..0660c7fb 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateDocumentationAction.kt +++ b/src/main/kotlin/aicoder/actions/generate/GenerateDocumentationAction.kt @@ -1,11 +1,7 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.generate -import com.github.simiacryptus.aicoder.actions.FileContextAction -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.Companion.getProjectStructure -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.test.TestResultAutofixAction +import aicoder.actions.test.TestResultAutofixAction.Companion.getProjectStructure import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager @@ -19,6 +15,9 @@ import com.intellij.ui.CheckBoxList import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.JBTextArea import com.intellij.ui.components.JBTextField +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.ApiModel import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.util.ClientUtil.toContentList @@ -37,7 +36,7 @@ import java.util.concurrent.TimeoutException import javax.swing.* -class GenerateDocumentationAction : FileContextAction() { +class GenerateDocumentationAction : aicoder.actions.FileContextAction() { override fun getActionUpdateThread() = ActionUpdateThread.BGT override fun isEnabled(event: AnActionEvent): Boolean { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateRelatedFileAction.kt b/src/main/kotlin/aicoder/actions/generate/GenerateRelatedFileAction.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateRelatedFileAction.kt rename to src/main/kotlin/aicoder/actions/generate/GenerateRelatedFileAction.kt index 205f8e9a..07b940e8 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/GenerateRelatedFileAction.kt +++ b/src/main/kotlin/aicoder/actions/generate/GenerateRelatedFileAction.kt @@ -1,9 +1,5 @@ -package com.github.simiacryptus.aicoder.actions.generic +package aicoder.actions.generate -import com.github.simiacryptus.aicoder.actions.FileContextAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager @@ -12,6 +8,9 @@ import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.LocalFileSystem +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.ApiModel import com.simiacryptus.jopenai.models.ApiModel.ChatMessage import com.simiacryptus.jopenai.models.ApiModel.Role @@ -27,7 +26,7 @@ import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicReference import javax.swing.JTextArea -class GenerateRelatedFileAction : FileContextAction() { +class GenerateRelatedFileAction : aicoder.actions.FileContextAction() { private val log = Logger.getInstance(GenerateRelatedFileAction::class.java) override fun getActionUpdateThread() = ActionUpdateThread.BGT diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitAction.kt b/src/main/kotlin/aicoder/actions/git/ChatWithCommitAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitAction.kt rename to src/main/kotlin/aicoder/actions/git/ChatWithCommitAction.kt index 1b46bfc3..345f96b3 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitAction.kt +++ b/src/main/kotlin/aicoder/actions/git/ChatWithCommitAction.kt @@ -1,11 +1,6 @@ -package com.github.simiacryptus.aicoder.actions.git +package aicoder.actions.git -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.IdeaChatClient +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -13,6 +8,11 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.vcs.VcsDataKeys import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.CodeChatSocketManager +import com.simiacryptus.aicoder.util.IdeaChatClient import com.simiacryptus.diff.IterativePatchUtil import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitDiffAction.kt b/src/main/kotlin/aicoder/actions/git/ChatWithCommitDiffAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitDiffAction.kt rename to src/main/kotlin/aicoder/actions/git/ChatWithCommitDiffAction.kt index db57ab7d..9439e10e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithCommitDiffAction.kt +++ b/src/main/kotlin/aicoder/actions/git/ChatWithCommitDiffAction.kt @@ -1,13 +1,7 @@ -package com.github.simiacryptus.aicoder.actions.git +package aicoder.actions.git -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.IdeaChatClient -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project @@ -20,6 +14,12 @@ import com.intellij.openapi.vcs.changes.CurrentContentRevision import com.intellij.openapi.vcs.changes.TextRevisionNumber import com.intellij.openapi.vcs.history.VcsRevisionNumber import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.CodeChatSocketManager +import com.simiacryptus.aicoder.util.IdeaChatClient +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt b/src/main/kotlin/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt rename to src/main/kotlin/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt index 132e2804..6f49626e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt +++ b/src/main/kotlin/aicoder/actions/git/ChatWithWorkingCopyDiffAction.kt @@ -1,16 +1,16 @@ -package com.github.simiacryptus.aicoder.actions.git - -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.CodeChatSocketManager -import com.github.simiacryptus.aicoder.util.IdeaChatClient +package aicoder.actions.git + +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.vcs.VcsDataKeys import com.intellij.openapi.vcs.changes.ChangeListManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.CodeChatSocketManager +import com.simiacryptus.aicoder.util.IdeaChatClient import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ReplicateCommitAction.kt b/src/main/kotlin/aicoder/actions/git/ReplicateCommitAction.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ReplicateCommitAction.kt rename to src/main/kotlin/aicoder/actions/git/ReplicateCommitAction.kt index 31f4d0c6..234875b0 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/git/ReplicateCommitAction.kt +++ b/src/main/kotlin/aicoder/actions/git/ReplicateCommitAction.kt @@ -1,12 +1,8 @@ -package com.github.simiacryptus.aicoder.actions.git +package aicoder.actions.git -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -17,6 +13,10 @@ import com.intellij.openapi.ui.Messages import com.intellij.openapi.vcs.VcsDataKeys import com.intellij.openapi.vcs.changes.Change import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils import com.simiacryptus.diff.IterativePatchUtil import com.simiacryptus.diff.addApplyFileDiffLinks diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt b/src/main/kotlin/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt rename to src/main/kotlin/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt index 093f2253..da59c41e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt +++ b/src/main/kotlin/aicoder/actions/knowledge/CreateProjectorFromQueryIndexAction.kt @@ -1,14 +1,14 @@ -package com.github.simiacryptus.aicoder.actions.knowledge +package aicoder.actions.knowledge -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.findRecursively +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.findRecursively import com.simiacryptus.skyenet.apps.parse.DocumentRecord import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.core.platform.model.User diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorAction.kt b/src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorAction.kt rename to src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorAction.kt index 1a9b7632..e4bbc9ce 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorAction.kt +++ b/src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorAction.kt @@ -1,15 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.knowledge +package aicoder.actions.knowledge -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.findRecursively +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.findRecursively import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.parse.DocumentParserApp import com.simiacryptus.skyenet.apps.parse.DocumentParsingModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt b/src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt rename to src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt index 164b37ec..60195bf5 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt +++ b/src/main/kotlin/aicoder/actions/knowledge/DocumentDataExtractorConfigDialog.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.actions.knowledge +package aicoder.actions.knowledge import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt b/src/main/kotlin/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt rename to src/main/kotlin/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt index 14d4cebc..c4e2b7f7 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt +++ b/src/main/kotlin/aicoder/actions/knowledge/SaveAsQueryIndexAction.kt @@ -1,14 +1,14 @@ -package com.github.simiacryptus.aicoder.actions.knowledge +package aicoder.actions.knowledge -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.util.IdeaOpenAIClient -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.findRecursively +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.progress.ProgressManager import com.intellij.openapi.progress.Task +import com.simiacryptus.aicoder.util.IdeaOpenAIClient +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.findRecursively import com.simiacryptus.skyenet.apps.parse.DocumentRecord.Companion.saveAsBinary import com.simiacryptus.skyenet.apps.parse.ProgressState import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/AppendTextWithChatAction.kt b/src/main/kotlin/aicoder/actions/legacy/AppendTextWithChatAction.kt similarity index 90% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/AppendTextWithChatAction.kt rename to src/main/kotlin/aicoder/actions/legacy/AppendTextWithChatAction.kt index 5d33e7ca..aff67565 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/AppendTextWithChatAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/AppendTextWithChatAction.kt @@ -1,12 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.ApiModel.* import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.util.ClientUtil.toContentList diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/CommentsAction.kt b/src/main/kotlin/aicoder/actions/legacy/CommentsAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/CommentsAction.kt rename to src/main/kotlin/aicoder/actions/legacy/CommentsAction.kt index b66ef7e6..53d0addc 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/CommentsAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/CommentsAction.kt @@ -1,12 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/DocAction.kt b/src/main/kotlin/aicoder/actions/legacy/DocAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/DocAction.kt rename to src/main/kotlin/aicoder/actions/legacy/DocAction.kt index 4e5d342b..77a3e84f 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/DocAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/DocAction.kt @@ -1,14 +1,14 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.IndentedText -import com.github.simiacryptus.aicoder.util.psi.PsiUtil +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.IndentedText +import com.simiacryptus.aicoder.util.psi.PsiUtil import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ImplementStubAction.kt b/src/main/kotlin/aicoder/actions/legacy/ImplementStubAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ImplementStubAction.kt rename to src/main/kotlin/aicoder/actions/legacy/ImplementStubAction.kt index b2f7a3ed..2b216ab4 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ImplementStubAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/ImplementStubAction.kt @@ -1,15 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.psi.PsiUtil +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.psi.PsiUtil import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy import com.simiacryptus.util.StringUtil diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/InsertImplementationAction.kt b/src/main/kotlin/aicoder/actions/legacy/InsertImplementationAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/InsertImplementationAction.kt rename to src/main/kotlin/aicoder/actions/legacy/InsertImplementationAction.kt index 4d82c452..b902eee4 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/InsertImplementationAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/InsertImplementationAction.kt @@ -1,17 +1,17 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.TextBlock -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.psi.PsiClassContext -import com.github.simiacryptus.aicoder.util.psi.PsiUtil +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.runReadAction import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.TextBlock +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.psi.PsiClassContext +import com.simiacryptus.aicoder.util.psi.PsiUtil import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/OpenWebPageAction.kt b/src/main/kotlin/aicoder/actions/legacy/OpenWebPageAction.kt similarity index 71% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/OpenWebPageAction.kt rename to src/main/kotlin/aicoder/actions/legacy/OpenWebPageAction.kt index 65951ac3..e6a80aa1 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/OpenWebPageAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/OpenWebPageAction.kt @@ -1,8 +1,8 @@ -package com.github.simiacryptus.aicoder.actions +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent +import com.simiacryptus.aicoder.util.BrowseUtil.browse import java.net.URI class OpenWebPageAction : AnAction() { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/RenameVariablesAction.kt b/src/main/kotlin/aicoder/actions/legacy/RenameVariablesAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/RenameVariablesAction.kt rename to src/main/kotlin/aicoder/actions/legacy/RenameVariablesAction.kt index d61520d2..a23edfd5 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/RenameVariablesAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/RenameVariablesAction.kt @@ -1,14 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.LanguageUtils -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt b/src/main/kotlin/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt rename to src/main/kotlin/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt index 4cf25fa2..074c31d9 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/ReplaceWithSuggestionsAction.kt @@ -1,12 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy import com.simiacryptus.util.StringUtil diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/VoiceToTextAction.kt b/src/main/kotlin/aicoder/actions/legacy/VoiceToTextAction.kt similarity index 95% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/VoiceToTextAction.kt rename to src/main/kotlin/aicoder/actions/legacy/VoiceToTextAction.kt index 17c76f0b..78c17392 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/legacy/VoiceToTextAction.kt +++ b/src/main/kotlin/aicoder/actions/legacy/VoiceToTextAction.kt @@ -1,13 +1,13 @@ -package com.github.simiacryptus.aicoder.actions.legacy +package aicoder.actions.legacy -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.command.WriteCommandAction +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.audio.AudioRecorder import com.simiacryptus.jopenai.audio.LookbackLoudnessWindowBuffer import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.kt b/src/main/kotlin/aicoder/actions/markdown/MarkdownImplementActionGroup.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.kt rename to src/main/kotlin/aicoder/actions/markdown/MarkdownImplementActionGroup.kt index 198aa0e6..2c526ed6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownImplementActionGroup.kt +++ b/src/main/kotlin/aicoder/actions/markdown/MarkdownImplementActionGroup.kt @@ -1,15 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.markdown +package aicoder.actions.markdown -import com.github.simiacryptus.aicoder.actions.SelectionAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.SelectionAction import com.intellij.openapi.actionSystem.ActionGroup import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.ComputerLanguage +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy import org.slf4j.LoggerFactory diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt b/src/main/kotlin/aicoder/actions/markdown/MarkdownListAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt rename to src/main/kotlin/aicoder/actions/markdown/MarkdownListAction.kt index b8fd5dce..39614b0e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/markdown/MarkdownListAction.kt +++ b/src/main/kotlin/aicoder/actions/markdown/MarkdownListAction.kt @@ -1,12 +1,6 @@ -package com.github.simiacryptus.aicoder.actions.markdown +package aicoder.actions.markdown -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.UITools -import com.github.simiacryptus.aicoder.util.UITools.getIndent -import com.github.simiacryptus.aicoder.util.UITools.insertString -import com.github.simiacryptus.aicoder.util.psi.PsiUtil.getAll -import com.github.simiacryptus.aicoder.util.psi.PsiUtil.getSmallestIntersecting +import aicoder.actions.BaseAction import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -14,6 +8,12 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.diagnostic.Logger import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.UITools.getIndent +import com.simiacryptus.aicoder.util.UITools.insertString +import com.simiacryptus.aicoder.util.psi.PsiUtil.getAll +import com.simiacryptus.aicoder.util.psi.PsiUtil.getSmallestIntersecting import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.proxy.ChatProxy import com.simiacryptus.util.StringUtil diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/AutoPlanChatAction.kt b/src/main/kotlin/aicoder/actions/plan/AutoPlanChatAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/AutoPlanChatAction.kt rename to src/main/kotlin/aicoder/actions/plan/AutoPlanChatAction.kt index 7cadbb8c..25ff5e22 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/AutoPlanChatAction.kt +++ b/src/main/kotlin/aicoder/actions/plan/AutoPlanChatAction.kt @@ -1,17 +1,17 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.SimpleCommandAction.Companion.tripleTilde -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.SimpleCommandAction.Companion.tripleTilde +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.general.AutoPlanChatApp diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanAheadAction.kt b/src/main/kotlin/aicoder/actions/plan/PlanAheadAction.kt similarity index 89% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanAheadAction.kt rename to src/main/kotlin/aicoder/actions/plan/PlanAheadAction.kt index 0f6a535c..57a4f63e 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanAheadAction.kt +++ b/src/main/kotlin/aicoder/actions/plan/PlanAheadAction.kt @@ -1,14 +1,14 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.general.PlanAheadApp import com.simiacryptus.skyenet.apps.plan.PlanSettings diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanChatAction.kt b/src/main/kotlin/aicoder/actions/plan/PlanChatAction.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanChatAction.kt rename to src/main/kotlin/aicoder/actions/plan/PlanChatAction.kt index ff3c00fe..2c205bf4 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanChatAction.kt +++ b/src/main/kotlin/aicoder/actions/plan/PlanChatAction.kt @@ -1,16 +1,16 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.command.WriteCommandAction +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.general.PlanChatApp import com.simiacryptus.skyenet.apps.plan.PlanSettings diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanConfigDialog.kt b/src/main/kotlin/aicoder/actions/plan/PlanConfigDialog.kt similarity index 99% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanConfigDialog.kt rename to src/main/kotlin/aicoder/actions/plan/PlanConfigDialog.kt index c9197162..01ed64e1 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PlanConfigDialog.kt +++ b/src/main/kotlin/aicoder/actions/plan/PlanConfigDialog.kt @@ -1,6 +1,5 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.config.AppSettingsState import com.intellij.openapi.project.Project import com.intellij.openapi.ui.ComboBox import com.intellij.openapi.ui.DialogWrapper @@ -11,11 +10,12 @@ import com.intellij.ui.dsl.builder.Align import com.intellij.ui.dsl.builder.RowLayout import com.intellij.ui.dsl.builder.panel import com.intellij.ui.table.JBTable +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.models.ChatModel -import com.simiacryptus.skyenet.apps.plan.tools.CommandAutoFixTask import com.simiacryptus.skyenet.apps.plan.PlanSettings import com.simiacryptus.skyenet.apps.plan.TaskSettingsBase import com.simiacryptus.skyenet.apps.plan.TaskType +import com.simiacryptus.skyenet.apps.plan.tools.CommandAutoFixTask import java.awt.CardLayout import java.awt.Component import java.awt.Dimension diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PrePlanAction.kt b/src/main/kotlin/aicoder/actions/plan/PrePlanAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PrePlanAction.kt rename to src/main/kotlin/aicoder/actions/plan/PrePlanAction.kt index e373d902..a6c81695 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/PrePlanAction.kt +++ b/src/main/kotlin/aicoder/actions/plan/PrePlanAction.kt @@ -1,18 +1,18 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.ui.DialogWrapper import com.intellij.openapi.ui.Messages import com.intellij.ui.components.JBLabel import com.intellij.ui.components.JBTextField +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.skyenet.apps.general.PlanAheadApp import com.simiacryptus.skyenet.apps.plan.PlanSettings diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/SingleTaskAction.kt b/src/main/kotlin/aicoder/actions/plan/SingleTaskAction.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/SingleTaskAction.kt rename to src/main/kotlin/aicoder/actions/plan/SingleTaskAction.kt index 14ec338b..a3c7e309 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/plan/SingleTaskAction.kt +++ b/src/main/kotlin/aicoder/actions/plan/SingleTaskAction.kt @@ -1,15 +1,15 @@ -package com.github.simiacryptus.aicoder.actions.plan +package aicoder.actions.plan -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.ActionUpdateThread import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.progress.ProgressIndicator +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils import com.simiacryptus.jopenai.models.chatModel import com.simiacryptus.jopenai.util.GPT4Tokenizer diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/problems/AnalyzeProblemAction.kt b/src/main/kotlin/aicoder/actions/problems/AnalyzeProblemAction.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/problems/AnalyzeProblemAction.kt rename to src/main/kotlin/aicoder/actions/problems/AnalyzeProblemAction.kt index d51ceb22..85c1e2b6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/problems/AnalyzeProblemAction.kt +++ b/src/main/kotlin/aicoder/actions/problems/AnalyzeProblemAction.kt @@ -1,16 +1,12 @@ -package com.github.simiacryptus.aicoder.actions.problems +package aicoder.actions.problems -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.Companion.findGitRoot -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.Companion.getProjectStructure -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.Companion.tripleTilde -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.ParsedError -import com.github.simiacryptus.aicoder.actions.test.TestResultAutofixAction.ParsedErrors -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.IdeaChatClient +import aicoder.actions.SessionProxyServer +import aicoder.actions.agent.toFile +import aicoder.actions.test.TestResultAutofixAction.Companion.findGitRoot +import aicoder.actions.test.TestResultAutofixAction.Companion.getProjectStructure +import aicoder.actions.test.TestResultAutofixAction.Companion.tripleTilde +import aicoder.actions.test.TestResultAutofixAction.ParsedError +import aicoder.actions.test.TestResultAutofixAction.ParsedErrors import com.intellij.analysis.problemsView.toolWindow.ProblemNode import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent @@ -22,6 +18,10 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.util.TextRange import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiManager +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.IdeaChatClient import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.models.chatModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/test/TestResultAutofixAction.kt b/src/main/kotlin/aicoder/actions/test/TestResultAutofixAction.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/actions/test/TestResultAutofixAction.kt rename to src/main/kotlin/aicoder/actions/test/TestResultAutofixAction.kt index 7e1c3127..6dff0819 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/test/TestResultAutofixAction.kt +++ b/src/main/kotlin/aicoder/actions/test/TestResultAutofixAction.kt @@ -1,17 +1,17 @@ -package com.github.simiacryptus.aicoder.actions.test +package aicoder.actions.test -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.IdeaChatClient -import com.github.simiacryptus.aicoder.util.UITools +import aicoder.actions.BaseAction +import aicoder.actions.SessionProxyServer import com.intellij.execution.testframework.AbstractTestProxy import com.intellij.execution.testframework.sm.runner.SMTestProxy import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.PlatformDataKeys import com.intellij.openapi.vfs.VirtualFile +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.util.BrowseUtil.browse +import com.simiacryptus.aicoder.util.IdeaChatClient +import com.simiacryptus.aicoder.util.UITools import com.simiacryptus.diff.FileValidationUtils.Companion.isGitignore import com.simiacryptus.diff.addApplyFileDiffLinks import com.simiacryptus.jopenai.models.chatModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/BaseAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/BaseAction.kt deleted file mode 100644 index ddcd0ed7..00000000 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/BaseAction.kt +++ /dev/null @@ -1,28 +0,0 @@ -package com.github.simiacryptus.aicoder.actions.generic - - import com.intellij.openapi.project.Project - import com.intellij.openapi.application.ApplicationManager - import com.intellij.openapi.command.WriteCommandAction -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.ui.Messages -import com.simiacryptus.jopenai.ChatClient - - abstract class BaseAction : AnAction() { - protected val api: ChatClient by lazy { - ChatClient() - } - - protected fun showError(project: Project?, message: String) { - Messages.showErrorDialog(project, message, "Error") - } - - protected fun showWarning(project: Project?, message: String) { - Messages.showWarningDialog(project, message, "Warning") - } - - protected fun runWriteAction(project: Project, action: () -> Unit) { - WriteCommandAction.runWriteCommandAction(project) { - action() - } - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiCodeChatAction.kt b/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiCodeChatAction.kt deleted file mode 100644 index 3dfaa472..00000000 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/actions/generic/MultiCodeChatAction.kt +++ /dev/null @@ -1,209 +0,0 @@ -package com.github.simiacryptus.aicoder.actions.generic - -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.BaseAction -import com.github.simiacryptus.aicoder.actions.generic.MultiStepPatchAction.AutoDevApp.Settings -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse -import com.github.simiacryptus.aicoder.util.UITools -import com.intellij.openapi.actionSystem.ActionUpdateThread -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.PlatformDataKeys -import com.intellij.openapi.vfs.VirtualFile -import com.simiacryptus.diff.addApplyFileDiffLinks -import com.simiacryptus.jopenai.API -import com.simiacryptus.jopenai.ChatClient -import com.simiacryptus.jopenai.models.chatModel -import com.simiacryptus.jopenai.util.GPT4Tokenizer -import com.simiacryptus.skyenet.Retryable -import com.simiacryptus.skyenet.core.actors.SimpleActor -import com.simiacryptus.skyenet.core.platform.Session -import com.simiacryptus.skyenet.core.platform.model.User -import com.simiacryptus.skyenet.core.util.getModuleRootForFile -import com.simiacryptus.skyenet.util.MarkdownUtil.renderMarkdown -import com.simiacryptus.skyenet.webui.application.AppInfoData -import com.simiacryptus.skyenet.webui.application.ApplicationInterface -import com.simiacryptus.skyenet.webui.application.ApplicationServer -import org.slf4j.LoggerFactory -import java.io.File -import java.nio.file.Path -import java.text.SimpleDateFormat -import java.util.* - -/** - * Action that enables multi-file code chat functionality. - * Allows users to select multiple files and discuss them with an AI assistant. - * Supports code modifications through patch application. - * - * @see BaseAction - */ - -class MultiCodeChatAction : BaseAction() { - override fun getActionUpdateThread() = ActionUpdateThread.BGT - - override fun handle(event: AnActionEvent) { - var root: Path? = null - val codeFiles: MutableSet = mutableSetOf() - fun codeSummary() = codeFiles.filter { - root!!.resolve(it).toFile().exists() - }.associateWith { root!!.resolve(it).toFile().readText(Charsets.UTF_8) } - .entries.joinToString("\n\n") { (path, code) -> - val extension = path.toString().split('.').lastOrNull()?.let { /*escapeHtml4*/(it)/*.indent(" ")*/ } - "# $path\n```$extension\n$code\n```" - } - - val dataContext = event.dataContext - val virtualFiles = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext) - val folder = UITools.getSelectedFolder(event) - root = if (null != folder) { - folder.toFile.toPath() - } else { - getModuleRootForFile(UITools.getSelectedFile(event)?.parent?.toFile ?: throw RuntimeException("")).toPath() - } - val files = getFiles(virtualFiles, root!!) - codeFiles.addAll(files) - - try { - UITools.runAsync(event.project, "Initializing Chat", true) { progress -> - progress.isIndeterminate = true - progress.text = "Setting up chat session..." - val session = Session.newGlobalID() - SessionProxyServer.metadataStorage.setSessionName(null, session, "${javaClass.simpleName} @ ${SimpleDateFormat("HH:mm:ss").format(System.currentTimeMillis())}") - SessionProxyServer.chats[session] = PatchApp(root.toFile(), { codeSummary() }, codeFiles) - ApplicationServer.appInfoMap[session] = AppInfoData( - applicationName = "Code Chat", - singleInput = false, - stickyInput = true, - loadImages = false, - showMenubar = false - ) - val server = AppServer.getServer(event.project) - launchBrowser(server, session.toString()) - } - } catch (e: Throwable) { - UITools.error(log, "Failed to initialize chat session", e) - } - } - - private fun launchBrowser(server: AppServer, session: String) { - - Thread { - Thread.sleep(500) - try { - val uri = server.server.uri.resolve("/#$session") - BaseAction.log.info("Opening browser to $uri") - browse(uri) - } catch (e: Throwable) { - log.warn("Error opening browser", e) - } - }.start() - } - - override fun isEnabled(event: AnActionEvent): Boolean { - UITools.getSelectedFile(event) ?: return false - return super.isEnabled(event) - } - - /** Application class that handles the chat interface and code modifications */ - private inner class PatchApp( - override val root: File, - val codeSummary: () -> String, - val codeFiles: Set = setOf(), - ) : ApplicationServer( - applicationName = "Multi-file Patch Chat", - path = "/patchChat", - showMenubar = false, - ) { - override val singleInput = false - override val stickyInput = true - - private val mainActor: SimpleActor - get() = SimpleActor( - prompt = (""" - You are a helpful AI that helps people with coding. - - You will be answering questions about the following code: - - """.trimIndent() + codeSummary()).trim(), - model = AppSettingsState.instance.smartModel.chatModel() - ) - - /** - * Handles user messages in the chat interface - * - * @throws RuntimeException if API calls fail - * @throws IOException if file operations fail - */ - override fun userMessage( - session: Session, - user: User?, - userMessage: String, - ui: ApplicationInterface, - api: API - ) { - val settings = getSettings(session, user) ?: Settings() - if (api is ChatClient) api.budget = settings.budget ?: 2.00 - val task = ui.newTask() - val codex = GPT4Tokenizer() - val api = (api as ChatClient).getChildClient().apply { - val createFile = task.createFile(".logs/api-${UUID.randomUUID()}.log") - createFile.second?.apply { - logStreams += this.outputStream().buffered() - task.verbose("API log: $this") - } - } - task.echo(renderMarkdown(userMessage)) - task.verbose(renderMarkdown(codeFiles.joinToString("\n") { path -> - "* $path - ${codex.estimateTokenCount(root.resolve(path.toFile()).readText())} tokens" - })) - val toInput = { it: String -> listOf(codeSummary(), it) } - Retryable( - ui = ui, - task = task, - process = { content -> - "
" + renderMarkdown(mainActor.answer(toInput(userMessage), api = api)) { - ui.socketManager?.addApplyFileDiffLinks( - root = root.toPath(), - response = it, - handle = { newCodeMap -> - newCodeMap.forEach { (path, newCode) -> - content.append("$path Updated") - } - }, - ui = ui, - api = api, - )!! - } + "
" - - }, - ) - } - } - - /** - * Recursively collects files from the selected virtual files - * - * @param virtualFiles Array of selected virtual files - * @param root Project root path - * @return Set of relative paths to the selected files - */ - private fun getFiles( - virtualFiles: Array?, - root: Path - ): Set { - val codeFiles = mutableSetOf() - virtualFiles?.forEach { file -> - if (file.isDirectory && !file.name.startsWith(".")) { - getFiles(file.children, root) - } else { - codeFiles.add(root.relativize(file.toNioPath())) - } - } - return codeFiles - } - - companion object { - private val log = LoggerFactory.getLogger(MultiDiffChatAction::class.java) - - } -} \ No newline at end of file diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/AppServer.kt b/src/main/kotlin/com/simiacryptus/aicoder/AppServer.kt similarity index 93% rename from src/main/kotlin/com/github/simiacryptus/aicoder/AppServer.kt rename to src/main/kotlin/com/simiacryptus/aicoder/AppServer.kt index dad60dd7..8a848cf6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/AppServer.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/AppServer.kt @@ -1,8 +1,8 @@ -package com.github.simiacryptus.aicoder +package com.simiacryptus.aicoder -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState +import aicoder.actions.SessionProxyServer import com.intellij.openapi.project.Project +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.skyenet.webui.chat.ChatServer import com.simiacryptus.skyenet.webui.servlet.CorsFilter import jakarta.servlet.DispatcherType diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsComponent.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsComponent.kt index 857c0c49..5baa6b3a 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsComponent.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsComponent.kt @@ -1,8 +1,7 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config -import com.github.simiacryptus.aicoder.actions.plan.PlanConfigDialog.Companion.isVisible -import com.github.simiacryptus.aicoder.util.IdeaChatClient +import aicoder.actions.plan.PlanConfigDialog.Companion.isVisible import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.fileChooser.FileChooser import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory @@ -17,6 +16,7 @@ import com.intellij.ui.components.JBCheckBox import com.intellij.ui.components.JBList import com.intellij.ui.components.JBTextField import com.intellij.ui.table.JBTable +import com.simiacryptus.aicoder.util.IdeaChatClient import com.simiacryptus.jopenai.models.APIProvider import com.simiacryptus.jopenai.models.ChatModel import com.simiacryptus.jopenai.models.ImageModels diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsConfigurable.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsConfigurable.kt similarity index 87% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsConfigurable.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsConfigurable.kt index e9274e76..d4a6bdd6 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsConfigurable.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsConfigurable.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config -import com.github.simiacryptus.aicoder.util.UITools +import com.simiacryptus.aicoder.util.UITools open class AppSettingsConfigurable : UIAdapter( AppSettingsState.instance diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsState.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsState.kt index e800689e..d7436848 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/AppSettingsState.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/AppSettingsState.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config /** * Stores and manages plugin configuration settings. @@ -8,17 +8,16 @@ package com.github.simiacryptus.aicoder.config * framework to save settings across IDE restarts. */ import com.fasterxml.jackson.annotation.JsonIgnore -import com.github.simiacryptus.aicoder.util.PluginStartupActivity.Companion.addUserSuppliedModels import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.PersistentStateComponent import com.intellij.openapi.components.State import com.intellij.openapi.components.Storage import com.intellij.openapi.util.io.FileUtil import com.intellij.util.xmlb.XmlSerializerUtil +import com.simiacryptus.aicoder.util.PluginStartupActivity.Companion.addUserSuppliedModels import com.simiacryptus.jopenai.models.APIProvider import com.simiacryptus.jopenai.models.ImageModels import com.simiacryptus.jopenai.models.OpenAIModels -import com.simiacryptus.skyenet.core.platform.AwsPlatform import com.simiacryptus.util.JsonUtil import org.slf4j.LoggerFactory import java.io.File diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/MRUItems.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/MRUItems.kt index b8409ad7..4f80a252 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/MRUItems.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/MRUItems.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config import com.fasterxml.jackson.annotation.JsonIgnore import java.io.Serializable diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/Name.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/Name.kt similarity index 62% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/Name.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/Name.kt index d113009a..9371dd59 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/Name.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/Name.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config @Retention(AnnotationRetention.RUNTIME) annotation class Name(val value: String) - + diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/SimpleEnvelope.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/SimpleEnvelope.kt similarity index 50% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/SimpleEnvelope.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/SimpleEnvelope.kt index 4dfdd5ca..ecd5a39f 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/SimpleEnvelope.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/SimpleEnvelope.kt @@ -1,3 +1,3 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config class SimpleEnvelope(var value: String? = null) \ No newline at end of file diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt index f3bfd165..3e685143 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/StaticAppSettingsConfigurable.kt @@ -1,20 +1,12 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config -import com.github.simiacryptus.aicoder.util.IdeaChatClient -import com.github.simiacryptus.aicoder.util.PluginStartupActivity.Companion.addUserSuppliedModels +import com.simiacryptus.aicoder.util.IdeaChatClient +import com.simiacryptus.aicoder.util.PluginStartupActivity.Companion.addUserSuppliedModels import com.simiacryptus.jopenai.models.APIProvider -import java.awt.BorderLayout -import java.awt.Dimension -import java.awt.FlowLayout -import java.awt.GridBagConstraints -import java.awt.GridBagLayout +import java.awt.* import java.io.File import java.io.FileOutputStream -import javax.swing.BoxLayout -import javax.swing.JComponent -import javax.swing.JLabel -import javax.swing.JPanel -import javax.swing.JScrollPane +import javax.swing.* import javax.swing.table.DefaultTableModel class StaticAppSettingsConfigurable : AppSettingsConfigurable() { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/UIAdapter.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/UIAdapter.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/UIAdapter.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/UIAdapter.kt index b66563cd..b9cdaa93 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/UIAdapter.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/UIAdapter.kt @@ -1,8 +1,8 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config -import com.github.simiacryptus.aicoder.util.UITools import com.intellij.openapi.Disposable import com.intellij.openapi.options.Configurable +import com.simiacryptus.aicoder.util.UITools import org.slf4j.LoggerFactory import javax.swing.JComponent diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/config/UsageTable.kt b/src/main/kotlin/com/simiacryptus/aicoder/config/UsageTable.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/config/UsageTable.kt rename to src/main/kotlin/com/simiacryptus/aicoder/config/UsageTable.kt index 026f16c5..dd2e7c00 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/config/UsageTable.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/config/UsageTable.kt @@ -1,8 +1,8 @@ -package com.github.simiacryptus.aicoder.config +package com.simiacryptus.aicoder.config -import com.github.simiacryptus.aicoder.util.IdeaChatClient import com.intellij.ui.components.JBScrollPane import com.intellij.ui.table.JBTable +import com.simiacryptus.aicoder.util.IdeaChatClient import com.simiacryptus.skyenet.core.platform.model.UsageInterface import org.jdesktop.swingx.JXTable import java.awt.BorderLayout diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt b/src/main/kotlin/com/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt rename to src/main/kotlin/com/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt index 2a1eddfe..aad42746 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/ui/SettingsWidgetFactory.kt @@ -1,10 +1,6 @@ -package com.github.simiacryptus.aicoder.ui +package com.simiacryptus.aicoder.ui -import com.github.simiacryptus.aicoder.AppServer -import com.github.simiacryptus.aicoder.actions.generic.SessionProxyServer -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.UsageTable -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse +import aicoder.actions.SessionProxyServer import com.intellij.openapi.project.Project import com.intellij.openapi.ui.popup.JBPopup import com.intellij.openapi.ui.popup.JBPopupFactory @@ -13,9 +9,12 @@ import com.intellij.openapi.ui.popup.LightweightWindowEvent import com.intellij.openapi.wm.StatusBar import com.intellij.openapi.wm.StatusBarWidget import com.intellij.openapi.wm.StatusBarWidgetFactory -import com.intellij.ui.SimpleListCellRenderer import com.intellij.ui.components.JBList import com.intellij.ui.treeStructure.Tree +import com.simiacryptus.aicoder.AppServer +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.UsageTable +import com.simiacryptus.aicoder.util.BrowseUtil.browse import com.simiacryptus.jopenai.models.ChatModel import com.simiacryptus.skyenet.core.platform.ApplicationServices import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt b/src/main/kotlin/com/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt similarity index 99% rename from src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt rename to src/main/kotlin/com/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt index 7a2bc16b..0f5391c1 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/ui/TokenCountWidgetFactory.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.ui +package com.simiacryptus.aicoder.ui import com.intellij.ide.projectView.impl.AbstractProjectViewPane import com.intellij.ide.projectView.impl.ProjectViewListener diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/BlockComment.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/BlockComment.kt index 7ebade48..2944ee47 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BlockComment.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/BlockComment.kt @@ -1,9 +1,9 @@ @file:Suppress("NAME_SHADOWING") -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.util.TextBlock.Companion.DELIMITER -import com.github.simiacryptus.aicoder.util.TextBlock.Companion.TAB_REPLACEMENT +import com.simiacryptus.aicoder.util.TextBlock.Companion.DELIMITER +import com.simiacryptus.aicoder.util.TextBlock.Companion.TAB_REPLACEMENT import com.simiacryptus.util.StringUtil import java.util.* import java.util.stream.Collectors diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BrowseUtil.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/BrowseUtil.kt similarity index 86% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/BrowseUtil.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/BrowseUtil.kt index 936d51a2..313c1474 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/BrowseUtil.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/BrowseUtil.kt @@ -1,7 +1,7 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.ui.SettingsWidgetFactory.SettingsWidget +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.ui.SettingsWidgetFactory.SettingsWidget import org.slf4j.LoggerFactory import java.awt.Desktop import java.net.DatagramPacket diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeChatSocketManager.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/CodeChatSocketManager.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeChatSocketManager.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/CodeChatSocketManager.kt index 596bc74e..41d02b03 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeChatSocketManager.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/CodeChatSocketManager.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.simiacryptus.jopenai.ChatClient import com.simiacryptus.jopenai.models.ChatModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeProcessingUtils.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/CodeProcessingUtils.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeProcessingUtils.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/CodeProcessingUtils.kt index 316e1058..dda7f2da 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/CodeProcessingUtils.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/CodeProcessingUtils.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import java.io.File import java.nio.file.Path diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/ComputerLanguage.kt similarity index 99% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/ComputerLanguage.kt index 91b2b531..9b988666 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/ComputerLanguage.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/ComputerLanguage.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/FileUtils.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/FileUtils.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/FileUtils.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/FileUtils.kt index 61fff3c7..0fa297ef 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/FileUtils.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/FileUtils.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.intellij.openapi.vfs.VirtualFile diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaChatClient.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/IdeaChatClient.kt similarity index 98% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaChatClient.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/IdeaChatClient.kt index e273fccf..32bb4f40 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaChatClient.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/IdeaChatClient.kt @@ -1,6 +1,5 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.config.AppSettingsState import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.application.ApplicationManager @@ -8,6 +7,7 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.ui.DialogWrapper import com.intellij.ui.components.JBScrollPane import com.intellij.util.ui.FormBuilder +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.ChatClient import com.simiacryptus.jopenai.models.APIProvider import com.simiacryptus.jopenai.models.ApiModel.* diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/IdeaOpenAIClient.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/IdeaOpenAIClient.kt index ff84ea18..a659296d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IdeaOpenAIClient.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/IdeaOpenAIClient.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.models.APIProvider import com.simiacryptus.jopenai.models.ApiModel diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IndentedText.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/IndentedText.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/IndentedText.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/IndentedText.kt index df205963..ff47c796 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/IndentedText.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/IndentedText.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.simiacryptus.util.StringUtil diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LanguageUtils.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/LanguageUtils.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/LanguageUtils.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/LanguageUtils.kt index 0d5490d6..0270ebe3 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LanguageUtils.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/LanguageUtils.kt @@ -1,6 +1,6 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.actions.generic.toFile +import aicoder.actions.agent.toFile import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys import com.intellij.openapi.application.ApplicationManager diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/LineComment.kt similarity index 97% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/LineComment.kt index 39df52dc..2b1fb98d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/LineComment.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/LineComment.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.simiacryptus.util.StringUtil.getWhitespacePrefix import com.simiacryptus.util.StringUtil.stripPrefix diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/PluginStartupActivity.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/PluginStartupActivity.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/PluginStartupActivity.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/PluginStartupActivity.kt index d7ae96a4..34f181df 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/PluginStartupActivity.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/PluginStartupActivity.kt @@ -1,6 +1,5 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.config.AppSettingsState import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.fileEditor.FileEditorManager import com.intellij.openapi.fileEditor.FileEditorManagerListener @@ -9,9 +8,13 @@ import com.intellij.openapi.project.Project import com.intellij.openapi.startup.ProjectActivity import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileManager +import com.simiacryptus.aicoder.config.AppSettingsState import com.simiacryptus.jopenai.models.ChatModel import com.simiacryptus.skyenet.core.OutputInterceptor -import com.simiacryptus.skyenet.core.platform.* +import com.simiacryptus.skyenet.core.platform.ApplicationServices +import com.simiacryptus.skyenet.core.platform.AwsPlatform +import com.simiacryptus.skyenet.core.platform.ClientManager +import com.simiacryptus.skyenet.core.platform.Session import com.simiacryptus.skyenet.core.platform.hsql.HSQLUsageManager import com.simiacryptus.skyenet.core.platform.model.ApplicationServicesConfig import com.simiacryptus.skyenet.core.platform.model.ApplicationServicesConfig.isLocked diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/SessionManager.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/SessionManager.kt similarity index 90% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/SessionManager.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/SessionManager.kt index d135dec4..7b160516 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/SessionManager.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/SessionManager.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import com.intellij.openapi.components.Service import com.simiacryptus.skyenet.core.platform.Session diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/StringUtil.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/StringUtil.kt similarity index 94% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/StringUtil.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/StringUtil.kt index 4b114434..41329496 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/StringUtil.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/StringUtil.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util object StringUtil { fun lineWrapping(text: String, maxLineLength: Int): String { diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlock.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/TextBlock.kt similarity index 91% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlock.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/TextBlock.kt index 0fc0119e..95d40ed4 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlock.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/TextBlock.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util import java.util.stream.Stream import kotlin.streams.asStream diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlockFactory.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/TextBlockFactory.kt similarity index 82% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlockFactory.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/TextBlockFactory.kt index 0b1dbb0c..cc2bd14d 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/TextBlockFactory.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/TextBlockFactory.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util interface TextBlockFactory { fun fromString(text: String?): T @@ -9,4 +9,4 @@ interface TextBlockFactory { } fun looksLike(text: String?): Boolean -} +} diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/UITools.kt similarity index 99% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/UITools.kt index ef882a88..d183c7df 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/UITools.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/UITools.kt @@ -1,9 +1,6 @@ -package com.github.simiacryptus.aicoder.util +package com.simiacryptus.aicoder.util -import com.github.simiacryptus.aicoder.actions.generic.toFile -import com.github.simiacryptus.aicoder.config.AppSettingsState -import com.github.simiacryptus.aicoder.config.Name -import com.github.simiacryptus.aicoder.util.BrowseUtil.browse +import aicoder.actions.agent.toFile import com.google.common.util.concurrent.* import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys @@ -27,6 +24,9 @@ import com.intellij.ui.components.JBPasswordField import com.intellij.ui.components.JBScrollPane import com.intellij.ui.components.JBTextArea import com.intellij.util.ui.FormBuilder +import com.simiacryptus.aicoder.config.AppSettingsState +import com.simiacryptus.aicoder.config.Name +import com.simiacryptus.aicoder.util.BrowseUtil.browse import com.simiacryptus.jopenai.OpenAIClient import com.simiacryptus.jopenai.exceptions.ModerationException import com.simiacryptus.jopenai.models.APIProvider diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiClassContext.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiClassContext.kt similarity index 96% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiClassContext.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiClassContext.kt index 2935a5a5..879b7863 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiClassContext.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiClassContext.kt @@ -1,151 +1,151 @@ -package com.github.simiacryptus.aicoder.util.psi - -import com.github.simiacryptus.aicoder.util.ComputerLanguage -import com.intellij.psi.PsiElement -import com.intellij.psi.PsiElementVisitor -import com.intellij.psi.PsiFile - -class PsiClassContext( - val text: String, - private val isPrior: Boolean, - private val isOverlap: Boolean, - val language: ComputerLanguage -) { - val children = ArrayList() - - /** - * This java code is initializing a PsiClassContext object. It is doing this by creating a PsiElementVisitor and using it to traverse the PsiFile. - * It is checking the text range of each element and whether it is prior to, overlapping, or within the selectionStart and selectionEnd parameters. - * Depending on the element, it is adding the text of the element to the PsiClassContext object, or recursively visiting its children. - * - * @param psiFile - * @param selectionStart - * @param selectionEnd - * @return - */ - fun init(psiFile: PsiFile?, selectionStart: Int, selectionEnd: Int): PsiClassContext { - object : PsiVisitorBase() { - var currentContext = this@PsiClassContext - var indent = "" - override fun visit(element: PsiElement, self: PsiElementVisitor) { - val text = element.text - val textRange = element.textRange - val textRangeEndOffset = textRange.endOffset + 1 - val textRangeStartOffset = textRange.startOffset - // Check if the element comes before the selection - val isPrior = textRangeEndOffset < selectionStart - // Check if the element overlaps with the selection - val isOverlap = - textRangeStartOffset in selectionStart..selectionEnd || textRangeEndOffset in selectionStart..selectionEnd || selectionStart in textRangeStartOffset..textRangeEndOffset || selectionEnd in textRangeStartOffset..textRangeEndOffset - // Check if the element is within the selection - val within = - selectionStart in textRangeStartOffset until textRangeEndOffset && textRangeStartOffset <= selectionEnd && textRangeEndOffset > selectionEnd - if (PsiUtil.matchesType(element, "ImportList")) { - currentContext.children.add(PsiClassContext(text.trim { it <= ' ' }, isPrior, isOverlap, language)) - } else if (PsiUtil.matchesType(element, "Comment", "DocComment")) { - if (within) { - currentContext.children.add( - PsiClassContext( - indent + text.trim { it <= ' ' }, - false, - true, - language - ) - ) - } - } else if (PsiUtil.matchesType(element, "Field")) { - processChildren( - element, - self, - isPrior, - isOverlap, - indent + PsiUtil.getDeclaration(element).trim { it <= ' ' } + if (isOverlap) " {" else ";") - } else if (PsiUtil.matchesType(element, "Method", "Function", "FunctionDefinition", "Constructor")) { - val methodTerminator = when (language) { - ComputerLanguage.Java -> " { /* ... */}" - ComputerLanguage.Kotlin -> " { /* ... */}" - ComputerLanguage.Scala -> " { /* ... */}" - else -> ";" - } - processChildren( - element, - self, - isPrior, - isOverlap, - indent + PsiUtil.getDeclaration(element) - .trim { it <= ' ' } + (if (isOverlap) " {" else methodTerminator)) - } else if (PsiUtil.matchesType(element, "LocalVariable")) { - currentContext.children.add(PsiClassContext(indent + text.trim { it <= ' ' } + ";", - isPrior, - isOverlap, - language)) - } else if (PsiUtil.matchesType(element, "Class")) { - processChildren( - element, - self, - isPrior, - isOverlap, - indent + text.substring(0, text.indexOf('{')).trim { it <= ' ' } + " {") - if (!isOverlap) { - currentContext.children.add(PsiClassContext("}", isPrior, false, language)) - } - } else if (!isOverlap && PsiUtil.matchesType(element, "CodeBlock", "ForStatement")) { - // Skip - } else { - element.acceptChildren(self) - } - } - - private fun processChildren( - element: PsiElement, - self: PsiElementVisitor, - isPrior: Boolean, - isOverlap: Boolean, - declarationText: String - ): PsiClassContext { - val newNode = PsiClassContext(declarationText, isPrior, isOverlap, language) - currentContext.children.add(newNode) - val prevclassBuffer = currentContext - currentContext = newNode - val prevIndent = indent - indent += " " - element.acceptChildren(self) - indent = prevIndent - currentContext = prevclassBuffer - return newNode - } - }.build(psiFile!!) - return this - } - - override fun toString(): String { - val sb = ArrayList() - sb.add(text) - children.stream().filter { x: PsiClassContext -> x.isPrior }.map { obj: PsiClassContext -> obj.toString() } - .forEach { e: String -> sb.add(e) } - children.stream().filter { x: PsiClassContext -> !x.isOverlap && !x.isPrior } - .map { obj: PsiClassContext -> obj.toString() } - .forEach { e: String -> sb.add(e) } - children.stream().filter { x: PsiClassContext -> x.isOverlap }.map { obj: PsiClassContext -> obj.toString() } - .forEach { e: String -> sb.add(e) } - return sb.stream().reduce { l: String, r: String -> - """ - $l - $r - """.trimIndent() - }.get() - } - - companion object { - @JvmStatic - fun getContext( - psiFile: PsiFile?, - selectionStart: Int, - selectionEnd: Int, - language: ComputerLanguage - ): PsiClassContext { - return PsiClassContext("", false, true, language).init(psiFile, selectionStart, selectionEnd) - } - - } -} +package com.simiacryptus.aicoder.util.psi + +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiElementVisitor +import com.intellij.psi.PsiFile +import com.simiacryptus.aicoder.util.ComputerLanguage + +class PsiClassContext( + val text: String, + private val isPrior: Boolean, + private val isOverlap: Boolean, + val language: ComputerLanguage +) { + val children = ArrayList() + + /** + * This java code is initializing a PsiClassContext object. It is doing this by creating a PsiElementVisitor and using it to traverse the PsiFile. + * It is checking the text range of each element and whether it is prior to, overlapping, or within the selectionStart and selectionEnd parameters. + * Depending on the element, it is adding the text of the element to the PsiClassContext object, or recursively visiting its children. + * + * @param psiFile + * @param selectionStart + * @param selectionEnd + * @return + */ + fun init(psiFile: PsiFile?, selectionStart: Int, selectionEnd: Int): PsiClassContext { + object : PsiVisitorBase() { + var currentContext = this@PsiClassContext + var indent = "" + override fun visit(element: PsiElement, self: PsiElementVisitor) { + val text = element.text + val textRange = element.textRange + val textRangeEndOffset = textRange.endOffset + 1 + val textRangeStartOffset = textRange.startOffset + // Check if the element comes before the selection + val isPrior = textRangeEndOffset < selectionStart + // Check if the element overlaps with the selection + val isOverlap = + textRangeStartOffset in selectionStart..selectionEnd || textRangeEndOffset in selectionStart..selectionEnd || selectionStart in textRangeStartOffset..textRangeEndOffset || selectionEnd in textRangeStartOffset..textRangeEndOffset + // Check if the element is within the selection + val within = + selectionStart in textRangeStartOffset until textRangeEndOffset && textRangeStartOffset <= selectionEnd && textRangeEndOffset > selectionEnd + if (PsiUtil.matchesType(element, "ImportList")) { + currentContext.children.add(PsiClassContext(text.trim { it <= ' ' }, isPrior, isOverlap, language)) + } else if (PsiUtil.matchesType(element, "Comment", "DocComment")) { + if (within) { + currentContext.children.add( + PsiClassContext( + indent + text.trim { it <= ' ' }, + false, + true, + language + ) + ) + } + } else if (PsiUtil.matchesType(element, "Field")) { + processChildren( + element, + self, + isPrior, + isOverlap, + indent + PsiUtil.getDeclaration(element).trim { it <= ' ' } + if (isOverlap) " {" else ";") + } else if (PsiUtil.matchesType(element, "Method", "Function", "FunctionDefinition", "Constructor")) { + val methodTerminator = when (language) { + ComputerLanguage.Java -> " { /* ... */}" + ComputerLanguage.Kotlin -> " { /* ... */}" + ComputerLanguage.Scala -> " { /* ... */}" + else -> ";" + } + processChildren( + element, + self, + isPrior, + isOverlap, + indent + PsiUtil.getDeclaration(element) + .trim { it <= ' ' } + (if (isOverlap) " {" else methodTerminator)) + } else if (PsiUtil.matchesType(element, "LocalVariable")) { + currentContext.children.add(PsiClassContext(indent + text.trim { it <= ' ' } + ";", + isPrior, + isOverlap, + language)) + } else if (PsiUtil.matchesType(element, "Class")) { + processChildren( + element, + self, + isPrior, + isOverlap, + indent + text.substring(0, text.indexOf('{')).trim { it <= ' ' } + " {") + if (!isOverlap) { + currentContext.children.add(PsiClassContext("}", isPrior, false, language)) + } + } else if (!isOverlap && PsiUtil.matchesType(element, "CodeBlock", "ForStatement")) { + // Skip + } else { + element.acceptChildren(self) + } + } + + private fun processChildren( + element: PsiElement, + self: PsiElementVisitor, + isPrior: Boolean, + isOverlap: Boolean, + declarationText: String + ): PsiClassContext { + val newNode = PsiClassContext(declarationText, isPrior, isOverlap, language) + currentContext.children.add(newNode) + val prevclassBuffer = currentContext + currentContext = newNode + val prevIndent = indent + indent += " " + element.acceptChildren(self) + indent = prevIndent + currentContext = prevclassBuffer + return newNode + } + }.build(psiFile!!) + return this + } + + override fun toString(): String { + val sb = ArrayList() + sb.add(text) + children.stream().filter { x: PsiClassContext -> x.isPrior }.map { obj: PsiClassContext -> obj.toString() } + .forEach { e: String -> sb.add(e) } + children.stream().filter { x: PsiClassContext -> !x.isOverlap && !x.isPrior } + .map { obj: PsiClassContext -> obj.toString() } + .forEach { e: String -> sb.add(e) } + children.stream().filter { x: PsiClassContext -> x.isOverlap }.map { obj: PsiClassContext -> obj.toString() } + .forEach { e: String -> sb.add(e) } + return sb.stream().reduce { l: String, r: String -> + """ + $l + $r + """.trimIndent() + }.get() + } + + companion object { + @JvmStatic + fun getContext( + psiFile: PsiFile?, + selectionStart: Int, + selectionEnd: Int, + language: ComputerLanguage + ): PsiClassContext { + return PsiClassContext("", false, true, language).init(psiFile, selectionStart, selectionEnd) + } + + } +} diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiUtil.kt similarity index 99% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiUtil.kt index b61da2ad..5e6dc8d8 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiUtil.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiUtil.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util.psi +package com.simiacryptus.aicoder.util.psi import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys diff --git a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt similarity index 92% rename from src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt rename to src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt index f2ddd63f..05a52c94 100644 --- a/src/main/kotlin/com/github/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt +++ b/src/main/kotlin/com/simiacryptus/aicoder/util/psi/PsiVisitorBase.kt @@ -1,4 +1,4 @@ -package com.github.simiacryptus.aicoder.util.psi +package com.simiacryptus.aicoder.util.psi import com.intellij.psi.PsiElement import com.intellij.psi.PsiElementVisitor @@ -18,4 +18,4 @@ abstract class PsiVisitorBase { } protected abstract fun visit(element: PsiElement, self: PsiElementVisitor) -} +} diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index e36c1e87..873037b1 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,5 +1,5 @@ - com.github.simiacryptus.intellijopenaicodeassist + com.simiacryptus.intellijopenaicodeassist AI Coding Assistant SimiaCryptus Software Code Tools @@ -7,313 +7,313 @@ com.intellij.modules.lang - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -