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

@dbx-tools/cli-service

v0.9.167

Published

Cross-platform service lifecycle, uv Python runtimes, and system tray menus for CLIs

Readme

@dbx-tools/cli-service

Add current-user service installation, lifecycle commands, optional uv-managed Python dependencies, and a tray menu to a Commander CLI. The managed command continues after its terminal closes on macOS, Linux, and Windows.

Add service commands

import { buildServiceCommand } from "@dbx-tools/cli-service/cli";
import { defineService } from "@dbx-tools/cli-service/definition";
import { Command } from "commander";

const program = new Command("example");
program.addCommand(
  buildServiceCommand(
    defineService(import.meta.url, {
      command: { arguments: ["serve"] },
      menu: [{ type: "url", label: "Open App", url: "http://127.0.0.1:4400" }],
    }),
  ),
);
await program.parseAsync(process.argv);

defineService uses the owning package's name, version, and default executable. Use command.binName when the package has multiple executable entries. Set command.executable to run an existing external program instead of compiling a package entrypoint. Managed commands default NODE_ENV to production. An explicit command.environment.NODE_ENV overrides it.

Set pythonPackage when the compiled service command needs a Python runtime:

defineService(import.meta.url, {
  pythonPackage: { name: "example-runtime" },
  command: { arguments: ["serve"] },
});

During installation, the service creates an isolated uv environment under its data directory, installs the Python distribution at the service version, and sets PYTHON to that environment's interpreter. pythonPackage.python selects the Python version uv manages and defaults to 3.11. uv must be available on PATH during installation. Uninstalling the service removes the environment with the rest of the service-owned data.

Local-project installations preserve package extras and companion dependencies. Offline installations resolve only from uv's cache and fail immediately when a required artifact is unavailable.

command.options accepts either a concrete option object or a Zod object schema. Objects serialize their current values. Schemas parse {} and serialize their defaults. Boolean values become positive or negated flags, arrays become repeated flags, and undefined values are omitted:

defineService(import.meta.url, {
  command: {
    arguments: ["serve"],
    options: {
      host: "127.0.0.1",
      port: 4400,
      telemetry: false,
    },
  },
});

Install and manage the service

For the example program above:

example service install
example service status
example service logs -- tail -f
example service uninstall

Arguments after -- run as a command with the service log path appended, so logs -- cat prints the log and logs -- tail -f follows it.

The service belongs to the current user. Login startup uses a LaunchAgent on macOS, an XDG autostart entry on Linux, and a Startup command on Windows. Package entrypoints are compiled with Bun into ~/.dbx-tools/bin.

restart stops and starts the installed executable. It does not rebuild it. Re-run install after upgrading a consuming package to replace compiled executables and update the saved configuration.

Customize the tray menu

The default tray menu shows the program name and version and offers Quit. Add URL, command, or separator items through the service definition. Custom command items can select a package binary or an external executable in the same way as the main service command.

Use this package when adding service support to another CLI so users get the same installation, lifecycle commands, and tray behavior. The generated reference uses <cli> as a placeholder for the consuming program's name.

Command reference

<cli> service

Install and manage the desktop service

<cli> service [command]

Commands

| Command | Description | | ------------------- | ----------------------------------------------------- | | install [options] | Install the service for the current user and start it | | start | Start the installed service | | stop | Stop the running service | | restart | Restart the installed service | | status | Print service installation and process state as JSON | | logs [command...] | Print the service log path or append it to a command | | uninstall | Stop and remove the service for the current user |

<cli> service install

Install the service for the current user and start it

<cli> service install [options]

Options

| Option | Description | | -------------------------- | ---------------------------------------------------------------------------------- | | --start | Start the service after installation. (default: true) | | --no-start | Disable start the service after installation. | | --python-project <value> | Local Python project installed instead of the registry package. | | --offline | Install Python packages from the uv cache without network access. (default: false) | | --no-offline | Disable install python packages from the uv cache without network access. |

<cli> service start

Start the installed service

<cli> service start

<cli> service stop

Stop the running service

<cli> service stop

<cli> service restart

Restart the installed service

<cli> service restart

<cli> service status

Print service installation and process state as JSON

<cli> service status

<cli> service logs

Print the service log path or append it to a command

<cli> service logs [command...]

Arguments

| Argument | Description | | --------- | -------------------------------------------------------- | | command | Command and arguments to run before the service log path |

<cli> service uninstall

Stop and remove the service for the current user

<cli> service uninstall