@forumulate/cli 0.5.0 → 0.9.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 (204) hide show
  1. package/README.md +124 -5
  2. package/dist/api/args.d.ts +21 -0
  3. package/dist/api/args.d.ts.map +1 -0
  4. package/dist/api/args.js +81 -0
  5. package/dist/api/args.js.map +1 -0
  6. package/dist/api/command.d.ts +17 -0
  7. package/dist/api/command.d.ts.map +1 -0
  8. package/dist/api/command.js +182 -0
  9. package/dist/api/command.js.map +1 -0
  10. package/dist/api/describe.d.ts +5 -0
  11. package/dist/api/describe.d.ts.map +1 -0
  12. package/dist/api/describe.js +121 -0
  13. package/dist/api/describe.js.map +1 -0
  14. package/dist/api/http.d.ts +81 -0
  15. package/dist/api/http.d.ts.map +1 -0
  16. package/dist/api/http.js +183 -0
  17. package/dist/api/http.js.map +1 -0
  18. package/dist/api/operations.json +1 -0
  19. package/dist/api/output.d.ts +35 -0
  20. package/dist/api/output.d.ts.map +1 -0
  21. package/dist/api/output.js +176 -0
  22. package/dist/api/output.js.map +1 -0
  23. package/dist/api/request.d.ts +37 -0
  24. package/dist/api/request.d.ts.map +1 -0
  25. package/dist/api/request.js +230 -0
  26. package/dist/api/request.js.map +1 -0
  27. package/dist/api/send.d.ts +35 -0
  28. package/dist/api/send.d.ts.map +1 -0
  29. package/dist/api/send.js +85 -0
  30. package/dist/api/send.js.map +1 -0
  31. package/dist/api/spec.d.ts +96 -0
  32. package/dist/api/spec.d.ts.map +1 -0
  33. package/dist/api/spec.js +126 -0
  34. package/dist/api/spec.js.map +1 -0
  35. package/dist/commands/completion.d.ts +12 -0
  36. package/dist/commands/completion.d.ts.map +1 -0
  37. package/dist/commands/completion.js +169 -0
  38. package/dist/commands/completion.js.map +1 -0
  39. package/dist/commands/config.d.ts +33 -0
  40. package/dist/commands/config.d.ts.map +1 -0
  41. package/dist/commands/config.js +144 -0
  42. package/dist/commands/config.js.map +1 -0
  43. package/dist/commands/context.d.ts +35 -0
  44. package/dist/commands/context.d.ts.map +1 -0
  45. package/dist/commands/context.js +59 -0
  46. package/dist/commands/context.js.map +1 -0
  47. package/dist/commands/groups-api.d.ts +11 -0
  48. package/dist/commands/groups-api.d.ts.map +1 -0
  49. package/dist/commands/groups-api.js +140 -0
  50. package/dist/commands/groups-api.js.map +1 -0
  51. package/dist/commands/groups-community.d.ts +15 -0
  52. package/dist/commands/groups-community.d.ts.map +1 -0
  53. package/dist/commands/groups-community.js +344 -0
  54. package/dist/commands/groups-community.js.map +1 -0
  55. package/dist/commands/groups-content.d.ts +10 -0
  56. package/dist/commands/groups-content.d.ts.map +1 -0
  57. package/dist/commands/groups-content.js +331 -0
  58. package/dist/commands/groups-content.js.map +1 -0
  59. package/dist/commands/groups-docs.d.ts +12 -0
  60. package/dist/commands/groups-docs.d.ts.map +1 -0
  61. package/dist/commands/groups-docs.js +414 -0
  62. package/dist/commands/groups-docs.js.map +1 -0
  63. package/dist/commands/groups-org.d.ts +10 -0
  64. package/dist/commands/groups-org.d.ts.map +1 -0
  65. package/dist/commands/groups-org.js +405 -0
  66. package/dist/commands/groups-org.js.map +1 -0
  67. package/dist/commands/groups-site.d.ts +3 -0
  68. package/dist/commands/groups-site.d.ts.map +1 -0
  69. package/dist/commands/groups-site.js +237 -0
  70. package/dist/commands/groups-site.js.map +1 -0
  71. package/dist/commands/groups-spaces.d.ts +3 -0
  72. package/dist/commands/groups-spaces.d.ts.map +1 -0
  73. package/dist/commands/groups-spaces.js +273 -0
  74. package/dist/commands/groups-spaces.js.map +1 -0
  75. package/dist/commands/groups-types.d.ts +3 -0
  76. package/dist/commands/groups-types.d.ts.map +1 -0
  77. package/dist/commands/groups-types.js +251 -0
  78. package/dist/commands/groups-types.js.map +1 -0
  79. package/dist/commands/groups.d.ts +4 -0
  80. package/dist/commands/groups.d.ts.map +1 -0
  81. package/dist/commands/groups.js +71 -0
  82. package/dist/commands/groups.js.map +1 -0
  83. package/dist/commands/index.d.ts +25 -0
  84. package/dist/commands/index.d.ts.map +1 -0
  85. package/dist/commands/index.js +118 -0
  86. package/dist/commands/index.js.map +1 -0
  87. package/dist/commands/resource.d.ts +86 -0
  88. package/dist/commands/resource.d.ts.map +1 -0
  89. package/dist/commands/resource.js +314 -0
  90. package/dist/commands/resource.js.map +1 -0
  91. package/dist/content/library.d.ts +1 -0
  92. package/dist/content/library.d.ts.map +1 -1
  93. package/dist/content/library.js +1 -0
  94. package/dist/content/library.js.map +1 -1
  95. package/dist/dev/command.d.ts +41 -0
  96. package/dist/dev/command.d.ts.map +1 -0
  97. package/dist/dev/command.js +158 -0
  98. package/dist/dev/command.js.map +1 -0
  99. package/dist/help.d.ts +3 -0
  100. package/dist/help.d.ts.map +1 -0
  101. package/dist/help.js +159 -0
  102. package/dist/help.js.map +1 -0
  103. package/dist/publish/api.d.ts +30 -12
  104. package/dist/publish/api.d.ts.map +1 -1
  105. package/dist/publish/api.js +62 -10
  106. package/dist/publish/api.js.map +1 -1
  107. package/dist/publish/client.d.ts +19 -0
  108. package/dist/publish/client.d.ts.map +1 -0
  109. package/dist/publish/client.js +3 -0
  110. package/dist/publish/client.js.map +1 -0
  111. package/dist/publish/command.d.ts +31 -2
  112. package/dist/publish/command.d.ts.map +1 -1
  113. package/dist/publish/command.js +62 -15
  114. package/dist/publish/command.js.map +1 -1
  115. package/dist/publish/context.d.ts +4 -1
  116. package/dist/publish/context.d.ts.map +1 -1
  117. package/dist/publish/context.js.map +1 -1
  118. package/dist/publish/diff.d.ts +21 -0
  119. package/dist/publish/diff.d.ts.map +1 -0
  120. package/dist/publish/diff.js +96 -0
  121. package/dist/publish/diff.js.map +1 -0
  122. package/dist/publish/docs-apply.d.ts +8 -1
  123. package/dist/publish/docs-apply.d.ts.map +1 -1
  124. package/dist/publish/docs-apply.js +37 -10
  125. package/dist/publish/docs-apply.js.map +1 -1
  126. package/dist/publish/docs-plan.d.ts +16 -3
  127. package/dist/publish/docs-plan.d.ts.map +1 -1
  128. package/dist/publish/docs-plan.js +57 -6
  129. package/dist/publish/docs-plan.js.map +1 -1
  130. package/dist/publish/frontmatter.d.ts +1 -1
  131. package/dist/publish/frontmatter.d.ts.map +1 -1
  132. package/dist/publish/frontmatter.js +1 -0
  133. package/dist/publish/frontmatter.js.map +1 -1
  134. package/dist/publish/index.d.ts +12 -0
  135. package/dist/publish/index.d.ts.map +1 -0
  136. package/dist/publish/index.js +17 -0
  137. package/dist/publish/index.js.map +1 -0
  138. package/dist/publish/manifest.d.ts.map +1 -1
  139. package/dist/publish/manifest.js +23 -3
  140. package/dist/publish/manifest.js.map +1 -1
  141. package/dist/publish/names.d.ts +28 -0
  142. package/dist/publish/names.d.ts.map +1 -0
  143. package/dist/publish/names.js +80 -0
  144. package/dist/publish/names.js.map +1 -0
  145. package/dist/publish/posts.d.ts.map +1 -1
  146. package/dist/publish/posts.js +46 -13
  147. package/dist/publish/posts.js.map +1 -1
  148. package/dist/publish/reserved.d.ts +49 -0
  149. package/dist/publish/reserved.d.ts.map +1 -0
  150. package/dist/publish/reserved.js +118 -0
  151. package/dist/publish/reserved.js.map +1 -0
  152. package/dist/publish/rewrite.d.ts +12 -0
  153. package/dist/publish/rewrite.d.ts.map +1 -1
  154. package/dist/publish/rewrite.js +22 -0
  155. package/dist/publish/rewrite.js.map +1 -1
  156. package/dist/publish/scan-docs.d.ts +10 -0
  157. package/dist/publish/scan-docs.d.ts.map +1 -0
  158. package/dist/publish/scan-docs.js +160 -0
  159. package/dist/publish/scan-docs.js.map +1 -0
  160. package/dist/publish/scan.d.ts +21 -17
  161. package/dist/publish/scan.d.ts.map +1 -1
  162. package/dist/publish/scan.js +99 -232
  163. package/dist/publish/scan.js.map +1 -1
  164. package/dist/publish/slots.d.ts +39 -0
  165. package/dist/publish/slots.d.ts.map +1 -0
  166. package/dist/publish/slots.js +64 -0
  167. package/dist/publish/slots.js.map +1 -0
  168. package/dist/publish/tags.d.ts +9 -0
  169. package/dist/publish/tags.d.ts.map +1 -0
  170. package/dist/publish/tags.js +194 -0
  171. package/dist/publish/tags.js.map +1 -0
  172. package/dist/publish/types.d.ts +62 -0
  173. package/dist/publish/types.d.ts.map +1 -1
  174. package/dist/publish/types.js +0 -10
  175. package/dist/publish/types.js.map +1 -1
  176. package/dist/run.d.ts +16 -1
  177. package/dist/run.d.ts.map +1 -1
  178. package/dist/run.js +124 -117
  179. package/dist/run.js.map +1 -1
  180. package/dist/translations/command.d.ts +36 -0
  181. package/dist/translations/command.d.ts.map +1 -0
  182. package/dist/translations/command.js +411 -0
  183. package/dist/translations/command.js.map +1 -0
  184. package/dist/translations/extras.d.ts +29 -0
  185. package/dist/translations/extras.d.ts.map +1 -0
  186. package/dist/translations/extras.js +123 -0
  187. package/dist/translations/extras.js.map +1 -0
  188. package/dist/translations/files.d.ts +22 -0
  189. package/dist/translations/files.d.ts.map +1 -0
  190. package/dist/translations/files.js +75 -0
  191. package/dist/translations/files.js.map +1 -0
  192. package/dist/translations/sync.d.ts +89 -0
  193. package/dist/translations/sync.d.ts.map +1 -0
  194. package/dist/translations/sync.js +215 -0
  195. package/dist/translations/sync.js.map +1 -0
  196. package/dist/translations/target.d.ts +33 -0
  197. package/dist/translations/target.d.ts.map +1 -0
  198. package/dist/translations/target.js +54 -0
  199. package/dist/translations/target.js.map +1 -0
  200. package/dist/translations/xliff.d.ts +29 -0
  201. package/dist/translations/xliff.d.ts.map +1 -0
  202. package/dist/translations/xliff.js +62 -0
  203. package/dist/translations/xliff.js.map +1 -0
  204. package/package.json +6 -4
@@ -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;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AC1C,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAAE,SAAS;QACpE,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,oDAAoD,EAAE,CAAC,CAAC;QACjH,IAAI,KAAK;YAAE,MAAM,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAA,mBAAS,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. */
@@ -95,6 +120,16 @@ export interface SpaceSpec {
95
120
  monitors?: Record<string, unknown>[];
96
121
  /** Slugs (pages/posts) or collection slugs that `--prune` must never remove. */
97
122
  keep?: string[];
123
+ /**
124
+ * What a README is in this space: `index` (a folder's own page, GitBook's
125
+ * convention, and the default for page-backed spaces) or `skip`. A posts
126
+ * space always skips it — see `reserved.ts`.
127
+ */
128
+ readme?: 'index' | 'skip';
129
+ /** Extra names to leave out, as globs relative to the space folder. */
130
+ ignore?: string[];
131
+ /** Blog categories by slug: label, colours, description, cover, icon, parent. */
132
+ tags?: Record<string, TagSpec>;
98
133
  }
99
134
  export interface OpenApiSpec {
100
135
  /** A file relative to the manifest, JSON or YAML. */
@@ -145,11 +180,38 @@ export interface LivePost {
145
180
  markdown?: string;
146
181
  sections?: Record<string, string>;
147
182
  }
183
+ /** A tag's display as `GET …/blog/tag-info` answers it. */
184
+ export interface LiveTag {
185
+ slug: string;
186
+ [key: string]: unknown;
187
+ }
148
188
  /** What a piece of the plan does — one line in the dry run, one or more calls in the real one. */
149
189
  export type Verb = 'create' | 'update' | 'meta' | 'move' | 'order' | 'prune' | 'upload' | 'patch' | 'import' | 'same' | 'skip' | 'warn';
150
190
  export interface PlanLine {
151
191
  verb: Verb;
152
192
  what: string;
153
193
  detail?: string;
194
+ /** For an update: the changed lines, `-` live and `+` the file (printed with `--diff`). */
195
+ diff?: string[];
196
+ }
197
+ export interface ScanResult extends LocalSpace {
198
+ /** Per file (relative to the space folder): reference as written → absolute asset path. */
199
+ refs: Map<string, Map<string, string>>;
200
+ /** Every Markdown file of the space (relative to the space folder) → its slug. */
201
+ slugByFile: Map<string, string>;
202
+ }
203
+ export type Reader = (abs: string) => {
204
+ rel: string;
205
+ text: string;
206
+ data: Record<string, unknown>;
207
+ body: string;
208
+ };
209
+ /** Shared with `scan-docs.ts`, which walks the docs half. */
210
+ export interface DocsWalk {
211
+ fieldKeys: string[];
212
+ slots: Slot[];
213
+ skip: (abs: string, name: string) => boolean;
214
+ hasMarkdown: (dir: string) => boolean;
215
+ isIndex: (file: string) => boolean;
154
216
  }
155
217
  //# 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;IACb,qEAAqE;IACrE,IAAI,EAAE,SAAS,CAAC;IAChB,yEAAyE;IACzE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,4CAA4C;AAC5C,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,GA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AC3F,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C,2FAA2F;IAC3F,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvC,kFAAkF;IAClF,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAGD,MAAM,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,6DAA6D;AAC7D,MAAM,WAAW,QAAQ;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":""}
package/dist/run.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import type { ForumulateClient } from '@forumulate/sdk';
2
2
  import { type ContentDeps } from './content/command';
3
+ import type { SyncFiles } from './translations/sync';
4
+ import type { Http } from './api/http';
3
5
  /**
4
6
  * Kept in step with package.json by `cli-version.test.ts` — they had drifted to
5
7
  * 0.1.0 and 0.2.1, so `--version` reported a release that was never published.
6
8
  */
7
- export declare const VERSION = "0.5.0";
9
+ export declare const VERSION = "0.9.0";
8
10
  export interface RunDeps {
9
11
  /** The API client. Injected so the CLI is testable without a live server. */
10
12
  client: ForumulateClient;
@@ -31,6 +33,19 @@ export interface RunDeps {
31
33
  ask?: (question: string) => Promise<string>;
32
34
  /** File access for `content`, injected so its tests touch no disk. */
33
35
  files?: ContentDeps['files'];
36
+ /**
37
+ * The transport `api` and the resource commands use (see `api/http.ts` for
38
+ * why it is not the SDK's). Built from `baseUrl` and the stored token when
39
+ * absent; a test passes one aimed at its fake server.
40
+ */
41
+ http?: Http;
42
+ readFile?: (path: string) => string | Buffer;
43
+ /** Where `--out` writes a downloaded file (tests capture it). */
44
+ writeFile?: (path: string, data: Buffer | string) => void;
45
+ readStdin?: () => Promise<string>;
46
+ userAgent?: string;
47
+ /** File access for `translations pull|push`, which also walks a folder. */
48
+ translationFiles?: SyncFiles;
34
49
  }
35
50
  /**
36
51
  * Parse and execute a CLI invocation. Pure w.r.t. I/O (uses the injected deps),
package/dist/run.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMxD,OAAO,EAAmC,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGtF;;;GAGG;AACH,eAAO,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