Skip to content

feat: sync wire types with the latest API (additive fields) - #25

Merged
nsollazzo merged 1 commit into
mainfrom
feat/sync-api-type-drift
Jul 8, 2026
Merged

feat: sync wire types with the latest API (additive fields)#25
nsollazzo merged 1 commit into
mainfrom
feat/sync-api-type-drift

Conversation

@nsollazzo

Copy link
Copy Markdown
Contributor

What

internal/api/types.go is the CLI's field-for-field mirror of the product's src/lib/types.ts. It had drifted — so --json was silently dropping fields the server now returns. This re-syncs the additive ones.

Type New field(s)
SoulCard / Listing chargeCount — the "energy boost" running count
Listing profileTier (author seal: official/verified/null), hasAsset, assetVersion, assetContentHash (hosted SKILL.md asset metadata)
LoopData, new SkillData bundles — a meta-skill/loop's bundled listing slugs

hasAsset/assetVersion/assetContentHash are functionally useful: a client can skip re-downloading an identical hosted skill asset.

Behavior

  • All fields flow into --json automatically (agents see everything the server sends).
  • Human detail views surface CHARGES (soul + listing), a skill's ASSET VERSION, and loop/skill BUNDLES.
  • Adds a SkillData() decoder mirroring LoopData() (typed access to bundled slugs).

Contract changes (golden diffs)

Every soul/listing --json golden and the MCP tool-schema golden (mcp-tools-list.json) gained the new fields — that is the contract change, regenerated via go test ./internal/cli -update. Mock fixtures updated with representative values (incl. a verified-tier meta-skill with a hosted asset + bundles, exercising the non-official tier, hasAsset:true, and SkillData/LoopData bundles).

Tests

  • TestListingSkillData — the new decoder, incl. fail-loud on a wrong-typed field.
  • TestNewWireFieldsRoundTrip — the new fields survive decode→encode (never dropped), nullable asset fields round-trip as JSON null, and SoulCard.chargeCount decodes.

go test ./... -race, go vet, golangci-lint run all clean. No auth/admin surface touched; nothing sensitive; no internal ids in the diff.

@nsollazzo
nsollazzo marked this pull request as ready for review July 8, 2026 13:39
internal/api/types.go documents itself as a field-for-field mirror of the
product's src/lib/types.ts; it had drifted, so --json silently dropped fields
the server now returns. Re-sync the additive ones:

- SoulCard/Listing: chargeCount (the "energy boost" running count)
- Listing: profileTier (author seal), hasAsset / assetVersion /
  assetContentHash (hosted SKILL.md asset metadata — lets clients skip an
  identical re-download)
- LoopData + new SkillData: bundles (a meta-skill/loop's bundled listing slugs)

Human detail views surface CHARGES, a skill's ASSET VERSION, and loop/skill
BUNDLES; everything flows into --json automatically. Adds a SkillData() decoder
mirroring LoopData(), round-trip tests pinning the new fields (incl. null for
the nullable asset fields), and the mock fixtures + regenerated goldens — the
golden churn is the contract change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nsollazzo
nsollazzo force-pushed the feat/sync-api-type-drift branch from a4e15fa to 82ce66b Compare July 8, 2026 13:40
@nsollazzo
nsollazzo merged commit 2620ab3 into main Jul 8, 2026
9 checks passed
@nsollazzo
nsollazzo deleted the feat/sync-api-type-drift branch July 8, 2026 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant