repowise 0.1.71 → 0.1.73
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/dist/bin/repowise.js +32 -15
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -2366,23 +2366,27 @@ async function create() {
|
|
|
2366
2366
|
process.exitCode = 1;
|
|
2367
2367
|
return;
|
|
2368
2368
|
}
|
|
2369
|
+
let useFreeRescan = false;
|
|
2369
2370
|
try {
|
|
2370
|
-
const pricing = await apiRequest(
|
|
2371
|
-
`/v1/repos/${repoId}/rescan-pricing`
|
|
2372
|
-
);
|
|
2371
|
+
const pricing = await apiRequest(`/v1/repos/${repoId}/rescan-pricing`);
|
|
2373
2372
|
if (pricing.lastFullScanAt) {
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2373
|
+
if (pricing.allowed && pricing.isFree) {
|
|
2374
|
+
spinner.succeed(chalk5.cyan("Free rescan available. Will trigger a full rescan."));
|
|
2375
|
+
useFreeRescan = true;
|
|
2376
|
+
} else {
|
|
2377
|
+
spinner.fail(chalk5.red("This repository already has context generated."));
|
|
2378
|
+
console.log(
|
|
2379
|
+
chalk5.cyan(
|
|
2380
|
+
`
|
|
2378
2381
|
To trigger a new full scan, visit the dashboard:
|
|
2379
2382
|
https://app.repowise.ai/repos/${repoId}
|
|
2380
2383
|
`
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2384
|
+
)
|
|
2385
|
+
);
|
|
2386
|
+
console.log(chalk5.dim(" To sync recent changes, use: repowise sync\n"));
|
|
2387
|
+
process.exitCode = 1;
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2386
2390
|
}
|
|
2387
2391
|
} catch {
|
|
2388
2392
|
}
|
|
@@ -2405,9 +2409,10 @@ async function create() {
|
|
|
2405
2409
|
spinner.start("Starting context generation pipeline...");
|
|
2406
2410
|
let syncId;
|
|
2407
2411
|
try {
|
|
2408
|
-
const
|
|
2412
|
+
const endpoint = useFreeRescan ? `/v1/repos/${repoId}/full-rescan` : `/v1/repos/${repoId}/sync`;
|
|
2413
|
+
const triggerResult = await apiRequest(endpoint, {
|
|
2409
2414
|
method: "POST",
|
|
2410
|
-
body: JSON.stringify({ scanType: "full", contextStorage })
|
|
2415
|
+
body: useFreeRescan ? void 0 : JSON.stringify({ scanType: "full", contextStorage })
|
|
2411
2416
|
});
|
|
2412
2417
|
syncId = triggerResult.syncId;
|
|
2413
2418
|
} catch (triggerErr) {
|
|
@@ -2430,6 +2435,8 @@ async function create() {
|
|
|
2430
2435
|
spinner.start();
|
|
2431
2436
|
}
|
|
2432
2437
|
let pollAttempts = 0;
|
|
2438
|
+
let pollErrors = 0;
|
|
2439
|
+
const MAX_POLL_ERRORS = 5;
|
|
2433
2440
|
const progressRenderer = new ProgressRenderer();
|
|
2434
2441
|
while (true) {
|
|
2435
2442
|
if (++pollAttempts > MAX_POLL_ATTEMPTS) {
|
|
@@ -2438,7 +2445,17 @@ async function create() {
|
|
|
2438
2445
|
return;
|
|
2439
2446
|
}
|
|
2440
2447
|
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
2441
|
-
|
|
2448
|
+
let syncResult;
|
|
2449
|
+
try {
|
|
2450
|
+
syncResult = await apiRequest(`/v1/sync/${syncId}/status`);
|
|
2451
|
+
pollErrors = 0;
|
|
2452
|
+
} catch (pollErr) {
|
|
2453
|
+
pollErrors++;
|
|
2454
|
+
if (pollErrors >= MAX_POLL_ERRORS) {
|
|
2455
|
+
throw pollErr;
|
|
2456
|
+
}
|
|
2457
|
+
continue;
|
|
2458
|
+
}
|
|
2442
2459
|
progressRenderer.update(syncResult, spinner);
|
|
2443
2460
|
if (syncResult.status === "awaiting_input" && syncResult.questionId && syncResult.questionText) {
|
|
2444
2461
|
spinner.stop();
|