docs(builder-agent): document JST step structure, Array callback methods, and Conditional.if...else#37
Open
ZackStr wants to merge 1 commit intoitential:mainfrom
Conversation
…ods, and Conditional.if...else
Adds a new helper template (helpers/create-transformation.json) and a
"JSON Transformations (JSTs) — Building" subsection in builder-agent
SKILL.md covering the build side of JSTs (the existing transformation
docs cover only the consumer side — calling a JST from a workflow).
Coverage (all verified against live IAP transformations):
Array callback methods — bodies live in a top-level functions[] array
(NOT inline in steps[] with #/N[0]):
- Array.map → ƒ_map_<n>, incoming: currentValue/index/array; outgoing: newValue
- Array.flatMap → ƒ_map_<n> (shares with map), 3-arg parent w/ constantValue1
- Array.filter → ƒ_query_<n>, incoming: element/index/array; outgoing: return
- Array.find → ƒ_query_<n>, 3-arg parent w/ constantValue1
- Array.findIndex → identical to find at function level
- Array.some/every → identical predicate shape, 2-arg parent
- Array.reduce → ƒ_reduce_<n>, incoming: accumulator/currentValue/...; outgoing: accumulator
- Array.sort → ƒ_sort_<n>, incoming: firstEl/secondEl; outgoing: comparison
- Array.forEach does NOT exist in JST.
Conditional.if...else uses INLINE sub-context (different mechanism from
functions[]): type:"context" parent, branches via context pointer
"#/N[0]"/"#/N[1]" with /return/if and /return/else string keys.
Step types table covers method/assign/declaration/context. Endpoint
table includes the bulk DELETE and the no-{options:{}}-wrapper PUT
format. Captures the "Anchors could not be found for step(s) N, N+1"
canvas error and its fix (missing/empty functions[] entry).
Also generalized: extra parent args slots beyond [array, callbackName]
bind to constantValue<N> in the function's incoming. Verified across
find/findIndex/flatMap.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
helpers/create-transformation.jsonfor building JSTs (JSON Transformations) from scratch viaPOST /transformations/.## JSON Transformations (JSTs) — Buildingsubsection inbuilder-agent/SKILL.mdcovering step types, the per-method Array-callback table, theConditional.if...elseinline branching pattern, and the canonical "Anchors could not be found" failure mode.bindingSchemawas empty (covered in docs(builder-agent): document REST-bound and cascading JSON Form dropdowns #36); JSTs rendered with canvas anchor errors whenArray.mapreferenced a function name that wasn't defined infunctions[].Background
The plugin documents the
transformationworkflow task (consumer side: how to call a JST from a workflow) but has no coverage of how to BUILD a JST — no helper, no step-structure docs, no callback-method table. While fixing a corrupted JST in a customer engagement, I discovered that:Array.map/filter/reduce/find/findIndex/some/every/sort/flatMaplive in a top-levelfunctions[]array, sibling tosteps[]— NOT inline insteps[]with acontext: "#/N[0]"pointer (which is the pattern forConditional.if...elseand othertype: "context"containers).Array.filter/find/findIndex/some/everyall share theƒ_query_*namespace;Array.flatMapshares theƒ_map_*namespace withArray.map. Read iteration values viacurrentValue(map family),element(predicate family),firstEl/secondEl(sort), oraccumulator/currentValue(reduce). Write per-iteration results tonewValue/return/comparison/accumulator— depends on family.argsslots beyond[array, callbackName]bind toconstantValue<N>slots in the function'sincoming— IAP's mechanism for passing external constants into a callback.Array.forEachdoes NOT exist in JST.The user (an Itential employee) hand-built reference JSTs (
teachClaudeJST,teachClaude2,teachClaude3,teachClaude4) so I could fetch each viaGET /transformations/{id}and extract the canonical structure. Every method/pattern in this PR is verified against live IAP data, not inferred.Changes
New file:
helpers/create-transformation.json_comment_*style as the other helpersArray.mapcallback that wraps each input string into{MyOtherObject: {key1: "blah", key2: <item>}}Conditional.if...elsepattern documentationmethod,assign,declaration,context)Edits:
.claude/skills/builder-agent/SKILL.md## JSON Transformations (JSTs) — Buildingsubsection (between JSON Forms and Operations Manager)/transformations/CRUDWhat's verified vs inferred
100% verified against live IAP transformations:
Conditional.if...elseinline sub-context (including nested branches)constantValue<N>injection pattern across families{options:{}}format (distinct from json-forms PUT)Not in scope (no claim made):
type: "context"containers (e.g.,Conditional.switch) — onlyif...elsewas verifiedObject.map/Object.entries— out of scope for this PRTest plan
jq typepasses on the helper (verified locally — file is valid JSON)/transformations/against a live platform → JST appears in Studio🤖 Generated with Claude Code