create-ailk 0.42.1 → 0.44.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/README.md +33 -10
- package/component-catalog.json +23 -0
- package/dist/cli.js +34 -0
- package/dist/compare-renders.d.ts +67 -0
- package/dist/compare-renders.js +274 -0
- package/dist/lib/import-mdx.d.ts +32 -15
- package/dist/lib/import-mdx.js +197 -188
- package/dist/lib/render-capture.d.ts +22 -0
- package/dist/lib/render-capture.js +125 -0
- package/dist/migrate-content.d.ts +9 -16
- package/dist/migrate-content.js +46 -82
- package/package.json +3 -3
- package/site-templates/shapes/local-business-service/content/en/Service/first-job.mdx +49 -26
- package/site-templates/shapes/local-business-service/content/en/Service/second-job.mdx +49 -26
- package/site-templates/shapes/local-business-service/content/en/Service/third-job.mdx +49 -26
- package/site-templates/shapes/organization-service/content/en/Service/first-engagement.mdx +49 -26
- package/site-templates/shapes/organization-service/content/en/Service/second-engagement.mdx +49 -26
- package/site-templates/shapes/organization-service/content/en/Service/third-engagement.mdx +49 -26
- package/site-templates/shapes/person-service/content/en/Service/first-engagement.mdx +49 -26
- package/site-templates/shapes/person-service/content/en/Service/second-engagement.mdx +49 -26
- package/site-templates/shapes/person-service/content/en/Service/third-engagement.mdx +49 -26
- package/templates/apps/api/CLAUDE.md +23 -5
- package/templates/apps/mcp/CLAUDE.md +32 -3
- package/templates/apps/web/package.json +1 -1
- package/versions.json +50 -50
|
@@ -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
|
+
}
|
|
@@ -28,24 +28,17 @@ export interface MigrateContentOptions {
|
|
|
28
28
|
onLine?: (line: string) => void;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* A fetch that sends `GET`s through `inner` and never sends a write
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* address, and a `PUT` to that address's `/structure` URL answers
|
|
39
|
-
* `written: true` when its body's `structure` is not `isDeepStrictEqual` to
|
|
40
|
-
* it — the hub's own comparison. Any other `PUT` (an equal layout, an address
|
|
41
|
-
* never read, a read with no `structure` member, no string body, a `Request`
|
|
42
|
-
* input) answers `written: false`. It never answers 409: a live tip with a
|
|
43
|
-
* changed layout is planned `update`, what `--apply` reports after its
|
|
44
|
-
* re-draft. The memory lasts one run, as the transport does.
|
|
31
|
+
* A fetch that sends `GET`s through `inner` and never sends a write (#11843
|
|
32
|
+
* D9): a `PUT` or `POST` is answered locally — `201` when its JSON body's
|
|
33
|
+
* `version` is `null`, else `200` — with the members of a save's answer the
|
|
34
|
+
* importer reads (`data.address.locale`, and `data.locale` for the Language
|
|
35
|
+
* pass). A `PATCH`, or any other method, throws, so a stray call on a retired
|
|
36
|
+
* route is visible in a dry run too. The importer decides `created`,
|
|
37
|
+
* `updated` and `unchanged` from its read alone, before it writes.
|
|
45
38
|
*/
|
|
46
39
|
export declare function readOnlyFetch(inner: typeof globalThis.fetch, locale: string): typeof globalThis.fetch;
|
|
47
40
|
/** What a dry run prints when the site's contract cannot give a verdict. */
|
|
48
|
-
export declare const PUBLISH_NOT_CHECKED = "publish: not checked \u2014 the site's @working-theory/validation has no
|
|
41
|
+
export declare const PUBLISH_NOT_CHECKED = "publish: not checked \u2014 the site's @working-theory/validation has no content check; update the site's dependencies and re-run";
|
|
49
42
|
export declare function migrateContent(opts: MigrateContentOptions): Promise<{
|
|
50
43
|
result: ImportMdxResult;
|
|
51
44
|
exitCode: 0 | 1;
|
|
@@ -60,5 +53,5 @@ export interface MigrateContentArgs {
|
|
|
60
53
|
languageSeed: string | undefined;
|
|
61
54
|
help: boolean;
|
|
62
55
|
}
|
|
63
|
-
export declare const MIGRATE_CONTENT_HELP = "create-ailk migrate-content \u2014 import an existing site's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk migrate-content [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>] [--language-seed <file>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --apply Write the pages. Without it the command reads the\n workspace, prints what it would do, and writes\n nothing.\n --api-url <origin> The API origin that holds the workspace \u2014 on a\n spoke, its hub's. Else AILK_API_URL. https: only\n (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n --language-seed <file> A Language seed file (language/<entity>.json).\n Each of its topics becomes one Topic holding all\n its keywords. Its items are not read.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page (and each legacy\ncontent/<Type>/<slug>.mdx) is written to the workspace as a draft through\nthe API's content routes, with the agent key, which is read from\nAILK_AGENT_KEY only and needs the content-edit grant. Nothing is published,\nso the live site does not change. The site needs no .ailk-site-manifest.json\nand may be a spoke; its dependencies must be installed. A page whose\nfrontmatter carries sections is converted: its words are written to the\npage's Markdown and its sections to its layout.\n\nEach FAQ item and glossary-index term becomes one Language item of its kind,\nset Live when the run creates it, and its section pins the items in the\norder the file lists them. A question on several pages is one item, with\nthe FAQ page's words (the glossary page's, for a term). Lines prefixed\nlanguage: report each item, and each page the database read will not show\nas its file does. An API with no Language collection leaves them inline.\n\nWith --language-seed, each topic in the seed file is written after the\npages as one Topic: its name, its pillar page, and every keyword with its\nmonthly searches and as-of date, its primary marked. A Topic the workspace\nalready holds keeps its spelling, notes and newer numbers, and gains what it\nlacks. Lines prefixed language: topic/ report each one; a second --apply\nreports every topic unchanged. A seed file that is not readable, or whose\ntopics the hub would refuse, is refused before anything is sent.\n\nWhen the site has apps/web/content, each blog post and docs page in it is\nwritten too: apps/web/content/en/blog/<slug>.mdx (or <slug>/index.mdx) as a\nBlogPosting, or one series down, blog/<series>/<post>.mdx, as a BlogPosting\nwhose parent is the series; the same under docs as a DocsDetail, and each\ndirectory's own index.mdx as its BlogList or DocsList index. A file the walk\nskips is listed with the rule it failed. Their lines are prefixed\neditorial: \u2014 each outcome's root is content or editorial.\n\nA dry run prints create, update, unchanged, skipped or failed per page. It\ncannot see a write the API would refuse at --apply (a conflict
|
|
56
|
+
export declare const MIGRATE_CONTENT_HELP = "create-ailk migrate-content \u2014 import an existing site's pages into its workspace.\n\nUsage:\n AILK_AGENT_KEY=<key> create-ailk migrate-content [<dir>] [--apply] [--api-url <origin>] [--workspace <wksp_id>] [--language-seed <file>]\n\nArguments:\n <dir> The site. Defaults to the current dir.\n\nOptions:\n --apply Write the pages. Without it the command reads the\n workspace, prints what it would do, and writes\n nothing.\n --api-url <origin> The API origin that holds the workspace \u2014 on a\n spoke, its hub's. Else AILK_API_URL. https: only\n (http: on localhost or 127.0.0.1).\n --workspace <wksp_id> The workspace the pages are written to. Else\n AILK_WORKSPACE_ID.\n --language-seed <file> A Language seed file (language/<entity>.json).\n Each of its topics becomes one Topic holding all\n its keywords. Its items are not read.\n -h, --help Show this help.\n\nEach content/en/<Type>/<slug>.mdx page (and each legacy\ncontent/<Type>/<slug>.mdx) is written to the workspace as a draft through\nthe API's content routes, with the agent key, which is read from\nAILK_AGENT_KEY only and needs the content-edit grant. Nothing is published,\nso the live site does not change. The site needs no .ailk-site-manifest.json\nand may be a spoke; its dependencies must be installed. A page whose\nfrontmatter carries sections is converted: its words are written to the\npage's Markdown and its sections to its layout.\n\nEach FAQ item and glossary-index term becomes one Language item of its kind,\nset Live when the run creates it, and its section pins the items in the\norder the file lists them. A question on several pages is one item, with\nthe FAQ page's words (the glossary page's, for a term). Lines prefixed\nlanguage: report each item, and each page the database read will not show\nas its file does. An API with no Language collection leaves them inline.\n\nWith --language-seed, each topic in the seed file is written after the\npages as one Topic: its name, its pillar page, and every keyword with its\nmonthly searches and as-of date, its primary marked. A Topic the workspace\nalready holds keeps its spelling, notes and newer numbers, and gains what it\nlacks. Lines prefixed language: topic/ report each one; a second --apply\nreports every topic unchanged. A seed file that is not readable, or whose\ntopics the hub would refuse, is refused before anything is sent.\n\nWhen the site has apps/web/content, each blog post and docs page in it is\nwritten too: apps/web/content/en/blog/<slug>.mdx (or <slug>/index.mdx) as a\nBlogPosting, or one series down, blog/<series>/<post>.mdx, as a BlogPosting\nwhose parent is the series; the same under docs as a DocsDetail, and each\ndirectory's own index.mdx as its BlogList or DocsList index. A file the walk\nskips is listed with the rule it failed. Their lines are prefixed\neditorial: \u2014 each outcome's root is content or editorial.\n\nA dry run prints create, update, unchanged, skipped or failed per page. It\ncannot see a write the API would refuse at --apply (a conflict, a server\nerror, or a page whose content fails its page type, which the save refuses\n422 invalid and stores nothing; fix its file and re-run). An update whose\nwords already match the workspace prints \"update \u2014 layout only\". A change to\na page that is live is saved as a new draft, so the live site does not\nchange until the page is published. --apply prints created, updated,\nunchanged, skipped or failed per page, so a re-run is safe. Exit 0 when no\npage failed, 1 when any did, 2 on a refusal (nothing is sent).\n\nNo page is written with a live-source mark, so a heading the page type's\ntemplate asks for and the page lacks stops its publish, as on any page. A\ndry run prints a publish line after each page: publishable, the advisory\nfindings the hub will list, or the status and findings that will stop the\npublish. The verdict is the site's installed @working-theory/validation's,\nnot the hub's; it sees no library-file finding and no layout the hub repairs\ndifferently. A site whose validation has no content check prints one\n\"publish: not checked\" line instead.\n";
|
|
64
57
|
export declare function parseMigrateContentArgs(argv: string[]): MigrateContentArgs;
|
package/dist/migrate-content.js
CHANGED
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
* origin and the workspace, which is all the topology would decide.
|
|
13
13
|
*
|
|
14
14
|
* A dry run is the default (D3): the importer runs over `readOnlyFetch`, which
|
|
15
|
-
* passes each `GET` through and answers a `
|
|
16
|
-
*
|
|
15
|
+
* passes each `GET` through and answers a `PUT` or `POST` locally without
|
|
16
|
+
* sending it, so the plan — create · update · unchanged · skipped · failed — is
|
|
17
17
|
* decided by the importer itself against the live workspace, and no write can
|
|
18
18
|
* leave the process. `--apply` writes; a second `--apply` reports every page
|
|
19
19
|
* `unchanged`.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* No page carries the hub's live-source mark (#11843 D7): `save_page` never
|
|
22
|
+
* keeps it, so a template's missing heading is blocking, as on any page. The
|
|
23
|
+
* dry run prints, per planned page, whether publish will take it and what the
|
|
24
|
+
* hub will list (#10898 D6), computed as publish will compute it.
|
|
25
25
|
*
|
|
26
26
|
* Credentials follow `seed-workspace` (#10204 D2): the origin from
|
|
27
27
|
* `--api-url`, else `AILK_API_URL`; the workspace id from `--workspace`, else
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
*/
|
|
35
35
|
import { readFileSync } from "node:fs";
|
|
36
36
|
import { join, resolve } from "node:path";
|
|
37
|
-
import {
|
|
37
|
+
import { parseArgs } from "node:util";
|
|
38
38
|
import { languageLines, languageOffLine, seedTopics, seedTopicsOf, topicSeedLines, withLanguage, } from "./language-import.js";
|
|
39
39
|
import { formatImportMdxReport, importMdx, isDirectory, loadSiteMdxAdapter, outcomePath, } from "./lib/import-mdx.js";
|
|
40
40
|
import { ParseError } from "./parse-args.js";
|
|
@@ -60,69 +60,33 @@ function given(value) {
|
|
|
60
60
|
}
|
|
61
61
|
// ── The dry run's transport (D3) ────────────────────────────────────────────
|
|
62
62
|
/**
|
|
63
|
-
* A fetch that sends `GET`s through `inner` and never sends a write
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* address, and a `PUT` to that address's `/structure` URL answers
|
|
71
|
-
* `written: true` when its body's `structure` is not `isDeepStrictEqual` to
|
|
72
|
-
* it — the hub's own comparison. Any other `PUT` (an equal layout, an address
|
|
73
|
-
* never read, a read with no `structure` member, no string body, a `Request`
|
|
74
|
-
* input) answers `written: false`. It never answers 409: a live tip with a
|
|
75
|
-
* changed layout is planned `update`, what `--apply` reports after its
|
|
76
|
-
* re-draft. The memory lasts one run, as the transport does.
|
|
63
|
+
* A fetch that sends `GET`s through `inner` and never sends a write (#11843
|
|
64
|
+
* D9): a `PUT` or `POST` is answered locally — `201` when its JSON body's
|
|
65
|
+
* `version` is `null`, else `200` — with the members of a save's answer the
|
|
66
|
+
* importer reads (`data.address.locale`, and `data.locale` for the Language
|
|
67
|
+
* pass). A `PATCH`, or any other method, throws, so a stray call on a retired
|
|
68
|
+
* route is visible in a dry run too. The importer decides `created`,
|
|
69
|
+
* `updated` and `unchanged` from its read alone, before it writes.
|
|
77
70
|
*/
|
|
78
71
|
export function readOnlyFetch(inner, locale) {
|
|
79
|
-
const layouts = new Map();
|
|
80
|
-
/** Whether the hub would write a dry run's layout `PUT` (#11749 D4). */
|
|
81
|
-
function layoutWritten(input, init) {
|
|
82
|
-
if (input instanceof Request || typeof init?.body !== "string")
|
|
83
|
-
return false;
|
|
84
|
-
const url = String(input);
|
|
85
|
-
const address = url.replace(/\/structure(?=\?|$)/, "");
|
|
86
|
-
if (address === url || !layouts.has(address))
|
|
87
|
-
return false;
|
|
88
|
-
let sent;
|
|
89
|
-
try {
|
|
90
|
-
sent = JSON.parse(init.body)?.structure;
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return !isDeepStrictEqual(sent, layouts.get(address));
|
|
96
|
-
}
|
|
97
72
|
return (async (input, init) => {
|
|
98
73
|
const method = (init?.method ?? (input instanceof Request ? input.method : "GET")).toUpperCase();
|
|
99
|
-
if (method === "GET")
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const url = input instanceof Request ? input.url : String(input);
|
|
103
|
-
try {
|
|
104
|
-
// Parsed here, never by `Response.json()`, so both sides of the
|
|
105
|
-
// comparison are this module's plain objects.
|
|
106
|
-
const data = JSON.parse(await response.clone().text())?.data;
|
|
107
|
-
if (data !== null && typeof data === "object" && "structure" in data) {
|
|
108
|
-
layouts.set(url, data.structure);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
layouts.delete(url);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
catch {
|
|
115
|
-
// Not JSON: nothing is recorded; the response goes back as it came.
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return response;
|
|
119
|
-
}
|
|
120
|
-
if (method !== "POST" && method !== "PATCH" && method !== "PUT") {
|
|
74
|
+
if (method === "GET")
|
|
75
|
+
return inner(input, init);
|
|
76
|
+
if (method !== "POST" && method !== "PUT") {
|
|
121
77
|
throw new Error(`a dry run sends no ${method} request`);
|
|
122
78
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
79
|
+
let created = false;
|
|
80
|
+
try {
|
|
81
|
+
created =
|
|
82
|
+
typeof init?.body === "string" &&
|
|
83
|
+
JSON.parse(init.body)?.version === null;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// Not JSON: answered as an edit.
|
|
87
|
+
}
|
|
88
|
+
return new Response(JSON.stringify({ ok: true, data: { locale, address: { locale } } }), {
|
|
89
|
+
status: created ? 201 : 200,
|
|
126
90
|
headers: { "content-type": "application/json" },
|
|
127
91
|
});
|
|
128
92
|
});
|
|
@@ -151,8 +115,10 @@ function issueText(issue, advisory) {
|
|
|
151
115
|
const { heading, setting, key } = issue.location;
|
|
152
116
|
const subject = heading ?? setting ?? key;
|
|
153
117
|
const quoted = subject === undefined ? "" : ` "${subject}"`;
|
|
118
|
+
// #11792 D6 — a heading finding reads as a word; any other advisory code is named as it is.
|
|
119
|
+
const word = issue.code === "empty-section" ? "empty" : issue.code === "missing-heading" ? "missing" : issue.code;
|
|
154
120
|
if (advisory)
|
|
155
|
-
return `${
|
|
121
|
+
return `${word}${quoted}`;
|
|
156
122
|
return `${issue.code}:${issue.location.kind}${quoted}`;
|
|
157
123
|
}
|
|
158
124
|
function verdictText(verdict) {
|
|
@@ -164,7 +130,7 @@ function verdictText(verdict) {
|
|
|
164
130
|
: `publishable · advisory: ${verdict.advisory.map((issue) => issueText(issue, true)).join(", ")}`;
|
|
165
131
|
}
|
|
166
132
|
/** What a dry run prints when the site's contract cannot give a verdict. */
|
|
167
|
-
export const PUBLISH_NOT_CHECKED = "publish: not checked — the site's @working-theory/validation has no
|
|
133
|
+
export const PUBLISH_NOT_CHECKED = "publish: not checked — the site's @working-theory/validation has no content check; update the site's dependencies and re-run";
|
|
168
134
|
// ── The command (D1–D4) ─────────────────────────────────────────────────────
|
|
169
135
|
export async function migrateContent(opts) {
|
|
170
136
|
const targetDir = resolve(opts.targetDir);
|
|
@@ -225,7 +191,6 @@ export async function migrateContent(opts) {
|
|
|
225
191
|
defaultLocale: LOCALE,
|
|
226
192
|
fetch: transport,
|
|
227
193
|
...(opts.sleep !== undefined && { sleep: opts.sleep }),
|
|
228
|
-
liveSource: true,
|
|
229
194
|
// A dry run's importer lines say `created`/`updated`, which nothing was.
|
|
230
195
|
...(apply && { onLine }),
|
|
231
196
|
});
|
|
@@ -369,24 +334,23 @@ skips is listed with the rule it failed. Their lines are prefixed
|
|
|
369
334
|
editorial: — each outcome's root is content or editorial.
|
|
370
335
|
|
|
371
336
|
A dry run prints create, update, unchanged, skipped or failed per page. It
|
|
372
|
-
cannot see a write the API would refuse at --apply (a conflict
|
|
373
|
-
error
|
|
374
|
-
|
|
375
|
-
match the workspace prints "update — layout only". A
|
|
376
|
-
|
|
377
|
-
|
|
337
|
+
cannot see a write the API would refuse at --apply (a conflict, a server
|
|
338
|
+
error, or a page whose content fails its page type, which the save refuses
|
|
339
|
+
422 invalid and stores nothing; fix its file and re-run). An update whose
|
|
340
|
+
words already match the workspace prints "update — layout only". A change to
|
|
341
|
+
a page that is live is saved as a new draft, so the live site does not
|
|
342
|
+
change until the page is published. --apply prints created, updated,
|
|
378
343
|
unchanged, skipped or failed per page, so a re-run is safe. Exit 0 when no
|
|
379
344
|
page failed, 1 when any did, 2 on a refusal (nothing is sent).
|
|
380
345
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
the live-source report prints one "publish: not checked" line instead.
|
|
346
|
+
No page is written with a live-source mark, so a heading the page type's
|
|
347
|
+
template asks for and the page lacks stops its publish, as on any page. A
|
|
348
|
+
dry run prints a publish line after each page: publishable, the advisory
|
|
349
|
+
findings the hub will list, or the status and findings that will stop the
|
|
350
|
+
publish. The verdict is the site's installed @working-theory/validation's,
|
|
351
|
+
not the hub's; it sees no library-file finding and no layout the hub repairs
|
|
352
|
+
differently. A site whose validation has no content check prints one
|
|
353
|
+
"publish: not checked" line instead.
|
|
390
354
|
`;
|
|
391
355
|
export function parseMigrateContentArgs(argv) {
|
|
392
356
|
let parsed;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ailk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.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.
|
|
32
|
-
"@working-theory/templates": "0.
|
|
31
|
+
"@working-theory/schema": "0.72.0",
|
|
32
|
+
"@working-theory/templates": "0.72.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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. */}
|