@openreef/cli 0.3.3 → 0.4.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.
Files changed (61) hide show
  1. package/README.md +34 -11
  2. package/dist/commands/export.d.ts +6 -0
  3. package/dist/commands/export.d.ts.map +1 -0
  4. package/dist/commands/export.js +70 -0
  5. package/dist/commands/export.js.map +1 -0
  6. package/dist/commands/inspect.js +2 -2
  7. package/dist/commands/inspect.js.map +1 -1
  8. package/dist/commands/install.d.ts +3 -0
  9. package/dist/commands/install.d.ts.map +1 -1
  10. package/dist/commands/install.js +78 -26
  11. package/dist/commands/install.js.map +1 -1
  12. package/dist/commands/lock.d.ts +2 -0
  13. package/dist/commands/lock.d.ts.map +1 -0
  14. package/dist/commands/lock.js +5 -0
  15. package/dist/commands/lock.js.map +1 -0
  16. package/dist/commands/uninstall.d.ts.map +1 -1
  17. package/dist/commands/uninstall.js +3 -2
  18. package/dist/commands/uninstall.js.map +1 -1
  19. package/dist/commands/update.d.ts +3 -0
  20. package/dist/commands/update.d.ts.map +1 -1
  21. package/dist/commands/update.js +160 -18
  22. package/dist/commands/update.js.map +1 -1
  23. package/dist/commands/validate.d.ts +1 -0
  24. package/dist/commands/validate.d.ts.map +1 -1
  25. package/dist/commands/validate.js +183 -14
  26. package/dist/commands/validate.js.map +1 -1
  27. package/dist/core/config-patcher.d.ts +11 -1
  28. package/dist/core/config-patcher.d.ts.map +1 -1
  29. package/dist/core/config-patcher.js +24 -7
  30. package/dist/core/config-patcher.js.map +1 -1
  31. package/dist/core/gateway-client.d.ts.map +1 -1
  32. package/dist/core/gateway-client.js +2 -1
  33. package/dist/core/gateway-client.js.map +1 -1
  34. package/dist/core/registry.d.ts +61 -0
  35. package/dist/core/registry.d.ts.map +1 -0
  36. package/dist/core/registry.js +277 -0
  37. package/dist/core/registry.js.map +1 -0
  38. package/dist/core/state-manager.d.ts +3 -0
  39. package/dist/core/state-manager.d.ts.map +1 -1
  40. package/dist/core/state-manager.js +55 -2
  41. package/dist/core/state-manager.js.map +1 -1
  42. package/dist/core/template-interpolator.d.ts +6 -0
  43. package/dist/core/template-interpolator.d.ts.map +1 -1
  44. package/dist/core/template-interpolator.js +14 -0
  45. package/dist/core/template-interpolator.js.map +1 -1
  46. package/dist/index.js +51 -9
  47. package/dist/index.js.map +1 -1
  48. package/dist/types/manifest.d.ts +0 -1
  49. package/dist/types/manifest.d.ts.map +1 -1
  50. package/dist/types/state.d.ts +4 -0
  51. package/dist/types/state.d.ts.map +1 -1
  52. package/dist/utils/tarball.d.ts +20 -7
  53. package/dist/utils/tarball.d.ts.map +1 -1
  54. package/dist/utils/tarball.js +36 -9
  55. package/dist/utils/tarball.js.map +1 -1
  56. package/dist/version.d.ts +2 -0
  57. package/dist/version.d.ts.map +1 -0
  58. package/dist/version.js +5 -0
  59. package/dist/version.js.map +1 -0
  60. package/package.json +1 -1
  61. package/schema/reef.schema.json +0 -6
@@ -1,12 +1,25 @@
1
+ export interface ResolveOptions {
2
+ registryUrl?: string;
3
+ skipCache?: boolean;
4
+ }
5
+ export interface ResolvedFormation {
6
+ formationPath: string;
7
+ tempDir: string | null;
8
+ registryRef?: {
9
+ name: string;
10
+ version: string;
11
+ };
12
+ }
1
13
  /**
2
- * If the given path looks like a tarball (.tar.gz or .tgz), extract it
3
- * to a temp directory and return the extracted path. Otherwise return
4
- * the original path unchanged.
14
+ * Resolve a formation source to a local directory path.
15
+ *
16
+ * Resolution order (local-first):
17
+ * 1. Tarball (.tar.gz, .tgz) → extract to temp dir
18
+ * 2. Local path exists → use as-is (local always wins)
19
+ * 3. Bare formation name → resolve from registry
20
+ * 4. Otherwise → treat as local path (fails naturally in manifest loader)
5
21
  *
6
22
  * Caller is responsible for cleaning up the temp directory if one was created.
7
23
  */
8
- export declare function resolveFormationPath(inputPath: string): Promise<{
9
- formationPath: string;
10
- tempDir: string | null;
11
- }>;
24
+ export declare function resolveFormationPath(inputPath: string, options?: ResolveOptions): Promise<ResolvedFormation>;
12
25
  //# sourceMappingURL=tarball.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tarball.d.ts","sourceRoot":"","sources":["../../src/utils/tarball.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAQ5D"}
1
+ {"version":3,"file":"tarball.d.ts","sourceRoot":"","sources":["../../src/utils/tarball.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC,CA6B5B"}
@@ -1,23 +1,50 @@
1
1
  import { mkdtemp } from 'node:fs/promises';
2
+ import { existsSync } from 'node:fs';
2
3
  import { join } from 'node:path';
3
4
  import { tmpdir } from 'node:os';
4
5
  import { extract } from 'tar';
6
+ import { isBareFormationName, parseRegistryRef, resolveFromRegistry, } from '../core/registry.js';
5
7
  /**
6
- * If the given path looks like a tarball (.tar.gz or .tgz), extract it
7
- * to a temp directory and return the extracted path. Otherwise return
8
- * the original path unchanged.
8
+ * Resolve a formation source to a local directory path.
9
+ *
10
+ * Resolution order (local-first):
11
+ * 1. Tarball (.tar.gz, .tgz) → extract to temp dir
12
+ * 2. Local path exists → use as-is (local always wins)
13
+ * 3. Bare formation name → resolve from registry
14
+ * 4. Otherwise → treat as local path (fails naturally in manifest loader)
9
15
  *
10
16
  * Caller is responsible for cleaning up the temp directory if one was created.
11
17
  */
12
- export async function resolveFormationPath(inputPath) {
13
- if (!isTarball(inputPath)) {
18
+ export async function resolveFormationPath(inputPath, options) {
19
+ // 1. Tarball?
20
+ if (isTarball(inputPath)) {
21
+ const tempDir = await mkdtemp(join(tmpdir(), 'reef-install-'));
22
+ await extract({ file: inputPath, cwd: tempDir });
23
+ return { formationPath: tempDir, tempDir };
24
+ }
25
+ // 2. Local path exists? (local always wins)
26
+ if (existsSync(inputPath)) {
14
27
  return { formationPath: inputPath, tempDir: null };
15
28
  }
16
- const tempDir = await mkdtemp(join(tmpdir(), 'reef-install-'));
17
- await extract({ file: inputPath, cwd: tempDir });
18
- return { formationPath: tempDir, tempDir };
29
+ // 3. Bare formation name? → resolve from registry
30
+ if (isBareFormationName(inputPath)) {
31
+ const { name, version } = parseRegistryRef(inputPath);
32
+ const result = await resolveFromRegistry(name, version, {
33
+ registryUrl: options?.registryUrl,
34
+ skipCache: options?.skipCache,
35
+ });
36
+ return {
37
+ formationPath: result.formationPath,
38
+ tempDir: result.tempDir,
39
+ registryRef: { name: result.name, version: result.version },
40
+ };
41
+ }
42
+ // 4. Fallthrough → treat as local path
43
+ return { formationPath: inputPath, tempDir: null };
19
44
  }
20
45
  function isTarball(path) {
21
- return path.endsWith('.tar.gz') || path.endsWith('.tgz') || path.endsWith('.reef.tar.gz');
46
+ return (path.endsWith('.tar.gz') ||
47
+ path.endsWith('.tgz') ||
48
+ path.endsWith('.reef.tar.gz'));
22
49
  }
23
50
  //# sourceMappingURL=tarball.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tarball.js","sourceRoot":"","sources":["../../src/utils/tarball.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;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,CAAC,cAAc,CAAC,CAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION: string;
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,EAAE,MAAoB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { createRequire } from 'node:module';
2
+ const require = createRequire(import.meta.url);
3
+ const pkg = require('../package.json');
4
+ export const VERSION = pkg.version;
5
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,OAAO,GAAW,GAAG,CAAC,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openreef/cli",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "CLI toolchain for OpenReef formations — package and deploy multi-agent teams",
5
5
  "type": "module",
6
6
  "bin": {
@@ -176,12 +176,6 @@
176
176
  "agent": {
177
177
  "type": "string",
178
178
  "description": "Agent slug to bind."
179
- },
180
- "direction": {
181
- "type": "string",
182
- "description": "Binding direction.",
183
- "enum": ["inbound", "outbound", "bidirectional"],
184
- "default": "bidirectional"
185
179
  }
186
180
  }
187
181
  }