Skip to content

feat: create and upgrade building blocks without hand-built JSON - #88

Open
j0g3sc wants to merge 3 commits into
claude/cli-gaps-waitingfrom
claude/cli-gaps-writing-blocks
Open

j0g3sc wants to merge 3 commits into
claude/cli-gaps-waitingfrom
claude/cli-gaps-writing-blocks

Conversation

@j0g3sc

@j0g3sc j0g3sc commented Nov 13, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #86 (which is stacked on #85), because --wait here uses the wait changes there; it shows only its own three commits.

Creating or upgrading a building block meant a raw meshstack api call with a hand-built body. This PR adds two commands, one commit each, on top of a small client change:

  1. feat(client): RawClient.Post and RawClient.Put send JSON as the caller gives it and return meshStack's response unparsed, as RawClient.Get and List already do. The provider is unaffected: RawClient is the CLI's alone.
  2. meshstack bb upgrade <uuid> moves a block to the latest released version of its definition (read from the definition's status.latestReleasedVersionUuid), or to the one --version names. It reads the block and sends back its metadata, target, display name and parents with the new version, plus only the inputs given with --input <name>=<value>: meshStack keeps the values of the inputs an upgrade leaves out, and rejects STATIC ones, which is what made the hand-built body hard. A value that is valid JSON goes out as JSON, any other as a string, so a payment method is --input 'payment_method={"kind": "meshPaymentMethod", "name": "…"}'. --wait waits for the upgrade's run.
  3. meshstack bb create -f <file|-> posts a building block and prints the response. --wait waits for the first run: piping the response into bb wait did not work, as the uuid is unknown before the create.

The meshstack-cli skill now orders through bb create and has a section Upgrading a building block.

Test plan

  • task lint
  • go test ./...: a test against the fake meshStack checks the body bb upgrade sends: the latest released version, and only the given inputs.
  • No acceptance test: the suite has no definition with two released versions to upgrade between, nor a definition version to order from. bb create is plain request plumbing.

🤖 Generated with Claude Code

j0g3sc and others added 3 commits November 13, 2026 14:54
RawClient.Post and RawClient.Put send the JSON as the caller gives it and
return meshStack's response unparsed, so that the CLI can write a
building block it read raw, or one from a file, and print the response.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'meshstack buildingblock upgrade <uuid>' moves a building block to the
latest released version of its definition, or to the one --version names.
It sends back only the inputs given with --input, such as a payment
method that the new version adds, because meshStack keeps the values of
the inputs an upgrade leaves out and rejects the STATIC ones. With
--wait, it waits until the run of the upgrade has ended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'meshstack buildingblock create -f <file|->' posts the building block
and prints meshStack's response. With --wait, it waits until the first
run of the new building block has ended, whose uuid a pipe into
'buildingblock wait' did not know.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@meshcloud-gh-actions

Copy link
Copy Markdown

Coverage of the acceptance run against the meshStack backend, on 9aa205a69b5e52ce658e7cafb9b094000cf3321c.

Scope Coverage
Unit tests 78.3%
Acceptance tests 53.8%
Combined 80.7%
Uncovered functions
client/api_key.go:52: meshApiKeyClient.Create 0.0%
client/api_key.go:56: meshApiKeyClient.Read 0.0%
client/api_key.go:60: meshApiKeyClient.Update 0.0%
client/api_key.go:64: meshApiKeyClient.Delete 0.0%
client/api_key_permissions.go:20: ApiKeyPermissions.AllCodes 0.0%
client/api_key_permissions.go:33: ApiKeyPermissions.WorkspaceCodes 0.0%
client/api_key_permissions.go:262: AllApiKeyPermissions 0.0%
client/api_key_permissions.go:266: WorkspacePermissionCodes 0.0%
client/building_block_definition.go:71: MeshBuildingBlockDefinitionApprovalPolicies.NothingRequiresApproval 0.0%
client/building_block_definition.go:82: DisabledSchedule 0.0%
client/building_block_definition.go:89: MeshBuildingBlockDefinitionSchedule.IsDisabled 0.0%
client/building_block_definition.go:93: MeshBuildingBlockDefinitionSpec.HasNeutralPolicies 0.0%
client/building_block_definition.go:97: MeshBuildingBlockDefinitionSpec.WithNeutralPolicies 0.0%
client/building_block_definition.go:166: meshBuildingBlockDefinitionClient.List 0.0%
client/building_block_definition.go:173: meshBuildingBlockDefinitionClient.Read 0.0%
client/building_block_definition.go:177: meshBuildingBlockDefinitionClient.Create 0.0%
client/building_block_definition.go:181: meshBuildingBlockDefinitionClient.Update 0.0%
client/building_block_definition.go:185: meshBuildingBlockDefinitionClient.Delete 0.0%
client/building_block_definition_version.go:101: MeshBuildingBlockType.TagInputTargets 0.0%
client/building_block_definition_version.go:245: meshBuildingBlockDefinitionVersionClient.Create 0.0%
client/building_block_definition_version.go:254: meshBuildingBlockDefinitionVersionClient.Update 0.0%
client/building_block_definition_version_implementation.go:81: MeshBuildingBlockDefinitionImplementation.InferType 0.0%
client/building_block_definition_version_implementation.go:95: MeshBuildingBlockDefinitionImplementation.MarshalJSONTo 0.0%
client/building_block_definition_version_implementation.go:108: *MeshBuildingBlockDefinitionImplementation.UnmarshalJSONFrom 0.0%
client/building_block_runner.go:93: meshBuildingBlockRunnerClient.Create 0.0%
... and 126 more

covdata func names a method without its receiver, so an entry can belong to an implementation nothing selects rather than to a function the tests never reached. Open the file and line before reading one as a coverage gap.

@sonarqubecloud

Copy link
Copy Markdown

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