Move Nexa contract checker to standalone skill

This commit is contained in:
zfusx
2026-06-03 22:30:35 +08:00
parent cd10c418cf
commit 073d099c3b
6 changed files with 5 additions and 515 deletions
+1 -64
View File
@@ -10,8 +10,6 @@ The skill is simplified-Chinese-first:
The source PDF is not included in this repository.
This repository also includes a Nexa BaZi contract checker for programmers. It catches mixed API fields, JSON schema names, prompt variables, and module keys such as `Day_Master`, `DayMaster_Stem`, `Dominant_Deity`, and `Primary_Favorite_Element`.
## Install
Clone the repository and copy it into Codex skills:
@@ -46,13 +44,7 @@ Use $bazi-translation to translate these terms into approved English and code na
Use $bazi-translation to review API field names in packages/bazi.
```
For Nexa:
```text
Use $bazi-translation to review Nexa BaZi API fields, prompt variables, and module keys in nexa_bazi-main.
```
## Use The Generic Checker
## Use The Checker
Run the local checker against files or directories:
@@ -80,47 +72,6 @@ src/chart.ts:42: dayOwner -> dayMaster
line: const dayOwner = chart.dayOwner;
```
## Use The Nexa Contract Checker
Run the Nexa-specific checker against code, JSON, prompt files, or docs:
```bash
python ~/.codex/skills/bazi-translation/scripts/check_nexa_bazi_contract.py <path>
```
Migration planning mode:
```bash
python ~/.codex/skills/bazi-translation/scripts/check_nexa_bazi_contract.py <path> --no-fail
```
CI-style blocking mode, reporting only hard errors:
```bash
python ~/.codex/skills/bazi-translation/scripts/check_nexa_bazi_contract.py <path> --min-severity error
```
List loaded Nexa rules:
```bash
python ~/.codex/skills/bazi-translation/scripts/check_nexa_bazi_contract.py --list-rules
```
Example output:
```text
5 八字详解/5.7 命理符号/2.命理符号-算法与判定规则.md:14: DayMaster_Stem -> day_master_stem [error]
concept: 日主天干
reason: mixed case 不适合接口契约
line: DayMaster_Stem: "辛"
```
Severity handling:
- `error`: do not add in new code; rename or add a compatibility migration.
- `warn`: likely wrong for new BaZi fields; check whether it is already published.
- `review`: not automatically unsafe, but it may show cross-system leakage or a published key that needs migration planning.
## Core Naming Rules
- Use `dayMaster`, not `dayOwner` or `dayLord`.
@@ -130,24 +81,10 @@ Severity handling:
- Use `usefulGod`, not `useGod`.
- Use `favorableElement` in code by default; keep `Favourable Element` for book-style display text.
- Keep `Useful God` separate from `Favourable Element`.
- For Nexa JSON/API/prompt fields, use `snake_case`: `day_master`, `day_master_stem`, `dominant_ten_god`, `primary_favorite_element`.
- Do not use `deity` for Ten Gods in interfaces. Use `ten_god`.
- Do not use astrology terms such as `astral_event` for BaZi branch relationships or daily BaZi events.
## Nexa Contract Files
- `references/nexa-bazi-contract.md`: canonical Nexa BaZi API/JSON/prompt naming contract.
- `references/nexa-naming-rules.md`: practical naming rules and migration guidance.
- `references/nexa-forbidden-names.md`: deterministic bad-name table used by the checker.
## Files
- `SKILL.md`: Codex skill trigger and workflow.
- `references/terms.md`: simplified-Chinese-first dictionary.
- `references/naming-rules.md`: review rules and anti-patterns.
- `references/nexa-bazi-contract.md`: Nexa BaZi interface and prompt-variable naming contract.
- `references/nexa-naming-rules.md`: Nexa-specific naming guidance.
- `references/nexa-forbidden-names.md`: Nexa forbidden/legacy name table.
- `references/pending-terms.md`: staging area for terms needing domain review.
- `scripts/check_bazi_names.py`: source-code naming checker.
- `scripts/check_nexa_bazi_contract.py`: Nexa BaZi API/JSON/prompt naming checker.