Skip to main content

Set Up the LitPage CLI and Connect a Site

Run the CLI with npx, configure a Workspace Key in the same shell, and confirm the site you can access.

Use this guide before sending a page or article to LitPage. By the end, your terminal will be able to display the CLI version, verify access, and identify the site you plan to update.

Run the CLI with npx

Use Node.js 18 or later with npm and npx available in your terminal. Start by checking which version the command runs.

node --version
npm --version
npx @litpage/cli --version

On the first run, npm may ask to fetch the @litpage/cli package. Confirm the package name and allow the download. The documentation uses npx @litpage/cli for each command, and the examples were tested with 0.7.0.

Create a Workspace Key

Open the workspace that owns your site in Builder. Use Workspace Keys to create a key with the permissions needed for the task. A read-only key is useful for inspecting a site or exporting content. A write-capable key is necessary to save or publish a draft. Use a test workspace or test site for the first tutorial. For site create and site init, create a workspace-level key with Allow website creation selected. Keys scoped to an individual site can still be used for permitted content work. The Workspace Key guide explains the creation steps and how to revoke a key.

Inject the key as LITPAGE_WORKSPACE_KEY in the environment of the terminal that runs the CLI. When you use an agent or automation runner, check the environment of that process separately. A project file can store a reference to the variable so teammates can use their own credentials.

npx @litpage/cli config set workspaceKey env:LITPAGE_WORKSPACE_KEY
npx @litpage/cli doctor

The configuration command writes a project-level litpage.config.json. Commit the file only after checking that it contains a variable reference and that the remaining settings are suitable for the whole team. Keep the key value in your secret store. In PowerShell, use the same variable name in the session environment. Once the environment is available, npx @litpage/cli config current displays the resolved configuration and masks the key.

Check your destination

npx @litpage/cli site list
npx @litpage/cli site resolve your-site

Use the first command to see sites the key can access. Use the second command to check one subdomain or active domain and copy its site ID. A site such as studio-notes.lit.page normally has the subdomain studio-notes. In each publishing command, use an explicit target or a file that identifies the intended site. When you change projects, resolve the site again before sending a write.

Read the result from doctor

A command can return a JSON receipt even when setup needs attention. Look at data.status, the individual checks and the next steps. Check the terminal environment first if the key is missing. If the site list is empty, confirm that the key belongs to the correct workspace and whether the key can create a site. Run npx @litpage/cli site create --help for the requirements. A key can pass a read check yet receive a permission error on a write. Check its type and scope before reissuing a publish command.

Continue to publish your first landing page or publish a blog post from the command line.