70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
const fs = require('fs');
|
|
const file = 'vibn-agent-runner/src/server.ts';
|
|
let code = fs.readFileSync(file, 'utf8');
|
|
|
|
// Update the type signature for the request body
|
|
const oldSig = ` } = req.body as {
|
|
sessionId?: string;
|
|
projectId?: string;
|
|
appName?: string;
|
|
appPath?: string;
|
|
giteaRepo?: string;
|
|
task?: string;
|
|
continueTask?: boolean;
|
|
autoApprove?: boolean;
|
|
coolifyAppUuid?: string;
|
|
};`;
|
|
|
|
const newSig = ` mcpToken, vibnApiUrl
|
|
} = req.body as {
|
|
sessionId?: string;
|
|
projectId?: string;
|
|
appName?: string;
|
|
appPath?: string;
|
|
giteaRepo?: string;
|
|
task?: string;
|
|
continueTask?: boolean;
|
|
autoApprove?: boolean;
|
|
coolifyAppUuid?: string;
|
|
mcpToken?: string;
|
|
vibnApiUrl?: string;
|
|
};`;
|
|
|
|
code = code.replace(oldSig, newSig);
|
|
|
|
const oldCtx = ` const ctx: ToolContext = {
|
|
workspaceRoot: repoRoot,
|
|
gitea: {
|
|
apiUrl: GITEA_API_URL,
|
|
apiToken: GITEA_API_TOKEN,
|
|
username: GITEA_USERNAME,
|
|
},
|
|
coolify: {
|
|
apiUrl: process.env.COOLIFY_API_URL || '',
|
|
apiToken: process.env.COOLIFY_API_TOKEN || '',
|
|
},
|
|
memoryUpdates: [],
|
|
};`;
|
|
|
|
const newCtx = ` const ctx: ToolContext = {
|
|
workspaceRoot: repoRoot,
|
|
gitea: {
|
|
apiUrl: GITEA_API_URL,
|
|
apiToken: GITEA_API_TOKEN,
|
|
username: GITEA_USERNAME,
|
|
},
|
|
coolify: {
|
|
apiUrl: process.env.COOLIFY_API_URL || '',
|
|
apiToken: process.env.COOLIFY_API_TOKEN || '',
|
|
},
|
|
mcpToken: mcpToken || '',
|
|
vibnApiUrl: vibnApiUrl || 'http://localhost:3000',
|
|
projectId,
|
|
memoryUpdates: [],
|
|
};`;
|
|
|
|
code = code.replace(oldCtx, newCtx);
|
|
|
|
fs.writeFileSync(file, code);
|
|
console.log("Patched Runner server.ts");
|