From 329a89b77a9385f420f671ccd47a2ce13b654841 Mon Sep 17 00:00:00 2001 From: Teodor Calin Date: Mon, 13 Jul 2026 16:03:53 +0300 Subject: [PATCH] publish: make rich-from-R2 metadata jq portable (jq 1.6/1.7 object-value grammar) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The metadata.json synthesis used object-construction values with inline '+' and '//' (vendor: ($sub[0].vendor // {name:$dn}) + {publisher_pubkey:$pub}). jq's object-value grammar is stricter than a full pipe on some builds (CI's jq), which rejected it with 'unexpected +, expecting }' — so a workflow_dispatch of a rich submission failed after the bundle verified. Precompute the vendor + methods sub-objects with plain jq and pass them as --argjson so every object value is a single term. Verified in DRY_RUN against live R2 for insforge/orthogonal/didit. Co-Authored-By: Claude Opus 4.8 --- scripts/publish-rich-from-r2.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/scripts/publish-rich-from-r2.sh b/scripts/publish-rich-from-r2.sh index 1d55a62..a9124d0 100755 --- a/scripts/publish-rich-from-r2.sh +++ b/scripts/publish-rich-from-r2.sh @@ -127,25 +127,31 @@ LICENSE="$(jq -r '.license // ""' "$META")" SOURCE="$(jq -r '.source_url // "https://github.com/pilot-protocol/app-template/tree/main/submissions/'"$ID"'"' "$META")" CATEGORIES_JSON="$(jq -c '.categories // []' "$META")" +# NB: jq's object-construction value grammar is stricter than a full pipe, and +# some jq builds reject `key: (A) + {..}` / `key: A // {..}` inline. Precompute +# the composite sub-objects with plain jq and pass them in as --argjson so every +# value below is a single term — portable across jq 1.6/1.7. +VENDOR_JSON="$(jq -c --arg dn "$DISPLAY" --arg pub "$PUBLISHER" \ + '((.vendor // {name: $dn}) + {publisher_pubkey: $pub})' "$META")" +METHODS_JSON="$(jq -c '[ (.methods // [])[] | {name: .name, summary: (.summary // .description // "")} ]' "$META")" METADATA_JSON="$(jq -n \ --arg id "$ID" --arg dn "$DISPLAY" --arg desc "$DESC" \ - --arg src "$SOURCE" --arg lic "$LICENSE" --arg pub "$PUBLISHER" \ + --arg src "$SOURCE" --arg lic "$LICENSE" \ --argjson cats "$CATEGORIES_JSON" --argjson bb "$BUNDLE_BYTES" \ - --arg ver "$VERSION" \ - --slurpfile sub "$META" ' + --arg ver "$VERSION" --argjson vendor "$VENDOR_JSON" --argjson methods "$METHODS_JSON" ' { schema_version: 1, id: $id, display_name: $dn, - tagline: ($desc | .[0:120]), + tagline: ($desc[0:120]), description_md: $desc, - vendor: ($sub[0].vendor // {name: $dn}) + {publisher_pubkey: $pub}, + vendor: $vendor, source_url: $src, license: $lic, categories: $cats, size: {bundle_bytes: $bb}, - methods: [ ($sub[0].methods // [])[] | {name: .name, summary: (.summary // .description // "")} ], - changelog: [ {version: $ver, notes: ["Published v" + $ver]} ] + methods: $methods, + changelog: [ {version: $ver, notes: (["Published v " + $ver])} ] }')" # ── 6. open the catalogue PR on pilotprotocol ────────────────────────────────