sam-coder-cli
Version:
SAM-CODER: An animated command-line AI assistant with agency capabilities.
109 lines (92 loc) • 2.98 kB
JavaScript
const chalk = require('chalk');
const ora = require('ora');
const spinner = ora({ text: 'Thinking...', color: 'yellow', spinner: 'pipe' });
// ASCII Art for AGI header
const AGI_HEADER = `
╔═══════════════════════════════════════╗
║ A G I - C L I ║
║ Artificial General Intelligence ║
║ Command Line Interface ║
╚═══════════════════════════════════════╝
`;
function showHeader() {
console.log(chalk.cyan.bold(AGI_HEADER));
console.log(chalk.gray('─'.repeat(41)));
console.log();
}
function showLegacyHeader() {
console.log(chalk.bold.magenta('================='));
console.log(chalk.bold.magenta(' SAM-CODER '));
console.log(chalk.bold.magenta('================='));
console.log();
}
function startThinking() {
spinner.start();
}
function stopThinking() {
spinner.stop();
}
function showResponse(response) {
stopThinking();
console.log(chalk.cyan(response));
}
function showError(error) {
stopThinking();
console.error(chalk.red('Error:', error));
}
function showAction(action) {
console.log(chalk.yellow(` -> ${action}`));
}
function showSystemMessage(message) {
console.log(chalk.greenBright(`[SYSTEM] ${message}`));
}
function showWarning(message) {
console.log(chalk.yellowBright(`⚠️ ${message}`));
}
function showSuccess(message) {
console.log(chalk.greenBright(`✅ ${message}`));
}
function showInfo(message) {
console.log(chalk.blueBright(`ℹ️ ${message}`));
}
function showAGIStatus(status) {
const statusBox = `
┌─────────────────────────────┐
│ AGI Status: ${status.padEnd(15)} │
└─────────────────────────────┘
`;
console.log(chalk.cyanBright(statusBox));
}
function showThought(thought) {
if (!thought) return;
const top = chalk.gray('┌' + '─'.repeat(30) + '┐');
const title = chalk.magenta.bold('│ ✧ Thinking');
const pad = ' '.repeat(Math.max(0, 30 - ' ✧ Thinking'.length));
const titleLine = title + pad + chalk.gray(' │');
const separator = chalk.gray('├' + '─'.repeat(30) + '┤');
const bottom = chalk.gray('└' + '─'.repeat(30) + '┘');
console.log(top);
console.log(titleLine);
console.log(separator);
// Print each line of thought dimmed
String(thought).split('\n').forEach(line => {
const truncated = line; // keep full line; rely on terminal wrap
console.log(chalk.gray('│ ') + chalk.dim(truncated) + chalk.gray(' │'));
});
console.log(bottom);
}
module.exports = {
showHeader,
showLegacyHeader,
startThinking,
stopThinking,
showResponse,
showError,
showAction,
showSystemMessage,
showWarning,
showSuccess,
showInfo,
showAGIStatus,
showThought
};