azeroth 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -10
  3. data/.claude/agents/architect.md +55 -0
  4. data/.claude/agents/docs.md +38 -0
  5. data/.claude/agents/ruby.md +48 -0
  6. data/.claude/agents/security.md +27 -0
  7. data/.claude/configuration/auto-fix-all.json +3 -0
  8. data/.claude/scripts/check_ruby.sh +8 -0
  9. data/.github/commit_message_template.md +8 -0
  10. data/.github/copilot-instructions.md +1 -70
  11. data/.github/pull_request_template.md +17 -0
  12. data/.gitignore +1 -0
  13. data/AGENTS.md +103 -0
  14. data/CLAUDE.md +1 -0
  15. data/Dockerfile +2 -2
  16. data/Gemfile +20 -17
  17. data/README.md +8 -8
  18. data/azeroth.gemspec +3 -3
  19. data/azeroth.jpg +0 -0
  20. data/docs/agents/architecture.md +79 -0
  21. data/docs/agents/contributing.md +195 -0
  22. data/docs/agents/flow.md +5 -0
  23. data/docs/agents/folder-structure.md +43 -0
  24. data/docs/agents/issue-enhancement.md +10 -0
  25. data/docs/agents/issues/.gitkeep +1 -0
  26. data/docs/agents/plans/.gitkeep +1 -0
  27. data/docs/guides/azeroth/basic-usage.md +66 -0
  28. data/docs/guides/azeroth/best-practices.md +9 -0
  29. data/docs/guides/azeroth/decorators.md +58 -0
  30. data/docs/guides/azeroth/installation.md +15 -0
  31. data/docs/guides/azeroth/model-for.md +40 -0
  32. data/docs/guides/azeroth/resource-for-options.md +64 -0
  33. data/docs/guides/azeroth/testing.md +30 -0
  34. data/docs/guides/azeroth-usage.md +28 -0
  35. data/lib/azeroth/version.rb +1 -1
  36. data/scripts/bump_version.sh +62 -0
  37. data/spec/dummy/bin/setup +1 -2
  38. data/spec/dummy/bin/update +1 -2
  39. data/spec/dummy/db/schema.rb +2 -2
  40. metadata +35 -13
  41. data/.github/azeroth-usage.md +0 -277
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3abf116f0ed9063b02d06bba4bcedee4ec48036aaaf2a86238a5b4fcfe32b804
4
- data.tar.gz: ba519353edc46b56834662db662a650b1bfddbbd3d10a3726b42aadb343fec73
3
+ metadata.gz: 808f17ce9b575ec1ba0d1d5233420fde1cd27e99fd74113623ee45694d405360
4
+ data.tar.gz: bed29be49992b47d86207a92bb36d7e3f6b67100b2c9f3f35ca9f3d4e4ac4927
5
5
  SHA512:
6
- metadata.gz: 181f6a5e4f0caf6a4d7e1e383956aad1b7cd34fccb3b30586e5d39e920de143ba5a1fd4dde681f3db368a39badbf9d3eb53ca3fc77e3e719927c8fd00c5043cf
7
- data.tar.gz: 41baee7b1b1f00fe82a32da29ccd4c38470e504855a6036c56e28db51d04c3335a40a76c68b84cf2b266045d88c6d685f941fbd66370dd1763e8b671e51ed13d
6
+ metadata.gz: 148e0754dc25fc4dc3490ad87979f831cfdbff05e96108ba30233f114e64786486eb82525b4310322b25381917eeafa353b8a56e922e02c38f5e29ac698cd453
7
+ data.tar.gz: 801c4e31cf9358bb23871b1278a53f3cd74e87e826ff390fb0568a5702182a7ba420ef6e92d76d8d76cb1b7d9a7c7de31a997f929f054ed5855c4806b51c1ef1
data/.circleci/config.yml CHANGED
@@ -1,6 +1,5 @@
1
- version: 2
1
+ version: 2.1
2
2
  workflows:
3
- version: 2
4
3
  test-and-build:
5
4
  jobs:
6
5
  - test:
@@ -11,18 +10,23 @@ workflows:
11
10
  filters:
12
11
  tags:
13
12
  only: /.*/
13
+ - coverage-final:
14
+ requires: [test]
15
+ filters:
16
+ tags:
17
+ only: /.*/
14
18
  - build-and-release:
15
- requires: [test, checks]
19
+ requires: [test, checks, coverage-final]
16
20
  filters:
17
21
  tags:
18
22
  only: /\d+\.\d+\.\d+/
19
23
  branches:
20
24
  only:
21
- - main
25
+ - master
22
26
  jobs:
23
27
  test:
24
28
  docker:
25
- - image: darthjee/circleci_rails_gems:2.1.1
29
+ - image: darthjee/circleci_ruby_3412:1.0.0
26
30
  environment:
27
31
  PROJECT: azeroth
28
32
  steps:
@@ -32,13 +36,20 @@ jobs:
32
36
  command: bundle install
33
37
  - run:
34
38
  name: RSpec
35
- command: bundle exec rspec
39
+ command: CI=true bundle exec rspec
40
+ - run:
41
+ name: Upload coverage to Codacy (partial)
42
+ command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report --partial -r coverage/lcov/project.lcov
43
+ coverage-final:
44
+ docker:
45
+ - image: darthjee/circleci_ruby_3412:1.0.0
46
+ steps:
36
47
  - run:
37
- name: Upload coverage to Codacy
38
- command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov/project.lcov
48
+ name: Finalize coverage on Codacy
49
+ command: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
39
50
  checks:
40
51
  docker:
41
- - image: darthjee/circleci_rails_gems:2.1.1
52
+ - image: darthjee/circleci_ruby_3412:1.0.0
42
53
  environment:
43
54
  PROJECT: azeroth
44
55
  steps:
@@ -63,7 +74,7 @@ jobs:
63
74
  command: check_specs
64
75
  build-and-release:
65
76
  docker:
66
- - image: darthjee/circleci_rails_gems:2.1.1
77
+ - image: darthjee/circleci_ruby_3412:1.0.0
67
78
  environment:
68
79
  PROJECT: azeroth
69
80
  steps:
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: architect
3
+ description: Azeroth architect and coordinator. Use for cross-cutting tasks, multi-agent coordination, build/CI/release configuration, or any task that spans more than one agent's scope.
4
+ tools: Read, Edit, Write, Bash, Agent
5
+ ---
6
+
7
+ You are the architect and coordinator for the Azeroth project — a Ruby gem that simplifies the creation of Rails controller endpoints via `resource_for` and `Azeroth::Decorator`.
8
+
9
+ ## Your scope
10
+
11
+ Everything not owned by a specialist agent:
12
+
13
+ - `Gemfile`, `Gemfile.lock`, `azeroth.gemspec`, `Rakefile`, `Makefile`
14
+ - `Dockerfile`, `docker-compose.yml`
15
+ - `.circleci/config.yml`
16
+ - `.rubocop.yml`, `.rubocop_todo.yml`
17
+ - `config/` (`check_specs.yml`, `rubycritc.rb`, `yardstick.rb`, `yardstick.yml`)
18
+ - `bin/` (executable scripts, e.g. `bin/test`)
19
+ - `LICENSE`, `.gitignore`, `azeroth.jpg`
20
+ - Generated report directories (`doc/`, `measurement/`, `rubycritic/`, `coverage/`, `.yardoc/`) — not hand-edited, but you decide what to do with build/tooling issues around them
21
+ - Cross-cutting decisions that span `ruby` and/or `docs`
22
+ - Coordination of the other specialist agents
23
+
24
+ ## Specialist agents
25
+
26
+ Delegate implementation work to the right agent. Never implement what belongs to a specialist yourself.
27
+
28
+ | Agent | Scope |
29
+ |-------|-------|
30
+ | `ruby` | `lib/`, `spec/` — gem source, tests, and inline YARD docs |
31
+ | `docs` | `docs/agents/`, `README.md`, `AGENTS.md`, `CLAUDE.md`, `.github/*.md` — all prose documentation |
32
+ | `security` | Read-only, whole repo — flags security concerns, does not fix |
33
+
34
+ ## How to coordinate
35
+
36
+ When a task spans multiple agents:
37
+
38
+ 1. **Break it down** — identify which parts belong to which agent.
39
+ 2. **Sequence or parallelize** — if agents' outputs are independent, run them in parallel; if one depends on the other, sequence them.
40
+ 3. **Integrate** — after specialist agents finish, verify cross-cutting concerns (e.g. a `lib/` change that needs a version bump in `lib/azeroth/version.rb` or a CI update).
41
+ 4. **Delegate doc updates** — if an architectural change needs `docs/agents/` updated, ask the `docs` agent to do it rather than editing it yourself.
42
+ 5. **Consult `security` early** on anything touching `instance_eval`/`send`/`public_send` in `controller_interface.rb`, or dependency updates.
43
+
44
+ ## Documentation (`docs/agents/`)
45
+
46
+ | File | Contents |
47
+ |------|----------|
48
+ | [Folder Structure](../../docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
49
+ | [Architecture](../../docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
50
+ | [Contributing](../../docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
51
+ | [Flow](../../docs/agents/flow.md) | Main runtime flow of the application. |
52
+ | [Plans](../../docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
53
+ | [Issues](../../docs/agents/issues/) | Detailed specs for open issues. |
54
+
55
+ Keep this table's targets accurate. When a new agent is created or its scope changes, ask the `docs` agent to update `AGENTS.md` and `docs/agents/`, and update this file yourself.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: docs
3
+ description: Azeroth documentation specialist. Use for any task involving docs/agents/, README.md, AGENTS.md, CLAUDE.md, or .github/*.md templates and usage guides.
4
+ tools: Read, Edit, Write
5
+ ---
6
+
7
+ You are the documentation specialist for the Azeroth project — a Ruby gem that simplifies the creation of Rails controller endpoints.
8
+
9
+ ## Your scope
10
+
11
+ You own all prose documentation, wherever it lives:
12
+
13
+ - `docs/agents/` — architecture, folder-structure, flow, contributing, issue-enhancement, plans/, issues/
14
+ - `docs/guides/` — user-facing usage guides, including `azeroth-usage.md` (and its `azeroth/` split files) meant to be copied into consumer projects
15
+ - `README.md`
16
+ - `AGENTS.md`, `CLAUDE.md`
17
+ - `.github/copilot-instructions.md`, `.github/pull_request_template.md`, `.github/commit_message_template.md`
18
+ - `.github/jace-usage.md`, `.github/core_ext-usage.md`, `.github/active_ext-usage.md` — dependency usage guides
19
+
20
+ Do NOT touch `lib/` or `spec/` (including inline YARD comments) — that belongs to the `ruby` agent. Do NOT touch Gemfile, gemspec, Rakefile, Dockerfiles, or CI config — that belongs to the `architect` agent. Generated docs under `doc/` (YARD build output) are not yours to hand-edit.
21
+
22
+ ## Stack
23
+
24
+ - Markdown
25
+ - YARD-generated API docs live under `doc/` (generated — do not hand-edit; source is inline comments in `lib/`, owned by `ruby`)
26
+
27
+ ## Commands
28
+
29
+ No automated lint/test command exists for documentation in this project. Review changes by reading them for accuracy against the current code and keeping cross-links (e.g. the `## Documentation` table in `AGENTS.md`) up to date.
30
+
31
+ ## Conventions
32
+
33
+ - All documentation must be written in **English**.
34
+ - Keep `docs/agents/folder-structure.md`, `architecture.md`, and `contributing.md` in sync with the actual codebase.
35
+ - If a `docs/agents/*.md` file grows too large, split it into a same-named folder with linked sub-files (e.g. `docs/agents/flow/` linked from `docs/agents/flow.md`) instead of letting one file grow unbounded.
36
+ - Keep the `## Documentation` table in `AGENTS.md` in sync with the files that exist under `docs/agents/`.
37
+ - Keep the dependency usage guides (`jace-usage.md`, `core_ext-usage.md`, `active_ext-usage.md`) in sync with how those gems are actually used in `lib/` — verify with the `ruby` agent or by reading `lib/` yourself before editing.
38
+ - Keep `docs/guides/azeroth-usage.md` and its split files under `docs/guides/azeroth/` in sync with how `resource_for`/`model_for`/`Azeroth::Decorator` actually behave in `lib/` — verify with the `ruby` agent or by reading `lib/` yourself before editing. Cross-links between these files must stay relative (no leading `/`), since the guide is meant to be copied as a unit into other projects.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: ruby
3
+ description: Azeroth Ruby specialist. Use for any task involving lib/, spec/, or inline YARD documentation.
4
+ tools: Read, Edit, Write, Bash
5
+ ---
6
+
7
+ You are the Ruby specialist for the Azeroth project — a Ruby gem that simplifies the creation of Rails controller endpoints, generating `create`/`show`/`index`/`update`/`delete`/`edit` action methods via `resource_for`, and controlling JSON serialization via `Azeroth::Decorator`.
8
+
9
+ ## Your scope
10
+
11
+ You own everything inside `lib/` and `spec/`, including inline YARD doc-comments within `lib/` source files:
12
+
13
+ - `lib/azeroth.rb` and `lib/azeroth/**` — gem source code
14
+ - `spec/**` — RSpec test suite (unit specs under `spec/lib/`, controller/integration specs, `spec/dummy` Rails host app, `spec/support`)
15
+
16
+ Do NOT touch `docs/agents/`, `README.md`, `AGENTS.md`, `CLAUDE.md`, `.github/*.md`, or any file outside `lib/`/`spec/` — those belong to the `docs` agent. Do NOT touch Gemfile, gemspec, Rakefile, Dockerfiles, CI config, or `config/` tooling files — those belong to the `architect` agent.
17
+
18
+ ## Stack
19
+
20
+ - Ruby (3.3 target), Rails (controller/routing integration), ActiveSupport
21
+ - [sinclair](https://github.com/darthjee/sinclair) for method building and options
22
+ - [jace](https://github.com/darthjee/jace) for event-driven lifecycle hooks (see `.github/jace-usage.md`)
23
+ - [darthjee-core_ext](https://github.com/darthjee/core_ext) / [darthjee-active_ext](https://github.com/darthjee/active_ext) for core/ActiveRecord extensions
24
+ - RSpec for tests, FactoryBot for fixtures
25
+ - RuboCop for linting
26
+ - YARD / Yardstick for inline documentation and doc-coverage
27
+
28
+ ## Commands
29
+
30
+ ```bash
31
+ bundle exec rspec
32
+ rubocop
33
+ bundle exec rake verify_measurements
34
+ bundle exec check_specs
35
+ ```
36
+
37
+ ## Conventions
38
+
39
+ - Follow **Sandi Metz's "99 Bottles of OOP"** principles: small, well-named, single-responsibility methods; high cohesion, low coupling.
40
+ - Respect the **Law of Demeter** — avoid chaining method calls across object boundaries.
41
+ - Prefer composition over inheritance.
42
+ - Document all public methods and classes with **YARD** doc-comments, including `@api public`/`@api private` visibility tags (doc coverage threshold: 96.5%, enforced via `config/yardstick.yml`).
43
+ - **Tests are mandatory** for all code changes — every new class, module, or method needs specs under `spec/`. Files without coverage must be listed in `config/check_specs.yml` under `ignore:`.
44
+ - New options added to `resource_for`/`model_for` must be documented and covered by integration specs (`spec/integration/`).
45
+ - **Maintain backward compatibility** when modifying existing public APIs.
46
+ - Public methods before private methods within a class.
47
+ - One class/module per file, file named in snake_case matching the class/module name (see `docs/agents/contributing.md`).
48
+ - All PRs, comments, and code must be written in **English**.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: security
3
+ description: Azeroth security reviewer. Read-only advisory agent — use to flag security concerns anywhere in the repo. Does not fix issues itself.
4
+ tools: Read, Grep, Glob, Bash
5
+ ---
6
+
7
+ You are the security reviewer for the Azeroth project — a Ruby gem that simplifies the creation of Rails controller endpoints.
8
+
9
+ ## Your scope
10
+
11
+ You review the **entire repository**, read-only. You do not own any files and must never edit or write code — your job is to identify and clearly report security concerns to the `architect` or the relevant specialist agent (`ruby` or `docs`), who will decide how to address them.
12
+
13
+ Pay particular attention to:
14
+
15
+ - Dynamic dispatch and eval: `lib/azeroth/controller_interface.rb` (`instance_eval`, `send`) and any other `send`/`public_send` call sites (`request_handler/`, `decorator/key_value_extractor.rb`) — check whether request-controlled input (params, model attribute names) can reach them.
16
+ - Mass-assignment surface: how `resource_for`-generated `create`/`update` actions build permitted params (`params_builder.rb`) — confirm attacker-controlled params can't widen beyond declared attributes.
17
+ - Dependency risk: `Gemfile`, `Gemfile.lock`, `azeroth.gemspec` — outdated or known-vulnerable gem versions (`sinclair`, `jace`, `darthjee-core_ext`, `darthjee-active_ext`, Rails/ActiveRecord).
18
+ - CI/release secrets handling in `.circleci/config.yml` and `build_gem.sh`-style release steps (`build-and-release` job).
19
+
20
+ ## Commands
21
+
22
+ No security-scanning gem (e.g. `bundler-audit`) is currently in the `Gemfile`. Perform manual review: `grep`/`Read` for risky patterns and cross-check dependency versions in `Gemfile.lock` by eye. If recurring findings would benefit from an automated scanner, report that as a recommendation to `architect` rather than adding the dependency yourself.
23
+
24
+ ## Conventions
25
+
26
+ - Report findings, don't fix them — you have no `Edit`/`Write` tools by design.
27
+ - For each finding: cite the file/line, describe the concrete risk (not just "this looks unsafe"), and suggest which agent should own the fix.
@@ -0,0 +1,3 @@
1
+ {
2
+ "ignored_check_patterns": ["Codacy"]
3
+ }
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ set -x
4
+
5
+ bundle exec rspec
6
+ rubocop
7
+ bundle exec rake verify_measurements
8
+ bundle exec check_specs
@@ -0,0 +1,8 @@
1
+ <type>(<scope>): <subject> (issue #<id>)
2
+
3
+ <optional body: what was done and why, if not obvious>
4
+
5
+ Addresses-Comment: <optional: URL of the PR comment this commit addresses>
6
+
7
+ Co-Authored-By: <AI model name> <AI model email>
8
+ Co-Authored-By: <agent> agent <AI model email>
@@ -1,70 +1 @@
1
- # GitHub Copilot Instructions for Azeroth
2
-
3
- ## Project Overview
4
-
5
- Azeroth is a Ruby gem that simplifies the creation of Rails controller endpoints. The main feature is the `resource_for` method, which automatically generates controller action methods (`create`, `show`, `index`, `update`, `delete`, `edit`) and handles both HTML and JSON request formats transparently.
6
-
7
- ## Language Requirements
8
-
9
- - All pull requests, comments, documentation, and code must be written in **English**.
10
-
11
- ## Testing Requirements
12
-
13
- - **Tests are mandatory** for all code changes.
14
- - Every new class, module, or method must have corresponding specs under `spec/`.
15
- - Files without test coverage must be listed in `config/check_specs.yml` under the `ignore:` key.
16
- - Use RSpec for all tests, following the conventions already established in the `spec/` directory.
17
- - Ensure comprehensive test coverage for new features and changes, including edge cases.
18
-
19
- ## Documentation Requirements
20
-
21
- - Use **YARD** format for all documentation.
22
- - Document all public methods, classes, and modules with:
23
- - A summary line (single-line, ending with a period).
24
- - `@param` tags for each parameter.
25
- - `@return` tag describing the return value.
26
- - `@example` tags showing representative usage where appropriate.
27
- - `@api public` or `@api private` tags to mark visibility.
28
- - Documentation coverage is enforced via `config/yardstick.yml` (threshold: 96.5%).
29
-
30
- ## Code Style and Design Principles
31
-
32
- - Follow the principles from **Sandi Metz's "99 Bottles of OOP"**:
33
- - Prefer small, well-named methods with a single responsibility.
34
- - Avoid large, complex methods—break them into smaller, well-defined ones.
35
- - Aim for high cohesion and low coupling between classes.
36
- - Respect the **Law of Demeter**: avoid chaining method calls across object boundaries.
37
- - Keep classes focused; a class should do one thing and do it well.
38
- - Prefer composition over inheritance where possible.
39
- - Follow the **RuboCop** rules configured in `.rubocop.yml` (Ruby 3.3 target).
40
-
41
- ## Project-Specific Guidelines
42
-
43
- - The gem is a **Rails** extension—follow Rails conventions and best practices.
44
- - The core abstraction is `Azeroth::Resourceable` (mixed into controllers via `include Azeroth::Resourceable`), which exposes the `resource_for` class method.
45
- - `Azeroth::Decorator` is used to control JSON serialization; use `expose` to declare which attributes are rendered.
46
- - **Maintain backward compatibility** when modifying existing public APIs.
47
- - Pagination is opt-in via `paginated: true` on `resource_for`; respect the `per_page` option and the pagination response headers (`pages`, `per_page`, `page`).
48
- - New options added to `resource_for` or `model_for` must be documented and covered by integration specs (see `spec/integration/`).
49
-
50
- ## Using dependencies
51
-
52
- ### Using Jace for Event-Driven Hooks
53
-
54
- Azeroth uses the [jace](https://github.com/darthjee/jace) gem to provide event-driven lifecycle hooks around controller actions. Refer to [`.github/jace-usage.md`](.github/jace-usage.md) for the full Jace API reference and usage patterns.
55
-
56
- Key points when working with Jace inside Azeroth:
57
-
58
- - Use `Jace::Registry` to register and trigger events.
59
- - Register handlers with `registry.register(event, instant = :after, &block)`, where `instant` is `:before` or `:after`.
60
- - Trigger events with `registry.trigger(event, context, &block)`; `:before` and `:after` handlers are `instance_eval`'d in `context`, while the main block is called in the surrounding scope.
61
- - Triggering an event with no registered handlers is safe—the main block still runs.
62
-
63
-
64
- ### Using darthjee-core_ext for extending core classes
65
-
66
- Azeroth uses the [darthjee-core_ext](https://github.com/darthjee/core_ext) gem to extend core Ruby classes with additional methods. Refer to [`.github/core_ext-usage.md`](.github/core_ext-usage.md) for the full list of available extensions and usage examples.
67
-
68
- ### Using darthjee-active_ext for extending active record and active support classes
69
-
70
- Azeroth uses the [darthjee-active_ext](https://github.com/darthjee/active_ext) gem to extend Active Record and Active Support classes with additional methods. Refer to [`.github/active_ext-usage.md`](.github/active_ext-usage.md) for the full list of available extensions and usage examples.
1
+ See [AGENTS.md](../AGENTS.md) for project instructions.
@@ -0,0 +1,17 @@
1
+ ## Summary
2
+
3
+ <!-- One sentence describing what this PR does -->
4
+
5
+ ## Problem
6
+
7
+ <!-- What problem does this solve? Why is this change needed? -->
8
+
9
+ ## Solution
10
+
11
+ <!-- How was the problem solved? What approach was taken? -->
12
+
13
+ ## Details
14
+
15
+ <!-- Optional: implementation notes, migration steps, caveats. Remove this section if not needed. -->
16
+
17
+ Fixes #
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ spec/dummy/db/*.sqlite3
14
14
  spec/dummy/db/*.sqlite3-journal
15
15
  spec/dummy/db/*.sqlite3-shm
16
16
  spec/dummy/db/*.sqlite3-wal
17
+ .claude/state
data/AGENTS.md ADDED
@@ -0,0 +1,103 @@
1
+ # GitHub Copilot Instructions for Azeroth
2
+
3
+ ## Project Overview
4
+
5
+ Azeroth is a Ruby gem that simplifies the creation of Rails controller endpoints. The main feature is the `resource_for` method, which automatically generates controller action methods (`create`, `show`, `index`, `update`, `delete`, `edit`) and handles both HTML and JSON request formats transparently.
6
+
7
+ ## Language Requirements
8
+
9
+ - All pull requests, comments, documentation, and code must be written in **English**.
10
+
11
+ ## Testing Requirements
12
+
13
+ - **Tests are mandatory** for all code changes.
14
+ - Every new class, module, or method must have corresponding specs under `spec/`.
15
+ - Files without test coverage must be listed in `config/check_specs.yml` under the `ignore:` key.
16
+ - Use RSpec for all tests, following the conventions already established in the `spec/` directory.
17
+ - Ensure comprehensive test coverage for new features and changes, including edge cases.
18
+
19
+ ## Documentation Requirements
20
+
21
+ - Use **YARD** format for all documentation.
22
+ - Document all public methods, classes, and modules with:
23
+ - A summary line (single-line, ending with a period).
24
+ - `@param` tags for each parameter.
25
+ - `@return` tag describing the return value.
26
+ - `@example` tags showing representative usage where appropriate.
27
+ - `@api public` or `@api private` tags to mark visibility.
28
+ - Documentation coverage is enforced via `config/yardstick.yml` (threshold: 96.5%).
29
+
30
+ ## Code Style and Design Principles
31
+
32
+ - Follow the principles from **Sandi Metz's "99 Bottles of OOP"**:
33
+ - Prefer small, well-named methods with a single responsibility.
34
+ - Avoid large, complex methods—break them into smaller, well-defined ones.
35
+ - Aim for high cohesion and low coupling between classes.
36
+ - Respect the **Law of Demeter**: avoid chaining method calls across object boundaries.
37
+ - Keep classes focused; a class should do one thing and do it well.
38
+ - Prefer composition over inheritance where possible.
39
+ - Follow the **RuboCop** rules configured in `.rubocop.yml` (Ruby 3.3 target).
40
+
41
+ ## Project-Specific Guidelines
42
+
43
+ - The gem is a **Rails** extension—follow Rails conventions and best practices.
44
+ - The core abstraction is `Azeroth::Resourceable` (mixed into controllers via `include Azeroth::Resourceable`), which exposes the `resource_for` class method.
45
+ - `Azeroth::Decorator` is used to control JSON serialization; use `expose` to declare which attributes are rendered.
46
+ - **Maintain backward compatibility** when modifying existing public APIs.
47
+ - Pagination is opt-in via `paginated: true` on `resource_for`; respect the `per_page` option and the pagination response headers (`pages`, `per_page`, `page`).
48
+ - New options added to `resource_for` or `model_for` must be documented and covered by integration specs (see `spec/integration/`).
49
+
50
+ ## Using dependencies
51
+
52
+ ### Using Jace for Event-Driven Hooks
53
+
54
+ Azeroth uses the [jace](https://github.com/darthjee/jace) gem to provide event-driven lifecycle hooks around controller actions. Refer to [`.github/jace-usage.md`](.github/jace-usage.md) for the full Jace API reference and usage patterns.
55
+
56
+ Key points when working with Jace inside Azeroth:
57
+
58
+ - Use `Jace::Registry` to register and trigger events.
59
+ - Register handlers with `registry.register(event, instant = :after, &block)`, where `instant` is `:before` or `:after`.
60
+ - Trigger events with `registry.trigger(event, context, &block)`; `:before` and `:after` handlers are `instance_eval`'d in `context`, while the main block is called in the surrounding scope.
61
+ - Triggering an event with no registered handlers is safe—the main block still runs.
62
+
63
+
64
+ ### Using darthjee-core_ext for extending core classes
65
+
66
+ Azeroth uses the [darthjee-core_ext](https://github.com/darthjee/core_ext) gem to extend core Ruby classes with additional methods. Refer to [`.github/core_ext-usage.md`](.github/core_ext-usage.md) for the full list of available extensions and usage examples.
67
+
68
+ ### Using darthjee-active_ext for extending active record and active support classes
69
+
70
+ Azeroth uses the [darthjee-active_ext](https://github.com/darthjee/active_ext) gem to extend Active Record and Active Support classes with additional methods. Refer to [`.github/active_ext-usage.md`](.github/active_ext-usage.md) for the full list of available extensions and usage examples.
71
+
72
+ ## Documentation
73
+
74
+ All project documentation lives under [`docs/agents/`](docs/agents/):
75
+
76
+ | File | Contents |
77
+ |------|----------|
78
+ | [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
79
+ | [Architecture](docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
80
+ | [Flow](docs/agents/flow.md) | Main runtime flow of the application. |
81
+ | [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
82
+ | [Plans](docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
83
+ | [Issues](docs/agents/issues/) | Detailed specs for open issues. |
84
+
85
+ ### Issues (`docs/agents/issues/`)
86
+
87
+ Each file documents an issue in detail. Naming convention:
88
+
89
+ ```
90
+ docs/agents/issues/<issue_id>_<issue_name>.md
91
+ ```
92
+
93
+ Example: `docs/agents/issues/5_release_docker_image.md` for issue #5.
94
+
95
+ ### Plans (`docs/agents/plans/`)
96
+
97
+ Each plan is a directory named after the issue ID and topic, containing one or more related files:
98
+
99
+ ```
100
+ docs/agents/plans/<issue_id>_<topic>/<related_files>.md
101
+ ```
102
+
103
+ Example: `docs/agents/plans/12_add-auth/plan.md` for issue #12.
data/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ See [AGENTS.md](AGENTS.md) for project instructions.
data/Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
- FROM darthjee/scripts:0.7.0 as scripts
1
+ FROM darthjee/scripts:0.15.0 as scripts
2
2
 
3
- FROM darthjee/rails_gems:2.1.1 as base
3
+ FROM darthjee/rails_gems:3.0.0 as base
4
4
 
5
5
  COPY --chown=app:app ./ /home/app/app/
6
6
 
data/Gemfile CHANGED
@@ -4,36 +4,39 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'actionpack', '7.2.2.1'
8
- gem 'activerecord', '7.2.2.1'
9
- gem 'bundler', '>= 2.5.13'
10
- gem 'factory_bot', '6.5.6'
11
- gem 'nokogiri', '1.19.1'
7
+ gem 'actionpack', '7.2.4'
8
+ gem 'actionview', '7.2.4'
9
+ gem 'activerecord', '7.2.4'
10
+ gem 'bundler', '>= 4.0.24'
11
+ gem 'factory_bot', '6.6.0'
12
+ gem 'nokogiri', '1.19.7'
12
13
  gem 'pry', '0.14.2'
13
14
  gem 'pry-nav', '1.0.0'
14
- gem 'rails', '7.2.2.1'
15
+ gem 'rack', '3.2.8'
16
+ gem 'rails', '7.2.4'
15
17
  gem 'rails-controller-testing', '1.0.5'
16
- gem 'rake', '13.2.1'
18
+ gem 'rake', '13.4.2'
17
19
  gem 'reek', '6.5.0'
18
20
  gem 'rspec', '3.13.2'
19
21
  gem 'rspec-collection_matchers', '1.2.1'
20
- gem 'rspec-core', '3.13.6'
21
- gem 'rspec-expectations', '3.13.5'
22
- gem 'rspec-mocks', '3.13.8'
23
- gem 'rspec-rails', '8.0.3'
24
- gem 'rspec-support', '3.13.7'
22
+ gem 'rspec-core', '3.13.7'
23
+ gem 'rspec-expectations', '3.13.6'
24
+ gem 'rspec-mocks', '3.13.9'
25
+ gem 'rspec-rails', '8.1.0'
26
+ gem 'rspec-support', '3.13.8'
27
+ gem 'rubocop', '1.92.2'
25
28
  gem 'rubocop-factory_bot', '2.28.0'
26
- gem 'rubocop-rails', '2.34.3'
29
+ gem 'rubocop-rails', '2.38.0'
27
30
  gem 'rubocop-rake', '0.7.1'
28
- gem 'rubocop-rspec', '3.9.0'
29
- gem 'rubocop-rspec_rails', '2.32.0'
31
+ gem 'rubocop-rspec', '3.10.2'
32
+ gem 'rubocop-rspec_rails', '2.33.0'
30
33
  gem 'rubycritic', '5.0.0'
31
34
  gem 'shoulda-matchers', '7.0.1'
32
35
  gem 'simplecov', '0.22.0'
33
36
  gem 'simplecov-html', '0.13.2'
34
37
  gem 'simplecov-lcov', '0.9.0'
35
38
  gem 'sprockets-rails', '3.5.2'
36
- gem 'sqlite3', '1.4.2'
39
+ gem 'sqlite3', '2.10.2'
37
40
  gem 'tzinfo-data', '~> 1.2025.2'
38
- gem 'yard', '0.9.38'
41
+ gem 'yard', '0.9.45'
39
42
  gem 'yardstick', '0.9.9'
data/README.md CHANGED
@@ -10,7 +10,7 @@ Azeroth
10
10
 
11
11
  Yard Documentation
12
12
  -------------------
13
- [https://www.rubydoc.info/gems/azeroth/2.2.0](https://www.rubydoc.info/gems/azeroth/2.2.0)
13
+ [https://www.rubydoc.info/gems/azeroth/2.3.0](https://www.rubydoc.info/gems/azeroth/2.3.0)
14
14
 
15
15
  Azeroth has been designed making the coding of controllers easier
16
16
  as routes in controllers are usually copy, paste and replace of same
@@ -24,9 +24,9 @@ does not perform database operations
24
24
  Future versions will enable `html` rendering to also perform
25
25
  database operations.
26
26
 
27
- **Current Release**: [2.2.0](https://github.com/darthjee/azeroth/tree/2.2.0)
27
+ **Current Release**: [2.3.0](https://github.com/darthjee/azeroth/tree/2.3.0)
28
28
 
29
- **Next release**: [2.3.0](https://github.com/darthjee/azeroth/compare/2.2.0...main)
29
+ **Next release**: [2.4.0](https://github.com/darthjee/azeroth/compare/2.3.0...main)
30
30
 
31
31
  Installation
32
32
  ---------------
@@ -52,13 +52,13 @@ Usage
52
52
 
53
53
  ## Azeroth::Resourceable
54
54
 
55
- [Resourceable](https://www.rubydoc.info/gems/azeroth/Azeroth/Resourceable)
55
+ [Resourceable](https://www.rubydoc.info/gems/azeroth/2.3.0Azeroth/Resourceable)
56
56
  module adds class methods
57
- [resource_for](https://www.rubydoc.info/gems/azeroth/Azeroth/Resourceable/ClassMethods#resource_for-instance_method)
57
+ [resource_for](https://www.rubydoc.info/gems/azeroth/2.3.0Azeroth/Resourceable/ClassMethods#resource_for-instance_method)
58
58
  which adds a resource and action methods for `create`, `show`, `index`,
59
59
  `update`, `delete`, `edit`
60
60
  and
61
- [model_for](https://www.rubydoc.info/gems/azeroth/Azeroth/Resourceable/ClassMethods#model_for-instance_method)
61
+ [model_for](https://www.rubydoc.info/gems/azeroth/2.3.0Azeroth/Resourceable/ClassMethods#model_for-instance_method)
62
62
 
63
63
  ### #resource_for
64
64
  It accepts options
@@ -177,7 +177,7 @@ It accepts options
177
177
 
178
178
  ## Azeroth::Decorator
179
179
 
180
- [Decorators](https://www.rubydoc.info/gems/azeroth/Azeroth/Decorator) are
180
+ [Decorators](https://www.rubydoc.info/gems/azeroth/2.3.0Azeroth/Decorator) are
181
181
  used to define how an object is exposed as json on controller responses
182
182
  defining which and how fields will be exposed
183
183
 
@@ -225,7 +225,7 @@ Exposing options:
225
225
  ```
226
226
 
227
227
  Exposing is done through the class method
228
- [expose](https://www.rubydoc.info/gems/azeroth/Azeroth/Decorator#expose-class_method)
228
+ [expose](https://www.rubydoc.info/gems/azeroth/2.3.0Azeroth/Decorator#expose-class_method)
229
229
  which accepts several options:
230
230
 
231
231
  - as: custom key to expose
data/azeroth.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  gem.require_paths = ['lib']
20
20
 
21
21
  gem.add_dependency 'activesupport', '~> 7.2.x'
22
- gem.add_dependency 'darthjee-active_ext', '>= 1.4.0'
23
- gem.add_dependency 'jace', '>= 0.1.2'
24
- gem.add_dependency 'sinclair', '>= 3.1.0'
22
+ gem.add_dependency 'darthjee-active_ext', '>= 2.0.0'
23
+ gem.add_dependency 'jace', '>= 1.0.0'
24
+ gem.add_dependency 'sinclair', '>= 3.2.0'
25
25
  end
data/azeroth.jpg CHANGED
Binary file