@cogenta/cli 0.4.0 → 0.7.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 (174) hide show
  1. package/CHANGELOG.md +3951 -0
  2. package/dist/admin-assets/assets/index-Bc_X94A_.js +1090 -0
  3. package/dist/admin-assets/assets/index-CxZHGwVA.css +1 -0
  4. package/dist/admin-assets/assets/vips-_dmTUXFO.wasm +0 -0
  5. package/dist/admin-assets/assets/vips-es6-DrQTTS8Q.js +7 -0
  6. package/dist/admin-assets/branding/logo-cogenta-dark.png +0 -0
  7. package/dist/admin-assets/branding/logo-cogenta-icon.png +0 -0
  8. package/dist/admin-assets/branding/logo-cogenta-light.png +0 -0
  9. package/dist/admin-assets/branding/logo-cogenta-small.png +0 -0
  10. package/dist/admin-assets/branding/logo-cogenta-transparent.png +0 -0
  11. package/dist/admin-assets/branding/logo-cogenta.png +0 -0
  12. package/dist/admin-assets/favicon.png +0 -0
  13. package/dist/admin-assets/fonts/jetbrains-mono-var.woff2 +0 -0
  14. package/dist/admin-assets/fonts/space-grotesk-var.woff2 +0 -0
  15. package/dist/admin-assets/index.html +3 -2
  16. package/dist/bin.js +6 -0
  17. package/dist/bin.js.map +1 -1
  18. package/dist/commands/admin-assets.d.ts +1 -0
  19. package/dist/commands/admin-assets.d.ts.map +1 -1
  20. package/dist/commands/admin-assets.js +19 -1
  21. package/dist/commands/admin-assets.js.map +1 -1
  22. package/dist/commands/agent-runtime.d.ts +160 -0
  23. package/dist/commands/agent-runtime.d.ts.map +1 -0
  24. package/dist/commands/agent-runtime.js +524 -0
  25. package/dist/commands/agent-runtime.js.map +1 -0
  26. package/dist/commands/assistant.d.ts +89 -3
  27. package/dist/commands/assistant.d.ts.map +1 -1
  28. package/dist/commands/assistant.js +209 -41
  29. package/dist/commands/assistant.js.map +1 -1
  30. package/dist/commands/audit-integrity-alert.d.ts +23 -0
  31. package/dist/commands/audit-integrity-alert.d.ts.map +1 -0
  32. package/dist/commands/audit-integrity-alert.js +33 -0
  33. package/dist/commands/audit-integrity-alert.js.map +1 -0
  34. package/dist/commands/backup.d.ts +78 -0
  35. package/dist/commands/backup.d.ts.map +1 -0
  36. package/dist/commands/backup.js +238 -0
  37. package/dist/commands/backup.js.map +1 -0
  38. package/dist/commands/channels.d.ts +47 -0
  39. package/dist/commands/channels.d.ts.map +1 -0
  40. package/dist/commands/channels.js +284 -0
  41. package/dist/commands/channels.js.map +1 -0
  42. package/dist/commands/default-logo.d.ts +27 -0
  43. package/dist/commands/default-logo.d.ts.map +1 -0
  44. package/dist/commands/default-logo.js +30 -0
  45. package/dist/commands/default-logo.js.map +1 -0
  46. package/dist/commands/doctor.d.ts +5 -1
  47. package/dist/commands/doctor.d.ts.map +1 -1
  48. package/dist/commands/doctor.js +74 -2
  49. package/dist/commands/doctor.js.map +1 -1
  50. package/dist/commands/export.d.ts +22 -0
  51. package/dist/commands/export.d.ts.map +1 -0
  52. package/dist/commands/export.js +182 -0
  53. package/dist/commands/export.js.map +1 -0
  54. package/dist/commands/forms-page.d.ts +75 -0
  55. package/dist/commands/forms-page.d.ts.map +1 -0
  56. package/dist/commands/forms-page.js +191 -0
  57. package/dist/commands/forms-page.js.map +1 -0
  58. package/dist/commands/import.d.ts.map +1 -1
  59. package/dist/commands/import.js +13 -1
  60. package/dist/commands/import.js.map +1 -1
  61. package/dist/commands/mcp.d.ts +35 -0
  62. package/dist/commands/mcp.d.ts.map +1 -0
  63. package/dist/commands/mcp.js +277 -0
  64. package/dist/commands/mcp.js.map +1 -0
  65. package/dist/commands/roles.d.ts +22 -0
  66. package/dist/commands/roles.d.ts.map +1 -0
  67. package/dist/commands/roles.js +79 -0
  68. package/dist/commands/roles.js.map +1 -0
  69. package/dist/commands/search-page.d.ts +15 -0
  70. package/dist/commands/search-page.d.ts.map +1 -1
  71. package/dist/commands/search-page.js +22 -16
  72. package/dist/commands/search-page.js.map +1 -1
  73. package/dist/commands/seo.d.ts +92 -4
  74. package/dist/commands/seo.d.ts.map +1 -1
  75. package/dist/commands/seo.js +168 -4
  76. package/dist/commands/seo.js.map +1 -1
  77. package/dist/commands/serve.d.ts +439 -7
  78. package/dist/commands/serve.d.ts.map +1 -1
  79. package/dist/commands/serve.js +3515 -181
  80. package/dist/commands/serve.js.map +1 -1
  81. package/dist/commands/site-plan.d.ts +27 -1
  82. package/dist/commands/site-plan.d.ts.map +1 -1
  83. package/dist/commands/site-plan.js +79 -8
  84. package/dist/commands/site-plan.js.map +1 -1
  85. package/dist/commands/skin.d.ts.map +1 -1
  86. package/dist/commands/skin.js +7 -2
  87. package/dist/commands/skin.js.map +1 -1
  88. package/dist/commands/term-archive-page.d.ts +94 -0
  89. package/dist/commands/term-archive-page.d.ts.map +1 -0
  90. package/dist/commands/term-archive-page.js +195 -0
  91. package/dist/commands/term-archive-page.js.map +1 -0
  92. package/dist/commands/theme-css.d.ts +22 -7
  93. package/dist/commands/theme-css.d.ts.map +1 -1
  94. package/dist/commands/theme-css.js +33 -8
  95. package/dist/commands/theme-css.js.map +1 -1
  96. package/dist/commands/theme-registry.d.ts +94 -0
  97. package/dist/commands/theme-registry.d.ts.map +1 -0
  98. package/dist/commands/theme-registry.js +130 -0
  99. package/dist/commands/theme-registry.js.map +1 -0
  100. package/dist/commands/theme-render.d.ts +330 -9
  101. package/dist/commands/theme-render.d.ts.map +1 -1
  102. package/dist/commands/theme-render.js +932 -66
  103. package/dist/commands/theme-render.js.map +1 -1
  104. package/dist/commands/theme-wiring.d.ts +107 -0
  105. package/dist/commands/theme-wiring.d.ts.map +1 -0
  106. package/dist/commands/theme-wiring.js +308 -0
  107. package/dist/commands/theme-wiring.js.map +1 -0
  108. package/dist/commands/tools.d.ts +71 -0
  109. package/dist/commands/tools.d.ts.map +1 -0
  110. package/dist/commands/tools.js +330 -0
  111. package/dist/commands/tools.js.map +1 -0
  112. package/dist/commands/update.d.ts +25 -0
  113. package/dist/commands/update.d.ts.map +1 -0
  114. package/dist/commands/update.js +193 -0
  115. package/dist/commands/update.js.map +1 -0
  116. package/dist/index.d.ts +15 -0
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +146 -4
  119. package/dist/index.js.map +1 -1
  120. package/dist/invite-mail.d.ts +39 -0
  121. package/dist/invite-mail.d.ts.map +1 -0
  122. package/dist/invite-mail.js +39 -0
  123. package/dist/invite-mail.js.map +1 -0
  124. package/dist/update/apply.d.ts +54 -0
  125. package/dist/update/apply.d.ts.map +1 -0
  126. package/dist/update/apply.js +77 -0
  127. package/dist/update/apply.js.map +1 -0
  128. package/dist/update/changelog-risk.d.ts +20 -0
  129. package/dist/update/changelog-risk.d.ts.map +1 -0
  130. package/dist/update/changelog-risk.js +55 -0
  131. package/dist/update/changelog-risk.js.map +1 -0
  132. package/dist/update/check.d.ts +60 -0
  133. package/dist/update/check.d.ts.map +1 -0
  134. package/dist/update/check.js +56 -0
  135. package/dist/update/check.js.map +1 -0
  136. package/dist/update/contract-risk.d.ts +55 -0
  137. package/dist/update/contract-risk.d.ts.map +1 -0
  138. package/dist/update/contract-risk.js +75 -0
  139. package/dist/update/contract-risk.js.map +1 -0
  140. package/dist/update/history.d.ts +30 -0
  141. package/dist/update/history.d.ts.map +1 -0
  142. package/dist/update/history.js +38 -0
  143. package/dist/update/history.js.map +1 -0
  144. package/dist/update/index.d.ts +28 -0
  145. package/dist/update/index.d.ts.map +1 -0
  146. package/dist/update/index.js +11 -0
  147. package/dist/update/index.js.map +1 -0
  148. package/dist/update/list-restore-points.d.ts +20 -0
  149. package/dist/update/list-restore-points.d.ts.map +1 -0
  150. package/dist/update/list-restore-points.js +35 -0
  151. package/dist/update/list-restore-points.js.map +1 -0
  152. package/dist/update/npm-registry.d.ts +11 -0
  153. package/dist/update/npm-registry.d.ts.map +1 -0
  154. package/dist/update/npm-registry.js +74 -0
  155. package/dist/update/npm-registry.js.map +1 -0
  156. package/dist/update/restore-point.d.ts +26 -0
  157. package/dist/update/restore-point.d.ts.map +1 -0
  158. package/dist/update/restore-point.js +23 -0
  159. package/dist/update/restore-point.js.map +1 -0
  160. package/dist/update/tar.d.ts +27 -0
  161. package/dist/update/tar.d.ts.map +1 -0
  162. package/dist/update/tar.js +56 -0
  163. package/dist/update/tar.js.map +1 -0
  164. package/dist/update/version-compare.d.ts +17 -0
  165. package/dist/update/version-compare.d.ts.map +1 -0
  166. package/dist/update/version-compare.js +42 -0
  167. package/dist/update/version-compare.js.map +1 -0
  168. package/dist/version.d.ts +13 -0
  169. package/dist/version.d.ts.map +1 -0
  170. package/dist/version.js +18 -0
  171. package/dist/version.js.map +1 -0
  172. package/package.json +33 -16
  173. package/dist/admin-assets/assets/index-C9a7O_Xs.css +0 -1
  174. package/dist/admin-assets/assets/index-DXvMgWvn.js +0 -74
@@ -0,0 +1,330 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { variantKeyFor } from '@cogenta/api';
3
+ import { createEmailAdapter } from '@cogenta/channels';
4
+ import { CogentaError, } from '@cogenta/core';
5
+ import { checkLinks, createContentStore, reindexAll, } from '@cogenta/schema';
6
+ import { reindexAllVectors } from './assistant.js';
7
+ /**
8
+ * The seven maintenance tools (fiche 24 task 3): what they do, and the run
9
+ * bookkeeping the admin polls while they run.
10
+ *
11
+ * Every tool goes through the queue, never inline in the request that
12
+ * triggers it — "un traitement long ne doit pas être une requête HTTP qui
13
+ * expire" is a literal acceptance criterion of the lot, and the queue
14
+ * already exists with a degraded (database) tier that needs no Redis (R1).
15
+ * A run's bookkeeping is a bounded, in-process ring — durability across a
16
+ * restart is not the point, seeing progress while the process is up is.
17
+ */
18
+ export const TOOL_DEFINITIONS = [
19
+ {
20
+ id: 'purge-cache',
21
+ labelKey: 'tools.purgeCache',
22
+ reversible: true,
23
+ estimatedDurationKey: 'tools.durationSeconds',
24
+ },
25
+ {
26
+ id: 'reindex-search',
27
+ labelKey: 'tools.reindexSearch',
28
+ reversible: true,
29
+ estimatedDurationKey: 'tools.durationMinutes',
30
+ },
31
+ {
32
+ id: 'reindex-vectors',
33
+ labelKey: 'tools.reindexVectors',
34
+ reversible: true,
35
+ estimatedDurationKey: 'tools.durationMinutes',
36
+ },
37
+ {
38
+ id: 'regenerate-images',
39
+ labelKey: 'tools.regenerateImages',
40
+ reversible: true,
41
+ estimatedDurationKey: 'tools.durationMinutes',
42
+ },
43
+ {
44
+ // Internal checking never leaves the site; external does, and the
45
+ // per-run `{ external: true }` request flag (default off) is what keeps
46
+ // that opt-in (R1) — this definition itself carries no such switch.
47
+ id: 'check-links',
48
+ labelKey: 'tools.checkLinks',
49
+ reversible: true,
50
+ estimatedDurationKey: 'tools.durationMinutes',
51
+ },
52
+ {
53
+ id: 'test-email',
54
+ labelKey: 'tools.testEmail',
55
+ reversible: true,
56
+ estimatedDurationKey: 'tools.durationSeconds',
57
+ },
58
+ {
59
+ id: 'purge-trash',
60
+ labelKey: 'tools.purgeTrash',
61
+ reversible: false,
62
+ estimatedDurationKey: 'tools.durationSeconds',
63
+ },
64
+ ];
65
+ function toLike(run) {
66
+ return {
67
+ id: run.id,
68
+ tool: run.tool,
69
+ status: run.status,
70
+ startedAt: run.startedAt,
71
+ finishedAt: run.finishedAt,
72
+ log: [...run.log],
73
+ error: run.error,
74
+ };
75
+ }
76
+ /**
77
+ * Wires the seven tool bodies to the queue and keeps an in-process run log.
78
+ *
79
+ * One queue job name per tool, registered once; `run()` enqueues a job
80
+ * carrying only the run id, and the handler looks the run up to append to
81
+ * its log as it goes. Nothing here assumes the queue's optimal (Redis) tier
82
+ * — the database tier's own test (fiche 24 § 6, "driver dégradé testé")
83
+ * exercises this exact path.
84
+ */
85
+ export function createToolRunner(options) {
86
+ const capacity = options.capacity ?? 50;
87
+ const now = options.now ?? (() => new Date());
88
+ const newId = options.newId ?? randomUUID;
89
+ const runs = new Map();
90
+ const order = [];
91
+ for (const definition of TOOL_DEFINITIONS) {
92
+ const body = options.bodies[definition.id];
93
+ if (body === undefined)
94
+ continue;
95
+ options.queue.process(definition.id, async (job) => {
96
+ const run = runs.get(job.payload.runId);
97
+ if (run === undefined)
98
+ return;
99
+ run.status = 'running';
100
+ try {
101
+ await body({
102
+ log: (line) => run.log.push(line),
103
+ external: job.payload.external === true,
104
+ email: job.payload.email,
105
+ });
106
+ run.status = 'completed';
107
+ }
108
+ catch (error) {
109
+ run.status = 'failed';
110
+ run.error = error instanceof Error ? error.message : String(error);
111
+ options.logger.error('maintenance tool run failed', {
112
+ tool: definition.id,
113
+ runId: run.id,
114
+ error: run.error,
115
+ });
116
+ }
117
+ finally {
118
+ run.finishedAt = now().toISOString();
119
+ }
120
+ });
121
+ }
122
+ return {
123
+ run: async (toolId, runOptions) => {
124
+ const id = newId();
125
+ const run = {
126
+ id,
127
+ tool: toolId,
128
+ status: 'queued',
129
+ startedAt: now().toISOString(),
130
+ finishedAt: undefined,
131
+ log: [],
132
+ error: undefined,
133
+ };
134
+ runs.set(id, run);
135
+ order.push(id);
136
+ while (order.length > capacity) {
137
+ const evicted = order.shift();
138
+ if (evicted !== undefined)
139
+ runs.delete(evicted);
140
+ }
141
+ await options.queue.enqueue({
142
+ name: toolId,
143
+ payload: {
144
+ runId: id,
145
+ ...(runOptions.external === undefined ? {} : { external: runOptions.external }),
146
+ ...(runOptions.email === undefined ? {} : { email: runOptions.email }),
147
+ },
148
+ });
149
+ // Nudge the degraded (database) queue right away instead of leaving this
150
+ // run to wait for the next scheduled drain — on `cogenta serve` that is
151
+ // `SCHEDULED_PUBLISH_TICK_MS` (60s) away, which reads as "stuck forever"
152
+ // for a tool the admin screen itself labels as taking mere seconds. This
153
+ // is fire-and-forget on purpose: the response to the caller must still
154
+ // return the run id immediately, never wait on the tool body itself
155
+ // (that would turn a long tool into the very "requête HTTP qui expire"
156
+ // this whole queue exists to avoid). The periodic tick remains the real
157
+ // drain — for jobs left behind by a crash, and for every backend that
158
+ // isn't the single in-process caller of `run()`.
159
+ options.queue.tick().catch((error) => {
160
+ options.logger.error('immediate tool queue tick failed', {
161
+ tool: toolId,
162
+ runId: id,
163
+ error: error instanceof Error ? error.message : String(error),
164
+ });
165
+ });
166
+ return id;
167
+ },
168
+ getRun: (id) => {
169
+ const run = runs.get(id);
170
+ return run === undefined ? null : toLike(run);
171
+ },
172
+ listRuns: () => [...order].reverse().map((id) => toLike(runs.get(id))),
173
+ };
174
+ }
175
+ /** A fresh, undecorated store per collection — reindexing and link-checking only ever read, so none of the write-path wrapping (`withSearchIndexing`, the read-only guard, …) matters here. */
176
+ function storeForFactory(db, collections) {
177
+ const cache = new Map();
178
+ return (collection) => {
179
+ const existing = cache.get(collection.name);
180
+ if (existing !== undefined)
181
+ return existing;
182
+ const created = createContentStore({ db, collection, siblings: collections });
183
+ cache.set(collection.name, created);
184
+ return created;
185
+ };
186
+ }
187
+ /**
188
+ * The seven real tool implementations (fiche 24 task 3), each honest about
189
+ * what it needs and what it does when that is absent — no tool ever throws
190
+ * because a driver is missing; it logs why and finishes.
191
+ */
192
+ export function buildToolBodies(options) {
193
+ const storeFor = storeForFactory(options.db, options.collections);
194
+ return {
195
+ 'purge-cache': async (ctx) => {
196
+ if (options.cache === null) {
197
+ ctx.log('No cache driver is configured on this site — nothing to purge.');
198
+ return;
199
+ }
200
+ await options.cache.clear();
201
+ ctx.log('Cache cleared.');
202
+ },
203
+ 'reindex-search': async (ctx) => {
204
+ let total = 0;
205
+ for (const collection of options.collections) {
206
+ const store = storeFor(collection);
207
+ const count = await reindexAll(store, { collection, index: options.searchIndex });
208
+ total += count;
209
+ ctx.log(`${collection.name}: ${count} entr(y/ies) reindexed.`);
210
+ }
211
+ ctx.log(`Done. ${total} entr(y/ies) reindexed across ${options.collections.length} collection(s).`);
212
+ },
213
+ 'reindex-vectors': async (ctx) => {
214
+ if (options.vectors === null) {
215
+ ctx.log('No embeddings provider is configured on this site — nothing to reindex.');
216
+ return;
217
+ }
218
+ let total = 0;
219
+ for (const collection of options.collections) {
220
+ const store = storeFor(collection);
221
+ const count = await reindexAllVectors(store, { ...options.vectors, collection });
222
+ total += count;
223
+ ctx.log(`${collection.name}: ${count} entr(y/ies) reindexed.`);
224
+ }
225
+ ctx.log(`Done. ${total} entr(y/ies) reindexed.`);
226
+ },
227
+ 'regenerate-images': async (ctx) => {
228
+ if (options.images === null) {
229
+ ctx.log('No image driver is available on this host — nothing to regenerate.');
230
+ return;
231
+ }
232
+ const images = options.images;
233
+ let processed = 0;
234
+ let cursor;
235
+ for (;;) {
236
+ const page = await options.mediaStore.list({
237
+ kind: 'image',
238
+ limit: 50,
239
+ ...(cursor ? { cursor } : {}),
240
+ });
241
+ for (const asset of page.items) {
242
+ if (asset.width === null || asset.height === null)
243
+ continue;
244
+ try {
245
+ const stream = await options.storage.get(asset.storageKey);
246
+ const chunks = [];
247
+ for await (const chunk of stream)
248
+ chunks.push(chunk);
249
+ const bytes = Buffer.concat(chunks);
250
+ const variants = await images.variants(bytes, {
251
+ width: asset.width,
252
+ height: asset.height,
253
+ });
254
+ for (const variant of variants) {
255
+ await options.storage.put(variantKeyFor(asset.id, variant.name), Buffer.from(variant.bytes), {
256
+ contentType: variant.contentType,
257
+ });
258
+ }
259
+ processed += 1;
260
+ ctx.log(`${asset.filename}: ${variants.length} variant(s) regenerated.`);
261
+ }
262
+ catch (error) {
263
+ ctx.log(`${asset.filename}: failed — ${error instanceof Error ? error.message : String(error)}`);
264
+ }
265
+ }
266
+ if (!page.hasMore || page.nextCursor === null)
267
+ break;
268
+ cursor = page.nextCursor;
269
+ }
270
+ ctx.log(`Done. ${processed} image(s) processed.`);
271
+ },
272
+ 'check-links': async (ctx) => {
273
+ const report = await checkLinks({
274
+ collections: options.collections,
275
+ storeFor,
276
+ locales: options.locales,
277
+ defaultLocale: options.defaultLocale,
278
+ ...(ctx.external ? { checkExternal: true } : {}),
279
+ });
280
+ ctx.log(`Checked ${report.checkedLinks} link(s) across ${report.checkedEntries} published entries.`);
281
+ if (report.skippedExternal > 0) {
282
+ ctx.log(`${report.skippedExternal} external link(s) were not followed (external checking is off).`);
283
+ }
284
+ if (report.broken.length === 0) {
285
+ ctx.log('Nothing broken.');
286
+ return;
287
+ }
288
+ for (const broken of report.broken) {
289
+ const target = broken.link.kind === 'url'
290
+ ? broken.link.href
291
+ : `${broken.link.collection}/${broken.link.id}`;
292
+ ctx.log(`${broken.collection}/${broken.entryId} [${broken.locale}] ${broken.at} → ${target}: ${broken.reason}`);
293
+ }
294
+ },
295
+ 'test-email': async (ctx) => {
296
+ if (ctx.email === undefined) {
297
+ ctx.log('No destination address was given.');
298
+ throw new CogentaError({
299
+ code: 'MAINT_TOOL_INPUT_INVALID',
300
+ message: 'The "test email" tool needs a destination address.',
301
+ hint: 'Send { "email": "you@example.com" } in the run request body.',
302
+ });
303
+ }
304
+ const adapter = createEmailAdapter({ transport: options.emailTransport });
305
+ try {
306
+ await adapter.send({ id: ctx.email }, {
307
+ level: 'notification',
308
+ text: `${options.siteName} — this is a test message from the admin's "Tools" screen. If it reached you, outgoing mail works.`,
309
+ });
310
+ ctx.log(`Sent to ${ctx.email}.`);
311
+ }
312
+ catch (error) {
313
+ ctx.log(`Transport error: ${error instanceof Error ? error.message : String(error)}`);
314
+ throw error;
315
+ }
316
+ },
317
+ 'purge-trash': async (ctx) => {
318
+ let total = 0;
319
+ for (const collection of options.collections) {
320
+ const store = storeFor(collection);
321
+ const report = await store.purgeExpired();
322
+ if (report.purged > 0)
323
+ ctx.log(`${collection.name}: ${report.purged} entr(y/ies) purged.`);
324
+ total += report.purged;
325
+ }
326
+ ctx.log(`Done. ${total} entr(y/ies) purged in total.`);
327
+ },
328
+ };
329
+ }
330
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/commands/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAOxC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAuB,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAEL,YAAY,GAMb,MAAM,eAAe,CAAA;A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,KAAK,EAAE,cAAc;oBACrB,IAAI,EAAE,GAAG,OAAO,CAAC,QAAQ,oGAAoG;iBAC9H,CACF,CAAA;gBACD,GAAG,CAAC,GAAG,CAAC,WAAW,GAAG,CAAC,KAAK,GAAG,CAAC,CAAA;YAClC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,GAAG,CAAC,oBAAoB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;gBACrF,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;QAED,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC3B,IAAI,KAAK,GAAG,CAAC,CAAA;YACb,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBAC7C,MAAM,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAA;gBAClC,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,YAAY,EAAE,CAAA;gBACzC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;oBAAE,GAAG,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,sBAAsB,CAAC,CAAA;gBAC1F,KAAK,IAAI,MAAM,CAAC,MAAM,CAAA;YACxB,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,+BAA+B,CAAC,CAAA;QACxD,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { type Logger } from '@cogenta/core';
2
+ import type { Output, Writer } from '../output.js';
3
+ import { type RunPackageInstall } from '../update/index.js';
4
+ /**
5
+ * `cogenta update` (L22 task 9) — the CLI half of the same logic the admin
6
+ * screen's "Update now" button calls (`@cogenta/api`'s `createUpdateRouter`,
7
+ * wired in `serve.ts`). Both go through exactly `checkForUpdates`/
8
+ * `applyUpdate` from `../update/index.js`, never a second implementation.
9
+ */
10
+ export type UpdateSubcommand = 'check' | 'apply' | 'history';
11
+ export interface UpdateOptions {
12
+ readonly subcommand: string | undefined;
13
+ readonly cwd?: string;
14
+ readonly env?: Record<string, string | undefined>;
15
+ readonly logger?: Logger;
16
+ readonly out: Output;
17
+ readonly stderr: Writer;
18
+ readonly confirmBreaking?: boolean;
19
+ readonly dir?: string;
20
+ readonly fetchImpl?: typeof fetch;
21
+ /** Test seam only — real `cogenta update apply` always uses the real `npm install`. */
22
+ readonly runInstall?: RunPackageInstall;
23
+ }
24
+ export declare function runUpdate(options: UpdateOptions): Promise<number>;
25
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgD,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAML,KAAK,iBAAiB,EAMvB,MAAM,oBAAoB,CAAA;AAI3B;;;;;GAKG;AAEH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;AAE5D,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACjD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAA;IAClC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACjC,uFAAuF;IACvF,QAAQ,CAAC,UAAU,CAAC,EAAE,iBAAiB,CAAA;CACxC;AAmED,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CA8IvE"}
@@ -0,0 +1,193 @@
1
+ import process from 'node:process';
2
+ import { classifyAuditActor, createAuditLog, ensureAuthTables } from '@cogenta/auth';
3
+ import { createLogger, getCoreVersion, isCogentaError } from '@cogenta/core';
4
+ import { applyUpdate, checkForUpdates, listRestorePoints, listUpdateHistory, recordUpdateHistory, UPDATE_APPLIED_ACTION, UPDATE_APPLY_FAILED_ACTION, UPDATE_CHECKED_ACTION, } from '../update/index.js';
5
+ import { getCliVersion } from '../version.js';
6
+ import { defaultBackupDir, openSite } from './backup.js';
7
+ const UPDATE_USAGE = `Usage
8
+ cogenta update check Compare the installed version against npm
9
+ cogenta update apply Apply an available update (creates a restore point first)
10
+ cogenta update history Show past checks, applies and the restore points they took
11
+
12
+ Options
13
+ --confirm-breaking apply: proceed even though a contract-risk warning was found
14
+ --dir <path> Where restore points are written/read (default .cogenta/backups)
15
+ `;
16
+ function installedPackages() {
17
+ return [
18
+ { name: '@cogenta/core', installed: getCoreVersion() },
19
+ { name: '@cogenta/cli', installed: getCliVersion() },
20
+ ];
21
+ }
22
+ function printReport(report, out) {
23
+ out.heading('Update check');
24
+ out.line(`Checked at ${report.checkedAt}`);
25
+ for (const pkg of report.packages) {
26
+ if (pkg.checkError !== undefined) {
27
+ out.line(`${pkg.name}: installed ${pkg.installed} — could not check npm: ${pkg.checkError}`);
28
+ continue;
29
+ }
30
+ if (!pkg.updateAvailable) {
31
+ out.line(`${pkg.name}: ${pkg.installed} — up to date`);
32
+ continue;
33
+ }
34
+ out.line(`${pkg.name}: ${pkg.installed} -> ${pkg.latest} (${pkg.bump})`);
35
+ if (pkg.contractRisk === null)
36
+ continue;
37
+ if (!pkg.contractRisk.available) {
38
+ out.line(` contract risk: could not be determined — ${pkg.contractRisk.reason ?? 'unknown reason'}`);
39
+ continue;
40
+ }
41
+ if (pkg.contractRisk.warnings.length === 0) {
42
+ out.line(' contract risk: none of the scanned changelog entries mention a frozen contract');
43
+ }
44
+ else {
45
+ out.line(' contract risk: possible — a scan of the changelog found a mention of a frozen contract (review before applying):');
46
+ for (const warning of pkg.contractRisk.warnings) {
47
+ out.line(` ${warning.version}: ${warning.excerpt}`);
48
+ }
49
+ }
50
+ }
51
+ if (!report.updateAvailable)
52
+ out.line('Everything is up to date.');
53
+ }
54
+ async function withAuditLog(options, logger, run) {
55
+ const { db, dispose } = await openSite(options, logger);
56
+ try {
57
+ await ensureAuthTables(db);
58
+ return await run(createAuditLog(db));
59
+ }
60
+ finally {
61
+ await dispose();
62
+ }
63
+ }
64
+ export async function runUpdate(options) {
65
+ const { out, stderr } = options;
66
+ const logger = options.logger ?? createLogger({ level: 'silent' });
67
+ const cwd = options.cwd ?? process.cwd();
68
+ const dir = options.dir ?? defaultBackupDir(cwd);
69
+ if (options.subcommand === undefined) {
70
+ stderr(`cogenta update needs a subcommand.\n\n${UPDATE_USAGE}`);
71
+ return 2;
72
+ }
73
+ if (options.subcommand !== 'check' &&
74
+ options.subcommand !== 'apply' &&
75
+ options.subcommand !== 'history') {
76
+ stderr(`Unknown subcommand "${options.subcommand}".\n\n${UPDATE_USAGE}`);
77
+ return 2;
78
+ }
79
+ try {
80
+ if (options.subcommand === 'history') {
81
+ const [history, restorePoints] = await withAuditLog(options, logger, async (auditLog) => [
82
+ await listUpdateHistory(auditLog),
83
+ await listRestorePoints(dir),
84
+ ]);
85
+ out.heading('Update history');
86
+ if (history.length === 0)
87
+ out.line('No update has been checked or applied yet.');
88
+ for (const entry of history) {
89
+ const actor = entry.actorId ?? `(${classifyAuditActor(entry)})`;
90
+ out.line(`${entry.at} ${entry.action} by ${actor}`);
91
+ }
92
+ out.heading('Restore points');
93
+ if (restorePoints.length === 0)
94
+ out.line('No restore point exists yet.');
95
+ for (const point of restorePoints) {
96
+ out.line(`${point.createdAt} ${point.path} ${point.tables} tables, ${point.rows} rows${point.triggeredByUpdate ? ' (taken automatically before an update)' : ''}`);
97
+ }
98
+ return 0;
99
+ }
100
+ if (options.subcommand === 'check') {
101
+ const report = await checkForUpdates({
102
+ packages: installedPackages(),
103
+ ...(options.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl }),
104
+ });
105
+ printReport(report, out);
106
+ await withAuditLog(options, logger, (auditLog) => recordUpdateHistory(auditLog, {
107
+ actorId: null,
108
+ actorRoles: ['admin'],
109
+ action: UPDATE_CHECKED_ACTION,
110
+ diff: {
111
+ packages: report.packages.map((pkg) => ({
112
+ name: pkg.name,
113
+ installed: pkg.installed,
114
+ latest: pkg.latest,
115
+ bump: pkg.bump,
116
+ })),
117
+ },
118
+ })).catch((error) => {
119
+ logger.error('update history record failed', { error: String(error) });
120
+ });
121
+ return 0;
122
+ }
123
+ // apply
124
+ let result;
125
+ try {
126
+ result = await applyUpdate({
127
+ cwd,
128
+ ...(options.env === undefined ? {} : { env: options.env }),
129
+ logger,
130
+ packages: installedPackages(),
131
+ confirmBreakingChange: options.confirmBreaking === true,
132
+ backupDir: dir,
133
+ ...(options.fetchImpl === undefined ? {} : { fetchImpl: options.fetchImpl }),
134
+ ...(options.runInstall === undefined ? {} : { runInstall: options.runInstall }),
135
+ });
136
+ }
137
+ catch (error) {
138
+ await withAuditLog(options, logger, (auditLog) => recordUpdateHistory(auditLog, {
139
+ actorId: null,
140
+ actorRoles: ['admin'],
141
+ action: UPDATE_APPLY_FAILED_ACTION,
142
+ diff: { error: isCogentaError(error) ? error.message : String(error) },
143
+ })).catch(() => undefined);
144
+ throw error;
145
+ }
146
+ if (result.kind === 'up-to-date') {
147
+ out.heading('Nothing to update');
148
+ out.line('Every checked package is already at the latest version.');
149
+ return 0;
150
+ }
151
+ if (result.kind === 'confirmation-required') {
152
+ out.heading('Update refused — contract risk found');
153
+ out.line('The following packages have an update available whose changelog mentions a frozen contract. Review before proceeding:');
154
+ for (const pkg of result.risky) {
155
+ out.line(`${pkg.name}: ${pkg.installed} -> ${pkg.latest}`);
156
+ for (const warning of pkg.contractRisk?.warnings ?? []) {
157
+ out.line(` ${warning.version}: ${warning.excerpt}`);
158
+ }
159
+ }
160
+ out.line('Re-run with --confirm-breaking once you have reviewed this, to proceed anyway.');
161
+ return 1;
162
+ }
163
+ out.heading('Update applied');
164
+ out.line(`Restore point: ${result.restorePoint.path}`);
165
+ for (const pkg of result.installed)
166
+ out.line(`${pkg.name} -> ${pkg.version}`);
167
+ out.line('Restart cogenta for the new version to take effect.');
168
+ await withAuditLog(options, logger, (auditLog) => recordUpdateHistory(auditLog, {
169
+ actorId: null,
170
+ actorRoles: ['admin'],
171
+ action: UPDATE_APPLIED_ACTION,
172
+ diff: {
173
+ installed: result.installed,
174
+ restorePoint: result.restorePoint.path,
175
+ },
176
+ })).catch((error) => {
177
+ logger.error('update history record failed', { error: String(error) });
178
+ });
179
+ return 0;
180
+ }
181
+ catch (error) {
182
+ if (isCogentaError(error)) {
183
+ stderr(`${error.code}: ${error.message}\n`);
184
+ if (error.hint !== undefined)
185
+ stderr(`${error.hint}\n`);
186
+ }
187
+ else {
188
+ stderr(`${error instanceof Error ? error.stack : String(error)}\n`);
189
+ }
190
+ return 1;
191
+ }
192
+ }
193
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAe,MAAM,eAAe,CAAA;AAEzF,OAAO,EAEL,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EAEjB,mBAAmB,EACnB,qBAAqB,EACrB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ions } from './commands/backup.js';
3
+ export { runBackup, runRestore } from './commands/backup.js';
4
+ export type { ChannelsOptions } from './commands/channels.js';
5
+ export { CHANNELS_USAGE, runChannels } from './commands/channels.js';
2
6
  export type { DoctorCheck, DoctorOptions, DoctorReport } from './commands/doctor.js';
3
7
  export { formatDoctorReport, runDoctor } from './commands/doctor.js';
8
+ export type { ExportOptions, ImportContentOptions } from './commands/export.js';
9
+ export { runExport, runImportContent } from './commands/export.js';
4
10
  export type { GenerateOptions, GenerateSubcommand } from './commands/generate.js';
5
11
  export { runGenerate } from './commands/generate.js';
6
12
  export type { ImportOptions, ImportSubcommand } from './commands/import.js';
7
13
  export { runImport } from './commands/import.js';
8
14
  export type { LinksOptions, LinksSubcommand } from './commands/links.js';
9
15
  export { runLinks } from './commands/links.js';
16
+ export type { McpOptions } from './commands/mcp.js';
17
+ export { runMcp } from './commands/mcp.js';
18
+ export type { MediaImageProcessorOptions } from './commands/media-images.js';
19
+ export { contentTypeOf, createMediaImageProcessor, selectMediaImageProcessor, VARIANT_FORMAT, variantName, variantWidthsFor, } from './commands/media-images.js';
10
20
  export type { MigrateOptions, MigrateSubcommand } from './commands/migrate.js';
11
21
  export { loadMigrations, MIGRATIONS_DIRECTORY, runMigrate } from './commands/migrate.js';
22
+ export type { RolesOptions, RolesSubcommand } from './commands/roles.js';
23
+ export { runRoles } from './commands/roles.js';
12
24
  export type { ServeOptions } from './commands/serve.js';
13
25
  export { loadCollections, runServe } from './commands/serve.js';
14
26
  export type { SkinOptions, SkinSubcommand } from './commands/skin.js';
15
27
  export { runSkin } from './commands/skin.js';
28
+ export type { UpdateOptions, UpdateSubcommand } from './commands/update.js';
29
+ export { runUpdate } from './commands/update.js';
16
30
  export type { UsersOptions, UsersSubcommand } from './commands/users.js';
17
31
  export { runUsers } from './commands/users.js';
18
32
  export type { Output, Writer } from './output.js';
19
33
  export { createOutput, shouldUseColour } from './output.js';
34
+ export { getCliVersion } from './version.js';
20
35
  export interface RunOptions {
21
36
  readonly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