Skip to content

CosineAI/setup-cos

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Setup Cosine CLI

A GitHub Action to install the Cosine CLI (cos) in your workflows.

The Cosine CLI is a terminal-native AI coding agent that helps you write, review, and optimize code directly from your terminal. This action downloads and caches the cos binary from Cosine's GitHub releases, making it available to all subsequent steps in your workflow.

Usage

Basic workflow example

name: Example Cosine Workflow
on: [push]

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Cosine CLI
        id: setup-cos
        uses: cosineai/setup-cos@v1
        with:
          version: latest

      - name: Run a Cosine command
        run: cos version

      - name: Use the installed binary path explicitly
        run: |
          echo "Cosine version: ${{ steps.setup-cos.outputs.version }}"
          echo "Cosine binary:  ${{ steps.setup-cos.outputs.path }}"
          "${{ steps.setup-cos.outputs.path }}" version

One-step install + run

You can combine installation and execution into a single step by providing a mode and prompt:

name: Cosine Auto Run
on: [push]

jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Cosine CLI (install only)
        uses: cosineai/setup-cos@v1
        with:
          version: latest

      - name: Setup Cosine CLI (install + auto run)
        uses: cosineai/setup-cos@v1
        with:
          version: latest
          mode: auto
          prompt: "Review this PR for bugs and style issues"
          reasoning: high

Example Workflows

Ready-to-use workflow templates are available in examples/. Copy them into your repository under .github/workflows/ and adapt the prompts and triggers to your needs.

Example Trigger Mode Description
PR Review pull_request auto Automated code review on every PR update.
Security Audit push to main/master auto Deep security audit with extra-high reasoning.
Documentation workflow_dispatch plan then auto Preview and apply documentation updates.
Model Matrix workflow_dispatch auto Run the same prompt across multiple models.

Inputs

Input Description Required Default
version Version to install. Use latest or a specific tag like v0.1.0. No latest
mode Operating mode: auto, plan, manual, swarm. If set, the action runs cos start --mode <mode> after installation. No
prompt Prompt text to pass to cos via --prompt. Required when mode is set. No
reasoning Reasoning depth: none, low, medium, high, xhigh, adaptive. Passed as --reasoning. No
model Model label (e.g. gemini-3.1-pro, sonnet-4.6). Passed as --model. No
cwd Working directory for the cos run. No ${{ github.workspace }}
auto-accept Automatically accept all changes without prompting. No false
disable-discovery Disable automatic discovery of project context. No false
disable-intermediate-updates Disable intermediate progress updates. No false
origin Origin identifier passed as --origin. No gh-actions

Outputs

Output Description
version The resolved version string that was installed
path Absolute path to the installed cos binary

Supported Platforms

  • Linux x64 (ubuntu-latest)
  • Linux arm64
  • macOS arm64 (macos-latest Apple Silicon)

macOS x64 runners are not supported.

Documentation

For full CLI documentation, head to https://cosine.sh/docs/cli.

Contributing

This action is built with TypeScript and bundled with @vercel/ncc.

# Install dependencies
npm ci

# Build the action (generates dist/index.js)
npm run build

# Package for production (minified)
npm run package

Note: The dist/index.js file is checked into git because GitHub Actions requires it at runtime. You must run npm run build and commit the updated dist/index.js whenever you modify src/main.ts.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors