mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
refactor: Update Copilot configuration for local development
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -149,7 +149,7 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/Realtime",
|
||||
"localRoot": "${workspaceFolder}/Copilot",
|
||||
"name": "Copilot: Debug with Docker",
|
||||
"port": 9985,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
|
||||
@@ -235,6 +235,32 @@ export default class CodeRepositoryUtil {
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
public static async listFilesInDirectory(data: {
|
||||
directoryPath: string;
|
||||
repoPath: string;
|
||||
}): Promise<Array<string>> {
|
||||
if (!data.directoryPath.startsWith("/")) {
|
||||
data.directoryPath = "/" + data.directoryPath;
|
||||
}
|
||||
|
||||
if (!data.repoPath.startsWith("/")) {
|
||||
data.repoPath = "/" + data.repoPath;
|
||||
}
|
||||
|
||||
const { directoryPath, repoPath } = data;
|
||||
|
||||
let totalPath: string = `${repoPath}/${directoryPath}`;
|
||||
|
||||
totalPath = LocalFile.sanitizeFilePath(totalPath); // clean up the path
|
||||
|
||||
const output: string = await Execute.executeCommand(`ls ${totalPath}`);
|
||||
|
||||
const fileNames: Array<string> = output.split("\n");
|
||||
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
public static async getFilesInDirectory(data: {
|
||||
directoryPath: string;
|
||||
repoPath: string;
|
||||
|
||||
@@ -18,7 +18,7 @@ export const GetRepositorySecretKey: GetStringOrNullFunction = ():
|
||||
};
|
||||
|
||||
export const GetLocalRepositoryPath: GetStringFunction = (): string => {
|
||||
return process.env["ONEUPTIME_LOCAL_REPOSITORY_PATH"] || "/repository";
|
||||
return "/repository";
|
||||
};
|
||||
|
||||
export const GetGitHubToken: GetStringOrNullFunction = (): string | null => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:21.7.3-alpine3.18
|
||||
FROM node:22.3.0
|
||||
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
|
||||
|
||||
ARG GIT_SHA
|
||||
@@ -18,17 +18,16 @@ RUN if [ -z "$APP_VERSION" ]; then export APP_VERSION=1.0.0; fi
|
||||
|
||||
|
||||
# Install bash.
|
||||
RUN apk add bash && apk add curl
|
||||
|
||||
RUN apt-get install bash -y && apt-get install curl -y
|
||||
|
||||
# Install python
|
||||
RUN apk update && apk add --no-cache --virtual .gyp python3 make g++
|
||||
RUN apt-get update && apt-get install -y .gyp python3 make g++
|
||||
|
||||
#Use bash shell by default
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
|
||||
RUN mkdir /usr/src
|
||||
RUN mkdir -p /usr/src
|
||||
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
@@ -46,7 +45,6 @@ RUN npm install
|
||||
COPY ./Model /usr/src/Model
|
||||
|
||||
|
||||
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
# Set version in ./CommonServer/package.json to the APP_VERSION
|
||||
|
||||
@@ -24,7 +24,10 @@ import CopilotActionProcessingException from "./Exceptions/CopilotActionProcessi
|
||||
let currentFixCount: number = 1;
|
||||
|
||||
const init: PromiseVoidFunction = async (): Promise<void> => {
|
||||
const codeRepositoryResult: CodeRepositoryResult = await InitUtil.init();
|
||||
|
||||
debugger;
|
||||
|
||||
const codeRepositoryResult: CodeRepositoryResult = await InitUtil.init()
|
||||
|
||||
for (const serviceToImrove of codeRepositoryResult.servicesToImprove) {
|
||||
checkIfCurrentFixCountIsLessThanFixNumberOfCodeEventsInEachRun();
|
||||
|
||||
@@ -59,6 +59,15 @@ export default class CodeRepositoryUtil {
|
||||
return pullRequests;
|
||||
}
|
||||
|
||||
public static async listFilesInDirectory(data: {
|
||||
directoryPath: string;
|
||||
}): Promise<Array<string>> {
|
||||
return await CodeRepositoryServerUtil.listFilesInDirectory({
|
||||
repoPath: GetLocalRepositoryPath(),
|
||||
directoryPath: data.directoryPath,
|
||||
});
|
||||
}
|
||||
|
||||
public static getGitHubUtil(): GitHubUtil {
|
||||
if (!this.gitHubUtil) {
|
||||
const gitHubToken: string | null = GetGitHubToken();
|
||||
|
||||
Reference in New Issue
Block a user