README
¶
CLI comparison recordings
record.sh runs real before/after binaries against the fixed synthetic API in
main.go. Commands run as openai on a PTY with a fake key and an isolated
environment. No live OpenAI requests or uploads are made.
capture_and_render.sh shares temporary setup, fixture lifecycle, PTY capture,
rendering and media assembly across this recorder, image models and streaming
text. Each recorder keeps its own scenes, rendering settings and assertions.
Failures stop the recording; exit and interruption clean up its fixture and
temporary state. Each run requires an empty output directory outside the
repository so it cannot overwrite previous evidence.
The tested replay tools are asciinema 3.2.1, agg 1.9.0 and ffmpeg 4.4.8. Install
these tools independently and put asciinema, agg, ffmpeg and ffprobe on
PATH. This is a terminal replay, not a native Apple Terminal, PowerShell or
cmd.exe capture. The retained .tape recipe is for VHS; it does not produce the
asciinema/agg media generated by this runner.
Reproduce
Run from the repository root. Build the fixture into the ignored output folder:
mkdir -p dist/demos/bin
go build -o dist/demos/bin/demo-api ./scripts/demos/main.go
Independently build a before CLI from the comparison base and an after CLI from the proposed commit. Verify that each binary comes from its supplied commit; the recorder logs commit IDs and file hashes but cannot establish provenance. Then run:
bash scripts/demos/record.sh readable-output \
/path/to/before/openai /path/to/after/openai \
"$BEFORE_SHA" "$AFTER_SHA" /path/to/evidence/readable-output
Both SHA arguments must be full 40-character commit IDs. Readable output uses main as its comparison base. For helpful errors, use the readable-output parent as the before commit and run:
bash scripts/demos/record.sh helpful-errors \
/path/to/before/openai /path/to/after/openai \
"$BEFORE_SHA" "$AFTER_SHA" /path/to/evidence/helpful-errors
Use DEMO_API_BINARY to select another prebuilt fixture.
The runner checks actual exit status and expected fixture text for each scene. Readable scenes expect exit 0; helpful-error scenes expect exit 1. The local fixture and temporary state are cleaned up on exit. The fixture binds only to loopback and serves fixed model data, file records and error responses.
List/get results
The list-get-results scenario compares the same two file records on the pager parent and
the feature branch. Both commands use openai files list --max-items 2. The
records have distinct IDs, filenames and sizes, with seven fields each so the
complete before output fits in the 90-column by 24-row capture. The after scene
retains ID, filename, purpose, bytes and status, followed by
one Summary; use --format json for full data. notice after the list.
Two more scenes retrieve the first file before and after the change. The last
scene uses openai --format json files retrieve file_training, demonstrating
that the original object and created_at fields are still available. All five
scenes use the same fixture server and expect exit 0. The recorder checks both
file IDs in the list scenes, exactly one summary hint in each after scene, and the
creation timestamp in the before and explicit JSON scenes.
Build the fixture as above, then capture the final feature binary using its
actual full commit ID. For the September 2026 feature extraction, the pinned
before commit is the pager cleanup parent ef4fd8b6baf818781ff5c5705f7e048e0efbe322.
Build its binary independently, then supply both verified binary paths:
PATH="/Users/vguvvala/.cache/cli-terminal-replay/bin:$PATH" \
bash scripts/demos/record.sh list-get-results \
"$BEFORE_BINARY" "$AFTER_BINARY" \
ef4fd8b6baf818781ff5c5705f7e048e0efbe322 \
"$AFTER_SHA" \
/absolute/path/to/list-get/media
Keep the media outside Git. Inspect before.png, after.png,
before-retrieve.png, after-retrieve.png, explicit-json.png and frames from
comparison.gif before using them for review. The fixture and recipe are
synthetic; the screenshots and GIF must come from actual binary execution.
list-get-results.tape preserves the same commands for a separate VHS capture.
Evidence and limits
The scenes show before, after and explicit JSON output. Each uses bash, 90 columns by 24 rows, Menlo at 22 px, Dracula colors and a 3.5-second final pause. If Menlo is unavailable, supply it locally before recording so styling matches. Terminal color detection can add a delay; recorded output and timing are not rewritten.
Each original scene is rendered separately with agg, then ffmpeg joins the full GIF frames while retaining the recorded timing and final pauses (within GIF timing precision). This avoids partial glyphs that agg 1.9.0 can retain across screen clears in a merged recording. The combined cast is preserved alongside the individual captures for provenance.
The output folder contains comparison.gif, before.png, after.png,
explicit-json.png, individual scene GIFs and their comparison-scenes.txt
list, individual and combined .cast files, text transcripts, and the retained
VHS tape. metadata.txt and media.json record commits,
hashes, actual exit codes, OS, shell, tool versions, dimensions and duration.
Inspect the GIF and screenshots for readable text, clipping, timing, correct
behavior and sensitive data before sharing. Keep recorded media outside the
repository; executables may use ignored dist/. Regenerate evidence after changes
that affect the demonstrated behavior. Retain only the runner, fixture and
recipes in Git.
For a separate VHS capture, provide DEMO_BEFORE_DIR and DEMO_AFTER_DIR
containing the matching binaries named openai, plus OPENAI_BASE_URL pointing
to this local fixture and a synthetic OPENAI_API_KEY. Run the tape from an
ignored output directory with vhs and validate it first with vhs validate.
Do not label asciinema/agg output as a VHS or native-terminal capture.
Official documentation: asciinema recording, configuration, agg rendering, VHS, and ffmpeg.
Image defaults and saving
Build the comparison binaries from main and the proposed feature commit in separate checkouts, then build the synthetic fixture:
go build -o dist/demos/bin/demo-api ./scripts/demos/main.go
PATH="$HOME/.cache/cli-terminal-replay/bin:$PATH" \
bash scripts/demos/record-image-saving.sh \
/path/to/before/openai /path/to/after/openai \
BEFORE_COMMIT AFTER_COMMIT /path/outside/repository/image-saving-demo
The runner reuses capture_and_render.sh for setup, fixture lifecycle, capture
and rendering. Image scenes and assertions remain in record-image-saving.sh.
Use an empty output directory outside the repository; fixture shutdown must
succeed before output validation and media assembly.
It uses asciinema 3.2.1 and agg 1.9.0, real binaries in a PTY, isolated
synthetic home directories, and a loopback API. It records the same prompt
before and after, then explicit JSON. It verifies request defaults, unchanged
saved PNG bytes, complete paths and the absence of files in API-output mode.
Inspect the screenshots and GIF before sharing them. This is a terminal-text
replay, not native image-renderer validation. image-saving.tape is the reusable
VHS alternative; it was not used for the macOS replay.
Image-saving recovery
record-image-saving-recovery.sh reuses the same image fixture and capture
helper. It compares --stream=true --max-items -1 before and after the fix,
then a two-image response with an invalid second image and closed stdout
(| true). The recovery scenes preserve one saved file and exit 1; only the
after scene explains that saved paths could not be printed.
Build demo-api as above, then run:
bash scripts/demos/record-image-saving-recovery.sh \
/path/to/before/openai /path/to/after/openai \
BEFORE_COMMIT AFTER_COMMIT /path/outside/repository/image-saving-recovery
The runner checks real exit codes, exact request bodies, saved PNG bytes and
recovery text. Inspect comparison.gif, before.png, after.png,
before-recovery.png and after-recovery.png. The local fixture only accepts
fixed synthetic inputs. image-saving-recovery.tape is the VHS alternative.
Image edits and variations
record-image-edit-saving.sh compares edits and variations, then explicit JSON.
It reuses main.go and capture_and_render.sh. Build the fixture as above and
pass independently built comparison binaries:
bash scripts/demos/record-image-edit-saving.sh \
/path/to/before/openai /path/to/after/openai \
BEFORE_COMMIT AFTER_COMMIT /path/outside/repository/image-edit-saving
The fixture validates fixed multipart settings and exact source/mask bytes.
Edit responses are identical; variation responds with a synthetic URL before,
and base64 after the saving path requests b64_json. No URL is downloaded.
The recorder checks saved filenames, full printed paths, original image bytes
and explicit JSON bypass. It retains source files, saved PNGs, request hashes,
transcripts and the alternative image-edit-saving.tape VHS recipe.
Inspect all five screenshots and comparison.gif before sharing.
Directories
¶
| Path | Synopsis |
|---|---|
|
image-model-demo-api serves synthetic metadata only.
|
image-model-demo-api serves synthetic metadata only. |
|
audio-demo-api serves a fixed, delayed synthetic transcription event stream.
|
audio-demo-api serves a fixed, delayed synthetic transcription event stream. |
|
streaming-demo-api serves a fixed, delayed synthetic Responses event stream.
|
streaming-demo-api serves a fixed, delayed synthetic Responses event stream. |