@elaraai/e3-cli 0.0.2-beta.9 → 1.0.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.
Files changed (135) hide show
  1. package/LICENSE.md +4 -0
  2. package/README.md +169 -46
  3. package/dist/src/cli.js +197 -73
  4. package/dist/src/cli.js.map +1 -1
  5. package/dist/src/commands/auth.d.ts +23 -0
  6. package/dist/src/commands/auth.d.ts.map +1 -0
  7. package/dist/src/commands/auth.js +200 -0
  8. package/dist/src/commands/auth.js.map +1 -0
  9. package/dist/src/commands/complete.d.ts +14 -0
  10. package/dist/src/commands/complete.d.ts.map +1 -0
  11. package/dist/src/commands/complete.js +166 -0
  12. package/dist/src/commands/complete.js.map +1 -0
  13. package/dist/src/commands/complete.spec.d.ts +6 -0
  14. package/dist/src/commands/complete.spec.d.ts.map +1 -0
  15. package/dist/src/commands/complete.spec.js +63 -0
  16. package/dist/src/commands/complete.spec.js.map +1 -0
  17. package/dist/src/commands/completion-install.d.ts +47 -0
  18. package/dist/src/commands/completion-install.d.ts.map +1 -0
  19. package/dist/src/commands/completion-install.js +141 -0
  20. package/dist/src/commands/completion-install.js.map +1 -0
  21. package/dist/src/commands/completion-install.spec.d.ts +6 -0
  22. package/dist/src/commands/completion-install.spec.d.ts.map +1 -0
  23. package/dist/src/commands/completion-install.spec.js +136 -0
  24. package/dist/src/commands/completion-install.spec.js.map +1 -0
  25. package/dist/src/commands/completion.d.ts +12 -0
  26. package/dist/src/commands/completion.d.ts.map +1 -0
  27. package/dist/src/commands/completion.js +75 -0
  28. package/dist/src/commands/completion.js.map +1 -0
  29. package/dist/src/commands/completion.spec.d.ts +6 -0
  30. package/dist/src/commands/completion.spec.d.ts.map +1 -0
  31. package/dist/src/commands/completion.spec.js +48 -0
  32. package/dist/src/commands/completion.spec.js.map +1 -0
  33. package/dist/src/commands/convert.impl.spec.d.ts +6 -0
  34. package/dist/src/commands/convert.impl.spec.d.ts.map +1 -0
  35. package/dist/src/commands/convert.impl.spec.js +245 -0
  36. package/dist/src/commands/convert.impl.spec.js.map +1 -0
  37. package/dist/src/commands/dataset-status.d.ts +9 -0
  38. package/dist/src/commands/dataset-status.d.ts.map +1 -0
  39. package/dist/src/commands/dataset-status.js +77 -0
  40. package/dist/src/commands/dataset-status.js.map +1 -0
  41. package/dist/src/commands/find.d.ts +17 -0
  42. package/dist/src/commands/find.d.ts.map +1 -0
  43. package/dist/src/commands/find.js +59 -0
  44. package/dist/src/commands/find.js.map +1 -0
  45. package/dist/src/commands/find.spec.d.ts +6 -0
  46. package/dist/src/commands/find.spec.d.ts.map +1 -0
  47. package/dist/src/commands/find.spec.js +43 -0
  48. package/dist/src/commands/find.spec.js.map +1 -0
  49. package/dist/src/commands/get.d.ts +3 -0
  50. package/dist/src/commands/get.d.ts.map +1 -1
  51. package/dist/src/commands/get.js +43 -20
  52. package/dist/src/commands/get.js.map +1 -1
  53. package/dist/src/commands/get.spec.d.ts +6 -0
  54. package/dist/src/commands/get.spec.d.ts.map +1 -0
  55. package/dist/src/commands/get.spec.js +28 -0
  56. package/dist/src/commands/get.spec.js.map +1 -0
  57. package/dist/src/commands/list.d.ts +6 -2
  58. package/dist/src/commands/list.d.ts.map +1 -1
  59. package/dist/src/commands/list.js +189 -30
  60. package/dist/src/commands/list.js.map +1 -1
  61. package/dist/src/commands/logs.d.ts.map +1 -1
  62. package/dist/src/commands/logs.js +96 -70
  63. package/dist/src/commands/logs.js.map +1 -1
  64. package/dist/src/commands/package.d.ts.map +1 -1
  65. package/dist/src/commands/package.js +78 -18
  66. package/dist/src/commands/package.js.map +1 -1
  67. package/dist/src/commands/repo.d.ts +44 -0
  68. package/dist/src/commands/repo.d.ts.map +1 -0
  69. package/dist/src/commands/repo.js +278 -0
  70. package/dist/src/commands/repo.js.map +1 -0
  71. package/dist/src/commands/run.d.ts +12 -0
  72. package/dist/src/commands/run.d.ts.map +1 -1
  73. package/dist/src/commands/run.js +21 -13
  74. package/dist/src/commands/run.js.map +1 -1
  75. package/dist/src/commands/run.spec.d.ts +6 -0
  76. package/dist/src/commands/run.spec.d.ts.map +1 -0
  77. package/dist/src/commands/run.spec.js +39 -0
  78. package/dist/src/commands/run.spec.js.map +1 -0
  79. package/dist/src/commands/set.d.ts +1 -0
  80. package/dist/src/commands/set.d.ts.map +1 -1
  81. package/dist/src/commands/set.js +33 -32
  82. package/dist/src/commands/set.js.map +1 -1
  83. package/dist/src/commands/start.d.ts.map +1 -1
  84. package/dist/src/commands/start.js +270 -52
  85. package/dist/src/commands/start.js.map +1 -1
  86. package/dist/src/commands/watch.d.ts +5 -2
  87. package/dist/src/commands/watch.d.ts.map +1 -1
  88. package/dist/src/commands/watch.js +32 -26
  89. package/dist/src/commands/watch.js.map +1 -1
  90. package/dist/src/commands/workspace.d.ts +12 -1
  91. package/dist/src/commands/workspace.d.ts.map +1 -1
  92. package/dist/src/commands/workspace.js +332 -38
  93. package/dist/src/commands/workspace.js.map +1 -1
  94. package/dist/src/credentials.d.ts +123 -0
  95. package/dist/src/credentials.d.ts.map +1 -0
  96. package/dist/src/credentials.js +213 -0
  97. package/dist/src/credentials.js.map +1 -0
  98. package/dist/src/format.d.ts +18 -0
  99. package/dist/src/format.d.ts.map +1 -0
  100. package/dist/src/format.js +43 -0
  101. package/dist/src/format.js.map +1 -0
  102. package/dist/src/path-resolver.d.ts +86 -0
  103. package/dist/src/path-resolver.d.ts.map +1 -0
  104. package/dist/src/path-resolver.js +241 -0
  105. package/dist/src/path-resolver.js.map +1 -0
  106. package/dist/src/path-resolver.spec.d.ts +6 -0
  107. package/dist/src/path-resolver.spec.d.ts.map +1 -0
  108. package/dist/src/path-resolver.spec.js +247 -0
  109. package/dist/src/path-resolver.spec.js.map +1 -0
  110. package/dist/src/utils.d.ts +76 -1
  111. package/dist/src/utils.d.ts.map +1 -1
  112. package/dist/src/utils.js +104 -1
  113. package/dist/src/utils.js.map +1 -1
  114. package/dist/src/utils.spec.d.ts +6 -0
  115. package/dist/src/utils.spec.d.ts.map +1 -0
  116. package/dist/src/utils.spec.js +199 -0
  117. package/dist/src/utils.spec.js.map +1 -0
  118. package/package.json +22 -18
  119. package/scripts/postinstall.cjs +26 -0
  120. package/dist/src/commands/gc.d.ts +0 -12
  121. package/dist/src/commands/gc.d.ts.map +0 -1
  122. package/dist/src/commands/gc.js +0 -44
  123. package/dist/src/commands/gc.js.map +0 -1
  124. package/dist/src/commands/init.d.ts +0 -9
  125. package/dist/src/commands/init.d.ts.map +0 -1
  126. package/dist/src/commands/init.js +0 -33
  127. package/dist/src/commands/init.js.map +0 -1
  128. package/dist/src/commands/status.d.ts +0 -9
  129. package/dist/src/commands/status.d.ts.map +0 -1
  130. package/dist/src/commands/status.js +0 -157
  131. package/dist/src/commands/status.js.map +0 -1
  132. package/dist/src/commands/tree.d.ts +0 -14
  133. package/dist/src/commands/tree.d.ts.map +0 -1
  134. package/dist/src/commands/tree.js +0 -77
  135. package/dist/src/commands/tree.js.map +0 -1
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export declare function completionCommand(shell: string): void;
6
+ /** Exposed for tests. */
7
+ export declare const COMPLETION_SCRIPTS: {
8
+ bash: string;
9
+ zsh: string;
10
+ fish: string;
11
+ };
12
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4DH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAcrD;AAED,yBAAyB;AACzB,eAAO,MAAM,kBAAkB;;;;CAAuC,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * `e3 completion {bash,zsh,fish}` — print an installable shell completion script.
7
+ *
8
+ * Each script delegates dynamic completion to `e3 __complete <cword> <words...>`.
9
+ * The handler emits one candidate per line; the shell renders them.
10
+ */
11
+ import { exitError } from '../utils.js';
12
+ // Single-quoted strings so JS doesn't interpolate the shell-script ${...}.
13
+ const BASH = [
14
+ '# e3 bash completion',
15
+ '# Install: eval "$(e3 completion bash)" (in your ~/.bashrc)',
16
+ '',
17
+ '_e3_complete() {',
18
+ ' local cur cwords cword candidates',
19
+ ' cur="${COMP_WORDS[COMP_CWORD]}"',
20
+ ' cwords=("${COMP_WORDS[@]:1}")',
21
+ ' cword=$((COMP_CWORD - 1))',
22
+ ' candidates=$(e3 __complete "$cword" "${cwords[@]}" 2>/dev/null)',
23
+ ' COMPREPLY=($(compgen -W "$candidates" -- "$cur"))',
24
+ '}',
25
+ 'complete -F _e3_complete e3',
26
+ '',
27
+ ].join('\n');
28
+ const ZSH = [
29
+ '# e3 zsh completion',
30
+ '# Install: eval "$(e3 completion zsh)" (in your ~/.zshrc)',
31
+ '',
32
+ '_e3_complete() {',
33
+ ' local -a candidates',
34
+ ' local cwords cword',
35
+ ' cwords=("${words[@]:1}")',
36
+ ' cword=$((CURRENT - 2))',
37
+ ' candidates=("${(@f)$(e3 __complete "$cword" "${cwords[@]}" 2>/dev/null)}")',
38
+ ' compadd -- "${candidates[@]}"',
39
+ '}',
40
+ 'compdef _e3_complete e3',
41
+ '',
42
+ ].join('\n');
43
+ const FISH = [
44
+ '# e3 fish completion',
45
+ '# Install: e3 completion fish > ~/.config/fish/completions/e3.fish',
46
+ '',
47
+ 'function __e3_complete',
48
+ ' set -l cmdline (commandline -opc)',
49
+ ' set -l current (commandline -ct)',
50
+ ' set -l cwords $cmdline[2..-1] $current',
51
+ ' set -l cword (math (count $cwords) - 1)',
52
+ ' e3 __complete $cword $cwords 2>/dev/null',
53
+ 'end',
54
+ '',
55
+ 'complete -c e3 -f -a "(__e3_complete)"',
56
+ '',
57
+ ].join('\n');
58
+ export function completionCommand(shell) {
59
+ switch (shell) {
60
+ case 'bash':
61
+ process.stdout.write(BASH);
62
+ return;
63
+ case 'zsh':
64
+ process.stdout.write(ZSH);
65
+ return;
66
+ case 'fish':
67
+ process.stdout.write(FISH);
68
+ return;
69
+ default:
70
+ exitError(`Unknown shell: '${shell}'. Use one of: bash, zsh, fish`);
71
+ }
72
+ }
73
+ /** Exposed for tests. */
74
+ export const COMPLETION_SCRIPTS = { bash: BASH, zsh: ZSH, fish: FISH };
75
+ //# sourceMappingURL=completion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/commands/completion.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,2EAA2E;AAC3E,MAAM,IAAI,GAAG;IACX,sBAAsB;IACtB,8DAA8D;IAC9D,EAAE;IACF,kBAAkB;IAClB,qCAAqC;IACrC,mCAAmC;IACnC,iCAAiC;IACjC,6BAA6B;IAC7B,mEAAmE;IACnE,qDAAqD;IACrD,GAAG;IACH,6BAA6B;IAC7B,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,GAAG,GAAG;IACV,qBAAqB;IACrB,4DAA4D;IAC5D,EAAE;IACF,kBAAkB;IAClB,uBAAuB;IACvB,sBAAsB;IACtB,4BAA4B;IAC5B,0BAA0B;IAC1B,8EAA8E;IAC9E,iCAAiC;IACjC,GAAG;IACH,yBAAyB;IACzB,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,IAAI,GAAG;IACX,sBAAsB;IACtB,oEAAoE;IACpE,EAAE;IACF,wBAAwB;IACxB,qCAAqC;IACrC,oCAAoC;IACpC,0CAA0C;IAC1C,2CAA2C;IAC3C,4CAA4C;IAC5C,KAAK;IACL,EAAE;IACF,wCAAwC;IACxC,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT,KAAK,KAAK;YACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1B,OAAO;QACT,KAAK,MAAM;YACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3B,OAAO;QACT;YACE,SAAS,CAAC,mBAAmB,KAAK,gCAAgC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC;AAED,yBAAyB;AACzB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=completion.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.spec.d.ts","sourceRoot":"","sources":["../../../src/commands/completion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ import { describe, it } from 'node:test';
6
+ import assert from 'node:assert/strict';
7
+ import { spawnSync } from 'node:child_process';
8
+ import { COMPLETION_SCRIPTS } from './completion.js';
9
+ /**
10
+ * Sanity checks for the generated shell scripts.
11
+ *
12
+ * We don't run the completion (would need real workspaces and shell sessions);
13
+ * we just verify the script is syntactically valid in its target shell.
14
+ * Tests skip cleanly when a shell isn't installed.
15
+ */
16
+ function checkSyntax(shell, script) {
17
+ const result = spawnSync(shell, ['-n'], { input: script, encoding: 'utf-8' });
18
+ if (result.error && 'code' in result.error && result.error.code === 'ENOENT') {
19
+ return { ok: true, stderr: '', skipped: true };
20
+ }
21
+ return { ok: result.status === 0, stderr: result.stderr };
22
+ }
23
+ describe('completion scripts — shell syntax', () => {
24
+ it('bash script parses cleanly', () => {
25
+ const r = checkSyntax('bash', COMPLETION_SCRIPTS.bash);
26
+ if (r.skipped)
27
+ return;
28
+ assert.strictEqual(r.ok, true, `bash -n failed: ${r.stderr}`);
29
+ });
30
+ it('zsh script parses cleanly', () => {
31
+ const r = checkSyntax('zsh', COMPLETION_SCRIPTS.zsh);
32
+ if (r.skipped)
33
+ return;
34
+ assert.strictEqual(r.ok, true, `zsh -n failed: ${r.stderr}`);
35
+ });
36
+ it('fish script parses cleanly', () => {
37
+ const r = checkSyntax('fish', COMPLETION_SCRIPTS.fish);
38
+ if (r.skipped)
39
+ return;
40
+ assert.strictEqual(r.ok, true, `fish -n failed: ${r.stderr}`);
41
+ });
42
+ it('every script references the __complete delegate', () => {
43
+ for (const [name, script] of Object.entries(COMPLETION_SCRIPTS)) {
44
+ assert.match(script, /e3 __complete/, `${name} script must delegate to e3 __complete`);
45
+ }
46
+ });
47
+ });
48
+ //# sourceMappingURL=completion.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.spec.js","sourceRoot":"","sources":["../../../src/commands/completion.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;;GAMG;AAEH,SAAS,WAAW,CAAC,KAAa,EAAE,MAAc;IAChD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE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WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,mBAAmB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;YAChE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,wCAAwC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=convert.impl.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.impl.spec.d.ts","sourceRoot":"","sources":["../../../src/commands/convert.impl.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Tests for convert command
7
+ *
8
+ * Testing strategy:
9
+ * - Test the core conversion logic directly (convertCore function)
10
+ * - Use temporary files for input/output
11
+ * - Test various format combinations (.east, .json, .beast2)
12
+ * - Test stdin input scenarios
13
+ * - Avoid implementation details of beast2 encoding/decoding
14
+ */
15
+ import { describe, it, beforeEach, afterEach } from 'node:test';
16
+ import assert from 'node:assert/strict';
17
+ import { readFileSync, mkdirSync } from 'node:fs';
18
+ import { convertCore } from './convert.impl.js';
19
+ import { createTestDir, removeTestDir, writeTestFile } from '../cli-test-helpers.js';
20
+ describe('convert command', () => {
21
+ let testDir;
22
+ beforeEach(() => {
23
+ testDir = createTestDir();
24
+ mkdirSync(testDir, { recursive: true });
25
+ });
26
+ afterEach(() => {
27
+ removeTestDir(testDir);
28
+ });
29
+ describe('.east to .east (identity)', () => {
30
+ it('converts integer value', async () => {
31
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
32
+ const outputPath = `${testDir}/output.east`;
33
+ const result = await convertCore(inputPath, 'east', outputPath);
34
+ assert.strictEqual(result.success, true);
35
+ const output = readFileSync(outputPath, 'utf-8');
36
+ assert.strictEqual(output.trim(), '42');
37
+ });
38
+ it('converts string value', async () => {
39
+ const inputPath = writeTestFile(testDir, 'input.east', '"hello world"');
40
+ const outputPath = `${testDir}/output.east`;
41
+ const result = await convertCore(inputPath, 'east', outputPath);
42
+ assert.strictEqual(result.success, true);
43
+ const output = readFileSync(outputPath, 'utf-8');
44
+ assert.strictEqual(output.trim(), '"hello world"');
45
+ });
46
+ it('converts array value', async () => {
47
+ const inputPath = writeTestFile(testDir, 'input.east', '[1, 2, 3]');
48
+ const outputPath = `${testDir}/output.east`;
49
+ const result = await convertCore(inputPath, 'east', outputPath);
50
+ assert.strictEqual(result.success, true);
51
+ const output = readFileSync(outputPath, 'utf-8');
52
+ assert.match(output, /\[.*1.*2.*3.*\]/s);
53
+ });
54
+ });
55
+ describe('.east to .json', () => {
56
+ it('converts integer to JSON', async () => {
57
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
58
+ const outputPath = `${testDir}/output.json`;
59
+ const result = await convertCore(inputPath, 'json', outputPath);
60
+ assert.strictEqual(result.success, true);
61
+ const output = JSON.parse(readFileSync(outputPath, 'utf-8'));
62
+ // East may convert numbers to strings in JSON
63
+ assert.ok(output === 42 || output === '42');
64
+ });
65
+ it('converts string to JSON', async () => {
66
+ const inputPath = writeTestFile(testDir, 'input.east', '"hello"');
67
+ const outputPath = `${testDir}/output.json`;
68
+ const result = await convertCore(inputPath, 'json', outputPath);
69
+ assert.strictEqual(result.success, true);
70
+ const output = JSON.parse(readFileSync(outputPath, 'utf-8'));
71
+ assert.strictEqual(output, 'hello');
72
+ });
73
+ it('converts array to JSON', async () => {
74
+ const inputPath = writeTestFile(testDir, 'input.east', '[1, 2, 3]');
75
+ const outputPath = `${testDir}/output.json`;
76
+ const result = await convertCore(inputPath, 'json', outputPath);
77
+ assert.strictEqual(result.success, true);
78
+ const output = JSON.parse(readFileSync(outputPath, 'utf-8'));
79
+ // East may convert numbers to strings in JSON
80
+ assert.ok(Array.isArray(output) && output.length === 3);
81
+ });
82
+ });
83
+ describe('.json to .east', () => {
84
+ it('converts integer with type spec', async () => {
85
+ // East's fromJSONFor expects strings for integers
86
+ const inputPath = writeTestFile(testDir, 'input.json', '"42"');
87
+ const outputPath = `${testDir}/output.east`;
88
+ // Type spec should be an East value whose type will be inferred
89
+ const result = await convertCore(inputPath, 'east', outputPath, '0', 'json');
90
+ assert.strictEqual(result.success, true);
91
+ const output = readFileSync(outputPath, 'utf-8');
92
+ assert.strictEqual(output.trim(), '42');
93
+ });
94
+ it('converts array with type spec', async () => {
95
+ // East's fromJSONFor expects strings for integers
96
+ const inputPath = writeTestFile(testDir, 'input.json', '["1", "2", "3"]');
97
+ const outputPath = `${testDir}/output.east`;
98
+ // Type spec should be an East value whose type will be inferred
99
+ // Use [0] instead of [] to get Array<Integer> type
100
+ const result = await convertCore(inputPath, 'east', outputPath, '[0]', 'json');
101
+ assert.strictEqual(result.success, true);
102
+ const output = readFileSync(outputPath, 'utf-8');
103
+ assert.match(output, /\[.*1.*2.*3.*\]/s);
104
+ });
105
+ it('fails without type spec', async () => {
106
+ const inputPath = writeTestFile(testDir, 'input.json', '42');
107
+ const outputPath = `${testDir}/output.east`;
108
+ const result = await convertCore(inputPath, 'east', outputPath, undefined, 'json');
109
+ assert.strictEqual(result.success, false);
110
+ assert.match(result.error?.message ?? '', /requires --type/);
111
+ });
112
+ });
113
+ describe('.beast2 format (round-trip)', () => {
114
+ it('converts .east to .beast2 and back', async () => {
115
+ // .east -> .beast2
116
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
117
+ const beast2Path = `${testDir}/data.beast2`;
118
+ const toBeast2Result = await convertCore(inputPath, 'beast2', beast2Path);
119
+ assert.strictEqual(toBeast2Result.success, true);
120
+ // Verify beast2 file was created
121
+ const beast2Data = readFileSync(beast2Path);
122
+ assert.ok(beast2Data.length > 0);
123
+ // .beast2 -> .east
124
+ const outputPath = `${testDir}/output.east`;
125
+ const toEastResult = await convertCore(beast2Path, 'east', outputPath);
126
+ assert.strictEqual(toEastResult.success, true);
127
+ // Verify round-trip
128
+ const output = readFileSync(outputPath, 'utf-8');
129
+ assert.strictEqual(output.trim(), '42');
130
+ });
131
+ it('converts array to beast2 and back', async () => {
132
+ const inputPath = writeTestFile(testDir, 'input.east', '[1, 2, 3]');
133
+ const beast2Path = `${testDir}/data.beast2`;
134
+ // .east -> .beast2
135
+ const toBeast2Result = await convertCore(inputPath, 'beast2', beast2Path);
136
+ assert.strictEqual(toBeast2Result.success, true);
137
+ // .beast2 -> .east
138
+ const outputPath = `${testDir}/output.east`;
139
+ const toEastResult = await convertCore(beast2Path, 'east', outputPath);
140
+ assert.strictEqual(toEastResult.success, true);
141
+ // Verify round-trip
142
+ const output = readFileSync(outputPath, 'utf-8');
143
+ assert.match(output, /\[.*1.*2.*3.*\]/s);
144
+ });
145
+ });
146
+ describe('type output format', () => {
147
+ it('outputs type for integer', async () => {
148
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
149
+ const outputPath = `${testDir}/type.east`;
150
+ const result = await convertCore(inputPath, 'type', outputPath);
151
+ assert.strictEqual(result.success, true);
152
+ const output = readFileSync(outputPath, 'utf-8');
153
+ assert.match(output, /Integer/i);
154
+ });
155
+ it('outputs type for array', async () => {
156
+ const inputPath = writeTestFile(testDir, 'input.east', '[1, 2, 3]');
157
+ const outputPath = `${testDir}/type.east`;
158
+ const result = await convertCore(inputPath, 'type', outputPath);
159
+ assert.strictEqual(result.success, true);
160
+ const output = readFileSync(outputPath, 'utf-8');
161
+ assert.match(output, /Array/);
162
+ });
163
+ });
164
+ describe('stdin input', () => {
165
+ it('converts from stdin to file', async () => {
166
+ // Note: Actual stdin testing would require spawning a subprocess
167
+ // For unit tests, we test the null path case which triggers stdin logic
168
+ // Mock stdin by providing null path (stdin indicator)
169
+ // In real usage, this would read from process.stdin
170
+ // For this test, we'll just verify the error handling path works
171
+ // This test would need subprocess spawning to properly test stdin
172
+ // We'll demonstrate the pattern in integration tests instead
173
+ assert.ok(true, 'Stdin testing requires subprocess - see integration tests');
174
+ });
175
+ });
176
+ describe('format detection', () => {
177
+ it('detects .east format from extension', async () => {
178
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
179
+ const outputPath = `${testDir}/output.json`;
180
+ const result = await convertCore(inputPath, 'json', outputPath);
181
+ assert.strictEqual(result.success, true);
182
+ });
183
+ it('detects .json format from extension', async () => {
184
+ // East's fromJSONFor expects strings for integers
185
+ const inputPath = writeTestFile(testDir, 'input.json', '"42"');
186
+ const outputPath = `${testDir}/output.east`;
187
+ // JSON format requires explicit type when auto-detecting
188
+ // Type spec should be an East value whose type will be inferred
189
+ const result = await convertCore(inputPath, 'east', outputPath, '0', 'json');
190
+ assert.strictEqual(result.success, true);
191
+ });
192
+ it('detects .beast2 format from extension', async () => {
193
+ // First create a beast2 file
194
+ const eastPath = writeTestFile(testDir, 'input.east', '42');
195
+ const beast2Path = `${testDir}/data.beast2`;
196
+ await convertCore(eastPath, 'beast2', beast2Path);
197
+ // Now test detection
198
+ const outputPath = `${testDir}/output.east`;
199
+ const result = await convertCore(beast2Path, 'east', outputPath);
200
+ assert.strictEqual(result.success, true);
201
+ });
202
+ });
203
+ describe('error handling', () => {
204
+ it('handles invalid .east input', async () => {
205
+ const inputPath = writeTestFile(testDir, 'input.east', 'not valid east syntax!!!');
206
+ const outputPath = `${testDir}/output.json`;
207
+ const result = await convertCore(inputPath, 'json', outputPath);
208
+ assert.strictEqual(result.success, false);
209
+ assert.ok(result.error);
210
+ });
211
+ it('handles missing input file', async () => {
212
+ const inputPath = `${testDir}/nonexistent.east`;
213
+ const outputPath = `${testDir}/output.json`;
214
+ const result = await convertCore(inputPath, 'json', outputPath);
215
+ assert.strictEqual(result.success, false);
216
+ assert.ok(result.error);
217
+ });
218
+ it('handles unknown file extension', async () => {
219
+ const inputPath = writeTestFile(testDir, 'input.txt', '42');
220
+ const outputPath = `${testDir}/output.json`;
221
+ const result = await convertCore(inputPath, 'json', outputPath);
222
+ assert.strictEqual(result.success, false);
223
+ assert.match(result.error?.message ?? '', /Cannot detect format/);
224
+ });
225
+ });
226
+ describe('stdout output (no output file)', () => {
227
+ it('returns data when no output path specified', async () => {
228
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
229
+ const result = await convertCore(inputPath, 'json');
230
+ assert.strictEqual(result.success, true);
231
+ assert.ok(result.data);
232
+ const json = JSON.parse(result.data);
233
+ // East may convert numbers to strings in JSON
234
+ assert.ok(json === 42 || json === '42');
235
+ });
236
+ it('returns beast2 buffer when no output path specified', async () => {
237
+ const inputPath = writeTestFile(testDir, 'input.east', '42');
238
+ const result = await convertCore(inputPath, 'beast2');
239
+ assert.strictEqual(result.success, true);
240
+ assert.ok(result.data instanceof Buffer);
241
+ assert.ok(result.data.length > 0);
242
+ });
243
+ });
244
+ });
245
+ //# sourceMappingURL=convert.impl.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert.impl.spec.js","sourceRoot":"","sources":["../../../src/commands/convert.impl.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAErF,QAAQ,CAAC,iBA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declare function datasetStatusCommand(repoArg: string, pathSpec: string): Promise<void>;
9
+ //# sourceMappingURL=dataset-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-status.d.ts","sourceRoot":"","sources":["../../../src/commands/dataset-status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CA4Df"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 status command - Show dataset status detail
7
+ *
8
+ * Usage:
9
+ * e3 dataset status . ws.name
10
+ * e3 dataset status https://server/repos/myrepo ws.name
11
+ *
12
+ * Paths use the flat form `<ws>.<name>`.
13
+ */
14
+ import { workspaceGetDatasetStatus, LocalStorage } from '@elaraai/e3-core';
15
+ import { datasetGetStatus as datasetGetStatusRemote } from '@elaraai/e3-api-client';
16
+ import { printFor, EastTypeType, isVariant, toEastTypeValue } from '@elaraai/east';
17
+ import { parseRepoLocation, formatError, exitError } from '../utils.js';
18
+ import { resolveDatasetPath } from '../path-resolver.js';
19
+ import { formatSize } from '../format.js';
20
+ /**
21
+ * Show status detail for a single dataset at a path.
22
+ */
23
+ export async function datasetStatusCommand(repoArg, pathSpec) {
24
+ try {
25
+ const location = await parseRepoLocation(repoArg);
26
+ const { ws, path, kind } = await resolveDatasetPath(location, pathSpec);
27
+ const printType = printFor(EastTypeType);
28
+ if (location.type === 'local') {
29
+ const storage = new LocalStorage();
30
+ const result = await workspaceGetDatasetStatus(storage, location.path, ws, path);
31
+ const typeValue = isVariant(result.datasetType)
32
+ ? result.datasetType
33
+ : toEastTypeValue(result.datasetType);
34
+ console.log(`Path: ${pathSpec}`);
35
+ console.log(`Kind: ${kind}`);
36
+ console.log(`Type: ${printType(typeValue)}`);
37
+ if (result.refType === 'unassigned') {
38
+ console.log('Status: unset');
39
+ }
40
+ else if (result.refType === 'null') {
41
+ console.log('Status: set');
42
+ console.log('Hash: (null)');
43
+ console.log('Size: 0 B');
44
+ }
45
+ else {
46
+ console.log('Status: set');
47
+ console.log(`Hash: ${result.hash}`);
48
+ console.log(`Size: ${formatSize(result.size)}`);
49
+ }
50
+ }
51
+ else {
52
+ const detail = await datasetGetStatusRemote(location.baseUrl, location.repo, ws, path, { token: location.token });
53
+ console.log(`Path: ${pathSpec}`);
54
+ console.log(`Kind: ${kind}`);
55
+ console.log(`Type: ${printType(detail.type)}`);
56
+ if (detail.hash.type === 'none' && detail.size.type === 'none') {
57
+ console.log('Status: unset');
58
+ }
59
+ else {
60
+ console.log('Status: set');
61
+ if (detail.hash.type === 'some') {
62
+ console.log(`Hash: ${detail.hash.value}`);
63
+ }
64
+ else {
65
+ console.log('Hash: (null)');
66
+ }
67
+ if (detail.size.type === 'some') {
68
+ console.log(`Size: ${formatSize(Number(detail.size.value))}`);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ catch (err) {
74
+ exitError(formatError(err));
75
+ }
76
+ }
77
+ //# sourceMappingURL=dataset-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-status.js","sourceRoot":"","sources":["../../../src/commands/dataset-status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,eAAe,EAAsB,MAAM,eAAe,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,U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EAAE,CAAC;oBAChC,OAAO,CAAC,GAAG,CAAC,WAAW,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Build a name matcher from a user pattern.
7
+ *
8
+ * - Empty pattern matches nothing (avoids accidental "everything").
9
+ * - Plain pattern (no `*` / `?`) becomes a literal substring match.
10
+ * - Pattern containing `*` / `?` becomes a glob: `*` → any sequence,
11
+ * `?` → any single character. Regex meta-chars in the user pattern are
12
+ * escaped before glob expansion, so `data.csv` matches literal `data.csv`,
13
+ * not `dataXcsv`.
14
+ */
15
+ export declare function makeMatcher(pattern: string): (name: string) => boolean;
16
+ export declare function findCommand(repoArg: string, ws: string, pattern: string): Promise<void>;
17
+ //# sourceMappingURL=find.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../src/commands/find.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CActE;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB7F"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 dataset find - Search workspace dataset names by substring.
7
+ *
8
+ * Usage:
9
+ * e3 dataset find . dev greet # all paths in workspace 'dev' containing 'greet'
10
+ * e3 dataset find . dev '*output*' # glob-style substring match
11
+ * e3 dataset find https://server/repos/r dev greet
12
+ */
13
+ import { parseRepoLocation, formatError, exitError } from '../utils.js';
14
+ import { buildWorkspaceIndex } from '../path-resolver.js';
15
+ /**
16
+ * Build a name matcher from a user pattern.
17
+ *
18
+ * - Empty pattern matches nothing (avoids accidental "everything").
19
+ * - Plain pattern (no `*` / `?`) becomes a literal substring match.
20
+ * - Pattern containing `*` / `?` becomes a glob: `*` → any sequence,
21
+ * `?` → any single character. Regex meta-chars in the user pattern are
22
+ * escaped before glob expansion, so `data.csv` matches literal `data.csv`,
23
+ * not `dataXcsv`.
24
+ */
25
+ export function makeMatcher(pattern) {
26
+ if (pattern.length === 0) {
27
+ return () => false;
28
+ }
29
+ const hasGlob = pattern.includes('*') || pattern.includes('?');
30
+ if (!hasGlob) {
31
+ return (name) => name.includes(pattern);
32
+ }
33
+ const escaped = pattern
34
+ .replace(/[.+^${}()|[\]\\]/g, '\\$&')
35
+ .replace(/\*/g, '.*')
36
+ .replace(/\?/g, '.');
37
+ const re = new RegExp(`^${escaped}$`);
38
+ return (name) => re.test(name);
39
+ }
40
+ export async function findCommand(repoArg, ws, pattern) {
41
+ try {
42
+ const location = await parseRepoLocation(repoArg);
43
+ const index = await buildWorkspaceIndex(location, ws);
44
+ const match = makeMatcher(pattern);
45
+ const hits = index.filter((e) => match(e.name));
46
+ if (hits.length === 0) {
47
+ console.log('(no matches)');
48
+ return;
49
+ }
50
+ hits.sort((a, b) => a.name.localeCompare(b.name));
51
+ for (const e of hits) {
52
+ console.log(`${ws}.${e.name}`);
53
+ }
54
+ }
55
+ catch (err) {
56
+ exitError(formatError(err));
57
+ }
58
+ }
59
+ //# sourceMappingURL=find.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../src/commands/find.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K,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAC5B,OAAO;QACT,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAClD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=find.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find.spec.d.ts","sourceRoot":"","sources":["../../../src/commands/find.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}