darthjee-active_ext 1.4.0 → 2.0.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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +5 -6
- data/.claude/agents/architect.md +46 -0
- data/.claude/agents/ruby.md +49 -0
- data/.claude/configuration/arcanum-repo-config.json +8 -0
- data/.claude/scripts/check_ruby.sh +7 -0
- data/.claude/settings.json +10 -0
- data/.github/commit_message_template-2.0.md +32 -0
- data/.github/commit_message_template.md +10 -0
- data/.github/copilot-instructions.md +1 -102
- data/.github/pull_request_template.md +17 -0
- data/.gitignore +1 -0
- data/AGENTS.md +139 -0
- data/CLAUDE.md +1 -0
- data/Dockerfile +2 -2
- data/Gemfile +12 -12
- data/README.md +5 -3
- data/active_ext.gemspec +1 -1
- data/active_ext.jpg +0 -0
- data/docs/agents/arcanum-split-issue.md +9 -0
- data/docs/agents/architecture.md +59 -0
- data/docs/agents/contributing.md +182 -0
- data/docs/agents/flow.md +5 -0
- data/docs/agents/folder-structure.md +18 -0
- data/docs/agents/issue-enhancement.md +13 -0
- data/docs/agents/issues/.gitkeep +1 -0
- data/docs/agents/plans/.gitkeep +1 -0
- data/lib/darthjee/active_ext/version.rb +1 -1
- data/scripts/bump_version.sh +62 -0
- metadata +25 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 519372f970cd7269217941e0195cbe7ae07e8efd832be66b81294425b4afecdf
|
|
4
|
+
data.tar.gz: 20f465f2aa808ce6c8b3d8884672c2a568ec10ce73d8c8c91ccb22cf1750a622
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2d1d141abfac80b8b0a436e04a15bd2768e957047e726b402fd5fe5689ec1b56eae640878c5732b5cbde63b84f1504a8fd9c1041e180ed0b9c340a67bb79dd1
|
|
7
|
+
data.tar.gz: 768c0b01bd9150083923a4f3801810d1b96132db431bcad29f5c0f1339c6034c302441a6b9cc2b8d4bcb179cfd4e4cc8409fd21a9281f12756909517dc66a9b7
|
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:
|
|
@@ -22,7 +21,7 @@ workflows:
|
|
|
22
21
|
jobs:
|
|
23
22
|
test:
|
|
24
23
|
docker:
|
|
25
|
-
- image: darthjee/circleci_rails_gems:
|
|
24
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
26
25
|
environment:
|
|
27
26
|
PROJECT: active_ext
|
|
28
27
|
steps:
|
|
@@ -38,7 +37,7 @@ jobs:
|
|
|
38
37
|
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage/lcov/project.lcov
|
|
39
38
|
checks:
|
|
40
39
|
docker:
|
|
41
|
-
- image: darthjee/circleci_rails_gems:
|
|
40
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
42
41
|
environment:
|
|
43
42
|
PROJECT: active_ext
|
|
44
43
|
steps:
|
|
@@ -54,7 +53,7 @@ jobs:
|
|
|
54
53
|
command: bundle exec rake verify_measurements
|
|
55
54
|
- run:
|
|
56
55
|
name: Check version documentation
|
|
57
|
-
command:
|
|
56
|
+
command: PROJECT=darthjee-active_ext check_readme.sh
|
|
58
57
|
- run:
|
|
59
58
|
name: Rubycritcs check
|
|
60
59
|
command: rubycritic.sh
|
|
@@ -63,7 +62,7 @@ jobs:
|
|
|
63
62
|
command: check_specs
|
|
64
63
|
build-and-release:
|
|
65
64
|
docker:
|
|
66
|
-
- image: darthjee/circleci_rails_gems:
|
|
65
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
67
66
|
environment:
|
|
68
67
|
PROJECT: active_ext
|
|
69
68
|
steps:
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: active_ext architect and coordinator. Use for cross-cutting tasks, multi-agent coordination, documentation, root-level files, 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 active_ext project — a Ruby gem (`darthjee-active_ext`) that adds query helpers to ActiveRecord::Relation and ActiveRecord::Base.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
- `docs/agents/` — all project documentation
|
|
12
|
+
- Root-level files: `README.md`, `AGENTS.md`, `CLAUDE.md`, `LICENSE`, `Dockerfile`, `docker-compose.yml`, `Makefile`
|
|
13
|
+
- `.github/` and `.circleci/`
|
|
14
|
+
- Cross-cutting decisions that span multiple layers
|
|
15
|
+
- Coordination of the other specialist agents
|
|
16
|
+
|
|
17
|
+
## Specialist agents
|
|
18
|
+
|
|
19
|
+
Delegate implementation, exploration, and planning work to the right agent. Never implement, explore, or plan what belongs to a specialist yourself.
|
|
20
|
+
|
|
21
|
+
| Agent | Scope |
|
|
22
|
+
|-------|-------|
|
|
23
|
+
| `ruby` | `lib/`, `spec/`, `config/` and the Ruby tooling files: gem code, specs, YARD, RuboCop |
|
|
24
|
+
|
|
25
|
+
## How to coordinate
|
|
26
|
+
|
|
27
|
+
When a task spans multiple agents:
|
|
28
|
+
|
|
29
|
+
1. **Break it down** — identify which parts belong to which agent.
|
|
30
|
+
2. **Delegate exploration first** — before proposing an approach, dispatch the specialist(s) whose scope covers the relevant area to investigate, rather than reading the code yourself.
|
|
31
|
+
3. **Sequence or parallelize** — if agents' outputs are independent, run them in parallel; if one depends on the other, sequence them.
|
|
32
|
+
4. **Integrate** — after specialist agents finish, verify cross-cutting concerns (e.g. README usage examples and the version line in `README.md` match the code).
|
|
33
|
+
5. **Update docs** — reflect any architectural change in `docs/agents/`.
|
|
34
|
+
|
|
35
|
+
## Documentation (`docs/agents/`)
|
|
36
|
+
|
|
37
|
+
| File | Contents |
|
|
38
|
+
|------|----------|
|
|
39
|
+
| [Folder Structure](../../docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
40
|
+
| [Architecture](../../docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
|
|
41
|
+
| [Flow](../../docs/agents/flow.md) | Main runtime flow of the application. |
|
|
42
|
+
| [Contributing](../../docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
43
|
+
| [Plans](../../docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
|
|
44
|
+
| [Issues](../../docs/agents/issues/) | Detailed specs for open issues. |
|
|
45
|
+
|
|
46
|
+
Keep documentation up to date after any architectural change. When a new agent is created or its scope changes, update this file and `AGENTS.md`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ruby
|
|
3
|
+
description: active_ext Ruby specialist. Use for any task involving Ruby code, ActiveRecord/ActiveSupport extensions, RSpec specs, YARD docs, RuboCop, or files under lib/, spec/, config/.
|
|
4
|
+
tools: Read, Edit, Write, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the ruby specialist for the active_ext project — a Ruby gem (`darthjee-active_ext`) that adds query helpers to ActiveRecord::Relation and ActiveRecord::Base.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
You own:
|
|
12
|
+
|
|
13
|
+
- `lib/` — gem source (`darthjee/` entry point and version, `active_record/` extensions)
|
|
14
|
+
- `spec/` — RSpec suite (`spec/lib/` mirrors `lib/`; `spec/support/` has the schema, models, shared examples)
|
|
15
|
+
- `config/` — check_specs, yardstick and rubycritic config
|
|
16
|
+
- `Gemfile`, `active_ext.gemspec`, `Rakefile`, `.rubocop.yml`, `.rubocop_todo.yml`, `.rspec`
|
|
17
|
+
|
|
18
|
+
Do NOT touch `docs/agents/`, `README.md`, `AGENTS.md`, `CLAUDE.md`, `.github/`, `.circleci/` or Docker files. Those belong to `architect`.
|
|
19
|
+
|
|
20
|
+
## Stack
|
|
21
|
+
|
|
22
|
+
- Ruby >= 3.3.1, ActiveRecord / ActiveSupport 7.2, `darthjee-core_ext`
|
|
23
|
+
- RSpec with in-memory SQLite, SimpleCov
|
|
24
|
+
- RuboCop (+ rubocop-rspec, rubocop-rake), YARD + yardstick, RubyCritic, reek
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
.claude/scripts/check_ruby.sh
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
which runs:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bundle exec rspec
|
|
36
|
+
bundle exec rubocop
|
|
37
|
+
bundle exec rake verify_measurements
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
CI also runs `check_specs`, `rubycritic.sh` and `check_readme.sh` from the `darthjee/circleci_rails_gems` image. `docker-compose run test_all` runs specs and the YARD checks in the dev container.
|
|
41
|
+
|
|
42
|
+
## Conventions
|
|
43
|
+
|
|
44
|
+
- Follow `docs/agents/contributing.md` and `docs/agents/architecture.md`.
|
|
45
|
+
- Every change needs specs. Every `lib/` file needs a spec, or an entry in `config/check_specs.yml` if it cannot have one.
|
|
46
|
+
- Every public class, module and method needs a YARD docstring with `@param`, `@return` and `@example`.
|
|
47
|
+
- Put behaviour on `ActiveRecord::Relation`, and expose it on `ActiveRecord::Base` by delegating to `all`.
|
|
48
|
+
- Keep methods small and chainable, in line with Rails conventions. Avoid patching core Ruby classes.
|
|
49
|
+
- `# frozen_string_literal: true` in every Ruby file. Public methods come before private ones.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
```text
|
|
2
|
+
<type>(<scope>): <subject> (issue #<id>)
|
|
3
|
+
|
|
4
|
+
<optional body: what was done and why, if not obvious>
|
|
5
|
+
|
|
6
|
+
Addresses-Comment: <optional: URL of the PR comment this commit addresses>
|
|
7
|
+
|
|
8
|
+
Co-Authored-By: <AI model name> <AI model email>
|
|
9
|
+
Co-Authored-By: <agent> agent <agent email>
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Note: unlike the model line above (always the running AI model's own
|
|
13
|
+
canonical noreply address), the agent line's email is independently
|
|
14
|
+
configurable per agent via the "git.email" key (a template such as
|
|
15
|
+
"you+{agent}@example.com", with "{agent}" substituted for the actual
|
|
16
|
+
agent name, e.g. "architect" or "backend") in
|
|
17
|
+
.claude/state/arcanum-config.json (local) or
|
|
18
|
+
.claude/configuration/arcanum-repo-config.json (repo) — see
|
|
19
|
+
docs/guides/arcanum-repo-config.md. When "git.email" is unset, the agent
|
|
20
|
+
line falls back to the same address as the model line, reproducing the
|
|
21
|
+
old, single-shared-email template's output.
|
|
22
|
+
|
|
23
|
+
The model line above can be omitted entirely by setting the
|
|
24
|
+
"git.omit_model_coauthor" key to "true" in the same three locations
|
|
25
|
+
(local state, repo config, or global config — see
|
|
26
|
+
docs/guides/arcanum-repo-config.md) — the agent line is always still
|
|
27
|
+
emitted regardless of this setting.
|
|
28
|
+
|
|
29
|
+
This file's mere presence (as "commit_message_template-2.0.md", not its
|
|
30
|
+
content) is what switches the commit scripts onto this new, two-distinct-
|
|
31
|
+
email behavior — the content itself is never parsed at runtime, it is
|
|
32
|
+
purely human-facing documentation of the shape above.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
```text
|
|
2
|
+
<type>(<scope>): <subject> (issue #<id>)
|
|
3
|
+
|
|
4
|
+
<optional body: what was done and why, if not obvious>
|
|
5
|
+
|
|
6
|
+
Addresses-Comment: <optional: URL of the PR comment this commit addresses>
|
|
7
|
+
|
|
8
|
+
Co-Authored-By: <AI model name> <AI model email>
|
|
9
|
+
Co-Authored-By: <agent> agent <AI model email>
|
|
10
|
+
```
|
|
@@ -1,102 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
`active_ext` is a Ruby gem that provides extension methods to be used with
|
|
6
|
-
**ActiveRecord** and **ActiveSupport** (Ruby on Rails components). It enriches
|
|
7
|
-
`ActiveRecord::Relation` and related classes with additional query helpers and
|
|
8
|
-
utilities, keeping the extensions idiomatic, lightweight, and Rails-friendly.
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## Language
|
|
13
|
-
|
|
14
|
-
All contributions must be in **English**:
|
|
15
|
-
|
|
16
|
-
- Pull request titles and descriptions
|
|
17
|
-
- Code comments and inline documentation
|
|
18
|
-
- YARD docstrings and examples
|
|
19
|
-
- Commit messages
|
|
20
|
-
- Identifiers (class names, method names, variable names, etc.)
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Testing
|
|
25
|
-
|
|
26
|
-
- **Always add tests** for every change, bug fix, or new feature.
|
|
27
|
-
- Tests live under `spec/` and use **RSpec**.
|
|
28
|
-
- Follow the existing spec structure: place specs next to the corresponding
|
|
29
|
-
`lib/` file (e.g., `lib/active_record/my_extension.rb` →
|
|
30
|
-
`spec/lib/active_record/my_extension_spec.rb`).
|
|
31
|
-
- If a source file genuinely cannot have a spec (e.g., it only re-exports
|
|
32
|
-
constants or requires other files), list it in **`check_specs.yml`** so it
|
|
33
|
-
is explicitly acknowledged as exempt from the coverage requirement.
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## Documentation
|
|
38
|
-
|
|
39
|
-
- Provide documentation compatible with **YARD**.
|
|
40
|
-
- Every **public** class, module, and method must include a YARD docstring.
|
|
41
|
-
- Include `@param`, `@return`, and `@example` tags where appropriate.
|
|
42
|
-
- Example:
|
|
43
|
-
|
|
44
|
-
```ruby
|
|
45
|
-
# Returns the percentage of records matching +scope+ within the current
|
|
46
|
-
# relation.
|
|
47
|
-
#
|
|
48
|
-
# @param scope [Symbol, Hash, String] the scope or condition to evaluate
|
|
49
|
-
# @return [Float] percentage as a decimal between 0.0 and 1.0
|
|
50
|
-
#
|
|
51
|
-
# @example Using a named scope
|
|
52
|
-
# Document.percentage(:with_error) #=> 0.75
|
|
53
|
-
#
|
|
54
|
-
# @example Using a hash condition
|
|
55
|
-
# Document.percentage(status: :error) #=> 0.75
|
|
56
|
-
#
|
|
57
|
-
# @example Within a nested scope
|
|
58
|
-
# Document.active.percentage(:with_error) #=> 0.5
|
|
59
|
-
def percentage(scope)
|
|
60
|
-
# ...
|
|
61
|
-
end
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Design & Quality
|
|
67
|
-
|
|
68
|
-
Follow the principles championed by **Sandi Metz** (as described in
|
|
69
|
-
*99 Bottles of OOP* and *Practical Object-Oriented Design*):
|
|
70
|
-
|
|
71
|
-
- **Small classes and methods** — each should have a single, well-defined
|
|
72
|
-
responsibility.
|
|
73
|
-
- **Limit method length** — prefer short, readable methods over long ones.
|
|
74
|
-
- **Prefer composition over inheritance** when extending behavior.
|
|
75
|
-
- **Avoid Law of Demeter violations** — an object should only talk to its
|
|
76
|
-
immediate collaborators; avoid long method-chain calls like
|
|
77
|
-
`a.b.c.do_something`.
|
|
78
|
-
- **Favor clear, explicit boundaries** — modules and classes should expose
|
|
79
|
-
minimal public APIs and hide implementation details.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Rails & ActiveRecord Compatibility
|
|
84
|
-
|
|
85
|
-
- Extensions must remain **Rails-friendly**: follow Rails conventions and
|
|
86
|
-
naming patterns.
|
|
87
|
-
- New methods added to `ActiveRecord::Relation` or `ActiveSupport` classes
|
|
88
|
-
should integrate naturally with existing Rails query interfaces (scopes,
|
|
89
|
-
chainability, etc.).
|
|
90
|
-
- Avoid monkey-patching core Ruby classes unless absolutely necessary; prefer
|
|
91
|
-
extending the appropriate Rails base classes or using `ActiveSupport::Concern`.
|
|
92
|
-
- Ensure compatibility with the Ruby and Rails versions declared in
|
|
93
|
-
`active_ext.gemspec` and `Gemfile`.
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## Pull Request Guidelines
|
|
98
|
-
|
|
99
|
-
- Keep PRs focused and small — one logical change per PR.
|
|
100
|
-
- Include a clear description of *what* changed and *why*.
|
|
101
|
-
- Reference any related issues.
|
|
102
|
-
- Ensure all existing and new specs pass before requesting review.
|
|
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
data/AGENTS.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# GitHub Copilot Instructions for `darthjee/active_ext`
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
`active_ext` is a Ruby gem that provides extension methods to be used with
|
|
6
|
+
**ActiveRecord** and **ActiveSupport** (Ruby on Rails components). It enriches
|
|
7
|
+
`ActiveRecord::Relation` and related classes with additional query helpers and
|
|
8
|
+
utilities, keeping the extensions idiomatic, lightweight, and Rails-friendly.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Language
|
|
13
|
+
|
|
14
|
+
All contributions must be in **English**:
|
|
15
|
+
|
|
16
|
+
- Pull request titles and descriptions
|
|
17
|
+
- Code comments and inline documentation
|
|
18
|
+
- YARD docstrings and examples
|
|
19
|
+
- Commit messages
|
|
20
|
+
- Identifiers (class names, method names, variable names, etc.)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Testing
|
|
25
|
+
|
|
26
|
+
- **Always add tests** for every change, bug fix, or new feature.
|
|
27
|
+
- Tests live under `spec/` and use **RSpec**.
|
|
28
|
+
- Follow the existing spec structure: place specs next to the corresponding
|
|
29
|
+
`lib/` file (e.g., `lib/active_record/my_extension.rb` →
|
|
30
|
+
`spec/lib/active_record/my_extension_spec.rb`).
|
|
31
|
+
- If a source file genuinely cannot have a spec (e.g., it only re-exports
|
|
32
|
+
constants or requires other files), list it in **`check_specs.yml`** so it
|
|
33
|
+
is explicitly acknowledged as exempt from the coverage requirement.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Code Documentation (YARD)
|
|
38
|
+
|
|
39
|
+
- Provide documentation compatible with **YARD**.
|
|
40
|
+
- Every **public** class, module, and method must include a YARD docstring.
|
|
41
|
+
- Include `@param`, `@return`, and `@example` tags where appropriate.
|
|
42
|
+
- Example:
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
# Returns the percentage of records matching +scope+ within the current
|
|
46
|
+
# relation.
|
|
47
|
+
#
|
|
48
|
+
# @param scope [Symbol, Hash, String] the scope or condition to evaluate
|
|
49
|
+
# @return [Float] percentage as a decimal between 0.0 and 1.0
|
|
50
|
+
#
|
|
51
|
+
# @example Using a named scope
|
|
52
|
+
# Document.percentage(:with_error) #=> 0.75
|
|
53
|
+
#
|
|
54
|
+
# @example Using a hash condition
|
|
55
|
+
# Document.percentage(status: :error) #=> 0.75
|
|
56
|
+
#
|
|
57
|
+
# @example Within a nested scope
|
|
58
|
+
# Document.active.percentage(:with_error) #=> 0.5
|
|
59
|
+
def percentage(scope)
|
|
60
|
+
# ...
|
|
61
|
+
end
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Design & Quality
|
|
67
|
+
|
|
68
|
+
Follow the principles championed by **Sandi Metz** (as described in
|
|
69
|
+
*99 Bottles of OOP* and *Practical Object-Oriented Design*):
|
|
70
|
+
|
|
71
|
+
- **Small classes and methods** — each should have a single, well-defined
|
|
72
|
+
responsibility.
|
|
73
|
+
- **Limit method length** — prefer short, readable methods over long ones.
|
|
74
|
+
- **Prefer composition over inheritance** when extending behavior.
|
|
75
|
+
- **Avoid Law of Demeter violations** — an object should only talk to its
|
|
76
|
+
immediate collaborators; avoid long method-chain calls like
|
|
77
|
+
`a.b.c.do_something`.
|
|
78
|
+
- **Favor clear, explicit boundaries** — modules and classes should expose
|
|
79
|
+
minimal public APIs and hide implementation details.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Rails & ActiveRecord Compatibility
|
|
84
|
+
|
|
85
|
+
- Extensions must remain **Rails-friendly**: follow Rails conventions and
|
|
86
|
+
naming patterns.
|
|
87
|
+
- New methods added to `ActiveRecord::Relation` or `ActiveSupport` classes
|
|
88
|
+
should integrate naturally with existing Rails query interfaces (scopes,
|
|
89
|
+
chainability, etc.).
|
|
90
|
+
- Avoid monkey-patching core Ruby classes unless absolutely necessary; prefer
|
|
91
|
+
extending the appropriate Rails base classes or using `ActiveSupport::Concern`.
|
|
92
|
+
- Ensure compatibility with the Ruby and Rails versions declared in
|
|
93
|
+
`active_ext.gemspec` and `Gemfile`.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Pull Request Guidelines
|
|
98
|
+
|
|
99
|
+
- Keep PRs focused and small — one logical change per PR.
|
|
100
|
+
- Include a clear description of *what* changed and *why*.
|
|
101
|
+
- Reference any related issues.
|
|
102
|
+
- Ensure all existing and new specs pass before requesting review.
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
All project documentation lives under [`docs/agents/`](docs/agents/):
|
|
107
|
+
|
|
108
|
+
| File | Contents |
|
|
109
|
+
|------|----------|
|
|
110
|
+
| [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
111
|
+
| [Architecture](docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
|
|
112
|
+
| [Flow](docs/agents/flow.md) | Main runtime flow of the application. |
|
|
113
|
+
| [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
114
|
+
| [Plans](docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
|
|
115
|
+
| [Issues](docs/agents/issues/) | Detailed specs for open issues. |
|
|
116
|
+
|
|
117
|
+
### Issues (`docs/agents/issues/`)
|
|
118
|
+
|
|
119
|
+
Each file documents an issue in detail. Naming convention:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
docs/agents/issues/<issue_id>_<issue_name>.md
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Example: `docs/agents/issues/5_release_docker_image.md` for issue #5.
|
|
126
|
+
|
|
127
|
+
### Plans (`docs/agents/plans/`)
|
|
128
|
+
|
|
129
|
+
Each plan is a directory named after the issue ID and topic, containing one or more related files:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
docs/agents/plans/<issue_id>_<topic>/<related_files>.md
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Example: `docs/agents/plans/12_add-auth/plan.md` for issue #12.
|
|
136
|
+
|
|
137
|
+
## Commit Attribution
|
|
138
|
+
|
|
139
|
+
Commit co-author trailers follow arcanum's resolved `git.omit_model_coauthor` and `git.remove_coauthors` config (check them with `/arcanum-check-config`); this overrides Claude Code's own attribution reminder for every commit, including ones written by hand.
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
See [AGENTS.md](AGENTS.md) for project instructions.
|
data/Dockerfile
CHANGED
data/Gemfile
CHANGED
|
@@ -5,26 +5,26 @@ source 'https://rubygems.org'
|
|
|
5
5
|
# Specify your gem's dependencies in credential_builder.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
-
gem 'activerecord', '7.2.
|
|
9
|
-
gem 'bundler', '>=
|
|
8
|
+
gem 'activerecord', '7.2.4'
|
|
9
|
+
gem 'bundler', '>= 4.0.24'
|
|
10
10
|
gem 'pry', '0.14.2'
|
|
11
11
|
gem 'pry-nav', '1.0.0'
|
|
12
|
-
gem 'rake', '13.2
|
|
12
|
+
gem 'rake', '13.4.2'
|
|
13
13
|
gem 'reek', '6.5.0'
|
|
14
14
|
gem 'rspec', '3.13.2'
|
|
15
15
|
gem 'rspec-collection_matchers'
|
|
16
|
-
gem 'rspec-core', '3.13.
|
|
17
|
-
gem 'rspec-expectations', '3.13.
|
|
18
|
-
gem 'rspec-mocks', '3.13.
|
|
19
|
-
gem 'rspec-rails', '8.0
|
|
20
|
-
gem 'rspec-support', '3.13.
|
|
21
|
-
gem 'rubocop', '1.
|
|
16
|
+
gem 'rspec-core', '3.13.7'
|
|
17
|
+
gem 'rspec-expectations', '3.13.6'
|
|
18
|
+
gem 'rspec-mocks', '3.13.9'
|
|
19
|
+
gem 'rspec-rails', '8.1.0'
|
|
20
|
+
gem 'rspec-support', '3.13.8'
|
|
21
|
+
gem 'rubocop', '1.92.2'
|
|
22
22
|
gem 'rubocop-rake', '0.7.1'
|
|
23
|
-
gem 'rubocop-rspec', '3.
|
|
23
|
+
gem 'rubocop-rspec', '3.10.2'
|
|
24
24
|
gem 'rubycritic', '5.0.0'
|
|
25
25
|
gem 'simplecov', '0.22.0'
|
|
26
26
|
gem 'simplecov-html', '0.13.2'
|
|
27
27
|
gem 'simplecov-lcov', '0.9.0'
|
|
28
|
-
gem 'sqlite3', '
|
|
29
|
-
gem 'yard', '0.9.
|
|
28
|
+
gem 'sqlite3', '2.10.2'
|
|
29
|
+
gem 'yard', '0.9.45'
|
|
30
30
|
gem 'yardstick', '0.9.9'
|
data/README.md
CHANGED
|
@@ -6,13 +6,15 @@ ActiveExt
|
|
|
6
6
|
[](https://app.codacy.com/gh/darthjee/active_ext/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
7
7
|
[](https://badge.fury.io/rb/darthjee-active_ext)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+

|
|
10
10
|
|
|
11
|
-
**
|
|
11
|
+
**Current Release**: [2.0.0](https://github.com/darthjee/active_ext/tree/2.0.0)
|
|
12
|
+
|
|
13
|
+
**Next release**: [2.1.0](https://github.com/darthjee/active_ext/compare/2.0.0...main)
|
|
12
14
|
|
|
13
15
|
Yard Documentation
|
|
14
16
|
-------------------
|
|
15
|
-
[https://www.rubydoc.info/gems/darthjee-active_ext/
|
|
17
|
+
[https://www.rubydoc.info/gems/darthjee-active_ext/2.0.0](https://www.rubydoc.info/gems/darthjee-active_ext/2.0.0)
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
# Usage
|
data/active_ext.gemspec
CHANGED
|
@@ -19,6 +19,6 @@ 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-core_ext', '>= 3.
|
|
22
|
+
gem.add_dependency 'darthjee-core_ext', '>= 3.2.0'
|
|
23
23
|
gem.metadata['rubygems_mfa_required'] = 'false'
|
|
24
24
|
end
|
data/active_ext.jpg
ADDED
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Arcanum Split Issue
|
|
2
|
+
|
|
3
|
+
A checklist of concerns to consider when splitting a broad issue into sub-issues via `/arcanum-split-issue`. Not exhaustive — adjust or extend the list for this project's needs.
|
|
4
|
+
|
|
5
|
+
- **Sub-issue granularity** — is each sub-issue independently workable, or does it still depend on another sub-issue landing first?
|
|
6
|
+
- **Standalone clarity** — does each sub-issue stand on its own, without requiring the reader to have the parent issue open to understand it?
|
|
7
|
+
- **Shared contracts** — interfaces, schemas, or config keys touched by more than one sub-issue, and who owns getting them right first.
|
|
8
|
+
- **Sequencing** — is there a natural order sub-issues should be implemented/merged in, or can they proceed in parallel?
|
|
9
|
+
- **Responsible agents** — which specialist agent(s) each sub-issue is likely to fall to.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
`darthjee-active_ext` is a small Ruby gem that reopens ActiveRecord classes to add
|
|
6
|
+
query helpers. It has no runtime of its own: requiring `darthjee/active_ext` loads
|
|
7
|
+
`darthjee/core_ext` (from the `darthjee-core_ext` gem) and the ActiveRecord
|
|
8
|
+
extensions, and the new methods are then available on every model and relation.
|
|
9
|
+
|
|
10
|
+
The logic lives on `ActiveRecord::Relation`. `ActiveRecord::Base` only delegates
|
|
11
|
+
the same methods to `all`, so the helpers work both on a model class
|
|
12
|
+
(`Document.percentage(...)`) and on any scope chain (`Document.active.percentage(...)`).
|
|
13
|
+
|
|
14
|
+
## Source Code Layout
|
|
15
|
+
|
|
16
|
+
All gem source code lives under `lib/`.
|
|
17
|
+
|
|
18
|
+
### `lib/darthjee.rb` and `lib/darthjee/`
|
|
19
|
+
|
|
20
|
+
Gem namespace and entry point.
|
|
21
|
+
|
|
22
|
+
- `darthjee/active_ext.rb`: requires `darthjee/core_ext` and the ActiveRecord
|
|
23
|
+
extensions, and defines the `Darthjee::ActiveExt` module.
|
|
24
|
+
- `darthjee/active_ext/version.rb`: `Darthjee::ActiveExt::VERSION`, which the
|
|
25
|
+
gemspec reads.
|
|
26
|
+
|
|
27
|
+
### `lib/active_record/`
|
|
28
|
+
|
|
29
|
+
Reopens the ActiveRecord classes.
|
|
30
|
+
|
|
31
|
+
- `relation_ext.rb`: adds instance methods to `ActiveRecord::Relation`:
|
|
32
|
+
- `percentage(*filters)` (public): the fraction (0.0–1.0) of records in the
|
|
33
|
+
relation that match the filters. Returns `0.0` for an empty relation.
|
|
34
|
+
- `scopped(*filters)` (private API): applies the filters. A list of Symbols is
|
|
35
|
+
chained as named scopes; anything else (a Hash or SQL String) goes to `where`.
|
|
36
|
+
Do not mix the two forms in one call.
|
|
37
|
+
- `pluck_as_json(*keys)` (public): like `pluck`, but returns an array of
|
|
38
|
+
Symbol-keyed hashes (via `Array#as_hash` from `darthjee-core_ext`). With no
|
|
39
|
+
keys it returns `as_json` for each record.
|
|
40
|
+
- `base_ext.rb`: delegates `percentage`, `pluck_as_json` and `scopped` from the
|
|
41
|
+
`ActiveRecord::Base` class to `all`. It holds only YARD `@method` docstrings
|
|
42
|
+
that point at the Relation docs.
|
|
43
|
+
|
|
44
|
+
## Tests
|
|
45
|
+
|
|
46
|
+
- RSpec, against an in-memory SQLite database (`spec/spec_helper.rb`).
|
|
47
|
+
- `spec/support/schema.rb` and `spec/support/models/document.rb` define the
|
|
48
|
+
`Document` test model and its scopes (`with_error`, `with_success`, `active`).
|
|
49
|
+
- `spec/support/shared_examples/active_relation.rb` holds shared examples that run
|
|
50
|
+
against both the model class and relations.
|
|
51
|
+
- The `lib/` files are listed in `config/check_specs.yml` because their behaviour
|
|
52
|
+
is covered by `spec/lib/active_record/relation_spec.rb`, not by a spec per file.
|
|
53
|
+
|
|
54
|
+
## Quality Tooling
|
|
55
|
+
|
|
56
|
+
- YARD docs, with coverage measured by yardstick (`config/yardstick.yml`,
|
|
57
|
+
`rake yardstick_measure`, `rake verify_measurements`).
|
|
58
|
+
- RuboCop (`.rubocop.yml`) and RubyCritic (`config/rubycritc.rb`).
|
|
59
|
+
- SimpleCov coverage, with an LCOV report on CI (CircleCI and Codacy).
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Commit Guidelines
|
|
4
|
+
|
|
5
|
+
- **Atomic and Unitary:** Each commit must represent a single logical change.
|
|
6
|
+
*Example:*
|
|
7
|
+
- Good: `Add pluck_as_json to ActiveRecord::Relation`
|
|
8
|
+
- Bad: `Add pluck_as_json and refactor scopped logic`
|
|
9
|
+
- **No Unrelated Changes:** Do not mix unrelated changes in the same commit.
|
|
10
|
+
- **Separate Refactoring:** Whenever possible, separate refactoring commits from new feature or bugfix commits.
|
|
11
|
+
- Follow `.github/commit_message_template.md`.
|
|
12
|
+
|
|
13
|
+
## Pull Requests
|
|
14
|
+
|
|
15
|
+
- **Descriptive Summary:** Every PR must include a clear and descriptive summary of its purpose and changes (see `.github/pull_request_template.md`).
|
|
16
|
+
- **PR Description Files:** If a description cannot be provided directly in the PR, generate a file with the PR description (e.g., `docs/agents/issues/<pr_number>_description.md`), but do not commit this file.
|
|
17
|
+
|
|
18
|
+
## Definition of Done for PRs
|
|
19
|
+
|
|
20
|
+
A PR is considered complete when:
|
|
21
|
+
|
|
22
|
+
- The stated objective has been achieved.
|
|
23
|
+
- All specs are passing (`bundle exec rspec`).
|
|
24
|
+
- RuboCop passes without offenses (`rubocop`).
|
|
25
|
+
- Every public class, module and method has a YARD docstring, and yardstick passes (`bundle exec rake verify_measurements`).
|
|
26
|
+
- Code coverage is as high as reasonably possible (SimpleCov).
|
|
27
|
+
- Code is not overly complex:
|
|
28
|
+
- Classes and methods should have clear, focused responsibilities.
|
|
29
|
+
- If a class or method is taking on too many responsibilities, refactor to simplify.
|
|
30
|
+
- Methods should be small and do exactly one thing. If a method is growing, extract parts into private helper methods or separate classes.
|
|
31
|
+
- *Example:*
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
# Good: each method does one thing
|
|
35
|
+
class Worker
|
|
36
|
+
def fetch_job; end
|
|
37
|
+
|
|
38
|
+
def process_job(job); end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Bad: method does too much
|
|
42
|
+
class Worker
|
|
43
|
+
def run
|
|
44
|
+
fetch_job
|
|
45
|
+
process_job
|
|
46
|
+
send_metrics
|
|
47
|
+
cleanup
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- This requirement applies primarily to source code. For specs, refactor only if there is excessive duplication.
|
|
53
|
+
|
|
54
|
+
### CI Checks
|
|
55
|
+
|
|
56
|
+
Before a PR is considered complete, all CI checks must pass locally. This project has a single gem at the root, so both CircleCI jobs apply to any change in `lib/`, `spec/`, `config/` or the root files:
|
|
57
|
+
|
|
58
|
+
| Modified folder(s) | CircleCI job | Local commands |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `lib/`, `spec/`, `config/`, root files | `test` | `bundle exec rspec` |
|
|
61
|
+
| `lib/`, `spec/`, `config/`, root files | `checks` | `rubocop`<br>`bundle exec rake verify_measurements`<br>`check_specs` (all files under `lib/` need a spec or an entry in `config/check_specs.yml`)<br>`rubycritic.sh` and `check_readme.sh` (README must reference the current version; these helpers ship in the CI image `darthjee/circleci_rails_gems`) |
|
|
62
|
+
|
|
63
|
+
`docker-compose run test_all` runs rspec, yard and the yardstick checks inside the dev container.
|
|
64
|
+
|
|
65
|
+
Run these same checks when **planning how to resolve an issue**: end the plan with a step that lists the affected folders and the CI commands to run before opening a PR.
|
|
66
|
+
|
|
67
|
+
## Code Organization
|
|
68
|
+
|
|
69
|
+
### File Responsibility: Class Declarers vs Scripts
|
|
70
|
+
|
|
71
|
+
Every source file (excluding specs) must act as a **class declarer**: it defines or reopens one or more classes or modules. Files must not act as **scripts**, meaning they must not run logic or side effects when they are required (beyond `require` statements and class/module definitions).
|
|
72
|
+
|
|
73
|
+
The only entrypoints are the require files:
|
|
74
|
+
|
|
75
|
+
| Purpose | Entrypoint |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| Gem require (`require 'darthjee/active_ext'`) | `lib/darthjee/active_ext.rb` |
|
|
78
|
+
| Namespace require (`require 'darthjee'`) | `lib/darthjee.rb` |
|
|
79
|
+
|
|
80
|
+
*Example:*
|
|
81
|
+
|
|
82
|
+
```ruby
|
|
83
|
+
# Good: class declarer — reopens a class to add behaviour
|
|
84
|
+
module ActiveRecord
|
|
85
|
+
class Relation
|
|
86
|
+
def percentage(*filters); end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Bad: script — executes logic at load time
|
|
91
|
+
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
|
|
92
|
+
Document.create(status: :error)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Specs and `spec/support/` files are exempt from this rule and may run setup code freely.
|
|
96
|
+
|
|
97
|
+
### File Naming: snake_case Matching the Class
|
|
98
|
+
|
|
99
|
+
Files must use **snake_case** and match the class or module they define (Zeitwerk-style). Files that extend an existing class end in `_ext`.
|
|
100
|
+
|
|
101
|
+
*Examples:*
|
|
102
|
+
|
|
103
|
+
- `lib/darthjee/active_ext.rb` for `Darthjee::ActiveExt`
|
|
104
|
+
- `lib/active_record/relation_ext.rb` for extensions to `ActiveRecord::Relation`
|
|
105
|
+
|
|
106
|
+
Spec files mirror the `lib/` path and end in `_spec.rb`:
|
|
107
|
+
|
|
108
|
+
- `lib/active_record/relation_ext.rb` → `spec/lib/active_record/relation_spec.rb`
|
|
109
|
+
|
|
110
|
+
### Method Order: Public Before Private
|
|
111
|
+
|
|
112
|
+
Within a class, **public methods must be declared before private methods**. Private helpers go at the end of the class body, after a single `private` keyword.
|
|
113
|
+
|
|
114
|
+
```ruby
|
|
115
|
+
# Good: public methods first, private methods last
|
|
116
|
+
class Worker
|
|
117
|
+
def run
|
|
118
|
+
prepare
|
|
119
|
+
execute
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def status; end
|
|
123
|
+
|
|
124
|
+
private
|
|
125
|
+
|
|
126
|
+
def prepare; end
|
|
127
|
+
|
|
128
|
+
def execute; end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Bad: private methods mixed in with or before public methods
|
|
132
|
+
class Worker
|
|
133
|
+
private def prepare; end
|
|
134
|
+
|
|
135
|
+
def run; end
|
|
136
|
+
|
|
137
|
+
private def execute; end
|
|
138
|
+
end
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Dependency Injection
|
|
142
|
+
|
|
143
|
+
Classes must receive their dependencies (data, configuration, collaborators) as `initialize` arguments. A class must never load files, read `ENV` or fetch configuration on its own.
|
|
144
|
+
|
|
145
|
+
**Only the entrypoint, or the host application, loads configuration.** It then passes the loaded data to the classes that need it. Extensions to ActiveRecord must work with whatever connection and models the host app provides, and must not open connections or define models themselves.
|
|
146
|
+
|
|
147
|
+
This makes every class testable on its own: specs instantiate it with the data they need, without touching the filesystem or environment.
|
|
148
|
+
|
|
149
|
+
```ruby
|
|
150
|
+
# Good: receives data as an argument — easy to test
|
|
151
|
+
class Router
|
|
152
|
+
def initialize(data)
|
|
153
|
+
@data = data
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def build; end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Bad: loads its own config — couples to the filesystem
|
|
160
|
+
class Router
|
|
161
|
+
def build
|
|
162
|
+
data = YAML.load_file('./data.yml') # ❌
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Refactoring Guidelines
|
|
168
|
+
|
|
169
|
+
When refactoring, aim to:
|
|
170
|
+
|
|
171
|
+
- **Reduce Code Duplication:** move repeated spec setup into `let`, `before` blocks, helper methods in `spec/support/`, or shared examples (`spec/support/shared_examples/`).
|
|
172
|
+
|
|
173
|
+
```ruby
|
|
174
|
+
# Good
|
|
175
|
+
shared_examples 'a method that returns the percentage of objects found' do
|
|
176
|
+
# ...
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
it_behaves_like 'a method that returns the percentage of objects found'
|
|
180
|
+
|
|
181
|
+
# Bad: the same setup and expectations copied into many spec files
|
|
182
|
+
```
|
data/docs/agents/flow.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Folder Structure
|
|
2
|
+
|
|
3
|
+
## Project Root
|
|
4
|
+
|
|
5
|
+
| Directory / File | Description |
|
|
6
|
+
|-----------------|-------------|
|
|
7
|
+
| `lib/` | Gem source code: the `darthjee/active_ext` entry point and version, plus the `active_record/` extensions (`relation_ext.rb`, `base_ext.rb`). |
|
|
8
|
+
| `spec/` | RSpec test suite. `spec/lib/` mirrors `lib/`; `spec/support/` holds the test schema, models and shared examples. |
|
|
9
|
+
| `config/` | Tooling config: `check_specs.yml` (files exempt from spec coverage), `yardstick.yml`/`yardstick.rb` (YARD docs quality), `rubycritc.rb` (RubyCritic). |
|
|
10
|
+
| `docs/agents/` | Agent docs: architecture, flow, folder structure, issue specs and implementation plans. |
|
|
11
|
+
| `.github/` | Copilot instructions, PR and commit message templates, and `active_ext-usage.md` (a usage guide for projects that use the gem). |
|
|
12
|
+
| `.circleci/` | CircleCI pipeline config. |
|
|
13
|
+
| `active_ext.gemspec` | Gem spec (published as `darthjee-active_ext`). |
|
|
14
|
+
| `Gemfile` | Development dependencies. |
|
|
15
|
+
| `Rakefile` | Rake tasks (YARD/yardstick measurement, etc.). |
|
|
16
|
+
| `Dockerfile` / `docker-compose.yml` / `Makefile` | Docker dev environment; `make dev` opens a shell, and the `test_all` service runs specs and the docs checks. |
|
|
17
|
+
| `.rubocop.yml` / `.rubocop_todo.yml` | RuboCop lint config. |
|
|
18
|
+
| `AGENTS.md` / `CLAUDE.md` | Agent instructions (`CLAUDE.md` points to `AGENTS.md`). |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Issue Enhancement
|
|
2
|
+
|
|
3
|
+
A checklist of concerns to consider when fleshing out a vague issue idea (tagged `Idea`/`Writting`) before it reaches the `Created` stage. Not exhaustive — adjust or extend the list for this project's needs.
|
|
4
|
+
|
|
5
|
+
- **Scope boundaries** — what's explicitly in scope and what's explicitly out.
|
|
6
|
+
- **Alternative solutions** — other ways to solve the same problem, and why this one was chosen.
|
|
7
|
+
- **Edge cases** — inputs, states, or timing the happy path doesn't cover.
|
|
8
|
+
- **Backward compatibility** — whether this breaks existing behavior, data, or integrations.
|
|
9
|
+
- **Testing strategy** — how the change will be verified.
|
|
10
|
+
- **Performance & security considerations** — anything relevant to load, latency, or attack surface.
|
|
11
|
+
- **Rails/ActiveRecord compatibility** — whether the method is chainable, works on both `ActiveRecord::Base` and `ActiveRecord::Relation`, and supports the Ruby/Rails versions declared in the gemspec and Gemfile.
|
|
12
|
+
- **Public API & versioning** — whether the gem's public API changes, which semver bump that needs, and which README and YARD examples must be updated.
|
|
13
|
+
- **SQL safety & DB portability** — whether user input can reach raw SQL, and whether the query behaves the same across database adapters (SQLite in specs; Postgres/MySQL in host apps).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Usage: scripts/bump_version.sh [major|minor|patch|X.Y.Z]
|
|
3
|
+
# Without arguments, bumps the patch version of the current version.
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
ROOT="$(git rev-parse --show-toplevel)"
|
|
8
|
+
README="$ROOT/README.md"
|
|
9
|
+
VERSION_FILE="$ROOT/lib/darthjee/active_ext/version.rb"
|
|
10
|
+
LOCKFILE="$ROOT/Gemfile.lock"
|
|
11
|
+
GEM="darthjee-active_ext"
|
|
12
|
+
|
|
13
|
+
current=$(grep -oE "VERSION = '[0-9]+\.[0-9]+\.[0-9]+'" "$VERSION_FILE" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
|
14
|
+
IFS='.' read -r cmajor cminor cpatch <<< "$current"
|
|
15
|
+
|
|
16
|
+
arg="${1:-patch}"
|
|
17
|
+
|
|
18
|
+
case "$arg" in
|
|
19
|
+
major) new_version="$((cmajor + 1)).0.0" ;;
|
|
20
|
+
minor) new_version="${cmajor}.$((cminor + 1)).0" ;;
|
|
21
|
+
patch) new_version="${cmajor}.${cminor}.$((cpatch + 1))" ;;
|
|
22
|
+
*) new_version="$arg" ;;
|
|
23
|
+
esac
|
|
24
|
+
|
|
25
|
+
# Validate semver format
|
|
26
|
+
if ! echo "$new_version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
|
27
|
+
echo "Error: version must be major, minor, patch or X.Y.Z" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
# Next release: following minor
|
|
32
|
+
IFS='.' read -r major minor _patch <<< "$new_version"
|
|
33
|
+
next_release="${major}.$((minor + 1)).0"
|
|
34
|
+
|
|
35
|
+
echo "Current version: $current"
|
|
36
|
+
echo "New version: $new_version"
|
|
37
|
+
echo "Next release: $next_release"
|
|
38
|
+
|
|
39
|
+
# version.rb
|
|
40
|
+
sed -i '' "s|VERSION = '[0-9.]*'|VERSION = '${new_version}'|" "$VERSION_FILE"
|
|
41
|
+
|
|
42
|
+
# README: YARD docs link
|
|
43
|
+
sed -i '' \
|
|
44
|
+
"s|rubydoc.info/gems/${GEM}/[0-9.]*|rubydoc.info/gems/${GEM}/${new_version}|g" \
|
|
45
|
+
"$README"
|
|
46
|
+
|
|
47
|
+
# README: Current Release line
|
|
48
|
+
sed -i '' \
|
|
49
|
+
"s|\*\*Current Release\*\*: \[[0-9.]*\](https://github.com/darthjee/active_ext/tree/[0-9.]*)|**Current Release**: [${new_version}](https://github.com/darthjee/active_ext/tree/${new_version})|" \
|
|
50
|
+
"$README"
|
|
51
|
+
|
|
52
|
+
# README: Next release line
|
|
53
|
+
sed -i '' \
|
|
54
|
+
"s|\*\*Next release\*\*: \[[0-9.]*\](https://github.com/darthjee/active_ext/compare/[0-9.]*\.\.\.main)|**Next release**: [${next_release}](https://github.com/darthjee/active_ext/compare/${new_version}...main)|" \
|
|
55
|
+
"$README"
|
|
56
|
+
|
|
57
|
+
# Gemfile.lock
|
|
58
|
+
if [ -f "$LOCKFILE" ]; then
|
|
59
|
+
sed -i '' "s|^\( *${GEM} (\)[0-9.]*)|\1${new_version})|" "$LOCKFILE"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
echo "Done."
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: darthjee-active_ext
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Darthjee
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -30,14 +29,14 @@ dependencies:
|
|
|
30
29
|
requirements:
|
|
31
30
|
- - ">="
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 3.
|
|
32
|
+
version: 3.2.0
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
37
|
- - ">="
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 3.
|
|
39
|
+
version: 3.2.0
|
|
41
40
|
description: Extension of active support classes with usefull methods
|
|
42
41
|
email:
|
|
43
42
|
- darthjee@gmail.com
|
|
@@ -46,12 +45,22 @@ extensions: []
|
|
|
46
45
|
extra_rdoc_files: []
|
|
47
46
|
files:
|
|
48
47
|
- ".circleci/config.yml"
|
|
48
|
+
- ".claude/agents/architect.md"
|
|
49
|
+
- ".claude/agents/ruby.md"
|
|
50
|
+
- ".claude/configuration/arcanum-repo-config.json"
|
|
51
|
+
- ".claude/scripts/check_ruby.sh"
|
|
52
|
+
- ".claude/settings.json"
|
|
49
53
|
- ".github/active_ext-usage.md"
|
|
54
|
+
- ".github/commit_message_template-2.0.md"
|
|
55
|
+
- ".github/commit_message_template.md"
|
|
50
56
|
- ".github/copilot-instructions.md"
|
|
57
|
+
- ".github/pull_request_template.md"
|
|
51
58
|
- ".gitignore"
|
|
52
59
|
- ".rspec"
|
|
53
60
|
- ".rubocop.yml"
|
|
54
61
|
- ".rubocop_todo.yml"
|
|
62
|
+
- AGENTS.md
|
|
63
|
+
- CLAUDE.md
|
|
55
64
|
- Dockerfile
|
|
56
65
|
- Gemfile
|
|
57
66
|
- LICENSE
|
|
@@ -59,16 +68,26 @@ files:
|
|
|
59
68
|
- README.md
|
|
60
69
|
- Rakefile
|
|
61
70
|
- active_ext.gemspec
|
|
71
|
+
- active_ext.jpg
|
|
62
72
|
- config/check_specs.yml
|
|
63
73
|
- config/rubycritc.rb
|
|
64
74
|
- config/yardstick.rb
|
|
65
75
|
- config/yardstick.yml
|
|
66
76
|
- docker-compose.yml
|
|
77
|
+
- docs/agents/arcanum-split-issue.md
|
|
78
|
+
- docs/agents/architecture.md
|
|
79
|
+
- docs/agents/contributing.md
|
|
80
|
+
- docs/agents/flow.md
|
|
81
|
+
- docs/agents/folder-structure.md
|
|
82
|
+
- docs/agents/issue-enhancement.md
|
|
83
|
+
- docs/agents/issues/.gitkeep
|
|
84
|
+
- docs/agents/plans/.gitkeep
|
|
67
85
|
- lib/active_record/base_ext.rb
|
|
68
86
|
- lib/active_record/relation_ext.rb
|
|
69
87
|
- lib/darthjee.rb
|
|
70
88
|
- lib/darthjee/active_ext.rb
|
|
71
89
|
- lib/darthjee/active_ext/version.rb
|
|
90
|
+
- scripts/bump_version.sh
|
|
72
91
|
- spec/lib/active_record/relation_spec.rb
|
|
73
92
|
- spec/spec_helper.rb
|
|
74
93
|
- spec/support/models/document.rb
|
|
@@ -78,7 +97,6 @@ homepage: https://github.com/darthjee/active_ext
|
|
|
78
97
|
licenses: []
|
|
79
98
|
metadata:
|
|
80
99
|
rubygems_mfa_required: 'false'
|
|
81
|
-
post_install_message:
|
|
82
100
|
rdoc_options: []
|
|
83
101
|
require_paths:
|
|
84
102
|
- lib
|
|
@@ -93,8 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
111
|
- !ruby/object:Gem::Version
|
|
94
112
|
version: '0'
|
|
95
113
|
requirements: []
|
|
96
|
-
rubygems_version:
|
|
97
|
-
signing_key:
|
|
114
|
+
rubygems_version: 4.0.23
|
|
98
115
|
specification_version: 4
|
|
99
116
|
summary: Active Extensions
|
|
100
117
|
test_files: []
|