"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.pkg = exports.CHORUS_BIN_PATH = void 0;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
/**
 * Absolute path to bin/chorus.mjs. Resolved from __dirname so the path
 * is correct whether the CLI runs via:
 *   - `npm i -g chorus-codes` → /usr/local/lib/node_modules/chorus-codes/dist/cli/index.js
 *   - tsx dev mode      → /home/.../chorus/src/cli/index.ts
 *   - direct dist       → /home/.../chorus/dist/cli/index.js
 *
 * `process.argv[1]` would also work for the npm-installed case, but in
 * tsx dev mode it points at the .ts file which `node` can't execute.
 */
exports.CHORUS_BIN_PATH = path_1.default.resolve(__dirname, '..', '..', 'bin', 'chorus.mjs');
/**
 * Read version from the shipped package.json so it can never drift.
 * __dirname is dist/cli (built) or src/cli (tsx dev); ../../package.json
 * resolves to the package root in both layouts.
 */
exports.pkg = (() => {
    try {
        const pkgPath = path_1.default.resolve(__dirname, '..', '..', 'package.json');
        const raw = fs_1.default.readFileSync(pkgPath, 'utf-8');
        const parsed = JSON.parse(raw);
        return {
            version: parsed.version ?? '0.0.0',
            name: parsed.name ?? 'chorus',
        };
    }
    catch {
        return { version: '0.0.0', name: 'chorus' };
    }
})();
//# sourceMappingURL=shared.js.map