@deskwork/core 0.9.5

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 (188) hide show
  1. package/dist/body-state.d.ts +27 -0
  2. package/dist/body-state.d.ts.map +1 -0
  3. package/dist/body-state.js +62 -0
  4. package/dist/body-state.js.map +1 -0
  5. package/dist/calendar-mutations.d.ts +124 -0
  6. package/dist/calendar-mutations.d.ts.map +1 -0
  7. package/dist/calendar-mutations.js +305 -0
  8. package/dist/calendar-mutations.js.map +1 -0
  9. package/dist/calendar.d.ts +54 -0
  10. package/dist/calendar.d.ts.map +1 -0
  11. package/dist/calendar.js +430 -0
  12. package/dist/calendar.js.map +1 -0
  13. package/dist/cli.d.ts +38 -0
  14. package/dist/cli.d.ts.map +1 -0
  15. package/dist/cli.js +72 -0
  16. package/dist/cli.js.map +1 -0
  17. package/dist/config.d.ts +91 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +216 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/content-index.d.ts +74 -0
  22. package/dist/content-index.d.ts.map +1 -0
  23. package/dist/content-index.js +205 -0
  24. package/dist/content-index.js.map +1 -0
  25. package/dist/content-tree-fs-walk.d.ts +54 -0
  26. package/dist/content-tree-fs-walk.d.ts.map +1 -0
  27. package/dist/content-tree-fs-walk.js +112 -0
  28. package/dist/content-tree-fs-walk.js.map +1 -0
  29. package/dist/content-tree-helpers.d.ts +52 -0
  30. package/dist/content-tree-helpers.d.ts.map +1 -0
  31. package/dist/content-tree-helpers.js +116 -0
  32. package/dist/content-tree-helpers.js.map +1 -0
  33. package/dist/content-tree-types.d.ts +175 -0
  34. package/dist/content-tree-types.d.ts.map +1 -0
  35. package/dist/content-tree-types.js +10 -0
  36. package/dist/content-tree-types.js.map +1 -0
  37. package/dist/content-tree.d.ts +93 -0
  38. package/dist/content-tree.d.ts.map +1 -0
  39. package/dist/content-tree.js +385 -0
  40. package/dist/content-tree.js.map +1 -0
  41. package/dist/doctor/index.d.ts +11 -0
  42. package/dist/doctor/index.d.ts.map +1 -0
  43. package/dist/doctor/index.js +10 -0
  44. package/dist/doctor/index.js.map +1 -0
  45. package/dist/doctor/project-rules.d.ts +59 -0
  46. package/dist/doctor/project-rules.d.ts.map +1 -0
  47. package/dist/doctor/project-rules.js +143 -0
  48. package/dist/doctor/project-rules.js.map +1 -0
  49. package/dist/doctor/rules/calendar-uuid-missing.d.ts +19 -0
  50. package/dist/doctor/rules/calendar-uuid-missing.d.ts.map +1 -0
  51. package/dist/doctor/rules/calendar-uuid-missing.js +176 -0
  52. package/dist/doctor/rules/calendar-uuid-missing.js.map +1 -0
  53. package/dist/doctor/rules/duplicate-id.d.ts +27 -0
  54. package/dist/doctor/rules/duplicate-id.d.ts.map +1 -0
  55. package/dist/doctor/rules/duplicate-id.js +157 -0
  56. package/dist/doctor/rules/duplicate-id.js.map +1 -0
  57. package/dist/doctor/rules/legacy-top-level-id-migration.d.ts +40 -0
  58. package/dist/doctor/rules/legacy-top-level-id-migration.d.ts.map +1 -0
  59. package/dist/doctor/rules/legacy-top-level-id-migration.js +232 -0
  60. package/dist/doctor/rules/legacy-top-level-id-migration.js.map +1 -0
  61. package/dist/doctor/rules/missing-frontmatter-id.d.ts +45 -0
  62. package/dist/doctor/rules/missing-frontmatter-id.d.ts.map +1 -0
  63. package/dist/doctor/rules/missing-frontmatter-id.js +283 -0
  64. package/dist/doctor/rules/missing-frontmatter-id.js.map +1 -0
  65. package/dist/doctor/rules/orphan-frontmatter-id.d.ts +18 -0
  66. package/dist/doctor/rules/orphan-frontmatter-id.d.ts.map +1 -0
  67. package/dist/doctor/rules/orphan-frontmatter-id.js +154 -0
  68. package/dist/doctor/rules/orphan-frontmatter-id.js.map +1 -0
  69. package/dist/doctor/rules/schema-rejected.d.ts +20 -0
  70. package/dist/doctor/rules/schema-rejected.d.ts.map +1 -0
  71. package/dist/doctor/rules/schema-rejected.js +44 -0
  72. package/dist/doctor/rules/schema-rejected.js.map +1 -0
  73. package/dist/doctor/rules/slug-collision.d.ts +18 -0
  74. package/dist/doctor/rules/slug-collision.d.ts.map +1 -0
  75. package/dist/doctor/rules/slug-collision.js +65 -0
  76. package/dist/doctor/rules/slug-collision.js.map +1 -0
  77. package/dist/doctor/rules/workflow-stale.d.ts +20 -0
  78. package/dist/doctor/rules/workflow-stale.d.ts.map +1 -0
  79. package/dist/doctor/rules/workflow-stale.js +136 -0
  80. package/dist/doctor/rules/workflow-stale.js.map +1 -0
  81. package/dist/doctor/runner.d.ts +75 -0
  82. package/dist/doctor/runner.d.ts.map +1 -0
  83. package/dist/doctor/runner.js +289 -0
  84. package/dist/doctor/runner.js.map +1 -0
  85. package/dist/doctor/schema-patch.d.ts +21 -0
  86. package/dist/doctor/schema-patch.d.ts.map +1 -0
  87. package/dist/doctor/schema-patch.js +92 -0
  88. package/dist/doctor/schema-patch.js.map +1 -0
  89. package/dist/doctor/types.d.ts +185 -0
  90. package/dist/doctor/types.d.ts.map +1 -0
  91. package/dist/doctor/types.js +13 -0
  92. package/dist/doctor/types.js.map +1 -0
  93. package/dist/frontmatter.d.ts +103 -0
  94. package/dist/frontmatter.d.ts.map +1 -0
  95. package/dist/frontmatter.js +306 -0
  96. package/dist/frontmatter.js.map +1 -0
  97. package/dist/index.d.ts +27 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +27 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/ingest-derive.d.ts +79 -0
  102. package/dist/ingest-derive.d.ts.map +1 -0
  103. package/dist/ingest-derive.js +299 -0
  104. package/dist/ingest-derive.js.map +1 -0
  105. package/dist/ingest-paths.d.ts +37 -0
  106. package/dist/ingest-paths.d.ts.map +1 -0
  107. package/dist/ingest-paths.js +176 -0
  108. package/dist/ingest-paths.js.map +1 -0
  109. package/dist/ingest.d.ts +162 -0
  110. package/dist/ingest.d.ts.map +1 -0
  111. package/dist/ingest.js +269 -0
  112. package/dist/ingest.js.map +1 -0
  113. package/dist/journal.d.ts +49 -0
  114. package/dist/journal.d.ts.map +1 -0
  115. package/dist/journal.js +113 -0
  116. package/dist/journal.js.map +1 -0
  117. package/dist/outline-split.d.ts +38 -0
  118. package/dist/outline-split.d.ts.map +1 -0
  119. package/dist/outline-split.js +84 -0
  120. package/dist/outline-split.js.map +1 -0
  121. package/dist/overrides.d.ts +83 -0
  122. package/dist/overrides.d.ts.map +1 -0
  123. package/dist/overrides.js +88 -0
  124. package/dist/overrides.js.map +1 -0
  125. package/dist/paths.d.ts +183 -0
  126. package/dist/paths.d.ts.map +1 -0
  127. package/dist/paths.js +266 -0
  128. package/dist/paths.js.map +1 -0
  129. package/dist/remark-image-figure.mjs +77 -0
  130. package/dist/remark-strip-first-h1.mjs +26 -0
  131. package/dist/remark-strip-outline.mjs +44 -0
  132. package/dist/rename-slug.d.ts +49 -0
  133. package/dist/rename-slug.d.ts.map +1 -0
  134. package/dist/rename-slug.js +161 -0
  135. package/dist/rename-slug.js.map +1 -0
  136. package/dist/review/handlers.d.ts +55 -0
  137. package/dist/review/handlers.d.ts.map +1 -0
  138. package/dist/review/handlers.js +307 -0
  139. package/dist/review/handlers.js.map +1 -0
  140. package/dist/review/index.d.ts +14 -0
  141. package/dist/review/index.d.ts.map +1 -0
  142. package/dist/review/index.js +13 -0
  143. package/dist/review/index.js.map +1 -0
  144. package/dist/review/journal-mappers.d.ts +35 -0
  145. package/dist/review/journal-mappers.d.ts.map +1 -0
  146. package/dist/review/journal-mappers.js +48 -0
  147. package/dist/review/journal-mappers.js.map +1 -0
  148. package/dist/review/pipeline.d.ts +79 -0
  149. package/dist/review/pipeline.d.ts.map +1 -0
  150. package/dist/review/pipeline.js +234 -0
  151. package/dist/review/pipeline.js.map +1 -0
  152. package/dist/review/render.d.ts +27 -0
  153. package/dist/review/render.d.ts.map +1 -0
  154. package/dist/review/render.js +42 -0
  155. package/dist/review/render.js.map +1 -0
  156. package/dist/review/report.d.ts +50 -0
  157. package/dist/review/report.d.ts.map +1 -0
  158. package/dist/review/report.js +164 -0
  159. package/dist/review/report.js.map +1 -0
  160. package/dist/review/result.d.ts +12 -0
  161. package/dist/review/result.d.ts.map +1 -0
  162. package/dist/review/result.js +12 -0
  163. package/dist/review/result.js.map +1 -0
  164. package/dist/review/start-handlers.d.ts +62 -0
  165. package/dist/review/start-handlers.d.ts.map +1 -0
  166. package/dist/review/start-handlers.js +223 -0
  167. package/dist/review/start-handlers.js.map +1 -0
  168. package/dist/review/types.d.ts +169 -0
  169. package/dist/review/types.d.ts.map +1 -0
  170. package/dist/review/types.js +26 -0
  171. package/dist/review/types.js.map +1 -0
  172. package/dist/review/workflow-paths.d.ts +68 -0
  173. package/dist/review/workflow-paths.d.ts.map +1 -0
  174. package/dist/review/workflow-paths.js +112 -0
  175. package/dist/review/workflow-paths.js.map +1 -0
  176. package/dist/scaffold.d.ts +67 -0
  177. package/dist/scaffold.d.ts.map +1 -0
  178. package/dist/scaffold.js +122 -0
  179. package/dist/scaffold.js.map +1 -0
  180. package/dist/scrapbook.d.ts +229 -0
  181. package/dist/scrapbook.d.ts.map +1 -0
  182. package/dist/scrapbook.js +500 -0
  183. package/dist/scrapbook.js.map +1 -0
  184. package/dist/types.d.ts +197 -0
  185. package/dist/types.d.ts.map +1 -0
  186. package/dist/types.js +120 -0
  187. package/dist/types.js.map +1 -0
  188. package/package.json +160 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * HTTP-shape handlers for the review pipeline. Astro API routes in
3
+ * plugins/deskwork/studio/ call these directly; the handlers return
4
+ * { status, body } results that routes serialize as JSON.
5
+ *
6
+ * Ported from audiocontrol.org's scripts/lib/editorial-review/handlers.ts.
7
+ * Site validation now checks against config.sites rather than a hardcoded
8
+ * SITES array, and the longform blog file path uses resolveBlogFilePath
9
+ * (which honors the site's blogFilenameTemplate config).
10
+ */
11
+ import type { DeskworkConfig } from '../config.ts';
12
+ import { type HandlerResult } from './result.ts';
13
+ export type { HandlerResult } from './result.ts';
14
+ export { handleStartLongform, handleStartShortform } from './start-handlers.ts';
15
+ export declare function handleAnnotate(projectRoot: string, config: DeskworkConfig, body: unknown): HandlerResult;
16
+ export declare function handleListAnnotations(projectRoot: string, config: DeskworkConfig, query: {
17
+ workflowId: string | null;
18
+ version: string | null;
19
+ }): HandlerResult;
20
+ export declare function handleDecision(projectRoot: string, config: DeskworkConfig, body: unknown): HandlerResult;
21
+ /**
22
+ * Return a workflow plus its full version history. The client looks up
23
+ * by one of (in priority order):
24
+ * 1. Workflow id — exact match on `DraftWorkflowItem.id`.
25
+ * 2. `entryId` — stable calendar-entry UUID; join survives slug renames.
26
+ * Preferred over slug when available.
27
+ * 3. (site, slug) — legacy lookup, still supported for workflows that
28
+ * have no entryId stamped.
29
+ *
30
+ * All lookups can additionally filter by (contentKind, platform, channel).
31
+ */
32
+ export declare function handleGetWorkflow(projectRoot: string, config: DeskworkConfig, query: {
33
+ id: string | null;
34
+ entryId?: string | null;
35
+ site: string | null;
36
+ slug: string | null;
37
+ contentKind: string | null;
38
+ platform: string | null;
39
+ channel: string | null;
40
+ }): HandlerResult;
41
+ /**
42
+ * Operator edit-mode submission. Writes disk first (SSOT invariant),
43
+ * then appends a DraftVersion + edit annotation with the server-computed
44
+ * diff.
45
+ */
46
+ export declare function handleCreateVersion(projectRoot: string, config: DeskworkConfig, body: unknown): HandlerResult;
47
+ /**
48
+ * Minimal line-level diff. `-` / `+` prefixed lines for removed/added
49
+ * content, `=` for unchanged. Paired with `applyLineDiff` the operation
50
+ * is reversible.
51
+ */
52
+ export declare function lineDiff(a: string, b: string): string;
53
+ /** Apply a line-diff (as produced by `lineDiff`) to reconstruct the after-text. */
54
+ export declare function applyLineDiff(diff: string): string;
55
+ //# sourceMappingURL=handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/review/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAanD,OAAO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GAAG,MAAM,CAgBrD;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQlD"}
@@ -0,0 +1,307 @@
1
+ /**
2
+ * HTTP-shape handlers for the review pipeline. Astro API routes in
3
+ * plugins/deskwork/studio/ call these directly; the handlers return
4
+ * { status, body } results that routes serialize as JSON.
5
+ *
6
+ * Ported from audiocontrol.org's scripts/lib/editorial-review/handlers.ts.
7
+ * Site validation now checks against config.sites rather than a hardcoded
8
+ * SITES array, and the longform blog file path uses resolveBlogFilePath
9
+ * (which honors the site's blogFilenameTemplate config).
10
+ */
11
+ import { existsSync, writeFileSync } from 'node:fs';
12
+ import { appendAnnotation, appendVersion, mintAnnotation, readAnnotations, readVersions, readWorkflow, readWorkflows, transitionState, } from "./pipeline.js";
13
+ import { workflowFilePath } from "./start-handlers.js";
14
+ import { err, ok } from "./result.js";
15
+ export { handleStartLongform, handleStartShortform } from "./start-handlers.js";
16
+ export function handleAnnotate(projectRoot, config, body) {
17
+ if (!body || typeof body !== 'object')
18
+ return err(400, 'expected JSON object body');
19
+ const draft = body;
20
+ if (!draft.type)
21
+ return err(400, 'type is required');
22
+ if (!draft.workflowId)
23
+ return err(400, 'workflowId is required');
24
+ const workflow = readWorkflow(projectRoot, config, draft.workflowId);
25
+ if (!workflow)
26
+ return err(404, `unknown workflow: ${draft.workflowId}`);
27
+ switch (draft.type) {
28
+ case 'comment': {
29
+ const d = draft;
30
+ if (typeof d.version !== 'number')
31
+ return err(400, 'comment.version is required');
32
+ if (!d.range || typeof d.range.start !== 'number' || typeof d.range.end !== 'number') {
33
+ return err(400, 'comment.range with numeric start/end is required');
34
+ }
35
+ if (typeof d.text !== 'string')
36
+ return err(400, 'comment.text is required');
37
+ const annotation = mintAnnotation({
38
+ type: 'comment',
39
+ workflowId: draft.workflowId,
40
+ version: d.version,
41
+ range: d.range,
42
+ text: d.text,
43
+ ...(d.category !== undefined ? { category: d.category } : {}),
44
+ ...(typeof d.anchor === 'string' ? { anchor: d.anchor } : {}),
45
+ });
46
+ appendAnnotation(projectRoot, config, annotation);
47
+ return ok({ annotation });
48
+ }
49
+ case 'edit': {
50
+ const d = draft;
51
+ if (typeof d.beforeVersion !== 'number')
52
+ return err(400, 'edit.beforeVersion is required');
53
+ if (typeof d.afterMarkdown !== 'string')
54
+ return err(400, 'edit.afterMarkdown is required');
55
+ if (typeof d.diff !== 'string')
56
+ return err(400, 'edit.diff is required');
57
+ const annotation = mintAnnotation({
58
+ type: 'edit',
59
+ workflowId: draft.workflowId,
60
+ beforeVersion: d.beforeVersion,
61
+ afterMarkdown: d.afterMarkdown,
62
+ diff: d.diff,
63
+ });
64
+ appendAnnotation(projectRoot, config, annotation);
65
+ return ok({ annotation });
66
+ }
67
+ case 'approve':
68
+ case 'reject': {
69
+ const d = draft;
70
+ if (typeof d.version !== 'number')
71
+ return err(400, `${draft.type}.version is required`);
72
+ const annotation = mintAnnotation({
73
+ type: draft.type,
74
+ workflowId: draft.workflowId,
75
+ version: d.version,
76
+ ...(draft.type === 'reject' && 'reason' in d ? { reason: d.reason } : {}),
77
+ });
78
+ appendAnnotation(projectRoot, config, annotation);
79
+ return ok({ annotation });
80
+ }
81
+ case 'resolve': {
82
+ const d = draft;
83
+ if (typeof d.commentId !== 'string' || d.commentId.length === 0) {
84
+ return err(400, 'resolve.commentId is required');
85
+ }
86
+ const resolved = typeof d.resolved === 'boolean' ? d.resolved : true;
87
+ const annotation = mintAnnotation({
88
+ type: 'resolve',
89
+ workflowId: draft.workflowId,
90
+ commentId: d.commentId,
91
+ resolved,
92
+ });
93
+ appendAnnotation(projectRoot, config, annotation);
94
+ return ok({ annotation });
95
+ }
96
+ case 'address': {
97
+ const d = draft;
98
+ if (typeof d.commentId !== 'string' || d.commentId.length === 0) {
99
+ return err(400, 'address.commentId is required');
100
+ }
101
+ if (typeof d.version !== 'number')
102
+ return err(400, 'address.version is required');
103
+ if (d.disposition !== 'addressed' && d.disposition !== 'deferred' && d.disposition !== 'wontfix') {
104
+ return err(400, "address.disposition must be 'addressed' | 'deferred' | 'wontfix'");
105
+ }
106
+ const annotation = mintAnnotation({
107
+ type: 'address',
108
+ workflowId: draft.workflowId,
109
+ commentId: d.commentId,
110
+ version: d.version,
111
+ disposition: d.disposition,
112
+ ...(typeof d.reason === 'string' ? { reason: d.reason } : {}),
113
+ });
114
+ appendAnnotation(projectRoot, config, annotation);
115
+ return ok({ annotation });
116
+ }
117
+ default:
118
+ return err(400, `unknown annotation type: ${String(draft.type)}`);
119
+ }
120
+ }
121
+ export function handleListAnnotations(projectRoot, config, query) {
122
+ if (!query.workflowId)
123
+ return err(400, 'workflowId query param is required');
124
+ const version = query.version !== null && query.version !== undefined
125
+ ? parseInt(query.version, 10)
126
+ : undefined;
127
+ if (version !== undefined && Number.isNaN(version)) {
128
+ return err(400, 'version must be a number');
129
+ }
130
+ const annotations = readAnnotations(projectRoot, config, query.workflowId, version);
131
+ return ok({ annotations });
132
+ }
133
+ export function handleDecision(projectRoot, config, body) {
134
+ if (!body || typeof body !== 'object')
135
+ return err(400, 'expected JSON object body');
136
+ const d = body;
137
+ if (!d.workflowId)
138
+ return err(400, 'workflowId is required');
139
+ if (!d.to)
140
+ return err(400, 'to is required');
141
+ try {
142
+ const updated = transitionState(projectRoot, config, d.workflowId, d.to);
143
+ return ok({ workflow: updated });
144
+ }
145
+ catch (e) {
146
+ const message = e instanceof Error ? e.message : String(e);
147
+ const status = message.startsWith('Unknown workflow') ? 404 : 409;
148
+ return err(status, message);
149
+ }
150
+ }
151
+ /**
152
+ * Return a workflow plus its full version history. The client looks up
153
+ * by one of (in priority order):
154
+ * 1. Workflow id — exact match on `DraftWorkflowItem.id`.
155
+ * 2. `entryId` — stable calendar-entry UUID; join survives slug renames.
156
+ * Preferred over slug when available.
157
+ * 3. (site, slug) — legacy lookup, still supported for workflows that
158
+ * have no entryId stamped.
159
+ *
160
+ * All lookups can additionally filter by (contentKind, platform, channel).
161
+ */
162
+ export function handleGetWorkflow(projectRoot, config, query) {
163
+ if (query.id) {
164
+ const workflow = readWorkflow(projectRoot, config, query.id);
165
+ if (!workflow)
166
+ return err(404, `unknown workflow id: ${query.id}`);
167
+ return ok({
168
+ workflow,
169
+ versions: readVersions(projectRoot, config, workflow.id),
170
+ });
171
+ }
172
+ if (!query.entryId && (!query.site || !query.slug)) {
173
+ return err(400, 'either id, entryId, or (site & slug) query params are required');
174
+ }
175
+ if (query.site && !(query.site in config.sites)) {
176
+ const known = Object.keys(config.sites).join(', ');
177
+ return err(400, `unknown site: ${query.site}. Configured: ${known}`);
178
+ }
179
+ const contentKind = (query.contentKind ?? 'longform');
180
+ const candidates = readWorkflows(projectRoot, config).filter((w) => {
181
+ // Stable-identity join when entryId is present on both sides;
182
+ // fall back to (site, slug) for legacy workflows. Always still
183
+ // filter by contentKind + platform + channel to keep scope.
184
+ const identityMatch = query.entryId && w.entryId
185
+ ? w.entryId === query.entryId
186
+ : query.site && query.slug
187
+ ? w.site === query.site && w.slug === query.slug
188
+ : false;
189
+ return (identityMatch &&
190
+ w.contentKind === contentKind &&
191
+ (w.platform ?? null) === (query.platform ?? null) &&
192
+ (w.channel ?? null) === (query.channel ?? null));
193
+ });
194
+ if (candidates.length === 0) {
195
+ const key = query.entryId
196
+ ? `entryId=${query.entryId}`
197
+ : `${query.site ?? '?'}/${query.slug ?? '?'}`;
198
+ return err(404, `no workflow for ${key} (${contentKind})`);
199
+ }
200
+ // Prefer active over terminal; within each tier, prefer most-recently created.
201
+ const isTerminal = (s) => s === 'applied' || s === 'cancelled';
202
+ const match = [...candidates].sort((a, b) => {
203
+ const aTerm = isTerminal(a.state) ? 1 : 0;
204
+ const bTerm = isTerminal(b.state) ? 1 : 0;
205
+ if (aTerm !== bTerm)
206
+ return aTerm - bTerm;
207
+ return b.createdAt.localeCompare(a.createdAt);
208
+ })[0];
209
+ return ok({ workflow: match, versions: readVersions(projectRoot, config, match.id) });
210
+ }
211
+ /**
212
+ * Operator edit-mode submission. Writes disk first (SSOT invariant),
213
+ * then appends a DraftVersion + edit annotation with the server-computed
214
+ * diff.
215
+ */
216
+ export function handleCreateVersion(projectRoot, config, body) {
217
+ if (!body || typeof body !== 'object')
218
+ return err(400, 'expected JSON object body');
219
+ const d = body;
220
+ if (!d.workflowId)
221
+ return err(400, 'workflowId is required');
222
+ if (typeof d.beforeVersion !== 'number')
223
+ return err(400, 'beforeVersion is required');
224
+ if (typeof d.afterMarkdown !== 'string')
225
+ return err(400, 'afterMarkdown is required');
226
+ const workflow = readWorkflow(projectRoot, config, d.workflowId);
227
+ if (!workflow)
228
+ return err(404, `unknown workflow: ${d.workflowId}`);
229
+ const versions = readVersions(projectRoot, config, d.workflowId);
230
+ const before = versions.find((v) => v.version === d.beforeVersion);
231
+ if (!before)
232
+ return err(404, `unknown beforeVersion: ${d.beforeVersion}`);
233
+ if (before.markdown === d.afterMarkdown) {
234
+ return err(400, 'afterMarkdown is identical to beforeVersion — no edit to record');
235
+ }
236
+ const diff = lineDiff(before.markdown, d.afterMarkdown);
237
+ // SSOT: the markdown file on disk IS the article. Write disk first,
238
+ // then snapshot to the journal. All content kinds (longform, outline,
239
+ // shortform) are disk-backed — Phase 21a removed the shortform special
240
+ // case so the studio's save/iterate/approve handlers see one shape.
241
+ //
242
+ // Resolve via the content index first (so writingcontrol-shaped layouts
243
+ // where slug != fs path work), with template fallback for legacy
244
+ // / pre-doctor cases. For shortform, the path goes through
245
+ // resolveShortformFilePath (entry-dir + scrapbook/shortform/<…>.md).
246
+ const targetFile = workflowFilePath(projectRoot, config, workflow);
247
+ if (targetFile === undefined || !existsSync(targetFile)) {
248
+ const shown = targetFile ?? '(unresolved)';
249
+ if (workflow.contentKind === 'shortform') {
250
+ return err(500, `cannot save: shortform file missing at ${shown}. ` +
251
+ `Run /deskwork:shortform-start to scaffold the file before saving edits.`);
252
+ }
253
+ return err(500, `cannot save: blog file missing at ${shown}. ` +
254
+ `Scaffold the post with /deskwork:outline before saving edits.`);
255
+ }
256
+ writeFileSync(targetFile, d.afterMarkdown, 'utf-8');
257
+ const version = appendVersion(projectRoot, config, d.workflowId, d.afterMarkdown, 'operator');
258
+ const annotation = mintAnnotation({
259
+ type: 'edit',
260
+ workflowId: d.workflowId,
261
+ beforeVersion: d.beforeVersion,
262
+ afterMarkdown: d.afterMarkdown,
263
+ diff,
264
+ });
265
+ appendAnnotation(projectRoot, config, annotation);
266
+ return ok({ version, annotation });
267
+ }
268
+ /**
269
+ * Minimal line-level diff. `-` / `+` prefixed lines for removed/added
270
+ * content, `=` for unchanged. Paired with `applyLineDiff` the operation
271
+ * is reversible.
272
+ */
273
+ export function lineDiff(a, b) {
274
+ const aLines = a.split('\n');
275
+ const bLines = b.split('\n');
276
+ const out = [];
277
+ const n = Math.max(aLines.length, bLines.length);
278
+ for (let i = 0; i < n; i++) {
279
+ const aLine = aLines[i];
280
+ const bLine = bLines[i];
281
+ if (aLine === bLine) {
282
+ if (aLine !== undefined)
283
+ out.push(`= ${aLine}`);
284
+ }
285
+ else {
286
+ if (aLine !== undefined)
287
+ out.push(`- ${aLine}`);
288
+ if (bLine !== undefined)
289
+ out.push(`+ ${bLine}`);
290
+ }
291
+ }
292
+ return out.join('\n');
293
+ }
294
+ /** Apply a line-diff (as produced by `lineDiff`) to reconstruct the after-text. */
295
+ export function applyLineDiff(diff) {
296
+ const out = [];
297
+ for (const line of diff.split('\n')) {
298
+ if (line.startsWith('= '))
299
+ out.push(line.slice(2));
300
+ else if (line.startsWith('+ '))
301
+ out.push(line.slice(2));
302
+ else if (line === '=' || line === '+')
303
+ out.push('');
304
+ }
305
+ return out.join('\n');
306
+ }
307
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../src/review/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,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AAC;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9C,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aACnD,IAAI,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,GAAG;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Barrel export for the review pipeline. Skills, bin/ helpers, and the
3
+ * studio Astro routes all import from here.
4
+ */
5
+ export * from './types.ts';
6
+ export * from './pipeline.ts';
7
+ export * from './handlers.ts';
8
+ export * from './start-handlers.ts';
9
+ export * from './workflow-paths.ts';
10
+ export * from './report.ts';
11
+ export * from './render.ts';
12
+ export { envelopeFor, unwrap, synthesizeHistoryId } from './journal-mappers.ts';
13
+ export type { JournaledHistoryEntry } from './journal-mappers.ts';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/review/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChF,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Barrel export for the review pipeline. Skills, bin/ helpers, and the
3
+ * studio Astro routes all import from here.
4
+ */
5
+ export * from "./types.js";
6
+ export * from "./pipeline.js";
7
+ export * from "./handlers.js";
8
+ export * from "./start-handlers.js";
9
+ export * from "./workflow-paths.js";
10
+ export * from "./report.js";
11
+ export * from "./render.js";
12
+ export { envelopeFor, unwrap, synthesizeHistoryId } from "./journal-mappers.js";
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/review/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * journal-mappers.ts — adapt DraftHistoryEntry variants to the shared
3
+ * journal storage contract (one file per record, each with `id` +
4
+ * `timestamp`).
5
+ *
6
+ * The history event union doesn't carry a uniform id/timestamp shape
7
+ * (variants are discriminated by `kind`). To route each event into its
8
+ * own journal file we wrap it in an envelope keyed by a deterministic id
9
+ * synthesized from the event's payload. Readers unwrap the envelope
10
+ * before returning DraftHistoryEntry[] to the rest of the codebase.
11
+ */
12
+ import type { DraftHistoryEntry } from './types.ts';
13
+ /** Storage wrapper for history events. */
14
+ export interface JournaledHistoryEntry {
15
+ id: string;
16
+ timestamp: string;
17
+ entry: DraftHistoryEntry;
18
+ }
19
+ /**
20
+ * Synthesize a deterministic id for a history event. The same event maps
21
+ * to the same filename every time, so re-emitting an equivalent event
22
+ * overwrites in place rather than duplicating.
23
+ *
24
+ * Rules:
25
+ * - workflow-created: `created-<workflowId>` (one per workflow)
26
+ * - workflow-state: `state-<workflowId>-<normalized-timestamp>`
27
+ * - version: `version-<workflowId>-v<n>`
28
+ * - annotation: the annotation's own id
29
+ */
30
+ export declare function synthesizeHistoryId(entry: DraftHistoryEntry): string;
31
+ /** Wrap a history event in its journal envelope. */
32
+ export declare function envelopeFor(entry: DraftHistoryEntry): JournaledHistoryEntry;
33
+ /** Unwrap an envelope back to the original history event. */
34
+ export declare function unwrap(env: JournaledHistoryEntry): DraftHistoryEntry;
35
+ //# sourceMappingURL=journal-mappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal-mappers.d.ts","sourceRoot":"","sources":["../../src/review/journal-mappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD,0CAA0C;AAC1C,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAWpE;AAED,oDAAoD;AACpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,qBAAqB,CAM3E;AAED,6DAA6D;AAC7D,wBAAgB,MAAM,CAAC,GAAG,EAAE,qBAAqB,GAAG,iBAAiB,CAEpE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * journal-mappers.ts — adapt DraftHistoryEntry variants to the shared
3
+ * journal storage contract (one file per record, each with `id` +
4
+ * `timestamp`).
5
+ *
6
+ * The history event union doesn't carry a uniform id/timestamp shape
7
+ * (variants are discriminated by `kind`). To route each event into its
8
+ * own journal file we wrap it in an envelope keyed by a deterministic id
9
+ * synthesized from the event's payload. Readers unwrap the envelope
10
+ * before returning DraftHistoryEntry[] to the rest of the codebase.
11
+ */
12
+ import { normalizeTimestamp } from "../journal.js";
13
+ /**
14
+ * Synthesize a deterministic id for a history event. The same event maps
15
+ * to the same filename every time, so re-emitting an equivalent event
16
+ * overwrites in place rather than duplicating.
17
+ *
18
+ * Rules:
19
+ * - workflow-created: `created-<workflowId>` (one per workflow)
20
+ * - workflow-state: `state-<workflowId>-<normalized-timestamp>`
21
+ * - version: `version-<workflowId>-v<n>`
22
+ * - annotation: the annotation's own id
23
+ */
24
+ export function synthesizeHistoryId(entry) {
25
+ switch (entry.kind) {
26
+ case 'workflow-created':
27
+ return `created-${entry.workflow.id}`;
28
+ case 'workflow-state':
29
+ return `state-${entry.workflowId}-${normalizeTimestamp(entry.at)}`;
30
+ case 'version':
31
+ return `version-${entry.workflowId}-v${entry.version.version}`;
32
+ case 'annotation':
33
+ return entry.annotation.id;
34
+ }
35
+ }
36
+ /** Wrap a history event in its journal envelope. */
37
+ export function envelopeFor(entry) {
38
+ return {
39
+ id: synthesizeHistoryId(entry),
40
+ timestamp: entry.at,
41
+ entry,
42
+ };
43
+ }
44
+ /** Unwrap an envelope back to the original history event. */
45
+ export function unwrap(env) {
46
+ return env.entry;
47
+ }
48
+ //# sourceMappingURL=journal-mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal-mappers.js","sourceRoot":"","sources":["../../src/review/journal-mappers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAUnD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAwB;IAC1D,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,kBAAkB;YACrB,OAAO,WAAW,KAAK,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACxC,KAAK,gBAAgB;YACnB,OAAO,SAAS,KAAK,CAAC,UAAU,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QACrE,KAAK,SAAS;YACZ,OAAO,WAAW,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACjE,KAAK,YAAY;YACf,OAAO,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,WAAW,CAAC,KAAwB;IAClD,OAAO;QACL,EAAE,EAAE,mBAAmB,CAAC,KAAK,CAAC;QAC9B,SAAS,EAAE,KAAK,CAAC,EAAE;QACnB,KAAK;KACN,CAAC;AACJ,CAAC;AAED,6DAA6D;AAC7D,MAAM,UAAU,MAAM,CAAC,GAA0B;IAC/C,OAAO,GAAG,CAAC,KAAK,CAAC;AACnB,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Editorial review pipeline — workflow + version API.
3
+ *
4
+ * Ported from audiocontrol.org's scripts/lib/editorial-review/pipeline.ts.
5
+ * Storage: two journal directories under `<journalDir>/` — a `pipeline/`
6
+ * dir holding one file per workflow (latest state) and a `history/` dir
7
+ * holding one file per event (versions, annotations, state transitions).
8
+ *
9
+ * The default `journalDir` is `.deskwork/review-journal`. Host projects
10
+ * migrating from a prior layout can override via the top-level
11
+ * `reviewJournalDir` config field (e.g. audiocontrol points it at
12
+ * `journal/editorial` to read existing data).
13
+ */
14
+ import type { Platform } from '../types.ts';
15
+ import type { DeskworkConfig } from '../config.ts';
16
+ import { type ContentKind, type DraftAnnotation, type DraftHistoryEntry, type DraftVersion, type DraftWorkflowItem, type DraftWorkflowState, type OriginatedBy } from './types.ts';
17
+ /** Absolute path to the review journal root for a project. */
18
+ export declare function reviewJournalRoot(projectRoot: string, config: DeskworkConfig): string;
19
+ /** Path to the pipeline journal (one file per workflow). */
20
+ export declare function pipelinePath(projectRoot: string, config: DeskworkConfig): string;
21
+ /** Path to the history journal (one file per event). */
22
+ export declare function historyPath(projectRoot: string, config: DeskworkConfig): string;
23
+ /**
24
+ * Read every workflow (one record per id by construction — state transitions
25
+ * overwrite the existing file in place).
26
+ */
27
+ export declare function readWorkflows(projectRoot: string, config: DeskworkConfig): DraftWorkflowItem[];
28
+ /** Read the full history log, oldest first. */
29
+ export declare function readHistory(projectRoot: string, config: DeskworkConfig): DraftHistoryEntry[];
30
+ export declare function readWorkflow(projectRoot: string, config: DeskworkConfig, id: string): DraftWorkflowItem | null;
31
+ export interface CreateWorkflowParams {
32
+ /**
33
+ * Stable UUID of the target calendar entry. Preferred over `slug` as
34
+ * the natural key so renames don't split a single entry's workflow
35
+ * history across two keys. Optional for callers that haven't migrated
36
+ * yet; when present, it replaces the (site, slug) match in idempotent
37
+ * lookup.
38
+ */
39
+ entryId?: string;
40
+ site: string;
41
+ slug: string;
42
+ contentKind: ContentKind;
43
+ platform?: Platform;
44
+ channel?: string;
45
+ initialMarkdown: string;
46
+ initialOriginatedBy?: OriginatedBy;
47
+ }
48
+ /**
49
+ * Create a new workflow plus its v1. Idempotent on the natural key
50
+ * (site, slug, contentKind, platform?, channel?) — if a non-terminal
51
+ * workflow already exists for that tuple, returns it unchanged.
52
+ */
53
+ export declare function createWorkflow(projectRoot: string, config: DeskworkConfig, params: CreateWorkflowParams): DraftWorkflowItem;
54
+ /** List workflows in non-terminal states; optionally scoped to a site. */
55
+ export declare function listOpen(projectRoot: string, config: DeskworkConfig, site?: string): DraftWorkflowItem[];
56
+ /**
57
+ * Transition a workflow to a new state. Validates against VALID_TRANSITIONS
58
+ * and appends a history event. The workflow's file is overwritten in place.
59
+ */
60
+ export declare function transitionState(projectRoot: string, config: DeskworkConfig, workflowId: string, to: DraftWorkflowState): DraftWorkflowItem;
61
+ /**
62
+ * Append a new version. Increments currentVersion on the workflow.
63
+ * Does not transition state — callers combine with transitionState().
64
+ */
65
+ export declare function appendVersion(projectRoot: string, config: DeskworkConfig, workflowId: string, markdown: string, originatedBy: OriginatedBy): DraftVersion;
66
+ /** Append an annotation to history. Does not transition state. */
67
+ export declare function appendAnnotation(projectRoot: string, config: DeskworkConfig, annotation: DraftAnnotation): void;
68
+ export declare function readVersions(projectRoot: string, config: DeskworkConfig, workflowId: string): DraftVersion[];
69
+ /**
70
+ * Annotations for a workflow, optionally filtered to a specific version.
71
+ * comment/approve/reject match by `version`; edit matches by `beforeVersion`.
72
+ */
73
+ export declare function readAnnotations(projectRoot: string, config: DeskworkConfig, workflowId: string, version?: number): DraftAnnotation[];
74
+ /** Mint an annotation with a server-assigned id and timestamp. */
75
+ export declare function mintAnnotation<T extends Omit<DraftAnnotation, 'id' | 'createdAt'>>(partial: T): T & {
76
+ id: string;
77
+ createdAt: string;
78
+ };
79
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/review/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAMnD,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EAClB,MAAM,YAAY,CAAC;AAMpB,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,MAAM,CAER;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAEhF;AAED,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAE/E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,iBAAiB,EAAE,CAIrB;AAED,+CAA+C;AAC/C,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,iBAAiB,EAAE,CAKr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