@elaraai/e3-cli 0.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE.md +50 -0
  2. package/README.md +93 -0
  3. package/dist/src/cli-test-helpers.d.ts +17 -0
  4. package/dist/src/cli-test-helpers.d.ts.map +1 -0
  5. package/dist/src/cli-test-helpers.js +48 -0
  6. package/dist/src/cli-test-helpers.js.map +1 -0
  7. package/dist/src/cli.d.ts +7 -0
  8. package/dist/src/cli.d.ts.map +1 -0
  9. package/dist/src/cli.js +144 -0
  10. package/dist/src/cli.js.map +1 -0
  11. package/dist/src/commands/convert.d.ts +11 -0
  12. package/dist/src/commands/convert.d.ts.map +1 -0
  13. package/dist/src/commands/convert.impl.d.ts +30 -0
  14. package/dist/src/commands/convert.impl.d.ts.map +1 -0
  15. package/dist/src/commands/convert.impl.js +193 -0
  16. package/dist/src/commands/convert.impl.js.map +1 -0
  17. package/dist/src/commands/convert.js +11 -0
  18. package/dist/src/commands/convert.js.map +1 -0
  19. package/dist/src/commands/gc.d.ts +12 -0
  20. package/dist/src/commands/gc.d.ts.map +1 -0
  21. package/dist/src/commands/gc.js +44 -0
  22. package/dist/src/commands/gc.js.map +1 -0
  23. package/dist/src/commands/get.d.ts +11 -0
  24. package/dist/src/commands/get.d.ts.map +1 -0
  25. package/dist/src/commands/get.js +60 -0
  26. package/dist/src/commands/get.js.map +1 -0
  27. package/dist/src/commands/init.d.ts +9 -0
  28. package/dist/src/commands/init.d.ts.map +1 -0
  29. package/dist/src/commands/init.js +33 -0
  30. package/dist/src/commands/init.js.map +1 -0
  31. package/dist/src/commands/list.d.ts +9 -0
  32. package/dist/src/commands/list.d.ts.map +1 -0
  33. package/dist/src/commands/list.js +54 -0
  34. package/dist/src/commands/list.js.map +1 -0
  35. package/dist/src/commands/logs.d.ts +11 -0
  36. package/dist/src/commands/logs.d.ts.map +1 -0
  37. package/dist/src/commands/logs.js +179 -0
  38. package/dist/src/commands/logs.js.map +1 -0
  39. package/dist/src/commands/package.d.ts +23 -0
  40. package/dist/src/commands/package.d.ts.map +1 -0
  41. package/dist/src/commands/package.js +78 -0
  42. package/dist/src/commands/package.js.map +1 -0
  43. package/dist/src/commands/run.d.ts +12 -0
  44. package/dist/src/commands/run.d.ts.map +1 -0
  45. package/dist/src/commands/run.js +99 -0
  46. package/dist/src/commands/run.js.map +1 -0
  47. package/dist/src/commands/set.d.ts +11 -0
  48. package/dist/src/commands/set.d.ts.map +1 -0
  49. package/dist/src/commands/set.js +124 -0
  50. package/dist/src/commands/set.js.map +1 -0
  51. package/dist/src/commands/start.d.ts +13 -0
  52. package/dist/src/commands/start.d.ts.map +1 -0
  53. package/dist/src/commands/start.js +86 -0
  54. package/dist/src/commands/start.js.map +1 -0
  55. package/dist/src/commands/status.d.ts +9 -0
  56. package/dist/src/commands/status.d.ts.map +1 -0
  57. package/dist/src/commands/status.js +58 -0
  58. package/dist/src/commands/status.js.map +1 -0
  59. package/dist/src/commands/workspace.d.ts +30 -0
  60. package/dist/src/commands/workspace.d.ts.map +1 -0
  61. package/dist/src/commands/workspace.js +96 -0
  62. package/dist/src/commands/workspace.js.map +1 -0
  63. package/dist/src/index.d.ts +6 -0
  64. package/dist/src/index.d.ts.map +1 -0
  65. package/dist/src/index.js +6 -0
  66. package/dist/src/index.js.map +1 -0
  67. package/dist/src/utils.d.ts +42 -0
  68. package/dist/src/utils.d.ts.map +1 -0
  69. package/dist/src/utils.js +99 -0
  70. package/dist/src/utils.js.map +1 -0
  71. package/package.json +45 -0
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 run command - Ad-hoc task execution
7
+ *
8
+ * Usage:
9
+ * e3 run . acme-forecast/train ./sales.beast2 -o ./model.beast2
10
+ * e3 run . my-pkg@1.0.0/process ./input1.beast2 ./input2.beast2 -o ./output.beast2
11
+ * e3 run . my-pkg/task ./data.beast2 -o ./out.beast2 --force
12
+ */
13
+ import { readFile, writeFile } from 'fs/promises';
14
+ import { packageRead, objectWrite, objectRead, taskExecute, } from '@elaraai/e3-core';
15
+ import { decodeBeast2 } from '@elaraai/east';
16
+ import { resolveRepo, parsePackageSpec, formatError, exitError } from '../utils.js';
17
+ /**
18
+ * Parse task specifier: pkg/task or pkg@version/task
19
+ */
20
+ function parseTaskSpec(spec) {
21
+ const slashIndex = spec.indexOf('/');
22
+ if (slashIndex === -1) {
23
+ throw new Error(`Invalid task specifier: ${spec}. Expected format: pkg/task or pkg@version/task`);
24
+ }
25
+ const pkgPart = spec.slice(0, slashIndex);
26
+ const task = spec.slice(slashIndex + 1);
27
+ if (!task) {
28
+ throw new Error(`Invalid task specifier: ${spec}. Task name cannot be empty.`);
29
+ }
30
+ const { name, version } = parsePackageSpec(pkgPart);
31
+ return { name, version, task };
32
+ }
33
+ /**
34
+ * Run a task ad-hoc with file inputs and output.
35
+ */
36
+ export async function runCommand(repoArg, taskSpec, inputs, options) {
37
+ try {
38
+ const repoPath = resolveRepo(repoArg);
39
+ // Parse task specifier
40
+ const { name, version, task } = parseTaskSpec(taskSpec);
41
+ // Validate output is provided
42
+ if (!options.output) {
43
+ exitError('Output file is required. Use -o <path> to specify output.');
44
+ }
45
+ // Get package and find task hash
46
+ const pkg = await packageRead(repoPath, name, version);
47
+ const taskHash = pkg.tasks.get(task);
48
+ if (!taskHash) {
49
+ const available = Array.from(pkg.tasks.keys()).join(', ');
50
+ exitError(`Task '${task}' not found in ${name}@${version}. Available: ${available || '(none)'}`);
51
+ }
52
+ console.log(`Running ${name}@${version}/${task}`);
53
+ // Read input files and store as objects
54
+ const inputHashes = [];
55
+ for (const inputPath of inputs) {
56
+ const data = await readFile(inputPath);
57
+ // Verify it's valid beast2 (will throw if not)
58
+ try {
59
+ decodeBeast2(data);
60
+ }
61
+ catch {
62
+ exitError(`Invalid beast2 file: ${inputPath}`);
63
+ }
64
+ const hash = await objectWrite(repoPath, data);
65
+ inputHashes.push(hash);
66
+ console.log(` Input: ${inputPath} -> ${hash.slice(0, 8)}...`);
67
+ }
68
+ // Execute the task
69
+ const startTime = Date.now();
70
+ const result = await taskExecute(repoPath, taskHash, inputHashes, {
71
+ force: options.force,
72
+ });
73
+ const elapsed = Date.now() - startTime;
74
+ if (result.cached) {
75
+ console.log(`Cached (${elapsed}ms)`);
76
+ }
77
+ else {
78
+ console.log(`Done (${elapsed}ms)`);
79
+ }
80
+ // Handle result
81
+ if (result.state === 'success' && result.outputHash) {
82
+ // Read output object and write to file
83
+ const outputData = await objectRead(repoPath, result.outputHash);
84
+ await writeFile(options.output, outputData);
85
+ console.log(`Output: ${options.output}`);
86
+ }
87
+ else if (result.state === 'failed') {
88
+ console.error(`Task failed with exit code: ${result.exitCode}`);
89
+ process.exit(1);
90
+ }
91
+ else if (result.state === 'error') {
92
+ exitError(result.error ?? 'Unknown error');
93
+ }
94
+ }
95
+ catch (err) {
96
+ exitError(formatError(err));
97
+ }
98
+ }
99
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/commands/run.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EACL,WAAW,EAEX,WAAW,EACX,UAAU,EACV,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpF;;GAEG;AACH,SAAS,aAAa,CAAC,IAAY;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,UAAU,KAAK,CAAC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AAC,CAAC;QACrC,CAAC;QAED,gBAAgB;QAChB,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;YACpD,uCAAuC;YACvC,MAAM,UAAU,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;YACjE,MAAM,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,+BAA+B,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;aAAM,IAAI,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YACpC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Set dataset value from a file.
7
+ */
8
+ export declare function setCommand(repoArg: string, pathSpec: string, filePath: string, options?: {
9
+ type?: string;
10
+ }): Promise<void>;
11
+ //# sourceMappingURL=set.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8CH;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9B,OAAO,CAAC,IAAI,CAAC,CAyFf"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 set command - Set dataset value from file
7
+ *
8
+ * Usage:
9
+ * e3 set . ws.path.to.dataset ./data.beast2
10
+ * e3 set . ws.path.to.dataset ./data.east
11
+ * e3 set . ws.path.to.dataset ./data.json --type ".Integer"
12
+ * e3 set . ws.path.to.dataset ./data.csv --type ".Array .Struct [{name: \"name\", type: .String}, {name: \"value\", type: .Integer}]"
13
+ */
14
+ import { readFile } from 'fs/promises';
15
+ import { extname } from 'path';
16
+ import { workspaceSetDataset } from '@elaraai/e3-core';
17
+ import { decodeBeast2, parseFor, fromJSONFor, decodeCsvFor, EastTypeType, parseInferred, toEastTypeValue, } from '@elaraai/east';
18
+ import { resolveRepo, parseDatasetPath, formatError, exitError } from '../utils.js';
19
+ /**
20
+ * Parse a type specification in .east format.
21
+ * Types are represented as EastTypeValue variants.
22
+ *
23
+ * Examples:
24
+ * ".Integer" -> variant("Integer", null)
25
+ * ".Array .Integer" -> variant("Array", variant("Integer", null))
26
+ * ".Struct [{name: \"x\", type: .Integer}]" -> variant("Struct", [{name: "x", type: variant("Integer", null)}])
27
+ */
28
+ function parseTypeSpec(typeSpec) {
29
+ const parser = parseFor(EastTypeType);
30
+ const result = parser(typeSpec);
31
+ if (!result.success) {
32
+ throw new Error(`Invalid type specification: ${result.error}`);
33
+ }
34
+ return result.value;
35
+ }
36
+ /**
37
+ * Set dataset value from a file.
38
+ */
39
+ export async function setCommand(repoArg, pathSpec, filePath, options = {}) {
40
+ try {
41
+ const repoPath = resolveRepo(repoArg);
42
+ const { ws, path } = parseDatasetPath(pathSpec);
43
+ if (path.length === 0) {
44
+ exitError('Path must include at least one field (e.g., ws.field)');
45
+ }
46
+ // Parse type specification if provided
47
+ let providedType;
48
+ if (options.type) {
49
+ providedType = parseTypeSpec(options.type);
50
+ }
51
+ // Read and decode the file based on extension
52
+ const fileContent = await readFile(filePath);
53
+ const ext = extname(filePath).toLowerCase();
54
+ let value;
55
+ let type;
56
+ switch (ext) {
57
+ case '.beast2': {
58
+ // Beast2 is self-describing, type spec is optional (for override)
59
+ const decoded = decodeBeast2(fileContent);
60
+ value = decoded.value;
61
+ type = providedType ?? decoded.type;
62
+ break;
63
+ }
64
+ case '.east': {
65
+ const content = fileContent.toString('utf-8');
66
+ if (providedType) {
67
+ // Parse with provided type for stricter validation
68
+ const parser = parseFor(providedType);
69
+ const result = parser(content);
70
+ if (!result.success) {
71
+ exitError(`Failed to parse .east file: ${result.error}`);
72
+ }
73
+ value = result.value;
74
+ type = providedType;
75
+ }
76
+ else {
77
+ // Use parseInferred for type inference from .east syntax
78
+ const [parsedType, parsedValue] = parseInferred(content);
79
+ // parseInferred returns EastType, but we need EastTypeValue
80
+ // Use toEastTypeValue to convert
81
+ value = parsedValue;
82
+ type = toEastTypeValue(parsedType);
83
+ }
84
+ break;
85
+ }
86
+ case '.json': {
87
+ if (!providedType) {
88
+ exitError('JSON files require --type flag. Example: --type ".Integer"');
89
+ }
90
+ const content = fileContent.toString('utf-8');
91
+ const jsonValue = JSON.parse(content);
92
+ const fromJSON = fromJSONFor(providedType);
93
+ value = fromJSON(jsonValue);
94
+ type = providedType;
95
+ break;
96
+ }
97
+ case '.csv': {
98
+ if (!providedType) {
99
+ exitError('CSV files require --type flag. Example: --type ".Array .Struct [{name: \\"name\\", type: .String}]"');
100
+ }
101
+ // CSV expects .Array .Struct [...] - check the variant type
102
+ if (providedType.type !== 'Array') {
103
+ exitError('CSV files require an Array type. Example: --type ".Array .Struct [...]"');
104
+ }
105
+ const elementType = providedType.value;
106
+ if (elementType.type !== 'Struct') {
107
+ exitError('CSV files require Array of Struct type. Example: --type ".Array .Struct [{name: \\"x\\", type: .Integer}]"');
108
+ }
109
+ const decoder = decodeCsvFor(elementType);
110
+ value = decoder(fileContent);
111
+ type = providedType;
112
+ break;
113
+ }
114
+ default:
115
+ exitError(`Unknown file extension: ${ext}. Supported: .beast2, .east, .json, .csv`);
116
+ }
117
+ await workspaceSetDataset(repoPath, ws, path, value, type);
118
+ console.log(`Set ${pathSpec} from ${filePath}`);
119
+ }
120
+ catch (err) {
121
+ exitError(formatError(err));
122
+ }
123
+ }
124
+ //# sourceMappingURL=set.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set.js","sourceRoot":"","sources":["../../../src/commands/set.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,YAAY,EAGZ,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpF;;;;;;;;GAQG;AACH,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,MAAM,CAAC,KAAsB,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAe,E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,CAAC,CAAC;gBAC1H,CAAC;gBACD,MAAM,OAAO,GAAG,YAAY,CAAC,WAA8B,CAAC,CAAC;gBAC7D,KAAK,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;gBAC7B,IAAI,GAAG,YAAY,CAAC;gBACpB,MAAM;YACR,CAAC;YACD;gBACE,SAAS,CAAC,2BAA2B,GAAG,0CAA0C,CAAC,CAAC;QACxF,CAAC;QAED,MAAM,mBAAmB,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAE3D,OAAO,CAAC,GAAG,CAAC,OAAO,QAAQ,SAAS,QAAQ,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Execute tasks in a workspace.
7
+ */
8
+ export declare function startCommand(repoArg: string, ws: string, options: {
9
+ filter?: string;
10
+ concurrency?: string;
11
+ force?: boolean;
12
+ }): Promise<void>;
13
+ //# sourceMappingURL=start.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;GAEG;AACH,wBAAsB,YAAY,CAChC,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAClE,OAAO,CAAC,IAAI,CAAC,CAuDf"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 start command - Execute tasks in a workspace
7
+ *
8
+ * Usage:
9
+ * e3 start . my-workspace
10
+ * e3 start . my-workspace --concurrency 2
11
+ * e3 start . my-workspace --force
12
+ */
13
+ import { dataflowExecute } from '@elaraai/e3-core';
14
+ import { resolveRepo, formatError, exitError } from '../utils.js';
15
+ /**
16
+ * Execute tasks in a workspace.
17
+ */
18
+ export async function startCommand(repoArg, ws, options) {
19
+ try {
20
+ const repoPath = resolveRepo(repoArg);
21
+ const concurrency = options.concurrency ? parseInt(options.concurrency, 10) : 4;
22
+ console.log(`Starting tasks in workspace: ${ws}`);
23
+ if (options.filter) {
24
+ console.log(`Filter: ${options.filter}`);
25
+ }
26
+ console.log(`Concurrency: ${concurrency}`);
27
+ if (options.force) {
28
+ console.log('Force: re-executing all tasks');
29
+ }
30
+ console.log('');
31
+ const result = await dataflowExecute(repoPath, ws, {
32
+ concurrency,
33
+ force: options.force,
34
+ filter: options.filter,
35
+ onTaskStart: (name) => {
36
+ console.log(` [START] ${name}`);
37
+ },
38
+ onTaskComplete: (taskResult) => {
39
+ const status = formatTaskStatus(taskResult);
40
+ const cached = taskResult.cached ? ' (cached)' : '';
41
+ const duration = taskResult.duration > 0 ? ` [${taskResult.duration}ms]` : '';
42
+ console.log(` [${status}] ${taskResult.name}${cached}${duration}`);
43
+ },
44
+ });
45
+ console.log('');
46
+ console.log('Summary:');
47
+ console.log(` Executed: ${result.executed}`);
48
+ console.log(` Cached: ${result.cached}`);
49
+ console.log(` Failed: ${result.failed}`);
50
+ console.log(` Skipped: ${result.skipped}`);
51
+ console.log(` Duration: ${result.duration}ms`);
52
+ if (!result.success) {
53
+ console.log('');
54
+ console.log('Failed tasks:');
55
+ for (const task of result.tasks) {
56
+ if (task.state === 'failed') {
57
+ const exitInfo = task.exitCode != null ? `exit code ${task.exitCode}` : 'spawn failed';
58
+ const errorInfo = task.error ? ` - ${task.error}` : '';
59
+ console.log(` ${task.name}: ${exitInfo}${errorInfo}`);
60
+ }
61
+ else if (task.state === 'error') {
62
+ console.log(` ${task.name}: ${task.error}`);
63
+ }
64
+ }
65
+ process.exit(1);
66
+ }
67
+ }
68
+ catch (err) {
69
+ exitError(formatError(err));
70
+ }
71
+ }
72
+ function formatTaskStatus(result) {
73
+ switch (result.state) {
74
+ case 'success':
75
+ return 'DONE';
76
+ case 'failed':
77
+ return 'FAIL';
78
+ case 'error':
79
+ return 'ERR';
80
+ case 'skipped':
81
+ return 'SKIP';
82
+ default:
83
+ return '???';
84
+ }
85
+ }
86
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAA4B,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,OAAe,EACf,EAAU,EACV,OAAmE;IAEnE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhF,OAAO,CAAC,GAAG,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;QAClD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,gBAAgB,WAAW,EAAE,CAAC,CAAC;QAC3C,IAAI,OAAO,CAAC,KA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X,OAAO,MAAM,CAAC;QAChB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,SAAS;YACZ,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * Show repository status.
7
+ */
8
+ export declare function statusCommand(repoArg: string): Promise<void>;
9
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwClE"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 status command - Show repository status
7
+ *
8
+ * Usage:
9
+ * e3 status .
10
+ */
11
+ import { packageList, workspaceList, workspaceGetState, } from '@elaraai/e3-core';
12
+ import { resolveRepo, formatError, exitError } from '../utils.js';
13
+ /**
14
+ * Show repository status.
15
+ */
16
+ export async function statusCommand(repoArg) {
17
+ try {
18
+ const repoPath = resolveRepo(repoArg);
19
+ console.log(`Repository: ${repoPath}`);
20
+ console.log('');
21
+ // List packages
22
+ const packages = await packageList(repoPath);
23
+ console.log('Packages:');
24
+ if (packages.length === 0) {
25
+ console.log(' (none)');
26
+ }
27
+ else {
28
+ for (const pkg of packages) {
29
+ console.log(` ${pkg.name}@${pkg.version}`);
30
+ }
31
+ }
32
+ console.log('');
33
+ // List workspaces with status
34
+ const workspaces = await workspaceList(repoPath);
35
+ console.log('Workspaces:');
36
+ if (workspaces.length === 0) {
37
+ console.log(' (none)');
38
+ }
39
+ else {
40
+ for (const ws of workspaces) {
41
+ const state = await workspaceGetState(repoPath, ws);
42
+ if (state) {
43
+ console.log(` ${ws}`);
44
+ console.log(` Package: ${state.packageName}@${state.packageVersion}`);
45
+ console.log(` Deployed: ${state.deployedAt.toISOString()}`);
46
+ console.log(` Updated: ${state.rootUpdatedAt.toISOString()}`);
47
+ }
48
+ else {
49
+ console.log(` ${ws} (not deployed)`);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ catch (err) {
55
+ exitError(formatError(err));
56
+ }
57
+ }
58
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AAEH,OAAO,EACL,WAAW,EACX,aAAa,EACb,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAElE;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QAEtC,OAAO,CAAC,GAAG,CAAC,eAAe,QAAQ,EAAE,CAAC,CAAC;QACvC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAEhB,gBAAgB;QAChB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;gBAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG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ENSE for details.
4
+ */
5
+ export declare const workspaceCommand: {
6
+ /**
7
+ * Create an empty workspace.
8
+ */
9
+ create(repoArg: string, name: string): Promise<void>;
10
+ /**
11
+ * Deploy a package to a workspace.
12
+ */
13
+ deploy(repoArg: string, ws: string, pkgSpec: string): Promise<void>;
14
+ /**
15
+ * Export workspace as a package.
16
+ */
17
+ export(repoArg: string, ws: string, zipPath: string, options: {
18
+ name?: string;
19
+ version?: string;
20
+ }): Promise<void>;
21
+ /**
22
+ * List workspaces.
23
+ */
24
+ list(repoArg: string): Promise<void>;
25
+ /**
26
+ * Remove a workspace.
27
+ */
28
+ remove(repoArg: string, ws: string): Promise<void>;
29
+ };
30
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,eAAO,MAAM,gBAAgB;IAC3B;;OAEG;oBACmB,MAAM,QAAQ,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1D;;OAEG;oBACmB,MAAM,MAAM,MAAM,WAAW,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAazE;;OAEG;oBAEQ,MAAM,MACX,MAAM,WACD,MAAM,WACN;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3C,OAAO,CAAC,IAAI,CAAC;IAchB;;OAEG;kBACiB,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1C;;OAEG;oBACmB,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAWzD,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * e3 workspace commands - Workspace management
7
+ */
8
+ import { workspaceCreate, workspaceDeploy, workspaceExport, workspaceList, workspaceRemove, workspaceGetState, } from '@elaraai/e3-core';
9
+ import { resolveRepo, parsePackageSpec, formatError, exitError } from '../utils.js';
10
+ export const workspaceCommand = {
11
+ /**
12
+ * Create an empty workspace.
13
+ */
14
+ async create(repoArg, name) {
15
+ try {
16
+ const repoPath = resolveRepo(repoArg);
17
+ await workspaceCreate(repoPath, name);
18
+ console.log(`Created workspace: ${name}`);
19
+ console.log('Deploy a package with: e3 workspace deploy <repo> <ws> <pkg>[@<ver>]');
20
+ }
21
+ catch (err) {
22
+ exitError(formatError(err));
23
+ }
24
+ },
25
+ /**
26
+ * Deploy a package to a workspace.
27
+ */
28
+ async deploy(repoArg, ws, pkgSpec) {
29
+ try {
30
+ const repoPath = resolveRepo(repoArg);
31
+ const { name, version } = parsePackageSpec(pkgSpec);
32
+ await workspaceDeploy(repoPath, ws, name, version);
33
+ console.log(`Deployed ${name}@${version} to workspace: ${ws}`);
34
+ }
35
+ catch (err) {
36
+ exitError(formatError(err));
37
+ }
38
+ },
39
+ /**
40
+ * Export workspace as a package.
41
+ */
42
+ async export(repoArg, ws, zipPath, options) {
43
+ try {
44
+ const repoPath = resolveRepo(repoArg);
45
+ const result = await workspaceExport(repoPath, ws, zipPath, options.name, options.version);
46
+ console.log(`Exported workspace ${ws} as ${result.name}@${result.version}`);
47
+ console.log(` Output: ${zipPath}`);
48
+ console.log(` Package hash: ${result.packageHash.slice(0, 12)}...`);
49
+ console.log(` Objects: ${result.objectCount}`);
50
+ }
51
+ catch (err) {
52
+ exitError(formatError(err));
53
+ }
54
+ },
55
+ /**
56
+ * List workspaces.
57
+ */
58
+ async list(repoArg) {
59
+ try {
60
+ const repoPath = resolveRepo(repoArg);
61
+ const workspaces = await workspaceList(repoPath);
62
+ if (workspaces.length === 0) {
63
+ console.log('No workspaces');
64
+ return;
65
+ }
66
+ console.log('Workspaces:');
67
+ for (const ws of workspaces) {
68
+ const state = await workspaceGetState(repoPath, ws);
69
+ if (state) {
70
+ console.log(` ${ws} (${state.packageName}@${state.packageVersion})`);
71
+ }
72
+ else {
73
+ console.log(` ${ws} (not deployed)`);
74
+ }
75
+ }
76
+ }
77
+ catch (err) {
78
+ exitError(formatError(err));
79
+ }
80
+ },
81
+ /**
82
+ * Remove a workspace.
83
+ */
84
+ async remove(repoArg, ws) {
85
+ try {
86
+ const repoPath = resolveRepo(repoArg);
87
+ await workspaceRemove(repoPath, ws);
88
+ console.log(`Removed workspace: ${ws}`);
89
+ console.log('Run `e3 gc` to reclaim disk space');
90
+ }
91
+ catch (err) {
92
+ exitError(formatError(err));
93
+ }
94
+ },
95
+ };
96
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../src/commands/workspace.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEpF,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,IAAY;QACxC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,eAAe,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YAEtC,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC;YAC1C,OAAO,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC;QACtF,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,E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,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { type TreePath } from '@elaraai/e3-types';
6
+ /**
7
+ * Resolve repository path from CLI argument.
8
+ * Supports `.` for current directory and relative/absolute paths.
9
+ */
10
+ export declare function resolveRepo(repoArg: string): string;
11
+ /**
12
+ * Parse package specification: name[@version]
13
+ * Returns { name, version } where version defaults to 'latest' if not specified.
14
+ */
15
+ export declare function parsePackageSpec(spec: string): {
16
+ name: string;
17
+ version: string;
18
+ };
19
+ /**
20
+ * Parse workspace.path.to.dataset syntax into workspace name and TreePath.
21
+ *
22
+ * Examples:
23
+ * "production" -> { ws: "production", path: [] }
24
+ * "production.inputs" -> { ws: "production", path: [field("inputs")] }
25
+ * "production.inputs.sales" -> { ws: "production", path: [field("inputs"), field("sales")] }
26
+ *
27
+ * For field names with special characters, use backticks:
28
+ * "production.`my field`" -> { ws: "production", path: [field("my field")] }
29
+ */
30
+ export declare function parseDatasetPath(pathSpec: string): {
31
+ ws: string;
32
+ path: TreePath;
33
+ };
34
+ /**
35
+ * Format error for CLI output.
36
+ */
37
+ export declare function formatError(err: unknown): string;
38
+ /**
39
+ * Exit with error message.
40
+ */
41
+ export declare function exitError(message: string): never;
42
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,mBAAmB,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAShF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAWjF;AAoCD;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAKhD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAGhD"}