Skip to content

Commit 24d52d7

Browse files
committed
Initial public OSS package for Rensheng Mima
0 parents  commit 24d52d7

70 files changed

Lines changed: 14425 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Privacy review
3+
about: Check whether a change touches sensitive data boundaries
4+
title: "[Privacy] "
5+
labels: privacy
6+
---
7+
8+
## Scope
9+
10+
What data, fixture, parser, report, or storage behavior changed?
11+
12+
## Checklist
13+
14+
- [ ] No real birth records are included.
15+
- [ ] No real names or private reports are included.
16+
- [ ] Logs and errors do not expose sensitive input.
17+
- [ ] Public examples are synthetic.
18+

.github/pull_request_template.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Summary
2+
3+
## Tests
4+
5+
## Privacy Checklist
6+
7+
- [ ] This PR does not add real birth records, names, private reports, logs, tokens, cookies, or agent state.
8+
- [ ] Any examples or fixtures are synthetic or safe for public release.
9+
- [ ] User-facing copy keeps advice boundaries clear.
10+

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
python:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.12"
15+
- run: python -m pip install --upgrade pip
16+
- run: pip install -r requirements.txt
17+
- run: python -B scripts/ziweiwenmotests.py
18+
- run: python -B scripts/xiashensuantests.py
19+
- run: python -B scripts/ziwei_patterns_tests.py
20+
- run: python -B scripts/wenmo_text_scan.py --record-dir private_records
21+
22+
frontend:
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
working-directory: web/frontend
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: "22"
32+
cache: npm
33+
cache-dependency-path: web/frontend/package-lock.json
34+
- run: npm ci
35+
- run: npm run build
36+

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
.pytest_cache/
5+
.venv/
6+
venv/
7+
8+
# Node
9+
web/frontend/node_modules/
10+
web/frontend/dist/
11+
web/frontend/.vite/
12+
web/frontend/*.tsbuildinfo
13+
14+
# Local private records
15+
private_records/
16+
命理记录/
17+
*.private.*
18+
19+
# Environment and OS
20+
.env
21+
.env.*
22+
.DS_Store
23+
Thumbs.db
24+
25+
# Generated outputs
26+
reports/
27+
exports/
28+
*.log
29+

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
## 0.1.0 - Local MVP
4+
5+
- Added BaZi and Zi Wei computation entry point
6+
- Added Wenmo-compatible parser support for private local regression
7+
- Added Zi Wei pattern detectors
8+
- Added local web MVP with React/Vite source and static fallback
9+
- Added privacy-first OSS packaging with no real case records
10+

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing
2+
3+
Thanks for considering a contribution to 人生密码 / Rensheng Mima.
4+
5+
## Ground Rules
6+
7+
- Do not commit real birth records, names, private reports, screenshots, logs, tokens, cookies, or agent state.
8+
- Use synthetic or anonymized examples only when they cannot identify a real person.
9+
- Keep rule changes covered by deterministic tests.
10+
- Avoid fear-based, deterministic life advice in user-facing copy.
11+
- Keep medical, legal, financial, and psychological boundaries explicit.
12+
13+
## Development
14+
15+
```bash
16+
pip install -r requirements.txt
17+
python3 -B scripts/ziweiwenmotests.py
18+
python3 -B scripts/xiashensuantests.py
19+
python3 -B scripts/ziwei_patterns_tests.py
20+
```
21+
22+
Frontend:
23+
24+
```bash
25+
cd web/frontend
26+
npm install
27+
npm run build
28+
```
29+
30+
## Pull Requests
31+
32+
Please include:
33+
34+
- what changed
35+
- how it was tested
36+
- whether any fixture or privacy-sensitive data was touched
37+
- screenshots for UI changes
38+

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Rensheng Mima contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

PRIVACY.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Privacy Policy for the Public OSS Project
2+
3+
人生密码 treats birth information and generated reports as highly sensitive personal data.
4+
5+
The public repository must not contain:
6+
7+
- real names
8+
- exact real birth records tied to a person
9+
- private reports
10+
- screenshots of private reports
11+
- chat logs, sessions, tokens, cookies, API keys, or local agent state
12+
13+
The local MVP currently stores generated reports in memory only. When the process exits, reports are cleared.
14+
15+
If you run private regression tests, keep fixtures under `private_records/`; this path is ignored by Git.
16+

README.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# 人生密码 / Rensheng Mima
2+
3+
Local-first Chinese metaphysics computation toolkit and web MVP.
4+
5+
人生密码是一个本地优先的中文命理结构化计算工具。它把八字、紫微斗数、文墨天机兼容文字盘解析、格局识别和融合报告拆成可测试的工程模块,并提供一个 React/Vite 本地网页入口。
6+
7+
> This project is for cultural research, structured rule-engine experiments, and personal reflection. It is not medical, legal, financial, or psychological advice.
8+
9+
## Why This Exists
10+
11+
Traditional Chinese metaphysics tools often mix calculation, interpretation, private records, and product UI in one opaque bundle. 人生密码 tries to make that stack more transparent:
12+
13+
- deterministic chart computation and parser outputs
14+
- privacy-preserving local execution
15+
- fixture-based regression tests
16+
- clear boundaries between rules, renderers, and web UI
17+
- cautious wording with explicit disclaimers
18+
19+
## Features
20+
21+
- BaZi engine with true-solar-time correction, ten-god analysis, weighted five-elements scoring, day-master strength, useful-god strategy, and luck-cycle summaries
22+
- Zi Wei Dou Shu engine using a C5FYC-style rule path, palace maps, major stars, support stars, transformations, and boundary-sensitive double-chart handling
23+
- Wenmo-compatible text parser for private local regression workflows
24+
- Pattern detectors for Zi Wei chart structures
25+
- Fusion layer for BaZi, Zi Wei, MBTI, zodiac, and blood-type modules
26+
- Local web MVP with free summary, mock checkout flow, privacy page, pricing page, and report deletion
27+
28+
## Privacy Boundary
29+
30+
No real user birth records, names, generated reports, private notes, logs, tokens, or agent state are included in this public package.
31+
32+
The public `xiashensuan_core/fixtures/wenmo_cases/manifest.json` is intentionally empty. Maintainers can keep private fixture records locally under `private_records/`, which is ignored by Git.
33+
34+
## Quick Start
35+
36+
```bash
37+
python3 -m venv .venv
38+
source .venv/bin/activate
39+
pip install -r requirements.txt
40+
python3 scripts/xiashensuan.py 1990 1 15 14 --minute 30 --gender 男 --place 北京 --mode life
41+
```
42+
43+
Run the local web MVP:
44+
45+
```bash
46+
python3 web/server.py
47+
```
48+
49+
Open `http://127.0.0.1:8765`.
50+
51+
## Frontend
52+
53+
```bash
54+
cd web/frontend
55+
npm install
56+
npm run build
57+
```
58+
59+
After building, restart `python3 web/server.py`; the server will serve `web/frontend/dist/` first and fall back to `web/static/` if no build exists.
60+
61+
## Tests
62+
63+
```bash
64+
python3 -B scripts/ziweiwenmotests.py
65+
python3 -B scripts/xiashensuantests.py
66+
python3 -B scripts/ziwei_patterns_tests.py
67+
python3 -B scripts/wenmo_text_scan.py --record-dir private_records
68+
```
69+
70+
Private Wenmo fixture tests are skipped when no private fixtures exist.
71+
72+
## Repository Scope
73+
74+
Included:
75+
76+
- rule engines
77+
- local web MVP source
78+
- deterministic tests
79+
- privacy and contribution docs
80+
81+
Excluded:
82+
83+
- real case records
84+
- generated reports
85+
- private agent files
86+
- `.openclaw` or local runtime state
87+
- `node_modules`
88+
- frontend build artifacts
89+
90+
## Roadmap
91+
92+
- Add synthetic public fixtures that do not come from real users
93+
- Split the engine into a proper Python package
94+
- Add typed JSON schema for chart outputs
95+
- Add GitHub Pages demo screenshots
96+
- Add CI coverage for frontend build and backend smoke tests
97+
- Add privacy review checklist for contribution review
98+
99+
## License
100+
101+
MIT.
102+

SECURITY.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Security Policy
2+
3+
## Reporting
4+
5+
Please open a private security advisory or contact the maintainer privately for vulnerabilities involving:
6+
7+
- exposure of birth records or generated reports
8+
- path traversal or local file disclosure
9+
- unsafe upload/parsing behavior
10+
- payment or order-state bypasses in future production integrations
11+
12+
Do not include real personal data in public issues.
13+
14+
## Current Security Model
15+
16+
The current web service is a local MVP. It stores reports only in process memory and does not implement login, persistent storage, or real payment callbacks.
17+
18+
Before production deployment, the project needs:
19+
20+
- authenticated access
21+
- encrypted persistence
22+
- payment callback verification
23+
- production logging with redaction
24+
- rate limiting
25+
- a stronger input-validation layer
26+

0 commit comments

Comments
 (0)