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

@aigraphia/cli

v1.0.1

Published

CLI tool for AIGP

Downloads

26

Readme

@aigraphia/cli

Command-line interface for working with AIGP diagrams.

Installation

pnpm add -g @aigraphia/cli

Or use with pnpm dlx:

pnpm dlx @aigraphia/cli [command]

Commands

aigp init [type] [name]

Initialize a new diagram with optional type and name.

Examples:

# Interactive mode - prompts for type and name
aigp init

# Create a flowchart diagram
aigp init flowchart my-diagram

# Create a sequence diagram
aigp init sequence user-flow

aigp validate <file>

Validate an AIGP diagram file against the schema.

Examples:

# Validate a diagram file
aigp validate my-diagram.json

# Validate a JSON file
aigp validate diagram.json

aigp types

List all available diagram types supported by AIGP.

Output includes:

  • Diagram type ID
  • Display name
  • Description
  • Node types available
  • Edge types available

Example:

aigp types

aigp export svg <input> [options]

Export an AIGP diagram to SVG format.

Arguments:

  • <input> - Input AIGP diagram file (.json or .json)

Options:

  • -o, --output <file> - Output SVG file (default: input.svg)
  • -w, --width <pixels> - SVG width (default: 800)
  • -h, --height <pixels> - SVG height (default: 600)
  • -p, --padding <pixels> - Padding around diagram (default: 20)
  • -b, --background <color> - Background color (default: #ffffff)
  • --no-viewbox - Disable viewBox attribute

Examples:

# Export to SVG with default settings
aigp export svg diagram.json

# Export with custom dimensions
aigp export svg diagram.json -w 1200 -h 800

# Export with custom output path
aigp export svg diagram.json -o output/diagram.svg

# Export with transparent background
aigp export svg diagram.json -b transparent

# Export with custom padding
aigp export svg diagram.json -p 40

aigp export png <input> [options]

Export an AIGP diagram to PNG format (or JPEG/WebP).

Arguments:

  • <input> - Input AIGP diagram file (.json or .json)

Options:

  • -o, --output <file> - Output PNG file (default: input.png)
  • -w, --width <pixels> - Image width (default: 800)
  • -h, --height <pixels> - Image height (default: 600)
  • -p, --padding <pixels> - Padding around diagram (default: 20)
  • -b, --background <color> - Background color (default: #ffffff)
  • -s, --scale <factor> - Scale factor for retina displays (default: 2)
  • -q, --quality <percent> - Image quality 1-100 (default: 90)
  • -f, --format <type> - Output format: png, jpeg, webp (default: png)

Examples:

# Export to PNG with default settings (2x scale)
aigp export png diagram.json

# Export with custom dimensions
aigp export png diagram.json -w 1600 -h 1200

# Export as JPEG with 85% quality
aigp export png diagram.json -o diagram.jpg -f jpeg -q 85

# Export as WebP
aigp export png diagram.json -o diagram.webp -f webp

# Export with 3x scale for extra high quality
aigp export png diagram.json -s 3

# Export with custom output path
aigp export png diagram.json -o exports/diagram.png

Usage Examples

Create and Export a Flowchart

# Initialize a flowchart
aigp init flowchart my-flow

# Edit the generated file (my-flow.json)
# ... add your nodes and edges ...

# Validate the diagram
aigp validate my-flow.json

# Export to SVG
aigp export svg my-flow.json

# Export to PNG
aigp export png my-flow.json

Batch Export

# Export all diagrams in a directory to SVG
for file in *.json; do
  aigp export svg "$file"
done

# Export all diagrams to PNG with high quality
for file in *.json; do
  aigp export png "$file" -s 3 -q 95
done

Export for Web and Print

# Web version (optimized size)
aigp export png diagram.json -o web/diagram.png -w 800 -s 2

# Print version (high quality)
aigp export png diagram.json -o print/diagram.png -w 3000 -s 1 -q 100

Global Options

All commands support:

  • --help - Display help information

File Formats

Input Files

The CLI accepts two input formats:

  • .json - AIGP Format (recommended)
  • .json - Standard JSON format

Both formats must conform to the AIGP schema.

Output Files

Export commands support:

  • .svg - Scalable Vector Graphics
  • .png - Portable Network Graphics
  • .jpg / .jpeg - JPEG images
  • .webp - WebP images

Exit Codes

  • 0 - Success
  • 1 - Error (validation failure, file not found, etc.)

Environment Variables

None currently used.

Dependencies

The CLI integrates these AIGP packages:

  • @aigraphia/protocol - Core protocol definitions
  • @aigraphia/plugins - Diagram type plugins
  • @aigraphia/layout - Layout engines
  • @aigraphia/export - SVG and PNG export
  • @aigraphia/converters - Format converters

Development

# Install dependencies
pnpm install

# Build the CLI
pnpm build

# Run tests
pnpm test

# Link for local development
pnpm link --global

# Test locally
aigp --help

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT - See LICENSE file for details

Related Packages

  • @aigraphia/protocol - Core protocol definitions
  • @aigraphia/plugins - Diagram type plugins
  • @aigraphia/layout - Layout algorithms
  • @aigraphia/export - SVG and PNG export
  • @aigraphia/converters - Format converters