kaabalah 5.1.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 { 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",
@@ -687,16 +697,19 @@ Tarot Draw: ${count} card${count > 1 ? "s" : ""}
687
697
  console.log();
688
698
  }
689
699
  }
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
- }
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 };
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) {
700
713
  console.log(`
701
714
  #${String(card.number).padStart(2, "0")} ${card.tarotCard}`);
702
715
  console.log(` Type: ${card.type} | Suit: ${card.suit ?? "major"} | Deck: ${card.deck}`);
@@ -705,6 +718,44 @@ function cmdTarotCard(numberStr, flags) {
705
718
  if (card.papusMeaning) console.log(` Papus: ${card.papusMeaning}`);
706
719
  console.log();
707
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
+ }
708
759
  function cmdIfa(dateStr, flags) {
709
760
  const date = parseDate(dateStr, flags);
710
761
  const result = calculateOdu(date);
@@ -1065,11 +1116,19 @@ async function main() {
1065
1116
  await cmdTarot(inputPayload?.count ?? args[1], flags);
1066
1117
  break;
1067
1118
  case "tarot:card":
1068
- if (!args[1] && inputPayload?.number == null) {
1069
- 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);
1070
1121
  }
1071
- cmdTarotCard((inputPayload?.number != null ? String(inputPayload.number) : void 0) ?? args[1], flags);
1122
+ cmdTarotCard((inputPayload?.query != null ? String(inputPayload.query) : void 0) ?? args.slice(1).join(" "), flags);
1072
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);
1128
+ }
1129
+ cmdTarotSpread(cardQueries, flags);
1130
+ break;
1131
+ }
1073
1132
  case "ifa":
1074
1133
  if (!args[1] && !inputPayload?.date) {
1075
1134
  exitWithError("MISSING_ARGUMENT", "Usage: kaabalah ifa <YYYY-MM-DD>", flags);