Skip to content

Latest commit

 

History

History
365 lines (226 loc) · 10.7 KB

KIT.md

File metadata and controls

365 lines (226 loc) · 10.7 KB

Script Kit Pro Tutorials

Visit https://scriptkit.com/tutorials to view the official Script Kit tutorials created by John Lindquist.

These lessons will take your scripting skills to the next level. Unlocking countless possibilities with scripts, AI, and more! 🚀

Get Help on Github Discussions

The Script Kit community lives on GitHub discussions.

This is the place to:

Or just hit Enter to browse all.

We'll do our best to respond ASAP!

Subscribe to the Newsletter

  • Featured Scripts
  • Latest Updates
  • Tutorials and lessons
  • Script Kit Tips and Tricks
  • Curated dev news

FAQ

What is Script Kit?

Script Kit is an open-source dev tool for creating, running, editing, and sharing scripts.

These scripts can run in the Kit.app, the Terminal, GitHub actions, package.json scripts, webhooks, or pretty much anywhere.

Community of Scripters?

The main goal of Script Kit is to build a community of people who love to script away the frictions of their day! 🥰

What are Kit.app, kit, and kenvs?

  • Kit.app - The Kit.app provides a UI for your scripts. The app is "script-driven" meaning that every time you launch the app, you're really launching a script. The main menu, even though complex, is a script you could write.

  • kit - "kit" is the sdk of Script Kit

    • A bundle of JavaScript common libs wrapped by an API to make writing scripts easier (get, download, replace, outputFile, etc)
    • APIs for interacting with your OS (edit, focusTab, say, notify, etc)
    • APIs for interacting with Kit.app and Terminal (arg, env, etc)
    • Scripts and utils for app setup, managing kenvs, parsing scripts, etc
  • kenvs - Kit Enviroments (AKA "kenv") are directories that contain a "scripts" directory. If you point "kit" at a "kenv", kit will parse the scripts and give you tools to simplify running and managing them.

View Scheduled Scripts

Use cron syntax to run scripts on a schedule:

// Schedule: */10 * * * * *

Note: these scripts must not include arg or they will time out after 10 seconds

View System Event Scripts

This menu shows scripts that run on system events.

Add the System metadata to run your script on a system event

// System: unlock-screen

Available events:

  • suspend
  • resume
  • on-ac
  • on-battery
  • shutdown
  • lock-screen
  • unlock-screen
  • user-did-become-active
  • user-did-resign-active
  • Read about the available events here

Note: YMMV based on your specific machine setup.

Manage Kenvs

A "kenv" (Kit Environment) is a directory with a scripts directory. This is the place to create a kenv to manage scripts for your dev team or projects that expose APIs (GitHub, Vercel, etc). We'll be releasing official Script Kit kenvs in the future to show off some of the best practices. 👍

Clone, create new, link, push, pull, remove. This menu allows you to manage any of the kenvs you've added to your machine.

Add ~/.kit/bin to $PATH

This is similar to VS Code's "Add code to path"

You can run the kit CLI from your terminal with

~/.kit/bin/kit

but this option will allow you run the CLI with:

kit

If you're familiar with adding to your .zshrc, just add ~/.kit/bin to your PATH.

The kit CLI will allow you to run, edit, etc scripts from your terminal.

Move .kenv Parent Directory

By default, your ".kenv" is store in your system's home directory.

If you'd like to move it to ~/.config/.kenv or somewhere else, press Enter then select a new parent directory.

Add kenv Executables to $PATH

Each time you create a script, Script Kit also generates a command based on the name you can run from the terminal.

If you create a script named list-downloads, then Script Kit creates a ~/.kenv/bin/list-downloads executable.

Then you can run the command like so in the terminal:

~/.kenv/bin/list-downloads

This will walk you through running the command without the full path:

list-downloads

Theme Selector

Select from a variety of themes. Mostly a work in progress. We'll support community themes in the future. ❤️

Change Script Kit Shortcut

Don't like cmd+;? Change it here!

Add/Change a Script Shortcut

This list all the scripts and allows you to add a shortcut to it.

You can manually add shortcuts to scripts like so:

// Shortcut: cmd option g

This menu will manage that for you

Generate bin Files

If you manually manage files in the scripts dir (instead of using Kit.app or the kit CLI) you may run into the scenarios where you have to re-generate all the bin executables. This will do that for you.

Change Editor

This will re-prompt you to pick an editor from your PATH by updating your kenv .env.

You can always manually change the editor that Script Kit uses to open files in ~/.kenv/.env.

The following would use code (assuming is on the "PATH").

KIT_EDITOR=code

If code isn't on your PATH, you can add the full path to the editor.

Clear Kit Prompt Cache

Each time you move or resize the prompt around for your scripts, Script Kit will store the position and size. If you want to reset the position of you prompts back to the centered defaults, then run this command.

Manage npm Packages

This will help you install/uninstall packages from your ~/.kenv/node_modules

Note: You can use the npm method in your script to prompt the user to auto-install:

let express = await npm("express")

Switch to JavaScript Mode

Prefer JavaScript for your scripts? Hit Enter!

Switch to TypeScript Mode

Prefer TypeScript for your scripts? Hit Enter!

Sync $PATH from Terminal to Kit.app

Have a command that's working in your terminal, but doesn't work when you call it with Script Kit?

Use this to sync up your "PATH" from your terminal to the "PATH" that Script Kit will use.

You can manually edit a PATH value any time in ~/.kenv/.env

Check for Update

Kit.app will check for updates each time your machine wakes from sleep. But if you heard about an update and just can't wait, trigger this command to grab it.

Open kit.log

This will open the kit.log file in your editor. This is where Script Kit logs errors and other information.

Select Default Display

Force the prompt to always open on a specific display.

Edit .env

This will open the .env file in your editor. This is where Script Kit stores environment variables for your scripts.

Credits

John Lindquist

Development

Vojta Holik

Design

Supported By

Quit

See you soon! 👋