Terminal demos
Play back a real terminal session in your docs using the optional PromptCast component.If your project is a CLI or another dev tool, sometimes the clearest documentation is a real terminal session rather than a wall of instructions. Flect includes an optional component for exactly that.
<PromptCast />
src/components/PromptCast.astro plays back an asciinema recording (a .cast file) using the asciinema-player package. Drop it into any docs page or onto the homepage to show install steps, CLI usage, or any other terminal workflow inline, as an actual replayed recording rather than a static screenshot.
Recordings are expected to live in public/casts/.
Recording your own
-
Install the asciinema CLI if you don’t already have it.
-
Record a session:
asciinema rec demo.castRun through whatever workflow you want to show, then press
Ctrl+Dor typeexitto stop recording. -
Move the resulting file into
public/casts/in this project. -
Update the cast file path inside
src/components/PromptCast.astroto point at your new file. -
Use
<PromptCast />wherever you want the recording to play: a docs page orsrc/pages/index.astro.
This is entirely optional
If your project doesn’t involve a terminal at all, there’s no need to keep this around. To remove it:
- Delete
src/components/PromptCast.astro. - Remove any
<PromptCast />usage (checksrc/pages/index.astroand any docs pages). - Remove
public/casts/and its contents. - Remove the
asciinema-playerdependency frompackage.jsonand runnpm installagain to update the lockfile.