create-ailk 0.42.1 → 0.43.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.
@@ -0,0 +1,125 @@
1
+ /**
2
+ * A capture of a live page's render, and its replay (#11794 D6, spec
3
+ * docs/specs/11794-convert-the-remaining-heading-form-spec.md).
4
+ *
5
+ * No URL serves a draft, so a heading-form page's "before" is captured from
6
+ * the live site before its converted draft is published, and replayed as the
7
+ * `before` side of the cutover's own `comparePage` afterwards. Both are
8
+ * `ComparisonPage`s, so the comparison is unchanged: `recordingPage` passes
9
+ * every call through to a real page and stores what it answered, and
10
+ * `replayPage` answers from the stored files and never navigates.
11
+ *
12
+ * One capture is `<dir>/<n>-<viewport>/render.json` (the status, the settled
13
+ * URL, the text and the JSON-LD) beside `screenshot.png`, where `n` is the
14
+ * path's place in `<dir>/capture.json`'s `paths`.
15
+ */
16
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
17
+ import { join } from "node:path";
18
+ import { JSONLD_EXPRESSION, TEXT_EXPRESSION, VIEWPORTS } from "./render-comparison.js";
19
+ const RENDER_FILE = "render.json";
20
+ const SCREENSHOT_FILE = "screenshot.png";
21
+ /** The viewport whose width the page was last set to, by name. */
22
+ function viewportOf(width) {
23
+ return VIEWPORTS.find((viewport) => viewport.width === width)?.name ?? String(width);
24
+ }
25
+ /** Where path `path` at `viewport` is stored; `null` for a path the capture does not list. */
26
+ function slot(dir, paths, path, viewport) {
27
+ const n = paths.indexOf(path) + 1;
28
+ return n === 0 ? null : join(dir, `${n}-${viewport}`);
29
+ }
30
+ /** `url`'s path on `origin`, or `null` when it is on another origin. */
31
+ function pathOn(origin, url) {
32
+ const parsed = new URL(url);
33
+ return parsed.origin === new URL(origin).origin ? parsed.pathname : null;
34
+ }
35
+ /**
36
+ * A page that passes every call through to `page` and stores, for each of
37
+ * `paths` on `origin` at each viewport, what it answered. It writes nowhere
38
+ * but under `dir`, and renders nothing it is not asked to.
39
+ */
40
+ export function recordingPage(page, o) {
41
+ let viewport = VIEWPORTS[0].name;
42
+ let at = null;
43
+ let stored = null;
44
+ const save = () => {
45
+ if (at === null || stored === null)
46
+ return;
47
+ mkdirSync(at, { recursive: true });
48
+ writeFileSync(join(at, RENDER_FILE), `${JSON.stringify(stored, null, 2)}\n`);
49
+ };
50
+ return {
51
+ async setViewportSize(size) {
52
+ viewport = viewportOf(size.width);
53
+ await page.setViewportSize(size);
54
+ },
55
+ async goto(url, options) {
56
+ const path = pathOn(o.origin, url);
57
+ at = path === null ? null : slot(o.dir, o.paths, path, viewport);
58
+ // A re-capture never leaves an earlier run's files for the replay to read.
59
+ if (at !== null)
60
+ rmSync(at, { recursive: true, force: true });
61
+ const response = await page.goto(url, options);
62
+ stored = { status: response?.status() ?? null, url: page.url() };
63
+ save();
64
+ return response;
65
+ },
66
+ url: () => page.url(),
67
+ async evaluate(expression) {
68
+ const answer = await page.evaluate(expression);
69
+ if (stored !== null && expression === TEXT_EXPRESSION)
70
+ stored.text = answer;
71
+ if (stored !== null && expression === JSONLD_EXPRESSION)
72
+ stored.jsonLd = answer;
73
+ save();
74
+ return answer;
75
+ },
76
+ async screenshot(options) {
77
+ const png = await page.screenshot(options);
78
+ if (at !== null)
79
+ writeFileSync(join(at, SCREENSHOT_FILE), png);
80
+ return png;
81
+ },
82
+ };
83
+ }
84
+ /**
85
+ * A page that answers from a capture under `dir` and never navigates. A path
86
+ * the capture does not list, or a capture missing its render or its
87
+ * screenshot, fails that render, so the comparison fails rather than
88
+ * comparing against nothing.
89
+ */
90
+ export function replayPage(o) {
91
+ let viewport = VIEWPORTS[0].name;
92
+ let at = null;
93
+ let stored = null;
94
+ return {
95
+ async setViewportSize(size) {
96
+ viewport = viewportOf(size.width);
97
+ },
98
+ async goto(url) {
99
+ const path = pathOn(o.origin, url);
100
+ at = path === null ? null : slot(o.dir, o.paths, path, viewport);
101
+ stored = null;
102
+ if (at === null || !existsSync(join(at, RENDER_FILE))) {
103
+ throw new Error(`no capture of ${path ?? url} at ${viewport}`);
104
+ }
105
+ if (!existsSync(join(at, SCREENSHOT_FILE)))
106
+ throw new Error(`the capture of ${path} at ${viewport} has no screenshot`);
107
+ stored = JSON.parse(readFileSync(join(at, RENDER_FILE), "utf8"));
108
+ const status = stored.status;
109
+ return status === null ? null : { status: () => status };
110
+ },
111
+ url: () => stored?.url ?? "about:blank",
112
+ async evaluate(expression) {
113
+ if (expression === TEXT_EXPRESSION)
114
+ return stored?.text;
115
+ if (expression === JSONLD_EXPRESSION)
116
+ return stored?.jsonLd;
117
+ return undefined;
118
+ },
119
+ async screenshot() {
120
+ if (at === null)
121
+ throw new Error("replay: no page");
122
+ return readFileSync(join(at, SCREENSHOT_FILE));
123
+ },
124
+ };
125
+ }
@@ -151,8 +151,10 @@ function issueText(issue, advisory) {
151
151
  const { heading, setting, key } = issue.location;
152
152
  const subject = heading ?? setting ?? key;
153
153
  const quoted = subject === undefined ? "" : ` "${subject}"`;
154
+ // #11792 D6 — a heading finding reads as a word; any other advisory code is named as it is.
155
+ const word = issue.code === "empty-section" ? "empty" : issue.code === "missing-heading" ? "missing" : issue.code;
154
156
  if (advisory)
155
- return `${issue.code === "empty-section" ? "empty" : "missing"}${quoted}`;
157
+ return `${word}${quoted}`;
156
158
  return `${issue.code}:${issue.location.kind}${quoted}`;
157
159
  }
158
160
  function verdictText(verdict) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ailk",
3
- "version": "0.42.1",
3
+ "version": "0.43.0",
4
4
  "description": "Scaffolder for AI Launch Kit — `pnpm create ailk@latest <dir>` produces a starter repo consuming @working-theory/* from npm (per ADR 0007).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,8 +28,8 @@
28
28
  "tar": "^7.5.21"
29
29
  },
30
30
  "devDependencies": {
31
- "@working-theory/schema": "0.70.0",
32
- "@working-theory/templates": "0.70.0"
31
+ "@working-theory/schema": "0.71.0",
32
+ "@working-theory/templates": "0.71.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
@@ -9,31 +9,54 @@ schema:
9
9
  provider:
10
10
  "@type": Organization
11
11
  name: "Your Company"
12
+ sections:
13
+ [
14
+ {
15
+ "id": "hero",
16
+ "type": "hero",
17
+ "data":
18
+ {
19
+ "headline": "{First job}",
20
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
21
+ },
22
+ },
23
+ {
24
+ "id": "what-it-covers",
25
+ "type": "content-block",
26
+ "data":
27
+ {
28
+ "headline": "What it covers",
29
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
30
+ },
31
+ },
32
+ {
33
+ "id": "how-it-runs",
34
+ "type": "content-block",
35
+ "data":
36
+ {
37
+ "headline": "How it runs",
38
+ "body": "{One paragraph on the shape of the visit: how it is scheduled, how long it takes, who turns up, and what you need from the customer beforehand.}",
39
+ },
40
+ },
41
+ {
42
+ "id": "what-you-end-up-with",
43
+ "type": "content-block",
44
+ "data":
45
+ {
46
+ "headline": "What you end up with",
47
+ "body": "{One paragraph on the result. Be concrete — describe the property when the crew drives away.}",
48
+ },
49
+ },
50
+ {
51
+ "id": "what-it-costs",
52
+ "type": "content-block",
53
+ "data":
54
+ {
55
+ "headline": "What it costs",
56
+ "body": "{One line on the pricing shape — flat rate, hourly, or by the job — and what it excludes. Replace with your real numbers, or delete this section and let a call do it.}",
57
+ },
58
+ },
59
+ ]
12
60
  ---
13
61
 
14
- # \{First job}
15
-
16
- \{Open with the situation a reader is in when they come looking for this. Two or
17
- three sentences, no more — the detail belongs under the headings below.}
18
-
19
- ## What it covers
20
-
21
- - \{The first thing you actually do}
22
- - \{The second thing you actually do}
23
- - \{The third thing you actually do}
24
-
25
- ## How it runs
26
-
27
- \{One paragraph on the shape of the visit: how it is scheduled, how long it
28
- takes, who turns up, and what you need from the customer beforehand.}
29
-
30
- ## What you end up with
31
-
32
- \{One paragraph on the result. Be concrete — describe the property when the
33
- crew drives away.}
34
-
35
- ## What it costs
36
-
37
- \{One line on the pricing shape — flat rate, hourly, or by the job — and what it
38
- excludes. Replace with your real numbers, or delete this section and let a
39
- call do it.}
62
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}
@@ -9,31 +9,54 @@ schema:
9
9
  provider:
10
10
  "@type": Organization
11
11
  name: "Your Company"
12
+ sections:
13
+ [
14
+ {
15
+ "id": "hero",
16
+ "type": "hero",
17
+ "data":
18
+ {
19
+ "headline": "{Second job}",
20
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
21
+ },
22
+ },
23
+ {
24
+ "id": "what-it-covers",
25
+ "type": "content-block",
26
+ "data":
27
+ {
28
+ "headline": "What it covers",
29
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
30
+ },
31
+ },
32
+ {
33
+ "id": "how-it-runs",
34
+ "type": "content-block",
35
+ "data":
36
+ {
37
+ "headline": "How it runs",
38
+ "body": "{One paragraph on the shape of the visit: how it is scheduled, how long it takes, who turns up, and what you need from the customer beforehand.}",
39
+ },
40
+ },
41
+ {
42
+ "id": "what-you-end-up-with",
43
+ "type": "content-block",
44
+ "data":
45
+ {
46
+ "headline": "What you end up with",
47
+ "body": "{One paragraph on the result. Be concrete — describe the property when the crew drives away.}",
48
+ },
49
+ },
50
+ {
51
+ "id": "what-it-costs",
52
+ "type": "content-block",
53
+ "data":
54
+ {
55
+ "headline": "What it costs",
56
+ "body": "{One line on the pricing shape — flat rate, hourly, or by the job — and what it excludes. Replace with your real numbers, or delete this section and let a call do it.}",
57
+ },
58
+ },
59
+ ]
12
60
  ---
13
61
 
14
- # \{Second job}
15
-
16
- \{Open with the situation a reader is in when they come looking for this. Two or
17
- three sentences, no more — the detail belongs under the headings below.}
18
-
19
- ## What it covers
20
-
21
- - \{The first thing you actually do}
22
- - \{The second thing you actually do}
23
- - \{The third thing you actually do}
24
-
25
- ## How it runs
26
-
27
- \{One paragraph on the shape of the visit: how it is scheduled, how long it
28
- takes, who turns up, and what you need from the customer beforehand.}
29
-
30
- ## What you end up with
31
-
32
- \{One paragraph on the result. Be concrete — describe the property when the
33
- crew drives away.}
34
-
35
- ## What it costs
36
-
37
- \{One line on the pricing shape — flat rate, hourly, or by the job — and what it
38
- excludes. Replace with your real numbers, or delete this section and let a
39
- call do it.}
62
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}
@@ -9,31 +9,54 @@ schema:
9
9
  provider:
10
10
  "@type": Organization
11
11
  name: "Your Company"
12
+ sections:
13
+ [
14
+ {
15
+ "id": "hero",
16
+ "type": "hero",
17
+ "data":
18
+ {
19
+ "headline": "{Third job}",
20
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
21
+ },
22
+ },
23
+ {
24
+ "id": "what-it-covers",
25
+ "type": "content-block",
26
+ "data":
27
+ {
28
+ "headline": "What it covers",
29
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
30
+ },
31
+ },
32
+ {
33
+ "id": "how-it-runs",
34
+ "type": "content-block",
35
+ "data":
36
+ {
37
+ "headline": "How it runs",
38
+ "body": "{One paragraph on the shape of the visit: how it is scheduled, how long it takes, who turns up, and what you need from the customer beforehand.}",
39
+ },
40
+ },
41
+ {
42
+ "id": "what-you-end-up-with",
43
+ "type": "content-block",
44
+ "data":
45
+ {
46
+ "headline": "What you end up with",
47
+ "body": "{One paragraph on the result. Be concrete — describe the property when the crew drives away.}",
48
+ },
49
+ },
50
+ {
51
+ "id": "what-it-costs",
52
+ "type": "content-block",
53
+ "data":
54
+ {
55
+ "headline": "What it costs",
56
+ "body": "{One line on the pricing shape — flat rate, hourly, or by the job — and what it excludes. Replace with your real numbers, or delete this section and let a call do it.}",
57
+ },
58
+ },
59
+ ]
12
60
  ---
13
61
 
14
- # \{Third job}
15
-
16
- \{Open with the situation a reader is in when they come looking for this. Two or
17
- three sentences, no more — the detail belongs under the headings below.}
18
-
19
- ## What it covers
20
-
21
- - \{The first thing you actually do}
22
- - \{The second thing you actually do}
23
- - \{The third thing you actually do}
24
-
25
- ## How it runs
26
-
27
- \{One paragraph on the shape of the visit: how it is scheduled, how long it
28
- takes, who turns up, and what you need from the customer beforehand.}
29
-
30
- ## What you end up with
31
-
32
- \{One paragraph on the result. Be concrete — describe the property when the
33
- crew drives away.}
34
-
35
- ## What it costs
36
-
37
- \{One line on the pricing shape — flat rate, hourly, or by the job — and what it
38
- excludes. Replace with your real numbers, or delete this section and let a
39
- call do it.}
62
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}
@@ -8,31 +8,54 @@ schema:
8
8
  provider:
9
9
  "@type": Organization
10
10
  name: "Your Company"
11
+ sections:
12
+ [
13
+ {
14
+ "id": "hero",
15
+ "type": "hero",
16
+ "data":
17
+ {
18
+ "headline": "{First engagement}",
19
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
20
+ },
21
+ },
22
+ {
23
+ "id": "what-it-covers",
24
+ "type": "content-block",
25
+ "data":
26
+ {
27
+ "headline": "What it covers",
28
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
29
+ },
30
+ },
31
+ {
32
+ "id": "how-it-runs",
33
+ "type": "content-block",
34
+ "data":
35
+ {
36
+ "headline": "How it runs",
37
+ "body": "{One paragraph on the shape of the engagement: how it starts, how long it runs, who is involved on both sides, and what a week looks like.}",
38
+ },
39
+ },
40
+ {
41
+ "id": "what-you-end-up-with",
42
+ "type": "content-block",
43
+ "data":
44
+ {
45
+ "headline": "What you end up with",
46
+ "body": "{One paragraph on the deliverable. Be concrete — name the artefact, not the feeling.}",
47
+ },
48
+ },
49
+ {
50
+ "id": "what-it-costs",
51
+ "type": "content-block",
52
+ "data":
53
+ {
54
+ "headline": "What it costs",
55
+ "body": "{One line on the pricing shape — fixed fee, retainer, day rate — and what it excludes. Replace with your real numbers, or delete this section and let the call do it.}",
56
+ },
57
+ },
58
+ ]
11
59
  ---
12
60
 
13
- # \{First engagement}
14
-
15
- \{Open with the situation a reader is in when they come looking for this. Two or
16
- three sentences, no more — the detail belongs under the headings below.}
17
-
18
- ## What it covers
19
-
20
- - \{The first thing you actually do}
21
- - \{The second thing you actually do}
22
- - \{The third thing you actually do}
23
-
24
- ## How it runs
25
-
26
- \{One paragraph on the shape of the engagement: how it starts, how long it runs,
27
- who is involved on both sides, and what a week looks like.}
28
-
29
- ## What you end up with
30
-
31
- \{One paragraph on the deliverable. Be concrete — name the artefact, not the
32
- feeling.}
33
-
34
- ## What it costs
35
-
36
- \{One line on the pricing shape — fixed fee, retainer, day rate — and what it
37
- excludes. Replace with your real numbers, or delete this section and let the
38
- call do it.}
61
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}
@@ -8,31 +8,54 @@ schema:
8
8
  provider:
9
9
  "@type": Organization
10
10
  name: "Your Company"
11
+ sections:
12
+ [
13
+ {
14
+ "id": "hero",
15
+ "type": "hero",
16
+ "data":
17
+ {
18
+ "headline": "{Second engagement}",
19
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
20
+ },
21
+ },
22
+ {
23
+ "id": "what-it-covers",
24
+ "type": "content-block",
25
+ "data":
26
+ {
27
+ "headline": "What it covers",
28
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
29
+ },
30
+ },
31
+ {
32
+ "id": "how-it-runs",
33
+ "type": "content-block",
34
+ "data":
35
+ {
36
+ "headline": "How it runs",
37
+ "body": "{One paragraph on the shape of the engagement: how it starts, how long it runs, who is involved on both sides, and what a week looks like.}",
38
+ },
39
+ },
40
+ {
41
+ "id": "what-you-end-up-with",
42
+ "type": "content-block",
43
+ "data":
44
+ {
45
+ "headline": "What you end up with",
46
+ "body": "{One paragraph on the deliverable. Be concrete — name the artefact, not the feeling.}",
47
+ },
48
+ },
49
+ {
50
+ "id": "what-it-costs",
51
+ "type": "content-block",
52
+ "data":
53
+ {
54
+ "headline": "What it costs",
55
+ "body": "{One line on the pricing shape — fixed fee, retainer, day rate — and what it excludes. Replace with your real numbers, or delete this section and let the call do it.}",
56
+ },
57
+ },
58
+ ]
11
59
  ---
12
60
 
13
- # \{Second engagement}
14
-
15
- \{Open with the situation a reader is in when they come looking for this. Two or
16
- three sentences, no more — the detail belongs under the headings below.}
17
-
18
- ## What it covers
19
-
20
- - \{The first thing you actually do}
21
- - \{The second thing you actually do}
22
- - \{The third thing you actually do}
23
-
24
- ## How it runs
25
-
26
- \{One paragraph on the shape of the engagement: how it starts, how long it runs,
27
- who is involved on both sides, and what a week looks like.}
28
-
29
- ## What you end up with
30
-
31
- \{One paragraph on the deliverable. Be concrete — name the artefact, not the
32
- feeling.}
33
-
34
- ## What it costs
35
-
36
- \{One line on the pricing shape — fixed fee, retainer, day rate — and what it
37
- excludes. Replace with your real numbers, or delete this section and let the
38
- call do it.}
61
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}
@@ -8,31 +8,54 @@ schema:
8
8
  provider:
9
9
  "@type": Organization
10
10
  name: "Your Company"
11
+ sections:
12
+ [
13
+ {
14
+ "id": "hero",
15
+ "type": "hero",
16
+ "data":
17
+ {
18
+ "headline": "{Third engagement}",
19
+ "subheadline": "{Open with the situation a reader is in when they come looking for this. Two or three sentences, no more — the detail belongs under the headings below.}",
20
+ },
21
+ },
22
+ {
23
+ "id": "what-it-covers",
24
+ "type": "content-block",
25
+ "data":
26
+ {
27
+ "headline": "What it covers",
28
+ "body": "- {The first thing you actually do}\n- {The second thing you actually do}\n- {The third thing you actually do}",
29
+ },
30
+ },
31
+ {
32
+ "id": "how-it-runs",
33
+ "type": "content-block",
34
+ "data":
35
+ {
36
+ "headline": "How it runs",
37
+ "body": "{One paragraph on the shape of the engagement: how it starts, how long it runs, who is involved on both sides, and what a week looks like.}",
38
+ },
39
+ },
40
+ {
41
+ "id": "what-you-end-up-with",
42
+ "type": "content-block",
43
+ "data":
44
+ {
45
+ "headline": "What you end up with",
46
+ "body": "{One paragraph on the deliverable. Be concrete — name the artefact, not the feeling.}",
47
+ },
48
+ },
49
+ {
50
+ "id": "what-it-costs",
51
+ "type": "content-block",
52
+ "data":
53
+ {
54
+ "headline": "What it costs",
55
+ "body": "{One line on the pricing shape — fixed fee, retainer, day rate — and what it excludes. Replace with your real numbers, or delete this section and let the call do it.}",
56
+ },
57
+ },
58
+ ]
11
59
  ---
12
60
 
13
- # \{Third engagement}
14
-
15
- \{Open with the situation a reader is in when they come looking for this. Two or
16
- three sentences, no more — the detail belongs under the headings below.}
17
-
18
- ## What it covers
19
-
20
- - \{The first thing you actually do}
21
- - \{The second thing you actually do}
22
- - \{The third thing you actually do}
23
-
24
- ## How it runs
25
-
26
- \{One paragraph on the shape of the engagement: how it starts, how long it runs,
27
- who is involved on both sides, and what a week looks like.}
28
-
29
- ## What you end up with
30
-
31
- \{One paragraph on the deliverable. Be concrete — name the artefact, not the
32
- feeling.}
33
-
34
- ## What it costs
35
-
36
- \{One line on the pricing shape — fixed fee, retainer, day rate — and what it
37
- excludes. Replace with your real numbers, or delete this section and let the
38
- call do it.}
61
+ {/* Rendered from frontmatter `sections[]`. Placeholder copy — replace every {brace} with your own words before you launch. */}