kaabalah 5.0.0 → 5.1.1

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
@@ -2,9 +2,9 @@
2
2
  'use strict';
3
3
 
4
4
  var chunk3WVZRLPG_js = require('./chunk-3WVZRLPG.js');
5
- var chunkFVEVTAM7_js = require('./chunk-FVEVTAM7.js');
6
- var chunkU77YFJXJ_js = require('./chunk-U77YFJXJ.js');
7
- var chunkKUH2YDQ2_js = require('./chunk-KUH2YDQ2.js');
5
+ var chunk2WENLHIP_js = require('./chunk-2WENLHIP.js');
6
+ var chunkZZ3YMT2R_js = require('./chunk-ZZ3YMT2R.js');
7
+ var chunkT67M2WBD_js = require('./chunk-T67M2WBD.js');
8
8
  var chunkG5BG73Y5_js = require('./chunk-G5BG73Y5.js');
9
9
  var chunkFM7WUVZV_js = require('./chunk-FM7WUVZV.js');
10
10
  require('dotenv/config');
@@ -26,7 +26,7 @@ var COMMANDS = [
26
26
  { name: "missing", type: "boolean", default: false, description: "Show missing gematria values" },
27
27
  { name: "percentages", type: "boolean", default: false, description: "Show letter percentages" }
28
28
  ],
29
- examples: ['kaabalah gematria "Mat Moura"', 'kaabalah gematria "Mat Moura" --json']
29
+ examples: ['kaabalah gematria "Hello World"', 'kaabalah gematria "Hello World" --json']
30
30
  },
31
31
  {
32
32
  name: "gematria:reverse",
@@ -62,7 +62,7 @@ var COMMANDS = [
62
62
  { name: "firstName", type: "string", required: false, description: "First name for personal cycles" }
63
63
  ],
64
64
  flags: [],
65
- examples: ["kaabalah numerology:cycles 1990-01-15", "kaabalah numerology:cycles 1990-01-15 Mateus"]
65
+ examples: ["kaabalah numerology:cycles 1990-01-15", "kaabalah numerology:cycles 1990-01-15 John"]
66
66
  },
67
67
  {
68
68
  name: "numerology:challenges",
@@ -90,10 +90,20 @@ var COMMANDS = [
90
90
  },
91
91
  {
92
92
  name: "tarot:card",
93
- description: "Look up a specific card (1-78)",
94
- args: [{ name: "number", type: "number", required: true, description: "Card number (1-78)" }],
93
+ description: "Look up a specific card by number or name",
94
+ args: [{ name: "query", type: "string", required: true, description: "Card number (1-78) or name (e.g. 'The Chariot', 'Two of Cups')" }],
95
95
  flags: [],
96
- examples: ["kaabalah tarot:card 7", "kaabalah tarot:card 22 --json"]
96
+ examples: ["kaabalah tarot:card 7", 'kaabalah tarot:card "The Chariot" --json', "kaabalah tarot:card chariot --json"]
97
+ },
98
+ {
99
+ name: "tarot:spread",
100
+ description: "Look up multiple tarot cards by name or number",
101
+ args: [{ name: "cards", type: "string", required: true, description: "Card names or numbers, space-separated (quote multi-word names)" }],
102
+ flags: [],
103
+ examples: [
104
+ 'kaabalah tarot:spread "Two of Cups" "The Chariot" 7',
105
+ `kaabalah tarot:spread --input-json='{"cards":["Two of Cups","The Chariot","7"]}'`
106
+ ]
97
107
  },
98
108
  {
99
109
  name: "ifa",
@@ -104,10 +114,32 @@ var COMMANDS = [
104
114
  },
105
115
  {
106
116
  name: "tree",
107
- description: "Show Tree of Life structure",
117
+ description: "Show Tree of Life structure with all nodes, data, and edges",
118
+ args: [],
119
+ flags: [],
120
+ examples: ["kaabalah tree --json --compact", "kaabalah tree --json --fields=nodes"]
121
+ },
122
+ {
123
+ name: "tree:node",
124
+ description: "Look up a node and all its correspondences",
125
+ args: [{ name: "id", type: "string", required: true, description: "Node ID (e.g. path:1, sphere:Kether, tarotArkAnnu:The Magician)" }],
126
+ flags: [
127
+ { name: "type", type: "string", description: "Filter related nodes by type (e.g. hebrewLetter, planet, tarotArkAnnu)" },
128
+ { name: "depth", type: "number", default: 1, description: "Traversal depth (default: 1)" }
129
+ ],
130
+ examples: [
131
+ "kaabalah tree:node path:1 --json",
132
+ "kaabalah tree:node sphere:Kether --type=tarotArkAnnu --json",
133
+ 'kaabalah tree:node "tarotArkAnnu:The Magician" --json',
134
+ "kaabalah tree:node path:1 --depth=2 --json"
135
+ ]
136
+ },
137
+ {
138
+ name: "tree:types",
139
+ description: "List all node types and their counts",
108
140
  args: [],
109
141
  flags: [],
110
- examples: ["kaabalah tree", "kaabalah tree --json"]
142
+ examples: ["kaabalah tree:types --json"]
111
143
  },
112
144
  {
113
145
  name: "astrology",
@@ -124,8 +156,8 @@ var COMMANDS = [
124
156
  { name: "timezone", type: "string", description: "IANA timezone string (e.g. America/New_York). Auto-resolved from coordinates if omitted" }
125
157
  ],
126
158
  examples: [
127
- "kaabalah astrology 1990-01-15 14:30 --lat=-23.5505 --lon=-46.6333",
128
- 'kaabalah astrology 1990-01-15 14:30 --location="S\xE3o Paulo, Brazil"',
159
+ "kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006",
160
+ 'kaabalah astrology 1990-01-15 14:30 --location="New York, USA"',
129
161
  "kaabalah astrology 1990-01-15 --lat=40.7128 --lon=-74.006 --json"
130
162
  ]
131
163
  },
@@ -286,15 +318,15 @@ function generateHelp() {
286
318
  }
287
319
  lines.push("");
288
320
  lines.push("EXAMPLES");
289
- lines.push(' kaabalah gematria "Mat Moura"');
321
+ lines.push(' kaabalah gematria "Hello World"');
290
322
  lines.push(" kaabalah numerology 1990-01-15");
291
- lines.push(" kaabalah numerology:cycles 1990-01-15 Mateus");
323
+ lines.push(" kaabalah numerology:cycles 1990-01-15 John");
292
324
  lines.push(" kaabalah tarot 5 --inverted");
293
325
  lines.push(" kaabalah tarot:card 7");
294
326
  lines.push(" kaabalah gematria:reverse 22");
295
327
  lines.push(" kaabalah ifa 1990-01-15");
296
- lines.push(" kaabalah astrology 1990-01-15 14:30 --lat=-23.5505 --lon=-46.6333");
297
- lines.push(' kaabalah astrology 1990-01-15 14:30 --location="S\xE3o Paulo, Brazil"');
328
+ lines.push(" kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006");
329
+ lines.push(' kaabalah astrology 1990-01-15 14:30 --location="New York, USA"');
298
330
  lines.push(" kaabalah help --json");
299
331
  lines.push("");
300
332
  return lines.join("\n");
@@ -416,7 +448,7 @@ function cmdGematria(text, flags) {
416
448
  exitWithError("INVALID_ARGUMENT", `Text exceeds maximum length of ${MAX_TEXT_LENGTH} characters.`, flags);
417
449
  }
418
450
  const sanitized = sanitizeInput(text);
419
- const result = chunkU77YFJXJ_js.calculateGematria(sanitized, {
451
+ const result = chunkZZ3YMT2R_js.calculateGematria(sanitized, {
420
452
  missing: getFlagBool(flags, "missing"),
421
453
  percentages: getFlagBool(flags, "percentages")
422
454
  });
@@ -459,7 +491,7 @@ function cmdReverseGematria(target, flags, inputPayload) {
459
491
  let minLength = inputPayload?.minLength != null ? Number(inputPayload.minLength) : getFlagNumber(flags, "min-length") ?? 2;
460
492
  let maxLength = inputPayload?.maxLength != null ? Number(inputPayload.maxLength) : getFlagNumber(flags, "max-length") ?? 6;
461
493
  const includeDigraphs = inputPayload?.includeDigraphs != null ? Boolean(inputPayload.includeDigraphs) : getFlagBool(flags, "include-digraphs");
462
- const result = chunkU77YFJXJ_js.reverseGematria({
494
+ const result = chunkZZ3YMT2R_js.reverseGematria({
463
495
  targetSynthesis: targetNum,
464
496
  maxResults,
465
497
  minLength,
@@ -482,12 +514,12 @@ Reverse Gematria: target synthesis = ${targetNum}
482
514
  }
483
515
  function cmdNumerology(dateStr, flags) {
484
516
  const date = parseDate(dateStr, flags);
485
- const kaabalistic = chunkFVEVTAM7_js.calculateKaabalisticLifePath(date);
486
- const straight = chunkFVEVTAM7_js.calculateStraightAcrossReductionLifePath(date);
487
- const challenges = chunkFVEVTAM7_js.calculateChallenges(date);
488
- const energies = chunkFVEVTAM7_js.getDateEnergies(date);
489
- const personalYear = chunkFVEVTAM7_js.calculatePersonalYear(date);
490
- const fibonacci = chunkFVEVTAM7_js.calculateFibonacciCycle(date, /* @__PURE__ */ new Date());
517
+ const kaabalistic = chunk2WENLHIP_js.calculateKaabalisticLifePath(date);
518
+ const straight = chunk2WENLHIP_js.calculateStraightAcrossReductionLifePath(date);
519
+ const challenges = chunk2WENLHIP_js.calculateChallenges(date);
520
+ const energies = chunk2WENLHIP_js.getDateEnergies(date);
521
+ const personalYear = chunk2WENLHIP_js.calculatePersonalYear(date);
522
+ const fibonacci = chunk2WENLHIP_js.calculateFibonacciCycle(date, /* @__PURE__ */ new Date());
491
523
  if (isJsonMode(flags)) {
492
524
  outputJson({ kaabalistic, straight, challenges, energies, personalYear, fibonacci }, flags);
493
525
  return;
@@ -525,7 +557,7 @@ Numerology Profile: ${dateStr}
525
557
  }
526
558
  function cmdLifePath(dateStr, flags) {
527
559
  const date = parseDate(dateStr, flags);
528
- const result = chunkFVEVTAM7_js.calculateKaabalisticLifePath(date);
560
+ const result = chunk2WENLHIP_js.calculateKaabalisticLifePath(date);
529
561
  if (isJsonMode(flags)) {
530
562
  outputJson(result, flags);
531
563
  return;
@@ -543,7 +575,7 @@ function cmdCycles(dateStr, firstName, flags) {
543
575
  const date = parseDate(dateStr, flags);
544
576
  const today = /* @__PURE__ */ new Date();
545
577
  if (firstName) {
546
- const result = chunkFVEVTAM7_js.calculatePersonalCycles(date, today, firstName);
578
+ const result = chunk2WENLHIP_js.calculatePersonalCycles(date, today, firstName);
547
579
  if (isJsonMode(flags)) {
548
580
  outputJson(result, flags);
549
581
  return;
@@ -572,7 +604,7 @@ Personal Cycles: ${dateStr} (${firstName})
572
604
  console.log(` Month ${m.month}: ${m.value.reducedValue}${active}`);
573
605
  }
574
606
  } else {
575
- const result = chunkFVEVTAM7_js.calculateCycles(date, today);
607
+ const result = chunk2WENLHIP_js.calculateCycles(date, today);
576
608
  if (isJsonMode(flags)) {
577
609
  outputJson(result, flags);
578
610
  return;
@@ -608,7 +640,7 @@ Heptad Cycles: ${dateStr}
608
640
  }
609
641
  function cmdChallenges(dateStr, flags) {
610
642
  const date = parseDate(dateStr, flags);
611
- const result = chunkFVEVTAM7_js.calculateChallenges(date);
643
+ const result = chunk2WENLHIP_js.calculateChallenges(date);
612
644
  if (isJsonMode(flags)) {
613
645
  outputJson(result, flags);
614
646
  return;
@@ -626,7 +658,7 @@ Challenges: ${dateStr}
626
658
  }
627
659
  function cmdFibonacci(dateStr, flags) {
628
660
  const date = parseDate(dateStr, flags);
629
- const result = chunkFVEVTAM7_js.calculateFibonacciCycle(date, /* @__PURE__ */ new Date());
661
+ const result = chunk2WENLHIP_js.calculateFibonacciCycle(date, /* @__PURE__ */ new Date());
630
662
  if (isJsonMode(flags)) {
631
663
  outputJson(result, flags);
632
664
  return;
@@ -668,16 +700,19 @@ Tarot Draw: ${count} card${count > 1 ? "s" : ""}
668
700
  console.log();
669
701
  }
670
702
  }
671
- function cmdTarotCard(numberStr, flags) {
672
- const num = parseInt(numberStr, 10);
673
- const card = chunkG5BG73Y5_js.ARKANNUS.find((c) => c.number === num);
674
- if (!card) {
675
- exitWithError("CARD_NOT_FOUND", `Card #${num} not found. Valid range: 1-78.`, flags);
676
- }
677
- if (isJsonMode(flags)) {
678
- outputJson(card, flags);
679
- return;
703
+ function findCardsByQuery(query) {
704
+ const num = parseInt(query, 10);
705
+ if (!isNaN(num)) {
706
+ const card = chunkG5BG73Y5_js.ARKANNUS.find((c) => c.number === num);
707
+ return card ? { cards: [card], exact: true } : { cards: [], exact: false };
680
708
  }
709
+ const q = query.toLowerCase();
710
+ const exactMatch = chunkG5BG73Y5_js.ARKANNUS.find((c) => c.tarotCard.toLowerCase() === q);
711
+ if (exactMatch) return { cards: [exactMatch], exact: true };
712
+ const substringMatches = chunkG5BG73Y5_js.ARKANNUS.filter((c) => c.tarotCard.toLowerCase().includes(q));
713
+ return { cards: substringMatches, exact: false };
714
+ }
715
+ function printCard(card) {
681
716
  console.log(`
682
717
  #${String(card.number).padStart(2, "0")} ${card.tarotCard}`);
683
718
  console.log(` Type: ${card.type} | Suit: ${card.suit ?? "major"} | Deck: ${card.deck}`);
@@ -686,6 +721,44 @@ function cmdTarotCard(numberStr, flags) {
686
721
  if (card.papusMeaning) console.log(` Papus: ${card.papusMeaning}`);
687
722
  console.log();
688
723
  }
724
+ function cmdTarotCard(query, flags) {
725
+ const { cards } = findCardsByQuery(query);
726
+ if (cards.length === 0) {
727
+ exitWithError("CARD_NOT_FOUND", `No card found for "${query}". Use a number (1-78) or card name.`, flags);
728
+ }
729
+ if (isJsonMode(flags)) {
730
+ outputJson(cards.length === 1 ? cards[0] : cards, flags);
731
+ return;
732
+ }
733
+ for (const card of cards) {
734
+ printCard(card);
735
+ }
736
+ }
737
+ function cmdTarotSpread(cardQueries, flags) {
738
+ const results = [];
739
+ for (const q of cardQueries) {
740
+ const { cards } = findCardsByQuery(q);
741
+ if (cards.length === 0) {
742
+ results.push({ query: q, error: true, code: "CARD_NOT_FOUND", message: `No card found for "${q}".` });
743
+ } else if (cards.length === 1) {
744
+ results.push(cards[0]);
745
+ } else {
746
+ results.push(...cards);
747
+ }
748
+ }
749
+ if (isJsonMode(flags)) {
750
+ outputJson(results, flags);
751
+ return;
752
+ }
753
+ for (const item of results) {
754
+ if ("error" in item && item.error) {
755
+ console.log(`
756
+ \u2717 "${item.query}": ${item.message}`);
757
+ } else {
758
+ printCard(item);
759
+ }
760
+ }
761
+ }
689
762
  function cmdIfa(dateStr, flags) {
690
763
  const date = parseDate(dateStr, flags);
691
764
  const result = chunk3WVZRLPG_js.calculateOdu(date);
@@ -705,15 +778,46 @@ Odu: ${dateStr}
705
778
  console.log(` Center: ${result.center}`);
706
779
  console.log();
707
780
  }
781
+ function getTree() {
782
+ return chunkT67M2WBD_js.createTree({ system: chunkT67M2WBD_js.SYSTEM, parts: ["westernAstrology", "tarot"] });
783
+ }
784
+ function serializeNode(n) {
785
+ const result = { id: n.id, type: n.type };
786
+ if (n.data && typeof n.data === "object" && Object.keys(n.data).length > 0) {
787
+ result.data = n.data;
788
+ }
789
+ if (n.name) result.name = n.name;
790
+ return result;
791
+ }
708
792
  function cmdTree(flags) {
709
- const tree = chunkKUH2YDQ2_js.createTree({ system: chunkKUH2YDQ2_js.SYSTEM, parts: ["westernAstrology", "tarot"] });
793
+ const tree = getTree();
710
794
  const allNodes = tree.getNodes();
711
795
  if (isJsonMode(flags)) {
712
- outputJson(allNodes.map((n) => ({ id: n.id, type: n.type, name: n.data && "name" in n.data ? n.data?.name : void 0 })), flags);
796
+ const nodes = allNodes.map((n) => {
797
+ const node = serializeNode(n);
798
+ const relatedTypes = tree.relatedTypes(n.id);
799
+ if (relatedTypes.length > 0) {
800
+ node.relatedTypes = relatedTypes;
801
+ }
802
+ return node;
803
+ });
804
+ const edgeSet = /* @__PURE__ */ new Set();
805
+ const edges = [];
806
+ for (const n of allNodes) {
807
+ const related = tree.related(n.id);
808
+ for (const r of related) {
809
+ const key = n.id < r.id ? `${n.id}|${r.id}` : `${r.id}|${n.id}`;
810
+ if (!edgeSet.has(key)) {
811
+ edgeSet.add(key);
812
+ edges.push({ from: n.id, to: r.id });
813
+ }
814
+ }
815
+ }
816
+ outputJson({ system: chunkT67M2WBD_js.SYSTEM, totalNodes: allNodes.length, totalEdges: edges.length, nodes, edges }, flags);
713
817
  return;
714
818
  }
715
819
  console.log(`
716
- Tree of Life (${chunkKUH2YDQ2_js.SYSTEM})
820
+ Tree of Life (${chunkT67M2WBD_js.SYSTEM})
717
821
  `);
718
822
  console.log(` Total nodes: ${allNodes.length}`);
719
823
  const byType = /* @__PURE__ */ new Map();
@@ -736,6 +840,71 @@ Tree of Life (${chunkKUH2YDQ2_js.SYSTEM})
736
840
  }
737
841
  console.log();
738
842
  }
843
+ function cmdTreeNode(idStr, flags) {
844
+ const tree = getTree();
845
+ const node = tree.getNode(idStr);
846
+ if (!node) {
847
+ exitWithError("INVALID_ARGUMENT", `Node "${idStr}" not found. Use "kaabalah tree:types --json" to see valid node types, or "kaabalah tree --json --fields=nodes" to list all node IDs.`, flags);
848
+ }
849
+ const typeFilter = getFlagString(flags, "type");
850
+ const depth = getFlagNumber(flags, "depth") ?? 1;
851
+ const related = depth > 1 ? tree.walk(node.id, depth, typeFilter || void 0) : typeFilter ? tree.related(node.id, typeFilter) : tree.related(node.id);
852
+ if (isJsonMode(flags)) {
853
+ outputJson({
854
+ node: serializeNode(node),
855
+ relatedTypes: tree.relatedTypes(node.id),
856
+ related: related.map(serializeNode)
857
+ }, flags);
858
+ return;
859
+ }
860
+ console.log(`
861
+ ${node.id}`);
862
+ const d = node.data;
863
+ if (d) {
864
+ for (const [k, v] of Object.entries(d)) {
865
+ if (v != null && typeof v !== "object") console.log(` ${k}: ${v}`);
866
+ }
867
+ }
868
+ const relatedTypes = tree.relatedTypes(node.id);
869
+ console.log(`
870
+ Related types: ${relatedTypes.join(", ")}`);
871
+ const byType = /* @__PURE__ */ new Map();
872
+ for (const r of related) {
873
+ if (!byType.has(r.type)) byType.set(r.type, []);
874
+ byType.get(r.type).push(r);
875
+ }
876
+ for (const [type, nodes] of byType) {
877
+ console.log(`
878
+ ${type}:`);
879
+ for (const n of nodes) {
880
+ const rd = n.data;
881
+ const label = rd?.name ?? rd?.character ?? rd?.englishName ?? rd?.meaning ?? "";
882
+ console.log(` ${n.id}${label ? ` \u2014 ${label}` : ""}`);
883
+ }
884
+ }
885
+ console.log();
886
+ }
887
+ function cmdTreeTypes(flags) {
888
+ const tree = getTree();
889
+ const allNodes = tree.getNodes();
890
+ const counts = {};
891
+ for (const n of allNodes) {
892
+ if (!counts[n.type]) counts[n.type] = { count: 0, ids: [] };
893
+ counts[n.type].count++;
894
+ counts[n.type].ids.push(n.id);
895
+ }
896
+ if (isJsonMode(flags)) {
897
+ outputJson(counts, flags);
898
+ return;
899
+ }
900
+ console.log(`
901
+ Node types (${Object.keys(counts).length}):
902
+ `);
903
+ for (const [type, info] of Object.entries(counts)) {
904
+ console.log(` ${type}: ${info.count}`);
905
+ }
906
+ console.log();
907
+ }
739
908
  async function cmdAstrology(args, flags, inputPayload) {
740
909
  const dateStr = inputPayload?.date ?? args[0];
741
910
  if (!dateStr) {
@@ -950,11 +1119,19 @@ async function main() {
950
1119
  await cmdTarot(inputPayload?.count ?? args[1], flags);
951
1120
  break;
952
1121
  case "tarot:card":
953
- if (!args[1] && inputPayload?.number == null) {
954
- exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <number>", flags);
1122
+ if (!args[1] && inputPayload?.query == null) {
1123
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <query>", flags);
1124
+ }
1125
+ cmdTarotCard((inputPayload?.query != null ? String(inputPayload.query) : void 0) ?? args.slice(1).join(" "), flags);
1126
+ break;
1127
+ case "tarot:spread": {
1128
+ const cardQueries = Array.isArray(inputPayload?.cards) ? inputPayload.cards.map(String) : args.slice(1);
1129
+ if (cardQueries.length === 0) {
1130
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:spread <card1> [card2] ...", flags);
955
1131
  }
956
- cmdTarotCard((inputPayload?.number != null ? String(inputPayload.number) : void 0) ?? args[1], flags);
1132
+ cmdTarotSpread(cardQueries, flags);
957
1133
  break;
1134
+ }
958
1135
  case "ifa":
959
1136
  if (!args[1] && !inputPayload?.date) {
960
1137
  exitWithError("MISSING_ARGUMENT", "Usage: kaabalah ifa <YYYY-MM-DD>", flags);
@@ -964,6 +1141,15 @@ async function main() {
964
1141
  case "tree":
965
1142
  cmdTree(flags);
966
1143
  break;
1144
+ case "tree:node":
1145
+ if (!args[1] && !inputPayload?.id) {
1146
+ exitWithError("MISSING_ARGUMENT", 'Usage: kaabalah tree:node <id> (e.g. tree:node path:1, tree:node "tarotArkAnnu:The Magician")', flags);
1147
+ }
1148
+ cmdTreeNode(inputPayload?.id ?? args.slice(1).join(" "), flags);
1149
+ break;
1150
+ case "tree:types":
1151
+ cmdTreeTypes(flags);
1152
+ break;
967
1153
  case "astrology":
968
1154
  await cmdAstrology(args.slice(1), flags, inputPayload);
969
1155
  break;