kaabalah 5.0.0 → 5.1.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.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { calculateOdu } from './chunk-YTZCZRJG.mjs';
2
2
  import { calculateFibonacciCycle, calculateChallenges, calculatePersonalCycles, calculateCycles, calculateKaabalisticLifePath, calculateStraightAcrossReductionLifePath, getDateEnergies, calculatePersonalYear } from './chunk-KSKAKQTM.mjs';
3
3
  import { reverseGematria, calculateGematria } from './chunk-X2SPWMUA.mjs';
4
- import { createTree, SYSTEM } from './chunk-JBMCNKO4.mjs';
4
+ import { SYSTEM, createTree } from './chunk-JBMCNKO4.mjs';
5
5
  import { ARKANNUS, shuffleTarotDeck } from './chunk-M7XQFDS4.mjs';
6
6
  import { __require } from './chunk-WY6NIR2V.mjs';
7
7
  import 'dotenv/config';
@@ -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",
@@ -101,10 +101,32 @@ var COMMANDS = [
101
101
  },
102
102
  {
103
103
  name: "tree",
104
- description: "Show Tree of Life structure",
104
+ description: "Show Tree of Life structure with all nodes, data, and edges",
105
105
  args: [],
106
106
  flags: [],
107
- examples: ["kaabalah tree", "kaabalah tree --json"]
107
+ examples: ["kaabalah tree --json --compact", "kaabalah tree --json --fields=nodes"]
108
+ },
109
+ {
110
+ name: "tree:node",
111
+ description: "Look up a node and all its correspondences",
112
+ args: [{ name: "id", type: "string", required: true, description: "Node ID (e.g. path:1, sphere:Kether, tarotArkAnnu:The Magician)" }],
113
+ flags: [
114
+ { name: "type", type: "string", description: "Filter related nodes by type (e.g. hebrewLetter, planet, tarotArkAnnu)" },
115
+ { name: "depth", type: "number", default: 1, description: "Traversal depth (default: 1)" }
116
+ ],
117
+ examples: [
118
+ "kaabalah tree:node path:1 --json",
119
+ "kaabalah tree:node sphere:Kether --type=tarotArkAnnu --json",
120
+ 'kaabalah tree:node "tarotArkAnnu:The Magician" --json',
121
+ "kaabalah tree:node path:1 --depth=2 --json"
122
+ ]
123
+ },
124
+ {
125
+ name: "tree:types",
126
+ description: "List all node types and their counts",
127
+ args: [],
128
+ flags: [],
129
+ examples: ["kaabalah tree:types --json"]
108
130
  },
109
131
  {
110
132
  name: "astrology",
@@ -121,8 +143,8 @@ var COMMANDS = [
121
143
  { name: "timezone", type: "string", description: "IANA timezone string (e.g. America/New_York). Auto-resolved from coordinates if omitted" }
122
144
  ],
123
145
  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"',
146
+ "kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006",
147
+ 'kaabalah astrology 1990-01-15 14:30 --location="New York, USA"',
126
148
  "kaabalah astrology 1990-01-15 --lat=40.7128 --lon=-74.006 --json"
127
149
  ]
128
150
  },
@@ -283,15 +305,15 @@ function generateHelp() {
283
305
  }
284
306
  lines.push("");
285
307
  lines.push("EXAMPLES");
286
- lines.push(' kaabalah gematria "Mat Moura"');
308
+ lines.push(' kaabalah gematria "Hello World"');
287
309
  lines.push(" kaabalah numerology 1990-01-15");
288
- lines.push(" kaabalah numerology:cycles 1990-01-15 Mateus");
310
+ lines.push(" kaabalah numerology:cycles 1990-01-15 John");
289
311
  lines.push(" kaabalah tarot 5 --inverted");
290
312
  lines.push(" kaabalah tarot:card 7");
291
313
  lines.push(" kaabalah gematria:reverse 22");
292
314
  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"');
315
+ lines.push(" kaabalah astrology 1990-01-15 14:30 --lat=40.7128 --lon=-74.006");
316
+ lines.push(' kaabalah astrology 1990-01-15 14:30 --location="New York, USA"');
295
317
  lines.push(" kaabalah help --json");
296
318
  lines.push("");
297
319
  return lines.join("\n");
@@ -702,11 +724,42 @@ Odu: ${dateStr}
702
724
  console.log(` Center: ${result.center}`);
703
725
  console.log();
704
726
  }
727
+ function getTree() {
728
+ return createTree({ system: SYSTEM, parts: ["westernAstrology", "tarot"] });
729
+ }
730
+ function serializeNode(n) {
731
+ const result = { id: n.id, type: n.type };
732
+ if (n.data && typeof n.data === "object" && Object.keys(n.data).length > 0) {
733
+ result.data = n.data;
734
+ }
735
+ if (n.name) result.name = n.name;
736
+ return result;
737
+ }
705
738
  function cmdTree(flags) {
706
- const tree = createTree({ system: SYSTEM, parts: ["westernAstrology", "tarot"] });
739
+ const tree = getTree();
707
740
  const allNodes = tree.getNodes();
708
741
  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);
742
+ const nodes = allNodes.map((n) => {
743
+ const node = serializeNode(n);
744
+ const relatedTypes = tree.relatedTypes(n.id);
745
+ if (relatedTypes.length > 0) {
746
+ node.relatedTypes = relatedTypes;
747
+ }
748
+ return node;
749
+ });
750
+ const edgeSet = /* @__PURE__ */ new Set();
751
+ const edges = [];
752
+ for (const n of allNodes) {
753
+ const related = tree.related(n.id);
754
+ for (const r of related) {
755
+ const key = n.id < r.id ? `${n.id}|${r.id}` : `${r.id}|${n.id}`;
756
+ if (!edgeSet.has(key)) {
757
+ edgeSet.add(key);
758
+ edges.push({ from: n.id, to: r.id });
759
+ }
760
+ }
761
+ }
762
+ outputJson({ system: SYSTEM, totalNodes: allNodes.length, totalEdges: edges.length, nodes, edges }, flags);
710
763
  return;
711
764
  }
712
765
  console.log(`
@@ -733,6 +786,71 @@ Tree of Life (${SYSTEM})
733
786
  }
734
787
  console.log();
735
788
  }
789
+ function cmdTreeNode(idStr, flags) {
790
+ const tree = getTree();
791
+ const node = tree.getNode(idStr);
792
+ if (!node) {
793
+ 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);
794
+ }
795
+ const typeFilter = getFlagString(flags, "type");
796
+ const depth = getFlagNumber(flags, "depth") ?? 1;
797
+ const related = depth > 1 ? tree.walk(node.id, depth, typeFilter || void 0) : typeFilter ? tree.related(node.id, typeFilter) : tree.related(node.id);
798
+ if (isJsonMode(flags)) {
799
+ outputJson({
800
+ node: serializeNode(node),
801
+ relatedTypes: tree.relatedTypes(node.id),
802
+ related: related.map(serializeNode)
803
+ }, flags);
804
+ return;
805
+ }
806
+ console.log(`
807
+ ${node.id}`);
808
+ const d = node.data;
809
+ if (d) {
810
+ for (const [k, v] of Object.entries(d)) {
811
+ if (v != null && typeof v !== "object") console.log(` ${k}: ${v}`);
812
+ }
813
+ }
814
+ const relatedTypes = tree.relatedTypes(node.id);
815
+ console.log(`
816
+ Related types: ${relatedTypes.join(", ")}`);
817
+ const byType = /* @__PURE__ */ new Map();
818
+ for (const r of related) {
819
+ if (!byType.has(r.type)) byType.set(r.type, []);
820
+ byType.get(r.type).push(r);
821
+ }
822
+ for (const [type, nodes] of byType) {
823
+ console.log(`
824
+ ${type}:`);
825
+ for (const n of nodes) {
826
+ const rd = n.data;
827
+ const label = rd?.name ?? rd?.character ?? rd?.englishName ?? rd?.meaning ?? "";
828
+ console.log(` ${n.id}${label ? ` \u2014 ${label}` : ""}`);
829
+ }
830
+ }
831
+ console.log();
832
+ }
833
+ function cmdTreeTypes(flags) {
834
+ const tree = getTree();
835
+ const allNodes = tree.getNodes();
836
+ const counts = {};
837
+ for (const n of allNodes) {
838
+ if (!counts[n.type]) counts[n.type] = { count: 0, ids: [] };
839
+ counts[n.type].count++;
840
+ counts[n.type].ids.push(n.id);
841
+ }
842
+ if (isJsonMode(flags)) {
843
+ outputJson(counts, flags);
844
+ return;
845
+ }
846
+ console.log(`
847
+ Node types (${Object.keys(counts).length}):
848
+ `);
849
+ for (const [type, info] of Object.entries(counts)) {
850
+ console.log(` ${type}: ${info.count}`);
851
+ }
852
+ console.log();
853
+ }
736
854
  async function cmdAstrology(args, flags, inputPayload) {
737
855
  const dateStr = inputPayload?.date ?? args[0];
738
856
  if (!dateStr) {
@@ -961,6 +1079,15 @@ async function main() {
961
1079
  case "tree":
962
1080
  cmdTree(flags);
963
1081
  break;
1082
+ case "tree:node":
1083
+ if (!args[1] && !inputPayload?.id) {
1084
+ exitWithError("MISSING_ARGUMENT", 'Usage: kaabalah tree:node <id> (e.g. tree:node path:1, tree:node "tarotArkAnnu:The Magician")', flags);
1085
+ }
1086
+ cmdTreeNode(inputPayload?.id ?? args.slice(1).join(" "), flags);
1087
+ break;
1088
+ case "tree:types":
1089
+ cmdTreeTypes(flags);
1090
+ break;
964
1091
  case "astrology":
965
1092
  await cmdAstrology(args.slice(1), flags, inputPayload);
966
1093
  break;