@optiqcode/cli 2.1.8 → 2.6.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/dist/commands/index.js +2 -2
- package/dist/index.js +13 -47
- 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 (20 at a time to avoid gateway timeouts)
|
|
78
|
+
const BATCH_SIZE = 20;
|
|
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
|
@@ -9,7 +9,7 @@ import fs from 'fs/promises';
|
|
|
9
9
|
import { getConfig, saveConfig } from './utils/config.js';
|
|
10
10
|
import { isValidDirectory, getGitIgnorePatterns, shouldIgnoreFile } from './utils/files.js';
|
|
11
11
|
const BACKEND_URL = process.env.OPTIQ_BACKEND_URL || 'https://api.optiqcode.com';
|
|
12
|
-
const ENGINE_URL = process.env.OPTIQ_ENGINE_URL || '
|
|
12
|
+
const ENGINE_URL = process.env.OPTIQ_ENGINE_URL || 'http://25.36.113.3:3002';
|
|
13
13
|
// Debug mode - set OPTIQ_DEBUG=1 to see request details
|
|
14
14
|
const DEBUG = process.env.OPTIQ_DEBUG === '1';
|
|
15
15
|
// Helper to generate repository ID from path
|
|
@@ -32,7 +32,7 @@ async function showBanner() {
|
|
|
32
32
|
|_| |_|
|
|
33
33
|
`));
|
|
34
34
|
console.log(chalk.gray(' AI-powered code indexing & search'));
|
|
35
|
-
console.log(chalk.gray(' v2.
|
|
35
|
+
console.log(chalk.gray(' v2.5.0\n'));
|
|
36
36
|
}
|
|
37
37
|
function showHelp() {
|
|
38
38
|
console.log(chalk.cyan.bold('Optiq CLI') + chalk.gray(' - AI-powered code indexing\n'));
|
|
@@ -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
|
|
302
|
-
const BATCH_SIZE =
|
|
301
|
+
// Upload in small batches to avoid gateway timeouts
|
|
302
|
+
const BATCH_SIZE = 5;
|
|
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
|
|
405
|
-
const BATCH_SIZE =
|
|
404
|
+
// Upload in small batches to avoid gateway timeouts
|
|
405
|
+
const BATCH_SIZE = 50;
|
|
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,23 +433,9 @@ 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
|
-
}
|
|
449
436
|
if (retries > 0) {
|
|
450
|
-
|
|
437
|
+
spinner.text = `Retrying batch ${batchNum}... (${retries} left)`;
|
|
451
438
|
await new Promise(r => setTimeout(r, 2000));
|
|
452
|
-
spinner.start(`Retrying batch ${batchNum}...`);
|
|
453
439
|
}
|
|
454
440
|
}
|
|
455
441
|
}
|
|
@@ -462,21 +448,12 @@ async function watchDirectory(targetPath, config) {
|
|
|
462
448
|
}
|
|
463
449
|
catch (error) {
|
|
464
450
|
spinner.fail(chalk.red('Failed'));
|
|
465
|
-
|
|
466
|
-
|
|
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)));
|
|
451
|
+
if (error.response?.data?.error) {
|
|
452
|
+
console.log(chalk.gray(' ' + error.response.data.error));
|
|
472
453
|
}
|
|
473
|
-
|
|
474
|
-
console.log(chalk.gray(
|
|
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'}`));
|
|
454
|
+
else {
|
|
455
|
+
console.log(chalk.gray(' ' + error.message));
|
|
478
456
|
}
|
|
479
|
-
console.log(chalk.red('═══════════════════════\n'));
|
|
480
457
|
return;
|
|
481
458
|
}
|
|
482
459
|
const ignorePatterns = await getGitIgnorePatterns(targetPath);
|
|
@@ -627,22 +604,11 @@ async function watchDirectory(targetPath, config) {
|
|
|
627
604
|
}
|
|
628
605
|
}
|
|
629
606
|
catch (error) {
|
|
630
|
-
// Clear dashboard, show error
|
|
607
|
+
// Clear dashboard, show error, redraw dashboard
|
|
631
608
|
process.stdout.write('\x1b[5A');
|
|
632
609
|
process.stdout.write('\x1b[0J');
|
|
633
610
|
dashboardShown = false;
|
|
634
|
-
console.log(chalk.red(
|
|
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'));
|
|
611
|
+
console.log(chalk.red(`✗ Failed to index: ${error.response?.data?.error || error.message}\n`));
|
|
646
612
|
showDashboard();
|
|
647
613
|
}
|
|
648
614
|
isProcessing = false;
|