@@ -6,7 +6,7 @@ import { Config, getConfig } from "../config.js";
66import { newThread , execute } from "../amp.js" ;
77
88
9- export const reviewDiff = async ( diffContent : string , mrDetailsContent : string ) => {
9+ export const reviewDiff = async ( diffContent : string , mrDetailsContent : string , installationId : number ) => {
1010
1111 // Get config
1212 const config : Config = getConfig ( ) ;
@@ -42,9 +42,22 @@ export const reviewDiff = async (diffContent: string, mrDetailsContent: string)
4242 // Write prompt to file
4343 writeFileSync ( promptFilePath , promptContent , 'utf8' ) ;
4444
45- // Write settings to file
46- const settings = ampConfig . settings ;
47- writeFileSync ( settingsFilePath , JSON . stringify ( settings || { } , null , 2 ) , 'utf8' ) ;
45+ // Write settings to file with installation ID
46+ const settings = { ...ampConfig . settings } ;
47+
48+ // Ensure GitHub MCP server environment exists and set installation ID
49+ settings [ 'amp.mcpServers' ] = {
50+ ...settings [ 'amp.mcpServers' ] ,
51+ github : {
52+ ...settings [ 'amp.mcpServers' ] ?. github ,
53+ env : {
54+ ...settings [ 'amp.mcpServers' ] ?. github ?. env ,
55+ GITHUB_INSTALLATION_ID : installationId . toString ( ) ,
56+ }
57+ }
58+ } ;
59+
60+ writeFileSync ( settingsFilePath , JSON . stringify ( settings , null , 2 ) , 'utf8' ) ;
4861
4962 const threadId = await newThread ( tempDir ) ;
5063 const result = await execute ( {
0 commit comments