ecoportal-api-graphql 1.3.14 → 1.3.15
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/.ai-assistance/projects/TODO.md +170 -118
- data/.ai-assistance/skills/ai-instructions/SKILL.md +48 -48
- data/.ai-assistance/skills/code-specs/SKILL.md +69 -69
- data/.ai-assistance/skills/gemini-assist/SKILL.md +63 -63
- data/.ai-assistance/skills/project-cycle/SKILL.md +177 -177
- data/.ai-assistance/skills/refactor/SKILL.md +62 -62
- data/.ai-assistance/skills/spec-generation/SKILL.md +72 -72
- data/.gitlab-ci.yml +64 -12
- data/CHANGELOG.md +60 -0
- data/changelog.d/fixed-mr51-payload-item-mismatches.md +17 -0
- data/lib/ecoportal/api/common/graphql/http_client.rb +6 -0
- data/lib/ecoportal/api/graphql/base/ai_summary_version.rb +17 -17
- data/lib/ecoportal/api/graphql/base/page/task.rb +24 -0
- data/lib/ecoportal/api/graphql/base/page.rb +17 -16
- data/lib/ecoportal/api/graphql/base/template.rb +35 -0
- data/lib/ecoportal/api/graphql/base.rb +2 -0
- data/lib/ecoportal/api/graphql/compat/response.rb +35 -35
- data/lib/ecoportal/api/graphql/file_upload/client.rb +21 -10
- data/lib/ecoportal/api/graphql/fragment/field_configuration.rb +38 -0
- data/lib/ecoportal/api/graphql/fragment/force.rb +14 -10
- data/lib/ecoportal/api/graphql/fragment/page_task.rb +39 -0
- data/lib/ecoportal/api/graphql/fragment/template.rb +51 -0
- data/lib/ecoportal/api/graphql/fragment.rb +3 -0
- data/lib/ecoportal/api/graphql/model/page/task.rb +16 -0
- data/lib/ecoportal/api/graphql/model/page.rb +16 -15
- data/lib/ecoportal/api/graphql/model/template.rb +15 -0
- data/lib/ecoportal/api/graphql/model.rb +2 -0
- data/lib/ecoportal/api/graphql/mutation/ai_summary/generate.rb +45 -45
- data/lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/approve_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/batch_update_review_task.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/create_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/delete_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/execute_force_commands.rb +7 -7
- data/lib/ecoportal/api/graphql/mutation/page/execute_workflow_commands.rb +8 -7
- data/lib/ecoportal/api/graphql/mutation/page/publish_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/reject_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/restart_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/undo_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/preset_view/destroy.rb +34 -35
- data/lib/ecoportal/api/graphql/mutation/register/destroy.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/smart_fill/generate.rb +36 -36
- data/lib/ecoportal/api/graphql/mutation/smart_fill/submit_feedback.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/smart_fill.rb +13 -13
- data/lib/ecoportal/api/graphql/mutation/template/create_related_page.rb +46 -46
- data/lib/ecoportal/api/graphql/mutation/template/destroy_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/template/update_information.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation.rb +20 -20
- data/lib/ecoportal/api/graphql/payload/ok_payload.rb +36 -21
- data/lib/ecoportal/api/graphql/payload/page/draft.rb +26 -13
- data/lib/ecoportal/api/graphql/payload/page/review_task.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/review_task_batch.rb +23 -0
- data/lib/ecoportal/api/graphql/payload/page.rb +20 -19
- data/lib/ecoportal/api/graphql/payload/preset_view.rb +15 -11
- data/lib/ecoportal/api/graphql/payload/register.rb +15 -11
- data/lib/ecoportal/api/graphql/payload/template/create_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/template/destroy_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/template/update_information.rb +1 -1
- data/lib/ecoportal/api/graphql/query/page_with_forces.rb +9 -3
- data/lib/ecoportal/api/graphql/query/pages_workflow_commands.rb +9 -3
- data/lib/ecoportal/api/graphql/query/register_preset_views.rb +78 -78
- data/lib/ecoportal/api/graphql.rb +9 -5
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- data/tests/dump_schema.rb +88 -0
- data/tests/validate_queries.rb +34 -12
- metadata +11 -1
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
# SKILL: Gemini Assist
|
|
2
|
-
|
|
3
|
-
**Purpose:** Offload large-context tasks to Gemini to save Claude token quota, speed up development, and leverage Gemini's wide context window.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## When to Use
|
|
8
|
-
|
|
9
|
-
- The task requires reading many files at once (e.g. whole-gem analysis, cross-cutting refactor planning).
|
|
10
|
-
- A task is mostly "read and summarise / read and advise" rather than "write code" — Gemini handles these cheaply.
|
|
11
|
-
- You're doing a cycle-end review and want a second pass over a large diff or many changed files.
|
|
12
|
-
- Token budget is running low and the task doesn't require Claude's nuanced judgement for the current step.
|
|
13
|
-
|
|
14
|
-
## When NOT to Use
|
|
15
|
-
|
|
16
|
-
- Tasks that require writing or editing actual code (Claude applies changes; Gemini only advises).
|
|
17
|
-
- Tasks where hallucination risk is high and verification would cost more time than doing it directly.
|
|
18
|
-
- Short tasks that fit comfortably in Claude's context — the overhead isn't worth it.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## How to Invoke
|
|
23
|
-
|
|
24
|
-
Run from the repo root:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
28
|
-
--prompt "Your question or instruction here" \
|
|
29
|
-
--files path/to/file1.rb path/to/file2.rb \
|
|
30
|
-
[--model gemini-1.5-pro]
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Or pass a prompt file:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
37
|
-
--prompt-file .ai-assistance/skills/gemini-assist/prompts/cycle_end_review.txt \
|
|
38
|
-
--files "lib/ecoportal/api/graphql/**/*.rb"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
**Environment variable required:** `GEMINI_API_KEY` — set in `.env` at repo root (git-ignored).
|
|
42
|
-
**Optional:** `GEMINI_MODEL` — defaults to `gemini-1.5-pro`. Override in `.env` or via `--model`.
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## Output Handling (IMPORTANT)
|
|
47
|
-
|
|
48
|
-
Gemini responses **must always be reviewed** before acting on them:
|
|
49
|
-
|
|
50
|
-
1. Read the response carefully.
|
|
51
|
-
2. Cross-check any specific claims (method names, class hierarchies, argument counts) against the actual code.
|
|
52
|
-
3. Where Gemini proposes code changes, treat them as a draft — apply only after verifying correctness.
|
|
53
|
-
4. Where Gemini flags issues in a cycle-end review, confirm each issue is real before proposing a fix to the developer.
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Prompting Tips for Best Results
|
|
58
|
-
|
|
59
|
-
- Give Gemini explicit instructions: what to look for, what to ignore, what format to respond in.
|
|
60
|
-
- Tell it the role: "You are reviewing a Ruby gem. Focus on X. Do not suggest Y."
|
|
61
|
-
- Ask for a structured output (e.g. "Respond with a numbered list of concerns, each with: file, line range, issue, suggested fix").
|
|
62
|
-
- For large reviews, ask it to triage by severity first.
|
|
63
|
-
- Use the pre-built prompt in `prompts/cycle_end_review.txt` for end-of-cycle reviews.
|
|
1
|
+
# SKILL: Gemini Assist
|
|
2
|
+
|
|
3
|
+
**Purpose:** Offload large-context tasks to Gemini to save Claude token quota, speed up development, and leverage Gemini's wide context window.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- The task requires reading many files at once (e.g. whole-gem analysis, cross-cutting refactor planning).
|
|
10
|
+
- A task is mostly "read and summarise / read and advise" rather than "write code" — Gemini handles these cheaply.
|
|
11
|
+
- You're doing a cycle-end review and want a second pass over a large diff or many changed files.
|
|
12
|
+
- Token budget is running low and the task doesn't require Claude's nuanced judgement for the current step.
|
|
13
|
+
|
|
14
|
+
## When NOT to Use
|
|
15
|
+
|
|
16
|
+
- Tasks that require writing or editing actual code (Claude applies changes; Gemini only advises).
|
|
17
|
+
- Tasks where hallucination risk is high and verification would cost more time than doing it directly.
|
|
18
|
+
- Short tasks that fit comfortably in Claude's context — the overhead isn't worth it.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## How to Invoke
|
|
23
|
+
|
|
24
|
+
Run from the repo root:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
28
|
+
--prompt "Your question or instruction here" \
|
|
29
|
+
--files path/to/file1.rb path/to/file2.rb \
|
|
30
|
+
[--model gemini-1.5-pro]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or pass a prompt file:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
37
|
+
--prompt-file .ai-assistance/skills/gemini-assist/prompts/cycle_end_review.txt \
|
|
38
|
+
--files "lib/ecoportal/api/graphql/**/*.rb"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Environment variable required:** `GEMINI_API_KEY` — set in `.env` at repo root (git-ignored).
|
|
42
|
+
**Optional:** `GEMINI_MODEL` — defaults to `gemini-1.5-pro`. Override in `.env` or via `--model`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Output Handling (IMPORTANT)
|
|
47
|
+
|
|
48
|
+
Gemini responses **must always be reviewed** before acting on them:
|
|
49
|
+
|
|
50
|
+
1. Read the response carefully.
|
|
51
|
+
2. Cross-check any specific claims (method names, class hierarchies, argument counts) against the actual code.
|
|
52
|
+
3. Where Gemini proposes code changes, treat them as a draft — apply only after verifying correctness.
|
|
53
|
+
4. Where Gemini flags issues in a cycle-end review, confirm each issue is real before proposing a fix to the developer.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Prompting Tips for Best Results
|
|
58
|
+
|
|
59
|
+
- Give Gemini explicit instructions: what to look for, what to ignore, what format to respond in.
|
|
60
|
+
- Tell it the role: "You are reviewing a Ruby gem. Focus on X. Do not suggest Y."
|
|
61
|
+
- Ask for a structured output (e.g. "Respond with a numbered list of concerns, each with: file, line range, issue, suggested fix").
|
|
62
|
+
- For large reviews, ask it to triage by severity first.
|
|
63
|
+
- Use the pre-built prompt in `prompts/cycle_end_review.txt` for end-of-cycle reviews.
|
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
# SKILL: Project Preparation, Maintenance & Cycle
|
|
2
|
-
|
|
3
|
-
**Purpose:** Capture, organise, and track a development project from intent through completion, including upstream dependency decisions and cycle-end review.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## When to Use
|
|
8
|
-
|
|
9
|
-
- A developer describes a new piece of work.
|
|
10
|
-
- Picking up an existing project after a gap.
|
|
11
|
-
- A cycle of changes is complete and needs a closing review.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Folder Structure
|
|
16
|
-
|
|
17
|
-
```
|
|
18
|
-
.ai-assistance/projects/<project-slug>/
|
|
19
|
-
INTENT.md What we're trying to achieve and why
|
|
20
|
-
TODO.md Ordered task list, ticked off as done
|
|
21
|
-
DECISIONS.md Key decisions made and why
|
|
22
|
-
UPSTREAM.md Upstream dependency changes needed (if any)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Project folders are **not git-ignored** — they should be committed so other developers can pick up context.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Starting a Project
|
|
30
|
-
|
|
31
|
-
1. Ask the developer: "What are we trying to change and why?"
|
|
32
|
-
2. Capture the answer in `INTENT.md` (see template below).
|
|
33
|
-
3. Present it back: "Here's my understanding — does this capture it?" Iterate until confirmed.
|
|
34
|
-
4. Break the intent into an ordered TODO list in `TODO.md`.
|
|
35
|
-
5. If upstream deps are involved, create `UPSTREAM.md` and present options (patch, fork, new version).
|
|
36
|
-
|
|
37
|
-
### INTENT.md template
|
|
38
|
-
|
|
39
|
-
```markdown
|
|
40
|
-
# Project: <Name>
|
|
41
|
-
|
|
42
|
-
**Created:** YYYY-MM-DD
|
|
43
|
-
**Status:** [active | paused | complete]
|
|
44
|
-
**Branch:** feature/<slug>
|
|
45
|
-
**Target branch:** main
|
|
46
|
-
|
|
47
|
-
## Goal
|
|
48
|
-
One paragraph: what we want to achieve.
|
|
49
|
-
|
|
50
|
-
## Motivation
|
|
51
|
-
Why now? What problem does this solve?
|
|
52
|
-
|
|
53
|
-
## Scope
|
|
54
|
-
What's in scope. What's explicitly out of scope.
|
|
55
|
-
|
|
56
|
-
## Success Criteria
|
|
57
|
-
How we'll know it's done.
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## TODO.md format
|
|
63
|
-
|
|
64
|
-
```markdown
|
|
65
|
-
# TODOs — <Project Name>
|
|
66
|
-
|
|
67
|
-
- [ ] Task description <!-- add detail as needed -->
|
|
68
|
-
- [x] Completed task
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Tick items off as they're completed. Never delete items — the history matters.
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## DECISIONS.md format
|
|
76
|
-
|
|
77
|
-
```markdown
|
|
78
|
-
# Decisions — <Project Name>
|
|
79
|
-
|
|
80
|
-
## [DATE] <Decision title>
|
|
81
|
-
|
|
82
|
-
**Context:** What made this decision necessary.
|
|
83
|
-
**Options considered:** Brief list.
|
|
84
|
-
**Decision:** What was chosen.
|
|
85
|
-
**Reason:** Why.
|
|
86
|
-
**Consequences:** What this means going forward.
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Session Start — Git Orientation (Always Do This)
|
|
92
|
-
|
|
93
|
-
Before any other work, run:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# 1. Confirm current branch
|
|
97
|
-
git branch --show-current
|
|
98
|
-
|
|
99
|
-
# 2. Check how far ahead of target branch
|
|
100
|
-
git rev-list --count main..HEAD
|
|
101
|
-
|
|
102
|
-
# 3. Get a cheap summary of what's changed
|
|
103
|
-
git diff main...HEAD --stat
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Cross-reference the diff stat against the active project's `TODO.md`:
|
|
107
|
-
- Changed files should map to ticked TODO items.
|
|
108
|
-
- Unticked TODOs with no corresponding changed files = work not yet started.
|
|
109
|
-
- Changed files with no corresponding TODO = untracked work, worth noting.
|
|
110
|
-
|
|
111
|
-
If **GitKraken MCP** is connected, use it instead — it returns the same information as structured data without a bash call.
|
|
112
|
-
|
|
113
|
-
If the branch in `INTENT.md` doesn't match the current branch, flag it to the developer before proceeding.
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Cycle-End Review
|
|
118
|
-
|
|
119
|
-
When all TODOs are ticked:
|
|
120
|
-
|
|
121
|
-
1. **Git summary:** Run `git diff main...HEAD --name-only` to get the exact file list.
|
|
122
|
-
2. **Gemini review:** Pass changed files to `gemini-assist` using the `cycle_end_review.txt` prompt:
|
|
123
|
-
```bash
|
|
124
|
-
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
125
|
-
--prompt-file .ai-assistance/skills/gemini-assist/prompts/cycle_end_review.txt \
|
|
126
|
-
--output .ai-assistance/projects/<slug>/gemini_review.txt \
|
|
127
|
-
--files $(git diff main...HEAD --name-only | tr '\n' ' ')
|
|
128
|
-
```
|
|
129
|
-
3. Review Gemini's output — verify each claim against actual code before acting.
|
|
130
|
-
4. Propose fixes for genuine issues — confirm with developer.
|
|
131
|
-
5. **If GitLab MCP is connected:** Check `get_merge_request_pipelines` to confirm CI is green.
|
|
132
|
-
6. Update `INTENT.md` status to `complete`.
|
|
133
|
-
7. Prompt: "Ready to open the MR / start the next project?"
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Upstream Dependency Changes
|
|
138
|
-
|
|
139
|
-
If changes require modifying an upstream gem:
|
|
140
|
-
|
|
141
|
-
Options (present all three to developer):
|
|
142
|
-
|
|
143
|
-
1. **Local patch** — monkey-patch from this gem. Fast, messy, temporary.
|
|
144
|
-
2. **Fork change** — commit to our fork (for `graphlient` or `graphql-client`). Appropriate for lasting fixes we own.
|
|
145
|
-
3. **New version** — for `ecoportal-api` or `ecoportal-api-v2` (team-owned), cut a new version. For external forks, optionally contribute back upstream.
|
|
146
|
-
|
|
147
|
-
Document the decision in `UPSTREAM.md` and `DECISIONS.md`.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## Session / Collaborator Setup (First Time on a Machine)
|
|
152
|
-
|
|
153
|
-
When starting a session and `.ai-assistance/local_paths.md` does not exist, run this setup flow **before** any project work:
|
|
154
|
-
|
|
155
|
-
1. Tell the developer: "I don't see a `local_paths.md` for your machine yet. This helps me cross-reference upstream and downstream gem code without fetching from remotes every time."
|
|
156
|
-
|
|
157
|
-
2. For each dependency in the table below, ask: "Do you have `<gem>` cloned locally?"
|
|
158
|
-
|
|
159
|
-
| Gem | Remote |
|
|
160
|
-
|-----|--------|
|
|
161
|
-
| `ecoportal-api` | https://gitlab.ecoportal.co.nz/ecoportal/ecoportal-api.git |
|
|
162
|
-
| `ecoportal-api-v2` | https://gitlab.ecoportal.co.nz/oscar/ecoportal-api-v2.git |
|
|
163
|
-
| `graphlient` | https://github.com/rellampec/graphlient.git |
|
|
164
|
-
| `graphql-client` | https://github.com/rellampec/graphql-client.git |
|
|
165
|
-
| `eco-helpers` | https://gitlab.ecoportal.co.nz/oscar/script_api_helpers.git |
|
|
166
|
-
|
|
167
|
-
3. For each one they have locally:
|
|
168
|
-
- In **Cowork**: ask them to connect the folder (via the folder picker), then record the confirmed path.
|
|
169
|
-
- In **Claude Code**: ask them to provide the path, or run `find ~ -name "<gemspec>" -maxdepth 6 2>/dev/null` to locate it.
|
|
170
|
-
|
|
171
|
-
4. Once all available paths are collected, create `.ai-assistance/local_paths.md` from `.ai-assistance/local_paths.example.md`, filling in only the repos they confirmed.
|
|
172
|
-
|
|
173
|
-
5. Also ask: "Do you have GitKraken MCP or GitLab MCP set up?" — if not, point them to `.ai-assistance/integrations/`.
|
|
174
|
-
|
|
175
|
-
6. Confirm: "Done — I've saved your local paths. You can update `.ai-assistance/local_paths.md` any time if your setup changes."
|
|
176
|
-
|
|
177
|
-
If a developer doesn't have a repo locally and the task requires reading it, offer: "I can fetch the relevant files from the remote — just note it'll be slower. Want me to proceed that way?"
|
|
1
|
+
# SKILL: Project Preparation, Maintenance & Cycle
|
|
2
|
+
|
|
3
|
+
**Purpose:** Capture, organise, and track a development project from intent through completion, including upstream dependency decisions and cycle-end review.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- A developer describes a new piece of work.
|
|
10
|
+
- Picking up an existing project after a gap.
|
|
11
|
+
- A cycle of changes is complete and needs a closing review.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Folder Structure
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
.ai-assistance/projects/<project-slug>/
|
|
19
|
+
INTENT.md What we're trying to achieve and why
|
|
20
|
+
TODO.md Ordered task list, ticked off as done
|
|
21
|
+
DECISIONS.md Key decisions made and why
|
|
22
|
+
UPSTREAM.md Upstream dependency changes needed (if any)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Project folders are **not git-ignored** — they should be committed so other developers can pick up context.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Starting a Project
|
|
30
|
+
|
|
31
|
+
1. Ask the developer: "What are we trying to change and why?"
|
|
32
|
+
2. Capture the answer in `INTENT.md` (see template below).
|
|
33
|
+
3. Present it back: "Here's my understanding — does this capture it?" Iterate until confirmed.
|
|
34
|
+
4. Break the intent into an ordered TODO list in `TODO.md`.
|
|
35
|
+
5. If upstream deps are involved, create `UPSTREAM.md` and present options (patch, fork, new version).
|
|
36
|
+
|
|
37
|
+
### INTENT.md template
|
|
38
|
+
|
|
39
|
+
```markdown
|
|
40
|
+
# Project: <Name>
|
|
41
|
+
|
|
42
|
+
**Created:** YYYY-MM-DD
|
|
43
|
+
**Status:** [active | paused | complete]
|
|
44
|
+
**Branch:** feature/<slug>
|
|
45
|
+
**Target branch:** main
|
|
46
|
+
|
|
47
|
+
## Goal
|
|
48
|
+
One paragraph: what we want to achieve.
|
|
49
|
+
|
|
50
|
+
## Motivation
|
|
51
|
+
Why now? What problem does this solve?
|
|
52
|
+
|
|
53
|
+
## Scope
|
|
54
|
+
What's in scope. What's explicitly out of scope.
|
|
55
|
+
|
|
56
|
+
## Success Criteria
|
|
57
|
+
How we'll know it's done.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## TODO.md format
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# TODOs — <Project Name>
|
|
66
|
+
|
|
67
|
+
- [ ] Task description <!-- add detail as needed -->
|
|
68
|
+
- [x] Completed task
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Tick items off as they're completed. Never delete items — the history matters.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## DECISIONS.md format
|
|
76
|
+
|
|
77
|
+
```markdown
|
|
78
|
+
# Decisions — <Project Name>
|
|
79
|
+
|
|
80
|
+
## [DATE] <Decision title>
|
|
81
|
+
|
|
82
|
+
**Context:** What made this decision necessary.
|
|
83
|
+
**Options considered:** Brief list.
|
|
84
|
+
**Decision:** What was chosen.
|
|
85
|
+
**Reason:** Why.
|
|
86
|
+
**Consequences:** What this means going forward.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Session Start — Git Orientation (Always Do This)
|
|
92
|
+
|
|
93
|
+
Before any other work, run:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
# 1. Confirm current branch
|
|
97
|
+
git branch --show-current
|
|
98
|
+
|
|
99
|
+
# 2. Check how far ahead of target branch
|
|
100
|
+
git rev-list --count main..HEAD
|
|
101
|
+
|
|
102
|
+
# 3. Get a cheap summary of what's changed
|
|
103
|
+
git diff main...HEAD --stat
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Cross-reference the diff stat against the active project's `TODO.md`:
|
|
107
|
+
- Changed files should map to ticked TODO items.
|
|
108
|
+
- Unticked TODOs with no corresponding changed files = work not yet started.
|
|
109
|
+
- Changed files with no corresponding TODO = untracked work, worth noting.
|
|
110
|
+
|
|
111
|
+
If **GitKraken MCP** is connected, use it instead — it returns the same information as structured data without a bash call.
|
|
112
|
+
|
|
113
|
+
If the branch in `INTENT.md` doesn't match the current branch, flag it to the developer before proceeding.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Cycle-End Review
|
|
118
|
+
|
|
119
|
+
When all TODOs are ticked:
|
|
120
|
+
|
|
121
|
+
1. **Git summary:** Run `git diff main...HEAD --name-only` to get the exact file list.
|
|
122
|
+
2. **Gemini review:** Pass changed files to `gemini-assist` using the `cycle_end_review.txt` prompt:
|
|
123
|
+
```bash
|
|
124
|
+
ruby .ai-assistance/skills/gemini-assist/gemini_ask.rb \
|
|
125
|
+
--prompt-file .ai-assistance/skills/gemini-assist/prompts/cycle_end_review.txt \
|
|
126
|
+
--output .ai-assistance/projects/<slug>/gemini_review.txt \
|
|
127
|
+
--files $(git diff main...HEAD --name-only | tr '\n' ' ')
|
|
128
|
+
```
|
|
129
|
+
3. Review Gemini's output — verify each claim against actual code before acting.
|
|
130
|
+
4. Propose fixes for genuine issues — confirm with developer.
|
|
131
|
+
5. **If GitLab MCP is connected:** Check `get_merge_request_pipelines` to confirm CI is green.
|
|
132
|
+
6. Update `INTENT.md` status to `complete`.
|
|
133
|
+
7. Prompt: "Ready to open the MR / start the next project?"
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Upstream Dependency Changes
|
|
138
|
+
|
|
139
|
+
If changes require modifying an upstream gem:
|
|
140
|
+
|
|
141
|
+
Options (present all three to developer):
|
|
142
|
+
|
|
143
|
+
1. **Local patch** — monkey-patch from this gem. Fast, messy, temporary.
|
|
144
|
+
2. **Fork change** — commit to our fork (for `graphlient` or `graphql-client`). Appropriate for lasting fixes we own.
|
|
145
|
+
3. **New version** — for `ecoportal-api` or `ecoportal-api-v2` (team-owned), cut a new version. For external forks, optionally contribute back upstream.
|
|
146
|
+
|
|
147
|
+
Document the decision in `UPSTREAM.md` and `DECISIONS.md`.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Session / Collaborator Setup (First Time on a Machine)
|
|
152
|
+
|
|
153
|
+
When starting a session and `.ai-assistance/local_paths.md` does not exist, run this setup flow **before** any project work:
|
|
154
|
+
|
|
155
|
+
1. Tell the developer: "I don't see a `local_paths.md` for your machine yet. This helps me cross-reference upstream and downstream gem code without fetching from remotes every time."
|
|
156
|
+
|
|
157
|
+
2. For each dependency in the table below, ask: "Do you have `<gem>` cloned locally?"
|
|
158
|
+
|
|
159
|
+
| Gem | Remote |
|
|
160
|
+
|-----|--------|
|
|
161
|
+
| `ecoportal-api` | https://gitlab.ecoportal.co.nz/ecoportal/ecoportal-api.git |
|
|
162
|
+
| `ecoportal-api-v2` | https://gitlab.ecoportal.co.nz/oscar/ecoportal-api-v2.git |
|
|
163
|
+
| `graphlient` | https://github.com/rellampec/graphlient.git |
|
|
164
|
+
| `graphql-client` | https://github.com/rellampec/graphql-client.git |
|
|
165
|
+
| `eco-helpers` | https://gitlab.ecoportal.co.nz/oscar/script_api_helpers.git |
|
|
166
|
+
|
|
167
|
+
3. For each one they have locally:
|
|
168
|
+
- In **Cowork**: ask them to connect the folder (via the folder picker), then record the confirmed path.
|
|
169
|
+
- In **Claude Code**: ask them to provide the path, or run `find ~ -name "<gemspec>" -maxdepth 6 2>/dev/null` to locate it.
|
|
170
|
+
|
|
171
|
+
4. Once all available paths are collected, create `.ai-assistance/local_paths.md` from `.ai-assistance/local_paths.example.md`, filling in only the repos they confirmed.
|
|
172
|
+
|
|
173
|
+
5. Also ask: "Do you have GitKraken MCP or GitLab MCP set up?" — if not, point them to `.ai-assistance/integrations/`.
|
|
174
|
+
|
|
175
|
+
6. Confirm: "Done — I've saved your local paths. You can update `.ai-assistance/local_paths.md` any time if your setup changes."
|
|
176
|
+
|
|
177
|
+
If a developer doesn't have a repo locally and the task requires reading it, offer: "I can fetch the relevant files from the remote — just note it'll be slower. Want me to proceed that way?"
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
# SKILL: Refactor
|
|
2
|
-
|
|
3
|
-
**Purpose:** Identify, log, and (with developer confirmation) apply refactoring opportunities. Never apply changes without explicit confirmation.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## When to Use
|
|
8
|
-
|
|
9
|
-
- You notice a structural issue while working on something else — log it, don't fix it silently.
|
|
10
|
-
- The developer asks for a refactor audit of an area.
|
|
11
|
-
- A cycle-end review surfaces cleanup opportunities.
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## Criteria for a Refactor Candidate
|
|
16
|
-
|
|
17
|
-
Flag something when it fails one or more of:
|
|
18
|
-
|
|
19
|
-
- **Understandability:** Is it clear what this does and why?
|
|
20
|
-
- **Dependency tracking:** Are dependencies implicit or tangled?
|
|
21
|
-
- **Separation of concerns:** Is this class/method doing more than one thing?
|
|
22
|
-
- **Simplicity:** Could this be simpler without losing correctness?
|
|
23
|
-
- **Alignment:** Does this match the conventions of the rest of the codebase?
|
|
24
|
-
|
|
25
|
-
---
|
|
26
|
-
|
|
27
|
-
## Log Format
|
|
28
|
-
|
|
29
|
-
Refactoring opportunities are logged in `.ai-assistance/code/refactoring/<area>.md`.
|
|
30
|
-
|
|
31
|
-
Each entry:
|
|
32
|
-
|
|
33
|
-
```markdown
|
|
34
|
-
## [SHORT-ID] <Title>
|
|
35
|
-
|
|
36
|
-
- **File(s):** `lib/ecoportal/...`
|
|
37
|
-
- **Type:** [extract_class | extract_method | rename | simplify | reorganise | other]
|
|
38
|
-
- **Priority:** [high | medium | low]
|
|
39
|
-
- **Status:** [open | confirmed | applied | dismissed]
|
|
40
|
-
- **Identified:** YYYY-MM-DD
|
|
41
|
-
|
|
42
|
-
**Observation:**
|
|
43
|
-
What the issue is, concisely.
|
|
44
|
-
|
|
45
|
-
**Proposed change:**
|
|
46
|
-
What you'd do to fix it. High-level — not code unless it's very short.
|
|
47
|
-
|
|
48
|
-
**Risk:**
|
|
49
|
-
Any backwards-compat or downstream risk if applied.
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## Workflow
|
|
55
|
-
|
|
56
|
-
1. Identify opportunity → log it in the appropriate refactoring file.
|
|
57
|
-
2. Present a summary to the developer: "I've logged N refactoring opportunities in `.ai-assistance/code/refactoring/`. Want to review them?"
|
|
58
|
-
3. Developer confirms which ones to apply → mark as `confirmed`.
|
|
59
|
-
4. Apply one at a time, update specs if needed, mark as `applied`.
|
|
60
|
-
5. If dismissed by developer → mark as `dismissed` with a brief reason.
|
|
61
|
-
|
|
62
|
-
**Never apply a refactor without a `confirmed` status.**
|
|
1
|
+
# SKILL: Refactor
|
|
2
|
+
|
|
3
|
+
**Purpose:** Identify, log, and (with developer confirmation) apply refactoring opportunities. Never apply changes without explicit confirmation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- You notice a structural issue while working on something else — log it, don't fix it silently.
|
|
10
|
+
- The developer asks for a refactor audit of an area.
|
|
11
|
+
- A cycle-end review surfaces cleanup opportunities.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Criteria for a Refactor Candidate
|
|
16
|
+
|
|
17
|
+
Flag something when it fails one or more of:
|
|
18
|
+
|
|
19
|
+
- **Understandability:** Is it clear what this does and why?
|
|
20
|
+
- **Dependency tracking:** Are dependencies implicit or tangled?
|
|
21
|
+
- **Separation of concerns:** Is this class/method doing more than one thing?
|
|
22
|
+
- **Simplicity:** Could this be simpler without losing correctness?
|
|
23
|
+
- **Alignment:** Does this match the conventions of the rest of the codebase?
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Log Format
|
|
28
|
+
|
|
29
|
+
Refactoring opportunities are logged in `.ai-assistance/code/refactoring/<area>.md`.
|
|
30
|
+
|
|
31
|
+
Each entry:
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## [SHORT-ID] <Title>
|
|
35
|
+
|
|
36
|
+
- **File(s):** `lib/ecoportal/...`
|
|
37
|
+
- **Type:** [extract_class | extract_method | rename | simplify | reorganise | other]
|
|
38
|
+
- **Priority:** [high | medium | low]
|
|
39
|
+
- **Status:** [open | confirmed | applied | dismissed]
|
|
40
|
+
- **Identified:** YYYY-MM-DD
|
|
41
|
+
|
|
42
|
+
**Observation:**
|
|
43
|
+
What the issue is, concisely.
|
|
44
|
+
|
|
45
|
+
**Proposed change:**
|
|
46
|
+
What you'd do to fix it. High-level — not code unless it's very short.
|
|
47
|
+
|
|
48
|
+
**Risk:**
|
|
49
|
+
Any backwards-compat or downstream risk if applied.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Workflow
|
|
55
|
+
|
|
56
|
+
1. Identify opportunity → log it in the appropriate refactoring file.
|
|
57
|
+
2. Present a summary to the developer: "I've logged N refactoring opportunities in `.ai-assistance/code/refactoring/`. Want to review them?"
|
|
58
|
+
3. Developer confirms which ones to apply → mark as `confirmed`.
|
|
59
|
+
4. Apply one at a time, update specs if needed, mark as `applied`.
|
|
60
|
+
5. If dismissed by developer → mark as `dismissed` with a brief reason.
|
|
61
|
+
|
|
62
|
+
**Never apply a refactor without a `confirmed` status.**
|