@elaraai/e3-cli 0.0.2-beta.5 → 0.0.2-beta.50

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 (69) hide show
  1. package/README.md +33 -9
  2. package/dist/src/cli.js +50 -15
  3. package/dist/src/cli.js.map +1 -1
  4. package/dist/src/commands/auth.d.ts +21 -0
  5. package/dist/src/commands/auth.d.ts.map +1 -0
  6. package/dist/src/commands/auth.js +196 -0
  7. package/dist/src/commands/auth.js.map +1 -0
  8. package/dist/src/commands/dataset-status.d.ts +9 -0
  9. package/dist/src/commands/dataset-status.d.ts.map +1 -0
  10. package/dist/src/commands/dataset-status.js +77 -0
  11. package/dist/src/commands/dataset-status.js.map +1 -0
  12. package/dist/src/commands/get.d.ts.map +1 -1
  13. package/dist/src/commands/get.js +32 -14
  14. package/dist/src/commands/get.js.map +1 -1
  15. package/dist/src/commands/list.d.ts +6 -1
  16. package/dist/src/commands/list.d.ts.map +1 -1
  17. package/dist/src/commands/list.js +259 -17
  18. package/dist/src/commands/list.js.map +1 -1
  19. package/dist/src/commands/logs.d.ts.map +1 -1
  20. package/dist/src/commands/logs.js +94 -68
  21. package/dist/src/commands/logs.js.map +1 -1
  22. package/dist/src/commands/package.d.ts.map +1 -1
  23. package/dist/src/commands/package.js +78 -18
  24. package/dist/src/commands/package.js.map +1 -1
  25. package/dist/src/commands/repo.d.ts +35 -0
  26. package/dist/src/commands/repo.d.ts.map +1 -0
  27. package/dist/src/commands/repo.js +242 -0
  28. package/dist/src/commands/repo.js.map +1 -0
  29. package/dist/src/commands/run.d.ts.map +1 -1
  30. package/dist/src/commands/run.js +4 -3
  31. package/dist/src/commands/run.js.map +1 -1
  32. package/dist/src/commands/set.d.ts.map +1 -1
  33. package/dist/src/commands/set.js +16 -10
  34. package/dist/src/commands/set.js.map +1 -1
  35. package/dist/src/commands/start.d.ts.map +1 -1
  36. package/dist/src/commands/start.js +188 -52
  37. package/dist/src/commands/start.js.map +1 -1
  38. package/dist/src/commands/watch.d.ts.map +1 -1
  39. package/dist/src/commands/watch.js +33 -24
  40. package/dist/src/commands/watch.js.map +1 -1
  41. package/dist/src/commands/workspace.d.ts +8 -0
  42. package/dist/src/commands/workspace.d.ts.map +1 -1
  43. package/dist/src/commands/workspace.js +327 -37
  44. package/dist/src/commands/workspace.js.map +1 -1
  45. package/dist/src/credentials.d.ts +123 -0
  46. package/dist/src/credentials.d.ts.map +1 -0
  47. package/dist/src/credentials.js +213 -0
  48. package/dist/src/credentials.js.map +1 -0
  49. package/dist/src/format.d.ts +18 -0
  50. package/dist/src/format.d.ts.map +1 -0
  51. package/dist/src/format.js +43 -0
  52. package/dist/src/format.js.map +1 -0
  53. package/dist/src/utils.d.ts +60 -1
  54. package/dist/src/utils.d.ts.map +1 -1
  55. package/dist/src/utils.js +80 -1
  56. package/dist/src/utils.js.map +1 -1
  57. package/package.json +7 -6
  58. package/dist/src/commands/gc.d.ts +0 -12
  59. package/dist/src/commands/gc.d.ts.map +0 -1
  60. package/dist/src/commands/gc.js +0 -44
  61. package/dist/src/commands/gc.js.map +0 -1
  62. package/dist/src/commands/init.d.ts +0 -9
  63. package/dist/src/commands/init.d.ts.map +0 -1
  64. package/dist/src/commands/init.js +0 -33
  65. package/dist/src/commands/init.js.map +0 -1
  66. package/dist/src/commands/status.d.ts +0 -9
  67. package/dist/src/commands/status.d.ts.map +0 -1
  68. package/dist/src/commands/status.js +0 -157
  69. package/dist/src/commands/status.js.map +0 -1
package/README.md CHANGED
@@ -13,18 +13,19 @@ npm install -g @elaraai/e3-cli
13
13
  ### Repository
14
14
 
15
15
  ```bash
16
- e3 init <repo> # Initialize a new repository
17
- e3 status <repo> # Show repository status
18
- e3 gc <repo> [--dry-run] # Remove unreferenced objects
16
+ e3 repo create <repo> # Create a new repository
17
+ e3 repo status <repo> # Show repository status
18
+ e3 repo remove <repo> # Remove a repository
19
+ e3 repo gc <repo> [--dry-run] # Remove unreferenced objects
19
20
  ```
20
21
 
21
22
  ### Packages
22
23
 
23
24
  ```bash
24
- e3 package import <repo> <zip> # Import package from .zip
25
+ e3 package import <repo> <zip> # Import package from .zip
25
26
  e3 package export <repo> <pkg> <zip> # Export package to .zip
26
- e3 package list <repo> # List installed packages
27
- e3 package remove <repo> <pkg> # Remove a package
27
+ e3 package list <repo> # List installed packages
28
+ e3 package remove <repo> <pkg> # Remove a package
28
29
  ```
29
30
 
30
31
  ### Workspaces
@@ -33,7 +34,9 @@ e3 package remove <repo> <pkg> # Remove a package
33
34
  e3 workspace create <repo> <name> # Create empty workspace
34
35
  e3 workspace deploy <repo> <ws> <pkg> # Deploy package to workspace
35
36
  e3 workspace export <repo> <ws> <zip> # Export workspace as package
37
+ e3 workspace import <repo> <ws> <zip> # Import package zip into workspace
36
38
  e3 workspace list <repo> # List workspaces
39
+ e3 workspace status <repo> <ws> # Show workspace status
37
40
  e3 workspace remove <repo> <ws> # Remove workspace
38
41
  ```
39
42
 
@@ -41,6 +44,9 @@ e3 workspace remove <repo> <ws> # Remove workspace
41
44
 
42
45
  ```bash
43
46
  e3 list <repo> [path] # List workspaces or tree contents
47
+ e3 list <repo> <path> -r # List all dataset paths recursively
48
+ e3 list <repo> <path> -l # List immediate children with type/status/size
49
+ e3 list <repo> <path> -r -l # List all datasets with type/status/size
44
50
  e3 get <repo> <path> [-f format] # Get dataset value (east/json/beast2)
45
51
  e3 set <repo> <path> <file> # Set dataset value from file
46
52
  ```
@@ -48,8 +54,9 @@ e3 set <repo> <path> <file> # Set dataset value from file
48
54
  ### Execution
49
55
 
50
56
  ```bash
51
- e3 run <repo> <task> [inputs...] # Run task ad-hoc
52
57
  e3 start <repo> <ws> # Execute tasks in workspace
58
+ e3 run <repo> <task> [inputs...] # Run task ad-hoc
59
+ e3 watch <repo> <ws> <source.ts> # Watch and auto-deploy on changes
53
60
  e3 logs <repo> <path> [--follow] # View task logs
54
61
  ```
55
62
 
@@ -59,11 +66,28 @@ e3 logs <repo> <path> [--follow] # View task logs
59
66
  e3 convert [input] --to <format> # Convert between .east/.json/.beast2
60
67
  ```
61
68
 
69
+ ### Authentication (for remote servers)
70
+
71
+ ```bash
72
+ e3 login <server> # Log in using OAuth2 Device Flow
73
+ e3 logout <server> # Log out and clear credentials
74
+ e3 auth status # List all saved credentials
75
+ e3 auth token <server> # Print access token (for curl/debugging)
76
+ e3 auth whoami [server] # Show current identity
77
+ ```
78
+
79
+ The `e3 auth token` command is useful for debugging API calls:
80
+
81
+ ```bash
82
+ curl -H "Authorization: Bearer $(e3 auth token https://example.com)" \
83
+ https://example.com/api/repos/my-repo/status
84
+ ```
85
+
62
86
  ## Example
63
87
 
64
88
  ```bash
65
- # Initialize repository and import a package
66
- e3 init ./my-project
89
+ # Create repository and import a package
90
+ e3 repo create ./my-project
67
91
  e3 package import ./my-project ./greeting-pkg-1.0.0.zip
68
92
 
69
93
  # Create workspace and deploy package
package/dist/src/cli.js CHANGED
@@ -8,8 +8,11 @@
8
8
  *
9
9
  * All commands take a repository path as the first argument (`.` for current directory).
10
10
  */
11
+ import { createRequire } from 'node:module';
11
12
  import { Command } from 'commander';
12
- import { initCommand } from './commands/init.js';
13
+ const require = createRequire(import.meta.url);
14
+ const packageJson = require('../../package.json');
15
+ import { repoCommand } from './commands/repo.js';
13
16
  import { packageCommand } from './commands/package.js';
14
17
  import { workspaceCommand } from './commands/workspace.js';
15
18
  import { listCommand } from './commands/list.js';
@@ -18,30 +21,41 @@ import { setCommand } from './commands/set.js';
18
21
  import { startCommand } from './commands/start.js';
19
22
  import { runCommand } from './commands/run.js';
20
23
  import { logsCommand } from './commands/logs.js';
21
- import { statusCommand } from './commands/status.js';
22
- import { gcCommand } from './commands/gc.js';
24
+ import { datasetStatusCommand } from './commands/dataset-status.js';
23
25
  import { convertCommand } from './commands/convert.js';
24
26
  import { watchCommand } from './commands/watch.js';
27
+ import { createAuthCommand, createLoginCommand, createLogoutCommand } from './commands/auth.js';
25
28
  const program = new Command();
26
29
  program
27
30
  .name('e3')
28
31
  .description('East Execution Engine - Execute tasks across multiple runtimes')
29
- .version('0.0.1-alpha.0');
32
+ .version(packageJson.version);
30
33
  // Repository commands
31
34
  program
32
- .command('init <repo>')
33
- .description('Initialize a new e3 repository')
34
- .action(initCommand);
35
- program
36
- .command('status <repo> [workspace]')
37
- .description('Show repository status, or detailed workspace status if workspace provided')
38
- .action(statusCommand);
39
- program
40
- .command('gc <repo>')
35
+ .command('repo')
36
+ .description('Repository operations')
37
+ .addCommand(new Command('create')
38
+ .description('Create a new repository')
39
+ .argument('<repo>', 'Repository path or URL')
40
+ .action(repoCommand.create))
41
+ .addCommand(new Command('remove')
42
+ .description('Remove a repository')
43
+ .argument('<repo>', 'Repository path or URL')
44
+ .action(repoCommand.remove))
45
+ .addCommand(new Command('status')
46
+ .description('Show repository status')
47
+ .argument('<repo>', 'Repository path or URL')
48
+ .action(repoCommand.status))
49
+ .addCommand(new Command('gc')
41
50
  .description('Remove unreferenced objects')
51
+ .argument('<repo>', 'Repository path or URL')
42
52
  .option('--dry-run', 'Report what would be deleted without deleting')
43
53
  .option('--min-age <ms>', 'Minimum file age in ms before deletion', '60000')
44
- .action(gcCommand);
54
+ .action(repoCommand.gc))
55
+ .addCommand(new Command('list')
56
+ .description('List repositories on a server')
57
+ .argument('<server>', 'Server URL (e.g., http://localhost:3000)')
58
+ .action(repoCommand.list));
45
59
  // Package commands
46
60
  program
47
61
  .command('package')
@@ -89,6 +103,12 @@ program
89
103
  .option('--name <name>', 'Package name (default: deployed package name)')
90
104
  .option('--version <version>', 'Package version (default: auto-generated)')
91
105
  .action(workspaceCommand.export))
106
+ .addCommand(new Command('import')
107
+ .description('Import a package zip into a workspace (creates workspace if needed)')
108
+ .argument('<repo>', 'Repository path or URL')
109
+ .argument('<ws>', 'Workspace name')
110
+ .argument('<zipPath>', 'Input .zip path')
111
+ .action(workspaceCommand.import))
92
112
  .addCommand(new Command('list')
93
113
  .description('List workspaces')
94
114
  .argument('<repo>', 'Repository path')
@@ -97,11 +117,18 @@ program
97
117
  .description('Remove a workspace')
98
118
  .argument('<repo>', 'Repository path')
99
119
  .argument('<ws>', 'Workspace name')
100
- .action(workspaceCommand.remove));
120
+ .action(workspaceCommand.remove))
121
+ .addCommand(new Command('status')
122
+ .description('Show detailed workspace status (tasks, datasets, locks)')
123
+ .argument('<repo>', 'Repository path')
124
+ .argument('<ws>', 'Workspace name')
125
+ .action(workspaceCommand.status));
101
126
  // Dataset commands
102
127
  program
103
128
  .command('list <repo> [path]')
104
129
  .description('List workspaces or tree contents at path (ws.path.to.tree)')
130
+ .option('-r, --recursive', 'List all datasets recursively')
131
+ .option('-l, --long', 'Show detailed information (type, status, size)')
105
132
  .action(listCommand);
106
133
  program
107
134
  .command('get <repo> <path>')
@@ -113,6 +140,10 @@ program
113
140
  .description('Set dataset value from file (ws.path.to.dataset)')
114
141
  .option('--type <typespec>', 'Type specification in .east format (required for .json/.csv files)')
115
142
  .action(setCommand);
143
+ program
144
+ .command('status <repo> <path>')
145
+ .description('Show dataset status at path (ws.path.to.dataset)')
146
+ .action(datasetStatusCommand);
116
147
  // Execution commands
117
148
  program
118
149
  .command('run <repo> <task> [inputs...]')
@@ -148,5 +179,9 @@ program
148
179
  .option('-o, --output <path>', 'Output file path (default: stdout)')
149
180
  .option('--type <typespec>', 'Type specification in .east format')
150
181
  .action(convertCommand);
182
+ // Authentication commands
183
+ program.addCommand(createLoginCommand());
184
+ program.addCommand(createLogoutCommand());
185
+ program.addCommand(createAuthCommand());
151
186
  program.parse();
152
187
  //# sourceMappingURL=cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,gBAAgB,E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UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,UAAU,CAAC,iBAAiB,EAAE,CAAC,CAAC;AAExC,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Authentication commands for e3 CLI.
7
+ */
8
+ import { Command } from 'commander';
9
+ /**
10
+ * Create the auth command group.
11
+ */
12
+ export declare function createAuthCommand(): Command;
13
+ /**
14
+ * Create the login command.
15
+ */
16
+ export declare function createLoginCommand(): Command;
17
+ /**
18
+ * Create the logout command.
19
+ */
20
+ export declare function createLogoutCommand(): Command;
21
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2CpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CA+E3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAsE5C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAa7C"}
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Authentication commands for e3 CLI.
7
+ */
8
+ import { Command } from 'commander';
9
+ import { fetchDiscovery, startDeviceAuth, pollForTokens, setCredential, removeCredential, listCredentials, getCredential, getValidToken, isExpired, decodeJwtPayload, normalizeServerUrl, } from '../credentials.js';
10
+ import { formatError, exitError } from '../utils.js';
11
+ /**
12
+ * Try to open a URL in the default browser.
13
+ */
14
+ async function openBrowser(url) {
15
+ const { exec } = await import('node:child_process');
16
+ const { platform } = await import('node:os');
17
+ return new Promise((resolve) => {
18
+ let command;
19
+ switch (platform()) {
20
+ case 'darwin':
21
+ command = `open "${url}"`;
22
+ break;
23
+ case 'win32':
24
+ command = `start "" "${url}"`;
25
+ break;
26
+ default:
27
+ command = `xdg-open "${url}"`;
28
+ }
29
+ exec(command, (error) => {
30
+ resolve(!error);
31
+ });
32
+ });
33
+ }
34
+ /**
35
+ * Create the auth command group.
36
+ */
37
+ export function createAuthCommand() {
38
+ const auth = new Command('auth')
39
+ .description('Authentication commands');
40
+ // e3 auth status - List all saved credentials
41
+ auth
42
+ .command('status')
43
+ .description('List saved credentials')
44
+ .action(() => {
45
+ const creds = listCredentials();
46
+ if (creds.length === 0) {
47
+ console.log('No saved credentials.');
48
+ console.log('Run: e3 login <server>');
49
+ return;
50
+ }
51
+ console.log('Saved credentials:\n');
52
+ for (const { server, expiresAt } of creds) {
53
+ const expired = isExpired(expiresAt);
54
+ const status = expired ? '(expired)' : '(valid)';
55
+ console.log(` ${server} ${status}`);
56
+ console.log(` Token expires: ${expiresAt}`);
57
+ }
58
+ });
59
+ // e3 auth token <server> - Print access token for use with curl
60
+ auth
61
+ .command('token')
62
+ .description('Print access token for a server (for curl/debugging)')
63
+ .argument('<server>', 'Server URL')
64
+ .action(async (server) => {
65
+ const serverUrl = normalizeServerUrl(server);
66
+ try {
67
+ // getValidToken handles refresh automatically if token is expired
68
+ const token = await getValidToken(serverUrl);
69
+ // Print just the token, suitable for: curl -H "Authorization: Bearer $(e3 auth token <server>)"
70
+ console.log(token);
71
+ }
72
+ catch (err) {
73
+ exitError(formatError(err));
74
+ }
75
+ });
76
+ // e3 auth whoami [server] - Show current identity
77
+ auth
78
+ .command('whoami')
79
+ .description('Show current identity')
80
+ .argument('[server]', 'Server URL')
81
+ .action((server) => {
82
+ const creds = listCredentials();
83
+ if (creds.length === 0) {
84
+ console.log('Not logged in to any servers.');
85
+ return;
86
+ }
87
+ const servers = server ? [server] : creds.map((c) => c.server);
88
+ for (const serverUrl of servers) {
89
+ const credential = getCredential(serverUrl);
90
+ if (!credential) {
91
+ console.log(`${serverUrl}: Not logged in`);
92
+ continue;
93
+ }
94
+ try {
95
+ const payload = decodeJwtPayload(credential.accessToken);
96
+ const expired = isExpired(credential.expiresAt);
97
+ const status = expired ? '(token expired)' : '';
98
+ console.log(`${serverUrl}: ${status}`);
99
+ console.log(` Subject: ${payload.sub ?? 'unknown'}`);
100
+ if (payload.email) {
101
+ console.log(` Email: ${payload.email}`);
102
+ }
103
+ console.log(` Issuer: ${payload.iss ?? 'unknown'}`);
104
+ }
105
+ catch {
106
+ console.log(`${serverUrl}: Invalid token`);
107
+ }
108
+ }
109
+ });
110
+ return auth;
111
+ }
112
+ /**
113
+ * Create the login command.
114
+ */
115
+ export function createLoginCommand() {
116
+ return new Command('login')
117
+ .description('Log in to a server using OAuth2 Device Flow')
118
+ .argument('<server>', 'Server URL (e.g., http://localhost:3000)')
119
+ .option('--no-browser', 'Do not open browser (for CI/headless environments)')
120
+ .action(async (server, options) => {
121
+ const serverUrl = normalizeServerUrl(server);
122
+ console.log(`Logging in to ${serverUrl}...`);
123
+ // Fetch OIDC discovery document
124
+ let discovery;
125
+ try {
126
+ discovery = await fetchDiscovery(serverUrl);
127
+ }
128
+ catch (err) {
129
+ exitError(`Failed to connect to server: ${formatError(err)}\nMake sure the server is running with --oidc enabled.`);
130
+ }
131
+ // Start device authorization
132
+ let deviceAuth;
133
+ try {
134
+ deviceAuth = await startDeviceAuth(discovery);
135
+ }
136
+ catch (err) {
137
+ exitError(`Failed to start login: ${formatError(err)}`);
138
+ }
139
+ // Display user code and URL (unless in quiet CI mode)
140
+ if (options.browser) {
141
+ console.log('\nTo complete login:');
142
+ console.log(` 1. Open: ${deviceAuth.verification_uri}`);
143
+ console.log(` 2. Enter code: ${deviceAuth.user_code}`);
144
+ console.log(`\nOr visit this URL directly:`);
145
+ console.log(` ${deviceAuth.verification_uri_complete}`);
146
+ // Try to open browser
147
+ const opened = await openBrowser(deviceAuth.verification_uri_complete);
148
+ if (opened) {
149
+ console.log('\nBrowser opened. Waiting for approval...');
150
+ }
151
+ else {
152
+ console.log('\nWaiting for approval...');
153
+ }
154
+ }
155
+ else {
156
+ console.log('Waiting for server approval (--no-browser mode)...');
157
+ }
158
+ // Poll for tokens
159
+ try {
160
+ const tokens = await pollForTokens(discovery, deviceAuth.device_code, deviceAuth.interval, deviceAuth.expires_in);
161
+ // Save credentials
162
+ const entry = {
163
+ accessToken: tokens.access_token,
164
+ refreshToken: tokens.refresh_token,
165
+ expiresAt: new Date(Date.now() + tokens.expires_in * 1000).toISOString(),
166
+ };
167
+ setCredential(serverUrl, entry);
168
+ // Show identity
169
+ const payload = decodeJwtPayload(tokens.access_token);
170
+ console.log(`\nSuccessfully logged in as: ${payload.sub ?? 'unknown'}`);
171
+ console.log(`Token expires: ${entry.expiresAt}`);
172
+ }
173
+ catch (err) {
174
+ exitError(`Login failed: ${formatError(err)}`);
175
+ }
176
+ });
177
+ }
178
+ /**
179
+ * Create the logout command.
180
+ */
181
+ export function createLogoutCommand() {
182
+ return new Command('logout')
183
+ .description('Log out from a server')
184
+ .argument('<server>', 'Server URL')
185
+ .action((server) => {
186
+ const serverUrl = normalizeServerUrl(server);
187
+ const removed = removeCredential(serverUrl);
188
+ if (removed) {
189
+ console.log(`Logged out from ${serverUrl}`);
190
+ }
191
+ else {
192
+ console.log(`Not logged in to ${serverUrl}`);
193
+ }
194
+ });
195
+ }
196
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/commands/auth.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb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AAC;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC;SACzB,WAAW,CAAC,uBAAuB,CAAC;SACpC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;SAClC,MAAM,CAAC,CAAC,MAAc,EAAE,EAAE;QACzB,MAAM,SAAS,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,mBAAmB,SAAS,EAAE,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,oBAAoB,SAAS,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Licensed under BSL 1.1. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Show status detail for a single dataset at a path.
7
+ */
8
+ export 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;AAgBH;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAgEf"}
@@ -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 status . ws.path.to.dataset
10
+ * e3 status https://server/repos/myrepo ws.path.to.dataset
11
+ */
12
+ import { workspaceGetDatasetStatus, LocalStorage } from '@elaraai/e3-core';
13
+ import { datasetGetStatus as datasetGetStatusRemote } from '@elaraai/e3-api-client';
14
+ import { printFor, EastTypeType, isVariant, toEastTypeValue } from '@elaraai/east';
15
+ import { parseRepoLocation, parseDatasetPath, formatError, exitError } from '../utils.js';
16
+ import { formatSize } from '../format.js';
17
+ /**
18
+ * Show status detail for a single dataset at a path.
19
+ */
20
+ export async function datasetStatusCommand(repoArg, pathSpec) {
21
+ try {
22
+ const location = await parseRepoLocation(repoArg);
23
+ const { ws, path } = parseDatasetPath(pathSpec);
24
+ if (path.length === 0) {
25
+ exitError('Path must include at least one field (e.g., ws.field)');
26
+ }
27
+ const pathStr = '.' + path.map(s => s.value).join('.');
28
+ const printType = printFor(EastTypeType);
29
+ if (location.type === 'local') {
30
+ const storage = new LocalStorage();
31
+ const result = await workspaceGetDatasetStatus(storage, location.path, ws, path);
32
+ // Convert type to EastTypeValue if needed
33
+ const typeValue = isVariant(result.datasetType)
34
+ ? result.datasetType
35
+ : toEastTypeValue(result.datasetType);
36
+ console.log(`Path: ${pathStr}`);
37
+ console.log(`Type: ${printType(typeValue)}`);
38
+ if (result.refType === 'unassigned') {
39
+ console.log('Status: unset');
40
+ }
41
+ else if (result.refType === 'null') {
42
+ console.log('Status: set');
43
+ console.log('Hash: (null)');
44
+ console.log('Size: 0 B');
45
+ }
46
+ else {
47
+ console.log('Status: set');
48
+ console.log(`Hash: ${result.hash}`);
49
+ console.log(`Size: ${formatSize(result.size)}`);
50
+ }
51
+ }
52
+ else {
53
+ const detail = await datasetGetStatusRemote(location.baseUrl, location.repo, ws, path, { token: location.token });
54
+ console.log(`Path: ${detail.path}`);
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;;;;;;GAMG;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,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAe,EACf,QAAgB;IAEhB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClD,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAEhD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,SAAS,CAAC,uDAAuD,CAAC,CAAC;QACrE,CAAC;QAED,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvD,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H,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CA+Cf"}
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/get.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuEf"}
@@ -8,32 +8,50 @@
8
8
  * Usage:
9
9
  * e3 get . ws.path.to.dataset
10
10
  * e3 get . ws.path.to.dataset -f json
11
+ * e3 get https://server/repos/myrepo ws.path.to.dataset
11
12
  */
12
- import { workspaceGetDatasetHash, datasetRead } from '@elaraai/e3-core';
13
- import { printFor, toJSONFor } from '@elaraai/east';
14
- import { resolveRepo, parseDatasetPath, formatError, exitError } from '../utils.js';
13
+ import { workspaceGetDatasetHash, datasetRead, LocalStorage } from '@elaraai/e3-core';
14
+ import { datasetGet as datasetGetRemote } from '@elaraai/e3-api-client';
15
+ import { printFor, toJSONFor, decodeBeast2, toEastTypeValue, isVariant } from '@elaraai/east';
16
+ import { parseRepoLocation, parseDatasetPath, formatError, exitError } from '../utils.js';
15
17
  /**
16
18
  * Get dataset value at a path.
17
19
  */
18
20
  export async function getCommand(repoArg, pathSpec, options) {
19
21
  try {
20
- const repoPath = resolveRepo(repoArg);
22
+ const location = await parseRepoLocation(repoArg);
21
23
  const { ws, path } = parseDatasetPath(pathSpec);
22
24
  if (path.length === 0) {
23
25
  exitError('Path must include at least one field (e.g., ws.field)');
24
26
  }
25
- // Get the hash first, then read with type info
26
- const { refType, hash } = await workspaceGetDatasetHash(repoPath, ws, path);
27
- if (refType === 'unassigned') {
28
- exitError('Dataset is unassigned (pending task output)');
27
+ const format = options.format ?? 'east';
28
+ let type;
29
+ let value;
30
+ if (location.type === 'local') {
31
+ const storage = new LocalStorage();
32
+ // Get the hash first, then read with type info
33
+ const { refType, hash } = await workspaceGetDatasetHash(storage, location.path, ws, path);
34
+ if (refType === 'unassigned') {
35
+ exitError('Dataset is unassigned (pending task output)');
36
+ }
37
+ if (refType === 'null' || hash === null) {
38
+ console.log('null');
39
+ return;
40
+ }
41
+ // Read the dataset to get both value and type
42
+ const dataset = await datasetRead(storage, location.path, hash);
43
+ // Convert EastType to EastTypeValue if necessary
44
+ type = isVariant(dataset.type) ? dataset.type : toEastTypeValue(dataset.type);
45
+ value = dataset.value;
29
46
  }
30
- if (refType === 'null' || hash === null) {
31
- console.log('null');
32
- return;
47
+ else {
48
+ // Remote: get raw BEAST2 bytes and decode
49
+ const { data: beast2Data } = await datasetGetRemote(location.baseUrl, location.repo, ws, path, { token: location.token });
50
+ // Decode BEAST2 to get type and value
51
+ const decoded = decodeBeast2(beast2Data);
52
+ type = decoded.type;
53
+ value = decoded.value;
33
54
  }
34
- // Read the dataset to get both value and type
35
- const { type, value } = await datasetRead(repoPath, hash);
36
- const format = options.format ?? 'east';
37
55
  switch (format) {
38
56
  case 'east': {
39
57
  const printer = printFor(type);