11---
22name : fetch-protos
33description : >
4- Fetch latest protobuf definitions, verify build, summarize API changes,
5- and scaffold new service stubs. Usage: /fetch-protos [flipcash|opencode] [commit_sha ]
4+ Bump a client-protocol artifact, summarize the contract changes it carries ,
5+ and scaffold new service stubs. Usage: /fetch-protos [flipcash|opencode] [version ]
66user-invocable : true
7- argument-hint : " [flipcash|opencode] [commit_sha ]"
7+ argument-hint : " [flipcash|opencode] [version ]"
88allowed-tools :
99 - Bash
1010 - Read
@@ -17,79 +17,92 @@ allowed-tools:
1717
1818# Fetch Protos
1919
20- Fetch protobuf definitions from upstream repos, verify they compile, summarize
21- API changes, and scaffold missing service layer implementations.
20+ The protos are no longer vendored here. Both contracts arrive as published
21+ artifacts, so "fetching" is bumping a version pin and reacting to what the new
22+ version changed.
23+
24+ | Target | Artifact | Client repo | Upstream contract |
25+ | --------| ----------| -------------| -------------------|
26+ | ` flipcash ` | ` com.flipcash:flipcash2-client-protocol ` | ` code-payments/flipcash2-client-protocol ` | ` code-payments/flipcash2-protobuf-api ` |
27+ | ` opencode ` | ` com.flipcash:ocp-client-protocol ` | ` code-payments/ocp-client-protocol ` | ` code-payments/ocp-protobuf-api ` |
2228
2329## Pre-flight context
2430
25- - Current proto files : !` find definitions/*/protos/src/main/proto -name "*.proto" 2>/dev/null | wc -l | tr -d ' ' ` proto files across targets
26- - Git status: !` git status --short definitions / `
31+ - Pinned versions : !` grep -E "^(ocp|flipcash2)-client-protocol = " gradle/libs.versions.toml `
32+ - Git status: !` git status --short gradle/libs.versions.toml services / `
2733
2834## Input
2935
30- Parse ` $ARGUMENTS ` to determine targets and optional commit SHA .
36+ Parse ` $ARGUMENTS ` to determine targets and an optional version .
3137
3238** Rules:**
3339- Known targets: ` flipcash ` , ` opencode `
34- - If no targets specified, fetch ** both** (` flipcash ` and ` opencode ` )
35- - A hex string (7+ chars) as the last argument is treated as a commit SHA
40+ - If no targets specified, check ** both**
41+ - A semver-looking string as the last argument is the version to move to; without
42+ one, use the latest release
3643- Examples:
37- - ` /fetch-protos ` → fetch flipcash + opencode at HEAD
38- - ` /fetch-protos flipcash ` → fetch flipcash only
39- - ` /fetch-protos opencode abc1234 ` → fetch opencode at commit abc1234
40- - ` /fetch-protos flipcash opencode ` → fetch both explicitly
44+ - ` /fetch-protos ` → check both artifacts for newer releases
45+ - ` /fetch-protos flipcash ` → flipcash only, latest release
46+ - ` /fetch-protos opencode 0.2.0 ` → opencode at 0.2.0
4147
4248## Steps
4349
44- ### Step 1 — Fetch protos
45-
46- For each target, run the fetch script from the repo root:
50+ ### Step 1 — Find the release
4751
4852``` bash
49- bash scripts/fetch-protos.sh -t < target > [commit_sha]
53+ gh release list --repo code-payments/ < ocp | flipcash 2> -client-protocol --limit 10
5054```
5155
52- Target-to-repo mapping (handled by the script):
53- | Target | Repository |
54- | --------| -----------|
55- | ` flipcash ` | ` git@github.com:code-payments/flipcash2-protobuf-api.git ` |
56- | ` opencode ` | ` git@github.com:code-payments/ocp-protobuf-api.git ` |
56+ Compare against the pin in ` gradle/libs.versions.toml ` . If the pinned version is
57+ already the latest and no version was requested, say so and stop.
58+
59+ If the contract change you want has ** not been released** , it has to land in the
60+ client repo first: sync its protos at the upstream SHA, regenerate, and publish.
61+ That repo's README covers it — this skill does not do it.
5762
58- Show the script output to the user.
63+ ### Step 2 — Bump the pin
64+
65+ Edit ` gradle/libs.versions.toml ` :
66+
67+ ``` toml
68+ ocp-client-protocol = " <new>" # or flipcash2-client-protocol
69+ ```
5970
60- ### Step 2 — Diff and summarize changes
71+ ### Step 3 — Diff and summarize the contract change
6172
62- Run ` git diff ` on the proto directories to identify what changed :
73+ The ` .proto ` sources are not in this repo. Diff them between the two release tags :
6374
6475``` bash
65- git diff --stat definitions/
66- git diff definitions/
76+ gh api repos/code-payments/ < repo > /compare/ < old-version > ... < new-version > \
77+ --jq ' .files[] | select(.filename | startswith("proto/")) | .filename '
6778```
6879
69- For each changed ` .proto ` file, summarize :
80+ Read the patch for each changed file. Summarize :
7081- ** New RPCs** added to services
7182- ** Modified RPCs** (changed request/response types or fields)
7283- ** Removed RPCs**
7384- ** New/modified messages** and fields
7485
75- Present a structured change summary table to the user. If nothing changed, report
76- that protos are already up to date and stop here.
86+ Present a structured change summary table. If the diff carries no ` proto/ ` change,
87+ the release is generator or packaging work only — say so, and expect no service
88+ layer impact.
7789
78- ### Step 3 — Build verification
90+ ### Step 4 — Build verification
7991
80- Build the definitions modules to verify the protos compile :
92+ Build the service module that consumes the artifact :
8193
8294``` bash
83- ./gradlew :definitions: flipcash:models:assembleDebug :definitions: opencode:models :assembleDebug
95+ ./gradlew :services: < flipcash| opencode> :assembleDebug
8496```
8597
86- Only build the targets that were fetched. If the build fails, show errors and stop.
98+ Only build the targets that were bumped. If the build fails, show errors and stop —
99+ a removed or renamed field breaks compilation here, which is the point.
87100
88- ### Step 4 — Detect service layer impact
101+ ### Step 5 — Detect service layer impact
89102
90- #### 4a — RPC changes
103+ #### 5a — RPC changes
91104
92- For each new or modified RPC found in Step 2 :
105+ For each new or modified RPC found in Step 3 :
93106
941071 . Identify which service proto file it belongs to (e.g., ` account/v1/flipcash_account_service.proto ` )
951082 . Search for the corresponding Api class in ` services/<target>/src/**/network/api/ `
@@ -103,7 +116,7 @@ Present a report:
103116| ` NewRpc ` | missing | missing | missing | missing | ** New — needs scaffolding** |
104117| ` ModifiedRpc ` | exists | exists | exists | exists | ** Signature may need update** |
105118
106- #### 4b — Message field changes (domain models)
119+ #### 5b — Message field changes (domain models)
107120
108121For each message with added or removed fields (e.g., ` UserFlags ` , ` UserProfile ` ):
109122
@@ -156,7 +169,7 @@ For **read-only** fields (e.g., booleans like `enablePhoneNumberSend`):
156169
157170Present a report of domain model updates needed and apply them after user confirmation.
158171
159- ### Step 5 — Scaffold new service stubs
172+ ### Step 6 — Scaffold new service stubs
160173
161174For RPCs marked as needing scaffolding, ask the user if they want to scaffold them.
162175If confirmed, generate code following the patterns below.
@@ -269,13 +282,13 @@ suspend fun newRpc(...): Result<DomainType> {
269282If a new Repository interface+impl pair was created, add a ` @Provides ` binding in
270283the corresponding Hilt module (` FlipcashModule.kt ` or ` OpenCodeModule.kt ` ).
271284
272- ### Step 6 — Review and commit
285+ ### Step 7 — Review and commit
273286
274287Show the user a summary of all changes (proto updates + any scaffolded code).
275288
276289Offer to commit with a conventional commit message:
277290```
278- chore(protos): update <target> protobuf definitions
291+ chore(protos): bump <flipcash2|ocp>-client-protocol to <version>
279292```
280293
281294If service stubs were also scaffolded, suggest a separate commit:
@@ -285,7 +298,7 @@ feat(<target>): scaffold service stubs for new RPCs
285298
286299## Never
287300
288- - Edit generated protobuf code in ` definitions/*/models/build/ `
301+ - Try to edit the generated protobuf code — it lives in the published artifact
289302- Commit without user approval
290303- Skip build verification
291304- Scaffold service code without asking the user first
0 commit comments