executable-stories-formatters 0.15.1 → 0.17.0

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { C as CIInfo, T as TestRunResult, a as TestCaseResult, S as StoryStep, D as DocEntry, b as TestStatus$1, N as NormalizedTicket, A as Attachment, c as DocPhase, O as OtelSpan, d as StepResult, e as CIProvider, R as RawStatus, f as RawAttachment, g as RawRun, h as RawCIInfo, i as StepKeyword$1, j as adaptJestRun, k as adaptPlaywrightRun, l as adaptVitestRun } from './index-CXrzCk9p.cjs';
2
2
  export { m as CIInfo, n as CoverageSummary, J as JestAdapterOptions, o as JestAggregatedResult, p as JestFileResult, q as JestTestResult, r as OtelAttributeValue, P as PlaywrightAdapterOptions, s as PlaywrightAnnotation, t as PlaywrightAttachment, u as PlaywrightError, v as PlaywrightLocation, w as PlaywrightStatus, x as PlaywrightTestCase, y as PlaywrightTestResult, z as RawStepEvent, B as RawTestCase, E as STORY_META_KEY, F as StepMode, G as StoryFileReport, H as StoryMeta, I as TestCaseAttempt, K as TestCaseEvidence, V as VitestAdapterOptions, L as VitestSerializedError, M as VitestState, Q as VitestTestCase, U as VitestTestModule, W as VitestTestResult, X as toCIInfo, Y as toRawCIInfo } from './index-CXrzCk9p.cjs';
3
+ import * as http from 'node:http';
3
4
 
4
5
  /**
5
6
  * Notification types for webhook integrations (Slack, Teams).
@@ -502,7 +503,7 @@ interface ResolvedFormatterOptions {
502
503
  allowMissingAssets: boolean;
503
504
  }
504
505
 
505
- type ScenarioChangeKind = "added" | "removed" | "regressed" | "fixed" | "changed" | "unchanged";
506
+ type ScenarioChangeKind = "added" | "removed" | "renamed" | "moved" | "regressed" | "fixed" | "changed" | "unchanged";
506
507
  interface ScenarioChangeFlags {
507
508
  status: boolean;
508
509
  steps: boolean;
@@ -541,12 +542,22 @@ interface ScenarioDiff {
541
542
  flags: ScenarioChangeFlags;
542
543
  changedFields: string[];
543
544
  durationDeltaMs?: number;
545
+ /** For `renamed`/`moved`: the baseline test-case id this behaviour was matched from. */
546
+ previousId?: string;
547
+ /** For `renamed`/`moved`: match confidence in 0..1 (1 = exact content fingerprint). */
548
+ matchConfidence?: number;
549
+ /** For `renamed`/`moved`: how the baseline/current pair was re-identified. */
550
+ matchedBy?: "fingerprint" | "similarity";
544
551
  }
545
552
  interface RunDiffSummary {
546
553
  totalBaseline: number;
547
554
  totalCurrent: number;
548
555
  added: number;
549
556
  removed: number;
557
+ /** Behaviours re-identified across a title change (content preserved). */
558
+ renamed: number;
559
+ /** Behaviours re-identified across a file move (content preserved). */
560
+ moved: number;
550
561
  changed: number;
551
562
  regressed: number;
552
563
  fixed: number;
@@ -1703,11 +1714,17 @@ interface RegenerateDeps {
1703
1714
  readFile?: (filePath: string) => string;
1704
1715
  }
1705
1716
  /**
1706
- * Read a raw-run (or canonical) file and regenerate the requested agent
1707
- * artifacts via the canonical {@link ReportGenerator}. Returns the written
1708
- * file paths. This is the unit of work the watcher repeats; it is also useful
1709
- * standalone for a one-shot regenerate.
1717
+ * Read a raw-run (or canonical) file once, canonicalize it, and regenerate the
1718
+ * requested agent artifacts via the canonical {@link ReportGenerator}. Returns
1719
+ * both the written file paths and the canonical run, so a caller that also needs
1720
+ * the run (e.g. `serve`, to diff it) does not read and canonicalize a second
1721
+ * time. This is the unit of work the watcher repeats.
1710
1722
  */
1723
+ declare function regenerateRun(options: WatchOptions, deps?: RegenerateDeps): Promise<{
1724
+ files: string[];
1725
+ run: TestRunResult;
1726
+ }>;
1727
+ /** Regenerate artifacts and return just the written file paths. */
1711
1728
  declare function regenerateArtifacts(options: WatchOptions, deps?: RegenerateDeps): Promise<string[]>;
1712
1729
  interface WatchDeps extends RegenerateDeps {
1713
1730
  /** Watch a path, calling the listener on every change. Injectable for tests. */
@@ -1729,6 +1746,94 @@ interface WatchHandle {
1729
1746
  */
1730
1747
  declare function startWatch(options: WatchOptions, deps?: WatchDeps): WatchHandle;
1731
1748
 
1749
+ interface ServeOptions {
1750
+ /** Path to the raw-run (or canonical) JSON the framework adapter writes. */
1751
+ input: string;
1752
+ outputDir: string;
1753
+ outputName: string;
1754
+ formats: OutputFormat[];
1755
+ /** Input is "raw" (default) or already-canonical "canonical". */
1756
+ inputType?: "raw" | "canonical";
1757
+ /** Synthesize story metadata for plain tests (raw input only). Default true. */
1758
+ synthesize?: boolean;
1759
+ /** Port for the live server. Default 4321. */
1760
+ port?: number;
1761
+ /** Host to bind. Default "127.0.0.1". */
1762
+ host?: string;
1763
+ /** Coalesce rapid change events. Default 150ms. */
1764
+ debounceMs?: number;
1765
+ }
1766
+ /**
1767
+ * The realtime state the server renders. The session baseline is pinned to the
1768
+ * first run we observe after boot, so the headline tracks the whole loop's
1769
+ * trajectory rather than the noise between any two adjacent iterations.
1770
+ */
1771
+ interface RunState {
1772
+ /** First run observed this session — the trajectory anchor. */
1773
+ sessionBaseline: TestRunResult | null;
1774
+ /** The run immediately before {@link current} — the per-iteration anchor. */
1775
+ previous: TestRunResult | null;
1776
+ /** Latest run. */
1777
+ current: TestRunResult | null;
1778
+ /** How many runs we have observed since boot. */
1779
+ runCount: number;
1780
+ }
1781
+ /**
1782
+ * Fold a freshly-read run into the prior state. Pure so the trajectory logic is
1783
+ * testable without a server or filesystem: the first run pins the session
1784
+ * baseline; later runs shift `previous`/`current` forward.
1785
+ */
1786
+ declare function advanceState(prev: RunState, run: TestRunResult): RunState;
1787
+ /** The two diffs the live view — and a portal payload — care about. */
1788
+ interface RunDeltas {
1789
+ /** Versus the first run of the session: the loop's trajectory. */
1790
+ session: RunDiffResult | null;
1791
+ /** Versus the immediately-previous run: what the last iteration did. */
1792
+ iteration: RunDiffResult | null;
1793
+ }
1794
+ /**
1795
+ * Derive the session and per-iteration diffs from the run history. Both are null
1796
+ * until there are two runs to compare. Pure, computed once per run — this is the
1797
+ * single source the strip renders from and the same payload a portal sink would
1798
+ * push, so neither re-runs the compare engine.
1799
+ */
1800
+ declare function computeDeltas(state: RunState): RunDeltas;
1801
+ /**
1802
+ * Render the delta strip that sits above the report. This is the one thing a
1803
+ * dumb static server cannot do — it needs the prior runs and the compare
1804
+ * engine. Pure, so the copy is unit-testable.
1805
+ */
1806
+ declare function renderDeltaStrip(state: RunState): string;
1807
+ /**
1808
+ * Inject the live bits into a generated (static) report without touching the
1809
+ * file on disk: the strip after <body>, the style + reload client before
1810
+ * </body>. The artifact stays a clean static file for the CI/Action path.
1811
+ */
1812
+ declare function injectLiveBits(html: string, stripHtml: string): string;
1813
+ interface ServeDeps {
1814
+ readFile?: (filePath: string) => string;
1815
+ watch?: (filePath: string, listener: () => void) => {
1816
+ close: () => void;
1817
+ };
1818
+ log?: (message: string) => void;
1819
+ /** Inject a server factory for tests. */
1820
+ createServer?: (handler: http.RequestListener) => http.Server;
1821
+ }
1822
+ interface ServeHandle {
1823
+ /** Resolved listening port (useful when port 0 picks a free one). */
1824
+ port: number;
1825
+ close: () => void;
1826
+ }
1827
+ /**
1828
+ * Serve the living docs at a URL and push a reload whenever the framework
1829
+ * rewrites its raw-run. The watch loop (debounce, coalesce, initial build) is
1830
+ * delegated to {@link startWatch}; `serve` only adds the HTTP surface and, on
1831
+ * each run, the delta strip — "what changed since you started this loop" —
1832
+ * rendered from the in-memory run history. That strip is the one thing a static
1833
+ * file server cannot give you.
1834
+ */
1835
+ declare function startServe(options: ServeOptions, deps?: ServeDeps): ServeHandle;
1836
+
1732
1837
  interface BehaviorDiffEntry {
1733
1838
  id: string;
1734
1839
  title: string;
@@ -3531,4 +3636,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
3531
3636
  */
3532
3637
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
3533
3638
 
3534
- export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, Attachment, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, CIProvider, type CanonicalizeOptions, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, DocEntry, DocPhase, ES_THEME_TOKENS_CSS, ES_THEME_TOKEN_VALUES, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type HtmlDocOptions, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, RawAttachment, RawCIInfo, RawRun, RawStatus, type RecordDeploymentArgs, type RecordDeploymentResult, type ReleaseManifest, ReleaseManifestFormatter, type ReportAttachment, type ReportCIInfo, type ReportCoverageSummary, type ReportDocCode, type ReportDocCustom, type ReportDocEntry, type ReportDocKv, type ReportDocLink, type ReportDocMermaid, type ReportDocNote, type ReportDocScreenshot, type ReportDocSection, type ReportDocTable, type ReportDocTag, type ReportFeature, ReportGenerator, type ReportScenario, type ReportStep, type ReportSummary, type ReportTicket, type ResolvedFormatterOptions, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, STORY_REPORT_SCHEMA_MAJOR, STORY_REPORT_SCHEMA_VERSION, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StepKeyword$1 as StepKeyword, StepResult, type StoryReport, StoryReportJsonFormatter, type StoryReportJsonOptions, type StoryReportSchemaVersion, StoryStep, TestCaseResult, type TestHistory, type TestMetrics, TestRunResult, TestStatus$1 as TestStatus, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, CIInfo as TypedCIInfo, type ValidationResult, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, buildCheck, buildGoal, buildHtmlDocEntry, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, classifyStatusChange, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveAudience, deriveChangeType, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readPackageVersion, recordDeployment, regenerateArtifacts, renderCheck, renderGoal, renderTriage, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, startWatch, stripAnsi, toBehaviorManifest, toReleaseManifest, toScenarioIndex, toStoryReport, toTraceabilityMatrix, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
3639
+ export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, Attachment, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, CIProvider, type CanonicalizeOptions, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, DocEntry, DocPhase, ES_THEME_TOKENS_CSS, ES_THEME_TOKEN_VALUES, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type HtmlDocOptions, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, RawAttachment, RawCIInfo, RawRun, RawStatus, type RecordDeploymentArgs, type RecordDeploymentResult, type ReleaseManifest, ReleaseManifestFormatter, type ReportAttachment, type ReportCIInfo, type ReportCoverageSummary, type ReportDocCode, type ReportDocCustom, type ReportDocEntry, type ReportDocKv, type ReportDocLink, type ReportDocMermaid, type ReportDocNote, type ReportDocScreenshot, type ReportDocSection, type ReportDocTable, type ReportDocTag, type ReportFeature, ReportGenerator, type ReportScenario, type ReportStep, type ReportSummary, type ReportTicket, type ResolvedFormatterOptions, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, type RunDeltas, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type RunState, STORY_REPORT_SCHEMA_MAJOR, STORY_REPORT_SCHEMA_VERSION, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type ServeDeps, type ServeHandle, type ServeOptions, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StepKeyword$1 as StepKeyword, StepResult, type StoryReport, StoryReportJsonFormatter, type StoryReportJsonOptions, type StoryReportSchemaVersion, StoryStep, TestCaseResult, type TestHistory, type TestMetrics, TestRunResult, TestStatus$1 as TestStatus, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, CIInfo as TypedCIInfo, type ValidationResult, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, advanceState, assertValidRun, buildCheck, buildGoal, buildHtmlDocEntry, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, classifyStatusChange, clearVersionCache, computeDeltas, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveAudience, deriveChangeType, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, injectLiveBits, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, renderCheck, renderDeltaStrip, renderGoal, renderTriage, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, startServe, startWatch, stripAnsi, toBehaviorManifest, toReleaseManifest, toScenarioIndex, toStoryReport, toTraceabilityMatrix, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { C as CIInfo, T as TestRunResult, a as TestCaseResult, S as StoryStep, D as DocEntry, b as TestStatus$1, N as NormalizedTicket, A as Attachment, c as DocPhase, O as OtelSpan, d as StepResult, e as CIProvider, R as RawStatus, f as RawAttachment, g as RawRun, h as RawCIInfo, i as StepKeyword$1, j as adaptJestRun, k as adaptPlaywrightRun, l as adaptVitestRun } from './index-CXrzCk9p.js';
2
2
  export { m as CIInfo, n as CoverageSummary, J as JestAdapterOptions, o as JestAggregatedResult, p as JestFileResult, q as JestTestResult, r as OtelAttributeValue, P as PlaywrightAdapterOptions, s as PlaywrightAnnotation, t as PlaywrightAttachment, u as PlaywrightError, v as PlaywrightLocation, w as PlaywrightStatus, x as PlaywrightTestCase, y as PlaywrightTestResult, z as RawStepEvent, B as RawTestCase, E as STORY_META_KEY, F as StepMode, G as StoryFileReport, H as StoryMeta, I as TestCaseAttempt, K as TestCaseEvidence, V as VitestAdapterOptions, L as VitestSerializedError, M as VitestState, Q as VitestTestCase, U as VitestTestModule, W as VitestTestResult, X as toCIInfo, Y as toRawCIInfo } from './index-CXrzCk9p.js';
3
+ import * as http from 'node:http';
3
4
 
4
5
  /**
5
6
  * Notification types for webhook integrations (Slack, Teams).
@@ -502,7 +503,7 @@ interface ResolvedFormatterOptions {
502
503
  allowMissingAssets: boolean;
503
504
  }
504
505
 
505
- type ScenarioChangeKind = "added" | "removed" | "regressed" | "fixed" | "changed" | "unchanged";
506
+ type ScenarioChangeKind = "added" | "removed" | "renamed" | "moved" | "regressed" | "fixed" | "changed" | "unchanged";
506
507
  interface ScenarioChangeFlags {
507
508
  status: boolean;
508
509
  steps: boolean;
@@ -541,12 +542,22 @@ interface ScenarioDiff {
541
542
  flags: ScenarioChangeFlags;
542
543
  changedFields: string[];
543
544
  durationDeltaMs?: number;
545
+ /** For `renamed`/`moved`: the baseline test-case id this behaviour was matched from. */
546
+ previousId?: string;
547
+ /** For `renamed`/`moved`: match confidence in 0..1 (1 = exact content fingerprint). */
548
+ matchConfidence?: number;
549
+ /** For `renamed`/`moved`: how the baseline/current pair was re-identified. */
550
+ matchedBy?: "fingerprint" | "similarity";
544
551
  }
545
552
  interface RunDiffSummary {
546
553
  totalBaseline: number;
547
554
  totalCurrent: number;
548
555
  added: number;
549
556
  removed: number;
557
+ /** Behaviours re-identified across a title change (content preserved). */
558
+ renamed: number;
559
+ /** Behaviours re-identified across a file move (content preserved). */
560
+ moved: number;
550
561
  changed: number;
551
562
  regressed: number;
552
563
  fixed: number;
@@ -1703,11 +1714,17 @@ interface RegenerateDeps {
1703
1714
  readFile?: (filePath: string) => string;
1704
1715
  }
1705
1716
  /**
1706
- * Read a raw-run (or canonical) file and regenerate the requested agent
1707
- * artifacts via the canonical {@link ReportGenerator}. Returns the written
1708
- * file paths. This is the unit of work the watcher repeats; it is also useful
1709
- * standalone for a one-shot regenerate.
1717
+ * Read a raw-run (or canonical) file once, canonicalize it, and regenerate the
1718
+ * requested agent artifacts via the canonical {@link ReportGenerator}. Returns
1719
+ * both the written file paths and the canonical run, so a caller that also needs
1720
+ * the run (e.g. `serve`, to diff it) does not read and canonicalize a second
1721
+ * time. This is the unit of work the watcher repeats.
1710
1722
  */
1723
+ declare function regenerateRun(options: WatchOptions, deps?: RegenerateDeps): Promise<{
1724
+ files: string[];
1725
+ run: TestRunResult;
1726
+ }>;
1727
+ /** Regenerate artifacts and return just the written file paths. */
1711
1728
  declare function regenerateArtifacts(options: WatchOptions, deps?: RegenerateDeps): Promise<string[]>;
1712
1729
  interface WatchDeps extends RegenerateDeps {
1713
1730
  /** Watch a path, calling the listener on every change. Injectable for tests. */
@@ -1729,6 +1746,94 @@ interface WatchHandle {
1729
1746
  */
1730
1747
  declare function startWatch(options: WatchOptions, deps?: WatchDeps): WatchHandle;
1731
1748
 
1749
+ interface ServeOptions {
1750
+ /** Path to the raw-run (or canonical) JSON the framework adapter writes. */
1751
+ input: string;
1752
+ outputDir: string;
1753
+ outputName: string;
1754
+ formats: OutputFormat[];
1755
+ /** Input is "raw" (default) or already-canonical "canonical". */
1756
+ inputType?: "raw" | "canonical";
1757
+ /** Synthesize story metadata for plain tests (raw input only). Default true. */
1758
+ synthesize?: boolean;
1759
+ /** Port for the live server. Default 4321. */
1760
+ port?: number;
1761
+ /** Host to bind. Default "127.0.0.1". */
1762
+ host?: string;
1763
+ /** Coalesce rapid change events. Default 150ms. */
1764
+ debounceMs?: number;
1765
+ }
1766
+ /**
1767
+ * The realtime state the server renders. The session baseline is pinned to the
1768
+ * first run we observe after boot, so the headline tracks the whole loop's
1769
+ * trajectory rather than the noise between any two adjacent iterations.
1770
+ */
1771
+ interface RunState {
1772
+ /** First run observed this session — the trajectory anchor. */
1773
+ sessionBaseline: TestRunResult | null;
1774
+ /** The run immediately before {@link current} — the per-iteration anchor. */
1775
+ previous: TestRunResult | null;
1776
+ /** Latest run. */
1777
+ current: TestRunResult | null;
1778
+ /** How many runs we have observed since boot. */
1779
+ runCount: number;
1780
+ }
1781
+ /**
1782
+ * Fold a freshly-read run into the prior state. Pure so the trajectory logic is
1783
+ * testable without a server or filesystem: the first run pins the session
1784
+ * baseline; later runs shift `previous`/`current` forward.
1785
+ */
1786
+ declare function advanceState(prev: RunState, run: TestRunResult): RunState;
1787
+ /** The two diffs the live view — and a portal payload — care about. */
1788
+ interface RunDeltas {
1789
+ /** Versus the first run of the session: the loop's trajectory. */
1790
+ session: RunDiffResult | null;
1791
+ /** Versus the immediately-previous run: what the last iteration did. */
1792
+ iteration: RunDiffResult | null;
1793
+ }
1794
+ /**
1795
+ * Derive the session and per-iteration diffs from the run history. Both are null
1796
+ * until there are two runs to compare. Pure, computed once per run — this is the
1797
+ * single source the strip renders from and the same payload a portal sink would
1798
+ * push, so neither re-runs the compare engine.
1799
+ */
1800
+ declare function computeDeltas(state: RunState): RunDeltas;
1801
+ /**
1802
+ * Render the delta strip that sits above the report. This is the one thing a
1803
+ * dumb static server cannot do — it needs the prior runs and the compare
1804
+ * engine. Pure, so the copy is unit-testable.
1805
+ */
1806
+ declare function renderDeltaStrip(state: RunState): string;
1807
+ /**
1808
+ * Inject the live bits into a generated (static) report without touching the
1809
+ * file on disk: the strip after <body>, the style + reload client before
1810
+ * </body>. The artifact stays a clean static file for the CI/Action path.
1811
+ */
1812
+ declare function injectLiveBits(html: string, stripHtml: string): string;
1813
+ interface ServeDeps {
1814
+ readFile?: (filePath: string) => string;
1815
+ watch?: (filePath: string, listener: () => void) => {
1816
+ close: () => void;
1817
+ };
1818
+ log?: (message: string) => void;
1819
+ /** Inject a server factory for tests. */
1820
+ createServer?: (handler: http.RequestListener) => http.Server;
1821
+ }
1822
+ interface ServeHandle {
1823
+ /** Resolved listening port (useful when port 0 picks a free one). */
1824
+ port: number;
1825
+ close: () => void;
1826
+ }
1827
+ /**
1828
+ * Serve the living docs at a URL and push a reload whenever the framework
1829
+ * rewrites its raw-run. The watch loop (debounce, coalesce, initial build) is
1830
+ * delegated to {@link startWatch}; `serve` only adds the HTTP surface and, on
1831
+ * each run, the delta strip — "what changed since you started this loop" —
1832
+ * rendered from the in-memory run history. That strip is the one thing a static
1833
+ * file server cannot give you.
1834
+ */
1835
+ declare function startServe(options: ServeOptions, deps?: ServeDeps): ServeHandle;
1836
+
1732
1837
  interface BehaviorDiffEntry {
1733
1838
  id: string;
1734
1839
  title: string;
@@ -3531,4 +3636,4 @@ declare function normalizeVitestResults(testModules: Parameters<typeof adaptVite
3531
3636
  */
3532
3637
  declare function normalizePlaywrightResults(testResults: Parameters<typeof adaptPlaywrightRun>[0], adapterOptions?: Parameters<typeof adaptPlaywrightRun>[1], canonicalizeOptions?: CanonicalizeOptions): TestRunResult;
3533
3638
 
3534
- export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, Attachment, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, CIProvider, type CanonicalizeOptions, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, DocEntry, DocPhase, ES_THEME_TOKENS_CSS, ES_THEME_TOKEN_VALUES, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type HtmlDocOptions, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, RawAttachment, RawCIInfo, RawRun, RawStatus, type RecordDeploymentArgs, type RecordDeploymentResult, type ReleaseManifest, ReleaseManifestFormatter, type ReportAttachment, type ReportCIInfo, type ReportCoverageSummary, type ReportDocCode, type ReportDocCustom, type ReportDocEntry, type ReportDocKv, type ReportDocLink, type ReportDocMermaid, type ReportDocNote, type ReportDocScreenshot, type ReportDocSection, type ReportDocTable, type ReportDocTag, type ReportFeature, ReportGenerator, type ReportScenario, type ReportStep, type ReportSummary, type ReportTicket, type ResolvedFormatterOptions, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, STORY_REPORT_SCHEMA_MAJOR, STORY_REPORT_SCHEMA_VERSION, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StepKeyword$1 as StepKeyword, StepResult, type StoryReport, StoryReportJsonFormatter, type StoryReportJsonOptions, type StoryReportSchemaVersion, StoryStep, TestCaseResult, type TestHistory, type TestMetrics, TestRunResult, TestStatus$1 as TestStatus, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, CIInfo as TypedCIInfo, type ValidationResult, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, assertValidRun, buildCheck, buildGoal, buildHtmlDocEntry, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, classifyStatusChange, clearVersionCache, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveAudience, deriveChangeType, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readPackageVersion, recordDeployment, regenerateArtifacts, renderCheck, renderGoal, renderTriage, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, startWatch, stripAnsi, toBehaviorManifest, toReleaseManifest, toScenarioIndex, toStoryReport, toTraceabilityMatrix, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };
3639
+ export { type AstroAssetResult, AstroFormatter, type AstroFormatterOptions as AstroFormatterOpts, Attachment, type BehaviorDebuggerIssue, type BehaviorDiff, type BehaviorDiffEntry, type BehaviorManifest, BehaviorManifestJsonFormatter, type BehaviorManifestJsonOptions, type BehaviorSourceFile, type BehaviorTag, type BundleOptions, type BundleResult, CIProvider, type CanonicalizeOptions, type ChangeType, type ChangedFile, type ChangedFileReview, type CheckArgs, type CheckDeps, type CheckFailure, type CheckReport, type CheckStep, type ColocatedStyle, type CompareFormat, type CompareFormatterOptions, type ConfluenceAuth, ConfluenceFormatter, type ConfluenceFormatterOptions as ConfluenceFormatterOpts, type CopyMarkdownAssetsOptions, CucumberHtmlFormatter, type CucumberHtmlOptions, CucumberJsonFormatter, type CucumberJsonOptions, CucumberMessagesFormatter, type CucumberMessagesOptions, type DeploymentEntry, type DeploymentLedger, type DeploymentStatus, DocEntry, DocPhase, ES_THEME_TOKENS_CSS, ES_THEME_TOKEN_VALUES, type EnvironmentDrift, type EvidenceStrength, type ExecutableStoriesConfig, type FetchFn, type FileChangeKind, type FlakinessLevel, type Formatter, type FormatterOptions, type GenerateArgs, type GenerateCompareResult, type GenerateDeps, type GenerateResult, type GenericWebhookNotifierOptions, type GoalArgs, type GoalDeps, type GoalReport, type GoalRequirementResult, type HistoryEntry, type HistoryStore, type HtmlDocOptions, HtmlFormatter, type HtmlOptions, type HtmlTheme, type HtmlThemeName, type IJsonDataTable, type IJsonDocString, type IJsonEmbedding, type IJsonFeature, type IJsonScenario, type IJsonStep, type IJsonStepArgument, type IJsonStepResult, type IJsonTableRow, type IJsonTag, JUnitFormatter, type JUnitOptions, type JiraAuth, type JiraPublishMode, type ListScenariosArgs, type ListScenariosDeps, type Logger, MIN_FLAKINESS_SAMPLES, MIN_METRIC_SAMPLES, MIN_PERF_SAMPLES, MarkdownFormatter, type MarkdownFormatterOptions, type MarkdownOptions, type MarkdownRenderers, NormalizedTicket, type NotificationSummary, type NotifyCondition, OtelSpan, type OtelTraceContext, type OutputConfig, type OutputFormat, type OutputMode, type OutputRule, type PerformanceTrend, type PublishConfluenceArgs, type PublishConfluenceDeps, type PublishConfluenceResult, type PublishJiraArgs, type PublishJiraDeps, type PublishJiraResult, type RatchetViolation, RawAttachment, RawCIInfo, RawRun, RawStatus, type RecordDeploymentArgs, type RecordDeploymentResult, type ReleaseManifest, ReleaseManifestFormatter, type ReportAttachment, type ReportCIInfo, type ReportCoverageSummary, type ReportDocCode, type ReportDocCustom, type ReportDocEntry, type ReportDocKv, type ReportDocLink, type ReportDocMermaid, type ReportDocNote, type ReportDocScreenshot, type ReportDocSection, type ReportDocTable, type ReportDocTag, type ReportFeature, ReportGenerator, type ReportScenario, type ReportStep, type ReportSummary, type ReportTicket, type ResolvedFormatterOptions, type ReviewAudience, type ReviewBand, type ReviewClaim, type ReviewContext, ReviewHtmlFormatter, type ReviewHtmlOptions, ReviewMarkdownFormatter, type ReviewMarkdownOptions, type ReviewResult, type ReviewSummary, type RunDeltas, RunDiffHtmlFormatter, type RunDiffHtmlOptions, RunDiffMarkdownFormatter, type RunDiffMarkdownOptions, type RunDiffResult, type RunDiffSummary, type RunState, STORY_REPORT_SCHEMA_MAJOR, STORY_REPORT_SCHEMA_VERSION, type ScenarioChangeFlags, type ScenarioChangeKind, type ScenarioDiff, type ScenarioIndex, type ScenarioIndexFilters, type ScenarioIndexItem, ScenarioIndexJsonFormatter, type ScenarioIndexJsonOptions, type ScenarioIndexStep, type ScenarioSnapshot, type ServeDeps, type ServeHandle, type ServeOptions, type SortTestCasesMode, type StabilityGrade, type StarlightBadge, StepKeyword$1 as StepKeyword, StepResult, type StoryReport, StoryReportJsonFormatter, type StoryReportJsonOptions, type StoryReportSchemaVersion, StoryStep, TestCaseResult, type TestHistory, type TestMetrics, TestRunResult, TestStatus$1 as TestStatus, type TraceabilityMatrix, TraceabilityMatrixFormatter, type TraceabilityRequirement, type TriageArgs, type TriageDeps, type TriageItem, type TriageReport, CIInfo as TypedCIInfo, type ValidationResult, type WatchDeps, type WatchHandle, type WatchOptions, type WebhookPayload, type WebhookSignerHmac, type WriteFile, adaptJestRun, adaptPlaywrightRun, adaptVitestRun, advanceState, assertValidRun, buildCheck, buildGoal, buildHtmlDocEntry, buildReview, buildTriage, bundleAssets, calculateFlakiness, calculateStability, canonicalizeRun, classifyStatusChange, clearVersionCache, computeDeltas, computeTestMetrics, copyMarkdownAssets, createPrCommentSummary, createReportGenerator, deriveAudience, deriveChangeType, deriveStepResults, detectCI, detectPerformanceTrend, diffRuns, diffStoryReports, findGitDir, formatDuration, generateRunComparison, generateRunId, generateTestCaseId, getAvailableThemes, getCssOnlyThemes, getDeploymentStatus, getEnvironmentDrift, gradeEvidence, hasSufficientHistory, injectLiveBits, isReviewableSource, isTestFile, joinNameAndExt, listScenarios, loadHistory, mergeStepResults, msToNanoseconds, nanosecondsToMs, normalizeJestResults, normalizePlaywrightResults, normalizeStatus, normalizeVitestResults, parseEnvelopes, parseNdjson, publishConfluencePage, publishJiraIssue, readBranchName, readGitSha, readPackageVersion, recordDeployment, regenerateArtifacts, regenerateRun, renderCheck, renderDeltaStrip, renderGoal, renderTriage, resolveAttachment, resolveAttachments, resolveTheme, resolveTraceUrl, rewriteAssetPaths, saveHistory, scenariosCoveringPaths, sendNotifications, sendSlackNotification, sendTeamsNotification, sendWebhookNotification, signBody, slugify, startServe, startWatch, stripAnsi, toBehaviorManifest, toReleaseManifest, toScenarioIndex, toStoryReport, toTraceabilityMatrix, tryGetActiveOtelContext, updateHistory, validateCanonicalRun };