@supatest/cli 0.0.60 → 0.0.61

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 +17 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,7 +20,8 @@ var init_config = __esm({
20
20
  const envFile = process.env.ENV_NAME ? `.env.${process.env.ENV_NAME}` : ".env";
21
21
  try {
22
22
  const dotenv = await import("dotenv");
23
- dotenv.config({ path: resolve(process.cwd(), envFile) });
23
+ const cliDir = new URL(".", import.meta.url).pathname;
24
+ dotenv.config({ path: resolve(cliDir, "..", envFile) });
24
25
  } catch (error) {
25
26
  }
26
27
  }
@@ -5887,7 +5888,7 @@ var CLI_VERSION;
5887
5888
  var init_version = __esm({
5888
5889
  "src/version.ts"() {
5889
5890
  "use strict";
5890
- CLI_VERSION = "0.0.60";
5891
+ CLI_VERSION = "0.0.61";
5891
5892
  }
5892
5893
  });
5893
5894
 
@@ -10759,6 +10760,12 @@ import { spawn as spawn3 } from "child_process";
10759
10760
  import crypto3 from "crypto";
10760
10761
  import http from "http";
10761
10762
  import { platform } from "os";
10763
+ function getFrontendUrl() {
10764
+ return process.env.SUPATEST_FRONTEND_URL || "https://code.supatest.ai";
10765
+ }
10766
+ function getApiUrl() {
10767
+ return process.env.SUPATEST_API_URL || "https://code-api.supatest.ai";
10768
+ }
10762
10769
  function escapeHtml(text) {
10763
10770
  return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
10764
10771
  }
@@ -10766,7 +10773,7 @@ function generateState() {
10766
10773
  return crypto3.randomBytes(STATE_LENGTH).toString("hex");
10767
10774
  }
10768
10775
  async function exchangeCodeForToken(code, state) {
10769
- const response = await fetch(`${API_URL}/web/auth/cli-token-exchange`, {
10776
+ const response = await fetch(`${getApiUrl()}/web/auth/cli-token-exchange`, {
10770
10777
  method: "POST",
10771
10778
  headers: { "Content-Type": "application/json" },
10772
10779
  body: JSON.stringify({ code, state })
@@ -10976,7 +10983,7 @@ function buildResultPage(config2) {
10976
10983
  <body>
10977
10984
  <div class="container">
10978
10985
  <div class="logo">
10979
- <img src="${FRONTEND_URL}/logo.png" alt="Supatest Logo" />
10986
+ <img src="${getFrontendUrl()}/logo.png" alt="Supatest Logo" />
10980
10987
  <span class="logo-text">Supatest</span>
10981
10988
  </div>
10982
10989
  <div class="${iconClass}" role="img" aria-label="${iconAriaLabel}">${iconEmoji}</div>
@@ -11047,7 +11054,7 @@ async function loginCommand() {
11047
11054
  `);
11048
11055
  throw error;
11049
11056
  }
11050
- const loginUrl = `${FRONTEND_URL}/cli-login?port=${port}&state=${state}`;
11057
+ const loginUrl = `${getFrontendUrl()}/cli-login?port=${port}&state=${state}`;
11051
11058
  console.log(`Opening browser to: ${loginUrl}`);
11052
11059
  console.log("\nIf your browser doesn't open automatically, please visit the URL above.\n");
11053
11060
  try {
@@ -11085,13 +11092,11 @@ ${loginUrl}
11085
11092
  throw error;
11086
11093
  }
11087
11094
  }
11088
- var LOGIN_RETRY_PORTS, FRONTEND_URL, API_URL, CALLBACK_TIMEOUT_MS, STATE_LENGTH;
11095
+ var LOGIN_RETRY_PORTS, CALLBACK_TIMEOUT_MS, STATE_LENGTH;
11089
11096
  var init_login = __esm({
11090
11097
  "src/commands/login.ts"() {
11091
11098
  "use strict";
11092
11099
  LOGIN_RETRY_PORTS = [8420, 8422, 8423];
11093
- FRONTEND_URL = process.env.SUPATEST_FRONTEND_URL || "https://code.supatest.ai";
11094
- API_URL = process.env.SUPATEST_API_URL || "https://code-api.supatest.ai";
11095
11100
  CALLBACK_TIMEOUT_MS = 3e5;
11096
11101
  STATE_LENGTH = 32;
11097
11102
  }
@@ -13665,7 +13670,7 @@ var init_markdown_builder = __esm({
13665
13670
  });
13666
13671
 
13667
13672
  // src/fix/context-builder.ts
13668
- function getFrontendUrl() {
13673
+ function getFrontendUrl2() {
13669
13674
  return process.env.SUPATEST_FRONTEND_URL || "https://app.supatest.dev";
13670
13675
  }
13671
13676
  function buildQuickFixPrompt(testCount, contextFilePath) {
@@ -13675,7 +13680,7 @@ function buildQuickFixPrompt(testCount, contextFilePath) {
13675
13680
  Error context: ${contextFilePath}`;
13676
13681
  }
13677
13682
  function buildUnderstandAndFixPrompt(failedCount, run, contextFilePath) {
13678
- const frontendUrl = getFrontendUrl();
13683
+ const frontendUrl = getFrontendUrl2();
13679
13684
  const runDetailUrl = `${frontendUrl}/runs/${run.id}`;
13680
13685
  const md = new MarkdownBuilder();
13681
13686
  const failureWord = failedCount === 1 ? "failure" : "failures";
@@ -13719,7 +13724,7 @@ function getAutomateContextPath(cwd, timestamp) {
13719
13724
  return join12(getAutomateContextDir(cwd), `manual-tests-${timestamp}.md`);
13720
13725
  }
13721
13726
  function formatTestForContextFile(test, index) {
13722
- const frontendUrl = getFrontendUrl();
13727
+ const frontendUrl = getFrontendUrl2();
13723
13728
  const md = new MarkdownBuilder();
13724
13729
  md.push(`### Test ${index + 1}: ${test.readableId} \u2014 ${test.title}`);
13725
13730
  if (test.priority) md.push(`- **Priority**: ${test.priority}`);
@@ -14668,7 +14673,7 @@ function formatTestForContextFile2(ctx, index, runId, frontendUrl, assignment) {
14668
14673
  return md.build();
14669
14674
  }
14670
14675
  function buildContextFileContent(tests, run, assignments) {
14671
- const frontendUrl = getFrontendUrl();
14676
+ const frontendUrl = getFrontendUrl2();
14672
14677
  const runDetailUrl = `${frontendUrl}/runs/${run.id}`;
14673
14678
  const md = new MarkdownBuilder();
14674
14679
  md.heading(1, `Fix Context: Run ${run.readableId || run.id}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supatest/cli",
3
- "version": "0.0.60",
3
+ "version": "0.0.61",
4
4
  "description": "Supatest CLI - AI-powered task automation for CI/CD",
5
5
  "type": "module",
6
6
  "bin": {