mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-25 05:21:03 -07:00
fix(workspaces): fix invalid gemini args and initialize remote auth settings
This commit is contained in:
@@ -13,7 +13,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const prNumber = process.argv[2];
|
||||
const branchName = process.argv[3];
|
||||
const policyPath = process.argv[4];
|
||||
const ISOLATED_CONFIG = process.env.GEMINI_CLI_HOME || path.join(process.env.HOME || '', '.workspace/gemini-cli-config');
|
||||
const ISOLATED_CONFIG = process.env.GEMINI_CLI_HOME || path.join(process.env.HOME || '', '.workspaces/gemini-cli-config');
|
||||
|
||||
async function main() {
|
||||
if (!prNumber || !branchName || !policyPath) {
|
||||
|
||||
@@ -6,9 +6,9 @@ export async function runFixPlaybook(prNumber: string, targetDir: string, policy
|
||||
console.log('Switching to agentic fix loop inside Gemini CLI...');
|
||||
|
||||
// Use the nightly gemini binary to activate the fix-pr skill and iterate
|
||||
// Note: Gemini doesn't support --cwd, so the caller (worker.ts) must ensure we are already in targetDir
|
||||
const result = spawnSync(geminiBin, [
|
||||
'--policy', policyPath,
|
||||
'--cwd', targetDir,
|
||||
'-p', `Please activate the 'fix-pr' skill and use it to iteratively fix PR #${prNumber}.
|
||||
Ensure you handle CI failures, merge conflicts, and unaddressed review comments
|
||||
until the PR is fully passing and mergeable.`
|
||||
|
||||
@@ -225,6 +225,22 @@ and full builds) to a dedicated, high-performance GCP worker.
|
||||
await provider.exec(`mkdir -p ~/.workspaces && echo ${githubToken} > ~/.workspaces/.gh_token && chmod 600 ~/.workspaces/.gh_token`);
|
||||
}
|
||||
|
||||
// Initialize Remote Gemini Config with Auth
|
||||
console.log('⚙️ Initializing remote Gemini configuration...');
|
||||
const remoteConfigDir = `~/.workspaces/gemini-cli-config/.gemini`;
|
||||
await provider.exec(`mkdir -p ${remoteConfigDir}`);
|
||||
|
||||
// Create a minimal settings.json on the remote to enable auth
|
||||
const remoteSettings = {
|
||||
general: {
|
||||
authMethod: 'google_accounts'
|
||||
}
|
||||
};
|
||||
const tmpSettingsPath = path.join(os.tmpdir(), `remote-settings-${Date.now()}.json`);
|
||||
fs.writeFileSync(tmpSettingsPath, JSON.stringify(remoteSettings, null, 2));
|
||||
await provider.sync(tmpSettingsPath, `${remoteConfigDir}/settings.json`);
|
||||
fs.unlinkSync(tmpSettingsPath);
|
||||
|
||||
// Final Repo Sync
|
||||
console.log(`🚀 Finalizing Remote Repository (${userFork})...`);
|
||||
const repoUrl = `https://github.com/${userFork}.git`;
|
||||
|
||||
Reference in New Issue
Block a user