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 🙏

© 2025 – Pkg Stats / Ryan Hefner

stepwise-flow

v0.1.0

Published

A site-agnostic browser automation framework with plugin support

Readme

Stepwise

A site-agnostic browser automation framework with plugin support. Built on Playwright.

Features

  • Flow-based automation: Define multi-step browser automation flows declaratively
  • Plugin system: Extend functionality with custom plugins for site-specific behaviors
  • Variable store: Share data between steps using ${path.to.value} syntax
  • Built-in step types: click, type, wait, extract, screenshot, navigate, and more
  • Conditional logic: If/else branching and polling with conditions
  • TypeScript-first: Full type safety with discriminated unions

Installation

npm install stepwise playwright

Quick Start

import { FlowEngine, PluginRegistry, registerBuiltinPlugins } from 'stepwise';

// Register built-in plugins
registerBuiltinPlugins();

// Create a flow engine
const engine = new FlowEngine({
  headless: false,
  timeout: 30000,
});

// Define a flow
const flow = {
  name: 'Example Search',
  description: 'Search Wikipedia',
  inputs: {
    searchTerm: { type: 'string' as const, description: 'Search term', required: true },
  },
  steps: [
    { type: 'navigate' as const, url: 'https://www.wikipedia.org' },
    { type: 'type' as const, selector: '#searchInput', text: '${inputs.searchTerm}' },
    { type: 'click' as const, selector: 'button[type="submit"]' },
    { type: 'wait' as const, selector: '#firstHeading' },
    { 
      type: 'extract' as const, 
      selector: '#firstHeading', 
      attribute: 'textContent',
      variable: 'pageTitle',
    },
    { type: 'log' as const, message: 'Found: ${pageTitle}' },
  ],
};

// Run the flow
const result = await engine.run(flow, { searchTerm: 'TypeScript' });
console.log(result);

Step Types

Basic Steps

  • navigate: Go to a URL
  • click: Click an element
  • type: Type text into an element
  • wait: Wait for an element to appear

Data Steps

  • extract: Extract data from elements
  • log: Log messages to console

Control Flow

  • if: Conditional branching
  • pollUntil: Poll until a condition is met

Plugin Steps

  • plugin: Execute a registered plugin

Plugin System

Create custom plugins by extending BasePlugin:

import { BasePlugin, PluginContext, StepResult } from 'stepwise';

interface MyPluginParams {
  myParam: string;
}

class MyPlugin extends BasePlugin<MyPluginParams> {
  readonly metadata = {
    namespace: 'myapp',
    name: 'myPlugin',
    description: 'Does something useful',
    version: '1.0.0',
  };

  protected async doExecute(
    params: MyPluginParams,
    context: PluginContext
  ): Promise<StepResult> {
    const { page } = context;
    // Your automation logic here
    return { success: true };
  }
}

Register and use:

import { PluginRegistry } from 'stepwise';

const registry = PluginRegistry.getInstance();
registry.register(new MyPlugin());

// In a flow:
{
  type: 'plugin',
  pluginId: 'myapp:myPlugin',
  params: { myParam: 'value' },
}

Variable Store

Variables can be set and referenced using ${path.to.value} syntax:

// Set in extract step
{ type: 'extract', selector: '.price', variable: 'product.price' }

// Reference in other steps
{ type: 'log', message: 'Price: ${product.price}' }
{ type: 'type', selector: '#input', text: '${product.price}' }

Flow inputs are available under ${inputs.fieldName}.

Local Development

  1. Build the package:
cd stepwise
npm install
npm run build
  1. In a downstream project (e.g. tcdd-bilet) add a dependency to the local folder:
cd tcdd-bilet
npm install ../stepwise

Or use npm link for development.

API Reference

FlowEngine

Main execution engine for running flows.

const engine = new FlowEngine(options);
const result = await engine.run(flow, inputs);
await engine.close();

PluginRegistry

Singleton registry for managing plugins.

const registry = PluginRegistry.getInstance();
registry.register(plugin);
registry.registerLazy('namespace', 'name', async () => new Plugin());
const plugin = await registry.get('namespace:name');

BrowserManager

Singleton for browser lifecycle management.

const browser = BrowserManager.getInstance();
await browser.init({ headless: false });
const page = await browser.getPage();
await browser.close();

License

MIT