@autometa/cli 1.0.0-rc.2

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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/run.ts","../src/compiler/module-compiler.ts","../src/runtime/cli-runtime.ts","../src/utils/reporter.ts","../src/utils/reporting/scenario-error-renderer.ts","../src/utils/reporting/step-summary.ts","../src/utils/reporting/location.ts","../src/utils/reporting/status-formatters.ts","../src/utils/logging/hierarchical-log.ts","../src/utils/reporting/gherkin-context-printer.ts","../src/utils/reporting/stack-utils.ts","../src/utils/glob.ts","../src/loaders/config.ts","../src/loaders/module-loader.ts","../src/utils/cache-dir.ts","../src/utils/formatter.ts","../src/utils/handover.ts","../src/orchestrator/index.ts"],"names":["fs","extname","resolvePath","pathToFileURL","pc","relative","path","relativePath","startedAt","isAbsolute","resolve","access","fsConstants","createHash","builtinModules","join","build","BUILTIN_EXTERNALS","DEFAULT_EXTERNALS","pathExists","next","resolved","require"],"mappings":";AAAA,SAAS,qBAAqB;AAE9B,SAAS,eAAe;;;ACFxB,SAAS,YAAYA,WAAU;AAC/B,SAAS,WAAAC,UAAS,UAAU,WAAWC,oBAAmB;AAC1D,SAAS,iBAAAC,sBAAqB;AAI9B,SAAS,MAAM,2BAA8C;AAC7D,SAAS,gBAAgB,8BAA8B;AAEvD,SAAS,oBAAyD;;;ACTlE,SAAS,sBAAsB;AAC/B,SAAS,YAAY,MAAM,eAAe;AAC1C,SAAS,OAAO,IAAI,iBAAiB;AAErC,SAAS,aAAa;AAsBtB,IAAM,iBAA+B;AACrC,IAAM,iBAAiB;AACvB,IAAM,oBAAsC;AAC5C,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,oBAAoB,oBAAI,IAAY;AAAA,EACxC,GAAG;AAAA,EACH,GAAG,eAAe,IAAI,CAAC,aAAa,QAAQ,QAAQ,EAAE;AACxD,CAAC;AA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AAsB,mBAAqC;AACzD,QAAM,UAAU,IAAI,QAAQ;AAC5B,UACG,KAAK,UAAU,EACf,YAAY,8BAA8B,EAC1C,QAAQ,WAAW,OAAO;AAE7B,qBAAmB,OAAO;AAE1B,SAAO;AACT","sourcesContent":["import { createRequire } from \"node:module\";\n\nimport { Command } from \"commander\";\n\nimport { registerRunCommand } from \"./commands/run\";\n\nconst require = createRequire(import.meta.url);\nconst { version } = require(\"../package.json\") as { version?: string };\n\nexport async function createCliProgram(): Promise<Command> {\n const program = new Command();\n program\n .name(\"autometa\")\n .description(\"Autometa command-line runner\")\n .version(version ?? \"0.0.0\");\n\n registerRunCommand(program);\n\n return program;\n}\n\nexport { runFeatures } from \"./commands/run\";\n","import { promises as fs } from \"node:fs\";\nimport { extname, relative, resolve as resolvePath } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport { Command } from \"commander\";\nimport type { ExecutorConfig, LoggingConfig } from \"@autometa/config\";\nimport { HTTP, createLoggingPlugin, type HTTPLogEvent } from \"@autometa/http\";\nimport { CucumberRunner, STEPS_ENVIRONMENT_META } from \"@autometa/runner\";\nimport type { GlobalWorld, RunnerStepsSurface } from \"@autometa/runner\";\nimport { parseGherkin, type SimpleFeature, type SimpleRule } from \"@autometa/gherkin\";\nimport type { ScopePlan, ScopeNode } from \"@autometa/scopes\";\n\nimport { compileModules } from \"../compiler/module-compiler\";\nimport {\n createCliRuntime,\n type RuntimeOptions,\n} from \"../runtime/cli-runtime\";\nimport { expandFilePatterns } from \"../utils/glob\";\nimport { loadExecutorConfig } from \"../loaders/config\";\nimport { formatSummary } from \"../utils/formatter\";\nimport { splitPatternsAndRunnerArgs } from \"../utils/handover\";\nimport type { SummaryFormatter } from \"../runtime/types\";\nimport type { RuntimeReporter } from \"../utils/reporter\";\nimport type { RuntimeSummary } from \"../runtime/types\";\nimport { orchestrate } from \"../orchestrator\";\nimport { resolveCliCacheDir } from \"../utils/cache-dir\";\n\nexport interface RunCommandOptions {\n readonly cwd?: string;\n /**\n * Directory used by the CLI to write transpiled/cached runtime artifacts.\n * When omitted, the CLI will choose a sensible default (preferring node_modules/.cache).\n */\n readonly cacheDir?: string;\n readonly patterns?: readonly string[];\n /**\n * Extra args to pass directly to the detected native runner.\n * Only used when mode is not \"standalone\".\n */\n readonly runnerArgs?: readonly string[];\n readonly dryRun?: boolean;\n readonly watch?: boolean;\n readonly verbose?: boolean;\n readonly reporters?: readonly RuntimeReporter[];\n readonly summaryFormatter?: SummaryFormatter;\n readonly modules?: readonly string[];\n readonly groups?: readonly string[];\n readonly environment?: string;\n /**\n * Force a specific runner mode.\n * - \"native\": Use vitest/jest if configured (default behavior)\n * - \"standalone\": Always use the built-in CLI runtime\n * - \"auto\": Detect from config (same as \"native\")\n */\n readonly mode?: \"native\" | \"standalone\" | \"auto\";\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface RunCommandResult extends RuntimeSummary {}\n\nconst STEP_FILE_EXTENSIONS = new Set([\".ts\", \".tsx\", \".js\", \".jsx\", \".mjs\", \".cjs\", \".mts\", \".cts\"]);\nconst STEP_FALLBACK_GLOB = \"**/*.{ts,tsx,js,jsx,mjs,cjs,mts,cts}\";\nconst FEATURE_FALLBACK_GLOB = \"**/*.feature\";\nconst ROOT_LOAD_ORDER = [\"parameterTypes\", \"support\", \"hooks\", \"app\"];\n\nfunction normalizeGlobLikePath(input: string): string {\n return input.replace(/\\\\/g, \"/\").replace(/^\\.\\//u, \"\");\n}\n\nfunction patternIsUnderRoot(pattern: string, root: string): boolean {\n const p = normalizeGlobLikePath(pattern);\n const r = normalizeGlobLikePath(root).replace(/\\/+$/u, \"\");\n if (!r) {\n return false;\n }\n return p === r || p.startsWith(`${r}/`);\n}\n\ntype ModuleDeclaration =\n | string\n | { readonly name: string; readonly submodules?: readonly ModuleDeclaration[] | undefined };\n\ninterface GroupIndexEntry {\n readonly group: string;\n readonly rootAbs: string;\n readonly modulePaths: readonly (readonly string[])[];\n}\n\ntype FileScope =\n | { readonly kind: \"root\" }\n | { readonly kind: \"group\"; readonly group: string }\n | { readonly kind: \"module\"; readonly group: string; readonly modulePath: readonly string[] };\n\nfunction flattenModuleDeclarations(\n declarations: readonly ModuleDeclaration[] | undefined,\n prefix: readonly string[] = []\n): readonly (readonly string[])[] {\n if (!declarations || declarations.length === 0) {\n return [];\n }\n\n const results: string[][] = [];\n\n for (const entry of declarations) {\n if (typeof entry === \"string\") {\n const next = [...prefix, entry];\n results.push(next);\n continue;\n }\n\n const next = [...prefix, entry.name];\n results.push(next);\n\n const nested = flattenModuleDeclarations(entry.submodules ?? undefined, next);\n for (const path of nested) {\n results.push([...path]);\n }\n }\n\n // Dedupe + sort by deepest first for fast \"deepest prefix\" matching\n const unique = new Map<string, readonly string[]>();\n for (const path of results) {\n unique.set(path.join(\"/\"), path);\n }\n\n return Array.from(unique.values()).sort((a, b) => b.length - a.length);\n}\n\nfunction buildGroupIndex(config: ExecutorConfig, cwd: string): readonly GroupIndexEntry[] {\n const groups = config.modules?.groups;\n if (!groups) {\n return [];\n }\n\n return Object.entries(groups).map(([group, groupConfig]) => {\n const rootAbs = resolvePath(cwd, groupConfig.root);\n const modulePaths = flattenModuleDeclarations(groupConfig.modules as unknown as ModuleDeclaration[]);\n return { group, rootAbs, modulePaths } satisfies GroupIndexEntry;\n });\n}\n\nfunction normalizePathSegments(input: string): string[] {\n const normalized = input.replace(/\\\\/g, \"/\");\n return normalized.split(\"/\").filter(Boolean);\n}\n\nfunction isPathUnderRoot(fileAbs: string, rootAbs: string): boolean {\n const rel = relative(rootAbs, fileAbs);\n if (rel === \"\") {\n return true;\n }\n return !rel.startsWith(\"..\") && !rel.startsWith(\"../\") && !rel.startsWith(\"..\\\\\");\n}\n\nfunction startsWithSegments(haystack: readonly string[], needle: readonly string[]): boolean {\n if (needle.length > haystack.length) {\n return false;\n }\n for (let i = 0; i < needle.length; i += 1) {\n if (haystack[i] !== needle[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction resolveFileScope(fileAbs: string, groupIndex: readonly GroupIndexEntry[]): FileScope {\n if (fileAbs.startsWith(\"node:\")) {\n return { kind: \"root\" };\n }\n\n for (const entry of groupIndex) {\n if (!isPathUnderRoot(fileAbs, entry.rootAbs)) {\n continue;\n }\n\n const rel = relative(entry.rootAbs, fileAbs);\n const segments = normalizePathSegments(rel);\n\n for (const modulePath of entry.modulePaths) {\n if (startsWithSegments(segments, modulePath)) {\n return {\n kind: \"module\",\n group: entry.group,\n modulePath,\n };\n }\n }\n\n return {\n kind: \"group\",\n group: entry.group,\n };\n }\n\n return { kind: \"root\" };\n}\n\nfunction parseScopeOverrideTag(tags: readonly string[] | undefined):\n | { readonly group: string; readonly modulePath?: readonly string[] }\n | undefined {\n if (!tags || tags.length === 0) {\n return undefined;\n }\n\n for (const tag of tags) {\n const match = tag.match(/^@scope(?::|=|\\()(.+?)(?:\\))?$/u);\n if (!match) {\n continue;\n }\n\n const raw = (match[1] ?? \"\").trim();\n if (!raw) {\n continue;\n }\n\n const normalized = raw.replace(/\\//g, \":\");\n const parts = normalized.split(\":\").filter(Boolean);\n const [group, ...rest] = parts;\n if (!group) {\n continue;\n }\n\n return rest.length > 0\n ? { group, modulePath: rest }\n : { group };\n }\n\n return undefined;\n}\n\nfunction resolveFeatureScope(\n featureAbsPath: string,\n feature: SimpleFeature,\n groupIndex: readonly GroupIndexEntry[]\n): FileScope {\n const override = parseScopeOverrideTag(feature.tags);\n if (override) {\n if (override.modulePath && override.modulePath.length > 0) {\n return { kind: \"module\", group: override.group, modulePath: override.modulePath };\n }\n return { kind: \"group\", group: override.group };\n }\n\n return resolveFileScope(featureAbsPath, groupIndex);\n}\n\nfunction isVisibleStepScope(stepScope: FileScope, featureScope: FileScope): boolean {\n if (featureScope.kind === \"root\") {\n return stepScope.kind === \"root\";\n }\n\n if (featureScope.kind === \"group\") {\n if (stepScope.kind === \"root\") {\n return true;\n }\n return stepScope.kind === \"group\" && stepScope.group === featureScope.group;\n }\n\n // featureScope.kind === \"module\"\n if (stepScope.kind === \"root\") {\n return true;\n }\n if (stepScope.kind === \"group\") {\n return stepScope.group === featureScope.group;\n }\n if (stepScope.kind === \"module\") {\n return stepScope.group === featureScope.group\n && startsWithSegments(featureScope.modulePath, stepScope.modulePath);\n }\n\n return false;\n}\n\nfunction stepScopeRank(scope: FileScope): number {\n switch (scope.kind) {\n case \"module\":\n return 200 + scope.modulePath.length;\n case \"group\":\n return 100;\n default:\n return 0;\n }\n}\n\nfunction collectRepeatedString(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nexport function registerRunCommand(program: Command): Command {\n return program\n .command(\"run\")\n .description(\"Execute Autometa feature files\")\n .argument(\"[patterns...]\", \"Feature files or glob patterns\")\n .option(\n \"--handover\",\n \"Pass through runner args after '--' directly to the detected native runner (vitest/jest/playwright)\"\n )\n .option(\n \"--cache-dir <dir>\",\n \"Directory for Autometa CLI cache (defaults to node_modules/.cache/autometa when available)\"\n )\n .option(\"--dry-run\", \"Collect scenarios without executing steps\")\n .option(\"--watch\", \"Run in watch mode (vitest/jest only)\")\n .option(\"--verbose\", \"Show detailed output including runner detection\")\n .option(\"--standalone\", \"Force standalone runtime instead of native runner\")\n .option(\"-e, --environment <environment>\", \"Select config environment\")\n .option(\n \"-g, --group <group>\",\n \"Filter module groups to include (affects module/step loading; patterns are not auto-scoped)\",\n collectRepeatedString,\n [] as string[]\n )\n .option(\n \"-m, --module <module>\",\n \"Filter modules to include (by id or unambiguous suffix; affects module/step loading; patterns are not auto-scoped)\",\n collectRepeatedString,\n [] as string[]\n )\n .action(async (\n patterns: string[],\n flags: {\n handover?: boolean;\n cacheDir?: string;\n dryRun?: boolean;\n watch?: boolean;\n verbose?: boolean;\n standalone?: boolean;\n module?: string[];\n group?: string[];\n environment?: string;\n }\n ) => {\n try {\n const split = flags?.handover === true\n ? splitPatternsAndRunnerArgs({ patterns, rawArgv: process.argv, handover: true })\n : splitPatternsAndRunnerArgs({ patterns, rawArgv: process.argv });\n\n const summary = await runFeatures({\n cwd: process.cwd(),\n ...(typeof flags?.cacheDir === \"string\" && flags.cacheDir.trim().length > 0\n ? { cacheDir: flags.cacheDir }\n : {}),\n ...(split.patterns.length > 0 ? { patterns: split.patterns } : {}),\n ...(split.runnerArgs.length > 0 ? { runnerArgs: split.runnerArgs } : {}),\n ...(typeof flags?.dryRun === \"boolean\" ? { dryRun: flags.dryRun } : {}),\n ...(typeof flags?.watch === \"boolean\" ? { watch: flags.watch } : {}),\n ...(typeof flags?.verbose === \"boolean\" ? { verbose: flags.verbose } : {}),\n ...(flags?.standalone ? { mode: \"standalone\" as const } : {}),\n ...(typeof flags?.environment === \"string\" && flags.environment.trim().length > 0\n ? { environment: flags.environment }\n : {}),\n ...(Array.isArray(flags?.group) && flags.group.length > 0 ? { groups: flags.group } : {}),\n ...(Array.isArray(flags?.module) && flags.module.length > 0 ? { modules: flags.module } : {}),\n });\n\n if (!summary.success) {\n process.exitCode = 1;\n }\n } catch (error) {\n const output =\n error instanceof Error ? error.stack ?? error.message : String(error);\n // eslint-disable-next-line no-console -- CLI error reporting\n console.error(output);\n process.exitCode = 1;\n }\n });\n}\n\nfunction isScenario(element: SimpleFeature[\"elements\"][number]): boolean {\n return \"steps\" in element && !(\"exampleGroups\" in element) && !(\"elements\" in element);\n}\n\nfunction isScenarioOutline(element: SimpleFeature[\"elements\"][number]): boolean {\n return \"steps\" in element && \"exampleGroups\" in element;\n}\n\nfunction isRule(element: SimpleFeature[\"elements\"][number]): element is SimpleRule {\n return \"elements\" in element && Array.isArray(element.elements);\n}\n\nfunction createFeatureScopePlan<World>(\n feature: SimpleFeature,\n basePlan: ScopePlan<World>,\n options: {\n readonly featureAbsPath: string;\n readonly cwd: string;\n readonly config: ExecutorConfig;\n readonly groupIndex: readonly GroupIndexEntry[];\n }\n): ScopePlan<World> {\n const scopingMode = options.config.modules?.stepScoping ?? \"global\";\n const useScopedSteps = scopingMode === \"scoped\" && options.groupIndex.length > 0;\n\n // Get all steps from base plan as an array for convenience\n const allSteps = Array.from(basePlan.stepsById.values());\n const featureFileScope = useScopedSteps\n ? resolveFeatureScope(options.featureAbsPath, feature, options.groupIndex)\n : ({ kind: \"root\" } as const);\n\n const visibleSteps = useScopedSteps\n ? allSteps\n .filter((definition) => {\n const file = definition.source?.file;\n const stepScope = file\n ? resolveFileScope(resolvePath(options.cwd, file), options.groupIndex)\n : ({ kind: \"root\" } as const);\n return isVisibleStepScope(stepScope, featureFileScope);\n })\n .sort((a, b) => {\n const aFile = a.source?.file;\n const bFile = b.source?.file;\n const aScope = aFile\n ? resolveFileScope(resolvePath(options.cwd, aFile), options.groupIndex)\n : ({ kind: \"root\" } as const);\n const bScope = bFile\n ? resolveFileScope(resolvePath(options.cwd, bFile), options.groupIndex)\n : ({ kind: \"root\" } as const);\n\n const delta = stepScopeRank(bScope) - stepScopeRank(aScope);\n return delta !== 0 ? delta : a.id.localeCompare(b.id);\n })\n : allSteps;\n\n const scopedStepsById = useScopedSteps\n ? (() => {\n const allowed = new Set(visibleSteps.map((step) => step.id));\n const next = new Map<string, (typeof visibleSteps)[number]>();\n for (const [id, def] of basePlan.stepsById.entries()) {\n if (allowed.has(id)) {\n next.set(id, def);\n }\n }\n return next;\n })()\n : basePlan.stepsById;\n\n // Create scenario and rule scope nodes\n const featureChildren: ScopeNode<World>[] = [];\n const scopesById = new Map<string, ScopeNode<World>>(basePlan.scopesById);\n\n for (const element of feature.elements ?? []) {\n if (isScenario(element) || isScenarioOutline(element)) {\n // Direct scenario under feature\n const scenarioScope: ScopeNode<World> = {\n id: element.id ?? element.name,\n kind: isScenarioOutline(element) ? \"scenarioOutline\" : \"scenario\",\n name: element.name,\n mode: \"default\",\n tags: element.tags ?? [],\n steps: visibleSteps,\n hooks: [],\n children: [],\n pending: false,\n };\n featureChildren.push(scenarioScope);\n scopesById.set(scenarioScope.id, scenarioScope);\n } else if (isRule(element)) {\n // Rule with child scenarios\n const ruleChildren: ScopeNode<World>[] = [];\n \n for (const ruleElement of element.elements ?? []) {\n if (isScenario(ruleElement) || isScenarioOutline(ruleElement)) {\n const scenarioScope: ScopeNode<World> = {\n id: ruleElement.id ?? ruleElement.name,\n kind: isScenarioOutline(ruleElement) ? \"scenarioOutline\" : \"scenario\",\n name: ruleElement.name,\n mode: \"default\",\n tags: ruleElement.tags ?? [],\n steps: visibleSteps,\n hooks: [],\n children: [],\n pending: false,\n };\n ruleChildren.push(scenarioScope);\n scopesById.set(scenarioScope.id, scenarioScope);\n }\n }\n \n const ruleScope: ScopeNode<World> = {\n id: element.id ?? element.name,\n kind: \"rule\",\n name: element.name,\n mode: \"default\",\n tags: element.tags ?? [],\n steps: visibleSteps,\n hooks: [],\n children: ruleChildren,\n pending: false,\n };\n featureChildren.push(ruleScope);\n scopesById.set(ruleScope.id, ruleScope);\n }\n }\n\n // Create a feature scope node with scenario and rule children\n const featureScope: ScopeNode<World> = {\n id: feature.uri ?? feature.name,\n kind: \"feature\",\n name: feature.name,\n mode: \"default\",\n tags: feature.tags ?? [],\n steps: visibleSteps,\n hooks: [],\n children: featureChildren,\n pending: false,\n };\n\n // Add feature scope as a child of the existing root scope\n const existingRoot = basePlan.root;\n const updatedRoot: ScopeNode<World> = {\n ...existingRoot,\n children: [...existingRoot.children, featureScope],\n };\n\n // Add feature to the scopes map\n scopesById.set(featureScope.id, featureScope);\n scopesById.set(updatedRoot.id, updatedRoot);\n\n // Return a new scope plan with the updated hierarchy\n const scopePlan: ScopePlan<World> = {\n root: updatedRoot,\n stepsById: scopedStepsById,\n hooksById: basePlan.hooksById,\n scopesById,\n };\n\n if (basePlan.worldFactory) {\n (scopePlan as { worldFactory?: typeof basePlan.worldFactory }).worldFactory = basePlan.worldFactory;\n }\n\n if (basePlan.parameterRegistry) {\n (scopePlan as { parameterRegistry?: typeof basePlan.parameterRegistry }).parameterRegistry = basePlan.parameterRegistry;\n }\n\n return scopePlan;\n}\n\nexport async function runFeatures(options: RunCommandOptions = {}): Promise<RunCommandResult> {\n const cwd = options.cwd ?? process.cwd();\n const cacheDir = options.cacheDir ?? await resolveCliCacheDir(cwd);\n const summaryFormatter = options.summaryFormatter ?? formatSummary;\n const { resolved } = await loadExecutorConfig(cwd, {\n cacheDir,\n ...(typeof options.environment === \"string\" && options.environment.trim().length > 0\n ? { environment: options.environment }\n : {}),\n ...(options.modules ? { modules: [...options.modules] } : {}),\n ...(options.groups ? { groups: [...options.groups] } : {}),\n });\n const executorConfig = resolved.config;\n\n // =========================================================================\n // SMART ORCHESTRATOR: Try native runner first (vitest/jest)\n // =========================================================================\n const mode = options.mode ?? \"native\";\n \n if (mode !== \"standalone\") {\n const orchestratorResult = await orchestrate({\n cwd,\n config: executorConfig,\n ...(options.patterns ? { patterns: options.patterns } : {}),\n ...(options.runnerArgs ? { runnerArgs: options.runnerArgs } : {}),\n ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),\n ...(options.watch !== undefined ? { watch: options.watch } : {}),\n ...(options.verbose !== undefined ? { verbose: options.verbose } : {}),\n });\n\n // If a native runner was used (vitest/jest), return its result\n if (orchestratorResult.runner !== \"default\") {\n return {\n success: orchestratorResult.success,\n total: 0, // Native runner handles its own reporting\n passed: 0,\n failed: 0,\n skipped: 0,\n pending: 0,\n durationMs: 0,\n scenarios: [],\n };\n }\n\n // Native runner not available or not configured - fall through to standalone\n if (options.verbose) {\n console.log(\"[autometa] Using standalone runtime\");\n }\n }\n\n // =========================================================================\n // STANDALONE RUNTIME: Built-in CLI execution\n // =========================================================================\n const hierarchicalBufferOutput = executorConfig.reporting?.hierarchical?.bufferOutput;\n const reporterOptions: RuntimeOptions[\"reporter\"] | undefined =\n hierarchicalBufferOutput !== undefined\n ? { hierarchical: { bufferOutput: hierarchicalBufferOutput } }\n : undefined;\n const runtimeOptions: RuntimeOptions = {\n ...(typeof options.dryRun === \"boolean\" ? { dryRun: options.dryRun } : {}),\n ...(options.reporters ? { reporters: options.reporters } : {}),\n ...(reporterOptions ? { reporter: reporterOptions } : {}),\n };\n const { runtime, hookLogger, execute } = createCliRuntime(runtimeOptions);\n configureHttpLogging(executorConfig.logging);\n\n const hasModuleSelection = (options.groups?.length ?? 0) > 0 || (options.modules?.length ?? 0) > 0;\n const hasExplicitPatterns = (options.patterns?.length ?? 0) > 0;\n\n if (hasExplicitPatterns && hasModuleSelection) {\n const patterns = [...(options.patterns ?? [])];\n\n const shouldWarn = (() => {\n const groups = executorConfig.modules?.groups;\n if (!groups) {\n return true;\n }\n\n // If groups were explicitly selected and we can determine group roots, only warn\n // when the provided patterns clearly extend beyond the allowed group roots.\n if ((options.groups?.length ?? 0) > 0) {\n const allowedGroups = new Set(options.groups);\n const allowedRoots = Object.entries(groups)\n .filter(([group]) => allowedGroups.has(group))\n .map(([, groupConfig]) => groupConfig.root);\n\n if (allowedRoots.length > 0) {\n return patterns.some((pattern) =>\n !allowedRoots.some((root) => patternIsUnderRoot(pattern, root))\n );\n }\n }\n\n // If we can't confidently assess scope, warn to avoid surprising runs.\n return true;\n })();\n\n if (shouldWarn) {\n // eslint-disable-next-line no-console -- CLI warning\n console.warn(\n \"[autometa] Note: when you pass explicit feature patterns, they are used as-is. \" +\n \"Group/module filters (-g/-m) affect module/step loading, but do not automatically filter your feature patterns.\"\n );\n }\n }\n\n const patternSource = (() => {\n if (hasExplicitPatterns) {\n return [...(options.patterns ?? [])];\n }\n\n const roots = [...executorConfig.roots.features];\n\n // When the user opts into module selection (-g/-m), the expectation is typically\n // \"run the selected modules\" rather than \"run everything including hoisted/root features\".\n // So we narrow default feature discovery to module group roots.\n if (hasModuleSelection && executorConfig.modules?.groups) {\n const allowedGroups = (options.groups?.length ?? 0) > 0\n ? new Set(options.groups)\n : new Set(Object.keys(executorConfig.modules.groups));\n\n const allowedRoots = Object.entries(executorConfig.modules.groups)\n .filter(([group]) => allowedGroups.has(group))\n .map(([, groupConfig]) => groupConfig.root);\n\n const filtered = roots.filter((pattern) =>\n allowedRoots.some((root) => patternIsUnderRoot(pattern, root))\n );\n\n // If we couldn't confidently filter (e.g. unusual config), fall back to current behavior.\n if (filtered.length > 0) {\n return filtered;\n }\n }\n\n return roots;\n })();\n\n const featurePatterns = buildPatterns(patternSource, FEATURE_FALLBACK_GLOB);\n const featureFiles = (await expandFilePatterns(featurePatterns, cwd)).filter((file) =>\n file.toLowerCase().endsWith(\".feature\")\n );\n\n if (featureFiles.length === 0) {\n throw new Error(\n `No feature files found for patterns: ${patternSource.map((pattern) => `\"${pattern}\"`).join(\", \")}`\n );\n }\n\n const builder = CucumberRunner.builder<GlobalWorld>();\n let stepsEnvironments: readonly RunnerStepsSurface<GlobalWorld>[] = [builder.steps()];\n\n const modulePlan = await createModulePlan(executorConfig, cwd);\n const compileOptions: Parameters<typeof compileModules>[1] = executorConfig.builder\n ? { cwd, cacheDir, builder: executorConfig.builder }\n : { cwd, cacheDir };\n const compileResult = await compileModules(modulePlan.orderedFiles, compileOptions);\n\n if (modulePlan.orderedFiles.length > 0) {\n const imported = await import(pathToFileURL(compileResult.bundlePath).href);\n const resolved = collectStepsEnvironments(imported);\n if (resolved.length > 0) {\n stepsEnvironments = resolved;\n }\n }\n\n const groupIndex = buildGroupIndex(executorConfig, cwd);\n const environmentIndex = indexStepsEnvironments(stepsEnvironments, cwd, groupIndex);\n\n for (const featurePath of featureFiles) {\n const feature = await readFeatureFile(featurePath, cwd);\n const featureAbsPath = resolvePath(cwd, featurePath);\n const selectedStepsEnvironment = resolveFeatureStepsEnvironment(\n featureAbsPath,\n feature,\n environmentIndex,\n groupIndex\n );\n\n // Keep legacy compatibility for any code that relies on CucumberRunner.steps().\n CucumberRunner.setSteps(selectedStepsEnvironment);\n\n const basePlan = selectedStepsEnvironment.getPlan();\n const scopePlan = createFeatureScopePlan(feature, basePlan, {\n featureAbsPath,\n cwd,\n config: executorConfig,\n groupIndex,\n });\n const coordinated = selectedStepsEnvironment.coordinateFeature({\n feature,\n plan: scopePlan,\n config: executorConfig,\n runtime,\n hookLogger,\n });\n coordinated.register(runtime);\n }\n\n const summary = await execute();\n logSummary(summary, resolved.environment, summaryFormatter);\n\n return summary;\n}\n\ntype ModuleLike = Record<string, unknown>;\n\nfunction collectStepsEnvironments(imported: unknown): readonly RunnerStepsSurface<GlobalWorld>[] {\n const candidates = collectCandidateModules(imported);\n const environments = new Set<RunnerStepsSurface<GlobalWorld>>();\n for (const candidate of candidates) {\n const extracted = extractStepsEnvironments(candidate);\n for (const env of extracted) {\n environments.add(env);\n }\n }\n return Array.from(environments);\n}\n\nfunction collectCandidateModules(imported: unknown): readonly ModuleLike[] {\n if (!imported || typeof imported !== \"object\") {\n return [];\n }\n\n const record = imported as ModuleLike;\n const modules = new Set<ModuleLike>();\n modules.add(record);\n\n const exportedModules = record.modules;\n if (Array.isArray(exportedModules)) {\n for (const entry of exportedModules) {\n if (entry && typeof entry === \"object\") {\n modules.add(entry as ModuleLike);\n }\n }\n }\n\n const defaultExport = record.default;\n if (Array.isArray(defaultExport)) {\n for (const entry of defaultExport) {\n if (entry && typeof entry === \"object\") {\n modules.add(entry as ModuleLike);\n }\n }\n } else if (defaultExport && typeof defaultExport === \"object\") {\n modules.add(defaultExport as ModuleLike);\n }\n\n return Array.from(modules);\n}\n\nfunction extractStepsEnvironments(candidate: ModuleLike): readonly RunnerStepsSurface<GlobalWorld>[] {\n const environments: RunnerStepsSurface<GlobalWorld>[] = [];\n\n if (isStepsEnvironment(candidate)) {\n environments.push(candidate);\n }\n\n const steps = candidate.stepsEnvironment;\n if (isStepsEnvironment(steps)) {\n environments.push(steps);\n }\n\n const defaultExport = candidate.default;\n if (isStepsEnvironment(defaultExport)) {\n environments.push(defaultExport);\n }\n\n return environments;\n}\n\ntype StepsEnvironmentIndexEntry =\n | { readonly kind: \"root\"; readonly environment: RunnerStepsSurface<GlobalWorld> }\n | { readonly kind: \"group\"; readonly group: string; readonly environment: RunnerStepsSurface<GlobalWorld> };\n\nfunction inferEnvironmentGroup(\n environment: RunnerStepsSurface<GlobalWorld>,\n cwd: string,\n groupIndex: readonly GroupIndexEntry[]\n): { readonly kind: \"root\" } | { readonly kind: \"group\"; readonly group: string } | { readonly kind: \"ambiguous\" } {\n const meta = (environment as unknown as Record<PropertyKey, unknown>)[STEPS_ENVIRONMENT_META] as\n | { readonly kind?: unknown; readonly group?: unknown }\n | undefined;\n if (meta?.kind === \"group\" && typeof meta.group === \"string\" && meta.group.trim().length > 0) {\n return { kind: \"group\", group: meta.group };\n }\n if (meta?.kind === \"root\") {\n return { kind: \"root\" };\n }\n\n const plan = environment.getPlan();\n const groups = new Set<string>();\n\n for (const step of plan.stepsById.values()) {\n const file = step.source?.file;\n if (!file) {\n continue;\n }\n const scope = resolveFileScope(resolvePath(cwd, file), groupIndex);\n if (scope.kind === \"group\" || scope.kind === \"module\") {\n groups.add(scope.group);\n }\n if (groups.size > 1) {\n return { kind: \"ambiguous\" };\n }\n }\n\n const only = Array.from(groups.values())[0];\n return only ? { kind: \"group\", group: only } : { kind: \"root\" };\n}\n\nfunction indexStepsEnvironments(\n environments: readonly RunnerStepsSurface<GlobalWorld>[],\n cwd: string,\n groupIndex: readonly GroupIndexEntry[]\n): readonly StepsEnvironmentIndexEntry[] {\n const entries: StepsEnvironmentIndexEntry[] = [];\n for (const env of environments) {\n const inferred = inferEnvironmentGroup(env, cwd, groupIndex);\n if (inferred.kind === \"ambiguous\") {\n continue;\n }\n entries.push(\n inferred.kind === \"group\"\n ? { kind: \"group\", group: inferred.group, environment: env }\n : { kind: \"root\", environment: env }\n );\n }\n return entries;\n}\n\nfunction resolveFeatureStepsEnvironment(\n featureAbsPath: string,\n feature: SimpleFeature,\n environments: readonly StepsEnvironmentIndexEntry[],\n groupIndex: readonly GroupIndexEntry[]\n): RunnerStepsSurface<GlobalWorld> {\n const featureScope = resolveFeatureScope(featureAbsPath, feature, groupIndex);\n if (featureScope.kind === \"root\") {\n const root = environments.find((entry) => entry.kind === \"root\");\n return root?.environment ?? environments[0]?.environment ?? CucumberRunner.steps<GlobalWorld>();\n }\n\n const group = featureScope.group;\n const match = environments.find((entry) => entry.kind === \"group\" && entry.group === group);\n if (match) {\n return match.environment;\n }\n\n const available = environments\n .filter((entry) => entry.kind === \"group\")\n .map((entry) => (entry as { kind: \"group\"; group: string }).group)\n .sort();\n\n throw new Error(\n `No steps environment found for group \"${group}\". Available groups: ${available.length > 0 ? available.join(\", \") : \"<none>\"}`\n );\n}\n\nfunction isStepsEnvironment(value: unknown): value is RunnerStepsSurface<GlobalWorld> {\n if (!value || typeof value !== \"object\") {\n return false;\n }\n\n const candidate = value as ModuleLike;\n return typeof candidate.coordinateFeature === \"function\"\n && typeof candidate.Given === \"function\"\n && typeof candidate.When === \"function\"\n && typeof candidate.Then === \"function\";\n}\n\ninterface ModulePlan {\n readonly orderedFiles: readonly string[];\n}\n\nasync function createModulePlan(config: ExecutorConfig, cwd: string): Promise<ModulePlan> {\n const orderedFiles: string[] = [];\n const seenFiles = new Set<string>();\n const processed = new Set<string>([\"features\", \"steps\"]);\n const rootsRecord = config.roots as Record<string, readonly string[] | undefined>;\n\n const pushFiles = (files: readonly string[]): void => {\n for (const file of files) {\n if (seenFiles.has(file)) {\n continue;\n }\n seenFiles.add(file);\n orderedFiles.push(file);\n }\n };\n\n const eventFiles = await resolveRootFiles(config.events ?? [], cwd);\n if (eventFiles.length > 0) {\n pushFiles(eventFiles);\n }\n\n for (const key of ROOT_LOAD_ORDER) {\n const entries = rootsRecord[key];\n if (!entries || entries.length === 0) {\n processed.add(key);\n continue;\n }\n const files = await resolveRootFiles(entries, cwd);\n if (files.length > 0) {\n pushFiles(files);\n }\n processed.add(key);\n }\n\n for (const [key, entries] of Object.entries(rootsRecord)) {\n if (processed.has(key)) {\n continue;\n }\n if (!entries || entries.length === 0) {\n continue;\n }\n const files = await resolveRootFiles(entries, cwd);\n if (files.length > 0) {\n pushFiles(files);\n }\n }\n\n const stepFiles = await resolveRootFiles(config.roots.steps, cwd);\n pushFiles(stepFiles);\n\n return {\n orderedFiles,\n };\n}\n\nasync function resolveRootFiles(entries: readonly string[], cwd: string): Promise<string[]> {\n const patterns = buildPatterns(entries, STEP_FALLBACK_GLOB);\n if (patterns.length === 0) {\n return [];\n }\n const matches = await expandFilePatterns(patterns, cwd);\n return filterCodeFiles(matches);\n}\nfunction buildPatterns(entries: readonly string[], fallbackGlob: string): string[] {\n const patterns = new Set<string>();\n for (const entry of entries) {\n const normalized = entry.trim();\n if (!normalized) {\n continue;\n }\n for (const pattern of toPatterns(normalized, fallbackGlob)) {\n patterns.add(pattern);\n }\n }\n return Array.from(patterns);\n}\n\nfunction toPatterns(entry: string, fallbackGlob: string): string[] {\n if (hasGlobMagic(entry) || hasFileExtension(entry)) {\n return [entry];\n }\n\n return [appendGlob(entry, fallbackGlob)];\n}\n\nfunction hasGlobMagic(input: string): boolean {\n return /[*?{}()[\\]!,@+]/.test(input);\n}\n\nfunction hasFileExtension(input: string): boolean {\n const normalized = input.replace(/\\\\/g, \"/\");\n const trimmed = normalized === \"/\" ? \"/\" : normalized.replace(/\\/+$/u, \"\");\n if (!trimmed || trimmed === \".\" || trimmed === \"..\") {\n return false;\n }\n return Boolean(extname(trimmed));\n}\n\nfunction appendGlob(entry: string, glob: string): string {\n const normalized = entry.replace(/\\\\/g, \"/\");\n const trimmed = normalized === \"/\" ? \"/\" : normalized.replace(/\\/+$/u, \"\");\n if (!trimmed || trimmed === \".\") {\n return glob;\n }\n if (trimmed === \"/\") {\n return `/${glob}`;\n }\n return `${trimmed}/${glob}`;\n}\n\nfunction filterCodeFiles(files: readonly string[]): string[] {\n return files.filter((file) => {\n const lower = file.toLowerCase();\n if (lower.endsWith(\".d.ts\")) {\n return false;\n }\n const dotIndex = lower.lastIndexOf(\".\");\n if (dotIndex === -1) {\n return false;\n }\n const extension = lower.slice(dotIndex);\n return STEP_FILE_EXTENSIONS.has(extension);\n });\n}\n\nasync function readFeatureFile(path: string, cwd: string): Promise<SimpleFeature> {\n const source = await fs.readFile(path, \"utf8\");\n const feature = parseGherkin(source);\n if (!feature.uri) {\n const relativePath = relative(cwd, path);\n const candidate = relativePath.startsWith(\"..\") ? path : relativePath;\n // Normalize for cross-platform consistency (Windows paths may contain backslashes)\n feature.uri = candidate.replace(/\\\\/g, \"/\");\n }\n return feature;\n}\n\nfunction logSummary(\n summary: RuntimeSummary,\n environment: string,\n formatter: SummaryFormatter\n): void {\n // eslint-disable-next-line no-console -- CLI summary output\n console.log(formatter(summary, { environment }));\n}\n\nfunction configureHttpLogging(logging: LoggingConfig | undefined): void {\n if (!logging?.http) {\n return;\n }\n\n const registered = HTTP.getSharedPlugins();\n if (registered.some((plugin) => plugin.name === \"http-logging\")) {\n return;\n }\n\n HTTP.registerSharedPlugin(createLoggingPlugin(logHttpEvent));\n}\n\nfunction logHttpEvent(event: HTTPLogEvent): void {\n const timestamp = new Date(event.timestamp).toISOString();\n const url = resolveRequestUrl(event.request);\n\n switch (event.type) {\n case \"request\": {\n const method = event.request.method ?? \"<unknown>\";\n console.log(`[HTTP ${timestamp}] → ${method} ${url}`);\n break;\n }\n case \"response\": {\n const status = event.response.status;\n console.log(`[HTTP ${timestamp}] ← ${status} ${url}`);\n break;\n }\n case \"error\": {\n const message =\n event.error instanceof Error ? event.error.message : String(event.error);\n console.error(`[HTTP ${timestamp}] ! ${url} ${message}`);\n break;\n }\n }\n}\n\nfunction resolveRequestUrl(request: HTTPLogEvent[\"request\"]): string {\n const url = request.fullUrl;\n if (url) {\n return url;\n }\n\n if (request.baseUrl && request.route && request.route.length > 0) {\n const normalizedRoute = request.route.join(\"/\");\n return `${request.baseUrl.replace(/\\/?$/u, \"\")}/${normalizedRoute}`;\n }\n\n if (request.baseUrl) {\n return request.baseUrl;\n }\n\n if (request.route && request.route.length > 0) {\n return request.route.join(\"/\");\n }\n\n return \"<unknown>\";\n}\n","import { builtinModules } from \"node:module\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { mkdir, rm, writeFile } from \"node:fs/promises\";\n\nimport { build } from \"esbuild\";\nimport type { BuildOptions } from \"esbuild\";\nimport type {\n BuildHook,\n BuildHookContext,\n BuilderConfig,\n ModuleFormat,\n SourceMapSetting,\n} from \"@autometa/config\";\n\nexport interface CompileModulesOptions {\n readonly cwd: string;\n readonly cacheDir: string;\n readonly builder?: BuilderConfig;\n}\n\nexport interface CompileModulesResult {\n readonly bundlePath: string;\n readonly outDir?: string;\n readonly format: ModuleFormat;\n}\n\nconst DEFAULT_FORMAT: ModuleFormat = \"cjs\";\nconst DEFAULT_TARGET = \"node20\";\nconst DEFAULT_SOURCEMAP: SourceMapSetting = \"inline\";\nconst DEFAULT_EXTERNALS = [\n \"p-limit\",\n \"@autometa/*\",\n \"@cucumber/*\",\n];\n\nconst BUILTIN_EXTERNALS = new Set<string>([\n ...builtinModules,\n ...builtinModules.map((moduleId) => `node:${moduleId}`),\n]);\n\nexport async function compileModules(\n orderedEntries: readonly string[],\n options: CompileModulesOptions\n): Promise<CompileModulesResult> {\n const format = options.builder?.format ?? DEFAULT_FORMAT;\n const target = options.builder?.target ?? DEFAULT_TARGET;\n const esbuildTarget: string | string[] = Array.isArray(target)\n ? [...target] as string[]\n : target;\n const sourcemap = options.builder?.sourcemap ?? DEFAULT_SOURCEMAP;\n const tsconfig = options.builder?.tsconfig\n ? resolve(options.cwd, options.builder.tsconfig)\n : undefined;\n const userExternal = options.builder?.external ?? [];\n const external = Array.from(\n new Set<string>([...BUILTIN_EXTERNALS, ...DEFAULT_EXTERNALS, ...userExternal])\n );\n const baseOutDir = resolveOutputBase(options);\n const outDir = join(baseOutDir, format);\n const entryFile = await createAggregateEntryFile(orderedEntries, options);\n\n await ensureOutputDirectory(outDir, format);\n\n const resolvedEntries = orderedEntries.map((entry) =>\n isAbsolute(entry) ? entry : resolve(options.cwd, entry)\n );\n\n const hookContext: BuildHookContext = {\n cwd: options.cwd,\n cacheDir: options.cacheDir,\n outDir,\n entries: resolvedEntries,\n format,\n ...(target !== undefined ? { target } : {}),\n ...(sourcemap !== undefined ? { sourcemap } : {}),\n ...(tsconfig ? { tsconfig } : {}),\n ...(external.length > 0 ? { external } : {}),\n };\n\n await runHooks(options.builder?.hooks?.before, hookContext);\n\n if (resolvedEntries.length > 0) {\n const entryName = \"__autometa_entry__\";\n const bundleFileName = format === \"esm\" ? \"__modules__.mjs\" : \"__modules__.cjs\";\n const outfile = join(outDir, bundleFileName);\n const buildOptions: BuildOptions = {\n absWorkingDir: options.cwd,\n entryPoints: {\n [entryName]: entryFile,\n },\n outfile,\n bundle: true,\n format,\n platform: \"node\",\n target: esbuildTarget,\n sourcemap,\n splitting: false,\n write: true,\n external,\n logLevel: \"silent\",\n treeShaking: false,\n ...(tsconfig ? { tsconfig } : {}),\n };\n await build(buildOptions);\n\n await runHooks(options.builder?.hooks?.after, hookContext);\n\n return {\n bundlePath: outfile,\n outDir,\n format,\n };\n }\n\n await runHooks(options.builder?.hooks?.after, hookContext);\n\n return {\n bundlePath: entryFile,\n format,\n };\n}\n\nfunction resolveOutputBase(options: CompileModulesOptions): string {\n if (!options.builder?.outDir) {\n return join(options.cacheDir, \"modules\");\n }\n\n const configured = options.builder.outDir;\n return isAbsolute(configured) ? configured : resolve(options.cwd, configured);\n}\n\nasync function ensureOutputDirectory(outDir: string, format: ModuleFormat): Promise<void> {\n await rm(outDir, { recursive: true, force: true });\n await mkdir(outDir, { recursive: true });\n const packageJsonPath = join(outDir, \"package.json\");\n const typeField = format === \"esm\" ? \"module\" : \"commonjs\";\n await writeFile(packageJsonPath, JSON.stringify({ type: typeField }, null, 2), \"utf8\");\n}\n\nasync function createAggregateEntryFile(entries: readonly string[], options: CompileModulesOptions): Promise<string> {\n if (entries.length === 0) {\n const stubPath = join(options.cacheDir, \"modules\", \"__noop__.ts\");\n await mkdir(join(options.cacheDir, \"modules\"), { recursive: true });\n await writeFile(stubPath, \"export {};\", \"utf8\");\n return stubPath;\n }\n\n const modulesDir = join(options.cacheDir, \"modules\");\n await mkdir(modulesDir, { recursive: true });\n\n const aggregatePath = join(modulesDir, \"__entry__.ts\");\n const uniqueEntries = Array.from(new Set(entries.map((entry) =>\n isAbsolute(entry) ? entry : resolve(options.cwd, entry)\n )));\n\n const moduleIdentifiers = uniqueEntries.map((_, index) => `module_${index}`);\n const imports = uniqueEntries\n .map((entry, index) => `import * as ${moduleIdentifiers[index]} from ${JSON.stringify(entry)};`)\n .join(\"\\n\");\n\n // Search for a module that exports stepsEnvironment\n // Create a helper function that prevents esbuild from constant-folding property accesses\n const stepsChecks = moduleIdentifiers.map((id) => {\n return ` const val_${id} = ${id}['stepsEnvironment'];\n if (val_${id}) return val_${id};`;\n }).join('\\n');\n\n const contents = `${imports}\n\nfunction __findStepsEnvironment() {\n${stepsChecks}\n return undefined;\n}\n\nexport const stepsEnvironment = __findStepsEnvironment();\nexport const modules = [${moduleIdentifiers.join(', ')}];\nexport default modules;\\n`;\n\n await writeFile(aggregatePath, contents, \"utf8\");\n\n return aggregatePath;\n}\n\nasync function runHooks(\n hooks: readonly BuildHook[] | undefined,\n context: BuildHookContext\n): Promise<void> {\n if (!hooks || hooks.length === 0) {\n return;\n }\n\n for (const hook of hooks) {\n await hook(context);\n }\n}\n","import \"source-map-support/register\";\n\nimport type {\n ExecutorRuntime,\n HookHandler,\n HookLogListener,\n SuiteFn,\n TestFn,\n} from \"@autometa/executor\";\n\nimport type { RuntimeSummary, ScenarioReport } from \"./types\";\nimport {\n HierarchicalReporter,\n type HierarchicalReporterOptions,\n type RuntimeReporter,\n type RunEndEvent,\n type RunStartEvent,\n type SuiteLifecycleEvent,\n type TestResultEvent,\n} from \"../utils/reporter\";\n\nexport type { RuntimeSummary, ScenarioReport } from \"./types\";\n\ntype Clock = {\n now(): number;\n};\n\nconst clock: Clock =\n typeof globalThis.performance?.now === \"function\"\n ? globalThis.performance\n : { now: () => Date.now() };\n\nexport interface RuntimeOptions {\n readonly dryRun?: boolean;\n readonly reporters?: readonly RuntimeReporter[];\n readonly reporter?: {\n readonly hierarchical?: HierarchicalReporterOptions;\n };\n}\n\ntype SuiteMode = \"default\" | \"skip\" | \"only\" | \"concurrent\";\ntype TestKind = \"test\" | \"todo\" | \"pending\";\n\ninterface SuiteNode {\n readonly title: string;\n mode: SuiteMode;\n readonly timeout?: number;\n readonly parent?: SuiteNode;\n readonly children: Array<SuiteChild>;\n readonly metadata?: SuiteMetadata;\n}\n\ntype SuiteChild =\n | { readonly kind: \"suite\"; readonly node: SuiteNode }\n | { readonly kind: \"test\"; readonly node: TestNode };\n\ninterface TestNode {\n readonly title: string;\n readonly timeout?: number;\n readonly handler?: () => void | Promise<void>;\n readonly mode: SuiteMode;\n readonly kind: TestKind;\n readonly reason?: string;\n}\n\ninterface ExecutionContext {\n readonly skip: boolean;\n readonly focus: boolean;\n readonly path: readonly string[];\n}\n\ntype SuiteMetadata = {\n readonly kind?: \"feature\" | \"rule\" | \"scenarioOutline\" | \"examples\";\n readonly keyword?: string;\n};\n\ntype SuiteFnWithMetadata = SuiteFn & {\n __withMetadata?: (metadata: SuiteMetadata | undefined, register: () => void) => void;\n};\n\nexport function createCliRuntime(options: RuntimeOptions = {}): {\n readonly runtime: ExecutorRuntime;\n readonly hookLogger: HookLogListener;\n execute(): Promise<RuntimeSummary>;\n} {\n const root: SuiteNode = {\n title: \"(root)\",\n mode: \"default\",\n children: [],\n };\n let currentSuite = root;\n let hasFocusedBlock = false;\n let currentTestName: string | undefined;\n\n const state = {\n total: 0,\n passed: 0,\n failed: 0,\n skipped: 0,\n pending: 0,\n success: true,\n };\n\n let emitHookLog: HookLogListener = () => undefined;\n let pendingSuiteMetadata: SuiteMetadata | undefined;\n\n const assignMetadataHandler = (target: SuiteFn): SuiteFnWithMetadata => {\n const fn = target as SuiteFnWithMetadata;\n fn.__withMetadata = (metadata, register) => {\n const previous = pendingSuiteMetadata;\n pendingSuiteMetadata = metadata;\n try {\n register();\n } finally {\n pendingSuiteMetadata = previous;\n }\n };\n return fn;\n };\n\n\n function registerSuite(\n mode: SuiteMode,\n title: string,\n handler?: () => void,\n timeout?: number\n ): void {\n const metadata = pendingSuiteMetadata;\n const node: SuiteNode = {\n title,\n mode,\n ...(timeout !== undefined ? { timeout } : {}),\n ...(currentSuite === root ? {} : { parent: currentSuite }),\n children: [],\n ...(metadata ? { metadata: { ...metadata } } : {}),\n };\n\n currentSuite.children.push({ kind: \"suite\", node });\n\n if (mode === \"only\") {\n hasFocusedBlock = true;\n }\n\n if (mode === \"skip\" || !handler) {\n return;\n }\n\n const previous = currentSuite;\n currentSuite = node;\n try {\n handler();\n } finally {\n currentSuite = previous;\n }\n }\n\n function registerTest(entry: {\n readonly title: string;\n readonly handler?: () => void | Promise<void>;\n readonly timeout?: number;\n readonly mode: SuiteMode;\n readonly kind: TestKind;\n readonly reason?: string;\n }): void {\n const node: TestNode = {\n title: entry.title,\n mode: entry.mode,\n kind: entry.kind,\n ...(entry.handler ? { handler: entry.handler } : {}),\n ...(entry.timeout !== undefined ? { timeout: entry.timeout } : {}),\n ...(entry.reason !== undefined ? { reason: entry.reason } : {}),\n };\n\n if (node.mode === \"only\") {\n hasFocusedBlock = true;\n }\n currentSuite.children.push({ kind: \"test\", node });\n }\n\n const suiteDefault = assignMetadataHandler(((title: string, handler: () => void, timeout?: number) => {\n registerSuite(\"default\", title, handler, timeout);\n }) as SuiteFn);\n\n const suiteSkip = assignMetadataHandler(((title: string, _handler: () => void, timeout?: number) => {\n registerSuite(\"skip\", title, undefined, timeout);\n }) as SuiteFn);\n\n const suiteOnly = assignMetadataHandler(((title: string, handler: () => void, timeout?: number) => {\n registerSuite(\"only\", title, handler, timeout);\n }) as SuiteFn);\n\n const suiteConcurrent = assignMetadataHandler(((title: string, handler: () => void, timeout?: number) => {\n registerSuite(\"concurrent\", title, handler, timeout);\n }) as SuiteFn);\n\n suiteDefault.skip = suiteSkip;\n suiteDefault.only = suiteOnly;\n suiteDefault.concurrent = suiteConcurrent;\n\n suiteSkip.skip = suiteSkip;\n suiteSkip.only = suiteOnly;\n suiteSkip.concurrent = suiteConcurrent;\n\n suiteOnly.skip = suiteSkip;\n suiteOnly.only = suiteOnly;\n suiteOnly.concurrent = suiteConcurrent;\n\n suiteConcurrent.skip = suiteSkip;\n suiteConcurrent.only = suiteOnly;\n suiteConcurrent.concurrent = suiteConcurrent;\n\n const suite = suiteDefault;\n\n const testDefault = ((\n title: string,\n handler: () => void | Promise<void>,\n timeout?: number\n ) => {\n registerTest({\n title,\n handler,\n ...(timeout !== undefined ? { timeout } : {}),\n mode: \"default\",\n kind: \"test\",\n });\n }) as TestFn;\n\n const testSkip = ((title: string, _handler?: () => void, timeout?: number) => {\n registerTest({\n title,\n ...(timeout !== undefined ? { timeout } : {}),\n mode: \"skip\",\n kind: \"test\",\n });\n }) as TestFn;\n\n const testOnly = ((\n title: string,\n handler: () => void | Promise<void>,\n timeout?: number\n ) => {\n registerTest({\n title,\n handler,\n ...(timeout !== undefined ? { timeout } : {}),\n mode: \"only\",\n kind: \"test\",\n });\n }) as TestFn;\n\n const testConcurrent = ((\n title: string,\n handler: () => void | Promise<void>,\n timeout?: number\n ) => {\n registerTest({\n title,\n handler,\n ...(timeout !== undefined ? { timeout } : {}),\n mode: \"concurrent\",\n kind: \"test\",\n });\n }) as TestFn;\n\n testDefault.skip = testSkip;\n testDefault.only = testOnly;\n testDefault.concurrent = testConcurrent;\n\n testSkip.skip = testSkip;\n testSkip.only = testOnly;\n testSkip.concurrent = testConcurrent;\n\n testOnly.skip = testSkip;\n testOnly.only = testOnly;\n testOnly.concurrent = testConcurrent;\n\n testConcurrent.skip = testSkip;\n testConcurrent.only = testOnly;\n testConcurrent.concurrent = testConcurrent;\n\n testDefault.todo = (title: string, reason?: string) => {\n registerTest({\n title,\n mode: \"skip\",\n kind: \"todo\",\n ...(reason !== undefined ? { reason } : {}),\n });\n };\n\n testDefault.pending = (title: string, reason?: string) => {\n registerTest({\n title,\n mode: \"skip\",\n kind: \"pending\",\n ...(reason !== undefined ? { reason } : {}),\n });\n };\n\n testSkip.todo = testDefault.todo;\n testSkip.pending = testDefault.pending;\n testOnly.todo = testDefault.todo;\n testOnly.pending = testDefault.pending;\n testConcurrent.todo = testDefault.todo;\n testConcurrent.pending = testDefault.pending;\n\n const test = testDefault;\n\n function invokeHook(handler: HookHandler): void {\n const outcome = handler();\n if (outcome && typeof (outcome as Promise<unknown>).then === \"function\") {\n void (outcome as Promise<unknown>).catch((error) => {\n console.error(error);\n });\n }\n }\n\n const runtime: ExecutorRuntime = {\n suite,\n test,\n beforeAll(handler: HookHandler): void {\n invokeHook(handler);\n },\n afterAll(handler: HookHandler): void {\n invokeHook(handler);\n },\n beforeEach(handler: HookHandler): void {\n invokeHook(handler);\n },\n afterEach(handler: HookHandler): void {\n invokeHook(handler);\n },\n currentTestName: () => currentTestName,\n };\n\n const hookLogger: HookLogListener = (event) => {\n emitHookLog(event);\n };\n\n async function execute(): Promise<RuntimeSummary> {\n const startedAt = clock.now();\n const reports: ScenarioReport[] = [];\n const reporters: RuntimeReporter[] = [\n ...(options.reporters\n ? [...options.reporters]\n : [new HierarchicalReporter(undefined, options.reporter?.hierarchical)]),\n ];\n\n emitHookLog = (event) => {\n for (const reporter of reporters) {\n if (typeof reporter.onHookLog === \"function\") {\n reporter.onHookLog(event);\n }\n }\n };\n\n await dispatchRunStart({ timestamp: startedAt });\n\n await runSuite(root, {\n skip: false,\n focus: false,\n path: [],\n });\n\n const finishedAt = clock.now();\n const summary: RuntimeSummary = {\n total: state.total,\n passed: state.passed,\n failed: state.failed,\n skipped: state.skipped,\n pending: state.pending,\n durationMs: finishedAt - startedAt,\n success: state.success,\n scenarios: reports,\n };\n\n await dispatchRunEnd({ timestamp: finishedAt, summary });\n\n emitHookLog = () => undefined;\n\n return summary;\n\n async function runSuite(node: SuiteNode, context: ExecutionContext): Promise<void> {\n const skip = context.skip || node.mode === \"skip\";\n const focus = context.focus || node.mode === \"only\";\n const suitePath = node.parent ? [...context.path, node.title] : context.path;\n\n const shouldTrack = node.title && node.title !== \"(root)\";\n if (shouldTrack) {\n await dispatchSuiteStart({\n title: node.title,\n ancestors: context.path,\n path: suitePath,\n ...(node.metadata?.kind ? { kind: node.metadata.kind } : {}),\n ...(node.metadata?.keyword ? { keyword: node.metadata.keyword } : {}),\n });\n }\n\n for (const child of node.children) {\n if (child.kind === \"suite\") {\n await runSuite(child.node, { skip, focus, path: suitePath });\n continue;\n }\n await runTest(child.node, suitePath, skip, focus);\n }\n\n if (shouldTrack) {\n await dispatchSuiteEnd({\n title: node.title,\n ancestors: context.path,\n path: suitePath,\n ...(node.metadata?.kind ? { kind: node.metadata.kind } : {}),\n ...(node.metadata?.keyword ? { keyword: node.metadata.keyword } : {}),\n });\n }\n }\n\n async function runTest(\n node: TestNode,\n ancestors: readonly string[],\n skipBranch: boolean,\n focusBranch: boolean\n ): Promise<void> {\n const suitePath = [...ancestors];\n const fullPath = [...suitePath, node.title];\n const fullName = fullPath.join(\" › \");\n\n if (node.kind === \"todo\" || node.kind === \"pending\") {\n await record({\n status: \"pending\",\n name: node.title,\n fullName,\n path: suitePath,\n ...(node.reason !== undefined ? { reason: node.reason } : {}),\n });\n return;\n }\n\n const skipDueToFocus = hasFocusedBlock && !focusBranch && node.mode !== \"only\";\n const shouldSkip = skipBranch || node.mode === \"skip\" || skipDueToFocus;\n\n if (options.dryRun) {\n await record({\n status: \"pending\",\n name: node.title,\n fullName,\n path: suitePath,\n reason: \"dry run\",\n });\n return;\n }\n\n if (shouldSkip || !node.handler) {\n await record({\n status: \"skipped\",\n name: node.title,\n fullName,\n path: suitePath,\n });\n return;\n }\n\n const startedAt = clock.now();\n currentTestName = fullName;\n\n try {\n const result = node.handler();\n if (result && typeof (result as Promise<unknown>).then === \"function\") {\n await (result as Promise<unknown>);\n }\n const duration = clock.now() - startedAt;\n await record({\n status: \"passed\",\n name: node.title,\n fullName,\n path: suitePath,\n durationMs: duration,\n });\n } catch (error) {\n const duration = clock.now() - startedAt;\n await record({\n status: \"failed\",\n name: node.title,\n fullName,\n path: suitePath,\n durationMs: duration,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n } finally {\n currentTestName = undefined;\n }\n }\n\n async function record(report: ScenarioReport): Promise<void> {\n state.total += 1;\n switch (report.status) {\n case \"passed\":\n state.passed += 1;\n break;\n case \"failed\":\n state.failed += 1;\n state.success = false;\n break;\n case \"skipped\":\n state.skipped += 1;\n break;\n case \"pending\":\n state.pending += 1;\n break;\n default:\n break;\n }\n\n reports.push(report);\n await dispatchTestResult({ result: report });\n }\n\n async function dispatchRunStart(event: RunStartEvent): Promise<void> {\n for (const reporter of reporters) {\n if (typeof reporter.onRunStart === \"function\") {\n await reporter.onRunStart(event);\n }\n }\n }\n\n async function dispatchSuiteStart(event: SuiteLifecycleEvent): Promise<void> {\n for (const reporter of reporters) {\n if (typeof reporter.onSuiteStart === \"function\") {\n await reporter.onSuiteStart(event);\n }\n }\n }\n\n async function dispatchSuiteEnd(event: SuiteLifecycleEvent): Promise<void> {\n for (const reporter of reporters) {\n if (typeof reporter.onSuiteEnd === \"function\") {\n await reporter.onSuiteEnd(event);\n }\n }\n }\n\n async function dispatchTestResult(event: TestResultEvent): Promise<void> {\n for (const reporter of reporters) {\n if (typeof reporter.onTestResult === \"function\") {\n await reporter.onTestResult(event);\n }\n }\n }\n\n async function dispatchRunEnd(event: RunEndEvent): Promise<void> {\n for (const reporter of reporters) {\n if (typeof reporter.onRunEnd === \"function\") {\n await reporter.onRunEnd(event);\n }\n }\n }\n }\n\n return {\n runtime,\n hookLogger,\n async execute(): Promise<RuntimeSummary> {\n return execute();\n },\n };\n}\n","import pc from \"picocolors\";\n\nimport { getGherkinErrorContext } from \"@autometa/errors\";\nimport type { HookLogEvent, HookLogPathSegment } from \"@autometa/executor\";\nimport type {\n RuntimeSummary,\n ScenarioReport,\n ScenarioStatus,\n} from \"../runtime/types\";\nimport { BaselineErrorRenderer, ScenarioErrorRenderer } from \"./reporting/scenario-error-renderer\";\nimport { GherkinContextPrinter, type GherkinContextPrinterOptions } from \"./reporting/gherkin-context-printer\";\nimport { colorizeScenarioStatus, getScenarioStatusIcon } from \"./reporting/status-formatters\";\nimport { formatStackLines, partitionErrorLines } from \"./reporting/stack-utils\";\nimport {\n BufferedHierarchicalLog,\n ImmediateHierarchicalLog,\n type HierarchicalLog,\n} from \"./logging/hierarchical-log\";\n\ntype ReportNode = SuiteReportNode | TestReportNode | LogReportNode;\n\ntype HookTargetKind = \"feature\" | \"rule\" | \"scenario\" | \"scenarioOutline\" | \"step\";\n\ntype SuiteHierarchyKind = \"feature\" | \"rule\" | \"scenarioOutline\" | \"examples\";\n\ninterface HookLogFormattingContext {\n readonly scenarioName?: string;\n}\n\ninterface SuiteReportNode {\n readonly type: \"suite\";\n readonly name: string;\n kind?: SuiteHierarchyKind;\n keyword?: string;\n readonly children: ReportNode[];\n}\n\ninterface TestReportNode {\n readonly type: \"test\";\n readonly name: string;\n status?: ScenarioStatus;\n durationMs?: number;\n error?: Error;\n reason?: string;\n readonly logs: LogReportNode[];\n}\n\ninterface LogReportNode {\n readonly type: \"log\";\n readonly message: string;\n readonly offset: number;\n}\n\nexport interface RunStartEvent {\n readonly timestamp: number;\n}\n\nexport interface SuiteLifecycleEvent {\n readonly title: string;\n readonly ancestors: readonly string[];\n readonly path: readonly string[];\n readonly kind?: SuiteHierarchyKind;\n readonly keyword?: string;\n}\n\nexport interface TestResultEvent {\n readonly result: ScenarioReport;\n}\n\nexport interface RunEndEvent {\n readonly timestamp: number;\n readonly summary: RuntimeSummary;\n}\n\nexport interface RuntimeReporter {\n onRunStart?(event: RunStartEvent): void | Promise<void>;\n onSuiteStart?(event: SuiteLifecycleEvent): void | Promise<void>;\n onSuiteEnd?(event: SuiteLifecycleEvent): void | Promise<void>;\n onTestResult?(event: TestResultEvent): void | Promise<void>;\n onHookLog?(event: HookLogEvent): void;\n onRunEnd?(event: RunEndEvent): void | Promise<void>;\n}\n\ninterface SuiteState {\n readonly node: SuiteReportNode;\n}\n\nexport interface HierarchicalReporterOptions {\n readonly showGherkinStack?: boolean;\n readonly bufferOutput?: boolean;\n}\n\nexport class HierarchicalReporter implements RuntimeReporter {\n private suiteStack: SuiteState[] = [];\n private rootSuites: SuiteReportNode[] = [];\n private readonly log: HierarchicalLog;\n private readonly gherkinContextPrinter: GherkinContextPrinter;\n private readonly baselineErrorRenderer: BaselineErrorRenderer;\n private readonly scenarioErrorRenderer: ScenarioErrorRenderer;\n private readonly testNodesByFullName = new Map<string, TestReportNode>();\n private readonly suiteMetadataCache = new Map<string, { kind?: SuiteHierarchyKind; keyword?: string }>();\n private suiteFailureCache = new WeakMap<SuiteReportNode, boolean>();\n\n constructor(log: (line: string) => void = console.log, options: HierarchicalReporterOptions = {}) {\n const useBuffer = options.bufferOutput ?? true;\n this.log = useBuffer ? new BufferedHierarchicalLog(log) : new ImmediateHierarchicalLog(log);\n const includeGherkinContext = options.showGherkinStack ?? false;\n const printerOptions: GherkinContextPrinterOptions = {\n includePath: includeGherkinContext,\n includeCodeFrame: includeGherkinContext,\n };\n this.gherkinContextPrinter = new GherkinContextPrinter(this.log, printerOptions);\n this.baselineErrorRenderer = new BaselineErrorRenderer(this.gherkinContextPrinter, this.log);\n this.scenarioErrorRenderer = new ScenarioErrorRenderer(this.baselineErrorRenderer, this.log);\n }\n\n async onRunStart(): Promise<void> {\n this.reset();\n }\n\n async onSuiteStart(event: SuiteLifecycleEvent): Promise<void> {\n const parentNames = event.ancestors;\n const parentSuite = parentNames.length > 0 ? this.ensureSuitePathByNames(parentNames) : undefined;\n\n let suiteNode: SuiteReportNode | undefined;\n if (parentSuite) {\n suiteNode = this.findSuite(parentSuite.children, event.title);\n } else {\n suiteNode = this.findSuite(this.rootSuites, event.title);\n }\n\n if (!suiteNode) {\n suiteNode = {\n type: \"suite\",\n name: event.title,\n children: [],\n };\n if (parentSuite) {\n parentSuite.children.push(suiteNode);\n } else {\n this.rootSuites.push(suiteNode);\n }\n }\n\n if (event.kind) {\n suiteNode.kind = event.kind;\n }\n if (event.keyword) {\n suiteNode.keyword = event.keyword;\n }\n\n const path = [...parentNames, event.title];\n if (event.kind || event.keyword) {\n this.updateSuiteMetadataCache(path, {\n ...(event.kind ? { kind: event.kind } : {}),\n ...(event.keyword ? { keyword: event.keyword } : {}),\n });\n }\n\n this.suiteStack.push({ node: suiteNode });\n }\n\n async onSuiteEnd(): Promise<void> {\n this.suiteStack.pop();\n }\n\n async onTestResult(event: TestResultEvent): Promise<void> {\n const fullName = event.result.fullName;\n const segments = fullName.split(\" › \");\n const suiteNames = event.result.path && event.result.path.length > 0\n ? [...event.result.path]\n : segments.slice(0, -1);\n const parentSuite = this.ensureSuitePathByNames(suiteNames);\n\n let testNode = this.testNodesByFullName.get(fullName);\n if (!testNode) {\n testNode = {\n type: \"test\",\n name: event.result.name,\n logs: [],\n };\n parentSuite.children.push(testNode);\n this.testNodesByFullName.set(fullName, testNode);\n }\n\n testNode.status = event.result.status;\n if (event.result.durationMs !== undefined) {\n testNode.durationMs = event.result.durationMs;\n } else {\n delete testNode.durationMs;\n }\n if (event.result.error) {\n testNode.error = event.result.error;\n } else {\n delete testNode.error;\n }\n if (event.result.reason) {\n testNode.reason = event.result.reason;\n } else {\n delete testNode.reason;\n }\n }\n\n onHookLog(event: HookLogEvent): void {\n const suiteNames = this.extractSuiteNames(event.path);\n const scenarioSegment = this.findScenarioSegment(event.path);\n const scenarioName = event.scenario?.name ?? scenarioSegment?.name;\n const context: HookLogFormattingContext = {\n ...(scenarioName ? { scenarioName } : {}),\n };\n\n const formatted = this.formatHookMessage(event, context);\n\n if (suiteNames.length === 0 && !scenarioSegment) {\n this.log.write(formatted, 0);\n return;\n }\n\n const parentSuite = this.ensureSuitePathByNames(suiteNames);\n\n if (scenarioSegment) {\n const testNode = this.ensureTestNode(parentSuite, suiteNames, scenarioSegment, event);\n const offset = event.step ? 1 : 0;\n testNode.logs.push({\n type: \"log\",\n message: formatted,\n offset,\n });\n return;\n }\n\n parentSuite.children.push({\n type: \"log\",\n message: formatted,\n offset: 0,\n });\n }\n\n async onRunEnd(): Promise<void> {\n this.flush();\n }\n\n private reset(): void {\n this.suiteStack = [];\n this.rootSuites = [];\n this.testNodesByFullName.clear();\n this.suiteFailureCache = new WeakMap<SuiteReportNode, boolean>();\n }\n\n private flush(): void {\n for (const suite of this.rootSuites) {\n this.printNode(suite, 0);\n }\n this.log.flush();\n }\n\n private printNode(node: ReportNode, depth: number): void {\n if (node.type === \"suite\") {\n const isSyntheticRoot = node.name === \"(root)\";\n const nextDepth = isSyntheticRoot ? depth : depth + 1;\n\n if (!isSyntheticRoot) {\n const heading = this.formatSuiteHeading(node);\n this.log.write(heading, depth);\n }\n\n for (const child of node.children) {\n if (child.type === \"log\") {\n if (this.suiteHasFailingDescendant(node)) {\n this.log.write(child.message, nextDepth + child.offset);\n }\n continue;\n }\n this.printNode(child, nextDepth);\n }\n return;\n }\n\n if (node.type === \"log\") {\n this.log.write(node.message, depth + node.offset);\n return;\n }\n\n if (!node.status) {\n return;\n }\n\n const icon = getScenarioStatusIcon(node.status);\n const coloredName = colorizeScenarioStatus(node.name, node.status);\n const duration = node.durationMs !== undefined\n ? pc.dim(` (${this.formatDuration(node.durationMs)})`)\n : \"\";\n\n const scenarioLabel = `${pc.bold(\"Scenario:\")} ${coloredName}`;\n this.log.write(`${icon} ${scenarioLabel}${duration}`, depth);\n\n if (node.status !== \"passed\") {\n for (const logEntry of node.logs) {\n this.log.write(logEntry.message, depth + 1 + logEntry.offset);\n }\n }\n\n if (node.error) {\n this.printError(node.error, depth + 1);\n } else if (node.reason) {\n this.log.write(pc.dim(`Reason: ${node.reason}`), depth + 1);\n }\n }\n\n private suiteHasFailingDescendant(node: SuiteReportNode): boolean {\n const cached = this.suiteFailureCache.get(node);\n if (cached !== undefined) {\n return cached;\n }\n\n let hasFailure = false;\n\n for (const child of node.children) {\n if (child.type === \"test\") {\n if (child.status === \"failed\") {\n hasFailure = true;\n break;\n }\n continue;\n }\n\n if (child.type === \"suite\") {\n if (this.suiteHasFailingDescendant(child)) {\n hasFailure = true;\n break;\n }\n }\n }\n\n this.suiteFailureCache.set(node, hasFailure);\n return hasFailure;\n }\n\n private formatSuiteHeading(node: SuiteReportNode): string {\n const keyword = this.resolveSuiteKeyword(node);\n if (!keyword) {\n return pc.bold(node.name);\n }\n\n const prefix = this.highlightSuiteKeyword(keyword, node.kind);\n const name = node.name ? this.sanitizeSuiteName(node.name, keyword) : undefined;\n return name && name.length > 0 ? `${prefix} ${name}` : prefix;\n }\n\n private resolveSuiteKeyword(node: SuiteReportNode): string | undefined {\n const preferred = node.keyword;\n const fallback = this.defaultSuiteKeyword(node.kind);\n const chosen = (preferred ?? fallback)?.trim();\n if (!chosen || chosen.length === 0) {\n return undefined;\n }\n return chosen.replace(/:\\s*$/u, \"\");\n }\n\n private sanitizeSuiteName(name: string, keyword: string): string {\n const trimmed = name.trim();\n if (trimmed.length === 0) {\n return \"\";\n }\n\n const pattern = new RegExp(`^${HierarchicalReporter.escapeRegExp(keyword)}\\\\s*:`, \"i\");\n if (pattern.test(trimmed)) {\n return trimmed.replace(pattern, \"\").trim();\n }\n\n return trimmed;\n }\n\n private defaultSuiteKeyword(kind: SuiteHierarchyKind | undefined): string | undefined {\n switch (kind) {\n case \"feature\":\n return \"Feature\";\n case \"rule\":\n return \"Rule\";\n case \"scenarioOutline\":\n return \"Scenario Outline\";\n case \"examples\":\n return \"Examples\";\n default:\n return undefined;\n }\n }\n\n private highlightSuiteKeyword(keyword: string, kind: SuiteHierarchyKind | undefined): string {\n const label = `${keyword}:`;\n switch (kind) {\n case \"feature\":\n return pc.bold(pc.cyan(label));\n case \"rule\":\n return pc.bold(pc.magenta(label));\n case \"scenarioOutline\":\n return pc.bold(pc.blue(label));\n case \"examples\":\n return pc.bold(pc.yellow(label));\n default:\n return pc.bold(label);\n }\n }\n\n private ensureSuitePathByNames(names: readonly string[]): SuiteReportNode {\n if (names.length === 0) {\n if (this.rootSuites.length === 0) {\n const rootSuite: SuiteReportNode = { type: \"suite\", name: \"(root)\", children: [] };\n this.rootSuites.push(rootSuite);\n return rootSuite;\n }\n const [first] = this.rootSuites;\n if (first) {\n return first;\n }\n const fallback: SuiteReportNode = { type: \"suite\", name: \"(root)\", children: [] };\n this.rootSuites.push(fallback);\n return fallback;\n }\n\n let currentChildren: ReportNode[] = this.rootSuites;\n let currentSuite: SuiteReportNode | undefined;\n const path: string[] = [];\n\n for (const name of names) {\n path.push(name);\n let suite = this.findSuite(currentChildren, name);\n if (!suite) {\n suite = { type: \"suite\", name, children: [] };\n this.applyMetadataFromCache(path, suite);\n currentChildren.push(suite);\n } else {\n this.applyMetadataFromCache(path, suite);\n }\n currentSuite = suite;\n currentChildren = suite.children;\n }\n\n if (!currentSuite) {\n return this.ensureSuitePathByNames([]);\n }\n\n return currentSuite;\n }\n\n private findSuite(children: readonly ReportNode[], name: string): SuiteReportNode | undefined {\n for (const child of children) {\n if (child.type === \"suite\" && child.name === name) {\n return child;\n }\n }\n return undefined;\n }\n\n private findSuiteByPath(path: readonly string[]): SuiteReportNode | undefined {\n let currentChildren: readonly ReportNode[] = this.rootSuites;\n let current: SuiteReportNode | undefined;\n\n for (const name of path) {\n const next = this.findSuite(currentChildren, name);\n if (!next) {\n return undefined;\n }\n current = next;\n currentChildren = next.children;\n }\n\n return current;\n }\n\n private getSuitePathKey(path: readonly string[]): string {\n return path.join(\" › \");\n }\n\n private applyMetadataFromCache(path: readonly string[], node: SuiteReportNode): void {\n const cached = this.suiteMetadataCache.get(this.getSuitePathKey(path));\n if (!cached) {\n return;\n }\n if (cached.kind) {\n node.kind = cached.kind;\n }\n if (cached.keyword) {\n node.keyword = cached.keyword;\n }\n }\n\n private updateSuiteMetadataCache(\n path: readonly string[],\n metadata: { kind?: SuiteHierarchyKind; keyword?: string }\n ): void {\n const key = this.getSuitePathKey(path);\n const existing = this.suiteMetadataCache.get(key) ?? {};\n this.suiteMetadataCache.set(key, { ...existing, ...metadata });\n\n const node = this.findSuiteByPath(path);\n if (node) {\n if (metadata.kind) {\n node.kind = metadata.kind;\n }\n if (metadata.keyword) {\n node.keyword = metadata.keyword;\n }\n }\n }\n\n private ensureTestNode(\n parentSuite: SuiteReportNode,\n suiteNames: readonly string[],\n scenarioSegment: HookLogPathSegment,\n event: HookLogEvent\n ): TestReportNode {\n const fullName = event.scenario?.fullName ?? [...suiteNames, scenarioSegment.name].join(\" › \");\n let node = this.testNodesByFullName.get(fullName);\n if (!node) {\n node = {\n type: \"test\",\n name: event.scenario?.name ?? scenarioSegment.name,\n logs: [],\n };\n parentSuite.children.push(node);\n this.testNodesByFullName.set(fullName, node);\n }\n return node;\n }\n\n private extractSuiteNames(path: readonly HookLogPathSegment[]): string[] {\n const suites: string[] = [];\n const currentPath: string[] = [];\n\n for (const segment of path) {\n if (!segment) {\n continue;\n }\n if (\n segment.kind === \"feature\"\n || segment.kind === \"rule\"\n || segment.kind === \"scenarioOutline\"\n ) {\n suites.push(segment.name);\n currentPath.push(segment.name);\n const suiteKind = this.toSuiteHierarchyKind(segment.kind);\n if (suiteKind) {\n const metadata = {\n kind: suiteKind,\n ...(segment.keyword ? { keyword: segment.keyword } : {}),\n } as const;\n this.updateSuiteMetadataCache(currentPath, metadata);\n }\n }\n }\n return suites;\n }\n\n private toSuiteHierarchyKind(kind: HookLogPathSegment[\"kind\"]): SuiteHierarchyKind | undefined {\n switch (kind) {\n case \"feature\":\n return \"feature\";\n case \"rule\":\n return \"rule\";\n case \"scenarioOutline\":\n return \"scenarioOutline\";\n default:\n return undefined;\n }\n }\n\n private findScenarioSegment(\n path: readonly HookLogPathSegment[]\n ): HookLogPathSegment | undefined {\n for (let index = path.length - 1; index >= 0; index -= 1) {\n const segment = path[index];\n if (!segment) {\n continue;\n }\n if (segment.kind === \"scenario\") {\n return segment;\n }\n }\n return undefined;\n }\n\n private formatHookMessage(event: HookLogEvent, context: HookLogFormattingContext): string {\n const kind = this.getHookTargetKind(event.hookType);\n if (kind === \"step\") {\n return this.formatStepHookMessage(event, context);\n }\n return this.formatContainerHookMessage(event, kind, context);\n }\n\n private getHookTargetKind(hookType: HookLogEvent[\"hookType\"]): HookTargetKind {\n switch (hookType) {\n case \"beforeFeature\":\n case \"afterFeature\":\n return \"feature\";\n case \"beforeRule\":\n case \"afterRule\":\n return \"rule\";\n case \"beforeScenario\":\n case \"afterScenario\":\n case \"beforeStep\":\n case \"afterStep\":\n return hookType === \"beforeStep\" || hookType === \"afterStep\" ? \"step\" : \"scenario\";\n case \"beforeScenarioOutline\":\n case \"afterScenarioOutline\":\n return \"scenarioOutline\";\n default:\n return \"scenario\";\n }\n }\n\n private formatStepHookMessage(event: HookLogEvent, context: HookLogFormattingContext): string {\n const phaseLabel = this.wrapPhaseLabel(event.phase);\n const stepKeyword = this.extractStepKeyword(event) ?? \"Step\";\n const coloredKeyword = this.wrapStepKeyword(stepKeyword);\n const text = this.extractStepText(event, context);\n const status = this.describeStepStatus(event.step?.status);\n\n const parts: string[] = [phaseLabel, coloredKeyword];\n\n if (text && text.length > 0) {\n parts.push(text);\n }\n\n if (status) {\n parts.push(status);\n }\n\n return parts.join(\" \");\n }\n\n private formatContainerHookMessage(\n event: HookLogEvent,\n kind: HookTargetKind,\n context: HookLogFormattingContext\n ): string {\n const phaseLabel = this.wrapPhaseLabel(event.phase);\n const keyword = this.resolveTargetKeyword(kind, event) ?? this.describeFallbackTarget(kind, event);\n const coloredKeyword = keyword ? this.wrapContainerKeyword(keyword) : undefined;\n const message = this.sanitizeHookMessage(event.message, context);\n\n if (coloredKeyword && message) {\n return `${phaseLabel} ${coloredKeyword}: ${message}`;\n }\n\n if (coloredKeyword) {\n return `${phaseLabel} ${coloredKeyword}`;\n }\n\n if (message) {\n return `${phaseLabel} ${message}`;\n }\n\n return phaseLabel;\n }\n\n private extractStepText(event: HookLogEvent, context: HookLogFormattingContext): string | undefined {\n const text = event.step?.text?.trim();\n if (text && text.length > 0) {\n return text;\n }\n return this.sanitizeHookMessage(event.message, context);\n }\n\n private sanitizeHookMessage(message: string | undefined, context: HookLogFormattingContext): string | undefined {\n if (!message) {\n return undefined;\n }\n\n let result = message.trim();\n\n if (context.scenarioName) {\n const escaped = HierarchicalReporter.escapeRegExp(context.scenarioName);\n const patterns = [\n new RegExp(`^Scenario\\\\s+\"?${escaped}\"?\\\\s*::\\\\s*`, \"i\"),\n new RegExp(`^Scenario\\\\s+\"?${escaped}\"?\\\\s*`, \"i\"),\n ];\n\n for (const pattern of patterns) {\n const updated = result.replace(pattern, \"\").trim();\n if (updated !== result) {\n result = updated;\n break;\n }\n }\n }\n\n return result;\n }\n\n private wrapPhaseLabel(phase: HookLogEvent[\"phase\"]): string {\n const label = phase === \"before\" ? \"Before\" : \"After\";\n return phase === \"before\" ? pc.cyan(label) : pc.magenta(label);\n }\n\n private wrapStepKeyword(keyword: string): string {\n const normalized = keyword.trim().toLowerCase();\n switch (normalized) {\n case \"given\":\n return pc.blue(keyword);\n case \"when\":\n return pc.yellow(keyword);\n case \"then\":\n return pc.green(keyword);\n case \"and\":\n case \"but\":\n return pc.cyan(keyword);\n default:\n return pc.white(keyword);\n }\n }\n\n private wrapContainerKeyword(keyword: string): string {\n return pc.bold(keyword);\n }\n\n private describeStepStatus(status: string | undefined): string | undefined {\n if (!status) {\n return undefined;\n }\n\n switch (status.toLowerCase()) {\n case \"passed\":\n return pc.dim(\"(passed)\");\n case \"failed\":\n return pc.red(\"(failed)\");\n case \"skipped\":\n return pc.yellow(\"(skipped)\");\n default:\n return pc.dim(`(${status})`);\n }\n }\n\n private static escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/gu, \"\\\\$&\");\n }\n\n private resolveTargetKeyword(kind: HookTargetKind, event: HookLogEvent): string | undefined {\n const normalized = (value: string | undefined): string | undefined => {\n if (!value) {\n return undefined;\n }\n return this.cleanKeyword(value);\n };\n\n if (kind === \"scenario\") {\n return (\n normalized(event.scenario?.keyword)\n ?? normalized(event.targetKeyword)\n ?? normalized(this.findSegmentKeyword(kind, event.path))\n );\n }\n\n if (kind === \"scenarioOutline\") {\n return (\n normalized(event.targetKeyword)\n ?? normalized(this.findSegmentKeyword(kind, event.path))\n );\n }\n\n if (kind === \"feature\" || kind === \"rule\") {\n return (\n normalized(event.targetKeyword)\n ?? normalized(this.findSegmentKeyword(kind, event.path))\n );\n }\n\n return undefined;\n }\n\n private describeFallbackTarget(kind: HookTargetKind, _event: HookLogEvent): string {\n switch (kind) {\n case \"feature\":\n return \"Feature\";\n case \"rule\":\n return \"Rule\";\n case \"scenario\":\n return \"Scenario\";\n case \"scenarioOutline\":\n return \"Scenario Outline\";\n case \"step\":\n default:\n return \"Step\";\n }\n }\n\n private extractStepKeyword(event: HookLogEvent): string | undefined {\n const keyword = event.step?.keyword;\n if (!keyword || keyword.trim().length === 0) {\n return undefined;\n }\n return this.cleanKeyword(keyword);\n }\n\n private findSegmentKeyword(\n kind: HookTargetKind,\n path: readonly HookLogPathSegment[]\n ): string | undefined {\n for (let index = path.length - 1; index >= 0; index -= 1) {\n const segment = path[index];\n if (!segment) {\n continue;\n }\n if (segment.kind === kind && segment.keyword) {\n return segment.keyword;\n }\n }\n return undefined;\n }\n\n private cleanKeyword(keyword: string): string {\n return keyword.trim().replace(/:\\s*$/u, \"\");\n }\n\n private formatDuration(ms: number): string {\n if (ms < 1) {\n return `${ms.toFixed(2)} ms`;\n }\n if (ms < 1000) {\n return `${ms.toFixed(0)} ms`;\n }\n return `${(ms / 1000).toFixed(2)} s`;\n }\n\n private printError(error: Error, depth: number): void {\n const stack = error.stack ?? error.message;\n const lines = stack.split(\"\\n\");\n\n if (lines.length === 0) {\n this.log.write(pc.red(error.message), depth);\n return;\n }\n\n const [headline, ...rest] = lines;\n this.log.write(pc.red(headline), depth);\n\n const { messageLines, stackLines } = partitionErrorLines(rest);\n const { lines: formattedStack, truncated } = formatStackLines(stackLines, 4);\n const context = getGherkinErrorContext(error);\n\n if (context?.steps && context.steps.length > 0) {\n this.scenarioErrorRenderer.print({\n context,\n depth,\n messageLines,\n formattedStack,\n truncated,\n });\n return;\n }\n\n this.baselineErrorRenderer.print({\n ...(context ? { context } : {}),\n depth,\n messageLines,\n formattedStack,\n truncated,\n });\n }\n\n}\n","import pc from \"picocolors\";\n\nimport type { GherkinErrorContext } from \"@autometa/errors\";\n\nimport { GherkinContextPrinter } from \"./gherkin-context-printer\";\nimport { describeStepSummary } from \"./step-summary\";\nimport { colorizeStepDescription, getStepStatusIcon } from \"./status-formatters\";\nimport {\n ImmediateHierarchicalLog,\n type HierarchicalLog,\n} from \"../logging/hierarchical-log\";\n\ntype BaselineOptions = {\n readonly context?: GherkinErrorContext;\n readonly depth: number;\n readonly messageLines: readonly string[];\n readonly formattedStack: readonly string[];\n readonly truncated: boolean;\n};\n\ntype ScenarioOptions = BaselineOptions & {\n readonly context: GherkinErrorContext;\n};\n\nexport class BaselineErrorRenderer {\n constructor(\n private readonly contextPrinter: GherkinContextPrinter,\n private readonly log: HierarchicalLog = new ImmediateHierarchicalLog()\n ) {}\n\n print(options: BaselineOptions): void {\n const {\n context,\n depth,\n messageLines,\n formattedStack,\n truncated,\n } = options;\n const scope = this.log.scoped(depth);\n\n if (messageLines.length > 0) {\n for (const line of messageLines) {\n const trimmed = line.trimEnd();\n if (trimmed.length === 0) {\n scope.write(\"\");\n continue;\n }\n scope.write(pc.red(trimmed));\n }\n }\n\n if (context) {\n this.contextPrinter.printContext(context, depth + 1);\n }\n\n for (const line of formattedStack) {\n scope.write(pc.dim(line));\n }\n\n if (truncated) {\n scope.write(pc.dim(\" …\"));\n }\n }\n}\n\nexport class ScenarioErrorRenderer {\n constructor(\n private readonly baselineRenderer: BaselineErrorRenderer,\n private readonly log: HierarchicalLog = new ImmediateHierarchicalLog()\n ) {}\n\n print(options: ScenarioOptions): void {\n const {\n context,\n depth,\n messageLines,\n formattedStack,\n truncated,\n } = options;\n\n const steps = context.steps ?? [];\n const failingIndex = steps.findIndex((step) => step.status === \"failed\");\n\n if (steps.length === 0 || failingIndex === -1) {\n this.baselineRenderer.print({\n context,\n depth,\n messageLines,\n formattedStack,\n truncated,\n });\n return;\n }\n\n const scope = this.log.scoped(depth);\n let detailsPrinted = false;\n\n for (const step of steps) {\n const { description, location } = describeStepSummary(step);\n const icon = getStepStatusIcon(step.status);\n const coloredDescription = colorizeStepDescription(description, step.status);\n const label = location ? `${coloredDescription}${location}` : coloredDescription;\n scope.write(`${icon} ${label}`);\n\n if (!detailsPrinted && step.status === \"failed\") {\n this.baselineRenderer.print({\n context,\n depth: depth + 1,\n messageLines,\n formattedStack,\n truncated,\n });\n detailsPrinted = true;\n }\n }\n\n if (!detailsPrinted) {\n this.baselineRenderer.print({\n context,\n depth: depth + 1,\n messageLines,\n formattedStack,\n truncated,\n });\n }\n }\n}\n","import pc from \"picocolors\";\n\nimport type { GherkinStepSummary } from \"@autometa/errors\";\n\nimport { formatSourceLocation } from \"./location\";\n\nexport function describeStepSummary(step: GherkinStepSummary): {\n description: string;\n location?: string;\n} {\n const keyword = step.keyword?.trim();\n const text = step.text?.trim();\n const descriptionParts = [keyword, text].filter((value): value is string => Boolean(value && value.length));\n const description = descriptionParts.length ? descriptionParts.join(\" \") : \"Step\";\n const location = step.location\n ? pc.dim(` (${formatSourceLocation(step.location)})`)\n : undefined;\n\n return {\n description,\n ...(location ? { location } : {}),\n };\n}\n","import path from \"node:path\";\n\nimport type { SourceLocation } from \"@autometa/errors\";\n\nexport function formatSourceLocation(location: SourceLocation): string {\n return `${relativePath(location.filePath)}:${location.start.line}:${location.start.column}`;\n}\n\nexport function relativePath(filePath: string): string {\n const cwd = process.cwd();\n const relative = path.relative(cwd, filePath);\n return relative || filePath;\n}\n","import pc from \"picocolors\";\n\nimport type { ScenarioStatus } from \"../../runtime/types\";\nimport type { GherkinStepSummary } from \"@autometa/errors\";\n\nexport function getScenarioStatusIcon(status: ScenarioStatus): string {\n switch (status) {\n case \"passed\":\n return pc.green(\"✓\");\n case \"failed\":\n return pc.red(\"✗\");\n case \"skipped\":\n return pc.yellow(\"○\");\n case \"pending\":\n return pc.cyan(\"◌\");\n default:\n return pc.dim(\"?\");\n }\n}\n\nexport function colorizeScenarioStatus(text: string, status: ScenarioStatus): string {\n switch (status) {\n case \"passed\":\n return pc.green(text);\n case \"failed\":\n return pc.red(text);\n case \"skipped\":\n return pc.yellow(text);\n case \"pending\":\n return pc.cyan(text);\n default:\n return text;\n }\n}\n\nexport function getStepStatusIcon(status: GherkinStepSummary[\"status\"]): string {\n switch (status) {\n case \"passed\":\n return pc.green(\"✓\");\n case \"failed\":\n return pc.red(\"✗\");\n case \"skipped\":\n default:\n return pc.yellow(\"○\");\n }\n}\n\nexport function colorizeStepDescription(\n description: string,\n status: GherkinStepSummary[\"status\"]\n): string {\n switch (status) {\n case \"passed\":\n return pc.green(description);\n case \"failed\":\n return pc.red(description);\n case \"skipped\":\n return pc.yellow(description);\n default:\n return description;\n }\n}\n","export interface HierarchicalLog {\n write(line: string, depth?: number): void;\n flush(): void;\n scoped(offset: number): HierarchicalLog;\n}\n\nexport interface HierarchicalLogOptions {\n readonly indent?: string;\n}\n\ninterface LogEntry {\n readonly depth: number;\n readonly line: string;\n}\n\nconst DEFAULT_INDENT = \" \";\n\nexport class BufferedHierarchicalLog implements HierarchicalLog {\n private readonly indent: string;\n private readonly entries: LogEntry[] = [];\n\n constructor(\n private readonly sink: (line: string) => void = console.log,\n options: HierarchicalLogOptions = {}\n ) {\n this.indent = options.indent ?? DEFAULT_INDENT;\n }\n\n write(line: string, depth = 0): void {\n const normalizedDepth = depth >= 0 ? depth : 0;\n this.entries.push({ line, depth: normalizedDepth });\n }\n\n flush(): void {\n if (this.entries.length === 0) {\n return;\n }\n for (const entry of this.entries) {\n if (entry.line.length === 0) {\n this.sink(\"\");\n continue;\n }\n const indent = this.indent.repeat(entry.depth);\n this.sink(`${indent}${entry.line}`);\n }\n this.entries.length = 0;\n }\n\n scoped(offset: number): HierarchicalLog {\n const base = offset >= 0 ? offset : 0;\n return new BufferedScopedHierarchicalLog(this, base);\n }\n}\n\nclass BufferedScopedHierarchicalLog implements HierarchicalLog {\n constructor(\n private readonly root: BufferedHierarchicalLog,\n private readonly base: number\n ) {}\n\n write(line: string, depth = 0): void {\n const normalizedDepth = depth >= 0 ? depth : 0;\n this.root.write(line, this.base + normalizedDepth);\n }\n\n flush(): void {\n this.root.flush();\n }\n\n scoped(offset: number): HierarchicalLog {\n const nextBase = this.base + (offset >= 0 ? offset : 0);\n return new BufferedScopedHierarchicalLog(this.root, nextBase);\n }\n}\n\nexport class ImmediateHierarchicalLog implements HierarchicalLog {\n private readonly indent: string;\n\n constructor(\n private readonly sink: (line: string) => void = console.log,\n options: HierarchicalLogOptions = {}\n ) {\n this.indent = options.indent ?? DEFAULT_INDENT;\n }\n\n write(line: string, depth = 0): void {\n const normalizedDepth = depth >= 0 ? depth : 0;\n if (line.length === 0) {\n this.sink(\"\");\n return;\n }\n const indent = this.indent.repeat(normalizedDepth);\n this.sink(`${indent}${line}`);\n }\n\n flush(): void {\n // immediate logger does not buffer\n }\n\n scoped(offset: number): HierarchicalLog {\n const base = offset >= 0 ? offset : 0;\n return new ImmediateScopedHierarchicalLog(this, base);\n }\n}\n\nclass ImmediateScopedHierarchicalLog implements HierarchicalLog {\n constructor(\n private readonly root: ImmediateHierarchicalLog,\n private readonly base: number\n ) {}\n\n write(line: string, depth = 0): void {\n const normalizedDepth = depth >= 0 ? depth : 0;\n this.root.write(line, this.base + normalizedDepth);\n }\n\n flush(): void {\n this.root.flush();\n }\n\n scoped(offset: number): HierarchicalLog {\n const nextBase = this.base + (offset >= 0 ? offset : 0);\n return new ImmediateScopedHierarchicalLog(this.root, nextBase);\n }\n}\n","import fs from \"node:fs\";\n\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport pc from \"picocolors\";\n\nimport type {\n GherkinContextPathSegment,\n GherkinErrorContext,\n SourceLocation,\n} from \"@autometa/errors\";\n\nimport { formatSourceLocation } from \"./location\";\nimport {\n ImmediateHierarchicalLog,\n type HierarchicalLog,\n} from \"../logging/hierarchical-log\";\n\nexport interface GherkinContextPrinterOptions {\n readonly includePath?: boolean;\n readonly includeCodeFrame?: boolean;\n}\n\nexport class GherkinContextPrinter {\n constructor(\n private readonly log: HierarchicalLog = new ImmediateHierarchicalLog(),\n private readonly options: GherkinContextPrinterOptions = {}\n ) {}\n\n printContext(context: GherkinErrorContext, depth: number): void {\n if (this.options.includeCodeFrame && context.gherkin) {\n const details = this.describeGherkinSegment(context.gherkin);\n const pathSegments = context.path;\n this.printCodeFrameSection(\n \"Gherkin\",\n context.gherkin.location,\n details,\n depth,\n {\n includeLocation: !pathSegments || pathSegments.length === 0,\n }\n );\n }\n\n if (this.options.includePath && context.path && context.path.length > 0) {\n this.printGherkinPath(context.path, depth);\n }\n\n if (context.code) {\n const details = this.describeCodeSegment(context.code);\n this.printCodeFrameSection(\"Step implementation\", context.code.location, details, depth);\n }\n }\n\n private printCodeFrameSection(\n title: string,\n location: SourceLocation,\n details: string | undefined,\n depth: number,\n options: { includeLocation?: boolean } = {}\n ): void {\n const headerParts = [title];\n if (details) {\n headerParts.push(details);\n }\n if (options.includeLocation !== false) {\n headerParts.push(pc.dim(formatSourceLocation(location)));\n }\n const scope = this.log.scoped(depth);\n scope.write(pc.cyan(headerParts.join(\" - \")));\n\n const frame = this.buildCodeFrame(location);\n if (!frame) {\n scope.scoped(1).write(pc.dim(\"Unable to read source snippet\"));\n return;\n }\n\n for (const line of frame) {\n scope.scoped(1).write(line);\n }\n }\n\n private buildCodeFrame(location: SourceLocation): readonly string[] | undefined {\n try {\n const contents = fs.readFileSync(location.filePath, \"utf8\");\n const frame = codeFrameColumns(\n contents,\n {\n start: location.start,\n ...(location.end ? { end: location.end } : {}),\n },\n {\n linesAbove: 2,\n linesBelow: 2,\n highlightCode: true,\n }\n );\n return frame.split(\"\\n\");\n } catch {\n return undefined;\n }\n }\n\n private printGherkinPath(\n pathSegments: readonly GherkinContextPathSegment[],\n depth: number\n ): void {\n if (pathSegments.length === 0) {\n return;\n }\n\n let scope = this.log.scoped(depth);\n let previousKey: string | undefined;\n\n for (const segment of pathSegments) {\n const segmentKey = this.describePathKey(segment);\n if (segmentKey === previousKey) {\n continue;\n }\n previousKey = segmentKey;\n scope.write(pc.dim(`at ${this.describePathLabel(segment)}`));\n scope = scope.scoped(1);\n }\n }\n\n private describeGherkinSegment(\n segment: GherkinErrorContext[\"gherkin\"]\n ): string | undefined {\n if (!segment) {\n return undefined;\n }\n const keyword = segment.stepKeyword?.trim();\n const text = segment.stepText?.trim();\n const parts = [keyword, text].filter((value): value is string => Boolean(value && value.length));\n if (parts.length) {\n return parts.join(\" \");\n }\n if (segment.featureName) {\n return `Feature: ${segment.featureName}`;\n }\n return undefined;\n }\n\n private describeCodeSegment(segment: GherkinErrorContext[\"code\"]): string | undefined {\n if (!segment) {\n return undefined;\n }\n return segment.functionName ?? undefined;\n }\n\n private describePathKey(segment: GherkinContextPathSegment): string {\n return `${segment.role}|${segment.name ?? \"\"}|${segment.text ?? \"\"}|${segment.index ?? \"\"}`;\n }\n\n private describePathLabel(segment: GherkinContextPathSegment): string {\n const location = formatSourceLocation(segment.location);\n switch (segment.role) {\n case \"feature\": {\n const name = segment.name?.trim();\n return name ? `Feature: ${name} (${location})` : `Feature (${location})`;\n }\n case \"rule\": {\n const name = segment.name?.trim();\n return name ? `Rule: ${name} (${location})` : `Rule (${location})`;\n }\n case \"outline\": {\n const name = segment.name?.trim();\n return name ? `Scenario Outline: ${name} (${location})` : `Scenario Outline (${location})`;\n }\n case \"scenario\": {\n const name = segment.name?.trim();\n return name ? `Scenario: ${name} (${location})` : `Scenario (${location})`;\n }\n case \"example\": {\n const label =\n segment.name?.trim() ??\n (segment.index !== undefined ? `Example #${segment.index + 1}` : undefined);\n return label ? `${label} (${location})` : `Example (${location})`;\n }\n case \"step\": {\n const keyword = segment.keyword?.trim();\n const text = segment.text?.trim();\n const labelParts = [keyword, text].filter((value): value is string => Boolean(value && value.length));\n const label = labelParts.length ? labelParts.join(\" \") : \"Step\";\n return `Step: ${label} (${location})`;\n }\n default:\n return `${segment.role} (${location})`;\n }\n }\n}\n","import path from \"node:path\";\n\ninterface NormalizedFrame {\n readonly text: string;\n readonly framework: boolean;\n}\n\nexport function formatStackLines(\n lines: readonly string[],\n limit: number\n): { lines: string[]; truncated: boolean } {\n const cwd = process.cwd();\n const max = Math.max(limit, 0);\n const normalized: NormalizedFrame[] = [];\n let count = 0;\n\n for (const line of lines) {\n if (max && count >= max) {\n return { lines: filterFrameworkFrames(normalized), truncated: true };\n }\n const info = normalizeStackLine(line.trimEnd(), cwd);\n normalized.push({\n text: info.text,\n framework: info.relativePath ? isFrameworkPath(info.relativePath) : false,\n });\n count += 1;\n }\n\n return { lines: filterFrameworkFrames(normalized), truncated: false };\n}\n\nexport function partitionErrorLines(lines: readonly string[]): {\n messageLines: string[];\n stackLines: string[];\n} {\n const messageLines: string[] = [];\n const stackLines: string[] = [];\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (isStackLine(trimmed)) {\n stackLines.push(line);\n } else {\n messageLines.push(line);\n }\n }\n\n while (messageLines.length > 0) {\n const last = messageLines[messageLines.length - 1];\n if (!last || last.trim().length === 0) {\n messageLines.pop();\n continue;\n }\n break;\n }\n\n return { messageLines, stackLines };\n}\n\nfunction normalizeStackLine(\n line: string,\n cwd: string\n): { text: string; relativePath?: string } {\n // eslint-disable-next-line no-useless-escape\n const stackRegex = /(.*?\\()?(?<filepath>(?:[a-zA-Z]:)?[\\\\/][^:\\)]+)(?<position>:\\d+:\\d+)(\\))?/;\n const match = line.match(stackRegex);\n\n if (!match || !match.groups) {\n return { text: line };\n }\n\n const { filepath, position } = match.groups as { filepath: string; position: string };\n const absolute = path.normalize(filepath);\n const relative = path.relative(cwd, absolute) || absolute;\n\n return {\n text: line.replace(`${filepath}${position}`, `${relative}${position}`),\n relativePath: relative,\n };\n}\n\nfunction filterFrameworkFrames(frames: NormalizedFrame[]): string[] {\n if (frames.length === 0) {\n return [];\n }\n\n const filtered = frames.filter((frame, index) => index === 0 || !frame.framework);\n if (filtered.length === 0) {\n return frames.map((frame) => frame.text);\n }\n\n return filtered.map((frame) => frame.text);\n}\n\nfunction isFrameworkPath(relativePath: string): boolean {\n const normalized = relativePath.split(path.sep).join(\"/\");\n return (\n normalized.includes(\"node_modules/\") ||\n normalized.startsWith(\"packages/runner/\") ||\n normalized.startsWith(\"packages/executor/\")\n );\n}\n\nfunction isStackLine(line: string): boolean {\n if (!line) {\n return false;\n }\n if (line.startsWith(\"at \")) {\n return true;\n }\n return /\\((?:[a-zA-Z]:)?[^():]+:\\d+:\\d+\\)$/.test(line);\n}\n","import fg from \"fast-glob\";\nimport { isAbsolute, resolve } from \"node:path\";\n\nexport async function expandFilePatterns(\n patterns: readonly string[] | undefined,\n cwd: string\n): Promise<string[]> {\n if (!patterns || patterns.length === 0) {\n return [];\n }\n\n const normalized: string[] = patterns.map((pattern) =>\n isAbsolute(pattern) ? pattern : resolve(cwd, pattern)\n );\n\n const entries = (await fg(normalized, {\n cwd,\n absolute: true,\n onlyFiles: true,\n unique: true,\n followSymbolicLinks: true,\n })) as string[];\n\n return entries.sort((a, b) => a.localeCompare(b));\n}\n","import { access } from \"node:fs/promises\";\nimport { constants as fsConstants } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\n\nimport { Config } from \"@autometa/config\";\nimport type { ResolvedConfig } from \"@autometa/config\";\n\nimport { loadModule, type ModuleLoadOptions } from \"./module-loader\";\n\nexport interface LoadedExecutorConfig {\n readonly filePath: string;\n readonly config: Config;\n readonly resolved: ResolvedConfig;\n}\n\nexport interface LoadExecutorConfigOptions {\n readonly configPath?: string;\n readonly cacheDir?: string;\n readonly external?: readonly string[];\n readonly modules?: readonly string[];\n readonly groups?: readonly string[];\n readonly environment?: string;\n}\n\nconst CONFIG_CANDIDATES = [\n \"autometa.config.ts\",\n \"autometa.config.mts\",\n \"autometa.config.cts\",\n \"autometa.config.js\",\n \"autometa.config.mjs\",\n \"autometa.config.cjs\",\n];\n\nexport async function loadExecutorConfig(\n cwd: string,\n options: LoadExecutorConfigOptions = {}\n): Promise<LoadedExecutorConfig> {\n const configPath = await resolveConfigPath(cwd, options.configPath);\n const module = await loadModule(configPath, createModuleLoadOptions(cwd, options));\n const config = extractConfig(module);\n\n if (!config) {\n throw new Error(\n `Failed to load Autometa config from \"${configPath}\". ` +\n \"Ensure the module exports a Config instance (e.g. export default defineConfig({...})).\"\n );\n }\n\n const resolveOptions = {\n ...(options.environment && options.environment.trim().length > 0\n ? { environment: options.environment }\n : {}),\n ...(options.modules && options.modules.length > 0 ? { modules: options.modules } : {}),\n ...(options.groups && options.groups.length > 0 ? { groups: options.groups } : {}),\n };\n\n const resolved = config.resolve(\n Object.keys(resolveOptions).length > 0 ? resolveOptions : undefined\n );\n\n return {\n filePath: configPath,\n config,\n resolved,\n };\n}\n\nasync function resolveConfigPath(cwd: string, explicitPath?: string): Promise<string> {\n if (explicitPath) {\n const absolutePath = resolvePath(cwd, explicitPath);\n await ensureFileExists(absolutePath);\n return absolutePath;\n }\n\n for (const candidate of CONFIG_CANDIDATES) {\n const absoluteCandidate = resolvePath(cwd, candidate);\n if (await fileExists(absoluteCandidate)) {\n return absoluteCandidate;\n }\n }\n\n throw new Error(\n `Unable to locate an Autometa config file in \"${cwd}\". Expected one of: ${CONFIG_CANDIDATES.join(\n \", \"\n )}`\n );\n}\n\nasync function ensureFileExists(path: string): Promise<void> {\n try {\n await access(path, fsConstants.F_OK);\n } catch {\n throw new Error(`Config file not found at \"${path}\"`);\n }\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await access(path, fsConstants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction createModuleLoadOptions(\n cwd: string,\n options: LoadExecutorConfigOptions\n): ModuleLoadOptions {\n return {\n cwd,\n ...(options.cacheDir ? { cacheDir: options.cacheDir } : {}),\n ...(options.external ? { external: options.external } : {}),\n };\n}\n\nfunction extractConfig(exports: Record<string, unknown>): Config | undefined {\n const candidates: unknown[] = [];\n\n if (exports.default !== undefined) {\n candidates.push(exports.default);\n }\n\n for (const value of Object.values(exports)) {\n candidates.push(value);\n }\n\n for (const candidate of candidates) {\n const config = asConfig(candidate);\n if (config) {\n return config;\n }\n }\n\n return undefined;\n}\n\nfunction asConfig(value: unknown): Config | undefined {\n if (!value || (typeof value !== \"object\" && typeof value !== \"function\")) {\n return undefined;\n }\n\n if (value instanceof Config) {\n return value;\n }\n\n const maybeConfig = value as { resolve?: unknown; current?: unknown };\n if (typeof maybeConfig.resolve === \"function\" && typeof maybeConfig.current === \"function\") {\n return maybeConfig as Config;\n }\n\n const maybeDefault = (value as { readonly default?: unknown }).default;\n if (maybeDefault && maybeDefault !== value) {\n return asConfig(maybeDefault);\n }\n\n return undefined;\n}\n","import { createHash } from \"crypto\";\nimport { promises as fs } from \"fs\";\nimport { builtinModules } from \"module\";\nimport { dirname, extname, isAbsolute, join, resolve } from \"path\";\nimport { pathToFileURL } from \"url\";\nimport { build, type OutputFile } from \"esbuild\";\n\nimport { resolveCliCacheDir } from \"../utils/cache-dir\";\n\nconst TS_EXTENSIONS = new Set([\".ts\", \".tsx\", \".cts\", \".mts\"]);\nconst BUILTIN_EXTERNALS = new Set<string>([\n ...builtinModules,\n ...builtinModules.map((moduleId: string) => `node:${moduleId}`),\n]);\nconst DEFAULT_EXTERNALS = new Set<string>([\"p-limit\"]);\n\nexport interface ModuleLoadOptions {\n readonly cwd: string;\n readonly external?: readonly string[];\n readonly cacheDir?: string;\n}\n\nexport async function loadModule(\n specifier: string,\n options: ModuleLoadOptions\n): Promise<Record<string, unknown>> {\n if (isBareSpecifier(specifier)) {\n return import(specifier);\n }\n\n const resolvedPath = resolve(options.cwd, specifier);\n const filePath = await resolveFilePath(resolvedPath);\n const extension = extname(filePath).toLowerCase();\n\n if (TS_EXTENSIONS.has(extension)) {\n return loadTranspiledModule(filePath, options);\n }\n\n return import(pathToFileURL(filePath).href);\n}\n\nfunction isBareSpecifier(specifier: string): boolean {\n if (!specifier) {\n return false;\n }\n if (specifier.startsWith(\"./\") || specifier.startsWith(\"../\")) {\n return false;\n }\n return !isAbsolute(specifier);\n}\n\nasync function resolveFilePath(pathCandidate: string): Promise<string> {\n if (await pathExists(pathCandidate)) {\n return pathCandidate;\n }\n\n const directory = dirname(pathCandidate);\n const fileName = pathCandidate.slice(directory.length + 1);\n\n for (const extension of TS_EXTENSIONS) {\n const candidate = join(directory, `${fileName}${extension}`);\n if (await pathExists(candidate)) {\n return candidate;\n }\n }\n\n throw new Error(`Unable to resolve module at ${pathCandidate}`);\n}\n\nasync function loadTranspiledModule(\n filePath: string,\n options: ModuleLoadOptions\n): Promise<Record<string, unknown>> {\n const cacheDirectory = options.cacheDir ?? await resolveCliCacheDir(options.cwd);\n await fs.mkdir(cacheDirectory, { recursive: true });\n\n const stats = await fs.stat(filePath);\n const cacheKey = createCacheKey(filePath, stats.mtimeMs);\n const outputFile = join(cacheDirectory, `${cacheKey}.cjs`);\n\n if (!(await pathExists(outputFile))) {\n const external = new Set<string>([\n ...BUILTIN_EXTERNALS,\n ...DEFAULT_EXTERNALS,\n ...(options.external ?? []),\n ]);\n\n const result = await build({\n entryPoints: [filePath],\n absWorkingDir: options.cwd,\n bundle: true,\n platform: \"node\",\n format: \"cjs\",\n target: \"node20\",\n sourcemap: \"inline\",\n write: false,\n external: Array.from(external),\n });\n\n const output = result.outputFiles?.find((file: OutputFile) => !file.path.endsWith(\".map\"));\n if (!output) {\n throw new Error(`Failed to compile module at ${filePath}`);\n }\n\n await fs.writeFile(outputFile, output.text, \"utf8\");\n }\n\n const moduleUrl = `${pathToFileURL(outputFile).href}?v=${cacheKey}`;\n return import(moduleUrl);\n}\n\nfunction createCacheKey(filePath: string, mtimeMs: number): string {\n return createHash(\"sha1\")\n .update(filePath)\n .update(String(mtimeMs))\n .digest(\"hex\");\n}\n\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n}\n","import { createHash } from \"node:crypto\";\nimport { access } from \"node:fs/promises\";\nimport { constants as fsConstants } from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { join, resolve as resolvePath, isAbsolute } from \"node:path\";\n\n/**\n * Resolve the directory used by the CLI to write compiled/cached artifacts.\n *\n * Why this exists:\n * - The CLI may need to transpile TS config/step modules at runtime.\n * - Writing them to a stable cache avoids recompiling on every run.\n *\n * Design goals:\n * - Prefer locations that are already ignored (node_modules/.cache) when available.\n * - Otherwise use an OS-level cache directory to avoid polluting the project root.\n * - Allow explicit overrides via env vars.\n */\nexport async function resolveCliCacheDir(cwd: string): Promise<string> {\n const envCacheDir = process.env.AUTOMETA_CACHE_DIR?.trim();\n if (envCacheDir) {\n return isAbsolute(envCacheDir) ? envCacheDir : resolvePath(cwd, envCacheDir);\n }\n\n const envHome = process.env.AUTOMETA_HOME?.trim();\n if (envHome) {\n const base = isAbsolute(envHome) ? envHome : resolvePath(cwd, envHome);\n return join(base, \"cache\");\n }\n\n // If node_modules exists, prefer node_modules/.cache/autometa (already ignored).\n // This keeps the cache project-local without requiring any extra gitignore rules.\n const nodeModules = join(cwd, \"node_modules\");\n if (await pathExists(nodeModules)) {\n return join(nodeModules, \".cache\", \"autometa\");\n }\n\n // Otherwise, fall back to an OS-level cache dir (or tmp as a last resort).\n const osBase = resolveOsCacheBase();\n const projectKey = createHash(\"sha1\").update(resolvePath(cwd)).digest(\"hex\");\n return join(osBase, projectKey, \"cache\");\n}\n\nfunction resolveOsCacheBase(): string {\n const xdg = process.env.XDG_CACHE_HOME?.trim();\n if (xdg) {\n return join(xdg, \"autometa\");\n }\n\n if (process.platform === \"darwin\") {\n return join(homedir(), \"Library\", \"Caches\", \"autometa\");\n }\n\n if (process.platform === \"win32\") {\n const local = process.env.LOCALAPPDATA?.trim();\n if (local) {\n return join(local, \"autometa\", \"Cache\");\n }\n return join(homedir(), \"AppData\", \"Local\", \"autometa\", \"Cache\");\n }\n\n // linux / other unix\n return join(homedir(), \".cache\", \"autometa\");\n}\n\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await access(path, fsConstants.F_OK);\n return true;\n } catch {\n return false;\n }\n}\n","import pc from \"picocolors\";\n\nimport type {\n RuntimeSummary,\n ScenarioStatus,\n SummaryContext,\n} from \"../runtime/types\";\n\nexport interface FormattedReport {\n readonly status: ScenarioStatus;\n readonly fullName: string;\n readonly durationMs?: number;\n readonly error?: Error;\n readonly reason?: string;\n}\n\nexport function formatScenarioReport(report: FormattedReport): string {\n const statusLabel = formatStatusLabel(report.status);\n const duration = report.durationMs !== undefined \n ? formatDuration(report.durationMs) \n : \"\";\n \n const nameWithDuration = duration \n ? `${report.fullName} ${pc.dim(`(${duration})`)}`\n : report.fullName;\n \n return `${statusLabel} ${nameWithDuration}`;\n}\n\nexport function formatStatusLabel(status: ScenarioStatus): string {\n switch (status) {\n case \"passed\":\n return pc.green(\"✓ PASS\");\n case \"failed\":\n return pc.red(\"✗ FAIL\");\n case \"skipped\":\n return pc.yellow(\"○ SKIP\");\n case \"pending\":\n return pc.cyan(\"◌ PEND\");\n default:\n return assertUnreachable(status);\n }\n}\n\nexport function formatDuration(ms: number): string {\n if (ms < 1) {\n return `${ms.toFixed(2)} ms`;\n }\n if (ms < 1000) {\n return `${ms.toFixed(0)} ms`;\n }\n return `${(ms / 1000).toFixed(2)} s`;\n}\n\nexport function formatError(error: Error): string {\n const stack = error.stack ?? error.message;\n // Indent each line and apply dim color to stack traces\n return stack\n .split(\"\\n\")\n .map((line, index) => {\n const indented = ` ${line}`;\n // First line (message) in red, stack traces in dim\n return index === 0 ? pc.red(indented) : pc.dim(indented);\n })\n .join(\"\\n\");\n}\n\nexport function formatReason(reason: string): string {\n return pc.dim(` Reason: ${reason}`);\n}\n\nexport function formatSummary(\n summary: RuntimeSummary,\n context: SummaryContext\n): string {\n const parts: string[] = [`Environment: ${pc.cyan(context.environment)}`];\n\n parts.push(`Total: ${pc.bold(String(summary.total))}`);\n\n if (summary.passed > 0) {\n parts.push(`Passed: ${pc.green(String(summary.passed))}`);\n }\n\n if (summary.failed > 0) {\n parts.push(`Failed: ${pc.red(String(summary.failed))}`);\n }\n\n if (summary.skipped > 0) {\n parts.push(`Skipped: ${pc.yellow(String(summary.skipped))}`);\n }\n\n if (summary.pending > 0) {\n parts.push(`Pending: ${pc.cyan(String(summary.pending))}`);\n }\n\n parts.push(`Duration: ${pc.dim(formatDuration(summary.durationMs))}`);\n\n return parts.join(\" | \");\n}\n\nexport function formatFeatureHeader(featureName: string): string {\n return `\\n${pc.bold(pc.blue(`Feature: ${featureName}`))}`;\n}\n\nexport function formatRuleHeader(ruleName: string, indent = 2): string {\n const spaces = \" \".repeat(indent);\n return `${spaces}${pc.bold(pc.magenta(`Rule: ${ruleName}`))}`;\n}\n\nfunction assertUnreachable(value: never): never {\n throw new Error(`Unhandled scenario status: ${String(value)}`);\n}\n","export interface SplitHandoverResult {\n readonly patterns: readonly string[];\n readonly runnerArgs: readonly string[];\n}\n\nexport function extractArgsAfterDoubleDash(rawArgv: readonly string[]): readonly string[] {\n const idx = rawArgv.indexOf(\"--\");\n if (idx < 0) {\n return [];\n }\n return rawArgv.slice(idx + 1);\n}\n\nexport function stripTrailingArgs(\n all: readonly string[],\n suffix: readonly string[]\n): readonly string[] {\n if (suffix.length === 0) {\n return [...all];\n }\n if (suffix.length > all.length) {\n return [...all];\n }\n\n const start = all.length - suffix.length;\n for (let i = 0; i < suffix.length; i += 1) {\n if (all[start + i] !== suffix[i]) {\n return [...all];\n }\n }\n\n return all.slice(0, start);\n}\n\nexport function splitPatternsAndRunnerArgs(options: {\n readonly patterns: readonly string[];\n readonly rawArgv: readonly string[];\n readonly handover?: boolean;\n}): SplitHandoverResult {\n const runnerArgs = options.handover ? extractArgsAfterDoubleDash(options.rawArgv) : [];\n const patterns = runnerArgs.length > 0\n ? stripTrailingArgs(options.patterns, runnerArgs)\n : [...options.patterns];\n\n return { patterns, runnerArgs };\n}\n","import { spawn, type SpawnOptions } from \"node:child_process\";\nimport { join } from \"node:path\";\nimport { existsSync } from \"node:fs\";\n\nimport type { ExecutorConfig } from \"@autometa/config\";\n\nexport type RunnerType = \"vitest\" | \"jest\" | \"playwright\" | \"default\";\n\nexport interface OrchestratorOptions {\n readonly cwd: string;\n readonly config: ExecutorConfig;\n readonly patterns?: readonly string[];\n /**\n * Extra args to pass directly to the detected native runner.\n * Intended for runner-specific flags like Jest `-t` or Vitest `--testNamePattern`.\n */\n readonly runnerArgs?: readonly string[];\n readonly dryRun?: boolean;\n readonly watch?: boolean;\n readonly verbose?: boolean;\n}\n\nexport interface OrchestratorResult {\n readonly success: boolean;\n readonly exitCode: number;\n readonly runner: RunnerType;\n}\n\n/**\n * Detects the appropriate runner based on config and project structure.\n */\nexport function detectRunner(config: ExecutorConfig, cwd: string): RunnerType {\n // Explicit runner from config takes priority\n if (config.runner === \"vitest\") {\n return \"vitest\";\n }\n if (config.runner === \"jest\") {\n return \"jest\";\n }\n if (config.runner === \"playwright\") {\n return \"playwright\";\n }\n\n // Auto-detect based on config files in project\n if (existsSync(join(cwd, \"vitest.config.ts\")) || existsSync(join(cwd, \"vitest.config.js\"))) {\n return \"vitest\";\n }\n if (existsSync(join(cwd, \"jest.config.js\")) || existsSync(join(cwd, \"jest.config.cjs\")) || existsSync(join(cwd, \"jest.config.ts\"))) {\n return \"jest\";\n }\n if (existsSync(join(cwd, \"playwright.config.ts\")) || existsSync(join(cwd, \"playwright.config.js\"))) {\n return \"playwright\";\n }\n\n // Fallback to default standalone runtime\n return \"default\";\n}\n\n/**\n * Smart Orchestrator that delegates to native test runners.\n * \n * This is the \"One Command to Rule Them All\" - users run `autometa run`\n * and we intelligently delegate to Vitest, Jest, or our standalone runtime.\n */\nexport async function orchestrate(options: OrchestratorOptions): Promise<OrchestratorResult> {\n const { cwd, config, patterns = [], runnerArgs = [], dryRun = false, watch = false, verbose = false } = options;\n const runner = detectRunner(config, cwd);\n\n if (verbose) {\n console.log(`[autometa] Detected runner: ${runner}`);\n }\n\n switch (runner) {\n case \"vitest\":\n return spawnVitest({ cwd, patterns, runnerArgs, dryRun, watch, verbose });\n case \"jest\":\n return spawnJest({ cwd, patterns, runnerArgs, dryRun, watch, verbose });\n case \"playwright\":\n return spawnPlaywright({ cwd, patterns, runnerArgs, dryRun, watch, verbose });\n case \"default\":\n // Return indicator that we should use the standalone runtime\n return { success: true, exitCode: 0, runner: \"default\" };\n }\n}\n\ninterface SpawnRunnerOptions {\n readonly cwd: string;\n readonly patterns: readonly string[];\n readonly runnerArgs: readonly string[];\n readonly dryRun: boolean;\n readonly watch: boolean;\n readonly verbose: boolean;\n}\n\n/**\n * Spawns Vitest with the autometa plugin.\n */\nasync function spawnVitest(options: SpawnRunnerOptions): Promise<OrchestratorResult> {\n const { cwd, patterns, runnerArgs, dryRun, watch, verbose } = options;\n\n const args: string[] = [];\n \n // Use run mode unless watch is requested\n if (!watch) {\n args.push(\"run\");\n }\n\n // Add pattern filters if provided\n if (patterns.length > 0) {\n // Vitest accepts file patterns directly\n args.push(...patterns);\n }\n\n // Dry run mode (vitest doesn't have native dry-run, but we can use --passWithNoTests)\n if (dryRun) {\n args.push(\"--passWithNoTests\");\n }\n\n if (runnerArgs.length > 0) {\n args.push(...runnerArgs);\n }\n\n if (verbose) {\n console.log(`[autometa] Running: vitest ${args.join(\" \")}`);\n }\n\n const result = await spawnRunner(\"vitest\", args, { cwd });\n return { ...result, runner: \"vitest\" };\n}\n\n/**\n * Spawns Jest with the autometa transformer.\n */\nasync function spawnJest(options: SpawnRunnerOptions): Promise<OrchestratorResult> {\n const { cwd, patterns, runnerArgs, dryRun, watch, verbose } = options;\n\n const args: string[] = [];\n\n // Watch mode\n if (watch) {\n args.push(\"--watch\");\n }\n\n // Add pattern filters if provided\n if (patterns.length > 0) {\n args.push(...patterns);\n }\n\n // Dry run mode - Jest uses --listTests\n if (dryRun) {\n args.push(\"--listTests\");\n }\n\n if (runnerArgs.length > 0) {\n args.push(...runnerArgs);\n }\n\n if (verbose) {\n console.log(`[autometa] Running: jest ${args.join(\" \")}`);\n }\n\n const result = await spawnRunner(\"jest\", args, { cwd });\n return { ...result, runner: \"jest\" };\n}\n\n/**\n * Spawns Playwright with the autometa loader.\n * \n * Playwright requires Node.js module hooks to transform .feature files.\n * We use `npx playwright test` with appropriate flags.\n */\nasync function spawnPlaywright(options: SpawnRunnerOptions): Promise<OrchestratorResult> {\n const { cwd, patterns, runnerArgs, dryRun, watch, verbose } = options;\n\n const args: string[] = [\"test\"];\n\n // Add pattern filters if provided (Playwright uses grep or file patterns)\n if (patterns.length > 0) {\n // Playwright accepts file patterns directly after 'test'\n args.push(...patterns);\n }\n\n // Dry run mode - Playwright uses --list to list tests\n if (dryRun) {\n args.push(\"--list\");\n }\n\n // Watch mode - Playwright uses --ui for interactive mode\n // Note: --ui opens a browser UI, which may not be ideal for all use cases\n // For headless watch-like behavior, we'd need a different approach\n if (watch) {\n args.push(\"--ui\");\n }\n\n if (runnerArgs.length > 0) {\n args.push(...runnerArgs);\n }\n\n if (verbose) {\n console.log(`[autometa] Running: playwright ${args.join(\" \")}`);\n }\n\n const loaderImportFlag = \"--import @autometa/playwright-loader/register\";\n const existingNodeOptions = process.env.NODE_OPTIONS ?? \"\";\n const hasLoaderFlag = existingNodeOptions.includes(loaderImportFlag);\n const nodeOptions = hasLoaderFlag\n ? existingNodeOptions\n : [existingNodeOptions, loaderImportFlag].filter(Boolean).join(\" \").trim();\n\n const result = await spawnRunner(\"playwright\", args, {\n cwd,\n env: {\n NODE_OPTIONS: nodeOptions,\n },\n });\n return { ...result, runner: \"playwright\" };\n}\n\n/**\n * Generic runner spawner with promise-based completion.\n */\nfunction spawnRunner(\n command: string,\n args: string[],\n options: { cwd: string; env?: NodeJS.ProcessEnv }\n): Promise<{ success: boolean; exitCode: number }> {\n return new Promise((resolve) => {\n const spawnOptions: SpawnOptions = {\n cwd: options.cwd,\n stdio: \"inherit\",\n shell: true,\n env: {\n ...process.env,\n FORCE_COLOR: process.env.FORCE_COLOR ?? \"1\",\n ...(options.env ?? {}),\n },\n };\n\n // Try to find the command in node_modules/.bin first\n const binPath = join(options.cwd, \"node_modules\", \".bin\", command);\n const actualCommand = existsSync(binPath) ? binPath : command;\n\n const child = spawn(actualCommand, args, spawnOptions);\n\n child.on(\"close\", (code) => {\n const exitCode = code ?? 0;\n resolve({\n success: exitCode === 0,\n exitCode,\n });\n });\n\n child.on(\"error\", (error) => {\n console.error(`[autometa] Failed to spawn ${command}:`, error.message);\n resolve({\n success: false,\n exitCode: 1,\n });\n });\n });\n}\n\n/**\n * Checks if a native runner is available for the project.\n */\nexport function isNativeRunnerAvailable(runner: RunnerType, cwd: string): boolean {\n if (runner === \"default\") {\n return true;\n }\n\n const binPath = join(cwd, \"node_modules\", \".bin\", runner);\n return existsSync(binPath);\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { Config } from "@autometa/config";
2
+ import type { ResolvedConfig } from "@autometa/config";
3
+ export interface LoadedExecutorConfig {
4
+ readonly filePath: string;
5
+ readonly config: Config;
6
+ readonly resolved: ResolvedConfig;
7
+ }
8
+ export interface LoadExecutorConfigOptions {
9
+ readonly configPath?: string;
10
+ readonly cacheDir?: string;
11
+ readonly external?: readonly string[];
12
+ readonly modules?: readonly string[];
13
+ readonly groups?: readonly string[];
14
+ readonly environment?: string;
15
+ }
16
+ export declare function loadExecutorConfig(cwd: string, options?: LoadExecutorConfigOptions): Promise<LoadedExecutorConfig>;
@@ -0,0 +1,6 @@
1
+ export interface ModuleLoadOptions {
2
+ readonly cwd: string;
3
+ readonly external?: readonly string[];
4
+ readonly cacheDir?: string;
5
+ }
6
+ export declare function loadModule(specifier: string, options: ModuleLoadOptions): Promise<Record<string, unknown>>;
@@ -0,0 +1,35 @@
1
+ import type { ExecutorConfig } from "@autometa/config";
2
+ export type RunnerType = "vitest" | "jest" | "playwright" | "default";
3
+ export interface OrchestratorOptions {
4
+ readonly cwd: string;
5
+ readonly config: ExecutorConfig;
6
+ readonly patterns?: readonly string[];
7
+ /**
8
+ * Extra args to pass directly to the detected native runner.
9
+ * Intended for runner-specific flags like Jest `-t` or Vitest `--testNamePattern`.
10
+ */
11
+ readonly runnerArgs?: readonly string[];
12
+ readonly dryRun?: boolean;
13
+ readonly watch?: boolean;
14
+ readonly verbose?: boolean;
15
+ }
16
+ export interface OrchestratorResult {
17
+ readonly success: boolean;
18
+ readonly exitCode: number;
19
+ readonly runner: RunnerType;
20
+ }
21
+ /**
22
+ * Detects the appropriate runner based on config and project structure.
23
+ */
24
+ export declare function detectRunner(config: ExecutorConfig, cwd: string): RunnerType;
25
+ /**
26
+ * Smart Orchestrator that delegates to native test runners.
27
+ *
28
+ * This is the "One Command to Rule Them All" - users run `autometa run`
29
+ * and we intelligently delegate to Vitest, Jest, or our standalone runtime.
30
+ */
31
+ export declare function orchestrate(options: OrchestratorOptions): Promise<OrchestratorResult>;
32
+ /**
33
+ * Checks if a native runner is available for the project.
34
+ */
35
+ export declare function isNativeRunnerAvailable(runner: RunnerType, cwd: string): boolean;
@@ -0,0 +1,17 @@
1
+ import "source-map-support/register";
2
+ import type { ExecutorRuntime, HookLogListener } from "@autometa/executor";
3
+ import type { RuntimeSummary } from "./types";
4
+ import { type HierarchicalReporterOptions, type RuntimeReporter } from "../utils/reporter";
5
+ export type { RuntimeSummary, ScenarioReport } from "./types";
6
+ export interface RuntimeOptions {
7
+ readonly dryRun?: boolean;
8
+ readonly reporters?: readonly RuntimeReporter[];
9
+ readonly reporter?: {
10
+ readonly hierarchical?: HierarchicalReporterOptions;
11
+ };
12
+ }
13
+ export declare function createCliRuntime(options?: RuntimeOptions): {
14
+ readonly runtime: ExecutorRuntime;
15
+ readonly hookLogger: HookLogListener;
16
+ execute(): Promise<RuntimeSummary>;
17
+ };
@@ -0,0 +1,24 @@
1
+ export type ScenarioStatus = "passed" | "failed" | "skipped" | "pending";
2
+ export interface ScenarioReport {
3
+ readonly name: string;
4
+ readonly fullName: string;
5
+ readonly path: readonly string[];
6
+ readonly status: ScenarioStatus;
7
+ readonly durationMs?: number;
8
+ readonly error?: Error;
9
+ readonly reason?: string;
10
+ }
11
+ export interface RuntimeSummary {
12
+ readonly total: number;
13
+ readonly passed: number;
14
+ readonly failed: number;
15
+ readonly skipped: number;
16
+ readonly pending: number;
17
+ readonly durationMs: number;
18
+ readonly success: boolean;
19
+ readonly scenarios: readonly ScenarioReport[];
20
+ }
21
+ export interface SummaryContext {
22
+ readonly environment: string;
23
+ }
24
+ export type SummaryFormatter = (summary: RuntimeSummary, context: SummaryContext) => string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolve the directory used by the CLI to write compiled/cached artifacts.
3
+ *
4
+ * Why this exists:
5
+ * - The CLI may need to transpile TS config/step modules at runtime.
6
+ * - Writing them to a stable cache avoids recompiling on every run.
7
+ *
8
+ * Design goals:
9
+ * - Prefer locations that are already ignored (node_modules/.cache) when available.
10
+ * - Otherwise use an OS-level cache directory to avoid polluting the project root.
11
+ * - Allow explicit overrides via env vars.
12
+ */
13
+ export declare function resolveCliCacheDir(cwd: string): Promise<string>;