edsger 0.1.4 → 0.1.5
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/cli.js +16 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
3
6
|
import { loadConfig, validateConfig } from './config.js';
|
|
4
7
|
import { reviewWithClaudeSDK, checkClaudeCodeSDK } from './code-review/reviewer.js';
|
|
5
8
|
import { logInfo, logError, logSuccess, logResults } from './logger.js';
|
|
9
|
+
// Get package.json version dynamically
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
const packageJson = JSON.parse(readFileSync(join(__dirname, '../package.json'), 'utf-8'));
|
|
13
|
+
const version = packageJson.version;
|
|
6
14
|
const program = new Command();
|
|
7
15
|
program
|
|
8
16
|
.name('edsger')
|
|
9
17
|
.description('AI-powered code review CLI tool using Claude Code SDK')
|
|
10
|
-
.version(
|
|
18
|
+
.version(version);
|
|
11
19
|
program
|
|
12
20
|
.option('-r, --review', 'Review code changes')
|
|
13
21
|
.option('-s, --staged', 'Review only staged changes')
|
|
@@ -67,7 +75,12 @@ export const runEdsger = async (options) => {
|
|
|
67
75
|
process.exit(1);
|
|
68
76
|
}
|
|
69
77
|
};
|
|
70
|
-
// Only parse when this file is run directly
|
|
71
|
-
if
|
|
78
|
+
// Only parse when this file is run directly (not imported as module)
|
|
79
|
+
// Check if this is the main module being executed
|
|
80
|
+
const isMainModule = import.meta.url === `file://${process.argv[1]}` ||
|
|
81
|
+
process.argv[1]?.endsWith('/edsger') ||
|
|
82
|
+
process.argv[1]?.endsWith('\\edsger') ||
|
|
83
|
+
process.argv[1]?.endsWith('cli.js');
|
|
84
|
+
if (isMainModule) {
|
|
72
85
|
program.parse();
|
|
73
86
|
}
|