edsger 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/features/feature-utils.d.ts +13 -0
- package/dist/api/features/feature-utils.js +46 -0
- package/dist/api/features/get-feature.d.ts +5 -0
- package/dist/api/features/get-feature.js +19 -0
- package/dist/api/features/index.d.ts +7 -0
- package/dist/api/features/index.js +9 -0
- package/dist/api/features/status-updater.d.ts +27 -0
- package/dist/api/features/status-updater.js +64 -0
- package/dist/api/features/test-cases.d.ts +21 -0
- package/dist/api/features/test-cases.js +63 -0
- package/dist/api/features/update-feature.d.ts +13 -0
- package/dist/api/features/update-feature.js +31 -0
- package/dist/api/features/user-stories.d.ts +21 -0
- package/dist/api/features/user-stories.js +63 -0
- package/dist/api/features.d.ts +100 -0
- package/dist/api/features.js +219 -0
- package/dist/api/mcp-client.d.ts +18 -0
- package/dist/api/mcp-client.js +58 -0
- package/dist/api/products.d.ts +10 -0
- package/dist/api/products.js +22 -0
- package/dist/api/test-reports.d.ts +9 -0
- package/dist/api/test-reports.js +25 -0
- package/dist/cli/commands/code-implementation-command.d.ts +2 -0
- package/dist/cli/commands/code-implementation-command.js +36 -0
- package/dist/cli/commands/code-review-command.d.ts +2 -0
- package/dist/cli/commands/code-review-command.js +39 -0
- package/dist/cli/commands/feature-analysis-command.d.ts +2 -0
- package/dist/cli/commands/feature-analysis-command.js +36 -0
- package/dist/cli/commands/functional-testing-command.d.ts +2 -0
- package/dist/cli/commands/functional-testing-command.js +36 -0
- package/dist/cli/commands/technical-design-command.d.ts +2 -0
- package/dist/cli/commands/technical-design-command.js +36 -0
- package/dist/cli/commands/workflow-command.d.ts +2 -0
- package/dist/cli/commands/workflow-command.js +34 -0
- package/dist/cli/formatters/code-implementation-formatter.d.ts +9 -0
- package/dist/cli/formatters/code-implementation-formatter.js +27 -0
- package/dist/cli/formatters/feature-analysis-formatter.d.ts +2 -0
- package/dist/cli/formatters/feature-analysis-formatter.js +27 -0
- package/dist/cli/formatters/functional-testing-formatter.d.ts +15 -0
- package/dist/cli/formatters/functional-testing-formatter.js +37 -0
- package/dist/cli/formatters/technical-design-formatter.d.ts +7 -0
- package/dist/cli/formatters/technical-design-formatter.js +30 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.js +99 -0
- package/dist/cli/utils/validation.d.ts +25 -0
- package/dist/cli/utils/validation.js +58 -0
- package/dist/cli/utils/workflow-utils.d.ts +21 -0
- package/dist/cli/utils/workflow-utils.js +47 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +11 -466
- package/dist/config.d.ts +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.d.ts +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/analyzer.js +1 -1
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.d.ts +4 -22
- package/dist/{bug-fixing → phases/bug-fixing}/context-fetcher.js +14 -58
- package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.js +1 -30
- package/dist/phases/code-implementation/analyzer.d.ts +33 -0
- package/dist/{code-implementation → phases/code-implementation}/analyzer.js +174 -15
- package/dist/phases/code-implementation/context-fetcher.d.ts +17 -0
- package/dist/phases/code-implementation/context-fetcher.js +86 -0
- package/dist/{code-implementation → phases/code-implementation}/mcp-server.js +1 -30
- package/dist/{code-review → phases/code-review}/reviewer.d.ts +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.d.ts +3 -2
- package/dist/{feature-analysis → phases/feature-analysis}/analyzer.js +29 -127
- package/dist/phases/feature-analysis/context-fetcher.d.ts +18 -0
- package/dist/phases/feature-analysis/context-fetcher.js +86 -0
- package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.js +1 -1
- package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.js +1 -24
- package/dist/{functional-testing → phases/functional-testing}/analyzer.d.ts +17 -2
- package/dist/{functional-testing → phases/functional-testing}/analyzer.js +225 -31
- package/dist/phases/functional-testing/context-fetcher.d.ts +16 -0
- package/dist/phases/functional-testing/context-fetcher.js +81 -0
- package/dist/{functional-testing → phases/functional-testing}/http-fallback.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.d.ts +1 -1
- package/dist/{functional-testing → phases/functional-testing}/index.js +1 -1
- package/dist/{functional-testing → phases/functional-testing}/mcp-server.js +1 -30
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.d.ts +26 -0
- package/dist/{functional-testing → phases/functional-testing}/test-report-creator.js +87 -5
- package/dist/phases/functional-testing/test-retry-handler.d.ts +16 -0
- package/dist/phases/functional-testing/test-retry-handler.js +75 -0
- package/dist/{pull-request → phases/pull-request}/creator.js +47 -6
- package/dist/phases/pull-request/handler.d.ts +16 -0
- package/dist/phases/pull-request/handler.js +60 -0
- package/dist/{technical-design → phases/technical-design}/analyzer.d.ts +7 -2
- package/dist/phases/technical-design/analyzer.js +418 -0
- package/dist/phases/technical-design/context-fetcher.d.ts +12 -0
- package/dist/phases/technical-design/context-fetcher.js +39 -0
- package/dist/{technical-design → phases/technical-design}/http-fallback.js +1 -1
- package/dist/{technical-design → phases/technical-design}/mcp-server.js +1 -30
- package/dist/prompts/bug-fixing.d.ts +2 -0
- package/dist/prompts/bug-fixing.js +63 -0
- package/dist/prompts/code-implementation.d.ts +3 -0
- package/dist/prompts/code-implementation.js +132 -0
- package/dist/prompts/feature-analysis.d.ts +3 -0
- package/dist/prompts/feature-analysis.js +149 -0
- package/dist/prompts/formatters.d.ts +29 -0
- package/dist/prompts/formatters.js +139 -0
- package/dist/prompts/functional-testing.d.ts +3 -0
- package/dist/prompts/functional-testing.js +126 -0
- package/dist/prompts/index.d.ts +6 -0
- package/dist/prompts/index.js +7 -0
- package/dist/prompts/technical-design.d.ts +3 -0
- package/dist/prompts/technical-design.js +130 -0
- package/dist/services/checklist.d.ts +99 -0
- package/dist/services/checklist.js +337 -0
- package/dist/types/features.d.ts +29 -0
- package/dist/types/features.js +1 -0
- package/dist/types/index.d.ts +112 -0
- package/dist/types/index.js +1 -0
- package/dist/types/pipeline.d.ts +25 -0
- package/dist/types/pipeline.js +4 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.js +52 -0
- package/dist/utils/pipeline-logger.d.ts +8 -0
- package/dist/utils/pipeline-logger.js +35 -0
- package/dist/workflow-runner/config/phase-configs.d.ts +5 -0
- package/dist/workflow-runner/config/phase-configs.js +34 -0
- package/dist/workflow-runner/config/stage-configs.d.ts +5 -0
- package/dist/workflow-runner/config/stage-configs.js +34 -0
- package/dist/workflow-runner/core/feature-filter.d.ts +16 -0
- package/dist/workflow-runner/core/feature-filter.js +46 -0
- package/dist/workflow-runner/core/feature-filter.test.d.ts +4 -0
- package/dist/workflow-runner/core/feature-filter.test.js +127 -0
- package/dist/workflow-runner/core/index.d.ts +8 -0
- package/dist/workflow-runner/core/index.js +12 -0
- package/dist/workflow-runner/core/pipeline-evaluator.d.ts +24 -0
- package/dist/workflow-runner/core/pipeline-evaluator.js +32 -0
- package/dist/workflow-runner/core/state-manager.d.ts +24 -0
- package/dist/workflow-runner/core/state-manager.js +42 -0
- package/dist/workflow-runner/core/workflow-logger.d.ts +20 -0
- package/dist/workflow-runner/core/workflow-logger.js +65 -0
- package/dist/workflow-runner/executors/phase-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/phase-executor.js +183 -0
- package/dist/workflow-runner/executors/stage-executor.d.ts +8 -0
- package/dist/workflow-runner/executors/stage-executor.js +49 -0
- package/dist/workflow-runner/feature-service.d.ts +17 -0
- package/dist/workflow-runner/feature-service.js +60 -0
- package/dist/workflow-runner/feature-workflow-runner.d.ts +26 -0
- package/dist/workflow-runner/feature-workflow-runner.js +113 -0
- package/dist/workflow-runner/index.d.ts +0 -1
- package/dist/workflow-runner/index.js +0 -1
- package/dist/workflow-runner/pipeline-runner.d.ts +9 -19
- package/dist/workflow-runner/pipeline-runner.js +247 -256
- package/dist/workflow-runner/pipeline.d.ts +18 -0
- package/dist/workflow-runner/pipeline.js +197 -0
- package/dist/workflow-runner/processor.d.ts +40 -0
- package/dist/workflow-runner/processor.js +191 -0
- package/dist/workflow-runner/types.d.ts +48 -0
- package/dist/workflow-runner/types.js +4 -0
- package/dist/workflow-runner/workflow-processor.d.ts +6 -23
- package/dist/workflow-runner/workflow-processor.js +38 -100
- package/package.json +2 -2
- package/dist/code-implementation/analyzer.d.ts +0 -19
- package/dist/code-implementation/context-fetcher.d.ts +0 -38
- package/dist/code-implementation/context-fetcher.js +0 -147
- package/dist/feature-analysis/context-fetcher.d.ts +0 -54
- package/dist/feature-analysis/context-fetcher.js +0 -193
- package/dist/functional-testing/context-fetcher.d.ts +0 -47
- package/dist/functional-testing/context-fetcher.js +0 -192
- package/dist/technical-design/analyzer.js +0 -338
- package/dist/technical-design/context-fetcher.d.ts +0 -42
- package/dist/technical-design/context-fetcher.js +0 -170
- /package/dist/{bug-fixing → phases/bug-fixing}/index.d.ts +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/index.js +0 -0
- /package/dist/{bug-fixing → phases/bug-fixing}/mcp-server.d.ts +0 -0
- /package/dist/{code-implementation → phases/code-implementation}/mcp-server.d.ts +0 -0
- /package/dist/{code-review → phases/code-review}/reviewer.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/http-fallback.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.d.ts +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/index.js +0 -0
- /package/dist/{feature-analysis → phases/feature-analysis}/mcp-server.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/http-fallback.d.ts +0 -0
- /package/dist/{functional-testing → phases/functional-testing}/mcp-server.d.ts +0 -0
- /package/dist/{pull-request → phases/pull-request}/creator.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/http-fallback.d.ts +0 -0
- /package/dist/{technical-design → phases/technical-design}/mcp-server.d.ts +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const logFeatureAnalysisResults = (result, verbose) => {
|
|
2
|
+
console.log('\n' + '='.repeat(60));
|
|
3
|
+
console.log('🎯 Feature Analysis Results');
|
|
4
|
+
console.log('='.repeat(60));
|
|
5
|
+
console.log(`\n📋 Feature ID: ${result.featureId}`);
|
|
6
|
+
console.log(`📊 Status: ${result.status === 'success' ? '✅ Success' : '❌ Failed'}`);
|
|
7
|
+
if (result.summary) {
|
|
8
|
+
console.log(`\n📝 Summary:\n${result.summary}`);
|
|
9
|
+
}
|
|
10
|
+
if (result.createdUserStories && result.createdUserStories.length > 0) {
|
|
11
|
+
console.log(`\n✨ Created ${result.createdUserStories.length} user stories`);
|
|
12
|
+
if (verbose) {
|
|
13
|
+
result.createdUserStories.forEach((story, index) => {
|
|
14
|
+
console.log(` ${index + 1}. ${story.title}`);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (result.createdTestCases && result.createdTestCases.length > 0) {
|
|
19
|
+
console.log(`\n🧪 Created ${result.createdTestCases.length} test cases`);
|
|
20
|
+
if (verbose) {
|
|
21
|
+
result.createdTestCases.forEach((testCase, index) => {
|
|
22
|
+
console.log(` ${index + 1}. ${testCase.name} ${testCase.is_critical ? '[CRITICAL]' : ''}`);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
console.log('\n' + '='.repeat(60));
|
|
27
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const logFunctionalTestingResults: (result: {
|
|
2
|
+
featureId: string;
|
|
3
|
+
testStatus: "testing_passed" | "testing_failed";
|
|
4
|
+
structuredTestResult: {
|
|
5
|
+
status: "testing_passed" | "testing_failed";
|
|
6
|
+
title: string;
|
|
7
|
+
summary: string;
|
|
8
|
+
total_test_cases: number;
|
|
9
|
+
passed_test_cases: number;
|
|
10
|
+
failed_test_cases: number;
|
|
11
|
+
execution_details?: string;
|
|
12
|
+
} | null;
|
|
13
|
+
status: "success" | "error";
|
|
14
|
+
message: string;
|
|
15
|
+
}, verbose?: boolean) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const logFunctionalTestingResults = (result, verbose) => {
|
|
2
|
+
console.log('\n' + '='.repeat(60));
|
|
3
|
+
console.log('🎭 Functional Testing Results');
|
|
4
|
+
console.log('='.repeat(60));
|
|
5
|
+
console.log(`\n📋 Feature ID: ${result.featureId}`);
|
|
6
|
+
console.log(`📊 Status: ${result.status === 'success' ? '✅ Success' : '❌ Failed'}`);
|
|
7
|
+
console.log(`🧪 Test Status: ${result.testStatus === 'testing_passed' ? '✅ Passed' : '❌ Failed'}`);
|
|
8
|
+
if (result.message) {
|
|
9
|
+
console.log(`\n📝 Message: ${result.message}`);
|
|
10
|
+
}
|
|
11
|
+
if (result.structuredTestResult && verbose) {
|
|
12
|
+
console.log(`\n🔍 Test Results:`);
|
|
13
|
+
console.log('─'.repeat(40));
|
|
14
|
+
console.log(` Title: ${result.structuredTestResult.title}`);
|
|
15
|
+
console.log(` Summary: ${result.structuredTestResult.summary}`);
|
|
16
|
+
console.log(` Total Tests: ${result.structuredTestResult.total_test_cases}`);
|
|
17
|
+
console.log(` Passed: ${result.structuredTestResult.passed_test_cases}`);
|
|
18
|
+
console.log(` Failed: ${result.structuredTestResult.failed_test_cases}`);
|
|
19
|
+
if (result.structuredTestResult.execution_details) {
|
|
20
|
+
console.log(`\n Execution Details:`);
|
|
21
|
+
const lines = result.structuredTestResult.execution_details.split('\n');
|
|
22
|
+
const previewLines = lines.slice(0, 20);
|
|
23
|
+
previewLines.forEach((line) => {
|
|
24
|
+
console.log(` ${line}`);
|
|
25
|
+
});
|
|
26
|
+
if (lines.length > 20) {
|
|
27
|
+
console.log(` ... (${lines.length - 20} more lines)`);
|
|
28
|
+
}
|
|
29
|
+
console.log('─'.repeat(40));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
else if (result.structuredTestResult &&
|
|
33
|
+
result.structuredTestResult.execution_details) {
|
|
34
|
+
console.log(`\n🔍 Test Results: Available (${result.structuredTestResult.execution_details.length} characters)`);
|
|
35
|
+
}
|
|
36
|
+
console.log('\n' + '='.repeat(60));
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const logTechnicalDesignResults = (result, verbose) => {
|
|
2
|
+
console.log('\n' + '='.repeat(60));
|
|
3
|
+
console.log('🎨 Technical Design Results');
|
|
4
|
+
console.log('='.repeat(60));
|
|
5
|
+
console.log(`\n📋 Feature ID: ${result.featureId}`);
|
|
6
|
+
console.log(`📊 Status: ${result.status === 'success' ? '✅ Success' : '❌ Failed'}`);
|
|
7
|
+
if (result.summary) {
|
|
8
|
+
console.log(`\n📝 Summary:\n${result.summary}`);
|
|
9
|
+
}
|
|
10
|
+
if (result.savedViaHttp) {
|
|
11
|
+
console.log(`\n🔄 Saved via HTTP fallback`);
|
|
12
|
+
}
|
|
13
|
+
if (result.technicalDesign && verbose) {
|
|
14
|
+
console.log(`\n🏗️ Technical Design:`);
|
|
15
|
+
console.log('─'.repeat(40));
|
|
16
|
+
const lines = result.technicalDesign.split('\n');
|
|
17
|
+
const previewLines = lines.slice(0, 10);
|
|
18
|
+
previewLines.forEach((line) => {
|
|
19
|
+
console.log(` ${line}`);
|
|
20
|
+
});
|
|
21
|
+
if (lines.length > 10) {
|
|
22
|
+
console.log(` ... (${lines.length - 10} more lines)`);
|
|
23
|
+
}
|
|
24
|
+
console.log('─'.repeat(40));
|
|
25
|
+
}
|
|
26
|
+
else if (result.technicalDesign) {
|
|
27
|
+
console.log(`\n🏗️ Technical Design: Generated (${result.technicalDesign.length} characters)`);
|
|
28
|
+
}
|
|
29
|
+
console.log('\n' + '='.repeat(60));
|
|
30
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
import { config as dotenvConfig } from 'dotenv';
|
|
7
|
+
import { logError } from '../utils/logger.js';
|
|
8
|
+
import { runWorkflow } from './commands/workflow-command.js';
|
|
9
|
+
import { runFeatureAnalysis } from './commands/feature-analysis-command.js';
|
|
10
|
+
import { runTechnicalDesign } from './commands/technical-design-command.js';
|
|
11
|
+
import { runCodeImplementation } from './commands/code-implementation-command.js';
|
|
12
|
+
import { runFunctionalTestingCommand } from './commands/functional-testing-command.js';
|
|
13
|
+
import { runCodeReview } from './commands/code-review-command.js';
|
|
14
|
+
// Get package.json version dynamically
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
18
|
+
const version = packageJson.version;
|
|
19
|
+
// Load environment variables from .env file
|
|
20
|
+
// Load from current working directory (where the command is run)
|
|
21
|
+
dotenvConfig({ path: join(process.cwd(), '.env') });
|
|
22
|
+
const program = new Command();
|
|
23
|
+
program
|
|
24
|
+
.name('edsger')
|
|
25
|
+
.description('AI-powered code review CLI tool using Claude Code SDK')
|
|
26
|
+
.version(version);
|
|
27
|
+
program
|
|
28
|
+
.option('-r, --review', 'Review code changes')
|
|
29
|
+
.option('-s, --staged', 'Review only staged changes')
|
|
30
|
+
.option('-f, --files <patterns...>', 'Review specific file patterns')
|
|
31
|
+
.option('--feature-analysis <featureId>', 'Analyze feature and generate user stories/test cases')
|
|
32
|
+
.option('--technical-design <featureId>', 'Generate technical design for a feature')
|
|
33
|
+
.option('--implement <featureId>', 'Implement code for a feature based on its specifications')
|
|
34
|
+
.option('--test <featureId>', 'Run functional tests for a feature using Playwright')
|
|
35
|
+
.option('--workflow', 'Run continuous workflow processor to handle ready_for_dev features')
|
|
36
|
+
.option('-c, --config <path>', 'Path to config file')
|
|
37
|
+
.option('-v, --verbose', 'Verbose output');
|
|
38
|
+
program.action(async (options) => {
|
|
39
|
+
try {
|
|
40
|
+
await runEdsger(options);
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
logError(error instanceof Error ? error.message : String(error));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
export const runEdsger = async (options) => {
|
|
48
|
+
// Handle workflow mode
|
|
49
|
+
if (options.workflow) {
|
|
50
|
+
await runWorkflow(options);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Handle feature analysis mode
|
|
54
|
+
if (options.featureAnalysis) {
|
|
55
|
+
await runFeatureAnalysis(options);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
// Handle technical design mode
|
|
59
|
+
if (options.technicalDesign) {
|
|
60
|
+
await runTechnicalDesign(options);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Handle code implementation mode
|
|
64
|
+
if (options.implement) {
|
|
65
|
+
await runCodeImplementation(options);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Handle functional testing mode
|
|
69
|
+
if (options.test) {
|
|
70
|
+
await runFunctionalTestingCommand(options);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
// Handle code review mode (explicit --review flag or as fallback)
|
|
74
|
+
if (options.review || options.staged || options.files) {
|
|
75
|
+
await runCodeReview(options);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Default to workflow mode if environment is configured, otherwise code review
|
|
79
|
+
const productId = process.env.EDSGER_PRODUCT_ID;
|
|
80
|
+
const mcpToken = process.env.EDSGER_MCP_TOKEN;
|
|
81
|
+
if (productId && mcpToken) {
|
|
82
|
+
// Environment is configured for workflow, use that as default
|
|
83
|
+
options.workflow = true;
|
|
84
|
+
await runWorkflow(options);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
// Default to code review mode
|
|
88
|
+
await runCodeReview(options);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// Only parse when this file is run directly (not imported as module)
|
|
92
|
+
// Check if this is the main module being executed
|
|
93
|
+
const isMainModule = import.meta.url === `file://${process.argv[1]}` ||
|
|
94
|
+
process.argv[1]?.endsWith('/edsger') ||
|
|
95
|
+
process.argv[1]?.endsWith('\\edsger') ||
|
|
96
|
+
process.argv[1]?.endsWith('cli.js');
|
|
97
|
+
if (isMainModule) {
|
|
98
|
+
program.parse();
|
|
99
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CliOptions } from '../../types/index.js';
|
|
2
|
+
export interface ValidationResult {
|
|
3
|
+
config: any;
|
|
4
|
+
mcpServerUrl: string;
|
|
5
|
+
mcpToken: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Common configuration validation for all CLI commands
|
|
9
|
+
*/
|
|
10
|
+
export declare const validateConfiguration: (options: CliOptions) => any;
|
|
11
|
+
/**
|
|
12
|
+
* Validate MCP environment variables and URL format
|
|
13
|
+
*/
|
|
14
|
+
export declare const validateMCPEnvironment: () => {
|
|
15
|
+
mcpServerUrl: string;
|
|
16
|
+
mcpToken: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Combined validation for commands that need both config and MCP setup
|
|
20
|
+
*/
|
|
21
|
+
export declare const validateCommandEnvironment: (options: CliOptions) => ValidationResult;
|
|
22
|
+
/**
|
|
23
|
+
* Check if required dependencies are installed
|
|
24
|
+
*/
|
|
25
|
+
export declare const validateRequirements: (checkFunction: () => Promise<boolean>, errorMessage: string) => Promise<void>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { loadConfig, validateConfig } from '../../config.js';
|
|
2
|
+
import { logInfo } from '../../utils/logger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Common configuration validation for all CLI commands
|
|
5
|
+
*/
|
|
6
|
+
export const validateConfiguration = (options) => {
|
|
7
|
+
const config = loadConfig(options.config);
|
|
8
|
+
const configErrors = validateConfig(config);
|
|
9
|
+
if (configErrors.length > 0) {
|
|
10
|
+
throw new Error(`Configuration errors:\n${configErrors.map((e) => ` - ${e}`).join('\n')}`);
|
|
11
|
+
}
|
|
12
|
+
if (options.verbose) {
|
|
13
|
+
logInfo('Configuration loaded successfully');
|
|
14
|
+
}
|
|
15
|
+
return config;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Validate MCP environment variables and URL format
|
|
19
|
+
*/
|
|
20
|
+
export const validateMCPEnvironment = () => {
|
|
21
|
+
const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
|
|
22
|
+
const mcpToken = process.env.EDSGER_MCP_TOKEN;
|
|
23
|
+
if (!mcpServerUrl) {
|
|
24
|
+
throw new Error('MCP server URL is required. Set EDSGER_MCP_SERVER_URL environment variable.');
|
|
25
|
+
}
|
|
26
|
+
if (!mcpToken) {
|
|
27
|
+
throw new Error('MCP token is required. Set EDSGER_MCP_TOKEN environment variable.');
|
|
28
|
+
}
|
|
29
|
+
// Validate MCP server URL format
|
|
30
|
+
try {
|
|
31
|
+
new URL(mcpServerUrl);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
throw new Error('Invalid MCP server URL format. Use http:// or https://');
|
|
35
|
+
}
|
|
36
|
+
return { mcpServerUrl, mcpToken };
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Combined validation for commands that need both config and MCP setup
|
|
40
|
+
*/
|
|
41
|
+
export const validateCommandEnvironment = (options) => {
|
|
42
|
+
const config = validateConfiguration(options);
|
|
43
|
+
const { mcpServerUrl, mcpToken } = validateMCPEnvironment();
|
|
44
|
+
return {
|
|
45
|
+
config,
|
|
46
|
+
mcpServerUrl,
|
|
47
|
+
mcpToken,
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Check if required dependencies are installed
|
|
52
|
+
*/
|
|
53
|
+
export const validateRequirements = async (checkFunction, errorMessage) => {
|
|
54
|
+
const hasRequirements = await checkFunction();
|
|
55
|
+
if (!hasRequirements) {
|
|
56
|
+
throw new Error(errorMessage);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CliOptions } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validate workflow-specific environment variables
|
|
4
|
+
*/
|
|
5
|
+
export declare const validateWorkflowEnvironment: () => {
|
|
6
|
+
productId: string;
|
|
7
|
+
mcpServerUrl: string;
|
|
8
|
+
mcpToken: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Setup workflow processor parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare const setupWorkflowProcessor: (options: CliOptions) => {
|
|
14
|
+
config: any;
|
|
15
|
+
params: {
|
|
16
|
+
productId: string;
|
|
17
|
+
mcpServerUrl: string;
|
|
18
|
+
mcpToken: string;
|
|
19
|
+
verbose?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { validateConfiguration } from './validation.js';
|
|
2
|
+
import { logInfo } from '../../utils/logger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Validate workflow-specific environment variables
|
|
5
|
+
*/
|
|
6
|
+
export const validateWorkflowEnvironment = () => {
|
|
7
|
+
const productId = process.env.EDSGER_PRODUCT_ID;
|
|
8
|
+
const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
|
|
9
|
+
const mcpToken = process.env.EDSGER_MCP_TOKEN;
|
|
10
|
+
if (!productId) {
|
|
11
|
+
throw new Error('Product ID is required. Set EDSGER_PRODUCT_ID environment variable.');
|
|
12
|
+
}
|
|
13
|
+
if (!mcpServerUrl) {
|
|
14
|
+
throw new Error('MCP server URL is required. Set EDSGER_MCP_SERVER_URL environment variable.');
|
|
15
|
+
}
|
|
16
|
+
if (!mcpToken) {
|
|
17
|
+
throw new Error('MCP token is required. Set EDSGER_MCP_TOKEN environment variable.');
|
|
18
|
+
}
|
|
19
|
+
// Validate MCP server URL format
|
|
20
|
+
try {
|
|
21
|
+
new URL(mcpServerUrl);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
throw new Error('Invalid MCP server URL format. Use http:// or https://');
|
|
25
|
+
}
|
|
26
|
+
return { productId, mcpServerUrl, mcpToken };
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Setup workflow processor parameters
|
|
30
|
+
*/
|
|
31
|
+
export const setupWorkflowProcessor = (options) => {
|
|
32
|
+
const config = validateConfiguration(options);
|
|
33
|
+
if (options.verbose) {
|
|
34
|
+
logInfo('Starting workflow processor mode...');
|
|
35
|
+
}
|
|
36
|
+
const { productId, mcpServerUrl, mcpToken } = validateWorkflowEnvironment();
|
|
37
|
+
logInfo('🚀 Starting workflow processor...');
|
|
38
|
+
return {
|
|
39
|
+
config,
|
|
40
|
+
params: {
|
|
41
|
+
productId,
|
|
42
|
+
mcpServerUrl,
|
|
43
|
+
mcpToken,
|
|
44
|
+
verbose: options.verbose,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
};
|
package/dist/cli.d.ts
CHANGED