@resourcexjs/registry 2.1.1 → 2.2.0

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 CHANGED
@@ -66,7 +66,7 @@ const rxr = await loadResource("./my-prompt");
66
66
 
67
67
  // Link to registry
68
68
  const registry = createRegistry();
69
- await registry.link(rxr);
69
+ await registry.add(rxr);
70
70
 
71
71
  // Now available at: ~/.resourcex/localhost/my-prompt.text@1.0.0/
72
72
  ```
@@ -135,7 +135,7 @@ Link a resource to local registry.
135
135
  - `resource: RXR` - Complete resource object
136
136
 
137
137
  ```typescript
138
- await registry.link(rxr);
138
+ await registry.add(rxr);
139
139
  ```
140
140
 
141
141
  #### `resolve(locator: string): Promise<RXR>`
@@ -358,7 +358,7 @@ const rxr = await loadResource("./my-prompts/assistant");
358
358
  const registry = createRegistry();
359
359
 
360
360
  // 3. Link to local registry
361
- await registry.link(rxr);
361
+ await registry.add(rxr);
362
362
 
363
363
  // 4. Resolve later
364
364
  const resolved = await registry.resolve("localhost/assistant.prompt@1.0.0");
@@ -374,9 +374,9 @@ console.log(text);
374
374
  const registry = createRegistry();
375
375
 
376
376
  // Link multiple versions
377
- await registry.link(promptV1); // v1.0.0
378
- await registry.link(promptV2); // v2.0.0
379
- await registry.link(promptV3); // v3.0.0
377
+ await registry.add(promptV1); // v1.0.0
378
+ await registry.add(promptV2); // v2.0.0
379
+ await registry.add(promptV3); // v3.0.0
380
380
 
381
381
  // Resolve specific version
382
382
  const v1 = await registry.resolve("localhost/prompt.text@1.0.0");
@@ -392,7 +392,7 @@ const registry = createRegistry({
392
392
  path: "./project-registry",
393
393
  });
394
394
 
395
- await registry.link(rxr);
395
+ await registry.add(rxr);
396
396
  // Stored at: ./project-registry/localhost/...
397
397
  ```
398
398
 
@@ -406,9 +406,9 @@ const registry = createRegistry({
406
406
  });
407
407
 
408
408
  // Now can handle these custom types
409
- await registry.link(promptResource);
410
- await registry.link(toolResource);
411
- await registry.link(agentResource);
409
+ await registry.add(promptResource);
410
+ await registry.add(toolResource);
411
+ await registry.add(agentResource);
412
412
  ```
413
413
 
414
414
  ## Resolution Strategy
package/dist/index.d.ts CHANGED
@@ -136,6 +136,18 @@ interface Registry {
136
136
  */
137
137
  supportType(type: ResourceType): void;
138
138
  /**
139
+ * Link a development directory to local registry.
140
+ * Creates a symlink so changes are reflected immediately.
141
+ * @param path - Path to resource directory (must contain resource.json)
142
+ */
143
+ link(path: string): Promise<void>;
144
+ /**
145
+ * Add resource to local registry.
146
+ * Copies resource content to local storage.
147
+ * @param source - Resource directory path or RXR object
148
+ */
149
+ add(source: string | RXR): Promise<void>;
150
+ /**
139
151
  * Pull resource from remote registry to local cache.
140
152
  * Discovers remote registry via well-known and caches locally.
141
153
  * @param locator - Resource locator (must include domain)
@@ -144,15 +156,10 @@ interface Registry {
144
156
  pull(locator: string, options?: PullOptions): Promise<void>;
145
157
  /**
146
158
  * Publish resource to remote registry.
147
- * Resource must exist in local first.
148
- * @param resource - Resource to publish
149
- * @param options - Publish target configuration
159
+ * @param source - Resource directory path or RXR object
160
+ * @param options - Publish target configuration (required)
150
161
  */
151
- publish(resource: RXR, options: PublishOptions): Promise<void>;
152
- /**
153
- * Link resource to local registry (for development/caching).
154
- */
155
- link(resource: RXR): Promise<void>;
162
+ publish(source: string | RXR, options: PublishOptions): Promise<void>;
156
163
  /**
157
164
  * Get raw resource by locator string.
158
165
  * Returns the RXR (locator + manifest + content) without resolving.
@@ -231,12 +238,18 @@ declare class LocalRegistry implements Registry {
231
238
  */
232
239
  private findArea;
233
240
  /**
241
+ * Check if a path is a symlink.
242
+ */
243
+ private isSymlink;
244
+ /**
234
245
  * Load resource from a specific path.
246
+ * If path is a symlink, loads from the linked directory using FolderLoader.
235
247
  */
236
248
  private loadFrom;
249
+ link(path: string): Promise<void>;
250
+ add(source: string | RXR2): Promise<void>;
237
251
  pull(_locator: string, _options?: PullOptions): Promise<void>;
238
- publish(_resource: RXR2, _options: PublishOptions): Promise<void>;
239
- link(resource: RXR2): Promise<void>;
252
+ publish(_source: string | RXR2, _options: PublishOptions): Promise<void>;
240
253
  get(locator: string): Promise<RXR2>;
241
254
  resolve<
242
255
  TArgs = void,
@@ -271,9 +284,10 @@ declare class RemoteRegistry implements Registry {
271
284
  private readonly typeHandler;
272
285
  constructor(config: RemoteRegistryConfig);
273
286
  supportType(type: ResourceType3): void;
287
+ link(_path: string): Promise<void>;
288
+ add(_source: string | RXR3): Promise<void>;
274
289
  pull(_locator: string, _options?: PullOptions): Promise<void>;
275
- publish(_resource: RXR3, _options: PublishOptions): Promise<void>;
276
- link(_resource: RXR3): Promise<void>;
290
+ publish(_source: string | RXR3, _options: PublishOptions): Promise<void>;
277
291
  get(locator: string): Promise<RXR3>;
278
292
  resolve<
279
293
  TArgs = void,
@@ -333,9 +347,10 @@ declare class GitRegistry implements Registry {
333
347
  exists(locator: string): Promise<boolean>;
334
348
  search(options?: SearchOptions): Promise<RXL4[]>;
335
349
  private parseEntryToRXL;
350
+ link(_path: string): Promise<void>;
351
+ add(_source: string | RXR4): Promise<void>;
336
352
  pull(_locator: string, _options?: PullOptions): Promise<void>;
337
- publish(_resource: RXR4, _options: PublishOptions): Promise<void>;
338
- link(_resource: RXR4): Promise<void>;
353
+ publish(_source: string | RXR4, _options: PublishOptions): Promise<void>;
339
354
  delete(_locator: string): Promise<void>;
340
355
  }
341
356
  /**
@@ -376,9 +391,10 @@ declare abstract class RegistryMiddleware implements Registry {
376
391
  protected readonly inner: Registry;
377
392
  constructor(inner: Registry);
378
393
  supportType(type: ResourceType5): void;
394
+ link(path: string): Promise<void>;
395
+ add(source: string | RXR5): Promise<void>;
379
396
  pull(locator: string, options?: PullOptions): Promise<void>;
380
- publish(resource: RXR5, options: PublishOptions): Promise<void>;
381
- link(resource: RXR5): Promise<void>;
397
+ publish(source: string | RXR5, options: PublishOptions): Promise<void>;
382
398
  get(locator: string): Promise<RXR5>;
383
399
  resolve<
384
400
  TArgs = void,