"use strict";
/**
 * Version utility - Reads version from package.json
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDataPilotVersion = getDataPilotVersion;
const fs_1 = require("fs");
const path_1 = require("path");
let cachedVersion = null;
/**
 * Get the current DataPilot version from package.json
 */
function getDataPilotVersion() {
    if (cachedVersion) {
        return cachedVersion;
    }
    try {
        // Try to read package.json from the project root
        // This works whether we're running from dist/ or src/
        const packageJsonPath = (0, path_1.join)(__dirname, '..', '..', 'package.json');
        const packageJsonContent = (0, fs_1.readFileSync)(packageJsonPath, 'utf8');
        const packageJson = JSON.parse(packageJsonContent);
        cachedVersion = packageJson.version;
        return cachedVersion;
    }
    catch (error) {
        // Fallback in case package.json can't be read
        // This should only happen in unusual deployment scenarios
        return '1.6.1';
    }
}
//# sourceMappingURL=version.js.map