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

@defai/element-cli

v1.0.0

Published

Command-line interface for developing DEFAI elements

Downloads

7

Readme

@defai/element-cli

Command-line interface for developing DEFAI elements.

Installation

npm install -g @defai/element-cli

Quick Start

# Create a new element
defai-element create my-awesome-element

# Start development server
cd my-awesome-element
defai-element dev

# Build for production
defai-element build

# Validate your element
defai-element validate

# Publish to marketplace
defai-element publish

Commands

create <name>

Create a new element project from a template.

defai-element create my-element

# With specific template
defai-element create my-element --template trading

# With custom settings
defai-element create my-element --author "John Doe" --tier silver

Options:

  • --template <type>: Template to use (basic, trading, analytics, ai-chat)
  • --author <name>: Author name
  • --tier <tier>: Required tier (free, bronze, silver, gold, titanium)

dev

Start the development server with hot reload.

defai-element dev

# With custom port
defai-element dev --port 3001

# With specific environment
defai-element dev --env production

Options:

  • --port <number>: Port number (default: 3000)
  • --host <string>: Host address (default: localhost)
  • --env <string>: Environment (development, production)

build

Build the element for production.

defai-element build

# With minification disabled
defai-element build --no-minify

# With source maps
defai-element build --sourcemap

Options:

  • --minify: Enable minification (default: true)
  • --sourcemap: Generate source maps
  • --analyze: Analyze bundle size

validate

Validate element code and configuration.

defai-element validate

# Strict validation
defai-element validate --strict

# With custom rules
defai-element validate --config validator.json

Options:

  • --strict: Enable strict validation
  • --config <file>: Custom validation config
  • --fix: Auto-fix issues where possible

test

Run element tests.

defai-element test

# With coverage
defai-element test --coverage

# Watch mode
defai-element test --watch

publish

Publish element to the DEFAI marketplace.

defai-element publish

# With version bump
defai-element publish --version patch

# Dry run
defai-element publish --dry-run

Options:

  • --version <type>: Version bump (patch, minor, major)
  • --tag <tag>: NPM tag
  • --dry-run: Simulate publish

login

Login to DEFAI marketplace.

defai-element login

# With API key
defai-element login --key YOUR_API_KEY

stats

View element statistics from marketplace.

defai-element stats

# Specific element
defai-element stats --element my-element

# Date range
defai-element stats --from 2024-01-01 --to 2024-01-31

update

Update element dependencies and SDK.

defai-element update

# Check only
defai-element update --check

# Force update
defai-element update --force

Configuration

Create a element.config.js file in your project root:

module.exports = {
  // Build configuration
  build: {
    outDir: 'dist',
    minify: true,
    sourcemap: false,
    target: 'es2020'
  },
  
  // Development server
  dev: {
    port: 3000,
    host: 'localhost',
    https: false,
    open: true
  },
  
  // Element metadata overrides
  element: {
    tierRequired: 'bronze',
    category: 'Trading'
  },
  
  // Custom webpack config
  webpack: (config) => {
    // Modify webpack config
    return config;
  }
};

Environment Variables

Create a .env file for environment-specific settings:

# API endpoints
DEFAI_API_URL=https://api.defai.com
DEFAI_WS_URL=wss://stream.defai.com

# Development
DEFAI_DEV_MODE=true
DEFAI_HOT_RELOAD=true

# Authentication
DEFAI_API_KEY=your_api_key_here

Project Structure

my-element/
├── src/
│   ├── index.ts        # Element entry point
│   ├── styles.css      # Element styles
│   └── assets/         # Static assets
├── tests/
│   └── element.test.ts  # Element tests
├── dist/               # Build output
├── element.config.js    # Element configuration
├── package.json
├── tsconfig.json
└── README.md

Debugging

Enable debug mode for detailed logs:

DEBUG=defai:* defai-element dev

License

MIT