Skip to content

Commit 548baef

Browse files
dblockCopilotericproulx
authored
Add AGENTS.md to please our future A.I. overlords (#2675)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Eric Proulx <playmaverick@gmail.com>
1 parent d0c0ea4 commit 548baef

2 files changed

Lines changed: 72 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# AI Agent Instructions
2+
3+
## Starting Work
4+
5+
Before creating a new branch, always sync and clean up:
6+
7+
```
8+
git checkout master
9+
git pull upstream master
10+
git branch --merged master | grep -v '^\* \|^ master$' | xargs -r git branch -d
11+
```
12+
13+
## After Making Code Changes
14+
15+
Always run before committing:
16+
17+
```
18+
bundle exec rake
19+
```
20+
21+
This runs RuboCop and the full RSpec suite. If RuboCop reports offenses, fix them with `bundle exec rubocop -a` then re-run.
22+
23+
For code you write, fix RuboCop offenses directly rather than adding them to `.rubocop_todo.yml`. If a fix is non-trivial, it is acceptable to run `bundle exec rubocop --auto-gen-config` to update the todo file instead.
24+
25+
## Tests
26+
27+
- Tests live in `spec/grape/` and use RSpec.
28+
- Add tests for all new features and bug fixes in the appropriate `spec/grape/` subdirectory.
29+
- Run a single spec file with `bundle exec rspec spec/path/to/file_spec.rb`.
30+
- Run the full RSpec suite with `bundle exec rspec`.
31+
- The test suite uses `rack-test` for HTTP-level specs. Include `Rack::Test::Methods` and define `app` in specs that need it.
32+
33+
## Changelog
34+
35+
Update [CHANGELOG.md](CHANGELOG.md) for every user-facing change. Add a line under `#### Features` or `#### Fixes` in the current unreleased section at the top, in this format:
36+
37+
```
38+
* [#PR](https://github.com/ruby-grape/grape/pull/PR): Description of change - [@username](https://github.com/username).
39+
```
40+
41+
Use a placeholder PR number when the PR is not yet open; update it after opening. The entry for "Your contribution here." must remain as the last line in each section.
42+
43+
## UPGRADING.md
44+
45+
Update [UPGRADING.md](UPGRADING.md) when introducing a **breaking change or behavior change** that users will need to act on when upgrading. Add a subsection under the current version heading (e.g. `### Upgrading to >= 3.2.0`), describing what changed and how to adapt.
46+
47+
## Code Style
48+
49+
- Ruby style is enforced via RuboCop (`.rubocop.yml`), with pinned gem versions in `Gemfile`.
50+
- Run `bundle exec rubocop` to check and `bundle exec rubocop -a` to auto-fix.
51+
- Frozen string literals are required in all files (`# frozen_string_literal: true`).
52+
- Minimum Ruby version is 3.2.
53+
54+
## Commits and PRs
55+
56+
- Never push directly to master — always work on a branch and open a PR targeting `ruby-grape/grape master`.
57+
- One logical commit per PR; squash before merging.
58+
- PR titles and commit messages should be clear and imperative (e.g. "Fix UnknownAuthStrategy when subclassing Auth::Base").
59+
- Reference the related issue in the commit message and PR description (e.g. `Fixes #1234`).
60+
61+
## Gem Dependencies
62+
63+
Core runtime dependencies are declared in `grape.gemspec`. Development and test dependencies are in `Gemfile`. Do not add new runtime dependencies without discussion; prefer what is already available (ActiveSupport, dry-types, Rack).
64+
65+
## Multiple Gemfile Variants
66+
67+
The `gemfiles/` directory contains alternate Gemfiles for testing against different Rack and Rails versions. CI runs against all of them. When fixing compatibility issues, test locally with:
68+
69+
```
70+
BUNDLE_GEMFILE=gemfiles/rack_3_2.gemfile bundle exec rspec
71+
```

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [#2670](https://github.com/ruby-grape/grape/pull/2670): Added support for Rack 3.2.6 and better handling to rack exceptions - [@ericproulx](https://github.com/ericproulx).
1414
* [#2671](https://github.com/ruby-grape/grape/pull/2671): Use ruby 3.1 shorthand kwargs syntax - [@ericproulx](https://github.com/ericproulx).
1515
* [#2672](https://github.com/ruby-grape/grape/pull/2672): Minor ruby optimizations - [@ericproulx](https://github.com/ericproulx).
16+
* [#2675](https://github.com/ruby-grape/grape/pull/2675): Add `AGENTS.md` to please our future A.I. overlords - [@dblock](https://github.com/dblock).
1617
* Your contribution here.
1718

1819
#### Fixes

0 commit comments

Comments
 (0)