Metadata-Version: 2.4
Name: kiro-fix-session-images
Version: 0.1.0
Summary: Repair Kiro CLI sessions broken by oversized (>=2000px) embedded images by resizing them in place.
Keywords: kiro,session,image,resize,repair
Author: sawitmee
License-Expression: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Topic :: Utilities
Requires-Dist: pillow>=10
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# kiro-fix-session-images

Repair Kiro CLI sessions that stopped working with this error:

```
At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels
```

A screenshot larger than 2000px (usually a Retina capture) gets stored in the
session history, so every later request that replays it fails. This tool scans
each session's `messages.jsonl`, downscales every embedded image above the
limit to 1900px on its longest side, and rewrites the file in place. The
original is kept next to it as `messages.jsonl.bak`.

**Warning:** Close the session in Kiro before running, then resume it.

## Install

With uv (recommended):

```sh
uv tool install kiro-fix-session-images
```

Or run it once without installing:

```sh
uvx kiro-fix-session-images --all --dry-run
```

Or with pip:

```sh
pip install kiro-fix-session-images
```

## Usage

```sh
# Fix one session
kiro-fix-session-images sess_<id>

# The sess_ prefix is added automatically if you omit it
kiro-fix-session-images <id>

# Fix every session
kiro-fix-session-images --all

# Report what would change without touching any file
kiro-fix-session-images --all --dry-run

# Use a smaller target size (default 1900, must be below 2000)
kiro-fix-session-images --all --max 1600

# Scan a different sessions directory (default ~/.kiro/sessions)
kiro-fix-session-images --all --root /path/to/sessions
```

Each affected session is printed as `sess_<id>: resized X/Y images`, followed
by a `done: N oversized image(s) fixed` summary. With `--dry-run` the wording
changes to `would resize` and `found`.

## How resizing works

Images are resized with [Pillow](https://python-pillow.org/), which is
installed as a dependency, and saved back in their original format (PNG, JPEG,
GIF or WEBP). On macOS the built-in `sips` tool is used as a faster path for
PNG and JPEG when it is available; if it fails, Pillow takes over.

## Platforms

macOS, Linux and Windows. Requires Python 3.9 or newer.

## License

MIT
