@optiqcode/cli 1.6.0 → 1.8.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/index.js +17 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ async function showBanner() {
|
|
|
21
21
|
|_| |_|
|
|
22
22
|
`));
|
|
23
23
|
console.log(chalk.gray(' AI-powered code indexing & search'));
|
|
24
|
-
console.log(chalk.gray(' v1.
|
|
24
|
+
console.log(chalk.gray(' v1.7.0\n'));
|
|
25
25
|
}
|
|
26
26
|
function showHelp() {
|
|
27
27
|
console.log(chalk.cyan.bold('Optiq CLI') + chalk.gray(' - AI-powered code indexing\n'));
|
|
@@ -62,7 +62,7 @@ async function login() {
|
|
|
62
62
|
if (!otpResponse.data.success) {
|
|
63
63
|
throw new Error('Failed to send code');
|
|
64
64
|
}
|
|
65
|
-
spinner.succeed(chalk.cyan('
|
|
65
|
+
spinner.succeed(chalk.cyan('Code sent\n'));
|
|
66
66
|
const { code } = await prompts({
|
|
67
67
|
type: 'text',
|
|
68
68
|
name: 'code',
|
|
@@ -103,16 +103,16 @@ async function login() {
|
|
|
103
103
|
token: token,
|
|
104
104
|
apiKey: validateResponse.data.context_engine_api_key || '',
|
|
105
105
|
});
|
|
106
|
-
verifySpinner.succeed(chalk.cyan(
|
|
106
|
+
verifySpinner.succeed(chalk.cyan(`Logged in as ${email}\n`));
|
|
107
107
|
return true;
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
|
-
verifySpinner.fail(chalk.red('
|
|
110
|
+
verifySpinner.fail(chalk.red('Invalid code'));
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
catch (error) {
|
|
115
|
-
spinner.fail(chalk.red('
|
|
115
|
+
spinner.fail(chalk.red('Login failed'));
|
|
116
116
|
if (error.response?.data?.error) {
|
|
117
117
|
console.log(chalk.gray(' ' + error.response.data.error));
|
|
118
118
|
}
|
|
@@ -301,7 +301,7 @@ async function indexOnce(targetPath, config) {
|
|
|
301
301
|
timeout: 0,
|
|
302
302
|
});
|
|
303
303
|
if (!response.data.success) {
|
|
304
|
-
spinner.fail(chalk.red('
|
|
304
|
+
spinner.fail(chalk.red('Indexing failed'));
|
|
305
305
|
console.log(chalk.gray(response.data.error || 'Unknown error'));
|
|
306
306
|
return;
|
|
307
307
|
}
|
|
@@ -309,7 +309,7 @@ async function indexOnce(targetPath, config) {
|
|
|
309
309
|
totalFiles += response.data.stats?.files_indexed || 0;
|
|
310
310
|
totalEntities += response.data.stats?.entities_indexed || 0;
|
|
311
311
|
}
|
|
312
|
-
spinner.succeed(chalk.cyan('
|
|
312
|
+
spinner.succeed(chalk.cyan('Indexed'));
|
|
313
313
|
console.log(chalk.gray(` ${totalFiles} files • ${totalEntities} entities`));
|
|
314
314
|
console.log(chalk.cyan('\n📊 Repository ID:'));
|
|
315
315
|
console.log(chalk.white(` ${repoId}`));
|
|
@@ -400,11 +400,11 @@ async function watchDirectory(targetPath, config) {
|
|
|
400
400
|
repoId = response.data.repo_id;
|
|
401
401
|
uploadedCount += batch.length;
|
|
402
402
|
}
|
|
403
|
-
spinner.succeed(chalk.cyan(
|
|
403
|
+
spinner.succeed(chalk.cyan(`Indexed ${files.length} files`));
|
|
404
404
|
console.log(chalk.gray(` Repo ID: ${repoId}\n`));
|
|
405
405
|
}
|
|
406
406
|
catch (error) {
|
|
407
|
-
spinner.fail(chalk.red('
|
|
407
|
+
spinner.fail(chalk.red('Failed'));
|
|
408
408
|
if (error.response?.data?.error) {
|
|
409
409
|
console.log(chalk.gray(' ' + error.response.data.error));
|
|
410
410
|
}
|
|
@@ -414,8 +414,6 @@ async function watchDirectory(targetPath, config) {
|
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
console.log(chalk.cyan('👀 Watching for changes...'));
|
|
418
|
-
console.log(chalk.gray(' Press Ctrl+C to stop\n'));
|
|
419
417
|
const ignorePatterns = await getGitIgnorePatterns(targetPath);
|
|
420
418
|
const watcher = chokidar.watch(targetPath, {
|
|
421
419
|
ignored: (filePath) => {
|
|
@@ -463,7 +461,8 @@ async function watchDirectory(targetPath, config) {
|
|
|
463
461
|
lines.push('');
|
|
464
462
|
logUpdate(lines.join('\n'));
|
|
465
463
|
};
|
|
466
|
-
//
|
|
464
|
+
// Show dashboard immediately and update every 5 seconds
|
|
465
|
+
updateDashboard();
|
|
467
466
|
setInterval(updateDashboard, 5000);
|
|
468
467
|
const processChanges = async () => {
|
|
469
468
|
if (pendingChanges.size === 0 || isProcessing)
|
|
@@ -534,13 +533,15 @@ async function watchDirectory(targetPath, config) {
|
|
|
534
533
|
else {
|
|
535
534
|
logUpdate.clear();
|
|
536
535
|
console.log(chalk.red(`✗ Failed to index`));
|
|
537
|
-
console.log(chalk.gray(` ${response.data.error}`));
|
|
536
|
+
console.log(chalk.gray(` ${response.data.error}\n`));
|
|
537
|
+
updateDashboard();
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
catch (error) {
|
|
541
541
|
logUpdate.clear();
|
|
542
542
|
console.log(chalk.red(`✗ Failed to index`));
|
|
543
|
-
console.log(chalk.gray(` ${error.response?.data?.error || error.message}`));
|
|
543
|
+
console.log(chalk.gray(` ${error.response?.data?.error || error.message}\n`));
|
|
544
|
+
updateDashboard();
|
|
544
545
|
}
|
|
545
546
|
isProcessing = false;
|
|
546
547
|
// Check if there are more pending changes and process them
|
|
@@ -569,7 +570,8 @@ async function watchDirectory(targetPath, config) {
|
|
|
569
570
|
})
|
|
570
571
|
.on('error', (error) => {
|
|
571
572
|
logUpdate.clear();
|
|
572
|
-
console.log(chalk.red('✗ Watcher error:'), chalk.gray(error.message));
|
|
573
|
+
console.log(chalk.red('✗ Watcher error:'), chalk.gray(error.message + '\n'));
|
|
574
|
+
updateDashboard();
|
|
573
575
|
});
|
|
574
576
|
process.on('SIGINT', () => {
|
|
575
577
|
logUpdate.clear();
|