Files
ruflo/src/cli/commands/memory.ts
T
rUv 5ecf29a960 Add comprehensive tests and reporting for Claude-Flow task system
- Implemented mock-based and comprehensive tests for batch task processing.
- Created detailed test results documentation including metrics and performance characteristics.
- Added error handling for unexpected arguments in test execution.
- Generated HTML and JSON reports summarizing test outcomes.
- Established integration tests for agent spawning, task assignment, and execution tracking.
- Enhanced event monitoring for task lifecycle and agent performance.
2025-06-10 17:24:18 +00:00

74 lines
2.9 KiB
TypeScript

/**
* Memory management commands
*/
import { Command } from '@cliffy/command';
import { colors } from '@cliffy/ansi/colors';
import { Table } from '@cliffy/table';
export const memoryCommand = new Command()
.description('Manage agent memory')
.action(() => {
memoryCommand.showHelp();
})
.command('query', new Command()
.description('Query memory entries')
.option('-a, --agent <agent:string>', 'Filter by agent ID')
.option('-s, --session <session:string>', 'Filter by session ID')
.option('-t, --type <type:string>', 'Filter by entry type')
.option('--tags <tags:string>', 'Filter by tags (comma-separated)')
.option('--search <search:string>', 'Search in content')
.option('--limit <limit:number>', 'Limit results', { default: 10 })
.action(async (options: any) => {
console.log(colors.yellow('Memory query requires a running Claude-Flow instance'));
console.log(colors.gray('Query parameters:'));
console.log(JSON.stringify(options, null, 2));
}),
)
.command('export', new Command()
.description('Export memory to file')
.arguments('<output-file:string>')
.option('-a, --agent <agent:string>', 'Export specific agent memory')
.option('-f, --format <format:string>', 'Export format (json, markdown)', {
default: 'json',
})
.action(async (options: any, outputFile: string) => {
console.log(colors.yellow('Memory export requires a running Claude-Flow instance'));
}),
)
.command('import', new Command()
.description('Import memory from file')
.arguments('<input-file:string>')
.option('-a, --agent <agent:string>', 'Import to specific agent')
.action(async (options: any, inputFile: string) => {
try {
const content = await Deno.readTextFile(inputFile);
const data = JSON.parse(content);
console.log(colors.green('Memory data loaded:'));
console.log(`- Entries: ${Array.isArray(data) ? data.length : 1}`);
console.log(colors.yellow('\nTo import this data, ensure Claude-Flow is running'));
} catch (error) {
console.error(colors.red('Failed to load memory file:'), (error as Error).message);
}
}),
)
.command('stats', new Command()
.description('Show memory statistics')
.action(async () => {
console.log(colors.yellow('Memory statistics require a running Claude-Flow instance'));
}),
)
.command('cleanup', new Command()
.description('Clean up old memory entries')
.option('--older-than <days:number>', 'Delete entries older than N days', {
default: 30,
})
.option('--dry-run', 'Show what would be deleted without deleting')
.action(async (options: any) => {
console.log(colors.yellow('Memory cleanup requires a running Claude-Flow instance'));
if (options.dryRun) {
console.log(colors.gray('(Dry run mode - no changes would be made)'));
}
}),
);