@deskwork/cli 0.12.0 → 0.13.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.
- package/dist/commands/approve.d.ts +8 -7
- package/dist/commands/approve.d.ts.map +1 -1
- package/dist/commands/approve.js +152 -121
- package/dist/commands/approve.js.map +1 -1
- package/dist/commands/publish.d.ts +16 -7
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +79 -25
- package/dist/commands/publish.js.map +1 -1
- package/package.json +5 -4
- package/dist/commands/draft.d.ts +0 -17
- package/dist/commands/draft.d.ts.map +0 -1
- package/dist/commands/draft.js +0 -77
- package/dist/commands/draft.js.map +0 -1
- package/dist/commands/outline.d.ts +0 -19
- package/dist/commands/outline.d.ts.map +0 -1
- package/dist/commands/outline.js +0 -102
- package/dist/commands/outline.js.map +0 -1
- package/dist/commands/pause.d.ts +0 -15
- package/dist/commands/pause.d.ts.map +0 -1
- package/dist/commands/pause.js +0 -70
- package/dist/commands/pause.js.map +0 -1
- package/dist/commands/plan.d.ts +0 -12
- package/dist/commands/plan.d.ts.map +0 -1
- package/dist/commands/plan.js +0 -74
- package/dist/commands/plan.js.map +0 -1
- package/dist/commands/resume.d.ts +0 -16
- package/dist/commands/resume.d.ts.map +0 -1
- package/dist/commands/resume.js +0 -70
- package/dist/commands/resume.js.map +0 -1
- package/dist/commands/review-cancel.d.ts +0 -15
- package/dist/commands/review-cancel.d.ts.map +0 -1
- package/dist/commands/review-cancel.js +0 -88
- package/dist/commands/review-cancel.js.map +0 -1
- package/dist/commands/review-help.d.ts +0 -12
- package/dist/commands/review-help.d.ts.map +0 -1
- package/dist/commands/review-help.js +0 -52
- package/dist/commands/review-help.js.map +0 -1
- package/dist/commands/review-report.d.ts +0 -13
- package/dist/commands/review-report.d.ts.map +0 -1
- package/dist/commands/review-report.js +0 -53
- package/dist/commands/review-report.js.map +0 -1
- package/dist/commands/review-start.d.ts +0 -17
- package/dist/commands/review-start.d.ts.map +0 -1
- package/dist/commands/review-start.js +0 -121
- package/dist/commands/review-start.js.map +0 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* deskwork-approve — terminal write step for the review loop.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Phase 29 / pipeline redesign: longform approve goes through the
|
|
5
|
+
* entry-centric helper (`approveEntryStage`) which advances the per-entry
|
|
6
|
+
* sidecar's `currentStage` to its successor and emits a stage-transition
|
|
7
|
+
* journal event. The workflow-object model remains in place for shortform
|
|
8
|
+
* — that path is preserved as `runShortformApprove` intact, including the
|
|
9
|
+
* disk SSOT semantics for the rendered file.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* Dispatcher: `--platform` set → legacy shortform path; otherwise →
|
|
12
|
+
* entry-centric path.
|
|
12
13
|
*
|
|
13
14
|
* Usage:
|
|
14
15
|
* deskwork-approve <project-root> [--site <slug>] <slug>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approve.d.ts","sourceRoot":"","sources":["../../src/commands/approve.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"approve.d.ts","sourceRoot":"","sources":["../../src/commands/approve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA+BH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvD"}
|
package/dist/commands/approve.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* deskwork-approve — terminal write step for the review loop.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Phase 29 / pipeline redesign: longform approve goes through the
|
|
5
|
+
* entry-centric helper (`approveEntryStage`) which advances the per-entry
|
|
6
|
+
* sidecar's `currentStage` to its successor and emits a stage-transition
|
|
7
|
+
* journal event. The workflow-object model remains in place for shortform
|
|
8
|
+
* — that path is preserved as `runShortformApprove` intact, including the
|
|
9
|
+
* disk SSOT semantics for the rendered file.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
11
|
+
* Dispatcher: `--platform` set → legacy shortform path; otherwise →
|
|
12
|
+
* entry-centric path.
|
|
12
13
|
*
|
|
13
14
|
* Usage:
|
|
14
15
|
* deskwork-approve <project-root> [--site <slug>] <slug>
|
|
@@ -16,29 +17,98 @@
|
|
|
16
17
|
*/
|
|
17
18
|
import { existsSync, readFileSync } from 'node:fs';
|
|
18
19
|
import { readConfig } from '@deskwork/core/config';
|
|
19
|
-
import { resolveSite, resolveCalendarPath,
|
|
20
|
+
import { resolveSite, resolveCalendarPath, resolveShortformFilePath, } from '@deskwork/core/paths';
|
|
20
21
|
import { readCalendar, writeCalendar } from '@deskwork/core/calendar';
|
|
21
22
|
import { parseFrontmatter } from '@deskwork/core/frontmatter';
|
|
22
|
-
import { handleGetWorkflow
|
|
23
|
+
import { handleGetWorkflow } from '@deskwork/core/review/handlers';
|
|
23
24
|
import { readAnnotations, transitionState, } from '@deskwork/core/review/pipeline';
|
|
24
25
|
import { isPlatform } from '@deskwork/core/types';
|
|
25
26
|
import { absolutize, emit, fail, parseArgs } from '@deskwork/core/cli-args';
|
|
27
|
+
import { approveEntryStage } from '@deskwork/core/entry/approve';
|
|
28
|
+
import { resolveEntryUuid } from '@deskwork/core/sidecar';
|
|
29
|
+
const KNOWN_FLAGS = ['site', 'platform', 'channel'];
|
|
30
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9-]*(\/[a-z0-9][a-z0-9-]*)*$/;
|
|
26
31
|
export async function run(argv) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
let parsed;
|
|
33
|
+
try {
|
|
34
|
+
parsed = parseArgs(argv, KNOWN_FLAGS);
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
fail(err instanceof Error ? err.message : String(err), 2);
|
|
38
|
+
}
|
|
39
|
+
const { positional, flags } = parsed;
|
|
30
40
|
if (positional.length < 2) {
|
|
31
41
|
fail('Usage: deskwork-approve <project-root> [--site <slug>] <slug> ' +
|
|
32
42
|
'[--platform <p>] [--channel <c>]', 2);
|
|
33
43
|
}
|
|
34
|
-
const [
|
|
35
|
-
const projectRoot = absolutize(rootArg);
|
|
44
|
+
const [, slug] = positional;
|
|
36
45
|
if (!SLUG_RE.test(slug)) {
|
|
37
46
|
fail(`invalid slug: ${slug} (must match ${SLUG_RE})`);
|
|
38
47
|
}
|
|
39
|
-
if (flags.platform !== undefined
|
|
40
|
-
|
|
48
|
+
if (flags.platform !== undefined) {
|
|
49
|
+
if (!isPlatform(flags.platform)) {
|
|
50
|
+
fail(`Invalid --platform "${flags.platform}".`);
|
|
51
|
+
}
|
|
52
|
+
await runShortformApprove(positional, flags);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (flags.channel !== undefined) {
|
|
56
|
+
fail('--channel is only valid with --platform.');
|
|
41
57
|
}
|
|
58
|
+
await runLongformApprove(positional, flags);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Entry-centric approve (longform / outline). Resolves the slug to a
|
|
62
|
+
* sidecar UUID and delegates to `approveEntryStage`, which advances
|
|
63
|
+
* `currentStage` to its successor and writes a stage-transition journal
|
|
64
|
+
* event. Refuses Final → Published (use `publish`), Published, Blocked,
|
|
65
|
+
* and Cancelled.
|
|
66
|
+
*/
|
|
67
|
+
async function runLongformApprove(positional, flags) {
|
|
68
|
+
const [rootArg, slug] = positional;
|
|
69
|
+
const projectRoot = absolutize(rootArg);
|
|
70
|
+
let config;
|
|
71
|
+
try {
|
|
72
|
+
config = readConfig(projectRoot);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
fail(err instanceof Error ? err.message : String(err));
|
|
76
|
+
}
|
|
77
|
+
// Validate --site (entries are project-global today, but failing on a
|
|
78
|
+
// bogus site keeps the CLI's error shape consistent with the legacy
|
|
79
|
+
// command).
|
|
80
|
+
const site = resolveSite(config, flags.site);
|
|
81
|
+
let uuid;
|
|
82
|
+
try {
|
|
83
|
+
uuid = await resolveEntryUuid(projectRoot, slug);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
fail(err instanceof Error ? err.message : String(err));
|
|
87
|
+
}
|
|
88
|
+
let result;
|
|
89
|
+
try {
|
|
90
|
+
result = await approveEntryStage(projectRoot, { uuid });
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
fail(err instanceof Error ? err.message : String(err));
|
|
94
|
+
}
|
|
95
|
+
emit({
|
|
96
|
+
entryId: result.entryId,
|
|
97
|
+
site,
|
|
98
|
+
slug,
|
|
99
|
+
fromStage: result.fromStage,
|
|
100
|
+
toStage: result.toStage,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Legacy shortform approve (workflow-object model). Preserved intact
|
|
105
|
+
* across the Phase 29 pipeline redesign — shortform's workflow-object
|
|
106
|
+
* model migration is deferred. Reproduces the original `applyShortform`
|
|
107
|
+
* behavior verbatim.
|
|
108
|
+
*/
|
|
109
|
+
async function runShortformApprove(positional, flags) {
|
|
110
|
+
const [rootArg, slug] = positional;
|
|
111
|
+
const projectRoot = absolutize(rootArg);
|
|
42
112
|
let config;
|
|
43
113
|
try {
|
|
44
114
|
config = readConfig(projectRoot);
|
|
@@ -47,17 +117,16 @@ export async function run(argv) {
|
|
|
47
117
|
fail(err instanceof Error ? err.message : String(err));
|
|
48
118
|
}
|
|
49
119
|
const site = resolveSite(config, flags.site);
|
|
50
|
-
const contentKind = flags.platform ? 'shortform' : 'longform';
|
|
51
120
|
const fetched = handleGetWorkflow(projectRoot, config, {
|
|
52
121
|
id: null,
|
|
53
122
|
site,
|
|
54
123
|
slug,
|
|
55
|
-
contentKind,
|
|
124
|
+
contentKind: 'shortform',
|
|
56
125
|
platform: flags.platform ?? null,
|
|
57
126
|
channel: flags.channel ?? null,
|
|
58
127
|
});
|
|
59
128
|
if (fetched.status !== 200 || !isSuccessBody(fetched.body)) {
|
|
60
|
-
fail(`no
|
|
129
|
+
fail(`no shortform workflow for ${site}/${slug}: ${errorMessage(fetched.body)}`);
|
|
61
130
|
}
|
|
62
131
|
const workflow = fetched.body.workflow;
|
|
63
132
|
const versions = fetched.body.versions;
|
|
@@ -68,112 +137,74 @@ export async function run(argv) {
|
|
|
68
137
|
const annotations = readAnnotations(projectRoot, config, workflow.id);
|
|
69
138
|
const approveAnn = latestApprove(annotations);
|
|
70
139
|
const approvedVersion = approveAnn?.version ?? workflow.currentVersion;
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
140
|
+
if (!flags.platform)
|
|
141
|
+
fail('--platform is required for shortform workflows');
|
|
142
|
+
if (!isPlatform(flags.platform))
|
|
143
|
+
fail(`Invalid --platform "${flags.platform}".`);
|
|
144
|
+
// Phase 21a: shortform is now disk-backed. Read the on-disk file as
|
|
145
|
+
// the SSOT — the journal version is just the latest snapshot, but
|
|
146
|
+
// every save writes to disk first. Strip the frontmatter so the
|
|
147
|
+
// calendar's `## Shortform Copy` section captures the body only.
|
|
148
|
+
const filePath = resolveShortformFilePath(projectRoot, config, site, { slug }, flags.platform, flags.channel);
|
|
149
|
+
if (filePath === undefined || !existsSync(filePath)) {
|
|
150
|
+
const shown = filePath ?? '(unresolved)';
|
|
151
|
+
fail(`Shortform file missing at ${shown}. ` +
|
|
152
|
+
`The file is the SSOT — re-run /deskwork:shortform-start if needed.`);
|
|
76
153
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// (Issue #67).
|
|
85
|
-
const blogFile = resolveEntryFilePath(projectRoot, config, site, slug, workflow.entryId);
|
|
86
|
-
if (!existsSync(blogFile)) {
|
|
87
|
-
fail(`Blog file missing at ${blogFile}. Nothing to approve against.`);
|
|
88
|
-
}
|
|
89
|
-
transitionState(projectRoot, config, workflow.id, 'applied');
|
|
90
|
-
emit({
|
|
91
|
-
workflowId: workflow.id,
|
|
92
|
-
site,
|
|
93
|
-
slug,
|
|
94
|
-
contentKind: 'longform',
|
|
95
|
-
state: 'applied',
|
|
96
|
-
version: approvedVersion,
|
|
97
|
-
filePath: blogFile,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
function applyShortform(workflow, _versions, approvedVersion) {
|
|
101
|
-
if (!flags.platform)
|
|
102
|
-
fail('--platform is required for shortform workflows');
|
|
103
|
-
if (!isPlatform(flags.platform))
|
|
104
|
-
fail(`Invalid --platform "${flags.platform}".`);
|
|
105
|
-
// Phase 21a: shortform is now disk-backed. Read the on-disk file as
|
|
106
|
-
// the SSOT — the journal version is just the latest snapshot, but
|
|
107
|
-
// every save writes to disk first. Strip the frontmatter so the
|
|
108
|
-
// calendar's `## Shortform Copy` section captures the body only.
|
|
109
|
-
const filePath = resolveShortformFilePath(projectRoot, config, site, { slug }, flags.platform, flags.channel);
|
|
110
|
-
if (filePath === undefined || !existsSync(filePath)) {
|
|
111
|
-
const shown = filePath ?? '(unresolved)';
|
|
112
|
-
fail(`Shortform file missing at ${shown}. ` +
|
|
113
|
-
`The file is the SSOT — re-run /deskwork:shortform-start if needed.`);
|
|
114
|
-
}
|
|
115
|
-
const fileSrc = readFileSync(filePath, 'utf-8');
|
|
116
|
-
const approvedMarkdown = parseFrontmatter(fileSrc).body.replace(/^\n+/, '');
|
|
117
|
-
const calendarPath = resolveCalendarPath(projectRoot, config, site);
|
|
118
|
-
const cal = readCalendar(calendarPath);
|
|
119
|
-
const channelLower = flags.channel?.toLowerCase();
|
|
120
|
-
const match = cal.distributions.find((d) => {
|
|
121
|
-
if (d.slug !== slug)
|
|
122
|
-
return false;
|
|
123
|
-
if (d.platform !== flags.platform)
|
|
124
|
-
return false;
|
|
125
|
-
if (channelLower !== undefined) {
|
|
126
|
-
return (d.channel?.toLowerCase() ?? '') === channelLower;
|
|
127
|
-
}
|
|
128
|
-
return !d.channel;
|
|
129
|
-
});
|
|
130
|
-
if (!match) {
|
|
131
|
-
const channelBit = flags.channel ? ` · channel=${flags.channel}` : '';
|
|
132
|
-
fail(`No distribution record for (slug=${slug}, platform=${flags.platform}${channelBit}). ` +
|
|
133
|
-
`Create it with /deskwork:distribute first.`);
|
|
134
|
-
}
|
|
135
|
-
match.shortform = approvedMarkdown;
|
|
136
|
-
writeCalendar(calendarPath, cal);
|
|
137
|
-
transitionState(projectRoot, config, workflow.id, 'applied');
|
|
138
|
-
emit({
|
|
139
|
-
workflowId: workflow.id,
|
|
140
|
-
site,
|
|
141
|
-
slug,
|
|
142
|
-
contentKind: 'shortform',
|
|
143
|
-
state: 'applied',
|
|
144
|
-
version: approvedVersion,
|
|
145
|
-
platform: flags.platform,
|
|
146
|
-
channel: flags.channel,
|
|
147
|
-
calendarPath,
|
|
148
|
-
filePath,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
function latestApprove(annotations) {
|
|
152
|
-
const approves = annotations.filter((a) => a.type === 'approve');
|
|
153
|
-
if (approves.length === 0)
|
|
154
|
-
return undefined;
|
|
155
|
-
return approves.reduce((a, b) => (a.createdAt > b.createdAt ? a : b));
|
|
156
|
-
}
|
|
157
|
-
function isSuccessBody(body) {
|
|
158
|
-
if (typeof body !== 'object' || body === null)
|
|
154
|
+
const fileSrc = readFileSync(filePath, 'utf-8');
|
|
155
|
+
const approvedMarkdown = parseFrontmatter(fileSrc).body.replace(/^\n+/, '');
|
|
156
|
+
const calendarPath = resolveCalendarPath(projectRoot, config, site);
|
|
157
|
+
const cal = readCalendar(calendarPath);
|
|
158
|
+
const channelLower = flags.channel?.toLowerCase();
|
|
159
|
+
const match = cal.distributions.find((d) => {
|
|
160
|
+
if (d.slug !== slug)
|
|
159
161
|
return false;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const value = Reflect.get(body, 'error');
|
|
165
|
-
if (typeof value === 'string')
|
|
166
|
-
return value;
|
|
162
|
+
if (d.platform !== flags.platform)
|
|
163
|
+
return false;
|
|
164
|
+
if (channelLower !== undefined) {
|
|
165
|
+
return (d.channel?.toLowerCase() ?? '') === channelLower;
|
|
167
166
|
}
|
|
168
|
-
return
|
|
167
|
+
return !d.channel;
|
|
168
|
+
});
|
|
169
|
+
if (!match) {
|
|
170
|
+
const channelBit = flags.channel ? ` · channel=${flags.channel}` : '';
|
|
171
|
+
fail(`No distribution record for (slug=${slug}, platform=${flags.platform}${channelBit}). ` +
|
|
172
|
+
`Create it with /deskwork:distribute first.`);
|
|
169
173
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
174
|
+
match.shortform = approvedMarkdown;
|
|
175
|
+
writeCalendar(calendarPath, cal);
|
|
176
|
+
transitionState(projectRoot, config, workflow.id, 'applied');
|
|
177
|
+
void versions;
|
|
178
|
+
emit({
|
|
179
|
+
workflowId: workflow.id,
|
|
180
|
+
site,
|
|
181
|
+
slug,
|
|
182
|
+
contentKind: 'shortform',
|
|
183
|
+
state: 'applied',
|
|
184
|
+
version: approvedVersion,
|
|
185
|
+
platform: flags.platform,
|
|
186
|
+
channel: flags.channel,
|
|
187
|
+
calendarPath,
|
|
188
|
+
filePath,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
function latestApprove(annotations) {
|
|
192
|
+
const approves = annotations.filter((a) => a.type === 'approve');
|
|
193
|
+
if (approves.length === 0)
|
|
194
|
+
return undefined;
|
|
195
|
+
return approves.reduce((a, b) => (a.createdAt > b.createdAt ? a : b));
|
|
196
|
+
}
|
|
197
|
+
function isSuccessBody(body) {
|
|
198
|
+
if (typeof body !== 'object' || body === null)
|
|
199
|
+
return false;
|
|
200
|
+
return 'workflow' in body && 'versions' in body;
|
|
201
|
+
}
|
|
202
|
+
function errorMessage(body) {
|
|
203
|
+
if (typeof body === 'object' && body !== null) {
|
|
204
|
+
const value = Reflect.get(body, 'error');
|
|
205
|
+
if (typeof value === 'string')
|
|
206
|
+
return value;
|
|
177
207
|
}
|
|
208
|
+
return 'unknown error';
|
|
178
209
|
}
|
|
179
210
|
//# sourceMappingURL=approve.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approve.js","sourceRoot":"","sources":["../../src/commands/approve.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"approve.js","sourceRoot":"","sources":["../../src/commands/approve.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,eAAe,EACf,eAAe,GAChB,MAAM,gCAAgC,CAAC;AAOxC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAU,CAAC;AAC7D,MAAM,OAAO,GAA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O;QACtB,YAAY;QACZ,QAAQ;KACT,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CACpB,WAAuC;IAEvC,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CACjC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CACpD,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CACpB,IAAa;IAEb,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,UAAU,IAAI,IAAI,IAAI,UAAU,IAAI,IAAI,CAAC;AAClD,CAAC;AAED,SAAS,YAAY,CAAC,IAAa;IACjC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IAC9C,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* deskwork-publish — mark a
|
|
2
|
+
* deskwork-publish — mark a Final entry as Published.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Phase 29 / pipeline redesign: entry-centric publish goes through the
|
|
5
|
+
* `publishEntry` core helper, which writes the sidecar's currentStage
|
|
6
|
+
* to 'Published', stamps `datePublished`, emits a stage-transition
|
|
7
|
+
* journal event, and regenerates calendar.md (#148).
|
|
8
|
+
*
|
|
9
|
+
* Dispatcher: when the slug resolves to an entry sidecar, route to the
|
|
10
|
+
* entry-centric path. Otherwise (legacy data without sidecars,
|
|
11
|
+
* shortform-style externally-hosted content using `--content-url`),
|
|
12
|
+
* fall through to the legacy calendar-mutation path which preserves
|
|
13
|
+
* the pre-Phase-30 behavior verbatim.
|
|
8
14
|
*
|
|
9
15
|
* Usage:
|
|
10
16
|
* deskwork-publish <project-root> [--site <slug>] [--date YYYY-MM-DD]
|
|
11
17
|
* [--content-url URL] <slug>
|
|
12
18
|
*
|
|
13
|
-
* Emits a JSON result:
|
|
14
|
-
* { slug,
|
|
19
|
+
* Emits a JSON result. Entry-centric path:
|
|
20
|
+
* { entryId, slug, fromStage, toStage: "Published", datePublished,
|
|
21
|
+
* site, calendarPath, filePath? }
|
|
22
|
+
* Legacy path (unchanged):
|
|
23
|
+
* { slug, title, stage, datePublished, contentType, contentUrl?,
|
|
15
24
|
* issueNumber?, filePath?, site, calendarPath }
|
|
16
25
|
*/
|
|
17
26
|
export declare function run(argv: string[]): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA4BH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA8EvD"}
|
package/dist/commands/publish.js
CHANGED
|
@@ -1,30 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* deskwork-publish — mark a
|
|
2
|
+
* deskwork-publish — mark a Final entry as Published.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Phase 29 / pipeline redesign: entry-centric publish goes through the
|
|
5
|
+
* `publishEntry` core helper, which writes the sidecar's currentStage
|
|
6
|
+
* to 'Published', stamps `datePublished`, emits a stage-transition
|
|
7
|
+
* journal event, and regenerates calendar.md (#148).
|
|
8
|
+
*
|
|
9
|
+
* Dispatcher: when the slug resolves to an entry sidecar, route to the
|
|
10
|
+
* entry-centric path. Otherwise (legacy data without sidecars,
|
|
11
|
+
* shortform-style externally-hosted content using `--content-url`),
|
|
12
|
+
* fall through to the legacy calendar-mutation path which preserves
|
|
13
|
+
* the pre-Phase-30 behavior verbatim.
|
|
8
14
|
*
|
|
9
15
|
* Usage:
|
|
10
16
|
* deskwork-publish <project-root> [--site <slug>] [--date YYYY-MM-DD]
|
|
11
17
|
* [--content-url URL] <slug>
|
|
12
18
|
*
|
|
13
|
-
* Emits a JSON result:
|
|
14
|
-
* { slug,
|
|
19
|
+
* Emits a JSON result. Entry-centric path:
|
|
20
|
+
* { entryId, slug, fromStage, toStage: "Published", datePublished,
|
|
21
|
+
* site, calendarPath, filePath? }
|
|
22
|
+
* Legacy path (unchanged):
|
|
23
|
+
* { slug, title, stage, datePublished, contentType, contentUrl?,
|
|
15
24
|
* issueNumber?, filePath?, site, calendarPath }
|
|
16
25
|
*/
|
|
17
26
|
import { existsSync } from 'node:fs';
|
|
18
27
|
import { readConfig } from '@deskwork/core/config';
|
|
19
28
|
import { readCalendar, writeCalendar } from '@deskwork/core/calendar';
|
|
20
|
-
import { findEntry, publishEntry, setContentUrl, } from '@deskwork/core/calendar-mutations';
|
|
29
|
+
import { findEntry, publishEntry as publishCalendarEntry, setContentUrl, } from '@deskwork/core/calendar-mutations';
|
|
21
30
|
import { effectiveContentType, hasRepoContent, requiresContentUrl, } from '@deskwork/core/types';
|
|
22
31
|
import { resolveSite, resolveCalendarPath, resolveEntryFilePath, } from '@deskwork/core/paths';
|
|
23
32
|
import { absolutize, emit, fail, parseArgs } from '@deskwork/core/cli-args';
|
|
33
|
+
import { publishEntry as publishEntrySidecar } from '@deskwork/core/entry/publish';
|
|
34
|
+
import { resolveEntryUuid } from '@deskwork/core/sidecar';
|
|
35
|
+
const KNOWN_FLAGS = ['site', 'date', 'content-url'];
|
|
36
|
+
const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
24
37
|
export async function run(argv) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
let parsed;
|
|
39
|
+
try {
|
|
40
|
+
parsed = parseArgs(argv, KNOWN_FLAGS);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
fail(err instanceof Error ? err.message : String(err), 2);
|
|
44
|
+
}
|
|
45
|
+
const { positional, flags } = parsed;
|
|
28
46
|
if (positional.length < 2) {
|
|
29
47
|
fail('Usage: deskwork-publish <project-root> [--site <slug>] [--date YYYY-MM-DD] ' +
|
|
30
48
|
'[--content-url URL] <slug>', 2);
|
|
@@ -42,6 +60,55 @@ export async function run(argv) {
|
|
|
42
60
|
fail(err instanceof Error ? err.message : String(err));
|
|
43
61
|
}
|
|
44
62
|
const site = resolveSite(config, flags.site);
|
|
63
|
+
// Try entry-centric path first. The slug-to-uuid resolver returns a
|
|
64
|
+
// structured error when no sidecar is bound; fall through to legacy
|
|
65
|
+
// only on that error so the rest of the publish pipeline still
|
|
66
|
+
// surfaces real problems (bad slug, missing artifact, etc.).
|
|
67
|
+
const uuid = await tryResolveEntryUuid(projectRoot, slug);
|
|
68
|
+
if (uuid !== undefined) {
|
|
69
|
+
// Entry-centric path. The new model doesn't have content-type info
|
|
70
|
+
// on the sidecar — content-url is a legacy-only concern, so we
|
|
71
|
+
// refuse to mix it with entry-centric publish to avoid silent
|
|
72
|
+
// drops. If an operator needs --content-url, they're on the
|
|
73
|
+
// legacy data path.
|
|
74
|
+
if (flags['content-url'] !== undefined) {
|
|
75
|
+
fail('--content-url is not supported on entry-centric entries. ' +
|
|
76
|
+
'Set contentUrl via the calendar mutation path before migrating.');
|
|
77
|
+
}
|
|
78
|
+
let result;
|
|
79
|
+
try {
|
|
80
|
+
result = await publishEntrySidecar(projectRoot, {
|
|
81
|
+
uuid,
|
|
82
|
+
...(flags.date !== undefined ? { date: flags.date } : {}),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
fail(err instanceof Error ? err.message : String(err));
|
|
87
|
+
}
|
|
88
|
+
emit({
|
|
89
|
+
entryId: result.entryId,
|
|
90
|
+
site,
|
|
91
|
+
slug,
|
|
92
|
+
fromStage: result.fromStage,
|
|
93
|
+
toStage: result.toStage,
|
|
94
|
+
datePublished: result.datePublished,
|
|
95
|
+
calendarPath: resolveCalendarPath(projectRoot, config, site),
|
|
96
|
+
...(result.artifactPath !== undefined ? { filePath: result.artifactPath } : {}),
|
|
97
|
+
});
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Legacy path — unchanged.
|
|
101
|
+
await runLegacyPublish(projectRoot, config, site, slug, flags);
|
|
102
|
+
}
|
|
103
|
+
async function tryResolveEntryUuid(projectRoot, slug) {
|
|
104
|
+
try {
|
|
105
|
+
return await resolveEntryUuid(projectRoot, slug);
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return undefined;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function runLegacyPublish(projectRoot, config, site, slug, flags) {
|
|
45
112
|
const calendarPath = resolveCalendarPath(projectRoot, config, site);
|
|
46
113
|
const calendar = readCalendar(calendarPath);
|
|
47
114
|
const existing = findEntry(calendar, slug);
|
|
@@ -56,15 +123,11 @@ export async function run(argv) {
|
|
|
56
123
|
fail(`Entry "${slug}" is already Published (date: ${existing.datePublished}).`);
|
|
57
124
|
}
|
|
58
125
|
const contentType = effectiveContentType(existing);
|
|
59
|
-
// Persist a late-set content URL before validating.
|
|
60
126
|
if (flags['content-url'] !== undefined) {
|
|
61
127
|
setContentUrl(calendar, slug, flags['content-url']);
|
|
62
128
|
}
|
|
63
129
|
let filePath;
|
|
64
130
|
if (hasRepoContent(contentType)) {
|
|
65
|
-
// Prefer the UUID-bound path so a refactored / non-template file
|
|
66
|
-
// location is honored (Issue #67). The slug-template fallback is
|
|
67
|
-
// automatic when no UUID binding exists.
|
|
68
131
|
filePath = resolveEntryFilePath(projectRoot, config, site, slug, existing.id);
|
|
69
132
|
if (!existsSync(filePath)) {
|
|
70
133
|
fail(`Cannot publish blog post "${slug}": no file at ${filePath}. ` +
|
|
@@ -72,14 +135,13 @@ export async function run(argv) {
|
|
|
72
135
|
}
|
|
73
136
|
}
|
|
74
137
|
else if (requiresContentUrl(contentType)) {
|
|
75
|
-
// Re-read after possible setContentUrl mutation above.
|
|
76
138
|
const updated = findEntry(calendar, slug);
|
|
77
139
|
if (!updated.contentUrl) {
|
|
78
140
|
fail(`Cannot publish ${contentType} entry "${slug}": contentUrl is not set. ` +
|
|
79
141
|
`Pass --content-url <URL> to set it.`);
|
|
80
142
|
}
|
|
81
143
|
}
|
|
82
|
-
const published =
|
|
144
|
+
const published = publishCalendarEntry(calendar, slug, flags.date);
|
|
83
145
|
writeCalendar(calendarPath, calendar);
|
|
84
146
|
emit({
|
|
85
147
|
slug: published.slug,
|
|
@@ -93,13 +155,5 @@ export async function run(argv) {
|
|
|
93
155
|
site,
|
|
94
156
|
calendarPath,
|
|
95
157
|
});
|
|
96
|
-
function parse() {
|
|
97
|
-
try {
|
|
98
|
-
return parseArgs(argv, KNOWN_FLAGS);
|
|
99
|
-
}
|
|
100
|
-
catch (err) {
|
|
101
|
-
fail(err instanceof Error ? err.message : String(err), 2);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
158
|
}
|
|
105
159
|
//# sourceMappingURL=publish.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/commands/publish.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["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