@deskwork/cli 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 (85) hide show
  1. package/dist/cli.d.ts +19 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +98 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/add.d.ts +13 -0
  6. package/dist/commands/add.d.ts.map +1 -0
  7. package/dist/commands/add.js +91 -0
  8. package/dist/commands/add.js.map +1 -0
  9. package/dist/commands/approve.d.ts +18 -0
  10. package/dist/commands/approve.d.ts.map +1 -0
  11. package/dist/commands/approve.js +179 -0
  12. package/dist/commands/approve.js.map +1 -0
  13. package/dist/commands/customize.d.ts +47 -0
  14. package/dist/commands/customize.d.ts.map +1 -0
  15. package/dist/commands/customize.js +176 -0
  16. package/dist/commands/customize.js.map +1 -0
  17. package/dist/commands/distribute.d.ts +30 -0
  18. package/dist/commands/distribute.d.ts.map +1 -0
  19. package/dist/commands/distribute.js +148 -0
  20. package/dist/commands/distribute.js.map +1 -0
  21. package/dist/commands/doctor.d.ts +35 -0
  22. package/dist/commands/doctor.d.ts.map +1 -0
  23. package/dist/commands/doctor.js +354 -0
  24. package/dist/commands/doctor.js.map +1 -0
  25. package/dist/commands/draft.d.ts +17 -0
  26. package/dist/commands/draft.d.ts.map +1 -0
  27. package/dist/commands/draft.js +77 -0
  28. package/dist/commands/draft.js.map +1 -0
  29. package/dist/commands/ingest.d.ts +43 -0
  30. package/dist/commands/ingest.d.ts.map +1 -0
  31. package/dist/commands/ingest.js +321 -0
  32. package/dist/commands/ingest.js.map +1 -0
  33. package/dist/commands/install-preflight.d.ts +83 -0
  34. package/dist/commands/install-preflight.d.ts.map +1 -0
  35. package/dist/commands/install-preflight.js +300 -0
  36. package/dist/commands/install-preflight.js.map +1 -0
  37. package/dist/commands/install.d.ts +27 -0
  38. package/dist/commands/install.d.ts.map +1 -0
  39. package/dist/commands/install.js +132 -0
  40. package/dist/commands/install.js.map +1 -0
  41. package/dist/commands/iterate.d.ts +33 -0
  42. package/dist/commands/iterate.d.ts.map +1 -0
  43. package/dist/commands/iterate.js +202 -0
  44. package/dist/commands/iterate.js.map +1 -0
  45. package/dist/commands/outline.d.ts +19 -0
  46. package/dist/commands/outline.d.ts.map +1 -0
  47. package/dist/commands/outline.js +102 -0
  48. package/dist/commands/outline.js.map +1 -0
  49. package/dist/commands/pause.d.ts +15 -0
  50. package/dist/commands/pause.d.ts.map +1 -0
  51. package/dist/commands/pause.js +70 -0
  52. package/dist/commands/pause.js.map +1 -0
  53. package/dist/commands/plan.d.ts +12 -0
  54. package/dist/commands/plan.d.ts.map +1 -0
  55. package/dist/commands/plan.js +74 -0
  56. package/dist/commands/plan.js.map +1 -0
  57. package/dist/commands/publish.d.ts +18 -0
  58. package/dist/commands/publish.d.ts.map +1 -0
  59. package/dist/commands/publish.js +105 -0
  60. package/dist/commands/publish.js.map +1 -0
  61. package/dist/commands/resume.d.ts +16 -0
  62. package/dist/commands/resume.d.ts.map +1 -0
  63. package/dist/commands/resume.js +70 -0
  64. package/dist/commands/resume.js.map +1 -0
  65. package/dist/commands/review-cancel.d.ts +15 -0
  66. package/dist/commands/review-cancel.d.ts.map +1 -0
  67. package/dist/commands/review-cancel.js +88 -0
  68. package/dist/commands/review-cancel.js.map +1 -0
  69. package/dist/commands/review-help.d.ts +12 -0
  70. package/dist/commands/review-help.d.ts.map +1 -0
  71. package/dist/commands/review-help.js +52 -0
  72. package/dist/commands/review-help.js.map +1 -0
  73. package/dist/commands/review-report.d.ts +13 -0
  74. package/dist/commands/review-report.d.ts.map +1 -0
  75. package/dist/commands/review-report.js +53 -0
  76. package/dist/commands/review-report.js.map +1 -0
  77. package/dist/commands/review-start.d.ts +17 -0
  78. package/dist/commands/review-start.d.ts.map +1 -0
  79. package/dist/commands/review-start.js +121 -0
  80. package/dist/commands/review-start.js.map +1 -0
  81. package/dist/commands/shortform-start.d.ts +33 -0
  82. package/dist/commands/shortform-start.d.ts.map +1 -0
  83. package/dist/commands/shortform-start.js +127 -0
  84. package/dist/commands/shortform-start.js.map +1 -0
  85. package/package.json +45 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * deskwork shortform-start — enqueue a shortform draft for editorial
3
+ * review.
4
+ *
5
+ * Mirrors the longform `review-start` flow, but for the per-platform /
6
+ * per-channel shortform copy that lives in the entry's scrapbook. The
7
+ * shortform file is the source of truth — the workflow holds version
8
+ * snapshots that mirror the file's body. The studio's review surface
9
+ * renders shortform workflows with a small platform/channel header above
10
+ * the same markdown editor used for longform.
11
+ *
12
+ * Usage:
13
+ * deskwork shortform-start <project-root> [--site <slug>]
14
+ * --platform <p> [--channel <c>]
15
+ * [--initial-markdown <text>] <slug>
16
+ *
17
+ * The `<slug>` positional resolves the calendar entry; `--platform` is
18
+ * required and must be one of the known Platforms (reddit, youtube,
19
+ * linkedin, instagram). `--channel` is optional and must be kebab-case
20
+ * (the same shape as a slug segment). `--initial-markdown` seeds the
21
+ * file body when scaffolding — leave it off for an empty draft.
22
+ *
23
+ * The helper is idempotent: if a non-terminal shortform workflow already
24
+ * matches `(entryId | site+slug, platform, channel?)`, that workflow is
25
+ * returned unchanged and the file body is left as-is.
26
+ *
27
+ * Emits a JSON result with the workflow id, the studio review URL path
28
+ * (the operator's running studio is on whatever port they chose — only
29
+ * the path is emitted), the resolved file path, and the platform /
30
+ * channel echo so callers can surface them.
31
+ */
32
+ export declare function run(argv: string[]): Promise<void>;
33
+ //# sourceMappingURL=shortform-start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortform-start.d.ts","sourceRoot":"","sources":["../../src/commands/shortform-start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAeH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6GvD"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * deskwork shortform-start — enqueue a shortform draft for editorial
3
+ * review.
4
+ *
5
+ * Mirrors the longform `review-start` flow, but for the per-platform /
6
+ * per-channel shortform copy that lives in the entry's scrapbook. The
7
+ * shortform file is the source of truth — the workflow holds version
8
+ * snapshots that mirror the file's body. The studio's review surface
9
+ * renders shortform workflows with a small platform/channel header above
10
+ * the same markdown editor used for longform.
11
+ *
12
+ * Usage:
13
+ * deskwork shortform-start <project-root> [--site <slug>]
14
+ * --platform <p> [--channel <c>]
15
+ * [--initial-markdown <text>] <slug>
16
+ *
17
+ * The `<slug>` positional resolves the calendar entry; `--platform` is
18
+ * required and must be one of the known Platforms (reddit, youtube,
19
+ * linkedin, instagram). `--channel` is optional and must be kebab-case
20
+ * (the same shape as a slug segment). `--initial-markdown` seeds the
21
+ * file body when scaffolding — leave it off for an empty draft.
22
+ *
23
+ * The helper is idempotent: if a non-terminal shortform workflow already
24
+ * matches `(entryId | site+slug, platform, channel?)`, that workflow is
25
+ * returned unchanged and the file body is left as-is.
26
+ *
27
+ * Emits a JSON result with the workflow id, the studio review URL path
28
+ * (the operator's running studio is on whatever port they chose — only
29
+ * the path is emitted), the resolved file path, and the platform /
30
+ * channel echo so callers can surface them.
31
+ */
32
+ import { readConfig } from '@deskwork/core/config';
33
+ import { resolveSite } from '@deskwork/core/paths';
34
+ import { handleStartShortform } from '@deskwork/core/review/handlers';
35
+ import { isPlatform, PLATFORMS } from '@deskwork/core/types';
36
+ import { absolutize, emit, fail, parseArgs } from '@deskwork/core/cli-args';
37
+ export async function run(argv) {
38
+ const KNOWN_FLAGS = ['site', 'platform', 'channel', 'initial-markdown'];
39
+ const SLUG_RE = /^[a-z0-9][a-z0-9-]*(\/[a-z0-9][a-z0-9-]*)*$/;
40
+ const { positional, flags } = parse();
41
+ if (positional.length < 2) {
42
+ fail('Usage: deskwork shortform-start <project-root> [--site <slug>] ' +
43
+ '--platform <p> [--channel <c>] [--initial-markdown <text>] <slug>', 2);
44
+ }
45
+ const [rootArg, slug] = positional;
46
+ const projectRoot = absolutize(rootArg);
47
+ if (!SLUG_RE.test(slug)) {
48
+ fail(`invalid slug: ${slug} (must match ${SLUG_RE})`);
49
+ }
50
+ const platform = flags.platform;
51
+ if (platform === undefined) {
52
+ fail(`--platform is required. Must be one of: ${PLATFORMS.join(', ')}.`, 2);
53
+ }
54
+ if (!isPlatform(platform)) {
55
+ fail(`Invalid --platform "${platform}". Must be one of: ${PLATFORMS.join(', ')}.`);
56
+ }
57
+ const channel = flags.channel;
58
+ const initialMarkdown = flags['initial-markdown'];
59
+ let config;
60
+ try {
61
+ config = readConfig(projectRoot);
62
+ }
63
+ catch (err) {
64
+ fail(err instanceof Error ? err.message : String(err));
65
+ }
66
+ let site;
67
+ try {
68
+ site = resolveSite(config, flags.site);
69
+ }
70
+ catch (err) {
71
+ fail(err instanceof Error ? err.message : String(err));
72
+ }
73
+ const result = handleStartShortform(projectRoot, config, {
74
+ site,
75
+ slug,
76
+ platform,
77
+ ...(channel !== undefined ? { channel } : {}),
78
+ ...(initialMarkdown !== undefined ? { initialMarkdown } : {}),
79
+ });
80
+ if (result.status !== 200) {
81
+ fail(errorMessage(result.body));
82
+ }
83
+ if (!isSuccessBody(result.body)) {
84
+ fail('shortform-start: handler returned a malformed response');
85
+ }
86
+ const { workflow, existing, filePath } = result.body;
87
+ emit({
88
+ workflowId: workflow.id,
89
+ site: workflow.site,
90
+ slug: workflow.slug,
91
+ state: workflow.state,
92
+ version: workflow.currentVersion,
93
+ fresh: !existing,
94
+ platform: workflow.platform,
95
+ ...(workflow.channel !== undefined ? { channel: workflow.channel } : {}),
96
+ filePath,
97
+ reviewUrl: `/dev/editorial-review/${workflow.id}`,
98
+ });
99
+ function parse() {
100
+ try {
101
+ return parseArgs(argv, KNOWN_FLAGS);
102
+ }
103
+ catch (err) {
104
+ fail(err instanceof Error ? err.message : String(err), 2);
105
+ }
106
+ }
107
+ function isSuccessBody(body) {
108
+ if (typeof body !== 'object' || body === null)
109
+ return false;
110
+ if (!('workflow' in body) || !('filePath' in body))
111
+ return false;
112
+ const workflowVal = Reflect.get(body, 'workflow');
113
+ const filePathVal = Reflect.get(body, 'filePath');
114
+ return (typeof workflowVal === 'object' &&
115
+ workflowVal !== null &&
116
+ typeof filePathVal === 'string');
117
+ }
118
+ function errorMessage(body) {
119
+ if (typeof body === 'object' && body !== null) {
120
+ const value = Reflect.get(body, 'error');
121
+ if (typeof value === 'string')
122
+ return value;
123
+ }
124
+ return 'shortform-start: unknown error';
125
+ }
126
+ }
127
+ //# sourceMappingURL=shortform-start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortform-start.js","sourceRoot":"","sources":["../../src/commands/shortform-start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQ5E,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc;IACtC,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,kBAAkB,CAAU,CAAC;IACjF,MAAM,OAAO,GAAG,6CAA6C,CAAC;IAE9D,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC;IAEtC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,IAAI,CACF,iEAAiE;YAC/D,mEAAmE,EACrE,CAAC,CACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC;IACnC,MAAM,WAAW,GAAG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O,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,SAAS,aAAa,CAAC,IAAa;QAClC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC5D,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,IAAI,IAAI,CAAC;YAAE,OAAO,KAAK,CAAC;QACjE,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAClD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAClD,OAAO,CACL,OAAO,WAAW,KAAK,QAAQ;YAC/B,WAAW,KAAK,IAAI;YACpB,OAAO,WAAW,KAAK,QAAQ,CAChC,CAAC;IACJ,CAAC;IAED,SAAS,YAAY,CAAC,IAAa;QACjC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAC9C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;gBAAE,OAAO,KAAK,CAAC;QAC9C,CAAC;QACD,OAAO,gCAAgC,CAAC;IAC1C,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@deskwork/cli",
3
+ "version": "0.9.5",
4
+ "type": "module",
5
+ "description": "Editorial calendar + review CLI for the deskwork plugin",
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/cli"
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
+ "bin": {
26
+ "deskwork": "./dist/cli.js"
27
+ },
28
+ "scripts": {
29
+ "build": "tsc -b tsconfig.build.json",
30
+ "prepack": "tsc -b tsconfig.build.json",
31
+ "test": "vitest run",
32
+ "test:watch": "vitest",
33
+ "typecheck": "tsc --noEmit"
34
+ },
35
+ "dependencies": {
36
+ "@deskwork/core": "*"
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.10.0",
40
+ "esbuild": "^0.24.0",
41
+ "tsx": "^4.21.0",
42
+ "typescript": "^5.7.0",
43
+ "vitest": "^4.1.2"
44
+ }
45
+ }