Skip to content

🀑 That awkwardly performant & enjoyable shell. Not only extremely extendable, but also powerful.

License

Notifications You must be signed in to change notification settings

stacksjs/krusty

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Krusty Shell

npm version GitHub Actions Commitizen friendly

Krusty Shell

Krusty is a modern, feature-rich shell built with TypeScript and Bun. It provides a familiar shell experience with enhanced features, extensibility, and developer-friendly tooling.

Features

  • πŸš€ Performance: Built on Bun
  • 🧠 Smart completion: Context-aware command/file completions
  • 🧩 Aliases & functions: Powerful aliasing and shell functions
  • 🧡 Pipelines & redirections: Full |, >, >>, 2>&1, here-strings, etc.
  • 🧭 Job control: jobs, bg, fg, kill, wait with proper signal handling
  • πŸ“œ Scripting: if/then/else, for/while/until, case/esac, functions, and more
  • 🎨 Themes: Configurable prompt with Git integration
  • πŸ”Œ Plugins: Extend functionality cleanly
  • πŸ§ͺ Tested: Comprehensive test suite for reliability

Quick start

# Install Krusty globally
bun add -g krusty
npm install -g krusty
yarn global add krusty
pnpm global add krusty

# Start the shell
krusty

Built-in Commands

Krusty ships with a comprehensive set of built-ins. Run help for details.

Core shell

Jobs & processes

  • jobs β€” list jobs
  • bg β€” resume a job in background
  • fg β€” bring a job to foreground
  • kill β€” send signals to jobs/processes
  • disown β€” remove jobs from job table
  • wait β€” wait for jobs to complete

Developer utilities

  • reload β€” reload configuration
  • library β€” manage/inspect libraries
  • show β€” display information/details
  • script-builtins β€” scripting helpers (internal)

Networking & system helpers

  • ip β€” display IP info
  • localip β€” show local IP
  • reloaddns β€” reload DNS cache

Productivity helpers

  • bookmark β€” manage bookmarks/paths
  • copyssh β€” copy SSH public key
  • dotfiles β€” dotfiles helper
  • emptytrash β€” empty system trash
  • ft β€” quick fuzzy file helper
  • hide β€” hide/show files
  • pstorm β€” open in PhpStorm
  • code β€” open in VS Code
  • shrug β€” print Β―\(ツ)/Β―
  • web β€” open URLs/web helpers
  • wip β€” work-in-progress helper

Short aliases (quality-of-life)

Note: A few items are convenience helpers specific to Krusty and not POSIX/Bash standard.

Usage

  • Execute external commands and pipelines: echo hi | tr a-z A-Z
  • Redirect output and duplicate FDs: sh -c 'echo out; echo err 1>&2' 2>&1 | wc -l
  • Backgrounding and job control: sleep 5 & β†’ jobs β†’ fg %1

Customization

Aliases

Create command aliases in your krusty.config.ts file:

export default {
  // ... other config
  aliases: {
    ll: 'ls -la',
    gs: 'git status',
  },
  // ... other config
}

Themes

Theme configuration powers prompt styling and Git status:

export default {
  theme: {
    prompt: {
      left: '{cwd} ❯ ',
      right: '',
    },
    git: { enabled: true },
  },
}

Environment Variables

Set environment variables in your krusty.config.ts file:

export default {
  // ... other config
  env: {
    EDITOR: 'code',
    PATH: `${process.env.HOME}/.local/bin:${process.env.PATH}`,
  },
  // ... other config
}

Scripting

Krusty includes a script engine with:

  • Control flow: if/then/else/fi, for/while/until, case/esac
  • Functions: name() { … } and function name { … }
  • Built-ins: source, test, true/false, local/declare/readonly, return/break/continue

See test/scripting.test.ts for examples.

Job Control

  • Ctrl+Z suspends the foreground job (SIGTSTP), bg resumes in background, fg brings it back
  • Ctrl+C sends SIGINT to the foreground job
  • kill -SIGNAL %n sends signals to a job; wait %n awaits completion

Development

# Clone the repository
git clone https://github.com/stacksjs/krusty.git
cd krusty

# Install dependencies
bun install

# Build the project
bun run build

Testing

bun test

Changelog

Please see our releases page for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discussions on GitHub

For casual chit-chat with others using this package:

Join the Stacks Discord Server

Postcardware

β€œSoftware that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.

Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎

Sponsors

We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.

License

The MIT License (MIT). Please see LICENSE for more information.

Made with πŸ’™

About

🀑 That awkwardly performant & enjoyable shell. Not only extremely extendable, but also powerful.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

  •