Skip to content
DocSpringPublic

About

Agent-first CI compiler: one config generates GitHub Actions and CircleCI, and skips jobs whose inputs already passed.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

242 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cigen

CI that skips the jobs that already passed.

Most pushes touch a handful of files, and CI runs every job anyway: the full test suite after a typo fix in the README, or the docs build after a change that never went near the docs. cigen compiles one config into native GitHub Actions workflows or CircleCI config. Every job knows which files its result depends on. On GitHub Actions, when none of them has changed since the job last passed, the job skips its steps in seconds and reports success.

# cigen.yml
provider: github

workflows:
  ci:
    jobs:
      test:
        image: rust:latest
        inputs: ['src/**', 'tests/**']
        steps:
          - run: cargo test --locked

cigen generate writes .github/workflows/ci.yml, a plain workflow you commit next to the config. Before the job's own steps, it hashes the job's inputs and looks that hash up in GitHub's cache:

# generated: .github/workflows/ci.yml (an excerpt)
- name: Compute source hash
  id: compute_hash
  run: |
    set -euo pipefail
    mkdir -p .cigen/skip-cache
    mkdir -p .cigen/cache
    cigen hash \
      --job test \
      --base-dir . \
      --output job_hash \
      --cache .cigen/cache/file-hashes.json
- name: Restore skip cache
  id: job_skip_cache
  uses: actions/cache@v4
  with:
    path: .cigen/skip-cache/test
    key: job-skip-${{ runner.os }}-test-${{ steps.compute_hash.outputs.job_hash }}
  if: ${{ env.ACT != 'true' }}
- run: cargo test --locked
  if: steps.job_skip_cache.outputs.cache-hit != 'true'

The first push runs cargo test and records a pass under that hash. Push a commit that only changes the README, and the hash comes out the same: the lookup hits, cargo test never starts, and the check stays green. Change a file under src/ and the job runs again.

What goes into the hash

You list the files a job reads under inputs, as globs or named groups. cigen adds everything else it can find:

  • the job's own definition, its workflow's settings and cigen's version;
  • the hashes of the jobs it needs, so a change that reruns build reruns the tests after it too;
  • the commands and services the job uses;
  • scripts and local actions its steps name (sh scripts/check.sh, uses: ./.github/actions/setup);
  • every tracked package.json, since its scripts are what npm run runs;
  • lockfiles and toolchain pins (rust-toolchain.toml, .nvmrc).

A job that skips when its inputs changed would turn a real failure into a green check, so every rule errs towards including too much. In a git repository only tracked files count, so build output never changes a hash.

Built for coding agents

cigen is designed for coding agents to write and fix, so its config is strict. An unknown key is an error that names the file and the key, and says what to write instead:

# cigen.yml
# error: `requires` is now `needs`
provider: github
workflows:
  ci:
    jobs:
      test:
        image: rust:latest
        requires: [build]
        steps:
          - run: cargo test
  • cigen validate --format json reports every problem at once as data: file, line, key path, message and fix.
  • JSON Schemas for every config file are in schemas/v1/, for editors and agents that validate as they write.
  • The docs are Markdown for agents too: llms.txt, llms-full.txt, and install.md, a setup guide an agent can follow from start to finish.
  • Generated files say so in their header, with the command that regenerates them.

Modules

A module is the setup you paste into every job: installing a toolchain, caching its downloads, and the files that setup depends on. One line replaces it. In a Rust crate:

[package]
name = "app"
version = "0.1.0"
edition = "2024"
# cigen.yml
provider: github

workflows:
  ci:
    jobs:
      clippy:
        modules:
          - rust: { components: [clippy] }
        inputs: ['src/**']
        steps:
          - run: cargo clippy --all-targets -- -D warnings

The rust module installs the toolchain your project pins, caches cargo's downloads and build output, and adds Cargo.toml, Cargo.lock and the toolchain file to the job's hash. node, Playwright and services are next.

Install

From source, with Rust and protoc installed:

cargo install --locked --git https://github.com/DocSpring/cigen \
  cigen cigen-provider-github cigen-provider-circleci

The providers are separate binaries that cigen finds beside its own. Prebuilt binaries and a one-line installer come with v0.2.0. Then follow the quick start.

Status

cigen is early, and being rebuilt in the open. Today it loads one config in two layouts (a cigen.yml, or a .cigen/ directory with a file per job), generates GitHub Actions and CircleCI config byte for byte the same on every run, and has cigen validate, cigen hash and the rust module.

Skipping on GitHub Actions is tested end to end in a simulator of GitHub's runner. The generated workflows download the cigen release that generated them, so they need v0.2.0, the first release with those archives. Skipping on CircleCI comes next, with more modules and a command that replays a project's git history to estimate what cigen would skip.

internal_docs/STATUS.md lists what works and every known problem. internal_docs/DIRECTION.md says where cigen is going, and in what order.

Help wanted

Run cigen against your own CI and tell us where it falls short. Open an issue for:

  • a bug, or a config that should load and doesn't;
  • something you'd need before you could switch;
  • setup you paste into every repository, which a module could generate.

Open an issue. cigen is maintained with AI coding agents, and they read every issue.

Development

pnpm install         # git hooks (lefthook) and the formatters they run
task ci              # fmt, clippy and the full test suite

cigen's own CI is generated by cigen from .cigen/. CONTRIBUTING.md has the dev loop and the rules. Agents working on this repository: start with CLAUDE.md.

License

MIT

About

Agent-first CI compiler: one config generates GitHub Actions and CircleCI, and skips jobs whose inputs already passed.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages