@forumulate/cli 0.8.0 → 0.10.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 (286) hide show
  1. package/README.md +11 -3
  2. package/dist/api/args.d.ts.map +1 -1
  3. package/dist/api/args.js +1 -0
  4. package/dist/api/args.js.map +1 -1
  5. package/dist/api/command.d.ts +1 -1
  6. package/dist/api/command.d.ts.map +1 -1
  7. package/dist/api/command.js +86 -11
  8. package/dist/api/command.js.map +1 -1
  9. package/dist/api/http.d.ts +8 -0
  10. package/dist/api/http.d.ts.map +1 -1
  11. package/dist/api/http.js +3 -2
  12. package/dist/api/http.js.map +1 -1
  13. package/dist/api/live-spec.d.ts +48 -0
  14. package/dist/api/live-spec.d.ts.map +1 -0
  15. package/dist/api/live-spec.js +72 -0
  16. package/dist/api/live-spec.js.map +1 -0
  17. package/dist/api/operations.json +1 -1
  18. package/dist/api/request.d.ts.map +1 -1
  19. package/dist/api/request.js +25 -1
  20. package/dist/api/request.js.map +1 -1
  21. package/dist/api/send.d.ts +10 -1
  22. package/dist/api/send.d.ts.map +1 -1
  23. package/dist/api/send.js +14 -3
  24. package/dist/api/send.js.map +1 -1
  25. package/dist/api/slim.d.ts +14 -0
  26. package/dist/api/slim.d.ts.map +1 -0
  27. package/dist/api/slim.js +174 -0
  28. package/dist/api/slim.js.map +1 -0
  29. package/dist/cache-command.d.ts +12 -0
  30. package/dist/cache-command.d.ts.map +1 -0
  31. package/dist/cache-command.js +93 -0
  32. package/dist/cache-command.js.map +1 -0
  33. package/dist/check/command.d.ts +48 -0
  34. package/dist/check/command.d.ts.map +1 -0
  35. package/dist/check/command.js +256 -0
  36. package/dist/check/command.js.map +1 -0
  37. package/dist/check/external.d.ts +66 -0
  38. package/dist/check/external.d.ts.map +1 -0
  39. package/dist/check/external.js +177 -0
  40. package/dist/check/external.js.map +1 -0
  41. package/dist/check/markdown-links.d.ts +38 -0
  42. package/dist/check/markdown-links.d.ts.map +1 -0
  43. package/dist/check/markdown-links.js +166 -0
  44. package/dist/check/markdown-links.js.map +1 -0
  45. package/dist/cli.js +42 -7
  46. package/dist/cli.js.map +1 -1
  47. package/dist/commands/completion.d.ts.map +1 -1
  48. package/dist/commands/completion.js +17 -0
  49. package/dist/commands/completion.js.map +1 -1
  50. package/dist/commands/context.d.ts.map +1 -1
  51. package/dist/commands/context.js +6 -2
  52. package/dist/commands/context.js.map +1 -1
  53. package/dist/commands/groups-api.d.ts.map +1 -1
  54. package/dist/commands/groups-api.js +20 -2
  55. package/dist/commands/groups-api.js.map +1 -1
  56. package/dist/commands/groups-docs.d.ts.map +1 -1
  57. package/dist/commands/groups-docs.js +8 -2
  58. package/dist/commands/groups-docs.js.map +1 -1
  59. package/dist/commands/groups-jobs.d.ts +10 -0
  60. package/dist/commands/groups-jobs.d.ts.map +1 -0
  61. package/dist/commands/groups-jobs.js +89 -0
  62. package/dist/commands/groups-jobs.js.map +1 -0
  63. package/dist/commands/groups-org.d.ts.map +1 -1
  64. package/dist/commands/groups-org.js +59 -2
  65. package/dist/commands/groups-org.js.map +1 -1
  66. package/dist/commands/groups-site.d.ts.map +1 -1
  67. package/dist/commands/groups-site.js +47 -10
  68. package/dist/commands/groups-site.js.map +1 -1
  69. package/dist/commands/groups-spaces.d.ts.map +1 -1
  70. package/dist/commands/groups-spaces.js +11 -5
  71. package/dist/commands/groups-spaces.js.map +1 -1
  72. package/dist/commands/groups-types.d.ts.map +1 -1
  73. package/dist/commands/groups-types.js +74 -0
  74. package/dist/commands/groups-types.js.map +1 -1
  75. package/dist/commands/groups.d.ts.map +1 -1
  76. package/dist/commands/groups.js +2 -0
  77. package/dist/commands/groups.js.map +1 -1
  78. package/dist/commands/index.d.ts +9 -0
  79. package/dist/commands/index.d.ts.map +1 -1
  80. package/dist/commands/index.js +18 -3
  81. package/dist/commands/index.js.map +1 -1
  82. package/dist/commands/job-wait.d.ts +64 -0
  83. package/dist/commands/job-wait.d.ts.map +1 -0
  84. package/dist/commands/job-wait.js +91 -0
  85. package/dist/commands/job-wait.js.map +1 -0
  86. package/dist/commands/resource.d.ts +19 -0
  87. package/dist/commands/resource.d.ts.map +1 -1
  88. package/dist/commands/resource.js +65 -3
  89. package/dist/commands/resource.js.map +1 -1
  90. package/dist/content/library.d.ts +8 -0
  91. package/dist/content/library.d.ts.map +1 -1
  92. package/dist/content/library.js +10 -2
  93. package/dist/content/library.js.map +1 -1
  94. package/dist/credentials.d.ts +43 -4
  95. package/dist/credentials.d.ts.map +1 -1
  96. package/dist/credentials.js +67 -4
  97. package/dist/credentials.js.map +1 -1
  98. package/dist/dev/command.d.ts +41 -0
  99. package/dist/dev/command.d.ts.map +1 -0
  100. package/dist/dev/command.js +158 -0
  101. package/dist/dev/command.js.map +1 -0
  102. package/dist/doctor/address-checks.d.ts +56 -0
  103. package/dist/doctor/address-checks.d.ts.map +1 -0
  104. package/dist/doctor/address-checks.js +183 -0
  105. package/dist/doctor/address-checks.js.map +1 -0
  106. package/dist/doctor/boilerplate.d.ts +33 -0
  107. package/dist/doctor/boilerplate.d.ts.map +1 -0
  108. package/dist/doctor/boilerplate.js +78 -0
  109. package/dist/doctor/boilerplate.js.map +1 -0
  110. package/dist/doctor/command.d.ts +18 -0
  111. package/dist/doctor/command.d.ts.map +1 -0
  112. package/dist/doctor/command.js +234 -0
  113. package/dist/doctor/command.js.map +1 -0
  114. package/dist/doctor/crawl.d.ts +49 -0
  115. package/dist/doctor/crawl.d.ts.map +1 -0
  116. package/dist/doctor/crawl.js +210 -0
  117. package/dist/doctor/crawl.js.map +1 -0
  118. package/dist/doctor/extended.d.ts +52 -0
  119. package/dist/doctor/extended.d.ts.map +1 -0
  120. package/dist/doctor/extended.js +150 -0
  121. package/dist/doctor/extended.js.map +1 -0
  122. package/dist/doctor/page-checks.d.ts +42 -0
  123. package/dist/doctor/page-checks.d.ts.map +1 -0
  124. package/dist/doctor/page-checks.js +200 -0
  125. package/dist/doctor/page-checks.js.map +1 -0
  126. package/dist/doctor/probe.d.ts +63 -0
  127. package/dist/doctor/probe.d.ts.map +1 -0
  128. package/dist/doctor/probe.js +170 -0
  129. package/dist/doctor/probe.js.map +1 -0
  130. package/dist/doctor/reader-auth-atlas.d.ts +18 -0
  131. package/dist/doctor/reader-auth-atlas.d.ts.map +1 -0
  132. package/dist/doctor/reader-auth-atlas.js +50 -0
  133. package/dist/doctor/reader-auth-atlas.js.map +1 -0
  134. package/dist/doctor/robots-params.d.ts +36 -0
  135. package/dist/doctor/robots-params.d.ts.map +1 -0
  136. package/dist/doctor/robots-params.js +97 -0
  137. package/dist/doctor/robots-params.js.map +1 -0
  138. package/dist/doctor/site.d.ts +42 -0
  139. package/dist/doctor/site.d.ts.map +1 -0
  140. package/dist/doctor/site.js +82 -0
  141. package/dist/doctor/site.js.map +1 -0
  142. package/dist/doctor.d.ts +21 -0
  143. package/dist/doctor.d.ts.map +1 -1
  144. package/dist/doctor.js +94 -3
  145. package/dist/doctor.js.map +1 -1
  146. package/dist/exit-codes.d.ts +40 -0
  147. package/dist/exit-codes.d.ts.map +1 -0
  148. package/dist/exit-codes.js +66 -0
  149. package/dist/exit-codes.js.map +1 -0
  150. package/dist/help-commands.d.ts +13 -0
  151. package/dist/help-commands.d.ts.map +1 -0
  152. package/dist/help-commands.js +215 -0
  153. package/dist/help-commands.js.map +1 -0
  154. package/dist/help.d.ts +1 -1
  155. package/dist/help.d.ts.map +1 -1
  156. package/dist/help.js +74 -11
  157. package/dist/help.js.map +1 -1
  158. package/dist/io.d.ts +33 -0
  159. package/dist/io.d.ts.map +1 -0
  160. package/dist/io.js +81 -0
  161. package/dist/io.js.map +1 -0
  162. package/dist/preview-comment.d.ts +20 -0
  163. package/dist/preview-comment.d.ts.map +1 -0
  164. package/dist/preview-comment.js +88 -0
  165. package/dist/preview-comment.js.map +1 -0
  166. package/dist/publish/about.d.ts +23 -0
  167. package/dist/publish/about.d.ts.map +1 -0
  168. package/dist/publish/about.js +66 -0
  169. package/dist/publish/about.js.map +1 -0
  170. package/dist/publish/api.d.ts +30 -12
  171. package/dist/publish/api.d.ts.map +1 -1
  172. package/dist/publish/api.js +62 -10
  173. package/dist/publish/api.js.map +1 -1
  174. package/dist/publish/client.d.ts +19 -0
  175. package/dist/publish/client.d.ts.map +1 -0
  176. package/dist/publish/client.js +3 -0
  177. package/dist/publish/client.js.map +1 -0
  178. package/dist/publish/command.d.ts +51 -2
  179. package/dist/publish/command.d.ts.map +1 -1
  180. package/dist/publish/command.js +157 -17
  181. package/dist/publish/command.js.map +1 -1
  182. package/dist/publish/context.d.ts +12 -1
  183. package/dist/publish/context.d.ts.map +1 -1
  184. package/dist/publish/context.js.map +1 -1
  185. package/dist/publish/diff.d.ts +21 -0
  186. package/dist/publish/diff.d.ts.map +1 -0
  187. package/dist/publish/diff.js +96 -0
  188. package/dist/publish/diff.js.map +1 -0
  189. package/dist/publish/docs-apply.d.ts +8 -1
  190. package/dist/publish/docs-apply.d.ts.map +1 -1
  191. package/dist/publish/docs-apply.js +49 -10
  192. package/dist/publish/docs-apply.js.map +1 -1
  193. package/dist/publish/docs-plan.d.ts +16 -3
  194. package/dist/publish/docs-plan.d.ts.map +1 -1
  195. package/dist/publish/docs-plan.js +57 -6
  196. package/dist/publish/docs-plan.js.map +1 -1
  197. package/dist/publish/extras.d.ts +10 -0
  198. package/dist/publish/extras.d.ts.map +1 -1
  199. package/dist/publish/extras.js +54 -2
  200. package/dist/publish/extras.js.map +1 -1
  201. package/dist/publish/frontmatter.d.ts +1 -1
  202. package/dist/publish/frontmatter.d.ts.map +1 -1
  203. package/dist/publish/frontmatter.js +1 -0
  204. package/dist/publish/frontmatter.js.map +1 -1
  205. package/dist/publish/index.d.ts +12 -0
  206. package/dist/publish/index.d.ts.map +1 -0
  207. package/dist/publish/index.js +17 -0
  208. package/dist/publish/index.js.map +1 -0
  209. package/dist/publish/manifest.d.ts.map +1 -1
  210. package/dist/publish/manifest.js +48 -3
  211. package/dist/publish/manifest.js.map +1 -1
  212. package/dist/publish/names.d.ts +28 -0
  213. package/dist/publish/names.d.ts.map +1 -0
  214. package/dist/publish/names.js +80 -0
  215. package/dist/publish/names.js.map +1 -0
  216. package/dist/publish/posts.d.ts.map +1 -1
  217. package/dist/publish/posts.js +46 -13
  218. package/dist/publish/posts.js.map +1 -1
  219. package/dist/publish/preview.d.ts +56 -0
  220. package/dist/publish/preview.d.ts.map +1 -0
  221. package/dist/publish/preview.js +133 -0
  222. package/dist/publish/preview.js.map +1 -0
  223. package/dist/publish/redirects.d.ts +13 -0
  224. package/dist/publish/redirects.d.ts.map +1 -0
  225. package/dist/publish/redirects.js +154 -0
  226. package/dist/publish/redirects.js.map +1 -0
  227. package/dist/publish/reserved.d.ts +49 -0
  228. package/dist/publish/reserved.d.ts.map +1 -0
  229. package/dist/publish/reserved.js +118 -0
  230. package/dist/publish/reserved.js.map +1 -0
  231. package/dist/publish/rewrite.d.ts +12 -0
  232. package/dist/publish/rewrite.d.ts.map +1 -1
  233. package/dist/publish/rewrite.js +22 -0
  234. package/dist/publish/rewrite.js.map +1 -1
  235. package/dist/publish/scan-docs.d.ts +10 -0
  236. package/dist/publish/scan-docs.d.ts.map +1 -0
  237. package/dist/publish/scan-docs.js +160 -0
  238. package/dist/publish/scan-docs.js.map +1 -0
  239. package/dist/publish/scan.d.ts +21 -17
  240. package/dist/publish/scan.d.ts.map +1 -1
  241. package/dist/publish/scan.js +99 -232
  242. package/dist/publish/scan.js.map +1 -1
  243. package/dist/publish/slots.d.ts +39 -0
  244. package/dist/publish/slots.d.ts.map +1 -0
  245. package/dist/publish/slots.js +64 -0
  246. package/dist/publish/slots.js.map +1 -0
  247. package/dist/publish/studio-edits.d.ts +25 -0
  248. package/dist/publish/studio-edits.d.ts.map +1 -0
  249. package/dist/publish/studio-edits.js +53 -0
  250. package/dist/publish/studio-edits.js.map +1 -0
  251. package/dist/publish/tags.d.ts +9 -0
  252. package/dist/publish/tags.d.ts.map +1 -0
  253. package/dist/publish/tags.js +194 -0
  254. package/dist/publish/tags.js.map +1 -0
  255. package/dist/publish/types.d.ts +84 -1
  256. package/dist/publish/types.d.ts.map +1 -1
  257. package/dist/publish/types.js +0 -10
  258. package/dist/publish/types.js.map +1 -1
  259. package/dist/publish-command.d.ts +55 -0
  260. package/dist/publish-command.d.ts.map +1 -0
  261. package/dist/publish-command.js +197 -0
  262. package/dist/publish-command.js.map +1 -0
  263. package/dist/run.d.ts +3 -10
  264. package/dist/run.d.ts.map +1 -1
  265. package/dist/run.js +171 -112
  266. package/dist/run.js.map +1 -1
  267. package/dist/translations/target.d.ts.map +1 -1
  268. package/dist/translations/target.js +2 -2
  269. package/dist/translations/target.js.map +1 -1
  270. package/dist/validate.d.ts +39 -0
  271. package/dist/validate.d.ts.map +1 -0
  272. package/dist/validate.js +166 -0
  273. package/dist/validate.js.map +1 -0
  274. package/dist/version.d.ts +8 -0
  275. package/dist/version.d.ts.map +1 -0
  276. package/dist/version.js +11 -0
  277. package/dist/version.js.map +1 -0
  278. package/dist/whoami.d.ts +41 -0
  279. package/dist/whoami.d.ts.map +1 -0
  280. package/dist/whoami.js +161 -0
  281. package/dist/whoami.js.map +1 -0
  282. package/package.json +2 -2
  283. package/dist/publish-dir.d.ts +0 -54
  284. package/dist/publish-dir.d.ts.map +0 -1
  285. package/dist/publish-dir.js +0 -119
  286. package/dist/publish-dir.js.map +0 -1
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.studioConflicts = studioConflicts;
4
+ exports.conflictText = conflictText;
5
+ const context_1 = require("./context");
6
+ /** The pages this plan would overwrite that were edited since the last publish. */
7
+ async function studioConflicts(ctx, plan, live) {
8
+ const bySlug = new Map(live.pages.map((p) => [p.slug, p]));
9
+ const touched = new Map();
10
+ for (const sends of plan.sends.values())
11
+ for (const s of sends) {
12
+ const page = s.why === 'update' ? bySlug.get(s.page.slug) : undefined;
13
+ if (page)
14
+ touched.set(page.id, page.slug);
15
+ }
16
+ for (const p of plan.slotWrites) {
17
+ const page = bySlug.get(p.slug);
18
+ if (page)
19
+ touched.set(page.id, page.slug);
20
+ }
21
+ if (touched.size === 0)
22
+ return [];
23
+ let rows = [];
24
+ try {
25
+ // Chunked: a query string has a limit, and a big docs space has hundreds.
26
+ const ids = [...touched.keys()];
27
+ for (let i = 0; i < ids.length; i += 100) {
28
+ const res = await ctx.api.get((0, context_1.spacePath)(ctx, '/sync-state'), {
29
+ pageIds: ids.slice(i, i + 100).join(','),
30
+ });
31
+ rows.push(...(res.pages ?? []));
32
+ }
33
+ }
34
+ catch (e) {
35
+ // An API from before the baseline existed: nothing to compare with, which
36
+ // is the state every page was in before this check — publish as before.
37
+ if (e.status === 404)
38
+ return [];
39
+ throw e;
40
+ }
41
+ rows = rows.filter((r) => r.editedSinceSync && touched.has(r.pageId));
42
+ return rows.map((r) => ({
43
+ slug: r.slug,
44
+ pageId: r.pageId,
45
+ by: r.lastEdit?.by.name ?? r.lastEdit?.by.email ?? 'someone',
46
+ at: r.lastEdit?.at ?? 'an unknown time',
47
+ }));
48
+ }
49
+ /** The line and the error a conflict prints, in the words the docs promise. */
50
+ function conflictText(c) {
51
+ return `CONFLICT ${c.slug} edited in studio by ${c.by} at ${c.at}`;
52
+ }
53
+ //# sourceMappingURL=studio-edits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"studio-edits.js","sourceRoot":"","sources":["../../src/publish/studio-edits.ts"],"names":[],"mappings":";;AA8BA,0CAwCC;AAGD,oCAEC;AA3ED,uCAAqD;AA6BrD,mFAAmF;AAC5E,KAAK,UAAU,eAAe,CACnC,GAAa,EACb,IAAc,EACd,IAAc;IAEd,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,K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AG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,0EAA0E;QAC1E,wEAAwE;QACxE,IAAK,CAAyB,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,EAAE,CAAC;QACzD,MAAM,CAAC,CAAC;IACV,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,IAAI,SAAS;QAC5D,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,iBAAiB;KACxC,CAAC,CAAC,CAAC;AACN,CAAC;AAED,+EAA+E;AAC/E,SAAgB,YAAY,CAAC,CAAiB;IAC5C,OAAO,YAAY,CAAC,CAAC,IAAI,wBAAwB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC;AACrE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { type SpaceCtx } from './context';
2
+ import type { TagSpec } from './types';
3
+ /** One declared tag → the body its door takes, and the keys nothing here understands. */
4
+ export declare function tagBody(spec: TagSpec): {
5
+ body: Record<string, unknown>;
6
+ unknown: string[];
7
+ };
8
+ export declare function syncTags(ctx: SpaceCtx, apply: boolean, existingAssets: Map<string, string>): Promise<void>;
9
+ //# sourceMappingURL=tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/publish/tags.ts"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrD,OAAO,KAAK,EAAW,OAAO,EAAE,MAAM,SAAS,CAAC;AA+DhD,yFAAyF;AACzF,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAc3F;AAkBD,wBAAsB,QAAQ,CAC5B,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,OAAO,EACd,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAClC,OAAO,CAAC,IAAI,CAAC,CAsFf"}
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tagBody = tagBody;
4
+ exports.syncTags = syncTags;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const compare_1 = require("./compare");
8
+ const context_1 = require("./context");
9
+ const diff_1 = require("./diff");
10
+ const api_1 = require("./api");
11
+ const names_1 = require("./names");
12
+ /**
13
+ * A blog's categories: how each tag looks — label, colours, description,
14
+ * cover, icon, the tag it sits under.
15
+ *
16
+ * Declared in the manifest (`tags:` on the space) or in `_tags.yml` beside the
17
+ * posts; the manifest wins key by key. Matched by slug, compared key by key
18
+ * against `GET …/blog/tag-info`, and only a tag that differs is written
19
+ * (`PUT …/blog/tags/{slug}`, which merges). A local `cover:` or image `icon:`
20
+ * is uploaded once, by content hash, like any image a post points at.
21
+ *
22
+ * Only a BLOG has this door; a tag list on another type is reported, not
23
+ * silently dropped.
24
+ */
25
+ /** `PUT …/blog/tags/{slug}`'s own keys. */
26
+ const TAG_KEYS = [
27
+ 'label',
28
+ 'color',
29
+ 'textColor',
30
+ 'colorDark',
31
+ 'textColorDark',
32
+ 'gradient',
33
+ 'description',
34
+ 'pageScheme',
35
+ 'pagePalette',
36
+ 'coverUrl',
37
+ 'icon',
38
+ 'parent',
39
+ 'translations',
40
+ 'internal',
41
+ ];
42
+ const BY_FOLD = new Map(TAG_KEYS.map((k) => [k.toLowerCase(), k]));
43
+ /** The spellings people write first. */
44
+ const ALIAS = {
45
+ name: 'label',
46
+ title: 'label',
47
+ colour: 'color',
48
+ textcolour: 'textColor',
49
+ colourdark: 'colorDark',
50
+ textcolourdark: 'textColorDark',
51
+ cover: 'coverUrl',
52
+ coverimage: 'coverUrl',
53
+ image: 'coverUrl',
54
+ scheme: 'pageScheme',
55
+ palette: 'pagePalette',
56
+ };
57
+ const COLOR_KEYS = new Set(['color', 'textColor', 'colorDark', 'textColorDark']);
58
+ /** A value that is a path to a local image, to upload rather than send. */
59
+ const IMAGE = /\.(png|jpe?g|gif|webp|svg|avif|ico)$/i;
60
+ /** The API's colour rule (lower-case, a hex gets its `#`), so a compare is not fooled by spelling. */
61
+ function canonColor(v) {
62
+ if (typeof v !== 'string')
63
+ return v;
64
+ const raw = v.trim().toLowerCase();
65
+ return /^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(raw) && !raw.startsWith('#')
66
+ ? `#${raw}`
67
+ : raw;
68
+ }
69
+ /** One declared tag → the body its door takes, and the keys nothing here understands. */
70
+ function tagBody(spec) {
71
+ const body = {};
72
+ const unknown = [];
73
+ for (const [k, v] of Object.entries(spec ?? {})) {
74
+ const fold = k.toLowerCase().replace(/[-_\s]/g, '');
75
+ const key = BY_FOLD.get(fold) ?? ALIAS[fold];
76
+ if (!key) {
77
+ unknown.push(k);
78
+ continue;
79
+ }
80
+ body[key] = COLOR_KEYS.has(key) ? canonColor(v) : typeof v === 'string' ? v.trim() : v;
81
+ }
82
+ if (typeof body.parent === 'string')
83
+ body.parent = (0, names_1.slugify)(body.parent, '');
84
+ return { body, unknown };
85
+ }
86
+ /** A live tag in the same terms as a declared one. */
87
+ function liveBody(t) {
88
+ const out = {};
89
+ for (const k of TAG_KEYS)
90
+ out[k] = k in t ? t[k] : null;
91
+ // `label` reads back as the slug when nobody named the tag.
92
+ if (out.label === t.slug)
93
+ out.label = null;
94
+ for (const k of COLOR_KEYS)
95
+ out[k] = canonColor(out[k]);
96
+ return out;
97
+ }
98
+ /** Does a tag hold any display of its own (beyond being used by a post)? */
99
+ function described(t) {
100
+ const b = liveBody(t);
101
+ return TAG_KEYS.some((k) => b[k] !== null && b[k] !== undefined && b[k] !== false);
102
+ }
103
+ async function syncTags(ctx, apply, existingAssets) {
104
+ const declared = { ...ctx.scan.tags };
105
+ for (const [slug, spec] of Object.entries(ctx.spec.tags ?? {}))
106
+ declared[slug] = { ...(declared[slug] ?? {}), ...(spec ?? {}) };
107
+ if (!Object.keys(declared).length || !ctx.only.part('tags', ctx.spec))
108
+ return;
109
+ if (ctx.type !== 'BLOG') {
110
+ ctx.line({
111
+ verb: 'warn',
112
+ what: 'tags',
113
+ detail: `a ${ctx.type} space has no tag display to set — only a blog's categories are synced`,
114
+ });
115
+ return;
116
+ }
117
+ const live = await ctx.api.tagInfo(ctx.org, ctx.spaceId);
118
+ if (live === null) {
119
+ ctx.line({ verb: 'meta', what: 'tags', detail: 'cannot compare without a token' });
120
+ return;
121
+ }
122
+ const bySlug = new Map(live.map((t) => [t.slug, t]));
123
+ const seen = new Set();
124
+ for (const [raw, spec] of Object.entries(declared)) {
125
+ const slug = (0, names_1.slugify)(raw, '');
126
+ if (!slug) {
127
+ ctx.errors.push(`tags: "${raw}" is not a tag slug (letters, numbers and dashes)`);
128
+ continue;
129
+ }
130
+ seen.add(slug);
131
+ const { body, unknown } = tagBody(spec);
132
+ if (unknown.length)
133
+ ctx.line({
134
+ verb: 'warn',
135
+ what: `tag ${slug}`,
136
+ detail: `not understood, not sent: ${unknown.join(', ')}`,
137
+ });
138
+ for (const k of ['coverUrl', 'icon']) {
139
+ const v = body[k];
140
+ if (typeof v !== 'string' || !IMAGE.test(v) || /^[a-z][a-z0-9+.-]*:|^\//i.test(v))
141
+ continue;
142
+ const abs = (0, node_path_1.resolve)(ctx.scan.absDir, v);
143
+ if (!(0, node_fs_1.existsSync)(abs) || !(0, node_fs_1.statSync)(abs).isFile()) {
144
+ ctx.errors.push(`tag ${slug}: ${k} ${v} is not a file in ${ctx.scan.dir || '.'}/`);
145
+ delete body[k];
146
+ continue;
147
+ }
148
+ // Uploaded once, by content; a plan names it by the URL it already has.
149
+ const known = (0, api_1.lookupAsset)(existingAssets, abs);
150
+ if (known)
151
+ body[k] = known;
152
+ else if (!apply)
153
+ ctx.line({
154
+ verb: 'upload',
155
+ what: abs.slice(ctx.root.length + 1) || abs,
156
+ detail: `tag ${slug}'s ${k} — uploaded by a real run`,
157
+ });
158
+ else {
159
+ const had = existingAssets.size;
160
+ body[k] = await ctx.api.upload(ctx.org, ctx.spaceId, abs, existingAssets);
161
+ if (existingAssets.size > had)
162
+ ctx.line({ verb: 'upload', what: abs.slice(ctx.root.length + 1) || abs, detail: String(body[k]) });
163
+ }
164
+ }
165
+ const current = bySlug.get(slug);
166
+ const was = current ? liveBody(current) : undefined;
167
+ const keys = (0, compare_1.differingKeys)(was, body);
168
+ if (!keys.length)
169
+ continue;
170
+ ctx.line({
171
+ verb: current && described(current) ? 'update' : 'create',
172
+ what: `tag ${slug}`,
173
+ detail: keys.join(', '),
174
+ diff: (0, diff_1.fieldDiff)(was, body, keys),
175
+ });
176
+ if (apply)
177
+ await ctx.api.put((0, context_1.spacePath)(ctx, `/blog/tags/${encodeURIComponent(slug)}`), Object.fromEntries(keys.map((k) => [k, body[k]])));
178
+ }
179
+ // `--prune`: a described tag the folder no longer describes loses its look.
180
+ // Its posts keep the tag; only the display is cleared (`DELETE …/tags/{slug}`).
181
+ if (!ctx.prune)
182
+ return;
183
+ if (!ctx.only.all)
184
+ return;
185
+ const keep = new Set(ctx.spec.keep ?? []);
186
+ for (const t of live) {
187
+ if (seen.has(t.slug) || keep.has(t.slug) || !described(t))
188
+ continue;
189
+ ctx.line({ verb: 'prune', what: `tag ${t.slug}`, detail: 'not declared — display cleared, posts keep the tag' });
190
+ if (apply)
191
+ await ctx.api.del((0, context_1.spacePath)(ctx, `/blog/tags/${encodeURIComponent(t.slug)}`));
192
+ }
193
+ }
194
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/publish/tags.ts"],"names":[],"mappings":";;AAuEA,0BAcC;AAkBD,4BA0FC;AAjMD,qCAA+C;AAC/C,yCAAoC;AACpC,uCAA0C;AAC1C,uCAAqD;AACrD,iCAAmC;AACnC,+BAAoC;AACpC,mCAAkC;AAGlC;;;;;;;;;;;;GAYG;AAEH,2CAA2C;AAC3C,MAAM,QAAQ,GAAG;IACf,OAAO;IACP,OAAO;IACP,WAAW;IACX,WAAW;IACX,eAAe;IACf,UAAU;IACV,aAAa;IACb,YAAY;IACZ,aAAa;IACb,UAAU;IACV,MAAM;IACN,QAAQ;IACR,cAAc;IACd,UAAU;CACF,CAAC;AACX,MAAM,OAAO,GAAG,IAAI,GAAG,CAAiB,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnF,wCAAwC;AACxC,MAAM,KAAK,GAA2B;IACpC,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,OAAO;IACf,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,WAAW;IACvB,cAAc,EAAE,eAAe;IAC/B,KAAK,EAAE,UAAU;IACjB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,aAAa;CACvB,CAAC;AAEF,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC,CAAC;AACjF,2EAA2E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EAAC,GAAG,EAAE,cAAc,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IAC3F,CAAC;AACH,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { Slot } from './slots';
1
2
  /**
2
3
  * The shapes `forumulate publish <folder>` works in.
3
4
  *
@@ -34,6 +35,12 @@ export interface LocalPage {
34
35
  unknown: string[];
35
36
  /** Synthesised to stand for a folder that has no index file of its own. */
36
37
  stub?: boolean;
38
+ /**
39
+ * Named slots the front matter fills (`short-answer:` on an FAQ question),
40
+ * by the shape's own keys. Empty when the file declares none, which is the
41
+ * common case: the body alone is the page.
42
+ */
43
+ sections: Record<string, string>;
37
44
  }
38
45
  /** One top-level folder of a docs space. */
39
46
  export interface LocalCollection {
@@ -65,7 +72,25 @@ export interface LocalSpace {
65
72
  /** Local files (images, PDFs) referenced from pages or posts, absolute paths. */
66
73
  assets: Set<string>;
67
74
  warnings: string[];
75
+ /**
76
+ * Slugs of the files marked `draft: true`. Never created or published — and
77
+ * never pruned either: marking a live post as a draft must not delete it.
78
+ */
79
+ drafts: Set<string>;
80
+ /** Markdown files left out because of their name (README, `_drafts/…`, `ignore:`). */
81
+ skipped: {
82
+ file: string;
83
+ reason: string;
84
+ }[];
85
+ /** Blog categories declared in `_tags.yml` beside the files (the manifest's `tags:` wins). */
86
+ tags: Record<string, TagSpec>;
68
87
  }
88
+ /**
89
+ * How one blog category looks, as written in the manifest or `_tags.yml`.
90
+ * The keys are `PUT …/blog/tags/{slug}`'s own, plus the spellings people
91
+ * reach for first (`name`, `colour`, `cover`, `image`), mapped in `tags.ts`.
92
+ */
93
+ export type TagSpec = Record<string, unknown>;
69
94
  /** A space as the manifest describes it. */
70
95
  export interface SpaceSpec {
71
96
  /** Folder under the publish root. */
@@ -93,8 +118,35 @@ export interface SpaceSpec {
93
118
  }>;
94
119
  openapi?: OpenApiSpec[];
95
120
  monitors?: Record<string, unknown>[];
121
+ /** An ABOUT space's parts (`PUT …/about`), inline or a YAML/JSON file beside the manifest. */
122
+ about?: Record<string, unknown> | string;
96
123
  /** Slugs (pages/posts) or collection slugs that `--prune` must never remove. */
97
124
  keep?: string[];
125
+ /**
126
+ * What a README is in this space: `index` (a folder's own page, GitBook's
127
+ * convention, and the default for page-backed spaces) or `skip`. A posts
128
+ * space always skips it — see `reserved.ts`.
129
+ */
130
+ readme?: 'index' | 'skip';
131
+ /** Extra names to leave out, as globs relative to the space folder. */
132
+ ignore?: string[];
133
+ /** Blog categories by slug: label, colours, description, cover, icon, parent. */
134
+ tags?: Record<string, TagSpec>;
135
+ /**
136
+ * Redirects this space keeps (FMU-F09): a list of rules, or a CSV file
137
+ * (relative to the manifest) in the redirect manager's columns. Merged into
138
+ * the space's table by `publish` — never deletes a rule the file does not
139
+ * name, and never touches the platform's own rename rules.
140
+ */
141
+ redirects?: ManifestRedirect[] | string;
142
+ }
143
+ /** One redirect a manifest declares — the same keys as `PUT …/redirects`. */
144
+ export interface ManifestRedirect {
145
+ from: string;
146
+ to: string;
147
+ status?: 301 | 302 | 307 | 308;
148
+ type?: 'redirect' | 'rewrite';
149
+ passQuery?: boolean;
98
150
  }
99
151
  export interface OpenApiSpec {
100
152
  /** A file relative to the manifest, JSON or YAML. */
@@ -145,11 +197,42 @@ export interface LivePost {
145
197
  markdown?: string;
146
198
  sections?: Record<string, string>;
147
199
  }
200
+ /** A tag's display as `GET …/blog/tag-info` answers it. */
201
+ export interface LiveTag {
202
+ slug: string;
203
+ [key: string]: unknown;
204
+ }
148
205
  /** What a piece of the plan does — one line in the dry run, one or more calls in the real one. */
149
- export type Verb = 'create' | 'update' | 'meta' | 'move' | 'order' | 'prune' | 'upload' | 'patch' | 'import' | 'same' | 'skip' | 'warn';
206
+ export type Verb = 'create' | 'update' | 'meta' | 'move' | 'order' | 'prune' | 'upload' | 'patch' | 'import' | 'same' | 'skip' | 'warn'
207
+ /** A page edited in the studio since the last publish (FMU-D18). */
208
+ | 'conflict'
209
+ /** A page sent to a pull-request preview instead of published (FMU-F01). */
210
+ | 'preview';
150
211
  export interface PlanLine {
151
212
  verb: Verb;
152
213
  what: string;
153
214
  detail?: string;
215
+ /** For an update: the changed lines, `-` live and `+` the file (printed with `--diff`). */
216
+ diff?: string[];
217
+ }
218
+ export interface ScanResult extends LocalSpace {
219
+ /** Per file (relative to the space folder): reference as written → absolute asset path. */
220
+ refs: Map<string, Map<string, string>>;
221
+ /** Every Markdown file of the space (relative to the space folder) → its slug. */
222
+ slugByFile: Map<string, string>;
223
+ }
224
+ export type Reader = (abs: string) => {
225
+ rel: string;
226
+ text: string;
227
+ data: Record<string, unknown>;
228
+ body: string;
229
+ };
230
+ /** Shared with `scan-docs.ts`, which walks the docs half. */
231
+ export interface DocsWalk {
232
+ fieldKeys: string[];
233
+ slots: Slot[];
234
+ skip: (abs: string, name: string) => boolean;
235
+ hasMarkdown: (dir: string) => boolean;
236
+ isIndex: (file: string) => boolean;
154
237
  }
155
238
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/publish/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEhD,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,iFAAiF;IACjF,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,kFAAkF;IAClF,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxB,uEAAuE;IACvE,KAAK,EAAE,MAAM,CAAC;IACd,yFAAyF;IACzF,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;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;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC7C,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACtC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC"}
@@ -1,13 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * The shapes `forumulate publish <folder>` works in.
4
- *
5
- * Three layers, kept apart on purpose: what is ON DISK (`Local*`), what is
6
- * LIVE (`Live*`), and what would change (`Plan`). Every customer publisher we
7
- * were shown (four of them, in three languages) mixed the first two — they
8
- * wrote while they read — so a dry run was a different code path from the real
9
- * one and drifted from it. Here a plan is computed from the two snapshots and
10
- * nothing else, and the real run executes that same plan.
11
- */
12
2
  Object.defineProperty(exports, "__esModule", { value: true });
13
3
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/publish/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/publish/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import type { ForumulateClient } from '@forumulate/sdk';
2
+ /**
3
+ * `forumulate publish` and `forumulate sync` as the CLI runs them: the
4
+ * argument forms, the purge, and the run report (FMU-DOC07, D04, D16).
5
+ *
6
+ * Three argument forms grew up over time — a page id, a folder, and the folder
7
+ * with org and space as positionals — and the guides used all three, so an
8
+ * integrator could not tell which was current. One form is documented now
9
+ * (`publish <folder> --org … --space …`); the others still work and say so on
10
+ * stderr, with the line to use instead.
11
+ */
12
+ export interface PublishCliDeps {
13
+ client: ForumulateClient;
14
+ authed: boolean;
15
+ out: (l: string) => void;
16
+ err: (l: string) => void;
17
+ env?: NodeJS.ProcessEnv;
18
+ upload?: (path: string, form: FormData) => Promise<unknown>;
19
+ sleep?: (ms: number) => Promise<void>;
20
+ }
21
+ export interface FolderFlags {
22
+ org?: string;
23
+ space?: string;
24
+ manifest?: string;
25
+ dryRun: boolean;
26
+ prune: boolean;
27
+ force: boolean;
28
+ verify: boolean;
29
+ only?: string[];
30
+ paceMs: number;
31
+ json: boolean;
32
+ diff: boolean;
33
+ purge?: string;
34
+ report: boolean;
35
+ command: 'publish' | 'sync';
36
+ /** `--preview <name>` (FMU-F01): send the plan's pages to a preview, publish nothing. */
37
+ preview?: string;
38
+ /** `--preview-ttl <days>`. */
39
+ previewTtl?: string;
40
+ /** `--comment`: post (or update) the preview's comment on the pull request. */
41
+ comment?: boolean;
42
+ }
43
+ /** `publish …` in any of its forms. */
44
+ export declare function runPublishCli(rest: string[], flags: Omit<FolderFlags, 'command'>, deps: PublishCliDeps): Promise<number>;
45
+ /** The folder publish/sync, its run reported to the API, its summary printed. */
46
+ export declare function runFolder(folder: string, flags: FolderFlags, deps: PublishCliDeps): Promise<number>;
47
+ /** Many `purged` answers (one per import batch) as one. */
48
+ export declare function mergePurged(answers: Record<string, unknown>[]): {
49
+ scope: string;
50
+ urlCount: number;
51
+ urls: string[];
52
+ edge: string;
53
+ edges: unknown[];
54
+ } | null;
55
+ //# sourceMappingURL=publish-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-command.d.ts","sourceRoot":"","sources":["../src/publish-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAKxD;;;;;;;;;GASG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,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