fix: resolve --version showing 0.0.0-dev when installed globally

Use getCurrentVersion() which walks up directories to find package.json
instead of hardcoded relative path that fails in global installs.

Bump version to 0.4.6.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
0xmrpeter 2026-03-22 01:41:16 +07:00
parent dd1a5b6256
commit d1074c645c
2 changed files with 3 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{
"name": "openacp",
"version": "0.4.4",
"version": "0.4.6",
"private": true,
"type": "module",
"bin": {

View File

@ -60,14 +60,8 @@ Examples:
}
export async function cmdVersion(): Promise<void> {
try {
const { createRequire } = await import("node:module")
const require = createRequire(import.meta.url)
const pkg = require("../../package.json")
console.log(`openacp v${pkg.version}`)
} catch {
console.log("openacp v0.0.0-dev")
}
const { getCurrentVersion } = await import("./version.js")
console.log(`openacp v${getCurrentVersion()}`)
}
export async function cmdInstall(args: string[]): Promise<void> {