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

@outshift/hax

v1.0.6

Published

A human-AI experience CLI tool for installing composable building blocks for rich, agentic user experiences.

Downloads

22

Readme

HAX SDK

Installation

Install globally via npm:

npm install -g @outshift/hax

Or for development from source:

# Clone the repository
git clone https://github.com/outshift-open/hax.git
cd hax/cli
npm install
npm run build
npm link

Quick Start

Initialize HAX in your project:

hax init

Add components to your project:

hax add artifact form
hax add artifact code-editor data-visualizer

Add Composers (chat features) to your project

hax add composer chat-commands file-upload rules-context
hax add composer chat-commands

List available components:

hax list

Available Components

  • form - Dynamic form builder
  • timeline - Activity timeline with status indicators
  • mindmap - Interactive mindmap with auto-layout
  • code-editor - Monaco-based code editor
  • details - Statistics and data display component
  • data-visualizer - Data visualization wrapper
  • source-attribution - Source citation component with clickable reference badges
  • rationale - Decision reasoning component with confidence indicators and criteria badges

Available Composers

  • chat-commands - Interactive chat interface with command suggestions, file picker, and context management
  • file-upload - Complete file upload flow with drag-and-drop, progress indicators, and error handling
  • rules-context - Rule configuration and management interface with validation and persistence

Configuration

The CLI creates a hax.json file in your project:

Basic configuration (after hax init):

{
  "$schema": "./schema.json",
  "style": "default",
  "components": [
    "code-editor",
    "data-visualizer",
    "timeline",
    "form",
    "mindmap",
    "details"
  ],
  "features": ["rules-context", "chat-commands", "file-upload"],
  "artifacts": {
    "path": "src/hax/artifacts"
  },
  "composers": {
    "path": "src/hax/composers"
  }
}

Example with multi-repository setup:

{
  "$schema": "./schema.json",
  "style": "default",
  "artifacts": {
    "path": "src/hax/artifacts"
  },
  "components": [],
  "registries": {
    "default": "official",
    "fallback": ["official", "internal", "partner"],
    "sources": {
      "official": {
        "type": "github",
        "repo": "outshift-open/hax",
        "branch": "main",
        "name": "official"
      },
      "internal": {
        "type": "github",
        "repo": "your-org/hax-components",
        "branch": "main",
        "name": "internal"
      },
      "partner": {
        "type": "github",
        "repo": "partner-org/components",
        "branch": "production",
        "name": "partner",

      }
    }
  }

Note: Repository names like internal, partner are example aliases - you can use any name that makes sense for your organization (e.g., dev, staging, company-name, team-ui, etc.)

Configuration Options

  • artifacts.path: Where artifact components are installed (default: src/hax/artifacts)
  • components: List of installed components (auto-managed)
  • composers: List of installed composer components (stored in src/hax/composers)
  • style: Component styling variant (default: "default")
  • registries.default: Default repository to check first
  • registries.fallback: Repository search order for component resolution
  • registries.sources: Repository definitions with GitHub details and optional tokens

Component Types

  • Artifacts: Individual UI components for specific visualizations and interactions
  • Composers: Enhanced chat interface with chat commands (@, +, /), file upload, and rules for agent behavior.
  • UI Components: Reusable base components (buttons, inputs, etc.) automatically installed as dependencies

Registry Sources

The CLI supports multiple registry sources:

GitHub Registry (Default)

The CLI uses the public GitHub registry by default. No additional configuration needed:

# Uses public GitHub registry from main branch (default)
HAX_REGISTRY_SOURCE=github:main

Local Registry

# Uses local TypeScript registry files
HAX_REGISTRY_SOURCE=local

Set via environment variable if needed:

# Set environment variable for current session
export HAX_REGISTRY_SOURCE=github:main

# Or run with environment variable
HAX_REGISTRY_SOURCE=github:main hax add artifact form

Multi-Repository Architecture

HAX CLI supports multiple component repositories for organizational flexibility:

Use Cases

  • Enterprise Organizations: Maintain internal component libraries alongside official HAX components
  • Partner Ecosystems: Access partner organization components while maintaining fallback to official registry
  • Development Workflows: Use development branches for testing while falling back to stable releases
  • Private Components: Secure proprietary components with authentication tokens

Repository Types

  1. Official Repository: Core HAX components (always available)
  2. Custom Repositories: Organization-specific components
  3. Partner Repositories: External organization components
  4. Development Repositories: Testing and development branches

Fallback Chain

Components are resolved using intelligent fallback:

Default Repository → Fallback Repository 1 → Fallback Repository 2 → Official

This ensures:

  • ✅ Custom components override official ones when available
  • ✅ Graceful degradation when custom repositories are unavailable
  • ✅ Consistent experience across different environments
  • ✅ Explicit control over component sources with --repo flag

Security & Authentication

  • Public Repositories: No authentication required (default)
  • Private Repositories: Secure with GitHub tokens (enterprise use)
  • Per-Repository Tokens: Different authentication for different repositories
  • Environment Variables: Global GitHub token fallback for private repos

Project Structure

  • cli/: CLI source code and tooling
    • src/: Main CLI source code
      • commands/: CLI commands (add, init, list)
      • config/: Configuration management
      • generator/: Component installation engine
      • registry/: Component registries
        • default/: Local TypeScript registry
        • github-registry/: GitHub JSON registry
      • types/: TypeScript type definitions
      • utils/: Utility functions
  • hax/: HAX component library
    • artifacts/: Available HAX components (form, timeline, etc.)
    • components/ui/: Shared UI components
    • lib/: Utility libraries

How It Works

  1. Multi-Repository Registry: Components are defined across multiple repositories with metadata (dependencies, files, types)
  2. Intelligent Resolution: CLI searches repositories in priority order with automatic fallback
  3. Installation: Downloads component files from resolved repository and installs npm dependencies
  4. Path Aliases: Automatically configures TypeScript/JavaScript path mapping
  5. Dependencies: Resolves both npm packages and HAX UI component dependencies across repositories

Component Structure

Each HAX component includes:

component-name/
├── component-name.tsx    # Main React component
├── action.ts            # CopilotKit action hook
├── types.ts             # TypeScript definitions
├── index.ts             # Exports
└── description.ts       # Detailed instructions for agents

Commands

init

Initialize HAX in your project:

hax init

add [components...]

Install one or more components:

hax add artifact form timeline

# Install from specific repository
hax add artifact custom-dashboard --repo=testing
hax add artifact salesCustom-timeline --repo=sales

list

Show installed components:

hax list

repo Remote Repository Management & Admin Features

For enterprise setups, multi-repository management, and administrative features, see the Remote Repository Guide.


## Development

### For Contributors

**Working on the CLI code itself:**

1. **Clone and set up the repository**:
   ```bash
   git clone https://github.com/outshift-open/hax.git
   cd hax/cli
   npm install
   ```

2. **For testing with private component repositories** (optional):
   ```bash
   # Create .env file if needed for private repos
   cp .env.example .env
   # Add GITHUB_TOKEN=your_token for private repository access
   ```

**Testing the CLI in other projects:**

The CLI works out-of-the-box with public repositories. For private component repositories, create a `.env` file in your test project.

### Build CLI

```bash
npm run build
```

### Testing

```bash
# Link globally for testing
npm link

# Test commands
hax --help
hax add form
```

### Testing Multi-Repository Functionality

**Setup test repositories:**
```bash
# Initialize project
hax init

# Add test repositories
hax repo add testing --github outshift-open/hax --branch test-remote-repo
hax repo add sales --github outshift-open/hax --branch sales-remote-hax
```

**Test component resolution:**
```bash
# Test automatic fallback
hax add custom-timeline    # Should find in testing
hax add salesCustom-dashboard  # Should find in sales
hax add form              # Should find in official

# Test specific repository targeting
hax add custom-dashboard --repo=testing
hax add mindmap --repo=official
```

**Test repository switching:**
```bash
# Test priority changes
hax repo switch testing
hax add salesCustom-timeline  # Should show "not found in testing, found in sales"

hax repo switch sales
hax add custom-timeline       # Should show "not found in sales, found in testing"

# View current configuration
hax repo list
```

## Troubleshooting

### Common Issues

**"Component not found in registry"**

- Check component name spelling
- Verify internet connection for GitHub registry access
- Try: `hax list` to see available components

**"npm install failed"**

- Check npm configuration
- Verify package names in registry
- Check for conflicting dependencies

**"Path aliases not working"**

- Ensure tsconfig.json/jsconfig.json exists
- Check baseUrl and paths configuration
- Restart TypeScript language server

### File Type System

Components use typed file system:

- `registry:component` - React components (.tsx)
- `registry:hook` - Action hooks (.ts/.tsx)
- `registry:types` - Type definitions (.ts)
- `registry:index` - Export files (.ts)
- `registry:description` - Metadata (.ts)

## License

MIT License - see the [LICENSE](../LICENSE) file for details.