@orrery/core 0.2.1 → 0.4.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/README.en.md +241 -0
- package/README.ja.md +241 -0
- package/README.md +34 -14
- package/README.zh.md +241 -0
- package/dist/{chunk-TRSIZZ73.js → chunk-6PLRETU5.js} +33 -7
- package/dist/{chunk-KD6TCTRW.js → chunk-APL4STY7.js} +10 -1
- package/dist/{chunk-VJDUZB5T.js → chunk-EXYPMSUR.js} +119 -0
- package/dist/{chunk-DGSIRAXF.js → chunk-JLKMDX3R.js} +138 -11
- package/dist/chunk-NSFWX6RO.js +42099 -0
- package/dist/chunk-TW4ADZCX.js +33 -0
- package/dist/{chunk-OCPJGMZC.js → chunk-WOQT7EBV.js} +71 -51
- package/dist/cities.d.ts +4 -2
- package/dist/cities.js +1 -1
- package/dist/constants.d.ts +12 -1
- package/dist/constants.js +21 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.js +20 -8
- package/dist/natal.d.ts +12 -5
- package/dist/natal.js +5 -3
- package/dist/pillars.d.ts +14 -6
- package/dist/pillars.js +10 -2
- package/dist/saju.js +4 -3
- package/dist/types.d.ts +44 -4
- package/dist/ziwei.js +3 -2
- package/package.json +2 -9
- package/dist/chunk-6PJQHSY6.js +0 -292
package/README.en.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
[한국어](./README.md) | **English** | [中文](./README.zh.md) | [日本語](./README.ja.md)
|
|
2
|
+
|
|
3
|
+
# @orrery/core
|
|
4
|
+
|
|
5
|
+
A calculation engine for Eastern and Western divination that runs in browser and Node.js environments.
|
|
6
|
+
|
|
7
|
+
- **四柱八字 (Four Pillars of Destiny)** — 60 干支 cycle, 十神, 12운성, 12신살, 大運, stem-branch interaction analysis
|
|
8
|
+
- **紫微斗數 (Purple Star Astrology)** — 命盤 generation, 大限, 流年/流月 analysis
|
|
9
|
+
- **Western Astrology Natal Chart** — Planet positions, houses, angles, aspects (pure TypeScript)
|
|
10
|
+
|
|
11
|
+
No backend required. All calculations are performed on the client.
|
|
12
|
+
|
|
13
|
+
**[Live Demo →](https://rath.github.io/orrery/)**
|
|
14
|
+
|
|
15
|
+
## Credits
|
|
16
|
+
|
|
17
|
+
- **Saju Perpetual Calendar** — Originally a Perl [perpetual calendar](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html) by Ko Young-chang, [ported to PHP](https://github.com/OOPS-ORG-PHP/Lunar) by Kim Jeong-gyun. In November 2018, Hwang Jang-ho ported it to Java and Python for personal use, then ported it to TypeScript in February 2026 using Claude Code (Opus 4.6).
|
|
18
|
+
- **紫微斗數 Chart** — Built on the [lunar-javascript](https://www.npmjs.com/package/lunar-javascript) library; Claude (Opus 4.5) implemented it while researching Chinese-language references.
|
|
19
|
+
- **Astrology Natal Chart** — The Moshier ephemeris from [Swiss Ephemeris](https://www.astro.com/swisseph/) ported to pure TypeScript.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @orrery/core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
### 四柱八字 (Four Pillars of Destiny)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { calculateSaju } from '@orrery/core/saju'
|
|
33
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
34
|
+
|
|
35
|
+
const input: BirthInput = {
|
|
36
|
+
year: 1993, month: 3, day: 12,
|
|
37
|
+
hour: 9, minute: 45,
|
|
38
|
+
gender: 'M',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = calculateSaju(input)
|
|
42
|
+
|
|
43
|
+
// Four Pillars (hour, day, month, year order)
|
|
44
|
+
for (const p of result.pillars) {
|
|
45
|
+
console.log(p.pillar.ganzi) // '乙巳', '壬辰', '乙卯', '癸酉'
|
|
46
|
+
console.log(p.stemSipsin) // Heavenly Stem 十神
|
|
47
|
+
console.log(p.branchSipsin) // Earthly Branch 十神
|
|
48
|
+
console.log(p.unseong) // 12운성
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 大運 (Major Life Periods)
|
|
52
|
+
for (const dw of result.daewoon) {
|
|
53
|
+
console.log(`${dw.ganzi} (age ${dw.age}~)`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Stem-Branch Interactions (合, 沖, 刑, 破, 害)
|
|
57
|
+
for (const [key, pair] of result.relations.pairs) {
|
|
58
|
+
console.log(key, pair.stem, pair.branch)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 紫微斗數 (Purple Star Astrology)
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { createChart, calculateLiunian, getDaxianList } from '@orrery/core/ziwei'
|
|
66
|
+
|
|
67
|
+
// Generate 命盤
|
|
68
|
+
const chart = createChart(1993, 3, 12, 9, 45, true)
|
|
69
|
+
|
|
70
|
+
console.log(chart.mingGongZhi) // 命宮 Earthly Branch
|
|
71
|
+
console.log(chart.shenGongZhi) // 身宮 Earthly Branch
|
|
72
|
+
console.log(chart.wuXingJu.name) // Five Elements Bureau (e.g., '水二局')
|
|
73
|
+
|
|
74
|
+
// Stars in each palace
|
|
75
|
+
for (const [name, palace] of Object.entries(chart.palaces)) {
|
|
76
|
+
const stars = palace.stars.map(s => {
|
|
77
|
+
const sihua = s.siHua ? `(${s.siHua})` : ''
|
|
78
|
+
return `${s.name}${s.brightness}${sihua}`
|
|
79
|
+
})
|
|
80
|
+
console.log(`${name} [${palace.ganZhi}]: ${stars.join(', ')}`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 大限 (Major Life Periods)
|
|
84
|
+
const daxianList = getDaxianList(chart)
|
|
85
|
+
for (const dx of daxianList) {
|
|
86
|
+
console.log(`${dx.ageStart}~${dx.ageEnd}세: ${dx.palaceName} ${dx.ganZhi}`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 流年 (Annual Fortune) — Fortune for a specific year
|
|
90
|
+
const liunian = calculateLiunian(chart, 2026)
|
|
91
|
+
console.log(liunian.natalPalaceAtMing) // Natal palace where 流年命宮 falls
|
|
92
|
+
console.log(liunian.siHua) // 流年 四化
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Western Astrology (Natal Chart)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { calculateNatal } from '@orrery/core/natal'
|
|
99
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
100
|
+
|
|
101
|
+
const input: BirthInput = {
|
|
102
|
+
year: 1993, month: 3, day: 12,
|
|
103
|
+
hour: 9, minute: 45,
|
|
104
|
+
gender: 'M',
|
|
105
|
+
latitude: 37.5665, // Seoul (optional, default: Seoul)
|
|
106
|
+
longitude: 126.9780,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const chart = await calculateNatal(input)
|
|
110
|
+
|
|
111
|
+
// Planet positions
|
|
112
|
+
for (const planet of chart.planets) {
|
|
113
|
+
console.log(`${planet.id}: ${planet.sign} ${planet.degreeInSign.toFixed(1)}°`)
|
|
114
|
+
// 'Sun: Pisces 21.6°'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ASC / MC
|
|
118
|
+
console.log(`ASC: ${chart.angles.asc.sign}`)
|
|
119
|
+
console.log(`MC: ${chart.angles.mc.sign}`)
|
|
120
|
+
|
|
121
|
+
// Houses (default: Placidus)
|
|
122
|
+
for (const house of chart.houses) {
|
|
123
|
+
console.log(`House ${house.number}: ${house.sign} ${house.degreeInSign.toFixed(1)}°`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Aspects
|
|
127
|
+
for (const aspect of chart.aspects) {
|
|
128
|
+
console.log(`${aspect.planet1} ${aspect.type} ${aspect.planet2} (orb: ${aspect.orb.toFixed(1)}°)`)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Change house system (Koch)
|
|
132
|
+
const kochChart = await calculateNatal(input, 'K')
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Low-Level API
|
|
136
|
+
|
|
137
|
+
You can also use individual functions directly:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { getFourPillars, getDaewoon, getRelation } from '@orrery/core/pillars'
|
|
141
|
+
import { STEM_INFO, ELEMENT_HANJA } from '@orrery/core/constants'
|
|
142
|
+
|
|
143
|
+
// Calculate only the four pillars
|
|
144
|
+
const [년주, 월주, 일주, 시주] = getFourPillars(1993, 3, 12, 9, 45)
|
|
145
|
+
console.log(년주, 월주, 일주, 시주) // '癸酉', '乙卯', '壬辰', '乙巳'
|
|
146
|
+
|
|
147
|
+
// 十神 relationship
|
|
148
|
+
const relation = getRelation('壬', '乙')
|
|
149
|
+
console.log(relation?.hanja) // '傷官'
|
|
150
|
+
|
|
151
|
+
// Heavenly Stem Five Elements info
|
|
152
|
+
console.log(STEM_INFO['壬']) // { yinyang: '+', element: 'water' }
|
|
153
|
+
console.log(ELEMENT_HANJA['water']) // '水'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### City Data
|
|
157
|
+
|
|
158
|
+
Provides Korean and world major city data for birth location input:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { SEOUL, filterCities, formatCityName } from '@orrery/core/cities'
|
|
162
|
+
|
|
163
|
+
console.log(SEOUL) // { name: '서울', lat: 37.5665, lon: 126.9780 }
|
|
164
|
+
|
|
165
|
+
// Supports Korean initial consonant search
|
|
166
|
+
const results = filterCities('ㅂㅅ') // Matches '부산'
|
|
167
|
+
console.log(formatCityName(results[0])) // '부산'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Running Examples
|
|
171
|
+
|
|
172
|
+
After cloning the repository, you can run the example scripts directly:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git clone https://github.com/rath/orrery.git
|
|
176
|
+
cd orrery
|
|
177
|
+
bun install
|
|
178
|
+
|
|
179
|
+
# 사주팔자
|
|
180
|
+
bun packages/core/examples/saju.ts
|
|
181
|
+
|
|
182
|
+
# 자미두수
|
|
183
|
+
bun packages/core/examples/ziwei.ts
|
|
184
|
+
|
|
185
|
+
# 서양 점성술 출생차트
|
|
186
|
+
bun packages/core/examples/natal.ts
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Subpath Exports
|
|
190
|
+
|
|
191
|
+
You can selectively import only the modules you need:
|
|
192
|
+
|
|
193
|
+
| Path | Description |
|
|
194
|
+
|------|-------------|
|
|
195
|
+
| `@orrery/core` | Full barrel export |
|
|
196
|
+
| `@orrery/core/saju` | `calculateSaju()` |
|
|
197
|
+
| `@orrery/core/ziwei` | `createChart()`, `calculateLiunian()`, `getDaxianList()` |
|
|
198
|
+
| `@orrery/core/natal` | `calculateNatal()`, zodiac/planet symbols, format functions |
|
|
199
|
+
| `@orrery/core/pillars` | `getFourPillars()`, `getDaewoon()`, and other low-level APIs |
|
|
200
|
+
| `@orrery/core/types` | All TypeScript types/interfaces |
|
|
201
|
+
| `@orrery/core/constants` | Stems/branches, 十神, palace names, and other constant tables |
|
|
202
|
+
| `@orrery/core/cities` | City data, search functions |
|
|
203
|
+
|
|
204
|
+
## Dependencies
|
|
205
|
+
|
|
206
|
+
| Package | Type | Purpose |
|
|
207
|
+
|---------|------|---------|
|
|
208
|
+
| `lunar-javascript` | dependency | Lunar calendar conversion (紫微斗數) |
|
|
209
|
+
|
|
210
|
+
All features run as pure TypeScript with no external WASM or data file dependencies.
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
[AGPL-3.0](../../LICENSE)
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary>What is AGPL-3.0? (Plain English)</summary>
|
|
218
|
+
|
|
219
|
+
### What you CAN do
|
|
220
|
+
|
|
221
|
+
- **Use it personally** — Run and modify it freely on your own machine.
|
|
222
|
+
- **Read and study the source code** — You are always welcome to learn from the code.
|
|
223
|
+
- **Modify, improve, and redistribute** — You can fork and redistribute the code, provided you follow the conditions below.
|
|
224
|
+
|
|
225
|
+
### What you MUST do
|
|
226
|
+
|
|
227
|
+
- **Keep the same license (AGPL-3.0)** — Any derivative work that includes or modifies this code must also be released under AGPL-3.0.
|
|
228
|
+
- **Disclose source code** — Unlike the standard GPL, the AGPL requires source disclosure **even when the software is offered as a web service**. If you modify this code and run it as a website, you must provide the modified source code to users upon request.
|
|
229
|
+
- **State changes** — You must clearly indicate what you changed from the original.
|
|
230
|
+
- **Preserve copyright notices** — Do not remove the original copyright and license notices.
|
|
231
|
+
|
|
232
|
+
### What you CANNOT do
|
|
233
|
+
|
|
234
|
+
- **Run a service with closed source** — Using a modified version of this code to operate a web service without disclosing the source is a license violation.
|
|
235
|
+
- **Relicense** — You cannot redistribute AGPL code under a more permissive license such as MIT or Apache.
|
|
236
|
+
|
|
237
|
+
### TL;DR
|
|
238
|
+
|
|
239
|
+
> Use it freely, but if you modify it or offer it as a service, you must release the source code under AGPL-3.0.
|
|
240
|
+
|
|
241
|
+
</details>
|
package/README.ja.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
[한국어](./README.md) | [English](./README.en.md) | [中文](./README.zh.md) | **日本語**
|
|
2
|
+
|
|
3
|
+
# @orrery/core
|
|
4
|
+
|
|
5
|
+
ブラウザおよびNode.js環境で動作する東洋・西洋占術計算エンジンです。
|
|
6
|
+
|
|
7
|
+
- **四柱八字** — 六十干支、十神、十二運星、十二神殺、大運、干支関係分析
|
|
8
|
+
- **紫微斗數** — 命盤生成、大限、流年/流月分析
|
|
9
|
+
- **西洋占星術出生チャート(Natal Chart)** — 惑星位置、ハウス、アングル、アスペクト(純粋TypeScript)
|
|
10
|
+
|
|
11
|
+
バックエンド不要。すべての計算がクライアント上で実行されます。
|
|
12
|
+
|
|
13
|
+
**[ライブデモ →](https://rath.github.io/orrery/)**
|
|
14
|
+
|
|
15
|
+
## クレジット
|
|
16
|
+
|
|
17
|
+
- **四柱万年暦** — 고영창(Ko Young-chang)氏のPerl [真万年暦](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html)を김정균(Kim Jeong-gyun)氏が[PHPに移植](https://github.com/OOPS-ORG-PHP/Lunar)したものを、2018年11月に황장호(Hwang Jang-ho)がJavaとPythonに移植して使用、2026年2月にClaude Code(Opus 4.6)でTypeScriptに移植
|
|
18
|
+
- **紫微斗數命盤** — [lunar-javascript](https://www.npmjs.com/package/lunar-javascript)ライブラリをベースに、Claude(Opus 4.5)が中国語文献を調査しながら実装
|
|
19
|
+
- **占星術出生チャート** — [Swiss Ephemeris](https://www.astro.com/swisseph/)のMoshier理論を純粋なTypeScriptに移植
|
|
20
|
+
|
|
21
|
+
## インストール
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @orrery/core
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 使い方
|
|
28
|
+
|
|
29
|
+
### 四柱八字
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { calculateSaju } from '@orrery/core/saju'
|
|
33
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
34
|
+
|
|
35
|
+
const input: BirthInput = {
|
|
36
|
+
year: 1993, month: 3, day: 12,
|
|
37
|
+
hour: 9, minute: 45,
|
|
38
|
+
gender: 'M',
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const result = calculateSaju(input)
|
|
42
|
+
|
|
43
|
+
// 四柱(時、日、月、年の順)
|
|
44
|
+
for (const p of result.pillars) {
|
|
45
|
+
console.log(p.pillar.ganzi) // '乙巳', '壬辰', '乙卯', '癸酉'
|
|
46
|
+
console.log(p.stemSipsin) // 天干十神
|
|
47
|
+
console.log(p.branchSipsin) // 地支十神
|
|
48
|
+
console.log(p.unseong) // 十二運星
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 大運
|
|
52
|
+
for (const dw of result.daewoon) {
|
|
53
|
+
console.log(`${dw.ganzi} (${dw.age}세~)`)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 干支関係(合、沖、刑、破、害)
|
|
57
|
+
for (const [key, pair] of result.relations.pairs) {
|
|
58
|
+
console.log(key, pair.stem, pair.branch)
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 紫微斗數
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { createChart, calculateLiunian, getDaxianList } from '@orrery/core/ziwei'
|
|
66
|
+
|
|
67
|
+
// 命盤を生成
|
|
68
|
+
const chart = createChart(1993, 3, 12, 9, 45, true)
|
|
69
|
+
|
|
70
|
+
console.log(chart.mingGongZhi) // 命宮の地支
|
|
71
|
+
console.log(chart.shenGongZhi) // 身宮の地支
|
|
72
|
+
console.log(chart.wuXingJu.name) // 五行局(例:'水二局')
|
|
73
|
+
|
|
74
|
+
// 各宮位の星曜を確認
|
|
75
|
+
for (const [name, palace] of Object.entries(chart.palaces)) {
|
|
76
|
+
const stars = palace.stars.map(s => {
|
|
77
|
+
const sihua = s.siHua ? `(${s.siHua})` : ''
|
|
78
|
+
return `${s.name}${s.brightness}${sihua}`
|
|
79
|
+
})
|
|
80
|
+
console.log(`${name} [${palace.ganZhi}]: ${stars.join(', ')}`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// 大限
|
|
84
|
+
const daxianList = getDaxianList(chart)
|
|
85
|
+
for (const dx of daxianList) {
|
|
86
|
+
console.log(`${dx.ageStart}~${dx.ageEnd}세: ${dx.palaceName} ${dx.ganZhi}`)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// 流年 — 特定の年の運勢
|
|
90
|
+
const liunian = calculateLiunian(chart, 2026)
|
|
91
|
+
console.log(liunian.natalPalaceAtMing) // 流年命宮が位置する本命盤の宮位
|
|
92
|
+
console.log(liunian.siHua) // 流年四化
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 西洋占星術(Natal Chart)
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { calculateNatal } from '@orrery/core/natal'
|
|
99
|
+
import type { BirthInput } from '@orrery/core/types'
|
|
100
|
+
|
|
101
|
+
const input: BirthInput = {
|
|
102
|
+
year: 1993, month: 3, day: 12,
|
|
103
|
+
hour: 9, minute: 45,
|
|
104
|
+
gender: 'M',
|
|
105
|
+
latitude: 37.5665, // ソウル(任意、デフォルト:ソウル)
|
|
106
|
+
longitude: 126.9780,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const chart = await calculateNatal(input)
|
|
110
|
+
|
|
111
|
+
// 惑星位置
|
|
112
|
+
for (const planet of chart.planets) {
|
|
113
|
+
console.log(`${planet.id}: ${planet.sign} ${planet.degreeInSign.toFixed(1)}°`)
|
|
114
|
+
// 'Sun: Pisces 21.6°'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ASC / MC
|
|
118
|
+
console.log(`ASC: ${chart.angles.asc.sign}`)
|
|
119
|
+
console.log(`MC: ${chart.angles.mc.sign}`)
|
|
120
|
+
|
|
121
|
+
// ハウス(デフォルト:Placidus)
|
|
122
|
+
for (const house of chart.houses) {
|
|
123
|
+
console.log(`House ${house.number}: ${house.sign} ${house.degreeInSign.toFixed(1)}°`)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// アスペクト
|
|
127
|
+
for (const aspect of chart.aspects) {
|
|
128
|
+
console.log(`${aspect.planet1} ${aspect.type} ${aspect.planet2} (orb: ${aspect.orb.toFixed(1)}°)`)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ハウスシステムの変更(Koch)
|
|
132
|
+
const kochChart = await calculateNatal(input, 'K')
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 低レベルAPI
|
|
136
|
+
|
|
137
|
+
個別の関数を直接使用することもできます:
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import { getFourPillars, getDaewoon, getRelation } from '@orrery/core/pillars'
|
|
141
|
+
import { STEM_INFO, ELEMENT_HANJA } from '@orrery/core/constants'
|
|
142
|
+
|
|
143
|
+
// 四柱のみ計算
|
|
144
|
+
const [년주, 월주, 일주, 시주] = getFourPillars(1993, 3, 12, 9, 45)
|
|
145
|
+
console.log(년주, 월주, 일주, 시주) // '癸酉', '乙卯', '壬辰', '乙巳'
|
|
146
|
+
|
|
147
|
+
// 十神関係
|
|
148
|
+
const relation = getRelation('壬', '乙')
|
|
149
|
+
console.log(relation?.hanja) // '傷官'
|
|
150
|
+
|
|
151
|
+
// 天干五行情報
|
|
152
|
+
console.log(STEM_INFO['壬']) // { yinyang: '+', element: 'water' }
|
|
153
|
+
console.log(ELEMENT_HANJA['water']) // '水'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 都市データ
|
|
157
|
+
|
|
158
|
+
出生地入力に活用できる韓国・世界の主要都市データを提供しています:
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
import { SEOUL, filterCities, formatCityName } from '@orrery/core/cities'
|
|
162
|
+
|
|
163
|
+
console.log(SEOUL) // { name: '서울', lat: 37.5665, lon: 126.9780 }
|
|
164
|
+
|
|
165
|
+
// 韓国語の初声検索対応
|
|
166
|
+
const results = filterCities('ㅂㅅ') // '부산'にマッチ
|
|
167
|
+
console.log(formatCityName(results[0])) // '부산'
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## サンプルの実行
|
|
171
|
+
|
|
172
|
+
リポジトリをクローンした後、すぐに実行できるサンプルスクリプトがあります:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
git clone https://github.com/rath/orrery.git
|
|
176
|
+
cd orrery
|
|
177
|
+
bun install
|
|
178
|
+
|
|
179
|
+
# 사주팔자
|
|
180
|
+
bun packages/core/examples/saju.ts
|
|
181
|
+
|
|
182
|
+
# 자미두수
|
|
183
|
+
bun packages/core/examples/ziwei.ts
|
|
184
|
+
|
|
185
|
+
# 서양 점성술 출생차트
|
|
186
|
+
bun packages/core/examples/natal.ts
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Subpath Exports
|
|
190
|
+
|
|
191
|
+
必要なモジュールのみを選択的にインポートできます:
|
|
192
|
+
|
|
193
|
+
| パス | 説明 |
|
|
194
|
+
|------|------|
|
|
195
|
+
| `@orrery/core` | 全体のbarrel export |
|
|
196
|
+
| `@orrery/core/saju` | `calculateSaju()` |
|
|
197
|
+
| `@orrery/core/ziwei` | `createChart()`, `calculateLiunian()`, `getDaxianList()` |
|
|
198
|
+
| `@orrery/core/natal` | `calculateNatal()`、星座/惑星シンボル、フォーマット関数 |
|
|
199
|
+
| `@orrery/core/pillars` | `getFourPillars()`, `getDaewoon()` 等の低レベルAPI |
|
|
200
|
+
| `@orrery/core/types` | すべてのTypeScript型/インターフェース |
|
|
201
|
+
| `@orrery/core/constants` | 天干/地支、十神、宮位名などの定数テーブル |
|
|
202
|
+
| `@orrery/core/cities` | 都市データ、検索関数 |
|
|
203
|
+
|
|
204
|
+
## 依存関係
|
|
205
|
+
|
|
206
|
+
| パッケージ | タイプ | 用途 |
|
|
207
|
+
|------------|--------|------|
|
|
208
|
+
| `lunar-javascript` | dependency | 旧暦変換(紫微斗數) |
|
|
209
|
+
|
|
210
|
+
外部のWASMやデータファイルへの依存なく、すべての機能が純粋なTypeScriptで動作します。
|
|
211
|
+
|
|
212
|
+
## ライセンス
|
|
213
|
+
|
|
214
|
+
[AGPL-3.0](../../LICENSE)
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary>AGPL-3.0とは?(わかりやすい説明)</summary>
|
|
218
|
+
|
|
219
|
+
### 自由にできること
|
|
220
|
+
|
|
221
|
+
- **個人的に使用** — 自分のコンピュータで自由に実行・修正できます。
|
|
222
|
+
- **ソースコードを読んで学ぶ** — コードを見て学ぶことはいつでも歓迎です。
|
|
223
|
+
- **修正・改善して再配布** — コードを修正して再配布できます。ただし、以下の条件を守る必要があります。
|
|
224
|
+
|
|
225
|
+
### 必ず守ること
|
|
226
|
+
|
|
227
|
+
- **同じライセンス(AGPL-3.0)を維持** — このコードを修正または含めて配布する場合、その成果物も必ずAGPL-3.0で公開しなければなりません。
|
|
228
|
+
- **ソースコードの公開義務** — 通常のGPLと異なり、AGPLは**Webサービスとして提供する場合にも**ソースコードを公開する必要があります。例えば、このコードを修正してウェブサイトとして運営する場合、ユーザーの要求に応じて修正されたソースコードを提供しなければなりません。
|
|
229
|
+
- **変更内容の明示** — 元のコードから何を変更したかわかるように表示する必要があります。
|
|
230
|
+
- **著作権表示の維持** — 元の著作権表示とライセンス文言を削除してはいけません。
|
|
231
|
+
|
|
232
|
+
### できないこと
|
|
233
|
+
|
|
234
|
+
- **ソース非公開でサービス運営** — このコードを修正してWebサービスを運営しながらソースを公開しないことはライセンス違反です。
|
|
235
|
+
- **ライセンスの変更** — AGPLコードをMIT、Apacheなどのより寛容なライセンスに変更して配布することはできません。
|
|
236
|
+
|
|
237
|
+
### 一言まとめ
|
|
238
|
+
|
|
239
|
+
> 自由に使えますが、修正したりサービスとして提供する場合は、ソースコードをAGPL-3.0で公開してください。
|
|
240
|
+
|
|
241
|
+
</details>
|
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
**한국어** | [English](./README.en.md) | [中文](./README.zh.md) | [日本語](./README.ja.md)
|
|
2
|
+
|
|
1
3
|
# @orrery/core
|
|
2
4
|
|
|
3
5
|
브라우저/Node.js 환경에서 동작하는 동양·서양 점술 계산 엔진입니다.
|
|
4
6
|
|
|
5
7
|
- **사주팔자(四柱八字)** — 60갑자, 십신, 12운성, 12신살, 대운, 간지 관계 분석
|
|
6
8
|
- **자미두수(紫微斗數)** — 명반(命盤) 생성, 대한(大限), 유년(流年)/유월(流月) 분석
|
|
7
|
-
- **서양 점성술 출생차트(Natal Chart)** — 행성 위치, 하우스, 앵글, 애스펙트 (
|
|
9
|
+
- **서양 점성술 출생차트(Natal Chart)** — 행성 위치, 하우스, 앵글, 애스펙트 (순수 TypeScript)
|
|
8
10
|
|
|
9
11
|
백엔드 불필요. 모든 계산이 클라이언트에서 수행됩니다.
|
|
10
12
|
|
|
@@ -12,9 +14,9 @@
|
|
|
12
14
|
|
|
13
15
|
## 크레딧
|
|
14
16
|
|
|
15
|
-
- **사주 만세력** — 고영창님의 Perl [진짜만세력](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html)
|
|
17
|
+
- **사주 만세력** — 고영창님의 Perl [진짜만세력](http://afnmp3.homeip.net/~kohyc/calendar/cal20000.html)을 김정균님이 [PHP로 포팅](https://github.com/OOPS-ORG-PHP/Lunar)한 것을, 2018년 11월 황장호가 Java와 Python으로 포팅하여 사용해오다가, 2026년 2월 Claude Code (Opus 4.6)로 TypeScript로 포팅
|
|
16
18
|
- **자미두수 명반** — [lunar-javascript](https://www.npmjs.com/package/lunar-javascript) 라이브러리 기반으로 Claude (Opus 4.5)가 중국어 문헌을 리서치하며 구현
|
|
17
|
-
- **점성술 출생차트** — [Swiss Ephemeris](https://
|
|
19
|
+
- **점성술 출생차트** — [Swiss Ephemeris](https://www.astro.com/swisseph/)의 Moshier 이론을 순수 TypeScript로 포팅
|
|
18
20
|
|
|
19
21
|
## 설치
|
|
20
22
|
|
|
@@ -22,14 +24,6 @@
|
|
|
22
24
|
npm install @orrery/core
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
서양 점성술(natal) 기능을 사용하려면 `swisseph-wasm`도 설치하세요:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install swisseph-wasm
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
> `swisseph-wasm`은 optional peer dependency입니다. 사주/자미두수만 사용한다면 설치하지 않아도 됩니다.
|
|
32
|
-
|
|
33
27
|
## 사용법
|
|
34
28
|
|
|
35
29
|
### 사주팔자 (四柱八字)
|
|
@@ -212,10 +206,36 @@ bun packages/core/examples/natal.ts
|
|
|
212
206
|
| 패키지 | 유형 | 용도 |
|
|
213
207
|
|--------|------|------|
|
|
214
208
|
| `lunar-javascript` | dependency | 음력 변환 (자미두수) |
|
|
215
|
-
| `swisseph-wasm` | optional peer | Swiss Ephemeris WASM (서양 점성술) |
|
|
216
209
|
|
|
217
|
-
|
|
210
|
+
외부 WASM이나 데이터 파일 의존성 없이 모든 기능이 순수 TypeScript로 동작합니다.
|
|
218
211
|
|
|
219
212
|
## 라이선스
|
|
220
213
|
|
|
221
|
-
|
|
214
|
+
[AGPL-3.0](../../LICENSE)
|
|
215
|
+
|
|
216
|
+
<details>
|
|
217
|
+
<summary>AGPL-3.0이 뭔가요? (쉬운 설명)</summary>
|
|
218
|
+
|
|
219
|
+
### 자유롭게 할 수 있는 것
|
|
220
|
+
|
|
221
|
+
- **개인적으로 사용** — 본인 컴퓨터에서 마음대로 실행하고 수정해도 됩니다.
|
|
222
|
+
- **소스 코드를 읽고 공부** — 코드를 보고 배우는 건 언제든 환영합니다.
|
|
223
|
+
- **수정·개선 후 재배포** — 코드를 고쳐서 다시 배포할 수 있습니다. 단, 아래 조건을 지켜야 합니다.
|
|
224
|
+
|
|
225
|
+
### 반드시 지켜야 하는 것
|
|
226
|
+
|
|
227
|
+
- **같은 라이선스(AGPL-3.0) 유지** — 이 코드를 수정하거나 포함해서 배포할 때, 그 결과물도 반드시 AGPL-3.0으로 공개해야 합니다.
|
|
228
|
+
- **소스 코드 공개 의무** — 일반적인 GPL과 달리, AGPL은 **웹 서비스로 제공하는 경우에도** 소스 코드를 공개해야 합니다. 예를 들어 이 코드를 수정해서 웹사이트로 운영하면, 사용자가 요청할 때 수정된 소스 코드를 제공해야 합니다.
|
|
229
|
+
- **변경 사항 명시** — 원본에서 무엇을 바꿨는지 알 수 있도록 표시해야 합니다.
|
|
230
|
+
- **저작권 표시 유지** — 원본의 저작권 표시와 라이선스 문구를 지우면 안 됩니다.
|
|
231
|
+
|
|
232
|
+
### 할 수 없는 것
|
|
233
|
+
|
|
234
|
+
- **소스 비공개 상태로 서비스 운영** — 이 코드를 수정해서 웹 서비스를 만들면서 소스를 공개하지 않는 것은 라이선스 위반입니다.
|
|
235
|
+
- **다른 라이선스로 변경** — AGPL 코드를 MIT, Apache 등 더 허용적인 라이선스로 바꿔서 배포할 수 없습니다.
|
|
236
|
+
|
|
237
|
+
### 한줄 요약
|
|
238
|
+
|
|
239
|
+
> 마음껏 쓰되, 수정하거나 서비스로 제공할 경우 소스 코드를 AGPL-3.0으로 공개하세요.
|
|
240
|
+
|
|
241
|
+
</details>
|