@elaraai/e3-cli 0.0.2-beta.3 → 0.0.2-beta.30

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 (64) hide show
  1. package/README.md +30 -9
  2. package/dist/src/cli.js +44 -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 +204 -0
  7. package/dist/src/commands/auth.js.map +1 -0
  8. package/dist/src/commands/get.d.ts.map +1 -1
  9. package/dist/src/commands/get.js +32 -14
  10. package/dist/src/commands/get.js.map +1 -1
  11. package/dist/src/commands/list.d.ts.map +1 -1
  12. package/dist/src/commands/list.js +47 -14
  13. package/dist/src/commands/list.js.map +1 -1
  14. package/dist/src/commands/logs.d.ts.map +1 -1
  15. package/dist/src/commands/logs.js +105 -69
  16. package/dist/src/commands/logs.js.map +1 -1
  17. package/dist/src/commands/package.d.ts.map +1 -1
  18. package/dist/src/commands/package.js +55 -18
  19. package/dist/src/commands/package.js.map +1 -1
  20. package/dist/src/commands/repo.d.ts +35 -0
  21. package/dist/src/commands/repo.d.ts.map +1 -0
  22. package/dist/src/commands/repo.js +243 -0
  23. package/dist/src/commands/repo.js.map +1 -0
  24. package/dist/src/commands/run.d.ts.map +1 -1
  25. package/dist/src/commands/run.js +4 -3
  26. package/dist/src/commands/run.js.map +1 -1
  27. package/dist/src/commands/set.d.ts.map +1 -1
  28. package/dist/src/commands/set.js +16 -5
  29. package/dist/src/commands/set.js.map +1 -1
  30. package/dist/src/commands/start.d.ts.map +1 -1
  31. package/dist/src/commands/start.js +188 -47
  32. package/dist/src/commands/start.js.map +1 -1
  33. package/dist/src/commands/tree.d.ts +14 -0
  34. package/dist/src/commands/tree.d.ts.map +1 -0
  35. package/dist/src/commands/tree.js +171 -0
  36. package/dist/src/commands/tree.js.map +1 -0
  37. package/dist/src/commands/watch.d.ts.map +1 -1
  38. package/dist/src/commands/watch.js +131 -91
  39. package/dist/src/commands/watch.js.map +1 -1
  40. package/dist/src/commands/workspace.d.ts +4 -0
  41. package/dist/src/commands/workspace.d.ts.map +1 -1
  42. package/dist/src/commands/workspace.js +269 -29
  43. package/dist/src/commands/workspace.js.map +1 -1
  44. package/dist/src/credentials.d.ts +123 -0
  45. package/dist/src/credentials.d.ts.map +1 -0
  46. package/dist/src/credentials.js +213 -0
  47. package/dist/src/credentials.js.map +1 -0
  48. package/dist/src/utils.d.ts +48 -0
  49. package/dist/src/utils.d.ts.map +1 -1
  50. package/dist/src/utils.js +64 -0
  51. package/dist/src/utils.js.map +1 -1
  52. package/package.json +7 -6
  53. package/dist/src/commands/gc.d.ts +0 -12
  54. package/dist/src/commands/gc.d.ts.map +0 -1
  55. package/dist/src/commands/gc.js +0 -44
  56. package/dist/src/commands/gc.js.map +0 -1
  57. package/dist/src/commands/init.d.ts +0 -9
  58. package/dist/src/commands/init.d.ts.map +0 -1
  59. package/dist/src/commands/init.js +0 -33
  60. package/dist/src/commands/init.js.map +0 -1
  61. package/dist/src/commands/status.d.ts +0 -9
  62. package/dist/src/commands/status.d.ts.map +0 -1
  63. package/dist/src/commands/status.js +0 -157
  64. 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
@@ -34,6 +35,7 @@ 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
36
37
  e3 workspace list <repo> # List workspaces
38
+ e3 workspace status <repo> <ws> # Show workspace status
37
39
  e3 workspace remove <repo> <ws> # Remove workspace
38
40
  ```
39
41
 
@@ -41,6 +43,7 @@ e3 workspace remove <repo> <ws> # Remove workspace
41
43
 
42
44
  ```bash
43
45
  e3 list <repo> [path] # List workspaces or tree contents
46
+ e3 tree <repo> <path> # Show full tree structure
44
47
  e3 get <repo> <path> [-f format] # Get dataset value (east/json/beast2)
45
48
  e3 set <repo> <path> <file> # Set dataset value from file
46
49
  ```
@@ -48,8 +51,9 @@ e3 set <repo> <path> <file> # Set dataset value from file
48
51
  ### Execution
49
52
 
50
53
  ```bash
51
- e3 run <repo> <task> [inputs...] # Run task ad-hoc
52
54
  e3 start <repo> <ws> # Execute tasks in workspace
55
+ e3 run <repo> <task> [inputs...] # Run task ad-hoc
56
+ e3 watch <repo> <ws> <source.ts> # Watch and auto-deploy on changes
53
57
  e3 logs <repo> <path> [--follow] # View task logs
54
58
  ```
55
59
 
@@ -59,11 +63,28 @@ e3 logs <repo> <path> [--follow] # View task logs
59
63
  e3 convert [input] --to <format> # Convert between .east/.json/.beast2
60
64
  ```
61
65
 
66
+ ### Authentication (for remote servers)
67
+
68
+ ```bash
69
+ e3 login <server> # Log in using OAuth2 Device Flow
70
+ e3 logout <server> # Log out and clear credentials
71
+ e3 auth status # List all saved credentials
72
+ e3 auth token <server> # Print access token (for curl/debugging)
73
+ e3 auth whoami [server] # Show current identity
74
+ ```
75
+
76
+ The `e3 auth token` command is useful for debugging API calls:
77
+
78
+ ```bash
79
+ curl -H "Authorization: Bearer $(e3 auth token https://example.com)" \
80
+ https://example.com/api/repos/my-repo/status
81
+ ```
82
+
62
83
  ## Example
63
84
 
64
85
  ```bash
65
- # Initialize repository and import a package
66
- e3 init ./my-project
86
+ # Create repository and import a package
87
+ e3 repo create ./my-project
67
88
  e3 package import ./my-project ./greeting-pkg-1.0.0.zip
68
89
 
69
90
  # Create workspace and deploy package
package/dist/src/cli.js CHANGED
@@ -8,40 +8,54 @@
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';
19
+ import { treeCommand } from './commands/tree.js';
16
20
  import { getCommand } from './commands/get.js';
17
21
  import { setCommand } from './commands/set.js';
18
22
  import { startCommand } from './commands/start.js';
19
23
  import { runCommand } from './commands/run.js';
20
24
  import { logsCommand } from './commands/logs.js';
21
- import { statusCommand } from './commands/status.js';
22
- import { gcCommand } from './commands/gc.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')
@@ -97,12 +111,23 @@ program
97
111
  .description('Remove a workspace')
98
112
  .argument('<repo>', 'Repository path')
99
113
  .argument('<ws>', 'Workspace name')
100
- .action(workspaceCommand.remove));
114
+ .action(workspaceCommand.remove))
115
+ .addCommand(new Command('status')
116
+ .description('Show detailed workspace status (tasks, datasets, locks)')
117
+ .argument('<repo>', 'Repository path')
118
+ .argument('<ws>', 'Workspace name')
119
+ .action(workspaceCommand.status));
101
120
  // Dataset commands
102
121
  program
103
122
  .command('list <repo> [path]')
104
123
  .description('List workspaces or tree contents at path (ws.path.to.tree)')
105
124
  .action(listCommand);
125
+ program
126
+ .command('tree <repo> <path>')
127
+ .description('Show full tree structure at path (ws or ws.subtree)')
128
+ .option('--depth <n>', 'Maximum depth to display')
129
+ .option('--types', 'Show dataset types')
130
+ .action(treeCommand);
106
131
  program
107
132
  .command('get <repo> <path>')
108
133
  .description('Get dataset value at path (ws.path.to.dataset)')
@@ -148,5 +173,9 @@ program
148
173
  .option('-o, --output <path>', 'Output file path (default: stdout)')
149
174
  .option('--type <typespec>', 'Type specification in .east format')
150
175
  .action(convertCommand);
176
+ // Authentication commands
177
+ program.addCommand(createLoginCommand());
178
+ program.addCommand(createLogoutCommand());
179
+ program.addCommand(createAuthCommand());
151
180
  program.parse();
152
181
  //# 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,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,IAAI,CAAC;KACV,WAAW,CAAC,gEAAgE,CAAC;KAC7E,OAAO,CAAC,eAAe,CAAC,CAAC;AAE5B,sBAAsB;AACtB,OAAO;KACJ,OAAO,CAAC,aAAa,CAAC;KACtB,WAAW,CAAC,gCAAgC,CAAC;KAC7C,M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AM,CAAC,qBAAqB,EAAE,oCAAoC,CAAC;KACnE,MAAM,CAAC,mBAAmB,EAAE,oCAAoC,CAAC;KACjE,MAAM,CAAC,cAAc,CAAC,CAAC;AAE1B,0BAA0B;AAC1B,OAAO,CAAC,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;AA0CpC;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAiF3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CA6E5C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAa7C"}
@@ -0,0 +1,204 @@
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
+ /**
11
+ * Try to open a URL in the default browser.
12
+ */
13
+ async function openBrowser(url) {
14
+ const { exec } = await import('node:child_process');
15
+ const { platform } = await import('node:os');
16
+ return new Promise((resolve) => {
17
+ let command;
18
+ switch (platform()) {
19
+ case 'darwin':
20
+ command = `open "${url}"`;
21
+ break;
22
+ case 'win32':
23
+ command = `start "" "${url}"`;
24
+ break;
25
+ default:
26
+ command = `xdg-open "${url}"`;
27
+ }
28
+ exec(command, (error) => {
29
+ resolve(!error);
30
+ });
31
+ });
32
+ }
33
+ /**
34
+ * Create the auth command group.
35
+ */
36
+ export function createAuthCommand() {
37
+ const auth = new Command('auth')
38
+ .description('Authentication commands');
39
+ // e3 auth status - List all saved credentials
40
+ auth
41
+ .command('status')
42
+ .description('List saved credentials')
43
+ .action(() => {
44
+ const creds = listCredentials();
45
+ if (creds.length === 0) {
46
+ console.log('No saved credentials.');
47
+ console.log('Run: e3 login <server>');
48
+ return;
49
+ }
50
+ console.log('Saved credentials:\n');
51
+ for (const { server, expiresAt } of creds) {
52
+ const expired = isExpired(expiresAt);
53
+ const status = expired ? '(expired)' : '(valid)';
54
+ console.log(` ${server} ${status}`);
55
+ console.log(` Token expires: ${expiresAt}`);
56
+ }
57
+ });
58
+ // e3 auth token <server> - Print access token for use with curl
59
+ auth
60
+ .command('token')
61
+ .description('Print access token for a server (for curl/debugging)')
62
+ .argument('<server>', 'Server URL')
63
+ .action(async (server) => {
64
+ const serverUrl = normalizeServerUrl(server);
65
+ try {
66
+ // getValidToken handles refresh automatically if token is expired
67
+ const token = await getValidToken(serverUrl);
68
+ // Print just the token, suitable for: curl -H "Authorization: Bearer $(e3 auth token <server>)"
69
+ console.log(token);
70
+ }
71
+ catch (err) {
72
+ const message = err instanceof Error ? err.message : 'unknown error';
73
+ console.error(message);
74
+ process.exit(1);
75
+ }
76
+ });
77
+ // e3 auth whoami [server] - Show current identity
78
+ auth
79
+ .command('whoami')
80
+ .description('Show current identity')
81
+ .argument('[server]', 'Server URL')
82
+ .action((server) => {
83
+ const creds = listCredentials();
84
+ if (creds.length === 0) {
85
+ console.log('Not logged in to any servers.');
86
+ return;
87
+ }
88
+ const servers = server ? [server] : creds.map((c) => c.server);
89
+ for (const serverUrl of servers) {
90
+ const credential = getCredential(serverUrl);
91
+ if (!credential) {
92
+ console.log(`${serverUrl}: Not logged in`);
93
+ continue;
94
+ }
95
+ try {
96
+ const payload = decodeJwtPayload(credential.accessToken);
97
+ const expired = isExpired(credential.expiresAt);
98
+ const status = expired ? '(token expired)' : '';
99
+ console.log(`${serverUrl}: ${status}`);
100
+ console.log(` Subject: ${payload.sub ?? 'unknown'}`);
101
+ if (payload.email) {
102
+ console.log(` Email: ${payload.email}`);
103
+ }
104
+ console.log(` Issuer: ${payload.iss ?? 'unknown'}`);
105
+ }
106
+ catch {
107
+ console.log(`${serverUrl}: Invalid token`);
108
+ }
109
+ }
110
+ });
111
+ return auth;
112
+ }
113
+ /**
114
+ * Create the login command.
115
+ */
116
+ export function createLoginCommand() {
117
+ return new Command('login')
118
+ .description('Log in to a server using OAuth2 Device Flow')
119
+ .argument('<server>', 'Server URL (e.g., http://localhost:3000)')
120
+ .option('--no-browser', 'Do not open browser (for CI/headless environments)')
121
+ .action(async (server, options) => {
122
+ const serverUrl = normalizeServerUrl(server);
123
+ console.log(`Logging in to ${serverUrl}...`);
124
+ // Fetch OIDC discovery document
125
+ let discovery;
126
+ try {
127
+ discovery = await fetchDiscovery(serverUrl);
128
+ }
129
+ catch (err) {
130
+ const message = err instanceof Error ? err.message : 'unknown error';
131
+ console.error(`Failed to connect to server: ${message}`);
132
+ console.error('Make sure the server is running with --oidc enabled.');
133
+ process.exit(1);
134
+ }
135
+ // Start device authorization
136
+ let deviceAuth;
137
+ try {
138
+ deviceAuth = await startDeviceAuth(discovery);
139
+ }
140
+ catch (err) {
141
+ const message = err instanceof Error ? err.message : 'unknown error';
142
+ console.error(`Failed to start login: ${message}`);
143
+ process.exit(1);
144
+ }
145
+ // Display user code and URL (unless in quiet CI mode)
146
+ if (options.browser) {
147
+ console.log('\nTo complete login:');
148
+ console.log(` 1. Open: ${deviceAuth.verification_uri}`);
149
+ console.log(` 2. Enter code: ${deviceAuth.user_code}`);
150
+ console.log(`\nOr visit this URL directly:`);
151
+ console.log(` ${deviceAuth.verification_uri_complete}`);
152
+ // Try to open browser
153
+ const opened = await openBrowser(deviceAuth.verification_uri_complete);
154
+ if (opened) {
155
+ console.log('\nBrowser opened. Waiting for approval...');
156
+ }
157
+ else {
158
+ console.log('\nWaiting for approval...');
159
+ }
160
+ }
161
+ else {
162
+ console.log('Waiting for server approval (--no-browser mode)...');
163
+ }
164
+ // Poll for tokens
165
+ try {
166
+ const tokens = await pollForTokens(discovery, deviceAuth.device_code, deviceAuth.interval, deviceAuth.expires_in);
167
+ // Save credentials
168
+ const entry = {
169
+ accessToken: tokens.access_token,
170
+ refreshToken: tokens.refresh_token,
171
+ expiresAt: new Date(Date.now() + tokens.expires_in * 1000).toISOString(),
172
+ };
173
+ setCredential(serverUrl, entry);
174
+ // Show identity
175
+ const payload = decodeJwtPayload(tokens.access_token);
176
+ console.log(`\nSuccessfully logged in as: ${payload.sub ?? 'unknown'}`);
177
+ console.log(`Token expires: ${entry.expiresAt}`);
178
+ }
179
+ catch (err) {
180
+ const message = err instanceof Error ? err.message : 'unknown error';
181
+ console.error(`\nLogin failed: ${message}`);
182
+ process.exit(1);
183
+ }
184
+ });
185
+ }
186
+ /**
187
+ * Create the logout command.
188
+ */
189
+ export function createLogoutCommand() {
190
+ return new Command('logout')
191
+ .description('Log out from a server')
192
+ .argument('<server>', 'Server URL')
193
+ .action((server) => {
194
+ const serverUrl = normalizeServerUrl(server);
195
+ const removed = removeCredential(serverUrl);
196
+ if (removed) {
197
+ console.log(`Logged out from ${serverUrl}`);
198
+ }
199
+ else {
200
+ console.log(`Not logged in to ${serverUrl}`);
201
+ }
202
+ });
203
+ }
204
+ //# 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,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,KAAK,UAAU,WAAW,CAAC,GAAW;IACpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IAE7C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,OAAe,CAAC;QACpB,QAAQ,QAAQ,EAAE,EAAE,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,GAAG,SAAS,GAAG,GAAG,CAAC;gBAC1B,MAAM;YACR,KAAK,OAAO;gBACV,OAAO,GAAG,aAAa,GAAG,GAAG,CAAC;gBAC9B,MAAM;YACR;gBACE,OAAO,GAAG,aAAa,GAAG,GAAG,CAAC;QAClC,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACtB,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,CAAC;SAC7B,WAAW,CAAC,yBAAyB,CAAC,CAAC;IAE1C,8CAA8C;IAC9C,IAAI;SACD,OAA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BAAgB,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/get.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;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,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 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);
@@ -1 +1 @@
1
- {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/get.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AO,CAAC,IAAI,CAAC,CAuCnF"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqFnF"}
@@ -10,35 +10,68 @@
10
10
  * e3 list . ws # List root tree of workspace
11
11
  * e3 list . ws.inputs # List fields under inputs
12
12
  */
13
- import { workspaceList, workspaceListTree, workspaceGetState, } from '@elaraai/e3-core';
14
- import { resolveRepo, parseDatasetPath, formatError, exitError } from '../utils.js';
13
+ import { workspaceList, workspaceListTree, workspaceGetState, LocalStorage, } from '@elaraai/e3-core';
14
+ import { workspaceList as workspaceListRemote, datasetList as datasetListRemote, datasetListAt as datasetListAtRemote, } from '@elaraai/e3-api-client';
15
+ import { parseRepoLocation, parseDatasetPath, formatError, exitError } from '../utils.js';
15
16
  /**
16
17
  * List workspaces or tree contents at a path.
17
18
  */
18
19
  export async function listCommand(repoArg, pathSpec) {
19
20
  try {
20
- const repoPath = resolveRepo(repoArg);
21
+ const location = await parseRepoLocation(repoArg);
21
22
  // If no path, list workspaces
22
23
  if (!pathSpec) {
23
- const workspaces = await workspaceList(repoPath);
24
- if (workspaces.length === 0) {
25
- console.log('No workspaces');
26
- return;
24
+ if (location.type === 'local') {
25
+ const storage = new LocalStorage();
26
+ const workspaces = await workspaceList(storage, location.path);
27
+ if (workspaces.length === 0) {
28
+ console.log('No workspaces');
29
+ return;
30
+ }
31
+ for (const ws of workspaces) {
32
+ const state = await workspaceGetState(storage, location.path, ws);
33
+ if (state) {
34
+ console.log(`${ws} (${state.packageName}@${state.packageVersion})`);
35
+ }
36
+ else {
37
+ console.log(`${ws} (not deployed)`);
38
+ }
39
+ }
27
40
  }
28
- for (const ws of workspaces) {
29
- const state = await workspaceGetState(repoPath, ws);
30
- if (state) {
31
- console.log(`${ws} (${state.packageName}@${state.packageVersion})`);
41
+ else {
42
+ // Remote: list workspaces
43
+ const workspaces = await workspaceListRemote(location.baseUrl, location.repo, { token: location.token });
44
+ if (workspaces.length === 0) {
45
+ console.log('No workspaces');
46
+ return;
32
47
  }
33
- else {
34
- console.log(`${ws} (not deployed)`);
48
+ for (const ws of workspaces) {
49
+ if (ws.deployed && ws.packageName.type === 'some' && ws.packageVersion.type === 'some') {
50
+ console.log(`${ws.name} (${ws.packageName.value}@${ws.packageVersion.value})`);
51
+ }
52
+ else {
53
+ console.log(`${ws.name} (not deployed)`);
54
+ }
35
55
  }
36
56
  }
37
57
  return;
38
58
  }
39
59
  // Parse path and list tree contents
40
60
  const { ws, path } = parseDatasetPath(pathSpec);
41
- const fields = await workspaceListTree(repoPath, ws, path);
61
+ let fields;
62
+ if (location.type === 'local') {
63
+ const storage = new LocalStorage();
64
+ fields = await workspaceListTree(storage, location.path, ws, path);
65
+ }
66
+ else {
67
+ // Remote: list tree contents
68
+ if (path.length === 0) {
69
+ fields = await datasetListRemote(location.baseUrl, location.repo, ws, { token: location.token });
70
+ }
71
+ else {
72
+ fields = await datasetListAtRemote(location.baseUrl, location.repo, ws, path, { token: location.token });
73
+ }
74
+ }
42
75
  if (fields.length === 0) {
43
76
  console.log('(empty)');
44
77
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/list.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe,EAAE,QAAiB;IAClE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,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