@workover/cli 0.8.1 → 0.9.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/README.md CHANGED
@@ -208,6 +208,22 @@ and then review what came back.
208
208
  `--draft` is not granted by default, because a draft spends AI credits and signs in to your
209
209
  connected app. The browser says so before you approve.
210
210
 
211
+ ## Retaking a document's screenshots
212
+
213
+ `workover doc reshoot` asks Workover AI to retake the screenshots for a document that already
214
+ exists, from its current text: it decides which steps need a picture, opens the screens in your
215
+ connected app, frames and marks them, and places each one after the sentence it illustrates.
216
+
217
+ ```sh
218
+ workover doc reshoot 1234 --replace # new pictures, suggested for review
219
+ workover doc reshoot 1234 --replace --write # new pictures, written directly
220
+ ```
221
+
222
+ `--replace` drops the old pictures and plans afresh (using where they were as a hint); without it,
223
+ new pictures are only added where there were none. The result arrives as tracked suggestions unless
224
+ you pass `--write`, which needs `workover login --write`. Like `draft`, it needs `--draft`, and your
225
+ app's password never leaves Workover.
226
+
211
227
  ## Coworking with Claude Code
212
228
 
213
229
  Pair it with the [Workover MCP server](https://www.npmjs.com/package/@workover/mcp):
package/bin/workover.mjs CHANGED
@@ -736,6 +736,9 @@ const DOC_USAGE = [
736
736
  ' write <docId> [--note "<why>"] REPLACE the body, no review step',
737
737
  ' [--file <path> | piped stdin] [--json] [--tab <tabId>]',
738
738
  ' needs `workover login --write`; use it only when asked to',
739
+ ' reshoot <docId> [--replace] [--write] Workover AI retakes the screenshots',
740
+ ' from the text; --replace drops the old ones; applied as',
741
+ ' suggestions, or directly with --write. Needs `login --draft`',
739
742
  ' search "<query>" [--limit N] [--json] find documents by title/content',
740
743
  ' activity <docId> [--limit N] [--json] who changed this document, and how',
741
744
  '',
@@ -767,13 +770,14 @@ async function docCommand() {
767
770
  'tabs',
768
771
  'tab-new',
769
772
  'activity',
773
+ 'reshoot',
770
774
  ].includes(sub)
771
775
  ) {
772
776
  console.log(DOC_USAGE);
773
777
  process.exit(sub ? 1 : 0);
774
778
  }
775
779
  const { flags, positionals } = parseArgs(process.argv.slice(4), {
776
- booleans: ['json', 'html'],
780
+ booleans: ['json', 'html', 'replace', 'write'],
777
781
  });
778
782
  const cfg = requireSignIn();
779
783
  const asJson = flags.json === true;
@@ -1029,6 +1033,51 @@ async function docCommand() {
1029
1033
  return;
1030
1034
  }
1031
1035
 
1036
+ if (sub === 'reshoot') {
1037
+ // Workover AI plans and captures this document's screenshots from its current text, signed in
1038
+ // to the workspace's connected app with the stored credential (which never reaches this
1039
+ // machine). Needs `draft`. The result is applied as suggestions, or written with --write.
1040
+ const docId = docIdArg(
1041
+ positionals,
1042
+ 'workover doc reshoot <docId> [--replace] [--write] [--note "<why>"]',
1043
+ );
1044
+ const res = await authedCall(cfg, `/ai/documents/${docId}/screenshots`, {
1045
+ replace: flags.replace === true,
1046
+ });
1047
+ const counts =
1048
+ `${res?.added ?? 0} added` +
1049
+ (res?.droppedByCapture ? `, ${res.droppedByCapture} refused by the browser` : '') +
1050
+ (res?.droppedByReview ? `, ${res.droppedByReview} rejected on review` : '') +
1051
+ (res?.droppedByAnchor ? `, ${res.droppedByAnchor} with nowhere to go` : '');
1052
+ if (!res?.changed) {
1053
+ if (asJson) return console.log(JSON.stringify(res, null, 2));
1054
+ console.log(`\n No new screenshots for document #${docId} (${counts}).`);
1055
+ for (const r of res?.dropReasons ?? []) console.log(` - ${r}`);
1056
+ if (res?.connectionError) console.log(` ${res.connectionError}`);
1057
+ console.log('');
1058
+ return;
1059
+ }
1060
+ const note =
1061
+ typeof flags.note === 'string'
1062
+ ? flags.note
1063
+ : `Screenshots re-shot by Workover AI (${counts})`;
1064
+ const direct = flags.write === true;
1065
+ const applied = await authedCall(
1066
+ cfg,
1067
+ `/project/doc/${docId}/${direct ? 'content' : 'propose'}`,
1068
+ { markdown: res.html, note, source: 'Workover CLI' },
1069
+ );
1070
+ if (asJson) return console.log(JSON.stringify({ ...res, applied }, null, 2));
1071
+ console.log(
1072
+ `\n \x1b[32m✓\x1b[0m Screenshots for document #${docId}: ${counts}. ` +
1073
+ (direct ? 'Written directly.' : 'Left as suggestions to accept.'),
1074
+ );
1075
+ for (const r of res?.dropReasons ?? []) console.log(` - ${r}`);
1076
+ if (applied?.documentUrl) console.log(` ${applied.documentUrl}`);
1077
+ console.log('');
1078
+ return;
1079
+ }
1080
+
1032
1081
  if (sub === 'activity') {
1033
1082
  const docId = docIdArg(positionals, 'workover doc activity <docId>');
1034
1083
  const limit = rowId(flags.limit) ?? 20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/cli",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Workover command line — sign in and cowork on your documents from the terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ScaleMath",