npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kivacore/cli-browser

v1.1.0

Published

KIVA API CLI for the browser: run kiva API commands from a web page

Readme

@kivacore/cli-browser

The API commands of the kiva CLI, packaged to run in a web page. Use it to build a terminal-style console or a CLI simulator on top of the Kiva API: the commands, flags and output are the ones of the real CLI, because they are built from the same source.

One ES module, no dependencies, no Node APIs.

import { createKivaCli } from "@kivacore/cli-browser";

const cli = createKivaCli({ accessToken });

const apps = await cli.run("apps list");
console.log(apps.stdout);

const who = await cli.run("auth who --json");
console.log(JSON.parse(who.stdout).data.email);

Signing in

There is no auth login. The page signs the user in and hands the tokens to the CLI:

const cli = createKivaCli({
  accessToken,
  refreshToken, // optional: lets the CLI renew an expired access token
  clientId, // the OAuth2 client the tokens were issued to; needed with refreshToken
  apiBaseUrl: "https://api.kiva.app", // the default
  onTokensChange: ({ accessToken, refreshToken, expiresAt }) => saveTokens({ accessToken, refreshToken }),
});

The first command that needs a session asks the API who the token belongs to (GET /users/me), so results carry the same context (email and tenant) as the real CLI. When the user signs in again or switches tenant, pass the new tokens with cli.setTokens({ accessToken, refreshToken, clientId }).

Without a refresh token, commands fail once the access token expires, until setTokens is called.

The API must allow cross-origin requests from the page's origin.

Running commands

run takes a command line or an argument list. A leading kiva is optional, and quoting follows shell rules, so JSON arguments can be written as in a terminal:

await cli.run(`ds create crm contacts --data '{"name":"Ada"}'`);
await cli.run(["ds", "create", "crm", "contacts", "--data", JSON.stringify({ name: "Ada" })]);

It resolves to { argv, exitCode, stdout, stderr } and does not reject when a command fails: check exitCode. As in the real CLI, a failing command prints its error to stdout; stderr holds what the browser build itself refuses.

Options for a single command:

| Option | Purpose | | ---------------------- | ----------------------------------------------------------------------------- | | stdin | Text piped to the command, like echo '{…}' \| kiva ds create crm contacts. | | env | Extra environment variables for this command. | | tty | false formats output for a program, as when the real CLI's output is piped. | | onStdout, onStderr | Receive output while the command runs. |

Every global flag of the CLI works: --json, --format <toon|json|yaml|md|jsonl>, --filter-output, --help, --schema, --llms, and the rest listed by kiva --help.

Commands run one at a time; calls made while another command is running wait their turn.

Files

Options that read a file (--from-file, uploads) read from an in-memory filesystem that belongs to the CLI instance:

const cli = createKivaCli({ accessToken, files: { "contacts.csv": csvText } });
cli.files.write("logo.png", pngBytes);

await cli.run("ds create crm contacts --from-file contacts.csv");

cli.files has write, read, readBytes, remove and list. Relative paths resolve against /. Files the commands write, such as the OpenAPI spec discover downloads, appear there too. Nothing is persisted: a new instance starts empty.

The tenant's OpenAPI spec is the exception. discover keeps it for every instance on the page for ten minutes, so later instances do not download it again, and discover api downloads a fresh one. Since the page cannot read an instance's files, discover results do not name the spec's file.

What is included

auth (who, tenant, accounts list, tenants list, sso-session), apps, ds, dsql, discover, studio, automation, agent, acl, account, messaging, connect and curl.

Left out, because they need a terminal, local files, git or an interactive sign-in: the agents (work, code, server), env, browser, knowledge, project-plan, release, agent-skills, update, auth login and the other session-changing auth commands, apps clone, and apps create --local-development. Running one returns exit code 1 with an explanation.

The package version is the version of the kiva CLI it was built from; cli.version returns it.