Skip to content
SoleonePublic

About

A tiny terminal game for learning Unix and Readline keyboard shortcuts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

51 Commits

Folders and files

Repository files navigation

Key Reps

A tiny terminal game for learning Unix and Readline keyboard shortcuts.

Try it in your browser: the real game in a sandboxed terminal, no install.

Three drills solved with Ctrl+A and Ctrl+E: two perfect in green, one with a detour that scores yellow

It runs a simulated command line, so practice never executes a real shell command. Each drill gives you a target line and tracks the keyboard presses needed to solve it. The expected number is perfect in green, up to two extra presses are close in yellow, and larger detours are red.

Install

Requires Node.js 20 or newer. Once published, install Key Reps globally:

npm install --global @soleone/keyreps
keyreps

You can also run it without a global install:

npx @soleone/keyreps

Play

The program needs an interactive POSIX terminal. Press Ctrl+C to quit, Esc to reset a drill, Enter to submit it, Ctrl+Up for the next lesson, and Ctrl+Down for the previous lesson.

When a Nerd Font is installed, the interactive UI adds a few small icons to its section landmarks. Detection uses fc-list; set KEYREPS_ICONS=text to keep the text-only layout or KEYREPS_ICONS=nerdfont to force the icons.

Theming

When running under Omarchy, Key Reps reads the active theme from $XDG_STATE_HOME/omarchy/current/theme/colors.toml and uses its accent, text, status, border, and panel colors. Outside Omarchy it falls back to basic ANSI colors. Set KEYREPS_THEME_FILE to preview another Omarchy-compatible colors.toml file. While the game is running, it checks for theme changes every 750 ms and redraws after a successful reload.

What it teaches

The drills progress from individual shortcuts to command combinations. Intermediate stages require several editing commands in one repair. Expert stages hide their instructions until a wasted key press or failed attempt reveals the safety net.

  • Ctrl+A and Ctrl+E: start and end of line
  • Ctrl+B, Ctrl+F, and the left/right arrow keys: character movement
  • Alt+B and Alt+F: word movement
  • Ctrl+Left and Ctrl+Right: word movement when supported by the terminal
  • Ctrl+U and Ctrl+K: kill to the start or end
  • Ctrl+W and Alt+D: kill words
  • Ctrl+Y: yank the last kill
  • Ctrl+T: transpose characters
  • Ctrl+D: delete under the cursor

The editor, terminal decoder, and game state are separate so the behavior can be tested without needing a terminal.

Development

From a checkout, install dependencies, run the tests, and start the compiled CLI:

npm install
npm test
npm run build
node dist/src/cli.js
npm run demo            # the browser demo at http://localhost:4321
npm run media:capture   # re-record demo/media (needs agent-browser and FFmpeg)

For local development, npm link makes the command available as keyreps.

npm link
keyreps

Releasing

Releases use release-it from a clean main or master checkout. Release tooling requires Node 22+ and npm 10+; the CLI itself still supports Node 20+. It runs the tests, bumps the package version, creates a Git tag, and submits the package to npm's staging queue.

Preview a release without changing Git or publishing anything:

npm run release -- patch --dry-run

To perform a release, choose a version increment instead:

npm run release -- patch

After the release is staged, review it and approve it with your npm passkey:

npm stage list
npm stage view <stage-id>
npm stage approve <stage-id>

About

A tiny terminal game for learning Unix and Readline keyboard shortcuts.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages