@optiqcode/cli 2.1.6 → 2.1.8
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/commands/index.js +2 -2
- package/dist/index.js +45 -11
- package/package.json +1 -1
package/dist/commands/index.js
CHANGED
|
@@ -74,8 +74,8 @@ export async function index(options) {
|
|
|
74
74
|
spinner.text = 'Indexing with Optiq Engine...';
|
|
75
75
|
// Generate repository ID from path
|
|
76
76
|
const repoId = generateRepoId(targetPath);
|
|
77
|
-
// Batch upload files (
|
|
78
|
-
const BATCH_SIZE =
|
|
77
|
+
// Batch upload files (3 at a time to avoid Cloudflare gateway timeouts)
|
|
78
|
+
const BATCH_SIZE = 3;
|
|
79
79
|
let uploadedCount = 0;
|
|
80
80
|
let totalChunksCreated = 0;
|
|
81
81
|
for (let i = 0; i < fileContents.length; i += BATCH_SIZE) {
|
package/dist/index.js
CHANGED
|
@@ -298,8 +298,8 @@ async function indexOnce(targetPath, config) {
|
|
|
298
298
|
}
|
|
299
299
|
// Generate repository ID from path
|
|
300
300
|
const repoId = generateRepoId(targetPath);
|
|
301
|
-
// Upload in small batches to avoid gateway timeouts
|
|
302
|
-
const BATCH_SIZE =
|
|
301
|
+
// Upload in small batches to avoid Cloudflare gateway timeouts
|
|
302
|
+
const BATCH_SIZE = 3;
|
|
303
303
|
let totalChunks = 0;
|
|
304
304
|
if (DEBUG) {
|
|
305
305
|
console.log(chalk.gray(`\n[DEBUG] Sending to: ${ENGINE_URL}/api/v1/index`));
|
|
@@ -401,8 +401,8 @@ async function watchDirectory(targetPath, config) {
|
|
|
401
401
|
}
|
|
402
402
|
spinner.text = `Reading... ${Math.min(i + PARALLEL_READS, files.length)}/${files.length}`;
|
|
403
403
|
}
|
|
404
|
-
// Upload in small batches to avoid gateway timeouts
|
|
405
|
-
const BATCH_SIZE =
|
|
404
|
+
// Upload in small batches to avoid Cloudflare gateway timeouts
|
|
405
|
+
const BATCH_SIZE = 3;
|
|
406
406
|
for (let i = 0; i < filesArray.length; i += BATCH_SIZE) {
|
|
407
407
|
const batch = filesArray.slice(i, i + BATCH_SIZE);
|
|
408
408
|
const batchNum = Math.floor(i / BATCH_SIZE) + 1;
|
|
@@ -433,9 +433,23 @@ async function watchDirectory(targetPath, config) {
|
|
|
433
433
|
catch (err) {
|
|
434
434
|
lastError = err;
|
|
435
435
|
retries--;
|
|
436
|
+
spinner.stop();
|
|
437
|
+
// Print detailed error info
|
|
438
|
+
console.log(chalk.red(`\n✗ Batch ${batchNum}/${totalBatches} failed`));
|
|
439
|
+
console.log(chalk.yellow(` Status: ${err.response?.status || 'N/A'}`));
|
|
440
|
+
console.log(chalk.yellow(` Code: ${err.code || 'N/A'}`));
|
|
441
|
+
console.log(chalk.yellow(` Message: ${err.message}`));
|
|
442
|
+
if (err.response?.data) {
|
|
443
|
+
console.log(chalk.yellow(` Response: ${JSON.stringify(err.response.data, null, 2)}`));
|
|
444
|
+
}
|
|
445
|
+
if (err.response?.headers) {
|
|
446
|
+
console.log(chalk.gray(` Server: ${err.response.headers['server'] || 'unknown'}`));
|
|
447
|
+
console.log(chalk.gray(` CF-Ray: ${err.response.headers['cf-ray'] || 'N/A'}`));
|
|
448
|
+
}
|
|
436
449
|
if (retries > 0) {
|
|
437
|
-
|
|
450
|
+
console.log(chalk.gray(` Retrying in 2s... (${retries} attempts left)\n`));
|
|
438
451
|
await new Promise(r => setTimeout(r, 2000));
|
|
452
|
+
spinner.start(`Retrying batch ${batchNum}...`);
|
|
439
453
|
}
|
|
440
454
|
}
|
|
441
455
|
}
|
|
@@ -448,12 +462,21 @@ async function watchDirectory(targetPath, config) {
|
|
|
448
462
|
}
|
|
449
463
|
catch (error) {
|
|
450
464
|
spinner.fail(chalk.red('Failed'));
|
|
451
|
-
|
|
452
|
-
|
|
465
|
+
console.log(chalk.red('\n═══ DETAILED ERROR ═══'));
|
|
466
|
+
console.log(chalk.yellow(`Status: ${error.response?.status || 'N/A'}`));
|
|
467
|
+
console.log(chalk.yellow(`Code: ${error.code || 'N/A'}`));
|
|
468
|
+
console.log(chalk.yellow(`Message: ${error.message}`));
|
|
469
|
+
if (error.response?.data) {
|
|
470
|
+
console.log(chalk.yellow(`Response Body:`));
|
|
471
|
+
console.log(chalk.gray(JSON.stringify(error.response.data, null, 2)));
|
|
453
472
|
}
|
|
454
|
-
|
|
455
|
-
console.log(chalk.gray(
|
|
473
|
+
if (error.response?.headers) {
|
|
474
|
+
console.log(chalk.gray(`\nHeaders:`));
|
|
475
|
+
console.log(chalk.gray(` Server: ${error.response.headers['server'] || 'unknown'}`));
|
|
476
|
+
console.log(chalk.gray(` CF-Ray: ${error.response.headers['cf-ray'] || 'N/A'}`));
|
|
477
|
+
console.log(chalk.gray(` Content-Type: ${error.response.headers['content-type'] || 'N/A'}`));
|
|
456
478
|
}
|
|
479
|
+
console.log(chalk.red('═══════════════════════\n'));
|
|
457
480
|
return;
|
|
458
481
|
}
|
|
459
482
|
const ignorePatterns = await getGitIgnorePatterns(targetPath);
|
|
@@ -604,11 +627,22 @@ async function watchDirectory(targetPath, config) {
|
|
|
604
627
|
}
|
|
605
628
|
}
|
|
606
629
|
catch (error) {
|
|
607
|
-
// Clear dashboard, show error
|
|
630
|
+
// Clear dashboard, show error
|
|
608
631
|
process.stdout.write('\x1b[5A');
|
|
609
632
|
process.stdout.write('\x1b[0J');
|
|
610
633
|
dashboardShown = false;
|
|
611
|
-
console.log(chalk.red(
|
|
634
|
+
console.log(chalk.red('\n═══ INDEX ERROR ═══'));
|
|
635
|
+
console.log(chalk.yellow(`Status: ${error.response?.status || 'N/A'}`));
|
|
636
|
+
console.log(chalk.yellow(`Code: ${error.code || 'N/A'}`));
|
|
637
|
+
console.log(chalk.yellow(`Message: ${error.message}`));
|
|
638
|
+
if (error.response?.data) {
|
|
639
|
+
console.log(chalk.yellow(`Response: ${JSON.stringify(error.response.data, null, 2)}`));
|
|
640
|
+
}
|
|
641
|
+
if (error.response?.headers) {
|
|
642
|
+
console.log(chalk.gray(`Server: ${error.response.headers['server'] || 'unknown'}`));
|
|
643
|
+
console.log(chalk.gray(`CF-Ray: ${error.response.headers['cf-ray'] || 'N/A'}`));
|
|
644
|
+
}
|
|
645
|
+
console.log(chalk.red('═══════════════════\n'));
|
|
612
646
|
showDashboard();
|
|
613
647
|
}
|
|
614
648
|
isProcessing = false;
|