Skip to content

Commit c7cc4de

Browse files
authored
Merge pull request #1 from AeonDave/create-agents.md-file
Refine GoAhead agent guidelines
2 parents e19077f + 40edb3d commit c7cc4de

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

AGENTS.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# GoAhead Agents Guide
2+
3+
This document directs AI contributors working in the GoAhead repository.
4+
5+
## Repository Overview
6+
7+
- `go.mod`: Declares the `github.com/AeonDave/goahead` module targeting Go 1.21.
8+
- `main.go`: Command-line entry point that orchestrates toolexec or standalone execution.
9+
- `internal/`: Core library for code generation, toolexec integration, and helper execution.
10+
- `examples/`: Minimal projects demonstrating how to invoke GoAhead during builds.
11+
- `test/`: Integration and unit tests covering filters, helper execution, and code generation outputs.
12+
- `Makefile`: Convenience targets mirroring common Go toolchain commands.
13+
- `README.md`: Usage overview, installation instructions, and quick-start guide.
14+
15+
## Coding Standards
16+
17+
- Write Go 1.21-compatible code and stick to the standard library unless an exception is documented.
18+
- Run `gofmt` on any touched Go source; keep imports grouped and sorted.
19+
- Prefer explicit error handling over panics in library code and return contextual errors (`fmt.Errorf` with `%w`).
20+
- Maintain deterministic behaviour: helper execution and code rewriting should be reproducible for identical inputs.
21+
- Keep functions focused; extract reusable utilities into the `internal` package when they span multiple entry points.
22+
23+
## Implementation Notes
24+
25+
- `internal/` packages should remain side-effect free at import time and expose explicit constructors (e.g., `NewToolexecManager`).
26+
- Preserve marker comment conventions (`//go:ahead ...`, `//:helperName:arg`) when transforming source files.
27+
- When extending CLI flags, wire them through `internal.Config` so both standalone and toolexec modes remain aligned.
28+
- Extend `test/` with unit or integration coverage alongside any behaviour changes; create descriptive subdirectories for fixtures when needed.
29+
30+
## Testing
31+
32+
Run Go test commands from the repository root:
33+
34+
```bash
35+
go test ./... # Full suite
36+
go test ./internal/... # Package-level checks for core logic
37+
go test ./test/... # Integration-focused tests
38+
```
39+
40+
Use `go test -race ./...` when modifying concurrent code or file processing pipelines.
41+
42+
## Pre-Submission Checks
43+
44+
Before opening a pull request, execute:
45+
46+
```bash
47+
go vet ./... # Static analysis
48+
go build ./... # Ensure binaries compile
49+
```
50+
51+
Include any additional project-specific scripts (e.g., `make test`, `make lint`) if they become relevant to your change.
52+
53+
## Pull Request Expectations
54+
55+
- Summarise behavioural changes, highlighting impacts on code generation, CLI flags, or helper execution.
56+
- Document user-facing updates in `README.md` or example projects when behaviour shifts.
57+
- Ensure new helpers or transformations include regression tests and, where necessary, example coverage.

0 commit comments

Comments
 (0)