BUG-710: call getSevenGovernorsChart with ketuMode/siderealMode so calculation.ketu_mode is the engine school, not the request echo. BUG-711: stop forbidding /ephemeris in the sidebar contract. BUG-712: compare ephemeris event longitudes at 6 decimals and fail closed when the golden is missing.
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
"use strict";
|
|
|
|
// Load the vendored CLI bundle without running main(), then call the
|
|
// in-bundle getSevenGovernorsChart(date, location, options) that the CLI
|
|
// itself never forwards flags into.
|
|
process.env.VITEST = "1";
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const Module = require("module");
|
|
|
|
const cliPath = path.resolve(__dirname, "..", "vendor", "stem-branch", "dist", "cli.cjs");
|
|
if (!fs.existsSync(cliPath)) {
|
|
process.stderr.write("vendored seven-governors CLI is missing\n");
|
|
process.exit(2);
|
|
}
|
|
|
|
const source = fs.readFileSync(cliPath, "utf8").replace(
|
|
"if (!process.env?.VITEST) {\n main();\n}",
|
|
"module.exports.getSevenGovernorsChart = getSevenGovernorsChart;\nif (!process.env?.VITEST) {\n main();\n}",
|
|
);
|
|
const loaded = new Module(cliPath);
|
|
loaded.filename = cliPath;
|
|
loaded.paths = Module._nodeModulePaths(path.dirname(cliPath));
|
|
loaded._compile(source, cliPath);
|
|
const getSevenGovernorsChart = loaded.exports.getSevenGovernorsChart;
|
|
if (typeof getSevenGovernorsChart !== "function") {
|
|
process.stderr.write("getSevenGovernorsChart is not available from the vendored CLI\n");
|
|
process.exit(2);
|
|
}
|
|
|
|
const input = JSON.parse(fs.readFileSync(0, "utf8"));
|
|
const date = new Date(input.date);
|
|
if (Number.isNaN(date.getTime())) {
|
|
process.stderr.write("invalid date\n");
|
|
process.exit(2);
|
|
}
|
|
const chart = getSevenGovernorsChart(
|
|
date,
|
|
{ lat: Number(input.lat), lon: Number(input.lng) },
|
|
{
|
|
ketuMode: input.ketuMode || "apogee",
|
|
siderealMode: input.siderealMode || { type: "modern" },
|
|
},
|
|
);
|
|
process.stdout.write(JSON.stringify({ sevenGovernors: chart }));
|