fix(register.sh): handle pretty-printed JSON with space after colon#55
Open
Nexory wants to merge 1 commit into
Open
fix(register.sh): handle pretty-printed JSON with space after colon#55Nexory wants to merge 1 commit into
Nexory wants to merge 1 commit into
Conversation
The grep pattern "builder_code":"[^"]*" requires no space between the colon and the value, but the API response (shown in references/agents/register.md) is pretty-printed with a space after the colon. The pattern matches zero bytes on that format, BUILDER_CODE becomes empty, and the script exits 1. This patch makes the pattern space-tolerant by using grep -E with *-quantifier between : and ", then extracts the value via a second grep + tr. No new dependencies. Both compact and pretty-printed JSON now work. Closes base#54
Collaborator
🟡 Heimdall Review Status
|
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.
Closes #54
This patch fixes the grep pattern in
skills/build-on-base/scripts/register.shline 21 so it tolerates the space-after-colon format that the API actually returns (as documented inreferences/agents/register.md).Before:
BUILDER_CODE=$(echo "$RESPONSE" | grep -o '"builder_code":"[^"]*"' | cut -d'"' -f4)The pattern requires no space between the colon and the value, so the pretty-printed format
"builder_code": "bc_..."matches zero bytes,BUILDER_CODEbecomes empty, and the script exits 1.After:
BUILDER_CODE=$(echo "$RESPONSE" | grep -oE '"builder_code": *"[^"]*"' | grep -oE '"[^"]*"$' | tr -d '"')The new pattern uses
grep -Ewith a*-quantifier between the colon and the opening quote, matching zero or more spaces. A secondgrep -oEextracts the trailing quoted value, thentr -d '"'strips the quotes. No new dependencies (still pure POSIX). Both compact and pretty-printed JSON now work.Reproduction confirming the fix:
Both formats produce identical output, the original bug is gone, and no new dependency is introduced.