Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .claude/commands/openspec/apply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: OpenSpec: Apply
description: Implement an approved OpenSpec change and keep tasks in sync.
category: OpenSpec
tags: [openspec, apply]
---
<!-- OPENSPEC:START -->
**Guardrails**
- Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
- Keep changes tightly scoped to the requested outcome.
- Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications.

**Steps**
Track these steps as TODOs and complete them one by one.
1. Read `changes/<id>/proposal.md`, `design.md` (if present), and `tasks.md` to confirm scope and acceptance criteria.
2. Work through tasks sequentially, keeping edits minimal and focused on the requested change.
3. Confirm completion before updating statuses—make sure every item in `tasks.md` is finished.
4. Update the checklist after all work is done so each task is marked `- [x]` and reflects reality.
5. Reference `openspec list` or `openspec show <item>` when additional context is required.

**Reference**
- Use `openspec show <id> --json --deltas-only` if you need additional context from the proposal while implementing.
<!-- OPENSPEC:END -->
27 changes: 27 additions & 0 deletions .claude/commands/openspec/archive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: OpenSpec: Archive
description: Archive a deployed OpenSpec change and update specs.
category: OpenSpec
tags: [openspec, archive]
---
<!-- OPENSPEC:START -->
**Guardrails**
- Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
- Keep changes tightly scoped to the requested outcome.
- Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications.

**Steps**
1. Determine the change ID to archive:
- If this prompt already includes a specific change ID (for example inside a `<ChangeId>` block populated by slash-command arguments), use that value after trimming whitespace.
- If the conversation references a change loosely (for example by title or summary), run `openspec list` to surface likely IDs, share the relevant candidates, and confirm which one the user intends.
- Otherwise, review the conversation, run `openspec list`, and ask the user which change to archive; wait for a confirmed change ID before proceeding.
- If you still cannot identify a single change ID, stop and tell the user you cannot archive anything yet.
2. Validate the change ID by running `openspec list` (or `openspec show <id>`) and stop if the change is missing, already archived, or otherwise not ready to archive.
3. Run `openspec archive <id> --yes` so the CLI moves the change and applies spec updates without prompts (use `--skip-specs` only for tooling-only work).
4. Review the command output to confirm the target specs were updated and the change landed in `changes/archive/`.
5. Validate with `openspec validate --strict` and inspect with `openspec show <id>` if anything looks off.

**Reference**
- Use `openspec list` to confirm change IDs before archiving.
- Inspect refreshed specs with `openspec list --specs` and address any validation issues before handing off.
<!-- OPENSPEC:END -->
28 changes: 28 additions & 0 deletions .claude/commands/openspec/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: OpenSpec: Proposal
description: Scaffold a new OpenSpec change and validate strictly.
category: OpenSpec
tags: [openspec, change]
---
<!-- OPENSPEC:START -->
**Guardrails**
- Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
- Keep changes tightly scoped to the requested outcome.
- Refer to `openspec/AGENTS.md` (located inside the `openspec/` directory—run `ls openspec` or `openspec update` if you don't see it) if you need additional OpenSpec conventions or clarifications.
- Identify any vague or ambiguous details and ask the necessary follow-up questions before editing files.
- Do not write any code during the proposal stage. Only create design documents (proposal.md, tasks.md, design.md, and spec deltas). Implementation happens in the apply stage after approval.

**Steps**
1. Review `openspec/project.md`, run `openspec list` and `openspec list --specs`, and inspect related code or docs (e.g., via `rg`/`ls`) to ground the proposal in current behaviour; note any gaps that require clarification.
2. Choose a unique verb-led `change-id` and scaffold `proposal.md`, `tasks.md`, and `design.md` (when needed) under `openspec/changes/<id>/`.
3. Map the change into concrete capabilities or requirements, breaking multi-scope efforts into distinct spec deltas with clear relationships and sequencing.
4. Capture architectural reasoning in `design.md` when the solution spans multiple systems, introduces new patterns, or demands trade-off discussion before committing to specs.
5. Draft spec deltas in `changes/<id>/specs/<capability>/spec.md` (one folder per capability) using `## ADDED|MODIFIED|REMOVED Requirements` with at least one `#### Scenario:` per requirement and cross-reference related capabilities when relevant.
6. Draft `tasks.md` as an ordered list of small, verifiable work items that deliver user-visible progress, include validation (tests, tooling), and highlight dependencies or parallelizable work.
7. Validate with `openspec validate <id> --strict` and resolve every issue before sharing the proposal.

**Reference**
- Use `openspec show <id> --json --deltas-only` or `openspec show <spec> --type spec` to inspect details when validation fails.
- Search existing requirements with `rg -n "Requirement:|Scenario:" openspec/specs` before writing new ones.
- Explore the codebase with `rg <keyword>`, `ls`, or direct file reads so proposals align with current implementation realities.
<!-- OPENSPEC:END -->
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ test/results/

.venv/
test/

# Openspec
openspec
AGENTS.md
CLAUDE.md
106 changes: 64 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ claude mcp add mingpan -- npx -y mingpan

> 请帮我排一个八字命盘,1992年4月12日7点30分,男性

> 请帮我起一个奇门遁甲时盘,2024年6月21日10点

## 工具列表

### 命理排盘
Expand All @@ -52,33 +54,33 @@ claude mcp add mingpan -- npx -y mingpan

#### 八字命理

| 工具 | 说明 |
|------|------|
| `bazi_basic` | 八字命盘排盘(四柱、藏干、十神、五行力量) |
| `bazi_dayun` | 大运列表(十年一运) |
| `bazi_liunian` | 流年列表(指定年份范围) |
| `bazi_liuyue` | 流月列表(节气月,立春起算) |
| `bazi_liuri` | 流日列表(指定月份内每日) |
| 工具 | 说明 |
| -------------- | ------------------------------------------ |
| `bazi_basic` | 八字命盘排盘(四柱、藏干、十神、五行力量) |
| `bazi_dayun` | 大运列表(十年一运) |
| `bazi_liunian` | 流年列表(指定年份范围) |
| `bazi_liuyue` | 流月列表(节气月,立春起算) |
| `bazi_liuri` | 流日列表(指定月份内每日) |

#### 紫微斗数

| 工具 | 说明 |
|------|------|
| `ziwei_basic` | 紫微命盘排盘(十二宫、主星、辅星、四化) |
| `ziwei_daxian` | 大限列表(十年一限) |
| `ziwei_xiaoxian` | 小限列表(每年一宫) |
| `ziwei_liunian` | 流年列表(指定年份范围) |
| `ziwei_liuyue` | 流月列表(农历月) |
| `ziwei_liuri` | 流日列表(农历日) |
| 工具 | 说明 |
| ---------------- | ---------------------------------------- |
| `ziwei_basic` | 紫微命盘排盘(十二宫、主星、辅星、四化) |
| `ziwei_daxian` | 大限列表(十年一限) |
| `ziwei_xiaoxian` | 小限列表(每年一宫) |
| `ziwei_liunian` | 流年列表(指定年份范围) |
| `ziwei_liuyue` | 流月列表(农历月) |
| `ziwei_liuri` | 流日列表(农历日) |

### 占卜起卦

占卜术基于起卦时间或随机数推演卦象,属于「卜」的范畴。

#### 六爻

| 工具 | 说明 |
|------|------|
| 工具 | 说明 |
| -------------- | --------------------------------------------------- |
| `liuyao_basic` | 六爻排盘(本卦/变卦、纳甲、六亲、六神、世应、旬空) |

六爻输入为六个爻值(自下而上):
Expand All @@ -89,8 +91,8 @@ claude mcp add mingpan -- npx -y mingpan

#### 梅花易数

| 工具 | 说明 |
|------|------|
| 工具 | 说明 |
| -------------- | ---------------------------------------- |
| `meihua_basic` | 梅花易数排盘(本卦/变卦/互卦、体用分析) |

支持两种起卦方式:
Expand All @@ -99,37 +101,57 @@ claude mcp add mingpan -- npx -y mingpan

#### 大六壬

| 工具 | 说明 |
|------|------|
| 工具 | 说明 |
| ---------------- | ------------------------------------------------ |
| `daliuren_basic` | 大六壬排盘(天地盘、四课、三传、十二天将、神煞) |

大六壬为三式之首,需输入节气、农历月、日干支、时干支。

#### 奇门遁甲

| 工具 | 说明 |
| ------------- | ---------------------------------------------------------- |
| `qimen_basic` | 奇门遁甲排盘(九宫布局、三奇六仪、八门九星八神、格局判断) |

奇门遁甲为三式之一,支持时盘和日盘两种盘式,支持拆补法和茅山法两种置闰算法。

## 输入参数

### 命理工具(八字/紫微)

| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| year | number | ✓ | 出生年份(1900-2100) |
| month | number | ✓ | 出生月份(1-12) |
| day | number | ✓ | 出生日期(1-31) |
| hour | number | ✓ | 出生时辰(0-23) |
| minute | number | | 出生分钟(0-59),默认 0 |
| gender | string | ✓ | `male` / `female` |
| longitude | number | | 出生地经度,用于真太阳时校正 |
| isLunar | boolean | | 是否为农历输入,默认 false |
| 参数 | 类型 | 必填 | 说明 |
| --------- | ------- | ---- | ---------------------------- |
| year | number | ✓ | 出生年份(1900-2100) |
| month | number | ✓ | 出生月份(1-12) |
| day | number | ✓ | 出生日期(1-31) |
| hour | number | ✓ | 出生时辰(0-23) |
| minute | number | | 出生分钟(0-59),默认 0 |
| gender | string | ✓ | `male` / `female` |
| longitude | number | | 出生地经度,用于真太阳时校正 |
| isLunar | boolean | | 是否为农历输入,默认 false |

### 占卜工具(六爻/梅花/大六壬)

占卜工具使用起卦时间而非出生时间,具体参数请参考各工具说明。

### 奇门遁甲工具

| 参数 | 类型 | 必填 | 说明 |
| ------------ | ------- | ---- | ------------------------------------------------------ |
| year | number | ✓ | 起盘年份(1900-2100) |
| month | number | ✓ | 起盘月份(1-12) |
| day | number | ✓ | 起盘日期(1-31) |
| hour | number | ✓ | 起盘时辰(0-23) |
| isLunar | boolean | | 是否为农历输入,默认 false |
| panType | string | | `时盘` / `日盘`,默认 `时盘` |
| zhiRunMethod | string | | `chaibu`(拆补法)/ `maoshan`(茅山法),默认 `chaibu` |

## 月份基准说明

| 系统 | 月份基准 | 日期基准 |
|------|----------|----------|
| 八字 | 节气月(立春起算) | 公历日 |
| 紫微 | 农历月(初一起算) | 农历日 |
| 系统 | 月份基准 | 日期基准 |
| ---- | ------------------ | -------- |
| 八字 | 节气月(立春起算) | 公历日 |
| 紫微 | 农历月(初一起算) | 农历日 |

## 开发

Expand All @@ -143,12 +165,12 @@ npm run dev # 监听变化

## 依赖

| 库 | 用途 |
|------|------|
| `@modelcontextprotocol/sdk` | MCP 协议实现 |
| `lunar-javascript` | 农历/公历转换 |
| `iztro` | 紫微斗数计算引擎 |
| `zod` | 输入参数校验 |
| 库 | 用途 |
| --------------------------- | ---------------- |
| `@modelcontextprotocol/sdk` | MCP 协议实现 |
| `lunar-javascript` | 农历/公历转换 |
| `iztro` | 紫微斗数计算引擎 |
| `zod` | 输入参数校验 |

## 路线图

Expand All @@ -157,7 +179,7 @@ npm run dev # 监听变化
- [x] 六爻排盘
- [x] 梅花易数排盘
- [x] 大六壬排盘
- [ ] 奇门遁甲
- [x] 奇门遁甲排盘

## 许可证

Expand Down
Loading