> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anpord.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publishing changes

> Adding versions and putting one live

## Add a version

```ts theme={"dark"}
await anpord.prompts.update({
  id: "support-reply",
  content: "You are a support agent for {{product}}. Be brief and warm.",
  message: "Warmer tone",
});
```

The response carries the number the new version was given. Nothing is live yet: callers asking for production still receive whatever that channel points at.

## Put it live

```ts theme={"dark"}
await anpord.prompts.promote({
  id: "support-reply",
  channel: "production",
  version: 5,
});
```

Promoting to a channel that does not exist yet creates it, so a move never fails on a missing channel. It fails only if the prompt or the version is missing.

## Roll back

A rollback is a promotion at an earlier number:

```ts theme={"dark"}
await anpord.prompts.promote({
  id: "support-reply",
  channel: "production",
  version: 4,
});
```

Because versions are appended and never overwritten, the version you are going back to is still exactly as it was.

## From the terminal

```bash theme={"dark"}
anpord push support-reply "You are a support agent. Be brief." -m "Tighter"
anpord promote support-reply --to production --at 5
```

Content can come from a file, which suits prompts long enough to deserve one:

```bash theme={"dark"}
cat prompts/support-reply.md | anpord push support-reply - -m "Rewrite"
```

## From CI

Publishing on merge keeps the prompts in your repository and the live version in sync:

```yaml theme={"dark"}
- name: Publish prompts
  env:
    ANPORD_API_KEY: ${{ secrets.ANPORD_API_KEY }}
  run: |
    for file in prompts/*.md; do
      id="$(basename "$file" .md)"
      anpord push "$id" - -m "${{ github.event.head_commit.message }}" < "$file"
    done
```

<Note>
  This adds a version without promoting one, so a merge never changes what production serves on its own. Promote deliberately, by hand or in a separate job.
</Note>
