eco-helpers 3.2.18 → 3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +112 -0
- data/lib/eco/api/common/session/base_session.rb +4 -0
- data/lib/eco/api/common/session/environment.rb +5 -0
- data/lib/eco/api/custom/cli.rb +3 -0
- data/lib/eco/api/session/config/api.rb +33 -14
- data/lib/eco/api/usecases/graphql/helpers/access_logs/base/reader.rb +59 -0
- data/lib/eco/api/usecases/graphql/helpers/access_logs/base.rb +17 -0
- data/lib/eco/api/usecases/graphql/helpers/access_logs.rb +7 -0
- data/lib/eco/api/usecases/graphql/helpers/base/connection_reader.rb +70 -0
- data/lib/eco/api/usecases/graphql/helpers/base/graphql_env.rb +6 -2
- data/lib/eco/api/usecases/graphql/helpers/base.rb +1 -0
- data/lib/eco/api/usecases/graphql/helpers/contractors/base/manager_settings.rb +64 -0
- data/lib/eco/api/usecases/graphql/helpers/contractors/base.rb +2 -0
- data/lib/eco/api/usecases/graphql/helpers/dashboards/base/reader.rb +30 -0
- data/lib/eco/api/usecases/graphql/helpers/dashboards/base.rb +20 -0
- data/lib/eco/api/usecases/graphql/helpers/dashboards.rb +7 -0
- data/lib/eco/api/usecases/graphql/helpers/pages/activities.rb +51 -0
- data/lib/eco/api/usecases/graphql/helpers/pages.rb +1 -0
- data/lib/eco/api/usecases/graphql/helpers.rb +2 -0
- data/lib/eco/api/usecases/graphql/samples/contractors/dsl.rb +16 -0
- data/lib/eco/api/usecases/graphql/samples/pages/template/base.rb +46 -37
- data/lib/eco/api/usecases/ooze_samples/register_update_case.rb +6 -2
- data/lib/eco/version.rb +1 -1
- metadata +17 -27
- data/.ai-assistance/conventions/code-working-tree-protocol.md +0 -176
- data/.ai-assistance/scripts/token-logger.js +0 -220
- data/.ai-assistance/scripts/token-report.ts +0 -158
- data/.ai-assistance/scripts/token-session-start.js +0 -66
- data/.ai-assistance/skills/ep-ai-manager/SKILL.md +0 -417
- data/.ai-assistance/skills/ruby-scripting/SKILL.md +0 -215
- data/.ai-assistance/standards-version.json +0 -10
- data/.ai-assistance/token-budget.json +0 -39
- data/.claude/settings.json +0 -103
- data/.gitignore +0 -25
- data/.idea/.gitignore +0 -10
- data/.markdownlint.json +0 -4
- data/.rspec +0 -3
- data/.rubocop.yml +0 -103
- data/.ruby-version +0 -1
- data/.yardopts +0 -10
- data/CLAUDE.md +0 -83
- data/Gemfile +0 -8
- data/Rakefile +0 -38
- data/eco-helpers.gemspec +0 -63
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: ruby-scripting
|
|
3
|
-
version: 0.1.0
|
|
4
|
-
description: >
|
|
5
|
-
AI coding assistant guidelines for internal Ruby scripts that consume ecoPortal's
|
|
6
|
-
Ruby gem stack (ecoportal-api-graphql, ecoportal-api, eco-helpers). Covers gem
|
|
7
|
-
authentication, GraphQL query patterns, mutation patterns, error handling, and
|
|
8
|
-
cross-platform script conventions (Windows/WSL/macOS/Linux).
|
|
9
|
-
triggers:
|
|
10
|
-
- ruby script
|
|
11
|
-
- internal script
|
|
12
|
-
- ecoportal-api
|
|
13
|
-
- graphql query
|
|
14
|
-
- ruby-scripting
|
|
15
|
-
- write a ruby script
|
|
16
|
-
applicable_to:
|
|
17
|
-
- ruby
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
# SKILL: Ruby Scripting (ecoPortal Internal)
|
|
21
|
-
|
|
22
|
-
**Purpose:** Guidelines for AI-assisted authoring of internal Ruby scripts that use the ecoPortal gem stack. These scripts run internally — no customer access; Ruby is not a customer-facing language at ecoPortal.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
- Writing a new script that queries or mutates ecoPortal data via the GraphQL API
|
|
29
|
-
- Debugging or extending an existing script in `ruby_scripts/` or similar
|
|
30
|
-
- Any task involving `ecoportal-api-graphql`, `ecoportal-api`, or `eco-helpers`
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Gem Stack
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
ecoportal-api-graphql ← GraphQL client layer (mutations, queries, models)
|
|
38
|
-
↑
|
|
39
|
-
ecoportal-api / ecoportal-api-v2 ← REST API + base model infrastructure
|
|
40
|
-
↑
|
|
41
|
-
eco-helpers ← Utility helpers (pagination, bulk ops, etc.)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
**Before writing any API call**, check:
|
|
45
|
-
1. Does `eco-helpers` already have a helper for this operation? (It often does.)
|
|
46
|
-
2. Does `ecoportal-api-graphql` already have a model/mutation class?
|
|
47
|
-
3. Read `.ai-assistance/code/dependencies.md` in `ecoportal-api-graphql` for local paths.
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Authentication
|
|
52
|
-
|
|
53
|
-
```ruby
|
|
54
|
-
require 'ecoportal/api'
|
|
55
|
-
|
|
56
|
-
api = Ecoportal::API::V2.new(
|
|
57
|
-
key: ENV.fetch('EP_API_KEY'),
|
|
58
|
-
host: ENV.fetch('EP_API_HOST', 'live.ecoportal.com')
|
|
59
|
-
)
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Always use `ENV.fetch` (not `ENV[]`) — raises on missing key rather than silently using nil.
|
|
63
|
-
Store credentials in `.env` (gitignored). Never hardcode.
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## GraphQL Query Pattern
|
|
68
|
-
|
|
69
|
-
```ruby
|
|
70
|
-
# Read models via GraphQL
|
|
71
|
-
result = api.graphql.query do |q|
|
|
72
|
-
q.current_organization do |org|
|
|
73
|
-
org.name
|
|
74
|
-
org.users(first: 50) do |conn|
|
|
75
|
-
conn.nodes do |user|
|
|
76
|
-
user.id
|
|
77
|
-
user.email
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Check for errors before using data
|
|
84
|
-
raise result.errors.map(&:message).join(', ') if result.errors.any?
|
|
85
|
-
users = result.data.current_organization.users.nodes
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
**Pagination:** use `eco-helpers` pagination helpers for large result sets rather than
|
|
89
|
-
writing manual cursor loops.
|
|
90
|
-
|
|
91
|
-
---
|
|
92
|
-
|
|
93
|
-
## Mutation Pattern
|
|
94
|
-
|
|
95
|
-
```ruby
|
|
96
|
-
# Mutations require patchVer for types that use optimistic locking
|
|
97
|
-
# Always fetch before mutate for those types
|
|
98
|
-
current = api.graphql.query { ... }.data.some_item
|
|
99
|
-
result = api.graphql.mutate do |m|
|
|
100
|
-
m.update_item(input: {
|
|
101
|
-
id: current.id,
|
|
102
|
-
patch_ver: current.patch_ver, # required for patchVer types
|
|
103
|
-
name: "New Name"
|
|
104
|
-
}) do |payload|
|
|
105
|
-
payload.item { |i| i.id; i.name }
|
|
106
|
-
payload.errors { |e| e.message; e.path }
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
raise result.errors.map(&:message).join(', ') if result.errors.any?
|
|
111
|
-
raise result.data.update_item.errors.map(&:message).join(', ') \
|
|
112
|
-
if result.data.update_item.errors.any?
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
**patchVer rule:** any schema type with a `patchVer` field requires reading current value
|
|
116
|
-
before any update. See `graphql-schema-analysis` skill for detection.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Cross-Platform Script Conventions
|
|
121
|
-
|
|
122
|
-
These scripts run on developer machines (Windows/WSL, macOS, Linux CI):
|
|
123
|
-
|
|
124
|
-
```ruby
|
|
125
|
-
# ✅ Safe: Ruby's File/Pathname handles separators cross-platform
|
|
126
|
-
require 'pathname'
|
|
127
|
-
base = Pathname.new(File.dirname(__FILE__))
|
|
128
|
-
data_file = base / 'data' / 'input.json'
|
|
129
|
-
|
|
130
|
-
# ❌ Unsafe: hardcoded separators, or shell assumptions
|
|
131
|
-
data_file = "#{__dir__}\\data\\input.json" # breaks on Linux
|
|
132
|
-
`cat #{data_file}` # assumes Unix shell
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
**Environment detection:**
|
|
136
|
-
```ruby
|
|
137
|
-
WINDOWS = Gem.win_platform?
|
|
138
|
-
# Use for platform-specific paths only — prefer Pathname for everything else
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
**Output:** use `$stdout.puts` not `print` for script output. Use `$stderr.puts` for
|
|
142
|
-
errors. This allows the script to be piped and combined cleanly.
|
|
143
|
-
|
|
144
|
-
**Exit codes:** always `exit 0` on success, `exit 1` on error. Never let an unhandled
|
|
145
|
-
exception be the exit mechanism in production scripts.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Error Handling
|
|
150
|
-
|
|
151
|
-
```ruby
|
|
152
|
-
begin
|
|
153
|
-
# API calls here
|
|
154
|
-
rescue Ecoportal::API::Errors::ApiError => e
|
|
155
|
-
$stderr.puts "API error: #{e.message} (status: #{e.status})"
|
|
156
|
-
exit 1
|
|
157
|
-
rescue => e
|
|
158
|
-
$stderr.puts "Unexpected error: #{e.class}: #{e.message}"
|
|
159
|
-
$stderr.puts e.backtrace.first(5).join("\n")
|
|
160
|
-
exit 1
|
|
161
|
-
end
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
## Script Structure Template
|
|
167
|
-
|
|
168
|
-
```ruby
|
|
169
|
-
#!/usr/bin/env ruby
|
|
170
|
-
# frozen_string_literal: true
|
|
171
|
-
#
|
|
172
|
-
# Script: <name>.rb
|
|
173
|
-
# Purpose: <one sentence>
|
|
174
|
-
# Usage: ruby <name>.rb [options]
|
|
175
|
-
# Dependencies: ecoportal-api-graphql, dotenv
|
|
176
|
-
#
|
|
177
|
-
# Run from repo root: bundle exec ruby scripts/<name>.rb
|
|
178
|
-
|
|
179
|
-
require 'bundler/setup'
|
|
180
|
-
require 'dotenv/load'
|
|
181
|
-
require 'ecoportal/api'
|
|
182
|
-
# ... other requires
|
|
183
|
-
|
|
184
|
-
api = Ecoportal::API::V2.new(
|
|
185
|
-
key: ENV.fetch('EP_API_KEY'),
|
|
186
|
-
host: ENV.fetch('EP_API_HOST', 'live.ecoportal.com')
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
begin
|
|
190
|
-
# main logic here
|
|
191
|
-
rescue => e
|
|
192
|
-
$stderr.puts "Error: #{e.class}: #{e.message}"
|
|
193
|
-
exit 1
|
|
194
|
-
end
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## What NOT to do
|
|
200
|
-
|
|
201
|
-
- Don't write raw HTTP calls to the EcoPortal API — use the gem stack
|
|
202
|
-
- Don't paginate manually — use `eco-helpers` pagination
|
|
203
|
-
- Don't hardcode API keys, hosts, or org identifiers
|
|
204
|
-
- Don't use `pp` or `binding.pry` in committed scripts — use structured logging
|
|
205
|
-
- Don't assume a Unix shell — use Ruby cross-platform file handling
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## v0.1.0 limitations
|
|
210
|
-
|
|
211
|
-
This skill covers general patterns. For area-specific details (specific GraphQL models,
|
|
212
|
-
available mutation inputs, schema patterns), consult:
|
|
213
|
-
- `ecoportal-api-graphql/.ai-assistance/code/` for code specs
|
|
214
|
-
- `ecoportal-api-graphql/.ai-assistance/skills/graphql-schema-analysis/SKILL.md`
|
|
215
|
-
- Live schema introspection (see graphql-schema-analysis skill)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schema_version": "1.0",
|
|
3
|
-
"project": {
|
|
4
|
-
"name": "eco-helpers",
|
|
5
|
-
"priority": "low",
|
|
6
|
-
"developer": "oscar@ecoportal.co.nz"
|
|
7
|
-
},
|
|
8
|
-
"weekly_quota": {
|
|
9
|
-
"total_tokens": null,
|
|
10
|
-
"target_utilization_pct": 75,
|
|
11
|
-
"reset_day": "monday",
|
|
12
|
-
"note": "total_tokens: null means track actuals without a hard cap. Set to e.g. 1000000 to enforce a budget."
|
|
13
|
-
},
|
|
14
|
-
"project_allocation": {
|
|
15
|
-
"priority_weights": {
|
|
16
|
-
"high": 50,
|
|
17
|
-
"medium": 30,
|
|
18
|
-
"low": 20
|
|
19
|
-
},
|
|
20
|
-
"note": "A 'high' priority project gets ~50% of the weekly budget; 'medium' gets ~30%; 'low' gets ~20%. These are soft targets — the system warns, not blocks."
|
|
21
|
-
},
|
|
22
|
-
"session_logging": {
|
|
23
|
-
"enabled": true,
|
|
24
|
-
"log_dir": ".ai-assistance/local/kpi",
|
|
25
|
-
"warn_at_pct": 80,
|
|
26
|
-
"prompt_category_at_stop": true
|
|
27
|
-
},
|
|
28
|
-
"task_categories": [
|
|
29
|
-
"coding",
|
|
30
|
-
"bug_fixing",
|
|
31
|
-
"bug_prevention",
|
|
32
|
-
"documentation",
|
|
33
|
-
"communication",
|
|
34
|
-
"post_release",
|
|
35
|
-
"troubleshooting",
|
|
36
|
-
"integration_delivery",
|
|
37
|
-
"skills_development"
|
|
38
|
-
]
|
|
39
|
-
}
|
data/.claude/settings.json
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"defaultMode": "auto",
|
|
4
|
-
"allowedTools": [
|
|
5
|
-
"Read"
|
|
6
|
-
],
|
|
7
|
-
"permissionRules": [
|
|
8
|
-
{
|
|
9
|
-
"tool": "Write",
|
|
10
|
-
"pattern": "/**",
|
|
11
|
-
"action": "allow"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"tool": "StrReplace",
|
|
15
|
-
"pattern": "/**",
|
|
16
|
-
"action": "allow"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"allow": [
|
|
20
|
-
"WebFetch(domain:anthropic.com)",
|
|
21
|
-
"WebFetch(domain:npmjs.com)",
|
|
22
|
-
"Write(.glaudeignore)",
|
|
23
|
-
"Update(.glaudeignore)",
|
|
24
|
-
"Bash(rm .ai-assistance/bridge/LOCK)",
|
|
25
|
-
"Read(.git/**)",
|
|
26
|
-
"Read(**/rubygems/**)",
|
|
27
|
-
"Write(*.md)",
|
|
28
|
-
"Edit(.ai-assistance/**)",
|
|
29
|
-
"Update(.ai-assistance/**)",
|
|
30
|
-
"Write(.ai-assistance/**)",
|
|
31
|
-
"Write(lib/**)",
|
|
32
|
-
"Write(spec/**)",
|
|
33
|
-
"Bash(git status)",
|
|
34
|
-
"Bash(git diff *)",
|
|
35
|
-
"Bash(git log *)",
|
|
36
|
-
"Bash(git add *)",
|
|
37
|
-
"Bash(git commit *)",
|
|
38
|
-
"PowerShell(git status)",
|
|
39
|
-
"PowerShell(git diff *)",
|
|
40
|
-
"PowerShell(git log *)",
|
|
41
|
-
"PowerShell(git add *)",
|
|
42
|
-
"PowerShell(git commit *)",
|
|
43
|
-
"Bash(npm test)",
|
|
44
|
-
"Bash(npm run lint)",
|
|
45
|
-
"Bash(npm run build)",
|
|
46
|
-
"Bash(vitest *)",
|
|
47
|
-
"Bash(jest *)",
|
|
48
|
-
"PowerShell(npm test)",
|
|
49
|
-
"PowerShell(npm run lint)",
|
|
50
|
-
"PowerShell(npm run build)",
|
|
51
|
-
"Bash(black .)",
|
|
52
|
-
"Bash(pytest)",
|
|
53
|
-
"Bash(python -m unittest)",
|
|
54
|
-
"Bash(ruff check *)",
|
|
55
|
-
"Bash(bundle exec rspec *)",
|
|
56
|
-
"Bash(bundle exec rubocop *)",
|
|
57
|
-
"PowerShell(pytest)",
|
|
58
|
-
"PowerShell(python -m unittest)",
|
|
59
|
-
"PowerShell(ruff check *)",
|
|
60
|
-
"PowerShell(bundle exec rspec *)",
|
|
61
|
-
"PowerShell(bundle exec rubocop *)",
|
|
62
|
-
"Bash(node .ai-assistance/scripts/token-logger.js)",
|
|
63
|
-
"Bash(node .ai-assistance/scripts/token-session-start.js)"
|
|
64
|
-
],
|
|
65
|
-
"deny": [
|
|
66
|
-
"Read(*.env)",
|
|
67
|
-
"Read(./.env*)",
|
|
68
|
-
"Read(./secrets/**)",
|
|
69
|
-
"Bash(*cat *.env*)",
|
|
70
|
-
"Bash(*grep *.env*)",
|
|
71
|
-
"Bash(printenv*)",
|
|
72
|
-
"Bash(env)",
|
|
73
|
-
"Write(.git/*)",
|
|
74
|
-
"Edit(.git/*)",
|
|
75
|
-
"Bash(git push *)",
|
|
76
|
-
"Bash(rm -rf *)"
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
"hooks": {
|
|
80
|
-
"SessionStart": [
|
|
81
|
-
{
|
|
82
|
-
"matcher": "",
|
|
83
|
-
"hooks": [
|
|
84
|
-
{
|
|
85
|
-
"type": "command",
|
|
86
|
-
"command": "node .ai-assistance/scripts/token-session-start.js 2>/dev/null || true"
|
|
87
|
-
}
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
"Stop": [
|
|
92
|
-
{
|
|
93
|
-
"matcher": "",
|
|
94
|
-
"hooks": [
|
|
95
|
-
{
|
|
96
|
-
"type": "command",
|
|
97
|
-
"command": "node .ai-assistance/scripts/token-logger.js 2>/dev/null || true"
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
}
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
}
|
data/.gitignore
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# it's a gem, ignore the lockfile
|
|
2
|
-
Gemfile.lock
|
|
3
|
-
|
|
4
|
-
# build artifacts
|
|
5
|
-
*.gem
|
|
6
|
-
/.bundle
|
|
7
|
-
/.vscode
|
|
8
|
-
.solargraph.yml
|
|
9
|
-
/vendor/bundle
|
|
10
|
-
/spec/reports/
|
|
11
|
-
/tmp/
|
|
12
|
-
/pkg/
|
|
13
|
-
|
|
14
|
-
# docs
|
|
15
|
-
/.yardoc
|
|
16
|
-
/_yardoc/
|
|
17
|
-
/coverage/
|
|
18
|
-
/doc/
|
|
19
|
-
|
|
20
|
-
# rspec failure tracking
|
|
21
|
-
.rspec_status
|
|
22
|
-
scratch.rb
|
|
23
|
-
.byebug_history
|
|
24
|
-
|
|
25
|
-
.ai-assistance/local/
|
data/.idea/.gitignore
DELETED
data/.markdownlint.json
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
AllCops:
|
|
2
|
-
TargetRubyVersion: 3.2
|
|
3
|
-
Exclude:
|
|
4
|
-
- 'config/routes.rb'
|
|
5
|
-
NewCops: enable
|
|
6
|
-
|
|
7
|
-
Metrics/ClassLength:
|
|
8
|
-
Max: 500
|
|
9
|
-
Metrics/ModuleLength:
|
|
10
|
-
Max: 300
|
|
11
|
-
Metrics/MethodLength:
|
|
12
|
-
Max: 50
|
|
13
|
-
Metrics/AbcSize:
|
|
14
|
-
Max: 30
|
|
15
|
-
Metrics/ParameterLists:
|
|
16
|
-
Max: 5
|
|
17
|
-
CountKeywordArgs: false
|
|
18
|
-
Metrics/BlockLength:
|
|
19
|
-
CountAsOne: ['array', 'heredoc', 'method_call']
|
|
20
|
-
Max: 50
|
|
21
|
-
Metrics/CyclomaticComplexity:
|
|
22
|
-
Max: 30
|
|
23
|
-
Metrics/PerceivedComplexity:
|
|
24
|
-
Max: 30
|
|
25
|
-
|
|
26
|
-
Style/AccessorGrouping:
|
|
27
|
-
Enabled: false
|
|
28
|
-
Style/ConditionalAssignment:
|
|
29
|
-
Enabled: false
|
|
30
|
-
Style/BlockDelimiters:
|
|
31
|
-
BracesRequiredMethods: ['log']
|
|
32
|
-
AllowedPatterns: ['proc', 'new']
|
|
33
|
-
Style/HashSyntax:
|
|
34
|
-
EnforcedShorthandSyntax: either
|
|
35
|
-
EnforcedStyle: no_mixed_keys
|
|
36
|
-
|
|
37
|
-
Style/ArgumentsForwarding:
|
|
38
|
-
UseAnonymousForwarding: false
|
|
39
|
-
Style/ClassAndModuleChildren:
|
|
40
|
-
Enabled: false
|
|
41
|
-
Style/FrozenStringLiteralComment:
|
|
42
|
-
Enabled: false
|
|
43
|
-
Style/StringLiterals:
|
|
44
|
-
Enabled: false
|
|
45
|
-
Style/StringLiteralsInInterpolation:
|
|
46
|
-
Enabled: false
|
|
47
|
-
Style/Documentation:
|
|
48
|
-
Enabled: false
|
|
49
|
-
Style/CommentedKeyword:
|
|
50
|
-
Enabled: false
|
|
51
|
-
Style/MultilineBlockChain:
|
|
52
|
-
Enabled: false
|
|
53
|
-
Style/AndOr:
|
|
54
|
-
Enabled: false
|
|
55
|
-
Style/Alias:
|
|
56
|
-
EnforcedStyle: prefer_alias_method
|
|
57
|
-
Style/FetchEnvVar:
|
|
58
|
-
Enabled: false
|
|
59
|
-
Style/RegexpLiteral:
|
|
60
|
-
EnforcedStyle: mixed
|
|
61
|
-
AllowInnerSlashes: true
|
|
62
|
-
|
|
63
|
-
Layout/HashAlignment:
|
|
64
|
-
EnforcedColonStyle: table
|
|
65
|
-
EnforcedHashRocketStyle: table
|
|
66
|
-
Layout/LeadingCommentSpace:
|
|
67
|
-
Enabled: false
|
|
68
|
-
AllowGemfileRubyComment: true
|
|
69
|
-
Layout/ParameterAlignment:
|
|
70
|
-
Enabled: false
|
|
71
|
-
Layout/MultilineMethodDefinitionBraceLayout:
|
|
72
|
-
EnforcedStyle: symmetrical
|
|
73
|
-
Layout/LineLength:
|
|
74
|
-
Enabled: true
|
|
75
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
76
|
-
Enabled: false
|
|
77
|
-
Layout/SpaceInsideBlockBraces:
|
|
78
|
-
Enabled: false
|
|
79
|
-
Layout/SpaceAroundOperators:
|
|
80
|
-
Enabled: false
|
|
81
|
-
Layout/ExtraSpacing:
|
|
82
|
-
AllowForAlignment: true
|
|
83
|
-
AllowBeforeTrailingComments: true
|
|
84
|
-
Layout/AccessModifierIndentation:
|
|
85
|
-
EnforcedStyle: indent
|
|
86
|
-
Layout/DotPosition:
|
|
87
|
-
EnforcedStyle: trailing
|
|
88
|
-
Layout/MultilineMethodCallIndentation:
|
|
89
|
-
EnforcedStyle: indented
|
|
90
|
-
Layout/FirstHashElementIndentation:
|
|
91
|
-
Enabled: false
|
|
92
|
-
Layout/EmptyLineAfterGuardClause:
|
|
93
|
-
Enabled: false
|
|
94
|
-
|
|
95
|
-
Naming/VariableNumber:
|
|
96
|
-
EnforcedStyle: snake_case
|
|
97
|
-
CheckSymbols: false
|
|
98
|
-
Naming/MethodParameterName:
|
|
99
|
-
AllowedNames: ['x', 'y', 'i', 'j', 'id', 'io', 'to']
|
|
100
|
-
Naming/RescuedExceptionsVariableName:
|
|
101
|
-
Enabled: false
|
|
102
|
-
Naming/BlockForwarding:
|
|
103
|
-
Enabled: false
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.2.2
|
data/.yardopts
DELETED
data/CLAUDE.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md — eco-helpers
|
|
2
|
-
|
|
3
|
-
AI agent instructions for this repository.
|
|
4
|
-
|
|
5
|
-
**Cross-cutting architecture context lives in `ecoportal-api-graphql` — see its `CLAUDE.md` and `.claude/` folder for the full dependency map, project history, and shared skills.**
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Repository Role
|
|
10
|
-
|
|
11
|
-
`eco-helpers` is the **primary downstream consumer** of the EcoPortal API gem stack. It provides a scripting and automation framework for interacting with EcoPortal — CLI tooling, use-case orchestration, data transformation, and batch operations.
|
|
12
|
-
|
|
13
|
-
**Position in chain:**
|
|
14
|
-
```
|
|
15
|
-
ecoportal-api
|
|
16
|
-
ecoportal-api-v2
|
|
17
|
-
ecoportal-api-graphql
|
|
18
|
-
↓
|
|
19
|
-
eco-helpers ← THIS REPO
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
**Remote:** https://gitlab.ecoportal.co.nz/oscar/script_api_helpers.git
|
|
23
|
-
|
|
24
|
-
**Gem dependencies on the stack:**
|
|
25
|
-
- `ecoportal-api ~> 0.10, >= 0.10.14`
|
|
26
|
-
- `ecoportal-api-v2 ~> 3.3, >= 3.3.1`
|
|
27
|
-
- `ecoportal-api-graphql ~> 1.3, >= 1.3.4`
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Key Folder Layout
|
|
32
|
-
|
|
33
|
-
```
|
|
34
|
-
lib/eco/
|
|
35
|
-
api/ API integration layer
|
|
36
|
-
common/ Shared helpers
|
|
37
|
-
microcases/ Fine-grained reusable operations
|
|
38
|
-
organization/ Org-level resources
|
|
39
|
-
session.rb Session management (entry point for scripting)
|
|
40
|
-
usecases.rb Use-case registry
|
|
41
|
-
policies.rb Access policies
|
|
42
|
-
cli/ CLI framework
|
|
43
|
-
cli_default/ Default CLI options, filters, people workflows
|
|
44
|
-
common/ Cross-cutting utilities
|
|
45
|
-
csv/ CSV reading, streaming, splitting
|
|
46
|
-
data/ Data utilities (fuzzy match, hashes, locations, strings, files)
|
|
47
|
-
language/ Logging, curry, auxiliar utilities
|
|
48
|
-
assets/ Static assets (language files etc.)
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Namespace
|
|
54
|
-
|
|
55
|
-
`Eco::` — entirely separate namespace from `Ecoportal::`. Does not reopen upstream gem namespaces.
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Key Concerns
|
|
60
|
-
|
|
61
|
-
- This gem is the **backwards-compatibility target** for all upstream gems. When `ecoportal-api-graphql` changes its public interface, check usage here first.
|
|
62
|
-
- `Eco::API::Session` is the main consumer of `Ecoportal::API::GraphQL` — it's the first place to look when checking how GraphQL features are used downstream.
|
|
63
|
-
- The CLI layer (`Eco::CLI`) uses Thor-style commands — changes to API interfaces may silently break CLI workflows if not tested end-to-end.
|
|
64
|
-
- Many operations are batch-oriented with progress logging — error handling and partial-failure behaviour matters.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
## How to Find GraphQL Usage
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
grep -r "GraphQL\|graphql\|ecoportal-api-graphql" lib/ --include="*.rb" -l
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
This shows which files directly use the GraphQL gem — useful when assessing impact of upstream changes.
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## Running Tests
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
bundle install
|
|
82
|
-
bundle exec rspec
|
|
83
|
-
```
|
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require 'bundler/gem_tasks'
|
|
2
|
-
require 'rspec/core/rake_task'
|
|
3
|
-
require 'rubocop/rake_task'
|
|
4
|
-
require 'yard'
|
|
5
|
-
require 'redcarpet'
|
|
6
|
-
|
|
7
|
-
desc "run the specs"
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
-
|
|
10
|
-
desc "run rspec showing backtrace"
|
|
11
|
-
RSpec::Core::RakeTask.new(:spec_trace) do |task|
|
|
12
|
-
task.rspec_opts = ['--backtrace']
|
|
13
|
-
end
|
|
14
|
-
task(rspec_trace: :spec_trace)
|
|
15
|
-
|
|
16
|
-
desc "run rspec stopping on first fail, and show backtrace"
|
|
17
|
-
RSpec::Core::RakeTask.new(:spec_fast) do |task|
|
|
18
|
-
task.rspec_opts = ['--fail-fast', '--backtrace']
|
|
19
|
-
end
|
|
20
|
-
task(rspec_fast: :spec_fast)
|
|
21
|
-
|
|
22
|
-
desc "run rubocop diaplying cop names"
|
|
23
|
-
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
24
|
-
t.options = ['--display-cop-names']
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# default task name is yard
|
|
28
|
-
desc "Yard: generate all the documentation"
|
|
29
|
-
YARD::Rake::YardocTask.new(:doc) do |t|
|
|
30
|
-
#t.files = ['lib/**/*.rb']
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
desc "default task: runs rubocop and rspec"
|
|
34
|
-
task :default do
|
|
35
|
-
Rake::Task[:rubocop].invoke
|
|
36
|
-
ensure
|
|
37
|
-
Rake::Task[:spec].invoke
|
|
38
|
-
end
|