# AGENTS.md

oci-portal：自托管 OCI 多租户管理面板后端（Go + Gin + GORM + SQLite，可选 MySQL/PostgreSQL）。本文件面向 AI 编码助手；人类文档见 [README.md](README.md)。

## 语言与交付

- 用中文回答与写注释
- commit message 用中文，不超过 50 字
- 函数不超过 30 行

## 仓库操作铁律

- **仅当用户明确提出「提交」「推送」时才执行 git 操作**
- 双 remote：`gitea`（日常默认）与 `github`（公共镜像）；推送默认到 `gitea`，仅用户明示「发版」或「推到 github」时才推 `github`

## 编码规范（写代码前读）

- 规范入口：[.trellis/spec/backend/index.md](.trellis/spec/backend/index.md)（目录结构 / 错误处理 / 并发 / 测试等分篇）
- 云 API 调用只出现在 `internal/oci/`；阻塞/远程调用第一参数 `ctx context.Context`；错误用 `%w` 包装向上返回
- 错误消息与日志绝不携带私钥、口令、令牌等敏感信息
- 新逻辑必须带 table-driven 测试

## 质量门（提交前必过）

```bash
gofmt -l . && go vet ./... && go test ./...
```

## 文档同步

- 改环境变量 / 部署形态 / 对外行为时，同步更新 README.md；CHANGELOG.md 只在发版时写对应版本段，日常提交不记录


<!-- TRELLIS:START -->
# Trellis Instructions

These instructions are for AI assistants working in this project.

This project is managed by Trellis. The working knowledge you need lives under `.trellis/`:

- `.trellis/workflow.md` — development phases, when to create tasks, skill routing
- `.trellis/spec/` — package- and layer-scoped coding guidelines (read before writing code in a given layer)
- `.trellis/workspace/` — per-developer journals and session traces
- `.trellis/tasks/` — active and archived tasks (PRDs, research, jsonl context)

If a Trellis command is available on your platform (e.g. `/trellis:finish-work`, `/trellis:continue`), prefer it over manual steps. Not every platform exposes every command.

If you're using Codex or another agent-capable tool, additional project-scoped helpers may live in:
- `.agents/skills/` — reusable Trellis skills
- `.codex/agents/` — optional custom subagents

Managed by Trellis. Edits outside this block are preserved; edits inside may be overwritten by a future `trellis update`.

<!-- TRELLIS:END -->
