---
name: cycle-time-report
description: Generate cycle-time report artifacts for archived issues in the current imdone project by reading the archive directory configured in .imdone/config.yml and each issue's changelog.yml. Use when the user wants a markdown report, SVG trend chart with a trend line, and PDF output written to /tmp for archived work, or when they want to inspect slowest or fastest archived issues.
---

# Cycle Time Report

Generate cycle-time report artifacts from archived issue folders.

The source of truth is:
- `.imdone/config.yml` for `settings.cards.archiveFolder`
- `<archive issue>/changelog.yml` for `startedAt`, `completedAt`, and `statusChanges`

This skill depends on `$markdown-pdf-docker` for the container image and the PDF rendering step.

## Quick Start

Run:

```bash
./.codex/skills/cycle-time-report/scripts/render_cycle_time_report.sh .
```

This writes a timestamped bundle under `/tmp/cycle-time-report-<timestamp>/`:
- `cycle-time-report.md`
- `cycle-time-trend.svg`
- `cycle-time-report.pdf`

Underlying steps:

```bash
./.codex/skills/markdown-pdf-docker/scripts/build_image.sh
./.codex/skills/cycle-time-report/scripts/render_cycle_time_report.sh .
```

## Workflow

1. Read `.imdone/config.yml` and resolve `settings.cards.archiveFolder`.
2. Scan that archive directory recursively for `changelog.yml`.
3. Use `startedAt` and `completedAt` when present.
4. If either is missing, derive it from `statusChanges`:
   - first `to: In Progress` becomes `startedAt`
   - first `to: Done` becomes `completedAt`
5. Generate `cycle-time-trend.svg` with a trend line inside the `$markdown-pdf-docker` image using the Node script.
6. Generate `cycle-time-report.md` in the same `/tmp` output directory.
7. Render `cycle-time-report.pdf` by passing the markdown file to `$markdown-pdf-docker`.

## Output Expectations

- Output lives in `/tmp/cycle-time-report-<timestamp>/`
- `cycle-time-report.md`: summary and issue table
- `cycle-time-trend.svg`: plotted cycle times with a trend line
- `cycle-time-report.pdf`: rendered from the markdown report

## Notes

- Cycle time is `completedAt - startedAt`.
- The generator reads local files only. It does not call Jira.
- The wrapper uses the `$markdown-pdf-docker` image so the host does not need plotting or PDF libraries installed.
- If Docker or Podman access is blocked, request escalation before running the wrapper.
