Kitten

Reference sections

Kitten has an interactive shell (REPL) that extends the default Node.js REPL with Kitten-specific features.

When working with Kitten interactively (i.e., during development), you can launch the shell using the s key from any Kitten instance running in your terminal.

You’ll know you’re in Kitten’s interactive shell when you see the following prompt:

🐱 💬

When Kitten runs as a service (e.g., an app you’ve deployed to a server using kitten deploy), there’s no terminal for you to press s in. Instead, Kitten listens for shell connections on 127.0.0.1, port 1337, and you open its interactive shell with the kitten shell command.

On the server, run:

kitten shell

From your own machine, run the same command on the server over SSH:

ssh -t you@server .local/bin/kitten shell

The -t option gives the shell a terminal to run in. (The command uses the path to the kitten launcher in your home folder as ~/.local/bin might not be on the path for commands you run over SSH.)

Press Ctrl D to exit the shell. Your Kitten service continues to run.

Note that the shell doesn’t ask you to authenticate, so any account on the server can connect to it and run code in your Kitten server. Only run Kitten on a server where you trust every account. (See issue #369.)

In addition to executing JavaScript statements, Kitten also provides a number of useful custom commands you can use. These commands always begin with a dot.

For a full list of available commands, including ones inherited from Node.js’s own REPL, use the .help command.

The .ls command shows you the keys of Kitten’s global kitten object – one of the most useful objects you can access in Kitten’s shell.

It is a convenience function for the more verbose Object.keys(kitten) JavaScript statement that you can also use for the same purpose.

Shows your Small Web place ID (ed25519 public key) if you have one.

Otherwise, prompts you to use the .id create command to create your Small Web place secret.

Creates your Small Web place secret (ed25519 private key, encoded as a lovely emoji string that you should keep in your password manager).

Kitten also asks your terminal to copy the secret to your clipboard (using the Operating System Command 52 escape sequence, OSC 52). Note that not all terminals support this, and Kitten has no way of knowing if yours does, so check what you paste into your password manager against the secret that it shows you.

The output looks something like the following:

   🆔 Identity

 » New ID created.

🔑 This is your secret:
🍮🐅🚲💕🦔🍑🥚🐻🌳🐹🐈🐴🥝🐩🪀🐼🐊📚🦎🐕🎓👽🌭🍑🎂🥑🧬🌳🔭👻🩰🎮

Shows the URL for accessing the Kitten Settings page of your app.

e.g., If you’re running it in development on the default port, it’ll return:

https://localhost/🐱/settings/

Shows the Sign In page URL for authenticating with your Kitten app.

e.g., If you’re running it in development on the default port, it’ll return:

https://localhost/💕/sign-in/

Shows the Sign Out page URL for signing out of your current session on your Kitten app.

e.g., If you’re running it in development on the default port, it’ll return:

https://localhost/💕/sign-out/

Shows statistics about your Kitten app (including statistics on event handlers and listeners) as well as any other Kitten processes that might be active on your machine, as well as basic statistics on all running processes and on the machine itself.

Explore ways you can use Kitten’s shell (REPL) in the Kitten’s Interactive Shell (REPL) tutorial.

Like this? Fund us!

Small Technology Foundation is a tiny, independent not-for-profit.

We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.