@aaronshaf/ger 0.1.7 → 0.1.8
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/package.json +1 -1
- package/src/cli/index.ts +21 -1
package/package.json
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -23,6 +23,9 @@ if (compareSemver(bunVersion, MIN_BUN_VERSION) < 0) {
|
|
|
23
23
|
|
|
24
24
|
import { Command } from 'commander'
|
|
25
25
|
import { Effect } from 'effect'
|
|
26
|
+
import { readFileSync } from 'node:fs'
|
|
27
|
+
import { join, dirname } from 'node:path'
|
|
28
|
+
import { fileURLToPath } from 'node:url'
|
|
26
29
|
import { GerritApiServiceLive } from '@/api/gerrit'
|
|
27
30
|
import { ConfigServiceLive } from '@/services/config'
|
|
28
31
|
import { ReviewStrategyServiceLive } from '@/services/review-strategy'
|
|
@@ -40,9 +43,26 @@ import { showCommand } from './commands/show'
|
|
|
40
43
|
import { statusCommand } from './commands/status'
|
|
41
44
|
import { workspaceCommand } from './commands/workspace'
|
|
42
45
|
|
|
46
|
+
// Read version from package.json
|
|
47
|
+
function getVersion(): string {
|
|
48
|
+
try {
|
|
49
|
+
// Get the directory of the current module
|
|
50
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
51
|
+
const __dirname = dirname(__filename)
|
|
52
|
+
|
|
53
|
+
// Navigate up to the project root and read package.json
|
|
54
|
+
const packageJsonPath = join(__dirname, '..', '..', 'package.json')
|
|
55
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'))
|
|
56
|
+
return packageJson.version || '0.0.0'
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Fallback version if package.json can't be read
|
|
59
|
+
return '0.0.0'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
const program = new Command()
|
|
44
64
|
|
|
45
|
-
program.name('gi').description('LLM-centric Gerrit CLI tool').version(
|
|
65
|
+
program.name('gi').description('LLM-centric Gerrit CLI tool').version(getVersion())
|
|
46
66
|
|
|
47
67
|
// setup command (new primary command)
|
|
48
68
|
program
|