Commit Graph

160 Commits

Author SHA1 Message Date
Simon Larsen
bd8ed04e1b
refactor: Extract code from CopilotActionBase to separate functions
This commit extracts code from the `CopilotActionBase.ts` file into separate functions for better code organization and readability. The extracted code includes the logic for ordering SSL certificates, checking the order status, and handling domain removal. This refactoring improves the maintainability and modularity of the codebase.
2024-06-26 19:33:01 +01:00
Simon Larsen
a9778cf9d0
refactor: Update Copilot README.md file
This commit adds a blank line at the end of the Copilot README.md file. This change ensures consistency in the file structure and improves readability.
2024-06-25 12:09:25 +01:00
Simon Larsen
0987634e54
refactor: Fix formatting and add comments in ArrayUtil.ts and CopilotActionProcessingException.ts 2024-06-23 21:37:36 +01:00
Simon Larsen
a3f5e268b5
refactor: Shuffle files in Copilot Init to avoid fixing the same file in each run 2024-06-23 21:29:23 +01:00
Simon Larsen
6c8a0c8cdc
refactor: Improve file extension handling in LocalFile.ts 2024-06-23 21:04:46 +01:00
Simon Larsen
a4c5354152
refactor: Improve comments in ImproveComments.ts 2024-06-23 20:58:21 +01:00
Simon Larsen
e85e351797
refactor: Remove unnecessary blank lines in ServiceLanguageUtil class 2024-06-23 19:41:24 +01:00
Simon Larsen
1964db22f1
refactor: Add support for Markdown file extension in ServiceLanguage enum 2024-06-23 19:35:04 +01:00
Simon Larsen
6737d97f30
refactor: Improve comments in ImproveComments.ts 2024-06-23 18:00:44 +01:00
Simon Larsen
d22b40e91a
refactor: Improve comments in ImproveComments.ts 2024-06-23 18:00:16 +01:00
Simon Larsen
2415f97ec6
refactor: Add NotAcceptedFileExtentionForCopilotAction exception handling 2024-06-22 19:40:18 +01:00
Simon Larsen
b6cabf12d5
refactor: Update CopilotActionsBase to include PR generation message
This commit updates the `CopilotActionsBase.ts` file to include a message about PR generation in the warning section. The message informs users that the PR is generated by OneUptime Copilot and advises them to review the changes before merging. This enhancement improves the clarity and transparency of the generated PRs.
2024-06-22 13:36:52 +01:00
Simon Larsen
27ef73be20
refactor: Execute CopilotAction and update currentFixCount
This commit modifies the `Copilot/Init.ts` file to execute the `CopilotActionService.execute` method for each event that needs fixing. It also updates the `currentFixCount` variable to keep track of the number of fixes performed. This refactor improves the functionality of the Copilot service by ensuring that all necessary actions are executed and the fix count is accurately maintained.
2024-06-22 13:34:54 +01:00
Simon Larsen
369bdfc841
```text
refactor: Add FixGrammarAndSpelling action to CopilotActionType and CopilotActions

This commit adds the `FixGrammarAndSpelling` action to the `CopilotActionType` enum and the `CopilotActions` dictionary. The action is now available for execution in the Copilot service. This enhancement improves the codebase by providing a new action that can be used to fix grammar and spelling errors in the application.
2024-06-22 12:50:54 +01:00
Simon Larsen
8150f44244
refactor: Improve comments in ImproveComments.ts 2024-06-22 12:42:34 +01:00
Simon Larsen
6a646c06b3
refactor: Remove unused CopilotActionType enum value
This commit removes the unused `CopilotActionType` enum value from the `CopilotActionType.ts` file. The value was commented out and had no impact on the functionality of the application. Removing it helps to improve code clarity and maintainability.
2024-06-22 12:38:27 +01:00
Simon Larsen
422656caf3
refactor: Remove unused PromptsUtil class
This commit removes the unused `PromptsUtil` class from the codebase. The class was no longer being used and had no impact on the functionality of the application. Removing it helps to reduce code complexity and improve maintainability.
2024-06-22 12:35:38 +01:00
Simon Larsen
5223d1bd6d
refactor: Improve comments in CopilotActionType and CopilotActionsBase
The code changes in this commit refactor the comments in the `CopilotActionType` and `CopilotActionsBase` files. The comments have been improved to provide clearer instructions and guidelines for code commenting. This enhancement ensures that the codebase is well-documented and easier to understand for future developers.
2024-06-22 12:35:12 +01:00
Simon Larsen
6be976102c
refactor: Remove commented out code and unused imports 2024-06-21 18:53:11 +01:00
Simon Larsen
261072b1fd
refactor: Update logging statements in CopilotActionService 2024-06-21 18:35:22 +01:00
Simon Larsen
e7659bdf08
chore: Switch to main branch before executing CopilotAction 2024-06-21 18:06:06 +01:00
Simon Larsen
a87f3ac896
refactor: Fix branch name generation in CopilotActionsBase.ts
The branch name generation in CopilotActionsBase.ts has been fixed to replace double hyphens with a single hyphen. This ensures that the branch name is correctly formatted and avoids any potential issues with branch creation and management.
2024-06-21 10:59:34 +01:00
Simon Larsen
2deeb32b78
refactor: Fix branch name generation in CopilotActionsBase.ts
The branch name generation in CopilotActionsBase.ts has been fixed to replace double hyphens with a single hyphen. This ensures that the branch name is correctly formatted and avoids any potential issues with branch creation and management.
2024-06-20 22:31:58 +01:00
Simon Larsen
bc8b8eb982
refactor: Update LlmType import paths in Copilot/Config.ts, Copilot/Service/LLM/Llama.ts, and Copilot/Service/LLM/LLM.ts
This commit updates the import paths for the LlmType module in the following files:
- Copilot/Config.ts
- Copilot/Service/LLM/Llama.ts
- Copilot/Service/LLM/LLM.ts

The import paths are corrected to match the actual file structure, ensuring that the LlmType module is properly imported and used throughout the codebase. This change improves the maintainability and readability of the code.
2024-06-20 21:37:24 +01:00
Simon Larsen
1260e482cf
refactor: Improve comments in code and update job function in app.py 2024-06-20 13:14:39 +01:00
Simon Larsen
6e5081a4e3
refactor: Remove unused CopilotEvent and CopilotEventService 2024-06-20 12:30:06 +01:00
Simon Larsen
dd93998296
refactor: Remove unused CopilotEvent and CopilotEventService
This commit removes the unused CopilotEvent enum and CopilotEventService class. These files are no longer needed in the codebase and can be safely deleted. Removing unused code improves the maintainability and reduces the complexity of the project.
2024-06-20 11:41:04 +01:00
Simon Larsen
94956b045a refactor: Improve comments in code and update job function in app.py
This commit refactors the code by improving the comments in the code and updating the job function in app.py. The comments are now focused on code that is hard to understand, and unnecessary comments are removed. The job function is converted to an async function to support asynchronous processing, which improves the performance and responsiveness of the application. These changes enhance the readability and efficiency of the codebase.
2024-06-20 10:00:07 +00:00
Simon Larsen
b2f650a865
refactor: Sanitize file path in CodeRepositoryUtil.getFileContent()
The file path in the CodeRepositoryUtil.getFileContent() method is now sanitized using the LocalFile.sanitizeFilePath() function before executing the command. This change ensures that the file path is properly formatted and prevents any potential security vulnerabilities or errors caused by invalid file paths.
2024-06-20 10:26:16 +01:00
Simon Larsen
4390a37184 fix prompt 2024-06-20 09:22:53 +00:00
Simon Larsen
98fbbe301e
refactor: Update variable types in Copilot/Init.ts and Copilot/Utils/Prompts.ts 2024-06-19 21:03:54 +01:00
Simon Larsen
27213fa235
refactor: Add FixNumberOfCodeEventsInEachRun constant to Config.ts
This commit adds the FixNumberOfCodeEventsInEachRun constant to the Config.ts file. The constant is set to 5 and is used to determine the number of code events to fix in each run. This change improves the flexibility and configurability of the code events handling in the application.
2024-06-19 16:29:25 +01:00
Simon Larsen
baa98e333e
refactor: Update LlmType export in Config.ts and LlmType.ts 2024-06-19 15:36:24 +01:00
Simon Larsen
ccdcf2c679
refactor: Update Llama app to use local model path instead of model ID 2024-06-19 15:06:36 +01:00
Simon Larsen
70a2a3993b
refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files 2024-06-14 12:09:53 +01:00
Simon Larsen
c15b8bb951
refactor: Update CodeRepositoryUtil to include serviceRepository parameter in createBranch and createOrCheckoutBranch 2024-06-13 14:11:09 +01:00
Simon Larsen
17c47f7d89
refactor: Update ServiceFileTypesUtil to include common directories and files to ignore 2024-06-13 13:32:16 +01:00
Simon Larsen
a406287215
refactor: Update branch name in Copilot/Index.ts and add GITHUB_USERNAME to .env.example
This commit updates the branch name in Copilot/Index.ts from 'test-branch-3' to 'test-branch-4'. Additionally, it adds the GITHUB_USERNAME variable to the .env.example file. These changes improve the accuracy and functionality of the code.
2024-06-13 13:10:14 +01:00
Simon Larsen
a73b050a4d
refactor: Update CodeRepositoryUtil to include serviceRepository parameter in createBranch and createOrCheckoutBranch
This commit modifies the CodeRepositoryUtil class in CodeRepository.ts to include a new parameter, serviceRepository, in the createBranch and createOrCheckoutBranch methods. This change allows for better integration with the ServiceRepository class and improves the flexibility and maintainability of the code.
2024-06-13 12:47:42 +01:00
Simon Larsen
96d4131614
refactor: Add createPullRequest method to HostedCodeRepository
The HostedCodeRepository class in HostedCodeRepository.ts has been updated to include a new method, createPullRequest. This method allows for the creation of pull requests in the code repository. This change enhances the functionality and flexibility of the HostedCodeRepository class.
2024-06-13 12:26:49 +01:00
Simon Larsen
dea385ad44
refactor: Update ServiceFileTypesUtil to include common directories and files to ignore
The ServiceFileTypesUtil class in ServiceFileTypes.ts has been updated to include two new methods: getCommonDirectoriesToIgnore and getCommonFilesToIgnore. These methods return arrays of common directories and files that should be ignored in code repositories. This change improves the functionality and maintainability of the code by providing a centralized way to define and retrieve the directories and files to ignore.
2024-06-12 22:10:47 +01:00
Simon Larsen
d153ad9bf7
refactor: Update ServiceRepository to include serviceLanguage field
The ServiceRepository class in ServiceRepository.ts has been updated to include a new field, serviceLanguage. This field is of type ServiceLanguage and is required. This change allows for better organization and identification of code repositories based on their programming language.
2024-06-12 21:27:00 +01:00
Simon Larsen
2ce8ba6295
refactor: Sanitize file paths in CodeRepositoryUtil and LocalFile
This commit refactors the CodeRepositoryUtil and LocalFile classes to include a new method, sanitizeFilePath, which removes double slashes from file paths. This change ensures that file paths are properly formatted and improves the reliability and maintainability of the code.
2024-06-12 21:05:37 +01:00
Simon Larsen
fd13e91aac
refactor: Update ServiceRepository to use number type for limitNumberOfOpenPullRequestsCount
The ServiceRepository class in ServiceRepository.ts has been updated to use the number type for the limitNumberOfOpenPullRequestsCount property instead of the string type. This change ensures that the property is correctly typed and improves the accuracy and reliability of the code.
2024-06-12 15:38:54 +01:00
Simon Larsen
cf7d4c7720
refactor: Update GitHubUtil to use HostedCodeRepository/HostedCodeRepository 2024-06-12 15:11:50 +01:00
Simon Larsen
c7344a7624
refactor: Remove commented out code and unused imports
The CodeRepositoryType.ts file has been refactored to remove commented out code and unused imports. This change improves code cleanliness and reduces unnecessary clutter in the file.
2024-06-12 12:25:12 +01:00
Simon Larsen
42253e4e50
refactor: Update GitHub token handling in Config.ts 2024-06-12 11:59:22 +01:00
Simon Larsen
64acf372d6
refactor: Update GitHub token handling in Config.ts
The Config.ts file has been updated to handle the GitHub token more efficiently. The GetGitHubToken function now checks the repository type and throws an exception if a GitHub token is required but not provided. This change improves the security and reliability of the application by ensuring that the correct token is used for GitHub repositories.
2024-06-12 11:31:50 +01:00
Simon Larsen
dfb7f2320c
refactor: Update jest.config.json files with testPathIgnorePatterns
The jest.config.json files in the Model, Probe, Common, Copilot, CommonUI, Ingestor, IsolatedVM, TestServer, and CommonServer directories have been updated. The "testPathIgnorePatterns" property has been added to each file, excluding the "node_modules" and "dist" directories from test path matching. This change improves test performance and ensures that unnecessary files are not included in the test coverage.
2024-06-11 14:52:55 +01:00
Simon Larsen
c53b14f88f
refactor: Update CodeRepositoryUtil methods to accept repoPath parameter
The CodeRepositoryUtil methods getGitCommitHashForFile and getFilesInDirectory have been updated to accept a repoPath parameter. This change allows for specifying the repository path when retrieving the git commit hash for a file or getting the files in a directory. It improves the flexibility and reusability of the CodeRepositoryUtil class.
2024-06-11 14:24:19 +01:00
Simon Larsen
41a8101b54
refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository 2024-06-11 13:25:41 +01:00
Simon Larsen
676a2b18b3
refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository 2024-06-11 13:20:52 +01:00
Simon Larsen
df7477929b
refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository
This code change updates the CodeRepositoryAPI endpoint in the CodeRepositoryAPI.ts file to use the POST method instead of the GET method for getting the code repository. The route has also been modified to "/get-code-repository/:secretkey" to align with the API design. This change ensures that the code repository is retrieved securely and follows the recommended RESTful API practices.
2024-06-11 13:00:33 +01:00
Simon Larsen
c1ebe14c50
refactor: Add CodeRepositoryAPI to BaseAPIFeatureSet
This code change adds the CodeRepositoryAPI endpoint to the BaseAPIFeatureSet in the App/FeatureSet/BaseAPI/Index.ts file. It imports the CodeRepository model and service, and includes the necessary routing and configuration for the endpoint. This change allows for the CRUD operations on CodeRepository data through the API.
2024-06-11 12:47:47 +01:00
Simon Larsen
d7e9776a3c
refactor: Update CodeRepository.getRepository() to return a Promise
Update CodeRepository.getRepository() to return a Promise<CodeRepositoryModel> instead of a string. This change improves the functionality and flexibility of the CodeRepository class.
2024-06-11 11:10:36 +01:00
Simon Larsen
3cb29b63fe
refactor: Update CodeRepository.getRepository() to return a Promise
The CodeRepository.getRepository() method has been updated to return a Promise<CodeRepositoryModel> instead of a string. This change ensures that the method is asynchronous and can handle asynchronous operations, improving the overall functionality and flexibility of the CodeRepository class.
2024-06-10 22:10:29 +01:00
Simon Larsen
e7f4a36ec9
refactor: Update Copilot startup message for clarity
The startup message in the Copilot/Index.ts file has been updated to provide a clearer description of the application. This change improves the readability and understanding of the log output during the startup process.
2024-06-10 22:09:25 +01:00
Simon Larsen
bf081d1ebe
refactor: Update file paths in code changes 2024-06-10 17:59:22 +01:00
Simon Larsen
a4a9e45fe0
refactor: Update Dockerfile and build steps for Copilot service
This code change updates the Dockerfile and build steps for the Copilot service. It adds a new workflow job, `docker-build-copilot`, which builds the Docker image for the Copilot service. The job includes steps to checkout the code, preinstall dependencies, and build the Docker image using the specified Dockerfile. This change ensures that the Copilot service is built and deployed correctly in the CI/CD pipeline.
2024-06-10 17:19:25 +01:00
Simon Larsen
f9c9480434
refactor: Update logger to use configured log level
This code change updates the logger class to use the configured log level from the environment configuration. The getLogLevel method is added to retrieve the log level, and the info, error, warn, and debug methods are updated to check the log level before logging the message. This change ensures that the logger behaves according to the configured log level, improving the consistency and control of log output.
2024-06-10 17:00:07 +01:00