Compare commits

...

3 Commits

Author SHA1 Message Date
e925828328 Formatting pass 2025-05-17 01:24:03 -05:00
136b3e386c Configure eslint and prettier 2025-05-17 01:23:36 -05:00
23a242fc16 Remove unused constant 2025-05-17 01:22:59 -05:00
13 changed files with 778 additions and 413 deletions

11
.prettierrc.json Normal file
View File

@ -0,0 +1,11 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 80,
"tabWidth": 2,
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf"
}

233
bun.lock
View File

@ -4,10 +4,15 @@
"": {
"name": "cli-framework",
"devDependencies": {
"@eslint/js": "^9.27.0",
"@maxmorozoff/try-catch-tuple": "^0.1.2",
"@maxmorozoff/try-catch-tuple-ts-plugin": "^0.0.1",
"@types/bun": "latest",
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"globals": "^16.1.0",
"ts-patch": "^3.3.0",
"typescript-eslint": "^8.32.1",
},
"peerDependencies": {
"typescript": "^5.8.3",
@ -15,62 +20,286 @@
},
},
"packages": {
"@eslint-community/eslint-utils": ["@eslint-community/eslint-utils@4.7.0", "", { "dependencies": { "eslint-visitor-keys": "^3.4.3" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw=="],
"@eslint-community/regexpp": ["@eslint-community/regexpp@4.12.1", "", {}, "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ=="],
"@eslint/config-array": ["@eslint/config-array@0.20.0", "", { "dependencies": { "@eslint/object-schema": "^2.1.6", "debug": "^4.3.1", "minimatch": "^3.1.2" } }, "sha512-fxlS1kkIjx8+vy2SjuCB94q3htSNrufYTXubwiBFeaQHbH6Ipi43gFJq2zCMt6PHhImH3Xmr0NksKDvchWlpQQ=="],
"@eslint/config-helpers": ["@eslint/config-helpers@0.2.2", "", {}, "sha512-+GPzk8PlG0sPpzdU5ZvIRMPidzAnZDl/s9L+y13iodqvb8leL53bTannOrQ/Im7UkpsmFU5Ily5U60LWixnmLg=="],
"@eslint/core": ["@eslint/core@0.14.0", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-qIbV0/JZr7iSDjqAc60IqbLdsj9GDt16xQtWD+B78d/HAlvysGdZZ6rpJHGAc2T0FQx1X6thsSPdnoiGKdNtdg=="],
"@eslint/eslintrc": ["@eslint/eslintrc@3.3.1", "", { "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" } }, "sha512-gtF186CXhIl1p4pJNGZw8Yc6RlshoePRvE0X91oPGb3vZ8pM3qOS9W9NGPat9LziaBV7XrJWGylNQXkGcnM3IQ=="],
"@eslint/js": ["@eslint/js@9.27.0", "", {}, "sha512-G5JD9Tu5HJEu4z2Uo4aHY2sLV64B7CDMXxFzqzjl3NKd6RVzSXNoE80jk7Y0lJkTTkjiIhBAqmlYwjuBY3tvpA=="],
"@eslint/object-schema": ["@eslint/object-schema@2.1.6", "", {}, "sha512-RBMg5FRL0I0gs51M/guSAj5/e14VQ4tpZnQNWwuDT66P14I43ItmPfIZRhO9fUVIPOAQXU47atlywZ/czoqFPA=="],
"@eslint/plugin-kit": ["@eslint/plugin-kit@0.3.1", "", { "dependencies": { "@eslint/core": "^0.14.0", "levn": "^0.4.1" } }, "sha512-0J+zgWxHN+xXONWIyPWKFMgVuJoZuGiIFu8yxk7RJjxkzpGmyja5wRFqZIVtjDVOQpV+Rw0iOAjYPE2eQyjr0w=="],
"@humanfs/core": ["@humanfs/core@0.19.1", "", {}, "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA=="],
"@humanfs/node": ["@humanfs/node@0.16.6", "", { "dependencies": { "@humanfs/core": "^0.19.1", "@humanwhocodes/retry": "^0.3.0" } }, "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw=="],
"@humanwhocodes/module-importer": ["@humanwhocodes/module-importer@1.0.1", "", {}, "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA=="],
"@humanwhocodes/retry": ["@humanwhocodes/retry@0.4.3", "", {}, "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ=="],
"@maxmorozoff/try-catch-tuple": ["@maxmorozoff/try-catch-tuple@0.1.2", "", { "peerDependencies": { "typescript": "^5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-stFwucLpAkJPkLIlBGsXB/Q9A3kSTFoioqqlz7V5r6pwsysQ1/+vpVKEutmbjSztoIOdy+iTn/iSSKyJXb+ebQ=="],
"@maxmorozoff/try-catch-tuple-ts-plugin": ["@maxmorozoff/try-catch-tuple-ts-plugin@0.0.1", "", { "peerDependencies": { "ts-patch": "^3.3.0", "typescript": "^5.0.0" }, "optionalPeers": ["ts-patch"] }, "sha512-OeQpI8YfkuB1gFXSCyogsllfoMmEYnZvIRsSV+MWOxk/amrpA4rKjpbmqaHpVVo3YKFLqTLB8RLDFgVkoWBGhQ=="],
"@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="],
"@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="],
"@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="],
"@types/bun": ["@types/bun@1.2.13", "", { "dependencies": { "bun-types": "1.2.13" } }, "sha512-u6vXep/i9VBxoJl3GjZsl/BFIsvML8DfVDO0RYLEwtSZSp981kEO1V5NwRcO1CPJ7AmvpbnDCiMKo3JvbDEjAg=="],
"@types/estree": ["@types/estree@1.0.7", "", {}, "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ=="],
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
"@types/node": ["@types/node@22.14.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-u0HuPQwe/dHrItgHHpmw3N2fYCR6x4ivMNbPHRkBVP4CvN+kiRrKHWk3i8tXiO/joPwXLMYvF9TTF0eqgHIuOw=="],
"@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.32.1", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.32.1", "@typescript-eslint/type-utils": "8.32.1", "@typescript-eslint/utils": "8.32.1", "@typescript-eslint/visitor-keys": "8.32.1", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-6u6Plg9nP/J1GRpe/vcjjabo6Uc5YQPAMxsgQyGC/I0RuukiG1wIe3+Vtg3IrSCVJDmqK3j8adrtzXSENRtFgg=="],
"@typescript-eslint/parser": ["@typescript-eslint/parser@8.32.1", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.32.1", "@typescript-eslint/types": "8.32.1", "@typescript-eslint/typescript-estree": "8.32.1", "@typescript-eslint/visitor-keys": "8.32.1", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-LKMrmwCPoLhM45Z00O1ulb6jwyVr2kr3XJp+G+tSEZcbauNnScewcQwtJqXDhXeYPDEjZ8C1SjXm015CirEmGg=="],
"@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.32.1", "", { "dependencies": { "@typescript-eslint/types": "8.32.1", "@typescript-eslint/visitor-keys": "8.32.1" } }, "sha512-7IsIaIDeZn7kffk7qXC3o6Z4UblZJKV3UBpkvRNpr5NSyLji7tvTcvmnMNYuYLyh26mN8W723xpo3i4MlD33vA=="],
"@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.32.1", "", { "dependencies": { "@typescript-eslint/typescript-estree": "8.32.1", "@typescript-eslint/utils": "8.32.1", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-mv9YpQGA8iIsl5KyUPi+FGLm7+bA4fgXaeRcFKRDRwDMu4iwrSHeDPipwueNXhdIIZltwCJv+NkxftECbIZWfA=="],
"@typescript-eslint/types": ["@typescript-eslint/types@8.32.1", "", {}, "sha512-YmybwXUJcgGqgAp6bEsgpPXEg6dcCyPyCSr0CAAueacR/CCBi25G3V8gGQ2kRzQRBNol7VQknxMs9HvVa9Rvfg=="],
"@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.32.1", "", { "dependencies": { "@typescript-eslint/types": "8.32.1", "@typescript-eslint/visitor-keys": "8.32.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "typescript": ">=4.8.4 <5.9.0" } }, "sha512-Y3AP9EIfYwBb4kWGb+simvPaqQoT5oJuzzj9m0i6FCY6SPvlomY2Ei4UEMm7+FXtlNJbor80ximyslzaQF6xhg=="],
"@typescript-eslint/utils": ["@typescript-eslint/utils@8.32.1", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", "@typescript-eslint/scope-manager": "8.32.1", "@typescript-eslint/types": "8.32.1", "@typescript-eslint/typescript-estree": "8.32.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-DsSFNIgLSrc89gpq1LJB7Hm1YpuhK086DRDJSNrewcGvYloWW1vZLHBTIvarKZDcAORIy/uWNx8Gad+4oMpkSA=="],
"@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.32.1", "", { "dependencies": { "@typescript-eslint/types": "8.32.1", "eslint-visitor-keys": "^4.2.0" } }, "sha512-ar0tjQfObzhSaW3C3QNmTc5ofj0hDoNQ5XWrCy6zDyabdr0TWhCkClp+rywGNj/odAFBVzzJrK4tEq5M4Hmu4w=="],
"acorn": ["acorn@8.14.1", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg=="],
"acorn-jsx": ["acorn-jsx@5.3.2", "", { "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ=="],
"ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="],
"ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
"ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
"argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="],
"balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
"brace-expansion": ["brace-expansion@1.1.11", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="],
"braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="],
"bun-types": ["bun-types@1.2.13", "", { "dependencies": { "@types/node": "*" } }, "sha512-rRjA1T6n7wto4gxhAO/ErZEtOXyEZEmnIHQfl0Dt1QQSB4QV0iP6BZ9/YB5fZaHFQ2dwHFrmPaRQ9GGMX01k9Q=="],
"callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="],
"chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="],
"color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
"color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
"concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="],
"cross-spawn": ["cross-spawn@7.0.6", "", { "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" } }, "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA=="],
"debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="],
"deep-is": ["deep-is@0.1.4", "", {}, "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ=="],
"escape-string-regexp": ["escape-string-regexp@4.0.0", "", {}, "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA=="],
"eslint": ["eslint@9.27.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.20.0", "@eslint/config-helpers": "^0.2.1", "@eslint/core": "^0.14.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.27.0", "@eslint/plugin-kit": "^0.3.1", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.3.0", "eslint-visitor-keys": "^4.2.0", "espree": "^10.3.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-ixRawFQuMB9DZ7fjU3iGGganFDp3+45bPOdaRurcFHSXO1e/sYwUX/FtQZpLZJR6SjMoJH8hR2pPEAfDyCoU2Q=="],
"eslint-config-prettier": ["eslint-config-prettier@10.1.5", "", { "peerDependencies": { "eslint": ">=7.0.0" }, "bin": { "eslint-config-prettier": "bin/cli.js" } }, "sha512-zc1UmCpNltmVY34vuLRV61r1K27sWuX39E+uyUnY8xS2Bex88VV9cugG+UZbRSRGtGyFboj+D8JODyme1plMpw=="],
"eslint-scope": ["eslint-scope@8.3.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-pUNxi75F8MJ/GdeKtVLSbYg4ZI34J6C0C7sbL4YOp2exGwen7ZsuBqKzUhXd0qMQ362yET3z+uPwKeg/0C2XCQ=="],
"eslint-visitor-keys": ["eslint-visitor-keys@4.2.0", "", {}, "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw=="],
"espree": ["espree@10.3.0", "", { "dependencies": { "acorn": "^8.14.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.0" } }, "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg=="],
"esquery": ["esquery@1.6.0", "", { "dependencies": { "estraverse": "^5.1.0" } }, "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg=="],
"esrecurse": ["esrecurse@4.3.0", "", { "dependencies": { "estraverse": "^5.2.0" } }, "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag=="],
"estraverse": ["estraverse@5.3.0", "", {}, "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA=="],
"esutils": ["esutils@2.0.3", "", {}, "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="],
"fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="],
"fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="],
"fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="],
"fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="],
"fastq": ["fastq@1.19.1", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ=="],
"file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="],
"fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="],
"find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="],
"flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="],
"flatted": ["flatted@3.3.3", "", {}, "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg=="],
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
"glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="],
"global-prefix": ["global-prefix@4.0.0", "", { "dependencies": { "ini": "^4.1.3", "kind-of": "^6.0.3", "which": "^4.0.0" } }, "sha512-w0Uf9Y9/nyHinEk5vMJKRie+wa4kR5hmDbEhGGds/kG1PwGLLHKRoNMeJOyCQjjBkANlnScqgzcFwGHgmgLkVA=="],
"globals": ["globals@16.1.0", "", {}, "sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g=="],
"graphemer": ["graphemer@1.4.0", "", {}, "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="],
"has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="],
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
"ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="],
"import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="],
"imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="],
"ini": ["ini@4.1.3", "", {}, "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg=="],
"is-core-module": ["is-core-module@2.16.1", "", { "dependencies": { "hasown": "^2.0.2" } }, "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w=="],
"isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="],
"is-extglob": ["is-extglob@2.1.1", "", {}, "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ=="],
"is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="],
"is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="],
"isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
"js-yaml": ["js-yaml@4.1.0", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA=="],
"json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="],
"json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
"json-stable-stringify-without-jsonify": ["json-stable-stringify-without-jsonify@1.0.1", "", {}, "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="],
"keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="],
"kind-of": ["kind-of@6.0.3", "", {}, "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="],
"levn": ["levn@0.4.1", "", { "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" } }, "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ=="],
"locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="],
"lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="],
"merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="],
"micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="],
"minimatch": ["minimatch@3.1.2", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
"minimist": ["minimist@1.2.8", "", {}, "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA=="],
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
"natural-compare": ["natural-compare@1.4.0", "", {}, "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw=="],
"optionator": ["optionator@0.9.4", "", { "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", "levn": "^0.4.1", "prelude-ls": "^1.2.1", "type-check": "^0.4.0", "word-wrap": "^1.2.5" } }, "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g=="],
"p-limit": ["p-limit@3.1.0", "", { "dependencies": { "yocto-queue": "^0.1.0" } }, "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ=="],
"p-locate": ["p-locate@5.0.0", "", { "dependencies": { "p-limit": "^3.0.2" } }, "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw=="],
"parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="],
"path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="],
"path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
"path-parse": ["path-parse@1.0.7", "", {}, "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw=="],
"picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="],
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
"punycode": ["punycode@2.3.1", "", {}, "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg=="],
"queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="],
"resolve": ["resolve@1.22.10", "", { "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" }, "bin": { "resolve": "bin/resolve" } }, "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w=="],
"resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="],
"reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="],
"run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="],
"semver": ["semver@7.7.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="],
"shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "^3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
"shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
"strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "^5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
"strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="],
"supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="],
"supports-preserve-symlinks-flag": ["supports-preserve-symlinks-flag@1.0.0", "", {}, "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w=="],
"to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
"ts-api-utils": ["ts-api-utils@2.1.0", "", { "peerDependencies": { "typescript": ">=4.8.4" } }, "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ=="],
"ts-patch": ["ts-patch@3.3.0", "", { "dependencies": { "chalk": "^4.1.2", "global-prefix": "^4.0.0", "minimist": "^1.2.8", "resolve": "^1.22.2", "semver": "^7.6.3", "strip-ansi": "^6.0.1" }, "bin": { "ts-patch": "bin/ts-patch.js", "tspc": "bin/tspc.js" } }, "sha512-zAOzDnd5qsfEnjd9IGy1IRuvA7ygyyxxdxesbhMdutt8AHFjD8Vw8hU2rMF89HX1BKRWFYqKHrO8Q6lw0NeUZg=="],
"type-check": ["type-check@0.4.0", "", { "dependencies": { "prelude-ls": "^1.2.1" } }, "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew=="],
"typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="],
"typescript-eslint": ["typescript-eslint@8.32.1", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.32.1", "@typescript-eslint/parser": "8.32.1", "@typescript-eslint/utils": "8.32.1" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <5.9.0" } }, "sha512-D7el+eaDHAmXvrZBy1zpzSNIRqnCOrkwTgZxTu3MUqRWk8k0q9m9Ho4+vPf7iHtgUfrK/o8IZaEApsxPlHTFCg=="],
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
"which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="],
"uri-js": ["uri-js@4.4.1", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
"which": ["which@2.0.2", "", { "dependencies": { "isexe": "^2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
"word-wrap": ["word-wrap@1.2.5", "", {}, "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA=="],
"yocto-queue": ["yocto-queue@0.1.0", "", {}, "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q=="],
"@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
"@eslint/eslintrc/globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="],
"@humanfs/node/@humanwhocodes/retry": ["@humanwhocodes/retry@0.3.1", "", {}, "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA=="],
"@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.4", "", {}, "sha512-gJzzk+PQNznz8ysRrC0aOkBNVRBDtE1n53IqyqEf3PXrYwomFs5q4pGMizBMJF+ykh03insJ27hB8gSrD2Hn8A=="],
"@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
"fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="],
"global-prefix/which": ["which@4.0.0", "", { "dependencies": { "isexe": "^3.1.1" }, "bin": { "node-which": "bin/which.js" } }, "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg=="],
"@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
"global-prefix/which/isexe": ["isexe@3.1.1", "", {}, "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ=="],
}
}

19
eslint.config.js Normal file
View File

@ -0,0 +1,19 @@
import js from "@eslint/js";
import globals from "globals";
import tseslint from "typescript-eslint";
import { defineConfig } from "eslint/config";
import eslintConfigPrettier from "eslint-config-prettier/flat";
export default defineConfig([
{
files: ["**/*.{js,mjs,cjs,ts}"],
plugins: { js },
extends: ["js/recommended"],
},
{
files: ["**/*.{js,mjs,cjs,ts}"],
languageOptions: { globals: globals.browser },
},
tseslint.configs.recommended,
eslintConfigPrettier,
]);

View File

@ -4,10 +4,15 @@
"type": "module",
"private": true,
"devDependencies": {
"@eslint/js": "^9.27.0",
"@maxmorozoff/try-catch-tuple": "^0.1.2",
"@maxmorozoff/try-catch-tuple-ts-plugin": "^0.0.1",
"@types/bun": "latest",
"ts-patch": "^3.3.0"
"eslint": "^9.27.0",
"eslint-config-prettier": "^10.1.5",
"globals": "^16.1.0",
"ts-patch": "^3.3.0",
"typescript-eslint": "^8.32.1"
},
"peerDependencies": {
"typescript": "^5.8.3"

View File

@ -1,88 +1,92 @@
import { type ParseArgsOptionsConfig } from 'util'
import type { BrigadierTreeCommand, BrigadierTree } from "./types";
import { type ParseArgsOptionsConfig } from 'util';
import type { BrigadierTreeCommand, BrigadierTree } from './types';
const commandObj:
{ _opts?: ParseArgsOptionsConfig } &
Record<string, BrigadierTreeCommand> = {}
const commandObj: { _opts?: ParseArgsOptionsConfig } & Record<
string,
BrigadierTreeCommand
> = {};
commandObj._opts = {
verbose: {
type: "boolean",
type: 'boolean',
short: 'v',
},
silent: {
type: "boolean",
short: "s",
type: 'boolean',
short: 's',
},
}
};
commandObj.run = {
command: "run",
command: 'run',
options: {
speed: {
type: "string",
}
}
}
type: 'string',
},
},
};
commandObj.walk = {
command: "walk",
command: 'walk',
options: {
fancy: {
type: "boolean",
short: "f"
}
}
}
type: 'boolean',
short: 'f',
},
},
};
commandObj.stand = {
command: "stand",
}
command: 'stand',
};
commandObj.sit = {
command: "sit",
}
command: 'sit',
};
commandObj.say = {
command: "say",
command: 'say',
value: {
required: true,
inputType: "string",
dataType: "string[]",
inputType: 'string',
dataType: 'string[]',
},
options: {
accent: {
type: 'string',
default: "American",
}
default: 'American',
},
},
subcommands: [
{
command: "talk",
command: 'talk',
value: {
required: true,
inputType: "string",
dataType: "string[]"
inputType: 'string',
dataType: 'string[]',
},
},
{
command: "whisper",
command: 'whisper',
value: {
required: true,
inputType: "string",
dataType: "string[]"
}
inputType: 'string',
dataType: 'string[]',
},
},
{
command: "yell",
command: 'yell',
value: {
required: true,
inputType: "string",
dataType: "string[]"
}
}
]
}
inputType: 'string',
dataType: 'string[]',
},
},
],
};
const { _opts, ...commands } = commandObj
export const main: BrigadierTree = { _opts, commands: [...Object.values(commands)] }
const { _opts, ...commands } = commandObj;
export const main: BrigadierTree = {
_opts,
commands: [...Object.values(commands)],
};

View File

@ -1,24 +1,24 @@
export class BrigadierInternalError extends Error {
constructor(error: Error | undefined = undefined) {
super()
super();
this.name = this.constructor.name;
this.message = "The argument parser experience an internal error."
if (error) this.cause = error
this.message = 'The argument parser experience an internal error.';
if (error) this.cause = error;
}
}
export class BrigadierConfigError extends Error {
constructor(message: string, error: Error | undefined = undefined) {
super(message)
super(message);
this.name = this.constructor.name;
if (error) this.cause = error
if (error) this.cause = error;
}
}
export class BrigadierOptionError extends Error {
#defaultCode = "ERR_PARSE_ARGS_BRIGADIER_PARSE_OPTION";
#defaultCode = 'ERR_PARSE_ARGS_BRIGADIER_PARSE_OPTION';
#defaultMessages = {
helpPrimitive: `Run '--help' for more information on how to use this command.`,
get generic() {
@ -40,7 +40,7 @@ export class BrigadierOptionError extends Error {
constructor(message: string, error: Error) {
super(message);
if ("code" in error && typeof error.code === "string")
if ('code' in error && typeof error.code === 'string')
this.#switchOnCodes(error.code);
this.name = this.constructor.name;
@ -48,12 +48,12 @@ export class BrigadierOptionError extends Error {
}
#switchOnCodes(code: string) {
if (code === "ERR_PARSE_ARGS_UNKNOWN_OPTION") {
if (code === 'ERR_PARSE_ARGS_UNKNOWN_OPTION') {
this.message = this.#unknownOption(this.message);
this.code = code;
return;
}
if (code === "ERR_PARSE_ARGS_INVALID_OPTION_VALUE") {
if (code === 'ERR_PARSE_ARGS_INVALID_OPTION_VALUE') {
this.message = this.#invalidOptionValue(this.message);
this.code = code;
return;
@ -62,15 +62,15 @@ export class BrigadierOptionError extends Error {
#unknownOption(message: string) {
const index = 18;
if (typeof message !== "string" || message[index - 3] !== "'")
if (typeof message !== 'string' || message[index - 3] !== "'")
return this.#defaultMessages.unknownOption;
this.option = this.#extractOptionString(message, index, ". ");
this.option = this.#extractOptionString(message, index, '. ');
return `Unknown option '--${this.option}'. ${this.#defaultMessages.helpPrimitive}`;
}
#invalidOptionValue(message: string) {
const index = 10;
if (typeof message !== "string" || message[index - 3] !== "'")
if (typeof message !== 'string' || message[index - 3] !== "'")
return this.#defaultMessages.invalidOptionValue;
this.option = this.#extractOptionString(message, index, "<value>' ");
return `Option '--${this.option}' has an invalid value. ${this.#defaultMessages.helpPrimitive}`;

View File

@ -1,13 +1,22 @@
import { tryCatch } from "@maxmorozoff/try-catch-tuple";
import { tryCatch } from '@maxmorozoff/try-catch-tuple';
import {
parseArgs,
type ParseArgsConfig,
type ParseArgsOptionsConfig,
} from "util";
import { assertArrayOfStrings } from "../util/typeCheck";
import { BrigadierConfigError, BrigadierInternalError, BrigadierOptionError } from "./errors";
import type { BrigadierTree, BrigadierParserOverrides, BrigadierTreeCommand, BrigadierOutput } from "./types";
import { treeUtils } from "./tree";
} from 'util';
import { assertArrayOfStrings } from '../util/typeCheck';
import {
BrigadierConfigError,
BrigadierInternalError,
BrigadierOptionError,
} from './errors';
import type {
BrigadierTree,
BrigadierParserOverrides,
BrigadierTreeCommand,
BrigadierOutput,
} from './types';
import { treeUtils } from './tree';
const defaultOverrides: BrigadierParserOverrides = {
allowPositionals: true,
@ -17,45 +26,55 @@ const defaultOverrides: BrigadierParserOverrides = {
};
function findNextTree(tree: Array<BrigadierTreeCommand>, command: string) {
const nextCommand = tree.filter((obj) => obj.command === command)
return nextCommand[0]?.subcommands
const nextCommand = tree.filter((obj) => obj.command === command);
return nextCommand[0]?.subcommands;
}
function findCommands(tree: Array<BrigadierTreeCommand> | undefined, args: Array<string>, out: Array<string> = []) {
const item = args[0]
if (!item || !tree) return out
function findCommands(
tree: Array<BrigadierTreeCommand> | undefined,
args: Array<string>,
out: Array<string> = []
) {
const item = args[0];
if (!item || !tree) return out;
const [commands, commandError] = tryCatch(() => treeUtils.commandArray(tree))
if (commandError) throw commandError
const [commands, commandError] = tryCatch(() => treeUtils.commandArray(tree));
if (commandError) throw commandError;
if (item.slice(0, 0) === "-" || !commands.includes(item)) return out
if (item.slice(0, 0) === '-' || !commands.includes(item)) return out;
const [newTree, newTreeError] = tryCatch(() => findNextTree(tree, item))
if (newTreeError) throw newTreeError
const [newTree, newTreeError] = tryCatch(() => findNextTree(tree, item));
if (newTreeError) throw newTreeError;
const newArgs = args.slice(1)
const newOut = [...out, item]
const newArgs = args.slice(1);
const newOut = [...out, item];
return findCommands(newTree, newArgs, newOut)
return findCommands(newTree, newArgs, newOut);
}
function findOpts(tree: Array<BrigadierTreeCommand>, commands: Array<string>, opts: ParseArgsOptionsConfig = {}) {
const item = commands[0]
if (!item) throw new TypeError("The first item in the array is missing.")
function findOpts(
tree: Array<BrigadierTreeCommand>,
commands: Array<string>,
opts: ParseArgsOptionsConfig = {}
) {
const item = commands[0];
if (!item) throw new TypeError('The first item in the array is missing.');
const commandObj = tree.filter((obj) => obj.command === item)
const thisOpts = commandObj[0]?.options ? commandObj[0].options : {}
const nextOpts = Object.assign(opts, thisOpts)
const commandObj = tree.filter((obj) => obj.command === item);
const thisOpts = commandObj[0]?.options ? commandObj[0].options : {};
const nextOpts = Object.assign(opts, thisOpts);
if (commands.length === 1) {
const config = nextOpts
return config
const config = nextOpts;
return config;
}
const nextTree = commandObj[0]?.subcommands
if (!nextTree) throw new BrigadierConfigError(`The '${item}' command was expected to have subcommands.`)
return findOpts(nextTree, commands.slice(1), nextOpts)
const nextTree = commandObj[0]?.subcommands;
if (!nextTree)
throw new BrigadierConfigError(
`The '${item}' command was expected to have subcommands.`
);
return findOpts(nextTree, commands.slice(1), nextOpts);
}
function setParsedArgsConfig(
@ -79,21 +98,32 @@ function setParsedArgsConfig(
return { config: configObj, commands: commands };
}
function generateParsedArgsConfig(tree: BrigadierTree, args: Array<string>, overrides: BrigadierParserOverrides | undefined = undefined) {
const [commandsArray, commandsError] = tryCatch(() => findCommands(tree.commands, args.slice(2)))
if (commandsError) throw commandsError
function generateParsedArgsConfig(
tree: BrigadierTree,
args: Array<string>,
overrides: BrigadierParserOverrides | undefined = undefined
) {
const [commandsArray, commandsError] = tryCatch(() =>
findCommands(tree.commands, args.slice(2))
);
if (commandsError) throw commandsError;
if (!commandsArray[0]) {
const opts = tree._opts
return setParsedArgsConfig(args, opts, overrides, commandsArray)
const opts = tree._opts;
return setParsedArgsConfig(args, opts, overrides, commandsArray);
}
const [commandOpts, commandOptsError] = tryCatch(() => findOpts(tree.commands, commandsArray))
if (commandOptsError) throw commandOptsError
const opts = Object.assign({}, tree._opts, commandOpts)
return setParsedArgsConfig(args, opts, overrides, commandsArray)
const [commandOpts, commandOptsError] = tryCatch(() =>
findOpts(tree.commands, commandsArray)
);
if (commandOptsError) throw commandOptsError;
const opts = Object.assign({}, tree._opts, commandOpts);
return setParsedArgsConfig(args, opts, overrides, commandsArray);
}
function getParsedArgs(opts: { config: ParseArgsConfig, commands: Array<string> }) {
function getParsedArgs(opts: {
config: ParseArgsConfig;
commands: Array<string>;
}) {
const [result, error] = tryCatch(() => {
return parseArgs(opts.config);
});
@ -101,39 +131,63 @@ function getParsedArgs(opts: { config: ParseArgsConfig, commands: Array<string>
return { ...result, commands: opts.commands };
}
function buildPositionalsArray(commands: Array<string>, positionals: Array<string>) {
const testSet = new Set(commands)
return positionals.filter(str => !testSet.has(str))
function buildPositionalsArray(
commands: Array<string>,
positionals: Array<string>
) {
const testSet = new Set(commands);
return positionals.filter((str) => !testSet.has(str));
}
function handleErr(error: Error) {
if (error instanceof BrigadierOptionError || error instanceof BrigadierConfigError) return error
return new BrigadierInternalError()
if (
error instanceof BrigadierOptionError ||
error instanceof BrigadierConfigError
)
return error;
return new BrigadierInternalError();
}
function buildOutputObject(tree: BrigadierTree, args: Array<string>, overrides: BrigadierParserOverrides | undefined = undefined) {
function buildOutputObject(
tree: BrigadierTree,
args: Array<string>,
overrides: BrigadierParserOverrides | undefined = undefined
) {
try {
const [config, configError] = tryCatch(() => generateParsedArgsConfig(tree, args, overrides))
if (configError) throw configError
const [config, configError] = tryCatch(() =>
generateParsedArgsConfig(tree, args, overrides)
);
if (configError) throw configError;
const [parsedArgs, parsedError] = tryCatch(() => getParsedArgs(config))
if (parsedError) throw parsedError
const [parsedArgs, parsedError] = tryCatch(() => getParsedArgs(config));
if (parsedError) throw parsedError;
const programPaths = {
bun: parsedArgs.positionals[0] ? parsedArgs.positionals[0] : "",
path: parsedArgs.positionals[1] ? parsedArgs.positionals[1] : "",
}
const command = config.commands[0] ? { command: config.commands[0] } : {}
const subcommands = config.commands[1] ? { subcommands: config.commands.slice(1) } : {}
const [positionals, positionalsError] = tryCatch(() => buildPositionalsArray(config.commands, parsedArgs.positionals.slice(2)))
if (positionalsError) throw positionalsError
const positionalsObj = positionals.length > 0 ? { positionals } : {}
const values = parsedArgs.values ? parsedArgs.values : {}
bun: parsedArgs.positionals[0] ? parsedArgs.positionals[0] : '',
path: parsedArgs.positionals[1] ? parsedArgs.positionals[1] : '',
};
const command = config.commands[0] ? { command: config.commands[0] } : {};
const subcommands = config.commands[1]
? { subcommands: config.commands.slice(1) }
: {};
const [positionals, positionalsError] = tryCatch(() =>
buildPositionalsArray(config.commands, parsedArgs.positionals.slice(2))
);
if (positionalsError) throw positionalsError;
const positionalsObj = positionals.length > 0 ? { positionals } : {};
const values = parsedArgs.values ? parsedArgs.values : {};
const out: BrigadierOutput = Object.assign({}, programPaths, command, subcommands, positionalsObj, { values })
return out
const out: BrigadierOutput = Object.assign(
{},
programPaths,
command,
subcommands,
positionalsObj,
{ values }
);
return out;
} catch (error) {
throw handleErr(error as Error)
throw handleErr(error as Error);
}
}
export const main = buildOutputObject;

View File

@ -1,13 +1,12 @@
import { demoTree } from ".";
import type { BrigadierTreeCommand } from "./types";
import { demoTree } from '.';
import type { BrigadierTreeCommand } from './types';
function commandArray(array: Array<BrigadierTreeCommand>) {
const out: Array<string> = []
array.forEach((obj) => out.push(obj.command))
return out
const out: Array<string> = [];
array.forEach((obj) => out.push(obj.command));
return out;
}
export const treeUtils = {
commandArray
}
commandArray,
};

View File

@ -1,39 +1,39 @@
import { type ParseArgsOptionsConfig } from 'util'
import { type ParseArgsOptionsConfig } from 'util';
export type BrigadierCommandValue =
"string" |
"number" |
"boolean" |
"string[]" |
"number[]" |
"boolean[]" |
"mixed[]"
| 'string'
| 'number'
| 'boolean'
| 'string[]'
| 'number[]'
| 'boolean[]'
| 'mixed[]';
export type BrigadierTreeCommand = {
command: string,
command: string;
value?: {
required: boolean,
inputType: "string" | "boolean",
dataType: BrigadierCommandValue,
default?: string | boolean
}
options?: ParseArgsOptionsConfig,
subcommands?: Array<BrigadierTreeCommand>
}
required: boolean;
inputType: 'string' | 'boolean';
dataType: BrigadierCommandValue;
default?: string | boolean;
};
options?: ParseArgsOptionsConfig;
subcommands?: Array<BrigadierTreeCommand>;
};
export type BrigadierTree = {
_opts: ParseArgsOptionsConfig,
commands: Array<BrigadierTreeCommand>
}
_opts: ParseArgsOptionsConfig;
commands: Array<BrigadierTreeCommand>;
};
export type BrigadierOutput = {
bun: string,
path: string,
command?: string,
subcommands?: Array<string>,
positionals?: Array<string>,
values?: Record<string, string | boolean>
}
bun: string;
path: string;
command?: string;
subcommands?: Array<string>;
positionals?: Array<string>;
values?: Record<string, string | boolean>;
};
export type BrigadierParserOverrides = {
strict?: boolean;
@ -43,7 +43,6 @@ export type BrigadierParserOverrides = {
};
export type BrigadierInput = BrigadierTree & {
args: Array<string>
args: Array<string>;
overrides?: BrigadierParserOverrides;
};

View File

@ -1,3 +1,5 @@
# Features to Impliment
## Basic Inputs
- [ ] **Text Input** User types a free-form response.

View File

@ -5,51 +5,78 @@ import { assertArrayOfStrings } from '../util/typeCheck';
export type PromptsmithConfig = {
format?: {
selected?: string,
selectedText?: string,
defualt?: string,
defualtText?: string,
},
selected?: string;
selectedText?: string;
defualt?: string;
defualtText?: string;
};
selector?: {
selected?: string,
default?: string,
}
}
selected?: string;
default?: string;
};
};
// A pure function to render options without side effects
const formatText = (text: string, format: string): string => `${format}${text}\x1B[0m`;
const formatText = (text: string, format: string): string =>
`${format}${text}\x1B[0m`;
const renderOptions = (options: string[], selectedIndex: number, pos: CursorPosition, config: PromptsmithConfig): string[] => {
const renderOptions = (
options: string[],
selectedIndex: number,
pos: CursorPosition,
config: PromptsmithConfig
): string[] => {
TerminalUtils.cursor.restorePosition(pos);
TerminalUtils.clear.below();
return [
formatText('Use the ↑ and ↓ keys to select an option. Press ENTER to confirm.\n', '\x1B[1m'), // Bold
formatText(
'Use the ↑ and ↓ keys to select an option. Press ENTER to confirm.\n',
'\x1B[1m'
), // Bold
...options.map((option, index) => {
const isSelected = index === selectedIndex;
const selector = formatText(
isSelected ? config.selector.selected as string : config.selector.default as string,
isSelected ? config.format.selected as string : config.format.defualt as string
)
isSelected
? (config.selector.selected as string)
: (config.selector.default as string),
isSelected
? (config.format.selected as string)
: (config.format.defualt as string)
);
const optionText = formatText(
option,
isSelected ? config.format.selectedText as string : config.format.defualtText as string
)
return selector + optionText
isSelected
? (config.format.selectedText as string)
: (config.format.defualtText as string)
);
return selector + optionText;
}),
];
};
// A pure function to update selected index based on input key
const updateSelection = (selectedIndex: number, keyName: string, options: string[]): number =>
keyName === 'up' ? Math.max(selectedIndex - 1, 0) :
keyName === 'down' ? Math.min(selectedIndex + 1, options.length - 1) :
selectedIndex;
const updateSelection = (
selectedIndex: number,
keyName: string,
options: string[]
): number =>
keyName === 'up'
? Math.max(selectedIndex - 1, 0)
: keyName === 'down'
? Math.min(selectedIndex + 1, options.length - 1)
: selectedIndex;
// Handles keypress events as pure transformations
const handleKeyPress = async (options: string[], selectedIndex: number, pos: CursorPosition, config: PromptsmithConfig): Promise<string> => {
const handleKeyPress = async (
options: string[],
selectedIndex: number,
pos: CursorPosition,
config: PromptsmithConfig
): Promise<string> => {
return new Promise((resolve) => {
if (!assertArrayOfStrings(options)) throw new TypeError("'options' should be Array<string>.")
if (!assertArrayOfStrings(options))
throw new TypeError("'options' should be Array<string>.");
process.stdin.resume();
readline.emitKeypressEvents(process.stdin);
@ -57,7 +84,11 @@ const handleKeyPress = async (options: string[], selectedIndex: number, pos: Cur
if (process.stdin.isTTY) process.stdin.setRawMode(true);
const onKeyPress = async (_: string, key: readline.Key) => {
const newIndex = updateSelection(selectedIndex, key.name as string, options);
const newIndex = updateSelection(
selectedIndex,
key.name as string,
options
);
if (key.name === 'return') {
cleanup();
@ -68,7 +99,9 @@ const handleKeyPress = async (options: string[], selectedIndex: number, pos: Cur
process.exit();
}
renderOptions(options, newIndex, pos, config).forEach(line => console.log(line));
renderOptions(options, newIndex, pos, config).forEach((line) =>
console.log(line)
);
selectedIndex = newIndex;
};
@ -77,27 +110,29 @@ const handleKeyPress = async (options: string[], selectedIndex: number, pos: Cur
const cleanup = () => {
process.stdin.removeListener('keypress', onKeyPress);
if (process.stdin.isTTY) process.stdin.setRawMode(false);
TerminalUtils.cursor.restorePosition(pos)
TerminalUtils.clear.below()
TerminalUtils.cursor.restorePosition(pos);
TerminalUtils.clear.below();
process.stdin.pause();
};
});
};
const setConfig = (config: PromptsmithConfig) => {
if (!config.format) config.format = {}
if (!config.format) config.format = {};
if (!config.format.selected) config.format.selected = '\x1B[32m\x1B[1m'
if (!config.format.selectedText) config.format.selectedText = config.format.selected
if (!config.format.defualt) config.format.defualt = ''
if (!config.format.defualtText) config.format.defualtText = config.format.defualt
if (!config.format.selected) config.format.selected = '\x1B[32m\x1B[1m';
if (!config.format.selectedText)
config.format.selectedText = config.format.selected;
if (!config.format.defualt) config.format.defualt = '';
if (!config.format.defualtText)
config.format.defualtText = config.format.defualt;
if (!config.selector) config.selector = {}
if (!config.selector.default) config.selector.default = ' '
if (!config.selector.selected) config.selector.selected = '> '
if (!config.selector) config.selector = {};
if (!config.selector.default) config.selector.default = ' ';
if (!config.selector.selected) config.selector.selected = '> ';
return config
}
return config;
};
// Main function using pure composition
const defaultConfig: PromptsmithConfig = {
@ -106,23 +141,29 @@ const defaultConfig: PromptsmithConfig = {
},
selector: {
selected: '> ',
default: ' '
}
}
const interactiveSelect = async (options: string[], config: PromptsmithConfig = {}): Promise<string> => {
const newConfig = setConfig(config)
default: ' ',
},
};
const interactiveSelect = async (
options: string[],
config: PromptsmithConfig = {}
): Promise<string> => {
const newConfig = setConfig(config);
const pos = await TerminalUtils.cursor.getCursorPosition();
renderOptions(options, 0, pos, newConfig).forEach(line => console.log(line));
renderOptions(options, 0, pos, newConfig).forEach((line) =>
console.log(line)
);
return handleKeyPress(options, 0, pos, newConfig);
};
// Execution
(async () => {
const options = ['Option A', 'Option B', 'Option C'];
const selectedOption = await interactiveSelect(options, { selector: { selected: '* ' } });
const selectedOption = await interactiveSelect(options, {
selector: { selected: '* ' },
});
console.log(`You selected: ${selectedOption}`);
process.stdin.pause(); // Ensures stdin closes AFTER selection
})();

View File

@ -13,8 +13,10 @@ export const TerminalUtils = {
clear: () => console.clear(),
},
cursor: { /** Move cursor to a specific row & column */
moveCursor: (row: number, col: number) => process.stdout.write(`\x1B[${row};${col}H`),
cursor: {
/** Move cursor to a specific row & column */
moveCursor: (row: number, col: number) =>
process.stdout.write(`\x1B[${row};${col}H`),
/** Queries the terminal for the current cursor position */
async getCursorPosition(): Promise<CursorPosition> {
@ -44,6 +46,7 @@ export const TerminalUtils = {
},
/** Restores the passed cursor position */
restorePosition: (pos: CursorPosition) => TerminalUtils.cursor.moveCursor(pos.row, pos.col),
}
restorePosition: (pos: CursorPosition) =>
TerminalUtils.cursor.moveCursor(pos.row, pos.col),
},
};

View File

@ -1,6 +1,5 @@
export function assertArrayOfStrings(arr: unknown) {
const arrName = Object.keys({ arr })[0];
if (!Array.isArray(arr)) return false;
if (!arr.every((item: unknown) => typeof item === "string")) return false;
if (!arr.every((item: unknown) => typeof item === 'string')) return false;
return true;
}