Common Helpers

The common module contains shared helpers used by project commands and other macros.

Typical responsibilities include:

  • environment initialization

  • timeline creation

  • standard project badges

  • directory comparison

  • name and label resolution

Dependencies

No additional tool is required for environment, badge, or timeline helpers. Directory comparison requires rsync.

Usage

A run-bound environment can be created with:

from cikit.macros.common import init_env

env = init_env(run_name="ruff")

Without run_name, init_env() returns a generic CiEnvironment.

Remote pipeline entries are initialized automatically on the first run-data update. chart_timeline() retrieves historical run data and returns a configurable TimelineChart before rendering.

Directory comparison is available through compare_dirs(). This helper executes rsync in dry-run mode and therefore requires the rsync executable.

Badges

python_badge(env) creates a Python version badge. ai_assisted_badge(env, value) creates an AI-assisted badge.

Timeline example

from cikit.macros.common import chart_timeline

timeline = chart_timeline(env, keys=["violations"], title="Ruff violations",
                          limit=20)
timeline.create(env, "ruff")

The chart can be customized before calling create(), which renders and registers the chart. See Timeline Charts for chart configuration.