-
-
Notifications
You must be signed in to change notification settings - Fork 16
docs: consolidate contributor and architecture guidance #897
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 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 |
|---|---|---|
| @@ -1,75 +1,16 @@ | ||
| # html2rss-web AI Agent Instructions | ||
|
|
||
| ## Overview | ||
| This repository uses a centralized documentation structure. All AI agents (including Copilot, Gemini CLI, etc.) must follow the constraints and rules defined in the following files: | ||
|
|
||
| - Ruby web app that converts websites into RSS 2.0 feeds. | ||
| - Built with **Roda** backend + **Preact** frontend, using the **html2rss** gem (+ `html2rss-configs`). | ||
| - **Frontend:** Vite-built Preact UI, served alongside Ruby backend. | ||
| ## Canonical Documentation | ||
|
|
||
| ## Documentation website of core dependencies | ||
| - **Agent Constraints**: [AGENTS.md](../../AGENTS.md) (Execution rules, verification, and UI principles) | ||
| - **Contributor Guide**: [docs/README.md](../../docs/README.md) (Architecture, security, setup, and coding style) | ||
| - **Design System**: [docs/design-system.md](../../docs/design-system.md) (Visual and CSS rules) | ||
|
|
||
| Search these pages before using them. Find examples, plugins, UI components, and configuration options. | ||
| ## Quick Reference for Agents | ||
|
|
||
| ### Roda | ||
|
|
||
| 1. https://roda.jeremyevans.net/documentation.html | ||
|
|
||
| ### Preact & Vite | ||
|
|
||
| 1. https://preactjs.com/guide/v10/getting-started/ | ||
| 2. https://vite.dev/guide/ | ||
|
|
||
| ### html2rss | ||
|
|
||
| 1. If available, find source locally in: `../html2rss`. | ||
| 2. source code on github: https://github.com/html2rss/html2rss | ||
|
|
||
| ### Test and Linters | ||
|
|
||
| 1. https://docs.rubocop.org/rubocop/cops.html | ||
| 2. https://docs.rubocop.org/rubocop-rspec/cops_rspec.html | ||
| 3. https://rspec.info/features/3-13/rspec-expectations/built-in-matchers/ | ||
| 4. https://www.betterspecs.org/ | ||
|
|
||
| Fix rubocop `RSpec/MultipleExpectations` adding rspec tag `:aggregate_failures`. | ||
|
|
||
| ## Core Rules | ||
|
|
||
| - ✅ Organise Roda routes via dedicated modules (e.g. `Html2rss::Web::Routes::*`), keeping the main app class thin. | ||
| - ✅ Keep helper modules minimal: define entrypoints with `class << self` and push implementation helpers under `private`; avoid `module_function` unless mirroring existing conventions. | ||
| - ✅ Validate all inputs. Pass outbound requests through **SSRF filter**. | ||
| - ✅ Add caching headers where appropriate (`Rack::Cache`). | ||
| - ✅ Errors: friendly messages for users, detailed logging internally. | ||
| - ✅ **Frontend**: Use Preact components in `frontend/src/`. Keep it simple. | ||
| - ✅ **CSS**: Use the app-owned frontend styles in `frontend/src/styles/`. | ||
| - ✅ **Specs**: RSpec for Ruby, build tests for frontend. | ||
| - ✅ When a spec needs to tweak environment variables, wrap the example in `ClimateControl.modify` so state is restored automatically. | ||
|
|
||
| ## Don't | ||
|
|
||
| - ❌ Don't use Ruby's URI class or addressable gem directly. Strictly use `Html2rss::Url` only. | ||
| - ❌ Don't bypass SSRF filter or weaken CSP. | ||
| - ❌ Don't add databases, ORMs, or background jobs. | ||
| - ❌ Don't leak stack traces or secrets in responses. | ||
| - ❌ Don't reach into private API with `send(...)`; expose what you need at the module level instead. | ||
| - ❌ Don't modify `frontend/dist/` - it's generated by build process. | ||
| - ❌ NEVER expose the auth token a user provides. | ||
|
|
||
| ## Environment | ||
|
|
||
| - `RACK_ENV` – environment | ||
| - `AUTO_SOURCE_ENABLED`, `AUTO_SOURCE_USERNAME`, `AUTO_SOURCE_PASSWORD`, `AUTO_SOURCE_ALLOWED_ORIGINS` | ||
| - `HEALTH_CHECK_USERNAME`, `HEALTH_CHECK_PASSWORD` | ||
| - `SENTRY_DSN` (optional) | ||
|
|
||
| ### Verification Steps | ||
|
|
||
| - Run `ruby -c app.rb` to check syntax | ||
| - Run `bundle exec rspec` to verify tests | ||
| - Check `bundle install` removes unused dependencies | ||
|
|
||
| ## Style | ||
|
|
||
| - Add `# frozen_string_literal: true` | ||
| - Follow RuboCop style | ||
| - YARD doc comments for public methods | ||
| - **Environment**: All commands MUST run inside the Dev Container. | ||
| - **Verification**: Run `make ready` before any commit. | ||
| - **Security**: Follow strict [Security & Safety Rules](../../docs/README.md#security--safety-rules). | ||
| - **Style**: Follow [Architectural Constraints](../../docs/README.md#architectural-constraints) (YARD docs, Roda organization). | ||
|
gildesmarais marked this conversation as resolved.
Outdated
|
||
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 |
|---|---|---|
| @@ -1,84 +1,51 @@ | ||
| # Agent Workflow (Dev Container) | ||
| # Agent Workflow Constraints | ||
|
|
||
| ## Start the Dev Container | ||
|
|
||
| ```text | ||
| docker compose -f .devcontainer/docker-compose.yml up -d | ||
| ``` | ||
|
|
||
| ## Commands (run inside the container) | ||
|
|
||
| ```text | ||
| docker compose -f .devcontainer/docker-compose.yml exec -T app make setup | ||
|
|
||
| docker compose -f .devcontainer/docker-compose.yml exec -T app make dev | ||
|
|
||
| docker compose -f .devcontainer/docker-compose.yml exec -T app make test | ||
|
|
||
| docker compose -f .devcontainer/docker-compose.yml exec -T app make ready | ||
|
|
||
| docker compose -f .devcontainer/docker-compose.yml exec -T app bundle exec rubocop -F | ||
|
|
||
| docker compose -f .devcontainer/docker-compose.yml exec -T app bundle exec rspec | ||
| ``` | ||
|
|
||
| Pre-commit gate (required): | ||
|
|
||
| ```text | ||
| docker compose -f .devcontainer/docker-compose.yml exec -T app make ready | ||
| ``` | ||
|
|
||
| If you need an interactive shell: | ||
|
|
||
| ```text | ||
| docker compose -f .devcontainer/docker-compose.yml exec app bash | ||
| ``` | ||
|
|
||
| --- | ||
| This document defines execution constraints for AI agents. For general contributor rules, setup commands, architectural constraints, and security policies, see [docs/README.md](docs/README.md). | ||
|
|
||
| ## Collaboration Agreement (Agent ↔ User) | ||
|
|
||
| ## Interview Answers (ID-able) + Expert Recommendations | ||
|
|
||
| **DoD:** `make ready` in Dev Container; if applicable, user completes manual smoke test with agent-provided steps. | ||
| **Verification:** Always smoke Dev Container + `make ready`. | ||
| **Commits:** Group by logical unit after smoke-tested (feature / improvement / refactor). | ||
| **Responses:** Changes → Commands → Results → Next steps, ending with a concise one-line summary. | ||
| **KISS vs Refactor:** KISS by default; boy-scout refactors allowed if low-risk and simplifying. | ||
| **Ambiguity:** Proceed with safest assumption, then confirm. | ||
| **Non-negotiables:** Dev Container only; security first. | ||
|
|
||
| Expert recommendation: keep workflows terminal-first and keyboard-focused (clear commands, no GUI-only steps). | ||
| - **DoD:** `make ready` in Dev Container; if applicable, user completes manual smoke test with agent-provided steps. | ||
| - **Verification:** Always smoke Dev Container + `make ready`. | ||
| - **Commits:** Group by logical unit after smoke-tested (feature / improvement / refactor). | ||
| - **Responses:** Changes → Commands → Results → Next steps, ending with a concise one-line summary. | ||
| - **KISS vs Refactor:** KISS by default; boy-scout refactors allowed if low-risk and simplifying. | ||
| - **Ambiguity:** Proceed with safest assumption, then confirm. | ||
| - **Non-negotiables:** Dev Container only; security first. | ||
|
|
||
| ## Definition of Done | ||
|
|
||
| - Run `make ready` inside the Dev Container. | ||
| - If applicable, user completes manual smoke test; agent provides clear instructions. | ||
|
|
||
| ## Verification Rules | ||
| ## Agent-Specific Verification Rules | ||
|
|
||
| - Always run Dev Container smoke + `make ready` for changes. | ||
| - For frontend changes, also verify in `chrome-devtools` MCP at `http://127.0.0.1:4001/` while the Dev Container is running. | ||
| - Capture a quick state check for all affected UI states (e.g., guest/member/result) to enforce state parity and avoid duplicate actions. | ||
|
|
||
| ## Commit Granularity | ||
| ### Frontend Smoke Checklist | ||
|
|
||
| - Group commits by logical units after they have grown and been smoke-tested (feature / improvement / refactor). | ||
| - Start the Dev Container and app (`make dev`). | ||
| - Open `http://127.0.0.1:4001/` with `chrome-devtools` MCP. | ||
| - Validate the primary user path touched by the change. | ||
| - Verify all affected states (e.g., guest/member/result) keep the same layout grammar. | ||
| - Confirm action uniqueness: one canonical control per outcome in each state. | ||
|
|
||
| ## Response Format | ||
| ## UI Execution Principles | ||
|
|
||
| - Default: Changes → Commands → Results → Next steps. | ||
| - End with a concise one-line summary. | ||
| See [docs/design-system.md](docs/design-system.md) for visual rules. | ||
|
|
||
| ## KISS vs Refactor | ||
| - **Task Dominance:** Each UI state should make one user objective obvious and primary. Supporting surfaces and links must yield priority. | ||
| - **Copy Minimalism:** Remove text that repeats what the interface already communicates. Prefer action-oriented wording. | ||
| - **State Skeleton:** Adjacent UI states should read as the same frame with content changes, not as separate pages. | ||
| - **Focus Contract:** Verify browser autofocus and return-focus behavior on initial load and after transitions. | ||
| - **Support Compression:** When a user has advanced past setup, reduce the visual weight of support content. | ||
|
|
||
| - KISS by default. | ||
| - Boy-scout refactors are allowed when they reduce complexity and are low-risk. | ||
|
|
||
| ## Ambiguity Handling | ||
| ## Response Format | ||
|
|
||
| - Proceed with the safest assumption, then confirm. | ||
| 1. **Changes:** Briefly list files/symbols modified. | ||
| 2. **Commands:** Show the verification commands run. | ||
| 3. **Results:** Summarize the outcome. | ||
| 4. **Next steps:** Propose the immediate follow-up. | ||
| 5. **One-line Summary:** End with a concise summary. | ||
|
|
||
| ## Non-Negotiables | ||
|
|
||
| - Security first. | ||
| - YARD docs are strict for public Ruby methods in `app/`: every public method must have a YARD docstring with typed `@param` tags (for all params) and typed `@return`. | ||
| - When touching non-public methods, add YARD docs when it improves maintenance or clarifies invariants/edge handling. | ||
| - **Security first:** No leaking secrets or insecure patterns. See [Security & Safety Rules](docs/README.md#security--safety-rules). | ||
| - **YARD docs:** Strict for public Ruby methods in `app/`. Every public method must have a YARD docstring with typed `@param` and `@return`. See [Architectural Constraints](docs/README.md#architectural-constraints). | ||
| - **No host execution:** All commands MUST run inside the Dev Container via `make` or `bundle exec`. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.