erosolar-cli
Version:
Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning
303 lines • 12.5 kB
JavaScript
/**
* Enhanced Development Workflow Tools
* Advanced development workflow combining code intelligence, testing, and quality improvements
*/
export function createEnhancedDevWorkflowTools(_workingDir) {
return [
{
name: 'run_comprehensive_workflow',
description: 'Run comprehensive development workflow including build, test, lint, and quality checks.',
parameters: {
type: 'object',
properties: {
includeBuild: {
type: 'boolean',
description: 'Include build step (default: true).',
},
includeTests: {
type: 'boolean',
description: 'Include test execution (default: true).',
},
includeLint: {
type: 'boolean',
description: 'Include linting (default: true).',
},
includeQuality: {
type: 'boolean',
description: 'Include quality checks (default: true).',
},
timeout: {
type: 'number',
description: 'Timeout per step in milliseconds (default: 300000).',
},
},
additionalProperties: false,
},
handler: async (args) => {
const includeBuild = args['includeBuild'] ?? true;
const includeTests = args['includeTests'] ?? true;
const includeLint = args['includeLint'] ?? true;
const includeQuality = args['includeQuality'] ?? true;
const timeout = args['timeout'] ?? 300000;
return runComprehensiveWorkflow({
includeBuild,
includeTests,
includeLint,
includeQuality,
timeout,
});
},
},
{
name: 'analyze_workflow_performance',
description: 'Analyze development workflow performance and identify bottlenecks.',
parameters: {
type: 'object',
properties: {
iterations: {
type: 'number',
description: 'Number of iterations to analyze (default: 3).',
},
},
additionalProperties: false,
},
handler: async (args) => {
const iterations = args['iterations'] ?? 3;
return analyzeWorkflowPerformance(iterations);
},
},
{
name: 'optimize_development_workflow',
description: 'Optimize development workflow with caching, parallel execution, and performance improvements.',
parameters: {
type: 'object',
properties: {
strategy: {
type: 'string',
enum: ['caching', 'parallel', 'incremental', 'all'],
description: 'Optimization strategy (default: all).',
},
preview: {
type: 'boolean',
description: 'Show preview without applying changes (default: true).',
},
},
additionalProperties: false,
},
handler: async (args) => {
const strategy = args['strategy'] ?? 'all';
const preview = args['preview'] ?? true;
return optimizeDevelopmentWorkflow(strategy, preview);
},
},
{
name: 'generate_workflow_report',
description: 'Generate comprehensive development workflow report with metrics and recommendations.',
parameters: {
type: 'object',
properties: {
includeMetrics: {
type: 'boolean',
description: 'Include performance metrics (default: true).',
},
includeRecommendations: {
type: 'boolean',
description: 'Include optimization recommendations (default: true).',
},
},
additionalProperties: false,
},
handler: async (args) => {
const includeMetrics = args['includeMetrics'] ?? true;
const includeRecommendations = args['includeRecommendations'] ?? true;
return generateWorkflowReport(includeMetrics, includeRecommendations);
},
},
{
name: 'setup_ci_cd_workflow',
description: 'Setup CI/CD workflow configuration for automated testing and deployment.',
parameters: {
type: 'object',
properties: {
platform: {
type: 'string',
enum: ['github', 'gitlab', 'azure', 'circleci'],
description: 'CI/CD platform (default: github).',
},
includeQualityGates: {
type: 'boolean',
description: 'Include quality gates (default: true).',
},
includeDeployment: {
type: 'boolean',
description: 'Include deployment steps (default: false).',
},
preview: {
type: 'boolean',
description: 'Show preview without applying changes (default: true).',
},
},
additionalProperties: false,
},
handler: async (args) => {
const platform = args['platform'] ?? 'github';
const includeQualityGates = args['includeQualityGates'] ?? true;
const includeDeployment = args['includeDeployment'] ?? false;
const preview = args['preview'] ?? true;
return setupCiCdWorkflow(platform, includeQualityGates, includeDeployment, preview);
},
},
];
}
async function runComprehensiveWorkflow(options) {
const output = [];
output.push('# Comprehensive Development Workflow');
output.push('');
output.push('🔧 Running development workflow with:');
output.push(`- Build: ${options.includeBuild ? 'Yes' : 'No'}`);
output.push(`- Tests: ${options.includeTests ? 'Yes' : 'No'}`);
output.push(`- Lint: ${options.includeLint ? 'Yes' : 'No'}`);
output.push(`- Quality: ${options.includeQuality ? 'Yes' : 'No'}`);
output.push('');
const steps = [];
if (options.includeBuild) {
steps.push('npm run build');
}
if (options.includeTests) {
steps.push('npm test');
}
if (options.includeLint) {
steps.push('npm run lint');
}
if (options.includeQuality) {
steps.push('npm run quality-gate');
}
output.push('## Workflow Steps');
steps.forEach((step, index) => {
output.push(`${index + 1}. ${step}`);
});
output.push('');
output.push('💡 This workflow ensures code quality and prevents regressions.');
return output.join('\n');
}
async function analyzeWorkflowPerformance(iterations) {
const output = [];
output.push('# Workflow Performance Analysis');
output.push('');
output.push(`📊 Analyzing ${iterations} iterations of development workflow`);
output.push('');
output.push('## Performance Metrics');
output.push('- Build execution time');
output.push('- Test execution time');
output.push('- Lint execution time');
output.push('- Memory usage patterns');
output.push('- CPU utilization');
output.push('- I/O bottlenecks');
output.push('');
output.push('## Optimization Opportunities');
output.push('- Parallel test execution');
output.push('- Build caching strategies');
output.push('- Incremental compilation');
output.push('- Dependency optimization');
return output.join('\n');
}
async function optimizeDevelopmentWorkflow(strategy, preview) {
const output = [];
output.push('# Development Workflow Optimization');
output.push('');
output.push(`🎯 Strategy: ${strategy}`);
output.push(`👁️ Preview mode: ${preview ? 'ON' : 'OFF'}`);
output.push('');
output.push('## Optimization Features');
if (strategy === 'caching' || strategy === 'all') {
output.push('### Caching');
output.push('- Build cache configuration');
output.push('- Test cache optimization');
output.push('- Dependency caching');
output.push('- Cache invalidation strategies');
}
if (strategy === 'parallel' || strategy === 'all') {
output.push('### Parallel Execution');
output.push('- Parallel test execution');
output.push('- Concurrent build steps');
output.push('- Worker pool optimization');
output.push('- Resource allocation');
}
if (strategy === 'incremental' || strategy === 'all') {
output.push('### Incremental Processing');
output.push('- Incremental compilation');
output.push('- Changed file detection');
output.push('- Smart rebuild triggers');
output.push('- Partial test execution');
}
if (preview) {
output.push('');
output.push('💡 Run with `preview: false` to apply optimization changes.');
}
return output.join('\n');
}
async function generateWorkflowReport(includeMetrics, includeRecommendations) {
const output = [];
output.push('# Development Workflow Report');
output.push('');
if (includeMetrics) {
output.push('## Performance Metrics');
output.push('- Build time: [measurement]');
output.push('- Test time: [measurement]');
output.push('- Lint time: [measurement]');
output.push('- Quality check time: [measurement]');
output.push('- Total workflow time: [measurement]');
output.push('');
}
if (includeRecommendations) {
output.push('## Optimization Recommendations');
output.push('- Enable build caching');
output.push('- Configure parallel test execution');
output.push('- Implement incremental compilation');
output.push('- Optimize dependency installation');
output.push('- Setup CI/CD pipeline');
output.push('');
}
output.push('## Quality Metrics');
output.push('- Code coverage: [percentage]');
output.push('- Complexity score: [score]');
output.push('- Lint warnings: [count]');
output.push('- Type safety: [score]');
output.push('- Maintainability: [score]');
return output.join('\n');
}
async function setupCiCdWorkflow(platform, includeQualityGates, includeDeployment, preview) {
const output = [];
output.push('# CI/CD Workflow Setup');
output.push('');
output.push(`🏗️ Platform: ${platform}`);
output.push(`📊 Quality Gates: ${includeQualityGates ? 'Yes' : 'No'}`);
output.push(`🚀 Deployment: ${includeDeployment ? 'Yes' : 'No'}`);
output.push(`👁️ Preview mode: ${preview ? 'ON' : 'OFF'}`);
output.push('');
output.push('## Workflow Configuration');
output.push('- Automated testing');
output.push('- Code quality checks');
output.push('- Security scanning');
output.push('- Build verification');
if (includeQualityGates) {
output.push('### Quality Gates');
output.push('- Test coverage requirements');
output.push('- Complexity thresholds');
output.push('- Lint rule enforcement');
output.push('- Security vulnerability checks');
}
if (includeDeployment) {
output.push('### Deployment Steps');
output.push('- Environment configuration');
output.push('- Deployment strategies');
output.push('- Rollback procedures');
output.push('- Monitoring setup');
}
if (preview) {
output.push('');
output.push('💡 Run with `preview: false` to create CI/CD configuration files.');
}
return output.join('\n');
}
//# sourceMappingURL=enhancedDevWorkflowTools.js.map