kaabalah 5.3.0 → 5.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -33,6 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
34
  mod
35
35
  ));
36
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
37
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
38
 
38
39
  // wasm/build/swisseph.node.wasm?url
@@ -56,7 +57,7 @@ function parsFortunae(asc, sunLon, moonLon, diurnal) {
56
57
  const val = diurnal ? asc + moonLon - sunLon : asc + sunLon - moonLon;
57
58
  return normalizeAngle(val);
58
59
  }
59
- var Planet, VirtualNodes, PLANET_AND_NODE_NAMES, HouseSystem, CalcFlag, SE_AST_OFFSET, BODY, normalizeAngle, SwissEph;
60
+ var Planet, VirtualNodes, PLANET_AND_NODE_NAMES, HouseSystem, CalcFlag, RiseTransitFlag, SE_ECL2HOR, SE_EQU2HOR, SE_AST_OFFSET, BODY, normalizeAngle, SwissEph;
60
61
  var init_swisseph = __esm({
61
62
  "wasm/src/swisseph.ts"() {
62
63
  "use strict";
@@ -129,6 +130,17 @@ var init_swisseph = __esm({
129
130
  CalcFlag2[CalcFlag2["SIDEREAL"] = 65536] = "SIDEREAL";
130
131
  return CalcFlag2;
131
132
  })(CalcFlag || {});
133
+ RiseTransitFlag = /* @__PURE__ */ ((RiseTransitFlag2) => {
134
+ RiseTransitFlag2[RiseTransitFlag2["RISE"] = 1] = "RISE";
135
+ RiseTransitFlag2[RiseTransitFlag2["SET"] = 2] = "SET";
136
+ RiseTransitFlag2[RiseTransitFlag2["UPPER_MERIDIAN"] = 4] = "UPPER_MERIDIAN";
137
+ RiseTransitFlag2[RiseTransitFlag2["LOWER_MERIDIAN"] = 8] = "LOWER_MERIDIAN";
138
+ RiseTransitFlag2[RiseTransitFlag2["DISC_CENTER"] = 256] = "DISC_CENTER";
139
+ RiseTransitFlag2[RiseTransitFlag2["NO_REFRACTION"] = 512] = "NO_REFRACTION";
140
+ return RiseTransitFlag2;
141
+ })(RiseTransitFlag || {});
142
+ SE_ECL2HOR = 0;
143
+ SE_EQU2HOR = 1;
132
144
  SE_AST_OFFSET = 1e4;
133
145
  BODY = {
134
146
  MEAN_APOGEE: 12,
@@ -155,6 +167,8 @@ var init_swisseph = __esm({
155
167
  this.swe_close = null;
156
168
  this.swe_set_topo = null;
157
169
  this.swe_set_sid_mode = null;
170
+ this.swe_azalt_fn = null;
171
+ this.swe_rise_trans_fn = null;
158
172
  this.module = module2;
159
173
  this.swe_julday = this.module.cwrap("swe_julday", "number", [
160
174
  "number",
@@ -199,6 +213,16 @@ var init_swisseph = __esm({
199
213
  null,
200
214
  ["number", "number", "number"]
201
215
  );
216
+ this.swe_azalt_fn = this.module.cwrap(
217
+ "swe_azalt",
218
+ null,
219
+ ["number", "number", "number", "number", "number", "number", "number"]
220
+ );
221
+ this.swe_rise_trans_fn = this.module.cwrap(
222
+ "swe_rise_trans",
223
+ "number",
224
+ ["number", "number", "number", "number", "number", "number", "number", "number", "number", "number"]
225
+ );
202
226
  }
203
227
  checkInitialized() {
204
228
  if (!this.module) {
@@ -405,6 +429,105 @@ var init_swisseph = __esm({
405
429
  const id2 = kind === "mean" ? BODY.MEAN_APOGEE : BODY.OSC_APOGEE;
406
430
  return this.calculatePlanetPosition(julday, id2, flags);
407
431
  }
432
+ /**
433
+ * Convert ecliptic (or equatorial) coordinates to horizon coordinates.
434
+ * Returns azimuth (0=south, 90=west, 180=north, 270=east) and altitude.
435
+ */
436
+ azalt(julday, longitude, latitude, altitude, xinLon, xinLat, xinDist, fromEquatorial = false) {
437
+ this.checkInitialized();
438
+ if (!this.swe_azalt_fn) {
439
+ throw new Error("swe_azalt function not available");
440
+ }
441
+ const BYTES = 8;
442
+ const geoPtr = this.module._malloc(3 * BYTES);
443
+ const xinPtr = this.module._malloc(3 * BYTES);
444
+ const xazPtr = this.module._malloc(3 * BYTES);
445
+ if (!geoPtr || !xinPtr || !xazPtr) {
446
+ if (geoPtr) this.module._free(geoPtr);
447
+ if (xinPtr) this.module._free(xinPtr);
448
+ if (xazPtr) this.module._free(xazPtr);
449
+ throw new Error("Memory allocation failed for azalt");
450
+ }
451
+ try {
452
+ this.module.setValue(geoPtr, longitude, "double");
453
+ this.module.setValue(geoPtr + BYTES, latitude, "double");
454
+ this.module.setValue(geoPtr + 2 * BYTES, altitude, "double");
455
+ this.module.setValue(xinPtr, xinLon, "double");
456
+ this.module.setValue(xinPtr + BYTES, xinLat, "double");
457
+ this.module.setValue(xinPtr + 2 * BYTES, xinDist, "double");
458
+ this.swe_azalt_fn(
459
+ julday,
460
+ fromEquatorial ? SE_EQU2HOR : SE_ECL2HOR,
461
+ geoPtr,
462
+ 0,
463
+ // atpress (0 = default 1013.25 mbar)
464
+ 0,
465
+ // attemp (0 = default 15°C)
466
+ xinPtr,
467
+ xazPtr
468
+ );
469
+ return {
470
+ azimuth: this.module.getValue(xazPtr, "double"),
471
+ trueAltitude: this.module.getValue(xazPtr + BYTES, "double"),
472
+ apparentAltitude: this.module.getValue(xazPtr + 2 * BYTES, "double")
473
+ };
474
+ } finally {
475
+ this.module._free(geoPtr);
476
+ this.module._free(xinPtr);
477
+ this.module._free(xazPtr);
478
+ }
479
+ }
480
+ /**
481
+ * Find the next rise, set, or meridian transit of a planet.
482
+ * Returns the Julian day of the event.
483
+ */
484
+ riseTransit(julday, planet, rsmi, longitude, latitude, altitude = 0, flags = 2 /* SWISS_EPH */) {
485
+ this.checkInitialized();
486
+ if (!this.swe_rise_trans_fn) {
487
+ throw new Error("swe_rise_trans function not available");
488
+ }
489
+ const BYTES = 8;
490
+ const geoPtr = this.module._malloc(3 * BYTES);
491
+ const tretPtr = this.module._malloc(BYTES);
492
+ const ERR_BYTES = 512;
493
+ const errPtr = this.module._malloc(ERR_BYTES);
494
+ if (!geoPtr || !tretPtr || !errPtr) {
495
+ if (geoPtr) this.module._free(geoPtr);
496
+ if (tretPtr) this.module._free(tretPtr);
497
+ if (errPtr) this.module._free(errPtr);
498
+ throw new Error("Memory allocation failed for riseTransit");
499
+ }
500
+ this.module.HEAP8.fill(0, errPtr, errPtr + ERR_BYTES);
501
+ try {
502
+ this.module.setValue(geoPtr, longitude, "double");
503
+ this.module.setValue(geoPtr + BYTES, latitude, "double");
504
+ this.module.setValue(geoPtr + 2 * BYTES, altitude, "double");
505
+ const ret = this.swe_rise_trans_fn(
506
+ julday,
507
+ planet,
508
+ 0,
509
+ // starname pointer (0 = planet, not fixed star)
510
+ flags,
511
+ rsmi,
512
+ geoPtr,
513
+ 0,
514
+ // atpress
515
+ 0,
516
+ // attemp
517
+ tretPtr,
518
+ errPtr
519
+ );
520
+ if (ret < 0) {
521
+ const msg = this.module.UTF8ToString(errPtr);
522
+ throw new Error(msg || `swe_rise_trans failed with code ${ret}`);
523
+ }
524
+ return this.module.getValue(tretPtr, "double");
525
+ } finally {
526
+ this.module._free(geoPtr);
527
+ this.module._free(tretPtr);
528
+ this.module._free(errPtr);
529
+ }
530
+ }
408
531
  };
409
532
  }
410
533
  });
@@ -6907,6 +7030,31 @@ var require_swisseph_node = __commonJS({
6907
7030
  });
6908
7031
 
6909
7032
  // src/astrology/swisseph.ts
7033
+ var swisseph_exports = {};
7034
+ __export(swisseph_exports, {
7035
+ CalcFlag: () => CalcFlag,
7036
+ HouseSystem: () => HouseSystem,
7037
+ PLANET_AND_NODE_NAMES: () => PLANET_AND_NODE_NAMES,
7038
+ Planet: () => Planet,
7039
+ REQUIRED_EPHE_FILES: () => REQUIRED_EPHE_FILES,
7040
+ RiseTransitFlag: () => RiseTransitFlag,
7041
+ VirtualNodes: () => VirtualNodes,
7042
+ calcParsFortunae: () => calcParsFortunae,
7043
+ calculateAsteroidPosition: () => calculateAsteroidPosition,
7044
+ calculateAzalt: () => calculateAzalt,
7045
+ calculateEquatorialPosition: () => calculateEquatorialPosition,
7046
+ calculateHouses: () => calculateHouses,
7047
+ calculatePlanetaryPositions: () => calculatePlanetaryPositions,
7048
+ calculateRiseTransit: () => calculateRiseTransit,
7049
+ calculateSinglePlanetPosition: () => calculateSinglePlanetPosition,
7050
+ closeSwissEph: () => closeSwissEph,
7051
+ getJulianDay: () => getJulianDay,
7052
+ getSwissEph: () => getSwissEph,
7053
+ inspectVirtualEphemerisPath: () => inspectVirtualEphemerisPath,
7054
+ normalizeAngle: () => normalizeAngle,
7055
+ resolveNodeEphemerisPath: () => resolveNodeEphemerisPath,
7056
+ toUtcDate: () => toUtcDate
7057
+ });
6910
7058
  function normalizeVirtualPath(path) {
6911
7059
  if (path === "/") {
6912
7060
  return path;
@@ -7135,6 +7283,39 @@ async function getSwissEph(options = {}) {
7135
7283
  throw error;
7136
7284
  }
7137
7285
  }
7286
+ function calculateSinglePlanetPosition(date, planet) {
7287
+ checkInitialization();
7288
+ const julday = swissEph.getJulianDay(date);
7289
+ return swissEph.calculatePlanetPosition(julday, planet, DEFAULT_FLAGS);
7290
+ }
7291
+ function calculateEquatorialPosition(date, planet) {
7292
+ checkInitialization();
7293
+ const julday = swissEph.getJulianDay(date);
7294
+ const pos = swissEph.calculatePlanetPosition(
7295
+ julday,
7296
+ planet,
7297
+ 2 /* SWISS_EPH */ | 2048 /* EQUATORIAL */
7298
+ );
7299
+ return {
7300
+ rightAscension: pos.longitude,
7301
+ declination: pos.latitude,
7302
+ distance: pos.distance
7303
+ };
7304
+ }
7305
+ function getJulianDay(date) {
7306
+ checkInitialization();
7307
+ return swissEph.getJulianDay(date);
7308
+ }
7309
+ function calculateRiseTransit(date, planet, latitude, longitude, event) {
7310
+ checkInitialization();
7311
+ const julday = swissEph.getJulianDay(date);
7312
+ return swissEph.riseTransit(julday, planet, event, longitude, latitude);
7313
+ }
7314
+ function calculateAzalt(date, latitude, longitude, eclLon, eclLat, dist) {
7315
+ checkInitialization();
7316
+ const julday = swissEph.getJulianDay(date);
7317
+ return swissEph.azalt(julday, longitude, latitude, 0, eclLon, eclLat, dist);
7318
+ }
7138
7319
  async function calculatePlanetaryPositions(date) {
7139
7320
  try {
7140
7321
  checkInitialization();
@@ -7189,6 +7370,20 @@ async function calculateHouses(date, latitude, longitude, houseSystem, options =
7189
7370
  throw error;
7190
7371
  }
7191
7372
  }
7373
+ async function calculateAsteroidPosition(date, mpcNumber) {
7374
+ try {
7375
+ checkInitialization();
7376
+ const julday = swissEph.getJulianDay(date);
7377
+ return swissEph.calculateAsteroidPosition(
7378
+ julday,
7379
+ mpcNumber,
7380
+ DEFAULT_FLAGS
7381
+ );
7382
+ } catch (error) {
7383
+ console.error("Error calculating asteroid:", error);
7384
+ throw error;
7385
+ }
7386
+ }
7192
7387
  function calcParsFortunae(asc, sunLon, moonLon, isDiurnal) {
7193
7388
  return parsFortunae(asc, sunLon, moonLon, isDiurnal);
7194
7389
  }
@@ -7254,6 +7449,9 @@ function getTimeZoneOffsetMs(instant, timeZone) {
7254
7449
  return asUTC - instant.getTime();
7255
7450
  }
7256
7451
  async function localToUtcDate(local, latitude, longitude, opts = {}) {
7452
+ if (opts.treatAsUTC === true) {
7453
+ return local instanceof Date ? local : createUtcDateFromParts(buildLocalParts(local));
7454
+ }
7257
7455
  const parts = buildLocalParts(local);
7258
7456
  const auto = opts.autoTimeZone !== false;
7259
7457
  if (typeof opts.utcOffsetMinutes === "number" && Number.isFinite(opts.utcOffsetMinutes)) {
@@ -7312,6 +7510,201 @@ var init_swisseph2 = __esm({
7312
7510
  }
7313
7511
  });
7314
7512
 
7513
+ // src/astrology/astrocartography.ts
7514
+ var astrocartography_exports = {};
7515
+ __export(astrocartography_exports, {
7516
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS: () => ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7517
+ computeAstrocartographyMap: () => computeAstrocartographyMap,
7518
+ computeEquatorialPositions: () => computeEquatorialPositions,
7519
+ computeGMST: () => computeGMST,
7520
+ computeHorizonLongitude: () => computeHorizonLongitude,
7521
+ computeICLongitude: () => computeICLongitude,
7522
+ computeMCLongitude: () => computeMCLongitude,
7523
+ findParansAtLatitude: () => findParansAtLatitude,
7524
+ geographicAngularDifference: () => geographicAngularDifference,
7525
+ queryAstrocartographyLocation: () => queryAstrocartographyLocation
7526
+ });
7527
+ function computeGMST(julianDay) {
7528
+ return normalizeAngle(
7529
+ 280.46061837 + 360.98564736629 * (julianDay - 2451545)
7530
+ );
7531
+ }
7532
+ function computeMCLongitude(gmst, ra) {
7533
+ return toGeoLon(normalizeAngle(gmst - ra));
7534
+ }
7535
+ function computeICLongitude(gmst, ra) {
7536
+ return toGeoLon(normalizeAngle(gmst - ra + 180));
7537
+ }
7538
+ function computeHorizonLongitude(gmst, ra, dec, latitude, angle) {
7539
+ const tanPhi = Math.tan(latitude * DEG);
7540
+ const tanDelta = Math.tan(dec * DEG);
7541
+ const cosH = -(tanPhi * tanDelta);
7542
+ if (Math.abs(cosH) > 1) return null;
7543
+ const H = Math.acos(cosH) / DEG;
7544
+ const lon = angle === "AC" ? normalizeAngle(gmst - ra - H) : normalizeAngle(gmst - ra + H);
7545
+ return toGeoLon(lon);
7546
+ }
7547
+ function geographicAngularDifference(a, b) {
7548
+ const d = normalizeAngle(a - b);
7549
+ return d > 180 ? 360 - d : d;
7550
+ }
7551
+ function toGeoLon(deg360) {
7552
+ const n = normalizeAngle(deg360);
7553
+ return n > 180 ? n - 360 : n;
7554
+ }
7555
+ function computeEquatorialPositions(date, planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS) {
7556
+ const result = {};
7557
+ for (const p of planets) {
7558
+ const name = PLANET_AND_NODE_NAMES[p];
7559
+ const eq = calculateEquatorialPosition(date, p);
7560
+ result[name] = {
7561
+ ra: eq.rightAscension,
7562
+ dec: eq.declination,
7563
+ planetId: p
7564
+ };
7565
+ }
7566
+ return result;
7567
+ }
7568
+ function findParansAtLatitude(equatorialPositions, gmst, latitude, paranOrb = 1) {
7569
+ const ANGLES = ["MC", "IC", "AC", "DC"];
7570
+ const lines = [];
7571
+ for (const [name, eq] of Object.entries(equatorialPositions)) {
7572
+ for (const angle of ANGLES) {
7573
+ let lon;
7574
+ if (angle === "MC") lon = computeMCLongitude(gmst, eq.ra);
7575
+ else if (angle === "IC") lon = computeICLongitude(gmst, eq.ra);
7576
+ else lon = computeHorizonLongitude(gmst, eq.ra, eq.dec, latitude, angle);
7577
+ if (lon !== null) {
7578
+ lines.push({ planet: name, angle, longitude: lon });
7579
+ }
7580
+ }
7581
+ }
7582
+ const parans = [];
7583
+ for (let i = 0; i < lines.length; i++) {
7584
+ for (let j = i + 1; j < lines.length; j++) {
7585
+ const a = lines[i];
7586
+ const b = lines[j];
7587
+ if (a.planet === b.planet) continue;
7588
+ if (a.angle === b.angle) continue;
7589
+ const dist = geographicAngularDifference(a.longitude, b.longitude);
7590
+ if (dist <= paranOrb) {
7591
+ parans.push({
7592
+ latitude,
7593
+ planetA: a.planet,
7594
+ angleA: a.angle,
7595
+ longitudeA: a.longitude,
7596
+ planetB: b.planet,
7597
+ angleB: b.angle,
7598
+ longitudeB: b.longitude
7599
+ });
7600
+ }
7601
+ }
7602
+ }
7603
+ return parans;
7604
+ }
7605
+ function queryAstrocartographyLocation(date, options) {
7606
+ const {
7607
+ latitude,
7608
+ longitude,
7609
+ orb = 2,
7610
+ planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7611
+ paranOrb = 1
7612
+ } = options;
7613
+ const jd = getJulianDay(date);
7614
+ const gmst = computeGMST(jd);
7615
+ const positions = computeEquatorialPositions(date, planets);
7616
+ const lines = [];
7617
+ const ANGLES = ["MC", "IC", "AC", "DC"];
7618
+ for (const [name, eq] of Object.entries(positions)) {
7619
+ for (const angle of ANGLES) {
7620
+ let lineLon;
7621
+ if (angle === "MC") lineLon = computeMCLongitude(gmst, eq.ra);
7622
+ else if (angle === "IC") lineLon = computeICLongitude(gmst, eq.ra);
7623
+ else
7624
+ lineLon = computeHorizonLongitude(
7625
+ gmst,
7626
+ eq.ra,
7627
+ eq.dec,
7628
+ latitude,
7629
+ angle
7630
+ );
7631
+ if (lineLon === null) continue;
7632
+ const dist = geographicAngularDifference(longitude, lineLon);
7633
+ lines.push({
7634
+ planet: name,
7635
+ angle,
7636
+ distance: Math.round(dist * 1e3) / 1e3,
7637
+ active: dist <= orb,
7638
+ longitude: Math.round(lineLon * 1e3) / 1e3
7639
+ });
7640
+ }
7641
+ }
7642
+ lines.sort((a, b) => a.distance - b.distance);
7643
+ const activeLines = lines.filter((l) => l.active);
7644
+ const parans = findParansAtLatitude(positions, gmst, latitude, paranOrb);
7645
+ return { queryLatitude: latitude, queryLongitude: longitude, orb, lines, activeLines, parans };
7646
+ }
7647
+ function computeAstrocartographyMap(date, options = {}) {
7648
+ const {
7649
+ latitudeStep = 1,
7650
+ latitudeRange = 66.5,
7651
+ planets = ASTROCARTOGRAPHY_DEFAULT_PLANETS
7652
+ } = options;
7653
+ const jd = getJulianDay(date);
7654
+ const gmst = computeGMST(jd);
7655
+ const positions = computeEquatorialPositions(date, planets);
7656
+ const meridianLines = [];
7657
+ const horizonLines = [];
7658
+ for (const [name, eq] of Object.entries(positions)) {
7659
+ meridianLines.push({
7660
+ planet: name,
7661
+ angle: "MC",
7662
+ longitude: Math.round(computeMCLongitude(gmst, eq.ra) * 1e3) / 1e3
7663
+ });
7664
+ meridianLines.push({
7665
+ planet: name,
7666
+ angle: "IC",
7667
+ longitude: Math.round(computeICLongitude(gmst, eq.ra) * 1e3) / 1e3
7668
+ });
7669
+ for (const angle of ["AC", "DC"]) {
7670
+ const points = [];
7671
+ for (let lat = -latitudeRange; lat <= latitudeRange; lat += latitudeStep) {
7672
+ const lon = computeHorizonLongitude(gmst, eq.ra, eq.dec, lat, angle);
7673
+ if (lon !== null) {
7674
+ points.push({
7675
+ latitude: Math.round(lat * 1e3) / 1e3,
7676
+ longitude: Math.round(lon * 1e3) / 1e3
7677
+ });
7678
+ }
7679
+ }
7680
+ horizonLines.push({ planet: name, angle, points });
7681
+ }
7682
+ }
7683
+ return { meridianLines, horizonLines };
7684
+ }
7685
+ var ASTROCARTOGRAPHY_DEFAULT_PLANETS, DEG;
7686
+ var init_astrocartography = __esm({
7687
+ "src/astrology/astrocartography.ts"() {
7688
+ "use strict";
7689
+ init_swisseph2();
7690
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS = [
7691
+ 0 /* SUN */,
7692
+ 1 /* MOON */,
7693
+ 2 /* MERCURY */,
7694
+ 3 /* VENUS */,
7695
+ 4 /* MARS */,
7696
+ 5 /* JUPITER */,
7697
+ 6 /* SATURN */,
7698
+ 7 /* URANUS */,
7699
+ 8 /* NEPTUNE */,
7700
+ 9 /* PLUTO */,
7701
+ 15 /* CHIRON */,
7702
+ 11 /* TRUE_NODE */
7703
+ ];
7704
+ DEG = Math.PI / 180;
7705
+ }
7706
+ });
7707
+
7315
7708
  // src/astrology/aspects.ts
7316
7709
  function getAspectMatch(lonA, lonB, specs = DEFAULT_ASPECT_SPECS) {
7317
7710
  const a = normalizeAngle(lonA);
@@ -7391,7 +7784,41 @@ function computeMidpoints(planetsA, planetsB) {
7391
7784
  }
7392
7785
  return result;
7393
7786
  }
7394
- var DEFAULT_ASPECT_SPECS;
7787
+ function computeTransitAspects(transitPlanets, natalPlanets, specs = DEFAULT_ASPECT_SPECS) {
7788
+ const keysT = Object.keys(transitPlanets);
7789
+ const keysN = Object.keys(natalPlanets);
7790
+ const edges = [];
7791
+ for (const kT of keysT) {
7792
+ const t = transitPlanets[kT];
7793
+ for (const kN of keysN) {
7794
+ const n = natalPlanets[kN];
7795
+ const match = getAspectMatch(t.longitude, n.longitude, specs);
7796
+ if (!match) continue;
7797
+ const tSpeed = t.longitudeSpeed ?? 0;
7798
+ const nSpeed = n.longitudeSpeed ?? 0;
7799
+ const dt = 0.01;
7800
+ const tLonFuture = t.longitude + tSpeed * dt;
7801
+ const nLonFuture = n.longitude + nSpeed * dt;
7802
+ const futureMatch = getAspectMatch(tLonFuture, nLonFuture, [match.spec]);
7803
+ const applying = futureMatch != null ? futureMatch.orb < match.orb : false;
7804
+ edges.push({
7805
+ planetA: kT,
7806
+ planetB: kN,
7807
+ longitudeA: t.longitude,
7808
+ longitudeB: n.longitude,
7809
+ aspect: match.spec.name,
7810
+ aspectAngle: match.spec.angle,
7811
+ delta: match.delta,
7812
+ orb: match.orb,
7813
+ applying,
7814
+ retrograde: tSpeed < 0,
7815
+ category: SLOW_PLANETS.has(kT) ? "slow" : "fast"
7816
+ });
7817
+ }
7818
+ }
7819
+ return edges;
7820
+ }
7821
+ var DEFAULT_ASPECT_SPECS, SLOW_PLANETS;
7395
7822
  var init_aspects = __esm({
7396
7823
  "src/astrology/aspects.ts"() {
7397
7824
  "use strict";
@@ -7407,32 +7834,364 @@ var init_aspects = __esm({
7407
7834
  { name: "quincunx", angle: 150, orb: 3 },
7408
7835
  { name: "opposition", angle: 180, orb: 8 }
7409
7836
  ];
7837
+ SLOW_PLANETS = /* @__PURE__ */ new Set([
7838
+ "pluto",
7839
+ "neptune",
7840
+ "uranus",
7841
+ "saturn",
7842
+ "jupiter",
7843
+ "chiron",
7844
+ "mean node",
7845
+ "true node",
7846
+ "lilith true",
7847
+ "lilith mean"
7848
+ ]);
7849
+ }
7850
+ });
7851
+
7852
+ // src/astrology/dignity.ts
7853
+ function getDomicileRuler(sign) {
7854
+ return DOMICILE_RULERS[sign];
7855
+ }
7856
+ function getExaltation(planet) {
7857
+ return EXALTATIONS[planet];
7858
+ }
7859
+ function getOppositeSign(sign) {
7860
+ const idx = SIGNS.indexOf(sign);
7861
+ return SIGNS[(idx + 6) % 12];
7862
+ }
7863
+ function getDetriment(planet) {
7864
+ const signs = [];
7865
+ for (const [sign, ruler] of Object.entries(DOMICILE_RULERS)) {
7866
+ if (ruler === planet) {
7867
+ signs.push(getOppositeSign(sign));
7868
+ }
7869
+ }
7870
+ return signs;
7871
+ }
7872
+ function getFall(planet) {
7873
+ return getOppositeSign(EXALTATIONS[planet].sign);
7874
+ }
7875
+ function getEssentialDignity(planet, sign) {
7876
+ const domicile = DOMICILE_RULERS[sign] === planet;
7877
+ const exaltation = EXALTATIONS[planet].sign === sign;
7878
+ const detrimentSigns = getDetriment(planet);
7879
+ const detriment = detrimentSigns.includes(sign);
7880
+ const fallSign = getFall(planet);
7881
+ const fall = fallSign === sign;
7882
+ const domicileRuler = DOMICILE_RULERS[sign];
7883
+ const peregrine = !domicile && !exaltation && !detriment && !fall;
7884
+ return { domicile, exaltation, detriment, fall, domicileRuler, peregrine };
7885
+ }
7886
+ var DOMICILE_RULERS, EXALTATIONS;
7887
+ var init_dignity = __esm({
7888
+ "src/astrology/dignity.ts"() {
7889
+ "use strict";
7890
+ init_astrology();
7891
+ DOMICILE_RULERS = {
7892
+ Aries: "Mars",
7893
+ Taurus: "Venus",
7894
+ Gemini: "Mercury",
7895
+ Cancer: "Moon",
7896
+ Leo: "Sun",
7897
+ Virgo: "Mercury",
7898
+ Libra: "Venus",
7899
+ Scorpio: "Mars",
7900
+ Sagittarius: "Jupiter",
7901
+ Capricorn: "Saturn",
7902
+ Aquarius: "Saturn",
7903
+ Pisces: "Jupiter"
7904
+ };
7905
+ EXALTATIONS = {
7906
+ Sun: { sign: "Aries", degree: 19 },
7907
+ Moon: { sign: "Taurus", degree: 3 },
7908
+ Mercury: { sign: "Virgo", degree: 15 },
7909
+ Venus: { sign: "Pisces", degree: 27 },
7910
+ Mars: { sign: "Capricorn", degree: 28 },
7911
+ Jupiter: { sign: "Cancer", degree: 15 },
7912
+ Saturn: { sign: "Libra", degree: 21 }
7913
+ };
7914
+ }
7915
+ });
7916
+
7917
+ // src/astrology/decans.ts
7918
+ function getDecan(longitude) {
7919
+ const L = normalizeAngle(longitude);
7920
+ const signIndex = Math.floor(L / 30) % 12;
7921
+ const degreeWithinSign = L - signIndex * 30;
7922
+ const decanIndex = Math.min(Math.floor(degreeWithinSign / 10), 2);
7923
+ const globalDecanIndex = signIndex * 3 + decanIndex;
7924
+ const sign = SIGNS[signIndex];
7925
+ const ruler = CHALDEAN_RULERS[globalDecanIndex % 7];
7926
+ const suit = SIGN_SUITS[sign];
7927
+ const rank = RANK_NAMES[globalDecanIndex % 9];
7928
+ const tarotCard = `${rank} of ${suit}`;
7929
+ return {
7930
+ sign,
7931
+ decanNumber: decanIndex + 1,
7932
+ ruler,
7933
+ tarotCard,
7934
+ startDegree: signIndex * 30 + decanIndex * 10,
7935
+ endDegree: signIndex * 30 + (decanIndex + 1) * 10,
7936
+ degreeWithinSign
7937
+ };
7938
+ }
7939
+ var CHALDEAN_RULERS, SIGN_SUITS, RANK_NAMES;
7940
+ var init_decans = __esm({
7941
+ "src/astrology/decans.ts"() {
7942
+ "use strict";
7943
+ init_swisseph2();
7944
+ init_astrology();
7945
+ CHALDEAN_RULERS = [
7946
+ "Mars",
7947
+ "Sun",
7948
+ "Venus",
7949
+ "Mercury",
7950
+ "Moon",
7951
+ "Saturn",
7952
+ "Jupiter"
7953
+ ];
7954
+ SIGN_SUITS = {
7955
+ Aries: "Wands",
7956
+ Taurus: "Pentacles",
7957
+ Gemini: "Swords",
7958
+ Cancer: "Cups",
7959
+ Leo: "Wands",
7960
+ Virgo: "Pentacles",
7961
+ Libra: "Swords",
7962
+ Scorpio: "Cups",
7963
+ Sagittarius: "Wands",
7964
+ Capricorn: "Pentacles",
7965
+ Aquarius: "Swords",
7966
+ Pisces: "Cups"
7967
+ };
7968
+ RANK_NAMES = ["Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten"];
7969
+ }
7970
+ });
7971
+
7972
+ // src/astrology/dodecatemoria.ts
7973
+ function getDodecatemoria(longitude) {
7974
+ const L = normalizeAngle(longitude);
7975
+ const signIndex = Math.floor(L / 30) % 12;
7976
+ const degreeWithinSign = L - signIndex * 30;
7977
+ const index = Math.min(Math.floor(degreeWithinSign / 2.5), 11);
7978
+ const dodecatemoriaSignIndex = (signIndex + index) % 12;
7979
+ return {
7980
+ originalSign: SIGNS[signIndex],
7981
+ originalDegree: degreeWithinSign,
7982
+ dodecatemoriaSign: SIGNS[dodecatemoriaSignIndex],
7983
+ dodecatemoriaIndex: index
7984
+ };
7985
+ }
7986
+ var init_dodecatemoria = __esm({
7987
+ "src/astrology/dodecatemoria.ts"() {
7988
+ "use strict";
7989
+ init_swisseph2();
7990
+ init_astrology();
7991
+ }
7992
+ });
7993
+
7994
+ // src/astrology/profections.ts
7995
+ function getAnnualProfection(natalChart, birthDate, targetYear) {
7996
+ const year = targetYear ?? (/* @__PURE__ */ new Date()).getFullYear();
7997
+ const birthYear = birthDate.getFullYear();
7998
+ const age = year - birthYear;
7999
+ if (age < 0) {
8000
+ throw new Error(`Target year (${year}) is before birth year (${birthYear}).`);
8001
+ }
8002
+ const house = age % 12 + 1;
8003
+ const sign = natalChart.houses.houses[house - 1].sign;
8004
+ const ruler = getDomicileRuler(sign);
8005
+ return { age, house, sign, ruler, targetYear: year };
8006
+ }
8007
+ function getMonthlyProfections(natalChart, birthDate, targetYear) {
8008
+ const annualProfection = getAnnualProfection(natalChart, birthDate, targetYear);
8009
+ const annualSignIndex = SIGNS.indexOf(annualProfection.sign);
8010
+ const bdMonth = birthDate.getMonth();
8011
+ const bdDay = birthDate.getDate();
8012
+ const year = annualProfection.targetYear;
8013
+ const months = [];
8014
+ for (let i = 0; i < 12; i++) {
8015
+ const monthDate = new Date(year, bdMonth + i, bdDay);
8016
+ if (monthDate.getDate() !== bdDay) {
8017
+ monthDate.setDate(0);
8018
+ }
8019
+ const signIndex = (annualSignIndex + i) % 12;
8020
+ const sign = SIGNS[signIndex];
8021
+ months.push({
8022
+ month: i + 1,
8023
+ startDate: monthDate,
8024
+ sign,
8025
+ ruler: getDomicileRuler(sign)
8026
+ });
8027
+ }
8028
+ return { annualProfection, months };
8029
+ }
8030
+ var init_profections = __esm({
8031
+ "src/astrology/profections.ts"() {
8032
+ "use strict";
8033
+ init_dignity();
8034
+ init_astrology();
8035
+ }
8036
+ });
8037
+
8038
+ // src/astrology/firdaria.ts
8039
+ function addYears(date, years) {
8040
+ const ms = years * 365.25 * 24 * 60 * 60 * 1e3;
8041
+ return new Date(date.getTime() + ms);
8042
+ }
8043
+ function getSubPeriodStart(planet, options) {
8044
+ const mode = options?.nodeSubPeriodStart ?? "jupiter-saturn";
8045
+ if (planet === "NorthNode") {
8046
+ if (mode === "sun-mars") {
8047
+ return CHALDEAN_ORDER.indexOf("Sun");
8048
+ }
8049
+ return CHALDEAN_ORDER.indexOf("Jupiter");
8050
+ }
8051
+ if (planet === "SouthNode") {
8052
+ if (mode === "sun-mars") {
8053
+ return CHALDEAN_ORDER.indexOf("Mars");
8054
+ }
8055
+ return CHALDEAN_ORDER.indexOf("Saturn");
8056
+ }
8057
+ return CHALDEAN_ORDER.indexOf(planet);
8058
+ }
8059
+ function buildSubPeriods(major, majorStart, majorEnd, options) {
8060
+ const startIdx = getSubPeriodStart(major.planet, options);
8061
+ const totalMs = majorEnd.getTime() - majorStart.getTime();
8062
+ const subMs = totalMs / 7;
8063
+ const subs = [];
8064
+ for (let i = 0; i < 7; i++) {
8065
+ const subPlanet = CHALDEAN_ORDER[(startIdx + i) % 7];
8066
+ const subStart = new Date(majorStart.getTime() + i * subMs);
8067
+ const subEnd = new Date(majorStart.getTime() + (i + 1) * subMs);
8068
+ subs.push({ planet: subPlanet, startDate: subStart, endDate: subEnd });
8069
+ }
8070
+ return subs;
8071
+ }
8072
+ function getFirdaria(birthDate, isDiurnal, targetDate, options) {
8073
+ const target = targetDate ?? /* @__PURE__ */ new Date();
8074
+ const sequence = isDiurnal ? DAY_SEQUENCE : NIGHT_SEQUENCE;
8075
+ const sect = isDiurnal ? "diurnal" : "nocturnal";
8076
+ const allPeriods = [];
8077
+ let cursor = new Date(birthDate.getTime());
8078
+ let foundCurrent = false;
8079
+ for (let cycle = 0; cycle < 3 && !foundCurrent; cycle++) {
8080
+ for (const entry of sequence) {
8081
+ const start = new Date(cursor.getTime());
8082
+ const end = addYears(start, entry.years);
8083
+ const subPeriods = buildSubPeriods(entry, start, end, options);
8084
+ allPeriods.push({
8085
+ planet: entry.planet,
8086
+ years: entry.years,
8087
+ startDate: start,
8088
+ endDate: end,
8089
+ subPeriods
8090
+ });
8091
+ cursor = end;
8092
+ if (target.getTime() >= start.getTime() && target.getTime() < end.getTime()) {
8093
+ foundCurrent = true;
8094
+ }
8095
+ }
8096
+ }
8097
+ const currentMajor = allPeriods.find(
8098
+ (p) => target.getTime() >= p.startDate.getTime() && target.getTime() < p.endDate.getTime()
8099
+ ) ?? allPeriods[0];
8100
+ const currentSub = currentMajor.subPeriods.find(
8101
+ (s) => target.getTime() >= s.startDate.getTime() && target.getTime() < s.endDate.getTime()
8102
+ ) ?? currentMajor.subPeriods[0];
8103
+ return { sect, currentMajor, currentSub, allPeriods };
8104
+ }
8105
+ var DAY_SEQUENCE, NIGHT_SEQUENCE, CHALDEAN_ORDER;
8106
+ var init_firdaria = __esm({
8107
+ "src/astrology/firdaria.ts"() {
8108
+ "use strict";
8109
+ DAY_SEQUENCE = [
8110
+ { planet: "Sun", years: 10 },
8111
+ { planet: "Venus", years: 8 },
8112
+ { planet: "Mercury", years: 13 },
8113
+ { planet: "Moon", years: 9 },
8114
+ { planet: "Saturn", years: 11 },
8115
+ { planet: "Jupiter", years: 12 },
8116
+ { planet: "Mars", years: 7 },
8117
+ { planet: "NorthNode", years: 3 },
8118
+ { planet: "SouthNode", years: 2 }
8119
+ ];
8120
+ NIGHT_SEQUENCE = [
8121
+ { planet: "Moon", years: 9 },
8122
+ { planet: "Saturn", years: 11 },
8123
+ { planet: "Jupiter", years: 12 },
8124
+ { planet: "Mars", years: 7 },
8125
+ { planet: "NorthNode", years: 3 },
8126
+ { planet: "SouthNode", years: 2 },
8127
+ { planet: "Sun", years: 10 },
8128
+ { planet: "Venus", years: 8 },
8129
+ { planet: "Mercury", years: 13 }
8130
+ ];
8131
+ CHALDEAN_ORDER = [
8132
+ "Saturn",
8133
+ "Jupiter",
8134
+ "Mars",
8135
+ "Sun",
8136
+ "Venus",
8137
+ "Mercury",
8138
+ "Moon"
8139
+ ];
7410
8140
  }
7411
8141
  });
7412
8142
 
7413
8143
  // src/astrology/index.ts
7414
8144
  var astrology_exports = {};
7415
8145
  __export(astrology_exports, {
8146
+ ASTROCARTOGRAPHY_DEFAULT_PLANETS: () => ASTROCARTOGRAPHY_DEFAULT_PLANETS,
7416
8147
  CalcFlag: () => CalcFlag,
7417
8148
  DEFAULT_ASPECT_SPECS: () => DEFAULT_ASPECT_SPECS,
8149
+ DOMICILE_RULERS: () => DOMICILE_RULERS,
8150
+ EXALTATIONS: () => EXALTATIONS,
7418
8151
  HouseSystem: () => HouseSystem,
7419
8152
  PLANET_AND_NODE_NAMES: () => PLANET_AND_NODE_NAMES,
7420
8153
  Planet: () => Planet,
8154
+ RiseTransitFlag: () => RiseTransitFlag,
7421
8155
  SIGNS: () => SIGNS,
8156
+ SLOW_PLANETS: () => SLOW_PLANETS,
7422
8157
  VirtualNodes: () => VirtualNodes,
7423
8158
  closeSwissEph: () => closeSwissEph,
7424
8159
  computeAspects: () => computeAspects,
8160
+ computeAstrocartographyMap: () => computeAstrocartographyMap,
8161
+ computeEquatorialPositions: () => computeEquatorialPositions,
8162
+ computeGMST: () => computeGMST,
8163
+ computeHorizonLongitude: () => computeHorizonLongitude,
8164
+ computeICLongitude: () => computeICLongitude,
8165
+ computeMCLongitude: () => computeMCLongitude,
7425
8166
  computeMidpoints: () => computeMidpoints,
7426
8167
  computeSynastryAspects: () => computeSynastryAspects,
8168
+ computeTransitAspects: () => computeTransitAspects,
7427
8169
  findHouseOf: () => findHouseOf,
8170
+ findParansAtLatitude: () => findParansAtLatitude,
7428
8171
  formatDegreeMinutes: () => formatDegreeMinutes,
8172
+ geographicAngularDifference: () => geographicAngularDifference,
8173
+ getAnnualProfection: () => getAnnualProfection,
7429
8174
  getAspectMatch: () => getAspectMatch,
7430
8175
  getBirthChart: () => getBirthChart,
7431
8176
  getCompositeChart: () => getCompositeChart,
8177
+ getDecan: () => getDecan,
8178
+ getDetriment: () => getDetriment,
8179
+ getDodecatemoria: () => getDodecatemoria,
8180
+ getDomicileRuler: () => getDomicileRuler,
8181
+ getEssentialDignity: () => getEssentialDignity,
8182
+ getExaltation: () => getExaltation,
8183
+ getFall: () => getFall,
8184
+ getFirdaria: () => getFirdaria,
8185
+ getMonthlyProfections: () => getMonthlyProfections,
8186
+ getOppositeSign: () => getOppositeSign,
8187
+ getSolarReturnChart: () => getSolarReturnChart,
7432
8188
  getSwissEph: () => getSwissEph,
7433
8189
  getSynastryChart: () => getSynastryChart,
8190
+ getTransitChart: () => getTransitChart,
8191
+ getTransitRange: () => getTransitRange,
7434
8192
  getZodiacPosition: () => getZodiacPosition,
7435
8193
  normalizeAngle: () => normalizeAngle,
8194
+ queryAstrocartographyLocation: () => queryAstrocartographyLocation,
7436
8195
  shorterArcMidpoint: () => shorterArcMidpoint
7437
8196
  });
7438
8197
  function validateInputs(options) {
@@ -7531,7 +8290,8 @@ async function getBirthChart(options) {
7531
8290
  planets,
7532
8291
  houses,
7533
8292
  nodes,
7534
- aspects
8293
+ aspects,
8294
+ sect: isDiurnal ? "diurnal" : "nocturnal"
7535
8295
  };
7536
8296
  } catch (error) {
7537
8297
  console.error("Error calculating birth chart:", error);
@@ -7623,12 +8383,329 @@ async function getCompositeChart(options) {
7623
8383
  aspects
7624
8384
  };
7625
8385
  }
7626
- var SIGNS;
8386
+ function getTransitAspectPoints(planets) {
8387
+ const points = {};
8388
+ for (const [key, p] of Object.entries(planets)) {
8389
+ points[key] = { longitude: p.longitude, longitudeSpeed: p.longitudeSpeed };
8390
+ }
8391
+ return points;
8392
+ }
8393
+ function getNatalAspectPoints(planets, ascLon, mcLon) {
8394
+ const points = {};
8395
+ for (const [key, p] of Object.entries(planets)) {
8396
+ points[key] = { longitude: p.longitude, longitudeSpeed: 0 };
8397
+ }
8398
+ points.ascendant = { longitude: ascLon, longitudeSpeed: 0 };
8399
+ points.mc = { longitude: mcLon, longitudeSpeed: 0 };
8400
+ return points;
8401
+ }
8402
+ function filterByNames(points, names) {
8403
+ if (!names || names.length === 0) return points;
8404
+ const allowed = new Set(names.map((n) => n.toLowerCase()));
8405
+ const result = {};
8406
+ for (const [key, val] of Object.entries(points)) {
8407
+ if (allowed.has(key)) result[key] = val;
8408
+ }
8409
+ return result;
8410
+ }
8411
+ async function getTransitChart(options) {
8412
+ const natalChart = await getBirthChart(options.natal);
8413
+ const transitChart = await getBirthChart({
8414
+ date: options.transitDate,
8415
+ latitude: options.transitLatitude ?? options.natal.latitude,
8416
+ longitude: options.transitLongitude ?? options.natal.longitude,
8417
+ houseSystem: options.natal.houseSystem,
8418
+ timeZoneSettings: options.transitTimeZoneSettings ?? { autoTimeZone: true }
8419
+ });
8420
+ const natalCusps = natalChart.houses.houses.map((h) => h.longitude);
8421
+ const transitPlanets = {};
8422
+ for (const [key, planet] of Object.entries(transitChart.planets)) {
8423
+ const natalZodiac = getZodiacPosition(planet.longitude, natalCusps);
8424
+ transitPlanets[key] = {
8425
+ ...planet,
8426
+ retrograde: (planet.longitudeSpeed ?? 0) < 0,
8427
+ natalHouse: natalZodiac.house,
8428
+ zodiacPosition: {
8429
+ ...planet.zodiacPosition,
8430
+ house: natalZodiac.house
8431
+ }
8432
+ };
8433
+ }
8434
+ let tPoints = getTransitAspectPoints(transitChart.planets);
8435
+ let nPoints = getNatalAspectPoints(
8436
+ natalChart.planets,
8437
+ natalChart.houses.ascendant.longitude,
8438
+ natalChart.houses.mc.longitude
8439
+ );
8440
+ tPoints = filterByNames(tPoints, options.transitPlanets);
8441
+ nPoints = filterByNames(nPoints, options.natalPlanets);
8442
+ let aspects = computeTransitAspects(tPoints, nPoints, options.aspectSpecs);
8443
+ if (options.maxOrb != null) {
8444
+ aspects = aspects.filter((a) => a.orb <= options.maxOrb);
8445
+ }
8446
+ if (options.aspectFilter && options.aspectFilter.length > 0) {
8447
+ const allowed = new Set(options.aspectFilter);
8448
+ aspects = aspects.filter((a) => allowed.has(a.aspect));
8449
+ }
8450
+ return {
8451
+ natalChart,
8452
+ transitDateUtc: transitChart.dateUtc,
8453
+ transitPlanets,
8454
+ aspects
8455
+ };
8456
+ }
8457
+ async function getTransitRange(options) {
8458
+ const natalChart = await getBirthChart(options.natal);
8459
+ const natalCusps = natalChart.houses.houses.map((h) => h.longitude);
8460
+ const nPoints = filterByNames(
8461
+ getNatalAspectPoints(
8462
+ natalChart.planets,
8463
+ natalChart.houses.ascendant.longitude,
8464
+ natalChart.houses.mc.longitude
8465
+ ),
8466
+ options.natalPlanets
8467
+ );
8468
+ const natalKeys = Object.keys(nPoints);
8469
+ const rawStep = options.stepDays ?? 1;
8470
+ if (rawStep <= 0) throw new Error("stepDays must be greater than 0");
8471
+ const fromMs = options.from.getTime();
8472
+ const toMs = options.to.getTime();
8473
+ const specs = options.aspectSpecs;
8474
+ const steps = [];
8475
+ const transitLat = options.transitLatitude ?? options.natal.latitude;
8476
+ const transitLon = options.transitLongitude ?? options.natal.longitude;
8477
+ const transitTz = options.transitTimeZoneSettings ?? { autoTimeZone: true };
8478
+ const FAST_PLANET_MAX_STEP = 0.25;
8479
+ let effectiveStepDays = rawStep;
8480
+ const requestedTransitPlanets = options.transitPlanets?.map((n) => n.toLowerCase());
8481
+ const hasFastPlanets = requestedTransitPlanets ? requestedTransitPlanets.some((n) => !SLOW_PLANETS.has(n)) : true;
8482
+ if (hasFastPlanets && effectiveStepDays > FAST_PLANET_MAX_STEP) {
8483
+ effectiveStepDays = FAST_PLANET_MAX_STEP;
8484
+ }
8485
+ const stepMs = effectiveStepDays * 864e5;
8486
+ const scanEndMs = toMs + stepMs;
8487
+ for (let ms = fromMs; ms <= scanEndMs; ms += stepMs) {
8488
+ const date = new Date(ms);
8489
+ const utcDate = await toUtcDate(date, transitLat, transitLon, transitTz ?? { autoTimeZone: true });
8490
+ const positions = await calculatePlanetaryPositions(utcDate);
8491
+ if (!positions) continue;
8492
+ const points = {};
8493
+ for (const [planetId, pos] of Object.entries(positions)) {
8494
+ const id2 = planetId;
8495
+ const name = PLANET_AND_NODE_NAMES[id2].toLowerCase();
8496
+ points[name] = { longitude: pos.longitude, longitudeSpeed: pos.longitudeSpeed };
8497
+ }
8498
+ steps.push({ time: ms, positions: filterByNames(points, options.transitPlanets) });
8499
+ }
8500
+ const perfections = [];
8501
+ const transitKeys = steps.length > 0 ? Object.keys(steps[0].positions) : [];
8502
+ for (const tKey of transitKeys) {
8503
+ for (const nKey of natalKeys) {
8504
+ let prevOrb = null;
8505
+ let prevDecreasing = false;
8506
+ let prevStep = null;
8507
+ for (const step of steps) {
8508
+ const tPos = step.positions[tKey];
8509
+ const nPos = nPoints[nKey];
8510
+ if (!tPos || !nPos) continue;
8511
+ const match = specs ? findClosestAspectOrb(tPos.longitude, nPos.longitude, specs) : findClosestAspectOrb(tPos.longitude, nPos.longitude);
8512
+ if (!match) {
8513
+ prevOrb = null;
8514
+ prevStep = step;
8515
+ continue;
8516
+ }
8517
+ const currentOrb = match.orb;
8518
+ if (prevOrb != null && prevStep) {
8519
+ const wasDecreasing = prevOrb > currentOrb;
8520
+ if (prevDecreasing && !wasDecreasing && currentOrb <= match.spec.orb) {
8521
+ const exactResult = await binarySearchPerfection(
8522
+ tKey,
8523
+ nKey,
8524
+ match.spec,
8525
+ prevStep.time,
8526
+ step.time,
8527
+ nPos,
8528
+ transitLat,
8529
+ transitLon,
8530
+ transitTz
8531
+ );
8532
+ if (exactResult) perfections.push(exactResult);
8533
+ }
8534
+ prevDecreasing = wasDecreasing;
8535
+ } else {
8536
+ prevDecreasing = false;
8537
+ }
8538
+ prevOrb = currentOrb;
8539
+ prevStep = step;
8540
+ }
8541
+ }
8542
+ }
8543
+ let filtered = perfections.filter((p) => {
8544
+ const t = p.exactDate.getTime();
8545
+ return t >= fromMs && t <= toMs;
8546
+ });
8547
+ if (options.maxOrb != null) {
8548
+ filtered = filtered.filter((p) => p.exactOrb <= options.maxOrb);
8549
+ }
8550
+ if (options.aspectFilter && options.aspectFilter.length > 0) {
8551
+ const allowed = new Set(options.aspectFilter);
8552
+ filtered = filtered.filter((p) => allowed.has(p.aspect));
8553
+ }
8554
+ filtered.sort((a, b) => a.exactDate.getTime() - b.exactDate.getTime());
8555
+ return {
8556
+ natalChart,
8557
+ from: options.from,
8558
+ to: options.to,
8559
+ perfections: filtered
8560
+ };
8561
+ }
8562
+ function findClosestAspectOrb(lonA, lonB, specs = DEFAULT_ASPECT_SPECS) {
8563
+ const a = normalizeAngle(lonA);
8564
+ const b = normalizeAngle(lonB);
8565
+ const delta = Math.min(normalizeAngle(b - a), normalizeAngle(a - b));
8566
+ let best = null;
8567
+ for (const spec of specs) {
8568
+ const orb = Math.abs(delta - spec.angle);
8569
+ if (orb <= spec.orb + 2) {
8570
+ if (!best || orb < best.orb) {
8571
+ best = { spec, orb, delta };
8572
+ }
8573
+ }
8574
+ }
8575
+ return best;
8576
+ }
8577
+ function computeOrbForAspect(transitLon, natalLon, aspectAngle) {
8578
+ const delta = Math.min(
8579
+ normalizeAngle(transitLon - natalLon),
8580
+ normalizeAngle(natalLon - transitLon)
8581
+ );
8582
+ return Math.abs(delta - aspectAngle);
8583
+ }
8584
+ async function getTransitLongitudeAt(ms, transitKey, transitLat, transitLon, transitTz) {
8585
+ const date = new Date(ms);
8586
+ const utc = await toUtcDate(date, transitLat, transitLon, transitTz);
8587
+ const planetId = NAME_TO_PLANET[transitKey];
8588
+ if (planetId != null) {
8589
+ try {
8590
+ return calculateSinglePlanetPosition(utc, planetId);
8591
+ } catch {
8592
+ return null;
8593
+ }
8594
+ }
8595
+ const positions = await calculatePlanetaryPositions(utc);
8596
+ if (!positions) return null;
8597
+ return findPlanetByName(positions, transitKey) ?? null;
8598
+ }
8599
+ async function binarySearchPerfection(transitKey, natalKey, spec, startMs, endMs, natalPoint, transitLat, transitLon, transitTz) {
8600
+ const tz = transitTz ?? { autoTimeZone: true };
8601
+ const maxIterations = 30;
8602
+ let lo = startMs;
8603
+ let hi = endMs;
8604
+ for (let i = 0; i < maxIterations; i++) {
8605
+ if (hi - lo < 6e4) break;
8606
+ const m1 = lo + Math.floor((hi - lo) / 3);
8607
+ const m2 = hi - Math.floor((hi - lo) / 3);
8608
+ const pos1 = await getTransitLongitudeAt(m1, transitKey, transitLat, transitLon, tz);
8609
+ const pos2 = await getTransitLongitudeAt(m2, transitKey, transitLat, transitLon, tz);
8610
+ if (!pos1 || !pos2) break;
8611
+ const orb1 = computeOrbForAspect(pos1.longitude, natalPoint.longitude, spec.angle);
8612
+ const orb2 = computeOrbForAspect(pos2.longitude, natalPoint.longitude, spec.angle);
8613
+ if (orb1 < orb2) {
8614
+ hi = m2;
8615
+ } else {
8616
+ lo = m1;
8617
+ }
8618
+ }
8619
+ const finalMs = Math.floor((lo + hi) / 2);
8620
+ const finalPos = await getTransitLongitudeAt(finalMs, transitKey, transitLat, transitLon, tz);
8621
+ if (!finalPos) return null;
8622
+ const finalOrb = computeOrbForAspect(finalPos.longitude, natalPoint.longitude, spec.angle);
8623
+ if (finalOrb > spec.orb) return null;
8624
+ return {
8625
+ transitPlanet: transitKey,
8626
+ natalPlanet: natalKey,
8627
+ aspect: spec.name,
8628
+ exactDate: new Date(finalMs),
8629
+ exactOrb: finalOrb,
8630
+ retrograde: (finalPos.longitudeSpeed ?? 0) < 0,
8631
+ category: SLOW_PLANETS.has(transitKey) ? "slow" : "fast"
8632
+ };
8633
+ }
8634
+ function findPlanetByName(positions, name) {
8635
+ for (const [planetId, pos] of Object.entries(positions)) {
8636
+ const id2 = planetId;
8637
+ if (PLANET_AND_NODE_NAMES[id2].toLowerCase() === name) return pos;
8638
+ }
8639
+ return void 0;
8640
+ }
8641
+ async function getSunLongitudeAtMs(ms) {
8642
+ const positions = await calculatePlanetaryPositions(new Date(ms));
8643
+ const sun = findPlanetByName(positions, "sun");
8644
+ if (!sun) throw new Error("Failed to compute Sun position");
8645
+ return sun.longitude;
8646
+ }
8647
+ function signedAngularDelta(current, target) {
8648
+ let d = normalizeAngle(current - target);
8649
+ if (d > 180) d -= 360;
8650
+ return d;
8651
+ }
8652
+ async function getSolarReturnChart(options) {
8653
+ const natalChart = await getBirthChart(options.natal);
8654
+ const natalSunLongitude = natalChart.planets.sun.longitude;
8655
+ const natalDate = options.natal.date;
8656
+ const approxReturn = new Date(Date.UTC(
8657
+ options.year,
8658
+ natalDate.getMonth(),
8659
+ natalDate.getDate(),
8660
+ 12,
8661
+ 0,
8662
+ 0
8663
+ ));
8664
+ let lo = approxReturn.getTime() - 2 * 864e5;
8665
+ let hi = approxReturn.getTime() + 2 * 864e5;
8666
+ for (let i = 0; i < 30; i++) {
8667
+ if (hi - lo < 6e4) break;
8668
+ const mid = Math.floor((lo + hi) / 2);
8669
+ const sunLon = await getSunLongitudeAtMs(mid);
8670
+ const delta = signedAngularDelta(sunLon, natalSunLongitude);
8671
+ if (delta < 0) {
8672
+ lo = mid;
8673
+ } else {
8674
+ hi = mid;
8675
+ }
8676
+ }
8677
+ const exactMs = Math.floor((lo + hi) / 2);
8678
+ const exactReturnDate = new Date(exactMs);
8679
+ const solarReturnChart = await getBirthChart({
8680
+ date: exactReturnDate,
8681
+ latitude: options.solarReturnLatitude ?? options.natal.latitude,
8682
+ longitude: options.solarReturnLongitude ?? options.natal.longitude,
8683
+ houseSystem: options.solarReturnHouseSystem ?? options.natal.houseSystem,
8684
+ // Always treatAsUTC: the binary search converged on a UTC millisecond timestamp.
8685
+ // Passing a caller timezone here would re-interpret the already-UTC instant as local,
8686
+ // shifting planetary positions by hours.
8687
+ timeZoneSettings: { treatAsUTC: true }
8688
+ });
8689
+ return {
8690
+ natalChart,
8691
+ solarReturnChart,
8692
+ exactReturnDate,
8693
+ natalSunLongitude,
8694
+ year: options.year
8695
+ };
8696
+ }
8697
+ var SIGNS, NAME_TO_PLANET;
7627
8698
  var init_astrology = __esm({
7628
8699
  "src/astrology/index.ts"() {
7629
8700
  "use strict";
7630
8701
  init_swisseph2();
8702
+ init_astrocartography();
7631
8703
  init_aspects();
8704
+ init_dignity();
8705
+ init_decans();
8706
+ init_dodecatemoria();
8707
+ init_profections();
8708
+ init_firdaria();
7632
8709
  init_aspects();
7633
8710
  SIGNS = [
7634
8711
  "Aries",
@@ -7644,6 +8721,11 @@ var init_astrology = __esm({
7644
8721
  "Aquarius",
7645
8722
  "Pisces"
7646
8723
  ];
8724
+ NAME_TO_PLANET = {};
8725
+ for (const [id2, name] of Object.entries(PLANET_AND_NODE_NAMES)) {
8726
+ const numId = Number(id2);
8727
+ if (!isNaN(numId)) NAME_TO_PLANET[name.toLowerCase()] = numId;
8728
+ }
7647
8729
  }
7648
8730
  });
7649
8731
 
@@ -7653,7 +8735,7 @@ var import_config3 = require("dotenv/config");
7653
8735
  // package.json
7654
8736
  var package_default = {
7655
8737
  name: "kaabalah",
7656
- version: "5.3.0",
8738
+ version: "5.5.0",
7657
8739
  description: "The de-facto library for any esoteric calculations and tooling",
7658
8740
  engines: {
7659
8741
  node: ">=18.18.0"
@@ -7956,6 +9038,200 @@ var COMMANDS = [
7956
9038
  "kaabalah astrology:composite --input-json=- --json --compact < composite.json"
7957
9039
  ]
7958
9040
  },
9041
+ {
9042
+ name: "astrology:transits",
9043
+ description: "Calculate transit aspects to a natal chart",
9044
+ args: [
9045
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9046
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9047
+ ],
9048
+ flags: [
9049
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9050
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9051
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9052
+ { name: "house-system", type: "string", default: "placidus", description: "House system" },
9053
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9054
+ { name: "transit-date", type: "string", description: "Transit date YYYY-MM-DD (default: today)" },
9055
+ { name: "transit-time", type: "string", description: "Transit time HH:MM (default: 12:00)" },
9056
+ { name: "transit-lat", type: "number", description: "Transit location latitude (default: natal lat)" },
9057
+ { name: "transit-lon", type: "number", description: "Transit location longitude (default: natal lon)" },
9058
+ { name: "transit-timezone", type: "string", description: "Transit IANA timezone (default: natal timezone)" },
9059
+ { name: "max-orb", type: "number", description: "Maximum orb in degrees to include" },
9060
+ { name: "aspects", type: "string", description: "Comma-separated aspect names, or 'major' for conjunction,sextile,square,trine,opposition" },
9061
+ { name: "transit-planets", type: "string", description: "Comma-separated transit planet names to include" },
9062
+ { name: "natal-planets", type: "string", description: "Comma-separated natal planet/point names to include" },
9063
+ { name: "from", type: "string", description: "Range start date YYYY-MM-DD (enables date range mode)" },
9064
+ { name: "to", type: "string", description: "Range end date YYYY-MM-DD (requires --from)" },
9065
+ { name: "step-days", type: "number", description: "Step size in days for range scan (default: 1)" },
9066
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9067
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9068
+ ],
9069
+ examples: [
9070
+ "kaabalah astrology:transits 1990-06-15 14:30 --lat=48.856 --lon=2.352 --transit-date=2026-03-17 --json --compact",
9071
+ "kaabalah astrology:transits 1990-01-15 14:30 --lat=40.71 --lon=-74 --from=2026-03-01 --to=2026-04-01 --json",
9072
+ "kaabalah astrology:transits 1990-01-15 --lat=40.71 --lon=-74 --aspects=major --transit-planets=saturn,pluto --json"
9073
+ ]
9074
+ },
9075
+ {
9076
+ name: "astrology:solar-return",
9077
+ description: "Calculate Solar Return chart for a given year",
9078
+ args: [
9079
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9080
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9081
+ ],
9082
+ flags: [
9083
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9084
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9085
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9086
+ { name: "house-system", type: "string", default: "placidus", description: "House system for natal chart" },
9087
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9088
+ { name: "year", type: "number", description: "Solar return year (default: current year)" },
9089
+ { name: "sr-lat", type: "number", description: "Solar return location latitude (default: natal lat)" },
9090
+ { name: "sr-lon", type: "number", description: "Solar return location longitude (default: natal lon)" },
9091
+ { name: "sr-location", type: "string", description: "Solar return location for geocoding" },
9092
+ { name: "sr-house-system", type: "string", description: "House system for solar return chart (default: natal house system)" },
9093
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9094
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9095
+ ],
9096
+ examples: [
9097
+ "kaabalah astrology:solar-return 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2025 --json --compact",
9098
+ "kaabalah astrology:solar-return 1990-01-15 14:30 --lat=40.71 --lon=-74 --year=2026 --sr-lat=34.05 --sr-lon=-118.24 --json"
9099
+ ]
9100
+ },
9101
+ {
9102
+ name: "astrology:profections",
9103
+ description: "Calculate annual profection for a given year",
9104
+ args: [
9105
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9106
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9107
+ ],
9108
+ flags: [
9109
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9110
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9111
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9112
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9113
+ { name: "year", type: "number", description: "Target year (default: current year)" },
9114
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9115
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9116
+ ],
9117
+ examples: [
9118
+ "kaabalah astrology:profections 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2026 --json --compact"
9119
+ ]
9120
+ },
9121
+ {
9122
+ name: "astrology:profections:monthly",
9123
+ description: "Calculate monthly profections for a given year",
9124
+ args: [
9125
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9126
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9127
+ ],
9128
+ flags: [
9129
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9130
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9131
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9132
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9133
+ { name: "year", type: "number", description: "Target year (default: current year)" },
9134
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9135
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9136
+ ],
9137
+ examples: [
9138
+ "kaabalah astrology:profections:monthly 1990-06-15 14:30 --lat=48.856 --lon=2.352 --year=2026 --json --compact"
9139
+ ]
9140
+ },
9141
+ {
9142
+ name: "astrology:firdaria",
9143
+ description: "Calculate firdaria planetary periods",
9144
+ args: [
9145
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9146
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9147
+ ],
9148
+ flags: [
9149
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9150
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9151
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9152
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9153
+ { name: "sect", type: "string", description: "Override sect: 'diurnal' or 'nocturnal' (default: auto-detect from chart)" },
9154
+ { name: "target-date", type: "string", description: "Target date YYYY-MM-DD (default: today)" },
9155
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9156
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9157
+ ],
9158
+ examples: [
9159
+ "kaabalah astrology:firdaria 1990-06-15 14:30 --lat=48.856 --lon=2.352 --json --compact",
9160
+ "kaabalah astrology:firdaria 1990-06-15 14:30 --lat=48.856 --lon=2.352 --target-date=2030-01-01 --json"
9161
+ ]
9162
+ },
9163
+ {
9164
+ name: "astrology:decans",
9165
+ description: "Look up the decan (face) for a zodiacal longitude",
9166
+ args: [
9167
+ { name: "longitude", type: "number", required: true, description: "Ecliptic longitude in degrees (0-360)" }
9168
+ ],
9169
+ flags: [],
9170
+ examples: [
9171
+ "kaabalah astrology:decans 15 --json --compact",
9172
+ "kaabalah astrology:decans 270.5 --json"
9173
+ ]
9174
+ },
9175
+ {
9176
+ name: "astrology:dodecatemoria",
9177
+ description: "Look up the dodecatemoria (12th part) for a zodiacal longitude",
9178
+ args: [
9179
+ { name: "longitude", type: "number", required: true, description: "Ecliptic longitude in degrees (0-360)" }
9180
+ ],
9181
+ flags: [],
9182
+ examples: [
9183
+ "kaabalah astrology:dodecatemoria 5 --json --compact",
9184
+ "kaabalah astrology:dodecatemoria 227.5 --json"
9185
+ ]
9186
+ },
9187
+ {
9188
+ name: "astrology:astrocartography",
9189
+ description: "Generate Astro*Carto*Graphy map (MC/IC/AC/DC lines for all planets)",
9190
+ args: [
9191
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9192
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9193
+ ],
9194
+ flags: [
9195
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9196
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9197
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9198
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9199
+ { name: "latitude-step", type: "number", description: "Degrees between latitude samples for AC/DC lines (default: 1)" },
9200
+ { name: "latitude-range", type: "number", description: "Maximum latitude to sweep (default: 66.5)" },
9201
+ { name: "house-system", type: "string", description: "House system (default: placidus)" },
9202
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9203
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9204
+ ],
9205
+ examples: [
9206
+ "kaabalah astrology:astrocartography 1990-06-15 14:30 --lat=48.856 --lon=2.352 --json --compact",
9207
+ "kaabalah astrology:astrocartography 1990-01-15 14:30 --lat=40.71 --lon=-74 --latitude-step=5 --json"
9208
+ ]
9209
+ },
9210
+ {
9211
+ name: "astrology:astrocartography:query",
9212
+ description: "Query a location for nearby astrocartography planetary lines and parans",
9213
+ args: [
9214
+ { name: "date", type: "date", required: true, description: "Natal birth date in YYYY-MM-DD format" },
9215
+ { name: "time", type: "string", required: false, description: "Natal birth time in HH:MM format (default: 12:00)" }
9216
+ ],
9217
+ flags: [
9218
+ { name: "lat", type: "number", description: "Natal latitude (-90 to 90)" },
9219
+ { name: "lon", type: "number", description: "Natal longitude (-180 to 180)" },
9220
+ { name: "location", type: "string", description: "Natal location for geocoding (requires GOOGLE_MAPS_API_KEY)" },
9221
+ { name: "timezone", type: "string", description: "Natal IANA timezone (auto-resolved if omitted)" },
9222
+ { name: "query-lat", type: "number", description: "Query latitude (-90 to 90)" },
9223
+ { name: "query-lon", type: "number", description: "Query longitude (-180 to 180)" },
9224
+ { name: "orb", type: "number", description: "Maximum distance in degrees to consider a line active (default: 2)" },
9225
+ { name: "paran-orb", type: "number", description: "Paran crossing orb in degrees (default: 1)" },
9226
+ { name: "house-system", type: "string", description: "House system (default: placidus)" },
9227
+ { name: "wasm-path", type: "string", description: "Override the Swiss Ephemeris WASM runtime path" },
9228
+ { name: "ephe-path", type: "string", description: "Override the ephemeris data directory path" }
9229
+ ],
9230
+ examples: [
9231
+ "kaabalah astrology:astrocartography:query 1990-06-15 14:30 --lat=48.856 --lon=2.352 --query-lat=51.5 --query-lon=-0.12 --orb=3 --json --compact",
9232
+ `kaabalah astrology:astrocartography:query --input-json='{"natal":{"date":"1990-06-15","time":"14:30","lat":48.856,"lon":2.352},"queryLat":51.5,"queryLon":-0.12,"orb":3}' --json --compact`
9233
+ ]
9234
+ },
7959
9235
  {
7960
9236
  name: "help",
7961
9237
  description: "Show help message",
@@ -9004,32 +10280,379 @@ async function cmdAstrologySynastry(flags, inputPayload, executionContext) {
9004
10280
  } = await parseTwoChartCommand(flags, inputPayload, "astrology:synastry", executionContext);
9005
10281
  const { getSynastryChart: getSynastryChart2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
9006
10282
  try {
9007
- debugLog("astrology", "Running astrology:synastry.", {
9008
- chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr },
9009
- chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr }
10283
+ debugLog("astrology", "Running astrology:synastry.", {
10284
+ chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr },
10285
+ chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr }
10286
+ });
10287
+ const result = await getSynastryChart2({
10288
+ chartA: buildBirthChartOptions(chartAInput, HouseSystem2),
10289
+ chartB: buildBirthChartOptions(chartBInput, HouseSystem2),
10290
+ aspectSpecs
10291
+ });
10292
+ executionContext.throwIfInterrupted();
10293
+ debugLog("astrology", "Completed astrology:synastry.", {
10294
+ aspects: result.aspects.length
10295
+ });
10296
+ if (isJsonMode(flags)) {
10297
+ outputJson({ ...result, input: formatInputEcho(chartAInput, chartBInput) }, flags);
10298
+ return;
10299
+ }
10300
+ console.log(`
10301
+ Synastry Chart
10302
+ `);
10303
+ console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
10304
+ console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
10305
+ console.log(`
10306
+ Cross-chart Aspects (${result.aspects.length}):
10307
+ `);
10308
+ for (const aspect of result.aspects) {
10309
+ console.log(` ${aspect.planetA.padEnd(14)} ${aspect.aspect.padEnd(12)} ${aspect.planetB.padEnd(14)} orb ${aspect.orb.toFixed(2)}\xB0`);
10310
+ }
10311
+ console.log();
10312
+ } catch (err) {
10313
+ rethrowInterruptedOrError(err, executionContext);
10314
+ } finally {
10315
+ releaseSwissEphCleanup();
10316
+ closeSwissEph2();
10317
+ }
10318
+ }
10319
+ async function cmdAstrologyComposite(flags, inputPayload, executionContext) {
10320
+ const {
10321
+ chartAInput,
10322
+ chartBInput,
10323
+ astroModule,
10324
+ aspectSpecs,
10325
+ releaseSwissEphCleanup
10326
+ } = await parseTwoChartCommand(flags, inputPayload, "astrology:composite", executionContext);
10327
+ const { getCompositeChart: getCompositeChart2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10328
+ try {
10329
+ debugLog("astrology", "Running astrology:composite.", {
10330
+ chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr },
10331
+ chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr }
10332
+ });
10333
+ const result = await getCompositeChart2({
10334
+ chartA: buildBirthChartOptions(chartAInput, HouseSystem2),
10335
+ chartB: buildBirthChartOptions(chartBInput, HouseSystem2),
10336
+ aspectSpecs
10337
+ });
10338
+ executionContext.throwIfInterrupted();
10339
+ debugLog("astrology", "Completed astrology:composite.", {
10340
+ aspects: result.aspects.length,
10341
+ compositePlanets: Object.keys(result.compositePlanets).length
10342
+ });
10343
+ if (isJsonMode(flags)) {
10344
+ outputJson({ ...result, input: formatInputEcho(chartAInput, chartBInput) }, flags);
10345
+ return;
10346
+ }
10347
+ console.log(`
10348
+ Composite Chart (Midpoint Method)
10349
+ `);
10350
+ console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
10351
+ console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
10352
+ console.log(`
10353
+ Composite Planets:`);
10354
+ for (const [name, planet] of Object.entries(result.compositePlanets)) {
10355
+ const zodiacPosition = planet.zodiacPosition;
10356
+ console.log(` ${name.padEnd(14)} ${zodiacPosition.sign.padEnd(12)} ${zodiacPosition.traditionalFormat.padEnd(8)} House ${zodiacPosition.house}`);
10357
+ }
10358
+ console.log(`
10359
+ Composite House Cusps:`);
10360
+ for (let i = 0; i < result.compositeHouses.length; i++) {
10361
+ const house = result.compositeHouses[i];
10362
+ console.log(` House ${String(i + 1).padStart(2)}: ${house.sign.padEnd(12)} ${house.traditionalFormat}`);
10363
+ }
10364
+ console.log(`
10365
+ Composite Aspects (${result.aspects.length}):
10366
+ `);
10367
+ for (const aspect of result.aspects) {
10368
+ console.log(` ${aspect.planetA.padEnd(14)} ${aspect.aspect.padEnd(12)} ${aspect.planetB.padEnd(14)} orb ${aspect.orb.toFixed(2)}\xB0`);
10369
+ }
10370
+ console.log();
10371
+ } catch (err) {
10372
+ rethrowInterruptedOrError(err, executionContext);
10373
+ } finally {
10374
+ releaseSwissEphCleanup();
10375
+ closeSwissEph2();
10376
+ }
10377
+ }
10378
+ var MAJOR_ASPECTS = ["conjunction", "sextile", "square", "trine", "opposition"];
10379
+ async function cmdAstrologyTransits(args, flags, inputPayload, executionContext) {
10380
+ const natalPayload = inputPayload?.natal;
10381
+ const effectiveArgs = natalPayload ? [] : args;
10382
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
10383
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
10384
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
10385
+ const { getTransitChart: getTransitChart2, getTransitRange: getTransitRange2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10386
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
10387
+ astroModule.closeSwissEph();
10388
+ });
10389
+ const runtimePaths = getAstrologyRuntimePaths(flags);
10390
+ try {
10391
+ await initWasm(runtimePaths, executionContext);
10392
+ } catch (err) {
10393
+ releaseSwissEphCleanup();
10394
+ closeSwissEph2();
10395
+ executionContext.throwIfInterrupted();
10396
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
10397
+ }
10398
+ try {
10399
+ const transitDateStr = inputPayload?.transitDate ?? getFlagString(flags, "transit-date");
10400
+ const transitTimeStr = inputPayload?.transitTime ?? getFlagString(flags, "transit-time") ?? "12:00";
10401
+ const transitLatFlag = inputPayload?.transitLat != null ? Number(inputPayload.transitLat) : getFlagNumber(flags, "transit-lat");
10402
+ const transitLonFlag = inputPayload?.transitLon != null ? Number(inputPayload.transitLon) : getFlagNumber(flags, "transit-lon");
10403
+ const transitTzStr = inputPayload?.transitTimezone ?? getFlagString(flags, "transit-timezone");
10404
+ const maxOrbFlag = inputPayload?.maxOrb != null ? Number(inputPayload.maxOrb) : getFlagNumber(flags, "max-orb");
10405
+ const aspectsStr = inputPayload?.aspects ?? getFlagString(flags, "aspects");
10406
+ const transitPlanetsStr = inputPayload?.transitPlanets ?? getFlagString(flags, "transit-planets");
10407
+ const natalPlanetsStr = inputPayload?.natalPlanets ?? getFlagString(flags, "natal-planets");
10408
+ const fromStr = inputPayload?.from ?? getFlagString(flags, "from");
10409
+ const toStr = inputPayload?.to ?? getFlagString(flags, "to");
10410
+ const stepDaysFlag = inputPayload?.stepDays != null ? Number(inputPayload.stepDays) : getFlagNumber(flags, "step-days");
10411
+ if (stepDaysFlag != null && (isNaN(stepDaysFlag) || stepDaysFlag <= 0)) {
10412
+ exitWithError("INVALID_ARGUMENT", `--step-days must be a positive number, got "${stepDaysFlag}".`, flags);
10413
+ }
10414
+ let aspectFilter;
10415
+ if (aspectsStr) {
10416
+ const raw = Array.isArray(aspectsStr) ? aspectsStr : aspectsStr.split(",").map((s) => s.trim());
10417
+ aspectFilter = raw.flatMap((a) => a === "major" ? MAJOR_ASPECTS : [a]);
10418
+ }
10419
+ const transitPlanets = transitPlanetsStr ? Array.isArray(transitPlanetsStr) ? transitPlanetsStr : transitPlanetsStr.split(",").map((s) => s.trim().toLowerCase()) : void 0;
10420
+ const natalPlanets = natalPlanetsStr ? Array.isArray(natalPlanetsStr) ? natalPlanetsStr : natalPlanetsStr.split(",").map((s) => s.trim().toLowerCase()) : void 0;
10421
+ const natalOpts = buildBirthChartOptions(natalInput, HouseSystem2);
10422
+ const transitTz = transitTzStr ? { timeZone: transitTzStr } : void 0;
10423
+ const isRangeMode = fromStr != null;
10424
+ if (isRangeMode) {
10425
+ if (!toStr) {
10426
+ exitWithError("MISSING_ARGUMENT", "--to is required when --from is specified.", flags);
10427
+ }
10428
+ parseDate(fromStr, flags);
10429
+ parseDate(toStr, flags);
10430
+ const fromDate = /* @__PURE__ */ new Date(fromStr + "T00:00:00");
10431
+ const toDate = /* @__PURE__ */ new Date(toStr + "T23:59:59.999");
10432
+ debugLog("astrology", "Running astrology:transits (range mode).", {
10433
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr },
10434
+ from: fromStr,
10435
+ to: toStr,
10436
+ stepDays: stepDaysFlag ?? 1
10437
+ });
10438
+ const result = await getTransitRange2({
10439
+ natal: natalOpts,
10440
+ from: fromDate,
10441
+ to: toDate,
10442
+ stepDays: stepDaysFlag ?? void 0,
10443
+ transitLatitude: transitLatFlag ?? void 0,
10444
+ transitLongitude: transitLonFlag ?? void 0,
10445
+ transitTimeZoneSettings: transitTz,
10446
+ aspectSpecs: inputPayload?.aspectSpecs,
10447
+ maxOrb: maxOrbFlag ?? void 0,
10448
+ transitPlanets,
10449
+ natalPlanets,
10450
+ aspectFilter
10451
+ });
10452
+ executionContext.throwIfInterrupted();
10453
+ debugLog("astrology", "Completed astrology:transits (range).", {
10454
+ perfections: result.perfections.length
10455
+ });
10456
+ if (isJsonMode(flags)) {
10457
+ outputJson({
10458
+ ...result,
10459
+ input: {
10460
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr, lat: natalInput.latitude, lon: natalInput.longitude },
10461
+ from: fromStr,
10462
+ to: toStr,
10463
+ stepDays: stepDaysFlag ?? 1
10464
+ }
10465
+ }, flags);
10466
+ return;
10467
+ }
10468
+ console.log(`
10469
+ Transit Range: ${fromStr} to ${toStr}`);
10470
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})
10471
+ `);
10472
+ if (result.perfections.length === 0) {
10473
+ console.log(" No aspect perfections found in range.\n");
10474
+ } else {
10475
+ console.log(` Aspect Perfections (${result.perfections.length}):
10476
+ `);
10477
+ for (const p of result.perfections) {
10478
+ const date = p.exactDate.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, " UTC");
10479
+ const rx = p.retrograde ? " R" : "";
10480
+ console.log(
10481
+ ` ${date} ${p.transitPlanet.padEnd(14)}${rx.padEnd(3)} ${p.aspect.padEnd(12)} ${p.natalPlanet.padEnd(14)} orb ${p.exactOrb.toFixed(3)}\xB0 [${p.category}]`
10482
+ );
10483
+ }
10484
+ console.log();
10485
+ }
10486
+ } else {
10487
+ let transitDate;
10488
+ const effectiveTransitDateStr = transitDateStr ?? (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
10489
+ parseDate(effectiveTransitDateStr, flags);
10490
+ const { hour: tHour, minute: tMin } = parseTimeValue(transitTimeStr, flags, {
10491
+ invalidFormat: (v) => `Invalid transit time format: "${v}". Use HH:MM.`,
10492
+ invalidValue: (v) => `Invalid transit time: "${v}". Hours 0-23, minutes 0-59.`
10493
+ });
10494
+ transitDate = buildBirthDate(effectiveTransitDateStr, tHour, tMin);
10495
+ debugLog("astrology", "Running astrology:transits.", {
10496
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr },
10497
+ transitDate: transitDate.toISOString()
10498
+ });
10499
+ const result = await getTransitChart2({
10500
+ natal: natalOpts,
10501
+ transitDate,
10502
+ transitLatitude: transitLatFlag ?? void 0,
10503
+ transitLongitude: transitLonFlag ?? void 0,
10504
+ transitTimeZoneSettings: transitTz,
10505
+ aspectSpecs: inputPayload?.aspectSpecs,
10506
+ maxOrb: maxOrbFlag ?? void 0,
10507
+ transitPlanets,
10508
+ natalPlanets,
10509
+ aspectFilter
10510
+ });
10511
+ executionContext.throwIfInterrupted();
10512
+ debugLog("astrology", "Completed astrology:transits.", {
10513
+ transitPlanets: Object.keys(result.transitPlanets).length,
10514
+ aspects: result.aspects.length
10515
+ });
10516
+ if (isJsonMode(flags)) {
10517
+ outputJson({
10518
+ ...result,
10519
+ input: {
10520
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr, lat: natalInput.latitude, lon: natalInput.longitude },
10521
+ transitDate: transitDate.toISOString()
10522
+ }
10523
+ }, flags);
10524
+ return;
10525
+ }
10526
+ const tdStr = transitDateStr ?? transitDate.toISOString().split("T")[0];
10527
+ console.log(`
10528
+ Transit Chart for ${tdStr} ${transitTimeStr}`);
10529
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})
10530
+ `);
10531
+ console.log(" Transit Planets (in natal houses):");
10532
+ for (const [name, planet] of Object.entries(result.transitPlanets)) {
10533
+ const zp = planet.zodiacPosition;
10534
+ const rx = planet.retrograde ? " R" : " ";
10535
+ console.log(
10536
+ ` ${name.padEnd(14)}${rx} ${zp.sign.padEnd(12)} ${zp.traditionalFormat.padEnd(8)} Natal House ${planet.natalHouse}`
10537
+ );
10538
+ }
10539
+ console.log(`
10540
+ Transit-to-Natal Aspects (${result.aspects.length}):
10541
+ `);
10542
+ for (const a of result.aspects) {
10543
+ const dir = a.applying ? "applying " : "separating";
10544
+ const rx = a.retrograde ? " R" : " ";
10545
+ console.log(
10546
+ ` ${a.planetA.padEnd(14)}${rx} ${a.aspect.padEnd(12)} ${a.planetB.padEnd(14)} orb ${a.orb.toFixed(2)}\xB0 ${dir} [${a.category}]`
10547
+ );
10548
+ }
10549
+ console.log();
10550
+ }
10551
+ } catch (err) {
10552
+ rethrowInterruptedOrError(err, executionContext);
10553
+ } finally {
10554
+ releaseSwissEphCleanup();
10555
+ closeSwissEph2();
10556
+ }
10557
+ }
10558
+ async function cmdAstrologySolarReturn(args, flags, inputPayload, executionContext) {
10559
+ const natalPayload = inputPayload?.natal;
10560
+ const effectiveArgs = natalPayload ? [] : args;
10561
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
10562
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
10563
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
10564
+ const { getSolarReturnChart: getSolarReturnChart2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10565
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
10566
+ astroModule.closeSwissEph();
10567
+ });
10568
+ const runtimePaths = getAstrologyRuntimePaths(flags);
10569
+ try {
10570
+ await initWasm(runtimePaths, executionContext);
10571
+ } catch (err) {
10572
+ releaseSwissEphCleanup();
10573
+ closeSwissEph2();
10574
+ executionContext.throwIfInterrupted();
10575
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
10576
+ }
10577
+ try {
10578
+ const yearFlag = inputPayload?.year != null ? Number(inputPayload.year) : getFlagNumber(flags, "year");
10579
+ const year = yearFlag ?? (/* @__PURE__ */ new Date()).getFullYear();
10580
+ const srLatFlag = inputPayload?.srLat != null ? Number(inputPayload.srLat) : getFlagNumber(flags, "sr-lat");
10581
+ const srLonFlag = inputPayload?.srLon != null ? Number(inputPayload.srLon) : getFlagNumber(flags, "sr-lon");
10582
+ const srLocationStr = inputPayload?.srLocation ?? getFlagString(flags, "sr-location");
10583
+ const srHouseSystemStr = inputPayload?.srHouseSystem ?? getFlagString(flags, "sr-house-system");
10584
+ let srLat = srLatFlag;
10585
+ let srLon = srLonFlag;
10586
+ if (srLat == null || srLon == null) {
10587
+ if (srLocationStr) {
10588
+ const geocoded = await geocodeLocation(srLocationStr, flags, executionContext);
10589
+ srLat = geocoded.latitude;
10590
+ srLon = geocoded.longitude;
10591
+ }
10592
+ }
10593
+ const srHouseSystem = srHouseSystemStr ? parseHouseSystem(srHouseSystemStr, flags, (value, valid) => `Unknown SR house system: "${value}". Valid: ${valid.join(", ")}`).houseSystemCode : void 0;
10594
+ debugLog("astrology", "Running astrology:solar-return.", {
10595
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr },
10596
+ year,
10597
+ srLat,
10598
+ srLon
9010
10599
  });
9011
- const result = await getSynastryChart2({
9012
- chartA: buildBirthChartOptions(chartAInput, HouseSystem2),
9013
- chartB: buildBirthChartOptions(chartBInput, HouseSystem2),
9014
- aspectSpecs
10600
+ const result = await getSolarReturnChart2({
10601
+ natal: buildBirthChartOptions(natalInput, HouseSystem2),
10602
+ year,
10603
+ solarReturnLatitude: srLat ?? void 0,
10604
+ solarReturnLongitude: srLon ?? void 0,
10605
+ solarReturnHouseSystem: srHouseSystem
9015
10606
  });
9016
10607
  executionContext.throwIfInterrupted();
9017
- debugLog("astrology", "Completed astrology:synastry.", {
9018
- aspects: result.aspects.length
10608
+ debugLog("astrology", "Completed astrology:solar-return.", {
10609
+ exactReturnDate: result.exactReturnDate.toISOString(),
10610
+ natalSunLongitude: result.natalSunLongitude
9019
10611
  });
9020
10612
  if (isJsonMode(flags)) {
9021
- outputJson({ ...result, input: formatInputEcho(chartAInput, chartBInput) }, flags);
10613
+ outputJson({
10614
+ ...result,
10615
+ input: {
10616
+ natal: { date: natalInput.dateStr, time: natalInput.timeStr, lat: natalInput.latitude, lon: natalInput.longitude },
10617
+ year,
10618
+ srLat: srLat ?? natalInput.latitude,
10619
+ srLon: srLon ?? natalInput.longitude
10620
+ }
10621
+ }, flags);
9022
10622
  return;
9023
10623
  }
10624
+ const srChart = result.solarReturnChart;
10625
+ const natalSun = result.natalChart.planets.sun.zodiacPosition;
10626
+ const returnDateStr = result.exactReturnDate.toISOString().replace("T", " ").replace(/\.\d{3}Z$/, " UTC");
9024
10627
  console.log(`
9025
- Synastry Chart
10628
+ Solar Return ${year}
9026
10629
  `);
9027
- console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
9028
- console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
10630
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
10631
+ console.log(` Natal Sun: ${natalSun.sign} ${natalSun.traditionalFormat} (${result.natalSunLongitude.toFixed(4)}\xB0)`);
10632
+ console.log(` Exact Return: ${returnDateStr}`);
10633
+ console.log(` SR Sun: ${srChart.planets.sun.zodiacPosition.sign} ${srChart.planets.sun.zodiacPosition.traditionalFormat} (${srChart.planets.sun.longitude.toFixed(4)}\xB0)`);
9029
10634
  console.log(`
9030
- Cross-chart Aspects (${result.aspects.length}):
10635
+ Solar Return Planets:`);
10636
+ for (const [name, planet] of Object.entries(srChart.planets)) {
10637
+ const zp = planet.zodiacPosition;
10638
+ console.log(` ${name.padEnd(14)} ${zp.sign.padEnd(12)} ${zp.traditionalFormat.padEnd(8)} House ${zp.house}`);
10639
+ }
10640
+ console.log(`
10641
+ Solar Return Houses:`);
10642
+ console.log(` Ascendant: ${srChart.houses.ascendant.sign} ${srChart.houses.ascendant.traditionalFormat}`);
10643
+ console.log(` Midheaven: ${srChart.houses.mc.sign} ${srChart.houses.mc.traditionalFormat}`);
10644
+ console.log(` Descendant: ${srChart.houses.dc.sign} ${srChart.houses.dc.traditionalFormat}`);
10645
+ console.log(` IC: ${srChart.houses.ic.sign} ${srChart.houses.ic.traditionalFormat}`);
10646
+ console.log(`
10647
+ House Cusps:`);
10648
+ for (let i = 0; i < srChart.houses.houses.length; i++) {
10649
+ const house = srChart.houses.houses[i];
10650
+ console.log(` House ${String(i + 1).padStart(2)}: ${house.sign.padEnd(12)} ${house.traditionalFormat}`);
10651
+ }
10652
+ console.log(`
10653
+ Solar Return Aspects (${srChart.aspects.length}):
9031
10654
  `);
9032
- for (const aspect of result.aspects) {
10655
+ for (const aspect of srChart.aspects) {
9033
10656
  console.log(` ${aspect.planetA.padEnd(14)} ${aspect.aspect.padEnd(12)} ${aspect.planetB.padEnd(14)} orb ${aspect.orb.toFixed(2)}\xB0`);
9034
10657
  }
9035
10658
  console.log();
@@ -9040,56 +10663,197 @@ Synastry Chart
9040
10663
  closeSwissEph2();
9041
10664
  }
9042
10665
  }
9043
- async function cmdAstrologyComposite(flags, inputPayload, executionContext) {
9044
- const {
9045
- chartAInput,
9046
- chartBInput,
9047
- astroModule,
9048
- aspectSpecs,
9049
- releaseSwissEphCleanup
9050
- } = await parseTwoChartCommand(flags, inputPayload, "astrology:composite", executionContext);
9051
- const { getCompositeChart: getCompositeChart2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10666
+ async function cmdAstrologyProfections(args, flags, inputPayload, executionContext) {
10667
+ const natalPayload = inputPayload?.natal;
10668
+ const effectiveArgs = natalPayload ? [] : args;
10669
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
10670
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
10671
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
10672
+ const { getBirthChart: getBirthChart2, getAnnualProfection: getAnnualProfection2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10673
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
10674
+ astroModule.closeSwissEph();
10675
+ });
10676
+ const runtimePaths = getAstrologyRuntimePaths(flags);
9052
10677
  try {
9053
- debugLog("astrology", "Running astrology:composite.", {
9054
- chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr },
9055
- chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr }
9056
- });
9057
- const result = await getCompositeChart2({
9058
- chartA: buildBirthChartOptions(chartAInput, HouseSystem2),
9059
- chartB: buildBirthChartOptions(chartBInput, HouseSystem2),
9060
- aspectSpecs
9061
- });
10678
+ await initWasm(runtimePaths, executionContext);
10679
+ } catch (err) {
10680
+ releaseSwissEphCleanup();
10681
+ closeSwissEph2();
9062
10682
  executionContext.throwIfInterrupted();
9063
- debugLog("astrology", "Completed astrology:composite.", {
9064
- aspects: result.aspects.length,
9065
- compositePlanets: Object.keys(result.compositePlanets).length
10683
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
10684
+ }
10685
+ try {
10686
+ const yearFlag = inputPayload?.year != null ? Number(inputPayload.year) : getFlagNumber(flags, "year");
10687
+ const year = yearFlag ?? (/* @__PURE__ */ new Date()).getFullYear();
10688
+ const chart = await getBirthChart2({
10689
+ date: natalInput.birthDate,
10690
+ latitude: natalInput.latitude,
10691
+ longitude: natalInput.longitude,
10692
+ houseSystem: HouseSystem2.WHOLE_SIGN,
10693
+ timeZoneSettings: natalInput.timeZoneSettings
9066
10694
  });
10695
+ executionContext.throwIfInterrupted();
10696
+ const result = getAnnualProfection2(chart, chart.dateUtc, year);
9067
10697
  if (isJsonMode(flags)) {
9068
- outputJson({ ...result, input: formatInputEcho(chartAInput, chartBInput) }, flags);
10698
+ outputJson({
10699
+ ...result,
10700
+ input: {
10701
+ date: natalInput.dateStr,
10702
+ time: natalInput.timeStr,
10703
+ lat: natalInput.latitude,
10704
+ lon: natalInput.longitude,
10705
+ year
10706
+ }
10707
+ }, flags);
9069
10708
  return;
9070
10709
  }
9071
10710
  console.log(`
9072
- Composite Chart (Midpoint Method)
10711
+ Annual Profection (${year})
9073
10712
  `);
9074
- console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
9075
- console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
9076
- console.log(`
9077
- Composite Planets:`);
9078
- for (const [name, planet] of Object.entries(result.compositePlanets)) {
9079
- const zodiacPosition = planet.zodiacPosition;
9080
- console.log(` ${name.padEnd(14)} ${zodiacPosition.sign.padEnd(12)} ${zodiacPosition.traditionalFormat.padEnd(8)} House ${zodiacPosition.house}`);
10713
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
10714
+ console.log(` Age: ${result.age}`);
10715
+ console.log(` Profected House: ${result.house}`);
10716
+ console.log(` Sign: ${result.sign}`);
10717
+ console.log(` Time Lord: ${result.ruler}`);
10718
+ console.log();
10719
+ } catch (err) {
10720
+ rethrowInterruptedOrError(err, executionContext);
10721
+ } finally {
10722
+ releaseSwissEphCleanup();
10723
+ closeSwissEph2();
10724
+ }
10725
+ }
10726
+ async function cmdAstrologyProfectionsMonthly(args, flags, inputPayload, executionContext) {
10727
+ const natalPayload = inputPayload?.natal;
10728
+ const effectiveArgs = natalPayload ? [] : args;
10729
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
10730
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
10731
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
10732
+ const { getBirthChart: getBirthChart2, getMonthlyProfections: getMonthlyProfections2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10733
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
10734
+ astroModule.closeSwissEph();
10735
+ });
10736
+ const runtimePaths = getAstrologyRuntimePaths(flags);
10737
+ try {
10738
+ await initWasm(runtimePaths, executionContext);
10739
+ } catch (err) {
10740
+ releaseSwissEphCleanup();
10741
+ closeSwissEph2();
10742
+ executionContext.throwIfInterrupted();
10743
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
10744
+ }
10745
+ try {
10746
+ const yearFlag = inputPayload?.year != null ? Number(inputPayload.year) : getFlagNumber(flags, "year");
10747
+ const year = yearFlag ?? (/* @__PURE__ */ new Date()).getFullYear();
10748
+ const chart = await getBirthChart2({
10749
+ date: natalInput.birthDate,
10750
+ latitude: natalInput.latitude,
10751
+ longitude: natalInput.longitude,
10752
+ houseSystem: HouseSystem2.WHOLE_SIGN,
10753
+ timeZoneSettings: natalInput.timeZoneSettings
10754
+ });
10755
+ executionContext.throwIfInterrupted();
10756
+ const result = getMonthlyProfections2(chart, chart.dateUtc, year);
10757
+ if (isJsonMode(flags)) {
10758
+ outputJson({
10759
+ ...result,
10760
+ input: {
10761
+ date: natalInput.dateStr,
10762
+ time: natalInput.timeStr,
10763
+ lat: natalInput.latitude,
10764
+ lon: natalInput.longitude,
10765
+ year
10766
+ }
10767
+ }, flags);
10768
+ return;
9081
10769
  }
10770
+ const ap = result.annualProfection;
9082
10771
  console.log(`
9083
- Composite House Cusps:`);
9084
- for (let i = 0; i < result.compositeHouses.length; i++) {
9085
- const house = result.compositeHouses[i];
9086
- console.log(` House ${String(i + 1).padStart(2)}: ${house.sign.padEnd(12)} ${house.traditionalFormat}`);
10772
+ Monthly Profections (${year})
10773
+ `);
10774
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
10775
+ console.log(` Annual: House ${ap.house}, ${ap.sign} (${ap.ruler}), Age ${ap.age}
10776
+ `);
10777
+ for (const m of result.months) {
10778
+ const dateStr = m.startDate.toISOString().split("T")[0];
10779
+ console.log(` Month ${String(m.month).padStart(2)}: ${dateStr} ${m.sign.padEnd(12)} ${m.ruler}`);
10780
+ }
10781
+ console.log();
10782
+ } catch (err) {
10783
+ rethrowInterruptedOrError(err, executionContext);
10784
+ } finally {
10785
+ releaseSwissEphCleanup();
10786
+ closeSwissEph2();
10787
+ }
10788
+ }
10789
+ async function cmdAstrologyFirdaria(args, flags, inputPayload, executionContext) {
10790
+ const natalPayload = inputPayload?.natal;
10791
+ const effectiveArgs = natalPayload ? [] : args;
10792
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
10793
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
10794
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
10795
+ const { getBirthChart: getBirthChart2, getFirdaria: getFirdaria2, closeSwissEph: closeSwissEph2, HouseSystem: HouseSystem2 } = astroModule;
10796
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
10797
+ astroModule.closeSwissEph();
10798
+ });
10799
+ const runtimePaths = getAstrologyRuntimePaths(flags);
10800
+ try {
10801
+ await initWasm(runtimePaths, executionContext);
10802
+ } catch (err) {
10803
+ releaseSwissEphCleanup();
10804
+ closeSwissEph2();
10805
+ executionContext.throwIfInterrupted();
10806
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
10807
+ }
10808
+ try {
10809
+ const chart = await getBirthChart2(buildBirthChartOptions(natalInput, HouseSystem2));
10810
+ executionContext.throwIfInterrupted();
10811
+ const sectOverride = inputPayload?.sect ?? getFlagString(flags, "sect");
10812
+ let isDiurnal;
10813
+ if (sectOverride === "diurnal") {
10814
+ isDiurnal = true;
10815
+ } else if (sectOverride === "nocturnal") {
10816
+ isDiurnal = false;
10817
+ } else if (sectOverride) {
10818
+ exitWithError("INVALID_ARGUMENT", `Invalid sect value: "${sectOverride}". Use "diurnal" or "nocturnal".`, flags);
10819
+ } else {
10820
+ isDiurnal = chart.sect === "diurnal";
10821
+ }
10822
+ const targetDateStr = inputPayload?.targetDate ?? getFlagString(flags, "target-date");
10823
+ let targetDate;
10824
+ if (targetDateStr) {
10825
+ parseDate(targetDateStr, flags);
10826
+ targetDate = /* @__PURE__ */ new Date(targetDateStr + "T12:00:00");
10827
+ }
10828
+ const result = getFirdaria2(chart.dateUtc, isDiurnal, targetDate);
10829
+ if (isJsonMode(flags)) {
10830
+ outputJson({
10831
+ ...result,
10832
+ input: {
10833
+ date: natalInput.dateStr,
10834
+ time: natalInput.timeStr,
10835
+ lat: natalInput.latitude,
10836
+ lon: natalInput.longitude,
10837
+ sect: isDiurnal ? "diurnal" : "nocturnal",
10838
+ targetDate: targetDateStr ?? "today"
10839
+ }
10840
+ }, flags);
10841
+ return;
9087
10842
  }
9088
10843
  console.log(`
9089
- Composite Aspects (${result.aspects.length}):
10844
+ Firdaria (${isDiurnal ? "Diurnal" : "Nocturnal"})
9090
10845
  `);
9091
- for (const aspect of result.aspects) {
9092
- console.log(` ${aspect.planetA.padEnd(14)} ${aspect.aspect.padEnd(12)} ${aspect.planetB.padEnd(14)} orb ${aspect.orb.toFixed(2)}\xB0`);
10846
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
10847
+ console.log(` Current Major: ${result.currentMajor.planet} (${result.currentMajor.years}y)`);
10848
+ console.log(` Current Sub: ${result.currentSub.planet}`);
10849
+ console.log(`
10850
+ All Periods:
10851
+ `);
10852
+ for (const p of result.allPeriods) {
10853
+ const start = p.startDate.toISOString().split("T")[0];
10854
+ const end = p.endDate.toISOString().split("T")[0];
10855
+ const marker = p === result.currentMajor ? " <--" : "";
10856
+ console.log(` ${p.planet.padEnd(12)} ${start} to ${end} (${p.years}y)${marker}`);
9093
10857
  }
9094
10858
  console.log();
9095
10859
  } catch (err) {
@@ -9099,6 +10863,53 @@ Composite Chart (Midpoint Method)
9099
10863
  closeSwissEph2();
9100
10864
  }
9101
10865
  }
10866
+ function cmdAstrologyDecans(args, flags, inputPayload) {
10867
+ const lonStr = inputPayload?.longitude ?? args[0];
10868
+ if (lonStr == null) {
10869
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah astrology:decans <longitude>", flags);
10870
+ }
10871
+ const longitude = Number(lonStr);
10872
+ if (isNaN(longitude)) {
10873
+ exitWithError("INVALID_ARGUMENT", `Invalid longitude: "${lonStr}". Must be a number.`, flags);
10874
+ }
10875
+ const { getDecan: getDecan2 } = (init_astrology(), __toCommonJS(astrology_exports));
10876
+ const result = getDecan2(longitude);
10877
+ if (isJsonMode(flags)) {
10878
+ outputJson(result, flags);
10879
+ return;
10880
+ }
10881
+ console.log(`
10882
+ Decan for ${longitude}\xB0
10883
+ `);
10884
+ console.log(` Sign: ${result.sign}`);
10885
+ console.log(` Decan: ${result.decanNumber}`);
10886
+ console.log(` Ruler: ${result.ruler}`);
10887
+ console.log(` Tarot: ${result.tarotCard}`);
10888
+ console.log(` Range: ${result.startDegree}\xB0 \u2013 ${result.endDegree}\xB0`);
10889
+ console.log();
10890
+ }
10891
+ function cmdAstrologyDodecatemoria(args, flags, inputPayload) {
10892
+ const lonStr = inputPayload?.longitude ?? args[0];
10893
+ if (lonStr == null) {
10894
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah astrology:dodecatemoria <longitude>", flags);
10895
+ }
10896
+ const longitude = Number(lonStr);
10897
+ if (isNaN(longitude)) {
10898
+ exitWithError("INVALID_ARGUMENT", `Invalid longitude: "${lonStr}". Must be a number.`, flags);
10899
+ }
10900
+ const { getDodecatemoria: getDodecatemoria2 } = (init_astrology(), __toCommonJS(astrology_exports));
10901
+ const result = getDodecatemoria2(longitude);
10902
+ if (isJsonMode(flags)) {
10903
+ outputJson(result, flags);
10904
+ return;
10905
+ }
10906
+ console.log(`
10907
+ Dodecatemoria for ${longitude}\xB0
10908
+ `);
10909
+ console.log(` Original Sign: ${result.originalSign} (${result.originalDegree.toFixed(2)}\xB0)`);
10910
+ console.log(` 12th Part: ${result.dodecatemoriaSign} (index ${result.dodecatemoriaIndex})`);
10911
+ console.log();
10912
+ }
9102
10913
  async function cmdAstrology(args, flags, inputPayload, executionContext) {
9103
10914
  const input = await parseSingleChartRequest(args, flags, inputPayload, executionContext);
9104
10915
  const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
@@ -9195,6 +11006,170 @@ Birth Chart: ${input.dateStr} ${input.timeStr}
9195
11006
  closeSwissEph2();
9196
11007
  }
9197
11008
  }
11009
+ async function cmdAstrologyAstrocartography(args, flags, inputPayload, executionContext) {
11010
+ const natalPayload = inputPayload?.natal;
11011
+ const effectiveArgs = natalPayload ? [] : args;
11012
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
11013
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
11014
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
11015
+ const { closeSwissEph: closeSwissEph2 } = astroModule;
11016
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
11017
+ astroModule.closeSwissEph();
11018
+ });
11019
+ const runtimePaths = getAstrologyRuntimePaths(flags);
11020
+ try {
11021
+ await initWasm(runtimePaths, executionContext);
11022
+ } catch (err) {
11023
+ releaseSwissEphCleanup();
11024
+ closeSwissEph2();
11025
+ executionContext.throwIfInterrupted();
11026
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
11027
+ }
11028
+ try {
11029
+ const { computeAstrocartographyMap: computeAstrocartographyMap2 } = await Promise.resolve().then(() => (init_astrocartography(), astrocartography_exports));
11030
+ const { toUtcDate: toUtcDate2 } = await Promise.resolve().then(() => (init_swisseph2(), swisseph_exports));
11031
+ const latStep = inputPayload?.latitudeStep != null ? Number(inputPayload.latitudeStep) : getFlagNumber(flags, "latitude-step");
11032
+ const latRange = inputPayload?.latitudeRange != null ? Number(inputPayload.latitudeRange) : getFlagNumber(flags, "latitude-range");
11033
+ const utcDate = await toUtcDate2(natalInput.birthDate, natalInput.latitude, natalInput.longitude, natalInput.timeZoneSettings);
11034
+ const map = computeAstrocartographyMap2(utcDate, {
11035
+ latitudeStep: latStep ?? 1,
11036
+ latitudeRange: latRange ?? 66.5
11037
+ });
11038
+ executionContext.throwIfInterrupted();
11039
+ if (isJsonMode(flags)) {
11040
+ outputJson({
11041
+ ...map,
11042
+ input: {
11043
+ date: natalInput.dateStr,
11044
+ time: natalInput.timeStr,
11045
+ lat: natalInput.latitude,
11046
+ lon: natalInput.longitude
11047
+ }
11048
+ }, flags);
11049
+ return;
11050
+ }
11051
+ console.log(`
11052
+ Astro*Carto*Graphy Map
11053
+ `);
11054
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
11055
+ console.log(`
11056
+ Meridian Lines (MC/IC):
11057
+ `);
11058
+ for (const line of map.meridianLines) {
11059
+ console.log(` ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.longitude > 0 ? "+" : ""}${line.longitude.toFixed(2)}\xB0`);
11060
+ }
11061
+ console.log(`
11062
+ Horizon Lines (AC/DC): ${map.horizonLines.length} lines with ${map.horizonLines.reduce((s, l) => s + l.points.length, 0)} total points`);
11063
+ console.log();
11064
+ } catch (err) {
11065
+ rethrowInterruptedOrError(err, executionContext);
11066
+ } finally {
11067
+ releaseSwissEphCleanup();
11068
+ closeSwissEph2();
11069
+ }
11070
+ }
11071
+ async function cmdAstrologyAstrocartographyQuery(args, flags, inputPayload, executionContext) {
11072
+ const natalPayload = inputPayload?.natal;
11073
+ const effectiveArgs = natalPayload ? [] : args;
11074
+ const effectiveInputPayload = natalPayload ? { ...natalPayload } : inputPayload;
11075
+ const natalInput = await parseSingleChartRequest(effectiveArgs, flags, effectiveInputPayload, executionContext);
11076
+ const astroModule = await Promise.resolve().then(() => (init_astrology(), astrology_exports));
11077
+ const { closeSwissEph: closeSwissEph2 } = astroModule;
11078
+ const releaseSwissEphCleanup = executionContext.registerCleanup(() => {
11079
+ astroModule.closeSwissEph();
11080
+ });
11081
+ const runtimePaths = getAstrologyRuntimePaths(flags);
11082
+ try {
11083
+ await initWasm(runtimePaths, executionContext);
11084
+ } catch (err) {
11085
+ releaseSwissEphCleanup();
11086
+ closeSwissEph2();
11087
+ executionContext.throwIfInterrupted();
11088
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
11089
+ }
11090
+ try {
11091
+ const { queryAstrocartographyLocation: queryAstrocartographyLocation2 } = await Promise.resolve().then(() => (init_astrocartography(), astrocartography_exports));
11092
+ const { toUtcDate: toUtcDate2 } = await Promise.resolve().then(() => (init_swisseph2(), swisseph_exports));
11093
+ const queryLat = inputPayload?.queryLat != null ? Number(inputPayload.queryLat) : getFlagNumber(flags, "query-lat");
11094
+ const queryLon = inputPayload?.queryLon != null ? Number(inputPayload.queryLon) : getFlagNumber(flags, "query-lon");
11095
+ const orb = inputPayload?.orb != null ? Number(inputPayload.orb) : getFlagNumber(flags, "orb");
11096
+ const paranOrb = inputPayload?.paranOrb != null ? Number(inputPayload.paranOrb) : getFlagNumber(flags, "paran-orb");
11097
+ if (queryLat == null || queryLon == null) {
11098
+ exitWithError("MISSING_ARGUMENT", "Query location is required. Use --query-lat=<N> --query-lon=<N>.", flags);
11099
+ }
11100
+ if (queryLat < -90 || queryLat > 90) {
11101
+ exitWithError("INVALID_ARGUMENT", `query-lat must be between -90 and 90, got ${queryLat}.`, flags);
11102
+ }
11103
+ if (queryLon < -180 || queryLon > 180) {
11104
+ exitWithError("INVALID_ARGUMENT", `query-lon must be between -180 and 180, got ${queryLon}.`, flags);
11105
+ }
11106
+ const utcDate = await toUtcDate2(natalInput.birthDate, natalInput.latitude, natalInput.longitude, natalInput.timeZoneSettings);
11107
+ const result = queryAstrocartographyLocation2(utcDate, {
11108
+ latitude: queryLat,
11109
+ longitude: queryLon,
11110
+ orb: orb ?? 2,
11111
+ paranOrb: paranOrb ?? 1
11112
+ });
11113
+ executionContext.throwIfInterrupted();
11114
+ if (isJsonMode(flags)) {
11115
+ outputJson({
11116
+ ...result,
11117
+ input: {
11118
+ natal: {
11119
+ date: natalInput.dateStr,
11120
+ time: natalInput.timeStr,
11121
+ lat: natalInput.latitude,
11122
+ lon: natalInput.longitude
11123
+ },
11124
+ queryLat,
11125
+ queryLon,
11126
+ orb: orb ?? 2
11127
+ }
11128
+ }, flags);
11129
+ return;
11130
+ }
11131
+ console.log(`
11132
+ Astrocartography Location Query
11133
+ `);
11134
+ console.log(` Natal: ${natalInput.dateStr} ${natalInput.timeStr} (${natalInput.latitude}, ${natalInput.longitude})`);
11135
+ console.log(` Query: (${queryLat}, ${queryLon}) Orb: ${orb ?? 2}\xB0`);
11136
+ if (result.activeLines.length > 0) {
11137
+ console.log(`
11138
+ Active Lines (within ${orb ?? 2}\xB0 orb):
11139
+ `);
11140
+ for (const line of result.activeLines) {
11141
+ console.log(` ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.distance.toFixed(2)}\xB0 away (line at ${line.longitude > 0 ? "+" : ""}${line.longitude.toFixed(2)}\xB0)`);
11142
+ }
11143
+ } else {
11144
+ console.log(`
11145
+ No active lines within ${orb ?? 2}\xB0 orb.`);
11146
+ }
11147
+ console.log(`
11148
+ All Lines (sorted by proximity):
11149
+ `);
11150
+ for (const line of result.lines.slice(0, 20)) {
11151
+ const marker = line.active ? "*" : " ";
11152
+ console.log(` ${marker} ${line.planet.padEnd(14)} ${line.angle.padEnd(4)} ${line.distance.toFixed(2)}\xB0`);
11153
+ }
11154
+ if (result.lines.length > 20) {
11155
+ console.log(` ... and ${result.lines.length - 20} more`);
11156
+ }
11157
+ if (result.parans.length > 0) {
11158
+ console.log(`
11159
+ Parans at latitude ${queryLat}\xB0:
11160
+ `);
11161
+ for (const p of result.parans) {
11162
+ console.log(` ${p.planetA} ${p.angleA} x ${p.planetB} ${p.angleB}`);
11163
+ }
11164
+ }
11165
+ console.log();
11166
+ } catch (err) {
11167
+ rethrowInterruptedOrError(err, executionContext);
11168
+ } finally {
11169
+ releaseSwissEphCleanup();
11170
+ closeSwissEph2();
11171
+ }
11172
+ }
9198
11173
 
9199
11174
  // src/core/constants.ts
9200
11175
  var FOUR_WORLDS = {
@@ -19085,6 +21060,33 @@ async function runCli(argv) {
19085
21060
  case "astrology:composite":
19086
21061
  await cmdAstrologyComposite(flags, inputPayload, execution);
19087
21062
  return;
21063
+ case "astrology:transits":
21064
+ await cmdAstrologyTransits(args.slice(1), flags, inputPayload, execution);
21065
+ return;
21066
+ case "astrology:solar-return":
21067
+ await cmdAstrologySolarReturn(args.slice(1), flags, inputPayload, execution);
21068
+ return;
21069
+ case "astrology:profections":
21070
+ await cmdAstrologyProfections(args.slice(1), flags, inputPayload, execution);
21071
+ return;
21072
+ case "astrology:profections:monthly":
21073
+ await cmdAstrologyProfectionsMonthly(args.slice(1), flags, inputPayload, execution);
21074
+ return;
21075
+ case "astrology:firdaria":
21076
+ await cmdAstrologyFirdaria(args.slice(1), flags, inputPayload, execution);
21077
+ return;
21078
+ case "astrology:astrocartography":
21079
+ await cmdAstrologyAstrocartography(args.slice(1), flags, inputPayload, execution);
21080
+ return;
21081
+ case "astrology:astrocartography:query":
21082
+ await cmdAstrologyAstrocartographyQuery(args.slice(1), flags, inputPayload, execution);
21083
+ return;
21084
+ case "astrology:decans":
21085
+ cmdAstrologyDecans(args.slice(1), flags, inputPayload);
21086
+ return;
21087
+ case "astrology:dodecatemoria":
21088
+ cmdAstrologyDodecatemoria(args.slice(1), flags, inputPayload);
21089
+ return;
19088
21090
  default:
19089
21091
  exitWithError("UNKNOWN_COMMAND", `Unknown command: "${command}". Run "kaabalah help" for usage.`, flags);
19090
21092
  }