@ravshansbox/pi-quota 0.3.0 → 0.3.2

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/index.ts +8 -5
  2. package/package.json +5 -5
package/index.ts CHANGED
@@ -9,8 +9,11 @@
9
9
  import { spawn } from 'node:child_process';
10
10
  import { readFile, writeFile, appendFile } from 'node:fs/promises';
11
11
  import { join } from 'node:path';
12
- import { homedir } from 'node:os';
13
- import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';
12
+ import {
13
+ getAgentDir,
14
+ type ExtensionAPI,
15
+ type ExtensionContext,
16
+ } from '@earendil-works/pi-coding-agent';
14
17
 
15
18
  interface QuotaConfig {
16
19
  codexResets?: { autoRedeem?: boolean };
@@ -119,7 +122,7 @@ function formatResetTime(reset: Date): string {
119
122
 
120
123
  async function loadConfig(): Promise<QuotaConfig | null> {
121
124
  try {
122
- const settingsPath = join(homedir(), '.pi', 'agent', 'settings.json');
125
+ const settingsPath = join(getAgentDir(), 'settings.json');
123
126
  const settings = JSON.parse(await readFile(settingsPath, 'utf-8'));
124
127
  return settings.quota ?? null;
125
128
  } catch {
@@ -128,7 +131,7 @@ async function loadConfig(): Promise<QuotaConfig | null> {
128
131
  }
129
132
 
130
133
  function authPath() {
131
- return join(homedir(), '.pi', 'agent', 'auth.json');
134
+ return join(getAgentDir(), 'auth.json');
132
135
  }
133
136
 
134
137
  async function loadAuth(): Promise<AuthFile | null> {
@@ -150,7 +153,7 @@ async function persistAuthRecord(provider: string, record: OAuthAuthRecord): Pro
150
153
  }
151
154
 
152
155
  function logPath() {
153
- return join(homedir(), '.pi', 'agent', 'pi-quota.log');
156
+ return join(getAgentDir(), 'pi-quota.log');
154
157
  }
155
158
 
156
159
  async function logError(message: string, error?: unknown): Promise<void> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ravshansbox/pi-quota",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Anthropic and OpenAI Codex quota status extension for pi",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,12 +35,12 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@eslint/js": "^10.0.1",
38
- "@types/node": "^26.6.4",
39
- "eslint": "^10.12.0",
38
+ "@types/node": "^26.6.5",
39
+ "eslint": "^10.13.0",
40
40
  "eslint-config-prettier": "^10.1.8",
41
- "prettier": "^3.9.9",
41
+ "prettier": "^3.9.10",
42
42
  "typescript": "^6.0.3",
43
- "typescript-eslint": "^8.71.1"
43
+ "typescript-eslint": "^8.72.0"
44
44
  },
45
45
  "files": [
46
46
  "index.ts"