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

@577-industries/workflow-dag

v1.0.0

Published

YAML-to-DAG workflow compiler with Kahn's topological sort, cycle detection, and parallel group identification

Readme

@577-industries/workflow-dag

npm version License: Apache 2.0

A YAML-to-DAG workflow compiler that uses Kahn's topological sort to determine execution order, detect cycles, and identify steps that can run in parallel.

Implements the core algorithm described in the "Workflow DAG Compiler" patent (March 2026) by 577 Industries.

How It Works

                    ┌──────────┐
  YAML Definition → │  Parser  │
                    └────┬─────┘
                         │
                    ┌────▼─────┐
                    │ Compiler │ ← Kahn's Algorithm
                    └────┬─────┘
                         │
              ┌──────────┼──────────┐
              │          │          │
         ┌────▼───┐ ┌───▼────┐ ┌──▼───────┐
         │ Order  │ │ Groups │ │ Mermaid  │
         └────────┘ └────────┘ └──────────┘

Quick Start

npm install @577-industries/workflow-dag
import { parseYaml, compileWorkflow, toMermaid } from "@577-industries/workflow-dag";

const yaml = `
name: deploy-pipeline
steps:
  - id: build
    task: compile_code
  - id: test_unit
    task: run_unit_tests
    depends_on: [build]
  - id: test_e2e
    task: run_e2e_tests
    depends_on: [build]
  - id: deploy
    task: deploy_to_prod
    depends_on: [test_unit, test_e2e]
`;

const definition = parseYaml(yaml);
const dag = compileWorkflow(definition);

console.log(dag.executionOrder);
// → ["build", "test_unit", "test_e2e", "deploy"]

console.log(dag.parallelGroups);
// → [["build"], ["test_unit", "test_e2e"], ["deploy"]]

console.log(toMermaid(dag));
// → graph TD
//     build["compile_code"]
//     test_unit["run_unit_tests"]
//     ...

API Reference

parseYaml(yamlString: string): WorkflowDefinition

Parses a YAML string into a validated workflow definition.

compileWorkflow(definition: WorkflowDefinition): CompiledDag

Compiles a workflow definition into a DAG with execution order and parallel groups. Throws CycleDetectedError if a cycle exists, or InvalidDependencyError if a step references a nonexistent dependency.

toMermaid(dag: CompiledDag): string

Generates a Mermaid graph diagram from a compiled DAG.

simulate(dag: CompiledDag): SimulationResult

Dry-runs the DAG, estimating total execution time based on step timeouts and parallelism.

Types

| Type | Description | |------|-------------| | WorkflowDefinition | Input workflow with name, steps, and metadata | | WorkflowStep | A single step: id, task, depends_on, condition, timeout | | DagNode | Compiled node with resolved dependencies | | CompiledDag | Full compilation result: nodes, order, parallel groups | | SimulationResult | Dry-run result with group timing estimates |

Error Types

| Error | When | |-------|------| | CycleDetectedError | Workflow contains circular dependencies | | InvalidDependencyError | Step references a nonexistent dependency |

Architecture

This library implements Kahn's algorithm for topological sorting:

  1. Parse — YAML → validated WorkflowDefinition
  2. Build adjacency — compute in-degree for each node
  3. Process zero-degree nodes — in batches (each batch = parallel group)
  4. Detect cycles — if unprocessed nodes remain after sort, a cycle exists

Based on the "Workflow DAG Compiler" patent by 577 Industries.


Extracted from FORGE OS by 577 Industries.