astro-skill 1.1.1__tar.gz

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.
Files changed (85) hide show
  1. astro_skill-1.1.1/LICENSE +21 -0
  2. astro_skill-1.1.1/PKG-INFO +254 -0
  3. astro_skill-1.1.1/README.md +212 -0
  4. astro_skill-1.1.1/astro/SKILL.md +106 -0
  5. astro_skill-1.1.1/astro/agents/openai.yaml +4 -0
  6. astro_skill-1.1.1/astro/assets/cover_ganesha.png +0 -0
  7. astro_skill-1.1.1/astro/config/defaults.json +12 -0
  8. astro_skill-1.1.1/astro/data/ashtakavarga_data.json +77 -0
  9. astro_skill-1.1.1/astro/data/avakahada_data.json +92 -0
  10. astro_skill-1.1.1/astro/data/compatibility_data.json +56 -0
  11. astro_skill-1.1.1/astro/data/functional_nature.json +183 -0
  12. astro_skill-1.1.1/astro/data/gochar_narrative_data.json +189 -0
  13. astro_skill-1.1.1/astro/data/graha_data.json +284 -0
  14. astro_skill-1.1.1/astro/data/nakshatra_db.json +31 -0
  15. astro_skill-1.1.1/astro/data/personality_ext.json +84 -0
  16. astro_skill-1.1.1/astro/data/phalit_basic.json +60 -0
  17. astro_skill-1.1.1/astro/data/phalit_ext.json +154 -0
  18. astro_skill-1.1.1/astro/data/remedies.json +320 -0
  19. astro_skill-1.1.1/astro/data/remedies_ext.json +76 -0
  20. astro_skill-1.1.1/astro/ephe/README.md +30 -0
  21. astro_skill-1.1.1/astro/ephe/semo_18.se1 +0 -0
  22. astro_skill-1.1.1/astro/ephe/sepl_18.se1 +0 -0
  23. astro_skill-1.1.1/astro/scripts/__init__.py +1 -0
  24. astro_skill-1.1.1/astro/scripts/ashtakavarga.py +44 -0
  25. astro_skill-1.1.1/astro/scripts/aspects.py +57 -0
  26. astro_skill-1.1.1/astro/scripts/avakahada.py +90 -0
  27. astro_skill-1.1.1/astro/scripts/dasha_calculator.py +197 -0
  28. astro_skill-1.1.1/astro/scripts/fonts/NotoSansDevanagari.ttf +0 -0
  29. astro_skill-1.1.1/astro/scripts/gochar_calculator.py +201 -0
  30. astro_skill-1.1.1/astro/scripts/gochar_narrative.py +408 -0
  31. astro_skill-1.1.1/astro/scripts/guna_milan.py +231 -0
  32. astro_skill-1.1.1/astro/scripts/html_pdf_report.py +3438 -0
  33. astro_skill-1.1.1/astro/scripts/kundali_calculator.py +648 -0
  34. astro_skill-1.1.1/astro/scripts/panchang_calculator.py +504 -0
  35. astro_skill-1.1.1/astro/scripts/pdf_report.py +991 -0
  36. astro_skill-1.1.1/astro/scripts/remedies.py +41 -0
  37. astro_skill-1.1.1/astro/scripts/report_generator.py +329 -0
  38. astro_skill-1.1.1/astro/scripts/scoring.py +258 -0
  39. astro_skill-1.1.1/astro/scripts/swe_lock.py +33 -0
  40. astro_skill-1.1.1/astro/scripts/synthesis.py +391 -0
  41. astro_skill-1.1.1/astro/scripts/vargas.py +67 -0
  42. astro_skill-1.1.1/astro/scripts/yoga_detector.py +448 -0
  43. astro_skill-1.1.1/astro/tests/test_ashtakavarga.py +41 -0
  44. astro_skill-1.1.1/astro/tests/test_aspects.py +49 -0
  45. astro_skill-1.1.1/astro/tests/test_astro_mcp_server.py +121 -0
  46. astro_skill-1.1.1/astro/tests/test_astro_mcp_storage.py +164 -0
  47. astro_skill-1.1.1/astro/tests/test_astro_mcp_tools.py +294 -0
  48. astro_skill-1.1.1/astro/tests/test_avakahada.py +71 -0
  49. astro_skill-1.1.1/astro/tests/test_ayanamsa.py +44 -0
  50. astro_skill-1.1.1/astro/tests/test_dasha.py +117 -0
  51. astro_skill-1.1.1/astro/tests/test_dasha_balance_antardasha.py +84 -0
  52. astro_skill-1.1.1/astro/tests/test_gochar.py +74 -0
  53. astro_skill-1.1.1/astro/tests/test_gochar_narrative.py +212 -0
  54. astro_skill-1.1.1/astro/tests/test_guna_milan.py +100 -0
  55. astro_skill-1.1.1/astro/tests/test_kundali.py +158 -0
  56. astro_skill-1.1.1/astro/tests/test_panchang.py +118 -0
  57. astro_skill-1.1.1/astro/tests/test_parse_birth_details_time.py +71 -0
  58. astro_skill-1.1.1/astro/tests/test_pdf_report.py +336 -0
  59. astro_skill-1.1.1/astro/tests/test_pdf_report_escaping.py +67 -0
  60. astro_skill-1.1.1/astro/tests/test_planetary_strength.py +179 -0
  61. astro_skill-1.1.1/astro/tests/test_pratyantardasha.py +59 -0
  62. astro_skill-1.1.1/astro/tests/test_premium_pdf_sections.py +753 -0
  63. astro_skill-1.1.1/astro/tests/test_project_structure.py +114 -0
  64. astro_skill-1.1.1/astro/tests/test_remedies.py +103 -0
  65. astro_skill-1.1.1/astro/tests/test_report.py +205 -0
  66. astro_skill-1.1.1/astro/tests/test_scoring.py +192 -0
  67. astro_skill-1.1.1/astro/tests/test_smoke_mcp_script.py +37 -0
  68. astro_skill-1.1.1/astro/tests/test_synthesis.py +255 -0
  69. astro_skill-1.1.1/astro/tests/test_vargas.py +46 -0
  70. astro_skill-1.1.1/astro/tests/test_yoga.py +347 -0
  71. astro_skill-1.1.1/astro_skill.egg-info/PKG-INFO +254 -0
  72. astro_skill-1.1.1/astro_skill.egg-info/SOURCES.txt +83 -0
  73. astro_skill-1.1.1/astro_skill.egg-info/dependency_links.txt +1 -0
  74. astro_skill-1.1.1/astro_skill.egg-info/entry_points.txt +2 -0
  75. astro_skill-1.1.1/astro_skill.egg-info/requires.txt +17 -0
  76. astro_skill-1.1.1/astro_skill.egg-info/top_level.txt +2 -0
  77. astro_skill-1.1.1/pyproject.toml +87 -0
  78. astro_skill-1.1.1/services/__init__.py +0 -0
  79. astro_skill-1.1.1/services/astro_mcp/__init__.py +11 -0
  80. astro_skill-1.1.1/services/astro_mcp/__main__.py +7 -0
  81. astro_skill-1.1.1/services/astro_mcp/models.py +49 -0
  82. astro_skill-1.1.1/services/astro_mcp/server.py +550 -0
  83. astro_skill-1.1.1/services/astro_mcp/storage.py +185 -0
  84. astro_skill-1.1.1/services/astro_mcp/tools.py +471 -0
  85. astro_skill-1.1.1/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aditya
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.
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: astro-skill
3
+ Version: 1.1.1
4
+ Summary: Portable Vedic astrology engine, agent skill, and stdio MCP server (kundali, dasha, panchang, PDF reports)
5
+ Author-email: Aditya Arya <adityarya24@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/adityarya24/astro-skill
8
+ Project-URL: Documentation, https://github.com/adityarya24/astro-skill#readme
9
+ Project-URL: Repository, https://github.com/adityarya24/astro-skill
10
+ Project-URL: Issues, https://github.com/adityarya24/astro-skill/issues
11
+ Project-URL: Changelog, https://github.com/adityarya24/astro-skill/blob/main/CHANGELOG.md
12
+ Keywords: vedic,astrology,kundali,dasha,panchang,mcp,jyotish,swiss-ephemeris
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Religion
20
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.11
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: mcp>=1.27.0
26
+ Requires-Dist: playwright>=1.40
27
+ Requires-Dist: pyswisseph>=2.10.3.2
28
+ Requires-Dist: python-dateutil>=2.9.0
29
+ Requires-Dist: reportlab>=4.5.1
30
+ Requires-Dist: tzdata>=2025.2
31
+ Provides-Extra: dev
32
+ Requires-Dist: build; extra == "dev"
33
+ Requires-Dist: pypdf>=6.12.2; extra == "dev"
34
+ Requires-Dist: pytest>=8.0; extra == "dev"
35
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
36
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
38
+ Requires-Dist: setuptools>=77.0.0; extra == "dev"
39
+ Requires-Dist: twine; extra == "dev"
40
+ Requires-Dist: wheel; extra == "dev"
41
+ Dynamic: license-file
42
+
43
+ # Astro Skill
44
+
45
+ [![CI](https://github.com/adityarya24/astro-skill/actions/workflows/ci.yml/badge.svg)](https://github.com/adityarya24/astro-skill/actions/workflows/ci.yml)
46
+ [![PyPI version](https://img.shields.io/pypi/v/astro-skill.svg)](https://pypi.org/project/astro-skill/)
47
+ [![Python versions](https://img.shields.io/pypi/pyversions/astro-skill.svg)](https://pypi.org/project/astro-skill/)
48
+ [![Astro Skill MCP server score](https://glama.ai/mcp/servers/adityarya24/astro-skill/badges/score.svg)](https://glama.ai/mcp/servers/adityarya24/astro-skill)
49
+
50
+ Portable Vedic astrology engine, agent skill, and MCP server. Deterministic
51
+ kundali, dasha, panchang, and yoga calculations with JSON and Hindi/English PDF
52
+ reports — reusable by any agent or MCP-compatible client.
53
+
54
+ <p align="center">
55
+ <img src="docs/images/sample-cover-hi.png" alt="Hindi PDF report cover" width="330">
56
+ <img src="docs/images/sample-lagna-chart.png" alt="North Indian lagna kundali chart" width="330">
57
+ </p>
58
+ <p align="center">
59
+ <img src="docs/images/sample-dasha-strip.png" alt="Vimshottari dasha timeline" width="670">
60
+ </p>
61
+
62
+ The repo is split so each layer can be reused on its own:
63
+
64
+ - **`astro/`** — the portable skill: calculator scripts, reference data, bundled
65
+ Swiss Ephemeris + Devanagari font, and tests. Drop it into any agent or call
66
+ the scripts directly from Python.
67
+ - **`services/astro_mcp/`** — a generic stdio MCP server exposing the same
68
+ calculations plus SQLite storage as 11 stable tools.
69
+ - **`apps/`** — optional products built on top (e.g. a web panel scaffold).
70
+ - **`docs/`** — architecture, roadmap, deployment, and operations docs.
71
+
72
+ ## Features
73
+
74
+ - **Kundali** — lagna, rashi, nakshatra + pada, nine grahas (with retrograde),
75
+ whole-sign houses, and dosha flags (e.g. Mangalik with classical cancellation
76
+ rules).
77
+ - **Planetary strength flags** — dignity, digbala, vargottama, combustion,
78
+ graha yuddha, functional benefic/malefic per lagna, and a composite
79
+ per-planet strength verdict.
80
+ - **Yogas** — Gajakesari, Budhaditya, Pancha Mahapurusha, Raja, Neechabhanga,
81
+ Vipreet (Harsha/Sarala/Vimala), Kaal Sarp (full/partial), Parivartana
82
+ (maha/khala/dainya), and more — with cancellation checks where classical.
83
+ - **Full 12-house bhava data** — house lords with placement + strength,
84
+ occupants, Parashari aspects received, and bhava karakas, surfaced in the
85
+ report JSON for downstream analysis.
86
+ - **Gochar narrative** — month-by-month (quarterly for long windows) transit
87
+ sampling across the current antardasha window, with true per-date ephemeris
88
+ recomputation.
89
+ - **Remedies data** — per-planet mantra/gemstone/fasting/daan/ritual reference
90
+ (Hindi + English) with prioritization by planetary weakness and running dasha.
91
+ - **Optional LLM synthesis** — provider-pluggable prose layer (executive
92
+ summary, per-house analysis, dasha deep-dive, life-area forecasts, remedies)
93
+ generated strictly from the computed chart JSON; the pipeline degrades
94
+ gracefully to a factual report when no provider is configured.
95
+ - **Navamsa (D9)** divisional chart in both JSON and the PDF report.
96
+ - **Vimshottari dasha** — mahadasha + antardasha timeline with correct
97
+ birth-balance handling (the sub-period actually running at birth, not a fresh
98
+ lord/lord cycle).
99
+ - **Daily Panchang** — tithi, vara, nakshatra, yoga, karana, sunrise/sunset —
100
+ anchored at sunrise (classical convention), with muhurta and yoga detection.
101
+ - **Lahiri (Chitrapaksha) sidereal** positions, whole-sign houses.
102
+ - **High precision** — bundled Swiss Ephemeris `.se1` data (SWIEPH) with an
103
+ automatic Moshier fallback; each output records the tier used in
104
+ `calculation.ephemeris`.
105
+ - **Reports** — structured JSON, and PDF via a preferred HTML/Chromium renderer
106
+ (polished Devanagari) or a legacy in-process ReportLab fallback. Hindi/English,
107
+ with a bundled Noto Sans Devanagari font. The HTML renderer also supports a
108
+ `pandit_v1` premium template for pitch-ready operator reports.
109
+ - **MCP server** — 11 tools over stdio, with SQLite-backed client/report storage,
110
+ input validation, and traversal-safe report filenames.
111
+
112
+ ## Install (PyPI)
113
+
114
+ ```bash
115
+ pip install astro-skill
116
+
117
+ # Optional: Chromium for the preferred HTML PDF renderer
118
+ python -m playwright install chromium
119
+
120
+ # Run the stdio MCP server
121
+ astro-mcp
122
+ # or: python -m services.astro_mcp
123
+ ```
124
+
125
+ Requires Python 3.11+. For development from source, use the editable install below.
126
+
127
+ ## Quick start (from source)
128
+
129
+ ```bash
130
+ git clone https://github.com/adityarya24/astro-skill.git
131
+ cd astro-skill
132
+ python -m venv .venv && . .venv/bin/activate # Windows: .\.venv\Scripts\Activate.ps1
133
+ python -m pip install --upgrade pip
134
+ pip install -e ".[dev]"
135
+
136
+ # Optional: Chromium for the preferred HTML PDF renderer
137
+ python -m playwright install chromium
138
+
139
+ # Checks
140
+ python -m pytest -q
141
+ python -m ruff check astro services scripts
142
+ ```
143
+
144
+ All tests pass; the HTML/Chromium PDF render test skips automatically until
145
+ Chromium is installed. For OS-specific venv details and MCP client config
146
+ examples, see [`docs/operations/install-smoke.md`](docs/operations/install-smoke.md).
147
+
148
+ ## LLM synthesis (optional)
149
+
150
+ The premium report sections can carry LLM-written prose (bilingual hi/en),
151
+ generated strictly from the computed chart JSON — prompts forbid inventing any
152
+ placement, yoga, or date. Configure via environment variables:
153
+
154
+ | Env var | Default | Meaning |
155
+ | --- | --- | --- |
156
+ | `ASTRO_LLM_PROVIDER` | `gemini` | `gemini`, `openai` (OpenAI-compatible), or `cli` |
157
+ | `ASTRO_LLM_API_KEY` | *(empty)* | API key for the chosen provider |
158
+ | `ASTRO_LLM_MODEL` | provider default | Model name |
159
+ | `ASTRO_LLM_CLI_ARGS` | — | For `cli` provider: JSON argv with a `{prompt}` token |
160
+
161
+ With no key configured, every section falls back to a compact factual digest —
162
+ the pipeline never fails because a provider is down. Calls have timeouts and
163
+ log provider failures to stderr.
164
+
165
+ ## MCP server
166
+
167
+ `services/astro_mcp/` is an importable package and a runnable **stdio MCP
168
+ server**. The same `TOOLS` registry powers the unit tests and the wire protocol
169
+ — no duplicated logic, and no environment variables required.
170
+
171
+ Tools (11): `parse_birth_details`, `save_client_profile`, `find_client_profile`,
172
+ `list_client_reports`, `calculate_kundali`, `calculate_dasha`,
173
+ `calculate_gochar`, `calculate_compatibility`, `calculate_panchang`,
174
+ `generate_report_json`, `generate_pdf_report`.
175
+
176
+ ```bash
177
+ python -m services.astro_mcp # or `astro-mcp` after `pip install -e .`
178
+ ```
179
+
180
+ Wire it into any MCP client (Claude Desktop, a Codex agent, or your own) by
181
+ pointing the client's MCP config at that command with `cwd` set to the repo
182
+ root. See [`services/astro_mcp/README.md`](services/astro_mcp/README.md) for the
183
+ tool contract and config examples, and verify an install in one shot with:
184
+
185
+ ```bash
186
+ python scripts/smoke_mcp_client.py
187
+ ```
188
+
189
+ ## Sample commands
190
+
191
+ ```bash
192
+ # Kundali JSON
193
+ python astro/scripts/kundali_calculator.py --dob 26/12/2019 --tob 09:15 \
194
+ --place Delhi --lat 28.6139 --lon 77.2090 --timezone Asia/Kolkata --json
195
+
196
+ # Panchang JSON
197
+ python astro/scripts/panchang_calculator.py --date 2026-05-21 \
198
+ --place Delhi --lat 28.6139 --lon 77.209 --timezone Asia/Kolkata --json
199
+
200
+ # Hindi PDF (default HTML/Chromium renderer; add --renderer reportlab for the
201
+ # no-browser fallback)
202
+ python astro/scripts/pdf_report.py --kundali-json chart.json --dasha-json dasha.json \
203
+ --panchang-json panchang.json --output report.pdf --language hi
204
+
205
+ # Pandit-style report
206
+ python astro/scripts/pdf_report.py --kundali-json chart.json --dasha-json dasha.json \
207
+ --panchang-json panchang.json --output pandit-v1.pdf --language hi \
208
+ --template pandit_v1 --client-name "Client Name"
209
+ ```
210
+
211
+ ## Deployment
212
+
213
+ Run it as a Docker MCP server or straight from Python. The default `Dockerfile`
214
+ builds a slim image (Python, dependencies, Devanagari font, ephemeris data);
215
+ `Dockerfile.full` adds Chromium for the HTML PDF renderer. See
216
+ [`docs/deploy.md`](docs/deploy.md) for build, run, smoke-test, and MCP-client
217
+ wiring instructions.
218
+
219
+ ## Documentation
220
+
221
+ - [`docs/operations/install-smoke.md`](docs/operations/install-smoke.md) — fresh-clone install, MCP client config, smoke checklist.
222
+ - [`docs/deploy.md`](docs/deploy.md) — Docker / MCP-client deployment.
223
+ - [`docs/architecture/generic-astro-platform.md`](docs/architecture/generic-astro-platform.md) — layering and reuse model.
224
+ - [`docs/architecture/astro-skill-roadmap.md`](docs/architecture/astro-skill-roadmap.md) — engine roadmap.
225
+ - [`services/astro_mcp/README.md`](services/astro_mcp/README.md) — MCP server contract.
226
+ - [`astro/SKILL.md`](astro/SKILL.md) — agent skill instructions.
227
+
228
+ ## Production notes
229
+
230
+ - Positions use the bundled high-precision Swiss Ephemeris (SWIEPH) out of the
231
+ box, not the lower-precision Moshier fallback.
232
+ - The default PDF path is HTML/Chromium for production Hindi rendering; ReportLab
233
+ stays as a no-browser fallback.
234
+ - Generated runtime data lives under an ignored `data/` directory (or a
235
+ caller-provided output directory).
236
+ - MCP tools validate their JSON schemas and keep generated filenames detached
237
+ from caller-controlled identifiers.
238
+ - GitHub Actions runs install, Chromium setup, tests, ruff, and skill validation
239
+ on push and pull requests.
240
+
241
+ ## Safety boundaries
242
+
243
+ These rules apply across every layer and downstream product:
244
+
245
+ - Reports are calculation-backed drafts, intended for review by an astrologer or
246
+ operator before any final reading is shared.
247
+ - Missing birth details must be requested rather than guessed.
248
+ - Approximate or partial inputs must be marked clearly in any output.
249
+ - Do not generate death, accident, medical, or unavoidable-harm certainty
250
+ predictions.
251
+
252
+ ## License
253
+
254
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,212 @@
1
+ # Astro Skill
2
+
3
+ [![CI](https://github.com/adityarya24/astro-skill/actions/workflows/ci.yml/badge.svg)](https://github.com/adityarya24/astro-skill/actions/workflows/ci.yml)
4
+ [![PyPI version](https://img.shields.io/pypi/v/astro-skill.svg)](https://pypi.org/project/astro-skill/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/astro-skill.svg)](https://pypi.org/project/astro-skill/)
6
+ [![Astro Skill MCP server score](https://glama.ai/mcp/servers/adityarya24/astro-skill/badges/score.svg)](https://glama.ai/mcp/servers/adityarya24/astro-skill)
7
+
8
+ Portable Vedic astrology engine, agent skill, and MCP server. Deterministic
9
+ kundali, dasha, panchang, and yoga calculations with JSON and Hindi/English PDF
10
+ reports — reusable by any agent or MCP-compatible client.
11
+
12
+ <p align="center">
13
+ <img src="docs/images/sample-cover-hi.png" alt="Hindi PDF report cover" width="330">
14
+ <img src="docs/images/sample-lagna-chart.png" alt="North Indian lagna kundali chart" width="330">
15
+ </p>
16
+ <p align="center">
17
+ <img src="docs/images/sample-dasha-strip.png" alt="Vimshottari dasha timeline" width="670">
18
+ </p>
19
+
20
+ The repo is split so each layer can be reused on its own:
21
+
22
+ - **`astro/`** — the portable skill: calculator scripts, reference data, bundled
23
+ Swiss Ephemeris + Devanagari font, and tests. Drop it into any agent or call
24
+ the scripts directly from Python.
25
+ - **`services/astro_mcp/`** — a generic stdio MCP server exposing the same
26
+ calculations plus SQLite storage as 11 stable tools.
27
+ - **`apps/`** — optional products built on top (e.g. a web panel scaffold).
28
+ - **`docs/`** — architecture, roadmap, deployment, and operations docs.
29
+
30
+ ## Features
31
+
32
+ - **Kundali** — lagna, rashi, nakshatra + pada, nine grahas (with retrograde),
33
+ whole-sign houses, and dosha flags (e.g. Mangalik with classical cancellation
34
+ rules).
35
+ - **Planetary strength flags** — dignity, digbala, vargottama, combustion,
36
+ graha yuddha, functional benefic/malefic per lagna, and a composite
37
+ per-planet strength verdict.
38
+ - **Yogas** — Gajakesari, Budhaditya, Pancha Mahapurusha, Raja, Neechabhanga,
39
+ Vipreet (Harsha/Sarala/Vimala), Kaal Sarp (full/partial), Parivartana
40
+ (maha/khala/dainya), and more — with cancellation checks where classical.
41
+ - **Full 12-house bhava data** — house lords with placement + strength,
42
+ occupants, Parashari aspects received, and bhava karakas, surfaced in the
43
+ report JSON for downstream analysis.
44
+ - **Gochar narrative** — month-by-month (quarterly for long windows) transit
45
+ sampling across the current antardasha window, with true per-date ephemeris
46
+ recomputation.
47
+ - **Remedies data** — per-planet mantra/gemstone/fasting/daan/ritual reference
48
+ (Hindi + English) with prioritization by planetary weakness and running dasha.
49
+ - **Optional LLM synthesis** — provider-pluggable prose layer (executive
50
+ summary, per-house analysis, dasha deep-dive, life-area forecasts, remedies)
51
+ generated strictly from the computed chart JSON; the pipeline degrades
52
+ gracefully to a factual report when no provider is configured.
53
+ - **Navamsa (D9)** divisional chart in both JSON and the PDF report.
54
+ - **Vimshottari dasha** — mahadasha + antardasha timeline with correct
55
+ birth-balance handling (the sub-period actually running at birth, not a fresh
56
+ lord/lord cycle).
57
+ - **Daily Panchang** — tithi, vara, nakshatra, yoga, karana, sunrise/sunset —
58
+ anchored at sunrise (classical convention), with muhurta and yoga detection.
59
+ - **Lahiri (Chitrapaksha) sidereal** positions, whole-sign houses.
60
+ - **High precision** — bundled Swiss Ephemeris `.se1` data (SWIEPH) with an
61
+ automatic Moshier fallback; each output records the tier used in
62
+ `calculation.ephemeris`.
63
+ - **Reports** — structured JSON, and PDF via a preferred HTML/Chromium renderer
64
+ (polished Devanagari) or a legacy in-process ReportLab fallback. Hindi/English,
65
+ with a bundled Noto Sans Devanagari font. The HTML renderer also supports a
66
+ `pandit_v1` premium template for pitch-ready operator reports.
67
+ - **MCP server** — 11 tools over stdio, with SQLite-backed client/report storage,
68
+ input validation, and traversal-safe report filenames.
69
+
70
+ ## Install (PyPI)
71
+
72
+ ```bash
73
+ pip install astro-skill
74
+
75
+ # Optional: Chromium for the preferred HTML PDF renderer
76
+ python -m playwright install chromium
77
+
78
+ # Run the stdio MCP server
79
+ astro-mcp
80
+ # or: python -m services.astro_mcp
81
+ ```
82
+
83
+ Requires Python 3.11+. For development from source, use the editable install below.
84
+
85
+ ## Quick start (from source)
86
+
87
+ ```bash
88
+ git clone https://github.com/adityarya24/astro-skill.git
89
+ cd astro-skill
90
+ python -m venv .venv && . .venv/bin/activate # Windows: .\.venv\Scripts\Activate.ps1
91
+ python -m pip install --upgrade pip
92
+ pip install -e ".[dev]"
93
+
94
+ # Optional: Chromium for the preferred HTML PDF renderer
95
+ python -m playwright install chromium
96
+
97
+ # Checks
98
+ python -m pytest -q
99
+ python -m ruff check astro services scripts
100
+ ```
101
+
102
+ All tests pass; the HTML/Chromium PDF render test skips automatically until
103
+ Chromium is installed. For OS-specific venv details and MCP client config
104
+ examples, see [`docs/operations/install-smoke.md`](docs/operations/install-smoke.md).
105
+
106
+ ## LLM synthesis (optional)
107
+
108
+ The premium report sections can carry LLM-written prose (bilingual hi/en),
109
+ generated strictly from the computed chart JSON — prompts forbid inventing any
110
+ placement, yoga, or date. Configure via environment variables:
111
+
112
+ | Env var | Default | Meaning |
113
+ | --- | --- | --- |
114
+ | `ASTRO_LLM_PROVIDER` | `gemini` | `gemini`, `openai` (OpenAI-compatible), or `cli` |
115
+ | `ASTRO_LLM_API_KEY` | *(empty)* | API key for the chosen provider |
116
+ | `ASTRO_LLM_MODEL` | provider default | Model name |
117
+ | `ASTRO_LLM_CLI_ARGS` | — | For `cli` provider: JSON argv with a `{prompt}` token |
118
+
119
+ With no key configured, every section falls back to a compact factual digest —
120
+ the pipeline never fails because a provider is down. Calls have timeouts and
121
+ log provider failures to stderr.
122
+
123
+ ## MCP server
124
+
125
+ `services/astro_mcp/` is an importable package and a runnable **stdio MCP
126
+ server**. The same `TOOLS` registry powers the unit tests and the wire protocol
127
+ — no duplicated logic, and no environment variables required.
128
+
129
+ Tools (11): `parse_birth_details`, `save_client_profile`, `find_client_profile`,
130
+ `list_client_reports`, `calculate_kundali`, `calculate_dasha`,
131
+ `calculate_gochar`, `calculate_compatibility`, `calculate_panchang`,
132
+ `generate_report_json`, `generate_pdf_report`.
133
+
134
+ ```bash
135
+ python -m services.astro_mcp # or `astro-mcp` after `pip install -e .`
136
+ ```
137
+
138
+ Wire it into any MCP client (Claude Desktop, a Codex agent, or your own) by
139
+ pointing the client's MCP config at that command with `cwd` set to the repo
140
+ root. See [`services/astro_mcp/README.md`](services/astro_mcp/README.md) for the
141
+ tool contract and config examples, and verify an install in one shot with:
142
+
143
+ ```bash
144
+ python scripts/smoke_mcp_client.py
145
+ ```
146
+
147
+ ## Sample commands
148
+
149
+ ```bash
150
+ # Kundali JSON
151
+ python astro/scripts/kundali_calculator.py --dob 26/12/2019 --tob 09:15 \
152
+ --place Delhi --lat 28.6139 --lon 77.2090 --timezone Asia/Kolkata --json
153
+
154
+ # Panchang JSON
155
+ python astro/scripts/panchang_calculator.py --date 2026-05-21 \
156
+ --place Delhi --lat 28.6139 --lon 77.209 --timezone Asia/Kolkata --json
157
+
158
+ # Hindi PDF (default HTML/Chromium renderer; add --renderer reportlab for the
159
+ # no-browser fallback)
160
+ python astro/scripts/pdf_report.py --kundali-json chart.json --dasha-json dasha.json \
161
+ --panchang-json panchang.json --output report.pdf --language hi
162
+
163
+ # Pandit-style report
164
+ python astro/scripts/pdf_report.py --kundali-json chart.json --dasha-json dasha.json \
165
+ --panchang-json panchang.json --output pandit-v1.pdf --language hi \
166
+ --template pandit_v1 --client-name "Client Name"
167
+ ```
168
+
169
+ ## Deployment
170
+
171
+ Run it as a Docker MCP server or straight from Python. The default `Dockerfile`
172
+ builds a slim image (Python, dependencies, Devanagari font, ephemeris data);
173
+ `Dockerfile.full` adds Chromium for the HTML PDF renderer. See
174
+ [`docs/deploy.md`](docs/deploy.md) for build, run, smoke-test, and MCP-client
175
+ wiring instructions.
176
+
177
+ ## Documentation
178
+
179
+ - [`docs/operations/install-smoke.md`](docs/operations/install-smoke.md) — fresh-clone install, MCP client config, smoke checklist.
180
+ - [`docs/deploy.md`](docs/deploy.md) — Docker / MCP-client deployment.
181
+ - [`docs/architecture/generic-astro-platform.md`](docs/architecture/generic-astro-platform.md) — layering and reuse model.
182
+ - [`docs/architecture/astro-skill-roadmap.md`](docs/architecture/astro-skill-roadmap.md) — engine roadmap.
183
+ - [`services/astro_mcp/README.md`](services/astro_mcp/README.md) — MCP server contract.
184
+ - [`astro/SKILL.md`](astro/SKILL.md) — agent skill instructions.
185
+
186
+ ## Production notes
187
+
188
+ - Positions use the bundled high-precision Swiss Ephemeris (SWIEPH) out of the
189
+ box, not the lower-precision Moshier fallback.
190
+ - The default PDF path is HTML/Chromium for production Hindi rendering; ReportLab
191
+ stays as a no-browser fallback.
192
+ - Generated runtime data lives under an ignored `data/` directory (or a
193
+ caller-provided output directory).
194
+ - MCP tools validate their JSON schemas and keep generated filenames detached
195
+ from caller-controlled identifiers.
196
+ - GitHub Actions runs install, Chromium setup, tests, ruff, and skill validation
197
+ on push and pull requests.
198
+
199
+ ## Safety boundaries
200
+
201
+ These rules apply across every layer and downstream product:
202
+
203
+ - Reports are calculation-backed drafts, intended for review by an astrologer or
204
+ operator before any final reading is shared.
205
+ - Missing birth details must be requested rather than guessed.
206
+ - Approximate or partial inputs must be marked clearly in any output.
207
+ - Do not generate death, accident, medical, or unavoidable-harm certainty
208
+ predictions.
209
+
210
+ ## License
211
+
212
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: astro
3
+ description: Vedic astrology calculation skill for kundali, dasha, panchang, gochar transits, guna milan, structured report JSON, and Hindi PDF reports. Use when an agent needs deterministic astrology from birth details, date, time, and location.
4
+ ---
5
+
6
+ # Astro Skill
7
+
8
+ Use this skill to calculate and explain Vedic astrology outputs. Keep responses practical, respectful, and grounded in computed data. Do not predict death, accidents, medical diagnoses, or unavoidable harm.
9
+
10
+ ## Defaults
11
+
12
+ - Ayanamsa: Lahiri Chitrapaksha.
13
+ - House system: whole sign.
14
+ - Default language: Hinglish (`hin`), with Hindi (`hi`) and English (`en`) supported by callers.
15
+ - Default location for non-birth daily work: Delhi, India.
16
+
17
+ ## Required Inputs
18
+
19
+ - Kundali: date of birth, time of birth, place, latitude, longitude, timezone.
20
+ - Dasha: kundali output from `kundali_calculator.py`.
21
+ - Panchang: local date, place, latitude, longitude, timezone.
22
+ - Basic report: kundali JSON, with optional dasha JSON and panchang JSON.
23
+ - PDF report: kundali JSON plus optional dasha and panchang JSON; dasha is recommended for the timeline chart.
24
+ - Gochar (transits): kundali JSON plus a local calendar date (and optional place for location-sensitive work).
25
+ - Guna Milan: two complete kundali JSON files (both people need full birth details).
26
+ - Muhurta and other advanced modules may require purpose plus date range when implemented.
27
+
28
+ ## Phase 1 Workflow
29
+
30
+ 1. Run `scripts/kundali_calculator.py` with birth details and `--json`.
31
+ 2. Inspect `lagna`, `rashi`, `nakshatra`, `nakshatra_pada`, `planets`, `houses`, and `dasha_seed`.
32
+ 3. Run `scripts/dasha_calculator.py --kundali-json <path> --json` when dasha timing is needed.
33
+ 4. Explain the output in the user's preferred language/tone. Mention calculations and practical meaning; avoid mystical filler.
34
+
35
+ ## Phase 2 Workflow
36
+
37
+ 1. Run `scripts/panchang_calculator.py` with local date, place, latitude, longitude, timezone, and `--json`.
38
+ 2. Inspect `vara`, `tithi`, `paksha`, `nakshatra`, `yoga`, `karana`, `sunrise`, and `sunset`.
39
+ 3. Use the Panchang output as calculation data for daily guidance or later muhurta work. Do not convert it into muhurta recommendations unless a muhurta module is available.
40
+ 4. If sunrise or sunset is `null`, check the `warnings` array and explain that the rest of the Panchang fields still came from computed solar/lunar positions.
41
+
42
+ ## Tier 2 Workflow (Gochar & Guna Milan)
43
+
44
+ Use these after Phase 1 kundali JSON exists. Outputs are calculation-backed; keep interpretation conservative and avoid certainty claims.
45
+
46
+ ### Gochar (transit snapshot)
47
+
48
+ 1. Run `scripts/kundali_calculator.py` for the native chart and save `--json` output.
49
+ 2. Run `scripts/gochar_calculator.py --kundali-json <chart.json> --date YYYY-MM-DD --json`.
50
+ 3. Explain which grahas are transiting which rashis/houses relative to the natal lagna. Mention retrograde flags when present.
51
+ 4. Do not treat gochar as fate prediction; frame as timing context for operator review.
52
+
53
+ ### Guna Milan (Ashtakoot compatibility score)
54
+
55
+ 1. Build kundali JSON for person A and person B (full DOB, TOB, place, lat, lon, timezone).
56
+ 2. Run `scripts/guna_milan.py --kundali-a-json <a.json> --kundali-b-json <b.json> --json`.
57
+ 3. Present the scored breakdown (guna table, total, dosha flags) from JSON only.
58
+ 4. Compatibility scores are heuristic drafts, not relationship verdicts. An astrologer remains the final authority.
59
+
60
+ ## Phase 3 Workflow
61
+
62
+ 1. Generate or load kundali JSON. Optionally generate dasha JSON and daily panchang JSON.
63
+ 2. Run `scripts/report_generator.py --kundali-json <chart.json> --dasha-json <dasha.json> --panchang-json <panchang.json> --json`.
64
+ 3. Use the structured report as an astrologer/operator draft: birth chart facts, current dasha, daily Panchang, and safety notes.
65
+ 4. Keep interpretation clearly separated from calculation. The reviewing astrologer or operator remains the final authority.
66
+
67
+ ## Phase 4 Workflow
68
+
69
+ 1. Generate or load kundali JSON. Generate dasha JSON when the PDF should include a dasha timeline chart.
70
+ 2. Run `scripts/pdf_report.py --kundali-json <chart.json> --dasha-json <dasha.json> --panchang-json <panchang.json> --output output/pdf/<name>.pdf --renderer html`.
71
+ The default `--renderer html` uses Chromium via Playwright and is the
72
+ preferred path for Hindi/Devanagari polish. Use `--renderer reportlab` to
73
+ fall back to the legacy in-process renderer (lower-quality maatra
74
+ shaping, but no browser dependency).
75
+ 3. Install the browser once with `python -m playwright install chromium` if
76
+ the HTML renderer reports it is missing.
77
+ 4. Check the PDF text or rendered pages before sharing. The PDF includes a planet/house chart, planet table, dasha timeline, Panchang section, and safety notes when those inputs are present.
78
+ 5. Keep PDF content calculation-first. Treat it as a formatted working draft for astrologer/operator review.
79
+
80
+ ## Command Examples
81
+
82
+ ```bash
83
+ python scripts/kundali_calculator.py --dob 26/12/2019 --tob 09:15 --place Delhi --lat 28.6139 --lon 77.2090 --timezone Asia/Kolkata --json
84
+ python scripts/dasha_calculator.py --kundali-json chart.json --json
85
+ python scripts/gochar_calculator.py --kundali-json chart.json --date 2026-07-01 --json
86
+ python scripts/guna_milan.py --kundali-a-json bride.json --kundali-b-json groom.json --json
87
+ python scripts/panchang_calculator.py --date 2026-05-21 --place Delhi --lat 28.6139 --lon 77.209 --timezone Asia/Kolkata --json
88
+ python scripts/report_generator.py --kundali-json chart.json --dasha-json dasha.json --panchang-json panchang.json --json
89
+ python scripts/pdf_report.py --kundali-json chart.json --dasha-json dasha.json --panchang-json panchang.json --output output/pdf/report.pdf
90
+ ```
91
+
92
+ ## Dependency Handling
93
+
94
+ The calculator requires `pyswisseph` for Swiss Ephemeris. If it is missing, install the project dependencies or install `pyswisseph` directly. Do not silently approximate kundali positions without an ephemeris.
95
+
96
+ PDF generation supports two renderers:
97
+
98
+ - `html` (default, preferred) — uses `playwright` + a Chromium binary for
99
+ print-CSS-styled output with proper Devanagari shaping. Install the
100
+ browser once with `python -m playwright install chromium`. If Chromium is
101
+ missing the renderer raises a clear `RuntimeError` with the install
102
+ command.
103
+ - `reportlab` (fallback) — uses `reportlab` in-process. No browser needed,
104
+ but Devanagari maatras are not perfectly shaped.
105
+
106
+ PDF test extraction uses `pypdf` in the development environment.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Astro"
3
+ short_description: "Calculate Vedic kundali and Vimshottari dasha."
4
+ default_prompt: "Calculate a Vedic astrology chart from birth details."
@@ -0,0 +1,12 @@
1
+ {
2
+ "ayanamsa": "lahiri",
3
+ "house_system": "whole_sign",
4
+ "default_timezone": "Asia/Kolkata",
5
+ "default_location": "Delhi",
6
+ "default_lat": 28.6139,
7
+ "default_lon": 77.209,
8
+ "default_geoname_id": "1273294",
9
+ "language": "hin",
10
+ "report_format": "markdown",
11
+ "dasha_system": "vimshottari"
12
+ }