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

drakongen

v1.4.4

Published

Generates pseudocode and AST from drakon flowcharts built with DrakonWidget or DrakonHub.

Readme

drakongen

drakongen generates pseudocode from drakon flowcharts and mind-maps built with DrakonWidget or DrakonHub.

One can use the output pseudocode as a prompt for AI applications like ChatGPT, Grok, or Gemini.

drakongen can also generate a generic AST from drakon flowcharts to generate source code in programming languages, for example, JavaScript. drakongen turns a drakon flowchart into a tree in the JSON format that one can trivially transform into code in any programming language.

How to use drakongen in the browser

Include the drakongen.js script on the web page.

<script src="browser/drakongen.js"></script>

Call drakongen.toPseudocode, drakongen.toMindTree, or drakongen.toTree functions.

<script>
var drakon = ... // Get the drakon chart from DrakonWidget
var mindJson = ... // Graf mind-map as json
var name = "Diagram one"
var filename = "Diagram one.drakon"

var pseudo = drakongen.toPseudocode(drakon, name, filename, "en")
console.log(pseudo)

var mind = drakongen.toMindTree(mindJson, name, filename)
console.log(mind)

var tree = drakongen.toTree(drakon, name, filename, "en")
console.log(tree)

</script>

Available languages:

  • en English
  • no Norwegian
  • ru Russian

How to use drakongen in Node JS

Add the drakongen package to dependencies.

npm i drakongen
  • Require the drakongen module.
  • Call toPseudocode, toMindTree, or toTree functions.
const {toTree, toPseudocode} = require("drakongen")

var drakon = ... // Get the drakon chart from DrakonWidget
var mindJson = ... // Graf mind-map as json
var name = "Diagram one"
var filename = "Diagram one.drakon"

var pseudo = toPseudocode(drakon, name, filename, "en")
console.log(pseudo)

var mind = toMindTree(mindJson, name, filename)
console.log(mind)

var tree = toTree(drakon, name, filename, "en")
console.log(tree)

How to use drakongen as a command-line tool

Install drakongen globally.

npm i --global drakongen

Run the drakongen utility.

Generate from one file

A .drakon flowchart will be converted to pseudocode.

A .graf mind-map will be converted to tree-like text.

In this example, the language is Norwegian, the path to the output folder is out, the input file is Hello.drakon:

drakongen --language no --output out Hello.drakon

Project mode

Drakongen in project mode generates a single prompt file by processing and concatenating multiple input files, including flowcharts, mind-maps, text files, and directories. It reads a project file specifying the input files, processes them in the defined order, and outputs a consolidated prompt file suitable for AI-driven code generation.

Features

  • Processes multiple file types:
    • Plain text files (e.g., .txt) are included as-is.
    • Mind-map files (e.g., .graf) are converted to indented text.
    • Flowchart files (e.g., .drakon) are converted to pseudocode.
    • Directories are recursively processed, including all files within.
  • Preserves file order: Files are processed and concatenated in the exact order specified in the project file, which is critical for AI tools relying on sequential context.
  • Flexible project file format: A simple text-based project file lists files and directories to process.

Usage

Run the tool with the following command:

drakongen --project <project_file> --output <output_directory>
  • --project: Path to the project file (e.g., exampleproject/foo.proj).
  • --output: Directory where the output prompt file will be saved (e.g., exampleproject).

Example

Given a project file exampleproject/foo.proj with the following content:

start.txt
math
class Point.graf
foo.drakon

Run:

drakongen --project exampleproject/foo.proj --output exampleproject

This will:

  1. Include start.txt as-is.
  2. Process all files in the math directory recursively.
  3. Convert class Point.graf (mind-map) to indented text.
  4. Convert foo.drakon (flowchart) to pseudocode.
  5. Concatenate all processed content into exampleproject/foo.txt.

The output file foo.txt will contain the concatenated text in the exact order specified in foo.proj.

Project File Format

The project file (e.g., foo.proj) is a plain text file where each line specifies:

  • A file path (relative to the project file) for a text, mind-map, or flowchart file.
  • A directory path to process all files within it recursively.