Otter
Workflows
Otter
Upstream Composition Verified
Numeric Calculation and Formatting Workflow
Demonstrates multi-pack numeric composition: clamps an input value with otter-official/math-utils and formats the result with zero padding using otter-official/text-utils via real number_to_text adapter.
Architecture & Runtime Preview
Otter Composition Planner (Phase 11)Deterministic 2-step multi-pack DAG composing 2 Schema v2 Packs with explicit port bindings and side-effect ordering.
- 1step1_clamp: otter-official/math-utils::clamp()
- 2step2_pad: otter-official/text-utils::padLeft() [adapter: number_to_text] [after: step1_clamp]
Source Code (1 file)
{
"$schema": "../schema/workflow-spec.schema.json",
"workflowVersion": 1,
"id": "numeric-calculation-formatting",
"name": "Numeric Calculation and Formatting Workflow",
"description": "Demonstrates multi-pack numeric composition: clamps an input value with otter-official/math-utils and formats the result with zero padding using otter-official/text-utils via real number_to_text adapter.",
"target": "console",
"composedPacks": [
"otter-official/math-utils",
"otter-official/text-utils"
],
"pipelineInputs": [
{
"name": "inputValue",
"type": "number",
"default": 42,
"description": "Numeric value to clamp and format"
},
{
"name": "minBound",
"type": "number",
"default": 10,
"description": "Minimum limit for clamping"
},
{
"name": "maxBound",
"type": "number",
"default": 100,
"description": "Maximum limit for clamping"
}
],
"steps": [
{
"id": "step1_clamp",
"pack": "otter-official/math-utils",
"operation": "clamp",
"inputs": {
"value": { "fromInput": "inputValue" },
"minLimit": { "fromInput": "minBound" },
"maxLimit": { "fromInput": "maxBound" }
}
},
{
"id": "step2_pad",
"pack": "otter-official/text-utils",
"operation": "padLeft",
"inputs": {
"text": {
"fromStep": "step1_clamp",
"port": "returns",
"adapter": "number_to_text"
},
"targetLen": { "value": 6 },
"padChar": { "value": "0" }
},
"orderAfter": [
"step1_clamp"
]
}
],
"output": {
"fromStep": "step2_pad",
"port": "returns"
}
}
Installation & Usage
otter compose plan --workflow library/workflows/numeric-calculation-formatting.workflow.json --explain
otter compose plan --workflow library/workflows/numeric-calculation-formatting.workflow.json --apply --yes
Apply into a fresh Otter console project with 'otter compose plan --workflow ... --apply --yes', verify with 'otter check src/main.ot', and execute with 'otter run src/main.ot'.