Roo-Code/apps/cli/src/lib/utils/version.ts
Chris Estreich 6e56619417
feat(cli): improve dev experience and roo provider API key support (#11203)
- Allow --api-key and ROO_API_KEY env var for the roo provider instead of
  requiring cloud auth token
- Switch dev/start scripts to use tsx for running directly from source
  without building first
- Fix path resolution (version.ts, extension.ts, extension-host.ts) to
  work from both source and bundled locations
- Disable debug log file (~/.roo/cli-debug.log) unless --debug is passed
- Update README with complete env var table and dev workflow docs

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 16:17:29 -08:00

24 lines
635 B
TypeScript

import fs from "fs"
import path from "path"
import { fileURLToPath } from "url"
// Walk up from the current file to find the nearest package.json.
// This works whether running from source (tsx src/lib/utils/) or bundle (dist/).
function findVersion(): string {
let dir = path.dirname(fileURLToPath(import.meta.url))
while (dir !== path.dirname(dir)) {
const candidate = path.join(dir, "package.json")
if (fs.existsSync(candidate)) {
const packageJson = JSON.parse(fs.readFileSync(candidate, "utf-8"))
return packageJson.version
}
dir = path.dirname(dir)
}
return "0.0.0"
}
export const VERSION = findVersion()