intervals-cli

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 0 Imported by: 0

README

intervals.icu CLI - agent-first training data without breaking stride.

intervals is a lightweight CLI for the public Intervals.icu API, built for AI agents.

The main use case is letting tools like openclaw inspect training data, create workouts and events, and automate common Intervals workflows through command line and JSON-first output.

Install it (or tell your agent to), set INTERVALS_API_KEY, and talk to your agent. 🏃‍♂️🚴‍♂️

Install

Recommended: install from a GitHub Release with the installer script:

curl -fsSL https://raw.githubusercontent.com/jonaswide/intervals-cli/master/scripts/install.sh | sh

Manual fallback: download a prebuilt archive from GitHub Releases, extract intervals, put it on PATH.

Verify install:

intervals --version

Status

  • athlete info and training plan
  • activities list/search/upload and activity detail helpers
  • events list/get/create/upsert/delete
  • workouts list/get/create/download
  • wellness list/get/put/bulk-put

Auth

For personal use, set your Intervals.icu API key from Settings -> Developer Settings:

export INTERVALS_API_KEY=...

Bearer token also works and takes precedence if both are set:

export INTERVALS_ACCESS_TOKEN=...

Verify auth:

intervals auth status
intervals whoami --format json

Output

  • TTY stdout defaults to table
  • non-TTY stdout defaults to json
  • override with --format json|table|plain

For Agents

Recommended calling pattern:

  • prefer --format json
  • use absolute dates like 2026-03-16, not relative values like tomorrow
  • use --file - or a temp file for complex writes
  • treat stdout as result data and stderr as diagnostics
  • see docs/agents.md for write workflows and JSON examples
  • a repo-contained skill is available at skills/intervals-cli/SKILL.md

Examples:

intervals auth status
intervals whoami --format json
intervals activities list --oldest 2026-03-01 --newest 2026-03-12
intervals activities search --query "#threshold" --oldest 2026-03-01 --newest 2026-03-12 --format json
intervals activity streams 123456 --types watts,hr
printf '%s\n' '{"category":"WORKOUT","start_date_local":"2026-03-16T00:00:00","type":"Run","name":"10km @ 5:00/km","moving_time":3000,"description":"- 10km 5:00/km Pace"}' | intervals events create --file - --format json
intervals workout download 123 --format zwo --output workout.zwo
printf '%s\n' '{"restingHR":48,"weight":78.2,"sleepSecs":27000}' | intervals wellness put --date 2026-03-12 --file - --format json

Write examples:

Development

Requirements:

  • Go 1.26+

The pinned OpenAPI source lives at api/openapi-spec.json. Generated code is emitted into internal/api/gen.

Tests:

go test ./...

Optional smoke tests:

go test -tags smoke ./...

Releases

Tagging v* publishes release archives and checksums.txt automatically via GitHub Actions.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
intervals command
internal
api/gen
Package gen provides primitives to interact with the openapi HTTP API.
Package gen provides primitives to interact with the openapi HTTP API.
app
cli
out

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL