@supatest/cli 0.0.31 → 0.0.32

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/dist/index.js +52 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5522,7 +5522,7 @@ var CLI_VERSION;
5522
5522
  var init_version = __esm({
5523
5523
  "src/version.ts"() {
5524
5524
  "use strict";
5525
- CLI_VERSION = "0.0.31";
5525
+ CLI_VERSION = "0.0.32";
5526
5526
  }
5527
5527
  });
5528
5528
 
@@ -8372,21 +8372,21 @@ var init_encryption = __esm({
8372
8372
  });
8373
8373
 
8374
8374
  // src/utils/token-storage.ts
8375
- import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync4, unlinkSync as unlinkSync2, writeFileSync } from "fs";
8376
- import { homedir as homedir4 } from "os";
8377
- import { join as join7 } from "path";
8375
+ import { existsSync as existsSync6, mkdirSync as mkdirSync2, readFileSync as readFileSync5, unlinkSync as unlinkSync2, writeFileSync } from "fs";
8376
+ import { homedir as homedir5 } from "os";
8377
+ import { join as join8 } from "path";
8378
8378
  function getTokenFilePath() {
8379
8379
  const apiUrl = process.env.SUPATEST_API_URL || PRODUCTION_API_URL;
8380
8380
  if (apiUrl === PRODUCTION_API_URL) {
8381
- return join7(CONFIG_DIR, "token.json");
8381
+ return join8(CONFIG_DIR, "token.json");
8382
8382
  }
8383
- return join7(CONFIG_DIR, "token.local.json");
8383
+ return join8(CONFIG_DIR, "token.local.json");
8384
8384
  }
8385
8385
  function isV2Format(stored) {
8386
8386
  return "version" in stored && stored.version === 2;
8387
8387
  }
8388
8388
  function ensureConfigDir() {
8389
- if (!existsSync5(CONFIG_DIR)) {
8389
+ if (!existsSync6(CONFIG_DIR)) {
8390
8390
  mkdirSync2(CONFIG_DIR, { recursive: true, mode: 448 });
8391
8391
  }
8392
8392
  }
@@ -8406,11 +8406,11 @@ function saveToken(token, expiresAt) {
8406
8406
  }
8407
8407
  function loadToken() {
8408
8408
  const tokenFile = getTokenFilePath();
8409
- if (!existsSync5(tokenFile)) {
8409
+ if (!existsSync6(tokenFile)) {
8410
8410
  return null;
8411
8411
  }
8412
8412
  try {
8413
- const data = readFileSync4(tokenFile, "utf8");
8413
+ const data = readFileSync5(tokenFile, "utf8");
8414
8414
  const stored = JSON.parse(data);
8415
8415
  let payload;
8416
8416
  if (isV2Format(stored)) {
@@ -8439,7 +8439,7 @@ function loadToken() {
8439
8439
  }
8440
8440
  function removeToken() {
8441
8441
  const tokenFile = getTokenFilePath();
8442
- if (existsSync5(tokenFile)) {
8442
+ if (existsSync6(tokenFile)) {
8443
8443
  unlinkSync2(tokenFile);
8444
8444
  }
8445
8445
  }
@@ -8448,10 +8448,10 @@ var init_token_storage = __esm({
8448
8448
  "src/utils/token-storage.ts"() {
8449
8449
  "use strict";
8450
8450
  init_encryption();
8451
- CONFIG_DIR = join7(homedir4(), ".supatest");
8451
+ CONFIG_DIR = join8(homedir5(), ".supatest");
8452
8452
  PRODUCTION_API_URL = "https://code-api.supatest.ai";
8453
8453
  STORAGE_VERSION = 2;
8454
- TOKEN_FILE = join7(CONFIG_DIR, "token.json");
8454
+ TOKEN_FILE = join8(CONFIG_DIR, "token.json");
8455
8455
  }
8456
8456
  });
8457
8457
 
@@ -10999,7 +10999,7 @@ var init_useOverlayEscapeGuard = __esm({
10999
10999
 
11000
11000
  // src/ui/App.tsx
11001
11001
  import { execSync as execSync6 } from "child_process";
11002
- import { homedir as homedir5 } from "os";
11002
+ import { homedir as homedir6 } from "os";
11003
11003
  import { Box as Box23, Text as Text21, useApp as useApp2, useStdout as useStdout2 } from "ink";
11004
11004
  import Spinner3 from "ink-spinner";
11005
11005
  import React26, { useEffect as useEffect13, useRef as useRef4, useState as useState13 } from "react";
@@ -11039,7 +11039,7 @@ var init_App = __esm({
11039
11039
  };
11040
11040
  getCurrentFolder2 = (configCwd) => {
11041
11041
  const cwd = configCwd || process.cwd();
11042
- const home = homedir5();
11042
+ const home = homedir6();
11043
11043
  if (cwd.startsWith(home)) {
11044
11044
  return `~${cwd.slice(home.length)}`;
11045
11045
  }
@@ -12411,26 +12411,60 @@ init_banner();
12411
12411
  // src/utils/claude-max.ts
12412
12412
  init_logger();
12413
12413
  import { execSync as execSync4 } from "child_process";
12414
+ import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
12415
+ import { homedir as homedir4 } from "os";
12416
+ import { join as join7 } from "path";
12414
12417
  function isClaudeMaxAvailable() {
12415
- logger.debug("[claude-max] Checking if Claude Code credentials exist in keychain");
12418
+ const platform2 = process.platform;
12419
+ logger.debug("[claude-max] Checking Claude Code credentials", { platform: platform2 });
12420
+ if (platform2 === "darwin") {
12421
+ return checkMacOSKeychain();
12422
+ } else {
12423
+ return checkCredentialsFile();
12424
+ }
12425
+ }
12426
+ function checkMacOSKeychain() {
12416
12427
  try {
12417
12428
  const credentialsJson = execSync4(
12418
12429
  'security find-generic-password -s "Claude Code-credentials" -w 2>/dev/null',
12419
12430
  { encoding: "utf-8" }
12420
12431
  ).trim();
12421
12432
  if (!credentialsJson) {
12422
- logger.debug("[claude-max] No credentials found in keychain");
12433
+ logger.debug("[claude-max] No credentials found in macOS keychain");
12434
+ return false;
12435
+ }
12436
+ const credentials = JSON.parse(credentialsJson);
12437
+ const hasOauth = !!credentials.claudeAiOauth?.accessToken;
12438
+ logger.debug("[claude-max] macOS keychain credentials check", {
12439
+ hasOauth,
12440
+ hasRefreshToken: !!credentials.claudeAiOauth?.refreshToken
12441
+ });
12442
+ return hasOauth;
12443
+ } catch (error) {
12444
+ logger.debug("[claude-max] Error checking macOS keychain", {
12445
+ error: error instanceof Error ? error.message : String(error)
12446
+ });
12447
+ return false;
12448
+ }
12449
+ }
12450
+ function checkCredentialsFile() {
12451
+ try {
12452
+ const credentialsPath = join7(homedir4(), ".claude", ".credentials.json");
12453
+ if (!existsSync5(credentialsPath)) {
12454
+ logger.debug("[claude-max] Credentials file not found", { path: credentialsPath });
12423
12455
  return false;
12424
12456
  }
12457
+ const credentialsJson = readFileSync4(credentialsPath, "utf-8");
12425
12458
  const credentials = JSON.parse(credentialsJson);
12426
12459
  const hasOauth = !!credentials.claudeAiOauth?.accessToken;
12427
- logger.debug("[claude-max] Credentials check", {
12460
+ logger.debug("[claude-max] Credentials file check", {
12461
+ path: credentialsPath,
12428
12462
  hasOauth,
12429
12463
  hasRefreshToken: !!credentials.claudeAiOauth?.refreshToken
12430
12464
  });
12431
12465
  return hasOauth;
12432
12466
  } catch (error) {
12433
- logger.debug("[claude-max] Error checking keychain", {
12467
+ logger.debug("[claude-max] Error checking credentials file", {
12434
12468
  error: error instanceof Error ? error.message : String(error)
12435
12469
  });
12436
12470
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supatest/cli",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "description": "Supatest CLI - AI-powered task automation for CI/CD",
5
5
  "type": "module",
6
6
  "bin": {