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

@bemedev/app-cli

v1.10.0

Published

CLI tool and AST parseTree parser for @bemedev/app

Downloads

1,051

Readme

@bemedev/app-cli

CLI tool and AST parseTree parser for @bemedev/app.

Installation

pnpm add -D @bemedev/app-cli

Or using npm / yarn:

npm install -D @bemedev/app-cli
# or
yarn add -D @bemedev/app-cli

CLI Usage

The CLI binary app-cli scans your workspace for machine definition files (*.machine.ts and *.fsm.ts), parses their configurations using AST traversal, and automatically generates ambient type definitions into app.gen.ts to register machine types into @bemedev/app's Register interface.

npx app-cli <command> [options]

1. generate

Performs a one-time generation of app.gen.ts by discovering and parsing all machine files in the workspace.

How it works:

  1. Discovery: Searches for all files matching *.machine.ts and *.fsm.ts (ignoring excluded directories such as node_modules, dist, lib).
  2. Extraction & AST Analysis: Uses ts-morph and the internal parseTree utility to extract machine names, initial states, target paths, events, options, and context types (pContext).
  3. Type Emission: Generates a strongly typed module declaration in app.gen.ts augmenting @bemedev/app's Register interface.
  4. Cleanup: Automatically removes app.gen.ts if all machine files are deleted or no valid machines are found.

Options:

| Option | Short | Description | Default | | ---------------------- | ----- | ---------------------------------------------------------------------------- | ------------------------------------------- | | --cwd <path> | -c | The directory where machine files are searched. | Current working directory (process.cwd()) | | --excludes <dirs...> | -e | List of directories or glob patterns to ignore during file discovery. | ['node_modules', 'dist', 'lib'] | | --dry-run | -d | Prints the generated module declaration to stdout without writing to disk. | false |

Examples:

# One-time generation in current directory
npx app-cli generate

# Custom working directory
npx app-cli generate -c ./src

# Exclude additional folders
npx app-cli generate -e temp coverage

# Dry-run inspection
npx app-cli generate --dry-run

2. watch (Alias: dev)

Starts a persistent file watcher that monitors machine files and dynamically regenerates app.gen.ts whenever changes occur.

How it works:

  1. Initial Build: Executes an initial full generation on launch.
  2. File Monitoring: Uses node-watch to recursively monitor *.machine.ts and *.fsm.ts files in real-time.
  3. Debounced Regeneration: Debounces changes (300ms delay) to handle file saving sequences smoothly.
  4. Auto-Scaffolding: Automatically populates newly created empty .machine.ts or .fsm.ts files with starter boilerplate code (createMachine(...)).
  5. Clean Shutdown: Listens for SIGINT (Ctrl+C) to terminate the watcher gracefully.

Options:

| Option | Short | Description | Default | | ---------------------- | ----- | ------------------------------------------------------ | ------------------------------------------- | | --cwd <path> | -c | The directory to watch for machine file modifications. | Current working directory (process.cwd()) | | --excludes <dirs...> | -e | List of directories to exclude from watcher events. | ['node_modules', 'dist', 'lib'] |

Examples:

# Start watch mode during development
npx app-cli watch

# Use the dev alias
npx app-cli dev

# Watch a specific directory
npx app-cli watch -c ./packages/feature

Programmatic API

In addition to CLI commands, @bemedev/app-cli exports AST parser utilities for programmatic integration:

import { parseTree } from '@bemedev/app-cli';
import type {
  ParseTree_F,
  ConfigPaths,
  ParseTreeContext,
} from '@bemedev/app-cli';

// Extract state paths, targets, and structure from machine config AST nodes
const tree = parseTree(configNode);

License

MIT