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

flowspec

v0.1.1

Published

Immutable user flow specifications for the age of agentic coding

Downloads

223

Readme

FlowSpec

Immutable user flow specifications for the age of agentic coding.

The Problem

AI coding agents can modify both implementation and tests. When a test fails, the agent might "fix" the test instead of fixing the bug. This breaks the feedback loop that catches regressions.

The Solution

FlowSpec separates what your app should do (immutable specs) from how it does it (agent-modifiable code).

  • Write user flows in simple YAML
  • Use human-readable labels (accessibility-first, a la React Testing Library)
  • Protect specs from agent modification via Claude Code hooks
  • Run deterministically in CI or interactively with an agent

Installation

# Install globally
npm install -g flowspec

# Or with bun
bun add -g flowspec

Requires agent-browser for browser automation.

Usage

Initialize a New Project

# Scaffold a new FlowSpec project
flowspec init

This creates:

  • flowspec.config.yaml - Project configuration
  • specs/example.flow.yaml - Sample flow to get started
  • .claude/settings.local.json - PreToolUse hook to protect specs from AI modification
  • Updates package.json with test:e2e script

Running init again is safe: existing files are skipped, and the protection hook is merged into an existing settings.local.json without overwriting your other settings.

Run Flows

# Run a single flow file
flowspec run specs/checkout.flow.yaml

# Run all flows in a directory
flowspec run specs/

# Specify a custom base URL
flowspec run specs/ --base-url http://localhost:8080

# Set assertion retry timeout (default: 5000ms)
flowspec run specs/ --timeout 10000

# Disable assertion retries (fail immediately)
flowspec run specs/ --timeout 0

# Show help
flowspec --help

Configuration File

FlowSpec looks for flowspec.config.yaml in the current directory or parent directories:

baseUrl: http://localhost:3000
timeout: 10000
specsDir: specs/

CLI options override config file values.

Exit Codes

| Code | Meaning | | ---- | ------- | | 0 | All flows passed | | 1 | One or more flows failed | | 2 | Parse error (invalid YAML or schema) |

Flow File Format

Flow files use YAML with a simple structure:

name: user-login
description: User can log in with valid credentials
steps:
  - visit: /login
  - fill:
      Email: [email protected]
      Password: secretpassword
  - click: Sign In
expect:
  - url: /dashboard
  - visible: Welcome back

Step Actions

| Action | Description | Example | | ------ | ----------- | ------- | | visit | Navigate to a URL (relative or absolute) | visit: /login | | click | Click element by visible text | click: "Sign In" | | fill | Fill form fields by label | fill: { Email: [email protected] } | | select | Select dropdown option by label | select: { Country: "United States" } | | wait_for | Wait for text to appear (with retry) | wait_for: "Loading complete" |

Assertions

| Assertion | Description | Example | | --------- | ----------- | ------- | | url | Check current URL contains value | url: /dashboard | | visible | Check text is visible on page | visible: "Welcome back" | | matches | Check page content matches regex | matches: "Order #\\d+" | | not_visible | Check text is NOT on page | not_visible: "Error" |

Quick Example

# specs/checkout.flow.yaml
name: checkout-flow
description: |
  User completes a purchase with items in cart.
  Captures shipping/billing info and confirms order.

steps:
  - visit: "/cart"
  - click: "Proceed to Checkout"
  - fill:
      "Email": "[email protected]"
      "Shipping Address": "123 Main St"
  - click: "Place Order"

expect:
  - url: "/order/confirmation"
  - visible: "Order confirmed"
  - matches: "Order #\\d+"

Development

bun install                    # Install dependencies
bun run build                  # Build CLI (required for bun link)
bun link                       # Link CLI locally as 'flowspec'
bun test                       # Run tests
bun run typecheck              # Type check
bun run lint                   # Lint with Biome
bun run lint:fix               # Auto-fix lint issues
bun run format                 # Format with Biome
bun run test:coverage          # Run with coverage

Project Structure

FlowSpec/
├── src/
│   ├── types.ts          # Zod schemas for FlowSpec
│   ├── parser.ts         # YAML parsing with Zod validation
│   ├── runner.ts         # Flow execution via agent-browser
│   ├── reporter.ts       # Result formatting for terminal
│   └── index.ts          # CLI entry point
├── test/
│   ├── fixtures/
│   │   ├── pages/        # HTML test fixtures
│   │   └── flows/        # YAML flow fixtures
│   └── *.test.ts         # Test files
├── docs/
│   └── specification.md  # Full framework design
└── specs/                # User flow specs (immutable)

Documentation

License

MIT