(home: string, path: string, modelToken: string)
| 38 | } |
| 39 | |
| 40 | export function isolatedEnvironment(home: string, path: string, modelToken: string): NodeJS.ProcessEnv { |
| 41 | return { |
| 42 | HOME: home, |
| 43 | USERPROFILE: home, |
| 44 | TMPDIR: join(home, "tmp"), |
| 45 | XDG_CONFIG_HOME: join(home, ".config"), |
| 46 | XDG_CACHE_HOME: join(home, ".cache"), |
| 47 | XDG_DATA_HOME: join(home, ".local/share"), |
| 48 | GH_CONFIG_DIR: join(home, ".config/gh"), |
| 49 | COPILOT_HOME: join(home, ".copilot"), |
| 50 | COPILOT_CLI: "1", |
| 51 | COPILOT_GITHUB_TOKEN: modelToken, |
| 52 | GIT_CONFIG_NOSYSTEM: "1", |
| 53 | GIT_CONFIG_GLOBAL: join(home, ".gitconfig"), |
| 54 | GIT_TERMINAL_PROMPT: "0", |
| 55 | GCM_INTERACTIVE: "never", |
| 56 | PATH: path, |
| 57 | LANG: "en_US.UTF-8", |
| 58 | TERM: "dumb", |
| 59 | NO_COLOR: "1", |
| 60 | }; |
| 61 | } |
| 62 | |
| 63 | export async function git(workDir: string, env: NodeJS.ProcessEnv, ...args: string[]): Promise<string> { |
| 64 | const { stdout } = await exec("git", args, { cwd: workDir, env, timeout: 30_000, maxBuffer: 2 * 1024 * 1024 }); |
no outgoing calls