Skip to content

CLI Reference

The kouma CLI provides commands for uploading screenshots and querying build results from the command line.

Installation

bash
npm install -g kouma-client

Or use with npx:

bash
npx kouma <command> [options]

Environment Variables

All commands accept options via flags or environment variables:

VariableFlagDescription
KOUMA_HOST--hostKouma server URL
KOUMA_API_KEY--api-keyProject API key
KOUMA_PID--pidProject ID

Environment variables are used as defaults when flags are not provided.

Commands

Create a build, upload screenshots to a build-specific staging area, and trigger analysis. Safe for parallel builds.

bash
kouma new-build-staged \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --pid your-project-id \
    --build-version v1.0.0 \
    --screenshots-dir ./screenshots
OptionRequiredDescription
--hostYesKouma server URL
--api-keyYesProject API key
--pidYesProject ID
--build-versionYesBuild identifier (e.g., git commit SHA)
--screenshots-dirYesPath to directory containing screenshot images
--metaNoCustom metadata as key=value (repeatable)

create-build

Create a new build record without triggering analysis. Use with upload-screenshot and finalize-build for full control.

bash
kouma create-build \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --pid your-project-id \
    --build-version v1.0.0
OptionRequiredDescription
--hostYesKouma server URL
--api-keyYesProject API key
--pidYesProject ID
--build-versionYesBuild identifier
--metaNoCustom metadata as key=value (repeatable)

upload-screenshot

Upload a single screenshot to a specific build's staging area.

bash
kouma upload-screenshot \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --bid build-id \
    --file ./screenshots/login.png
OptionRequiredDescription
--hostYesKouma server URL
--api-keyYesProject API key
--bidYesBuild ID (from create-build)
--fileYesPath to screenshot file

finalize-build

Trigger analysis for a previously created build. Call after all screenshots have been uploaded.

bash
kouma finalize-build \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --bid build-id
OptionRequiredDescription
--hostYesKouma server URL
--api-keyYesProject API key
--bidYesBuild ID (from create-build)

new-build deprecated

Upload screenshots sequentially and trigger comparison.

bash
kouma new-build \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --pid your-project-id \
    --build-version v1.0.0 \
    --screenshots-dir ./screenshots
OptionRequiredDescription
--hostYesKouma server URL
--api-keyYesProject API key
--pidYesProject ID
--build-versionYesBuild identifier (e.g., git commit SHA)
--screenshots-dirYesPath to directory containing screenshot images

Screenshots are uploaded one at a time, then the build is initialized.

new-build-sync deprecated

Upload all screenshots and trigger comparison in a single request.

bash
kouma new-build-sync \
    --host https://kouma.example.com \
    --api-key your-api-key \
    --pid your-project-id \
    --build-version v1.0.0 \
    --screenshots-dir ./screenshots

Same options as new-build.

build-stats

Get the status and result of a specific build.

bash
kouma build-stats --bid build-id
OptionRequiredDescription
--bidYesBuild ID

latest-build-stats

Get the status and result of the latest build for a project.

bash
kouma latest-build-stats --pid your-project-id
OptionRequiredDescription
--pidYesProject ID

CI/CD Examples

GitHub Actions

yaml
steps:
    - name: Upload screenshots to Kouma
      run: |
          npx kouma new-build-staged \
              --host ${{ secrets.KOUMA_HOST }} \
              --api-key ${{ secrets.KOUMA_API_KEY }} \
              --pid ${{ secrets.KOUMA_PID }} \
              --build-version ${{ github.sha }} \
              --screenshots-dir ./screenshots

    - name: Check build result
      run: |
          npx kouma latest-build-stats \
              --pid ${{ secrets.KOUMA_PID }}

GitLab CI

yaml
visual-test:
    script:
        - npx kouma new-build-staged --host $KOUMA_HOST --api-key $KOUMA_API_KEY --pid $KOUMA_PID --build-version $CI_COMMIT_SHA
          --screenshots-dir ./screenshots

Released under the MIT License.