@resourcexjs/cli
v2.22.0
Published
ResourceX CLI - rx command
Readme
@resourcexjs/cli
Command-line interface for ResourceX - the resource management protocol for AI Agents.
Installation
npm install -g @resourcexjs/cliOr with other package managers:
# pnpm
pnpm add -g @resourcexjs/cli
# yarn
yarn global add @resourcexjs/cli
# bun
bun add -g @resourcexjs/cliQuick Start
# Add a resource from local directory
rx add ./my-prompt
# Use a resource
rx use [email protected]
# List local resources
rx list
# Push to remote registry
rx config set registry https://registry.example.com
rx push [email protected]Commands
Local Resource Management
rx add <path>
Add a resource from a local directory to local storage.
rx add ./my-promptThe 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 promptrx info <locator>
Show detailed information about a resource.
rx info [email protected]Output includes locator, name, type, version, and file tree.
rx use <locator>
Execute a resource and output the result.
rx use [email protected]- 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 [email protected]Development
rx link <path>
Link a resource directory for development. Changes to the source are reflected immediately.
rx link ./dev-promptrx unlink <locator>
Remove a development link.
rx unlink [email protected]Remote Registry
rx push <locator>
Push a local resource to a remote registry.
# Use configured registry
rx push [email protected]
# Override registry
rx push [email protected] --registry https://registry.example.comOptions:
-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 [email protected]
# Override registry
rx pull [email protected] --registry https://registry.example.comOptions:
-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 10Options:
--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.comOptions:
-r, --registry <host>- Only clear resources from this registry
Configuration
rx config list
Display current configuration.
rx config listrx 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/pathValid 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/resourcexOptions:
--port <n>- Port to listen on (default: 3000)--storage <path>- Storage path for resources (default:./data)
Server endpoints:
GET /health- Health checkPOST /publish- Publish resourceGET /resource/:loc- Get manifestGET /content/:loc- Get contentGET /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 pathRX_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
[email protected]
# Remote resource (with registry)
registry/name.type@version
registry.example.com/[email protected]License
Apache-2.0
