kaabalah 6.11.0 → 6.12.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
@@ -15240,13 +15240,13 @@ function loadHermeticQabalah(tree) {
15240
15240
  }
15241
15241
  ];
15242
15242
  for (const path of paths) {
15243
- const pathId = tree.addPath({
15243
+ const pathId2 = tree.addPath({
15244
15244
  leftSphere: path.leftSphere,
15245
15245
  rightSphere: path.rightSphere,
15246
15246
  relatedNumber: path.relatedNumber
15247
15247
  });
15248
15248
  tree.addLetters({
15249
- path: pathId,
15249
+ path: pathId2,
15250
15250
  letters: path.letters
15251
15251
  });
15252
15252
  }
@@ -16579,14 +16579,14 @@ var init_kaabalah = __esm({
16579
16579
  }
16580
16580
  ];
16581
16581
  for (const path of paths) {
16582
- const pathId = tree.addPath({
16582
+ const pathId2 = tree.addPath({
16583
16583
  leftSphere: path.leftSphere,
16584
16584
  rightSphere: path.rightSphere,
16585
16585
  relatedNumber: path.relatedNumber,
16586
16586
  data: path.data
16587
16587
  });
16588
16588
  tree.addLetters({
16589
- path: pathId,
16589
+ path: pathId2,
16590
16590
  letters: path.letters
16591
16591
  });
16592
16592
  }
@@ -18906,13 +18906,13 @@ function loadLurianicKabbalah(tree) {
18906
18906
  }
18907
18907
  ];
18908
18908
  for (const path of paths) {
18909
- const pathId = tree.addPath({
18909
+ const pathId2 = tree.addPath({
18910
18910
  leftSphere: path.leftSphere,
18911
18911
  rightSphere: path.rightSphere,
18912
18912
  relatedNumber: path.relatedNumber
18913
18913
  });
18914
18914
  tree.addLetters({
18915
- path: pathId,
18915
+ path: pathId2,
18916
18916
  letters: path.letters
18917
18917
  });
18918
18918
  }
@@ -19401,7 +19401,7 @@ var init_tree_of_life = __esm({
19401
19401
  relatedNumber,
19402
19402
  data
19403
19403
  }) {
19404
- const pathId = this.upsertNode(
19404
+ const pathId2 = this.upsertNode(
19405
19405
  new BaseNode({
19406
19406
  id: relatedNumber,
19407
19407
  type: "path" /* PATH */,
@@ -19414,11 +19414,11 @@ var init_tree_of_life = __esm({
19414
19414
  );
19415
19415
  const numberOfSpheres = 10;
19416
19416
  const pathNumber = relatedNumber + numberOfSpheres;
19417
- this.link(leftSphere, pathId);
19418
- this.link(rightSphere, pathId);
19419
- this.addNumber({ number: relatedNumber, nodeId: pathId });
19420
- this.addNumber({ number: pathNumber, nodeId: pathId });
19421
- return pathId;
19417
+ this.link(leftSphere, pathId2);
19418
+ this.link(rightSphere, pathId2);
19419
+ this.addNumber({ number: relatedNumber, nodeId: pathId2 });
19420
+ this.addNumber({ number: pathNumber, nodeId: pathId2 });
19421
+ return pathId2;
19422
19422
  }
19423
19423
  addLetters({
19424
19424
  path,
@@ -19538,10 +19538,10 @@ function cloneSphereData(data) {
19538
19538
  function clonePathData(data) {
19539
19539
  return { ...data };
19540
19540
  }
19541
- function parsePathNumber(pathId) {
19542
- const parsed = Number.parseInt(parseId(pathId), 10);
19541
+ function parsePathNumber(pathId2) {
19542
+ const parsed = Number.parseInt(parseId(pathId2), 10);
19543
19543
  if (!Number.isInteger(parsed)) {
19544
- throw new Error(`Invalid tree path id: ${pathId}`);
19544
+ throw new Error(`Invalid tree path id: ${pathId2}`);
19545
19545
  }
19546
19546
  return parsed;
19547
19547
  }
@@ -20376,6 +20376,33 @@ var init_core = __esm({
20376
20376
  });
20377
20377
 
20378
20378
  // src/visual/tree.ts
20379
+ function getUnsupportedTreeSvgSystemMessage(system) {
20380
+ return `tree:svg is only supported for the Melkitzedeki system ('${TREE_SVG_SUPPORTED_SYSTEM}'); received '${system}'.`;
20381
+ }
20382
+ function assertTreeSvgSupportedSystem(system) {
20383
+ if (system !== TREE_SVG_SUPPORTED_SYSTEM) {
20384
+ throw new Error(getUnsupportedTreeSvgSystemMessage(system));
20385
+ }
20386
+ }
20387
+ function iridescentColorAt(t) {
20388
+ const frac = (t % 1 + 1) % 1;
20389
+ return interpolateColorStops(IRIDESCENT_STOPS, frac);
20390
+ }
20391
+ function iridescentContactT(center, toward) {
20392
+ const degrees = Math.atan2(toward.y - center.y, toward.x - center.x) * 180 / Math.PI;
20393
+ return ((degrees + 90) / 360 % 1 + 1) % 1;
20394
+ }
20395
+ function edgeAnchoredVector(from, to, radius) {
20396
+ const length = Math.hypot(to.x - from.x, to.y - from.y) || 1;
20397
+ const ux = (to.x - from.x) / length;
20398
+ const uy = (to.y - from.y) / length;
20399
+ return {
20400
+ x1: round3(from.x + ux * radius),
20401
+ y1: round3(from.y + uy * radius),
20402
+ x2: round3(to.x - ux * radius),
20403
+ y2: round3(to.y - uy * radius)
20404
+ };
20405
+ }
20379
20406
  function getTreeLayout(system = "kaabalah") {
20380
20407
  const tree = createTree({ system });
20381
20408
  const percentages = buildLayoutMap(tree, CANONICAL_SPHERE_PERCENTAGES);
@@ -20555,6 +20582,7 @@ function getTreeRenderModel(options = {}) {
20555
20582
  }
20556
20583
  function generateTreeSvg(options = {}) {
20557
20584
  const system = options.system ?? "kaabalah";
20585
+ assertTreeSvgSupportedSystem(system);
20558
20586
  const daathLayer = options.daathLayer ?? "front";
20559
20587
  const tree = createTree({ system, parts: ["colors"] });
20560
20588
  const viewBox = normalizeViewBox3(options.viewBox);
@@ -20612,21 +20640,44 @@ function generateTreeSvg(options = {}) {
20612
20640
  `<clipPath id="clip-${slug}"><circle cx="${point.x}" cy="${point.y}" r="${radius}"/></clipPath>`
20613
20641
  );
20614
20642
  }
20615
- push(`<radialGradient id="kether-glow" cx="50%" cy="50%" r="50%">
20616
- <stop offset="0%" stop-color="white" stop-opacity="0.95"/>
20617
- <stop offset="45%" stop-color="white" stop-opacity="0.6"/>
20618
- <stop offset="80%" stop-color="white" stop-opacity="0.15"/>
20619
- <stop offset="100%" stop-color="white" stop-opacity="0"/>
20620
- </radialGradient>`);
20621
- push(`<linearGradient id="kether-facet" x1="0" y1="0" x2="0" y2="1">
20622
- <stop offset="0%" stop-color="white" stop-opacity="0.9"/>
20623
- <stop offset="50%" stop-color="white" stop-opacity="0.5"/>
20624
- <stop offset="100%" stop-color="white" stop-opacity="0.1"/>
20625
- </linearGradient>`);
20626
- push(`<radialGradient id="kether-rim" cx="50%" cy="50%" r="75%">
20627
- <stop offset="60%" stop-color="black" stop-opacity="0"/>
20628
- <stop offset="100%" stop-color="black" stop-opacity="0.18"/>
20629
- </radialGradient>`);
20643
+ if (palette.mode === "color") {
20644
+ for (const splitPathId of SPLIT_GRADIENT_PATH_IDS) {
20645
+ const splitPath = layout.paths[splitPathId];
20646
+ if (!splitPath || highlights.pathColors[splitPathId] !== void 0 || activationMap.get(splitPathId) !== void 0) {
20647
+ continue;
20648
+ }
20649
+ const fromColor = resolveSplitEndpointColor({
20650
+ palette,
20651
+ sphereId: splitPath.fromId,
20652
+ tree
20653
+ });
20654
+ const toColor = resolveSplitEndpointColor({
20655
+ palette,
20656
+ sphereId: splitPath.toId,
20657
+ tree
20658
+ });
20659
+ const blendStart = round3(50 - SPLIT_GRADIENT_BLEND / 2);
20660
+ const blendEnd = round3(50 + SPLIT_GRADIENT_BLEND / 2);
20661
+ const fromName = parseId(splitPath.fromId);
20662
+ const toName = parseId(splitPath.toId);
20663
+ const contactT = toName === "Chokhmah" ? iridescentContactT(splitPath.to, splitPath.from) : fromName === "Chokhmah" ? iridescentContactT(splitPath.from, splitPath.to) : null;
20664
+ const stops = buildSplitGradientStops({
20665
+ fromName,
20666
+ toName,
20667
+ fromColor,
20668
+ toColor,
20669
+ blendStart,
20670
+ blendEnd,
20671
+ contactT
20672
+ });
20673
+ const edge = edgeAnchoredVector(splitPath.from, splitPath.to, radius);
20674
+ push(
20675
+ `<linearGradient id="path-grad-${parseId(splitPathId)}" gradientUnits="userSpaceOnUse" x1="${edge.x1}" y1="${edge.y1}" x2="${edge.x2}" y2="${edge.y2}">
20676
+ ${stops}
20677
+ </linearGradient>`
20678
+ );
20679
+ }
20680
+ }
20630
20681
  push(`</defs>`);
20631
20682
  const background = options.background ?? "white";
20632
20683
  if (background !== "transparent") {
@@ -20672,22 +20723,31 @@ function generateTreeSvg(options = {}) {
20672
20723
  activation: activationMap.get(currentPathId),
20673
20724
  canonicalColor
20674
20725
  });
20675
- const color = activation ? resolvePathDisplayColor({
20676
- canonicalColor,
20677
- activation
20678
- }) : baseColor;
20679
- const edgeColor = resolvePathEdgeColor({
20680
- palette,
20681
- pathColor: color
20682
- });
20726
+ const useSplitGradient = palette.mode === "color" && !activation && highlights.pathColors[currentPathId] === void 0 && SPLIT_GRADIENT_PATH_IDS.has(currentPathId);
20727
+ const solidColor = activation ? resolvePathDisplayColor({ canonicalColor, activation }) : baseColor;
20728
+ const solidEdgeColor = resolvePathEdgeColor({ palette, pathColor: solidColor });
20729
+ const gradientRef = useSplitGradient ? `url(#path-grad-${parseId(currentPathId)})` : null;
20730
+ const color = gradientRef ?? solidColor;
20731
+ const edgeColor = gradientRef ?? solidEdgeColor;
20732
+ const edgeFilter = palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : "";
20733
+ if (gradientRef) {
20734
+ push(
20735
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(solidEdgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${edgeFilter}/>`
20736
+ );
20737
+ }
20683
20738
  push(
20684
- `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${palette.pathEdgeUseFilter ? ` filter="url(#pathDarken)"` : ""}/>`
20739
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(edgeColor)}" stroke-width="${pathEdgeWidth}" stroke-linecap="round"${edgeFilter}/>`
20685
20740
  );
20686
20741
  if (activation?.visible && activation.emphasis > 0) {
20687
20742
  push(
20688
20743
  `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-opacity="${round3(0.18 + activation.emphasis * 0.28)}" stroke-width="${round3(pathEdgeWidth + activation.emphasis * 10)}" stroke-linecap="round"/>`
20689
20744
  );
20690
20745
  }
20746
+ if (gradientRef) {
20747
+ push(
20748
+ `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(solidColor)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
20749
+ );
20750
+ }
20691
20751
  push(
20692
20752
  `<line x1="${path.from.x}" y1="${path.from.y}" x2="${path.to.x}" y2="${path.to.y}" stroke="${escapeAttr3(color)}" stroke-width="${pathMainWidth}" stroke-linecap="round"/>`
20693
20753
  );
@@ -20802,6 +20862,16 @@ function renderSphere(push, params) {
20802
20862
  push(
20803
20863
  `<circle cx="${point.x}" cy="${point.y}" r="${params.radius}" fill="none" stroke="${escapeAttr3(params.palette.sphereStrokeColor)}" stroke-width="${params.sphereStrokeWidth}"/>`
20804
20864
  );
20865
+ } else if (INNER_BORDER_SPHERE_NAMES.has(params.sphereName)) {
20866
+ const borderWidth = round3(params.radius * 0.05);
20867
+ const borderColor = interpolateColor(
20868
+ toPrimaryFill(activeFill, params.palette.defaultSphereFill),
20869
+ "#000000",
20870
+ 0.2
20871
+ );
20872
+ push(
20873
+ `<circle cx="${point.x}" cy="${point.y}" r="${round3(params.radius - borderWidth / 2)}" fill="none" stroke="${escapeAttr3(borderColor)}" stroke-width="${borderWidth}"/>`
20874
+ );
20805
20875
  }
20806
20876
  }
20807
20877
  function buildLayoutMap(tree, spherePositions) {
@@ -20888,6 +20958,40 @@ function resolveTargetActivation(params) {
20888
20958
  emphasis: state === "selected" ? clamp01(Math.max(strength, 0.9)) : state === "hovered" ? clamp01(Math.max(strength, 0.72)) : state === "active" ? clamp01(Math.max(strength, 0.56)) : 0
20889
20959
  };
20890
20960
  }
20961
+ function resolveSplitEndpointColor(params) {
20962
+ const name = parseId(params.sphereId);
20963
+ return SPECIAL_SPHERE_PATH_COLORS[name] ?? resolveSphereCanonicalColor(params);
20964
+ }
20965
+ function buildSplitGradientStops(params) {
20966
+ const { fromName, toName, fromColor, toColor, blendStart, blendEnd, contactT } = params;
20967
+ const stop = (offset, color) => ` <stop offset="${round3(offset)}%" stop-color="${escapeAttr3(color)}"/>`;
20968
+ const sweep = (start, end, t0, sphereAtEnd) => Array.from({ length: CHOKHMAH_SWEEP_SAMPLES }, (_, index) => {
20969
+ const f = index / (CHOKHMAH_SWEEP_SAMPLES - 1);
20970
+ const offset = start + f * (end - start);
20971
+ const along = sphereAtEnd ? 1 - f : f;
20972
+ return stop(offset, iridescentColorAt(t0 + along * CHOKHMAH_SWEEP_SPAN));
20973
+ });
20974
+ if (toName === "Chokhmah" && contactT !== null) {
20975
+ return [
20976
+ stop(0, fromColor),
20977
+ stop(blendStart, fromColor),
20978
+ ...sweep(blendEnd, 100, contactT, true)
20979
+ ].join("\n");
20980
+ }
20981
+ if (fromName === "Chokhmah" && contactT !== null) {
20982
+ return [
20983
+ ...sweep(0, blendStart, contactT, false),
20984
+ stop(blendEnd, toColor),
20985
+ stop(100, toColor)
20986
+ ].join("\n");
20987
+ }
20988
+ return [
20989
+ stop(0, fromColor),
20990
+ stop(blendStart, fromColor),
20991
+ stop(blendEnd, toColor),
20992
+ stop(100, toColor)
20993
+ ].join("\n");
20994
+ }
20891
20995
  function resolveSphereCanonicalColor(params) {
20892
20996
  const override = params.palette.sphereFills[params.sphereId];
20893
20997
  if (override) {
@@ -21135,33 +21239,18 @@ function arcPath2(cx, cy, radius, startDegrees, endDegrees) {
21135
21239
  const largeArc = endDegrees - startDegrees <= 180 ? 0 : 1;
21136
21240
  return `M ${cx} ${cy} L ${start.x} ${start.y} A ${radius} ${radius} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
21137
21241
  }
21138
- function renderKether(push, point, radius, baseFill = "#e0e0e0") {
21242
+ function renderKether(push, point, radius, baseFill = NAZAR_NACRE) {
21243
+ const { x, y } = point;
21244
+ renderIridescent(push, point, radius, NACRE_STOPS);
21245
+ if (baseFill !== NAZAR_NACRE) {
21246
+ renderSphereTintOverlay(push, point, radius, baseFill, 0.5);
21247
+ }
21139
21248
  push(
21140
- `<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="${escapeAttr3(baseFill)}"/>`
21249
+ `<circle cx="${x}" cy="${y}" r="${round3(radius * 0.42)}" fill="${escapeAttr3(NAZAR_IRIS)}"/>`
21250
+ );
21251
+ push(
21252
+ `<circle cx="${x}" cy="${y}" r="${round3(radius * 0.2)}" fill="${escapeAttr3(NAZAR_PUPIL)}"/>`
21141
21253
  );
21142
- push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-glow)"/>`);
21143
- const spokes = 16;
21144
- const innerRadius = round3(radius * 0.18);
21145
- const outerRadius = round3(radius * 0.92);
21146
- const innerWidth = round3(radius * 0.04);
21147
- const angleStep = 360 / spokes;
21148
- push(`<g opacity="0.85">`);
21149
- for (let index = 0; index < spokes; index++) {
21150
- const angle = index * angleStep;
21151
- push(`<g transform="rotate(${angle} ${point.x} ${point.y})">`);
21152
- const x0 = round3(point.x - innerWidth);
21153
- const y0 = round3(point.y - innerRadius);
21154
- const x1 = point.x;
21155
- const y1 = round3(point.y - outerRadius);
21156
- const x2 = round3(point.x + innerWidth);
21157
- const y2 = round3(point.y - innerRadius);
21158
- push(
21159
- `<polygon points="${x0},${y0} ${x1},${y1} ${x2},${y2} ${point.x},${point.y}" fill="url(#kether-facet)"/>`
21160
- );
21161
- push(`</g>`);
21162
- }
21163
- push(`</g>`);
21164
- push(`<circle cx="${point.x}" cy="${point.y}" r="${radius}" fill="url(#kether-rim)"/>`);
21165
21254
  }
21166
21255
  function renderSlicedSphere(push, point, radius, colors, startAngle) {
21167
21256
  const segmentCount = colors.length;
@@ -21173,18 +21262,7 @@ function renderSlicedSphere(push, point, radius, colors, startAngle) {
21173
21262
  currentAngle += step;
21174
21263
  }
21175
21264
  }
21176
- function renderIridescent(push, point, radius) {
21177
- const stops = [
21178
- [0, "#F0E8EE"],
21179
- [0.1, "#ffa3e6"],
21180
- [0.22, "#a7e0ff"],
21181
- [0.34, "#baff9a"],
21182
- [0.46, "#ffe28a"],
21183
- [0.58, "#c6a4ff"],
21184
- [0.7, "#9ad6ff"],
21185
- [0.82, "#ffa3e6"],
21186
- [1, "#F0E8EE"]
21187
- ];
21265
+ function renderIridescent(push, point, radius, stops = IRIDESCENT_STOPS) {
21188
21266
  const slices = 72;
21189
21267
  const sphereRadius = round3(radius * 0.96);
21190
21268
  for (let index = 0; index < slices; index++) {
@@ -21261,11 +21339,12 @@ function resolveDualToneFill(fill) {
21261
21339
  function escapeAttr3(value) {
21262
21340
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
21263
21341
  }
21264
- var TREE_SVG_DEFAULT_VIEWBOX, TREE_SPHERE_NAMES, CANONICAL_X_PERCENTAGES, CANONICAL_ROW_Y_PERCENTAGES, DEFAULT_SPHERE_RADIUS, DEFAULT_PATH_EDGE_WIDTH, DEFAULT_PATH_MAIN_WIDTH, DEFAULT_PATH_HIGHLIGHT_WIDTH, DEFAULT_SPHERE_HIT_RADIUS, DEFAULT_PATH_HIT_STROKE_WIDTH, MUTED_TARGET_COLOR, sphereId, TREE_SPHERE_IDS, TREE_PATH_IDS, CANONICAL_SPHERE_PERCENTAGES;
21342
+ var TREE_SVG_SUPPORTED_SYSTEM, TREE_SVG_DEFAULT_VIEWBOX, TREE_SPHERE_NAMES, CANONICAL_X_PERCENTAGES, CANONICAL_ROW_Y_PERCENTAGES, DEFAULT_SPHERE_RADIUS, DEFAULT_PATH_EDGE_WIDTH, DEFAULT_PATH_MAIN_WIDTH, DEFAULT_PATH_HIGHLIGHT_WIDTH, DEFAULT_SPHERE_HIT_RADIUS, DEFAULT_PATH_HIT_STROKE_WIDTH, MUTED_TARGET_COLOR, INNER_BORDER_SPHERE_NAMES, NAZAR_NACRE, NAZAR_IRIS, NAZAR_PUPIL, sphereId, pathId, SPLIT_GRADIENT_PATH_IDS, SPLIT_GRADIENT_BLEND, SPECIAL_SPHERE_PATH_COLORS, CHOKHMAH_SWEEP_SPAN, CHOKHMAH_SWEEP_SAMPLES, TREE_SPHERE_IDS, TREE_PATH_IDS, CANONICAL_SPHERE_PERCENTAGES, IRIDESCENT_STOPS, NACRE_STOPS;
21265
21343
  var init_tree = __esm({
21266
21344
  "src/visual/tree.ts"() {
21267
21345
  "use strict";
21268
21346
  init_core();
21347
+ TREE_SVG_SUPPORTED_SYSTEM = "kaabalah";
21269
21348
  TREE_SVG_DEFAULT_VIEWBOX = {
21270
21349
  minX: 0,
21271
21350
  minY: 0,
@@ -21293,7 +21372,23 @@ var init_tree = __esm({
21293
21372
  DEFAULT_SPHERE_HIT_RADIUS = DEFAULT_SPHERE_RADIUS + 8;
21294
21373
  DEFAULT_PATH_HIT_STROKE_WIDTH = DEFAULT_PATH_EDGE_WIDTH + 8;
21295
21374
  MUTED_TARGET_COLOR = "#AAA";
21375
+ INNER_BORDER_SPHERE_NAMES = /* @__PURE__ */ new Set(["Tiphareth"]);
21376
+ NAZAR_NACRE = "__nacre__";
21377
+ NAZAR_IRIS = "#33a6dd";
21378
+ NAZAR_PUPIL = "#0b0b12";
21296
21379
  sphereId = (name) => id("sphere" /* SPHERE */, name);
21380
+ pathId = (value) => id("path" /* PATH */, value);
21381
+ SPLIT_GRADIENT_PATH_IDS = new Set(
21382
+ Array.from({ length: 22 }, (_, index) => pathId(String(index + 1)))
21383
+ );
21384
+ SPLIT_GRADIENT_BLEND = 34;
21385
+ SPECIAL_SPHERE_PATH_COLORS = {
21386
+ Kether: "#cfe0f2",
21387
+ Chokhmah: "#e6d6ef",
21388
+ Malkuth: "#8a6a52"
21389
+ };
21390
+ CHOKHMAH_SWEEP_SPAN = 0.42;
21391
+ CHOKHMAH_SWEEP_SAMPLES = 12;
21297
21392
  TREE_SPHERE_IDS = [...TREE_TOPOLOGY_SPHERE_IDS];
21298
21393
  TREE_PATH_IDS = [...TREE_TOPOLOGY_PATH_IDS];
21299
21394
  CANONICAL_SPHERE_PERCENTAGES = {
@@ -21309,6 +21404,27 @@ var init_tree = __esm({
21309
21404
  [sphereId("Yesod")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[6] },
21310
21405
  [sphereId("Malkuth")]: { x: CANONICAL_X_PERCENTAGES.mid, y: CANONICAL_ROW_Y_PERCENTAGES[7] }
21311
21406
  };
21407
+ IRIDESCENT_STOPS = [
21408
+ [0, "#F0E8EE"],
21409
+ [0.1, "#ffa3e6"],
21410
+ [0.22, "#a7e0ff"],
21411
+ [0.34, "#baff9a"],
21412
+ [0.46, "#ffe28a"],
21413
+ [0.58, "#c6a4ff"],
21414
+ [0.7, "#9ad6ff"],
21415
+ [0.82, "#ffa3e6"],
21416
+ [1, "#F0E8EE"]
21417
+ ];
21418
+ NACRE_STOPS = [
21419
+ [0, "#eaf6f6"],
21420
+ [0.12, "#a8d6ec"],
21421
+ [0.25, "#c3b6ec"],
21422
+ [0.4, "#a6ecec"],
21423
+ [0.55, "#dfe6fb"],
21424
+ [0.7, "#a6cdf0"],
21425
+ [0.82, "#cbb4ec"],
21426
+ [1, "#eaf6f6"]
21427
+ ];
21312
21428
  }
21313
21429
  });
21314
21430
 
@@ -21343,6 +21459,7 @@ __export(visual_exports, {
21343
21459
  TREE_SPHERE_IDS: () => TREE_SPHERE_IDS,
21344
21460
  TREE_SPHERE_NAMES: () => TREE_SPHERE_NAMES,
21345
21461
  TREE_SVG_DEFAULT_VIEWBOX: () => TREE_SVG_DEFAULT_VIEWBOX,
21462
+ TREE_SVG_SUPPORTED_SYSTEM: () => TREE_SVG_SUPPORTED_SYSTEM,
21346
21463
  ZODIAC_GLYPHS: () => ZODIAC_GLYPHS,
21347
21464
  ZODIAC_GLYPH_PRIMITIVES: () => ZODIAC_GLYPH_PRIMITIVES,
21348
21465
  generateArcheometerSvg: () => generateArcheometerSvg,
@@ -21355,6 +21472,7 @@ __export(visual_exports, {
21355
21472
  getRouteActivations: () => getRouteActivations,
21356
21473
  getTreeLayout: () => getTreeLayout,
21357
21474
  getTreeRenderModel: () => getTreeRenderModel,
21475
+ getUnsupportedTreeSvgSystemMessage: () => getUnsupportedTreeSvgSystemMessage,
21358
21476
  listAstroGlyphs: () => listAstroGlyphs
21359
21477
  });
21360
21478
  var init_visual = __esm({
@@ -23441,6 +23559,19 @@ function drawDefaultTarotSpread(spread, includeInverted, rng) {
23441
23559
  }
23442
23560
  return drawnCards;
23443
23561
  }
23562
+ function buildResolvedConsciousCard(slot, card, index, poolSize, includeInverted, rng) {
23563
+ const drawnCard = withSpreadCardOrientation(card, includeInverted, rng);
23564
+ return {
23565
+ slotKey: slot.slotKey,
23566
+ cardNumber: drawnCard.number,
23567
+ isInverted: drawnCard.isInverted ?? false,
23568
+ slot,
23569
+ card: drawnCard,
23570
+ index,
23571
+ poolSize,
23572
+ pos: `${index} of ${poolSize}`
23573
+ };
23574
+ }
23444
23575
  function drawEventReadingSpread(spread, includeInverted, rng, context) {
23445
23576
  const inquirerRule = spread.specialRules?.inquirerCard;
23446
23577
  if (!inquirerRule || !context?.inquirerGender) {
@@ -23670,11 +23801,81 @@ function drawTarotSpread(options) {
23670
23801
  cards: sortResolvedTarotSpreadCards(drawnCards)
23671
23802
  };
23672
23803
  }
23673
- var TAROT_SPREAD_MINOR_RANKS, EVENT_INNER_SLOT_KEYS, TAROT_CARD_BY_NUMBER, TAROT_SPREADS, TAROT_SPREAD_BY_ID;
23804
+ function drawConsciousTarotSpread(options) {
23805
+ const spread = TAROT_SPREAD_BY_ID.get(options.spreadId);
23806
+ if (!spread) {
23807
+ throw new Error(`Unknown tarot spread: ${options.spreadId}.`);
23808
+ }
23809
+ const slots = spread.slots.slice().sort((left, right) => left.order - right.order);
23810
+ if (options.indices.length !== slots.length) {
23811
+ throw new Error(
23812
+ `${spread.label} requires ${slots.length} conscious indices; received ${options.indices.length}.`
23813
+ );
23814
+ }
23815
+ const rng = options.rng ?? Math.random;
23816
+ const includeInverted = options.includeInverted ?? false;
23817
+ const drawnCards = slots.map((slot, slotIndex) => {
23818
+ const index = options.indices[slotIndex];
23819
+ const drawRule = getTarotSpreadRuleForDraw(slot);
23820
+ const pool = options.shuffledDeck.filter(
23821
+ (card) => matchesTarotSpreadConstraint(card, drawRule)
23822
+ );
23823
+ if (!Number.isInteger(index) || index < 1) {
23824
+ throw new Error(
23825
+ `${slot.label} conscious index must be a positive integer; received ${index}.`
23826
+ );
23827
+ }
23828
+ if (index > pool.length) {
23829
+ throw new TarotSpreadIndexOutOfPoolError(slot, index, pool.length);
23830
+ }
23831
+ return buildResolvedConsciousCard(
23832
+ slot,
23833
+ pool[index - 1],
23834
+ index,
23835
+ pool.length,
23836
+ includeInverted,
23837
+ rng
23838
+ );
23839
+ });
23840
+ const validation = validateTarotSpreadSelection({
23841
+ spreadId: spread.spreadId,
23842
+ cards: drawnCards.map((card) => ({
23843
+ slotKey: card.slotKey,
23844
+ cardNumber: card.cardNumber,
23845
+ isInverted: card.isInverted
23846
+ })),
23847
+ context: options.context
23848
+ });
23849
+ if (!validation.ok) {
23850
+ throw new Error(
23851
+ `Generated an invalid conscious tarot spread selection for ${spread.label}: ${validation.errors.map((error) => error.message).join(" ")}`
23852
+ );
23853
+ }
23854
+ return {
23855
+ spread: cloneSpreadDefinition(spread),
23856
+ deckId: options.deckId ?? "rider-waite",
23857
+ method: "conscious",
23858
+ context: options.context,
23859
+ cards: sortResolvedTarotSpreadCards(drawnCards)
23860
+ };
23861
+ }
23862
+ var TarotSpreadIndexOutOfPoolError, TAROT_SPREAD_MINOR_RANKS, EVENT_INNER_SLOT_KEYS, TAROT_CARD_BY_NUMBER, TAROT_SPREADS, TAROT_SPREAD_BY_ID;
23674
23863
  var init_spreads = __esm({
23675
23864
  "src/tarot/spreads.ts"() {
23676
23865
  "use strict";
23677
23866
  init_arkannus();
23867
+ TarotSpreadIndexOutOfPoolError = class extends Error {
23868
+ constructor(slot, index, poolSize) {
23869
+ super(
23870
+ `${slot.label} index ${index} exceeds the matching tarot pool size (${poolSize}).`
23871
+ );
23872
+ this.code = "INDEX_OUT_OF_POOL";
23873
+ this.name = "TarotSpreadIndexOutOfPoolError";
23874
+ this.slotKey = slot.slotKey;
23875
+ this.index = index;
23876
+ this.poolSize = poolSize;
23877
+ }
23878
+ };
23678
23879
  TAROT_SPREAD_MINOR_RANKS = [
23679
23880
  "ace",
23680
23881
  "2",
@@ -24368,22 +24569,22 @@ function getTarotArchetypeCache() {
24368
24569
  parts: ["westernAstrology", "tarot"]
24369
24570
  });
24370
24571
  const archetypes = MAJOR_ARCANA_CARDS.map((card) => {
24371
- const pathId = id("path" /* PATH */, card.number);
24372
- const path = tree.getNode(pathId);
24373
- const hebrewLetter = tree.getCorrespondences(pathId, {
24572
+ const pathId2 = id("path" /* PATH */, card.number);
24573
+ const path = tree.getNode(pathId2);
24574
+ const hebrewLetter = tree.getCorrespondences(pathId2, {
24374
24575
  type: "hebrewLetter" /* HEBREW_LETTER */,
24375
24576
  limit: 1
24376
24577
  })[0]?.node;
24377
- const tarotArkAnnu = tree.getCorrespondences(pathId, {
24578
+ const tarotArkAnnu = tree.getCorrespondences(pathId2, {
24378
24579
  type: "tarotArkAnnu" /* TAROT_ARK_ANNU */,
24379
24580
  limit: 1
24380
24581
  })[0]?.node;
24381
24582
  if (!path || !hebrewLetter || !tarotArkAnnu) {
24382
24583
  throw new Error(
24383
- `Missing canonical tarot archetype metadata for ${pathId}.`
24584
+ `Missing canonical tarot archetype metadata for ${pathId2}.`
24384
24585
  );
24385
24586
  }
24386
- const astrology = tree.getCorrespondences(pathId, {
24587
+ const astrology = tree.getCorrespondences(pathId2, {
24387
24588
  type: [
24388
24589
  "westernElement" /* WESTERN_ELEMENT */,
24389
24590
  "planet" /* PLANET */,
@@ -24396,9 +24597,9 @@ function getTarotArchetypeCache() {
24396
24597
  );
24397
24598
  const descriptionsByDeck = buildDescriptionsByDeck(tarotArkAnnu);
24398
24599
  return {
24399
- canonicalId: pathId,
24600
+ canonicalId: pathId2,
24400
24601
  kind: "major",
24401
- pathId,
24602
+ pathId: pathId2,
24402
24603
  pathNumber: card.number,
24403
24604
  pathSlug: parseId(hebrewLetter.id).toLowerCase(),
24404
24605
  hebrewLetterId: hebrewLetter.id,
@@ -25124,7 +25325,7 @@ function orderedSpheres() {
25124
25325
  }
25125
25326
  function orderedPaths() {
25126
25327
  orderedPathsInstance ?? (orderedPathsInstance = Object.freeze(
25127
- orderedPathIds.map((pathId) => canonicalTree().getNode(pathId)).filter((node) => Boolean(node))
25328
+ orderedPathIds.map((pathId2) => canonicalTree().getNode(pathId2)).filter((node) => Boolean(node))
25128
25329
  ));
25129
25330
  return orderedPathsInstance;
25130
25331
  }
@@ -25172,8 +25373,8 @@ function createSymbolRegistry(entries) {
25172
25373
  function createClassicalPlanetPathIdsByKey(tree) {
25173
25374
  const registry = /* @__PURE__ */ new Map();
25174
25375
  const mutable = /* @__PURE__ */ new Map();
25175
- for (const pathId of orderedPathIds) {
25176
- const planet = tree.getCorrespondences(pathId, {
25376
+ for (const pathId2 of orderedPathIds) {
25377
+ const planet = tree.getCorrespondences(pathId2, {
25177
25378
  type: "planet" /* PLANET */,
25178
25379
  depth: 1,
25179
25380
  limit: 1
@@ -25186,7 +25387,7 @@ function createClassicalPlanetPathIdsByKey(tree) {
25186
25387
  continue;
25187
25388
  }
25188
25389
  const bucket = mutable.get(key) ?? [];
25189
- bucket.push(pathId);
25390
+ bucket.push(pathId2);
25190
25391
  mutable.set(key, bucket);
25191
25392
  }
25192
25393
  for (const [key, value] of mutable.entries()) {
@@ -25571,10 +25772,10 @@ function getKaabalisticCorrespondenceTargets(lookup) {
25571
25772
  if (lookup.kind === "planet") {
25572
25773
  const planet = normalizePlanetName(lookup.planet);
25573
25774
  const planetKey = normalizeLookupKey(planet);
25574
- const planetPathTargets = (classicalPlanetPathIdsByKey().get(planetKey) ?? []).map((pathId) => ({
25575
- targetId: pathId,
25775
+ const planetPathTargets = (classicalPlanetPathIdsByKey().get(planetKey) ?? []).map((pathId2) => ({
25776
+ targetId: pathId2,
25576
25777
  targetType: "path",
25577
- targetName: getTargetName(pathId),
25778
+ targetName: getTargetName(pathId2),
25578
25779
  mapping: "planet-sign-path",
25579
25780
  distance: 1,
25580
25781
  sign,
@@ -26947,7 +27148,7 @@ var import_config3 = require("dotenv/config");
26947
27148
  // package.json
26948
27149
  var package_default = {
26949
27150
  name: "kaabalah",
26950
- version: "6.11.0",
27151
+ version: "6.12.1",
26951
27152
  description: "The de-facto library for any esoteric calculations and tooling",
26952
27153
  engines: {
26953
27154
  node: ">=18.18.0"
@@ -27085,6 +27286,8 @@ var GLOBAL_FLAGS = [
27085
27286
  { name: "compact", type: "boolean", default: false, description: "Minified JSON output (no indentation)" },
27086
27287
  { name: "fields", type: "string", description: "Comma-separated dot-paths to filter JSON output (e.g. --fields=a.b,c.d)" },
27087
27288
  { name: "input-json", type: "string", description: "JSON string, or - to read a JSON object from stdin" },
27289
+ { name: "quiet", type: "boolean", default: false, description: "Suppress stderr diagnostics and notices" },
27290
+ { name: "silent", type: "boolean", default: false, description: "Alias for --quiet" },
27088
27291
  { name: "debug", type: "boolean", default: false, description: "Emit debug logs to stderr (same effect as DEBUG=kaabalah:*)" },
27089
27292
  { name: "trace", type: "boolean", default: false, description: "Print stack traces for unexpected fatal errors in human-readable mode" }
27090
27293
  ];
@@ -27164,7 +27367,9 @@ var COMMANDS = [
27164
27367
  args: [{ name: "count", type: "number", required: false, description: "Number of cards to draw (1-78, default: 3)" }],
27165
27368
  flags: [
27166
27369
  { name: "inverted", type: "boolean", default: false, description: "Include inverted cards" },
27167
- { name: "shuffle-count", type: "number", default: 7, description: "Number of times to shuffle the deck" }
27370
+ { name: "shuffle-count", type: "number", default: 7, description: "Number of times to shuffle the deck" },
27371
+ { name: "deck", type: "string", description: "Deck for image/description: papus_pt, papus, mythic, egyptian, rider-waite" },
27372
+ { name: "include-fields", type: "string", description: "Comma-separated legacy card fields to include with --deck (papus, egyptian)" }
27168
27373
  ],
27169
27374
  examples: ["kaabalah tarot 5 --inverted", "kaabalah tarot --json"]
27170
27375
  },
@@ -27174,7 +27379,8 @@ var COMMANDS = [
27174
27379
  args: [{ name: "query", type: "string", required: true, description: "Card number (1-78) or name (e.g. 'The Chariot', 'Two of Cups')" }],
27175
27380
  flags: [
27176
27381
  { name: "deck", type: "string", description: "Deck for image/description: papus_pt, papus, mythic, egyptian, rider-waite" },
27177
- { name: "decks", type: "boolean", description: "List available decks" }
27382
+ { name: "decks", type: "boolean", description: "List available decks" },
27383
+ { name: "include-fields", type: "string", description: "Comma-separated legacy card fields to include with --deck (papus, egyptian)" }
27178
27384
  ],
27179
27385
  examples: [
27180
27386
  "kaabalah tarot:card 7",
@@ -27189,7 +27395,14 @@ var COMMANDS = [
27189
27395
  args: [{ name: "cards", type: "string", required: false, description: "Card names or numbers, space-separated (quote multi-word names)" }],
27190
27396
  flags: [
27191
27397
  { name: "list", type: "boolean", default: false, description: "List built-in spread IDs and requirements" },
27398
+ { name: "verbose", type: "boolean", default: false, description: "Include full spread slot definitions with --list" },
27399
+ { name: "describe", type: "boolean", default: false, description: "Describe a spread schema without drawing cards" },
27192
27400
  { name: "spread-id", type: "string", description: "Draw a built-in spread by ID (e.g. quick-insight, celtic-cross, event-reading)" },
27401
+ { name: "method", type: "string", description: "Spread draw method: random or conscious" },
27402
+ { name: "indices", type: "string", description: "Comma-separated 1-based pool indices for --method=conscious" },
27403
+ { name: "deck", type: "string", description: "Deck for image/description: papus_pt, papus, mythic, egyptian, rider-waite" },
27404
+ { name: "shuffle-count", type: "number", default: 7, description: "Number of times to shuffle the deck for conscious spreads" },
27405
+ { name: "include-fields", type: "string", description: "Comma-separated legacy card fields to include with --deck (papus, egyptian)" },
27193
27406
  { name: "inverted", type: "boolean", default: false, description: "Include inverted cards when drawing a named spread" },
27194
27407
  { name: "inquirer-gender", type: "string", description: 'Required by event-reading; must be "man" or "woman"' }
27195
27408
  ],
@@ -27698,6 +27911,25 @@ function debugLog(namespace, message, details) {
27698
27911
  );
27699
27912
  }
27700
27913
 
27914
+ // src/cli/runtime/quiet.ts
27915
+ var originalStderrWrite = null;
27916
+ function isQuietMode(flags) {
27917
+ return flags.quiet === true || flags.silent === true;
27918
+ }
27919
+ function configureQuietRuntime(flags = {}) {
27920
+ if (isQuietMode(flags)) {
27921
+ if (!originalStderrWrite) {
27922
+ originalStderrWrite = process.stderr.write.bind(process.stderr);
27923
+ process.stderr.write = () => true;
27924
+ }
27925
+ return;
27926
+ }
27927
+ if (originalStderrWrite) {
27928
+ process.stderr.write = originalStderrWrite;
27929
+ originalStderrWrite = null;
27930
+ }
27931
+ }
27932
+
27701
27933
  // src/cli/runtime/args.ts
27702
27934
  var CliParseError = class extends Error {
27703
27935
  constructor(message, flags) {
@@ -27798,6 +28030,14 @@ function getFallbackFlags(argv) {
27798
28030
  flags.debug = true;
27799
28031
  continue;
27800
28032
  }
28033
+ if (arg === "--quiet") {
28034
+ flags.quiet = true;
28035
+ continue;
28036
+ }
28037
+ if (arg === "--silent") {
28038
+ flags.silent = true;
28039
+ continue;
28040
+ }
27801
28041
  if (arg === "--trace") {
27802
28042
  flags.trace = true;
27803
28043
  continue;
@@ -27842,6 +28082,7 @@ function parseArgs(argv) {
27842
28082
  const flags = applyJsonDefaults({ ...parsed.values });
27843
28083
  const args = parsed.positionals;
27844
28084
  const usedOptions = parsed.tokens.filter((token) => token.kind === "option").map((token) => token.name);
28085
+ configureQuietRuntime(flags);
27845
28086
  configureDebugRuntime(flags);
27846
28087
  debugLog("parser", "Parsed CLI arguments.", {
27847
28088
  argv: describeArgvForDebug(argv),
@@ -27861,6 +28102,7 @@ function parseArgs(argv) {
27861
28102
  throw err;
27862
28103
  }
27863
28104
  const fallbackFlags = getFallbackFlags(argv);
28105
+ configureQuietRuntime(fallbackFlags);
27864
28106
  configureDebugRuntime(fallbackFlags);
27865
28107
  debugLog("parser", "Argument parsing failed.", {
27866
28108
  argv: describeArgvForDebug(argv),
@@ -28265,6 +28507,7 @@ function exitWithError(code, message, flags) {
28265
28507
  }
28266
28508
  function handleFatalError(err, argv) {
28267
28509
  const flags = getFallbackFlags(argv);
28510
+ configureQuietRuntime(flags);
28268
28511
  configureDebugRuntime(flags);
28269
28512
  if (isCliSignalError(err)) {
28270
28513
  debugLog("signals", `Exiting after ${err.signalName}.`);
@@ -30439,6 +30682,25 @@ function summarizeTarotSpreads() {
30439
30682
  contextRequirements: spread.contextRequirements ?? []
30440
30683
  }));
30441
30684
  }
30685
+ function describeTarotSpread(spread) {
30686
+ return {
30687
+ spreadId: spread.spreadId,
30688
+ label: spread.label,
30689
+ description: spread.description,
30690
+ contextRequirements: spread.contextRequirements ?? [],
30691
+ slots: spread.slots.slice().sort((left, right) => left.order - right.order).map((slot) => ({
30692
+ slotKey: slot.slotKey,
30693
+ label: slot.label,
30694
+ order: slot.order,
30695
+ minCards: slot.minCards,
30696
+ maxCards: slot.maxCards,
30697
+ validationRules: slot.validationRules,
30698
+ manualSelectionRules: slot.manualSelectionRules,
30699
+ drawRules: slot.drawRules,
30700
+ metadata: slot.metadata
30701
+ }))
30702
+ };
30703
+ }
30442
30704
  function findCardsByQuery(query) {
30443
30705
  const num = Number.parseInt(query, 10);
30444
30706
  if (!Number.isNaN(num)) {
@@ -30504,7 +30766,28 @@ function getRequestedDeckId(flags) {
30504
30766
  }
30505
30767
  return deckId;
30506
30768
  }
30507
- function enrichCardWithDeck(card, deckId, flags) {
30769
+ function getRequestedLegacyFields(flags) {
30770
+ const raw = getFlagString(flags, "include-fields");
30771
+ const fields = /* @__PURE__ */ new Set();
30772
+ if (!raw) {
30773
+ return fields;
30774
+ }
30775
+ for (const field of raw.split(",").map((value) => value.trim()).filter(Boolean)) {
30776
+ if (field !== "papus" && field !== "egyptian") {
30777
+ exitWithError(
30778
+ "INVALID_ARGUMENT",
30779
+ `Unknown tarot include field "${field}". Valid: papus, egyptian.`,
30780
+ flags
30781
+ );
30782
+ }
30783
+ fields.add(field);
30784
+ }
30785
+ return fields;
30786
+ }
30787
+ function serializeTarotCard(card, deckId, flags) {
30788
+ if (!deckId) {
30789
+ return card;
30790
+ }
30508
30791
  const profile = getTarotCardProfile({ tarotCardName: card.tarotCard });
30509
30792
  if (!profile) {
30510
30793
  exitWithError(
@@ -30514,12 +30797,52 @@ function enrichCardWithDeck(card, deckId, flags) {
30514
30797
  );
30515
30798
  }
30516
30799
  const representation = profile.availableDeckIds.includes(deckId) ? getTarotRepresentation({ tarotCardName: card.tarotCard }, deckId) : void 0;
30517
- return {
30518
- ...card,
30800
+ const legacyFields = getRequestedLegacyFields(flags);
30801
+ const serialized = {
30802
+ number: card.number,
30803
+ tarotCard: card.tarotCard,
30804
+ tarotCardFilename: card.tarotCardFilename,
30805
+ meaning: card.meaning,
30806
+ type: card.type,
30807
+ deck: deckId,
30808
+ suit: card.suit,
30809
+ isInverted: card.isInverted,
30519
30810
  deckId,
30520
30811
  imageUrl: representation?.imageUrl ?? null,
30521
30812
  description: profile.descriptionsByDeck[deckId]
30522
30813
  };
30814
+ if (legacyFields.has("egyptian") && card.egyptianCardName) {
30815
+ serialized.egyptianCardName = card.egyptianCardName;
30816
+ }
30817
+ if (legacyFields.has("papus") && card.papusMeaning) {
30818
+ serialized.papusMeaning = card.papusMeaning;
30819
+ }
30820
+ return serialized;
30821
+ }
30822
+ function serializeSpreadCard(spreadCard, deckId, flags) {
30823
+ return {
30824
+ ...spreadCard,
30825
+ card: serializeTarotCard(spreadCard.card, deckId, flags)
30826
+ };
30827
+ }
30828
+ function parseConsciousIndices(flags) {
30829
+ const raw = getFlagString(flags, "indices");
30830
+ if (!raw) {
30831
+ exitWithError(
30832
+ "MISSING_ARGUMENT",
30833
+ "--method=conscious requires --indices=<n1,n2,...>.",
30834
+ flags
30835
+ );
30836
+ }
30837
+ const indices = raw.split(",").map((value) => Number.parseInt(value.trim(), 10));
30838
+ if (indices.some((index) => !Number.isInteger(index) || index < 1)) {
30839
+ exitWithError(
30840
+ "INVALID_ARGUMENT",
30841
+ "--indices must contain positive 1-based integers.",
30842
+ flags
30843
+ );
30844
+ }
30845
+ return indices;
30523
30846
  }
30524
30847
  async function cmdTarot(countStr, flags) {
30525
30848
  const count = countStr ? Number.parseInt(countStr, 10) : 3;
@@ -30528,6 +30851,7 @@ async function cmdTarot(countStr, flags) {
30528
30851
  }
30529
30852
  const shuffleCount = getFlagNumber(flags, "shuffle-count") ?? 7;
30530
30853
  const shuffleDelay = isJsonMode(flags) ? 0 : 300;
30854
+ const deckId = getRequestedDeckId(flags);
30531
30855
  const deck = await shuffleTarotDeck(
30532
30856
  ARKANNUS,
30533
30857
  getFlagBool(flags, "inverted"),
@@ -30535,8 +30859,9 @@ async function cmdTarot(countStr, flags) {
30535
30859
  shuffleDelay
30536
30860
  );
30537
30861
  const drawn = deck.slice(0, count);
30862
+ const outputCards = deckId ? drawn.map((card) => serializeTarotCard(card, deckId, flags)) : drawn;
30538
30863
  if (isJsonMode(flags)) {
30539
- outputJson(drawn, flags);
30864
+ outputJson(outputCards, flags);
30540
30865
  return;
30541
30866
  }
30542
30867
  console.log(`
@@ -30565,7 +30890,7 @@ function cmdTarotCard(query, flags) {
30565
30890
  exitWithError("CARD_NOT_FOUND", `No card found for "${query}". Use a number (1-78) or card name.`, flags);
30566
30891
  }
30567
30892
  const deckId = getRequestedDeckId(flags);
30568
- const outputCards = deckId ? cards.map((card) => enrichCardWithDeck(card, deckId, flags)) : cards;
30893
+ const outputCards = deckId ? cards.map((card) => serializeTarotCard(card, deckId, flags)) : cards;
30569
30894
  if (isJsonMode(flags)) {
30570
30895
  outputJson(outputCards.length === 1 ? outputCards[0] : outputCards, flags);
30571
30896
  return;
@@ -30609,7 +30934,7 @@ ${result.spread.label}`);
30609
30934
  }
30610
30935
  console.log();
30611
30936
  }
30612
- function cmdTarotNamedSpread(spreadId, flags, options) {
30937
+ async function cmdTarotNamedSpread(spreadId, flags, options) {
30613
30938
  const spread = getTarotSpread(spreadId);
30614
30939
  if (!spread) {
30615
30940
  exitWithError("INVALID_ARGUMENT", `Unknown tarot spread: ${spreadId}.`, flags);
@@ -30623,32 +30948,59 @@ function cmdTarotNamedSpread(spreadId, flags, options) {
30623
30948
  flags
30624
30949
  );
30625
30950
  }
30951
+ const deckId = getRequestedDeckId(flags);
30952
+ const method = getFlagString(flags, "method") ?? "random";
30953
+ if (method !== "random" && method !== "conscious") {
30954
+ exitWithError("INVALID_ARGUMENT", 'Tarot spread method must be "random" or "conscious".', flags);
30955
+ }
30626
30956
  try {
30627
- const result = drawTarotSpread({
30957
+ const shuffledDeck = method === "conscious" ? await shuffleTarotDeck(
30958
+ ARKANNUS,
30959
+ false,
30960
+ getFlagNumber(flags, "shuffle-count") ?? 7,
30961
+ isJsonMode(flags) ? 0 : 300
30962
+ ) : void 0;
30963
+ const result = method === "conscious" ? drawConsciousTarotSpread({
30964
+ spreadId: spread.spreadId,
30965
+ shuffledDeck: shuffledDeck ?? ARKANNUS,
30966
+ indices: parseConsciousIndices(flags),
30967
+ deckId,
30968
+ includeInverted: getFlagBool(flags, "inverted"),
30969
+ context
30970
+ }) : drawTarotSpread({
30628
30971
  spreadId: spread.spreadId,
30972
+ deckId,
30629
30973
  includeInverted: getFlagBool(flags, "inverted"),
30630
30974
  context
30631
30975
  });
30976
+ const outputResult = deckId ? {
30977
+ ...result,
30978
+ cards: result.cards.map((card) => serializeSpreadCard(card, deckId, flags))
30979
+ } : result;
30632
30980
  if (isJsonMode(flags)) {
30633
- outputJson(result, flags);
30981
+ outputJson(outputResult, flags);
30634
30982
  return;
30635
30983
  }
30636
30984
  printSpreadDraw(result);
30637
30985
  } catch (err) {
30986
+ if (err instanceof TarotSpreadIndexOutOfPoolError) {
30987
+ exitWithError("INDEX_OUT_OF_POOL", err.message, flags);
30988
+ }
30638
30989
  exitWithError("INVALID_ARGUMENT", err instanceof Error ? err.message : String(err), flags);
30639
30990
  }
30640
30991
  }
30641
- function cmdTarotSpread(cardQueries, flags, options = {}) {
30992
+ async function cmdTarotSpread(cardQueries, flags, options = {}) {
30642
30993
  if (getFlagBool(flags, "list")) {
30643
- const spreads = summarizeTarotSpreads();
30994
+ const spreads = getFlagBool(flags, "verbose") ? listTarotSpreads().map(describeTarotSpread) : summarizeTarotSpreads();
30644
30995
  if (isJsonMode(flags)) {
30645
30996
  outputJson(spreads, flags);
30646
30997
  return;
30647
30998
  }
30648
30999
  console.log("\nTarot spreads\n");
30649
31000
  for (const spread of spreads) {
31001
+ const slotCount = Array.isArray(spread.slots) ? spread.slots.length : spread.slots;
30650
31002
  const requirements = spread.contextRequirements.length > 0 ? ` | requires: ${spread.contextRequirements.join(", ")}` : "";
30651
- console.log(` ${spread.spreadId.padEnd(22)} ${spread.label} (${spread.slots} slots)${requirements}`);
31003
+ console.log(` ${spread.spreadId.padEnd(22)} ${spread.label} (${slotCount} slots)${requirements}`);
30652
31004
  if (spread.description) {
30653
31005
  console.log(` ${spread.description}`);
30654
31006
  }
@@ -30656,9 +31008,30 @@ function cmdTarotSpread(cardQueries, flags, options = {}) {
30656
31008
  console.log();
30657
31009
  return;
30658
31010
  }
31011
+ const describedSpreadId = getFlagBool(flags, "describe") ? cardQueries[0] ?? getFlagString(flags, "spread-id") ?? options.spreadId : void 0;
31012
+ if (describedSpreadId) {
31013
+ const spread = getTarotSpread(describedSpreadId);
31014
+ if (!spread) {
31015
+ exitWithError("INVALID_ARGUMENT", `Unknown tarot spread: ${describedSpreadId}.`, flags);
31016
+ }
31017
+ const describedSpread = describeTarotSpread(spread);
31018
+ if (isJsonMode(flags)) {
31019
+ outputJson(describedSpread, flags);
31020
+ return;
31021
+ }
31022
+ console.log(`
31023
+ ${describedSpread.label}`);
31024
+ console.log(`Spread: ${describedSpread.spreadId}`);
31025
+ for (const slot of describedSpread.slots) {
31026
+ const allowedTypes = slot.validationRules?.allowedTypes?.join(", ") ?? "any";
31027
+ console.log(` ${slot.order}. ${slot.label} (${slot.minCards}-${slot.maxCards}) | allowed: ${allowedTypes}`);
31028
+ }
31029
+ console.log();
31030
+ return;
31031
+ }
30659
31032
  const spreadId = getFlagString(flags, "spread-id") ?? options.spreadId;
30660
31033
  if (spreadId) {
30661
- cmdTarotNamedSpread(spreadId, flags, options);
31034
+ await cmdTarotNamedSpread(spreadId, flags, options);
30662
31035
  return;
30663
31036
  }
30664
31037
  const results = [];
@@ -31020,6 +31393,10 @@ function readActivations(flags) {
31020
31393
  return payload.map((entry, index) => validateActivationEntry(entry, index, flags));
31021
31394
  }
31022
31395
  function buildSvgOptions(flags) {
31396
+ const system = resolveSystem(flags);
31397
+ if (system !== TREE_SVG_SUPPORTED_SYSTEM) {
31398
+ exitWithError("UNSUPPORTED_SYSTEM", getUnsupportedTreeSvgSystemMessage(system), flags);
31399
+ }
31023
31400
  const palette = getFlagString(flags, "palette");
31024
31401
  if (palette && palette !== "color" && palette !== "monochrome") {
31025
31402
  exitWithError(
@@ -31037,7 +31414,7 @@ function buildSvgOptions(flags) {
31037
31414
  );
31038
31415
  }
31039
31416
  return {
31040
- system: resolveSystem(flags),
31417
+ system,
31041
31418
  width: getFlagString(flags, "width"),
31042
31419
  height: getFlagString(flags, "height"),
31043
31420
  background: getFlagString(flags, "background") ?? void 0,
@@ -31133,8 +31510,8 @@ function renderAsciiTree(layout, columns, rows) {
31133
31510
  }
31134
31511
  plot(x1, y1, lineChar);
31135
31512
  };
31136
- for (const pathId of layout.pathOrder) {
31137
- const path = layout.percentages.paths[pathId];
31513
+ for (const pathId2 of layout.pathOrder) {
31514
+ const path = layout.percentages.paths[pathId2];
31138
31515
  drawLine(
31139
31516
  toGridX(path.from.x),
31140
31517
  toGridY(path.from.y),
@@ -31559,9 +31936,11 @@ async function runCli(argv) {
31559
31936
  if (isCliParseError(err)) {
31560
31937
  try {
31561
31938
  const resolved = resolveRuntimeConfig(err.flags);
31939
+ configureQuietRuntime(resolved.flags);
31562
31940
  exitWithError("INVALID_ARGUMENT", err.message, resolved.flags);
31563
31941
  } catch (configErr) {
31564
31942
  if (isCliConfigError(configErr)) {
31943
+ configureQuietRuntime(err.flags);
31565
31944
  exitWithError(configErr.code, configErr.message, err.flags);
31566
31945
  }
31567
31946
  throw configErr;
@@ -31573,8 +31952,10 @@ async function runCli(argv) {
31573
31952
  let flags = parsedArgs.flags;
31574
31953
  try {
31575
31954
  flags = resolveRuntimeConfig(flags).flags;
31955
+ configureQuietRuntime(flags);
31576
31956
  } catch (err) {
31577
31957
  if (isCliConfigError(err)) {
31958
+ configureQuietRuntime(flags);
31578
31959
  exitWithError(err.code, err.message, flags);
31579
31960
  }
31580
31961
  throw err;
@@ -31663,7 +32044,7 @@ async function runCli(argv) {
31663
32044
  if (cardQueries.length === 0 && !hasSpreadIdFlag && !spreadId && !shouldListSpreads) {
31664
32045
  exitWithError("MISSING_ARGUMENT", "Usage: kaabalah tarot:spread <card1> [card2] ...", flags);
31665
32046
  }
31666
- cmdTarotSpread(cardQueries, flags, {
32047
+ await cmdTarotSpread(cardQueries, flags, {
31667
32048
  spreadId,
31668
32049
  context: inputPayload?.context
31669
32050
  });