@prover-coder-ai/docker-git 1.0.45 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/docker-git/main.js +158 -131
- package/dist/src/docker-git/main.js.map +1 -1
- package/package.json +1 -1
|
@@ -286,7 +286,7 @@ var runCommandWithExitCodes = (spec, okExitCodes, onFailure) => Effect.gen(funct
|
|
|
286
286
|
const exitCode = yield* _(Command.exitCode(buildCommand(spec, "inherit", "inherit", "inherit")));
|
|
287
287
|
yield* _(ensureExitCode(Number(exitCode), okExitCodes, onFailure));
|
|
288
288
|
});
|
|
289
|
-
var runCommandExitCode = (spec) => Effect.map(Command.exitCode(buildCommand(spec, "pipe", "pipe", "
|
|
289
|
+
var runCommandExitCode = (spec) => Effect.map(Command.exitCode(buildCommand(spec, "pipe", "pipe", "pipe")), Number);
|
|
290
290
|
var collectUint8Array$1 = (chunks) => Chunk.reduce(chunks, new Uint8Array(), (acc, curr) => {
|
|
291
291
|
const next = new Uint8Array(acc.length + curr.length);
|
|
292
292
|
next.set(acc);
|
|
@@ -1394,7 +1394,7 @@ var readProjectConfig = (baseDir) => Effect.gen(function* (_) {
|
|
|
1394
1394
|
//#endregion
|
|
1395
1395
|
//#region ../lib/src/usecases/docker-git-config-search.ts
|
|
1396
1396
|
var isDockerGitConfig = (entry) => entry.endsWith("docker-git.json");
|
|
1397
|
-
var shouldSkipDir = (entry) => entry === ".git" || entry === ".orch" || entry === ".docker-git" || entry === ".cache";
|
|
1397
|
+
var shouldSkipDir = (entry) => entry === ".git" || entry === ".orch" || entry === ".docker-git" || entry === ".cache" || entry === "node_modules";
|
|
1398
1398
|
var isNotFoundStatError = (error) => error._tag === "SystemError" && error.reason === "NotFound";
|
|
1399
1399
|
var processDockerGitEntry = (fs, path, dir, entry, state) => Effect.gen(function* (_) {
|
|
1400
1400
|
if (shouldSkipDir(entry)) return;
|
|
@@ -1620,6 +1620,7 @@ var resolveTemplateResourceLimits = (template) => Effect.succeed(withDefaultReso
|
|
|
1620
1620
|
var successExitCode = Number(ExitCode(0));
|
|
1621
1621
|
var gitBaseEnv$1 = {
|
|
1622
1622
|
GIT_TERMINAL_PROMPT: "0",
|
|
1623
|
+
GIT_SSH_COMMAND: "ssh -o BatchMode=yes",
|
|
1623
1624
|
GIT_AUTHOR_NAME: "docker-git",
|
|
1624
1625
|
GIT_AUTHOR_EMAIL: "docker-git@users.noreply.github.com",
|
|
1625
1626
|
GIT_COMMITTER_NAME: "docker-git",
|
|
@@ -6565,6 +6566,150 @@ var authCodexStatus = (command) => withCodexAuth(command, ({ accountPath, cwd })
|
|
|
6565
6566
|
}));
|
|
6566
6567
|
var authCodexLogout = (command) => withCodexAuth(command, ({ accountPath, cwd }) => runCodexLogout(cwd, accountPath)).pipe(Effect.zipRight(autoSyncState(`chore(state): auth codex logout ${normalizeAccountLabel(command.label, "default")}`)));
|
|
6567
6568
|
//#endregion
|
|
6569
|
+
//#region ../lib/src/usecases/auth-gemini-helpers.ts
|
|
6570
|
+
var geminiImageName = "docker-git-auth-gemini:latest";
|
|
6571
|
+
var geminiImageDir = ".docker-git/.orch/auth/gemini/.image";
|
|
6572
|
+
var geminiContainerHomeDir = "/gemini-home";
|
|
6573
|
+
var geminiCredentialsDir$1 = ".gemini";
|
|
6574
|
+
var geminiAuthRoot = ".docker-git/.orch/auth/gemini";
|
|
6575
|
+
var geminiApiKeyFileName = ".api-key";
|
|
6576
|
+
var geminiEnvFileName = ".env";
|
|
6577
|
+
var geminiApiKeyPath = (accountPath) => `${accountPath}/${geminiApiKeyFileName}`;
|
|
6578
|
+
var geminiEnvFilePath = (accountPath) => `${accountPath}/${geminiEnvFileName}`;
|
|
6579
|
+
var geminiCredentialsPath = (accountPath) => `${accountPath}/${geminiCredentialsDir$1}`;
|
|
6580
|
+
var renderGeminiDockerfile = () => String.raw`FROM ubuntu:24.04
|
|
6581
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
6582
|
+
RUN apt-get update \
|
|
6583
|
+
&& apt-get install -y --no-install-recommends ca-certificates curl bsdutils \
|
|
6584
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
6585
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
|
|
6586
|
+
&& apt-get install -y --no-install-recommends nodejs \
|
|
6587
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
6588
|
+
RUN npm install -g @google/gemini-cli@0.33.2
|
|
6589
|
+
`;
|
|
6590
|
+
var ensureGeminiOrchLayout = (cwd) => migrateLegacyOrchLayout(cwd, {
|
|
6591
|
+
envGlobalPath: defaultTemplateConfig.envGlobalPath,
|
|
6592
|
+
envProjectPath: defaultTemplateConfig.envProjectPath,
|
|
6593
|
+
codexAuthPath: defaultTemplateConfig.codexAuthPath,
|
|
6594
|
+
ghAuthPath: ".docker-git/.orch/auth/gh",
|
|
6595
|
+
claudeAuthPath: ".docker-git/.orch/auth/claude",
|
|
6596
|
+
geminiAuthPath: ".docker-git/.orch/auth/gemini"
|
|
6597
|
+
});
|
|
6598
|
+
var resolveGeminiAccountPath = (path, rootPath, label) => {
|
|
6599
|
+
const accountLabel = normalizeAccountLabel(label, "default");
|
|
6600
|
+
return {
|
|
6601
|
+
accountLabel,
|
|
6602
|
+
accountPath: path.join(rootPath, accountLabel)
|
|
6603
|
+
};
|
|
6604
|
+
};
|
|
6605
|
+
var withGeminiAuth = (command, run, options = {}) => withFsPathContext(({ cwd, fs, path }) => Effect.gen(function* (_) {
|
|
6606
|
+
yield* _(ensureGeminiOrchLayout(cwd));
|
|
6607
|
+
const { accountLabel, accountPath } = resolveGeminiAccountPath(path, resolvePathFromCwd(path, cwd, command.geminiAuthPath), command.label);
|
|
6608
|
+
yield* _(fs.makeDirectory(accountPath, { recursive: true }));
|
|
6609
|
+
if (options.buildImage === true) yield* _(ensureDockerImage(fs, path, cwd, {
|
|
6610
|
+
imageName: geminiImageName,
|
|
6611
|
+
imageDir: geminiImageDir,
|
|
6612
|
+
dockerfile: renderGeminiDockerfile(),
|
|
6613
|
+
buildLabel: "gemini auth"
|
|
6614
|
+
}));
|
|
6615
|
+
return yield* _(run({
|
|
6616
|
+
accountLabel,
|
|
6617
|
+
accountPath,
|
|
6618
|
+
cwd,
|
|
6619
|
+
fs
|
|
6620
|
+
}));
|
|
6621
|
+
}));
|
|
6622
|
+
var readApiKey = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6623
|
+
const apiKeyFilePath = geminiApiKeyPath(accountPath);
|
|
6624
|
+
if (yield* _(isRegularFile$1(fs, apiKeyFilePath))) {
|
|
6625
|
+
const trimmed = (yield* _(fs.readFileString(apiKeyFilePath), Effect.orElseSucceed(() => ""))).trim();
|
|
6626
|
+
if (trimmed.length > 0) return trimmed;
|
|
6627
|
+
}
|
|
6628
|
+
const envFilePath = geminiEnvFilePath(accountPath);
|
|
6629
|
+
if (yield* _(isRegularFile$1(fs, envFilePath))) {
|
|
6630
|
+
const lines = (yield* _(fs.readFileString(envFilePath), Effect.orElseSucceed(() => ""))).split("\n");
|
|
6631
|
+
for (const line of lines) {
|
|
6632
|
+
const trimmed = line.trim();
|
|
6633
|
+
if (trimmed.startsWith("GEMINI_API_KEY=")) {
|
|
6634
|
+
const value = trimmed.slice(15).replaceAll(/^['"]|['"]$/g, "").trim();
|
|
6635
|
+
if (value.length > 0) return value;
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
}
|
|
6639
|
+
return null;
|
|
6640
|
+
});
|
|
6641
|
+
var hasOauthCredentials$1 = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6642
|
+
const credentialsDir = geminiCredentialsPath(accountPath);
|
|
6643
|
+
if (!(yield* _(fs.exists(credentialsDir)))) return false;
|
|
6644
|
+
const possibleFiles = [
|
|
6645
|
+
`${credentialsDir}/oauth-tokens.json`,
|
|
6646
|
+
`${credentialsDir}/credentials.json`,
|
|
6647
|
+
`${credentialsDir}/application_default_credentials.json`
|
|
6648
|
+
];
|
|
6649
|
+
for (const filePath of possibleFiles) if (yield* _(isRegularFile$1(fs, filePath))) return true;
|
|
6650
|
+
return false;
|
|
6651
|
+
});
|
|
6652
|
+
var resolveGeminiAuthMethod = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6653
|
+
if ((yield* _(readApiKey(fs, accountPath))) !== null) return "api-key";
|
|
6654
|
+
return (yield* _(hasOauthCredentials$1(fs, accountPath))) ? "oauth" : "none";
|
|
6655
|
+
});
|
|
6656
|
+
var prepareGeminiCredentialsDir = (cwd, accountPath, fs) => Effect.gen(function* (_) {
|
|
6657
|
+
const credentialsDir = geminiCredentialsPath(accountPath);
|
|
6658
|
+
const removeFallback = pipe(runCommandExitCode({
|
|
6659
|
+
cwd,
|
|
6660
|
+
command: "docker",
|
|
6661
|
+
args: [
|
|
6662
|
+
"run",
|
|
6663
|
+
"--rm",
|
|
6664
|
+
"-v",
|
|
6665
|
+
`${accountPath}:/target`,
|
|
6666
|
+
"alpine",
|
|
6667
|
+
"rm",
|
|
6668
|
+
"-rf",
|
|
6669
|
+
"/target/.gemini"
|
|
6670
|
+
]
|
|
6671
|
+
}), Effect.asVoid, Effect.orElse(() => Effect.void));
|
|
6672
|
+
yield* _(fs.remove(credentialsDir, {
|
|
6673
|
+
recursive: true,
|
|
6674
|
+
force: true
|
|
6675
|
+
}).pipe(Effect.orElse(() => removeFallback)));
|
|
6676
|
+
yield* _(fs.makeDirectory(credentialsDir, { recursive: true }));
|
|
6677
|
+
yield* _(runCommandExitCode({
|
|
6678
|
+
cwd,
|
|
6679
|
+
command: "chmod",
|
|
6680
|
+
args: [
|
|
6681
|
+
"-R",
|
|
6682
|
+
"777",
|
|
6683
|
+
credentialsDir
|
|
6684
|
+
]
|
|
6685
|
+
}).pipe(Effect.orElse(() => Effect.succeed(0))));
|
|
6686
|
+
return credentialsDir;
|
|
6687
|
+
});
|
|
6688
|
+
var writeInitialSettings = (credentialsDir, fs) => Effect.gen(function* (_) {
|
|
6689
|
+
const settingsPath = `${credentialsDir}/settings.json`;
|
|
6690
|
+
yield* _(fs.writeFileString(settingsPath, JSON.stringify({
|
|
6691
|
+
model: {
|
|
6692
|
+
name: "gemini-2.0-flash",
|
|
6693
|
+
compressionThreshold: .9,
|
|
6694
|
+
disableLoopDetection: true
|
|
6695
|
+
},
|
|
6696
|
+
general: { defaultApprovalMode: "auto_edit" },
|
|
6697
|
+
yolo: true,
|
|
6698
|
+
sandbox: { enabled: false },
|
|
6699
|
+
security: {
|
|
6700
|
+
folderTrust: { enabled: false },
|
|
6701
|
+
auth: { selectedType: "oauth-personal" },
|
|
6702
|
+
approvalPolicy: "never"
|
|
6703
|
+
}
|
|
6704
|
+
}, null, 2)));
|
|
6705
|
+
const trustedFoldersPath = `${credentialsDir}/trustedFolders.json`;
|
|
6706
|
+
yield* _(fs.writeFileString(trustedFoldersPath, JSON.stringify({
|
|
6707
|
+
"/": "TRUST_FOLDER",
|
|
6708
|
+
[geminiContainerHomeDir]: "TRUST_FOLDER"
|
|
6709
|
+
})));
|
|
6710
|
+
return settingsPath;
|
|
6711
|
+
});
|
|
6712
|
+
//#endregion
|
|
6568
6713
|
//#region ../lib/src/usecases/auth-gemini-oauth.ts
|
|
6569
6714
|
var outputWindowSize = 262144;
|
|
6570
6715
|
var authSuccessPatterns = [
|
|
@@ -6572,8 +6717,7 @@ var authSuccessPatterns = [
|
|
|
6572
6717
|
"Authentication successful",
|
|
6573
6718
|
"Successfully authenticated",
|
|
6574
6719
|
"Logged in as",
|
|
6575
|
-
"You are now logged in"
|
|
6576
|
-
"Logged in with Google"
|
|
6720
|
+
"You are now logged in"
|
|
6577
6721
|
];
|
|
6578
6722
|
var authFailurePatterns = [
|
|
6579
6723
|
"Authentication failed",
|
|
@@ -6605,6 +6749,7 @@ var buildDockerGeminiAuthSpec = (cwd, accountPath, image, containerPath, port) =
|
|
|
6605
6749
|
"NO_BROWSER=true",
|
|
6606
6750
|
"GEMINI_CLI_NONINTERACTIVE=true",
|
|
6607
6751
|
"GEMINI_CLI_TRUST_ALL=true",
|
|
6752
|
+
"GEMINI_DISABLE_UPDATE_CHECK=true",
|
|
6608
6753
|
`OAUTH_CALLBACK_PORT=${port}`,
|
|
6609
6754
|
"OAUTH_CALLBACK_HOST=0.0.0.0"
|
|
6610
6755
|
]
|
|
@@ -6613,12 +6758,15 @@ var buildDockerGeminiAuthArgs = (spec) => {
|
|
|
6613
6758
|
const base = [
|
|
6614
6759
|
"run",
|
|
6615
6760
|
"--rm",
|
|
6761
|
+
"--init",
|
|
6616
6762
|
"-i",
|
|
6617
6763
|
"-t",
|
|
6618
6764
|
"-v",
|
|
6619
6765
|
`${spec.hostPath}:${spec.containerPath}`,
|
|
6620
6766
|
"-p",
|
|
6621
|
-
`${spec.callbackPort}:${spec.callbackPort}
|
|
6767
|
+
`${spec.callbackPort}:${spec.callbackPort}`,
|
|
6768
|
+
"-w",
|
|
6769
|
+
spec.containerPath
|
|
6622
6770
|
];
|
|
6623
6771
|
for (const entry of spec.env) {
|
|
6624
6772
|
const trimmed = entry.trim();
|
|
@@ -6629,7 +6777,8 @@ var buildDockerGeminiAuthArgs = (spec) => {
|
|
|
6629
6777
|
...base,
|
|
6630
6778
|
spec.image,
|
|
6631
6779
|
"gemini",
|
|
6632
|
-
"
|
|
6780
|
+
"mcp",
|
|
6781
|
+
"list",
|
|
6633
6782
|
"--debug"
|
|
6634
6783
|
];
|
|
6635
6784
|
};
|
|
@@ -6726,103 +6875,14 @@ var runGeminiOauthLoginWithPrompt = (cwd, accountPath, options) => Effect.scoped
|
|
|
6726
6875
|
const resultBox = { value: "pending" };
|
|
6727
6876
|
const stdoutFiber = yield* _(Effect.forkScoped(pumpDockerOutput(proc.stdout, 1, resultBox, authDeferred)));
|
|
6728
6877
|
const stderrFiber = yield* _(Effect.forkScoped(pumpDockerOutput(proc.stderr, 2, resultBox, authDeferred)));
|
|
6729
|
-
const exitCode = yield* _(Effect.race(proc.exitCode.pipe(Effect.map(Number)), pipe(Deferred.await(authDeferred), Effect.flatMap(() => proc.kill()), Effect.map(() => 0))));
|
|
6730
|
-
yield* _(Fiber$1.
|
|
6731
|
-
yield* _(Fiber$1.
|
|
6878
|
+
const exitCode = yield* _(Effect.race(proc.exitCode.pipe(Effect.map(Number)), pipe(Deferred.await(authDeferred), Effect.delay("500 millis"), Effect.flatMap(() => proc.kill()), Effect.map(() => 0))));
|
|
6879
|
+
yield* _(Fiber$1.interrupt(stdoutFiber));
|
|
6880
|
+
yield* _(Fiber$1.interrupt(stderrFiber));
|
|
6732
6881
|
yield* _(fixGeminiAuthPermissions(hostPath, spec.containerPath));
|
|
6733
6882
|
return yield* _(resolveGeminiLoginResult(resultBox.value, exitCode));
|
|
6734
6883
|
}));
|
|
6735
6884
|
//#endregion
|
|
6736
6885
|
//#region ../lib/src/usecases/auth-gemini.ts
|
|
6737
|
-
var geminiImageName = "docker-git-auth-gemini:latest";
|
|
6738
|
-
var geminiImageDir = ".docker-git/.orch/auth/gemini/.image";
|
|
6739
|
-
var geminiContainerHomeDir = "/gemini-home";
|
|
6740
|
-
var geminiCredentialsDir$1 = ".gemini";
|
|
6741
|
-
var geminiAuthRoot = ".docker-git/.orch/auth/gemini";
|
|
6742
|
-
var geminiApiKeyFileName = ".api-key";
|
|
6743
|
-
var geminiEnvFileName = ".env";
|
|
6744
|
-
var geminiApiKeyPath = (accountPath) => `${accountPath}/${geminiApiKeyFileName}`;
|
|
6745
|
-
var geminiEnvFilePath = (accountPath) => `${accountPath}/${geminiEnvFileName}`;
|
|
6746
|
-
var geminiCredentialsPath = (accountPath) => `${accountPath}/${geminiCredentialsDir$1}`;
|
|
6747
|
-
var renderGeminiDockerfile = () => String.raw`FROM ubuntu:24.04
|
|
6748
|
-
ENV DEBIAN_FRONTEND=noninteractive
|
|
6749
|
-
RUN apt-get update \
|
|
6750
|
-
&& apt-get install -y --no-install-recommends ca-certificates curl bsdutils \
|
|
6751
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
6752
|
-
RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
|
|
6753
|
-
&& apt-get install -y --no-install-recommends nodejs \
|
|
6754
|
-
&& node -v \
|
|
6755
|
-
&& npm -v \
|
|
6756
|
-
&& rm -rf /var/lib/apt/lists/*
|
|
6757
|
-
RUN npm install -g @google/gemini-cli@latest
|
|
6758
|
-
ENTRYPOINT ["/bin/bash", "-c"]
|
|
6759
|
-
`;
|
|
6760
|
-
var ensureGeminiOrchLayout = (cwd) => migrateLegacyOrchLayout(cwd, {
|
|
6761
|
-
envGlobalPath: defaultTemplateConfig.envGlobalPath,
|
|
6762
|
-
envProjectPath: defaultTemplateConfig.envProjectPath,
|
|
6763
|
-
codexAuthPath: defaultTemplateConfig.codexAuthPath,
|
|
6764
|
-
ghAuthPath: ".docker-git/.orch/auth/gh",
|
|
6765
|
-
claudeAuthPath: ".docker-git/.orch/auth/claude",
|
|
6766
|
-
geminiAuthPath: ".docker-git/.orch/auth/gemini"
|
|
6767
|
-
});
|
|
6768
|
-
var resolveGeminiAccountPath = (path, rootPath, label) => {
|
|
6769
|
-
const accountLabel = normalizeAccountLabel(label, "default");
|
|
6770
|
-
return {
|
|
6771
|
-
accountLabel,
|
|
6772
|
-
accountPath: path.join(rootPath, accountLabel)
|
|
6773
|
-
};
|
|
6774
|
-
};
|
|
6775
|
-
var withGeminiAuth = (command, run, options = {}) => withFsPathContext(({ cwd, fs, path }) => Effect.gen(function* (_) {
|
|
6776
|
-
yield* _(ensureGeminiOrchLayout(cwd));
|
|
6777
|
-
const { accountLabel, accountPath } = resolveGeminiAccountPath(path, resolvePathFromCwd(path, cwd, command.geminiAuthPath), command.label);
|
|
6778
|
-
yield* _(fs.makeDirectory(accountPath, { recursive: true }));
|
|
6779
|
-
if (options.buildImage === true) yield* _(ensureDockerImage(fs, path, cwd, {
|
|
6780
|
-
imageName: geminiImageName,
|
|
6781
|
-
imageDir: geminiImageDir,
|
|
6782
|
-
dockerfile: renderGeminiDockerfile(),
|
|
6783
|
-
buildLabel: "gemini auth"
|
|
6784
|
-
}));
|
|
6785
|
-
return yield* _(run({
|
|
6786
|
-
accountLabel,
|
|
6787
|
-
accountPath,
|
|
6788
|
-
cwd,
|
|
6789
|
-
fs
|
|
6790
|
-
}));
|
|
6791
|
-
}));
|
|
6792
|
-
var readApiKey = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6793
|
-
const apiKeyFilePath = geminiApiKeyPath(accountPath);
|
|
6794
|
-
if (yield* _(isRegularFile$1(fs, apiKeyFilePath))) {
|
|
6795
|
-
const trimmed = (yield* _(fs.readFileString(apiKeyFilePath), Effect.orElseSucceed(() => ""))).trim();
|
|
6796
|
-
if (trimmed.length > 0) return trimmed;
|
|
6797
|
-
}
|
|
6798
|
-
const envFilePath = geminiEnvFilePath(accountPath);
|
|
6799
|
-
if (yield* _(isRegularFile$1(fs, envFilePath))) {
|
|
6800
|
-
const lines = (yield* _(fs.readFileString(envFilePath), Effect.orElseSucceed(() => ""))).split("\n");
|
|
6801
|
-
for (const line of lines) {
|
|
6802
|
-
const trimmed = line.trim();
|
|
6803
|
-
if (trimmed.startsWith("GEMINI_API_KEY=")) {
|
|
6804
|
-
const value = trimmed.slice(15).replaceAll(/^['"]|['"]$/g, "").trim();
|
|
6805
|
-
if (value.length > 0) return value;
|
|
6806
|
-
}
|
|
6807
|
-
}
|
|
6808
|
-
}
|
|
6809
|
-
return null;
|
|
6810
|
-
});
|
|
6811
|
-
var hasOauthCredentials$1 = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6812
|
-
const credentialsDir = geminiCredentialsPath(accountPath);
|
|
6813
|
-
if (!(yield* _(fs.exists(credentialsDir)))) return false;
|
|
6814
|
-
const possibleFiles = [
|
|
6815
|
-
`${credentialsDir}/oauth-tokens.json`,
|
|
6816
|
-
`${credentialsDir}/credentials.json`,
|
|
6817
|
-
`${credentialsDir}/application_default_credentials.json`
|
|
6818
|
-
];
|
|
6819
|
-
for (const filePath of possibleFiles) if (yield* _(isRegularFile$1(fs, filePath))) return true;
|
|
6820
|
-
return false;
|
|
6821
|
-
});
|
|
6822
|
-
var resolveGeminiAuthMethod = (fs, accountPath) => Effect.gen(function* (_) {
|
|
6823
|
-
if ((yield* _(readApiKey(fs, accountPath))) !== null) return "api-key";
|
|
6824
|
-
return (yield* _(hasOauthCredentials$1(fs, accountPath))) ? "oauth" : "none";
|
|
6825
|
-
});
|
|
6826
6886
|
var authGeminiLogin = (command, apiKey) => {
|
|
6827
6887
|
const accountLabel = normalizeAccountLabel(command.label, "default");
|
|
6828
6888
|
return withGeminiAuth(command, ({ accountPath, fs }) => Effect.gen(function* (_) {
|
|
@@ -6843,39 +6903,6 @@ var authGeminiLoginCli = (_command) => Effect.gen(function* (_) {
|
|
|
6843
6903
|
yield* _(Effect.log(" - Use: docker-git menu -> Auth profiles -> Gemini CLI: login via OAuth"));
|
|
6844
6904
|
yield* _(Effect.log(" - Follow the prompts to authenticate with your Google account"));
|
|
6845
6905
|
});
|
|
6846
|
-
var prepareGeminiCredentialsDir = (cwd, accountPath, fs) => Effect.gen(function* (_) {
|
|
6847
|
-
const credentialsDir = geminiCredentialsPath(accountPath);
|
|
6848
|
-
const removeFallback = pipe(runCommandExitCode({
|
|
6849
|
-
cwd,
|
|
6850
|
-
command: "docker",
|
|
6851
|
-
args: [
|
|
6852
|
-
"run",
|
|
6853
|
-
"--rm",
|
|
6854
|
-
"-v",
|
|
6855
|
-
`${accountPath}:/target`,
|
|
6856
|
-
"alpine",
|
|
6857
|
-
"rm",
|
|
6858
|
-
"-rf",
|
|
6859
|
-
"/target/.gemini"
|
|
6860
|
-
]
|
|
6861
|
-
}), Effect.asVoid, Effect.orElse(() => Effect.void));
|
|
6862
|
-
yield* _(fs.remove(credentialsDir, {
|
|
6863
|
-
recursive: true,
|
|
6864
|
-
force: true
|
|
6865
|
-
}).pipe(Effect.orElse(() => removeFallback)));
|
|
6866
|
-
yield* _(fs.makeDirectory(credentialsDir, { recursive: true }));
|
|
6867
|
-
return credentialsDir;
|
|
6868
|
-
});
|
|
6869
|
-
var writeInitialSettings = (credentialsDir, fs) => Effect.gen(function* (_) {
|
|
6870
|
-
const settingsPath = `${credentialsDir}/settings.json`;
|
|
6871
|
-
yield* _(fs.writeFileString(settingsPath, JSON.stringify({ security: { folderTrust: { enabled: false } } })));
|
|
6872
|
-
const trustedFoldersPath = `${credentialsDir}/trustedFolders.json`;
|
|
6873
|
-
yield* _(fs.writeFileString(trustedFoldersPath, JSON.stringify({
|
|
6874
|
-
"/": "TRUST_FOLDER",
|
|
6875
|
-
[geminiContainerHomeDir]: "TRUST_FOLDER"
|
|
6876
|
-
})));
|
|
6877
|
-
return settingsPath;
|
|
6878
|
-
});
|
|
6879
6906
|
var authGeminiLoginOauth = (command) => {
|
|
6880
6907
|
const accountLabel = normalizeAccountLabel(command.label, "default");
|
|
6881
6908
|
return withGeminiAuth(command, ({ accountPath, cwd, fs }) => Effect.gen(function* (_) {
|