@workover/cli 0.9.0 → 0.11.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
@@ -224,6 +224,23 @@ new pictures are only added where there were none. The result arrives as tracked
224
224
  you pass `--write`, which needs `workover login --write`. Like `draft`, it needs `--draft`, and your
225
225
  app's password never leaves Workover.
226
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
+
227
244
  ## Coworking with Claude Code
228
245
 
229
246
  Pair it with the [Workover MCP server](https://www.npmjs.com/package/@workover/mcp):
package/bin/workover.mjs CHANGED
@@ -739,6 +739,10 @@ const DOC_USAGE = [
739
739
  ' reshoot <docId> [--replace] [--write] Workover AI retakes the screenshots',
740
740
  ' from the text; --replace drops the old ones; applied as',
741
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`',
742
746
  ' search "<query>" [--limit N] [--json] find documents by title/content',
743
747
  ' activity <docId> [--limit N] [--json] who changed this document, and how',
744
748
  '',
@@ -771,6 +775,7 @@ async function docCommand() {
771
775
  'tab-new',
772
776
  'activity',
773
777
  'reshoot',
778
+ 'verify',
774
779
  ].includes(sub)
775
780
  ) {
776
781
  console.log(DOC_USAGE);
@@ -1078,6 +1083,66 @@ async function docCommand() {
1078
1083
  return;
1079
1084
  }
1080
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
+ // Started in the background and polled: the check reads the repository for minutes, and a
1092
+ // single request is cut at 100 seconds by Cloudflare (a 524 whose answer never arrives).
1093
+ let state = await authedCall(cfg, `/ai/documents/${docId}/verify`, {
1094
+ background: true,
1095
+ });
1096
+ const started = Date.now();
1097
+ if (!asJson) process.stdout.write('\n Workover AI is reading the repository');
1098
+ while (state?.status === 'running' && Date.now() - started < 30 * 60 * 1000) {
1099
+ await new Promise((r) => setTimeout(r, 10_000));
1100
+ if (!asJson) process.stdout.write('.');
1101
+ state = await authedCall(cfg, `/ai/documents/${docId}/verify`);
1102
+ }
1103
+ if (!asJson) process.stdout.write('\n');
1104
+ if (state?.status === 'failed') {
1105
+ console.error(`\n \x1b[31m✗\x1b[0m ${state.error}\n`);
1106
+ process.exit(1);
1107
+ }
1108
+ if (state?.status !== 'done') {
1109
+ console.error('\n \x1b[31m✗\x1b[0m The check did not finish in 30 minutes.\n');
1110
+ process.exit(1);
1111
+ }
1112
+ const res = state.result;
1113
+ const list = Array.isArray(res?.corrections) ? res.corrections : null;
1114
+ if (asJson && !res?.changed) return console.log(JSON.stringify(res, null, 2));
1115
+ if (!res?.changed) {
1116
+ console.log(
1117
+ list === null
1118
+ ? `\n Workover AI could not produce a check it trusts for document #${docId}; nothing changed.\n`
1119
+ : `\n Workover AI checked document #${docId} against ${res?.repo} and found nothing to correct.\n`,
1120
+ );
1121
+ return;
1122
+ }
1123
+ const note =
1124
+ typeof flags.note === 'string'
1125
+ ? flags.note
1126
+ : `Fact-checked by Workover AI against ${res.repo}` +
1127
+ (list ? ` (${list.length} correction${list.length === 1 ? '' : 's'})` : '');
1128
+ const direct = flags.write === true;
1129
+ const applied = await authedCall(
1130
+ cfg,
1131
+ `/project/doc/${docId}/${direct ? 'content' : 'propose'}`,
1132
+ { markdown: res.html, note, source: 'Workover CLI' },
1133
+ );
1134
+ if (asJson) return console.log(JSON.stringify({ ...res, applied }, null, 2));
1135
+ console.log(
1136
+ `\n \x1b[32m✓\x1b[0m Workover AI checked document #${docId} against ${res.repo}. ` +
1137
+ (direct ? 'Written directly.' : 'Left as suggestions to accept.'),
1138
+ );
1139
+ for (const c of list ?? []) console.log(` - ${c}`);
1140
+ if (list === null) console.log(' (It changed the text but did not list what it changed.)');
1141
+ if (applied?.documentUrl) console.log(` ${applied.documentUrl}`);
1142
+ console.log('');
1143
+ return;
1144
+ }
1145
+
1081
1146
  if (sub === 'activity') {
1082
1147
  const docId = docIdArg(positionals, 'workover doc activity <docId>');
1083
1148
  const limit = rowId(flags.limit) ?? 20;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/cli",
3
- "version": "0.9.0",
3
+ "version": "0.11.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",