@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,197 @@
1
+ /**
2
+ * Editorial calendar types and stage definitions.
3
+ *
4
+ * Ported from audiocontrol.org's editorial lib, with site-specific constants
5
+ * removed — sites are configured per host project in `.deskwork/config.json`
6
+ * (see `config.ts`) rather than hardcoded here.
7
+ */
8
+ /**
9
+ * Ordered editorial stages — content moves forward through these.
10
+ *
11
+ * Outlining sits between Planned and Drafting: the blog file is
12
+ * scaffolded at outline time with an empty `## Outline` section,
13
+ * and the operator approves the shape before the body is drafted.
14
+ * Real editorial teams outline first; skipping this step wastes
15
+ * iteration cycles on structural problems a 30-second outline
16
+ * review would have caught.
17
+ *
18
+ * `Paused` is a non-linear holding stage. An entry pauses out of any
19
+ * non-terminal stage (Ideas / Planned / Outlining / Drafting / Review)
20
+ * and resumes back to wherever it came from. The pause origin lives on
21
+ * the entry itself (`pausedFrom`) so resume restores the right place
22
+ * without the operator having to remember. `Paused` is always rendered
23
+ * AFTER `Review` and BEFORE `Published` in fixed lifecycle views — it
24
+ * sits visually adjacent to the terminal state without itself being
25
+ * terminal. Added in v0.6.0 (issue #27).
26
+ */
27
+ export declare const STAGES: readonly ["Ideas", "Planned", "Outlining", "Drafting", "Review", "Paused", "Published"];
28
+ export type Stage = (typeof STAGES)[number];
29
+ /**
30
+ * Stages an entry can pause out of (and resume back to). Excludes
31
+ * `Paused` itself (can't double-pause) and `Published` (terminal —
32
+ * a published entry is already shipped, pausing would be lying).
33
+ */
34
+ export declare const PAUSABLE_STAGES: readonly ["Ideas", "Planned", "Outlining", "Drafting", "Review"];
35
+ export type PausableStage = (typeof PAUSABLE_STAGES)[number];
36
+ /** True if a stage can be paused out of. */
37
+ export declare function isPausable(stage: Stage): stage is PausableStage;
38
+ /** True if a value is a recognized stage name. */
39
+ export declare function isStage(value: string): value is Stage;
40
+ /**
41
+ * What kind of content a calendar entry represents.
42
+ *
43
+ * - `blog` — lives in the host repo under the site's `contentDir`
44
+ * - `youtube` — video hosted on YouTube; `contentUrl` is the video URL
45
+ * - `tool` — standalone page or app on the site; `contentUrl` is the canonical URL
46
+ */
47
+ export declare const CONTENT_TYPES: readonly ["blog", "youtube", "tool"];
48
+ export type ContentType = (typeof CONTENT_TYPES)[number];
49
+ /** True if a value is a recognized content type. */
50
+ export declare function isContentType(value: string): value is ContentType;
51
+ /** A single entry in the editorial calendar. */
52
+ export interface CalendarEntry {
53
+ /**
54
+ * Stable internal identifier (UUID v4) — the canonical join key for
55
+ * everything inside deskwork (workflows, distribution records,
56
+ * journal entries, the content index). Persists across slug renames
57
+ * so SEO-driven slug changes don't rewrite history.
58
+ *
59
+ * Optional on this interface so pre-id test fixtures compile. At
60
+ * runtime every parseCalendar / addEntry path sets id to a UUID.
61
+ * Treat missing on disk as "legacy, not yet migrated" — the parser
62
+ * assigns a fresh UUID in-memory and the next `writeCalendar`
63
+ * persists it. One save fully populates a legacy calendar.
64
+ */
65
+ id?: string;
66
+ /**
67
+ * The host rendering engine's identifier — typically used to derive
68
+ * the public URL (e.g. `/blog/<slug>` in Astro). Owned by the host
69
+ * project, not by deskwork. Deskwork stores it for display and for
70
+ * the legacy slug-fallback path; deskwork's filesystem placement
71
+ * decisions go through `id` + the content index, NOT through slug.
72
+ *
73
+ * Format remains URL-safe — kebab-case segments, optionally
74
+ * separated by forward slashes for hierarchical content collections.
75
+ * Examples:
76
+ *
77
+ * "scsi-over-wifi-raspberry-pi-bridge" (flat)
78
+ * "the-outbound" (hierarchical root)
79
+ * "the-outbound/characters/strivers" (nested chapter)
80
+ *
81
+ * Each segment must match `[a-z0-9][a-z0-9-]*`.
82
+ */
83
+ slug: string;
84
+ /** Human-readable title */
85
+ title: string;
86
+ /** One-line description for SEO / calendar overview */
87
+ description: string;
88
+ /** Current editorial stage */
89
+ stage: Stage;
90
+ /**
91
+ * Optional in storage — entries without an explicit type default to `'blog'`
92
+ * when accessed via `effectiveContentType`, keeping legacy calendars valid.
93
+ */
94
+ contentType?: ContentType;
95
+ /**
96
+ * Canonical URL for content that doesn't live at the site's default blog path.
97
+ * Required for `youtube` and `tool` entries once published.
98
+ */
99
+ contentUrl?: string;
100
+ /** Target SEO keywords (set when moving to Planned) */
101
+ targetKeywords: string[];
102
+ /**
103
+ * Coarse topic tags used for cross-posting opportunity lookup.
104
+ * Distinct from targetKeywords — these map to channels in the channels file.
105
+ */
106
+ topics?: string[];
107
+ /** ISO date string (YYYY-MM-DD) when published, if applicable */
108
+ datePublished?: string;
109
+ /** GitHub issue number, if one has been created */
110
+ issueNumber?: number;
111
+ /** How this entry was sourced */
112
+ source: 'manual' | 'analytics';
113
+ /**
114
+ * When `stage === 'Paused'`, the stage the entry was in immediately
115
+ * before pausing — `unpauseEntry` reads this to restore the entry
116
+ * to its prior lifecycle position. Never set for non-Paused entries
117
+ * (writeCalendar emits an empty cell for them so the column doesn't
118
+ * shout at non-paused rows).
119
+ */
120
+ pausedFrom?: PausableStage;
121
+ }
122
+ /**
123
+ * Return the effective content type for an entry — `'blog'` when unset.
124
+ * Use this everywhere that needs to branch on type so legacy entries
125
+ * (no contentType) keep behaving like blog posts.
126
+ */
127
+ export declare function effectiveContentType(entry: CalendarEntry): ContentType;
128
+ /**
129
+ * True if this content type has a source file in the repo that
130
+ * `draft` should scaffold. Only blog posts live in the repo.
131
+ */
132
+ export declare function hasRepoContent(contentType: ContentType): boolean;
133
+ /**
134
+ * True if this content type requires `contentUrl` to be set before publishing.
135
+ * Blog entries derive their URL from the slug; everything else needs explicit URL.
136
+ */
137
+ export declare function requiresContentUrl(contentType: ContentType): boolean;
138
+ /** Social platforms we track distribution to. */
139
+ export declare const PLATFORMS: readonly ["reddit", "youtube", "linkedin", "instagram"];
140
+ export type Platform = (typeof PLATFORMS)[number];
141
+ /** True if a value is a recognized platform. */
142
+ export declare function isPlatform(value: string): value is Platform;
143
+ /** A single social share of a published post. */
144
+ export interface DistributionRecord {
145
+ /**
146
+ * Stable id of the CalendarEntry this share refers to — the real
147
+ * join key. Slug is kept as a human-readable cross-reference and for
148
+ * legacy compatibility, but lookups should prefer entryId.
149
+ *
150
+ * Optional on this interface to keep test fixtures and pre-id call
151
+ * sites compiling. At runtime: the parser and `addDistribution`
152
+ * always set entryId (to the matching entry's id, or empty string
153
+ * if no match found). Treat missing/empty as "legacy, not yet
154
+ * migrated" — all code paths that resolve records do so by slug
155
+ * as a fallback.
156
+ */
157
+ entryId?: string;
158
+ /** Slug of the published CalendarEntry this share refers to */
159
+ slug: string;
160
+ /** Which platform the post was shared on */
161
+ platform: Platform;
162
+ /**
163
+ * Sub-channel within the platform — e.g. subreddit (`r/synthdiy`),
164
+ * YouTube channel handle, LinkedIn page. Normalized on comparison.
165
+ */
166
+ channel?: string;
167
+ /** URL of the share (e.g. the Reddit thread, YouTube video) */
168
+ url: string;
169
+ /** ISO date string (YYYY-MM-DD) when the share was made */
170
+ dateShared: string;
171
+ /** Optional free-form context */
172
+ notes?: string;
173
+ /**
174
+ * Approved short-form copy for this (slug, platform, channel) tuple,
175
+ * produced by the editorial-review shortform pipeline. For Reddit,
176
+ * conventionally stores `title: ...\n\n<body>`; for others, a single blob.
177
+ */
178
+ shortform?: string;
179
+ }
180
+ /** The full editorial calendar — entries grouped by stage, plus social distributions. */
181
+ export interface EditorialCalendar {
182
+ entries: CalendarEntry[];
183
+ distributions: DistributionRecord[];
184
+ }
185
+ /** Return entries for a given stage. */
186
+ export declare function entriesByStage(calendar: EditorialCalendar, stage: Stage): CalendarEntry[];
187
+ /** Return distribution records for a given slug. */
188
+ export declare function distributionsBySlug(calendar: EditorialCalendar, slug: string): DistributionRecord[];
189
+ /**
190
+ * Return distribution records for a given calendar entry id. This is the
191
+ * stable-identity join — prefer this over `distributionsBySlug` anywhere
192
+ * you have the entry already and just want its distributions.
193
+ */
194
+ export declare function distributionsByEntryId(calendar: EditorialCalendar, entryId: string): DistributionRecord[];
195
+ /** Find a calendar entry by its stable UUID. */
196
+ export declare function entryById(calendar: EditorialCalendar, id: string): CalendarEntry | undefined;
197
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,yFAQT,CAAC;AAEX,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5C;;;;GAIG;AACH,eAAO,MAAM,eAAe,kEAMS,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,4CAA4C;AAC5C,wBAAgB,UAAU,CAAC,KAA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,CACvB,QAAQ,EAAE,iBAAiB,EAC3B,EAAE,EAAE,MAAM,GACT,aAAa,GAAG,SAAS,CAG3B"}
package/dist/types.js ADDED
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Editorial calendar types and stage definitions.
3
+ *
4
+ * Ported from audiocontrol.org's editorial lib, with site-specific constants
5
+ * removed — sites are configured per host project in `.deskwork/config.json`
6
+ * (see `config.ts`) rather than hardcoded here.
7
+ */
8
+ /**
9
+ * Ordered editorial stages — content moves forward through these.
10
+ *
11
+ * Outlining sits between Planned and Drafting: the blog file is
12
+ * scaffolded at outline time with an empty `## Outline` section,
13
+ * and the operator approves the shape before the body is drafted.
14
+ * Real editorial teams outline first; skipping this step wastes
15
+ * iteration cycles on structural problems a 30-second outline
16
+ * review would have caught.
17
+ *
18
+ * `Paused` is a non-linear holding stage. An entry pauses out of any
19
+ * non-terminal stage (Ideas / Planned / Outlining / Drafting / Review)
20
+ * and resumes back to wherever it came from. The pause origin lives on
21
+ * the entry itself (`pausedFrom`) so resume restores the right place
22
+ * without the operator having to remember. `Paused` is always rendered
23
+ * AFTER `Review` and BEFORE `Published` in fixed lifecycle views — it
24
+ * sits visually adjacent to the terminal state without itself being
25
+ * terminal. Added in v0.6.0 (issue #27).
26
+ */
27
+ export const STAGES = [
28
+ 'Ideas',
29
+ 'Planned',
30
+ 'Outlining',
31
+ 'Drafting',
32
+ 'Review',
33
+ 'Paused',
34
+ 'Published',
35
+ ];
36
+ /**
37
+ * Stages an entry can pause out of (and resume back to). Excludes
38
+ * `Paused` itself (can't double-pause) and `Published` (terminal —
39
+ * a published entry is already shipped, pausing would be lying).
40
+ */
41
+ export const PAUSABLE_STAGES = [
42
+ 'Ideas',
43
+ 'Planned',
44
+ 'Outlining',
45
+ 'Drafting',
46
+ 'Review',
47
+ ];
48
+ /** True if a stage can be paused out of. */
49
+ export function isPausable(stage) {
50
+ return PAUSABLE_STAGES.includes(stage);
51
+ }
52
+ /** True if a value is a recognized stage name. */
53
+ export function isStage(value) {
54
+ return STAGES.includes(value);
55
+ }
56
+ /**
57
+ * What kind of content a calendar entry represents.
58
+ *
59
+ * - `blog` — lives in the host repo under the site's `contentDir`
60
+ * - `youtube` — video hosted on YouTube; `contentUrl` is the video URL
61
+ * - `tool` — standalone page or app on the site; `contentUrl` is the canonical URL
62
+ */
63
+ export const CONTENT_TYPES = ['blog', 'youtube', 'tool'];
64
+ /** True if a value is a recognized content type. */
65
+ export function isContentType(value) {
66
+ return CONTENT_TYPES.includes(value);
67
+ }
68
+ /**
69
+ * Return the effective content type for an entry — `'blog'` when unset.
70
+ * Use this everywhere that needs to branch on type so legacy entries
71
+ * (no contentType) keep behaving like blog posts.
72
+ */
73
+ export function effectiveContentType(entry) {
74
+ return entry.contentType ?? 'blog';
75
+ }
76
+ /**
77
+ * True if this content type has a source file in the repo that
78
+ * `draft` should scaffold. Only blog posts live in the repo.
79
+ */
80
+ export function hasRepoContent(contentType) {
81
+ return contentType === 'blog';
82
+ }
83
+ /**
84
+ * True if this content type requires `contentUrl` to be set before publishing.
85
+ * Blog entries derive their URL from the slug; everything else needs explicit URL.
86
+ */
87
+ export function requiresContentUrl(contentType) {
88
+ return contentType !== 'blog';
89
+ }
90
+ /** Social platforms we track distribution to. */
91
+ export const PLATFORMS = ['reddit', 'youtube', 'linkedin', 'instagram'];
92
+ /** True if a value is a recognized platform. */
93
+ export function isPlatform(value) {
94
+ return PLATFORMS.includes(value);
95
+ }
96
+ /** Return entries for a given stage. */
97
+ export function entriesByStage(calendar, stage) {
98
+ return calendar.entries.filter((e) => e.stage === stage);
99
+ }
100
+ /** Return distribution records for a given slug. */
101
+ export function distributionsBySlug(calendar, slug) {
102
+ return calendar.distributions.filter((d) => d.slug === slug);
103
+ }
104
+ /**
105
+ * Return distribution records for a given calendar entry id. This is the
106
+ * stable-identity join — prefer this over `distributionsBySlug` anywhere
107
+ * you have the entry already and just want its distributions.
108
+ */
109
+ export function distributionsByEntryId(calendar, entryId) {
110
+ if (!entryId)
111
+ return [];
112
+ return calendar.distributions.filter((d) => d.entryId === entryId);
113
+ }
114
+ /** Find a calendar entry by its stable UUID. */
115
+ export function entryById(calendar, id) {
116
+ if (!id)
117
+ return undefined;
118
+ return calendar.entries.find((e) => e.id === id);
119
+ }
120
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,OAAO;IACP,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,WAAW;CACH,CAAC;AAIX;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,OAAO;IACP,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;CAC2B,CAAC;AAItC,4CAA4C;AAC5C,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,OAAQ,eAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,OAAQ,MAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAU,CAAC;AAIlE,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAQ,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AA0ED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAoB;IACvD,OAAO,KAAK,CAAC,WAAW,IAAI,MAAM,CAAC;AACrC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,WAAwB;IACrD,OAAO,WAAW,KAAK,MAAM,CAAC;AAChC,C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CAAC"}
package/package.json ADDED
@@ -0,0 +1,160 @@
1
+ {
2
+ "name": "@deskwork/core",
3
+ "version": "0.9.5",
4
+ "type": "module",
5
+ "description": "Editorial calendar + review pipeline library — shared by @deskwork/cli and @deskwork/studio",
6
+ "homepage": "https://github.com/audiocontrol-org/deskwork#readme",
7
+ "license": "GPL-3.0-or-later",
8
+ "author": "audiocontrol-org",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/audiocontrol-org/deskwork.git",
12
+ "directory": "packages/core"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "engines": {
18
+ "node": ">=20"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "package.json",
23
+ "README.md"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./package.json": "./package.json",
31
+ "./body-state": {
32
+ "types": "./dist/body-state.d.ts",
33
+ "default": "./dist/body-state.js"
34
+ },
35
+ "./calendar": {
36
+ "types": "./dist/calendar.d.ts",
37
+ "default": "./dist/calendar.js"
38
+ },
39
+ "./calendar-mutations": {
40
+ "types": "./dist/calendar-mutations.d.ts",
41
+ "default": "./dist/calendar-mutations.js"
42
+ },
43
+ "./cli-args": {
44
+ "types": "./dist/cli.d.ts",
45
+ "default": "./dist/cli.js"
46
+ },
47
+ "./config": {
48
+ "types": "./dist/config.d.ts",
49
+ "default": "./dist/config.js"
50
+ },
51
+ "./content-index": {
52
+ "types": "./dist/content-index.d.ts",
53
+ "default": "./dist/content-index.js"
54
+ },
55
+ "./content-tree": {
56
+ "types": "./dist/content-tree.d.ts",
57
+ "default": "./dist/content-tree.js"
58
+ },
59
+ "./doctor": {
60
+ "types": "./dist/doctor/index.d.ts",
61
+ "default": "./dist/doctor/index.js"
62
+ },
63
+ "./frontmatter": {
64
+ "types": "./dist/frontmatter.d.ts",
65
+ "default": "./dist/frontmatter.js"
66
+ },
67
+ "./ingest": {
68
+ "types": "./dist/ingest.d.ts",
69
+ "default": "./dist/ingest.js"
70
+ },
71
+ "./ingest-derive": {
72
+ "types": "./dist/ingest-derive.d.ts",
73
+ "default": "./dist/ingest-derive.js"
74
+ },
75
+ "./ingest-paths": {
76
+ "types": "./dist/ingest-paths.d.ts",
77
+ "default": "./dist/ingest-paths.js"
78
+ },
79
+ "./journal": {
80
+ "types": "./dist/journal.d.ts",
81
+ "default": "./dist/journal.js"
82
+ },
83
+ "./outline-split": {
84
+ "types": "./dist/outline-split.d.ts",
85
+ "default": "./dist/outline-split.js"
86
+ },
87
+ "./overrides": {
88
+ "types": "./dist/overrides.d.ts",
89
+ "default": "./dist/overrides.js"
90
+ },
91
+ "./paths": {
92
+ "types": "./dist/paths.d.ts",
93
+ "default": "./dist/paths.js"
94
+ },
95
+ "./rename-slug": {
96
+ "types": "./dist/rename-slug.d.ts",
97
+ "default": "./dist/rename-slug.js"
98
+ },
99
+ "./review": {
100
+ "types": "./dist/review/index.d.ts",
101
+ "default": "./dist/review/index.js"
102
+ },
103
+ "./review/handlers": {
104
+ "types": "./dist/review/handlers.d.ts",
105
+ "default": "./dist/review/handlers.js"
106
+ },
107
+ "./review/pipeline": {
108
+ "types": "./dist/review/pipeline.d.ts",
109
+ "default": "./dist/review/pipeline.js"
110
+ },
111
+ "./review/render": {
112
+ "types": "./dist/review/render.d.ts",
113
+ "default": "./dist/review/render.js"
114
+ },
115
+ "./review/report": {
116
+ "types": "./dist/review/report.d.ts",
117
+ "default": "./dist/review/report.js"
118
+ },
119
+ "./review/start-handlers": {
120
+ "types": "./dist/review/start-handlers.d.ts",
121
+ "default": "./dist/review/start-handlers.js"
122
+ },
123
+ "./review/types": {
124
+ "types": "./dist/review/types.d.ts",
125
+ "default": "./dist/review/types.js"
126
+ },
127
+ "./scaffold": {
128
+ "types": "./dist/scaffold.d.ts",
129
+ "default": "./dist/scaffold.js"
130
+ },
131
+ "./scrapbook": {
132
+ "types": "./dist/scrapbook.d.ts",
133
+ "default": "./dist/scrapbook.js"
134
+ },
135
+ "./types": {
136
+ "types": "./dist/types.d.ts",
137
+ "default": "./dist/types.js"
138
+ }
139
+ },
140
+ "scripts": {
141
+ "build": "tsc -b tsconfig.build.json && cp src/*.mjs dist/",
142
+ "prepack": "tsc -b tsconfig.build.json && cp src/*.mjs dist/",
143
+ "test": "vitest run",
144
+ "test:watch": "vitest",
145
+ "typecheck": "tsc --noEmit"
146
+ },
147
+ "dependencies": {
148
+ "rehype-stringify": "^10.0.0",
149
+ "remark-parse": "^11.0.0",
150
+ "remark-rehype": "^11.1.0",
151
+ "unified": "^11.0.5",
152
+ "yaml": "^2.8.0"
153
+ },
154
+ "devDependencies": {
155
+ "@types/node": "^22.10.0",
156
+ "tsx": "^4.21.0",
157
+ "typescript": "^5.7.0",
158
+ "vitest": "^4.1.2"
159
+ }
160
+ }