Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@resourcexjs/cli

Command-line interface for ResourceX - the resource management protocol for AI Agents.

Installation

npm install -g @resourcexjs/cli

Or with other package managers:

# pnpm
pnpm add -g @resourcexjs/cli

# yarn
yarn global add @resourcexjs/cli

# bun
bun add -g @resourcexjs/cli

Quick Start

# Add a resource from local directory
rx add ./my-prompt

# Use a resource
rx use my-prompt.text@1.0.0

# List local resources
rx list

# Push to remote registry
rx config set registry https://registry.example.com
rx push my-prompt.text@1.0.0

Commands

Local Resource Management

rx add <path>

Add a resource from a local directory to local storage.

rx add ./my-prompt

The directory must contain a resource.json manifest file.

rx list [query]

List all local resources. Optionally filter by search query.

# List all resources
rx list

# Filter by name
rx list prompt

rx info <locator>

Show detailed information about a resource.

rx info hello.text@1.0.0

Output includes locator, name, type, version, and file tree.

rx use <locator>

Execute a resource and output the result.

rx use hello.text@1.0.0
  • String results are printed to stdout
  • Binary results are written to stdout
  • JSON/object results are pretty-printed

rx remove <locator>

Remove a resource from local storage.

rx remove hello.text@1.0.0

Development

rx link <path>

Link a resource directory for development. Changes to the source are reflected immediately.

rx link ./dev-prompt

rx unlink <locator>

Remove a development link.

rx unlink dev-prompt.text@1.0.0

Remote Registry

rx push <locator>

Push a local resource to a remote registry.

# Use configured registry
rx push my-prompt.text@1.0.0

# Override registry
rx push my-prompt.text@1.0.0 --registry https://registry.example.com

Options:

  • -r, --registry <url> - Registry URL (overrides config)

rx pull <locator>

Pull a resource from a remote registry to local cache.

# Use configured registry
rx pull hello.text@1.0.0

# Override registry
rx pull hello.text@1.0.0 --registry https://registry.example.com

Options:

  • -r, --registry <url> - Registry URL (overrides config)

rx search <query>

Search resources in a remote registry.

rx search prompt

# Limit results
rx search prompt --limit 10

Options:

  • --limit <n> - Maximum results (default: 20)

Cache Management

rx cache clear

Clear cached remote resources.

# Clear all cached resources
rx cache clear

# Clear resources from specific registry
rx cache clear --registry registry.example.com

Options:

  • -r, --registry <host> - Only clear resources from this registry

Configuration

rx config list

Display current configuration.

rx config list

rx config set <key> <value>

Set a configuration value.

# Set default registry
rx config set registry https://registry.example.com

# Set storage path
rx config set path /custom/path

Valid keys:

  • path - Local storage path (default: ~/.resourcex)
  • registry - Default registry URL

Server

rx server

Start a registry API server for hosting resources.

# Start with defaults (port 3000, storage ./data)
rx server

# Custom port and storage
rx server --port 8080 --storage /var/resourcex

Options:

  • --port <n> - Port to listen on (default: 3000)
  • --storage <path> - Storage path for resources (default: ./data)

Server endpoints:

  • GET /health - Health check
  • POST /publish - Publish resource
  • GET /resource/:loc - Get manifest
  • GET /content/:loc - Get content
  • GET /search - Search resources

Configuration

Config File

Configuration is stored at ~/.resourcex/config.json:

{
  "path": "~/.resourcex",
  "registry": "https://registry.example.com"
}

Environment Variables

Environment variables take precedence over config file:

  • RX_HOME - Override storage path
  • RX_REGISTRY - Override default registry

Directory Structure

~/.resourcex/
├── config.json     # CLI configuration
├── local/          # Local resources (rx add)
├── cache/          # Cached remote resources (rx pull)
└── linked/         # Development symlinks (rx link)

Locator Format

Resources use a Go-style locator format:

# Local resource (no registry)
name.type@version
hello.text@1.0.0

# Remote resource (with registry)
registry/name.type@version
registry.example.com/hello.text@1.0.0

License

Apache-2.0