adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
117 lines ⢠5.19 kB
JavaScript
/**
* Status Command Handler
* Displays comprehensive system status, configuration, and AI provider information
*/
import { existsSync } from 'fs';
import { join } from 'path';
import process from 'process';
import { config as dotenvConfig } from 'dotenv';
import { createRequire } from 'module';
import { REQUIRED_FILES, DEFAULT_OUTPUT_DIR } from '../constants.js';
const require = createRequire(import.meta.url);
const { version } = require('../../package.json');
/**
* Helper to check for provider config and display its status
*/
const checkProvider = (name, envVars, details) => {
const isConfigured = envVars.every(v => !!process.env[v]);
console.log(`\n ${name}:`);
console.log(` Status: ${isConfigured ? 'ā
Configured' : 'ā Not Configured'}`);
if (isConfigured) {
details();
}
};
/**
* Check file existence and report status
*/
const checkFiles = () => {
console.log('\nš PROJECT FILES:');
REQUIRED_FILES.forEach(file => {
const exists = existsSync(join(process.cwd(), file.name));
const status = exists ? 'ā
Found' : (file.required ? 'ā Missing (Required)' : 'ā ļø Missing (Optional)');
console.log(` ${file.name}: ${status}`);
});
};
/**
* Check AI provider configurations
*/
const checkAIProviders = () => {
console.log('\nš¤ AI PROVIDER STATUS:');
checkProvider('š£ Google AI Studio', ['GOOGLE_AI_API_KEY'], () => {
console.log(` Model: ${process.env.GOOGLE_AI_MODEL || 'gemini-1.5-flash'}`);
console.log(` Endpoint: ${process.env.GOOGLE_AI_ENDPOINT || 'https://generativelanguage.googleapis.com'}`);
});
checkProvider('š¢ GitHub AI', ['GITHUB_TOKEN'], () => {
console.log(` Endpoint: ${process.env.GITHUB_ENDPOINT || 'https://models.github.ai/inference/'}`);
console.log(` Model: ${process.env.GITHUB_MODEL || process.env.REQUIREMENTS_AGENT_MODEL || 'gpt-4o-mini'}`);
});
checkProvider('š· Azure OpenAI', ['AZURE_OPENAI_ENDPOINT'], () => {
if (process.env.USE_ENTRA_ID === 'true') {
console.log(` Auth: Entra ID`);
console.log(` Tenant: ${process.env.AZURE_TENANT_ID ? 'ā
Set' : 'ā Missing'}`);
}
else {
console.log(` Auth: API Key`);
console.log(` API Key: ${process.env.AZURE_OPENAI_API_KEY ? 'ā
Set' : 'ā Missing'}`);
}
console.log(` Deployment: ${process.env.AZURE_OPENAI_DEPLOYMENT_NAME || process.env.DEPLOYMENT_NAME || 'Not set'}`);
console.log(` API Version: ${process.env.AZURE_OPENAI_API_VERSION || '2024-02-15-preview'}`);
});
checkProvider('š¦ Ollama', ['OLLAMA_ENDPOINT'], () => {
console.log(` Endpoint: ${process.env.OLLAMA_ENDPOINT}`);
console.log(` Model: ${process.env.OLLAMA_MODEL || 'Not specified'}`);
});
};
/**
* Check current provider configuration
*/
const checkCurrentProvider = () => {
console.log('\nāļø CURRENT CONFIGURATION:');
const currentProvider = process.env.CURRENT_PROVIDER;
if (currentProvider) {
console.log(` Active Provider: ${currentProvider}`);
}
else {
console.log(' Active Provider: ā Not set (check CURRENT_PROVIDER in .env)');
}
const outputDir = process.env.DEFAULT_OUTPUT_DIR || DEFAULT_OUTPUT_DIR;
console.log(` Output Directory: ${outputDir}`);
const debugMode = process.env.DEBUG === 'true';
console.log(` Debug Mode: ${debugMode ? 'ā
Enabled' : 'ā Disabled'}`);
};
/**
* Main status command handler
*/
export async function handleStatusCommand() {
console.log('\nš Requirements Gathering Agent - System Status\n');
// Version and environment info
console.log('š VERSION INFO:');
console.log(` š CLI Version: ${version}`);
console.log(` š Working Directory: ${process.cwd()}`);
console.log(` š¢ Node.js: ${process.version}`);
console.log(` š» Platform: ${process.platform} (${process.arch})`);
// Load environment variables
const envPath = join(process.cwd(), '.env');
if (existsSync(envPath)) {
console.log('\nā
Loading .env configuration...');
dotenvConfig(); // Load .env to check variables
checkCurrentProvider();
checkAIProviders();
}
else {
console.log('\nā .env file not found');
console.log(' Run `rga setup` to configure AI providers.');
}
checkFiles();
// System resources
console.log('\nš¾ SYSTEM RESOURCES:');
const memUsage = process.memoryUsage();
console.log(` Memory Usage: ${Math.round(memUsage.heapUsed / 1024 / 1024)}MB / ${Math.round(memUsage.heapTotal / 1024 / 1024)}MB`);
console.log(` Uptime: ${Math.round(process.uptime())}s`);
console.log('\nš HELP:');
console.log(' ⢠Run `rga setup` to configure AI providers');
console.log(' ⢠Run `rga list-templates` to see available document types');
console.log(' ⢠Run `rga generate-core-analysis` to start generating documents');
console.log(' ⢠Run `rga --help` for all available commands\n');
}
//# sourceMappingURL=status.js.map