Skip to content

aramirez087/opencode-pet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐾 opencode-pet

Animated Typing Cat

Your AI model shouldn't have to think alone. Adorable animated pets that hang out in your terminal while the model works! ✨

Turns Codex spritesheet pets (pet.json + spritesheet.webp) into OpenCode TUI plugins that render the pet in your terminal whenever the model is processing. Because every coder deserves a little companion while they wait. πŸ’–

πŸš€ Quick start

# 1. Install
npm install -g opencode-pet

# 2. Generate a pet (or convert your own)
opencode-pet generate

# 3. Plugin setup (pick one)

## Option A β€” Symlink (recommended)
ln -s "$(npm root -g)/opencode-pet" ~/.config/opencode/plugins/opencode-pet

## Option B β€” Direct path in ~/.config/opencode/opencode.json:
#  { "plugin": ["file:/absolute/path/to/node_modules/opencode-pet"] }

# 4. Open OpenCode β€” your pet animates while the model thinks

πŸ€” What is this?

opencode-pet adds a small animated pet companion to OpenCode that appears to the right of the session prompt whenever the AI model is busy thinking. It works by:

  1. 🐱 Curating a library of hand-designed kawaii sprites (cat, fox, ghost, slime, robot, dragon, bunny, octopus, penguin, mushroom)
  2. 🎨 Converting Codex spritesheet pets (pet.json + spritesheet.webp) into terminal-friendly frames (legacy path)
  3. ✨ Rendering frames in the OpenCode TUI using Unicode block characters (β–€β–„β–ˆ) with full ANSI color support
  4. πŸ’« Animating in sync with the model's busy/idle state

The pet renders inside a fixed 16Γ—6 cell box with overflow clipping so it always fits cleanly next to the prompt β€” no wrapping or doubling. A bundled curated fallback pet ships with the plugin so you see something adorable immediately.

🐾 Available pets

Pet Vibe
🐱 Mochi Cat Chill, observant, always watching your code
🦊 Pixel Fox Sly and curious, loves a good algorithm
πŸ‘» Tiny Ghost Boo! Just floating by, no harm intended
🍑 Blobby Slime Wobbly, cheerful, loves terminal colors
πŸ€– Retro Bot Beep boop. You're doing great.
πŸ‰ Mini Dragon Tiny flames, big dreams
🐰 Bunny Soft ears, faster than your build times
πŸ™ Octopus Many hands, all typing at once
🐧 Penguin Slides through your terminal with style
πŸ„ Shroom Fungi friends don't lie β€” your code is fine

Or generate a random pet with opencode-pet generate!

πŸ› οΈ CLI reference

Command Description
opencode-pet sprites List bundled curated sprites
opencode-pet install <id> Install a curated sprite as a pet
opencode-pet generate Procedurally generate a random pet
opencode-pet convert <path> Convert a Codex pet spritesheet
opencode-pet list List installed pets
opencode-pet preview <id> Preview a pet in your terminal
opencode-pet remove <id> Remove a pet

Convert flags

Flag Default Description
-o, --output ~/.opencode/pets Output directory
--cols auto Grid columns in spritesheet
--rows auto Grid rows in spritesheet
--output-width 40 Terminal output width (chars)
--output-height 20 Terminal output height (chars)
-c, --color truecolor Color mode: truecolor, 256, ansi16, mono
--name from pet.json Override pet ID
-f, --force β€” Overwrite existing pet
--fps 10 Animation frames per second

πŸ”Œ Plugin setup

Add the plugin to your OpenCode config at ~/.config/opencode/opencode.json (or .opencode/opencode.json for project-scoped install):

Option 1 β€” Symlink + Config (recommended)

ln -s "$(npm root -g)/opencode-pet" ~/.config/opencode/plugins/opencode-pet

Even with the symlink in place, you must also add the plugin to your opencode.json:

{
  "plugin": ["opencode-pet"]
}

Re-launch OpenCode to pick up the change.

Option 2 β€” Direct path

{
  "plugin": ["file:$(npm root -g)/opencode-pet"]
}

Re-launch OpenCode to pick up the change.

Option 3 β€” From npm (plugin name)

npm install -g opencode-pet
{
  "plugin": ["opencode-pet"]
}

For global installs, the plugin bundles solid-js and @opentui/solid so peer dependency resolution is not required.

πŸ’¬ Slash commands

Command What it does
/pet Open the pet picker to switch active pet
/pet-generate Procedurally generate a new pet
/pet-remove Open a picker to delete an installed pet
/pet-debug Show diagnostic info (pet count, active id, KV status)

πŸ—οΈ Architecture

opencode-pet/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli/index.ts            β†’ CLI entry point
β”‚   β”œβ”€β”€ converter/
β”‚   β”‚   β”œβ”€β”€ index.ts            β†’ Conversion orchestrator
β”‚   β”‚   β”œβ”€β”€ spritesheet.ts      β†’ Grid detection + frame extraction
β”‚   β”‚   └── terminal-art.ts     β†’ Frame β†’ ANSI block character conversion
β”‚   β”œβ”€β”€ plugin/
β”‚   β”‚   β”œβ”€β”€ index.tsx           β†’ OpenCode TUI plugin entry
β”‚   β”‚   └── pet-loader.ts       β†’ Pet manifest loading + KV storage
β”‚   └── types.ts                β†’ Shared type definitions
β”œβ”€β”€ assets/
β”‚   └── default-pet.json        β†’ Bundled fallback pet
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ build-plugin.mjs        β†’ Plugin build script
β”‚   └── generate-default-pet.mjs β†’ Default pet generator
β”œβ”€β”€ package.json
└── README.md

βš™οΈ How the converter works

  1. Grid detection β€” Auto-detects the spritesheet grid (e.g., 8Γ—8 for standard Codex format). Override with --cols/--rows.
  2. Frame extraction β€” Uses Sharp to slice each frame from the spritesheet.
  3. Downscaling β€” Resamples each frame to the target output size using area averaging with alpha compositing.
  4. Terminal rendering β€” Each 2Γ—1 pixel block becomes a single terminal character cell:
    • Both pixels filled β†’ β–ˆ (full block)
    • Top filled, bottom empty β†’ β–€ (upper half block)
    • Top empty, bottom filled β†’ β–„ (lower half block)
    • Both empty β†’ (space, transparent)
  5. Coloring β€” Each cell gets ANSI escape codes in the selected color mode. Adjacent cells with the same colors reuse existing codes to minimize output size.

πŸ₯Ί Why pets?

Because waiting for an AI to think shouldn't feel like staring at an empty screen. A pet gives you a tiny visual cue that something is happening, and maybe a smile while you wait. 🐾

πŸ“‹ Requirements

  • Node.js >= 18 (for CLI)
  • OpenCode >= 1.14.0 (for plugin)

πŸ“„ License

MIT

About

🐾 Adorable animated pets that hang out in your terminal while AI models think

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors