@yamo/cli 1.3.12 → 1.3.14
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/README.md +62 -1
- package/dist/commands/audit.js +67 -0
- package/dist/commands/bridge.js +116 -0
- package/dist/commands/config.js +74 -0
- package/dist/commands/download-bundle.js +87 -0
- package/dist/commands/hash.js +29 -0
- package/dist/commands/init.js +38 -0
- package/dist/commands/submit.js +174 -0
- package/dist/index.js +57 -322
- package/dist/interfaces.js +2 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/config.js +67 -0
- package/dist/utils/constants.js +13 -0
- package/dist/utils/format.js +43 -0
- package/dist/utils/spinner.js +38 -0
- package/dist/utils/storage.js +69 -0
- package/dist/utils/validation.js +39 -0
- package/package.json +23 -7
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateBytes32 = validateBytes32;
|
|
4
|
+
exports.validateBlockId = validateBlockId;
|
|
5
|
+
exports.validateArtifactPath = validateArtifactPath;
|
|
6
|
+
const constants_js_1 = require("./constants.js");
|
|
7
|
+
/**
|
|
8
|
+
* Validates bytes32 hash format (0x + 64 hex characters).
|
|
9
|
+
* @param hash - Hash string to validate
|
|
10
|
+
* @returns True if valid bytes32 format
|
|
11
|
+
*/
|
|
12
|
+
function validateBytes32(hash) {
|
|
13
|
+
return constants_js_1.CONSTANTS.HASH_PATTERN.test(hash);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Validates YAMO block ID format (origin_workflow).
|
|
17
|
+
* Enforces alphanumeric characters and a single underscore.
|
|
18
|
+
* @param blockId - Block identifier to validate
|
|
19
|
+
* @returns True if valid format
|
|
20
|
+
*/
|
|
21
|
+
function validateBlockId(blockId) {
|
|
22
|
+
const pattern = /^[a-z0-9]+_[a-z0-9]+$/i;
|
|
23
|
+
return pattern.test(blockId);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Validates artifact path for security (no path traversal).
|
|
27
|
+
* @param artifactName - Artifact name from YAMO file
|
|
28
|
+
* @param artifactPath - Resolved artifact path
|
|
29
|
+
* @param inputDir - Directory of YAMO file
|
|
30
|
+
* @throws Error if path is unsafe
|
|
31
|
+
*/
|
|
32
|
+
function validateArtifactPath(artifactName, artifactPath, inputDir) {
|
|
33
|
+
if (artifactName.includes('..') || artifactName.startsWith('/')) {
|
|
34
|
+
throw new Error(`Invalid artifact name: ${artifactName}. Path traversal attempts are blocked for security.`);
|
|
35
|
+
}
|
|
36
|
+
if (!artifactPath.startsWith(inputDir)) {
|
|
37
|
+
throw new Error(`Artifact path outside allowed directory: ${artifactName}. Only artifacts in the same directory or subdirectories are allowed.`);
|
|
38
|
+
}
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yamo/cli",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.14",
|
|
4
|
+
"engines": {
|
|
5
|
+
"node": ">=20.0.0"
|
|
6
|
+
},
|
|
4
7
|
"description": "YAMO Protocol v0.4 - Command-line tools for blockchain integration",
|
|
5
8
|
"main": "dist/index.js",
|
|
6
9
|
"type": "commonjs",
|
|
@@ -17,8 +20,12 @@
|
|
|
17
20
|
"build": "tsc && chmod +x dist/index.js",
|
|
18
21
|
"prepublishOnly": "npm run build",
|
|
19
22
|
"start": "node dist/index.js",
|
|
20
|
-
"test": "node --test test
|
|
21
|
-
"test:security": "node --test test/security.test.js"
|
|
23
|
+
"test": "node --test 'test/*.test.js' 'test/e2e/*.test.js'",
|
|
24
|
+
"test:security": "node --test test/security.test.js",
|
|
25
|
+
"lint": "eslint src",
|
|
26
|
+
"lint:fix": "eslint src --fix",
|
|
27
|
+
"format": "prettier --write src/**/*.ts",
|
|
28
|
+
"format:check": "prettier --check src/**/*.ts"
|
|
22
29
|
},
|
|
23
30
|
"keywords": [
|
|
24
31
|
"yamo",
|
|
@@ -38,16 +45,25 @@
|
|
|
38
45
|
"homepage": "https://github.com/yamo-protocol/yamo-cli#readme",
|
|
39
46
|
"devDependencies": {
|
|
40
47
|
"@types/form-data": "^2.2.1",
|
|
41
|
-
"@types/
|
|
48
|
+
"@types/inquirer": "^9.0.7",
|
|
49
|
+
"@types/node": "^25.0.8",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.53.0",
|
|
51
|
+
"@typescript-eslint/parser": "^8.53.0",
|
|
52
|
+
"eslint": "^9.39.2",
|
|
53
|
+
"eslint-config-prettier": "^9.1.2",
|
|
54
|
+
"globals": "^17.0.0",
|
|
55
|
+
"prettier": "^3.8.0",
|
|
42
56
|
"ts-node": "^10.9.2",
|
|
43
57
|
"typescript": "^5.9.3"
|
|
44
58
|
},
|
|
45
59
|
"dependencies": {
|
|
46
|
-
"@yamo/core": "^1.2.
|
|
60
|
+
"@yamo/core": "^1.2.15",
|
|
47
61
|
"axios": "^1.13.2",
|
|
48
62
|
"chalk": "^4.1.2",
|
|
49
|
-
"commander": "^
|
|
63
|
+
"commander": "^14.0.2",
|
|
50
64
|
"dotenv": "^17.2.3",
|
|
51
|
-
"form-data": "^4.0.5"
|
|
65
|
+
"form-data": "^4.0.5",
|
|
66
|
+
"inquirer": "^9.2.12",
|
|
67
|
+
"ora": "^5.4.1"
|
|
52
68
|
}
|
|
53
69
|
}
|