@forumulate/cli 0.3.6 → 0.5.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.
Files changed (160) hide show
  1. package/README.md +4 -3
  2. package/dist/cli.js +37 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/content/command.d.ts +34 -0
  5. package/dist/content/command.d.ts.map +1 -0
  6. package/dist/content/command.js +225 -0
  7. package/dist/content/command.js.map +1 -0
  8. package/dist/content/library.d.ts +22 -0
  9. package/dist/content/library.d.ts.map +1 -0
  10. package/dist/content/library.js +40 -0
  11. package/dist/content/library.js.map +1 -0
  12. package/dist/content/render.d.ts +15 -0
  13. package/dist/content/render.d.ts.map +1 -0
  14. package/dist/content/render.js +85 -0
  15. package/dist/content/render.js.map +1 -0
  16. package/dist/content/types-gen.d.ts +40 -0
  17. package/dist/content/types-gen.d.ts.map +1 -0
  18. package/dist/content/types-gen.js +200 -0
  19. package/dist/content/types-gen.js.map +1 -0
  20. package/dist/import/coerce.d.ts +34 -0
  21. package/dist/import/coerce.d.ts.map +1 -0
  22. package/dist/import/coerce.js +134 -0
  23. package/dist/import/coerce.js.map +1 -0
  24. package/dist/import/command.d.ts +25 -0
  25. package/dist/import/command.d.ts.map +1 -0
  26. package/dist/import/command.js +127 -0
  27. package/dist/import/command.js.map +1 -0
  28. package/dist/import/config.d.ts +39 -0
  29. package/dist/import/config.d.ts.map +1 -0
  30. package/dist/import/config.js +48 -0
  31. package/dist/import/config.js.map +1 -0
  32. package/dist/import/contentful.d.ts +3 -0
  33. package/dist/import/contentful.d.ts.map +1 -0
  34. package/dist/import/contentful.js +179 -0
  35. package/dist/import/contentful.js.map +1 -0
  36. package/dist/import/disk.d.ts +4 -0
  37. package/dist/import/disk.d.ts.map +1 -0
  38. package/dist/import/disk.js +19 -0
  39. package/dist/import/disk.js.map +1 -0
  40. package/dist/import/engine-locales.d.ts +35 -0
  41. package/dist/import/engine-locales.d.ts.map +1 -0
  42. package/dist/import/engine-locales.js +61 -0
  43. package/dist/import/engine-locales.js.map +1 -0
  44. package/dist/import/engine.d.ts +29 -0
  45. package/dist/import/engine.d.ts.map +1 -0
  46. package/dist/import/engine.js +248 -0
  47. package/dist/import/engine.js.map +1 -0
  48. package/dist/import/media.d.ts +24 -0
  49. package/dist/import/media.d.ts.map +1 -0
  50. package/dist/import/media.js +39 -0
  51. package/dist/import/media.js.map +1 -0
  52. package/dist/import/model-fields.d.ts +22 -0
  53. package/dist/import/model-fields.d.ts.map +1 -0
  54. package/dist/import/model-fields.js +60 -0
  55. package/dist/import/model-fields.js.map +1 -0
  56. package/dist/import/payload/index.d.ts +9 -0
  57. package/dist/import/payload/index.d.ts.map +1 -0
  58. package/dist/import/payload/index.js +129 -0
  59. package/dist/import/payload/index.js.map +1 -0
  60. package/dist/import/report.d.ts +5 -0
  61. package/dist/import/report.d.ts.map +1 -0
  62. package/dist/import/report.js +52 -0
  63. package/dist/import/report.js.map +1 -0
  64. package/dist/import/richtext-core.d.ts +26 -0
  65. package/dist/import/richtext-core.d.ts.map +1 -0
  66. package/dist/import/richtext-core.js +65 -0
  67. package/dist/import/richtext-core.js.map +1 -0
  68. package/dist/import/richtext-html.d.ts +5 -0
  69. package/dist/import/richtext-html.d.ts.map +1 -0
  70. package/dist/import/richtext-html.js +311 -0
  71. package/dist/import/richtext-html.js.map +1 -0
  72. package/dist/import/richtext-json.d.ts +10 -0
  73. package/dist/import/richtext-json.d.ts.map +1 -0
  74. package/dist/import/richtext-json.js +250 -0
  75. package/dist/import/richtext-json.js.map +1 -0
  76. package/dist/import/sanity.d.ts +8 -0
  77. package/dist/import/sanity.d.ts.map +1 -0
  78. package/dist/import/sanity.js +158 -0
  79. package/dist/import/sanity.js.map +1 -0
  80. package/dist/import/strapi-archive.d.ts +6 -0
  81. package/dist/import/strapi-archive.d.ts.map +1 -0
  82. package/dist/import/strapi-archive.js +127 -0
  83. package/dist/import/strapi-archive.js.map +1 -0
  84. package/dist/import/strapi.d.ts +7 -0
  85. package/dist/import/strapi.d.ts.map +1 -0
  86. package/dist/import/strapi.js +185 -0
  87. package/dist/import/strapi.js.map +1 -0
  88. package/dist/import/tar.d.ts +3 -0
  89. package/dist/import/tar.d.ts.map +1 -0
  90. package/dist/import/tar.js +48 -0
  91. package/dist/import/tar.js.map +1 -0
  92. package/dist/import/types.d.ts +157 -0
  93. package/dist/import/types.d.ts.map +1 -0
  94. package/dist/import/types.js +12 -0
  95. package/dist/import/types.js.map +1 -0
  96. package/dist/import/wordpress.d.ts +15 -0
  97. package/dist/import/wordpress.d.ts.map +1 -0
  98. package/dist/import/wordpress.js +147 -0
  99. package/dist/import/wordpress.js.map +1 -0
  100. package/dist/publish/api.d.ts +95 -0
  101. package/dist/publish/api.d.ts.map +1 -0
  102. package/dist/publish/api.js +265 -0
  103. package/dist/publish/api.js.map +1 -0
  104. package/dist/publish/command.d.ts +44 -0
  105. package/dist/publish/command.d.ts.map +1 -0
  106. package/dist/publish/command.js +246 -0
  107. package/dist/publish/command.js.map +1 -0
  108. package/dist/publish/compare.d.ts +45 -0
  109. package/dist/publish/compare.d.ts.map +1 -0
  110. package/dist/publish/compare.js +124 -0
  111. package/dist/publish/compare.js.map +1 -0
  112. package/dist/publish/context.d.ts +46 -0
  113. package/dist/publish/context.d.ts.map +1 -0
  114. package/dist/publish/context.js +54 -0
  115. package/dist/publish/context.js.map +1 -0
  116. package/dist/publish/docs-apply.d.ts +39 -0
  117. package/dist/publish/docs-apply.d.ts.map +1 -0
  118. package/dist/publish/docs-apply.js +178 -0
  119. package/dist/publish/docs-apply.js.map +1 -0
  120. package/dist/publish/docs-plan.d.ts +40 -0
  121. package/dist/publish/docs-plan.d.ts.map +1 -0
  122. package/dist/publish/docs-plan.js +211 -0
  123. package/dist/publish/docs-plan.js.map +1 -0
  124. package/dist/publish/docs-reconcile.d.ts +26 -0
  125. package/dist/publish/docs-reconcile.d.ts.map +1 -0
  126. package/dist/publish/docs-reconcile.js +162 -0
  127. package/dist/publish/docs-reconcile.js.map +1 -0
  128. package/dist/publish/extras.d.ts +25 -0
  129. package/dist/publish/extras.d.ts.map +1 -0
  130. package/dist/publish/extras.js +218 -0
  131. package/dist/publish/extras.js.map +1 -0
  132. package/dist/publish/frontmatter.d.ts +45 -0
  133. package/dist/publish/frontmatter.d.ts.map +1 -0
  134. package/dist/publish/frontmatter.js +265 -0
  135. package/dist/publish/frontmatter.js.map +1 -0
  136. package/dist/publish/manifest.d.ts +5 -0
  137. package/dist/publish/manifest.d.ts.map +1 -0
  138. package/dist/publish/manifest.js +144 -0
  139. package/dist/publish/manifest.js.map +1 -0
  140. package/dist/publish/posts.d.ts +39 -0
  141. package/dist/publish/posts.d.ts.map +1 -0
  142. package/dist/publish/posts.js +350 -0
  143. package/dist/publish/posts.js.map +1 -0
  144. package/dist/publish/rewrite.d.ts +20 -0
  145. package/dist/publish/rewrite.d.ts.map +1 -0
  146. package/dist/publish/rewrite.js +82 -0
  147. package/dist/publish/rewrite.js.map +1 -0
  148. package/dist/publish/scan.d.ts +25 -0
  149. package/dist/publish/scan.d.ts.map +1 -0
  150. package/dist/publish/scan.js +351 -0
  151. package/dist/publish/scan.js.map +1 -0
  152. package/dist/publish/types.d.ts +155 -0
  153. package/dist/publish/types.d.ts.map +1 -0
  154. package/dist/publish/types.js +13 -0
  155. package/dist/publish/types.js.map +1 -0
  156. package/dist/run.d.ts +15 -1
  157. package/dist/run.d.ts.map +1 -1
  158. package/dist/run.js +103 -45
  159. package/dist/run.js.map +1 -1
  160. package/package.json +3 -2
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findManifest = findManifest;
4
+ exports.loadManifest = loadManifest;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const yaml_1 = require("yaml");
8
+ const scan_1 = require("./scan");
9
+ /**
10
+ * `forumulate.yaml` (or `.yml`, or `forumulate.json`) at the top of the folder.
11
+ *
12
+ * Optional: a folder with no manifest publishes into the space named on the
13
+ * command line. With one, a single repository describes a whole presence —
14
+ * which spaces, their settings and theme, the site around them, an OpenAPI
15
+ * reference, the status monitors — and re-running the command converges on it.
16
+ *
17
+ * Two forms. One space, written flat:
18
+ *
19
+ * org: acme
20
+ * space: docs
21
+ * theme: { primaryColor: "#0a7" }
22
+ *
23
+ * or several, each with the folder it publishes from:
24
+ *
25
+ * org: acme
26
+ * site: { slug: main, config: { tagline: "…" } }
27
+ * spaces:
28
+ * - { path: docs, space: docs }
29
+ * - { path: blog, space: blog }
30
+ */
31
+ const SPACE_KEYS = [
32
+ 'space',
33
+ 'path',
34
+ 'create',
35
+ 'name',
36
+ 'visibility',
37
+ 'settings',
38
+ 'theme',
39
+ 'rootCollection',
40
+ 'collections',
41
+ 'openapi',
42
+ 'monitors',
43
+ 'keep',
44
+ ];
45
+ const TOP_KEYS = new Set(['org', 'site', 'spaces', '$schema', ...SPACE_KEYS]);
46
+ function findManifest(root, explicit) {
47
+ if (explicit) {
48
+ const p = (0, node_path_1.resolve)(explicit);
49
+ if (!(0, node_fs_1.existsSync)(p))
50
+ throw new Error(`No manifest at ${p}`);
51
+ return p;
52
+ }
53
+ for (const n of scan_1.MANIFEST_NAMES) {
54
+ const p = (0, node_path_1.join)(root, n);
55
+ if ((0, node_fs_1.existsSync)(p))
56
+ return p;
57
+ }
58
+ return null;
59
+ }
60
+ function asObject(v, where) {
61
+ if (v === undefined || v === null)
62
+ return undefined;
63
+ if (typeof v !== 'object' || Array.isArray(v))
64
+ throw new Error(`${where} must be a map`);
65
+ return v;
66
+ }
67
+ function spaceSpec(raw, where) {
68
+ const unknown = Object.keys(raw).filter((k) => !SPACE_KEYS.includes(k));
69
+ // A misspelt key in a manifest is a setting silently not applied — the same
70
+ // failure `X-Unrecognized-Fields` exists for on the API. Refused, by name.
71
+ if (unknown.length)
72
+ throw new Error(`${where}: unknown key(s) ${unknown.join(', ')} — expected ${SPACE_KEYS.join(', ')}`);
73
+ const openapi = raw.openapi === undefined
74
+ ? undefined
75
+ : Array.isArray(raw.openapi)
76
+ ? raw.openapi
77
+ : [raw.openapi];
78
+ for (const [i, o] of (openapi ?? []).entries()) {
79
+ const spec = asObject(o, `${where}.openapi[${i}]`);
80
+ if (!spec.spec && !spec.url)
81
+ throw new Error(`${where}.openapi[${i}] needs \`spec\` (a file) or \`url\``);
82
+ if (typeof spec.collection !== 'string')
83
+ throw new Error(`${where}.openapi[${i}] needs \`collection\` (its name)`);
84
+ }
85
+ const monitors = raw.monitors === undefined ? undefined : raw.monitors;
86
+ if (monitors && !Array.isArray(monitors))
87
+ throw new Error(`${where}.monitors must be a list`);
88
+ for (const [i, m] of (monitors ?? []).entries()) {
89
+ if (typeof asObject(m, `${where}.monitors[${i}]`)?.name !== 'string')
90
+ throw new Error(`${where}.monitors[${i}] needs a \`name\` — monitors are matched by it`);
91
+ }
92
+ return {
93
+ path: typeof raw.path === 'string' ? raw.path : '',
94
+ space: raw.space === undefined ? undefined : String(raw.space),
95
+ create: asObject(raw.create, `${where}.create`),
96
+ name: raw.name,
97
+ visibility: raw.visibility,
98
+ settings: asObject(raw.settings, `${where}.settings`),
99
+ theme: asObject(raw.theme, `${where}.theme`),
100
+ rootCollection: raw.rootCollection,
101
+ collections: asObject(raw.collections, `${where}.collections`),
102
+ openapi: openapi,
103
+ monitors: monitors,
104
+ keep: Array.isArray(raw.keep) ? raw.keep.map(String) : undefined,
105
+ };
106
+ }
107
+ /** Read and check the manifest; `null` file → the one-space default. */
108
+ function loadManifest(file) {
109
+ if (!file)
110
+ return { file: null, spaces: [{ path: '' }] };
111
+ const text = (0, node_fs_1.readFileSync)(file, 'utf8');
112
+ let raw;
113
+ try {
114
+ raw = file.endsWith('.json') ? JSON.parse(text) : (0, yaml_1.parse)(text);
115
+ }
116
+ catch (e) {
117
+ throw new Error(`${file}: ${e.message}`);
118
+ }
119
+ const top = asObject(raw ?? {}, file);
120
+ const unknown = Object.keys(top).filter((k) => !TOP_KEYS.has(k));
121
+ if (unknown.length)
122
+ throw new Error(`${file}: unknown key(s) ${unknown.join(', ')}`);
123
+ const site = asObject(top.site, `${file}: site`);
124
+ if (site && !site.id && !site.slug)
125
+ throw new Error(`${file}: site needs \`id\` or \`slug\``);
126
+ let spaces;
127
+ if (top.spaces !== undefined) {
128
+ if (!Array.isArray(top.spaces))
129
+ throw new Error(`${file}: spaces must be a list`);
130
+ const flat = SPACE_KEYS.filter((k) => top[k] !== undefined);
131
+ if (flat.length)
132
+ throw new Error(`${file}: with \`spaces:\`, put ${flat.join(', ')} inside a space`);
133
+ spaces = top.spaces.map((s, i) => spaceSpec(asObject(s, `spaces[${i}]`), `spaces[${i}]`));
134
+ }
135
+ else {
136
+ const one = {};
137
+ for (const k of SPACE_KEYS)
138
+ if (top[k] !== undefined)
139
+ one[k] = top[k];
140
+ spaces = [spaceSpec(one, file)];
141
+ }
142
+ return { file, org: top.org === undefined ? undefined : String(top.org), site, spaces };
143
+ }
144
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/publish/manifest.ts"],"names":[],"mappings":";;AA4CA,oCAWC;AAoDD,oCA2BC;AAtID,qCAAmD;AACnD,yCAA0C;AAC1C,+BAA0C;AAC1C,iCAAwC;AAGxC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,GAAG;IACjB,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,YAAY;IACZ,UAAU;IACV,OAAO;IACP,gBAAgB;IAChB,aAAa;IACb,SAAS;IACT,UAAU;IACV,MAAM;CACE,CAAC;AACX,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;AAE9E,SAAgB,YAAY,CAAC,IAAY,EAAE,QAAiB;IAC1D,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CAAC,GAAG,IAAA,mBA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AAK,CAAC,GAAG,IAAI,2BAA2B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACtF,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAE,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7F,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAA4B,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,UAAU;YAAE,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,SAAS;gBAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { type SpaceCtx } from './context';
2
+ import type { LocalPost } from './types';
3
+ /**
4
+ * Posts: a blog, a changelog, or any space whose pieces are not docs pages.
5
+ *
6
+ * Each type goes through the door its own surface uses, because each takes
7
+ * facts the generic one cannot: a blog post's tags, excerpt and date are
8
+ * columns of the blog, not declared parameters, and `POST …/items` refuses a
9
+ * key the type does not declare. Blog and changelog through their own routes;
10
+ * everything else through `POST …/items`, which writes any kind of piece.
11
+ *
12
+ * Keyed by slug. A changelog derives its slug from the release title (it takes
13
+ * no slug on create), so a release is also matched by its title — otherwise a
14
+ * file named `2-4-0.md` titled "Faster search" would make a second release on
15
+ * every run.
16
+ */
17
+ type Kind = 'blog' | 'changelog' | 'items';
18
+ interface Shape {
19
+ sections: {
20
+ key: string;
21
+ required?: boolean;
22
+ role?: string;
23
+ schemaProperty?: string;
24
+ }[];
25
+ params: {
26
+ key: string;
27
+ }[];
28
+ }
29
+ /** What one post sends: the body (as sections when the type declares them) and its extras. */
30
+ export declare function postPayload(post: LocalPost, kind: Kind, shape: Shape, ctx: SpaceCtx, urls: Map<string, string>): {
31
+ body: Record<string, unknown>;
32
+ extras: Record<string, unknown>;
33
+ unknown: string[];
34
+ derived?: string;
35
+ };
36
+ /** Plan, and on a real run apply, one posts folder. */
37
+ export declare function publishPosts(ctx: SpaceCtx, apply: boolean, existingAssets: Map<string, string>): Promise<void>;
38
+ export {};
39
+ //# sourceMappingURL=posts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"posts.d.ts","sourceRoot":"","sources":["../../src/publish/posts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAKrD,OAAO,KAAK,EAAY,SAAS,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;;;;;;;;;;GAaG;AAEH,KAAK,IAAI,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC;AAyD3C,UAAU,KAAK;IACb,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxF,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3B;AAwBD,8FAA8F;AAC9F,wBAAgB,WAAW,CACzB,IAAI,EAAE,SAAS,EACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACxB;IACD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAwFA;AAED,uDAAuD;AACvD,wBAAsB,YAAY,CAChC,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC,CAoGf"}
@@ -0,0 +1,350 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.postPayload = postPayload;
4
+ exports.publishPosts = publishPosts;
5
+ const frontmatter_1 = require("./frontmatter");
6
+ const compare_1 = require("./compare");
7
+ const context_1 = require("./context");
8
+ const api_1 = require("./api");
9
+ const docs_apply_1 = require("./docs-apply");
10
+ const rewrite_1 = require("./rewrite");
11
+ const scan_1 = require("./scan");
12
+ const kindOf = (type) => type === 'BLOG' ? 'blog' : type === 'CHANGELOG' ? 'changelog' : 'items';
13
+ /** Front matter keys each door takes besides the body, under the door's own names. */
14
+ const BLOG_EXTRAS = [
15
+ 'tags',
16
+ 'excerpt',
17
+ 'coverUrl',
18
+ 'coverAlt',
19
+ 'subtitle',
20
+ 'series',
21
+ 'socialImageUrl',
22
+ 'publishedAt',
23
+ 'seo',
24
+ 'furtherReading',
25
+ 'commentsEnabled',
26
+ 'onThisPage',
27
+ 'author',
28
+ 'bylines',
29
+ 'customization',
30
+ 'featured',
31
+ 'pinned',
32
+ ];
33
+ const CHANGELOG_EXTRAS = [
34
+ 'version',
35
+ 'publishedAt',
36
+ 'tags',
37
+ 'fields',
38
+ 'onThisPage',
39
+ 'customization',
40
+ 'featured',
41
+ 'pinned',
42
+ ];
43
+ const ALIAS = {
44
+ image: 'coverUrl',
45
+ cover: 'coverUrl',
46
+ coverimage: 'coverUrl',
47
+ date: 'publishedAt',
48
+ ogimage: 'socialImageUrl',
49
+ socialimage: 'socialImageUrl',
50
+ };
51
+ const IGNORED = new Set([
52
+ 'title',
53
+ 'slug',
54
+ 'draft',
55
+ 'notify',
56
+ 'layout',
57
+ 'permalink',
58
+ 'id',
59
+ 'description',
60
+ 'summary',
61
+ 'standfirst',
62
+ ]);
63
+ /** What a summary section is called in the front matter of every tool we have met. */
64
+ const SUMMARY_KEYS = ['standfirst', 'description', 'summary', 'excerpt', 'lede'];
65
+ /** `2026-10-01` → an ISO datetime; anything Date can read, likewise. */
66
+ function isoDate(v) {
67
+ if (v instanceof Date)
68
+ return v.toISOString();
69
+ if (typeof v !== 'string' || !v.trim())
70
+ return undefined;
71
+ const d = new Date(/^\d{4}-\d{2}-\d{2}$/.test(v.trim()) ? `${v.trim()}T00:00:00.000Z` : v);
72
+ return Number.isNaN(d.getTime()) ? undefined : d.toISOString();
73
+ }
74
+ /** The first paragraph as plain text — a standfirst for a post that did not write one. */
75
+ function firstParagraph(md) {
76
+ const para = md
77
+ .split(/\n\s*\n/)
78
+ .map((p) => p.trim())
79
+ .find((p) => p && !/^(#|!\[|```|:::|<|\||[-*+] |\d+\. )/.test(p)) ?? '';
80
+ return para
81
+ .replace(/!?\[([^\]]*)\]\([^)]*\)/g, '$1')
82
+ .replace(/[*_`]/g, '')
83
+ .replace(/\s+/g, ' ')
84
+ .slice(0, 300);
85
+ }
86
+ /** What one post sends: the body (as sections when the type declares them) and its extras. */
87
+ function postPayload(post, kind, shape, ctx, urls) {
88
+ const text = (0, rewrite_1.rewriteAssets)((0, rewrite_1.rewriteLinks)(post.body, post.file, ctx.scan.slugByFile), urls).trim();
89
+ const front = (0, rewrite_1.rewriteValue)(post.front, urls);
90
+ const lower = new Map(Object.entries(front).map(([k, v]) => [k.toLowerCase().replace(/[-_]/g, ''), [k, v]]));
91
+ const body = { title: post.title };
92
+ const used = new Set();
93
+ let derived;
94
+ if (shape.sections.length) {
95
+ const sections = {};
96
+ for (const s of shape.sections) {
97
+ const hit = lower.get(s.key.toLowerCase());
98
+ if (hit && typeof hit[1] === 'string') {
99
+ sections[s.key] = hit[1];
100
+ used.add(hit[0]);
101
+ }
102
+ }
103
+ const summary = shape.sections.find((s) => s.role === 'summary' || s.key === 'standfirst');
104
+ const main = shape.sections.find((s) => s.key === 'body' || s.schemaProperty === 'articleBody') ??
105
+ shape.sections[shape.sections.length - 1];
106
+ if (summary && !sections[summary.key]) {
107
+ const given = SUMMARY_KEYS.map((k) => lower.get(k)).find((h) => h && typeof h[1] === 'string');
108
+ if (given) {
109
+ sections[summary.key] = String(given[1]);
110
+ used.add(given[0]);
111
+ }
112
+ else if (summary.required) {
113
+ sections[summary.key] = derived = firstParagraph(text);
114
+ }
115
+ }
116
+ if (!sections[main.key])
117
+ sections[main.key] = text;
118
+ body.sections = sections;
119
+ }
120
+ else
121
+ body[kind === 'items' ? 'body' : 'markdown'] = text;
122
+ if (kind !== 'blog') {
123
+ // Only the blog and items doors take an address; a release's comes from its title.
124
+ if (kind === 'items')
125
+ body.slug = post.slug;
126
+ }
127
+ else
128
+ body.slug = post.slug;
129
+ const extras = {};
130
+ const unknown = [];
131
+ const allowed = kind === 'blog' ? BLOG_EXTRAS : kind === 'changelog' ? CHANGELOG_EXTRAS : [];
132
+ const params = new Map(shape.params.map((p) => [p.key.toLowerCase(), p.key]));
133
+ const fields = {};
134
+ for (const [k, v] of Object.entries(front)) {
135
+ if (used.has(k))
136
+ continue;
137
+ const flat = k.toLowerCase().replace(/[-_]/g, '');
138
+ if (IGNORED.has(flat))
139
+ continue;
140
+ const name = ALIAS[flat] ?? allowed.find((a) => a.toLowerCase() === flat) ?? (0, frontmatter_1.camel)(k);
141
+ if (allowed.includes(name)) {
142
+ extras[name] =
143
+ name === 'publishedAt'
144
+ ? isoDate(v)
145
+ : name === 'tags'
146
+ ? Array.isArray(v)
147
+ ? v.map(String)
148
+ : String(v)
149
+ .split(',')
150
+ .map((s) => s.trim())
151
+ .filter(Boolean)
152
+ : v;
153
+ continue;
154
+ }
155
+ const param = params.get(flat);
156
+ if (param) {
157
+ fields[param] = v instanceof Date ? v.toISOString().slice(0, 10) : v;
158
+ continue;
159
+ }
160
+ unknown.push(k);
161
+ }
162
+ if (Object.keys(fields).length) {
163
+ if (kind === 'items')
164
+ body.params = fields;
165
+ else if (kind === 'changelog')
166
+ extras.fields = { ...(extras.fields ?? {}), ...fields };
167
+ // A blog's declared parameters that are not columns of the blog door
168
+ // (`canonicalUrl`, `coverPlacement`) have no field to land in there.
169
+ else
170
+ unknown.push(...Object.keys(fields).map((k) => `${k} (set it in the studio)`));
171
+ }
172
+ // A blog without declared sections still has an excerpt; `description` is
173
+ // what most tools call it.
174
+ if (kind === 'blog' && !shape.sections.length && extras.excerpt === undefined) {
175
+ const d = SUMMARY_KEYS.map((k) => lower.get(k)).find((h) => h && typeof h[1] === 'string');
176
+ if (d)
177
+ extras.excerpt = d[1];
178
+ }
179
+ if (extras.publishedAt === undefined)
180
+ delete extras.publishedAt;
181
+ return { body, extras, unknown, derived };
182
+ }
183
+ /** Plan, and on a real run apply, one posts folder. */
184
+ async function publishPosts(ctx, apply, existingAssets) {
185
+ const kind = kindOf(ctx.type);
186
+ const [live, shape] = await Promise.all([
187
+ ctx.api.posts(ctx.org, ctx.spaceId, ctx.type),
188
+ ctx.api.shape(ctx.org, ctx.spaceId),
189
+ ]);
190
+ if (live === null)
191
+ ctx.line({
192
+ verb: 'warn',
193
+ what: `space ${ctx.spec.space ?? ''}`,
194
+ detail: `a ${ctx.type} space cannot be read without a token — every post is shown as a create`,
195
+ });
196
+ const bySlug = new Map((live ?? []).map((p) => [p.slug, p]));
197
+ const byTitle = new Map((live ?? []).map((p) => [p.title.toLowerCase(), p]));
198
+ const scoped = ctx.scan.posts.filter((p) => ctx.only.piece(ctx.spec, p.slug, p.file));
199
+ const urls = apply
200
+ ? await (0, docs_apply_1.uploadAssetsFor)(ctx, scoped.map((p) => p.file), existingAssets)
201
+ : new Map(scoped.map((p) => [p.file, (0, docs_apply_1.knownUrls)(ctx, existingAssets)(p.file)]));
202
+ const matched = new Set();
203
+ const base = kind === 'items' ? '/items' : `/${kind}`;
204
+ for (const post of scoped) {
205
+ const found = bySlug.get(post.slug) ??
206
+ (kind === 'changelog' ? byTitle.get(post.title.toLowerCase()) : undefined);
207
+ if (found)
208
+ matched.add(found.id);
209
+ const fileUrls = urls.get(post.file) ?? new Map();
210
+ const pay = postPayload(post, kind, shape, ctx, fileUrls);
211
+ if (pay.unknown.length)
212
+ ctx.line({
213
+ verb: 'warn',
214
+ what: `post ${post.slug}`,
215
+ detail: `front matter not understood, not sent: ${pay.unknown.join(', ')}`,
216
+ });
217
+ if (pay.derived !== undefined)
218
+ ctx.line({
219
+ verb: 'warn',
220
+ what: `post ${post.slug}`,
221
+ detail: 'no standfirst/description — the first paragraph is used',
222
+ });
223
+ if (!found) {
224
+ ctx.line({ verb: 'create', what: `post ${post.slug}`, detail: `← ${post.file}` });
225
+ if (!apply)
226
+ continue;
227
+ const created = await createPost(ctx, kind, base, { ...pay.body, ...pay.extras }, post);
228
+ await publish(ctx, kind, base, created, post);
229
+ continue;
230
+ }
231
+ const reasons = [];
232
+ if (ctx.force)
233
+ reasons.push('--force');
234
+ if (found.title !== post.title)
235
+ reasons.push('title');
236
+ if (!reasons.length && live) {
237
+ const sections = pay.body.sections;
238
+ const same = sections && found.sections && Object.keys(found.sections).length
239
+ ? Object.entries(sections).every(([k, v]) => (0, compare_1.sameText)(v, found.sections?.[k] ?? ''))
240
+ : (0, compare_1.sameText)(String(pay.body.markdown ?? pay.body.body ?? Object.values(sections ?? {}).join('\n\n')), found.markdown ?? '');
241
+ if (!same)
242
+ reasons.push('content');
243
+ }
244
+ const extrasDiff = Object.keys(pay.extras).length && ctx.api.opts.authed
245
+ ? await extrasChanged(ctx, kind, base, found, pay.extras)
246
+ : [];
247
+ if (extrasDiff.length)
248
+ reasons.push(extrasDiff.join(', '));
249
+ if (!found.published)
250
+ reasons.push('not published');
251
+ if (!reasons.length)
252
+ continue;
253
+ ctx.line({
254
+ verb: 'update',
255
+ what: `post ${post.slug}`,
256
+ detail: `${reasons.join(', ')} ← ${post.file}`,
257
+ });
258
+ if (!apply)
259
+ continue;
260
+ await updatePost(ctx, kind, base, found, pay, reasons);
261
+ if (!found.published)
262
+ await publish(ctx, kind, base, found.id, post);
263
+ }
264
+ if (!ctx.prune || !live)
265
+ return;
266
+ if (!ctx.only.all) {
267
+ ctx.line({
268
+ verb: 'skip',
269
+ what: 'prune',
270
+ detail: 'not with --only — a narrowed run never deletes',
271
+ });
272
+ return;
273
+ }
274
+ const keep = new Set(ctx.spec.keep ?? []);
275
+ for (const p of live) {
276
+ if (matched.has(p.id) || keep.has(p.slug))
277
+ continue;
278
+ ctx.line({ verb: 'prune', what: `post ${p.slug}`, detail: 'no file — deleted (recoverable)' });
279
+ if (apply)
280
+ await ctx.api.del((0, context_1.spacePath)(ctx, `/items/${p.id}`));
281
+ }
282
+ }
283
+ async function createPost(ctx, kind, base, body, post) {
284
+ if (kind === 'items') {
285
+ // `POST …/items` requires an Idempotency-Key: a retried create is one piece.
286
+ const r = await ctx.api.post((0, context_1.spacePath)(ctx, base), body, {
287
+ 'Idempotency-Key': (0, api_1.idemKey)(ctx.spaceId, post.slug, post.source),
288
+ });
289
+ return r.item.id;
290
+ }
291
+ const r = await ctx.api.post((0, context_1.spacePath)(ctx, base), body);
292
+ const id = r.article?.id ?? r.release?.id;
293
+ if (!id)
294
+ throw new Error(`creating ${post.slug} answered without an id`);
295
+ return id;
296
+ }
297
+ async function updatePost(ctx, kind, base, found, pay, reasons) {
298
+ if (kind !== 'items') {
299
+ // Blog and changelog take the body and the extras in one PATCH.
300
+ const body = { ...pay.extras };
301
+ if (reasons.some((r) => r !== 'not published'))
302
+ Object.assign(body, pay.body);
303
+ if (kind === 'blog')
304
+ delete body.slug;
305
+ await ctx.api.patch((0, context_1.spacePath)(ctx, `${base}/${found.id}`), body);
306
+ return;
307
+ }
308
+ const { title, params, sections, body } = pay.body;
309
+ await ctx.api.patch((0, context_1.spacePath)(ctx, `/items/${found.id}`), {
310
+ title,
311
+ ...(params ? { params } : {}),
312
+ });
313
+ if (sections)
314
+ for (const [k, v] of Object.entries(sections))
315
+ await ctx.api.put((0, context_1.spacePath)(ctx, `/items/${found.id}/sections/${k}`), { markdown: v });
316
+ else
317
+ await ctx.api.put((0, context_1.spacePath)(ctx, `/items/${found.id}/content`), { body });
318
+ }
319
+ async function publish(ctx, kind, base, id, post) {
320
+ // `notify: false` in front matter is the silent publish a back-catalogue import wants.
321
+ const notify = post.front.notify === false ? { notify: false } : {};
322
+ await ctx.api.post((0, context_1.spacePath)(ctx, kind === 'items' ? `/items/${id}/publish` : `${base}/${id}/publish`), kind === 'blog' ? notify : {});
323
+ }
324
+ /** Which declared extras the live post does not already hold. */
325
+ async function extrasChanged(ctx, kind, base, found, extras) {
326
+ if (kind === 'items')
327
+ return [];
328
+ const r = await ctx.api.get((0, context_1.spacePath)(ctx, `${base}/${found.id}`));
329
+ const current = { ...(r.article ?? r.release ?? {}) };
330
+ if (Array.isArray(current.tags))
331
+ current.tags = current.tags.map((t) => typeof t === 'string' ? t : String(t.name ?? ''));
332
+ const want = { ...extras };
333
+ // Tags are stored as slugs; dates by the instant. Compare those, not spellings.
334
+ if (Array.isArray(want.tags)) {
335
+ const norm = (l) => l.map((t) => (0, scan_1.tagKey)(String(t))).sort();
336
+ if ((0, compare_1.holds)(norm(current.tags ?? []), norm(want.tags)))
337
+ delete want.tags;
338
+ }
339
+ if (want.publishedAt &&
340
+ current.publishedAt &&
341
+ new Date(String(current.publishedAt)).getTime() === new Date(String(want.publishedAt)).getTime())
342
+ delete want.publishedAt;
343
+ if (want.author !== undefined) {
344
+ const byline = current.byline;
345
+ if ((typeof byline === 'string' ? byline : byline?.name) === want.author)
346
+ delete want.author;
347
+ }
348
+ return (0, compare_1.differingKeys)(current, want);
349
+ }
350
+ //# sourceMappingURL=posts.js.map
@@ -0,0 +1 @@
1
+ {"version":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AAO,CAAC,WAAW;QACnB,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAAE;QAEhG,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,MAA2C,CAAC;QACnE,IAAI,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;IAC/F,CAAC;IACD,OAAO,IAAA,uBAAa,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `[text](../setup/install.md#flags)` → `[text](./install#flags)`.
3
+ *
4
+ * The importer rewrites links between files it is sent in the SAME call, and
5
+ * the publisher only sends what changed — so a changed page linking an
6
+ * unchanged one would keep a link to a `.md` file that does not exist on the
7
+ * web. The CLI knows every file's slug, so it rewrites every link it can
8
+ * resolve itself, in the importer's own form (page-relative `./slug`: the same
9
+ * page is reached at `/slug`, `/space/slug` and `/p/org/space/slug`, and only a
10
+ * relative link is right at all three).
11
+ */
12
+ export declare function rewriteLinks(source: string, file: string, slugByFile: Map<string, string>): string;
13
+ /**
14
+ * Local images and files → the uploaded asset's URL, wherever the file names
15
+ * them: a Markdown image or link, an HTML `src`/`href`, a front matter value.
16
+ */
17
+ export declare function rewriteAssets(source: string, urlByRef: Map<string, string>): string;
18
+ /** The same substitution over a metadata patch (values that were local paths). */
19
+ export declare function rewriteValue<T>(value: T, urlByRef: Map<string, string>): T;
20
+ //# sourceMappingURL=rewrite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/publish/rewrite.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,MAAM,CA0BR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAcnF;AAED,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAQ1E"}