vibehub-cli
Version:
VibeHub CLI - Command line interface for VibeHub
79 lines ⢠4.25 kB
JavaScript
import { Command } from 'commander';
import chalk from 'chalk';
import { VibeHubManager } from '../lib/vibehub-manager.js';
export const statusCommand = new Command('status')
.description('Show the status of the VibeHub repository')
.option('-v, --verbose', 'Show detailed information')
.action(async (options) => {
const cwd = process.cwd();
const vibehubManager = new VibeHubManager(cwd);
try {
const status = await vibehubManager.getStatus();
if (!status.initialized) {
console.log(chalk.red('ā Not a VibeHub repository'));
console.log(chalk.blue('Run ') + chalk.cyan('vibe init') + chalk.blue(' to initialize a new repository'));
return;
}
const config = status.config;
console.log(chalk.blue('š VibeHub Repository Status\n'));
// Basic info
console.log(chalk.white('Project: ') + chalk.cyan(config.projectName));
if (config.description) {
console.log(chalk.white('Description: ') + chalk.gray(config.description));
}
console.log(chalk.white('Author: ') + chalk.gray(config.author?.name || 'Unknown'));
console.log(chalk.white('Email: ') + chalk.gray(config.author?.email || 'Not set'));
console.log(chalk.white('Created: ') + chalk.gray(new Date(config.createdAt).toLocaleDateString()));
console.log(chalk.white('Version: ') + chalk.gray(config.version));
// Stats
console.log(chalk.white('\nš Statistics:'));
console.log(chalk.white(' Sessions: ') + chalk.cyan(status.sessionCount));
console.log(chalk.white(' Commits: ') + chalk.cyan(status.commitCount));
if (status.lastActivity) {
console.log(chalk.white(' Last Activity: ') + chalk.gray(new Date(status.lastActivity).toLocaleString()));
}
// Auto-sync status
console.log(chalk.white('\nš Auto-sync: ') + (config.config?.autoSync ? chalk.green('Enabled') : chalk.yellow('Disabled')));
// Cloud connection status
if (config.cloud) {
console.log(chalk.white('\nāļø Cloud Connection: ') + chalk.green('Connected'));
console.log(chalk.white(' Project URL: ') + chalk.cyan(config.cloud.projectUrl));
console.log(chalk.white(' API URL: ') + chalk.cyan(config.cloud.apiUrl));
console.log(chalk.white(' User Email: ') + chalk.cyan(config.cloud.userEmail || 'Not set'));
// Check authentication status
if (config.author?.email && config.cloud.userEmail) {
if (config.author.email === config.cloud.userEmail) {
console.log(chalk.white(' Authentication: ') + chalk.green('ā
Verified'));
}
else {
console.log(chalk.white(' Authentication: ') + chalk.red('ā Failed'));
console.log(chalk.white(' Local: ') + chalk.gray(config.author.email));
console.log(chalk.white(' Cloud: ') + chalk.gray(config.cloud.userEmail));
}
}
else {
console.log(chalk.white(' Authentication: ') + chalk.yellow('ā ļø Not configured'));
}
if (config.lastSync) {
console.log(chalk.white(' Last Sync: ') + chalk.gray(new Date(config.lastSync).toLocaleString()));
}
}
else {
console.log(chalk.white('\nāļø Cloud Connection: ') + chalk.yellow('Not Connected'));
console.log(chalk.blue(' Run ') + chalk.cyan('vibe set <project-url>') + chalk.blue(' to connect to a cloud project'));
}
if (options.verbose) {
console.log(chalk.white('\nš Repository Structure:'));
console.log(chalk.gray(' .vibehub/'));
console.log(chalk.gray(' āāā vibehub.json'));
console.log(chalk.gray(' āāā sessions/'));
console.log(chalk.gray(' āāā commits/'));
console.log(chalk.gray(' āāā workspace/'));
}
}
catch (error) {
console.error(chalk.red('Failed to get repository status:'), error);
process.exit(1);
}
});
//# sourceMappingURL=status.js.map