Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ jobs:
id: go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.25
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
# Build golangci-lint from source with the configured Go version
install-mode: goinstall
version: latest
- name: Install dependency
run: if [ $(uname) == "Darwin" ]; then brew install gnu-sed ;fi
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.25

- name: Set GOVERSION
run: echo "GOVERSION=$(go version | sed -r 's/go version go(.*)\ .*/\1/')" >> $GITHUB_ENV
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/smoke_test_reuse_job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:
id: go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.25
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
install-mode: goinstall
version: latest
- name: Install
run: make install
- name: Check rebuild
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/smoke_test_reuse_job_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:
id: go
uses: actions/setup-go@v5
with:
go-version: ^1.24
go-version: ^1.25
- name: golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
install-mode: goinstall
version: latest
- name: Setup Python
uses: actions/setup-python@v5
with:
Expand Down
86 changes: 86 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# 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 by `hack/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` (see `runner/*_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 in `README.md` and `air_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-lint` via `hack/check.sh`.
- `make build|install|ci`: standard workflows.
- Prefer `rg` for repository searches; keep file reads to small chunks.

## Documentation

- Update `README.md` for any user‑visible change (flags, config, examples).
- Keep examples in `air_example.toml` accurate 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 `rg` and read files in ≤250‑line chunks.
- Validation: run `make check` and `go 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.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24 AS builder
FROM golang:1.25 AS builder

LABEL maintainer="Rick Yu <[email protected]>"

Expand All @@ -12,7 +12,7 @@ RUN --mount=type=cache,target=/go/pkg/mod go mod download

RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build make ci && make install

FROM golang:1.24
FROM golang:1.25

COPY --from=builder /go/bin/air /go/bin/air

Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ LDFLAGS += -X "main.airVersion=$(AIRVER)"
LDFLAGS += -X "main.goVersion=$(shell go version | sed -r 's/go version go(.*)\ .*/\1/')"

GO := GO111MODULE=on CGO_ENABLED=0 go
GOLANGCI_LINT_VERSION = v2.1.6
GOLANGCI_LINT_VERSION = v2.2.0
GOLANGCI_LINT_CURRENT := $(shell golangci-lint --version 2>/dev/null | sed -n 's/.*version \([0-9.]*\).*/v\1/p')

.PHONY: init
init: install-golangci-lint
Expand All @@ -15,9 +16,8 @@ init: install-golangci-lint

.PHONY: install-golangci-lint
install-golangci-lint:
ifeq (, $(shell which golangci-lintx))
@$(shell curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION))
endif
@echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)"
@GO111MODULE=on go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

.PHONY: setup
setup: init
Expand Down
4 changes: 2 additions & 2 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### `go install` を使う場合(推奨)

go 1.23以上を使う場合:
go 1.25以上を使う場合:

```bash
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -219,7 +219,7 @@ services:

```Dockerfile
# 1.16以上の利用したいバージョンを選択してください
FROM golang:1.23-alpine
FROM golang:1.25-alpine

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions README-zh_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### 使用 `go install` (推荐)

使用 go 1.23 或更高版本:
使用 go 1.25 或更高版本:

```shell
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -205,7 +205,7 @@ services:

```Dockerfile
# 选择你想要的版本,>= 1.16
FROM golang:1.23-alpine
FROM golang:1.25-alpine

WORKDIR /app

Expand Down
6 changes: 3 additions & 3 deletions README-zh_tw.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### 使用 `go install` (推薦)

需要使用 go 1.23 或更高版本:
需要使用 go 1.25 或更高版本:

```bash
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -72,7 +72,7 @@ curl -sSfL https://goblin.run/github.com/air-verse/air | PREFIX=/tmp sh

### 透過 `go install`

使用 go 1.18 或更高版本:
使用 go 1.25 或更高版本:

```bash
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -212,7 +212,7 @@ services:

```Dockerfile
# Choose whatever you want, version >= 1.16
FROM golang:1.21-alpine
FROM golang:1.25-alpine

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ air --build.cmd "go build -o bin/api cmd/run.go" --build.bin "./bin/api" --build

### Via `go install` (Recommended)

With go 1.23 or higher:
With go 1.25 or higher:

```bash
go install github.com/air-verse/air@latest
Expand Down Expand Up @@ -219,7 +219,7 @@ services:

```Dockerfile
# Choose whatever you want, version >= 1.16
FROM golang:1.23-alpine
FROM golang:1.25-alpine
WORKDIR /app
Expand Down
20 changes: 8 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module github.com/air-verse/air

go 1.24
go 1.25

require (
dario.cat/mergo v1.0.2
github.com/creack/pty v1.1.24
github.com/fatih/color v1.18.0
github.com/fsnotify/fsnotify v1.9.0
github.com/gohugoio/hugo v0.147.6
github.com/gohugoio/hugo v0.149.1
github.com/pelletier/go-toml v1.9.5
github.com/stretchr/testify v1.10.0
github.com/stretchr/testify v1.11.1
)

require (
Expand All @@ -21,19 +21,15 @@ require (
github.com/gobwas/glob v0.2.3 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/spf13/afero v1.14.0 // indirect
github.com/spf13/cast v1.8.0 // indirect
github.com/tdewolff/parse/v2 v2.8.1 // indirect
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
golang.org/x/image v0.27.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.25.0 // indirect
golang.org/x/tools v0.33.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
github.com/spf13/cast v1.9.2 // indirect
github.com/tdewolff/parse/v2 v2.8.3 // indirect
golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.28.0 // indirect
google.golang.org/protobuf v1.36.8 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading