@ingcreators/annot-product-docs 0.1.0 → 0.3.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/CHANGELOG.md ADDED
@@ -0,0 +1,295 @@
1
+ # @ingcreators/annot-product-docs
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5778902: **MDX resolver moves home + auto-registers into the screenshot
8
+ patch** — Phase 2 of
9
+ `docs/plans/playwright-screenshot-fixture-relayer.md`. The
10
+ MDX-aware annotation pipeline that powers
11
+ `page.screenshot({ annot: { mdx: { id, path } } })` now lives in
12
+ `@ingcreators/annot-product-docs` (the package that already owns
13
+ MDX parsing + the `screen.capture()` fixture). Calls go through
14
+ annot-playwright's generic patch + the new
15
+ `annotSourceResolvers` hook registry, so consumers no longer
16
+ need an Astro peer dep for the dogfood tour pattern:
17
+
18
+ ```ts
19
+ // Was: @ingcreators/annot-product-docs-astro/playwright
20
+ import { test } from "@ingcreators/annot-product-docs";
21
+
22
+ test("docs tour", async ({ page }) => {
23
+ await page.goto(APP_URL);
24
+ await page.screenshot({
25
+ path: "shots/app-overview.png",
26
+ annot: {
27
+ mdx: { id: "app-overview", path: "src/content/docs/app/index.mdx" },
28
+ tags: { source: "docs-tour", screen: "app-overview" },
29
+ },
30
+ });
31
+ });
32
+ ```
33
+
34
+ The `annot: { mdx }` resolver fires in two stages:
35
+ 1. `prepare()` — calls `captureScreen(page, { id, mdxPath })`
36
+ internally, refreshing the MDX's `annot:snapshot` +
37
+ `annot:attributes` blocks against the live page BEFORE the
38
+ raw screenshot is taken.
39
+ 2. `resolveAnnotations(dims)` — reads the freshly-written
40
+ `annot:snapshot` block + `<Overlay match>` entries and
41
+ returns page-space `BboxNumberedBadgeAnnotation[]` which
42
+ annot-playwright merges with any caller-supplied
43
+ `annot.overlays` before rebasing onto the clipped image.
44
+
45
+ **New public surface**
46
+ - `resolveMdxAnnotations({ mdxPath, screenId, dims, cwd? })` —
47
+ pure-data resolver used by both the Playwright hook and the
48
+ Astro Image Service (Phase 4 of the relayer plan switches
49
+ product-docs-astro's `renderAnnotatedScreen` to consume it).
50
+ - `parseSnapshotBoxes(yaml)` / `buildBadgeAnnotations(overlays,
51
+ boxed, dims)` — exposed for callers that want to drive
52
+ annotation production from custom snapshot pipelines.
53
+ - `svgFromBboxAnnotations(annotations)` /
54
+ `svgFromBadges(badges)` / `emptyAnnotationsSvg()` — single-root
55
+ `<svg>` wrappers that the headless annotator's `annotationsSvg`
56
+ input expects.
57
+ - `BoxedEntry` type — parsed aria-snapshot YAML entry with
58
+ `[ref=…]` + `[box=…]` markers.
59
+
60
+ **Compatibility**
61
+ - Module augmentation extends annot-playwright's
62
+ `AnnotScreenshotOptions` with the `mdx?: { id, path }` field
63
+ via `declare module "@ingcreators/annot-playwright"`. Imports
64
+ from `@ingcreators/annot-product-docs/fixture` or the package
65
+ root register the resolver via side-effect.
66
+ - The existing
67
+ `@ingcreators/annot-product-docs-astro/playwright` subpath
68
+ continues to work unchanged (it ships its own duplicate
69
+ augmentation + patch — Phase 4 of the plan converts that subpath
70
+ into a deprecated re-export pointing here).
71
+ - `packages/docs-site/tests/docs/annot-app.spec.ts` — the
72
+ dogfood tour spec swaps `import { test } from
73
+ "@ingcreators/annot-product-docs-astro/playwright"` to
74
+ `"@ingcreators/annot-product-docs"`. PNG output stays
75
+ byte-identical (same patch → same composer → same encoder).
76
+
77
+ ### Patch Changes
78
+
79
+ - 96e7625: **`screen` fixture → `productDocs`, `capture` method → `sync`** —
80
+ Phase 3 of `docs/plans/playwright-screenshot-fixture-relayer.md`.
81
+ The fixture's old name reads like a Playwright built-in and
82
+ collides with `@testing-library/react`'s `screen`; `capture`
83
+ implies a screenshot but the method actually synchronizes MDX
84
+ comment blocks. The rename aligns with the established
85
+ `annotator` convention from `@ingcreators/annot-annotator`.
86
+
87
+ ```ts
88
+ // Was:
89
+ test("login", async ({ page, screen }) => {
90
+ await screen.capture({ id: "login", mdxPath: "..." });
91
+ });
92
+
93
+ // Now:
94
+ test("login", async ({ page, productDocs }) => {
95
+ await productDocs.sync({ id: "login", mdxPath: "..." });
96
+ });
97
+ ```
98
+
99
+ **Back-compat — old names keep working**:
100
+ - Fixture: `test.extend({ screen })` is preserved alongside
101
+ `productDocs`. Both expose the same `.sync()` method (the
102
+ deprecated `.capture()` method on `screen` aliases `.sync()`).
103
+ - Standalone helper: `captureScreen` re-exports the new
104
+ `syncProductDocs` implementation. `captureScreen ===
105
+ syncProductDocs` is true — reference-equal so callers that
106
+ identity-check the function across the rename boundary keep
107
+ working.
108
+ - Types: `Screen` aliases `ProductDocs`, `ScreenCaptureOptions`
109
+ aliases `ProductDocsSyncOptions`. Both flagged
110
+ `@deprecated` in JSDoc; deletion is scheduled for the
111
+ deprecation window noted in
112
+ `living-spec-authoring-roadmap.md` OQ-08.
113
+
114
+ **In-tree consumers migrated**:
115
+ - `packages/product-docs/src/cli.ts` — `annot docs sync` /
116
+ `annot docs lint --fix` call `syncProductDocs` directly. The
117
+ `init` scaffold's sample tour uses `productDocs.sync(...)`.
118
+ - `packages/product-docs-astro/src/playwright/fixture.ts` —
119
+ imports `syncProductDocs` (was `captureScreen`).
120
+ - `packages/docs-site/src/content/docs/product-docs/playwright-tour.mdx`
121
+ - `getting-started/product-docs.mdx` +
122
+ `api/product-docs.mdx` + `concepts.mdx` +
123
+ `recipes/living-product-docs.mdx` — all example snippets
124
+ updated to the new names.
125
+ - `packages/product-docs/README.md` — quickstart updated.
126
+
127
+ **Test of the back-compat surface** — a new
128
+ `fixture.test.ts` case asserts `captureScreen === syncProductDocs`
129
+ so the alias contract is enforced by CI; any future refactor
130
+ that breaks the reference equality fails the build.
131
+
132
+ - 85d40e6: **Docs + CLAUDE.md + plan archive** — Phase 5 (final) of
133
+ `docs/plans/_done/playwright-screenshot-fixture-relayer.md`.
134
+ Refreshes the doc surfaces, the operational CLAUDE.md notes,
135
+ and archives the relayer plan into `_done/`.
136
+
137
+ ## Doc surface updates
138
+ - `packages/docs-site/src/content/docs/product-docs/playwright-fixture.mdx`
139
+ — recommended import paths updated; new "Choosing your import"
140
+ section covers the `@ingcreators/annot-product-docs` (MDX)
141
+ vs. `@ingcreators/annot-playwright` (no MDX) split; companion
142
+ helpers section now imports from the canonical homes; codegen
143
+ workflow example swapped to `@ingcreators/annot-product-docs`.
144
+ - `packages/docs-site/src/content/docs/api/create-annotator.mdx`
145
+ — "From a Playwright test" example imports from the canonical
146
+ home; mentions the no-MDX alternative.
147
+ - `packages/playwright/README.md` — adds the
148
+ `page.screenshot({ annot: { … } })` (recommended) section
149
+ above the existing `annotator.annotateScreenshot(...)` flow;
150
+ documents the `annotSourceResolvers` extension hook + the
151
+ coordinate-rebase helpers.
152
+ - `packages/product-docs/README.md` — adds a `page.screenshot({
153
+ annot })` Playwright fixture section explaining the
154
+ productDocs.sync + MDX-resolver bundle.
155
+ - `packages/product-docs-astro/README.md` — replaces the
156
+ Playwright fixture section with a Migration note pointing at
157
+ the canonical homes; documents the `0.5.0` removal target.
158
+
159
+ ## CLAUDE.md monorepo layout
160
+ - `playwright/` entry now describes the canonical
161
+ `page.screenshot({ annot })` patch + `annotSourceResolvers`
162
+ extension hook. Version bumped to 0.4.0.
163
+ - `product-docs/` entry mentions the `productDocs` fixture
164
+ rename + the MDX-aware resolver registration via the hook
165
+ registry. Version bumped to 0.3.0.
166
+ - `product-docs-astro/` entry calls out the deprecated
167
+ `/playwright` re-export shim + 0.5.0 removal target.
168
+ `@playwright/test` no longer a peer dep. Version bumped to
169
+ 0.3.0.
170
+
171
+ ## Plan archive
172
+ - `docs/plans/playwright-screenshot-fixture-relayer.md` →
173
+ `docs/plans/_done/playwright-screenshot-fixture-relayer.md`.
174
+ Status header switched to `Done` with the four landing PRs
175
+ enumerated. Internal `./_done/...` link paths updated to
176
+ `./...` (the plan is itself inside `_done/` now).
177
+ - `docs/plans/README.md` — removed the active entry, added a
178
+ "Recently landed plans" row pointing at the archived plan
179
+ with a multi-phase summary covering all four landing PRs.
180
+ - `docs/plans/living-spec-authoring-roadmap.md` — three link
181
+ references updated to point at the archived path; the "How
182
+ this relates" line switched from "Already Draft" to "Landed
183
+ 2026-05-22 (PRs #962 / #963 / #964 / #966)".
184
+
185
+ No source code changes; verified via `pnpm -r typecheck`,
186
+ `pnpm test`, `pnpm lint` regardless to confirm the doc/comment
187
+ edits parse cleanly.
188
+
189
+ - Updated dependencies [f979374]
190
+ - Updated dependencies [85d40e6]
191
+ - @ingcreators/annot-playwright@0.4.0
192
+
193
+ ## 0.2.0
194
+
195
+ ### Minor Changes
196
+
197
+ - 2e92c97: First publish of the living-product-docs package family. Phases
198
+ 1-5 + 7 of `docs/plans/living-product-docs.md` landed across
199
+ PRs 876-899; this entry flips the three packages from
200
+ `private: true` to publishable and stamps `0.1.0`.
201
+
202
+ ### `@ingcreators/annot-product-docs`
203
+ - MDX parser (`parseMdx` / `parseMdxFile`) — Remark / unified
204
+ pipeline that walks `.mdx` files with `annot:` frontmatter
205
+ and extracts `<Screen>` / `<Overlay>` / `<Transition>` /
206
+ `<HistoryEntry>` / `<ScreenList>` JSX components.
207
+ - Match resolver (`parseSnapshot` / `resolveMatch` /
208
+ `resolveOverlays`) for the Playwright `aria-snapshot`
209
+ YAML, honouring `match.under` disambiguation and emitting
210
+ `not-found` / `ambiguous` / `renamed` / `role-changed` /
211
+ `live-mismatch` diagnostics.
212
+ - `screen` fixture extending `@ingcreators/annot-playwright`
213
+ with `screen.capture({ id, mdxPath })` that re-syncs
214
+ `annot:snapshot` + `annot:attributes` MDX comment blocks
215
+ in place.
216
+ - Drift detector (`detectDrift` / `detectDriftFromYaml`) — six
217
+ finding kinds (added / removed / renamed / role-changed /
218
+ duplicated / attribute-drift) with severity buckets.
219
+ - `annot-docs` CLI (`init` / `sync` / `lint`) with `--json`
220
+ / `--ci` / `--fix` flags + a sample GitHub Actions workflow
221
+ emitting GitHub annotations on PR diff views.
222
+
223
+ ### `@ingcreators/annot-product-docs-astro`
224
+ - `productDocsIntegration()` Astro 5.x integration factory.
225
+ - 7 docs components: `<Screen>`, `<Overlay>`, `<Transition>`,
226
+ `<TransitionTable>`, `<HistoryEntry>`, `<ScreenList>`,
227
+ `<TransitionGraph>`. Shipped as `.astro` source under
228
+ `./components/*.astro` exports.
229
+ - Image Service (`renderAnnotatedScreen` + SHA-keyed
230
+ `createFileCache` / `createMemoryCache`) that composes the
231
+ base screenshot with overlay callouts at build time.
232
+
233
+ ### `@ingcreators/annot-product-docs-xlsx`
234
+ - MDX → normalised bundle extractor; per-role default layout
235
+ (cover / history / list / screen / reference); customer-
236
+ template support with `{var}` placeholder substitution
237
+ (including `{annot:date}` special vars + `{name:format}`
238
+ date formatting); Excel Named Range writers
239
+ (`annotImage` / `annotItemTable` / `annotHistory` /
240
+ `annotList` / `annotSnapshot` / `annotAttributes`).
241
+ - `annot-docs-xlsx render` CLI with multi-book emit + per-book
242
+ template config.
243
+
244
+ ### Patch Changes
245
+
246
+ - 657a685: **Republish with `dist/` included.** The `0.1.0` tarballs of all
247
+ three packages shipped to npm without their `dist/` directory —
248
+ the `publish.yml` workflow's pre-pack `pnpm build` step had only
249
+ filtered four other packages, so `pnpm pack` packed the three
250
+ `product-docs*` packages against empty `dist/`s. The
251
+ `publishConfig.main` (`./dist/index.js`) consequently pointed at
252
+ a missing file, breaking `npm install` for every consumer.
253
+
254
+ The source fix landed in
255
+ [#947](https://github.com/ingcreators/annot/pull/947) with two
256
+ defences:
257
+ 1. Three new `--filter` lines in the workflow's build step so
258
+ all seven publishable packages get built before pack.
259
+ 2. A per-package `prepack` script (`pnpm run build`) so even a
260
+ misconfigured workflow (or a manual `pnpm pack` / `pnpm
261
+ publish`) refreshes `dist/` before packing.
262
+
263
+ No source-code changes in any of the three packages — only the
264
+ packaging is fixed. This patch publish exists solely to deliver
265
+ working tarballs to the registry; the public API surface is
266
+ byte-identical to `0.1.0`.
267
+
268
+ Verified locally:
269
+
270
+ ```
271
+ $ pnpm --filter @ingcreators/annot-product-docs pack --dry-run
272
+ Tarball Contents
273
+ bin/annot-docs.mjs
274
+ dist/cli.d.ts
275
+ dist/config.d.ts
276
+ dist/drift.d.ts
277
+ dist/fixture.d.ts
278
+ dist/index.d.ts
279
+ dist/index.js
280
+ dist/mdx.d.ts
281
+ dist/resolver.d.ts
282
+ dist/types-config.d.ts
283
+ dist/types.d.ts
284
+ LICENSE
285
+ package.json
286
+ README.md
287
+ ```
288
+
289
+ Before the fix the same command produced 4 files (LICENSE +
290
+ README + package.json + bin/annot-docs.mjs), no compiled code.
291
+
292
+ - Updated dependencies [806badc]
293
+ - Updated dependencies [df1a429]
294
+ - @ingcreators/annot-annotator@0.5.0
295
+ - @ingcreators/annot-playwright@0.3.1
package/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
  [![license](https://img.shields.io/npm/l/@ingcreators/annot-product-docs.svg)](https://github.com/ingcreators/annot/blob/main/LICENSE)
5
5
 
6
6
  Living product docs core. Turn a Playwright tour suite into
7
- always-fresh user manuals + Japanese 画面設計書, with drift
8
- between MDX and live UI caught as a CI lint step.
7
+ always-fresh user manuals + Excel screen specifications, with
8
+ drift between MDX and live UI caught as a CI lint step.
9
9
 
10
10
  Phase 1 of
11
- [`docs/plans/living-product-docs.md`](https://github.com/ingcreators/annot/blob/main/docs/plans/living-product-docs.md).
11
+ [`docs/plans/_done/living-product-docs.md`](https://github.com/ingcreators/annot/blob/main/docs/plans/_done/living-product-docs.md).
12
12
 
13
13
  ## Install
14
14
 
@@ -78,15 +78,50 @@ don't. The resolver re-finds each element on every run.
78
78
  // tests/docs/auth.spec.ts
79
79
  import { test } from "@ingcreators/annot-product-docs";
80
80
 
81
- test("login flow", async ({ page, screen }) => {
81
+ test("login flow", async ({ page, productDocs }) => {
82
82
  await page.goto("/login");
83
- await screen.capture({
83
+ await productDocs.sync({
84
84
  id: "login",
85
85
  mdxPath: "docs/books/example/SC-001-login.mdx",
86
86
  });
87
87
  });
88
88
  ```
89
89
 
90
+ ## `page.screenshot({ annot })` Playwright fixture
91
+
92
+ The package's `test` extends
93
+ [`@ingcreators/annot-playwright`](../playwright)'s test with the
94
+ `productDocs.sync(...)` fixture above AND registers an MDX-aware
95
+ resolver into the `annotSourceResolvers` registry. Pass
96
+ `annot: { mdx }` on `page.screenshot()` to bundle the
97
+ refresh-snapshot + take-screenshot + bake-overlays + write-PNG
98
+ sequence into one call — the same `<Screen id>` block in the
99
+ target MDX gets re-synced before the screenshot fires, and the
100
+ output PNG is re-editable in Annot Cloud:
101
+
102
+ ```ts
103
+ test("app overview", async ({ page }) => {
104
+ await page.goto("https://annot.work/app/");
105
+ await page.screenshot({
106
+ path: "public/app/shots/app-overview.png",
107
+ annot: {
108
+ mdx: { id: "app-overview", path: "src/content/docs/app/index.mdx" },
109
+ tags: { source: "docs-tour", capturedAt: new Date().toISOString() },
110
+ },
111
+ });
112
+ });
113
+ ```
114
+
115
+ Calls without `annot` (or with `annot: true` / `{}`) fall
116
+ through to vanilla Playwright byte-for-byte — codegen-emitted
117
+ calls keep working unedited. The generic `annot.overlays` /
118
+ `annot.tags` / `annot.editable` fields are handled by
119
+ annot-playwright; this package contributes the MDX-aware
120
+ `annot.mdx` field on top via the hook registry. See
121
+ [`annot.work/docs/product-docs/playwright-fixture/`](https://annot.work/docs/product-docs/playwright-fixture/)
122
+ for the compositional vocabulary, locator screenshot semantics,
123
+ and the codegen→hand-edit workflow.
124
+
90
125
  ## CLI
91
126
 
92
127
  ```sh
@@ -99,7 +134,7 @@ annot-docs lint --fix # auto-refresh stored blocks for files
99
134
 
100
135
  The companion adapters consume the MDXs:
101
136
  - [`@ingcreators/annot-product-docs-astro`](../product-docs-astro) renders an Astro docs site.
102
- - [`@ingcreators/annot-product-docs-xlsx`](../product-docs-xlsx) emits Excel 画面設計書.
137
+ - [`@ingcreators/annot-product-docs-xlsx`](../product-docs-xlsx) emits Excel screen specifications.
103
138
 
104
139
  ## Tier
105
140
 
package/dist/cli.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ import { Page } from 'playwright-core';
2
+ export interface CliOptions {
3
+ cwd?: string;
4
+ /** Write target for diagnostic output (defaults to process.stderr). */
5
+ stderr?: (line: string) => void;
6
+ stdout?: (line: string) => void;
7
+ /** Override Playwright launch (used in tests). Returns an already-open `Page`. */
8
+ newPage?: (url: string) => Promise<{
9
+ page: Page;
10
+ close: () => Promise<void>;
11
+ }>;
12
+ }
13
+ /**
14
+ * `main(argv)` entrypoint. Returns the process exit code so the
15
+ * bin script (`bin/annot-docs.mjs`) can `process.exit(...)`. Also
16
+ * usable from vitest by passing custom `stdout` / `stderr` / `cwd`.
17
+ */
18
+ export declare function main(argv: string[], options?: CliOptions): Promise<number>;
19
+ /**
20
+ * Walk the directory tree below `root` and return every `*.mdx`
21
+ * absolute path. Uses `readdir({ withFileTypes: true })` for a
22
+ * single syscall per directory — no external glob dep.
23
+ */
24
+ export declare function walkMdx(root: string): Promise<string[]>;
25
+ /**
26
+ * Filter a list of MDX paths down to the ones with `annot:`
27
+ * frontmatter — i.e. the files the CLI should act on.
28
+ */
29
+ export declare function filterAnnotMdxFiles(paths: string[]): Promise<string[]>;
@@ -0,0 +1,184 @@
1
+ import { z } from 'zod';
2
+ import { AnnotDocsConfig, AnnotFrontmatter } from './types-config.js';
3
+ export declare const annotFrontmatterSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ title: z.ZodOptional<z.ZodString>;
6
+ purpose: z.ZodOptional<z.ZodString>;
7
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8
+ xlsx: z.ZodOptional<z.ZodEffects<z.ZodObject<{
9
+ book: z.ZodOptional<z.ZodString>;
10
+ sheet: z.ZodOptional<z.ZodString>;
11
+ sheets: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
12
+ role: z.ZodOptional<z.ZodEnum<["cover", "history", "list", "screen", "reference"]>>;
13
+ order: z.ZodOptional<z.ZodNumber>;
14
+ }, "strict", z.ZodTypeAny, {
15
+ book?: string | undefined;
16
+ sheet?: string | undefined;
17
+ sheets?: Record<string, string> | undefined;
18
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
19
+ order?: number | undefined;
20
+ }, {
21
+ book?: string | undefined;
22
+ sheet?: string | undefined;
23
+ sheets?: Record<string, string> | undefined;
24
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
25
+ order?: number | undefined;
26
+ }>, {
27
+ book?: string | undefined;
28
+ sheet?: string | undefined;
29
+ sheets?: Record<string, string> | undefined;
30
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
31
+ order?: number | undefined;
32
+ }, {
33
+ book?: string | undefined;
34
+ sheet?: string | undefined;
35
+ sheets?: Record<string, string> | undefined;
36
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
37
+ order?: number | undefined;
38
+ }>>;
39
+ }, "strict", z.ZodTypeAny, {
40
+ id: string;
41
+ title?: string | undefined;
42
+ purpose?: string | undefined;
43
+ meta?: Record<string, unknown> | undefined;
44
+ xlsx?: {
45
+ book?: string | undefined;
46
+ sheet?: string | undefined;
47
+ sheets?: Record<string, string> | undefined;
48
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
49
+ order?: number | undefined;
50
+ } | undefined;
51
+ }, {
52
+ id: string;
53
+ title?: string | undefined;
54
+ purpose?: string | undefined;
55
+ meta?: Record<string, unknown> | undefined;
56
+ xlsx?: {
57
+ book?: string | undefined;
58
+ sheet?: string | undefined;
59
+ sheets?: Record<string, string> | undefined;
60
+ role?: "screen" | "cover" | "history" | "list" | "reference" | undefined;
61
+ order?: number | undefined;
62
+ } | undefined;
63
+ }>;
64
+ export declare const annotDocsConfigSchema: z.ZodObject<{
65
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
66
+ xlsx: z.ZodOptional<z.ZodObject<{
67
+ defaultBook: z.ZodOptional<z.ZodString>;
68
+ books: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
69
+ template: z.ZodOptional<z.ZodString>;
70
+ templateSheets: z.ZodOptional<z.ZodObject<{
71
+ cover: z.ZodOptional<z.ZodString>;
72
+ history: z.ZodOptional<z.ZodString>;
73
+ list: z.ZodOptional<z.ZodString>;
74
+ screen: z.ZodOptional<z.ZodString>;
75
+ reference: z.ZodOptional<z.ZodString>;
76
+ }, "strict", z.ZodTypeAny, {
77
+ screen?: string | undefined;
78
+ cover?: string | undefined;
79
+ history?: string | undefined;
80
+ list?: string | undefined;
81
+ reference?: string | undefined;
82
+ }, {
83
+ screen?: string | undefined;
84
+ cover?: string | undefined;
85
+ history?: string | undefined;
86
+ list?: string | undefined;
87
+ reference?: string | undefined;
88
+ }>>;
89
+ }, "strict", z.ZodTypeAny, {
90
+ template?: string | undefined;
91
+ templateSheets?: {
92
+ screen?: string | undefined;
93
+ cover?: string | undefined;
94
+ history?: string | undefined;
95
+ list?: string | undefined;
96
+ reference?: string | undefined;
97
+ } | undefined;
98
+ }, {
99
+ template?: string | undefined;
100
+ templateSheets?: {
101
+ screen?: string | undefined;
102
+ cover?: string | undefined;
103
+ history?: string | undefined;
104
+ list?: string | undefined;
105
+ reference?: string | undefined;
106
+ } | undefined;
107
+ }>>>;
108
+ }, "strict", z.ZodTypeAny, {
109
+ defaultBook?: string | undefined;
110
+ books?: Record<string, {
111
+ template?: string | undefined;
112
+ templateSheets?: {
113
+ screen?: string | undefined;
114
+ cover?: string | undefined;
115
+ history?: string | undefined;
116
+ list?: string | undefined;
117
+ reference?: string | undefined;
118
+ } | undefined;
119
+ }> | undefined;
120
+ }, {
121
+ defaultBook?: string | undefined;
122
+ books?: Record<string, {
123
+ template?: string | undefined;
124
+ templateSheets?: {
125
+ screen?: string | undefined;
126
+ cover?: string | undefined;
127
+ history?: string | undefined;
128
+ list?: string | undefined;
129
+ reference?: string | undefined;
130
+ } | undefined;
131
+ }> | undefined;
132
+ }>>;
133
+ }, "strict", z.ZodTypeAny, {
134
+ meta?: Record<string, unknown> | undefined;
135
+ xlsx?: {
136
+ defaultBook?: string | undefined;
137
+ books?: Record<string, {
138
+ template?: string | undefined;
139
+ templateSheets?: {
140
+ screen?: string | undefined;
141
+ cover?: string | undefined;
142
+ history?: string | undefined;
143
+ list?: string | undefined;
144
+ reference?: string | undefined;
145
+ } | undefined;
146
+ }> | undefined;
147
+ } | undefined;
148
+ }, {
149
+ meta?: Record<string, unknown> | undefined;
150
+ xlsx?: {
151
+ defaultBook?: string | undefined;
152
+ books?: Record<string, {
153
+ template?: string | undefined;
154
+ templateSheets?: {
155
+ screen?: string | undefined;
156
+ cover?: string | undefined;
157
+ history?: string | undefined;
158
+ list?: string | undefined;
159
+ reference?: string | undefined;
160
+ } | undefined;
161
+ }> | undefined;
162
+ } | undefined;
163
+ }>;
164
+ /**
165
+ * Identity-with-validation helper.
166
+ *
167
+ * Project config files (`annot-docs.config.ts`) call this so
168
+ * editor tooling (TypeScript) sees the precise type. The runtime
169
+ * call also runs the Zod schema, so typos in the config object
170
+ * fail loudly at module load time rather than silently being
171
+ * dropped by `tsc`'s structural matching.
172
+ */
173
+ export declare function defineConfig(config: AnnotDocsConfig): AnnotDocsConfig;
174
+ export type { AnnotDocsConfig, AnnotFrontmatter, BookConfig, } from './types-config.js';
175
+ /**
176
+ * Convenience guard: does this AnnotFrontmatter declare a
177
+ * `screen` role? Useful for filtering MDXs that have `<Screen>`
178
+ * blocks (and therefore drift-checkable) from cover / history /
179
+ * list MDXs.
180
+ *
181
+ * Defaults to `true` when `xlsx.role` is unset because plain MDXs
182
+ * with `<Screen>` blocks default to the `screen` role.
183
+ */
184
+ export declare function isScreenRole(fm: AnnotFrontmatter): boolean;
@@ -0,0 +1,77 @@
1
+ import { SnapshotEntry } from './resolver.js';
2
+ import { MatchKey, ScreenSpec } from './types.js';
3
+ export type DriftSeverity = "error" | "warning" | "info";
4
+ export type DriftKind = "added" | "removed" | "renamed" | "role-changed" | "duplicated" | "attribute-drift";
5
+ export interface DriftFinding {
6
+ severity: DriftSeverity;
7
+ kind: DriftKind;
8
+ /** The screen id the finding pertains to. */
9
+ screenId: string;
10
+ /** Human-readable description. */
11
+ message: string;
12
+ /** The `MatchKey` from the source MDX, if relevant. */
13
+ match?: MatchKey;
14
+ /** Suggested replacement (used by `--fix` flows in Phase 4). */
15
+ suggestion?: {
16
+ role?: string;
17
+ name?: string;
18
+ };
19
+ }
20
+ export interface DetectDriftOptions {
21
+ screen: ScreenSpec;
22
+ /** Parsed Playwright aria-snapshot entries against the current page. */
23
+ liveSnapshot: SnapshotEntry[];
24
+ /** Optional verbatim YAML of the stored `annot:attributes` block. */
25
+ storedAttributesYaml?: string;
26
+ /** Optional verbatim YAML of the freshly-captured attributes. */
27
+ freshAttributesYaml?: string;
28
+ }
29
+ /**
30
+ * Compute the drift findings for one `<Screen>` block.
31
+ *
32
+ * Severity policy:
33
+ * - **error** stops `annot docs lint --ci` (non-zero exit). Removed
34
+ * + duplicated belong here because they fail rendering.
35
+ * - **warning** logs but doesn't fail CI by default. Added + renamed
36
+ * + role-changed belong here because they're authoring tasks (the
37
+ * doc author decides whether the new element warrants an
38
+ * `<Overlay>`).
39
+ * - **info** is silent unless `--verbose`; attribute-drift is here
40
+ * because `annot docs sync` rewrites the block automatically on
41
+ * the next CI run.
42
+ */
43
+ export declare function detectDrift(opts: DetectDriftOptions): DriftFinding[];
44
+ /**
45
+ * Convenience: parse the stored snapshot YAML + dispatch.
46
+ *
47
+ * Used by the CLI when comparing the persisted `annot:snapshot`
48
+ * comment block against a fresh page snapshot — e.g. for an
49
+ * offline `annot docs lint --offline` mode (Phase 4 polish).
50
+ */
51
+ export declare function detectDriftFromYaml(args: {
52
+ screen: ScreenSpec;
53
+ liveSnapshotYaml: string;
54
+ storedAttributesYaml?: string;
55
+ freshAttributesYaml?: string;
56
+ }): DriftFinding[];
57
+ /**
58
+ * Summarise findings by severity. Used by the CLI to decide an
59
+ * exit code.
60
+ */
61
+ export declare function summariseDrift(findings: DriftFinding[]): {
62
+ errors: number;
63
+ warnings: number;
64
+ infos: number;
65
+ };
66
+ /**
67
+ * A `<Screen>` is drift-checkable when it has at least one
68
+ * `<Overlay>`. Files without `<Screen>` blocks (cover / history /
69
+ * list / reference MDXs) are skipped by the lint walker.
70
+ */
71
+ export declare function isLintableScreen(screen: ScreenSpec): boolean;
72
+ /**
73
+ * Filter the list of `ScreenSpec`s in a parsed MDX to just the
74
+ * ones drift detection should touch. Helps the CLI keep the
75
+ * "skipped cover.mdx" path cheap.
76
+ */
77
+ export declare function lintableScreens(screens: ScreenSpec[]): ScreenSpec[];