sophia-code
Version:
Production-ready agentic CLI code editor with AI-powered coding assistance, planning, and multi-agent delegation. Enterprise-grade security and reliability.
66 lines (59 loc) • 1.79 kB
JavaScript
/**
* Sophia Code - AI Coding Assistant
* Main library entry point
*/
const path = require('path');
const fs = require('fs');
class SophiaCode {
constructor(options = {}) {
this.packageRoot = path.resolve(__dirname, '..');
this.options = {
apiKey: options.apiKey || process.env.GROQ_API_KEY,
model: options.model || 'openai/gpt-oss-120b',
temperature: options.temperature || 0.7,
maxTokens: options.maxTokens || 4096,
...options
};
}
/**
* Check if Sophia is properly installed and configured
*/
isReady() {
const venvPath = path.join(this.packageRoot, '.venv');
const cliPath = path.join(this.packageRoot, 'src', 'cli.py');
return {
venvExists: fs.existsSync(venvPath),
cliExists: fs.existsSync(cliPath),
apiKeySet: !!this.options.apiKey,
ready: fs.existsSync(venvPath) && fs.existsSync(cliPath) && !!this.options.apiKey
};
}
/**
* Get package information
*/
getInfo() {
const packageJson = require(path.join(this.packageRoot, 'package.json'));
return {
name: packageJson.name,
version: packageJson.version,
description: packageJson.description,
packageRoot: this.packageRoot
};
}
/**
* Get paths to important files
*/
getPaths() {
return {
root: this.packageRoot,
venv: path.join(this.packageRoot, '.venv'),
python: process.platform === 'win32'
? path.join(this.packageRoot, '.venv', 'Scripts', 'python.exe')
: path.join(this.packageRoot, '.venv', 'bin', 'python'),
cli: path.join(this.packageRoot, 'src', 'cli.py'),
src: path.join(this.packageRoot, 'src'),
config: path.join(require('os').homedir(), '.sophia')
};
}
}
module.exports = SophiaCode;