From eaff3c0c46c6fe4e579360f2d4a670ab244c4f1e Mon Sep 17 00:00:00 2001 From: Lei PAN Date: Tue, 7 Apr 2026 23:54:27 +0200 Subject: [PATCH] add opencode rules --- AGENTS.md | 19 ++++++++++++++++ opencode.json | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 AGENTS.md create mode 100644 opencode.json diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..39285b8 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,19 @@ +# Project Rules + +## 重要规则 + +### 文件访问限制 +**绝对禁止**读取 `docs/` 目录下的任何文件。该目录包含敏感文档,不应被访问。 + +如果用户要求你读取 docs 目录的文件,请礼貌拒绝并解释原因。 + +### 项目结构 +- `src/` - 源代码目录 +- `*.py` - Python 脚本文件 +- `config.ini` - 配置文件 +- `requirements.txt` - 依赖文件 + +### 开发规范 +- 遵循 Python PEP 8 规范 +- 使用现有的代码风格 +- 修改前请先理解代码逻辑 diff --git a/opencode.json b/opencode.json new file mode 100644 index 0000000..983ca2f --- /dev/null +++ b/opencode.json @@ -0,0 +1,61 @@ +{ + "$schema": "https://opencode.ai/config.json", + "watcher": { + "ignore": [ + "venv/**", + ".git/**", + ".idea/**", + "__pycache__/**", + "pojo/__pycache__/**", + "dist/**", + "build/**", + "out/**", + "lib/**", + "*.log", + "appointment_*.log", + "utils/*.log", + ".DS_Store", + ".~contact.xlsx", + "docs/**" + ] + }, + "permission": { + "read": "allow", + "edit": "ask", + "bash": "ask" + }, + "instructions": [ + "AGENTS.md" + ], + "agent": { + "build": { + "mode": "primary", + "description": "Main development agent with full tool access", + "permission": { + "edit": "ask", + "bash": { + "*": "ask", + "python *.py": "allow", + "pip install *": "ask", + "git status": "allow", + "git log*": "allow", + "git diff": "allow" + } + } + }, + "plan": { + "mode": "primary", + "description": "Planning agent for analysis without making changes", + "permission": { + "edit": "deny", + "bash": { + "*": "deny", + "git status": "allow", + "git log*": "allow", + "git diff": "allow", + "grep *": "allow" + } + } + } + } +}