kaabalah 5.1.0 → 5.2.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.
Files changed (40) hide show
  1. package/README.md +9 -1
  2. package/dist/astrology/index.d.mts +66 -1
  3. package/dist/astrology/index.d.ts +66 -1
  4. package/dist/astrology/index.js +42 -14
  5. package/dist/astrology/index.mjs +1 -1
  6. package/dist/{chunk-JBMCNKO4.mjs → chunk-2J6CVLH2.mjs} +5 -4
  7. package/dist/chunk-2J6CVLH2.mjs.map +1 -0
  8. package/dist/{chunk-FVEVTAM7.js → chunk-2WENLHIP.js} +4 -4
  9. package/dist/{chunk-FVEVTAM7.js.map → chunk-2WENLHIP.js.map} +1 -1
  10. package/dist/{chunk-X2SPWMUA.mjs → chunk-5ID55YUP.mjs} +3 -3
  11. package/dist/{chunk-X2SPWMUA.mjs.map → chunk-5ID55YUP.mjs.map} +1 -1
  12. package/dist/{chunk-A5ME4PFX.mjs → chunk-CYWQV2RL.mjs} +151 -4
  13. package/dist/chunk-CYWQV2RL.mjs.map +1 -0
  14. package/dist/{chunk-7AXRFYPX.js → chunk-IAKSKHGA.js} +157 -3
  15. package/dist/chunk-IAKSKHGA.js.map +1 -0
  16. package/dist/{chunk-KUH2YDQ2.js → chunk-T67M2WBD.js} +5 -4
  17. package/dist/chunk-T67M2WBD.js.map +1 -0
  18. package/dist/{chunk-KSKAKQTM.mjs → chunk-XSAXO3D2.mjs} +3 -3
  19. package/dist/{chunk-KSKAKQTM.mjs.map → chunk-XSAXO3D2.mjs.map} +1 -1
  20. package/dist/{chunk-U77YFJXJ.js → chunk-ZZ3YMT2R.js} +23 -23
  21. package/dist/{chunk-U77YFJXJ.js.map → chunk-ZZ3YMT2R.js.map} +1 -1
  22. package/dist/cli.js +303 -35
  23. package/dist/cli.js.map +1 -1
  24. package/dist/cli.mjs +288 -20
  25. package/dist/cli.mjs.map +1 -1
  26. package/dist/core/index.js +38 -38
  27. package/dist/core/index.mjs +1 -1
  28. package/dist/gematria/index.js +5 -5
  29. package/dist/gematria/index.mjs +2 -2
  30. package/dist/index.d.mts +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.js +100 -72
  33. package/dist/index.mjs +4 -4
  34. package/dist/numerology/index.js +18 -18
  35. package/dist/numerology/index.mjs +3 -3
  36. package/package.json +1 -1
  37. package/dist/chunk-7AXRFYPX.js.map +0 -1
  38. package/dist/chunk-A5ME4PFX.mjs.map +0 -1
  39. package/dist/chunk-JBMCNKO4.mjs.map +0 -1
  40. package/dist/chunk-KUH2YDQ2.js.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { calculateOdu } from './chunk-YTZCZRJG.mjs';
2
- import { calculateFibonacciCycle, calculateChallenges, calculatePersonalCycles, calculateCycles, calculateKaabalisticLifePath, calculateStraightAcrossReductionLifePath, getDateEnergies, calculatePersonalYear } from './chunk-KSKAKQTM.mjs';
3
- import { reverseGematria, calculateGematria } from './chunk-X2SPWMUA.mjs';
4
- import { SYSTEM, createTree } from './chunk-JBMCNKO4.mjs';
5
- import { ARKANNUS, shuffleTarotDeck } from './chunk-M7XQFDS4.mjs';
2
+ import { calculateFibonacciCycle, calculateChallenges, calculatePersonalCycles, calculateCycles, calculateKaabalisticLifePath, calculateStraightAcrossReductionLifePath, getDateEnergies, calculatePersonalYear } from './chunk-XSAXO3D2.mjs';
3
+ import { reverseGematria, calculateGematria } from './chunk-5ID55YUP.mjs';
4
+ import { SYSTEM, createTree } from './chunk-2J6CVLH2.mjs';
5
+ import { shuffleTarotDeck, ARKANNUS } from './chunk-M7XQFDS4.mjs';
6
6
  import { __require } from './chunk-WY6NIR2V.mjs';
7
7
  import 'dotenv/config';
8
8
 
@@ -87,10 +87,20 @@ var COMMANDS = [
87
87
  },
88
88
  {
89
89
  name: "tarot:card",
90
- description: "Look up a specific card (1-78)",
91
- args: [{ name: "number", type: "number", required: true, description: "Card number (1-78)" }],
90
+ description: "Look up a specific card by number or name",
91
+ args: [{ name: "query", type: "string", required: true, description: "Card number (1-78) or name (e.g. 'The Chariot', 'Two of Cups')" }],
92
92
  flags: [],
93
- examples: ["kaabalah tarot:card 7", "kaabalah tarot:card 22 --json"]
93
+ examples: ["kaabalah tarot:card 7", 'kaabalah tarot:card "The Chariot" --json', "kaabalah tarot:card chariot --json"]
94
+ },
95
+ {
96
+ name: "tarot:spread",
97
+ description: "Look up multiple tarot cards by name or number",
98
+ args: [{ name: "cards", type: "string", required: true, description: "Card names or numbers, space-separated (quote multi-word names)" }],
99
+ flags: [],
100
+ examples: [
101
+ 'kaabalah tarot:spread "Two of Cups" "The Chariot" 7',
102
+ `kaabalah tarot:spread --input-json='{"cards":["Two of Cups","The Chariot","7"]}'`
103
+ ]
94
104
  },
95
105
  {
96
106
  name: "ifa",
@@ -148,6 +158,28 @@ var COMMANDS = [
148
158
  "kaabalah astrology 1990-01-15 --lat=40.7128 --lon=-74.006 --json"
149
159
  ]
150
160
  },
161
+ {
162
+ name: "astrology:synastry",
163
+ description: "Calculate synastry (cross-chart aspects) between two birth charts",
164
+ args: [],
165
+ flags: [
166
+ { name: "house-system", type: "string", default: "placidus", description: "House system for both charts" }
167
+ ],
168
+ examples: [
169
+ `kaabalah astrology:synastry --input-json='{"chartA":{"date":"1990-01-15","time":"14:30","lat":40.71,"lon":-74},"chartB":{"date":"1992-06-20","time":"09:00","lat":51.5,"lon":-0.12}}' --json --compact`
170
+ ]
171
+ },
172
+ {
173
+ name: "astrology:composite",
174
+ description: "Calculate midpoint composite chart from two birth charts",
175
+ args: [],
176
+ flags: [
177
+ { name: "house-system", type: "string", default: "placidus", description: "House system for both charts" }
178
+ ],
179
+ examples: [
180
+ `kaabalah astrology:composite --input-json='{"chartA":{"date":"1990-01-15","time":"14:30","lat":40.71,"lon":-74},"chartB":{"date":"1992-06-20","time":"09:00","lat":51.5,"lon":-0.12}}' --json --compact`
181
+ ]
182
+ },
151
183
  {
152
184
  name: "help",
153
185
  description: "Show help message",
@@ -687,16 +719,19 @@ Tarot Draw: ${count} card${count > 1 ? "s" : ""}
687
719
  console.log();
688
720
  }
689
721
  }
690
- function cmdTarotCard(numberStr, flags) {
691
- const num = parseInt(numberStr, 10);
692
- const card = ARKANNUS.find((c) => c.number === num);
693
- if (!card) {
694
- exitWithError("CARD_NOT_FOUND", `Card #${num} not found. Valid range: 1-78.`, flags);
695
- }
696
- if (isJsonMode(flags)) {
697
- outputJson(card, flags);
698
- return;
699
- }
722
+ function findCardsByQuery(query) {
723
+ const num = parseInt(query, 10);
724
+ if (!isNaN(num)) {
725
+ const card = ARKANNUS.find((c) => c.number === num);
726
+ return card ? { cards: [card], exact: true } : { cards: [], exact: false };
727
+ }
728
+ const q = query.toLowerCase();
729
+ const exactMatch = ARKANNUS.find((c) => c.tarotCard.toLowerCase() === q);
730
+ if (exactMatch) return { cards: [exactMatch], exact: true };
731
+ const substringMatches = ARKANNUS.filter((c) => c.tarotCard.toLowerCase().includes(q));
732
+ return { cards: substringMatches, exact: false };
733
+ }
734
+ function printCard(card) {
700
735
  console.log(`
701
736
  #${String(card.number).padStart(2, "0")} ${card.tarotCard}`);
702
737
  console.log(` Type: ${card.type} | Suit: ${card.suit ?? "major"} | Deck: ${card.deck}`);
@@ -705,6 +740,44 @@ function cmdTarotCard(numberStr, flags) {
705
740
  if (card.papusMeaning) console.log(` Papus: ${card.papusMeaning}`);
706
741
  console.log();
707
742
  }
743
+ function cmdTarotCard(query, flags) {
744
+ const { cards } = findCardsByQuery(query);
745
+ if (cards.length === 0) {
746
+ exitWithError("CARD_NOT_FOUND", `No card found for "${query}". Use a number (1-78) or card name.`, flags);
747
+ }
748
+ if (isJsonMode(flags)) {
749
+ outputJson(cards.length === 1 ? cards[0] : cards, flags);
750
+ return;
751
+ }
752
+ for (const card of cards) {
753
+ printCard(card);
754
+ }
755
+ }
756
+ function cmdTarotSpread(cardQueries, flags) {
757
+ const results = [];
758
+ for (const q of cardQueries) {
759
+ const { cards } = findCardsByQuery(q);
760
+ if (cards.length === 0) {
761
+ results.push({ query: q, error: true, code: "CARD_NOT_FOUND", message: `No card found for "${q}".` });
762
+ } else if (cards.length === 1) {
763
+ results.push(cards[0]);
764
+ } else {
765
+ results.push(...cards);
766
+ }
767
+ }
768
+ if (isJsonMode(flags)) {
769
+ outputJson(results, flags);
770
+ return;
771
+ }
772
+ for (const item of results) {
773
+ if ("error" in item && item.error) {
774
+ console.log(`
775
+ \u2717 "${item.query}": ${item.message}`);
776
+ } else {
777
+ printCard(item);
778
+ }
779
+ }
780
+ }
708
781
  function cmdIfa(dateStr, flags) {
709
782
  const date = parseDate(dateStr, flags);
710
783
  const result = calculateOdu(date);
@@ -851,6 +924,187 @@ Node types (${Object.keys(counts).length}):
851
924
  }
852
925
  console.log();
853
926
  }
927
+ function parseChartInput(input, label, flags) {
928
+ const dateStr = input.date;
929
+ if (!dateStr) {
930
+ exitWithError("MISSING_ARGUMENT", `${label}: "date" is required (YYYY-MM-DD).`, flags);
931
+ }
932
+ parseDate(dateStr, flags);
933
+ const timeStr = input.time ?? "12:00";
934
+ const timeMatch = timeStr.match(/^(\d{1,2}):(\d{2})$/);
935
+ if (!timeMatch) {
936
+ exitWithError("INVALID_ARGUMENT", `${label}: Invalid time format "${timeStr}". Use HH:MM.`, flags);
937
+ }
938
+ const hour = parseInt(timeMatch[1], 10);
939
+ const minute = parseInt(timeMatch[2], 10);
940
+ if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
941
+ exitWithError("INVALID_ARGUMENT", `${label}: Invalid time "${timeStr}". Hours 0-23, minutes 0-59.`, flags);
942
+ }
943
+ const latitude = input.lat != null ? Number(input.lat) : void 0;
944
+ const longitude = input.lon != null ? Number(input.lon) : void 0;
945
+ if (latitude == null || longitude == null) {
946
+ exitWithError("MISSING_ARGUMENT", `${label}: "lat" and "lon" are required.`, flags);
947
+ }
948
+ if (latitude < -90 || latitude > 90) {
949
+ exitWithError("INVALID_ARGUMENT", `${label}: Latitude must be between -90 and 90, got ${latitude}.`, flags);
950
+ }
951
+ if (longitude < -180 || longitude > 180) {
952
+ exitWithError("INVALID_ARGUMENT", `${label}: Longitude must be between -180 and 180, got ${longitude}.`, flags);
953
+ }
954
+ const houseSystem = input.houseSystem ?? "placidus";
955
+ const houseSystemCode = HOUSE_SYSTEM_MAP[houseSystem.toLowerCase()];
956
+ if (!houseSystemCode) {
957
+ exitWithError("INVALID_ARGUMENT", `${label}: Unknown house system "${houseSystem}". Valid: ${Object.keys(HOUSE_SYSTEM_MAP).join(", ")}`, flags);
958
+ }
959
+ const timezoneStr = input.timezone;
960
+ const timeZoneSettings = {};
961
+ if (timezoneStr) {
962
+ timeZoneSettings.timeZone = timezoneStr;
963
+ } else {
964
+ timeZoneSettings.autoTimeZone = true;
965
+ }
966
+ const dateParts = dateStr.match(/^(\d{4})-(\d{2})-(\d{2})$/);
967
+ const birthDate = new Date(
968
+ parseInt(dateParts[1], 10),
969
+ parseInt(dateParts[2], 10) - 1,
970
+ parseInt(dateParts[3], 10),
971
+ hour,
972
+ minute,
973
+ 0
974
+ );
975
+ return { birthDate, latitude, longitude, houseSystem, houseSystemCode, timeZoneSettings, dateStr, timeStr };
976
+ }
977
+ async function initWasm() {
978
+ const path = __require("path");
979
+ const wasmPath = path.resolve(__dirname, "../wasm/build/swisseph.node.wasm");
980
+ const ephePath = path.resolve(__dirname, "../ephe");
981
+ const { getSwissEph } = await import('./astrology/index.mjs');
982
+ await getSwissEph({ wasmPath, ephePath });
983
+ }
984
+ async function cmdAstrologySynastry(flags, inputPayload) {
985
+ if (!inputPayload?.chartA || !inputPayload?.chartB) {
986
+ exitWithError("MISSING_ARGUMENT", `Usage: kaabalah astrology:synastry --input-json='{"chartA":{...},"chartB":{...}}'`, flags);
987
+ }
988
+ const chartAInput = parseChartInput(inputPayload.chartA, "chartA", flags);
989
+ const chartBInput = parseChartInput(inputPayload.chartB, "chartB", flags);
990
+ const { getSynastryChart, closeSwissEph, HouseSystem } = await import('./astrology/index.mjs');
991
+ try {
992
+ await initWasm();
993
+ } catch (err) {
994
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
995
+ }
996
+ try {
997
+ const result = await getSynastryChart({
998
+ chartA: {
999
+ date: chartAInput.birthDate,
1000
+ latitude: chartAInput.latitude,
1001
+ longitude: chartAInput.longitude,
1002
+ houseSystem: chartAInput.houseSystemCode,
1003
+ timeZoneSettings: chartAInput.timeZoneSettings
1004
+ },
1005
+ chartB: {
1006
+ date: chartBInput.birthDate,
1007
+ latitude: chartBInput.latitude,
1008
+ longitude: chartBInput.longitude,
1009
+ houseSystem: chartBInput.houseSystemCode,
1010
+ timeZoneSettings: chartBInput.timeZoneSettings
1011
+ },
1012
+ aspectSpecs: inputPayload.aspectSpecs
1013
+ });
1014
+ if (isJsonMode(flags)) {
1015
+ outputJson({
1016
+ ...result,
1017
+ input: {
1018
+ chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr, lat: chartAInput.latitude, lon: chartAInput.longitude, houseSystem: chartAInput.houseSystem },
1019
+ chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr, lat: chartBInput.latitude, lon: chartBInput.longitude, houseSystem: chartBInput.houseSystem }
1020
+ }
1021
+ }, flags);
1022
+ } else {
1023
+ console.log(`
1024
+ Synastry Chart
1025
+ `);
1026
+ console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
1027
+ console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
1028
+ console.log(`
1029
+ Cross-chart Aspects (${result.aspects.length}):
1030
+ `);
1031
+ for (const a of result.aspects) {
1032
+ console.log(` ${a.planetA.padEnd(14)} ${a.aspect.padEnd(12)} ${a.planetB.padEnd(14)} orb ${a.orb.toFixed(2)}\xB0`);
1033
+ }
1034
+ console.log();
1035
+ }
1036
+ } finally {
1037
+ closeSwissEph();
1038
+ }
1039
+ }
1040
+ async function cmdAstrologyComposite(flags, inputPayload) {
1041
+ if (!inputPayload?.chartA || !inputPayload?.chartB) {
1042
+ exitWithError("MISSING_ARGUMENT", `Usage: kaabalah astrology:composite --input-json='{"chartA":{...},"chartB":{...}}'`, flags);
1043
+ }
1044
+ const chartAInput = parseChartInput(inputPayload.chartA, "chartA", flags);
1045
+ const chartBInput = parseChartInput(inputPayload.chartB, "chartB", flags);
1046
+ const { getCompositeChart, closeSwissEph, HouseSystem } = await import('./astrology/index.mjs');
1047
+ try {
1048
+ await initWasm();
1049
+ } catch (err) {
1050
+ exitWithError("WASM_INIT_ERROR", `Failed to initialize Swiss Ephemeris: ${err instanceof Error ? err.message : String(err)}`, flags);
1051
+ }
1052
+ try {
1053
+ const result = await getCompositeChart({
1054
+ chartA: {
1055
+ date: chartAInput.birthDate,
1056
+ latitude: chartAInput.latitude,
1057
+ longitude: chartAInput.longitude,
1058
+ houseSystem: chartAInput.houseSystemCode,
1059
+ timeZoneSettings: chartAInput.timeZoneSettings
1060
+ },
1061
+ chartB: {
1062
+ date: chartBInput.birthDate,
1063
+ latitude: chartBInput.latitude,
1064
+ longitude: chartBInput.longitude,
1065
+ houseSystem: chartBInput.houseSystemCode,
1066
+ timeZoneSettings: chartBInput.timeZoneSettings
1067
+ },
1068
+ aspectSpecs: inputPayload.aspectSpecs
1069
+ });
1070
+ if (isJsonMode(flags)) {
1071
+ outputJson({
1072
+ ...result,
1073
+ input: {
1074
+ chartA: { date: chartAInput.dateStr, time: chartAInput.timeStr, lat: chartAInput.latitude, lon: chartAInput.longitude, houseSystem: chartAInput.houseSystem },
1075
+ chartB: { date: chartBInput.dateStr, time: chartBInput.timeStr, lat: chartBInput.latitude, lon: chartBInput.longitude, houseSystem: chartBInput.houseSystem }
1076
+ }
1077
+ }, flags);
1078
+ } else {
1079
+ console.log(`
1080
+ Composite Chart (Midpoint Method)
1081
+ `);
1082
+ console.log(` Chart A: ${chartAInput.dateStr} ${chartAInput.timeStr} (${chartAInput.latitude}, ${chartAInput.longitude})`);
1083
+ console.log(` Chart B: ${chartBInput.dateStr} ${chartBInput.timeStr} (${chartBInput.latitude}, ${chartBInput.longitude})`);
1084
+ console.log(`
1085
+ Composite Planets:`);
1086
+ for (const [name, planet] of Object.entries(result.compositePlanets)) {
1087
+ const zp = planet.zodiacPosition;
1088
+ console.log(` ${name.padEnd(14)} ${zp.sign.padEnd(12)} ${zp.traditionalFormat.padEnd(8)} House ${zp.house}`);
1089
+ }
1090
+ console.log(`
1091
+ Composite House Cusps:`);
1092
+ for (let i = 0; i < result.compositeHouses.length; i++) {
1093
+ const h = result.compositeHouses[i];
1094
+ console.log(` House ${String(i + 1).padStart(2)}: ${h.sign.padEnd(12)} ${h.traditionalFormat}`);
1095
+ }
1096
+ console.log(`
1097
+ Composite Aspects (${result.aspects.length}):
1098
+ `);
1099
+ for (const a of result.aspects) {
1100
+ console.log(` ${a.planetA.padEnd(14)} ${a.aspect.padEnd(12)} ${a.planetB.padEnd(14)} orb ${a.orb.toFixed(2)}\xB0`);
1101
+ }
1102
+ console.log();
1103
+ }
1104
+ } finally {
1105
+ closeSwissEph();
1106
+ }
1107
+ }
854
1108
  async function cmdAstrology(args, flags, inputPayload) {
855
1109
  const dateStr = inputPayload?.date ?? args[0];
856
1110
  if (!dateStr) {
@@ -1065,11 +1319,19 @@ async function main() {
1065
1319
  await cmdTarot(inputPayload?.count ?? args[1], flags);
1066
1320
  break;
1067
1321
  case "tarot:card":
1068
- if (!args[1] && inputPayload?.number == null) {
1069
- exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <number>", flags);
1322
+ if (!args[1] && inputPayload?.query == null) {
1323
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <query>", flags);
1324
+ }
1325
+ cmdTarotCard((inputPayload?.query != null ? String(inputPayload.query) : void 0) ?? args.slice(1).join(" "), flags);
1326
+ break;
1327
+ case "tarot:spread": {
1328
+ const cardQueries = Array.isArray(inputPayload?.cards) ? inputPayload.cards.map(String) : args.slice(1);
1329
+ if (cardQueries.length === 0) {
1330
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:spread <card1> [card2] ...", flags);
1070
1331
  }
1071
- cmdTarotCard((inputPayload?.number != null ? String(inputPayload.number) : void 0) ?? args[1], flags);
1332
+ cmdTarotSpread(cardQueries, flags);
1072
1333
  break;
1334
+ }
1073
1335
  case "ifa":
1074
1336
  if (!args[1] && !inputPayload?.date) {
1075
1337
  exitWithError("MISSING_ARGUMENT", "Usage: kaabalah ifa <YYYY-MM-DD>", flags);
@@ -1091,6 +1353,12 @@ async function main() {
1091
1353
  case "astrology":
1092
1354
  await cmdAstrology(args.slice(1), flags, inputPayload);
1093
1355
  break;
1356
+ case "astrology:synastry":
1357
+ await cmdAstrologySynastry(flags, inputPayload);
1358
+ break;
1359
+ case "astrology:composite":
1360
+ await cmdAstrologyComposite(flags, inputPayload);
1361
+ break;
1094
1362
  case "--version":
1095
1363
  if (isJsonMode(flags)) {
1096
1364
  outputJson({ version: VERSION }, flags);