erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
163 lines (156 loc) • 5.26 kB
JavaScript
/**
* Claude Code Features - Unified Integration Module
*
* This module exports all Claude Code style features integrated into erosolar-cli.
* Use this as the main entry point for accessing the new capabilities.
*
* Features included:
* - Checkpointing/Rewind System
* - EROSOLAR.md Memory System
* - Output Styles
* - Cost Tracking
* - Update Manager
* - Vim Mode
* - Keyboard Shortcuts
*/
// Re-export all feature modules
export * from './checkpoint.js';
export * from './memorySystem.js';
export * from './outputStyles.js';
export * from './costTracker.js';
export * from './updateManager.js';
// Import for unified initialization
import { getCheckpointManager } from './checkpoint.js';
import { getMemorySystem, formatMemoryForPrompt } from './memorySystem.js';
import { getOutputStyle, getCurrentStyleId, formatStyleForPrompt } from './outputStyles.js';
import { getCostTracker } from './costTracker.js';
import { checkForUpdates, isUpdateCheckDue } from './updateManager.js';
/**
* Initialize all Claude Code features
*/
export async function initializeClaudeCodeFeatures(workingDir, sessionId) {
// Initialize checkpoint manager
const checkpointManager = getCheckpointManager(workingDir);
// Initialize memory system and load memory files
const memorySystem = getMemorySystem();
const memory = memorySystem.loadAllMemory(workingDir);
// Initialize cost tracker
const costTracker = getCostTracker(sessionId);
// Check for updates (non-blocking)
let lastUpdateCheck = null;
if (isUpdateCheckDue()) {
try {
const result = await checkForUpdates();
if (result.success && result.versionInfo) {
lastUpdateCheck = result.versionInfo;
}
}
catch {
// Ignore update check errors
}
}
return {
checkpointManager,
memorySystem,
costTracker,
currentOutputStyle: getCurrentStyleId(),
memory,
lastUpdateCheck,
};
}
/**
* Build system prompt additions from Claude Code features
*/
export function buildSystemPromptAdditions(state, workingDir) {
const additions = [];
// Add memory content
if (state.memory.length > 0) {
additions.push(formatMemoryForPrompt(state.memory));
}
// Add output style
const style = getOutputStyle(state.currentOutputStyle, workingDir);
if (style) {
additions.push(formatStyleForPrompt(style));
}
return additions.join('\n');
}
export function checkFeatureAvailability() {
return {
checkpointing: true,
memory: true,
outputStyles: true,
costTracking: true,
vimMode: true,
updates: true,
};
}
/**
* Format feature status for /doctor command
*/
export function formatFeatureStatus() {
const features = checkFeatureAvailability();
const lines = [
'Claude Code Features:',
'',
];
const formatStatus = (name, available, extra) => {
const icon = available ? '✓' : '✗';
const status = available ? 'enabled' : 'disabled';
return ` ${icon} ${name}: ${status}${extra ? ` (${extra})` : ''}`;
};
lines.push(formatStatus('Checkpointing', features.checkpointing, '/rewind'));
lines.push(formatStatus('Memory System', features.memory, 'EROSOLAR.md'));
lines.push(formatStatus('Output Styles', features.outputStyles, '/output-style'));
lines.push(formatStatus('Cost Tracking', features.costTracking, '/cost'));
lines.push(formatStatus('Vim Mode', features.vimMode, '/vim'));
lines.push(formatStatus('Auto Updates', features.updates, '/update'));
return lines.join('\n');
}
/**
* Help text for Claude Code features
*/
export function formatClaudeCodeHelp() {
return `
Claude Code Features in Erosolar CLI
=====================================
Checkpointing & Rewind (/rewind)
Automatic snapshots before code changes
Rewind to any checkpoint (code only, conversation only, or both)
Press Esc+Esc to open rewind menu
Memory System (EROSOLAR.md)
Hierarchical memory files for persistent context
~/.erosolar/EROSOLAR.md (user preferences)
./EROSOLAR.md (project memory)
Use @path/to/file to reference files in prompts
Use # prefix to quickly add to memory
Output Styles (/output-style)
default - Standard efficient coding mode
explanatory - Educational with detailed explanations
learning - Collaborative with TODO(human) markers
concise - Minimal output, code-focused only
Custom styles in ~/.erosolar/output-styles/
Cost Tracking (/cost, /usage)
Real-time token usage and cost display
Session and lifetime tracking
Breakdown by model
Vim Mode (/vim)
Toggle vim-style editing in input
Normal/Insert/Visual modes
Standard vim navigation (hjkl, w/b, etc.)
Keyboard Shortcuts
Ctrl+C Cancel/Clear
Ctrl+D Exit
Ctrl+B Background task
Esc+Esc Rewind menu
Shift+Tab Cycle edit modes
Tab Cycle thinking modes
Alt+V Toggle verification
Alt+C Toggle auto-continue
Alt+T Toggle thinking
PageUp/Down Scroll output
Updates (/update)
Check for new versions
Auto-update CLI
`.trim();
}
//# sourceMappingURL=claudeCodeFeatures.js.map