{"version":3,"file":"index.mjs","names":["path","path","path"],"sources":["../../src/engine/manifest-reader.ts","../../src/verify/run-compat-check.ts","../../src/verify/run-overlay-retry-loop.ts","../../src/compat/staleness.ts","../../src/verify/run-staleness-check.ts","../../src/verify/run-smoke-check.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'node:fs';\nimport * as path from 'node:path';\nimport { MANIFEST_FILENAME } from './manifest.js';\n\n/** Minimal shape matching compat/overlay.ts ManifestEntry for cross-layer use. */\ninterface ManifestEntry {\n  operationId: string;\n  sdkResourceProperty: string;\n  sdkMethodName: string;\n  httpMethod: string;\n  path: string;\n  pathParams: string[];\n  bodyFields: string[];\n  queryFields: string[];\n}\n\n/**\n * Read the operations map from `.oagen-manifest.json` in the given directory\n * and convert it to `ManifestEntry[]` for the overlay builder.\n *\n * Returns undefined if the manifest is absent or has no operations field.\n */\nexport function readManifestSync(dir: string): ManifestEntry[] | undefined {\n  const manifestPath = path.join(dir, MANIFEST_FILENAME);\n  if (!existsSync(manifestPath)) return undefined;\n  try {\n    const parsed = JSON.parse(readFileSync(manifestPath, 'utf-8'));\n    const operations = parsed?.operations;\n    if (!operations || typeof operations !== 'object') return undefined;\n    return convertOperationsToManifestEntries(operations);\n  } catch {\n    return undefined;\n  }\n}\n\n/** Convert the operations map from .oagen-manifest.json into ManifestEntry[]. */\nfunction convertOperationsToManifestEntries(operations: Record<string, unknown>): ManifestEntry[] {\n  const entries: ManifestEntry[] = [];\n  for (const [httpKey, value] of Object.entries(operations)) {\n    const spaceIdx = httpKey.indexOf(' ');\n    const httpMethod = httpKey.slice(0, spaceIdx);\n    const httpPath = httpKey.slice(spaceIdx + 1);\n\n    const values = Array.isArray(value) ? value : [value];\n    for (const v of values) {\n      const entry = v as { sdkMethod?: string; service?: string };\n      entries.push({\n        operationId: '',\n        sdkResourceProperty: entry.service ?? '',\n        sdkMethodName: entry.sdkMethod ?? '',\n        httpMethod,\n        path: httpPath,\n        pathParams: [],\n        bodyFields: [],\n        queryFields: [],\n      });\n    }\n  }\n  return entries;\n}\n","import { getExtractor } from '../compat/extractor-registry.js';\nimport {\n  diffSnapshots,\n  specDerivedNames,\n  specDerivedFieldPaths,\n  specDerivedMethodPaths,\n  specDerivedEnumValues,\n  filterSurface,\n} from '../compat/differ.js';\nimport { apiSurfaceToSnapshot } from '../compat/ir.js';\nimport type { LanguageId } from '../compat/ir.js';\nimport { getDefaultPolicy, mergePolicy } from '../compat/policy.js';\nimport type { CompatPolicyHints } from '../compat/policy.js';\nimport type { ApiSpec } from '../ir/types.js';\nimport type { OperationResolution } from '../ir/operation-hints.js';\nimport type { ApiSurface, OverlayLookup } from '../compat/types.js';\nimport { buildOverlayLookup } from '../compat/overlay.js';\nimport { readManifestSync } from '../engine/manifest-reader.js';\nimport type { CompatCheckResult } from './types.js';\n\n/**\n * The overlay `generate --api-surface` writes the SDK in `outputDir` with:\n * the baseline's own names for the operations the `.oagen-manifest.json`\n * there maps (`buildOverlayLookup`), and nothing without a manifest. The\n * compat scope and the staleness check read it, so a baseline method the\n * overlay keeps (`Animals.fetchAll` for `GET /pets`) stays in scope under\n * the name `generate` wrote.\n */\nexport function manifestOverlay(baseline: ApiSurface, outputDir: string, spec: ApiSpec, lang: string): OverlayLookup {\n  return buildOverlayLookup(baseline, readManifestSync(outputDir), spec, getExtractor(lang).hints);\n}\n\n/**\n * Extract the generated SDK in `outputDir` and diff it against `baseline`.\n *\n * With a `spec`, the baseline is scoped to the symbols the spec derives\n * (`specDerivedNames`, `specDerivedMethodPaths`, `filterSurface`), read as\n * `generate` writes them under the `resolution`'s `mountRules`,\n * `operationHints` and `operationNaming` — the settings `generate` resolved\n * the SDK's operations with. Under `mountRules: { Pets: 'Animals' }` the\n * `Animals` class is in scope with the methods its operations resolve to, so\n * a method the SDK lost from it is reported removed; read from the IR as\n * parsed, `Animals` was no name the spec derived and the loss passed. With\n * the `overlay` `generate --api-surface` writes with (see\n * {@link manifestOverlay}; the retry loop passes the one it patches), a\n * baseline method the overlay maps to one of the spec's operations stays in\n * scope under its own name, so an SDK that renamed `Animals.fetchAll` is\n * reported and the retry can restore it.\n */\nexport async function runCompatCheck(\n  baseline: ApiSurface,\n  outputDir: string,\n  lang: string,\n  spec?: ApiSpec,\n  policyOverrides?: Partial<CompatPolicyHints>,\n  resolution?: OperationResolution,\n  overlay?: Pick<OverlayLookup, 'methodByOperation'>,\n): Promise<CompatCheckResult> {\n  const extractor = getExtractor(lang);\n  const candidate = await extractor.extract(outputDir);\n\n  let scopedBaseline = baseline;\n  let scopedToSpec = false;\n  let scopedSymbolCount: number | undefined;\n  if (spec) {\n    const allowed = specDerivedNames(spec, extractor.hints, resolution);\n    const fieldPaths = specDerivedFieldPaths(spec, extractor.hints);\n    const methodPaths = specDerivedMethodPaths(spec, resolution, overlay);\n    const enumVals = specDerivedEnumValues(spec);\n    scopedBaseline = filterSurface(baseline, allowed, { fieldPaths, methodPaths, enumValues: enumVals });\n    scopedToSpec = true;\n    scopedSymbolCount =\n      Object.keys(scopedBaseline.interfaces).length +\n      Object.keys(scopedBaseline.classes).length +\n      Object.keys(scopedBaseline.typeAliases).length +\n      Object.keys(scopedBaseline.enums).length;\n  }\n\n  const baseSnap = apiSurfaceToSnapshot(scopedBaseline);\n  const candSnap = apiSurfaceToSnapshot(candidate);\n\n  const langId = lang as LanguageId;\n  const policy = policyOverrides ? mergePolicy(getDefaultPolicy(langId), policyOverrides) : getDefaultPolicy(langId);\n\n  const diff = diffSnapshots(baseSnap, candSnap, policy);\n  const passed = diff.changes.every((c) => c.severity !== 'breaking');\n\n  return { passed, diff, scopedToSpec, scopedSymbolCount };\n}\n","import { readdirSync, unlinkSync, statSync, openSync, readSync, closeSync } from 'node:fs';\nimport * as path from 'node:path';\nimport { buildOverlayLookup, patchOverlay, isPatchableChange } from '../compat/overlay.js';\nimport { getExtractor } from '../compat/extractor-registry.js';\nimport type { ApiSurface } from '../compat/types.js';\nimport type { ApiSpec } from '../ir/types.js';\nimport type { OperationHint, OperationNaming, OperationResolution } from '../ir/operation-hints.js';\nimport { getEmitter } from '../engine/registry.js';\nimport { generate } from '../engine/orchestrator.js';\nimport { runCompatCheck } from './run-compat-check.js';\nimport type { OverlayRetryResult } from './types.js';\nimport { readManifestSync } from '../engine/manifest-reader.js';\n\n/** Generated file header markers used by various emitters. */\nconst GENERATED_MARKERS = ['Code generated by oagen', 'auto-generated by oagen', 'This file is auto-generated'];\n\n/**\n * Delete oagen-generated source files so the retry loop can regenerate them\n * with overlay-corrected names. Only deletes files that contain an oagen\n * generation marker, preserving hand-written files.\n */\nfunction cleanGeneratedFiles(dir: string): void {\n  let entries: string[];\n  try {\n    entries = readdirSync(dir);\n  } catch {\n    return;\n  }\n  for (const entry of entries) {\n    const full = path.join(dir, entry);\n    let stat;\n    try {\n      stat = statSync(full);\n    } catch {\n      continue;\n    }\n    if (stat.isDirectory()) {\n      cleanGeneratedFiles(full);\n      continue;\n    }\n    // Skip non-source files and manifests\n    if (entry.endsWith('.json') || entry.endsWith('.lock')) continue;\n    // Read only the first 200 bytes to check for generation marker\n    try {\n      const buf = Buffer.alloc(200);\n      const fd = openSync(full, 'r');\n      try {\n        readSync(fd, buf, 0, 200, 0);\n      } finally {\n        closeSync(fd);\n      }\n      const header = buf.toString('utf-8');\n      if (GENERATED_MARKERS.some((m) => header.includes(m))) {\n        unlinkSync(full);\n      }\n    } catch {\n      // ignore read/delete errors\n    }\n  }\n}\n\nexport async function runOverlayRetryLoop(opts: {\n  baseline: ApiSurface;\n  parsedSpec: ApiSpec;\n  outputDir: string;\n  lang: string;\n  maxRetries: number;\n  namespace?: string;\n  // The settings `generate` hands the engine from the config. The retry\n  // regenerates with them so it rewrites the SDK `generate` wrote rather than\n  // another one: without `mountRules` and `operationHints` it wrote a `Pets`\n  // service with `list_pets` beside the `Animals` service with `list_all`\n  // that `generate` writes (#567).\n  operationHints?: Record<string, OperationHint>;\n  mountRules?: Record<string, string>;\n  operationNaming?: OperationNaming;\n  modelHints?: Record<string, string>;\n  emitterOptions?: Record<string, unknown>;\n  onRetry?: (attemptNumber: number, maxRetries: number, patchableCount: number) => void;\n}): Promise<OverlayRetryResult> {\n  const { baseline, parsedSpec, outputDir, lang, maxRetries, namespace, onRetry } = opts;\n  // The compat scope reads the classes and methods the same settings resolve\n  // the operations to, so each check compares the SDK `generate` wrote (#600),\n  // and the overlay of the attempt, so a baseline method it keeps (the\n  // manifest's `fetchAll` for `GET /pets`, or one a patch restored) stays in\n  // scope under its own name.\n  const resolution: OperationResolution = {\n    operationHints: opts.operationHints,\n    mountRules: opts.mountRules,\n    operationNaming: opts.operationNaming,\n  };\n\n  const manifest = readManifestSync(outputDir);\n  // Pass language-specific hints so property-to-class matching works correctly\n  // (e.g., Ruby snake_case \"api_keys\" → PascalCase \"ApiKeys\").\n  const extractor = getExtractor(lang);\n  let overlay = buildOverlayLookup(baseline, manifest, parsedSpec, extractor.hints);\n  let prevPreserved = -1;\n  const patchedPerIteration: number[] = [];\n\n  for (let attempt = 0; attempt <= maxRetries; attempt++) {\n    const compatResult = await runCompatCheck(baseline, outputDir, lang, parsedSpec, undefined, resolution, overlay);\n    if (compatResult.passed) {\n      return {\n        status: 'passed',\n        attempts: attempt,\n        patchedPerIteration,\n        compatResult,\n      };\n    }\n\n    if (attempt === maxRetries) {\n      return {\n        status: 'max-retries',\n        attempts: attempt,\n        patchedPerIteration,\n        compatResult,\n      };\n    }\n\n    const patchable = compatResult.diff.changes.filter(isPatchableChange);\n    if (patchable.length === 0) {\n      return {\n        status: 'no-patchable',\n        attempts: attempt,\n        patchedPerIteration,\n        compatResult,\n      };\n    }\n\n    const currentBreaking = compatResult.diff.summary.breaking;\n    // Stall detection: if breaking count hasn't decreased, we're not making progress\n    if (attempt > 0 && currentBreaking >= prevPreserved) {\n      return {\n        status: 'stalled',\n        attempts: attempt,\n        patchedPerIteration,\n        compatResult,\n      };\n    }\n    prevPreserved = currentBreaking;\n    patchedPerIteration.push(patchable.length);\n    onRetry?.(attempt + 1, maxRetries, patchable.length);\n\n    overlay = patchOverlay(overlay, patchable, baseline);\n\n    // Pre-delete generated source files so the writer creates them fresh\n    // with overlay-corrected names. Without this, the AST merger would preserve\n    // old method/class names from the existing files.\n    // Only delete files that look like oagen-generated source files (have the header).\n    cleanGeneratedFiles(outputDir);\n\n    const emitter = getEmitter(lang);\n    await generate(parsedSpec, emitter, {\n      namespace: namespace ?? parsedSpec.name,\n      outputDir,\n      overlayLookup: overlay,\n      apiSurface: baseline,\n      operationHints: opts.operationHints,\n      mountRules: opts.mountRules,\n      operationNaming: opts.operationNaming,\n      modelHints: opts.modelHints,\n      emitterOptions: opts.emitterOptions,\n    });\n  }\n\n  const compatResult = await runCompatCheck(baseline, outputDir, lang, parsedSpec, undefined, resolution, overlay);\n  return {\n    status: 'max-retries',\n    attempts: maxRetries,\n    patchedPerIteration,\n    compatResult,\n  };\n}\n","import type { ApiSurface, LanguageHints, OverlayLookup, Violation } from './types.js';\nimport type { ApiSpec } from '../ir/types.js';\nimport type { OperationResolution } from '../ir/operation-hints.js';\nimport {\n  specDerivedNames,\n  specDerivedFieldPaths,\n  specDerivedMethodPaths,\n  memberKeysByClass,\n  normalizeMemberName,\n} from './spec-filter.js';\n\n/**\n * Detect symbols that exist in the live SDK surface but are no longer defined\n * in the current OpenAPI spec. These are \"stale\" — they compile and run but\n * represent dead code from a previous spec version.\n *\n * Requires both the old and new spec so we can distinguish hand-written SDK\n * symbols (never in any spec) from genuinely removed spec symbols.\n *\n * Both specs are read as `generate` writes them, under the `resolution`'s\n * `mountRules`, `operationHints` and `operationNaming` (see\n * `specDerivedNames` and `specDerivedMethodPaths`): a service class is the\n * mount target, so under `mountRules: { Pets: 'Animals' }` a live `Animals`\n * class is stale once the new spec drops the `Pets` tag, and a method is stale\n * when the old spec's resolution names it on its class — by the resolved name,\n * a split wrapper's name or the IR's operation name, matched with underscores\n * stripped and case folded — and the new spec's does not: a live\n * `Animals.listAll` under `operationHints: { 'GET /pets': { name: 'list_all' } }`\n * once the new spec drops `GET /pets`, whether or not another service still\n * mounts on `Animals`. A class the new spec no longer names is reported once,\n * at the class level, not again per method. With the `overlay` `generate\n * --api-surface` writes with, a baseline method it maps to an operation\n * (`.oagen-manifest.json`: `GET /pets` → `Animals.fetchAll`) is keyed under\n * that name too, so it is stale once the new spec drops the route (see\n * `specDerivedMethodPaths`).\n */\nexport function detectStaleSymbols(\n  liveSurface: ApiSurface,\n  oldSpec: ApiSpec,\n  newSpec: ApiSpec,\n  hints: LanguageHints,\n  resolution?: OperationResolution,\n  overlay?: Pick<OverlayLookup, 'methodByOperation'>,\n): Violation[] {\n  const violations: Violation[] = [];\n\n  // Step 1-3: Name-set difference for top-level symbols\n  const oldNames = specDerivedNames(oldSpec, hints, resolution);\n  const newNames = specDerivedNames(newSpec, hints, resolution);\n\n  const removedNames = new Set<string>();\n  for (const name of oldNames) {\n    if (!newNames.has(name)) removedNames.add(name);\n  }\n\n  for (const name of removedNames) {\n    if (liveSurface.classes[name]) {\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: name,\n        baseline: name,\n        candidate: '(removed from spec)',\n        message: `Class \"${name}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n    if (liveSurface.interfaces[name]) {\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: name,\n        baseline: name,\n        candidate: '(removed from spec)',\n        message: `Interface \"${name}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n    if (liveSurface.typeAliases[name]) {\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: name,\n        baseline: name,\n        candidate: '(removed from spec)',\n        message: `Type alias \"${name}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n    if (liveSurface.enums[name]) {\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: name,\n        baseline: name,\n        candidate: '(removed from spec)',\n        message: `Enum \"${name}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n  }\n\n  // Step 4-6: Field-level staleness for models that still exist in new spec\n  const oldFieldPaths = specDerivedFieldPaths(oldSpec, hints);\n  const newFieldPaths = specDerivedFieldPaths(newSpec, hints);\n\n  for (const fieldPath of oldFieldPaths) {\n    if (newFieldPaths.has(fieldPath)) continue;\n\n    const [modelName, fieldName] = fieldPath.split('.');\n    // Only flag field-level staleness for models that still exist in the new spec\n    // (fully removed models are already caught above)\n    if (removedNames.has(modelName)) continue;\n\n    const iface = liveSurface.interfaces[modelName];\n    if (iface?.fields[fieldName]) {\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: fieldPath,\n        baseline: fieldName,\n        candidate: '(removed from spec)',\n        message: `Field \"${fieldPath}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n  }\n\n  // Step 7: Method-level staleness on classes that still exist in the new\n  // spec: a live method the old spec's resolution named on its class, by any\n  // of its keys, and the new spec's resolution does not. Read per class, not\n  // from the differ's `operation-removed` changes: those are keyed by the\n  // IR's service and operation names, and a removed service yields none at\n  // all, so the methods of a service merged onto a surviving mount target\n  // were never found.\n  const oldMembers = memberKeysByClass(specDerivedMethodPaths(oldSpec, resolution, overlay));\n  const newMembers = memberKeysByClass(specDerivedMethodPaths(newSpec, resolution, overlay));\n\n  for (const [className, members] of oldMembers) {\n    // A class the new spec no longer names is reported above, once.\n    if (removedNames.has(className)) continue;\n    const cls = liveSurface.classes[className];\n    if (!cls) continue;\n    const surviving = newMembers.get(className);\n    for (const methodName of Object.keys(cls.methods)) {\n      const key = normalizeMemberName(methodName);\n      if (!members.has(key) || surviving?.has(key)) continue;\n      violations.push({\n        category: 'staleness',\n        severity: 'warning',\n        symbolPath: `${className}.${methodName}`,\n        baseline: methodName,\n        candidate: '(removed from spec)',\n        message: `Method \"${className}.${methodName}\" is no longer defined in the OpenAPI spec`,\n      });\n    }\n  }\n\n  return violations;\n}\n","import { getExtractor } from '../compat/extractor-registry.js';\nimport { detectStaleSymbols } from '../compat/staleness.js';\nimport type { ApiSpec } from '../ir/types.js';\nimport type { OperationResolution } from '../ir/operation-hints.js';\nimport type { ApiSurface, OverlayLookup } from '../compat/types.js';\nimport type { StalenessCheckResult } from './types.js';\n\n/**\n * Find the symbols of `baseline` the old spec derived and the new spec no\n * longer does (`detectStaleSymbols`), both read as `generate` writes them\n * under the `resolution`'s `mountRules`, `operationHints` and\n * `operationNaming`, so a remounted service and its methods are found stale\n * on the class `generate` wrote them to, and under the `overlay` `generate\n * --api-surface` wrote with (see `manifestOverlay`), so a baseline method the\n * manifest maps to a dropped operation is found stale under its own name.\n */\nexport function runStalenessCheck(\n  baseline: ApiSurface,\n  oldSpec: ApiSpec,\n  newSpec: ApiSpec,\n  lang: string,\n  resolution?: OperationResolution,\n  overlay?: Pick<OverlayLookup, 'methodByOperation'>,\n): StalenessCheckResult {\n  const extractor = getExtractor(lang);\n  const violations = detectStaleSymbols(baseline, oldSpec, newSpec, extractor.hints, resolution, overlay);\n  return { violations };\n}\n","import { execFileSync } from 'node:child_process';\nimport { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';\nimport { tmpdir } from 'node:os';\nimport { fileURLToPath } from 'node:url';\nimport * as path from 'node:path';\nimport { CommandError } from '../errors.js';\nimport type { ApiSpec } from '../ir/types.js';\nimport type { SmokeCheckResult } from './types.js';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nfunction resolveScript(scriptRelPath: string): { bin: string; script: string } {\n  const distScript = path.resolve(__dirname, '..', '..', 'dist', 'scripts', scriptRelPath.replace(/\\.ts$/, '.mjs'));\n  if (existsSync(distScript)) {\n    return { bin: 'node', script: distScript };\n  }\n  const srcScript = path.resolve(__dirname, '..', '..', 'scripts', scriptRelPath);\n  return { bin: 'npx', script: srcScript };\n}\n\nfunction runPackagedScript(scriptRelPath: string, args: string[]): void {\n  const { bin, script } = resolveScript(scriptRelPath);\n  const fullArgs = bin === 'npx' ? ['tsx', script, ...args] : [script, ...args];\n  execFileSync(bin, fullArgs, { stdio: 'inherit', env: process.env });\n}\n\n/**\n * Run the smoke step: the spec-only baseline when no raw baseline exists,\n * then the runner (and its diff) against the baseline.\n *\n * The smoke scripts run as subprocesses and take `--spec`, which a script\n * parses bare — without the config's settings, which cannot cross a process\n * boundary. `parsedSpec` is what `--spec` parses to with those settings, as\n * `generate` parses it; it is written to a file for the scripts' lifetime\n * and handed to both as `--ir <path>` beside `--spec`, so the baseline lists\n * the operations `generate` reads (`Pets.list` under an `operationIdTransform`\n * that strips `PetsController_`, no `Pets.get` under a `transformSpec` that\n * drops `/pets/{id}`) and a runner that reads the file plans the same ones\n * (#567). Without `parsedSpec`, each script parses `--spec` as before.\n */\nexport function runSmokeCheck(opts: {\n  spec?: string;\n  /** What `--spec` parses to with the config's settings (see above). */\n  parsedSpec?: ApiSpec;\n  lang: string;\n  output: string;\n  rawResults?: string;\n  smokeConfig?: string;\n  smokeRunner?: string;\n}): SmokeCheckResult {\n  const { spec, parsedSpec, lang, output, rawResults, smokeConfig, smokeRunner } = opts;\n\n  const irDir = parsedSpec ? mkdtempSync(path.join(tmpdir(), 'oagen-verify-')) : undefined;\n  const irArgs: string[] = [];\n  if (irDir) {\n    const irPath = path.join(irDir, 'spec-ir.json');\n    writeFileSync(irPath, JSON.stringify(parsedSpec));\n    irArgs.push('--ir', irPath);\n  }\n\n  try {\n    return runSmokeScripts({ spec, lang, output, rawResults, smokeConfig, smokeRunner, irArgs });\n  } finally {\n    if (irDir) rmSync(irDir, { recursive: true, force: true });\n  }\n}\n\nfunction runSmokeScripts(opts: {\n  spec?: string;\n  lang: string;\n  output: string;\n  rawResults?: string;\n  smokeConfig?: string;\n  smokeRunner?: string;\n  /** `--ir <path>` when the IR `--spec` parses to was handed over; else empty. */\n  irArgs: string[];\n}): SmokeCheckResult {\n  const { spec, lang, output, rawResults, smokeConfig, smokeRunner, irArgs } = opts;\n\n  let baselinePath = rawResults ?? 'smoke-results-raw.json';\n  let generatedBaseline = false;\n\n  if (!rawResults && !existsSync('smoke-results-raw.json')) {\n    if (!spec) {\n      throw new CommandError(\n        'error: --spec <path> or OPENAPI_SPEC_PATH env var is required when no raw baseline exists',\n        '',\n        1,\n      );\n    }\n\n    try {\n      runPackagedScript('smoke/baseline.ts', ['--spec', spec, ...irArgs]);\n    } catch {\n      throw new CommandError('Baseline generation failed', '', 1);\n    }\n    baselinePath = 'smoke-results-spec-baseline.json';\n    generatedBaseline = true;\n  }\n\n  const smokeArgs = ['--lang', lang, '--sdk-path', output, '--raw-results', baselinePath];\n  if (spec) smokeArgs.push('--spec', spec, ...irArgs);\n  if (smokeConfig) smokeArgs.push('--smoke-config', smokeConfig);\n\n  try {\n    if (smokeRunner) {\n      const bin = smokeRunner.endsWith('.ts') ? 'npx' : 'node';\n      const fullArgs = bin === 'npx' ? ['tsx', smokeRunner, ...smokeArgs] : [smokeRunner, ...smokeArgs];\n      execFileSync(bin, fullArgs, { stdio: 'inherit', env: process.env });\n    } else {\n      runPackagedScript('smoke/sdk-test.ts', smokeArgs);\n    }\n\n    return { passed: true, baselinePath, generatedBaseline };\n  } catch {\n    if (existsSync('smoke-compile-errors.json')) {\n      return { passed: false, compileErrors: true, baselinePath, generatedBaseline };\n    }\n\n    const findingsCount = existsSync('smoke-diff-findings.json')\n      ? (JSON.parse(readFileSync('smoke-diff-findings.json', 'utf-8')) as unknown[]).length\n      : undefined;\n\n    return { passed: false, findingsCount, baselinePath, generatedBaseline };\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAAgB,iBAAiB,KAA0C;CACzE,MAAM,eAAeA,OAAK,KAAK,KAAK,iBAAiB;CACrD,IAAI,CAAC,WAAW,YAAY,GAAG,OAAO,KAAA;CACtC,IAAI;EAEF,MAAM,aADS,KAAK,MAAM,aAAa,cAAc,OAAO,CACpC,CAAC,EAAE;EAC3B,IAAI,CAAC,cAAc,OAAO,eAAe,UAAU,OAAO,KAAA;EAC1D,OAAO,mCAAmC,UAAU;CACtD,QAAQ;EACN;CACF;AACF;;AAGA,SAAS,mCAAmC,YAAsD;CAChG,MAAM,UAA2B,CAAC;C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