jasper-recall 0.4.1 → 0.4.2
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/cli/doctor.js +60 -0
- package/package.json +1 -1
package/cli/doctor.js
CHANGED
|
@@ -382,9 +382,69 @@ function runDoctor(options = {}) {
|
|
|
382
382
|
|
|
383
383
|
module.exports = { runDoctor };
|
|
384
384
|
|
|
385
|
+
// JSON output for integration with exo doctor
|
|
386
|
+
function runDoctorJson() {
|
|
387
|
+
const checks = {};
|
|
388
|
+
let status = 'healthy';
|
|
389
|
+
|
|
390
|
+
// Node.js
|
|
391
|
+
const nodeResult = exec('node --version');
|
|
392
|
+
checks.node = nodeResult.success ? nodeResult.output.trim() : 'missing';
|
|
393
|
+
|
|
394
|
+
// Python
|
|
395
|
+
const pythonResult = exec('python3 --version');
|
|
396
|
+
const pythonMatch = pythonResult.output.match(/Python ([\d.]+)/);
|
|
397
|
+
checks.python = pythonMatch ? pythonMatch[1] : 'missing';
|
|
398
|
+
|
|
399
|
+
// Venv
|
|
400
|
+
checks.venv = fs.existsSync(VENV_PATH) ? 'ok' : 'missing';
|
|
401
|
+
if (checks.venv === 'missing') status = 'degraded';
|
|
402
|
+
|
|
403
|
+
// ChromaDB
|
|
404
|
+
const pipPath = path.join(VENV_PATH, 'bin', 'pip');
|
|
405
|
+
const chromaResult = exec(`${pipPath} show chromadb 2>/dev/null`);
|
|
406
|
+
const chromaMatch = chromaResult.output.match(/Version: ([\d.]+)/);
|
|
407
|
+
checks.chromadb = chromaMatch ? chromaMatch[1] : 'missing';
|
|
408
|
+
if (checks.chromadb === 'missing') status = 'degraded';
|
|
409
|
+
|
|
410
|
+
// Database
|
|
411
|
+
const chromaExists = fs.existsSync(CHROMA_PATH);
|
|
412
|
+
const collections = countCollections();
|
|
413
|
+
checks.database = chromaExists ? `${collections} collections` : 'missing';
|
|
414
|
+
if (!chromaExists) status = 'error';
|
|
415
|
+
|
|
416
|
+
// Memory files
|
|
417
|
+
const memoryCount = countMemoryFiles();
|
|
418
|
+
checks.indexed = memoryCount;
|
|
419
|
+
|
|
420
|
+
// Last index time
|
|
421
|
+
const lastIndexMs = getLastIndexTime();
|
|
422
|
+
checks.lastIndex = lastIndexMs ? formatTime(lastIndexMs) : 'never';
|
|
423
|
+
|
|
424
|
+
// Get version
|
|
425
|
+
let version = 'unknown';
|
|
426
|
+
try {
|
|
427
|
+
version = require('../package.json').version;
|
|
428
|
+
} catch {}
|
|
429
|
+
|
|
430
|
+
return {
|
|
431
|
+
status,
|
|
432
|
+
version,
|
|
433
|
+
checks
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
module.exports = { runDoctor, runDoctorJson };
|
|
438
|
+
|
|
385
439
|
// Allow direct execution
|
|
386
440
|
if (require.main === module) {
|
|
387
441
|
const args = process.argv.slice(2);
|
|
442
|
+
|
|
443
|
+
if (args.includes('--json')) {
|
|
444
|
+
console.log(JSON.stringify(runDoctorJson(), null, 2));
|
|
445
|
+
process.exit(0);
|
|
446
|
+
}
|
|
447
|
+
|
|
388
448
|
const options = {
|
|
389
449
|
fix: args.includes('--fix'),
|
|
390
450
|
dryRun: args.includes('--dry-run')
|