@workover/cli 0.8.1 → 0.10.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,39 @@ 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
+
227
+ ## Fact-checking a document
228
+
229
+ `workover doc verify` asks Workover AI to check an existing document against the repository
230
+ linked to its project, and to correct what it finds wrong: a setting that was renamed, a limit
231
+ that changed, a capability that no longer exists (or never did).
232
+
233
+ ```sh
234
+ workover doc verify 1234 # corrections, suggested for review
235
+ workover doc verify 1234 --write # corrections, written directly
236
+ ```
237
+
238
+ You pass nothing but the document id. Workover AI reads the source itself and lists each claim it
239
+ changed, and a claim the source does not settle is removed rather than softened. It leaves the
240
+ writing, the structure and the pictures alone. Like `reshoot`, it needs `workover login --draft`,
241
+ and `--write` needs `--write` too. A project with no linked repository has nothing to check
242
+ against, so the command says so rather than pretending to have checked.
243
+
211
244
  ## Coworking with Claude Code
212
245
 
213
246
  Pair it with the [Workover MCP server](https://www.npmjs.com/package/@workover/mcp):
package/bin/workover.mjs CHANGED
@@ -736,6 +736,13 @@ 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`',
742
+ ' verify <docId> [--write] Workover AI checks the text against',
743
+ ' the linked repository and corrects what it finds wrong;',
744
+ ' applied as suggestions, or directly with --write. Needs',
745
+ ' `login --draft`',
739
746
  ' search "<query>" [--limit N] [--json] find documents by title/content',
740
747
  ' activity <docId> [--limit N] [--json] who changed this document, and how',
741
748
  '',
@@ -767,13 +774,15 @@ async function docCommand() {
767
774
  'tabs',
768
775
  'tab-new',
769
776
  'activity',
777
+ 'reshoot',
778
+ 'verify',
770
779
  ].includes(sub)
771
780
  ) {
772
781
  console.log(DOC_USAGE);
773
782
  process.exit(sub ? 1 : 0);
774
783
  }
775
784
  const { flags, positionals } = parseArgs(process.argv.slice(4), {
776
- booleans: ['json', 'html'],
785
+ booleans: ['json', 'html', 'replace', 'write'],
777
786
  });
778
787
  const cfg = requireSignIn();
779
788
  const asJson = flags.json === true;
@@ -1029,6 +1038,90 @@ async function docCommand() {
1029
1038
  return;
1030
1039
  }
1031
1040
 
1041
+ if (sub === 'reshoot') {
1042
+ // Workover AI plans and captures this document's screenshots from its current text, signed in
1043
+ // to the workspace's connected app with the stored credential (which never reaches this
1044
+ // machine). Needs `draft`. The result is applied as suggestions, or written with --write.
1045
+ const docId = docIdArg(
1046
+ positionals,
1047
+ 'workover doc reshoot <docId> [--replace] [--write] [--note "<why>"]',
1048
+ );
1049
+ const res = await authedCall(cfg, `/ai/documents/${docId}/screenshots`, {
1050
+ replace: flags.replace === true,
1051
+ });
1052
+ const counts =
1053
+ `${res?.added ?? 0} added` +
1054
+ (res?.droppedByCapture ? `, ${res.droppedByCapture} refused by the browser` : '') +
1055
+ (res?.droppedByReview ? `, ${res.droppedByReview} rejected on review` : '') +
1056
+ (res?.droppedByAnchor ? `, ${res.droppedByAnchor} with nowhere to go` : '');
1057
+ if (!res?.changed) {
1058
+ if (asJson) return console.log(JSON.stringify(res, null, 2));
1059
+ console.log(`\n No new screenshots for document #${docId} (${counts}).`);
1060
+ for (const r of res?.dropReasons ?? []) console.log(` - ${r}`);
1061
+ if (res?.connectionError) console.log(` ${res.connectionError}`);
1062
+ console.log('');
1063
+ return;
1064
+ }
1065
+ const note =
1066
+ typeof flags.note === 'string'
1067
+ ? flags.note
1068
+ : `Screenshots re-shot by Workover AI (${counts})`;
1069
+ const direct = flags.write === true;
1070
+ const applied = await authedCall(
1071
+ cfg,
1072
+ `/project/doc/${docId}/${direct ? 'content' : 'propose'}`,
1073
+ { markdown: res.html, note, source: 'Workover CLI' },
1074
+ );
1075
+ if (asJson) return console.log(JSON.stringify({ ...res, applied }, null, 2));
1076
+ console.log(
1077
+ `\n \x1b[32m✓\x1b[0m Screenshots for document #${docId}: ${counts}. ` +
1078
+ (direct ? 'Written directly.' : 'Left as suggestions to accept.'),
1079
+ );
1080
+ for (const r of res?.dropReasons ?? []) console.log(` - ${r}`);
1081
+ if (applied?.documentUrl) console.log(` ${applied.documentUrl}`);
1082
+ console.log('');
1083
+ return;
1084
+ }
1085
+
1086
+ if (sub === 'verify') {
1087
+ // Workover AI reads the project's linked repository and corrects what the document gets wrong.
1088
+ // Nothing is passed in but the id: the corrections have to come from the source, not from us.
1089
+ // The result is applied as suggestions (or written with --write), like `reshoot`.
1090
+ const docId = docIdArg(positionals, 'workover doc verify <docId> [--write] [--note "<why>"]');
1091
+ const res = await authedCall(cfg, `/ai/documents/${docId}/verify`, {});
1092
+ const list = Array.isArray(res?.corrections) ? res.corrections : null;
1093
+ if (asJson && !res?.changed) return console.log(JSON.stringify(res, null, 2));
1094
+ if (!res?.changed) {
1095
+ console.log(
1096
+ list === null
1097
+ ? `\n Workover AI could not produce a check it trusts for document #${docId}; nothing changed.\n`
1098
+ : `\n Workover AI checked document #${docId} against ${res?.repo} and found nothing to correct.\n`,
1099
+ );
1100
+ return;
1101
+ }
1102
+ const note =
1103
+ typeof flags.note === 'string'
1104
+ ? flags.note
1105
+ : `Fact-checked by Workover AI against ${res.repo}` +
1106
+ (list ? ` (${list.length} correction${list.length === 1 ? '' : 's'})` : '');
1107
+ const direct = flags.write === true;
1108
+ const applied = await authedCall(
1109
+ cfg,
1110
+ `/project/doc/${docId}/${direct ? 'content' : 'propose'}`,
1111
+ { markdown: res.html, note, source: 'Workover CLI' },
1112
+ );
1113
+ if (asJson) return console.log(JSON.stringify({ ...res, applied }, null, 2));
1114
+ console.log(
1115
+ `\n \x1b[32m✓\x1b[0m Workover AI checked document #${docId} against ${res.repo}. ` +
1116
+ (direct ? 'Written directly.' : 'Left as suggestions to accept.'),
1117
+ );
1118
+ for (const c of list ?? []) console.log(` - ${c}`);
1119
+ if (list === null) console.log(' (It changed the text but did not list what it changed.)');
1120
+ if (applied?.documentUrl) console.log(` ${applied.documentUrl}`);
1121
+ console.log('');
1122
+ return;
1123
+ }
1124
+
1032
1125
  if (sub === 'activity') {
1033
1126
  const docId = docIdArg(positionals, 'workover doc activity <docId>');
1034
1127
  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.10.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",