@supatest/cli 0.0.57 → 0.0.59

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 +74 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -359,7 +359,7 @@ function getToolGroupCounts(tools) {
359
359
  );
360
360
  return Object.entries(groups).map(([name, count]) => ({ name, count })).sort((a, b) => b.count - a.count);
361
361
  }
362
- var AVAILABLE_MODELS, DATE_SUFFIX_REGEX, SMALL_COST_MULTIPLIER, MEDIUM_COST_MULTIPLIER, PREMIUM_COST_MULTIPLIER, SMALL_COST_LABEL, MEDIUM_COST_LABEL, PREMIUM_COST_LABEL, MODEL_TIERS, CONTEXT_WINDOWS, util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, ZodBranded, ZodPipeline, ZodReadonly, ZodFirstPartyTypeKind, stringType, numberType, booleanType, dateType, unknownType, arrayType, objectType, unionType, discriminatedUnionType, recordType, functionType, lazyType, literalType, enumType, promiseType, coerce, MAX_API_KEY_NAME_LENGTH, apiKeySchema, apiKeyUsageSchema, createApiKeyRequestSchema, apiKeyResponseSchema, apiKeyUsageSummarySchema, genericErrorSchema, validationErrorSchema, feedbackCategorySchema, FEEDBACK_CATEGORIES, createFeedbackSchema, feedbackResponseSchema, listFeedbackQuerySchema, feedbackListResponseSchema, gitHubRepositorySchema, gitHubInstallationSchema, gitHubInstallUrlResponseSchema, gitHubClaimInstallationRequestSchema, gitHubReposResponseSchema, healthMetricSchema, healthMetricDailyItemSchema, healthMetricsWithDailySchema, healthAnalyticsPeriodSchema, healthAnalyticsDailyItemSchema, healthAnalyticsResponseSchema, manualTestCasePrioritySchema, manualTestCaseItemSchema, createManualTestCaseItemSchema, updateManualTestCaseItemSchema, listManualTestCaseItemsQuerySchema, manualTestCaseItemListResponseSchema, manualTestFolderSchema, manualTestFolderContentsSchema, createManualTestFolderSchema, updateManualTestFolderSchema, MAX_TIMEZONE_CHAR_LENGTH, organizationSchema, organizationSettingsSchema, adminOrganizationSchema, adminOrganizationListSchema, updateAdminOrganizationRequestSchema, sandboxProviderSchema, sessionTypeSchema, sessionStatusSchema, provisioningStepSchema, createWebSessionSchema, createWebSessionResponseSchema, wsServerMessageSchema, wsClientMessageSchema, gitStatusResponseSchema, gitCommitRequestSchema, gitCommitResponseSchema, gitPushResponseSchema, createPRRequestSchema, createPRResponseSchema, gitDiffResponseSchema, webSessionResponseSchema, snapshotStateSchema, toolPresetsSchema, projectRepoSchema, createProjectMachineSchema, updateProjectMachineSchema, envVarEntrySchema, createEnvFileSchema, putEnvFileVarsSchema, projectMachineResponseSchema, machineSnapshotResponseSchema, envFileResponseSchema, textBlockSchema, toolUseBlockSchema, toolResultBlockSchema, thinkingBlockSchema, imageBlockSchema, contentBlockSchema, sessionSchema, createSessionRequestSchema, updateSessionRequestSchema, messageSchema, createMessageRequestSchema, cliEventSchema, createCLISessionRequestSchema, queryResultSchema, queryTurnSchema, queryContentSchema, queryUsageSchema, querySchema, runStatusSchema, testResultStatusSchema, testOutcomeSchema, attachmentKindSchema, stepCategorySchema, runSummarySchema, ciMetadataSchema, gitMetadataSchema, playwrightConfigSchema, errorInfoSchema, locationSchema, sourceSnippetSchema, runSourceSchema, runSchema, annotationSchema, testSchema, testResultSchema, baseStepSchema, stepSchema, attachmentSchema, listRunsQuerySchema, listTestsQuerySchema, runsListResponseSchema, runDetailResponseSchema, coverageTestItemSchema, secondaryTagMetricSchema, tagCoverageSchema, coverageStatsSchema, coverageAlertSchema, coverageDashboardResponseSchema, coverageDashboardQuerySchema, testsListResponseSchema, testDetailResponseSchema, testHistoryItemSchema, testHistoryResponseSchema, visualComparisonScreenshotSchema, visualComparisonRunSchema, visualComparisonMatchedStepSchema, visualComparisonResponseSchema, topOffenderSchema, topOffendersResponseSchema, trendPointSchema, trendsResponseSchema, errorCategorySchema, failureClusterSchema, newFailureSchema, runInsightsResponseSchema, FailureCategoryEnum, SelectorTypeEnum, FailureCategoryStatsSchema, FailureCategoriesResponseSchema, FailingSelectorStatsSchema, FailingSelectorsResponseSchema, newFailureItemSchema, newFailuresResponseSchema, flakyTestItemSchema, flakyTestsResponseSchema, slowestTestItemSchema, slowestTestsResponseSchema, runSummaryEmailFailureSchema, runSummaryEmailReportSchema, sendRunReportRequestSchema, metricWithTrendSchema, weekOverWeekMetricsSchema, ciComputeTimeSchema, investigationCandidateSchema, failureCategoryBreakdownSchema, stabilityTrendSchema, folderStabilitySchema, managerReportSchema, managerReportQuerySchema, sendManagerReportRequestSchema, reportAttachmentLinkSchema, developerReportRegressionSchema, developerReportFlakyTestSchema, developerReportSlowTestSchema, developerRunSummaryReportSchema, executiveReportStatusSchema, executiveMetricSchema, executiveKeyMetricsSchema, executiveTrendPointSchema, executiveTrendsSchema, executiveFlakyOffenderSchema, executiveSlowestOffenderSchema, executiveTopOffendersSchema, executiveReportSchema, executiveReportQuerySchema, sendExecutiveReportRequestSchema, manualTestCaseSchema, createManualRunRequestSchema, manualTestResultSchema, recordManualResultsRequestSchema, recordSingleManualResultRequestSchema, assignmentActivityActionSchema, assignmentActivityActorTypeSchema, assignmentActivitySchema, assignmentActivityListResponseSchema, assigneeInfoSchema, assigneesListResponseSchema, testCatalogPrioritySchema, testCatalogTypeSchema, testCatalogAssignmentStatusSchema, testCatalogAssignmentSchema, testCatalogDefinitionSchema, testCatalogListItemSchema, testCatalogHistoryEntrySchema, testCatalogListQuerySchema, testCatalogListResponseSchema, testCatalogDetailResponseSchema, testCatalogFilterOptionsSchema, testCatalogAssigneeInfoSchema, testCatalogAssignRequestSchema, testCatalogUpdateAssignmentRequestSchema, testCatalogAssignmentResponseSchema, testCatalogFolderNodeSchema, testCatalogFolderTreeResponseSchema, testCatalogFolderTestsQuerySchema, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, DAYS_PER_WEEK, SECONDS_PER_WEEK, DAYS_PER_MONTH, SECONDS_PER_MONTH, DAYS_PER_YEAR, SECONDS_PER_YEAR;
362
+ var AVAILABLE_MODELS, DATE_SUFFIX_REGEX, SMALL_COST_MULTIPLIER, MEDIUM_COST_MULTIPLIER, PREMIUM_COST_MULTIPLIER, SMALL_COST_LABEL, MEDIUM_COST_LABEL, PREMIUM_COST_LABEL, MODEL_TIERS, CONTEXT_WINDOWS, util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, ZodBranded, ZodPipeline, ZodReadonly, ZodFirstPartyTypeKind, stringType, numberType, booleanType, dateType, unknownType, arrayType, objectType, unionType, discriminatedUnionType, recordType, functionType, lazyType, literalType, enumType, promiseType, coerce, MAX_API_KEY_NAME_LENGTH, apiKeySchema, apiKeyUsageSchema, createApiKeyRequestSchema, apiKeyResponseSchema, apiKeyUsageSummarySchema, genericErrorSchema, validationErrorSchema, feedbackCategorySchema, FEEDBACK_CATEGORIES, feedbackStatusSchema, feedbackActivitySchema, createFeedbackSchema, updateFeedbackStatusSchema, feedbackResponseSchema, listFeedbackQuerySchema, feedbackListResponseSchema, gitHubRepositorySchema, gitHubInstallationSchema, gitHubInstallUrlResponseSchema, gitHubClaimInstallationRequestSchema, gitHubReposResponseSchema, healthMetricSchema, healthMetricDailyItemSchema, healthMetricsWithDailySchema, healthAnalyticsPeriodSchema, healthAnalyticsDailyItemSchema, healthAnalyticsResponseSchema, manualTestCasePrioritySchema, manualTestCaseItemSchema, createManualTestCaseItemSchema, updateManualTestCaseItemSchema, listManualTestCaseItemsQuerySchema, manualTestCaseItemListResponseSchema, manualTestFolderSchema, manualTestFolderContentsSchema, createManualTestFolderSchema, updateManualTestFolderSchema, MAX_TIMEZONE_CHAR_LENGTH, organizationSchema, organizationSettingsSchema, adminOrganizationSchema, adminOrganizationListSchema, updateAdminOrganizationRequestSchema, sandboxProviderSchema, sessionTypeSchema, sessionStatusSchema, provisioningStepSchema, createWebSessionSchema, createWebSessionResponseSchema, wsServerMessageSchema, wsClientMessageSchema, gitStatusResponseSchema, gitCommitRequestSchema, gitCommitResponseSchema, gitPushResponseSchema, createPRRequestSchema, createPRResponseSchema, gitDiffResponseSchema, webSessionResponseSchema, snapshotStateSchema, toolPresetsSchema, projectRepoSchema, createProjectMachineSchema, updateProjectMachineSchema, envVarEntrySchema, createEnvFileSchema, putEnvFileVarsSchema, projectMachineResponseSchema, machineSnapshotResponseSchema, envFileResponseSchema, textBlockSchema, toolUseBlockSchema, toolResultBlockSchema, thinkingBlockSchema, imageBlockSchema, contentBlockSchema, sessionSchema, createSessionRequestSchema, updateSessionRequestSchema, messageSchema, createMessageRequestSchema, cliEventSchema, createCLISessionRequestSchema, queryResultSchema, queryTurnSchema, queryContentSchema, queryUsageSchema, querySchema, runStatusSchema, testResultStatusSchema, testOutcomeSchema, attachmentKindSchema, stepCategorySchema, runSummarySchema, ciMetadataSchema, gitMetadataSchema, playwrightConfigSchema, errorInfoSchema, locationSchema, sourceSnippetSchema, runSourceSchema, runSchema, annotationSchema, testSchema, testResultSchema, baseStepSchema, stepSchema, attachmentSchema, listRunsQuerySchema, listTestsQuerySchema, runsListResponseSchema, runDetailResponseSchema, coverageTestItemSchema, secondaryTagMetricSchema, tagCoverageSchema, coverageStatsSchema, coverageAlertSchema, coverageDashboardResponseSchema, coverageDashboardQuerySchema, testsListResponseSchema, testDetailResponseSchema, testHistoryItemSchema, testHistoryResponseSchema, visualComparisonScreenshotSchema, visualComparisonRunSchema, visualComparisonMatchedStepSchema, visualComparisonResponseSchema, topOffenderSchema, topOffendersResponseSchema, trendPointSchema, trendsResponseSchema, errorCategorySchema, failureClusterSchema, newFailureSchema, runInsightsResponseSchema, FailureCategoryEnum, SelectorTypeEnum, FailureCategoryStatsSchema, FailureCategoriesResponseSchema, FailingSelectorStatsSchema, FailingSelectorsResponseSchema, newFailureItemSchema, newFailuresResponseSchema, flakyTestItemSchema, flakyTestsResponseSchema, slowestTestItemSchema, slowestTestsResponseSchema, runSummaryEmailFailureSchema, runSummaryEmailReportSchema, sendRunReportRequestSchema, metricWithTrendSchema, weekOverWeekMetricsSchema, ciComputeTimeSchema, investigationCandidateSchema, failureCategoryBreakdownSchema, stabilityTrendSchema, folderStabilitySchema, managerReportSchema, managerReportQuerySchema, sendManagerReportRequestSchema, reportAttachmentLinkSchema, developerReportRegressionSchema, developerReportFlakyTestSchema, developerReportSlowTestSchema, developerRunSummaryReportSchema, executiveReportStatusSchema, executiveMetricSchema, executiveKeyMetricsSchema, executiveTrendPointSchema, executiveTrendsSchema, executiveFlakyOffenderSchema, executiveSlowestOffenderSchema, executiveTopOffendersSchema, executiveReportSchema, executiveReportQuerySchema, sendExecutiveReportRequestSchema, manualTestCaseSchema, createManualRunRequestSchema, manualTestResultSchema, recordManualResultsRequestSchema, recordSingleManualResultRequestSchema, assignmentActivityActionSchema, assignmentActivityActorTypeSchema, assignmentActivitySchema, assignmentActivityListResponseSchema, assigneeInfoSchema, assigneesListResponseSchema, testCatalogPrioritySchema, testCatalogTypeSchema, testCatalogAssignmentStatusSchema, testCatalogWorkTypeSchema, testCatalogAssignmentSchema, testCatalogDefinitionSchema, testCatalogListItemSchema, testCatalogHistoryEntrySchema, testCatalogListQuerySchema, testCatalogListResponseSchema, testCatalogDetailResponseSchema, testCatalogFilterOptionsSchema, testCatalogAssigneeInfoSchema, testCatalogAssignRequestSchema, testCatalogUpdateAssignmentRequestSchema, testCatalogAssignmentResponseSchema, testCatalogFolderNodeSchema, testCatalogFolderTreeResponseSchema, testCatalogFolderTestsQuerySchema, SECONDS_PER_MINUTE, SECONDS_PER_HOUR, SECONDS_PER_DAY, DAYS_PER_WEEK, SECONDS_PER_WEEK, DAYS_PER_MONTH, SECONDS_PER_MONTH, DAYS_PER_YEAR, SECONDS_PER_YEAR;
363
363
  var init_shared_es = __esm({
364
364
  "../shared/dist/shared.es.mjs"() {
365
365
  "use strict";
@@ -4158,6 +4158,22 @@ var init_shared_es = __esm({
4158
4158
  description: "Anything else"
4159
4159
  }
4160
4160
  };
4161
+ feedbackStatusSchema = enumType([
4162
+ "open",
4163
+ "acknowledged",
4164
+ "in_progress",
4165
+ "resolved",
4166
+ "dismissed"
4167
+ ]);
4168
+ feedbackActivitySchema = objectType({
4169
+ id: stringType(),
4170
+ note: stringType().optional(),
4171
+ statusFrom: feedbackStatusSchema.optional(),
4172
+ statusTo: feedbackStatusSchema.optional(),
4173
+ createdBy: stringType(),
4174
+ createdAt: stringType()
4175
+ // ISO timestamp
4176
+ });
4161
4177
  createFeedbackSchema = objectType({
4162
4178
  category: feedbackCategorySchema,
4163
4179
  description: stringType().min(1, "Description is required").max(5e3),
@@ -4167,6 +4183,12 @@ var init_shared_es = __esm({
4167
4183
  cliVersion: stringType().optional(),
4168
4184
  metadata: recordType(unknownType()).optional()
4169
4185
  });
4186
+ updateFeedbackStatusSchema = objectType({
4187
+ status: feedbackStatusSchema.optional(),
4188
+ note: stringType().max(1e3).optional()
4189
+ }).refine((d) => d.status !== void 0 || d.note && d.note.length > 0, {
4190
+ message: "Provide a status change, a note, or both"
4191
+ });
4170
4192
  feedbackResponseSchema = objectType({
4171
4193
  id: stringType().uuid(),
4172
4194
  userId: stringType(),
@@ -4178,10 +4200,14 @@ var init_shared_es = __esm({
4178
4200
  model: stringType().nullable(),
4179
4201
  cliVersion: stringType().nullable(),
4180
4202
  metadata: recordType(unknownType()).nullable(),
4203
+ status: feedbackStatusSchema,
4204
+ statusUpdatedAt: stringType().nullable(),
4205
+ activity: arrayType(feedbackActivitySchema),
4181
4206
  createdAt: stringType()
4182
4207
  });
4183
4208
  listFeedbackQuerySchema = objectType({
4184
4209
  category: feedbackCategorySchema.optional(),
4210
+ status: feedbackStatusSchema.optional(),
4185
4211
  startDate: stringType().optional(),
4186
4212
  endDate: stringType().optional(),
4187
4213
  search: stringType().optional(),
@@ -5645,9 +5671,16 @@ var init_shared_es = __esm({
5645
5671
  "completed",
5646
5672
  "failed"
5647
5673
  ]);
5674
+ testCatalogWorkTypeSchema = enumType([
5675
+ "fix_failure",
5676
+ "automate",
5677
+ "review",
5678
+ "investigate"
5679
+ ]);
5648
5680
  testCatalogAssignmentSchema = objectType({
5649
5681
  assignedTo: stringType(),
5650
- status: testCatalogAssignmentStatusSchema
5682
+ status: testCatalogAssignmentStatusSchema,
5683
+ workType: testCatalogWorkTypeSchema.nullable().optional()
5651
5684
  });
5652
5685
  testCatalogDefinitionSchema = objectType({
5653
5686
  id: stringType().uuid(),
@@ -5772,7 +5805,8 @@ var init_shared_es = __esm({
5772
5805
  });
5773
5806
  testCatalogAssignRequestSchema = objectType({
5774
5807
  assignedTo: stringType(),
5775
- notes: stringType().optional()
5808
+ notes: stringType().optional(),
5809
+ workType: testCatalogWorkTypeSchema.optional()
5776
5810
  });
5777
5811
  testCatalogUpdateAssignmentRequestSchema = objectType({
5778
5812
  status: enumType(["completed", "failed"]),
@@ -6045,7 +6079,7 @@ var CLI_VERSION;
6045
6079
  var init_version = __esm({
6046
6080
  "src/version.ts"() {
6047
6081
  "use strict";
6048
- CLI_VERSION = "0.0.57";
6082
+ CLI_VERSION = "0.0.59";
6049
6083
  }
6050
6084
  });
6051
6085
 
@@ -7447,7 +7481,9 @@ ${projectInstructions}`,
7447
7481
  "ZAI_BASE_URL",
7448
7482
  "CLAUDE_CODE_AUTH_TOKEN",
7449
7483
  "CLAUDE_CODE_OAUTH_TOKEN",
7450
- "CLAUDE_API_KEY"
7484
+ "CLAUDE_API_KEY",
7485
+ "CLAUDECODE"
7486
+ // Prevent nested session detection by Claude Code subprocess
7451
7487
  ]);
7452
7488
  for (const [key, value] of Object.entries(process.env)) {
7453
7489
  if (value !== void 0 && !excludeKeys.has(key)) {
@@ -7498,7 +7534,7 @@ ${projectInstructions}`,
7498
7534
  allowDangerouslySkipPermissions: !isPlanMode,
7499
7535
  pathToClaudeCodeExecutable: claudeCodePath,
7500
7536
  includePartialMessages: true,
7501
- executable: "node",
7537
+ executable: process.execPath,
7502
7538
  // MCP servers: built-in Supatest MCP + user-configured servers
7503
7539
  // User config takes precedence (can override or disable supatest server)
7504
7540
  mcpServers: (() => {
@@ -9771,7 +9807,9 @@ var init_test_tagging = __esm({
9771
9807
  **IMPORTANT**: Before completing any fix or writing a new test, check if the test has metadata tags. If tags are missing, add them.
9772
9808
 
9773
9809
  Required tags for ALL tests:
9774
- - @id:UNIQUE-ID \u2014 Stable identity for history tracking. Generate a short memorable ID based on the feature and test purpose (e.g. AUTH-LOGIN-001, CART-ADD-001). REQUIRED for every test \u2014 without it, renaming or moving a test loses its entire run history.
9810
+ - @id:UNIQUE-ID \u2014 Stable identity for history tracking. REQUIRED for every test \u2014 without it, renaming or moving a test loses its entire run history.
9811
+ - **If automating an existing manual test**: use the platform's readableId as the @id (e.g. \`@id:TST-123\`). This is how the platform links automated runs back to the manual test record \u2014 same history, same assignments, same entity.
9812
+ - **If writing a brand-new test with no platform entry**: generate a short memorable ID from the feature and test purpose (e.g. AUTH-LOGIN-001, CART-ADD-001).
9775
9813
  - @feature:name \u2014 Feature area or module this test covers
9776
9814
  - @priority:critical|high|medium|low \u2014 Test importance
9777
9815
  - @test_type:smoke|e2e|regression|integration|unit \u2014 Classification
@@ -9805,7 +9843,7 @@ it("User can login (@id:AUTH-LOGIN-001 @feature:auth @priority:high @test_type:e
9805
9843
  - ...
9806
9844
  \`\`\`
9807
9845
  2. Show the draft to the user and ask for confirmation before creating it in Supatest.
9808
- 3. On confirmation, use the Supatest MCP \`create-manual-test\` tool to create it (pass \`title\`, \`steps\` as the markdown body, \`priority\`, \`tags\`, and \`folderId\` if relevant).
9846
+ 3. On confirmation, use the Supatest MCP \`create-manual-test\` tool to create it (pass \`title\`, \`steps\` as the markdown body, \`priority\`, \`tags\`, and \`folderId\` if relevant). The tool returns a \`readableId\` (e.g. TST-123) \u2014 store it. If you automate this same test later in the session, use \`@id:TST-123\` (the platform readableId) instead of generating a new ID.
9809
9847
 
9810
9848
  A test is not complete until it has @id plus the other required tags.
9811
9849
  </test_tagging>`;
@@ -19888,7 +19926,6 @@ var HeadlessApp = (props) => {
19888
19926
  init_stdio();
19889
19927
  init_version();
19890
19928
  async function runAgent(config2) {
19891
- const cleanupStdio = patchStdio();
19892
19929
  const apiUrl = config2.supatestApiUrl || "https://code-api.supatest.ai";
19893
19930
  const apiClient = new ApiClient(apiUrl, config2.supatestApiKey);
19894
19931
  let sessionId;
@@ -19912,7 +19949,6 @@ async function runAgent(config2) {
19912
19949
  }
19913
19950
  }
19914
19951
  if (!sessionId) {
19915
- cleanupStdio();
19916
19952
  return {
19917
19953
  success: false,
19918
19954
  summary: "Failed to create session",
@@ -19921,6 +19957,7 @@ async function runAgent(config2) {
19921
19957
  error: "Could not create session on backend"
19922
19958
  };
19923
19959
  }
19960
+ const cleanupStdio = patchStdio();
19924
19961
  clearTerminalViewportAndScrollback();
19925
19962
  const { stdout: inkStdout, stderr: inkStderr } = createInkStdio();
19926
19963
  return new Promise((resolve2) => {
@@ -20006,7 +20043,16 @@ Updating Supatest CLI ${CLI_VERSION} \u2192 ${latest}...`);
20006
20043
  try {
20007
20044
  try {
20008
20045
  const npmPrefix = execSync3("npm config get prefix", { encoding: "utf-8" }).trim();
20009
- execSync3(`rm -rf ${npmPrefix}/lib/node_modules/@supatest/.cli-* 2>/dev/null || true`);
20046
+ if (process.platform === "win32") {
20047
+ const { rmSync, readdirSync: readdirSync2 } = await import("fs");
20048
+ const modulesDir = `${npmPrefix}\\node_modules\\@supatest`;
20049
+ const entries = readdirSync2(modulesDir).filter((e) => e.startsWith(".cli-"));
20050
+ for (const entry of entries) {
20051
+ rmSync(`${modulesDir}\\${entry}`, { recursive: true, force: true });
20052
+ }
20053
+ } else {
20054
+ execSync3(`rm -rf ${npmPrefix}/lib/node_modules/@supatest/.cli-* 2>/dev/null || true`);
20055
+ }
20010
20056
  } catch {
20011
20057
  }
20012
20058
  try {
@@ -20042,6 +20088,12 @@ Updating Supatest CLI ${CLI_VERSION} \u2192 ${latest}...`);
20042
20088
  detached: false
20043
20089
  });
20044
20090
  child.on("exit", (code) => process.exit(code ?? 0));
20091
+ child.on("error", (err) => {
20092
+ logError(err, { source: "auto-update", action: "relaunch" });
20093
+ console.error("Failed to relaunch after update:", err.message);
20094
+ console.log("Please restart the CLI manually.\n");
20095
+ process.exit(0);
20096
+ });
20045
20097
  await new Promise(() => {
20046
20098
  });
20047
20099
  } catch (installError) {
@@ -20228,6 +20280,17 @@ program.name("supatest").description(
20228
20280
  process.exit(1);
20229
20281
  }
20230
20282
  }
20283
+ {
20284
+ const { existsSync: existsSync10 } = await import("fs");
20285
+ const { resolve: resolve2 } = await import("path");
20286
+ const resolvedCwd = resolve2(options.cwd ?? process.cwd());
20287
+ if (!existsSync10(resolvedCwd)) {
20288
+ logger.error(`Working directory does not exist: ${resolvedCwd}`);
20289
+ logger.error(`Provided path: ${options.cwd}`);
20290
+ process.exit(1);
20291
+ }
20292
+ options.cwd = resolvedCwd;
20293
+ }
20231
20294
  if (!prompt && isHeadlessMode) {
20232
20295
  logger.error("Task description is required in headless mode");
20233
20296
  program.help();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supatest/cli",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "description": "Supatest CLI - AI-powered task automation for CI/CD",
5
5
  "type": "module",
6
6
  "bin": {