@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.
- package/LICENSE.md +50 -0
- package/README.md +93 -0
- package/dist/src/cli-test-helpers.d.ts +17 -0
- package/dist/src/cli-test-helpers.d.ts.map +1 -0
- package/dist/src/cli-test-helpers.js +48 -0
- package/dist/src/cli-test-helpers.js.map +1 -0
- package/dist/src/cli.d.ts +7 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +144 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/commands/convert.d.ts +11 -0
- package/dist/src/commands/convert.d.ts.map +1 -0
- package/dist/src/commands/convert.impl.d.ts +30 -0
- package/dist/src/commands/convert.impl.d.ts.map +1 -0
- package/dist/src/commands/convert.impl.js +193 -0
- package/dist/src/commands/convert.impl.js.map +1 -0
- package/dist/src/commands/convert.js +11 -0
- package/dist/src/commands/convert.js.map +1 -0
- package/dist/src/commands/gc.d.ts +12 -0
- package/dist/src/commands/gc.d.ts.map +1 -0
- package/dist/src/commands/gc.js +44 -0
- package/dist/src/commands/gc.js.map +1 -0
- package/dist/src/commands/get.d.ts +11 -0
- package/dist/src/commands/get.d.ts.map +1 -0
- package/dist/src/commands/get.js +60 -0
- package/dist/src/commands/get.js.map +1 -0
- package/dist/src/commands/init.d.ts +9 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +33 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/list.d.ts +9 -0
- package/dist/src/commands/list.d.ts.map +1 -0
- package/dist/src/commands/list.js +54 -0
- package/dist/src/commands/list.js.map +1 -0
- package/dist/src/commands/logs.d.ts +11 -0
- package/dist/src/commands/logs.d.ts.map +1 -0
- package/dist/src/commands/logs.js +179 -0
- package/dist/src/commands/logs.js.map +1 -0
- package/dist/src/commands/package.d.ts +23 -0
- package/dist/src/commands/package.d.ts.map +1 -0
- package/dist/src/commands/package.js +78 -0
- package/dist/src/commands/package.js.map +1 -0
- package/dist/src/commands/run.d.ts +12 -0
- package/dist/src/commands/run.d.ts.map +1 -0
- package/dist/src/commands/run.js +99 -0
- package/dist/src/commands/run.js.map +1 -0
- package/dist/src/commands/set.d.ts +11 -0
- package/dist/src/commands/set.d.ts.map +1 -0
- package/dist/src/commands/set.js +124 -0
- package/dist/src/commands/set.js.map +1 -0
- package/dist/src/commands/start.d.ts +13 -0
- package/dist/src/commands/start.d.ts.map +1 -0
- package/dist/src/commands/start.js +86 -0
- package/dist/src/commands/start.js.map +1 -0
- package/dist/src/commands/status.d.ts +9 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +58 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/workspace.d.ts +30 -0
- package/dist/src/commands/workspace.d.ts.map +1 -0
- package/dist/src/commands/workspace.js +96 -0
- package/dist/src/commands/workspace.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/utils.d.ts +42 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +99 -0
- package/dist/src/utils.js.map +1 -0
- 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
|
+
* CLI utilities for path parsing and resolution
|
|
7
|
+
*/
|
|
8
|
+
import { resolve } from 'path';
|
|
9
|
+
import { repoGet } from '@elaraai/e3-core';
|
|
10
|
+
import { variant } from '@elaraai/east';
|
|
11
|
+
/**
|
|
12
|
+
* Resolve repository path from CLI argument.
|
|
13
|
+
* Supports `.` for current directory and relative/absolute paths.
|
|
14
|
+
*/
|
|
15
|
+
export function resolveRepo(repoArg) {
|
|
16
|
+
const absolutePath = resolve(repoArg);
|
|
17
|
+
return repoGet(absolutePath);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parse package specification: name[@version]
|
|
21
|
+
* Returns { name, version } where version defaults to 'latest' if not specified.
|
|
22
|
+
*/
|
|
23
|
+
export function parsePackageSpec(spec) {
|
|
24
|
+
const atIndex = spec.lastIndexOf('@');
|
|
25
|
+
if (atIndex > 0) {
|
|
26
|
+
return {
|
|
27
|
+
name: spec.slice(0, atIndex),
|
|
28
|
+
version: spec.slice(atIndex + 1),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return { name: spec, version: 'latest' };
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Parse workspace.path.to.dataset syntax into workspace name and TreePath.
|
|
35
|
+
*
|
|
36
|
+
* Examples:
|
|
37
|
+
* "production" -> { ws: "production", path: [] }
|
|
38
|
+
* "production.inputs" -> { ws: "production", path: [field("inputs")] }
|
|
39
|
+
* "production.inputs.sales" -> { ws: "production", path: [field("inputs"), field("sales")] }
|
|
40
|
+
*
|
|
41
|
+
* For field names with special characters, use backticks:
|
|
42
|
+
* "production.`my field`" -> { ws: "production", path: [field("my field")] }
|
|
43
|
+
*/
|
|
44
|
+
export function parseDatasetPath(pathSpec) {
|
|
45
|
+
const segments = parsePathSegments(pathSpec);
|
|
46
|
+
if (segments.length === 0) {
|
|
47
|
+
throw new Error('Path cannot be empty');
|
|
48
|
+
}
|
|
49
|
+
const ws = segments[0];
|
|
50
|
+
const path = segments.slice(1).map((s) => variant('field', s));
|
|
51
|
+
return { ws, path };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parse dot-separated path into segments, handling backtick-quoted identifiers.
|
|
55
|
+
*/
|
|
56
|
+
function parsePathSegments(pathSpec) {
|
|
57
|
+
const segments = [];
|
|
58
|
+
let current = '';
|
|
59
|
+
let inBackticks = false;
|
|
60
|
+
for (let i = 0; i < pathSpec.length; i++) {
|
|
61
|
+
const char = pathSpec[i];
|
|
62
|
+
if (char === '`') {
|
|
63
|
+
inBackticks = !inBackticks;
|
|
64
|
+
}
|
|
65
|
+
else if (char === '.' && !inBackticks) {
|
|
66
|
+
if (current.length > 0) {
|
|
67
|
+
segments.push(current);
|
|
68
|
+
current = '';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
current += char;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (current.length > 0) {
|
|
76
|
+
segments.push(current);
|
|
77
|
+
}
|
|
78
|
+
if (inBackticks) {
|
|
79
|
+
throw new Error('Unclosed backtick in path');
|
|
80
|
+
}
|
|
81
|
+
return segments;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Format error for CLI output.
|
|
85
|
+
*/
|
|
86
|
+
export function formatError(err) {
|
|
87
|
+
if (err instanceof Error) {
|
|
88
|
+
return err.message;
|
|
89
|
+
}
|
|
90
|
+
return String(err);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Exit with error message.
|
|
94
|
+
*/
|
|
95
|
+
export function exitError(message) {
|
|
96
|
+
console.error(`Error: ${message}`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;AAC/B,CA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C,CAAC,CAAC;QAEzB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;YACjB,WAAW,GAAG,CAAC,WAAW,CAAC;QAC7B,CAAC;aAAM,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACxC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACvB,OAAO,GAAG,EAAE,CAAC;YACf,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,IAAI,CAAC;QAClB,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY;IACtC,IAAI,GAAG,YAAY,KAAK,EAAE,CAAC;QACzB,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,KAAK,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elaraai/e3-cli",
|
|
3
|
+
"version": "0.0.1-beta.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "East Execution Engine CLI - Command-line tool for managing e3 repositories and tasks",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"types": "dist/src/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"e3": "./dist/src/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/src",
|
|
13
|
+
"!dist/src/**/*.spec.*",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc --build",
|
|
19
|
+
"test": "npm run build && node --enable-source-maps --test 'dist/src/**/*.spec.js'",
|
|
20
|
+
"lint": "eslint .",
|
|
21
|
+
"lint:fix": "eslint . --fix",
|
|
22
|
+
"dev": "npm run build && node --enable-source-maps dist/src/cli.js"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"east",
|
|
26
|
+
"e3",
|
|
27
|
+
"cli",
|
|
28
|
+
"execution-engine"
|
|
29
|
+
],
|
|
30
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@elaraai/e3-core": "*",
|
|
33
|
+
"@elaraai/e3-types": "*",
|
|
34
|
+
"@elaraai/east": "0.0.1-beta.11",
|
|
35
|
+
"commander": "^12.0.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "^22.0.0",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^8.47.0",
|
|
40
|
+
"@typescript-eslint/parser": "^8.47.0",
|
|
41
|
+
"eslint": "^9.0.0",
|
|
42
|
+
"eslint-plugin-headers": "^1.3.3",
|
|
43
|
+
"typescript": "^5.6.0"
|
|
44
|
+
}
|
|
45
|
+
}
|