@supatest/cli 0.0.25 → 0.0.26

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 +217 -23
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -442,15 +442,15 @@ var init_prompts = __esm({
442
442
 
443
443
  // src/config.ts
444
444
  import { resolve } from "path";
445
- import dotenv from "dotenv";
446
445
  var isDevelopment, getEnvVar, config;
447
446
  var init_config = __esm({
448
- "src/config.ts"() {
447
+ async "src/config.ts"() {
449
448
  "use strict";
450
449
  init_prompts();
451
450
  isDevelopment = process.env.NODE_ENV === "development";
452
451
  if (isDevelopment) {
453
452
  const envFile = process.env.ENV_NAME ? `.env.${process.env.ENV_NAME}` : ".env";
453
+ const dotenv = await import("dotenv");
454
454
  dotenv.config({ path: resolve(process.cwd(), envFile) });
455
455
  }
456
456
  getEnvVar = (key, defaultValue) => {
@@ -466,7 +466,7 @@ var init_config = __esm({
466
466
  supatestApiKey: getEnvVar("SUPATEST_API_KEY"),
467
467
  supatestApiUrl: getEnvVar("SUPATEST_API_URL", "https://code-api.supatest.ai"),
468
468
  claudeCodeExecutablePath: getEnvVar("SUPATEST_CLAUDE_CODE_PATH"),
469
- anthropicModelName: getEnvVar("ANTHROPIC_MODEL_NAME", "claude-sonnet-4-20250514"),
469
+ anthropicModelName: getEnvVar("ANTHROPIC_MODEL_NAME", "claude-opus-4-5"),
470
470
  headlessSystemPrompt: fixerPrompt,
471
471
  interactiveSystemPrompt: builderPrompt,
472
472
  planSystemPrompt: plannerPrompt
@@ -684,7 +684,7 @@ function getToolDisplayName(toolName) {
684
684
  };
685
685
  return displayNameMap[toolName] || toolName;
686
686
  }
687
- var AVAILABLE_MODELS, DEFAULT_MODEL_ID, DATE_SUFFIX_REGEX, 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, MAX_TIMEZONE_CHAR_LENGTH, organizationSchema, organizationSettingsSchema, 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, runSchema, annotationSchema, testSchema, testResultSchema, baseStepSchema, stepSchema, attachmentSchema, listRunsQuerySchema, listTestsQuerySchema, runsListResponseSchema, runDetailResponseSchema, testsListResponseSchema, testDetailResponseSchema, testHistoryItemSchema, testHistoryResponseSchema, topOffenderSchema, topOffendersResponseSchema, trendPointSchema, trendsResponseSchema, errorCategorySchema, failureClusterSchema, newFailureSchema, runInsightsResponseSchema;
687
+ var AVAILABLE_MODELS, DEFAULT_MODEL_ID, DATE_SUFFIX_REGEX, 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, healthMetricSchema, healthMetricDailyItemSchema, healthMetricsWithDailySchema, healthAnalyticsPeriodSchema, healthAnalyticsDailyItemSchema, healthAnalyticsResponseSchema, MAX_TIMEZONE_CHAR_LENGTH, organizationSchema, organizationSettingsSchema, 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, runSchema, annotationSchema, testSchema, testResultSchema, baseStepSchema, stepSchema, attachmentSchema, listRunsQuerySchema, listTestsQuerySchema, runsListResponseSchema, runDetailResponseSchema, testsListResponseSchema, testDetailResponseSchema, testHistoryItemSchema, testHistoryResponseSchema, topOffenderSchema, topOffendersResponseSchema, trendPointSchema, trendsResponseSchema, errorCategorySchema, failureClusterSchema, newFailureSchema, runInsightsResponseSchema, FailureCategoryEnum, SelectorTypeEnum, FailureCategoryStatsSchema, FailureCategoriesResponseSchema, FailingSelectorStatsSchema, FailingSelectorsResponseSchema, newFailureItemSchema, newFailuresResponseSchema, flakyTestItemSchema, flakyTestsResponseSchema, slowestTestItemSchema, slowestTestsResponseSchema, runSummaryEmailFailureSchema, runSummaryEmailReportSchema, sendRunReportRequestSchema;
688
688
  var init_shared_es = __esm({
689
689
  "../shared/dist/shared.es.mjs"() {
690
690
  "use strict";
@@ -4510,6 +4510,62 @@ var init_shared_es = __esm({
4510
4510
  limit: numberType(),
4511
4511
  offset: numberType()
4512
4512
  });
4513
+ healthMetricSchema = objectType({
4514
+ /** Current period value */
4515
+ current: numberType(),
4516
+ /** Previous period value for comparison */
4517
+ previous: numberType(),
4518
+ /** Absolute change (current - previous) */
4519
+ change: numberType(),
4520
+ /** Percentage change from previous period, null if previous was 0 */
4521
+ percentChange: numberType().nullable()
4522
+ });
4523
+ healthMetricDailyItemSchema = objectType({
4524
+ /** Date in ISO format (YYYY-MM-DD) */
4525
+ date: stringType(),
4526
+ /** Metric value for this day */
4527
+ value: numberType()
4528
+ });
4529
+ healthMetricsWithDailySchema = objectType({
4530
+ /** Aggregate metric values and trend */
4531
+ metric: healthMetricSchema,
4532
+ /** Daily breakdown of the metric */
4533
+ byDay: arrayType(healthMetricDailyItemSchema)
4534
+ });
4535
+ healthAnalyticsPeriodSchema = objectType({
4536
+ /** Start date in ISO format */
4537
+ start: stringType(),
4538
+ /** End date in ISO format */
4539
+ end: stringType(),
4540
+ /** Number of days in the period */
4541
+ days: numberType()
4542
+ });
4543
+ healthAnalyticsDailyItemSchema = objectType({
4544
+ /** Date in ISO format (YYYY-MM-DD) */
4545
+ date: stringType(),
4546
+ /** Total number of tests run this day */
4547
+ totalTests: numberType(),
4548
+ /** Pass rate percentage for this day (0-100) */
4549
+ passRate: numberType(),
4550
+ /** Number of flaky tests detected this day */
4551
+ flakyCount: numberType(),
4552
+ /** Number of new failures detected this day */
4553
+ newFailures: numberType()
4554
+ });
4555
+ healthAnalyticsResponseSchema = objectType({
4556
+ /** Time period for this analytics data */
4557
+ period: healthAnalyticsPeriodSchema,
4558
+ /** Combined daily breakdown of all metrics */
4559
+ daily: arrayType(healthAnalyticsDailyItemSchema),
4560
+ /** Total tests metric with daily breakdown */
4561
+ totalTests: healthMetricsWithDailySchema,
4562
+ /** Pass rate metric with daily breakdown (byDay contains passRate values) */
4563
+ passRate: healthMetricsWithDailySchema,
4564
+ /** Flaky tests metric with daily breakdown (byDay contains count values) */
4565
+ flakyTests: healthMetricsWithDailySchema,
4566
+ /** New failures metric with daily breakdown (byDay contains count values) */
4567
+ newFailures: healthMetricsWithDailySchema
4568
+ });
4513
4569
  MAX_TIMEZONE_CHAR_LENGTH = 100;
4514
4570
  organizationSchema = objectType({
4515
4571
  id: stringType().uuid(),
@@ -4794,6 +4850,8 @@ var init_shared_es = __esm({
4794
4850
  });
4795
4851
  runSchema = objectType({
4796
4852
  id: stringType(),
4853
+ readableId: stringType().optional(),
4854
+ // e.g., "RUN-123"
4797
4855
  projectId: stringType(),
4798
4856
  status: runStatusSchema,
4799
4857
  summary: runSummarySchema,
@@ -4812,6 +4870,8 @@ var init_shared_es = __esm({
4812
4870
  });
4813
4871
  testSchema = objectType({
4814
4872
  id: stringType(),
4873
+ readableId: stringType().optional(),
4874
+ // e.g., "TEST-123"
4815
4875
  runId: stringType(),
4816
4876
  file: stringType(),
4817
4877
  title: stringType(),
@@ -4913,7 +4973,8 @@ var init_shared_es = __esm({
4913
4973
  status: testResultStatusSchema,
4914
4974
  durationMs: numberType(),
4915
4975
  date: stringType(),
4916
- branch: stringType().optional()
4976
+ branch: stringType().optional(),
4977
+ errorSummary: stringType().optional()
4917
4978
  });
4918
4979
  testHistoryResponseSchema = objectType({
4919
4980
  testId: stringType(),
@@ -4983,6 +5044,144 @@ var init_shared_es = __esm({
4983
5044
  newFailures: arrayType(newFailureSchema),
4984
5045
  clusters: arrayType(failureClusterSchema)
4985
5046
  });
5047
+ FailureCategoryEnum = enumType([
5048
+ "timeout",
5049
+ "element_not_found",
5050
+ "assertion",
5051
+ "network",
5052
+ "navigation",
5053
+ "other"
5054
+ ]);
5055
+ SelectorTypeEnum = enumType([
5056
+ "testid",
5057
+ "class",
5058
+ "id",
5059
+ "aria",
5060
+ "text",
5061
+ "css",
5062
+ "xpath"
5063
+ ]);
5064
+ FailureCategoryStatsSchema = objectType({
5065
+ category: FailureCategoryEnum,
5066
+ count: numberType(),
5067
+ percentage: numberType()
5068
+ });
5069
+ FailureCategoriesResponseSchema = objectType({
5070
+ totalFailures: numberType(),
5071
+ categories: arrayType(FailureCategoryStatsSchema),
5072
+ period: objectType({
5073
+ start: stringType(),
5074
+ end: stringType(),
5075
+ days: numberType()
5076
+ })
5077
+ });
5078
+ FailingSelectorStatsSchema = objectType({
5079
+ selector: stringType(),
5080
+ selectorType: SelectorTypeEnum,
5081
+ count: numberType(),
5082
+ testCount: numberType()
5083
+ });
5084
+ FailingSelectorsResponseSchema = objectType({
5085
+ selectors: arrayType(FailingSelectorStatsSchema),
5086
+ period: objectType({
5087
+ start: stringType(),
5088
+ end: stringType(),
5089
+ days: numberType()
5090
+ })
5091
+ });
5092
+ newFailureItemSchema = objectType({
5093
+ testRunId: stringType(),
5094
+ runId: stringType(),
5095
+ testId: stringType(),
5096
+ file: stringType(),
5097
+ title: stringType(),
5098
+ failureCount: numberType(),
5099
+ totalRunCount: numberType(),
5100
+ firstFailedAt: stringType(),
5101
+ avgDurationMs: numberType(),
5102
+ errorMessage: stringType().nullable()
5103
+ });
5104
+ newFailuresResponseSchema = objectType({
5105
+ items: arrayType(newFailureItemSchema),
5106
+ total: numberType(),
5107
+ period: objectType({
5108
+ start: stringType(),
5109
+ end: stringType(),
5110
+ days: numberType()
5111
+ })
5112
+ });
5113
+ flakyTestItemSchema = objectType({
5114
+ testRunId: stringType(),
5115
+ runId: stringType(),
5116
+ testId: stringType(),
5117
+ file: stringType(),
5118
+ title: stringType(),
5119
+ passRate: numberType(),
5120
+ flakeCount: numberType(),
5121
+ totalRuns: numberType(),
5122
+ avgDurationMs: numberType()
5123
+ });
5124
+ flakyTestsResponseSchema = objectType({
5125
+ items: arrayType(flakyTestItemSchema),
5126
+ total: numberType(),
5127
+ period: objectType({
5128
+ start: stringType(),
5129
+ end: stringType(),
5130
+ days: numberType()
5131
+ })
5132
+ });
5133
+ slowestTestItemSchema = objectType({
5134
+ testRunId: stringType(),
5135
+ runId: stringType(),
5136
+ testId: stringType(),
5137
+ file: stringType(),
5138
+ title: stringType(),
5139
+ avgDurationMs: numberType(),
5140
+ p95DurationMs: numberType(),
5141
+ trendPercent: numberType()
5142
+ });
5143
+ slowestTestsResponseSchema = objectType({
5144
+ items: arrayType(slowestTestItemSchema),
5145
+ total: numberType(),
5146
+ period: objectType({
5147
+ start: stringType(),
5148
+ end: stringType(),
5149
+ days: numberType()
5150
+ })
5151
+ });
5152
+ runSummaryEmailFailureSchema = objectType({
5153
+ testRunId: stringType(),
5154
+ testId: stringType(),
5155
+ title: stringType(),
5156
+ file: stringType(),
5157
+ errorMessage: stringType().nullable(),
5158
+ errorStack: stringType().nullable()
5159
+ });
5160
+ runSummaryEmailReportSchema = objectType({
5161
+ runId: stringType(),
5162
+ readableId: stringType().optional(),
5163
+ runDetailsUrl: stringType(),
5164
+ startedAt: stringType(),
5165
+ endedAt: stringType().optional(),
5166
+ durationMs: numberType(),
5167
+ // Git info
5168
+ branch: stringType().optional(),
5169
+ commit: stringType().optional(),
5170
+ commitMessage: stringType().optional(),
5171
+ // Summary stats
5172
+ totalTests: numberType(),
5173
+ passedTests: numberType(),
5174
+ failedTests: numberType(),
5175
+ flakyTests: numberType(),
5176
+ skippedTests: numberType(),
5177
+ passRate: numberType(),
5178
+ // Top failures
5179
+ topFailures: arrayType(runSummaryEmailFailureSchema)
5180
+ });
5181
+ sendRunReportRequestSchema = objectType({
5182
+ runId: stringType(),
5183
+ emails: arrayType(stringType().email())
5184
+ });
4986
5185
  }
4987
5186
  });
4988
5187
 
@@ -5241,7 +5440,7 @@ var CLI_VERSION;
5241
5440
  var init_version = __esm({
5242
5441
  "src/version.ts"() {
5243
5442
  "use strict";
5244
- CLI_VERSION = "0.0.25";
5443
+ CLI_VERSION = "0.0.26";
5245
5444
  }
5246
5445
  });
5247
5446
 
@@ -6180,9 +6379,9 @@ import { dirname, join as join6 } from "path";
6180
6379
  import { query } from "@anthropic-ai/claude-agent-sdk";
6181
6380
  var CoreAgent;
6182
6381
  var init_agent = __esm({
6183
- "src/core/agent.ts"() {
6382
+ async "src/core/agent.ts"() {
6184
6383
  "use strict";
6185
- init_config();
6384
+ await init_config();
6186
6385
  init_command_discovery();
6187
6386
  init_error_logger();
6188
6387
  init_mcp_loader();
@@ -6408,7 +6607,7 @@ ${projectInstructions}`,
6408
6607
  cacheCreationTokens: usageFromResult.cacheCreationTokens
6409
6608
  };
6410
6609
  queryUsage = {
6411
- model: finalUsage.model ?? resolvedModel ?? config.anthropicModelName ?? "claude-sonnet-4-20250514",
6610
+ model: finalUsage.model ?? resolvedModel ?? config.anthropicModelName ?? "claude-opus-4-5",
6412
6611
  numTurns: msg.num_turns,
6413
6612
  durationMs: msg.duration_ms,
6414
6613
  inputTokens: finalUsage.inputTokens || 0,
@@ -6571,13 +6770,8 @@ var init_react = __esm({
6571
6770
  "use strict";
6572
6771
  init_shared_es();
6573
6772
  CONTEXT_WINDOWS2 = {
6574
- "claude-sonnet-4-20250514": 2e5,
6575
- "claude-sonnet-4-5-20250929": 2e5,
6576
- "claude-opus-4-20250514": 2e5,
6577
- "claude-3-5-sonnet-20241022": 2e5,
6578
- "claude-3-opus-20240229": 2e5,
6579
- "claude-3-sonnet-20240229": 2e5,
6580
- "claude-3-haiku-20240307": 2e5
6773
+ "claude-opus-4-5": 2e5,
6774
+ "claude-sonnet-4-5": 2e5
6581
6775
  };
6582
6776
  ReactPresenter = class {
6583
6777
  callbacks;
@@ -11444,10 +11638,10 @@ async function runInteractive(config2) {
11444
11638
  }
11445
11639
  var AgentRunner, InteractiveAppContent, InteractiveApp;
11446
11640
  var init_interactive = __esm({
11447
- "src/modes/interactive.tsx"() {
11641
+ async "src/modes/interactive.tsx"() {
11448
11642
  "use strict";
11449
- init_config();
11450
- init_agent();
11643
+ await init_config();
11644
+ await init_agent();
11451
11645
  init_message_bridge();
11452
11646
  init_react();
11453
11647
  init_api_client();
@@ -11766,10 +11960,10 @@ var init_interactive = __esm({
11766
11960
  });
11767
11961
 
11768
11962
  // src/index.ts
11769
- init_config();
11963
+ await init_config();
11770
11964
  init_shared_es();
11771
11965
  init_setup();
11772
- init_config();
11966
+ await init_config();
11773
11967
  import { Command } from "commander";
11774
11968
 
11775
11969
  // src/modes/headless.ts
@@ -11779,7 +11973,7 @@ import { render } from "ink";
11779
11973
  import React14 from "react";
11780
11974
 
11781
11975
  // src/ui/HeadlessApp.tsx
11782
- init_agent();
11976
+ await init_agent();
11783
11977
  init_react();
11784
11978
  init_MessageList();
11785
11979
  init_SessionContext();
@@ -12321,7 +12515,7 @@ program.name("supatest").description(
12321
12515
  });
12322
12516
  process.exit(result.success ? 0 : 1);
12323
12517
  } else {
12324
- const { runInteractive: runInteractive2 } = await Promise.resolve().then(() => (init_interactive(), interactive_exports));
12518
+ const { runInteractive: runInteractive2 } = await init_interactive().then(() => interactive_exports);
12325
12519
  await runInteractive2({
12326
12520
  task: prompt || "",
12327
12521
  // Empty string if no task provided (will use input prompt)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supatest/cli",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "Supatest CLI - AI-powered task automation for CI/CD",
5
5
  "type": "module",
6
6
  "bin": {
@@ -48,7 +48,6 @@
48
48
  "cli-highlight": "^2.1.11",
49
49
  "commander": "^12.1.0",
50
50
  "diff": "^8.0.2",
51
- "dotenv": "^16.6.1",
52
51
  "highlight.js": "^11.11.1",
53
52
  "ink": "npm:@jrichman/ink@6.4.6",
54
53
  "ink-gradient": "^3.0.0",
@@ -70,6 +69,7 @@
70
69
  },
71
70
  "devDependencies": {
72
71
  "@types/node": "^20.12.12",
72
+ "dotenv": "^16.6.1",
73
73
  "@types/semver": "^7.5.8",
74
74
  "@types/react": "^19.0.0",
75
75
  "nodemon": "^3.1.11",