53e3fb858d
* chore: update Go version to 1.25.1 and dependencies - Updated Dockerfile to use Go 1.25.1 for both builder and final images. - Modified README files (Japanese, Chinese Simplified, Chinese Traditional, and English) to reflect the new Go version requirement of 1.25.1. - Updated go.mod to specify Go 1.25 and updated dependencies: - Upgraded hugo from v0.147.6 to v0.149.1 - Upgraded testify from v1.10.0 to v1.11.1 - Upgraded other indirect dependencies to their latest versions. - Updated go.sum to reflect the changes in dependencies. * fix: update golangci-lint to use latest version and install mode
3.4 KiB
3.4 KiB
AGENTS
Guidelines for contributors and AI coding agents working in this repository.
Goals
- Keep changes minimal, focused, and idiomatic to Go.
- Prefer root‑cause fixes over band‑aids; don’t refactor unrelated code.
- Maintain user‑facing behavior and CLI flags unless explicitly changing them.
Project Snapshot
- Language: Go (modules enabled)
- Entry:
main.go - Core package:
runner/(watcher, engine, flags, config, proxy) - Docs:
README*.md,air_example.toml,docs/ - Tooling:
Makefile,hack/check.sh,hooks/pre-commit
Quick Start
- Build:
make build - Install:
make install - CI setup + vendor:
make ci - Lint/format/check staged files:
make check - Run tests:
go test ./...
Tip: run make init once to install goimports, set up golangci-lint, and enable the pre‑commit hook.
Code Style (Go)
- Formatting: rely on
goimports(invoked byhack/check.sh). - Linting: fixes must satisfy
golangci-lint(same config used in CI). - Errors: wrap with context; return early; avoid panics in library code.
- Concurrency: use contexts where appropriate; avoid data races; prefer channels or mutexes over ad‑hoc globals.
- Logging: keep logs concise, actionable, and consistent with existing patterns.
- Public API/flags: changing behavior or flags requires README updates and tests.
Tests
- Location: alongside code as
*_test.go(seerunner/*_test.go). - Scope: unit tests near behavior changes; table‑driven where it fits.
- Run locally:
go test ./...
Common Change Points
- Config fields: edit
runner/config.go, update parsing, defaults, and tests; reflect inREADME.mdandair_example.toml. - CLI flags: update
runner/flag.go, sync help text, and README usage. - Watcher behavior:
runner/watcher.go; add tests for edge cases (create/delete/move events, include/exclude rules). - Proxy/browser reload:
runner/proxy*.go; keep docs aligned with README’s proxy section.
Tooling and Commands
make init: installs tooling and pre‑commit hook.make check: runs formatting +golangci-lintviahack/check.sh.make build|install|ci: standard workflows.- Prefer
rgfor repository searches; keep file reads to small chunks.
Documentation
- Update
README.mdfor any user‑visible change (flags, config, examples). - Keep examples in
air_example.tomlaccurate when adding/removing fields. - Include concise migration notes in PRs when behavior changes.
PR & Commit Guidelines
- Commit messages: imperative, present tense, concise summary line.
- Include rationale and tradeoffs in the PR description.
- Link related issues; note breaking changes clearly.
For AI Coding Agents (Codex CLI)
- Planning: for multi‑step tasks, maintain an explicit plan and mark progress.
- Edits: use a single focused patch per logical change; prefer
apply_patch. - Preambles: briefly state what you’re about to do before running commands.
- Searches: prefer
rgand read files in ≤250‑line chunks. - Validation: run
make checkandgo test ./...to verify changes. - Scope control: avoid touching unrelated files; don’t reformat the repo wholesale.
- No external network: assume offline; do not add dependencies lightly.
Release Notes (maintainers)
- Follow the README “Release” section for tagging; CI performs builds.
Questions or uncertain scope? Open an issue or ask for clarification before implementing.