@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.
@@ -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 (20 at a time to avoid gateway timeouts)
78
- const BATCH_SIZE = 20;
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 = 5;
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 = 5;
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
- spinner.text = `Retrying batch ${batchNum}... (${retries} left)`;
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
- if (error.response?.data?.error) {
452
- console.log(chalk.gray(' ' + error.response.data.error));
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
- else {
455
- console.log(chalk.gray(' ' + error.message));
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, redraw dashboard
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(`✗ Failed to index: ${error.response?.data?.error || error.message}\n`));
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optiqcode/cli",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "CLI tool for Optiq - automatic code indexing and context engine",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",