fix: use gt rig list --json in bead-links endpoint#33
Open
Ljferrer wants to merge 1 commit into
Open
Conversation
The `/api/bead/:beadId/links` endpoint was the only rig-enumerating endpoint still parsing the pretty-printed text output of `gt rig list`. `/api/rigs` and `/api/setup/status` already prefer `gt rig list --json` with a text fallback; this brings the links endpoint in line. Parsing the structured `--json` output is more robust than scraping display text (which has already drifted once — the legacy two-space indent vs. the current emoji-prefixed format that motivated `parseRigNames`). The text path is retained as a fallback for older `gt` builds that don't support `--json`. No behavior change for current `gt`; verified the endpoint still resolves both rigs end-to-end. Integration suite green (127/127).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/bead/:beadId/linkswas the only rig-enumerating endpoint still parsing the pretty-printed text output ofgt rig list./api/rigsand/api/setup/statusalready prefergt rig list --jsonwith a text fallback — this brings the links endpoint in line.Why
Parsing structured
--jsonis more robust than scraping display text, which has already drifted once: the legacy two-space-indentformat vs. the current emoji-prefixed format (
🟢 RigName) that motivated theparseRigNameshelper. Pinning to JSON avoids thenext such break. The text path is kept as a fallback for older
gtbuilds without--json.Verification
[Links] Found rigs: GasTownTower, GigaClip), returns 200.gt.