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

@loopstack/cli-module

v0.23.0

Published

The cli module for Loopstack

Readme

@loopstack/cli-module

The Loopstack CLI provides commands for adding and installing packages from the Loopstack registry. It handles npm installation, source file copying, and automatic module/workflow registration in your project.

Commands

loopstack add <package>

Copies the source files of a registry package into your project and registers its modules and workflows.

loopstack add @loopstack/google-oauth-calendar-example

What it does:

  1. Installs the npm package (if not already installed)
  2. Copies the package's src/ directory into your project
  3. Registers all configured modules in your target module file (e.g. default.module.ts)
  4. Registers all configured workflows in your target workspace file (e.g. default.workspace.ts)

Use add when you want full access to the source code for learning, exploring, or customizing.

Options:

| Flag | Description | | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -d, --dir <directory> | Target directory for the copied source files. If not specified, the CLI prompts with a default based on the package name. | | -m, --module <module> | Target module file to register in (e.g. src/default.module.ts). If not specified, the CLI searches for .module.ts files and prompts if multiple are found. | | -w, --workspace <workspace> | Target workspace file to register workflows in (e.g. src/default.workspace.ts). If not specified, the CLI searches for .workspace.ts files and prompts if multiple are found. |

Example:

loopstack add @loopstack/google-oauth-calendar-example -d src/calendar -m src/default.module.ts -w src/default.workspace.ts

loopstack install <package>

Installs a registry package as an npm dependency and registers its modules and workflows — without copying any source files.

loopstack install @loopstack/google-oauth-calendar-example

What it does:

  1. Installs the npm package (if not already installed)
  2. Registers all configured modules in your target module file, importing from the package name (e.g. import { ... } from '@loopstack/google-oauth-calendar-example')
  3. Registers all configured workflows in your target workspace file

Use install when you don't need to modify the source code and want to receive updates via npm.

Options:

| Flag | Description | | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -m, --module <module> | Target module file to register in (e.g. src/default.module.ts). If not specified, the CLI searches for .module.ts files and prompts if multiple are found. | | -w, --workspace <workspace> | Target workspace file to register workflows in (e.g. src/default.workspace.ts). If not specified, the CLI searches for .workspace.ts files and prompts if multiple are found. |


loopstack configure <package>

Runs only the module and workflow registration for a package that is already installed via npm. Skips registry lookup and npm installation entirely.

loopstack configure @loopstack/oauth-module

What it does:

  1. Reads the loopstack config from the installed package's package.json
  2. Registers all configured modules in your target module file
  3. Registers all configured workflows in your target workspace file

Use configure when the package is already in your node_modules (e.g. installed as a transitive dependency or after a manual npm install) and you just need to wire it into your project.

It supports both modes:

  • Without --dir (dependency-style): imports use the package name (e.g. import { ... } from '@loopstack/oauth-module')
  • With --dir (add-style): imports use relative paths from the copied source directory (e.g. import { ... } from './my-feature/my.module')

Options:

| Flag | Description | | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | -d, --dir <directory> | Directory where source files were copied to. When provided, local module/workflow entries use relative import paths instead of the package name. | | -m, --module <module> | Target module file to register in (e.g. src/default.module.ts). If not specified, the CLI searches for .module.ts files and prompts if multiple are found. | | -w, --workspace <workspace> | Target workspace file to register workflows in (e.g. src/default.workspace.ts). If not specified, the CLI searches for .workspace.ts files and prompts if multiple are found. |

Examples:

# Dependency-style: imports from package name
loopstack configure @loopstack/oauth-module

# Add-style: imports from copied source directory
loopstack configure @loopstack/google-oauth-calendar-example -d src/calendar-example

Automatic Registration

Both add and install perform automatic module and workflow registration based on the loopstack configuration in the package's package.json.

How module registration works

For each module entry in the config, the CLI:

  1. Adds an import statement to the target module file
  2. Adds the module class to the @Module() decorator's imports array

Modules can come from two sources:

  • Local (the package's own source): the import path is computed relative to the target module file (for add) or uses the package name (for install)
  • Dependency (another npm package): the import always uses the dependency's package name directly

How workflow registration works

For each workflow entry in the config, the CLI:

  1. Adds an import statement to the target workspace file
  2. Adds a property with the @InjectWorkflow() decorator to the workspace class

Like modules, workflows can come from the package's own source or from a dependency.

Package configuration

Packages declare their registration config under the loopstack key in package.json:

{
  "loopstack": {
    "installModes": ["add", "install"],
    "modules": [
      {
        "path": "src/calendar-example.module.ts",
        "className": "CalendarExampleModule"
      },
      {
        "package": "@loopstack/oauth-module",
        "className": "OAuthModule"
      },
      {
        "package": "@loopstack/google-workspace-module",
        "className": "GoogleWorkspaceModule"
      }
    ],
    "workflows": [
      {
        "path": "src/workflows/calendar-summary.workflow.ts",
        "className": "CalendarSummaryWorkflow",
        "propertyName": "calendarSummary"
      },
      {
        "package": "@loopstack/oauth-module",
        "className": "OAuthWorkflow",
        "propertyName": "oAuth"
      }
    ]
  }
}

Module entries:

| Field | Description | | ----------- | --------------------------------------------------------------- | | path | Path to the module file within the package (local modules only) | | package | npm package name (dependency modules only) | | className | The module class name to import and register |

An entry must have either path (local) or package (dependency), not both.

Workflow entries:

| Field | Description | | -------------- | ----------------------------------------------------------------------- | | path | Path to the workflow file within the package (local workflows only) | | package | npm package name (dependency workflows only) | | className | The workflow class name to import | | propertyName | The property name to use in the workspace class | | options | Optional object passed as argument to the @InjectWorkflow() decorator |

Install modes:

The installModes array controls which commands a package supports. Valid values are "add" and "install". If omitted, both modes are allowed.


Differences between add, install, and configure

| Aspect | add | install | configure | | ---------------------------- | ---------------------------------------------------- | ---------------------- | -------------------------------------- | | Registry lookup | Yes | Yes | No | | npm install | Yes | Yes | No (package must already be installed) | | Source files | Copied into your project | Stay in node_modules | Stay in node_modules | | Import paths (local entries) | Relative (e.g. ./calendar/calendar-example.module) | Package name | Package name | | --dir flag | Supported | Not applicable | Not applicable | | Customizable source | Yes | No | No | | Receives npm updates | No (your copy is independent) | Yes | Yes |