Examples

AI Code Review

Drop Shiro into your pipeline as a CI image and get AI-powered code review on every merge request — no extra infra needed.

1. Workflow file

Save as .shiro/workflows/code-review.json

json
{
  "name": "code-review",
  "steps": [
    {
      "id": "get_diff",
      "type": "git.diff",
      "config": {
        "base": "{{env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME}}",
        "head": "{{env.CI_COMMIT_SHA}}"
      }
    },
    {
      "id": "review",
      "type": "ai.generate",
      "config": {
        "prompt": "You are a senior engineer. Review this diff for bugs, security issues, and style problems. Be concise.\n\nDiff:\n{{steps.get_diff.stdout}}",
        "model": "reviewer"
      },
      "depends_on": ["get_diff"]
    },
    {
      "id": "notify",
      "type": "slack.notify",
      "config": {
        "webhook_url": "{{env.SLACK_WEBHOOK_URL}}",
        "message": "AI Review for *{{env.CI_COMMIT_REF_NAME}}*:\n{{steps.review.output}}"
      },
      "depends_on": ["review"]
    }
  ]
}

2. AI config

Save as .shiro/config.yaml

yaml
models:
  - name: reviewer
    provider: openai
    model: gpt-4o-mini
    base_url: https://api.openai.com/v1
    api_key: "{{env.OPENAI_API_KEY}}"
    default: true

3. Add to your CI

GitLab CI.gitlab-ci.yml
stages:
  - review

code-review:
  stage: review
  image: ghcr.io/rajitk13/shiro-automation:latest
  variables:
    GITLAB_TOKEN: $GL_TOKEN
  script:
    - cat .shiro/workflows/code-review.json
    - shiro run
        -workflow .shiro/workflows/code-review.json
        -config .shiro/config.yaml
        -state-store gitlab
  artifacts:
    paths:
      - .shiro/state/
    expire_in: 1 day
  only:
    - merge_requests
GitHub Actions.github/workflows/code-review.yml
name: AI Code Review

on:
  pull_request:

jobs:
  review:
    runs-on: ubuntu-latest
    container:
      image: ghcr.io/rajitk13/shiro-automation:latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Shiro review
        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          shiro run \
            -workflow .shiro/workflows/code-review.json \
            -config .shiro/config.yaml \
            -state-store github

      - uses: actions/upload-artifact@v4
        with:
          name: shiro-state
          path: .shiro/state/

Using Ollama instead of OpenAI

Swap the model config — no API key needed:

yaml
models:
  - name: reviewer
    provider: ollama
    model: llama3
    base_url: http://localhost:11434
    default: true