arstotzka 1.6.2 → 1.7.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 +34 -12
- data/.claude/agents/architect.md +48 -0
- data/.claude/agents/infra.md +34 -0
- data/.claude/agents/ruby.md +43 -0
- data/.claude/configuration/arcanum-repo-config.json +3 -0
- data/.claude/scripts/check_infra.sh +6 -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 -0
- data/.github/pull_request_template.md +17 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +19 -6
- data/AGENTS.md +69 -0
- data/CLAUDE.md +1 -0
- data/Dockerfile +6 -9
- data/Gemfile +20 -3
- data/README.md +8 -4
- data/Rakefile +2 -0
- data/arstotzka.gemspec +4 -24
- data/docs/agents/arcanum-split-issue.md +9 -0
- data/docs/agents/architecture.md +64 -0
- data/docs/agents/contributing.md +202 -0
- data/docs/agents/flow.md +28 -0
- data/docs/agents/folder-structure.md +29 -0
- data/docs/agents/issue-enhancement.md +11 -0
- data/docs/agents/issues/.gitkeep +1 -0
- data/docs/agents/plans/.gitkeep +1 -0
- data/lib/arstotzka/class_methods.rb +1 -1
- data/lib/arstotzka/crawler.rb +1 -0
- data/lib/arstotzka/exception.rb +1 -0
- data/lib/arstotzka/fetcher/cache.rb +1 -0
- data/lib/arstotzka/key_reader.rb +2 -1
- data/lib/arstotzka/method_builder.rb +1 -0
- data/lib/arstotzka/options.rb +1 -1
- data/lib/arstotzka/reader.rb +1 -0
- data/lib/arstotzka/type_cast.rb +2 -2
- data/lib/arstotzka/version.rb +1 -1
- data/lib/arstotzka/wrapper.rb +17 -1
- data/scripts/bump_version.sh +62 -0
- data/spec/integration/yard/arstotzka/class_methods_spec.rb +1 -0
- data/spec/integration/yard/arstotzka/config_spec.rb +1 -1
- data/spec/integration/yard/arstotzka/fetcher/cache_spec.rb +1 -1
- data/spec/integration/yard/arstotzka/options_spec.rb +2 -4
- data/spec/integration/yard/arstotzka/type_cast_spec.rb +1 -1
- data/spec/integration/yard/arstotzka/wrapper_spec.rb +1 -1
- data/spec/lib/arstotzka/fetcher_spec.rb +1 -1
- data/spec/lib/arstotzka/options_spec.rb +1 -2
- data/spec/lib/arstotzka/type_cast_spec.rb +4 -4
- data/spec/lib/arstotzka/wrapper_spec.rb +4 -3
- data/spec/spec_helper.rb +13 -4
- data/spec/support/models/arstotzka/dummy.rb +1 -0
- data/spec/support/models/arstotzka/wrapper/dummy.rb +1 -0
- data/spec/support/models/car_collector.rb +1 -1
- data/spec/support/models/collector.rb +1 -1
- data/spec/support/models/game.rb +1 -0
- data/spec/support/models/house.rb +1 -0
- data/spec/support/models/my_parser.rb +1 -1
- data/spec/support/models.rb +2 -2
- metadata +32 -329
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe88a14cdf6253438f9639aded2aaf205d9d03ef4cea40261f69735606b5bbd1
|
|
4
|
+
data.tar.gz: ef032b43c1ddfe152efa0ce206e84752c1423a08704087e7eb641eb44e21be0c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9786f63c0ce4fef1107dceeb69c5cdd5b2ca8c3441af35b5a74880b0a7c45f7a963ab6f0050b3b32a2e4acd015df4813163484a866505bcdce03e8ac9223233
|
|
7
|
+
data.tar.gz: 6ed06259d502cd6ab6755044c066f6ea21d103e62f693afce9da224f18e78a29f841419ac2b95cf282e86ded42988ab23f14545eda50a16017ffffe290515dcc
|
data/.circleci/config.yml
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
version: 2
|
|
1
|
+
version: 2.1
|
|
2
2
|
workflows:
|
|
3
|
-
version: 2
|
|
4
3
|
test-and-build:
|
|
5
4
|
jobs:
|
|
6
5
|
- test:
|
|
7
6
|
filters:
|
|
8
7
|
tags:
|
|
9
8
|
only: /.*/
|
|
10
|
-
-
|
|
9
|
+
- checks:
|
|
10
|
+
filters:
|
|
11
|
+
tags:
|
|
12
|
+
only: /.*/
|
|
13
|
+
- coverage-final:
|
|
11
14
|
requires: [test]
|
|
15
|
+
filters:
|
|
16
|
+
tags:
|
|
17
|
+
only: /.*/
|
|
18
|
+
- build-and-release:
|
|
19
|
+
requires: [test, checks, coverage-final]
|
|
12
20
|
filters:
|
|
13
21
|
tags:
|
|
14
22
|
only: /\d+\.\d+\.\d+/
|
|
@@ -18,26 +26,40 @@ workflows:
|
|
|
18
26
|
jobs:
|
|
19
27
|
test:
|
|
20
28
|
docker:
|
|
21
|
-
- image: darthjee/
|
|
29
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
22
30
|
environment:
|
|
23
31
|
PROJECT: arstotzka
|
|
24
32
|
steps:
|
|
25
33
|
- checkout
|
|
26
|
-
- run:
|
|
27
|
-
name: Prepare Coverage Test Report
|
|
28
|
-
command: cc-test-reporter before-build
|
|
29
34
|
- run:
|
|
30
35
|
name: Bundle Install
|
|
31
36
|
command: bundle install
|
|
32
37
|
- run:
|
|
33
38
|
name: RSpec
|
|
34
|
-
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_rails_gems:3.0.0
|
|
46
|
+
steps:
|
|
47
|
+
- run:
|
|
48
|
+
name: Finalize coverage on Codacy
|
|
49
|
+
command: bash <(curl -Ls https://coverage.codacy.com/get.sh) final
|
|
50
|
+
checks:
|
|
51
|
+
docker:
|
|
52
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
53
|
+
environment:
|
|
54
|
+
PROJECT: arstotzka
|
|
55
|
+
steps:
|
|
56
|
+
- checkout
|
|
57
|
+
- run:
|
|
58
|
+
name: Bundle Install
|
|
59
|
+
command: bundle install
|
|
35
60
|
- run:
|
|
36
61
|
name: Rubocop
|
|
37
62
|
command: rubocop
|
|
38
|
-
- run:
|
|
39
|
-
name: Coverage Test Report
|
|
40
|
-
command: cc-test-reporter after-build --exit-code $?
|
|
41
63
|
- run:
|
|
42
64
|
name: Yardstick coverage check
|
|
43
65
|
command: bundle exec rake verify_measurements
|
|
@@ -52,7 +74,7 @@ jobs:
|
|
|
52
74
|
command: check_specs
|
|
53
75
|
build-and-release:
|
|
54
76
|
docker:
|
|
55
|
-
- image: darthjee/
|
|
77
|
+
- image: darthjee/circleci_rails_gems:3.0.0
|
|
56
78
|
environment:
|
|
57
79
|
PROJECT: arstotzka
|
|
58
80
|
steps:
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architect
|
|
3
|
+
description: Arstotzka 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 arstotzka project — a Ruby gem (concern) for declaratively fetching values from nested hashes / JSON without nil checks, with key case changing, type casting, wrapping and post-processing.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
- `docs/agents/` — all project documentation
|
|
12
|
+
- Root-level files: `README.md`, `AGENTS.md`, `CLAUDE.md`, `LICENSE`, `.gitignore`, `.github/`
|
|
13
|
+
- Cross-cutting decisions that span multiple layers
|
|
14
|
+
- Coordination of the other specialist agents
|
|
15
|
+
|
|
16
|
+
## Specialist agents
|
|
17
|
+
|
|
18
|
+
Delegate implementation, exploration, and planning work to the right agent. Never implement, explore, or plan what belongs to a specialist yourself.
|
|
19
|
+
|
|
20
|
+
| Agent | Scope |
|
|
21
|
+
|-------|-------|
|
|
22
|
+
| `ruby` | `lib/`, `spec/`, `config/`, `scripts/`, gemspec, Gemfile, Rakefile, linter/YARD configs — gem source, specs and quality tooling |
|
|
23
|
+
| `infra` | `Dockerfile`, `docker-compose.yml`, `.circleci/` — containers and CI/release pipeline |
|
|
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.
|
|
33
|
+
5. **Update docs** — reflect any architectural change in `docs/agents/`.
|
|
34
|
+
|
|
35
|
+
Note: `README.md` examples are executed by `spec/integration/readme` (owned by `ruby`) and the README must link the current version's YARD docs (`scripts/check_readme.sh`) — README changes usually need `ruby` to update or verify specs.
|
|
36
|
+
|
|
37
|
+
## Documentation (`docs/agents/`)
|
|
38
|
+
|
|
39
|
+
| File | Contents |
|
|
40
|
+
|------|----------|
|
|
41
|
+
| [Folder Structure](../../docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
42
|
+
| [Architecture](../../docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
|
|
43
|
+
| [Flow](../../docs/agents/flow.md) | Main runtime flow of the application. |
|
|
44
|
+
| [Contributing](../../docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
45
|
+
| [Plans](../../docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
|
|
46
|
+
| [Issues](../../docs/agents/issues/) | Detailed specs for open issues. |
|
|
47
|
+
|
|
48
|
+
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,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: infra
|
|
3
|
+
description: Arstotzka infra specialist. Use for any task involving Docker, docker-compose, CircleCI pipelines, CI images, or gem build/release automation.
|
|
4
|
+
tools: Read, Edit, Write, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the infra specialist for the arstotzka project — a Ruby gem (concern) for declaratively fetching values from nested hashes / JSON.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
You own:
|
|
12
|
+
|
|
13
|
+
- `Dockerfile` — development image
|
|
14
|
+
- `docker-compose.yml` — `base_build`, `arstotzka` (RSpec) and `test_all` (RSpec + YARD + Yardstick) services
|
|
15
|
+
- `.circleci/` — `test` job and `build-and-release` job (gem push on version tags on `master`)
|
|
16
|
+
|
|
17
|
+
Do NOT touch `lib/`, `spec/`, `config/`, `scripts/`, gemspec/Gemfile/Rakefile or linter configs (owned by `ruby`), nor `docs/agents/`, `README.md`, `AGENTS.md`, `CLAUDE.md` (owned by `architect`).
|
|
18
|
+
|
|
19
|
+
## Stack
|
|
20
|
+
|
|
21
|
+
- Docker, docker-compose
|
|
22
|
+
- CircleCI 2 using the `darthjee/circleci_ruby_gems` image (provides `cc-test-reporter`, `check_specs`, `build_gem.sh`)
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
docker-compose config --quiet
|
|
28
|
+
docker-compose build base_build
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Conventions
|
|
32
|
+
|
|
33
|
+
- CI steps must stay runnable locally; when adding a CI step, document its local command in the CI Checks table of [docs/agents/contributing.md](../../docs/agents/contributing.md) (coordinate with `architect`).
|
|
34
|
+
- Pin image versions explicitly (e.g. `darthjee/circleci_ruby_gems:0.5.4`).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ruby
|
|
3
|
+
description: Arstotzka ruby specialist. Use for any task involving Ruby source code, RSpec specs, gem dependencies, RuboCop/Reek/YARD/Yardstick/RubyCritic configuration, or the lib/, spec/, config/ and scripts/ directories.
|
|
4
|
+
tools: Read, Edit, Write, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the ruby specialist for the arstotzka project — a Ruby gem (concern) for declaratively fetching values from nested hashes / JSON without nil checks, with key case changing, type casting, wrapping and post-processing.
|
|
8
|
+
|
|
9
|
+
## Your scope
|
|
10
|
+
|
|
11
|
+
You own:
|
|
12
|
+
|
|
13
|
+
- `lib/` — gem source code (`lib/arstotzka.rb` entrypoint and `lib/arstotzka/` classes)
|
|
14
|
+
- `spec/` — RSpec unit specs (`spec/lib/`), integration specs for README and YARD examples (`spec/integration/`), fixtures and support models
|
|
15
|
+
- `config/` — Yardstick, RubyCritic and `check_specs` configuration
|
|
16
|
+
- `scripts/` — CI helper scripts (`check_readme.sh`, `rubycritic.sh`)
|
|
17
|
+
- `arstotzka.gemspec`, `Gemfile`, `Rakefile`, `Guardfile`, `.rspec`, `.rubocop.yml`, `.rubocop_todo.yml`, `.yardopts`
|
|
18
|
+
|
|
19
|
+
Do NOT touch `Dockerfile`, `docker-compose.yml`, `.circleci/` (owned by `infra`), nor `docs/agents/`, `README.md`, `AGENTS.md`, `CLAUDE.md` (owned by `architect`).
|
|
20
|
+
|
|
21
|
+
## Stack
|
|
22
|
+
|
|
23
|
+
- Ruby (>= 2.5), runtime deps `activesupport` and `sinclair`
|
|
24
|
+
- RSpec + SimpleCov, RuboCop (+ `rubocop-rspec`), Reek, RubyCritic
|
|
25
|
+
- YARD documentation measured by Yardstick
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
bundle exec rspec
|
|
31
|
+
bundle exec rubocop
|
|
32
|
+
bundle exec rake verify_measurements
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Conventions
|
|
36
|
+
|
|
37
|
+
- See [docs/agents/architecture.md](../../docs/agents/architecture.md), [docs/agents/flow.md](../../docs/agents/flow.md) and [docs/agents/contributing.md](../../docs/agents/contributing.md).
|
|
38
|
+
- Every file starts with `# frozen_string_literal: true`; max line length 100.
|
|
39
|
+
- One class/module per file, snake_case path mirroring the namespace; register new classes with `autoload` in `lib/arstotzka.rb`.
|
|
40
|
+
- Every `lib/` file has a mirrored spec in `spec/lib/` (unless listed in `config/check_specs.yml`).
|
|
41
|
+
- Classes receive an options object/hash in the constructor; collaborators are memoised private methods; public methods before private.
|
|
42
|
+
- Document every method with YARD (`@api public`/`@api private`, `@param`, `@return`, `@example`); new `@example`s must be covered by `spec/integration/yard`, and README examples by `spec/integration/readme`.
|
|
43
|
+
- New `expose` options go in `Arstotzka::Options` (documented there) and, if they have a default, in `Arstotzka::Config`.
|
|
@@ -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
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
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/.rubocop.yml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
plugins:
|
|
2
|
+
- rubocop-rspec
|
|
3
|
+
- rubocop-rake
|
|
2
4
|
inherit_from: .rubocop_todo.yml
|
|
3
5
|
|
|
4
6
|
AllCops:
|
|
5
|
-
TargetRubyVersion:
|
|
7
|
+
TargetRubyVersion: 3.4
|
|
8
|
+
NewCops: enable
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Layout/LineLength:
|
|
8
11
|
Max: 100
|
|
9
12
|
|
|
10
|
-
RSpec/AlignLeftLetBrace:
|
|
11
|
-
Enabled: true
|
|
12
|
-
|
|
13
13
|
Style/ClassAndModuleChildren:
|
|
14
14
|
Exclude:
|
|
15
15
|
- spec/integration/**/*.rb
|
|
@@ -35,3 +35,16 @@ Style/HashTransformKeys:
|
|
|
35
35
|
|
|
36
36
|
Style/HashTransformValues:
|
|
37
37
|
Enabled: true
|
|
38
|
+
|
|
39
|
+
RSpec/MultipleMemoizedHelpers:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
Gemspec/DevelopmentDependencies:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
Gemspec/RequireMFA:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
Style/OpenStructUse:
|
|
49
|
+
Exclude:
|
|
50
|
+
- 'spec/**/*.rb'
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Project Instructions
|
|
2
|
+
|
|
3
|
+
Arstotzka is a Ruby gem (a concern to be included in classes) for quick, declarative
|
|
4
|
+
fetching of values from nested hashes / JSON. It avoids code that crawls through a hash
|
|
5
|
+
constantly checking for `nil` values or missing keys and, like `OpenStruct`, lets the data
|
|
6
|
+
be read as an object — but without `method_missing`, since every attribute is a declared
|
|
7
|
+
method (returning `nil` when data is absent). It also supports key case changing
|
|
8
|
+
(e.g. camelCase ↔ snake_case), type casting, wrapping values in classes and post-processing,
|
|
9
|
+
having been built as a bridge between Rails applications and Java APIs.
|
|
10
|
+
|
|
11
|
+
## Stack
|
|
12
|
+
|
|
13
|
+
- Ruby (>= 2.5) gem — runtime dependencies: `activesupport`, `sinclair`
|
|
14
|
+
- Tests: RSpec (`spec/`), with SimpleCov coverage
|
|
15
|
+
- Linting / quality: RuboCop (+ `rubocop-rspec`), Reek, RubyCritic
|
|
16
|
+
- Documentation: YARD, with Yardstick measuring doc coverage (`config/yardstick.yml`)
|
|
17
|
+
- Tooling: Docker / docker-compose for local runs, CircleCI for CI and gem release
|
|
18
|
+
|
|
19
|
+
## Conventions
|
|
20
|
+
|
|
21
|
+
- Every Ruby file starts with `# frozen_string_literal: true`.
|
|
22
|
+
- Maximum line length is 100 characters; code must pass `rubocop` (see `.rubocop.yml`).
|
|
23
|
+
- Public API must be documented with YARD; Yardstick coverage (`rake verify_measurements`)
|
|
24
|
+
must not drop.
|
|
25
|
+
- Every file in `lib/` has a matching spec under `spec/lib/` (enforced by `check_specs`,
|
|
26
|
+
configured in `config/check_specs.yml`); integration specs live in `spec/integration/`
|
|
27
|
+
and support models in `spec/support/`.
|
|
28
|
+
- The README documents the current version (checked by `scripts/check_readme.sh`) —
|
|
29
|
+
keep it in sync when bumping `lib/arstotzka/version.rb`.
|
|
30
|
+
- Run the suite with `docker-compose run arstotzka` (RSpec) or
|
|
31
|
+
`docker-compose run test_all` (RSpec + YARD + Yardstick), or directly with
|
|
32
|
+
`bundle exec rspec` and `rubocop`.
|
|
33
|
+
|
|
34
|
+
## Documentation
|
|
35
|
+
|
|
36
|
+
All project documentation lives under [`docs/agents/`](docs/agents/):
|
|
37
|
+
|
|
38
|
+
| File | Contents |
|
|
39
|
+
|------|----------|
|
|
40
|
+
| [Folder Structure](docs/agents/folder-structure.md) | Top-level directory layout and the role of each folder. |
|
|
41
|
+
| [Architecture](docs/agents/architecture.md) | Source layout, modules, code style, and implementation guidelines. |
|
|
42
|
+
| [Flow](docs/agents/flow.md) | Main runtime flow of the application. |
|
|
43
|
+
| [Contributing](docs/agents/contributing.md) | Commit guidelines, PR standards, code organization, and refactoring rules. |
|
|
44
|
+
| [Plans](docs/agents/plans/) | Implementation plans for ongoing or upcoming features. |
|
|
45
|
+
| [Issues](docs/agents/issues/) | Detailed specs for open issues. |
|
|
46
|
+
|
|
47
|
+
### Issues (`docs/agents/issues/`)
|
|
48
|
+
|
|
49
|
+
Each file documents an issue in detail. Naming convention:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
docs/agents/issues/<issue_id>_<issue_name>.md
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Example: `docs/agents/issues/5_release_docker_image.md` for issue #5.
|
|
56
|
+
|
|
57
|
+
### Plans (`docs/agents/plans/`)
|
|
58
|
+
|
|
59
|
+
Each plan is a directory named after the issue ID and topic, containing one or more related files:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
docs/agents/plans/<issue_id>_<topic>/<related_files>.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Example: `docs/agents/plans/12_add-auth/plan.md` for issue #12.
|
|
66
|
+
|
|
67
|
+
## Commit Attribution
|
|
68
|
+
|
|
69
|
+
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
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
FROM darthjee/
|
|
2
|
-
|
|
1
|
+
FROM darthjee/scripts:0.15.0 as scripts
|
|
2
|
+
|
|
3
|
+
FROM darthjee/rails_gems:3.0.0 as base
|
|
4
|
+
|
|
5
|
+
COPY --chown=app:app ./ /home/app/app/
|
|
3
6
|
|
|
4
7
|
######################################
|
|
5
8
|
|
|
6
9
|
FROM base as builder
|
|
7
10
|
|
|
8
|
-
COPY --chown=app
|
|
9
|
-
COPY --chown=app:app --from=scripts /home/scripts/builder/bundle_builder.sh /usr/local/sbin/
|
|
11
|
+
COPY --chown=app:app --from=scripts /home/scripts/builder/bundle_builder.sh /usr/local/sbin/bundle_builder.sh
|
|
10
12
|
|
|
11
13
|
ENV HOME_DIR /home/app
|
|
12
14
|
RUN bundle_builder.sh
|
|
@@ -14,11 +16,6 @@ RUN bundle_builder.sh
|
|
|
14
16
|
#######################
|
|
15
17
|
#FINAL IMAGE
|
|
16
18
|
FROM base
|
|
17
|
-
RUN mkdir lib/arstotzka -p
|
|
18
19
|
|
|
19
20
|
COPY --chown=app:app --from=builder /home/app/bundle/ /usr/local/bundle/
|
|
20
|
-
|
|
21
|
-
COPY --chown=app ./*.gemspec ./Gemfile /home/app/app/
|
|
22
|
-
COPY --chown=app ./lib/arstotzka/version.rb /home/app/app/lib/arstotzka/
|
|
23
|
-
|
|
24
21
|
RUN bundle install
|
data/Gemfile
CHANGED
|
@@ -4,6 +4,23 @@ source 'https://rubygems.org'
|
|
|
4
4
|
|
|
5
5
|
gemspec
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
gem 'bundler', '>= 4.0.24'
|
|
8
|
+
gem 'pry', '0.14.2'
|
|
9
|
+
gem 'pry-nav', '1.0.0'
|
|
10
|
+
gem 'rake', '13.4.2'
|
|
11
|
+
gem 'reek', '6.5.0'
|
|
12
|
+
gem 'rspec', '3.13.2'
|
|
13
|
+
gem 'rspec-core', '3.13.7'
|
|
14
|
+
gem 'rspec-expectations', '3.13.6'
|
|
15
|
+
gem 'rspec-mocks', '3.13.9'
|
|
16
|
+
gem 'rspec-support', '3.13.8'
|
|
17
|
+
gem 'rubocop', '1.92.2'
|
|
18
|
+
gem 'rubocop-rake', '0.7.1'
|
|
19
|
+
gem 'rubocop-rspec', '3.10.2'
|
|
20
|
+
gem 'rubycritic', '5.0.0'
|
|
21
|
+
gem 'safe_attribute_assignment'
|
|
22
|
+
gem 'simplecov', '0.22.0'
|
|
23
|
+
gem 'simplecov-html', '0.13.2'
|
|
24
|
+
gem 'simplecov-lcov', '0.9.0'
|
|
25
|
+
gem 'yard', '0.9.45'
|
|
26
|
+
gem 'yardstick', '0.9.9'
|
data/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Arstotzka
|
|
2
2
|
========
|
|
3
3
|
[](https://circleci.com/gh/darthjee/arstotzka)
|
|
4
|
-
[](https://codeclimate.com/github/darthjee/arstotzka)
|
|
4
|
+
[](https://app.codacy.com/gh/darthjee/arstotzka/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
5
|
+
[](https://app.codacy.com/gh/darthjee/arstotzka/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
7
6
|
[](https://badge.fury.io/rb/arstotzka)
|
|
8
7
|
[](http://inch-ci.org/github/darthjee/arstotzka)
|
|
9
8
|
|
|
@@ -21,7 +20,12 @@ JSON keys)
|
|
|
21
20
|
|
|
22
21
|
Yard Documentation
|
|
23
22
|
-------------------
|
|
24
|
-
[https://www.rubydoc.info/gems/arstotzka/1.
|
|
23
|
+
[https://www.rubydoc.info/gems/arstotzka/1.7.0](https://www.rubydoc.info/gems/arstotzka/1.7.0)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
**Current Release**: [1.7.0](https://github.com/darthjee/arstotzka/tree/1.7.0)
|
|
27
|
+
|
|
28
|
+
**Next release**: [1.8.0](https://github.com/darthjee/arstotzka/compare/1.7.0...main)
|
|
25
29
|
|
|
26
30
|
Instalation
|
|
27
31
|
---------------
|
data/Rakefile
CHANGED
data/arstotzka.gemspec
CHANGED
|
@@ -10,34 +10,14 @@ Gem::Specification.new do |gem|
|
|
|
10
10
|
gem.authors = ['Darthjee']
|
|
11
11
|
gem.email = ['dev@gmail.com']
|
|
12
12
|
gem.summary = 'Arstotzka'
|
|
13
|
-
gem.description =
|
|
13
|
+
gem.description = 'Fetch values from nested hashes / JSON declaratively'
|
|
14
14
|
gem.homepage = 'https://github.com/darthjee/arstotzka'
|
|
15
|
-
gem.required_ruby_version = '>=
|
|
15
|
+
gem.required_ruby_version = '>= 3.4.0'
|
|
16
16
|
|
|
17
17
|
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
|
18
18
|
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
19
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
20
19
|
gem.require_paths = ['lib']
|
|
21
20
|
|
|
22
|
-
gem.
|
|
23
|
-
gem.
|
|
24
|
-
|
|
25
|
-
gem.add_development_dependency 'bundler', '1.16.1'
|
|
26
|
-
gem.add_development_dependency 'pry', '0.12.2'
|
|
27
|
-
gem.add_development_dependency 'pry-nav', '0.3.0'
|
|
28
|
-
gem.add_development_dependency 'rake', '13.0.1'
|
|
29
|
-
gem.add_development_dependency 'reek', '5.6.0'
|
|
30
|
-
gem.add_development_dependency 'rspec', '3.9.0'
|
|
31
|
-
gem.add_development_dependency 'rspec-core', '3.9.1'
|
|
32
|
-
gem.add_development_dependency 'rspec-expectations', '3.9.1'
|
|
33
|
-
gem.add_development_dependency 'rspec-mocks', '3.9.1'
|
|
34
|
-
gem.add_development_dependency 'rspec-support', '3.9.2'
|
|
35
|
-
gem.add_development_dependency 'rubocop', '0.80.1'
|
|
36
|
-
gem.add_development_dependency 'rubocop-rspec', '1.38.1'
|
|
37
|
-
gem.add_development_dependency 'rubycritic', '4.4.1'
|
|
38
|
-
gem.add_development_dependency 'simplecov', '0.17.1'
|
|
39
|
-
gem.add_development_dependency 'yard', '0.9.24'
|
|
40
|
-
gem.add_development_dependency 'yardstick', '0.9.9'
|
|
41
|
-
|
|
42
|
-
gem.add_development_dependency 'safe_attribute_assignment'
|
|
21
|
+
gem.add_dependency 'activesupport', '>= 7.x'
|
|
22
|
+
gem.add_dependency 'sinclair', '>= 3.2.0'
|
|
43
23
|
end
|
|
@@ -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,64 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Arstotzka is a Ruby concern (`ActiveSupport::Concern`). A class does `include Arstotzka`
|
|
6
|
+
and declares attributes with the class method `expose`. Each exposed attribute becomes a
|
|
7
|
+
real instance method (built with [Sinclair](https://github.com/darthjee/sinclair)) that,
|
|
8
|
+
when called, builds a `Fetcher` which reads the instance's hash, crawls it through a
|
|
9
|
+
path of keys, wraps/casts the values found and post-processes the result.
|
|
10
|
+
|
|
11
|
+
Options flow through the whole pipeline as a single `Arstotzka::Options` object, created
|
|
12
|
+
from the global defaults in `Arstotzka::Config` merged with the options given to `expose`
|
|
13
|
+
(and the owning `instance`). Every internal class receives these options in its
|
|
14
|
+
constructor and reads only what it needs.
|
|
15
|
+
|
|
16
|
+
Most classes are marked `@api private`; the public API is `Arstotzka` itself,
|
|
17
|
+
`ClassMethods#expose`, `Arstotzka.configure` / `Config`, and `TypeCast` (which users may
|
|
18
|
+
extend with custom `to_<type>` methods).
|
|
19
|
+
|
|
20
|
+
## Source Code Layout
|
|
21
|
+
|
|
22
|
+
All source code lives under `lib/`. `lib/arstotzka.rb` defines the concern and
|
|
23
|
+
autoloads every class in `lib/arstotzka/`.
|
|
24
|
+
|
|
25
|
+
### Declaration (class level)
|
|
26
|
+
|
|
27
|
+
| File | Role |
|
|
28
|
+
|------|------|
|
|
29
|
+
| `class_methods.rb` | `ClassMethods#expose` (public) plus the per-class registry of `FetcherBuilder`s (`add_fetcher`, `fetcher_for`, `builder_for`), inherited by subclasses. |
|
|
30
|
+
| `method_builder.rb` | `MethodBuilder < Sinclair` — registers a `FetcherBuilder` for each attribute and defines the reader method calling `fetcher_for(attr, self).fetch`. |
|
|
31
|
+
| `fetcher_builder.rb` | Holds an attribute's options and builds a `Fetcher` bound to a given instance. |
|
|
32
|
+
| `config.rb` | `Config < Sinclair::Config` — global defaults for `expose` options; builds `Options` objects. |
|
|
33
|
+
| `options.rb` | `Options < Sinclair::Options` — value object with every supported option (`path`, `full_path`, `json`, `type`, `klass`, `cached`, `case`, `compact`, `flatten`, `default`, `after`, `after_each`, `before`, ...). Documents each option. |
|
|
34
|
+
|
|
35
|
+
### Fetching (instance level)
|
|
36
|
+
|
|
37
|
+
| File | Role |
|
|
38
|
+
|------|------|
|
|
39
|
+
| `fetcher.rb` | Orchestrates a fetch: cache → read hash → crawl (with wrapping) → post-process. |
|
|
40
|
+
| `fetcher/cache.rb` | Handles the `cached` option, storing the result in an instance variable. |
|
|
41
|
+
| `hash_reader.rb` | Retrieves the hash to crawl from the instance (via the `json` option: method, instance variable or class variable). |
|
|
42
|
+
| `crawler.rb` | Recursively walks the hash through the keys, descending into arrays, applying `default`/`compact` and calling the wrapper block on final values. |
|
|
43
|
+
| `reader.rb` | Reads the value for the key at a given index of the key path; raises `KeyNotFound` when missing. |
|
|
44
|
+
| `key_reader.rb` | Reads a single key from a hash, trying string and symbol forms. |
|
|
45
|
+
| `key_changer.rb` | Converts a key to the configured case (`lower_camel`, `upper_camel`, `snake`). |
|
|
46
|
+
| `wrapper.rb` | Per-element transformation: `before`, type casting, wrapping in `klass`, `after_each`. |
|
|
47
|
+
| `type_cast.rb` | `to_integer`, `to_float`, `to_string`, `to_symbol` casts; extendable by users. |
|
|
48
|
+
| `post_processor.rb` | Collection-level processing of the crawled result: `flatten`, then `after` method call. |
|
|
49
|
+
|
|
50
|
+
### Support
|
|
51
|
+
|
|
52
|
+
| File | Role |
|
|
53
|
+
|------|------|
|
|
54
|
+
| `base.rb` | Shared helper for classes that receive an `options` object. |
|
|
55
|
+
| `exception.rb` | `Exception::KeyNotFound` and `Exception::FetcherBuilderNotFound`. |
|
|
56
|
+
| `version.rb` | Gem version (`Arstotzka::VERSION`). |
|
|
57
|
+
|
|
58
|
+
## Code Style
|
|
59
|
+
|
|
60
|
+
- Small, single-responsibility classes, each initialised with an options object/hash.
|
|
61
|
+
- Memoised collaborators (`@crawler ||= Crawler.new(options)`).
|
|
62
|
+
- Public methods first, then `protected`/`private`; delegation via `ActiveSupport` `delegate`.
|
|
63
|
+
- Every method, including private ones, carries YARD documentation with `@api` tags and
|
|
64
|
+
`@example` blocks; examples are verified by `spec/integration/yard`.
|