Skip to main content
Version: v3.x.x

GetLit CLI

The GetLit CLI is a command-line tool designed to help developers manage their Lit Actions projects. The CLI provides a set of commands to create, build, test, and configure Lit Actions.

Installation​

npm install -g getlit

// or
yarn add global getlit

Usage​

To use the GetLit CLI, navigate to a directory or your existing project, and then simply run the desired command followed by any required or optional arguments. The CLI will execute the associated function and display the output accordingly.

CommandUsageDescription
action | initgetlit action🏁 Initialise a new Lit project
buildgetlit buildπŸ— Build your Lit Actions
newgetlit new [<lit-action-name>]πŸ“ Create a new Lit Action
testgetlit test [<lit-action-name>]πŸ§ͺ Test a Lit Action
watchgetlit watch [<lit-action-name>]πŸ”§ Simultaneously build and test a Lit Action
setupgetlit setupπŸ”‘ Setup config for authSig and PKP
deploygetlit deployπŸš€ Deploy your Lit Actions
derive-pkpgetlit derive-pkp --userId --projectId --formatπŸ”‘ Derive a public key from user and application IDs
searchgetlit search --get --format --publicKey --authMethodId --userId --appIdπŸ” Search for data related to PKPs
docs | docgetlit docsπŸ“– Open the Lit Protocol documentation
help | showgetlit helpπŸ†˜ Show the help menu

getlit action​

This command is used to initialize a new Lit project.

getlit action

Initialized Lit project directory looks like:

β”œβ”€β”€ README.md
β”œβ”€β”€ getlit.json
β”œβ”€β”€ globa.d.ts
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ foo.action.ts
β”‚Β Β  └── main.action.ts
β”œβ”€β”€ test
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ foo.t.action.mjs
β”‚Β Β  └── main.t.action.mjs
β”œβ”€β”€ tsconfig.json
└── utils.mjs

In order to proceed, src/foo.action.ts needs to be modified as β€˜NA_E’ to β€˜NAME’:

/**
* NA_E: foo
*
* ⬆️ Replace "_" with "M" to pass the schema validation
*
*/

const foo = () => {
return "bar";
};

You can start building your own Lit Action by modifying src/main.action.ts, and test/main.t.action.mjs accordingly.

getlit new​

This command is used to create a new Lit Action in an existing project.

getlit new newAction

A new Lit Action called newAction and the test are automatically created in the project directory:

β”œβ”€β”€ README.md
β”œβ”€β”€ getlit.json
β”œβ”€β”€ globa.d.ts
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
β”œβ”€β”€ src
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ foo.action.ts
β”‚Β Β  β”œβ”€β”€ main.action.ts
β”‚ └── newAction.action.ts
β”œβ”€β”€ test
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ foo.t.action.mjs
β”‚Β Β  β”œβ”€β”€ main.t.action.mjs
β”‚ └── newAction.t.action.mjs
β”œβ”€β”€ tsconfig.json
└── utils.mjs

getlit setup​

Recall that in order to build a Lit project, an AuthSig and a PKP are needed. setupΒ command is used to mint the PKP and create the AuthSig.

getlit setup

getlit build​

When the Lit Action is coded, and the PKP is created, final step is to build the project.

getlit build

getlit test​

You can test your Lit Actions by using the test command with the Lit Action to be tested specified:

getlit test foo

getlit watch​

This command executes the build and test commands simultaneously:

getlit watch

getlit deploy​

Once the Lit Action code is ready, after building it, it can be deployed using the deployΒ command:

getlit deploy

This command is used to get PKP-related data by providing some data like public key or IDs:

getlit search --get --format --publicKey --authMethodId --userId --appId

getlit derive-pkp​

Lit Protocol supports derived keys. Users are able to claim the key from the authentication method identifier:

getlit derive-pkp --userId --projectId --format
info

Not finding the answer you're looking for? Share your feedback on these docs by creating an issue in our GitHub Issues and Reports repository or get support by visiting our Support page.