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

@pvasek/xmlq

v0.0.4

Published

A pipe-friendly CLI for exploring and querying XML files

Downloads

134

Readme

xmlq

npm version License: MIT

A pipe-friendly CLI for exploring and querying XML files. Built with Node.js/TypeScript.

Published on npm as @pvasek/xmlq.

Installation

npm install -g @pvasek/xmlq

Or run directly with npx:

npx @pvasek/xmlq <command> [options] [file]

Usage

All commands accept a file path or read from stdin when no file is given. Output goes to stdout, errors to stderr.

Commands

| Command | Description | |---------|-------------| | stat | Quick overview of an XML file (size, root, element count, namespaces) | | tags | List all unique element names with occurrence counts | | tree | Show the structural skeleton of the document | | select | Query nodes using XPath expressions | | first | Select first N matching nodes (shorthand for select --first) | | count | Count matches for an XPath expression | | text | Extract text content of matched nodes | | attrs | List attributes of matched elements | | fmt | Pretty-print or reformat XML | | json | Convert XML to JSON | | validate | Check if the file is well-formed XML | | ns | List namespaces used in the document | | schema | Infer a rough schema from the document |

Global flags

| Flag | Description | |------|-------------| | --help, -h | Show help | | --version, -V | Show version | | --no-color | Disable colored output | | --ns PREFIX=URI | Register namespace prefix for XPath queries |

Examples

# Get a quick overview of an XML file
xmlq stat data.xml

# See the structure
xmlq tree data.xml

# Find all unique element names
xmlq tags data.xml

# Query with XPath
xmlq select '//product[price > 100]' data.xml

# Peek at the first record
xmlq first '//product' data.xml

# Count matches
xmlq count '//product' data.xml

# Extract text values
xmlq text '//product/name' data.xml

# Convert to JSON and pipe to jq
xmlq json data.xml | jq '.catalog.product[0]'

# Pretty-print
xmlq fmt --indent 4 data.xml

# Validate
xmlq validate data.xml

# Pipe from stdin
curl -s https://example.com/feed.xml | xmlq first 3 '//item'

AI Agent Integration (Claude Code)

xmlq works with Claude Code — install the skill so Claude learns to use it automatically:

# 1. Install xmlq globally
npm install -g @pvasek/xmlq

# 2. In your project, install the skill
xmlq skill --install

This creates .claude/skills/xmlq/SKILL.md in your project. Claude Code discovers it and can then use xmlq to explore XML files on your behalf.

See SPEC.md for the full specification.

Development

Prerequisites

  • Node.js >= 18
  • npm

Setup

git clone https://github.com/pvasek/xmlq.git
cd xmlq
npm install

Build

npm run build        # compile TypeScript to dist/
npm run dev          # watch mode — recompile on changes

Run locally

node dist/index.js stat data.xml

# Or link globally for development
npm link
xmlq stat data.xml

Project structure

src/
├── index.ts               Entry point — CLI setup with commander
├── commands/
│   ├── stat.ts            Quick file overview
│   ├── tags.ts            List element names
│   ├── tree.ts            Structural skeleton
│   ├── select.ts          XPath query (core command)
│   ├── first.ts           First N matches shorthand
│   ├── count.ts           Count matches
│   ├── text.ts            Extract text content
│   ├── attrs.ts           List attributes
│   ├── fmt.ts             Pretty-print / reformat
│   ├── json.ts            XML to JSON conversion
│   ├── validate.ts        Well-formedness check
│   ├── ns.ts              List namespaces
│   └── schema.ts          Infer schema
└── utils/
    ├── input.ts           Read from file or stdin
    └── output.ts          TTY detection, output formatting

Each command file exports a register(program: Command): void function that adds its subcommand to the commander program.