Beta.18 Changes/Features (`db` has a breaking change)

⚠️Breaking: New db helper

lowdb updated to 2.0, so I updated the db helper to support it.

  • access/mutate the objects in the db directly. Then .write() to save your changes to the file.
  • await db() and await myDb.write()

Example with a simple object:

let shoppingListDb = await db("shopping-list", {
list: ["apples", "bananas"],
let item = await arg("Add to list")
await shoppingListDb.write()
await arg("Shopping list", shoppingListDb.list)

You can also use an async function to store the initial data:

let reposDb = await db("repos", async () => {
let response = await get(
return {
await arg("Select repo", reposDb.repos)

Text Area prompt

let text = await textarea()

CleanShot 2021-06-04 at 14 25 12

Optional value

arg choice objects used to require a value. Now if you don't provide a value, it will simply return the entire object:

let person = await arg("Select", [
{ name: "John", location: "Chair" },
{ name: "Mindy", location: "Couch" },
await arg(person.location)

⚗️ Experimental "Multiple kenvs"

There was a ton 🏋️‍♀️ of internal work over the past couple weeks to get this working. The "big idea" is supporting multiple kit environments. For example:

  • private/personal kenv
  • shared kenv
  • company kenv
  • product kenv

Future plans

In an upcoming release:

  • you'll be able to "click to install kenv from repo" (just like we do with individual scripts)
  • update a git-controlled kenv (like a company kenv)
  • the main prompt will be able to search for all scripts across kenvs.
  • If multiple kenvs exist, creating a new script will ask you which kenv to create it in.

For now, you can try adding/creating/switching the help menu. It should all work fine, but will be waaaay cooler in the future 😎

CleanShot 2021-06-04 at 11 50 32

Improved Error Prompt

Now when an error occurs, it takes the error data, shuts down the script, then prompts you on what to do. For example, trying to use the old db would result in this:

CleanShot 2021-06-04 at 12 03 04

Improved Tab Switching

Switching tabs will now cancel the previous tabs' script. Previously, if you quickly switched tabs on the main menu, the "Hot" tab results might show up in a different tab because the loaded after the tab switched. The internals around message passing between the script and the app now have a cancellation mechanism so you only get the latest result that matches the prompt/tab. (This was also a ton of internals refactoring work 😅)

Discuss Post