Otter Workflows Otter Upstream Composition Verified

Text Processing and Persistence Workflow

Demonstrates multi-pack composition: normalizes and slugifies text using otter-official/text-utils, then persists and verifies the structured record using otter-official/file-helpers.

ID: workflow/text-processing-persistence Version: 1.0.0 License: MIT Framework: Otter Composition Planner (Phase 11)

Architecture & Runtime Preview

Otter Composition Planner (Phase 11)

Deterministic 4-step multi-pack DAG composing 2 Schema v2 Packs with explicit port bindings and side-effect ordering.

  1. 1step1_clean: otter-official/text-utils::normalizeSpaces()
  2. 2step2_slug: otter-official/text-utils::slugify()
  3. 3step3_persist: otter-official/file-helpers::writeJsonObject() [adapter: json_object_wrap_slug] [after: step2_slug]
  4. 4step4_verify: otter-official/file-helpers::readJsonObjectSafe() [after: step3_persist]

Source Code (1 file)

text-processing-persistence.workflow.json · json
{
  "$schema": "../schema/workflow-spec.schema.json",
  "workflowVersion": 1,
  "id": "text-processing-persistence",
  "name": "Text Processing and Persistence Workflow",
  "description": "Demonstrates multi-pack composition: normalizes and slugifies text using otter-official/text-utils, then persists and verifies the structured record using otter-official/file-helpers.",
  "target": "console",
  "composedPacks": [
    "otter-official/text-utils",
    "otter-official/file-helpers"
  ],
  "pipelineInputs": [
    {
      "name": "rawInput",
      "type": "text",
      "default": "   Multi-Pack   Deterministic   Composition   Architecture   ",
      "description": "Raw string to normalize and slugify"
    },
    {
      "name": "targetFilePath",
      "type": "text",
      "default": "composition_output.json",
      "description": "Destination file path for structured JSON persistence"
    }
  ],
  "steps": [
    {
      "id": "step1_clean",
      "pack": "otter-official/text-utils",
      "operation": "normalizeSpaces",
      "inputs": {
        "text": { "fromInput": "rawInput" }
      }
    },
    {
      "id": "step2_slug",
      "pack": "otter-official/text-utils",
      "operation": "slugify",
      "inputs": {
        "text": { "fromStep": "step1_clean", "port": "returns" }
      }
    },
    {
      "id": "step3_persist",
      "pack": "otter-official/file-helpers",
      "operation": "writeJsonObject",
      "inputs": {
        "filePath": { "fromInput": "targetFilePath" },
        "obj": {
          "fromStep": "step2_slug",
          "port": "returns",
          "adapter": "json_object_wrap_slug"
        }
      },
      "orderAfter": [
        "step2_slug"
      ]
    },
    {
      "id": "step4_verify",
      "pack": "otter-official/file-helpers",
      "operation": "readJsonObjectSafe",
      "inputs": {
        "filePath": { "fromInput": "targetFilePath" },
        "fallbackValue": { "value": null }
      },
      "orderAfter": [
        "step3_persist"
      ]
    }
  ],
  "output": {
    "fromStep": "step3_persist",
    "port": "returns"
  }
}

Installation & Usage

otter compose plan --workflow library/workflows/text-processing-persistence.workflow.json --explain
otter compose plan --workflow library/workflows/text-processing-persistence.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'.