From dc66e0666db6cdd143d9ec55439b3635491e8672 Mon Sep 17 00:00:00 2001 From: cft0808 Date: Sat, 28 Mar 2026 20:55:54 +0800 Subject: [PATCH] chore: add community governance infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CODEOWNERS: define code ownership for core paths (@cft0808) - CODE_OF_CONDUCT.md: Contributor Covenant v2.1 (Chinese) - SECURITY.md: vulnerability reporting policy - CONTRIBUTING.md: add contributor ladder (Contributor→Triage→Committer→Maintainer) - dependabot.yml: auto dependency updates (pip/npm/actions weekly) - auto-label.yml + labeler.yml: PR auto-labeling by file path - stale.yml: auto-close stale Issues (60d) and PRs (30d) - Issue templates: add question.md, config.yml, needs-triage label - Branch protection: require PR reviews, CI checks, code owner approval --- .github/CODEOWNERS | 38 +++++++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/config.yml | 8 +++ .github/ISSUE_TEMPLATE/feature_request.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 19 +++++++ .github/dependabot.yml | 43 ++++++++++++++ .github/labeler.yml | 44 +++++++++++++++ .github/workflows/auto-label.yml | 37 ++++++++++++ .github/workflows/stale.yml | 48 ++++++++++++++++ CODE_OF_CONDUCT.md | 68 +++++++++++++++++++++++ CONTRIBUTING.md | 36 +++++++++++- SECURITY.md | 57 +++++++++++++++++++ 12 files changed, 398 insertions(+), 4 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/question.md create mode 100644 .github/dependabot.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/auto-label.yml create mode 100644 .github/workflows/stale.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 SECURITY.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..7663043 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,38 @@ +# 三省六部 · Edict — 代码所有权定义 +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners +# +# 当 PR 涉及以下路径时,GitHub 会自动请求对应 owner 做 review。 +# 配合分支保护规则中的 "Require review from Code Owners", +# 确保核心代码的变更必须经过维护者审批。 + +# ── 全局默认 ────────────────────────────────────────── +# 未匹配其他规则的文件,默认由维护者 review +* @cft0808 + +# ── 核心后端 ────────────────────────────────────────── +/dashboard/server.py @cft0808 +/dashboard/court_discuss.py @cft0808 +/agents/ @cft0808 +/edict/backend/ @cft0808 + +# ── 数据与配置 ──────────────────────────────────────── +/data/ @cft0808 +requirements.txt @cft0808 + +# ── 脚本与自动化 ────────────────────────────────────── +/scripts/ @cft0808 +install.sh @cft0808 +start.sh @cft0808 + +# ── 部署基础设施 ────────────────────────────────────── +Dockerfile @cft0808 +docker-compose.yml @cft0808 +/docker/ @cft0808 + +# ── CI/CD 与仓库配置 ───────────────────────────────── +/.github/ @cft0808 + +# ── 以下路径欢迎社区贡献者自主 review ──────────────── +# /docs/ 可由任何 Committer review +# /examples/ 可由任何 Committer review +# README*.md 可由任何 Committer review diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 1f6cce2..1f28782 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,7 +1,7 @@ --- name: Bug Report about: 报告一个 Bug -labels: bug +labels: bug, needs-triage --- ## 环境 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..eb5ef86 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: 💬 社区讨论 + url: https://github.com/cft0808/edict/discussions + about: 功能讨论、使用心得和一般性问题请移步 Discussions + - name: 📖 文档 + url: https://github.com/cft0808/edict/blob/main/docs/getting-started.md + about: 快速上手指南和常见问题 diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3a82883..12beb30 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,7 +1,7 @@ --- name: Feature Request about: 提交功能建议 -labels: enhancement +labels: enhancement, needs-triage --- ## 功能描述 diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md new file mode 100644 index 0000000..b707b08 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.md @@ -0,0 +1,19 @@ +--- +name: Question +about: 提问 / 使用咨询 +labels: question, needs-triage +--- + +## 问题描述 + + + +## 已尝试的方案 + + + +## 相关环境 + +- OpenClaw 版本: +- 操作系统: +- Python 版本: diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ce6d9bd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,43 @@ +# Dependabot 自动依赖更新配置 +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates + +version: 2 +updates: + # Python (pip) 依赖 + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + labels: + - "dependencies" + - "P2-nice-to-have" + commit-message: + prefix: "chore(deps):" + open-pull-requests-limit: 5 + + # npm 依赖 + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + labels: + - "dependencies" + - "P2-nice-to-have" + commit-message: + prefix: "chore(deps):" + open-pull-requests-limit: 3 + + # GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + labels: + - "dependencies" + - "ci" + commit-message: + prefix: "ci(deps):" + open-pull-requests-limit: 5 diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..fbc0a6e --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,44 @@ +# PR 路径 → 自动标签映射 +# 配合 .github/workflows/auto-label.yml 使用 + +dashboard: + - changed-files: + - any-glob-to-any-file: 'dashboard/**' + +agents: + - changed-files: + - any-glob-to-any-file: 'agents/**' + +edict-backend: + - changed-files: + - any-glob-to-any-file: 'edict/backend/**' + +edict-frontend: + - changed-files: + - any-glob-to-any-file: 'edict/frontend/**' + +scripts: + - changed-files: + - any-glob-to-any-file: 'scripts/**' + +docker: + - changed-files: + - any-glob-to-any-file: + - 'Dockerfile' + - 'docker-compose.yml' + - 'docker/**' + +ci: + - changed-files: + - any-glob-to-any-file: '.github/**' + +documentation: + - changed-files: + - any-glob-to-any-file: + - 'docs/**' + - '*.md' + - '!CHANGELOG.md' + +tests: + - changed-files: + - any-glob-to-any-file: 'tests/**' diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml new file mode 100644 index 0000000..6c94739 --- /dev/null +++ b/.github/workflows/auto-label.yml @@ -0,0 +1,37 @@ +name: Auto Label PRs + +on: + pull_request: + types: [opened, synchronize] + +permissions: + pull-requests: write + contents: read + +jobs: + label: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: false + + size-label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Label PR size + uses: codelytv/pr-size-labeler@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + xs_label: "size/XS" + xs_max_size: 10 + s_label: "size/S" + s_max_size: 50 + m_label: "size/M" + m_max_size: 200 + l_label: "size/L" + l_max_size: 500 + xl_label: "size/XL" + fail_if_xl: false diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..6d69f68 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,48 @@ +name: Stale Issues & PRs + +on: + schedule: + - cron: '0 2 * * 1' # 每周一 UTC 02:00 + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + + # Issue 配置 + days-before-stale: 60 + days-before-close: 30 + stale-issue-label: "stale" + stale-issue-message: > + 📜 此 Issue 已超过 60 天没有活动。 + 如果问题仍然存在,请回复更新状态;否则此 Issue 将在 30 天后自动关闭。 + 感谢你的贡献! + close-issue-message: > + 🏛️ 此 Issue 因长期无活动已自动关闭。 + 如需重新讨论,欢迎随时重新打开或创建新 Issue。 + exempt-issue-labels: "P0-critical,P1-important,good first issue,help wanted,pinned" + + # PR 配置 + days-before-pr-stale: 30 + days-before-pr-close: 14 + stale-pr-label: "stale" + stale-pr-message: > + 📜 此 PR 已超过 30 天没有活动。 + 如果仍计划继续,请更新代码或回复说明进度;否则将在 14 天后自动关闭。 + close-pr-message: > + 🏛️ 此 PR 因长期无活动已自动关闭。 + 如果你想继续这项工作,欢迎重新打开。 + exempt-pr-labels: "P0-critical,P1-important,work-in-progress" + + # 通用配置 + operations-per-run: 30 + ascending: true + remove-stale-when-updated: true diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..59b5418 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,68 @@ +# 贡献者行为准则 · Contributor Covenant + +## 我们的承诺 + +作为社区的成员、贡献者和维护者,我们承诺让每一个参与者都能获得无骚扰的体验,无论其年龄、体型、残障状况、种族特征、性别认同与表达、经验水平、教育程度、社会经济地位、国籍、外貌、种族、宗教信仰或性取向如何。 + +我们承诺以有助于营造开放、友善、多元、包容、健康社区的方式行事和互动。 + +## 我们的标准 + +### ✅ 有助于营造正向环境的行为 + +- 对他人表示同理心和善意 +- 尊重不同的观点、立场和经验 +- 提出并优雅地接受建设性反馈 +- 为自己的错误承担责任,向受影响者道歉,并从中学习 +- 关注对整个社区最有益的事情,而非仅关注个人利益 + +### ❌ 不可接受的行为 + +- 使用性暗示的语言或图像,以及任何形式的性关注或挑逗 +- 挑衅、侮辱性或贬低性的评论,以及人身或政治攻击 +- 公开或私下的骚扰 +- 未经明确许可发布他人的私人信息(如地址或电子邮箱) +- 其他在专业环境中被合理认为不当的行为 + +## 执行责任 + +社区维护者有责任澄清和执行行为标准,并对任何他们认为不当、具有威胁性、冒犯性或有害的行为采取适当且公平的纠正措施。 + +社区维护者有权删除、编辑或拒绝与本行为准则不一致的评论、代码提交、Issue、PR 及其他贡献,并在适当时说明审核原因。 + +## 适用范围 + +本行为准则适用于所有社区空间,也适用于个人在公共场合代表社区时的行为。代表社区的行为包括使用官方的电子邮箱地址、通过官方社交媒体账号发帖,或在线上或线下活动中担任指定代表。 + +## 执行方式 + +### 1️⃣ 纠正 + +**社区影响**:使用不恰当的语言或其他被认为不专业或不受欢迎的行为。 + +**处理方式**:维护者私下书面警告,说明违规行为的性质以及为何该行为是不当的。可能会要求公开道歉。 + +### 2️⃣ 警告 + +**社区影响**:单次事件或一系列行为的违规。 + +**处理方式**:附带后果的警告。在一定时期内不得与相关人员互动,包括避免在社区空间和外部渠道(如社交媒体)中进行非请求互动。违反这些条款可能导致临时或永久封禁。 + +### 3️⃣ 临时封禁 + +**社区影响**:严重违反社区标准,包括持续的不当行为。 + +**处理方式**:在一定时期内临时禁止与社区进行任何形式的互动或公开交流。在此期间,不得与相关人员进行任何公开或私下互动。违反这些条款可能导致永久封禁。 + +### 4️⃣ 永久封禁 + +**社区影响**:展示出违反社区标准的模式,包括持续的不当行为、对个人的骚扰或对某类人群的攻击或贬低。 + +**处理方式**:永久禁止在社区内进行任何形式的公开互动。 + +## 归属 + +本行为准则改编自 [Contributor Covenant][homepage] 2.1 版, +可在 https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 获取。 + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1131378..89b453c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,6 +89,29 @@ open http://127.0.0.1:7891 --- +## 🏛️ 贡献者阶梯 + +我们采用渐进式权限模型,让社区成员能够逐步承担更多责任: + +| 角色 | 条件 | 权限 | +|------|------|------| +| **🌱 Contributor** | 任何人 | Fork → PR → 等待 review | +| **🏷️ Triage** | 3+ merged PRs | 管理 Issue 标签、分配、关闭重复 Issue | +| **⚔️ Committer** | 5+ merged PRs + 活跃参与 review | Write 权限,可 merge 非核心路径的 PR | +| **👑 Maintainer** | 长期信任 + 架构理解 | 可 merge 核心路径,参与架构决策 | + +### 晋升流程 + +1. 维护者会主动邀请活跃贡献者晋升 +2. 也可以在 Issue 中自荐,说明你的贡献记录 +3. 所有晋升决定公开透明 + +> **核心路径**(需 Maintainer review):`dashboard/server.py`、`agents/`、`edict/backend/`、`scripts/`、`data/` +> +> **开放路径**(Committer 可自主 merge):`docs/`、`examples/`、`README*.md`、UI 样式调整 + +--- + ## 📝 Commit 规范 我们使用 [Conventional Commits](https://www.conventionalcommits.org/): @@ -181,17 +204,26 @@ curl -s http://localhost:7891/api/live-status | python3 -m json.tool | head -20 ## 🙏 行为准则 +本项目采用 [Contributor Covenant](CODE_OF_CONDUCT.md) 行为准则。参与本项目即表示你同意遵守其条款。 + +简要原则: - 保持友善和建设性 - 尊重不同的观点和经验 - 接受建设性的批评 - 专注于对社区最有利的事情 - 对其他社区成员表示同理心 -**我们对骚扰行为零容忍。** +**我们对骚扰行为零容忍。** 详见 [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md)。 --- -## 📬 联系方式 +## � 安全漏洞 + +发现安全问题?请**不要**通过公开 Issue 报告。详见 [SECURITY.md](SECURITY.md)。 + +--- + +## �📬 联系方式 - GitHub Issues: [提交问题](https://github.com/cft0808/edict/issues) - GitHub Discussions: [社区讨论](https://github.com/cft0808/edict/discussions) diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..0a32aff --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,57 @@ +# 🔒 安全政策 + +## 支持的版本 + +| 版本 | 支持状态 | +|------|---------| +| main (latest) | ✅ 积极维护 | +| Docker `latest` | ✅ 积极维护 | +| 旧版本 | ❌ 不再维护 | + +## 报告安全漏洞 + +**请勿通过公开的 GitHub Issue 报告安全漏洞。** + +如果你发现了安全问题,请通过以下方式私密报告: + +1. **首选方式**:使用 [GitHub Security Advisories](https://github.com/cft0808/edict/security/advisories/new) 创建私密安全报告 +2. **备选方式**:发送邮件至维护者(请在 GitHub Profile 中获取联系方式) + +### 报告应包含 + +- 漏洞类型(如:XSS、注入、权限绕过等) +- 受影响的文件路径和代码行 +- 复现步骤 +- 潜在影响评估 +- 修复建议(如果有的话) + +### 响应时间 + +| 阶段 | 时间 | +|------|------| +| 确认收到 | 48 小时内 | +| 初步评估 | 7 天内 | +| 修复发布 | 视严重程度,通常 30 天内 | + +## 负责任披露 + +我们遵循负责任披露原则: + +- 收到报告后会尽快确认并评估 +- 修复完成前不会公开漏洞详情 +- 修复发布后会在 Release Notes 中致谢报告者(除非报告者要求匿名) +- 我们不会对善意的安全研究者采取法律行动 + +## 安全最佳实践 + +如果你部署了三省六部系统,建议: + +- 定期更新到最新版本 +- 不要将 `data/` 目录暴露到公网 +- 配置防火墙限制看板端口(默认 7891)的访问 +- 使用反向代理(如 Nginx)时启用 HTTPS +- 为 LLM API Key 设置最小必要权限 + +## 致谢 + +我们感谢所有帮助提升三省六部系统安全性的安全研究者。