gemini-cli-leo 0.1.25 → 0.1.26

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.
Files changed (2) hide show
  1. package/gemini.mjs +43 -9
  2. package/package.json +1 -1
package/gemini.mjs CHANGED
@@ -173286,8 +173286,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
173286
173286
  var init_git_commit = __esm({
173287
173287
  "packages/core/dist/src/generated/git-commit.js"() {
173288
173288
  "use strict";
173289
- GIT_COMMIT_INFO = "fef7510";
173290
- CLI_VERSION = "0.1.25";
173289
+ GIT_COMMIT_INFO = "e922bce";
173290
+ CLI_VERSION = "0.1.26";
173291
173291
  }
173292
173292
  });
173293
173293
 
@@ -316489,7 +316489,7 @@ function getVersion() {
316489
316489
  }
316490
316490
  versionPromise = (async () => {
316491
316491
  const pkgJson = await getPackageJson(__dirname4);
316492
- return "0.1.25";
316492
+ return "0.1.26";
316493
316493
  })();
316494
316494
  return versionPromise;
316495
316495
  }
@@ -318858,6 +318858,19 @@ function isWorkspaceLocalPath(token2, options) {
318858
318858
  return false;
318859
318859
  }
318860
318860
  }
318861
+ function isCliManagedPathToken(token2, options) {
318862
+ if (!options?.cwd || !options.isCliManagedPath || token2.startsWith("http://") || token2.startsWith("https://") || EXECUTABLE_SCRIPT_REGEX.test(token2) || /[$`~]/.test(token2)) {
318863
+ return false;
318864
+ }
318865
+ try {
318866
+ return options.isCliManagedPath(path43.resolve(options.cwd, token2));
318867
+ } catch {
318868
+ return false;
318869
+ }
318870
+ }
318871
+ function isFlaggingRelevantPath(token2, options) {
318872
+ return !isWorkspaceLocalPath(token2, options) && !isCliManagedPathToken(token2, options);
318873
+ }
318861
318874
  function hasUntrustedSubstring(untrustedContext, value) {
318862
318875
  const normalized2 = value.toLowerCase().replace(/\\/g, "/");
318863
318876
  return untrustedContext.untrustedTexts.some((text) => text.toLowerCase().includes(normalized2));
@@ -318982,7 +318995,7 @@ function findUntrustedFlags(command2, untrustedContext, options) {
318982
318995
  }
318983
318996
  }
318984
318997
  if (valToCheck && rawValToCheck) {
318985
- const isRiskyValuePattern = isHighRiskPatternToken(rawValToCheck) && (isHighRiskFlag || !isWorkspaceLocalPath(rawValToCheck, options));
318998
+ const isRiskyValuePattern = isHighRiskPatternToken(rawValToCheck) && (isHighRiskFlag || isFlaggingRelevantPath(rawValToCheck, options));
318986
318999
  const isValUntrusted = untrustedContext.untrustedTokens.has(valToCheck) && (isHighRiskFlag || !isSafeFlag && isRiskyValuePattern);
318987
319000
  const isHighRiskValSubstring = (!isSafeFlag || isHighRiskFlag) && isRiskyValuePattern && hasUntrustedSubstring(untrustedContext, valToCheck);
318988
319001
  if (isValUntrusted || isHighRiskValSubstring) {
@@ -319001,7 +319014,7 @@ function findUntrustedFlags(command2, untrustedContext, options) {
319001
319014
  if (token2.length <= 1 || BARE_SHELL_VARIABLE_REGEX.test(token2)) {
319002
319015
  continue;
319003
319016
  }
319004
- if (isHighRiskPatternToken(token2) && !isWorkspaceLocalPath(token2, options)) {
319017
+ if (isHighRiskPatternToken(token2) && isFlaggingRelevantPath(token2, options)) {
319005
319018
  if (untrustedContext.untrustedTokens.has(lowerToken)) {
319006
319019
  detected.add(token2);
319007
319020
  continue;
@@ -342902,6 +342915,25 @@ function trimLiveOutputBuffer(output) {
342902
342915
  }
342903
342916
  return output.slice(startIndex);
342904
342917
  }
342918
+ function isGeminiManagedPath(absolutePath, config2) {
342919
+ const managedRoots = [
342920
+ Storage.getGlobalGeminiDir(),
342921
+ config2.storage.getProjectTempDir()
342922
+ ];
342923
+ let resolvedPath;
342924
+ try {
342925
+ resolvedPath = resolveToRealPath(absolutePath);
342926
+ } catch {
342927
+ return false;
342928
+ }
342929
+ return managedRoots.some((root) => {
342930
+ try {
342931
+ return isSubpath(resolveToRealPath(root), resolvedPath);
342932
+ } catch {
342933
+ return false;
342934
+ }
342935
+ });
342936
+ }
342905
342937
  var OUTPUT_UPDATE_INTERVAL_MS, LIVE_OUTPUT_MAX_BUFFER_CHARS, BACKGROUND_DELAY_MS, SHOW_NL_DESCRIPTION_THRESHOLD, LOW_SURROGATE_START, LOW_SURROGATE_END, ShellToolInvocation, ShellTool;
342906
342938
  var init_shell = __esm({
342907
342939
  "packages/core/dist/src/tools/shell.js"() {
@@ -342922,6 +342954,7 @@ var init_shell = __esm({
342922
342954
  init_coreTools();
342923
342955
  init_resolver();
342924
342956
  init_paths();
342957
+ init_storage();
342925
342958
  init_proactivePermissions();
342926
342959
  init_textUtils();
342927
342960
  OUTPUT_UPDATE_INTERVAL_MS = 1e3;
@@ -343085,7 +343118,8 @@ exit $__code`;
343085
343118
  const workspaceContext = config2.getWorkspaceContext();
343086
343119
  const untrustedFlags = findUntrustedFlags(command2, untrustedContext, {
343087
343120
  cwd: this.params.dir_path ? path64.resolve(targetDir, this.params.dir_path) : targetDir,
343088
- isPathWithinWorkspace: (absolutePath) => workspaceContext.isPathWithinWorkspace(absolutePath)
343121
+ isPathWithinWorkspace: (absolutePath) => workspaceContext.isPathWithinWorkspace(absolutePath),
343122
+ isCliManagedPath: (absolutePath) => isGeminiManagedPath(absolutePath, config2)
343089
343123
  });
343090
343124
  let roots = [];
343091
343125
  try {
@@ -481352,7 +481386,7 @@ var GIT_COMMIT_INFO2;
481352
481386
  var init_git_commit2 = __esm({
481353
481387
  "packages/cli/src/generated/git-commit.ts"() {
481354
481388
  "use strict";
481355
- GIT_COMMIT_INFO2 = "fef7510";
481389
+ GIT_COMMIT_INFO2 = "e922bce";
481356
481390
  }
481357
481391
  });
481358
481392
 
@@ -603504,13 +603538,13 @@ ${deceptiveUrlWarnings.map(
603504
603538
  });
603505
603539
  const hasUntrustedFlags = confirmationDetails.untrustedFlags && confirmationDetails.untrustedFlags.length > 0;
603506
603540
  const hasModifiedBuildFiles = confirmationDetails.modifiedBuildFiles && confirmationDetails.modifiedBuildFiles.length > 0;
603507
- if (isTrustedFolder && !hasUntrustedFlags && !hasModifiedBuildFiles) {
603541
+ if (isTrustedFolder && !hasModifiedBuildFiles) {
603508
603542
  options2.push({
603509
603543
  label: `Allow for this session`,
603510
603544
  value: ToolConfirmationOutcome.ProceedAlways,
603511
603545
  key: `Allow for this session`
603512
603546
  });
603513
- if (allowPermanentApproval) {
603547
+ if (allowPermanentApproval && !hasUntrustedFlags) {
603514
603548
  options2.push({
603515
603549
  label: `Allow this command for all future sessions`,
603516
603550
  value: ToolConfirmationOutcome.ProceedAlwaysAndSave,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemini-cli-leo",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "gemini-leo": "gemini.mjs"