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

@uncaged/workflow-util

v0.5.1

Published

Shared utilities: encoding, IDs, logging, frontmatter parsing, storage paths, and CLI reference generation.

Readme

@uncaged/workflow-util

Shared utilities: encoding, IDs, logging, frontmatter parsing, storage paths, and CLI reference generation.

Overview

Layer 1 shared infrastructure used across CLI, agent-kit, and agent packages. Provides Crockford Base32 encoding, ULID generation, structured logging with fixed 8-char tags, frontmatter markdown parsing/validation, process-level debug logging, and helpers for the default workflow data directory.

Dependencies: none (standalone)

Installation

bun add @uncaged/workflow-util

API

All exports come from src/index.ts.

Encoding and IDs

function encodeUint64AsCrockford(value: bigint): string
function generateUlid(nowMs: number): string
function extractUlidTimestamp(ulid: string): number | null

Logging

function createLogger(options?: { sink: { kind: "stderr" } }): LogFn

type LogFn = (tag: string, message: string) => void
// CreateLoggerOptions and LoggerSink are internal types

Process logger

function createProcessLogger(options: CreateProcessLoggerOptions): ProcessLogger

type ProcessLogger = {
  pid: string;
  log: ProcessLogFn;
};

type ProcessLoggerContext = {
  thread: string | null;
  workflow: string | null;
};

type CreateProcessLoggerOptions = {
  storageRoot: string | null;
  context: ProcessLoggerContext;
};

type ProcessLogFn = (
  tag: string,
  msg: string,
  context: Record<string, string> | null,
) => void;

Frontmatter markdown

function parseFrontmatterMarkdown(raw: string): ParsedFrontmatterMarkdown
function validateFrontmatter(
  parsed: ParsedFrontmatterMarkdown,
  schema: Record<string, unknown>,
): FrontmatterValidationError[]

type ParsedFrontmatterMarkdown = {
  frontmatter: Record<string, unknown>;
  body: string;
};

type AgentFrontmatter = { /* standard agent frontmatter fields */ };
type FrontmatterScope = string;
type FrontmatterStatus = string;
type FrontmatterValidationError = { path: string; message: string };

Result helpers

function ok<T>(value: T): Result<T, never>
function err<E>(error: E): Result<never, E>

type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }

Storage paths

function getDefaultWorkflowStorageRoot(): string
function getGlobalCasDir(storageRoot: string | undefined): string

Refs and misc

function normalizeRefsField(value: unknown): string[]
function generateCliReference(): string
function env(name: string, fallback: string): string

Usage

import {
  createLogger,
  generateUlid,
  getDefaultWorkflowStorageRoot,
  parseFrontmatterMarkdown,
} from "@uncaged/workflow-util";

const log = createLogger();
log("4KNMR2PX", "Loading workflow...");

const root = getDefaultWorkflowStorageRoot();
const threadId = generateUlid(Date.now());

Internal Structure

src/
├── index.ts
├── base32.ts              Crockford Base32 encode/decode
├── ulid.ts                  ULID generation
├── logger.ts                Structured logger
├── process-logger/          Process-level debug log files
├── frontmatter-markdown/    Parse and validate agent frontmatter
├── refs-field.ts            Normalize refs arrays on CAS nodes
├── result.ts                ok / err helpers
├── storage-root.ts          Default ~/.uncaged/workflow paths
├── env.ts                   Environment variable helper
├── cli-reference.ts         Markdown CLI reference generator
└── types.ts                 LogFn, Result, logger options

Configuration

getDefaultWorkflowStorageRoot() resolves to ~/.uncaged/workflow unless overridden by environment (see storage-root.ts).