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

@0x800a6/author-txt

v1.0.0

Published

Author DSL Parser – A robust parser for author configuration files with support for blocks, types, and multiline values.

Readme

Author DSL Parser

The Author DSL parser reads and validates author.txt files. It turns them into a clean abstract syntax tree (AST) for use in scripts, websites, or applications. The format is designed for author profiles and metadata. It supports blocks, typed keys, lists, and multiline values.

Full specification: Author DSL Specification

Specification

  • File name: author.txt
  • Location: /author.txt or /.well-known/author.txt
  • Purpose: Provide machine-readable metadata about authors or maintainers.

The DSL is line-oriented. Each line is a statement, block, or comment.

Syntax Rules

  • Comments: Lines starting with # are ignored.
  • Statements: Key: Value pairs.
  • Typed keys: Key@type: Value. Common types include url, email, date, and multiline.
  • Blocks: Begin with Begin Name and end with End Name.
  • Lists: Repeated keys or comma-separated values.
  • Multiline values: Use triple quotes """ to span multiple lines.
  • Includes: Include: <path> to reference another file.

Reserved Keys

  • Author-DSL – DSL version
  • Include – references another file
  • Expires – expiration date
  • PublicKey / Fingerprint – optional identity proof

Example

# Author file example
Author-DSL: 1.0
Author: Lexi
Handle: 0x800a6
Alias: lexi, author, sysprog
Website@url: https://0x800a6.dev
Contact@email: mailto:[email protected]

Bio@multiline: """
Systems programmer.
Privacy advocate.
Inspired by Serial Experiments Lain.
"""

Begin Profile
    Skills: Assembly, Rust, C, TypeScript
    Motto: "Building the future, one line at a time"
End Profile

Include: https://0x800a6.dev/more-links.txt

AST Example

{
  "Author": "Lexi",
  "Handle": "0x800a6",
  "Alias": ["lexi", "author", "sysprog"],
  "Website": { "type": "url", "value": "https://0x800a6.dev" },
  "Bio": "Systems programmer.\nPrivacy advocate.\nInspired by Serial Experiments Lain.",
  "Profile": [
    { "Skills": ["Assembly", "Rust", "C", "TypeScript"], "Motto": "Building the future, one line at a time" }
  ]
}

Installation

npm install @0x800a6/author-txt

or clone directly:

git clone https://github.com/0x800a6/author.txt.git
cd author.txt

Usage

Basic Usage

import { readFileSync } from "fs";
import {
  parseAuthorDSL,
  formatParsedData,
  validateParsedData,
} from "@0x800a6/author-txt";

function main(): void {
  const inputPath = "author.txt";
  let input: string;

  try {
    input = readFileSync(inputPath, "utf-8");
  } catch (err) {
    console.error(`Failed to read file: ${inputPath}`);
    if (err instanceof Error) {
      console.error(err.message);
    }
    process.exit(1);
    return;
  }

  try {
    const data = parseAuthorDSL(input);
    console.log("Parsed JSON:", JSON.stringify(data, null, 2));
    console.log("Formatted:\n", formatParsedData(data));

    const warnings: string[] = validateParsedData(data);
    if (warnings.length > 0) {
      console.warn("Validation warnings:");
      for (const warning of warnings) {
        console.warn(`- ${warning}`);
      }
    }
  } catch (err) {
    console.error("Parsing failed.");
    if (err instanceof Error) {
      console.error(err.message);
    } else {
      console.error("Unknown error:", err);
    }
    process.exit(1);
  }
}

main();

Using the Plugin System

import { 
  parseAuthorDSLWithPlugins, 
  validateParsedDataWithPlugins,
  PluginManager,
  JsonFormatterPlugin,
  YamlFormatterPlugin 
} from "@0x800a6/author-txt";

// Use with default plugins
const data = parseAuthorDSLWithPlugins(input);
const warnings = validateParsedDataWithPlugins(data);

// Or create custom plugin manager
const pluginManager = new PluginManager();
pluginManager.register(new JsonFormatterPlugin());
pluginManager.register(new YamlFormatterPlugin());

// Get available output formats
const formats = pluginManager.getAvailableFormats();
console.log('Available formats:', formats); // ['json', 'yaml', 'yml']

// Format data
const jsonOutput = pluginManager.formatData(data, 'json', { indent: 2 });
const yamlOutput = pluginManager.formatData(data, 'yaml');

Errors

The parser reports descriptive errors with line numbers. It will throw when:

  • Blocks are unclosed or mismatched
  • Multiline values are not closed
  • Keys or types are invalid
  • Keys or values are empty

Plugin System

The Author DSL Parser includes a comprehensive plugin system for extensibility:

Plugin Types

  • Type Plugins: Handle custom value types (@phone, @github, @color)
  • Validation Plugins: Add custom validation rules
  • Formatter Plugins: Create custom output formats (JSON, YAML, Markdown)
  • Parser Plugins: Hook into the parsing process

Built-in Plugins

  • Type Plugins: @url, @email, @date, @phone, @github
  • Validation Plugins: Enhanced validation, security checks
  • Formatter Plugins: JSON, YAML, Markdown output

Creating Custom Plugins

import { TypePlugin, PluginContext, PluginMetadata } from '@0x800a6/author-txt';

class CustomTypePlugin implements TypePlugin {
  metadata: PluginMetadata = {
    name: 'custom-type',
    version: '1.0.0',
    description: 'Custom type plugin'
  };

  supportedTypes = ['custom'];

  processValue(value: string, type: string, context: PluginContext): any {
    return { type, value: value.toUpperCase() };
  }
}

// Register and use
const pluginManager = new PluginManager();
pluginManager.register(new CustomTypePlugin());
const data = parseAuthorDSL(input, pluginManager);

See Plugin System Documentation for complete details.

Extensibility

The DSL can grow without breaking existing files. You can:

  • Add new types (@phone, @github, @color)
  • Add new blocks for projects, skills, or social profiles
  • Add attributes to keys (Social::Handle{preferred=main})
  • Create custom plugins for any aspect of parsing, validation, or formatting

Parsers should ignore unknown keys to stay forward-compatible.

License

MIT License. See LICENSE.