opencode-usage 0.3.1 → 0.4.0

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/README.md CHANGED
@@ -87,13 +87,13 @@ opencode-usage --provider anthropic --since 7d --json
87
87
 
88
88
  ## How It Works
89
89
 
90
- This tool reads OpenCode session data from:
90
+ This tool reads OpenCode session data from the SQLite database (`opencode.db`):
91
91
 
92
- - Linux: `~/.local/share/opencode/storage/`
93
- - macOS: `~/.local/share/opencode/storage/`
94
- - Windows: `%LOCALAPPDATA%/opencode/storage/`
92
+ - Linux: `~/.local/share/opencode/opencode.db`
93
+ - macOS: `~/.local/share/opencode/opencode.db`
94
+ - Windows: `%LOCALAPPDATA%/opencode/opencode.db`
95
95
 
96
- It aggregates token usage by day and calculates estimated costs based on current API pricing.
96
+ Requires OpenCode v1.2.0+ (SQLite storage). It aggregates token usage by day and calculates estimated costs based on current API pricing.
97
97
 
98
98
  ## Note on Costs
99
99
 
package/dist/cli.d.ts CHANGED
@@ -9,9 +9,7 @@ export type CliArgs = {
9
9
  json?: boolean;
10
10
  monthly?: boolean;
11
11
  watch?: boolean;
12
- dashboard?: boolean;
13
- codexToken?: string;
14
- config?: "set-codex-token" | "show";
15
- configToken?: string;
12
+ stats?: boolean;
13
+ config?: "show";
16
14
  };
17
15
  export declare function parseArgs(): CliArgs;
@@ -1,6 +1,10 @@
1
1
  import type { QuotaSnapshot } from "./types.js";
2
2
  /**
3
- * Fetch Codex usage quota from ChatGPT API
4
- * Requires a valid session token passed via --codex-token
3
+ * Resolve Codex token: explicit override > ~/.codex/auth.json auto-read
4
+ */
5
+ export declare function resolveCodexToken(explicitToken?: string): Promise<string | undefined>;
6
+ /**
7
+ * Fetch Codex usage quota from ChatGPT API.
8
+ * Auto-reads token from ~/.codex/auth.json if not provided explicitly.
5
9
  */
6
10
  export declare function loadCodexQuota(token?: string): Promise<QuotaSnapshot[]>;
@@ -1,5 +1 @@
1
- /**
2
- * Config management commands
3
- */
4
- export declare function setCodexToken(token: string): Promise<void>;
5
1
  export declare function showConfig(): Promise<void>;
package/dist/config.d.ts CHANGED
@@ -1,9 +1 @@
1
- /**
2
- * Configuration file loader for opencode-usage
3
- */
4
- export type Config = {
5
- codexToken?: string;
6
- };
7
1
  export declare function getConfigPath(): string;
8
- export declare function loadConfig(): Promise<Config>;
9
- export declare function saveConfig(config: Config): Promise<void>;
@@ -1,5 +1,4 @@
1
1
  type DashboardProps = {
2
- codexToken?: string;
3
2
  providerFilter?: string;
4
3
  initialDays?: number;
5
4
  refreshInterval?: number;
@@ -2,7 +2,6 @@
2
2
  * Dashboard orchestrator - unified multi-source usage view
3
3
  */
4
4
  export type DashboardOptions = {
5
- codexToken?: string;
6
5
  refreshInterval?: number;
7
6
  providerFilter?: string;
8
7
  daysFilter?: number;
package/dist/index.d.ts CHANGED
@@ -3,12 +3,9 @@
3
3
  * OpenCode Usage - CLI tool for tracking OpenCode AI usage and costs
4
4
  *
5
5
  * Usage:
6
- * bunx opencode-usage
7
- * bunx opencode-usage --provider anthropic
8
- * bunx opencode-usage --days 30
9
- * bunx opencode-usage --since 20251201 --until 20251231
10
- * bunx opencode-usage --monthly --json
11
- * bunx opencode-usage --watch
12
- * bunx opencode-usage --dashboard
6
+ * bunx opencode-usage (dashboard, default)
7
+ * bunx opencode-usage --stats (table mode)
8
+ * bunx opencode-usage --stats -d 30
9
+ * bunx opencode-usage --stats --monthly --json
13
10
  */
14
11
  export {};