codex-team 0.0.7 → 0.0.8

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
@@ -24,8 +24,6 @@ codexm switch <name>
24
24
  codexm switch --auto --dry-run
25
25
  codexm remove <name> --yes
26
26
  codexm rename <old> <new>
27
- codexm quota refresh [name]
28
- codexm doctor
29
27
  ```
30
28
 
31
29
  Use `--json` on query and mutation commands when you need machine-readable output.
@@ -36,7 +34,7 @@ Use `--json` on query and mutation commands when you need machine-readable outpu
36
34
  2. Save the current auth snapshot with `codexm save <name>`.
37
35
  3. Repeat for other accounts.
38
36
  4. Switch between saved accounts with `codexm switch <name>` or let the tool choose with `codexm switch --auto`.
39
- 5. Refresh and inspect quota usage with `codexm list` or `codexm quota refresh`.
37
+ 5. Refresh and inspect quota usage with `codexm list`.
40
38
 
41
39
  ## Development
42
40
 
package/dist/cli.cjs CHANGED
@@ -13,7 +13,7 @@ var __webpack_modules__ = {
13
13
  const utc_js_namespaceObject = require("dayjs/plugin/utc.js");
14
14
  var utc_js_default = /*#__PURE__*/ __webpack_require__.n(utc_js_namespaceObject);
15
15
  var package_namespaceObject = {
16
- rE: "0.0.7"
16
+ rE: "0.0.8"
17
17
  };
18
18
  const external_node_crypto_namespaceObject = require("node:crypto");
19
19
  const promises_namespaceObject = require("node:fs/promises");
@@ -714,9 +714,16 @@ var __webpack_modules__ = {
714
714
  const authPath = this.accountAuthPath(name);
715
715
  const metaPath = this.accountMetaPath(name);
716
716
  const configPath = this.accountConfigPath(name);
717
+ const identity = getSnapshotIdentity(snapshot);
717
718
  const accountExists = await pathExists(accountDir);
718
719
  const existingMeta = accountExists && await pathExists(metaPath) ? parseSnapshotMeta(await readJsonFile(metaPath)) : void 0;
719
720
  if (accountExists && !force) throw new Error(`Account "${name}" already exists. Use --force to overwrite it.`);
721
+ const { accounts } = await this.listAccounts();
722
+ const duplicateIdentityAccounts = accounts.filter((account)=>account.name !== name && account.account_id === identity);
723
+ if (duplicateIdentityAccounts.length > 0) {
724
+ const joinedNames = duplicateIdentityAccounts.map((account)=>`"${account.name}"`).join(", ");
725
+ throw new Error(`Identity ${identity} is already managed by ${joinedNames}.`);
726
+ }
720
727
  this.validateConfigSnapshot(name, snapshot, rawConfig);
721
728
  await ensureDirectory(accountDir, DIRECTORY_MODE);
722
729
  await atomicWriteFile(authPath, `${rawSnapshot.trimEnd()}\n`);
@@ -1012,12 +1019,10 @@ Usage:
1012
1019
  codexm list [name] [--json]
1013
1020
  codexm save <name> [--force] [--json]
1014
1021
  codexm update [--json]
1015
- codexm quota refresh [name] [--json]
1016
1022
  codexm switch <name> [--json]
1017
1023
  codexm switch --auto [--dry-run] [--json]
1018
1024
  codexm remove <name> [--yes] [--json]
1019
1025
  codexm rename <old> <new> [--json]
1020
- codexm doctor [--json]
1021
1026
 
1022
1027
  Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1023
1028
  `);
@@ -1035,16 +1040,6 @@ Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1035
1040
  for (const warning of status.warnings)lines.push(`Warning: ${warning}`);
1036
1041
  return lines.join("\n");
1037
1042
  }
1038
- function describeDoctor(report) {
1039
- const lines = [
1040
- report.healthy ? "Doctor checks passed." : "Doctor checks found issues.",
1041
- `Saved accounts: ${report.account_count}`,
1042
- `Current auth present: ${report.current_auth_present ? "yes" : "no"}`
1043
- ];
1044
- for (const issue of report.issues)lines.push(`Issue: ${issue}`);
1045
- for (const warning of report.warnings)lines.push(`Warning: ${warning}`);
1046
- return lines.join("\n");
1047
- }
1048
1043
  function formatUsagePercent(window) {
1049
1044
  if (!window) return "-";
1050
1045
  return `${window.used_percent}%`;
@@ -1308,18 +1303,6 @@ Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1308
1303
  }
1309
1304
  return 0;
1310
1305
  }
1311
- case "quota":
1312
- {
1313
- const quotaCommand = parsed.positionals[0];
1314
- if ("refresh" === quotaCommand) {
1315
- const targetName = parsed.positionals[1];
1316
- const result = await store.refreshAllQuotas(targetName);
1317
- if (json) writeJson(streams.stdout, toCliQuotaRefreshResult(result));
1318
- else streams.stdout.write(`${describeQuotaRefresh(result)}\n`);
1319
- return 0 === result.failures.length ? 0 : 1;
1320
- }
1321
- throw new Error("Usage: codexm quota refresh [name] [--json]");
1322
- }
1323
1306
  case "switch":
1324
1307
  {
1325
1308
  const auto = parsed.flags.has("--auto");
@@ -1463,13 +1446,6 @@ Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1463
1446
  else streams.stdout.write(`Renamed "${oldName}" to "${newName}".\n`);
1464
1447
  return 0;
1465
1448
  }
1466
- case "doctor":
1467
- {
1468
- const report = await store.doctor();
1469
- if (json) writeJson(streams.stdout, report);
1470
- else streams.stdout.write(`${describeDoctor(report)}\n`);
1471
- return report.healthy ? 0 : 1;
1472
- }
1473
1449
  default:
1474
1450
  throw new Error(`Unknown command "${parsed.command}".`);
1475
1451
  }
package/dist/main.cjs CHANGED
@@ -43,7 +43,7 @@ var timezone_js_default = /*#__PURE__*/ __webpack_require__.n(timezone_js_namesp
43
43
  const utc_js_namespaceObject = require("dayjs/plugin/utc.js");
44
44
  var utc_js_default = /*#__PURE__*/ __webpack_require__.n(utc_js_namespaceObject);
45
45
  var package_namespaceObject = {
46
- rE: "0.0.7"
46
+ rE: "0.0.8"
47
47
  };
48
48
  const external_node_crypto_namespaceObject = require("node:crypto");
49
49
  const promises_namespaceObject = require("node:fs/promises");
@@ -744,9 +744,16 @@ class AccountStore {
744
744
  const authPath = this.accountAuthPath(name);
745
745
  const metaPath = this.accountMetaPath(name);
746
746
  const configPath = this.accountConfigPath(name);
747
+ const identity = getSnapshotIdentity(snapshot);
747
748
  const accountExists = await pathExists(accountDir);
748
749
  const existingMeta = accountExists && await pathExists(metaPath) ? parseSnapshotMeta(await readJsonFile(metaPath)) : void 0;
749
750
  if (accountExists && !force) throw new Error(`Account "${name}" already exists. Use --force to overwrite it.`);
751
+ const { accounts } = await this.listAccounts();
752
+ const duplicateIdentityAccounts = accounts.filter((account)=>account.name !== name && account.account_id === identity);
753
+ if (duplicateIdentityAccounts.length > 0) {
754
+ const joinedNames = duplicateIdentityAccounts.map((account)=>`"${account.name}"`).join(", ");
755
+ throw new Error(`Identity ${identity} is already managed by ${joinedNames}.`);
756
+ }
750
757
  this.validateConfigSnapshot(name, snapshot, rawConfig);
751
758
  await ensureDirectory(accountDir, DIRECTORY_MODE);
752
759
  await atomicWriteFile(authPath, `${rawSnapshot.trimEnd()}\n`);
@@ -1042,12 +1049,10 @@ Usage:
1042
1049
  codexm list [name] [--json]
1043
1050
  codexm save <name> [--force] [--json]
1044
1051
  codexm update [--json]
1045
- codexm quota refresh [name] [--json]
1046
1052
  codexm switch <name> [--json]
1047
1053
  codexm switch --auto [--dry-run] [--json]
1048
1054
  codexm remove <name> [--yes] [--json]
1049
1055
  codexm rename <old> <new> [--json]
1050
- codexm doctor [--json]
1051
1056
 
1052
1057
  Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1053
1058
  `);
@@ -1065,16 +1070,6 @@ function describeCurrentStatus(status) {
1065
1070
  for (const warning of status.warnings)lines.push(`Warning: ${warning}`);
1066
1071
  return lines.join("\n");
1067
1072
  }
1068
- function describeDoctor(report) {
1069
- const lines = [
1070
- report.healthy ? "Doctor checks passed." : "Doctor checks found issues.",
1071
- `Saved accounts: ${report.account_count}`,
1072
- `Current auth present: ${report.current_auth_present ? "yes" : "no"}`
1073
- ];
1074
- for (const issue of report.issues)lines.push(`Issue: ${issue}`);
1075
- for (const warning of report.warnings)lines.push(`Warning: ${warning}`);
1076
- return lines.join("\n");
1077
- }
1078
1073
  function formatUsagePercent(window) {
1079
1074
  if (!window) return "-";
1080
1075
  return `${window.used_percent}%`;
@@ -1338,18 +1333,6 @@ async function runCli(argv, options = {}) {
1338
1333
  }
1339
1334
  return 0;
1340
1335
  }
1341
- case "quota":
1342
- {
1343
- const quotaCommand = parsed.positionals[0];
1344
- if ("refresh" === quotaCommand) {
1345
- const targetName = parsed.positionals[1];
1346
- const result = await store.refreshAllQuotas(targetName);
1347
- if (json) writeJson(streams.stdout, toCliQuotaRefreshResult(result));
1348
- else streams.stdout.write(`${describeQuotaRefresh(result)}\n`);
1349
- return 0 === result.failures.length ? 0 : 1;
1350
- }
1351
- throw new Error("Usage: codexm quota refresh [name] [--json]");
1352
- }
1353
1336
  case "switch":
1354
1337
  {
1355
1338
  const auto = parsed.flags.has("--auto");
@@ -1493,13 +1476,6 @@ async function runCli(argv, options = {}) {
1493
1476
  else streams.stdout.write(`Renamed "${oldName}" to "${newName}".\n`);
1494
1477
  return 0;
1495
1478
  }
1496
- case "doctor":
1497
- {
1498
- const report = await store.doctor();
1499
- if (json) writeJson(streams.stdout, report);
1500
- else streams.stdout.write(`${describeDoctor(report)}\n`);
1501
- return report.healthy ? 0 : 1;
1502
- }
1503
1479
  default:
1504
1480
  throw new Error(`Unknown command "${parsed.command}".`);
1505
1481
  }
package/dist/main.js CHANGED
@@ -9,7 +9,7 @@ import { basename, dirname, join } from "node:path";
9
9
  import { execFile } from "node:child_process";
10
10
  import { promisify } from "node:util";
11
11
  var package_namespaceObject = {
12
- rE: "0.0.7"
12
+ rE: "0.0.8"
13
13
  };
14
14
  function isRecord(value) {
15
15
  return "object" == typeof value && null !== value && !Array.isArray(value);
@@ -704,9 +704,16 @@ class AccountStore {
704
704
  const authPath = this.accountAuthPath(name);
705
705
  const metaPath = this.accountMetaPath(name);
706
706
  const configPath = this.accountConfigPath(name);
707
+ const identity = getSnapshotIdentity(snapshot);
707
708
  const accountExists = await pathExists(accountDir);
708
709
  const existingMeta = accountExists && await pathExists(metaPath) ? parseSnapshotMeta(await readJsonFile(metaPath)) : void 0;
709
710
  if (accountExists && !force) throw new Error(`Account "${name}" already exists. Use --force to overwrite it.`);
711
+ const { accounts } = await this.listAccounts();
712
+ const duplicateIdentityAccounts = accounts.filter((account)=>account.name !== name && account.account_id === identity);
713
+ if (duplicateIdentityAccounts.length > 0) {
714
+ const joinedNames = duplicateIdentityAccounts.map((account)=>`"${account.name}"`).join(", ");
715
+ throw new Error(`Identity ${identity} is already managed by ${joinedNames}.`);
716
+ }
710
717
  this.validateConfigSnapshot(name, snapshot, rawConfig);
711
718
  await ensureDirectory(accountDir, DIRECTORY_MODE);
712
719
  await atomicWriteFile(authPath, `${rawSnapshot.trimEnd()}\n`);
@@ -1002,12 +1009,10 @@ Usage:
1002
1009
  codexm list [name] [--json]
1003
1010
  codexm save <name> [--force] [--json]
1004
1011
  codexm update [--json]
1005
- codexm quota refresh [name] [--json]
1006
1012
  codexm switch <name> [--json]
1007
1013
  codexm switch --auto [--dry-run] [--json]
1008
1014
  codexm remove <name> [--yes] [--json]
1009
1015
  codexm rename <old> <new> [--json]
1010
- codexm doctor [--json]
1011
1016
 
1012
1017
  Account names must match /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/.
1013
1018
  `);
@@ -1025,16 +1030,6 @@ function describeCurrentStatus(status) {
1025
1030
  for (const warning of status.warnings)lines.push(`Warning: ${warning}`);
1026
1031
  return lines.join("\n");
1027
1032
  }
1028
- function describeDoctor(report) {
1029
- const lines = [
1030
- report.healthy ? "Doctor checks passed." : "Doctor checks found issues.",
1031
- `Saved accounts: ${report.account_count}`,
1032
- `Current auth present: ${report.current_auth_present ? "yes" : "no"}`
1033
- ];
1034
- for (const issue of report.issues)lines.push(`Issue: ${issue}`);
1035
- for (const warning of report.warnings)lines.push(`Warning: ${warning}`);
1036
- return lines.join("\n");
1037
- }
1038
1033
  function formatUsagePercent(window) {
1039
1034
  if (!window) return "-";
1040
1035
  return `${window.used_percent}%`;
@@ -1298,18 +1293,6 @@ async function runCli(argv, options = {}) {
1298
1293
  }
1299
1294
  return 0;
1300
1295
  }
1301
- case "quota":
1302
- {
1303
- const quotaCommand = parsed.positionals[0];
1304
- if ("refresh" === quotaCommand) {
1305
- const targetName = parsed.positionals[1];
1306
- const result = await store.refreshAllQuotas(targetName);
1307
- if (json) writeJson(streams.stdout, toCliQuotaRefreshResult(result));
1308
- else streams.stdout.write(`${describeQuotaRefresh(result)}\n`);
1309
- return 0 === result.failures.length ? 0 : 1;
1310
- }
1311
- throw new Error("Usage: codexm quota refresh [name] [--json]");
1312
- }
1313
1296
  case "switch":
1314
1297
  {
1315
1298
  const auto = parsed.flags.has("--auto");
@@ -1453,13 +1436,6 @@ async function runCli(argv, options = {}) {
1453
1436
  else streams.stdout.write(`Renamed "${oldName}" to "${newName}".\n`);
1454
1437
  return 0;
1455
1438
  }
1456
- case "doctor":
1457
- {
1458
- const report = await store.doctor();
1459
- if (json) writeJson(streams.stdout, report);
1460
- else streams.stdout.write(`${describeDoctor(report)}\n`);
1461
- return report.healthy ? 0 : 1;
1462
- }
1463
1439
  default:
1464
1440
  throw new Error(`Unknown command "${parsed.command}".`);
1465
1441
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-team",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "Manage multiple Codex ChatGPT auth snapshots and quota usage from the command line.",
5
5
  "license": "MIT",
6
6
  "type": "module",