# SPDX-License-Identifier: Apache-2.0
# © SuperNovae Studio · nika.sh/library
nika: v1
workflow:
  id: social-repurpose
# local model · your draft never leaves
model: ollama/llama3.2:3b

# the file IS the blast radius
permits:
  fs: { read: [ ./post.md ], write: [ ./social-bundle.md ] }
  tools: [ "nika:read", "nika:write" ]

tasks:
  # one read · three parallel rewrites · one merge
  post:
    invoke: { tool: "nika:read", args: { path: ./post.md } }

  thread:
    with:
      post: ${{ tasks.post.output }}
    infer: { prompt: "Turn this post into a 6-tweet thread, keep the voice: ${{ with.post }}", max_tokens: 400 }

  linkedin:
    with:
      post: ${{ tasks.post.output }}
    infer: { prompt: "Rewrite this post for LinkedIn, hook first: ${{ with.post }}", max_tokens: 400 }

  newsletter:
    with:
      post: ${{ tasks.post.output }}
    infer: { prompt: "Write a 3-sentence newsletter blurb for this post: ${{ with.post }}", max_tokens: 300 }

  bundle:
    with:
      thread: ${{ tasks.thread.output }}
      linkedin: ${{ tasks.linkedin.output }}
      newsletter: ${{ tasks.newsletter.output }}
    invoke:
      tool: "nika:write"
      args:
        path: ./social-bundle.md
        content: "${{ with.thread }}\n\n---\n\n${{ with.linkedin }}\n\n---\n\n${{ with.newsletter }}"

outputs:
  bundle: "${{ tasks.bundle.output }}"
