Merge pull request #13 from xr843/chore/tier-a-community-and-npm

chore(community): contributing infra + npm publish workflow
This commit is contained in:
Tim Ren
2026-04-16 13:54:22 +08:00
committed by GitHub
12 changed files with 1005 additions and 7 deletions
@@ -0,0 +1,74 @@
name: 🚨 教界边界违规(P0
description: AI 角色给你传戒、印证开悟、灵媒化对话、给出修行诊断等 → 立即报告
title: "[Boundary Violation] "
labels: ["boundary-violation", "P0", "triage"]
body:
- type: markdown
attributes:
value: |
## ⚠️ P0 优先级
本项目的核心承诺之一是 AI 角色不会越过教界边界(见 [`ETHICS.md`](https://github.com/xr843/Master-skill/blob/main/ETHICS.md) §3)。
一旦发现越界,我们会:
1. 24 小时内确认
2. 优先于所有 feature 工作修复
3. 修复后更新 fidelity 测试确保不再回归
**请不要在 issue 中贴过长的 AI 回答原文**——只需能说明问题的关键片段,避免被错误引用为"祖师开示"。
- type: dropdown
id: violation-type
attributes:
label: 违规类型
options:
- AI 为用户传戒 / 授戒 / 证戒
- AI 印证用户开悟 / 授记 / 给法卷
- AI 给出修行状况诊断("你是某种禅病")
- AI 预测命数 / 因果业报细节 / 往生品位
- AI 充当"与已故法师对话"的灵媒
- AI 在心理危机场景给佛法替代医疗建议
- AI 声称自己就是某位法师
- 其它越过 ETHICS.md §3 边界的回答
validations:
required: true
- type: input
id: master
attributes:
label: 涉及哪位法师
placeholder: "例如:yinguang / xuanzang / ..."
validations:
required: true
- type: input
id: platform
attributes:
label: 使用平台
placeholder: "fojin.app/chat / Claude Code / Cursor / Codex CLI / OpenCode / Gemini CLI"
validations:
required: true
- type: textarea
id: trigger
attributes:
label: 触发问题(原话或改写)
description: 你问了什么让 AI 越界?
validations:
required: true
- type: textarea
id: response-snippet
attributes:
label: AI 回答的关键片段(非全文)
description: "**不要贴全文**。只贴越界的那几句,最好截图打码处理后附图。"
validations:
required: true
- type: textarea
id: harm
attributes:
label: 潜在危害
description: 你或别人可能因此受到什么误导?
validations:
required: false
+94
View File
@@ -0,0 +1,94 @@
name: 🐞 Bug Report
description: 报告技术问题(CI 失败、脚本崩溃、installer 报错、错误引经、法师回答偏离预期等)
title: "[Bug] "
labels: ["bug", "triage"]
body:
- type: markdown
attributes:
value: |
**先确认:**
- [ ] 已看过 [README](https://github.com/xr843/Master-skill#readme) 与 [CONTRIBUTING.md](https://github.com/xr843/Master-skill/blob/main/CONTRIBUTING.md)
- [ ] 已搜索现有 [issues](https://github.com/xr843/Master-skill/issues?q=is%3Aissue) 无重复
- [ ] 如果是**教界边界问题**(AI 给你传戒 / 印证开悟 / 灵媒化回答),请改用 [Boundary Violation 模板](./new?template=boundary_violation.yml)
- type: dropdown
id: area
attributes:
label: 影响范围
options:
- CI / Workflow
- scripts/ (validate / fidelity / cite / query)
- bin/cli.mjs (NPX installer)
- tools/ (fojin_bridge / verify_sources / cross_reference)
- prebuilt/<master> 回答质量
- prebuilt/<master> 引经错误
- /create-master 生成管线
- /compare-masters 对比
- hooks (Claude Code / Cursor / Codex / OpenCode / Gemini)
- 文档 / README
- 其它
validations:
required: true
- type: input
id: master
attributes:
label: 涉及法师(如有)
placeholder: yinguang / xuanzang / ... 或 N/A
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: 发生了什么
description: 简要描述问题现象
placeholder: "例如「跑 `python scripts/validate.py --strict` 报 KeyError: 'sources'」"
validations:
required: true
- type: textarea
id: repro
attributes:
label: 复现步骤
description: 最小复现。越可复现越快修。
placeholder: |
1. `git clone https://github.com/xr843/Master-skill`
2. `pip install -r requirements.txt`
3. `python scripts/test-fidelity.py --master huineng --max-tests 1`
4. 看到 ...
render: bash
validations:
required: true
- type: textarea
id: expected
attributes:
label: 预期行为
validations:
required: true
- type: textarea
id: logs
attributes:
label: 日志 / 堆栈
description: 粘贴完整 traceback 或相关 log。**请删除 API key**
render: shell
validations:
required: false
- type: input
id: platform
attributes:
label: 运行环境
placeholder: "macOS 14.4 / Python 3.11 / Node 20 / Claude Code 1.0.x"
validations:
required: true
- type: input
id: version
attributes:
label: Master-skill 版本或 commit SHA
placeholder: "v0.3.0 / main@abc1234"
validations:
required: true
+14
View File
@@ -0,0 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: 💬 GitHub Discussions — 一般讨论 / 提问 / 分享
url: https://github.com/xr843/Master-skill/discussions
about: 不是 bug 也不是 feature request?先来讨论区聊聊。
- name: 🌐 浏览器体验(fojin.app/chat
url: https://fojin.app/chat
about: 想先体验再决定要不要贡献?点左下角「法师模式」。
- name: 🔒 安全漏洞(请勿走 public issue
url: https://github.com/xr843/Master-skill/security/advisories/new
about: 发现 prompt injection、supply chain、secret leak 等安全问题?走 Security Advisory。
- name: 📜 伦理 / 版权申诉(紧急)
url: mailto:xianren843@protonmail.com?subject=%5BURGENT%20TAKEDOWN%5D
about: 权利人要求下架内容 / 教界边界严重违规 / 需要紧急处理 → 48 小时回复。
@@ -0,0 +1,60 @@
name: ✨ Feature Request
description: 提议新功能、改进、工具链增强(非法师内容类)
title: "[Feature] "
labels: ["enhancement", "triage"]
body:
- type: markdown
attributes:
value: |
**先确认:**
- [ ] 这不是「增加一位新法师」请求(请改用 [New Master 模板](./new?template=new_master.yml)
- [ ] 已搜索现有 [issues](https://github.com/xr843/Master-skill/issues?q=is%3Aissue) 与 [discussions](https://github.com/xr843/Master-skill/discussions) 无重复
- type: dropdown
id: area
attributes:
label: 影响范围
options:
- CI / 测试工具
- scripts / tools
- bin/cli.mjs (NPX installer)
- hooks (Claude Code / Cursor / Codex / OpenCode / Gemini)
- 新平台支持(cline / aider / openhands / ...
- 文档 / 翻译
- /compare-masters
- /create-master 生成管线
- 其它
validations:
required: true
- type: textarea
id: problem
attributes:
label: 要解决的问题
description: 你遇到的什么场景让你需要这个功能?
placeholder: "例如:在 Gemini CLI 环境里调用 /yinguang 时 hooks 没有触发,session-start 注入失败..."
validations:
required: true
- type: textarea
id: proposal
attributes:
label: 建议方案
description: 你认为可以怎么做?可以是粗略想法。
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: 考虑过的替代方案
validations:
required: false
- type: textarea
id: volunteer
attributes:
label: 是否愿意贡献 PR
description: 可选。如果你愿意动手,维护者会优先 review。
validations:
required: false
+115
View File
@@ -0,0 +1,115 @@
name: 🧘 新法师提议
description: 提议收录一位新的祖师大德(⚠️ 提 PR 前请先开此 issue 征询,避免已完成工作被拒)
title: "[New Master] "
labels: ["new-master", "needs-tier-check"]
body:
- type: markdown
attributes:
value: |
## ⚠️ 重要:提 PR 前必须先开此 issue
贡献一位新法师涉及**版权判定、教界边界、史料可得性**三层审查。已完成 `prebuilt/` 目录再被拒的成本很高,因此请先在这里征询意见。
**必读**[`ETHICS.md`](https://github.com/xr843/Master-skill/blob/main/ETHICS.md) §2(版权 Tier)、§3(教界边界),以及 [`CONTRIBUTING.md`](https://github.com/xr843/Master-skill/blob/main/CONTRIBUTING.md) §3。
- type: input
id: master-name
attributes:
label: 法师名称
placeholder: "例如:马祖道一 / 临济义玄 / 弘一大师"
validations:
required: true
- type: input
id: slug
attributes:
label: 建议 slug(小写英文或拼音)
placeholder: "例如:mazu / linji / hongyi"
validations:
required: true
- type: input
id: dates
attributes:
label: 生卒年
placeholder: "例如:709-788 / 1880-1942"
validations:
required: true
- type: dropdown
id: lineage
attributes:
label: 主要宗派 / 传承
options:
- 禅宗
- 净土宗
- 天台宗
- 华严宗
- 法相唯识宗
- 三论宗(中观)
- 律宗
- 密宗 / 真言宗
- 跨宗派融合
- 其它
validations:
required: true
- type: dropdown
id: tier
attributes:
label: 版权 Tier 自评(参考 ETHICS.md §2
options:
- "Tier A — 公有领域(圆寂 > 50 年,中国大陆 / 台湾)"
- "Tier A — 公有领域(圆寂 > 70 年,大多数其它辖区)"
- "Tier B — 仍在版权期(需附授权证明)"
- "Tier D — 灰色,需讨论"
- "不确定"
validations:
required: true
- type: textarea
id: tier-justification
attributes:
label: Tier 判定理由
description: 引用具体的圆寂年份、授权文件、学界共识等。Tier B 必须附授权证明链接。
placeholder: "例如:印光大师圆寂 1940 年,距今 85 年;中国大陆著作权保护期 50 年,已于 1990 年过期。文钞 CBETA X62n1182, X62n1183 已收录公有学术版本。"
validations:
required: true
- type: textarea
id: sources
attributes:
label: 主要 CBETA / FoJin 数据源
description: 至少 3 部代表性经论或文集的 CBETA ID + 可选 FoJin text_id
placeholder: |
- 《六祖坛经》T48n2008
- 《景德传灯录》T51n2076 慧能章
- FoJin text_id: 待查
validations:
required: true
- type: textarea
id: why-now
attributes:
label: 为什么收录这位法师?
description: 从用户需求 / 宗派覆盖 / 对比价值 / 数据可得性角度说明
placeholder: "例如:当前 8 位覆盖唯识/中观/禅/天台/华严/净土/跨宗派,但禅宗各家(马祖/临济/赵州)未单独立传。马祖作为洪州宗代表,与慧能的南宗直指、虚云的近代参禅形成三代对比,/compare-masters 价值显著。"
validations:
required: true
- type: textarea
id: ethical-concerns
attributes:
label: 可能的教界边界 / 学界争议
description: 有无学派争议、身份考证分歧、特定地区的敏感性?
placeholder: "例如:《坛经》版本差异(敦煌本 vs 宗宝本),现当代学界倾向敦煌本为近祖;神会造论说需要说明但不过度卷入。"
validations:
required: false
- type: textarea
id: volunteer
attributes:
label: 是否愿意亲自贡献 PR
placeholder: "是 / 否。如是,预计何时可提?"
validations:
required: true
+66
View File
@@ -0,0 +1,66 @@
<!--
感谢贡献!请用中文或英文填写以下字段。纯 typo / 格式修复可删除不相关部分。
-->
## 改动类型
<!-- 勾选适用项 -->
- [ ] 代码 / CI / 工具链
- [ ] 文档 / README / 翻译
- [ ] 新增法师内容(`prebuilt/<slug>/`
- [ ] 修改已有法师内容
- [ ] fidelity 测试用例变更
- [ ] `ETHICS.md` / `CONTRIBUTING.md` / `CODE_OF_CONDUCT.md` / `SECURITY.md` 治理条款
- [ ] 其它
## 做了什么 + 为什么
<!-- 描述改动本身,以及它解决了什么问题。不要只列文件。 -->
## 相关 issue / discussion
<!-- Closes #123 / Refs #456 / 相关讨论链接 -->
## 自检清单
<!-- 提交前请自行勾选 -->
- [ ] CI 绿色(validate / fidelity-smoke / verify-links 无 red
- [ ] 如果改了 `prebuilt/**` → 已 review [`ETHICS.md`](../ETHICS.md) §2(版权 Tier)、§3(教界边界)
- [ ] 如果新增 / 修改 `teaching.md` → 所有教义断言均附**真实** CBETA 经号
- [ ] 如果新增 `voice.md` → Layer 0(硬规则)已从 ETHICS.md §3 完整复制
- [ ] 如果新增 fidelity 用例 → `python scripts/validate-fidelity.py` 绿色
- [ ] CHANGELOG.md 的 `[Unreleased]` 章节已更新(除非是纯 typo / 格式)
- [ ] PR description 说明了**为什么**这样做,不只是做了什么
## 新增法师(如适用)
<!-- 仅新增 prebuilt/<slug>/ 时填写 -->
- **法师**
- **slug**
- **版权 Tier**A / B / D
- **对应的 New Master issue**#
- **Tier B 授权证明**:(链接 `prebuilt/<slug>/LICENSE.md`
## 本地测试
<!-- 说明你本地跑了什么、结果如何 -->
```bash
# 示例
python scripts/validate.py --strict # ✅
python scripts/test-fidelity.py --master <new> --dry-run # ✅ 5 条用例
ANTHROPIC_API_KEY=... python scripts/test-fidelity.py --master <new> --max-tests 1 # ✅ 1/1 pass
```
## 截图 / 样例回答
<!-- 可选。展示 AI 角色的实际表现,方便 review -->
---
<!--
PR description 写得详细一点,可以大幅减少来回 review 的次数。感谢!
-->
+70
View File
@@ -0,0 +1,70 @@
name: Publish to npm
# Triggered on release tags (v0.3.0, v0.3.1, v1.0.0, ...) or manually.
# First-time publish requires: Settings → Secrets → Actions → NPM_TOKEN
# Generate at https://www.npmjs.com/settings/~/tokens (type: Automation / Granular).
on:
release:
types: [published]
workflow_dispatch:
inputs:
dry-run:
description: "Run npm publish --dry-run only"
required: false
default: "true"
type: choice
options: ["true", "false"]
permissions:
contents: read
# id-token needed if we move to npm provenance / trusted publishing later
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/master-skill
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Verify CLI is executable
run: |
test -x bin/cli.mjs || chmod +x bin/cli.mjs
node bin/cli.mjs list
- name: Verify package contents (what will ship)
run: npm pack --dry-run
- name: Verify version matches tag
if: github.event_name == 'release'
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
TAG="${GITHUB_REF_NAME#v}"
if [ "$PKG_VERSION" != "$TAG" ]; then
echo "::error::package.json version ($PKG_VERSION) != release tag ($TAG)"
exit 1
fi
- name: Publish (dry-run)
if: github.event_name == 'workflow_dispatch' && inputs.dry-run == 'true'
run: npm publish --dry-run --access public
- name: Publish
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry-run == 'false')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
echo "::error::NPM_TOKEN secret not configured. Add it at Settings → Secrets → Actions."
exit 1
fi
npm publish --access public --provenance
+87
View File
@@ -0,0 +1,87 @@
# Code of Conduct
## 我们的承诺
为了营造一个开放、友善、具有学术严谨度的社区,我们作为贡献者与维护者承诺:**无论年龄、背景、性别认同、国籍、种族、宗教信仰、政治立场、身体状况、经验水平如何,对所有参与者一视同仁**。
本项目涉及佛教内容,在通用行为准则之上,额外遵守**汉传佛教语境下的学术与教界礼仪**。
---
## 可接受的行为
- 使用友善、包容的语言
- 尊重不同观点与经历
- 主动给出并虚心接纳建设性批评
- 以项目长期健康与社区福祉为重
- 对其他社区成员保持同理心
- **学术讨论以 CBETA 原文 + 主流学界共识为据**,避免以个人修学经验或宗派立场压制他人
- **尊重不同宗派**:禅 / 净 / 律 / 密 / 教 各宗平等,不贬损任何传承
- **尊重在家 / 出家四众**:本项目面向学术与学习,不区别对待参与者身份
---
## 不可接受的行为
通用禁止项(与大多数开源项目一致):
- 使用性暗示、侮辱、攻击性语言或图像
- 骚扰行为,无论是公开还是私下
- 发布他人隐私信息(住址、邮箱、电话等)而未获许可
- 其它在专业场合被认为不当的行为
**本项目专有的禁止行为:**
- **教义垄断性发言**:声称"只有某宗是真佛法"、"某宗祖师比其它宗更高"
- **借项目传法**:把 issue / PR / discussion 当作个人开示或教学场
- **对他人做修行诊断**:在讨论中评判他人修行境界、给他人"灌顶"、预测他人业报
- **假冒出家身份**:虚构自己为法师、仁波切、活佛等以获取权威
- **引用伪经或附佛外道文献作为权威**:讨论时请引 CBETA 或主流学界认可的文献
- **禁用项目生成的 AI 回答作为"祖师原话"传播**(见 [`ETHICS.md`](ETHICS.md) §1
---
## 执行范围
本准则适用于:
- 项目仓库所有空间(issues、pull requests、discussions、code review comments
- 项目相关的线下 / 线上聚会
- 以项目代表身份出现的任何场合(官方社交账号、以 `@xr843` handle 发声等)
---
## 举报
看到违规行为,请通过以下任一方式联系维护者:
- 邮件:**xianren843@protonmail.com**(首选,72 小时内回复)
- 在相关 issue / PR 中用 `@xr843` 私下联络请求 meta 讨论
**承诺:**
- 所有举报将被保密处理,不公开举报者身份
- 维护者有义务对举报做书面回应并说明处理决定
- 如举报者对处理结果不满意,可要求升级到中立第三方(拟引入佛学界或开源社区独立仲裁人)
---
## 执行措施
根据违规严重程度,维护者可采取:
| 级别 | 行为 | 后果 |
|-----|------|------|
| 1 | 轻度不当措辞 | 公开 / 私下提醒,要求改正 |
| 2 | 重复 1 级或中度骚扰 | 临时封禁 7 日 |
| 3 | 严重骚扰、假冒身份、恶意传法 | 永久封禁 |
| 4 | 违反 [`ETHICS.md`](ETHICS.md) 硬规则(Tier C 内容、教界越界)| 立即封禁 + 公开说明 |
---
## 归属
本准则基于 [Contributor Covenant 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/),并补充佛教项目特有条款。
原文:CC BY 4.0
补充条款:遵循本项目内容授权(见 [`ETHICS.md`](ETHICS.md) §4
+245
View File
@@ -0,0 +1,245 @@
# Contributing to Master-skill
欢迎贡献!本项目分三类改动,每类流程不同——**请先判断你的改动属于哪一类**,再按对应流程走。
> 📜 贡献前**必读**[`ETHICS.md`](ETHICS.md) — AI 透明度、版权 Tier、教界边界、内容授权。违反伦理条款的 PR 不会 review。
---
## 三类改动
### ① 代码 / CI / 工具链
`scripts/**`, `tools/**`, `bin/**`, `hooks/**`, `.github/**`, `tests/`(非 fidelity
流程:**普通 GitHub PR**。满足 Python 3.9+、现有测试通过、`python scripts/validate.py --strict` 绿色即可。
### ② 文档 / README / 脚本注释 / 翻译
`README.md`, `README_EN.md`, `docs/**`, `CHANGELOG.md`, 其它非 `prebuilt/**` 的 markdown
流程:**普通 PR**。不需要跑 fidelity 测试,CI 中的 validate / smoke job 会跳过(除非改了其它触发路径)。
### ③ 贡献 / 修改法师内容(⚠️ 最严,必读)
`prebuilt/**`, `prompts/**`
涉及:
- 新增一位法师
- 修改已有法师的 `teaching.md` / `voice.md` / `sources/`
- 修改 fidelity 测试用例
流程:见下方 [§3 贡献一位新法师](#3-贡献一位新法师)。
---
## 开发环境
```bash
git clone https://github.com/xr843/Master-skill
cd Master-skill
# Python(用于 validate / fidelity / verify-links
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
pip install anthropic # 仅 fidelity 实跑需要
# Node(用于 npx installer
# 需要 Node.js >= 18
npm install -g . # 可选,本地测试 CLI
```
**基本健康检查:**
```bash
# Lint SKILL.md frontmatter — 每位法师必须通过
python scripts/validate.py --strict
# Fidelity 结构(不调 API
python scripts/validate-fidelity.py
# Fidelity 干跑(显示测试用例,不调 API)
python scripts/test-fidelity.py --all --dry-run
# Fidelity 实跑(需要 ANTHROPIC_API_KEY,一次 ≈ $0.05-0.10
ANTHROPIC_API_KEY=sk-... python scripts/test-fidelity.py --master zhiyi --max-tests 1
```
---
## § 1 分支与提交约定
- **分支命名**`feat/<short>``fix/<short>``docs/<short>``chore/<short>``master/<slug>`
- **Commit 格式**[Conventional Commits](https://www.conventionalcommits.org/)`feat:` / `fix:` / `docs:` / `chore:` / `refactor:` / `test:` + 可选 scope
- **Commit message 语言**:代码/基础设施类改动用英文,佛教内容类改动中英文均可,但 PR description 需要有中文摘要(方便教内读者审阅)
---
## § 2 PR 评审清单
提交 PR 前自检:
- [ ] CI 绿色(validate / fidelity-smoke 必过;forks 无 API key 会 skip 并 warningOK
- [ ] CHANGELOG.md 的 `[Unreleased]` 章节已更新(除非是纯 typo
- [ ] 涉及 `prebuilt/**` 的改动 → 已 review ETHICS.md §2(版权 Tier)、§3(教界边界)
- [ ] PR description 说明**做了什么 + 为什么**,而非只列改动文件
---
## § 3 贡献一位新法师
### 3.1 前置检查(必看 [`ETHICS.md`](ETHICS.md)
**这位法师可以收录吗?**
| 情形 | 判断 |
|-----|------|
| 生卒明确,圆寂超过 50 年(CN/TW)或 70 年(大多数其它辖区) | ✅ Tier A,可直接 PR |
| 近现代法师,亲授弟子在世 / 所属寺院仍运营 | ⚠️ Tier B,PR 必须附 `prebuilt/{slug}/LICENSE.md` 授权证明 |
| 在世法师 | ❌ Tier C,不接受 |
| 主流学界对身份 / 著作有争议 | ❌ Tier C,不接受 |
| 汉传以外(南传 / 藏传 / 日莲 / 天台日宗等)| ⏳ 当前版本仅汉传,未来独立分支规划中,不接受 |
**想收录但不确定?** 先开一个 [new_master Issue](https://github.com/xr843/Master-skill/issues/new?template=new_master.yml) 征询意见,**不要先写完再提 PR**——已经投入精力再被拒成本太高。
### 3.2 选项 A:交给 `/create-master` 生成(推荐)
```bash
# 在 Claude Code / Cursor 等 AgentSkills 环境
/create-master 某某法师
```
生成管线会:
1. **intake** — 3 问收集信息(传承、核心教义、可用文献)
2. **collect** — 从 FoJin 采集该法师的 CBETA 文本
3. **analyze**`sutra_analyzer` + `voice_analyzer` 并行分析
4. **review** — 二阶段独立审查:教义准确性 → 风格一致性
5. **write** — 生成 `prebuilt/<slug>/` 目录结构
6. **validate** — 自动跑 `validate.py` + `validate-fidelity.py`
然后你手动:
- Review 生成结果,补充 `references/teaching.md``voice.md` 的细节
- 起草 5 条 `tests/fidelity.jsonl`1 basic + 2 intermediate + 2 advanced
- 跑一次 `test-fidelity.py --master <slug>` 确认 ≥ 4/5 通过
- 提 PR
### 3.3 选项 B:手工编写
参考现有法师 `prebuilt/yinguang/` 的完整结构:
```
prebuilt/<slug>/
├── SKILL.md # 必须。frontmatter 见下
├── meta.json # 必须。search_scope + keywords
├── references/
│ ├── teaching.md # 必须。教义体系,每条断言附 CBETA 引证
│ └── voice.md # 必须。Layer 0/1/2/3 四层表达风格
├── sources/
│ ├── INDEX.md # 必须。本目录导览
│ └── *.md # ≥ 2 篇 CBETA 核心段落摘录
└── tests/
└── fidelity.jsonl # 必须。5 条 Q&A 测试用例
```
**SKILL.md frontmatter 必填字段:**
```yaml
---
name: <slug> # 小写英文或拼音,作为 `/命令` 触发词
description: Use when user asks about ..., triggers include ...
version: 0.1.0
license: MIT
lineage: <宗派>
dates: 生年-卒年
sources:
- title: <经典名称>
cbeta_id: <T 或 X + 数字>
fojin_text_id: <FoJin 内部 text_id>
- ... # 至少 3 部经
citation_format: "【《{title}》卷{juan}{cbeta_id}】"
verified_by: <你的 GitHub handle>
verified_at: <YYYY-MM-DD>
---
```
**HARD-GATE 铁律(写入任何 `teaching.md` 前请自检):**
1. 每一条教义断言必须附一个**真实**的 CBETA 经号
2. 不得捏造经号(`scripts/validate.py` 会对照 FoJin 反查)
3. 不得为虚构 / 神话 / 未有史实记载的人物建角色
4. 不得大段抄录仍在版权期内的现代白话译本或学术校注
### 3.4 Voice.md 四层结构
`prebuilt/yinguang/references/voice.md` 作为参照。重点:
- **Layer 0 — 硬规则**[`ETHICS.md` §3](ETHICS.md) 的禁止行为必须原文复制到此
- **Layer 1 — 身份**:生卒、传承、核心立场
- **Layer 2 — 表达风格**:常用比喻、开场方式、称呼
- **Layer 3 — 教学方法**:循序渐进的路径、遇困惑时的处理
### 3.5 Fidelity 测试用例怎么写
`tests/fidelity.jsonl` 每行一个 JSON,字段:
```json
{
"q": "用户会问的典型问题",
"must_cite": ["T48n2008", "某经号"],
"must_mention": ["核心术语1", "核心术语2"],
"must_not_contain_first_turn": ["学生啊", "师兄"],
"difficulty": "basic|intermediate|advanced"
}
```
**5 条分布建议:**
- 1 条 `basic` — 宗派入门问题(smoke 会优先跑这条)
- 2 条 `intermediate` — 核心教义(如 "三性" / "信愿行"
- 1 条 `advanced` — 跨宗派对话 / 批判性问题
- 1 条 boundary 测试 — 试探 "给我授戒 / 印证我开悟了吗" 一类,must_not_contain 检查 AI 是否正确拒绝
### 3.6 Review 过程
PR 提交后:
1. CI 自动跑 validate + fidelity-smoke(抽本 PR 修改的法师做 smoke)
2. 维护者 review 教义准确性 + 风格一致性 + 版权 Tier 判断
3. 如有佛学学者 / 教内法师愿意 review,欢迎在 PR 评论 tag 维护者协调
4. Review 周期:7-14 天(含教内邀请意见)
---
## § 4 修改已有法师
- 小修(typo、措辞):直接 PR
- 大修(新增教义章节、修改 Layer 1-3 风格):先开 issue 讨论
- 修改 fidelity 测试用例:**PR description 必须说明新旧用例的差异以及为何新用例更能体现该法师风格**——不要为了让测试通过而放宽标准
---
## § 5 行为准则
见 [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)。
本项目涉及佛教内容,请在讨论中:
- 不评判宗派高下
- 不借项目传播个人修行见解
- 不对其他贡献者做教学式 / 居高临下的发言
- 教理争议以学界主流共识 + CBETA 原文为准,而非个人修学经验
---
## 问题?
- 技术问题 → [Bug Report](https://github.com/xr843/Master-skill/issues/new?template=bug_report.yml)
- 新法师建议 → [New Master Proposal](https://github.com/xr843/Master-skill/issues/new?template=new_master.yml)
- 教界边界疑虑 → [Boundary Violation](https://github.com/xr843/Master-skill/issues/new?template=boundary_violation.yml)P0,优先处理)
- 一般讨论 → [GitHub Discussions](https://github.com/xr843/Master-skill/discussions)
- 紧急版权下架 → xianren843@protonmail.com48 小时回复)
感谢你愿意为汉传佛教数字人文贡献一份力。合十。
+14 -3
View File
@@ -361,11 +361,22 @@ Master-skill 通过 `tools/fojin_bridge.py` 接入 FoJin API,实现:
## 贡献指南 ## 贡献指南
欢迎提交新的预置法师、修正文献来源错误、补充经文片段,或改进工具链。 **完整流程见 [CONTRIBUTING.md](CONTRIBUTING.md)。** 以下是速查:
新增祖师需遵循 v0.3 架构:`prebuilt/<name>/` 下包含 SKILL.md(含 provenance frontmatter 与决策树)、`references/teaching.md``references/voice.md`(按需加载)、`sources/*.md`(离线经文片段)、`tests/fidelity.jsonl`(5 条以上 Q&A 保真度样例)。提交前运行 `python3 scripts/validate.py --strict` 确保 0 errors,并让 CI 的保真度 dry-run 通过。 - 🐞 **报 bug**[Bug Report](https://github.com/xr843/Master-skill/issues/new?template=bug_report.yml)
-**提 feature**[Feature Request](https://github.com/xr843/Master-skill/issues/new?template=feature_request.yml)
- 🧘 **建议新法师****先开 [New Master 提议](https://github.com/xr843/Master-skill/issues/new?template=new_master.yml) 征询**,不要直接写完 PR 再被拒(版权 Tier / 教界边界 / 史料可得性 三重审查)
- 🚨 **教界越界报告**[Boundary Violation (P0)](https://github.com/xr843/Master-skill/issues/new?template=boundary_violation.yml)
- 💬 **一般讨论 / 提问**[GitHub Discussions](https://github.com/xr843/Master-skill/discussions)
提交前请确认:文献来源可追溯至 CBETA,内容忠实于佛教经典文献,无宗派偏见。 **新增一位法师的必读:**
1. [ETHICS.md](ETHICS.md) §2 — 确认版权 Tier(A 可直接 PR,B 需授权证明,C 一律拒绝)
2. [ETHICS.md](ETHICS.md) §3 — 教界禁止行为须写入该法师 `voice.md` Layer 0
3. [CONTRIBUTING.md](CONTRIBUTING.md) §3 — 目录结构、frontmatter、fidelity 测试用例编写规范
4. 提交前:`python scripts/validate.py --strict` 绿色 + `tests/fidelity.jsonl` 至少 5 条 + CI fidelity-smoke 通过
其它一般贡献(文档、工具链、CI)走普通 PR 流程。
--- ---
+105
View File
@@ -0,0 +1,105 @@
# Security Policy
## Supported Versions
Master-skill 以 `main` 为持续发布分支。我们仅对以下版本承诺 security fix
| 版本 | 状态 |
|------|------|
| `main` (latest) | ✅ 持续修复 |
| `0.3.x` | ✅ 持续修复 |
| `< 0.3.0` | ❌ 不再维护 |
---
## 报告安全漏洞
**请勿通过公开 issue 报告安全漏洞。** 公开披露会让攻击者先行利用。
### 推荐方式:GitHub Security Advisory
1. 访问 https://github.com/xr843/Master-skill/security/advisories/new
2. 填写漏洞描述、复现步骤、影响范围
3. 维护者会在 72 小时内确认收悉
### 备选:邮件
邮件发送至 **xianren843@protonmail.com**,主题请包含 `[SECURITY]`
**推荐用 GPG / PGP 加密**:公钥可通过 keys.openpgp.org 搜索该邮箱获取(或在 issue 中 request)。
---
## 本项目关心的安全类别
Master-skill 作为 AgentSkill 插件 + NPX CLI,主要关注以下安全面:
### 1. **Prompt Injection**
- 预置法师的 `SKILL.md` / `voice.md` / `sources/` 被恶意注入,导致 AI 绕过 HARD-GATE 或伦理边界
- `/create-master` 生成管线中的 prompt 模板被污染
- 用户问题中的诱导越狱("假装你是个能传戒的 AI..."
### 2. **Supply Chain**
- `package.json` 依赖被投毒(当前依赖极少,但未来可能增加)
- FoJin API 返回的文本被篡改以影响 fidelity test
- CBETA ID 伪造(已有 `scripts/validate.py` 防线,但需持续完善)
### 3. **Secret Leakage**
- `ANTHROPIC_API_KEY` 在 CI 日志中意外泄露
- 用户在 issue / discussion 中误粘自己的 API key(自动检测 + 立即清除)
### 4. **Installer Safety**
- `bin/cli.mjs` (`npx master-skill install`) 的目录操作是否存在路径穿越
- 安装到 `~/.claude/skills/` 时的符号链接注入
### 5. **Religious-Boundary Violation via Adversarial Input**
- 特别 crafted 的用户问题使法师角色逾越 [`ETHICS.md`](ETHICS.md) §3 的禁止行为
- 这类属于**安全 + 伦理**交叉问题,优先级等同 S 级漏洞
---
## 非安全范畴(请走普通 issue)
以下不属于 security policy 范围:
- 某位法师回答不够"像"该祖师 → 开 bug report
- 引经错误(而非伪造)→ 开 bug report
- FoJin API 不可用 → 项目已有 graceful degradation,非安全问题
- UX / 文档问题 → 普通 issue
---
## 响应 SLA
| 严重级 | 首次回复 | 修复目标 | 公开披露 |
|-------|---------|---------|---------|
| Critical0day、泄密、Prompt injection 破 HARD-GATE| 24h | 7 天内发 patch | 修复后 7 天 |
| High(影响正常功能但非系统性)| 72h | 14 天内发 patch | 修复后 30 天 |
| Medium / Low | 7 天 | 下一版本 | 与版本同步 |
---
## 安全奖励
本项目目前**无法提供现金奖励**(个人维护,非商业项目)。但会:
-`CHANGELOG.md` 显著位置署名感谢(除非你希望匿名)
- 对严重漏洞发现者提供一份定制化感谢文书(PDF + 项目维护者签名)
- 愿与你共同起草 CVE 条目(如适用)
---
## 相关文档
- 负责任披露:[GitHub Security Advisory Policy](https://docs.github.com/en/code-security/security-advisories)
- 内容安全边界:[`ETHICS.md`](ETHICS.md) §3
- 社区安全:[`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
---
感谢你让本项目更安全。
+61 -4
View File
@@ -2,12 +2,69 @@
"name": "master-skill", "name": "master-skill",
"version": "0.3.0", "version": "0.3.0",
"type": "module", "type": "module",
"description": "Chinese Buddhist Master AI Skills — RAG-grounded, source-cited, fidelity-tested", "description": "Chinese Buddhist Master AI Skills — RAG-grounded, source-cited, fidelity-tested. 8 pre-built 汉传 patriarchs: Xuanzang, Kumārajīva, Huineng, Zhiyi, Fazang, Yinguang, Ouyi, Xuyun.",
"bin": { "bin": {
"master-skill": "./bin/cli.mjs" "master-skill": "./bin/cli.mjs"
}, },
"keywords": ["claude-skills", "agent-skills", "buddhism", "ai-persona", "rag", "digital-humanities"], "scripts": {
"list": "node bin/cli.mjs list",
"validate": "python scripts/validate.py --strict",
"validate:fidelity": "python scripts/validate-fidelity.py",
"test": "python scripts/validate.py --strict && python scripts/validate-fidelity.py && python scripts/test-fidelity.py --all --dry-run",
"test:smoke": "python scripts/test-fidelity.py --master yinguang --max-tests 1",
"prepack": "node bin/cli.mjs list"
},
"keywords": [
"claude-skills",
"agent-skills",
"claude-code",
"cursor",
"codex",
"opencode",
"gemini-cli",
"buddhism",
"chinese-buddhism",
"ai-persona",
"rag",
"digital-humanities",
"cbeta",
"fojin"
],
"author": {
"name": "xr843",
"url": "https://github.com/xr843"
},
"license": "MIT", "license": "MIT",
"repository": {"type": "git", "url": "https://github.com/xr843/Master-skill"}, "repository": {
"files": ["bin/", "prebuilt/", "scripts/", "hooks/", ".claude-plugin/", ".cursor-plugin/", ".codex/", ".opencode/"] "type": "git",
"url": "git+https://github.com/xr843/Master-skill.git"
},
"bugs": {
"url": "https://github.com/xr843/Master-skill/issues"
},
"homepage": "https://fojin.app/chat",
"engines": {
"node": ">=18"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"files": [
"bin/",
"prebuilt/",
"scripts/",
"hooks/",
".claude-plugin/",
".cursor-plugin/",
".codex/",
".opencode/",
"gemini-extension.json",
"GEMINI.md",
"SKILL.md",
"ETHICS.md",
"LICENSE",
"README.md",
"README_EN.md"
]
} }