gemini-cli-usage 0.1.3__tar.gz → 0.1.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gemini-cli-usage
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Gemini CLI quota monitor — fetches Code Assist quota data from Google's backend
5
5
  Requires-Python: >=3.12
6
6
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "gemini-cli-usage"
3
- version = "0.1.3"
3
+ version = "0.1.5"
4
4
  description = "Gemini CLI quota monitor — fetches Code Assist quota data from Google's backend"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -190,14 +190,56 @@ def _write_oauth_credentials(creds: dict):
190
190
 
191
191
 
192
192
  def _get_gemini_cli_oauth2_path() -> Path | None:
193
+ oauth2_rels = [
194
+ Path("node_modules") / "@google" / "gemini-cli-core" / "dist" / "src" / "code_assist" / "oauth2.js",
195
+ Path("node_modules") / "@google" / "gemini-cli" / "node_modules" / "@google" / "gemini-cli-core" / "dist" / "src" / "code_assist" / "oauth2.js",
196
+ ]
197
+
198
+ candidates: list[Path] = []
199
+
200
+ # 1. Try shutil.which
193
201
  gemini_bin = shutil.which("gemini")
194
- if not gemini_bin:
195
- return None
202
+ if gemini_bin:
203
+ resolved = Path(gemini_bin).resolve()
204
+ candidates.extend([resolved.parent, resolved.parent.parent])
205
+
206
+ # 2. On Windows, scan fnm node version directories
207
+ if sys.platform == "win32":
208
+ fnm_dir = Path.home() / "AppData" / "Roaming" / "fnm" / "node-versions"
209
+ if fnm_dir.exists():
210
+ for version_dir in fnm_dir.iterdir():
211
+ candidates.append(version_dir / "installation")
212
+
213
+ # Also check AppData/Local fnm multishells
214
+ fnm_multi = Path.home() / "AppData" / "Local" / "fnm_multishells"
215
+ if fnm_multi.exists():
216
+ for shell_dir in fnm_multi.iterdir():
217
+ candidates.append(shell_dir)
218
+
219
+ # 3. Unix: check common global npm/nvm paths
220
+ else:
221
+ for p in [
222
+ Path("/usr/lib"),
223
+ Path("/usr/local/lib"),
224
+ Path.home() / ".nvm" / "versions",
225
+ ]:
226
+ if p.exists():
227
+ if "nvm" in str(p):
228
+ for v in p.rglob("node"):
229
+ candidates.append(v / "lib")
230
+ else:
231
+ candidates.append(p)
232
+
233
+ for root in candidates:
234
+ for oauth2_rel in oauth2_rels:
235
+ oauth2_path = root / oauth2_rel
236
+ if oauth2_path.exists():
237
+ return oauth2_path
238
+ oauth2_path = root / "lib" / oauth2_rel
239
+ if oauth2_path.exists():
240
+ return oauth2_path
196
241
 
197
- resolved = Path(gemini_bin).resolve()
198
- package_root = resolved.parent.parent
199
- oauth2_path = package_root / "node_modules" / "@google" / "gemini-cli-core" / "dist" / "src" / "code_assist" / "oauth2.js"
200
- return oauth2_path if oauth2_path.exists() else None
242
+ return None
201
243
 
202
244
 
203
245
  def _get_gemini_cli_oauth_client_credentials() -> tuple[str, str] | None:
@@ -0,0 +1,2 @@
1
+ from gemini_cli_usage import main
2
+ main()
@@ -4,5 +4,5 @@ requires-python = ">=3.12"
4
4
 
5
5
  [[package]]
6
6
  name = "gemini-cli-usage"
7
- version = "0.1.0"
7
+ version = "0.1.4"
8
8
  source = { editable = "." }