-
Notifications
You must be signed in to change notification settings - Fork 5
Add AGENTS.md guidance #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adrian-rpf
wants to merge
2
commits into
main
Choose a base branch
from
add-agents-md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+76
−0
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # Project Overview | ||
| - Rails 7.1 monolith for the Raspberry Pi Code Editor API (REST + GraphQL), served at | ||
| `editor-api.raspberrypi.org`. Provides auth, project storage, and education features. | ||
| - Primary runtime via Docker; API listens on port 3009 in containers. | ||
|
|
||
| ## Repository Structure | ||
| - `app/` Rails application code (REST, GraphQL, jobs, views, admin). | ||
| - `config/` environment, initializers, Puma, CORS, credentials. | ||
| - `db/` migrations, seeds, schema helpers; `bin/db-sync/` for pulling Heroku data locally. | ||
| - `spec/` RSpec tests (Rails, GraphQL, feature/system). | ||
| - `bin/` developer scripts (`with-builder.sh`, `db-sync/*`, Rails binstubs). | ||
| - `lib/` supporting libraries, tasks, assets; `public/` static assets; `docker-compose.yml` | ||
| for local stack; `.circleci/` for CI; `.rubocop.yml` for style config. | ||
|
|
||
| ## Quickstart Commands | ||
| ```bash | ||
| cp .env.example .env | ||
| docker-compose build | ||
| docker compose run --rm api rails db:setup | ||
| docker-compose up | ||
| # API available on http://localhost:3009 | ||
| ``` | ||
|
|
||
| ## Development Workflow | ||
| - Prefer Docker compose; mounts project into `editor-api:builder` image with tmpfs for `tmp/`. | ||
| - Use `./bin/with-builder.sh <cmd>` for operations that modify Gemfile.lock (e.g. `bundle update`). | ||
| - Seeds (dev): `docker compose run --rm api rails projects:create_all` and | ||
| `docker compose run --rm api rails for_education:seed_a_school_with_lessons_and_students` | ||
| (others in README). | ||
| - DB sync (needs Heroku access): `./bin/db-sync/production-to-local.sh` or `staging-to-local.sh`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be encouraging agents to run this? |
||
| - Background jobs use GoodJob; Procfile defines `worker: bundle exec good_job start --max-threads=8`. | ||
|
|
||
| ## Testing & CI | ||
| - Full suite: `docker-compose run api rspec` | ||
| - Single spec: `docker-compose run api rspec spec/path/to/spec.rb` | ||
| - CI (CircleCI): Ruby 3.2 images with Postgres 12 + Redis; steps include `bin/rails db:setup --trace`, | ||
| `ruby/rspec-test`, RuboCop via `ruby/rubocop-check`, coverage artifacts uploaded and posted via | ||
| `.circleci/record_coverage`. | ||
|
|
||
| ## Code Style & Conventions | ||
| - Ruby 3.2.3 (specified as `~> 3.2.0` in Gemfile). | ||
| - RuboCop uses Raspberry Pi Foundation shared configs plus Rails/RSpec/GraphQL cops; many metrics and | ||
| line-length checks are relaxed. | ||
| - Variable numbers must be snake_case (allowed: `sha256`, `X-Hub-Signature-256`). | ||
| - Tests in RSpec (`spec/`), Jbuilder for JSON views, GraphQL types under `app/graphql/`. | ||
| - GoodJob for background processing; Puma configured via `config/puma.rb`; release hook runs migrations | ||
| then `rake projects:create_experience_cs_examples` (see Procfile). | ||
|
|
||
| ## Security & Safety Guardrails | ||
| - Never commit secrets: `.env`, `config/master.key`, AWS/Postmark tokens, Hydra/Profile secrets, | ||
| webhook secrets. Keep `.env.example` values as references only. | ||
| - DB sync scripts fetch production/staging data; run only if authorized and handle dumps securely. | ||
| - Generated/ignored paths: `log/`, `tmp/`, `storage/`, `coverage/`, `public/assets/`, `.bundle/`, | ||
| `docker-compose.override.yml` (gitignored); do not add noise from these. | ||
| - Webhooks and smee tunnel secrets live in env vars; avoid logging or sharing real values. | ||
|
|
||
| ## Common Tasks (add feature, add test, refactor, release/deploy if applicable) | ||
| - Run app locally: ensure `.env`, then `docker-compose up` (build + `rails db:setup` first). | ||
| - Lint: `docker-compose run --rm api bundle exec rubocop` (mirrors CI RuboCop check). | ||
| - Migrate: `docker compose run --rm api rails db:migrate` (release hook also migrates). | ||
| - Update gems: `./bin/with-builder.sh bundle update` (keeps builder image and lockfiles in sync). | ||
| - Seed dev data: commands in README (e.g. `rails projects:create_all`, | ||
| `rails for_education:seed_a_school_with_lessons_and_students`). | ||
| - Sync DB from Heroku: `./bin/db-sync/production-to-local.sh` or `staging-to-local.sh` (requires Heroku | ||
| CLI + app access). | ||
| - Release/deploy: Procfile release runs migrations then `rake projects:create_experience_cs_examples`; | ||
| confirm platform/trigger before running manually. > TODO: document official deploy pipeline and branch | ||
| triggers. | ||
|
|
||
| ## Further Reading (relative links) | ||
| - `README.md` | ||
| - `.circleci/config.yml` | ||
| - `.rubocop.yml` | ||
| - `.env.example` | ||
| - `Procfile` | ||
| - `bin/db-sync/load-local-db.sh` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same as below) - should be be encouraging agents to run
bin/db-sync/?