@workover/cli 0.10.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/bin/workover.mjs +22 -1
- package/package.json +1 -1
package/bin/workover.mjs
CHANGED
|
@@ -1088,7 +1088,28 @@ async function docCommand() {
|
|
|
1088
1088
|
// Nothing is passed in but the id: the corrections have to come from the source, not from us.
|
|
1089
1089
|
// The result is applied as suggestions (or written with --write), like `reshoot`.
|
|
1090
1090
|
const docId = docIdArg(positionals, 'workover doc verify <docId> [--write] [--note "<why>"]');
|
|
1091
|
-
|
|
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;
|
|
1092
1113
|
const list = Array.isArray(res?.corrections) ? res.corrections : null;
|
|
1093
1114
|
if (asJson && !res?.changed) return console.log(JSON.stringify(res, null, 2));
|
|
1094
1115
|
if (!res?.changed) {
|