@resourcexjs/cli 0.4.0 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +238 -48
- package/dist/index.js +3278 -68
- package/dist/index.js.map +27 -4
- package/package.json +14 -22
- package/dist/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,92 +1,282 @@
|
|
|
1
1
|
# @resourcexjs/cli
|
|
2
2
|
|
|
3
|
-
Command-line interface for ResourceX -
|
|
3
|
+
Command-line interface for ResourceX - the resource management protocol for AI Agents.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install -g @resourcexjs/cli
|
|
9
|
-
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with other package managers:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# pnpm
|
|
15
|
+
pnpm add -g @resourcexjs/cli
|
|
16
|
+
|
|
17
|
+
# yarn
|
|
18
|
+
yarn global add @resourcexjs/cli
|
|
19
|
+
|
|
20
|
+
# bun
|
|
10
21
|
bun add -g @resourcexjs/cli
|
|
11
22
|
```
|
|
12
23
|
|
|
13
|
-
##
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Add a resource from local directory
|
|
28
|
+
rx add ./my-prompt
|
|
29
|
+
|
|
30
|
+
# Use a resource
|
|
31
|
+
rx use my-prompt.text@1.0.0
|
|
32
|
+
|
|
33
|
+
# List local resources
|
|
34
|
+
rx list
|
|
35
|
+
|
|
36
|
+
# Push to remote registry
|
|
37
|
+
rx config set registry https://registry.example.com
|
|
38
|
+
rx push my-prompt.text@1.0.0
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
### Local Resource Management
|
|
44
|
+
|
|
45
|
+
#### `rx add <path>`
|
|
46
|
+
|
|
47
|
+
Add a resource from a local directory to local storage.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
rx add ./my-prompt
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
The directory must contain a `resource.json` manifest file.
|
|
54
|
+
|
|
55
|
+
#### `rx list [query]`
|
|
56
|
+
|
|
57
|
+
List all local resources. Optionally filter by search query.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# List all resources
|
|
61
|
+
rx list
|
|
62
|
+
|
|
63
|
+
# Filter by name
|
|
64
|
+
rx list prompt
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
#### `rx info <locator>`
|
|
68
|
+
|
|
69
|
+
Show detailed information about a resource.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
rx info hello.text@1.0.0
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Output includes locator, name, type, version, and file tree.
|
|
76
|
+
|
|
77
|
+
#### `rx use <locator>`
|
|
78
|
+
|
|
79
|
+
Execute a resource and output the result.
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
rx use hello.text@1.0.0
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
- String results are printed to stdout
|
|
86
|
+
- Binary results are written to stdout
|
|
87
|
+
- JSON/object results are pretty-printed
|
|
88
|
+
|
|
89
|
+
#### `rx remove <locator>`
|
|
90
|
+
|
|
91
|
+
Remove a resource from local storage.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
rx remove hello.text@1.0.0
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Development
|
|
98
|
+
|
|
99
|
+
#### `rx link <path>`
|
|
100
|
+
|
|
101
|
+
Link a resource directory for development. Changes to the source are reflected immediately.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
rx link ./dev-prompt
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
#### `rx unlink <locator>`
|
|
108
|
+
|
|
109
|
+
Remove a development link.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
rx unlink dev-prompt.text@1.0.0
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Remote Registry
|
|
116
|
+
|
|
117
|
+
#### `rx push <locator>`
|
|
118
|
+
|
|
119
|
+
Push a local resource to a remote registry.
|
|
14
120
|
|
|
15
121
|
```bash
|
|
16
|
-
#
|
|
17
|
-
|
|
122
|
+
# Use configured registry
|
|
123
|
+
rx push my-prompt.text@1.0.0
|
|
18
124
|
|
|
19
|
-
#
|
|
20
|
-
|
|
125
|
+
# Override registry
|
|
126
|
+
rx push my-prompt.text@1.0.0 --registry https://registry.example.com
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Options:
|
|
130
|
+
|
|
131
|
+
- `-r, --registry <url>` - Registry URL (overrides config)
|
|
132
|
+
|
|
133
|
+
#### `rx pull <locator>`
|
|
134
|
+
|
|
135
|
+
Pull a resource from a remote registry to local cache.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# Use configured registry
|
|
139
|
+
rx pull hello.text@1.0.0
|
|
21
140
|
|
|
22
|
-
#
|
|
23
|
-
|
|
141
|
+
# Override registry
|
|
142
|
+
rx pull hello.text@1.0.0 --registry https://registry.example.com
|
|
24
143
|
```
|
|
25
144
|
|
|
26
|
-
|
|
145
|
+
Options:
|
|
27
146
|
|
|
28
|
-
|
|
29
|
-
| --------------- | -------------- |
|
|
30
|
-
| `-h, --help` | Show help |
|
|
31
|
-
| `-v, --version` | Show version |
|
|
32
|
-
| `-j, --json` | Output as JSON |
|
|
147
|
+
- `-r, --registry <url>` - Registry URL (overrides config)
|
|
33
148
|
|
|
34
|
-
|
|
149
|
+
#### `rx search <query>`
|
|
35
150
|
|
|
36
|
-
|
|
151
|
+
Search resources in a remote registry.
|
|
37
152
|
|
|
38
153
|
```bash
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
154
|
+
rx search prompt
|
|
155
|
+
|
|
156
|
+
# Limit results
|
|
157
|
+
rx search prompt --limit 10
|
|
43
158
|
```
|
|
44
159
|
|
|
45
|
-
|
|
160
|
+
Options:
|
|
161
|
+
|
|
162
|
+
- `--limit <n>` - Maximum results (default: 20)
|
|
163
|
+
|
|
164
|
+
### Cache Management
|
|
165
|
+
|
|
166
|
+
#### `rx cache clear`
|
|
167
|
+
|
|
168
|
+
Clear cached remote resources.
|
|
46
169
|
|
|
47
170
|
```bash
|
|
48
|
-
|
|
49
|
-
|
|
171
|
+
# Clear all cached resources
|
|
172
|
+
rx cache clear
|
|
173
|
+
|
|
174
|
+
# Clear resources from specific registry
|
|
175
|
+
rx cache clear --registry registry.example.com
|
|
50
176
|
```
|
|
51
177
|
|
|
52
|
-
|
|
178
|
+
Options:
|
|
179
|
+
|
|
180
|
+
- `-r, --registry <host>` - Only clear resources from this registry
|
|
181
|
+
|
|
182
|
+
### Configuration
|
|
183
|
+
|
|
184
|
+
#### `rx config list`
|
|
185
|
+
|
|
186
|
+
Display current configuration.
|
|
53
187
|
|
|
54
188
|
```bash
|
|
55
|
-
|
|
56
|
-
semantic: text
|
|
57
|
-
transport: https
|
|
58
|
-
location: example.com/file.txt
|
|
189
|
+
rx config list
|
|
59
190
|
```
|
|
60
191
|
|
|
61
|
-
|
|
192
|
+
#### `rx config set <key> <value>`
|
|
193
|
+
|
|
194
|
+
Set a configuration value.
|
|
62
195
|
|
|
63
196
|
```bash
|
|
64
|
-
|
|
197
|
+
# Set default registry
|
|
198
|
+
rx config set registry https://registry.example.com
|
|
199
|
+
|
|
200
|
+
# Set storage path
|
|
201
|
+
rx config set path /custom/path
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Valid keys:
|
|
205
|
+
|
|
206
|
+
- `path` - Local storage path (default: `~/.resourcex`)
|
|
207
|
+
- `registry` - Default registry URL
|
|
208
|
+
|
|
209
|
+
### Server
|
|
210
|
+
|
|
211
|
+
#### `rx server`
|
|
212
|
+
|
|
213
|
+
Start a registry API server for hosting resources.
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Start with defaults (port 3000, storage ./data)
|
|
217
|
+
rx server
|
|
218
|
+
|
|
219
|
+
# Custom port and storage
|
|
220
|
+
rx server --port 8080 --storage /var/resourcex
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Options:
|
|
224
|
+
|
|
225
|
+
- `--port <n>` - Port to listen on (default: 3000)
|
|
226
|
+
- `--storage <path>` - Storage path for resources (default: `./data`)
|
|
227
|
+
|
|
228
|
+
Server endpoints:
|
|
229
|
+
|
|
230
|
+
- `GET /health` - Health check
|
|
231
|
+
- `POST /publish` - Publish resource
|
|
232
|
+
- `GET /resource/:loc` - Get manifest
|
|
233
|
+
- `GET /content/:loc` - Get content
|
|
234
|
+
- `GET /search` - Search resources
|
|
235
|
+
|
|
236
|
+
## Configuration
|
|
237
|
+
|
|
238
|
+
### Config File
|
|
239
|
+
|
|
240
|
+
Configuration is stored at `~/.resourcex/config.json`:
|
|
241
|
+
|
|
242
|
+
```json
|
|
65
243
|
{
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"meta": {
|
|
69
|
-
"url": "arp:text:file:///tmp/test.txt",
|
|
70
|
-
"semantic": "text",
|
|
71
|
-
"transport": "file",
|
|
72
|
-
"location": "/tmp/test.txt",
|
|
73
|
-
"size": 13,
|
|
74
|
-
"encoding": "utf-8",
|
|
75
|
-
"fetchedAt": "2025-01-15T03:22:07.917Z"
|
|
76
|
-
}
|
|
244
|
+
"path": "~/.resourcex",
|
|
245
|
+
"registry": "https://registry.example.com"
|
|
77
246
|
}
|
|
78
247
|
```
|
|
79
248
|
|
|
80
|
-
|
|
249
|
+
### Environment Variables
|
|
250
|
+
|
|
251
|
+
Environment variables take precedence over config file:
|
|
252
|
+
|
|
253
|
+
- `RX_HOME` - Override storage path
|
|
254
|
+
- `RX_REGISTRY` - Override default registry
|
|
81
255
|
|
|
256
|
+
## Directory Structure
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
~/.resourcex/
|
|
260
|
+
├── config.json # CLI configuration
|
|
261
|
+
├── local/ # Local resources (rx add)
|
|
262
|
+
├── cache/ # Cached remote resources (rx pull)
|
|
263
|
+
└── linked/ # Development symlinks (rx link)
|
|
82
264
|
```
|
|
83
|
-
|
|
265
|
+
|
|
266
|
+
## Locator Format
|
|
267
|
+
|
|
268
|
+
Resources use a Go-style locator format:
|
|
269
|
+
|
|
84
270
|
```
|
|
271
|
+
# Local resource (no registry)
|
|
272
|
+
name.type@version
|
|
273
|
+
hello.text@1.0.0
|
|
85
274
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
275
|
+
# Remote resource (with registry)
|
|
276
|
+
registry/name.type@version
|
|
277
|
+
registry.example.com/hello.text@1.0.0
|
|
278
|
+
```
|
|
89
279
|
|
|
90
280
|
## License
|
|
91
281
|
|
|
92
|
-
|
|
282
|
+
Apache-2.0
|