dsh-metaphysics 0.62.3 → 0.62.5
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/CHANGELOG.md +108 -1
- package/README.md +2 -2
- package/client.almanac.js +1 -1
- package/client.bazi.js +127 -121
- package/client.chenggu.js +1 -1
- package/client.convert.js +1 -1
- package/client.daliuren.js +93 -87
- package/client.fengshui.js +1 -1
- package/client.hepan.js +126 -120
- package/client.js +19 -19
- package/client.liuyao.js +71 -65
- package/client.mbti.js +1 -1
- package/client.name.js +70 -70
- package/client.numerology.js +1 -1
- package/client.qimen.js +118 -112
- package/client.star.js +1 -1
- package/client.tarot.js +90 -84
- package/client.trend.js +117 -111
- package/client.xiaoliuren.js +1 -1
- package/client.zeri.js +1 -1
- package/client.ziwei.js +130 -124
- package/docs/assets/dsh-metaphysics-group.jpg +0 -0
- package/engine/bazi.js +71 -2
- package/engine/citations-fuwen.js +3294 -0
- package/engine/citations.js +1186 -205
- package/engine/diff.js +1 -1
- package/engine/geju.js +333 -2
- package/engine/interpret-knowledge.js +46 -10
- package/engine/interpret.js +46 -5
- package/engine/qimen.js +9 -0
- package/engine/qiongtong.js +25 -11
- package/engine/structure.js +218 -0
- package/engine/trace.js +3 -3
- package/package.json +1 -1
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +1955 -251
|
Binary file
|
package/engine/bazi.js
CHANGED
|
@@ -12,6 +12,7 @@ import { bool } from './bool.js';
|
|
|
12
12
|
import { nayinOf } from './nayin.js';
|
|
13
13
|
import { SANHE } from './sanhe.js';
|
|
14
14
|
import { analyzeBaziFrame, scoreLuck } from './geju.js';
|
|
15
|
+
import { branchStructureOf, weightPctOf } from './structure.js';
|
|
15
16
|
|
|
16
17
|
// 地支藏干(本气 / 中气 / 余气)
|
|
17
18
|
// 巳的顺序是「丙庚戊」而不是「丙戊庚」:庚长生于巳,是中气;戊是辰月余气,排末位。
|
|
@@ -147,7 +148,38 @@ function rootedWeightOf(pillars, el, factor) {
|
|
|
147
148
|
return w;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
|
|
151
|
+
// ── 暗合(盲派/现代命理的补充定义)───────────────────────────
|
|
152
|
+
// 子平正法只有天干五合;暗合只作取象与风水参考,不参与旺衰与格局。
|
|
153
|
+
// 通合:亥午、寅丑(藏干双合);禄合:卯申、午亥、巳子;午亥与通合重叠时只报通合。
|
|
154
|
+
// 干支暗合取课里明列的六组;自合只取辰(戊癸)。
|
|
155
|
+
const ANHE_TONG = [['亥', '午'], ['寅', '丑']];
|
|
156
|
+
const ANHE_LU = [['卯', '申'], ['午', '亥'], ['巳', '子']];
|
|
157
|
+
const ANHE_GANZHI = new Set(['甲午', '丁亥', '戊子', '辛巳', '壬午', '癸巳']);
|
|
158
|
+
const ANHE_ZIHE = new Set(['辰']);
|
|
159
|
+
|
|
160
|
+
function anheOf(pillars, keys) {
|
|
161
|
+
const out = [];
|
|
162
|
+
const branches = keys.map((k) => pillars[k].branch);
|
|
163
|
+
const has = (a, b) => branches.includes(a) && branches.includes(b);
|
|
164
|
+
const seen = new Set();
|
|
165
|
+
const push = (text) => { if (!seen.has(text)) { seen.add(text); out.push(text); } };
|
|
166
|
+
|
|
167
|
+
for (const [a, b] of ANHE_TONG) if (has(a, b)) push(`${a}${b}通合(藏干双合)`);
|
|
168
|
+
for (const [a, b] of ANHE_LU) {
|
|
169
|
+
if (!has(a, b)) continue;
|
|
170
|
+
if (seen.has(`${a}${b}通合(藏干双合)`) || seen.has(`${b}${a}通合(藏干双合)`)) continue;
|
|
171
|
+
push(`${a}${b}禄合`);
|
|
172
|
+
}
|
|
173
|
+
for (const k of keys) {
|
|
174
|
+
const pl = pillars[k];
|
|
175
|
+
const gz = pl.ganzhi || `${pl.stem}${pl.branch}`;
|
|
176
|
+
if (ANHE_GANZHI.has(gz)) push(`${gz}干支暗合`);
|
|
177
|
+
if (ANHE_ZIHE.has(pl.branch)) push(`${gz}自合`);
|
|
178
|
+
}
|
|
179
|
+
return out;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** 干支关系:五合、相冲、相克;六合、三合半合、三会半会拱会、冲、害、破、刑;暗合另列 */
|
|
151
183
|
export function buildRelations(pillars, keys = ['year', 'month', 'day', 'hour']) {
|
|
152
184
|
const stems = keys.map((k) => pillars[k].stem);
|
|
153
185
|
const branches = keys.map((k) => pillars[k].branch);
|
|
@@ -228,7 +260,12 @@ export function buildRelations(pillars, keys = ['year', 'month', 'day', 'hour'])
|
|
|
228
260
|
}
|
|
229
261
|
return out;
|
|
230
262
|
};
|
|
231
|
-
return {
|
|
263
|
+
return {
|
|
264
|
+
stems: uniq(stemOut),
|
|
265
|
+
branches: uniq(branchOut),
|
|
266
|
+
anhe: anheOf(pillars, keys),
|
|
267
|
+
anheNote: '暗合只作取象与风水参考,不参与旺衰与格局;只出现一对时按课里可忽略',
|
|
268
|
+
};
|
|
232
269
|
}
|
|
233
270
|
|
|
234
271
|
/** 十神:以日干为我 */
|
|
@@ -407,6 +444,15 @@ export function buildBazi(input) {
|
|
|
407
444
|
// 四舍五入到 12 个月时必须进位,否则显示「X 岁 12 个月起运」
|
|
408
445
|
if (startAgeMonths >= 12) { startAgeMonths -= 12; startAgeYears += 1; }
|
|
409
446
|
|
|
447
|
+
// 并列的截断口径:年/月取整后,余数继续往下拆。1 月 = 0.25 日 = 6 时,
|
|
448
|
+
// 所以月内余数 ×30 得「日」、日余 ×24 得「时」——与 startAge 的四舍五入同源、不互相覆盖。
|
|
449
|
+
const exactYears = Math.floor(totalMonths / 12);
|
|
450
|
+
const exactRemMonths = totalMonths - exactYears * 12;
|
|
451
|
+
const exactMonths = Math.floor(exactRemMonths);
|
|
452
|
+
const exactRemDays = (exactRemMonths - exactMonths) * 30;
|
|
453
|
+
const exactDays = Math.floor(exactRemDays);
|
|
454
|
+
const exactHours = Math.floor((exactRemDays - exactDays) * 24);
|
|
455
|
+
|
|
410
456
|
// 交运:三日折一年。
|
|
411
457
|
// 古法三条换算是同一比例的三种说法——3 日折 1 年、1 日折 4 个月、1 时辰折 10 日:
|
|
412
458
|
// 把「出生 → 起运那一侧的节令」的真实间隔按 365.2422/3(≈121.7474)倍放大,
|
|
@@ -573,6 +619,11 @@ export function buildBazi(input) {
|
|
|
573
619
|
},
|
|
574
620
|
};
|
|
575
621
|
|
|
622
|
+
// 八大地支结构(炳祥课堂口径):只读标注,不参与上面的旺衰打分
|
|
623
|
+
strength.branchStructure = branchStructureOf(pillars, dayStem);
|
|
624
|
+
// 宫位权重百分比视图:纯展示换算,与上面的评分口径并列,不改分值
|
|
625
|
+
strength.weightPct = weightPctOf(pillars, { hourUnknown });
|
|
626
|
+
|
|
576
627
|
// ── 格局 / 用神 / 行运 ─────────────────────────────────────
|
|
577
628
|
const frame = analyzeBaziFrame({ pillars, dayStem, monthBranch, strength, wuxing });
|
|
578
629
|
|
|
@@ -731,6 +782,10 @@ export function buildBazi(input) {
|
|
|
731
782
|
direction: forward ? '顺行' : '逆行',
|
|
732
783
|
rule: `${isYangYear ? '阳' : '阴'}年${gender === 'male' ? '男' : '女'}${forward ? '顺排' : '逆排'}`,
|
|
733
784
|
startAge: { years: startAgeYears, months: startAgeMonths },
|
|
785
|
+
startAgeExact: {
|
|
786
|
+
years: exactYears, months: exactMonths, days: exactDays, hours: exactHours,
|
|
787
|
+
caliber: '截断到年月日时',
|
|
788
|
+
},
|
|
734
789
|
toNextJieDays: Math.round(spanDays * 100) / 100,
|
|
735
790
|
// 交运时刻(日/时辰级):上方 startAge 是四舍五入到月的旧字段,两者同源、不互相覆盖
|
|
736
791
|
jiao: {
|
|
@@ -812,6 +867,20 @@ export function buildBazi(input) {
|
|
|
812
867
|
// 旺衰与格局:内部仍按正午时柱跑(否则没有可比的基准),但必须说清这是占位值,
|
|
813
868
|
// 不能写成「时柱不参与任何判定」——那与 strength/frame 实际用了时柱相矛盾
|
|
814
869
|
out.strength.precision = 'three-pillars';
|
|
870
|
+
// 结构同此:第四支是正午占位,不套从格概率,免得把编出来的时支说成实有
|
|
871
|
+
if (out.strength.branchStructure) {
|
|
872
|
+
const bs = out.strength.branchStructure;
|
|
873
|
+
bs.placeholderHour = true;
|
|
874
|
+
bs.congProb = null;
|
|
875
|
+
bs.congRange = '三柱不判结构概率';
|
|
876
|
+
bs.word = '时柱暂缺,第四支为正午占位,不套从格概率';
|
|
877
|
+
bs.note = '时柱暂缺:第四支为占位值,只列结构形态,不据此断从格;补上出生时刻后可能改变';
|
|
878
|
+
bs.detail = `${bs.detail}(时支为占位值)`;
|
|
879
|
+
}
|
|
880
|
+
if (out.strength.weightPct) {
|
|
881
|
+
out.strength.weightPct.placeholderHour = true;
|
|
882
|
+
out.strength.weightPct.note = '时柱暂缺:时柱权重不计入合计(本盘 81%),不重新归一化;补上出生时刻后再按 100% 看';
|
|
883
|
+
}
|
|
815
884
|
out.notes = [
|
|
816
885
|
'时柱暂缺:未提供出生时刻,时柱不对外给出,也不计入神煞与干支关系',
|
|
817
886
|
'旺衰、格局、用神、调候暂以正午时柱估算,补上出生时刻后可能改变',
|