import { defineCommand } from '@kb-labs/sdk';
import { captureBaseline, buildBaselineReport } from '@kb-labs/qa-core';

// src/cli/commands/baseline-update.ts
var baseline_update_default = defineCommand({
  id: "baseline:update",
  description: "Run full QA and save as new baseline",
  handler: {
    async execute(ctx, input) {
      const { ui } = ctx;
      const flags = input.flags ?? input;
      const rootDir = ctx.cwd;
      const snapshot = await captureBaseline(rootDir);
      if (flags.json) {
        ui?.json?.(snapshot);
        return { exitCode: 0 };
      }
      const sections = buildBaselineReport(snapshot);
      for (const section of sections) {
        ui?.success?.(section.header, {
          title: section.header,
          sections: [{ header: "", items: section.lines }]
        });
      }
      ui?.success?.("Baseline captured successfully", {});
      return { exitCode: 0 };
    }
  }
});

export { baseline_update_default as default };
//# sourceMappingURL=baseline-update.js.map
//# sourceMappingURL=baseline-update.js.map