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.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 { createTree, SYSTEM } 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
 
@@ -23,7 +23,7 @@ var COMMANDS = [
23
23
  { name: "missing", type: "boolean", default: false, description: "Show missing gematria values" },
24
24
  { name: "percentages", type: "boolean", default: false, description: "Show letter percentages" }
25
25
  ],
26
- examples: ['kaabalah gematria "Mat Moura"', 'kaabalah gematria "Mat Moura" --json']
26
+ examples: ['kaabalah gematria "Hello World"', 'kaabalah gematria "Hello World" --json']
27
27
  },
28
28
  {
29
29
  name: "gematria:reverse",
@@ -59,7 +59,7 @@ var COMMANDS = [
59
59
  { name: "firstName", type: "string", required: false, description: "First name for personal cycles" }
60
60
  ],
61
61
  flags: [],
62
- examples: ["kaabalah numerology:cycles 1990-01-15", "kaabalah numerology:cycles 1990-01-15 Mateus"]
62
+ examples: ["kaabalah numerology:cycles 1990-01-15", "kaabalah numerology:cycles 1990-01-15 John"]
63
63
  },
64
64
  {
65
65
  name: "numerology:challenges",
@@ -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",
@@ -101,10 +111,32 @@ var COMMANDS = [
101
111
  },
102
112
  {
103
113
  name: "tree",
104
- description: "Show Tree of Life structure",
114
+ description: "Show Tree of Life structure with all nodes, data, and edges",
115
+ args: [],
116
+ flags: [],
117
+ examples: ["kaabalah tree --json --compact", "kaabalah tree --json --fields=nodes"]
118
+ },
119
+ {
120
+ name: "tree:node",
121
+ description: "Look up a node and all its correspondences",
122
+ args: [{ name: "id", type: "string", required: true, description: "Node ID (e.g. path:1, sphere:Kether, tarotArkAnnu:The Magician)" }],
123
+ flags: [
124
+ { name: "type", type: "string", description: "Filter related nodes by type (e.g. hebrewLetter, planet, tarotArkAnnu)" },
125
+ { name: "depth", type: "number", default: 1, description: "Traversal depth (default: 1)" }
126
+ ],
127
+ examples: [
128
+ "kaabalah tree:node path:1 --json",
129
+ "kaabalah tree:node sphere:Kether --type=tarotArkAnnu --json",
130
+ 'kaabalah tree:node "tarotArkAnnu:The Magician" --json',
131
+ "kaabalah tree:node path:1 --depth=2 --json"
132
+ ]
133
+ },
134
+ {
135
+ name: "tree:types",
136
+ description: "List all node types and their counts",
105
137
  args: [],
106
138
  flags: [],
107
- examples: ["kaabalah tree", "kaabalah tree --json"]
139
+ examples: ["kaabalah tree:types --json"]
108
140
  },
109
141
  {
110
142
  name: "astrology",
@@ -121,8 +153,8 @@ var COMMANDS = [
121
153
  { name: "timezone", type: "string", description: "IANA timezone string (e.g. America/New_York). Auto-resolved from coordinates if omitted" }
122
154
  ],
123
155
  examples: [
124
- "kaabalah astrology 1990-01-15 14:30 --lat=-23.5505 --lon=-46.6333",
125
- 'kaabalah astrology 1990-01-15 14:30 --location="S\xE3o Paulo, Brazil"',
156
+ "kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006",
157
+ 'kaabalah astrology 1990-01-15 14:30 --location="New York, USA"',
126
158
  "kaabalah astrology 1990-01-15 --lat=40.7128 --lon=-74.006 --json"
127
159
  ]
128
160
  },
@@ -283,15 +315,15 @@ function generateHelp() {
283
315
  }
284
316
  lines.push("");
285
317
  lines.push("EXAMPLES");
286
- lines.push(' kaabalah gematria "Mat Moura"');
318
+ lines.push(' kaabalah gematria "Hello World"');
287
319
  lines.push(" kaabalah numerology 1990-01-15");
288
- lines.push(" kaabalah numerology:cycles 1990-01-15 Mateus");
320
+ lines.push(" kaabalah numerology:cycles 1990-01-15 John");
289
321
  lines.push(" kaabalah tarot 5 --inverted");
290
322
  lines.push(" kaabalah tarot:card 7");
291
323
  lines.push(" kaabalah gematria:reverse 22");
292
324
  lines.push(" kaabalah ifa 1990-01-15");
293
- lines.push(" kaabalah astrology 1990-01-15 14:30 --lat=-23.5505 --lon=-46.6333");
294
- lines.push(' kaabalah astrology 1990-01-15 14:30 --location="S\xE3o Paulo, Brazil"');
325
+ lines.push(" kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006");
326
+ lines.push(' kaabalah astrology 1990-01-15 14:30 --location="New York, USA"');
295
327
  lines.push(" kaabalah help --json");
296
328
  lines.push("");
297
329
  return lines.join("\n");
@@ -665,16 +697,19 @@ Tarot Draw: ${count} card${count > 1 ? "s" : ""}
665
697
  console.log();
666
698
  }
667
699
  }
668
- function cmdTarotCard(numberStr, flags) {
669
- const num = parseInt(numberStr, 10);
670
- const card = ARKANNUS.find((c) => c.number === num);
671
- if (!card) {
672
- exitWithError("CARD_NOT_FOUND", `Card #${num} not found. Valid range: 1-78.`, flags);
673
- }
674
- if (isJsonMode(flags)) {
675
- outputJson(card, flags);
676
- return;
700
+ function findCardsByQuery(query) {
701
+ const num = parseInt(query, 10);
702
+ if (!isNaN(num)) {
703
+ const card = ARKANNUS.find((c) => c.number === num);
704
+ return card ? { cards: [card], exact: true } : { cards: [], exact: false };
677
705
  }
706
+ const q = query.toLowerCase();
707
+ const exactMatch = ARKANNUS.find((c) => c.tarotCard.toLowerCase() === q);
708
+ if (exactMatch) return { cards: [exactMatch], exact: true };
709
+ const substringMatches = ARKANNUS.filter((c) => c.tarotCard.toLowerCase().includes(q));
710
+ return { cards: substringMatches, exact: false };
711
+ }
712
+ function printCard(card) {
678
713
  console.log(`
679
714
  #${String(card.number).padStart(2, "0")} ${card.tarotCard}`);
680
715
  console.log(` Type: ${card.type} | Suit: ${card.suit ?? "major"} | Deck: ${card.deck}`);
@@ -683,6 +718,44 @@ function cmdTarotCard(numberStr, flags) {
683
718
  if (card.papusMeaning) console.log(` Papus: ${card.papusMeaning}`);
684
719
  console.log();
685
720
  }
721
+ function cmdTarotCard(query, flags) {
722
+ const { cards } = findCardsByQuery(query);
723
+ if (cards.length === 0) {
724
+ exitWithError("CARD_NOT_FOUND", `No card found for "${query}". Use a number (1-78) or card name.`, flags);
725
+ }
726
+ if (isJsonMode(flags)) {
727
+ outputJson(cards.length === 1 ? cards[0] : cards, flags);
728
+ return;
729
+ }
730
+ for (const card of cards) {
731
+ printCard(card);
732
+ }
733
+ }
734
+ function cmdTarotSpread(cardQueries, flags) {
735
+ const results = [];
736
+ for (const q of cardQueries) {
737
+ const { cards } = findCardsByQuery(q);
738
+ if (cards.length === 0) {
739
+ results.push({ query: q, error: true, code: "CARD_NOT_FOUND", message: `No card found for "${q}".` });
740
+ } else if (cards.length === 1) {
741
+ results.push(cards[0]);
742
+ } else {
743
+ results.push(...cards);
744
+ }
745
+ }
746
+ if (isJsonMode(flags)) {
747
+ outputJson(results, flags);
748
+ return;
749
+ }
750
+ for (const item of results) {
751
+ if ("error" in item && item.error) {
752
+ console.log(`
753
+ \u2717 "${item.query}": ${item.message}`);
754
+ } else {
755
+ printCard(item);
756
+ }
757
+ }
758
+ }
686
759
  function cmdIfa(dateStr, flags) {
687
760
  const date = parseDate(dateStr, flags);
688
761
  const result = calculateOdu(date);
@@ -702,11 +775,42 @@ Odu: ${dateStr}
702
775
  console.log(` Center: ${result.center}`);
703
776
  console.log();
704
777
  }
778
+ function getTree() {
779
+ return createTree({ system: SYSTEM, parts: ["westernAstrology", "tarot"] });
780
+ }
781
+ function serializeNode(n) {
782
+ const result = { id: n.id, type: n.type };
783
+ if (n.data && typeof n.data === "object" && Object.keys(n.data).length > 0) {
784
+ result.data = n.data;
785
+ }
786
+ if (n.name) result.name = n.name;
787
+ return result;
788
+ }
705
789
  function cmdTree(flags) {
706
- const tree = createTree({ system: SYSTEM, parts: ["westernAstrology", "tarot"] });
790
+ const tree = getTree();
707
791
  const allNodes = tree.getNodes();
708
792
  if (isJsonMode(flags)) {
709
- outputJson(allNodes.map((n) => ({ id: n.id, type: n.type, name: n.data && "name" in n.data ? n.data?.name : void 0 })), flags);
793
+ const nodes = allNodes.map((n) => {
794
+ const node = serializeNode(n);
795
+ const relatedTypes = tree.relatedTypes(n.id);
796
+ if (relatedTypes.length > 0) {
797
+ node.relatedTypes = relatedTypes;
798
+ }
799
+ return node;
800
+ });
801
+ const edgeSet = /* @__PURE__ */ new Set();
802
+ const edges = [];
803
+ for (const n of allNodes) {
804
+ const related = tree.related(n.id);
805
+ for (const r of related) {
806
+ const key = n.id < r.id ? `${n.id}|${r.id}` : `${r.id}|${n.id}`;
807
+ if (!edgeSet.has(key)) {
808
+ edgeSet.add(key);
809
+ edges.push({ from: n.id, to: r.id });
810
+ }
811
+ }
812
+ }
813
+ outputJson({ system: SYSTEM, totalNodes: allNodes.length, totalEdges: edges.length, nodes, edges }, flags);
710
814
  return;
711
815
  }
712
816
  console.log(`
@@ -733,6 +837,71 @@ Tree of Life (${SYSTEM})
733
837
  }
734
838
  console.log();
735
839
  }
840
+ function cmdTreeNode(idStr, flags) {
841
+ const tree = getTree();
842
+ const node = tree.getNode(idStr);
843
+ if (!node) {
844
+ 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);
845
+ }
846
+ const typeFilter = getFlagString(flags, "type");
847
+ const depth = getFlagNumber(flags, "depth") ?? 1;
848
+ const related = depth > 1 ? tree.walk(node.id, depth, typeFilter || void 0) : typeFilter ? tree.related(node.id, typeFilter) : tree.related(node.id);
849
+ if (isJsonMode(flags)) {
850
+ outputJson({
851
+ node: serializeNode(node),
852
+ relatedTypes: tree.relatedTypes(node.id),
853
+ related: related.map(serializeNode)
854
+ }, flags);
855
+ return;
856
+ }
857
+ console.log(`
858
+ ${node.id}`);
859
+ const d = node.data;
860
+ if (d) {
861
+ for (const [k, v] of Object.entries(d)) {
862
+ if (v != null && typeof v !== "object") console.log(` ${k}: ${v}`);
863
+ }
864
+ }
865
+ const relatedTypes = tree.relatedTypes(node.id);
866
+ console.log(`
867
+ Related types: ${relatedTypes.join(", ")}`);
868
+ const byType = /* @__PURE__ */ new Map();
869
+ for (const r of related) {
870
+ if (!byType.has(r.type)) byType.set(r.type, []);
871
+ byType.get(r.type).push(r);
872
+ }
873
+ for (const [type, nodes] of byType) {
874
+ console.log(`
875
+ ${type}:`);
876
+ for (const n of nodes) {
877
+ const rd = n.data;
878
+ const label = rd?.name ?? rd?.character ?? rd?.englishName ?? rd?.meaning ?? "";
879
+ console.log(` ${n.id}${label ? ` \u2014 ${label}` : ""}`);
880
+ }
881
+ }
882
+ console.log();
883
+ }
884
+ function cmdTreeTypes(flags) {
885
+ const tree = getTree();
886
+ const allNodes = tree.getNodes();
887
+ const counts = {};
888
+ for (const n of allNodes) {
889
+ if (!counts[n.type]) counts[n.type] = { count: 0, ids: [] };
890
+ counts[n.type].count++;
891
+ counts[n.type].ids.push(n.id);
892
+ }
893
+ if (isJsonMode(flags)) {
894
+ outputJson(counts, flags);
895
+ return;
896
+ }
897
+ console.log(`
898
+ Node types (${Object.keys(counts).length}):
899
+ `);
900
+ for (const [type, info] of Object.entries(counts)) {
901
+ console.log(` ${type}: ${info.count}`);
902
+ }
903
+ console.log();
904
+ }
736
905
  async function cmdAstrology(args, flags, inputPayload) {
737
906
  const dateStr = inputPayload?.date ?? args[0];
738
907
  if (!dateStr) {
@@ -947,11 +1116,19 @@ async function main() {
947
1116
  await cmdTarot(inputPayload?.count ?? args[1], flags);
948
1117
  break;
949
1118
  case "tarot:card":
950
- if (!args[1] && inputPayload?.number == null) {
951
- exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <number>", flags);
1119
+ if (!args[1] && inputPayload?.query == null) {
1120
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:card <query>", flags);
1121
+ }
1122
+ cmdTarotCard((inputPayload?.query != null ? String(inputPayload.query) : void 0) ?? args.slice(1).join(" "), flags);
1123
+ break;
1124
+ case "tarot:spread": {
1125
+ const cardQueries = Array.isArray(inputPayload?.cards) ? inputPayload.cards.map(String) : args.slice(1);
1126
+ if (cardQueries.length === 0) {
1127
+ exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:spread <card1> [card2] ...", flags);
952
1128
  }
953
- cmdTarotCard((inputPayload?.number != null ? String(inputPayload.number) : void 0) ?? args[1], flags);
1129
+ cmdTarotSpread(cardQueries, flags);
954
1130
  break;
1131
+ }
955
1132
  case "ifa":
956
1133
  if (!args[1] && !inputPayload?.date) {
957
1134
  exitWithError("MISSING_ARGUMENT", "Usage: kaabalah ifa <YYYY-MM-DD>", flags);
@@ -961,6 +1138,15 @@ async function main() {
961
1138
  case "tree":
962
1139
  cmdTree(flags);
963
1140
  break;
1141
+ case "tree:node":
1142
+ if (!args[1] && !inputPayload?.id) {
1143
+ exitWithError("MISSING_ARGUMENT", 'Usage: kaabalah tree:node <id> (e.g. tree:node path:1, tree:node "tarotArkAnnu:The Magician")', flags);
1144
+ }
1145
+ cmdTreeNode(inputPayload?.id ?? args.slice(1).join(" "), flags);
1146
+ break;
1147
+ case "tree:types":
1148
+ cmdTreeTypes(flags);
1149
+ break;
964
1150
  case "astrology":
965
1151
  await cmdAstrology(args.slice(1), flags, inputPayload);
966
1152
  break;