@empirical-gauzza/cli 1.0.36 → 1.0.37

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.
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ // `empirical usage`: memory, blueprint installs this month, and Empirical Tokens (spec 8.4).
4
+ // Reads GET /api/v1/billing/me. The Empirical Tokens line appears only while they are enforced
5
+ // for this account, so the command stays dark until rollout. A missing or null
6
+ // empiricalTokenUsage, or any mode other than 'enforce', is hidden.
7
+ const { httpJson, printApiError } = require('./http');
8
+ const { requireAccessToken, resolveApiBaseUrl, buildApiAuthHeaders } = require('./auth');
9
+ const { log } = require('./ui');
10
+ const { resetLabel } = require('./empiricalTokensFormat');
11
+
12
+ const fmt = (n) => Number(n).toLocaleString('en-US');
13
+
14
+ function empiricalTokensLine(usage) {
15
+ if (!usage || usage.mode !== 'enforce') return null;
16
+ // An admin account has no limit: the server sends unlimited true with null granted and remaining.
17
+ if (usage.unlimited) return `Empirical Tokens: unlimited. ${fmt(usage.spent || 0)} used this month.`;
18
+ // Free has nothing granted (Writing Voice is paid only): same idea as the portal card, not '0 of 0 left'.
19
+ if (usage.tier === 'free' && !(Number(usage.granted) + Number(usage.adjust || 0) > 0)) return 'Empirical Tokens: building a writing voice is part of the paid plans.';
20
+ const reset = resetLabel(usage.resetsAt);
21
+ return `Empirical Tokens: ${fmt(usage.remaining)} of ${fmt(usage.granted + usage.adjust)} left this month.${reset ? ` Resets ${reset}.` : ''}`;
22
+ }
23
+
24
+ async function fetchBillingMe(timeoutMs = 0) {
25
+ const token = requireAccessToken();
26
+ const url = new URL('/api/v1/billing/me', resolveApiBaseUrl()).toString();
27
+ const response = await httpJson(url, 'GET', null, buildApiAuthHeaders(token), timeoutMs);
28
+ return response && response.data ? response.data : response;
29
+ }
30
+
31
+ async function runUsageCommand(args) {
32
+ let data;
33
+ try {
34
+ data = await fetchBillingMe();
35
+ } catch (error) {
36
+ printApiError(error);
37
+ process.exit(1);
38
+ }
39
+ if (args.includes('--json')) {
40
+ log(JSON.stringify({ memoryUsage: data.memoryUsage, blueprintUsage: data.blueprintUsage, empiricalTokenUsage: data.empiricalTokenUsage && data.empiricalTokenUsage.mode === 'enforce' ? data.empiricalTokenUsage : null }, null, 2));
41
+ return;
42
+ }
43
+ const memory = data.memoryUsage || {};
44
+ log(memory.unlimited ? `Memory: ${fmt(memory.used)} used (no plan cap).` : `Memory: ${fmt(memory.used)} of ${fmt(memory.limit)} used.`);
45
+ const installs = data.blueprintUsage || {};
46
+ const across = typeof installs.accountUsed === 'number' ? ` (${fmt(installs.accountUsed)} across all workspaces)` : '';
47
+ log(installs.unlimited ? `Blueprint installs this month: ${fmt(installs.used)}${across}.` : `Blueprint installs this month: ${fmt(installs.used)} of ${fmt(installs.limit)}${across}.`);
48
+ const line = empiricalTokensLine(data.empiricalTokenUsage);
49
+ if (line) log(line);
50
+ }
51
+
52
+ module.exports = { runUsageCommand, empiricalTokensLine, fetchBillingMe };
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
- {
2
- "name": "@empirical-gauzza/cli",
3
- "version": "1.0.36",
4
- "description": "Persistent cross-tool memory for AI agents. Give Claude Code, Codex, Copilot, Cursor, and ChatGPT one shared memory: save project context once, recall it everywhere via CLI or MCP.",
5
- "keywords": [
6
- "memory",
7
- "mcp",
8
- "agent memory",
9
- "ai memory",
10
- "claude",
11
- "chatgpt",
12
- "model context protocol",
13
- "persistent memory",
14
- "claude-code",
15
- "codex",
16
- "knowledge base"
17
- ],
18
- "type": "commonjs",
19
- "license": "MIT",
20
- "homepage": "https://empirical.gauzza.com/docs/cli-details",
21
- "publishConfig": {
22
- "access": "public"
23
- },
24
- "bin": {
25
- "empirical": "bin/empirical.js"
26
- },
27
- "engines": {
28
- "node": ">=18.0.0"
29
- },
30
- "dependencies": {
31
- "gray-matter": "^4.0.3"
32
- }
33
- }
1
+ {
2
+ "name": "@empirical-gauzza/cli",
3
+ "version": "1.0.37",
4
+ "description": "Persistent cross-tool memory for AI agents. Give Claude Code, Codex, Copilot, Cursor, and ChatGPT one shared memory: save project context once, recall it everywhere via CLI or MCP.",
5
+ "keywords": [
6
+ "memory",
7
+ "mcp",
8
+ "agent memory",
9
+ "ai memory",
10
+ "claude",
11
+ "chatgpt",
12
+ "model context protocol",
13
+ "persistent memory",
14
+ "claude-code",
15
+ "codex",
16
+ "knowledge base"
17
+ ],
18
+ "type": "commonjs",
19
+ "license": "MIT",
20
+ "homepage": "https://empirical.gauzza.com/docs/cli-details",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "bin": {
25
+ "empirical": "bin/empirical.js"
26
+ },
27
+ "engines": {
28
+ "node": ">=18.0.0"
29
+ },
30
+ "dependencies": {
31
+ "gray-matter": "^4.0.3"
32
+ }
33
+ }