@cyberskill/shared 1.75.0 → 1.77.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/README.md +9 -10
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/graphql-codegen/graphql-codegen.util.cjs +1 -1
- package/dist/configs/graphql-codegen/graphql-codegen.util.js +1 -1
- package/dist/configs/graphql-codegen/index.cjs +1 -1
- package/dist/configs/graphql-codegen/index.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/nodejs/cli/cli.util.cjs +1 -1
- package/dist/nodejs/cli/cli.util.js +1 -1
- package/dist/nodejs/cli/index.cjs +1 -1
- package/dist/nodejs/cli/index.js +1 -1
- package/dist/nodejs/command/command.util.cjs +1 -1
- package/dist/nodejs/command/command.util.js +1 -1
- package/dist/nodejs/command/index.cjs +1 -1
- package/dist/nodejs/command/index.js +1 -1
- package/dist/nodejs/index.cjs +1 -1
- package/dist/nodejs/index.js +1 -1
- package/dist/nodejs/package/index.cjs +1 -1
- package/dist/nodejs/package/index.js +1 -1
- package/dist/nodejs/package/package.util.cjs +1 -1
- package/dist/nodejs/package/package.util.js +1 -1
- package/dist/nodejs/path/index.cjs +1 -1
- package/dist/nodejs/path/index.js +1 -1
- package/dist/nodejs/path/path.constant.cjs +1 -1
- package/dist/nodejs/path/path.constant.js +1 -1
- package/dist/nodejs/path/path.util.cjs +1 -1
- package/dist/nodejs/path/path.util.js +1 -1
- package/dist/nodejs/storage/index.cjs +1 -1
- package/dist/nodejs/storage/index.js +1 -1
- package/dist/nodejs/storage/storage.util.cjs +1 -1
- package/dist/nodejs/storage/storage.util.js +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/vitest/index.cjs +1 -1
- package/dist/react/vitest/index.js +1 -1
- package/dist/react/vitest/vitest.unit.cjs +1 -1
- package/dist/react/vitest/vitest.unit.js +1 -1
- package/package.json +2 -2
- package/public/wiki/convention.md +193 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var h=Object.create;var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var c=function(){var s=u.value;!b.call(e,s)&&s!==n&&m(e,s,{get:function(){return t[s]},enumerable:!(r=v(t,s))||r.enumerable})};for(var a=j(t)[Symbol.iterator](),u;!(s=(u=a.next()).done);s=true)c()}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return e};var I=function(e,t,n){return n=e!=null?h(x(e)):{},w(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return w(m({},"__esModule",{value:!0}),e)};var O={};module.exports=S(O);var E=I(require("process"),1),_=require("yargs/helpers"),k=I(require("yargs/yargs"),1);var C={name:"@cyberskill/shared",type:"module",version:"1.74.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.6","@eslint-react/eslint-plugin":"1.43.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var T=require("child_process"),q=I(require("process"),1),N=I(require("util"),1);var G=I(require("process"),1),P=G.default.env.DEBUG==="true";var A=I(require("chalk"),1),L=I(require("consola"),1),R=require("graphql");P||(L.default.level=4);function D(e){var t=A.default[e];return typeof t=="function"?t:A.default.green}var F={silent:L.default.silent,level:L.default.level,fatal:L.default.fatal,error:L.default.error,warn:L.default.warn,log:L.default.log,info:L.default.info,success:L.default.success,ready:L.default.ready,start:L.default.start,box:L.default.box,debug:L.default.debug,trace:L.default.trace,verbose:L.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){L.default.box(A.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;L.default.log("".concat(A.default.gray("File:")," ").concat(A.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&L.default.log(" ".concat(D(n)("Rule:")," ").concat(s)),L.default.log(" ".concat(D(n)("Message:")," ").concat(i))}),L.default.box(D(n)("".concat(e," : ").concat(t.length))),L.default.log(A.default.gray("─".repeat(40)))}};var M={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var U=I(require("node-fetch"),1);var J=I(require("fs"),1);function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return J.existsSync(e)})}function W(e,t){var n=J.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function B(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);J.writeFileSync(e,i,"utf-8")}function H(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);J.appendFileSync(e,i,"utf-8")}function Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){K(e)&&J.rmSync(e,{recursive:!0,force:!0})})}var $=I(require("process"),1);var z=I(require("path"),1);function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=z).resolve.apply(r,[X].concat(p(t)))}function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=z).join.apply(r,p(t))}var X=$.default.env.INIT_CWD||$.default.cwd(),Z="@cyberskill/shared",ee=".cyberskill-storage",et="node_modules",en="dist",er="package.json",es="package-lock.json",ei="tsconfig.json",eo=".gitignore",ec=".simple-git-hooks.json",ea="pnpm-lock.yaml",eu=".git/hooks/",el=".git/COMMIT_EDITMSG",ed=Q(X,et,Z,en),ep="cyberskill",ef="src/nodejs/cli/index.ts",eg="eslint",ey="eslint",eh="vitest",em="playwright",ev="vitest",ej="@commitlint/cli",ex="commitlint",eb="lint-staged",ew="lint-staged",eI="typescript",eS="tsc",eO="tsx",eE="git",e_="pnpm",ek="pnpm exec",eC="simple-git-hooks",eT="simple-git-hooks",eq="@eslint/config-inspector",eN="eslint-config-inspector",eG="node-modules-inspector",eP="node-modules-inspector",eA={CYBERSKILL_DIRECTORY:ed,WORKING_DIRECTORY:X,TS_CONFIG:V(ei),GIT_IGNORE:V(eo),GIT_HOOK:V(eu),GIT_COMMIT_MSG:V(el),SIMPLE_GIT_HOOKS_JSON:V(ec),PACKAGE_JSON:V(er),PACKAGE_LOCK_JSON:V(es),PNPM_LOCK_YAML:V(ea),NODE_MODULES:V(et),LINT_STAGED_CONFIG:V("".concat(ed,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:V("".concat(ed,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:V("".concat(ed,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:V("".concat(ed,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:V("".concat(ed,"/react/vitest/vitest.e2e.js"))};function eL(e){var t=e.isCurrentProject;return l({"pre-commit":ew,"commit-msg":ex},t&&{"pre-push":ti("".concat(eE," pull"))})}function eR(e){return eD.apply(this,arguments)}function eD(){eD=s(function(e){var t,n,r,s,i,o;var c=arguments;return y(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}s=d(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,e$(i.split(" "),{update:!0})];case 2:return[2,(a.sent(),tc(ti("".concat(ek," ").concat(o))))];case 3:return[2,tc(ti(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eD.apply(this,arguments)}function eF(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/s(function(){return y(this,function(t){return[2,eR.apply(void 0,[e].concat(p(n)))]})})}var eM={simpleGitHooks:eF("CLI",eC,eT),eslintInspect:eF("CLI",eq,eN),nodeModulesInspect:eF("CLI",eG,eP),eslintCheck:eF("CLI",eg,"".concat(ey," ").concat(eA.WORKING_DIRECTORY)),eslintFix:eF("CLI",eg,"".concat(ey," ").concat(eA.WORKING_DIRECTORY," --fix")),typescriptCheck:eF("CLI",eI,"".concat(eS," -p ").concat(eA.TS_CONFIG," --noEmit")),configureGitHook:eF("RAW","".concat(eE," config core.hooksPath ").concat(eA.GIT_HOOK)),testUnit:eF("CLI",eh,"".concat(ev," --config ").concat(eA.UNIT_TEST_CONFIG)),testE2e:eF("CLI","".concat(eh," ").concat(em),"".concat(ev," --config ").concat(eA.E2E_TEST_CONFIG)),commitLint:eF("CLI",ej,"".concat(ex," --edit ").concat(eA.GIT_COMMIT_MSG," --config ").concat(eA.COMMITLINT_CONFIG)),lintStaged:eF("CLI",eb,"".concat(ew," --config ").concat(eA.LINT_STAGED_CONFIG)),stageBuildDirectory:eF("RAW","".concat(eE," add ").concat(en)),build:eF("RAW","".concat(e_," run build")),pnpmInstallStandard:eF("RAW","".concat(e_," install")),pnpmInstallLegacy:eF("RAW","".concat(e_," install --legacy-peer-deps")),pnpmInstallForce:eF("RAW","".concat(e_," install --force"))};function eU(e){var t=Q(X,er);if(!K(t))return!1;try{var n=W(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return F.warn("Failed to read package.json: ".concat(e.message)),!1}}function eJ(e){return eK.apply(this,arguments)}function eK(){eK=s(function(e){var t,n,r,s;return y(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,U.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw F.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eK.apply(this,arguments)}function eW(e,t){return eB.apply(this,arguments)}function eB(){eB=s(function(e,t){var n,r,s,i,o,c,a,u,d,p,f,g,h,m,v,j,x,b,w,I,S;return y(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);n=eU(e);if(!n)return[2,l({},M)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(s=u.devDependencies)!==null&&s!==void 0?s:{},m=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=m;return[3,3];case 1:return[4,eJ(e)];case 2:x=y.sent();y.label=3;case 3:v=x,j=d||m===v;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,B(a,u,{isJson:!0}),F.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:j}];case 4:S=y.sent();return[2,(F.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},M))];case 5:return[2]}})});return eB.apply(this,arguments)}function eH(){return eY.apply(this,arguments)}function eY(){eY=s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return y(this,function(p){switch(p.label){case 0:e=[{command:function(){return eM.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eM.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eM.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,tl("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();F.warn("Installation attempt failed: ".concat(a)),F.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eY.apply(this,arguments)}function e$(e,t){return ez.apply(this,arguments)}function ez(){ez=s(function(e,t){var n,r,s,i,o,c,a,u,l,d,f;return y(this,function(g){switch(g.label){case 0:if(!K(eA.PACKAGE_JSON)){F.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eW(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eH()];case 3:r=g.sent();g.label=4;case 4:r;i=true,o=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];l=u.value;return[4,l()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();o=true;c=d;return[3,12];case 11:try{if(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:F.success('"'.concat(e.join(", "),'" setup completed.'));return[3,14];case 13:f=g.sent();throw F.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return ez.apply(this,arguments)}var eV=I(require("node-persist"),1),eQ=I(require("os"),1),eX=I(require("process"),1);function eZ(){return eX.default.env.CYBERSKILL_STORAGE_DIR||Q(eQ.default.homedir(),ee)}function e0(){return e1.apply(this,arguments)}function e1(){e1=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=eV.default.defaultInstance;if(e)return[3,2];return[4,eV.default.init({dir:eZ(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return e1.apply(this,arguments)}var e2={get:function e(e){return s(function(){var t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e0()];case 1:r.sent();return[4,eV.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(F.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e0()];case 1:r.sent();return[4,eV.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();F.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e0()];case 1:n.sent();return[4,eV.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();F.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e0()];case 1:n.sent();return[4,eV.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(F.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(F.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return y(this,function(t){try{return[2,"".concat(eZ()," (key: ").concat(e,")")]}catch(e){return[2,(F.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e4=N.promisify(T.exec);function e3(e){return"error_list:".concat(e)}function e6(e){return e5.apply(this,arguments)}function e5(){e5=s(function(e){var t,n,r;return y(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e3(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,e2.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/s(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e2.getLogLink(n)];case 1:e=t.sent();e&&F.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=i.sent();F.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e5.apply(this,arguments)}function e8(){return e9.apply(this,arguments)}function e9(){e9=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e2.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=s(function(e){var t;return y(this,function(n){switch(n.label){case 0:return[4,e2.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(F.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return e9.apply(this,arguments)}function e7(){return te.apply(this,arguments)}function te(){te=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e2.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return e2.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();F.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return te.apply(this,arguments)}function tt(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c=s.exec(e)||[],a=i.exec(e)||[],u=o.exec(e)||[];c.length&&r?t.push({file:r,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()}):a.length?t.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&e6(t),P&&n.length&&(F.warn("Unmatched lines:"),n.forEach(function(e){return F.info(" ".concat(e))}))}function tn(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&e6(n)}catch(t){tt(e)}}function tr(e){return ts.apply(this,arguments)}function ts(){ts=s(function(e){var t,n,r,s,i,o,c,a,u;var l=arguments;return y(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tn;n=new AbortController;q.default.on("SIGINT",function(){F.warn("Process interrupted. Terminating..."),n.abort(),q.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e4(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&F.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ts.apply(this,arguments)}function ti(e){return{raw:!0,cmd:e}}function to(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ek," ").concat(Z," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ek," ").concat(eO," ").concat(ef," ").concat(e):"".concat(ek," ").concat(ep," ").concat(e)}function tc(e,t){return typeof e=="function"?to(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?to(e,t):e}function ta(e){return tu.apply(this,arguments)}function tu(){tu=s(function(e){var t,n,r,s,i,o,c;var a=arguments;return y(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eW(Z)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tc(r,i)]}))]}})});return tu.apply(this,arguments)}function tl(e,t){return td.apply(this,arguments)}function td(){td=s(function(e,t){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);F.start("".concat(e)),P&&F.info("→ ".concat(t));return[4,tr(t)];case 1:r.sent(),F.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw F.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return td.apply(this,arguments)}function tp(){return tf.apply(this,arguments)}function tf(){tf=s(function(){var e,t;return y(this,function(n){switch(n.label){case 0:if(!K(eA.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eM.typescriptCheck()];case 1:return[4,tl.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=F.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tf.apply(this,arguments)}function tg(){return ty.apply(this,arguments)}function ty(){ty=s(function(){var e,t,n,r;var s=arguments;return y(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eM.eslintFix()];case 1:return[4,tl.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eM.eslintCheck()];case 4:return[4,tl.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return ty.apply(this,arguments)}function th(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";F.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tm(){return tv.apply(this,arguments)}function tv(){tv=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:return[4,e8()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?F.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(th("Warnings",n),th("Errors",t));return[2]}})});return tv.apply(this,arguments)}function tj(){return tx.apply(this,arguments)}function tx(){tx=s(function(){var e,t,n,r,s,i;return y(this,function(o){switch(o.label){case 0:return[4,e7()];case 1:o.sent();return[4,eW(Z)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(Z)];return[4,eM.build()];case 4:return[4,tl.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eM.stageBuildDirectory()];case 6:return[4,tl.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw F.error("Error building and staging ".concat(Z,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eM.lintStaged()];case 10:return[4,tl.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tm();return[2]}})});return tx.apply(this,arguments)}function tb(){return tw.apply(this,arguments)}function tw(){tw=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eM.eslintInspect()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tw.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e7()];case 1:e.sent();return[4,Promise.all([tp(),tg()])];case 2:e.sent(),tm();return[2]}})});return tS.apply(this,arguments)}function tO(){return tE.apply(this,arguments)}function tE(){tE=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e7()];case 1:e.sent();return[4,Promise.all([tp(),tg(!0)])];case 2:e.sent(),tm();return[2]}})});return tE.apply(this,arguments)}function t_(){return tk.apply(this,arguments)}function tk(){tk=s(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e7()];case 1:t.sent();e=["Validating commit message"];return[4,eM.commitLint()];case 2:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tm();return[2]}})});return tk.apply(this,arguments)}function tC(){return tT.apply(this,arguments)}function tT(){tT=s(function(){var e,t,n,r;return y(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eM.configureGitHook()];case 1:return[4,tl.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),Y(eA.GIT_HOOK);return[4,ta(eL)];case 3:t=s.sent();B(eA.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(ec,"\n");K(eA.GIT_IGNORE)?W(eA.GIT_IGNORE).split("\n").includes(ec)||H(eA.GIT_IGNORE,n):B(eA.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eM.simpleGitHooks()];case 4:return[4,tl.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tT.apply(this,arguments)}function tq(){return tN.apply(this,arguments)}function tN(){tN=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e$([Z],{update:!0,postInstallActions:[tC]})];case 1:e.sent();return[2]}})});return tN.apply(this,arguments)}function tG(){return tP.apply(this,arguments)}function tP(){tP=s(function(){return y(this,function(e){switch(e.label){case 0:Y(eA.NODE_MODULES,eA.PNPM_LOCK_YAML);return[4,eH()];case 1:e.sent();return[4,tC()];case 2:e.sent();return[2]}})});return tP.apply(this,arguments)}function tA(){return tL.apply(this,arguments)}function tL(){tL=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eM.nodeModulesInspect()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tL.apply(this,arguments)}function tR(){return tD.apply(this,arguments)}function tD(){tD=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eM.testUnit()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tD.apply(this,arguments)}function tF(){return tM.apply(this,arguments)}function tM(){tM=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eM.testE2e()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tM.apply(this,arguments)}s(function(){var e;return y(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,k.default)((0,_.hideBin)(E.default.argv)).scriptName(ep).usage("$0 <command> [options]").command("lint","Check code for linting issues",tI).command("lint:fix","Fix linting issues automatically",tO).command("lint:inspect","View active ESLint configuration",tb).command("lint-staged","Run lint checks on staged files",tj).command("commitlint","Validate commit message format",t_).command("setup","Initialize project setup and dependencies",tq).command("reset","Reset the project and reinstall dependencies",tG).command("inspect","Analyze installed project dependencies",tA).command("test:unit","Run unit test suite",tR).command("test:e2e","Run end-to-end test suite",tF).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(C.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();F.error("Fatal: ".concat(e.message)),E.default.exit(1);return[3,3];case 3:return[2]}})})();
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function y(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var h=Object.create;var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var c=function(){var s=u.value;!b.call(e,s)&&s!==n&&m(e,s,{get:function(){return t[s]},enumerable:!(r=v(t,s))||r.enumerable})};for(var a=j(t)[Symbol.iterator](),u;!(s=(u=a.next()).done);s=true)c()}catch(e){i=true;o=e}finally{try{if(!s&&a.return!=null){a.return()}}finally{if(i){throw o}}}return e};var I=function(e,t,n){return n=e!=null?h(x(e)):{},w(t||!e||!e.__esModule?m(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return w(m({},"__esModule",{value:!0}),e)};var O={};module.exports=S(O);var E=I(require("process"),1),_=require("yargs/helpers"),k=I(require("yargs/yargs"),1);var C={name:"@cyberskill/shared",type:"module",version:"1.76.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eslint-react/eslint-plugin":"1.43.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var T=require("child_process"),q=I(require("process"),1),N=I(require("util"),1);var G=I(require("process"),1),P=G.default.env.DEBUG==="true";var A=I(require("chalk"),1),L=I(require("consola"),1),R=require("graphql");P||(L.default.level=4);function D(e){var t=A.default[e];return typeof t=="function"?t:A.default.green}var F={silent:L.default.silent,level:L.default.level,fatal:L.default.fatal,error:L.default.error,warn:L.default.warn,log:L.default.log,info:L.default.info,success:L.default.success,ready:L.default.ready,start:L.default.start,box:L.default.box,debug:L.default.debug,trace:L.default.trace,verbose:L.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){L.default.box(A.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;L.default.log("".concat(A.default.gray("File:")," ").concat(A.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&L.default.log(" ".concat(D(n)("Rule:")," ").concat(s)),L.default.log(" ".concat(D(n)("Message:")," ").concat(i))}),L.default.box(D(n)("".concat(e," : ").concat(t.length))),L.default.log(A.default.gray("─".repeat(40)))}};var M={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var U=I(require("node-fetch"),1);var J=I(require("fs"),1);function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return J.existsSync(e)})}function W(e,t){var n=J.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function B(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);J.writeFileSync(e,i,"utf-8")}function H(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);J.appendFileSync(e,i,"utf-8")}function Y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){K(e)&&J.rmSync(e,{recursive:!0,force:!0})})}var $=I(require("process"),1);var z=I(require("path"),1);function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=z).resolve.apply(r,[X].concat(p(t)))}function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=z).join.apply(r,p(t))}var X=$.default.env.INIT_CWD||$.default.cwd(),Z="@cyberskill/shared",ee=".cyberskill-storage",et="node_modules",en="dist",er="package.json",es="package-lock.json",ei="tsconfig.json",eo=".gitignore",ec=".simple-git-hooks.json",ea="pnpm-lock.yaml",eu=".git/hooks/",el=".git/COMMIT_EDITMSG",ed=Q(X,et,Z,en),ep="cyberskill",ef="src/nodejs/cli/index.ts",eg="eslint",ey="eslint",eh="vitest",em="playwright",ev="vitest",ej="@commitlint/cli",ex="commitlint",eb="lint-staged",ew="lint-staged",eI="typescript",eS="tsc",eO="tsx",eE="git",e_="pnpm",ek="pnpm exec",eC="simple-git-hooks",eT="simple-git-hooks",eq="@eslint/config-inspector",eN="eslint-config-inspector",eG="node-modules-inspector",eP="node-modules-inspector",eA={CYBERSKILL_DIRECTORY:ed,WORKING_DIRECTORY:X,TS_CONFIG:V(ei),GIT_IGNORE:V(eo),GIT_HOOK:V(eu),GIT_COMMIT_MSG:V(el),SIMPLE_GIT_HOOKS_JSON:V(ec),PACKAGE_JSON:V(er),PACKAGE_LOCK_JSON:V(es),PNPM_LOCK_YAML:V(ea),NODE_MODULES:V(et),LINT_STAGED_CONFIG:V("".concat(ed,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:V("".concat(ed,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:V("".concat(ed,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:V("".concat(ed,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:V("".concat(ed,"/react/vitest/vitest.e2e.js"))};function eL(e){var t=e.isCurrentProject;return l({"pre-commit":ew,"commit-msg":ex},t&&{"pre-push":ti("".concat(eE," pull"))})}function eR(e){return eD.apply(this,arguments)}function eD(){eD=s(function(e){var t,n,r,s,i,o;var c=arguments;return y(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}s=d(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,e$(i.split(" "),{update:!0})];case 2:return[2,(a.sent(),tc(ti("".concat(ek," ").concat(o))))];case 3:return[2,tc(ti(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eD.apply(this,arguments)}function eF(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/s(function(){return y(this,function(t){return[2,eR.apply(void 0,[e].concat(p(n)))]})})}var eM={simpleGitHooks:eF("CLI",eC,eT),eslintInspect:eF("CLI",eq,eN),nodeModulesInspect:eF("CLI",eG,eP),eslintCheck:eF("CLI",eg,"".concat(ey," ").concat(eA.WORKING_DIRECTORY)),eslintFix:eF("CLI",eg,"".concat(ey," ").concat(eA.WORKING_DIRECTORY," --fix")),typescriptCheck:eF("CLI",eI,"".concat(eS," -p ").concat(eA.TS_CONFIG," --noEmit")),configureGitHook:eF("RAW","".concat(eE," config core.hooksPath ").concat(eA.GIT_HOOK)),testUnit:eF("CLI",eh,"".concat(ev," --config ").concat(eA.UNIT_TEST_CONFIG)),testE2e:eF("CLI","".concat(eh," ").concat(em),"".concat(ev," --config ").concat(eA.E2E_TEST_CONFIG)),commitLint:eF("CLI",ej,"".concat(ex," --edit ").concat(eA.GIT_COMMIT_MSG," --config ").concat(eA.COMMITLINT_CONFIG)),lintStaged:eF("CLI",eb,"".concat(ew," --config ").concat(eA.LINT_STAGED_CONFIG)),stageBuildDirectory:eF("RAW","".concat(eE," add ").concat(en)),build:eF("RAW","".concat(e_," run build")),pnpmInstallStandard:eF("RAW","".concat(e_," install")),pnpmInstallLegacy:eF("RAW","".concat(e_," install --legacy-peer-deps")),pnpmInstallForce:eF("RAW","".concat(e_," install --force"))};function eU(e){var t=Q(X,er);if(!K(t))return!1;try{var n=W(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return F.warn("Failed to read package.json: ".concat(e.message)),!1}}function eJ(e){return eK.apply(this,arguments)}function eK(){eK=s(function(e){var t,n,r,s;return y(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,U.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw F.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eK.apply(this,arguments)}function eW(e,t){return eB.apply(this,arguments)}function eB(){eB=s(function(e,t){var n,r,s,i,o,c,a,u,d,p,f,g,h,m,v,j,x,b,w,I,S;return y(this,function(y){switch(y.label){case 0:y.trys.push([0,4,,5]);n=eU(e);if(!n)return[2,l({},M)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},h=(s=u.devDependencies)!==null&&s!==void 0?s:{},m=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=h[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=m;return[3,3];case 1:return[4,eJ(e)];case 2:x=y.sent();y.label=3;case 3:v=x,j=d||m===v;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,B(a,u,{isJson:!0}),F.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:j}];case 4:S=y.sent();return[2,(F.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},M))];case 5:return[2]}})});return eB.apply(this,arguments)}function eH(){return eY.apply(this,arguments)}function eY(){eY=s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return y(this,function(p){switch(p.label){case 0:e=[{command:function(){return eM.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eM.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eM.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,tl("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();F.warn("Installation attempt failed: ".concat(a)),F.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eY.apply(this,arguments)}function e$(e,t){return ez.apply(this,arguments)}function ez(){ez=s(function(e,t){var n,r,s,i,o,c,a,u,l,d,f;return y(this,function(g){switch(g.label){case 0:if(!K(eA.PACKAGE_JSON)){F.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eW(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eH()];case 3:r=g.sent();g.label=4;case 4:r;i=true,o=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];l=u.value;return[4,l()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();o=true;c=d;return[3,12];case 11:try{if(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:f=g.sent();throw F.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return ez.apply(this,arguments)}var eV=I(require("node-persist"),1),eQ=I(require("os"),1),eX=I(require("process"),1);function eZ(){return eX.default.env.CYBERSKILL_STORAGE_DIR||Q(eQ.default.homedir(),ee)}function e0(){return e1.apply(this,arguments)}function e1(){e1=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=eV.default.defaultInstance;if(e)return[3,2];return[4,eV.default.init({dir:eZ(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return e1.apply(this,arguments)}var e2={get:function e(e){return s(function(){var t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e0()];case 1:r.sent();return[4,eV.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(F.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e0()];case 1:r.sent();return[4,eV.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();F.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e0()];case 1:n.sent();return[4,eV.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();F.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e0()];case 1:n.sent();return[4,eV.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(F.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(F.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return y(this,function(t){try{return[2,"".concat(eZ()," (key: ").concat(e,")")]}catch(e){return[2,(F.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e4=N.promisify(T.exec);function e3(e){return"error_list:".concat(e)}function e6(e){return e5.apply(this,arguments)}function e5(){e5=s(function(e){var t,n,r;return y(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e3(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,e2.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/s(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e2.getLogLink(n)];case 1:e=t.sent();e&&F.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=i.sent();F.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e5.apply(this,arguments)}function e8(){return e9.apply(this,arguments)}function e9(){e9=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e2.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=s(function(e){var t;return y(this,function(n){switch(n.label){case 0:return[4,e2.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(F.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return e9.apply(this,arguments)}function e7(){return te.apply(this,arguments)}function te(){te=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e2.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return e2.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();F.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return te.apply(this,arguments)}function tt(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c=s.exec(e)||[],a=i.exec(e)||[],u=o.exec(e)||[];c.length&&r?t.push({file:r,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()}):a.length?t.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&e6(t),P&&n.length&&(F.warn("Unmatched lines:"),n.forEach(function(e){return F.info(" ".concat(e))}))}function tn(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&e6(n)}catch(t){tt(e)}}function tr(e){return ts.apply(this,arguments)}function ts(){ts=s(function(e){var t,n,r,s,i,o,c,a,u;var l=arguments;return y(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tn;n=new AbortController;q.default.on("SIGINT",function(){F.warn("Process interrupted. Terminating..."),n.abort(),q.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e4(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&F.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ts.apply(this,arguments)}function ti(e){return{raw:!0,cmd:e}}function to(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ek," ").concat(Z," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ek," ").concat(eO," ").concat(ef," ").concat(e):"".concat(ek," ").concat(ep," ").concat(e)}function tc(e,t){return typeof e=="function"?to(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?to(e,t):e}function ta(e){return tu.apply(this,arguments)}function tu(){tu=s(function(e){var t,n,r,s,i,o,c;var a=arguments;return y(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eW(Z)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tc(r,i)]}))]}})});return tu.apply(this,arguments)}function tl(e,t){return td.apply(this,arguments)}function td(){td=s(function(e,t){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);F.start("".concat(e)),P&&F.info("→ ".concat(t));return[4,tr(t)];case 1:r.sent(),F.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw F.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return td.apply(this,arguments)}function tp(){return tf.apply(this,arguments)}function tf(){tf=s(function(){var e,t;return y(this,function(n){switch(n.label){case 0:if(!K(eA.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eM.typescriptCheck()];case 1:return[4,tl.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=F.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tf.apply(this,arguments)}function tg(){return ty.apply(this,arguments)}function ty(){ty=s(function(){var e,t,n,r;var s=arguments;return y(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eM.eslintFix()];case 1:return[4,tl.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eM.eslintCheck()];case 4:return[4,tl.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return ty.apply(this,arguments)}function th(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";F.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tm(){return tv.apply(this,arguments)}function tv(){tv=s(function(){var e,t,n;return y(this,function(r){switch(r.label){case 0:return[4,e8()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?F.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(th("Warnings",n),th("Errors",t));return[2]}})});return tv.apply(this,arguments)}function tj(){return tx.apply(this,arguments)}function tx(){tx=s(function(){var e,t,n,r,s,i;return y(this,function(o){switch(o.label){case 0:return[4,e7()];case 1:o.sent();return[4,eW(Z)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(Z)];return[4,eM.build()];case 4:return[4,tl.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eM.stageBuildDirectory()];case 6:return[4,tl.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw F.error("Error building and staging ".concat(Z,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eM.lintStaged()];case 10:return[4,tl.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tm();return[2]}})});return tx.apply(this,arguments)}function tb(){return tw.apply(this,arguments)}function tw(){tw=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eM.eslintInspect()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tw.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e7()];case 1:e.sent();return[4,Promise.all([tp(),tg()])];case 2:e.sent(),tm();return[2]}})});return tS.apply(this,arguments)}function tO(){return tE.apply(this,arguments)}function tE(){tE=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e7()];case 1:e.sent();return[4,Promise.all([tp(),tg(!0)])];case 2:e.sent(),tm();return[2]}})});return tE.apply(this,arguments)}function t_(){return tk.apply(this,arguments)}function tk(){tk=s(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,e7()];case 1:t.sent();e=["Validating commit message"];return[4,eM.commitLint()];case 2:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tm();return[2]}})});return tk.apply(this,arguments)}function tC(){return tT.apply(this,arguments)}function tT(){tT=s(function(){var e,t,n,r;return y(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eM.configureGitHook()];case 1:return[4,tl.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),Y(eA.GIT_HOOK);return[4,ta(eL)];case 3:t=s.sent();B(eA.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(ec,"\n");K(eA.GIT_IGNORE)?W(eA.GIT_IGNORE).split("\n").includes(ec)||H(eA.GIT_IGNORE,n):B(eA.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eM.simpleGitHooks()];case 4:return[4,tl.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tT.apply(this,arguments)}function tq(){return tN.apply(this,arguments)}function tN(){tN=s(function(){return y(this,function(e){switch(e.label){case 0:return[4,e$([Z],{update:!0,postInstallActions:[tC]})];case 1:e.sent();return[2]}})});return tN.apply(this,arguments)}function tG(){return tP.apply(this,arguments)}function tP(){tP=s(function(){return y(this,function(e){switch(e.label){case 0:Y(eA.NODE_MODULES,eA.PNPM_LOCK_YAML);return[4,eH()];case 1:e.sent();return[4,tC()];case 2:e.sent();return[2]}})});return tP.apply(this,arguments)}function tA(){return tL.apply(this,arguments)}function tL(){tL=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eM.nodeModulesInspect()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tL.apply(this,arguments)}function tR(){return tD.apply(this,arguments)}function tD(){tD=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eM.testUnit()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tD.apply(this,arguments)}function tF(){return tM.apply(this,arguments)}function tM(){tM=s(function(){var e;return y(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eM.testE2e()];case 1:return[4,tl.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tM.apply(this,arguments)}s(function(){var e;return y(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,k.default)((0,_.hideBin)(E.default.argv)).scriptName(ep).usage("$0 <command> [options]").command("lint","Check code for linting issues",tI).command("lint:fix","Fix linting issues automatically",tO).command("lint:inspect","View active ESLint configuration",tb).command("lint-staged","Run lint checks on staged files",tj).command("commitlint","Validate commit message format",t_).command("setup","Initialize project setup and dependencies",tq).command("reset","Reset the project and reinstall dependencies",tG).command("inspect","Analyze installed project dependencies",tA).command("test:unit","Run unit test suite",tR).command("test:e2e","Run end-to-end test suite",tF).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(C.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();F.error("Fatal: ".concat(e.message)),E.default.exit(1);return[3,3];case 3:return[2]}})})();
|
package/dist/nodejs/cli/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function h(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import m from"node:process";import{hideBin as y}from"yargs/helpers";import v from"yargs/yargs";var j={name:"@cyberskill/shared",type:"module",version:"1.74.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.6","@eslint-react/eslint-plugin":"1.43.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};import{exec as x}from"node:child_process";import b from"node:process";import*as w from"node:util";import I from"node:process";var S=I.env.DEBUG==="true";import E from"chalk";import O from"consola";import{GraphQLError as _}from"graphql";S||(O.level=4);function k(e){var t=E[e];return typeof t=="function"?t:E.green}var C={silent:O.silent,level:O.level,fatal:O.fatal,error:O.error,warn:O.warn,log:O.log,info:O.info,success:O.success,ready:O.ready,start:O.start,box:O.box,debug:O.debug,trace:O.trace,verbose:O.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){O.box(E.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;O.log("".concat(E.gray("File:")," ").concat(E.blue("".concat(t).concat(r?":".concat(r):"")))),s&&O.log(" ".concat(k(n)("Rule:")," ").concat(s)),O.log(" ".concat(k(n)("Message:")," ").concat(i))}),O.box(k(n)("".concat(e," : ").concat(t.length))),O.log(E.gray("─".repeat(40)))}};var T={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import G from"node-fetch";import*as N from"node:fs";function L(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return N.existsSync(e)})}function A(e,t){var n=N.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function R(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);N.writeFileSync(e,i,"utf-8")}function q(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);N.appendFileSync(e,i,"utf-8")}function P(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){L(e)&&N.rmSync(e,{recursive:!0,force:!0})})}import D from"node:process";import*as F from"node:path";function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=F).resolve.apply(r,[J].concat(p(t)))}function U(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=F).join.apply(r,p(t))}var J=D.env.INIT_CWD||D.cwd(),K="@cyberskill/shared",W=".cyberskill-storage",B="node_modules",H="dist",Y="package.json",$="package-lock.json",z="tsconfig.json",V=".gitignore",Q=".simple-git-hooks.json",X="pnpm-lock.yaml",Z=".git/hooks/",ee=".git/COMMIT_EDITMSG",et=U(J,B,K,H),en="cyberskill",er="src/nodejs/cli/index.ts",es="eslint",ei="eslint",eo="vitest",ec="playwright",ea="vitest",eu="@commitlint/cli",el="commitlint",ed="lint-staged",ep="lint-staged",ef="typescript",eg="tsc",eh="tsx",em="git",ey="pnpm",ev="pnpm exec",ej="simple-git-hooks",ex="simple-git-hooks",eb="@eslint/config-inspector",ew="eslint-config-inspector",eI="node-modules-inspector",eS="node-modules-inspector",eE={CYBERSKILL_DIRECTORY:et,WORKING_DIRECTORY:J,TS_CONFIG:M(z),GIT_IGNORE:M(V),GIT_HOOK:M(Z),GIT_COMMIT_MSG:M(ee),SIMPLE_GIT_HOOKS_JSON:M(Q),PACKAGE_JSON:M(Y),PACKAGE_LOCK_JSON:M($),PNPM_LOCK_YAML:M(X),NODE_MODULES:M(B),LINT_STAGED_CONFIG:M("".concat(et,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:M("".concat(et,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:M("".concat(et,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:M("".concat(et,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:M("".concat(et,"/react/vitest/vitest.e2e.js"))};function eO(e){var t=e.isCurrentProject;return l({"pre-commit":ep,"commit-msg":el},t&&{"pre-push":e6("".concat(em," pull"))})}function e_(e){return ek.apply(this,arguments)}function ek(){ek=s(function(e){var t,n,r,s,i,o;var c=arguments;return h(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}s=d(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eD(i.split(" "),{update:!0})];case 2:return[2,(a.sent(),e8(e6("".concat(ev," ").concat(o))))];case 3:return[2,e8(e6(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return ek.apply(this,arguments)}function eC(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/s(function(){return h(this,function(t){return[2,e_.apply(void 0,[e].concat(p(n)))]})})}var eT={simpleGitHooks:eC("CLI",ej,ex),eslintInspect:eC("CLI",eb,ew),nodeModulesInspect:eC("CLI",eI,eS),eslintCheck:eC("CLI",es,"".concat(ei," ").concat(eE.WORKING_DIRECTORY)),eslintFix:eC("CLI",es,"".concat(ei," ").concat(eE.WORKING_DIRECTORY," --fix")),typescriptCheck:eC("CLI",ef,"".concat(eg," -p ").concat(eE.TS_CONFIG," --noEmit")),configureGitHook:eC("RAW","".concat(em," config core.hooksPath ").concat(eE.GIT_HOOK)),testUnit:eC("CLI",eo,"".concat(ea," --config ").concat(eE.UNIT_TEST_CONFIG)),testE2e:eC("CLI","".concat(eo," ").concat(ec),"".concat(ea," --config ").concat(eE.E2E_TEST_CONFIG)),commitLint:eC("CLI",eu,"".concat(el," --edit ").concat(eE.GIT_COMMIT_MSG," --config ").concat(eE.COMMITLINT_CONFIG)),lintStaged:eC("CLI",ed,"".concat(ep," --config ").concat(eE.LINT_STAGED_CONFIG)),stageBuildDirectory:eC("RAW","".concat(em," add ").concat(H)),build:eC("RAW","".concat(ey," run build")),pnpmInstallStandard:eC("RAW","".concat(ey," install")),pnpmInstallLegacy:eC("RAW","".concat(ey," install --legacy-peer-deps")),pnpmInstallForce:eC("RAW","".concat(ey," install --force"))};function eG(e){var t=U(J,Y);if(!L(t))return!1;try{var n=A(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return C.warn("Failed to read package.json: ".concat(e.message)),!1}}function eN(e){return eL.apply(this,arguments)}function eL(){eL=s(function(e){var t,n,r,s;return h(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,G("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw C.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eL.apply(this,arguments)}function eA(e,t){return eR.apply(this,arguments)}function eR(){eR=s(function(e,t){var n,r,s,i,o,c,a,u,d,p,f,g,m,y,v,j,x,b,w,I,S;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);n=eG(e);if(!n)return[2,l({},T)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},y=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=m[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=y;return[3,3];case 1:return[4,eN(e)];case 2:x=h.sent();h.label=3;case 3:v=x,j=d||y===v;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,R(a,u,{isJson:!0}),C.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:j}];case 4:S=h.sent();return[2,(C.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},T))];case 5:return[2]}})});return eR.apply(this,arguments)}function eq(){return eP.apply(this,arguments)}function eP(){eP=s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return h(this,function(p){switch(p.label){case 0:e=[{command:function(){return eT.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eT.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eT.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,te("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();C.warn("Installation attempt failed: ".concat(a)),C.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eP.apply(this,arguments)}function eD(e,t){return eF.apply(this,arguments)}function eF(){eF=s(function(e,t){var n,r,s,i,o,c,a,u,l,d,f;return h(this,function(g){switch(g.label){case 0:if(!L(eE.PACKAGE_JSON)){C.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eA(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eq()];case 3:r=g.sent();g.label=4;case 4:r;i=true,o=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];l=u.value;return[4,l()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();o=true;c=d;return[3,12];case 11:try{if(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:C.success('"'.concat(e.join(", "),'" setup completed.'));return[3,14];case 13:f=g.sent();throw C.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return eF.apply(this,arguments)}import eM from"node-persist";import eU from"node:os";import eJ from"node:process";function eK(){return eJ.env.CYBERSKILL_STORAGE_DIR||U(eU.homedir(),W)}function eW(){return eB.apply(this,arguments)}function eB(){eB=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=eM.defaultInstance;if(e)return[3,2];return[4,eM.init({dir:eK(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eB.apply(this,arguments)}var eH={get:function e(e){return s(function(){var t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eW()];case 1:r.sent();return[4,eM.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(C.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eW()];case 1:r.sent();return[4,eM.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();C.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eW()];case 1:n.sent();return[4,eM.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();C.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eW()];case 1:n.sent();return[4,eM.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(C.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(C.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return h(this,function(t){try{return[2,"".concat(eK()," (key: ").concat(e,")")]}catch(e){return[2,(C.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eY=w.promisify(x);function e$(e){return"error_list:".concat(e)}function ez(e){return eV.apply(this,arguments)}function eV(){eV=s(function(e){var t,n,r;return h(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e$(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,eH.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/s(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eH.getLogLink(n)];case 1:e=t.sent();e&&C.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=i.sent();C.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return eV.apply(this,arguments)}function eQ(){return eX.apply(this,arguments)}function eX(){eX=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eH.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=s(function(e){var t;return h(this,function(n){switch(n.label){case 0:return[4,eH.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(C.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return eX.apply(this,arguments)}function eZ(){return e0.apply(this,arguments)}function e0(){e0=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eH.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eH.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();C.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}function e1(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c=s.exec(e)||[],a=i.exec(e)||[],u=o.exec(e)||[];c.length&&r?t.push({file:r,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()}):a.length?t.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ez(t),S&&n.length&&(C.warn("Unmatched lines:"),n.forEach(function(e){return C.info(" ".concat(e))}))}function e2(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&ez(n)}catch(t){e1(e)}}function e4(e){return e3.apply(this,arguments)}function e3(){e3=s(function(e){var t,n,r,s,i,o,c,a,u;var l=arguments;return h(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e2;n=new AbortController;b.on("SIGINT",function(){C.warn("Process interrupted. Terminating..."),n.abort(),b.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eY(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&C.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}function e6(e){return{raw:!0,cmd:e}}function e5(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ev," ").concat(K," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ev," ").concat(eh," ").concat(er," ").concat(e):"".concat(ev," ").concat(en," ").concat(e)}function e8(e,t){return typeof e=="function"?e5(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?e5(e,t):e}function e9(e){return e7.apply(this,arguments)}function e7(){e7=s(function(e){var t,n,r,s,i,o,c;var a=arguments;return h(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eA(K)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,e8(r,i)]}))]}})});return e7.apply(this,arguments)}function te(e,t){return tt.apply(this,arguments)}function tt(){tt=s(function(e,t){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);C.start("".concat(e)),S&&C.info("→ ".concat(t));return[4,e4(t)];case 1:r.sent(),C.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw C.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tt.apply(this,arguments)}function tn(){return tr.apply(this,arguments)}function tr(){tr=s(function(){var e,t;return h(this,function(n){switch(n.label){case 0:if(!L(eE.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eT.typescriptCheck()];case 1:return[4,te.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=C.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tr.apply(this,arguments)}function ts(){return ti.apply(this,arguments)}function ti(){ti=s(function(){var e,t,n,r;var s=arguments;return h(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eT.eslintFix()];case 1:return[4,te.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eT.eslintCheck()];case 4:return[4,te.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return ti.apply(this,arguments)}function to(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";C.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tc(){return ta.apply(this,arguments)}function ta(){ta=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:return[4,eQ()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?C.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(to("Warnings",n),to("Errors",t));return[2]}})});return ta.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=s(function(){var e,t,n,r,s,i;return h(this,function(o){switch(o.label){case 0:return[4,eZ()];case 1:o.sent();return[4,eA(K)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(K)];return[4,eT.build()];case 4:return[4,te.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eT.stageBuildDirectory()];case 6:return[4,te.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw C.error("Error building and staging ".concat(K,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eT.lintStaged()];case 10:return[4,te.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tc();return[2]}})});return tl.apply(this,arguments)}function td(){return tp.apply(this,arguments)}function tp(){tp=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eT.eslintInspect()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tp.apply(this,arguments)}function tf(){return tg.apply(this,arguments)}function tg(){tg=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eZ()];case 1:e.sent();return[4,Promise.all([tn(),ts()])];case 2:e.sent(),tc();return[2]}})});return tg.apply(this,arguments)}function th(){return tm.apply(this,arguments)}function tm(){tm=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eZ()];case 1:e.sent();return[4,Promise.all([tn(),ts(!0)])];case 2:e.sent(),tc();return[2]}})});return tm.apply(this,arguments)}function ty(){return tv.apply(this,arguments)}function tv(){tv=s(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eZ()];case 1:t.sent();e=["Validating commit message"];return[4,eT.commitLint()];case 2:return[4,te.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tc();return[2]}})});return tv.apply(this,arguments)}function tj(){return tx.apply(this,arguments)}function tx(){tx=s(function(){var e,t,n,r;return h(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eT.configureGitHook()];case 1:return[4,te.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),P(eE.GIT_HOOK);return[4,e9(eO)];case 3:t=s.sent();R(eE.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(Q,"\n");L(eE.GIT_IGNORE)?A(eE.GIT_IGNORE).split("\n").includes(Q)||q(eE.GIT_IGNORE,n):R(eE.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eT.simpleGitHooks()];case 4:return[4,te.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tx.apply(this,arguments)}function tb(){return tw.apply(this,arguments)}function tw(){tw=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eD([K],{update:!0,postInstallActions:[tj]})];case 1:e.sent();return[2]}})});return tw.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=s(function(){return h(this,function(e){switch(e.label){case 0:P(eE.NODE_MODULES,eE.PNPM_LOCK_YAML);return[4,eq()];case 1:e.sent();return[4,tj()];case 2:e.sent();return[2]}})});return tS.apply(this,arguments)}function tE(){return tO.apply(this,arguments)}function tO(){tO=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eT.nodeModulesInspect()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tO.apply(this,arguments)}function t_(){return tk.apply(this,arguments)}function tk(){tk=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eT.testUnit()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tk.apply(this,arguments)}function tC(){return tT.apply(this,arguments)}function tT(){tT=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eT.testE2e()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tT.apply(this,arguments)}s(function(){var e;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,v(y(m.argv)).scriptName(en).usage("$0 <command> [options]").command("lint","Check code for linting issues",tf).command("lint:fix","Fix linting issues automatically",th).command("lint:inspect","View active ESLint configuration",td).command("lint-staged","Run lint checks on staged files",tu).command("commitlint","Validate commit message format",ty).command("setup","Initialize project setup and dependencies",tb).command("reset","Reset the project and reinstall dependencies",tI).command("inspect","Analyze installed project dependencies",tE).command("test:unit","Run unit test suite",t_).command("test:e2e","Run end-to-end test suite",tC).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(j.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();C.error("Fatal: ".concat(e.message)),m.exit(1);return[3,3];case 3:return[2]}})})();
|
|
1
|
+
function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function h(e,t){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function c(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(s=i[0]&2?r["return"]:i[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,i[1])).done)return s;if(r=0,s)i=[i[0]&2,s.value];switch(i[0]){case 0:case 1:s=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(s=o.trys,s=s.length>0&&s[s.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(i[0]===6&&o.label<s[1]){o.label=s[1];s=i;break}if(s&&o.label<s[2]){o.label=s[2];o.ops.push(i);break}if(s[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=s=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import m from"node:process";import{hideBin as y}from"yargs/helpers";import v from"yargs/yargs";var j={name:"@cyberskill/shared",type:"module",version:"1.76.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./configs/vitest/react/e2e":{types:"./dist/configs/vitest/react/e2e.d.ts",import:"./dist/configs/vitest/react/e2e.js",require:"./dist/configs/vitest/react/e2e.cjs"},"./configs/vitest/react/unit":{types:"./dist/configs/vitest/react/unit.d.ts",import:"./dist/configs/vitest/react/unit.js",require:"./dist/configs/vitest/react/unit.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.7","@eslint-react/eslint-plugin":"1.43.0","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@graphql-codegen/typescript-react-apollo":"4.3.2","@microsoft/api-extractor":"7.52.3","@next/eslint-plugin-next":"15.3.0","@swc/core":"1.11.18","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.8.1","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",consola:"3.4.2","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0","eslint-config-next":"15.3.0","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"24.2.3",jsdom:"26.0.0",localforage:"1.10.0","modern-normalize":"3.0.1",mongodb:"6.15.0",mongoose:"8.13.2","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.0.2","node-fetch":"3.3.2","node-persist":"4.0.4",ora:"8.2.0",playwright:"1.51.1","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.4.1","react-icons":"5.5.0",sass:"1.86.3",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.2.6",vitest:"3.1.1","vitest-browser-react":"0.1.1",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.0","@eslint/config-inspector":"1.0.2","@types/crypto-js":"4.2.2","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.0","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/yargs":"17.0.33",eslint:"9.24.0","lint-staged":"15.5.0","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};import{exec as x}from"node:child_process";import b from"node:process";import*as w from"node:util";import I from"node:process";var S=I.env.DEBUG==="true";import E from"chalk";import O from"consola";import{GraphQLError as _}from"graphql";S||(O.level=4);function k(e){var t=E[e];return typeof t=="function"?t:E.green}var C={silent:O.silent,level:O.level,fatal:O.fatal,error:O.error,warn:O.warn,log:O.log,info:O.info,success:O.success,ready:O.ready,start:O.start,box:O.box,debug:O.debug,trace:O.trace,verbose:O.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){O.box(E.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;O.log("".concat(E.gray("File:")," ").concat(E.blue("".concat(t).concat(r?":".concat(r):"")))),s&&O.log(" ".concat(k(n)("Rule:")," ").concat(s)),O.log(" ".concat(k(n)("Message:")," ").concat(i))}),O.box(k(n)("".concat(e," : ").concat(t.length))),O.log(E.gray("─".repeat(40)))}};var T={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import G from"node-fetch";import*as N from"node:fs";function L(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return N.existsSync(e)})}function A(e,t){var n=N.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":f(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function R(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);N.writeFileSync(e,i,"utf-8")}function q(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,s=r===void 0?!1:r,i=s&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);N.appendFileSync(e,i,"utf-8")}function P(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){L(e)&&N.rmSync(e,{recursive:!0,force:!0})})}import D from"node:process";import*as F from"node:path";function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=F).resolve.apply(r,[J].concat(p(t)))}function U(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=F).join.apply(r,p(t))}var J=D.env.INIT_CWD||D.cwd(),K="@cyberskill/shared",W=".cyberskill-storage",B="node_modules",H="dist",Y="package.json",$="package-lock.json",z="tsconfig.json",V=".gitignore",Q=".simple-git-hooks.json",X="pnpm-lock.yaml",Z=".git/hooks/",ee=".git/COMMIT_EDITMSG",et=U(J,B,K,H),en="cyberskill",er="src/nodejs/cli/index.ts",es="eslint",ei="eslint",eo="vitest",ec="playwright",ea="vitest",eu="@commitlint/cli",el="commitlint",ed="lint-staged",ep="lint-staged",ef="typescript",eg="tsc",eh="tsx",em="git",ey="pnpm",ev="pnpm exec",ej="simple-git-hooks",ex="simple-git-hooks",eb="@eslint/config-inspector",ew="eslint-config-inspector",eI="node-modules-inspector",eS="node-modules-inspector",eE={CYBERSKILL_DIRECTORY:et,WORKING_DIRECTORY:J,TS_CONFIG:M(z),GIT_IGNORE:M(V),GIT_HOOK:M(Z),GIT_COMMIT_MSG:M(ee),SIMPLE_GIT_HOOKS_JSON:M(Q),PACKAGE_JSON:M(Y),PACKAGE_LOCK_JSON:M($),PNPM_LOCK_YAML:M(X),NODE_MODULES:M(B),LINT_STAGED_CONFIG:M("".concat(et,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:M("".concat(et,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:M("".concat(et,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:M("".concat(et,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:M("".concat(et,"/react/vitest/vitest.e2e.js"))};function eO(e){var t=e.isCurrentProject;return l({"pre-commit":ep,"commit-msg":el},t&&{"pre-push":e6("".concat(em," pull"))})}function e_(e){return ek.apply(this,arguments)}function ek(){ek=s(function(e){var t,n,r,s,i,o;var c=arguments;return h(this,function(a){switch(a.label){case 0:for(t=c.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=c[r]}s=d(n,2),i=s[0],o=s[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eD(i.split(" "),{update:!0})];case 2:return[2,(a.sent(),e8(e6("".concat(ev," ").concat(o))))];case 3:return[2,e8(e6(i))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return ek.apply(this,arguments)}function eC(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}return /*#__PURE__*/s(function(){return h(this,function(t){return[2,e_.apply(void 0,[e].concat(p(n)))]})})}var eT={simpleGitHooks:eC("CLI",ej,ex),eslintInspect:eC("CLI",eb,ew),nodeModulesInspect:eC("CLI",eI,eS),eslintCheck:eC("CLI",es,"".concat(ei," ").concat(eE.WORKING_DIRECTORY)),eslintFix:eC("CLI",es,"".concat(ei," ").concat(eE.WORKING_DIRECTORY," --fix")),typescriptCheck:eC("CLI",ef,"".concat(eg," -p ").concat(eE.TS_CONFIG," --noEmit")),configureGitHook:eC("RAW","".concat(em," config core.hooksPath ").concat(eE.GIT_HOOK)),testUnit:eC("CLI",eo,"".concat(ea," --config ").concat(eE.UNIT_TEST_CONFIG)),testE2e:eC("CLI","".concat(eo," ").concat(ec),"".concat(ea," --config ").concat(eE.E2E_TEST_CONFIG)),commitLint:eC("CLI",eu,"".concat(el," --edit ").concat(eE.GIT_COMMIT_MSG," --config ").concat(eE.COMMITLINT_CONFIG)),lintStaged:eC("CLI",ed,"".concat(ep," --config ").concat(eE.LINT_STAGED_CONFIG)),stageBuildDirectory:eC("RAW","".concat(em," add ").concat(H)),build:eC("RAW","".concat(ey," run build")),pnpmInstallStandard:eC("RAW","".concat(ey," install")),pnpmInstallLegacy:eC("RAW","".concat(ey," install --legacy-peer-deps")),pnpmInstallForce:eC("RAW","".concat(ey," install --force"))};function eG(e){var t=U(J,Y);if(!L(t))return!1;try{var n=A(t,{asJson:!0}),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return C.warn("Failed to read package.json: ".concat(e.message)),!1}}function eN(e){return eL.apply(this,arguments)}function eL(){eL=s(function(e){var t,n,r,s;return h(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,G("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw C.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})});return eL.apply(this,arguments)}function eA(e,t){return eR.apply(this,arguments)}function eR(){eR=s(function(e,t){var n,r,s,i,o,c,a,u,d,p,f,g,m,y,v,j,x,b,w,I,S;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);n=eG(e);if(!n)return[2,l({},T)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},m=(s=u.devDependencies)!==null&&s!==void 0?s:{},y=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=m[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=y;return[3,3];case 1:return[4,eN(e)];case 2:x=h.sent();h.label=3;case 3:v=x,j=d||y===v;if(!j&&(t===null||t===void 0?void 0:t.update)){;w=p?"dependencies":f?"devDependencies":null;w&&((b=u[w])===null||b===void 0?void 0:b[e])!==v&&(u[w]=(I=u[w])!==null&&I!==void 0?I:{},u[w][e]=v,R(a,u,{isJson:!0}),C.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:j}];case 4:S=h.sent();return[2,(C.error('Error checking package "'.concat(e,'": ').concat(S.message)),l({},T))];case 5:return[2]}})});return eR.apply(this,arguments)}function eq(){return eP.apply(this,arguments)}function eP(){eP=s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return h(this,function(p){switch(p.label){case 0:e=[{command:function(){return eT.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eT.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eT.pnpmInstallForce()},message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,te("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();C.warn("Installation attempt failed: ".concat(a)),C.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eP.apply(this,arguments)}function eD(e,t){return eF.apply(this,arguments)}function eF(){eF=s(function(e,t){var n,r,s,i,o,c,a,u,l,d,f;return h(this,function(g){switch(g.label){case 0:if(!L(eE.PACKAGE_JSON)){C.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eA(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eq()];case 3:r=g.sent();g.label=4;case 4:r;i=true,o=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];l=u.value;return[4,l()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();o=true;c=d;return[3,12];case 11:try{if(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:f=g.sent();throw C.error('Failed to setup "'.concat(e.join(", "),'": ').concat(f.message)),f;case 14:return[2]}})});return eF.apply(this,arguments)}import eM from"node-persist";import eU from"node:os";import eJ from"node:process";function eK(){return eJ.env.CYBERSKILL_STORAGE_DIR||U(eU.homedir(),W)}function eW(){return eB.apply(this,arguments)}function eB(){eB=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=eM.defaultInstance;if(e)return[3,2];return[4,eM.init({dir:eK(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return eB.apply(this,arguments)}var eH={get:function e(e){return s(function(){var t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eW()];case 1:r.sent();return[4,eM.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(C.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eW()];case 1:r.sent();return[4,eM.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();C.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eW()];case 1:n.sent();return[4,eM.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();C.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eW()];case 1:n.sent();return[4,eM.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(C.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(C.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return h(this,function(t){try{return[2,"".concat(eK()," (key: ").concat(e,")")]}catch(e){return[2,(C.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eY=w.promisify(x);function e$(e){return"error_list:".concat(e)}function ez(e){return eV.apply(this,arguments)}function eV(){eV=s(function(e){var t,n,r;return h(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e$(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,eH.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/s(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eH.getLogLink(n)];case 1:e=t.sent();e&&C.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=i.sent();C.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return eV.apply(this,arguments)}function eQ(){return eX.apply(this,arguments)}function eX(){eX=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eH.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=s(function(e){var t;return h(this,function(n){switch(n.label){case 0:return[4,eH.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(C.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return eX.apply(this,arguments)}function eZ(){return e0.apply(this,arguments)}function e0(){e0=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eH.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eH.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();C.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}function e1(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c=s.exec(e)||[],a=i.exec(e)||[],u=o.exec(e)||[];c.length&&r?t.push({file:r,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()}):a.length?t.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ez(t),S&&n.length&&(C.warn("Unmatched lines:"),n.forEach(function(e){return C.info(" ".concat(e))}))}function e2(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&ez(n)}catch(t){e1(e)}}function e4(e){return e3.apply(this,arguments)}function e3(){e3=s(function(e){var t,n,r,s,i,o,c,a,u;var l=arguments;return h(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e2;n=new AbortController;b.on("SIGINT",function(){C.warn("Process interrupted. Terminating..."),n.abort(),b.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,eY(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&C.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}function e6(e){return{raw:!0,cmd:e}}function e5(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ev," ").concat(K," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ev," ").concat(eh," ").concat(er," ").concat(e):"".concat(ev," ").concat(en," ").concat(e)}function e8(e,t){return typeof e=="function"?e5(e(t),t):(typeof e==="undefined"?"undefined":f(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?e5(e,t):e}function e9(e){return e7.apply(this,arguments)}function e7(){e7=s(function(e){var t,n,r,s,i,o,c;var a=arguments;return h(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];c=!1;return[3,3];case 1:return[4,eA(K)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,e8(r,i)]}))]}})});return e7.apply(this,arguments)}function te(e,t){return tt.apply(this,arguments)}function tt(){tt=s(function(e,t){var n;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);C.start("".concat(e)),S&&C.info("→ ".concat(t));return[4,e4(t)];case 1:r.sent(),C.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw C.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tt.apply(this,arguments)}function tn(){return tr.apply(this,arguments)}function tr(){tr=s(function(){var e,t;return h(this,function(n){switch(n.label){case 0:if(!L(eE.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eT.typescriptCheck()];case 1:return[4,te.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=C.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tr.apply(this,arguments)}function ts(){return ti.apply(this,arguments)}function ti(){ti=s(function(){var e,t,n,r;var s=arguments;return h(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eT.eslintFix()];case 1:return[4,te.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eT.eslintCheck()];case 4:return[4,te.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})});return ti.apply(this,arguments)}function to(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";C.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}function tc(){return ta.apply(this,arguments)}function ta(){ta=s(function(){var e,t,n;return h(this,function(r){switch(r.label){case 0:return[4,eQ()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?C.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(to("Warnings",n),to("Errors",t));return[2]}})});return ta.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=s(function(){var e,t,n,r,s,i;return h(this,function(o){switch(o.label){case 0:return[4,eZ()];case 1:o.sent();return[4,eA(K)];case 2:e=o.sent(),t=e.isCurrentProject;if(!t)return[3,9];o.label=3;case 3:o.trys.push([3,8,,9]);n=["Building package: ".concat(K)];return[4,eT.build()];case 4:return[4,te.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eT.stageBuildDirectory()];case 6:return[4,te.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw C.error("Error building and staging ".concat(K,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eT.lintStaged()];case 10:return[4,te.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tc();return[2]}})});return tl.apply(this,arguments)}function td(){return tp.apply(this,arguments)}function tp(){tp=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eT.eslintInspect()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tp.apply(this,arguments)}function tf(){return tg.apply(this,arguments)}function tg(){tg=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eZ()];case 1:e.sent();return[4,Promise.all([tn(),ts()])];case 2:e.sent(),tc();return[2]}})});return tg.apply(this,arguments)}function th(){return tm.apply(this,arguments)}function tm(){tm=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eZ()];case 1:e.sent();return[4,Promise.all([tn(),ts(!0)])];case 2:e.sent(),tc();return[2]}})});return tm.apply(this,arguments)}function ty(){return tv.apply(this,arguments)}function tv(){tv=s(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eZ()];case 1:t.sent();e=["Validating commit message"];return[4,eT.commitLint()];case 2:return[4,te.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tc();return[2]}})});return tv.apply(this,arguments)}function tj(){return tx.apply(this,arguments)}function tx(){tx=s(function(){var e,t,n,r;return h(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eT.configureGitHook()];case 1:return[4,te.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),P(eE.GIT_HOOK);return[4,e9(eO)];case 3:t=s.sent();R(eE.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(Q,"\n");L(eE.GIT_IGNORE)?A(eE.GIT_IGNORE).split("\n").includes(Q)||q(eE.GIT_IGNORE,n):R(eE.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eT.simpleGitHooks()];case 4:return[4,te.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})});return tx.apply(this,arguments)}function tb(){return tw.apply(this,arguments)}function tw(){tw=s(function(){return h(this,function(e){switch(e.label){case 0:return[4,eD([K],{update:!0,postInstallActions:[tj]})];case 1:e.sent();return[2]}})});return tw.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=s(function(){return h(this,function(e){switch(e.label){case 0:P(eE.NODE_MODULES,eE.PNPM_LOCK_YAML);return[4,eq()];case 1:e.sent();return[4,tj()];case 2:e.sent();return[2]}})});return tS.apply(this,arguments)}function tE(){return tO.apply(this,arguments)}function tO(){tO=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eT.nodeModulesInspect()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tO.apply(this,arguments)}function t_(){return tk.apply(this,arguments)}function tk(){tk=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eT.testUnit()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tk.apply(this,arguments)}function tC(){return tT.apply(this,arguments)}function tT(){tT=s(function(){var e;return h(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eT.testE2e()];case 1:return[4,te.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tT.apply(this,arguments)}s(function(){var e;return h(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,v(y(m.argv)).scriptName(en).usage("$0 <command> [options]").command("lint","Check code for linting issues",tf).command("lint:fix","Fix linting issues automatically",th).command("lint:inspect","View active ESLint configuration",td).command("lint-staged","Run lint checks on staged files",tu).command("commitlint","Validate commit message format",ty).command("setup","Initialize project setup and dependencies",tb).command("reset","Reset the project and reinstall dependencies",tI).command("inspect","Analyze installed project dependencies",tE).command("test:unit","Run unit test suite",t_).command("test:e2e","Run end-to-end test suite",tC).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(j.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();C.error("Fatal: ".concat(e.message)),m.exit(1);return[3,3];case 3:return[2]}})})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t,r,n,a,o,c){try{var i=e[o](c);var s=i.value}catch(e){r(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(n,a)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,o){var c=e.apply(t,r);function i(e){n(c,a,o,i,s,"next",e)}function s(e){n(c,a,o,i,s,"throw",e)}i(undefined)})}}function o(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var c,i;try{for(r=r.call(e);!(a=(c=r.next()).done);a=true){n.push(c.value);if(t&&n.length===t)break}}catch(e){o=true;i=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw i}}return n}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){o(e,t,r[t])})}return e}function f(e,r){return t(e)||i(e,r)||v(e,r)||s()}function d(e){return r(e)||c(e)||v(e)||u()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function v(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function h(e,t){var r,n,a,o,c={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(e){return function(t){return s([e,t])}}function s(o){if(r)throw new TypeError("Generator is already executing.");while(c)try{if(r=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:c.label++;return{value:o[1],done:false};case 5:c.label++;n=o[1];o=[0];continue;case 7:o=c.ops.pop();c.trys.pop();continue;default:if(!(a=c.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){c=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){c.label=o[1];break}if(o[0]===6&&c.label<a[1]){c.label=a[1];a=o;break}if(a&&c.label<a[2]){c.label=a[2];c.ops.push(o);break}if(a[2])c.ops.pop();c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e];n=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var y=Object.create;var m=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var O=function(e,t){for(var r in t)m(e,r,{get:t[r],enumerable:!0})},S=function(e,t,r,n){var a=true,o=false,c=undefined;if(t&&(typeof t==="undefined"?"undefined":p(t))=="object"||typeof t=="function")try{var i=function(){var a=u.value;!I.call(e,a)&&a!==r&&m(e,a,{get:function(){return t[a]},enumerable:!(n=g(t,a))||n.enumerable})};for(var s=b(t)[Symbol.iterator](),u;!(a=(u=s.next()).done);a=true)i()}catch(e){o=true;c=e}finally{try{if(!a&&s.return!=null){s.return()}}finally{if(o){throw c}}}return e};var _=function(e,t,r){return r=e!=null?y(w(e)):{},S(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)},C=function(e){return S(m({},"__esModule",{value:!0}),e)};var E={};O(E,{clearAllErrorLists:function(){return e4},formatCommand:function(){return tt},getStoredErrorLists:function(){return e1},rawCommand:function(){return e9},resolveCommands:function(){return tr},runCommand:function(){return ta}});module.exports=C(E);var T=require("child_process"),j=_(require("process"),1),k=_(require("util"),1);var A=_(require("process"),1),L=A.default.env.DEBUG==="true";var N=_(require("chalk"),1),P=_(require("consola"),1),G=require("graphql");L||(P.default.level=4);function R(e){var t=N.default[e];return typeof t=="function"?t:N.default.green}var x={silent:P.default.silent,level:P.default.level,fatal:P.default.fatal,error:P.default.error,warn:P.default.warn,log:P.default.log,info:P.default.info,success:P.default.success,ready:P.default.ready,start:P.default.start,box:P.default.box,debug:P.default.debug,trace:P.default.trace,verbose:P.default.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){P.default.box(N.default.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,a=e.rule,o=e.message;P.default.log("".concat(N.default.gray("File:")," ").concat(N.default.blue("".concat(t).concat(n?":".concat(n):"")))),a&&P.default.log(" ".concat(R(r)("Rule:")," ").concat(a)),P.default.log(" ".concat(R(r)("Message:")," ").concat(o))}),P.default.box(R(r)("".concat(e," : ").concat(t.length))),P.default.log(N.default.gray("─".repeat(40)))}};var D={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var F=_(require("node-fetch"),1);var M=_(require("fs"),1);function U(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return M.existsSync(e)})}function q(e,t){var r=M.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var n=JSON.parse(r);if((typeof n==="undefined"?"undefined":p(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return r}function J(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,a=n===void 0?!1:n,o=a&&(typeof t==="undefined"?"undefined":p(t))=="object"?JSON.stringify(t,null,4):String(t);M.writeFileSync(e,o,"utf-8")}var W=_(require("process"),1);var K=_(require("path"),1);function Y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=K).resolve.apply(n,[H].concat(d(t)))}function B(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=K).join.apply(n,d(t))}var H=W.default.env.INIT_CWD||W.default.cwd(),$="@cyberskill/shared",z=".cyberskill-storage",Q="node_modules",V="dist",X="package.json",Z="package-lock.json",ee="tsconfig.json",et=".gitignore",er=".simple-git-hooks.json",en="pnpm-lock.yaml",ea=".git/hooks/",eo=".git/COMMIT_EDITMSG",ec=B(H,Q,$,V),ei="cyberskill",es="src/nodejs/cli/index.ts",eu="eslint",el="eslint",ef="vitest",ed="playwright",ep="vitest",ev="@commitlint/cli",eh="commitlint",ey="lint-staged",em="lint-staged",eg="typescript",eb="tsc",ew="tsx",eI="git",eO="pnpm",eS="pnpm exec",e_="simple-git-hooks",eC="simple-git-hooks",eE="@eslint/config-inspector",eT="eslint-config-inspector",ej="node-modules-inspector",ek="node-modules-inspector",eA={CYBERSKILL_DIRECTORY:ec,WORKING_DIRECTORY:H,TS_CONFIG:Y(ee),GIT_IGNORE:Y(et),GIT_HOOK:Y(ea),GIT_COMMIT_MSG:Y(eo),SIMPLE_GIT_HOOKS_JSON:Y(er),PACKAGE_JSON:Y(X),PACKAGE_LOCK_JSON:Y(Z),PNPM_LOCK_YAML:Y(en),NODE_MODULES:Y(Q),LINT_STAGED_CONFIG:Y("".concat(ec,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:Y("".concat(ec,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:Y("".concat(ec,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:Y("".concat(ec,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:Y("".concat(ec,"/react/vitest/vitest.e2e.js"))};function eL(e){return eN.apply(this,arguments)}function eN(){eN=a(function(e){var t,r,n,a,o,c;var i=arguments;return h(this,function(s){switch(s.label){case 0:for(t=i.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=i[n]}a=f(r,2),o=a[0],c=a[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eJ(o.split(" "),{update:!0})];case 2:return[2,(s.sent(),tt(e9("".concat(eS," ").concat(c))))];case 3:return[2,tt(e9(o))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eN.apply(this,arguments)}function eP(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return /*#__PURE__*/a(function(){return h(this,function(t){return[2,eL.apply(void 0,[e].concat(d(r)))]})})}var eG={simpleGitHooks:eP("CLI",e_,eC),eslintInspect:eP("CLI",eE,eT),nodeModulesInspect:eP("CLI",ej,ek),eslintCheck:eP("CLI",eu,"".concat(el," ").concat(eA.WORKING_DIRECTORY)),eslintFix:eP("CLI",eu,"".concat(el," ").concat(eA.WORKING_DIRECTORY," --fix")),typescriptCheck:eP("CLI",eg,"".concat(eb," -p ").concat(eA.TS_CONFIG," --noEmit")),configureGitHook:eP("RAW","".concat(eI," config core.hooksPath ").concat(eA.GIT_HOOK)),testUnit:eP("CLI",ef,"".concat(ep," --config ").concat(eA.UNIT_TEST_CONFIG)),testE2e:eP("CLI","".concat(ef," ").concat(ed),"".concat(ep," --config ").concat(eA.E2E_TEST_CONFIG)),commitLint:eP("CLI",ev,"".concat(eh," --edit ").concat(eA.GIT_COMMIT_MSG," --config ").concat(eA.COMMITLINT_CONFIG)),lintStaged:eP("CLI",ey,"".concat(em," --config ").concat(eA.LINT_STAGED_CONFIG)),stageBuildDirectory:eP("RAW","".concat(eI," add ").concat(V)),build:eP("RAW","".concat(eO," run build")),pnpmInstallStandard:eP("RAW","".concat(eO," install")),pnpmInstallLegacy:eP("RAW","".concat(eO," install --legacy-peer-deps")),pnpmInstallForce:eP("RAW","".concat(eO," install --force"))};function eR(e){var t=B(H,X);if(!U(t))return!1;try{var r=q(t,{asJson:!0}),n=r.name,a=r.dependencies,o=a===void 0?{}:a,c=r.devDependencies,i=c===void 0?{}:c,s=n===e,u=e in o,l=e in i;return s||u||l?{path:t,file:r,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return x.warn("Failed to read package.json: ".concat(e.message)),!1}}function ex(e){return eD.apply(this,arguments)}function eD(){eD=a(function(e){var t,r,n,a;return h(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,F.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:r=o.sent(),n=r.version;return[2,n];case 3:a=o.sent();throw x.error('Failed to fetch version for "'.concat(e,'": ').concat(a.message)),a;case 4:return[2]}})});return eD.apply(this,arguments)}function eF(e,t){return eM.apply(this,arguments)}function eM(){eM=a(function(e,t){var r,n,a,o,c,i,s,u,f,d,p,v,y,m,g,b,w,I,O,S,_;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);r=eR(e);if(!r)return[2,l({},D)];s=r.path,u=r.file,f=r.isCurrentProject,d=r.isDepend,p=r.isDevDepend,v=(n=u.dependencies)!==null&&n!==void 0?n:{},y=(a=u.devDependencies)!==null&&a!==void 0?a:{},m=f?(o=u.version)!==null&&o!==void 0?o:"0.0.0":d?(c=v[e])!==null&&c!==void 0?c:"0.0.0":p?(i=y[e])!==null&&i!==void 0?i:"0.0.0":"0.0.0";if(!f)return[3,1];w=m;return[3,3];case 1:return[4,ex(e)];case 2:w=h.sent();h.label=3;case 3:g=w,b=f||m===g;if(!b&&(t===null||t===void 0?void 0:t.update)){;O=d?"dependencies":p?"devDependencies":null;O&&((I=u[O])===null||I===void 0?void 0:I[e])!==g&&(u[O]=(S=u[O])!==null&&S!==void 0?S:{},u[O][e]=g,J(s,u,{isJson:!0}),x.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:_=h.sent();return[2,(x.error('Error checking package "'.concat(e,'": ').concat(_.message)),l({},D))];case 5:return[2]}})});return eM.apply(this,arguments)}function eU(){return eq.apply(this,arguments)}function eq(){eq=a(function(){var e,t,r,n,a,o,c,i,s,u,l,f;return h(this,function(d){switch(d.label){case 0:e=[{command:function(){return eG.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eG.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eG.pnpmInstallForce()},message:"Retrying with force install"}];t=true,r=false,n=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);a=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];c=o.value,i=c.command,s=c.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,i()];case 4:u=d.sent();return[4,ta("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();x.warn("Installation attempt failed: ".concat(s)),x.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();r=true;n=f;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eq.apply(this,arguments)}function eJ(e,t){return eW.apply(this,arguments)}function eW(){eW=a(function(e,t){var r,n,a,o,c,i,s,u,l,f,p;return h(this,function(v){switch(v.label){case 0:if(!U(eA.PACKAGE_JSON)){x.error("package.json not found. Aborting setup.");return[2]}v.label=1;case 1:v.trys.push([1,13,,14]);r=d(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eF(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:n=v.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eU()];case 3:n=v.sent();v.label=4;case 4:n;o=true,c=false,i=undefined;v.label=5;case 5:v.trys.push([5,10,11,12]);s=((a=t===null||t===void 0?void 0:t.postInstallActions)!==null&&a!==void 0?a:[])[Symbol.iterator]();v.label=6;case 6:if(!!(o=(u=s.next()).done))return[3,9];l=u.value;return[4,l()];case 7:v.sent();v.label=8;case 8:o=true;return[3,6];case 9:return[3,12];case 10:f=v.sent();c=true;i=f;return[3,12];case 11:try{if(!o&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 12:x.success('"'.concat(e.join(", "),'" setup completed.'));return[3,14];case 13:p=v.sent();throw x.error('Failed to setup "'.concat(e.join(", "),'": ').concat(p.message)),p;case 14:return[2]}})});return eW.apply(this,arguments)}var eK=_(require("node-persist"),1),eY=_(require("os"),1),eB=_(require("process"),1);function eH(){return eB.default.env.CYBERSKILL_STORAGE_DIR||B(eY.default.homedir(),z)}function e$(){return ez.apply(this,arguments)}function ez(){ez=a(function(){var e;return h(this,function(t){switch(t.label){case 0:e=eK.default.defaultInstance;if(e)return[3,2];return[4,eK.default.init({dir:eH(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return ez.apply(this,arguments)}var eQ={get:function e(e){return a(function(){var t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(x.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return a(function(){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();x.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();x.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(x.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return h(this,function(t){try{return[2,"".concat(eH()," (key: ").concat(e,")")]}catch(e){return[2,(x.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eV=k.promisify(T.exec);function eX(e){return"error_list:".concat(e)}function eZ(e){return e0.apply(this,arguments)}function e0(){e0=a(function(e){var t,r,n;return h(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eX(t);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,eQ.set(r,{errors:e,timestamp:t})];case 2:o.sent(),setTimeout(/*#__PURE__*/a(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eQ.getLogLink(r)];case 1:e=t.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();x.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}function e1(){return e2.apply(this,arguments)}function e2(){e2=a(function(){var e,t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eQ.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=a(function(e){var t;return h(this,function(r){switch(r.label){case 0:return[4,eQ.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(x.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return e2.apply(this,arguments)}function e4(){return e3.apply(this,arguments)}function e3(){e3=a(function(){var e,t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eQ.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eQ.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();x.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}function e5(e){var t=[],r=[],n="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var i=a.exec(e)||[],s=o.exec(e)||[],u=c.exec(e)||[];i.length&&n?t.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):s.length?t.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4]==="error"?"error":"warning",message:s[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&eZ(t),L&&r.length&&(x.warn("Unmatched lines:"),r.forEach(function(e){return x.info(" ".concat(e))}))}function e6(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,a=e.line,o=e.column,c=e.ruleId,i=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(a,":").concat(o),rule:c,message:i})})}),r.length&&eZ(r)}catch(t){e5(e)}}function e8(e){return e7.apply(this,arguments)}function e7(){e7=a(function(e){var t,r,n,a,o,c,i,s,u;var l=arguments;return h(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e6;r=new AbortController;j.default.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),r.abort(),j.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,eV(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=f.sent(),a=n.stdout,o=n.stderr;[a,o].forEach(function(e){return e&&t(e)});return[3,4];case 3:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&x.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e7.apply(this,arguments)}function e9(e){return{raw:!0,cmd:e}}function te(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eS," ").concat($," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eS," ").concat(ew," ").concat(es," ").concat(e):"".concat(eS," ").concat(ei," ").concat(e)}function tt(e,t){return typeof e=="function"?te(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?te(e,t):e}function tr(e){return tn.apply(this,arguments)}function tn(){tn=a(function(e){var t,r,n,a,o,c,i;var s=arguments;return h(this,function(u){switch(u.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];i=!1;return[3,3];case 1:return[4,eF($)];case 2:i=u.sent().isCurrentProject;u.label=3;case 3:a=i,o={isRemote:n,isCurrentProject:a},c=typeof e=="function"?e(o):e;return[2,Object.fromEntries(Object.entries(c).map(function(e){var t=f(e,2),r=t[0],n=t[1];return[r,tt(n,o)]}))]}})});return tn.apply(this,arguments)}function ta(e,t){return to.apply(this,arguments)}function to(){to=a(function(e,t){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);x.start("".concat(e)),L&&x.info("→ ".concat(t));return[4,e8(t)];case 1:n.sent(),x.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw x.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return to.apply(this,arguments)}0&&(module.exports={clearAllErrorLists:clearAllErrorLists,formatCommand:formatCommand,getStoredErrorLists:getStoredErrorLists,rawCommand:rawCommand,resolveCommands:resolveCommands,runCommand:runCommand});
|
|
1
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function t(e){if(Array.isArray(e))return e}function r(t){if(Array.isArray(t))return e(t)}function n(e,t,r,n,a,o,c){try{var i=e[o](c);var s=i.value}catch(e){r(e);return}if(i.done){t(s)}else{Promise.resolve(s).then(n,a)}}function a(e){return function(){var t=this,r=arguments;return new Promise(function(a,o){var c=e.apply(t,r);function i(e){n(c,a,o,i,s,"next",e)}function s(e){n(c,a,o,i,s,"throw",e)}i(undefined)})}}function o(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,t){var r=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r==null)return;var n=[];var a=true;var o=false;var c,i;try{for(r=r.call(e);!(a=(c=r.next()).done);a=true){n.push(c.value);if(t&&n.length===t)break}}catch(e){o=true;i=e}finally{try{if(!a&&r["return"]!=null)r["return"]()}finally{if(o)throw i}}return n}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};var n=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))}n.forEach(function(t){o(e,t,r[t])})}return e}function f(e,r){return t(e)||i(e,r)||v(e,r)||s()}function d(e){return r(e)||c(e)||v(e)||u()}function p(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function v(t,r){if(!t)return;if(typeof t==="string")return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor)n=t.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}function h(e,t){var r,n,a,o,c={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]};return o={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function i(e){return function(t){return s([e,t])}}function s(o){if(r)throw new TypeError("Generator is already executing.");while(c)try{if(r=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:c.label++;return{value:o[1],done:false};case 5:c.label++;n=o[1];o=[0];continue;case 7:o=c.ops.pop();c.trys.pop();continue;default:if(!(a=c.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){c=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){c.label=o[1];break}if(o[0]===6&&c.label<a[1]){c.label=a[1];a=o;break}if(a&&c.label<a[2]){c.label=a[2];c.ops.push(o);break}if(a[2])c.ops.pop();c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e];n=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var y=Object.create;var m=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var O=function(e,t){for(var r in t)m(e,r,{get:t[r],enumerable:!0})},S=function(e,t,r,n){var a=true,o=false,c=undefined;if(t&&(typeof t==="undefined"?"undefined":p(t))=="object"||typeof t=="function")try{var i=function(){var a=u.value;!I.call(e,a)&&a!==r&&m(e,a,{get:function(){return t[a]},enumerable:!(n=g(t,a))||n.enumerable})};for(var s=b(t)[Symbol.iterator](),u;!(a=(u=s.next()).done);a=true)i()}catch(e){o=true;c=e}finally{try{if(!a&&s.return!=null){s.return()}}finally{if(o){throw c}}}return e};var _=function(e,t,r){return r=e!=null?y(w(e)):{},S(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)},C=function(e){return S(m({},"__esModule",{value:!0}),e)};var E={};O(E,{clearAllErrorLists:function(){return e4},formatCommand:function(){return tt},getStoredErrorLists:function(){return e1},rawCommand:function(){return e9},resolveCommands:function(){return tr},runCommand:function(){return ta}});module.exports=C(E);var T=require("child_process"),j=_(require("process"),1),k=_(require("util"),1);var A=_(require("process"),1),L=A.default.env.DEBUG==="true";var N=_(require("chalk"),1),P=_(require("consola"),1),G=require("graphql");L||(P.default.level=4);function R(e){var t=N.default[e];return typeof t=="function"?t:N.default.green}var x={silent:P.default.silent,level:P.default.level,fatal:P.default.fatal,error:P.default.error,warn:P.default.warn,log:P.default.log,info:P.default.info,success:P.default.success,ready:P.default.ready,start:P.default.start,box:P.default.box,debug:P.default.debug,trace:P.default.trace,verbose:P.default.verbose,printBoxedLog:function e(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){P.default.box(N.default.green(e));return}t.forEach(function(e){var t=e.file,n=e.position,a=e.rule,o=e.message;P.default.log("".concat(N.default.gray("File:")," ").concat(N.default.blue("".concat(t).concat(n?":".concat(n):"")))),a&&P.default.log(" ".concat(R(r)("Rule:")," ").concat(a)),P.default.log(" ".concat(R(r)("Message:")," ").concat(o))}),P.default.box(R(r)("".concat(e," : ").concat(t.length))),P.default.log(N.default.gray("─".repeat(40)))}};var D={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var F=_(require("node-fetch"),1);var M=_(require("fs"),1);function U(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}return t.every(function(e){return M.existsSync(e)})}function q(e,t){var r=M.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var n=JSON.parse(r);if((typeof n==="undefined"?"undefined":p(n))=="object"&&n!==null)return n;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return r}function J(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var n=r.isJson,a=n===void 0?!1:n,o=a&&(typeof t==="undefined"?"undefined":p(t))=="object"?JSON.stringify(t,null,4):String(t);M.writeFileSync(e,o,"utf-8")}var W=_(require("process"),1);var K=_(require("path"),1);function Y(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=K).resolve.apply(n,[H].concat(d(t)))}function B(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++){t[r]=arguments[r]}var n;return(n=K).join.apply(n,d(t))}var H=W.default.env.INIT_CWD||W.default.cwd(),$="@cyberskill/shared",z=".cyberskill-storage",Q="node_modules",V="dist",X="package.json",Z="package-lock.json",ee="tsconfig.json",et=".gitignore",er=".simple-git-hooks.json",en="pnpm-lock.yaml",ea=".git/hooks/",eo=".git/COMMIT_EDITMSG",ec=B(H,Q,$,V),ei="cyberskill",es="src/nodejs/cli/index.ts",eu="eslint",el="eslint",ef="vitest",ed="playwright",ep="vitest",ev="@commitlint/cli",eh="commitlint",ey="lint-staged",em="lint-staged",eg="typescript",eb="tsc",ew="tsx",eI="git",eO="pnpm",eS="pnpm exec",e_="simple-git-hooks",eC="simple-git-hooks",eE="@eslint/config-inspector",eT="eslint-config-inspector",ej="node-modules-inspector",ek="node-modules-inspector",eA={CYBERSKILL_DIRECTORY:ec,WORKING_DIRECTORY:H,TS_CONFIG:Y(ee),GIT_IGNORE:Y(et),GIT_HOOK:Y(ea),GIT_COMMIT_MSG:Y(eo),SIMPLE_GIT_HOOKS_JSON:Y(er),PACKAGE_JSON:Y(X),PACKAGE_LOCK_JSON:Y(Z),PNPM_LOCK_YAML:Y(en),NODE_MODULES:Y(Q),LINT_STAGED_CONFIG:Y("".concat(ec,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:Y("".concat(ec,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:Y("".concat(ec,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:Y("".concat(ec,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:Y("".concat(ec,"/react/vitest/vitest.e2e.js"))};function eL(e){return eN.apply(this,arguments)}function eN(){eN=a(function(e){var t,r,n,a,o,c;var i=arguments;return h(this,function(s){switch(s.label){case 0:for(t=i.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=i[n]}a=f(r,2),o=a[0],c=a[1];switch(e){case"CLI":return[3,1];case"RAW":return[3,3]}return[3,4];case 1:return[4,eJ(o.split(" "),{update:!0})];case 2:return[2,(s.sent(),tt(e9("".concat(eS," ").concat(c))))];case 3:return[2,tt(e9(o))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eN.apply(this,arguments)}function eP(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return /*#__PURE__*/a(function(){return h(this,function(t){return[2,eL.apply(void 0,[e].concat(d(r)))]})})}var eG={simpleGitHooks:eP("CLI",e_,eC),eslintInspect:eP("CLI",eE,eT),nodeModulesInspect:eP("CLI",ej,ek),eslintCheck:eP("CLI",eu,"".concat(el," ").concat(eA.WORKING_DIRECTORY)),eslintFix:eP("CLI",eu,"".concat(el," ").concat(eA.WORKING_DIRECTORY," --fix")),typescriptCheck:eP("CLI",eg,"".concat(eb," -p ").concat(eA.TS_CONFIG," --noEmit")),configureGitHook:eP("RAW","".concat(eI," config core.hooksPath ").concat(eA.GIT_HOOK)),testUnit:eP("CLI",ef,"".concat(ep," --config ").concat(eA.UNIT_TEST_CONFIG)),testE2e:eP("CLI","".concat(ef," ").concat(ed),"".concat(ep," --config ").concat(eA.E2E_TEST_CONFIG)),commitLint:eP("CLI",ev,"".concat(eh," --edit ").concat(eA.GIT_COMMIT_MSG," --config ").concat(eA.COMMITLINT_CONFIG)),lintStaged:eP("CLI",ey,"".concat(em," --config ").concat(eA.LINT_STAGED_CONFIG)),stageBuildDirectory:eP("RAW","".concat(eI," add ").concat(V)),build:eP("RAW","".concat(eO," run build")),pnpmInstallStandard:eP("RAW","".concat(eO," install")),pnpmInstallLegacy:eP("RAW","".concat(eO," install --legacy-peer-deps")),pnpmInstallForce:eP("RAW","".concat(eO," install --force"))};function eR(e){var t=B(H,X);if(!U(t))return!1;try{var r=q(t,{asJson:!0}),n=r.name,a=r.dependencies,o=a===void 0?{}:a,c=r.devDependencies,i=c===void 0?{}:c,s=n===e,u=e in o,l=e in i;return s||u||l?{path:t,file:r,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return x.warn("Failed to read package.json: ".concat(e.message)),!1}}function ex(e){return eD.apply(this,arguments)}function eD(){eD=a(function(e){var t,r,n,a;return h(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,F.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:r=o.sent(),n=r.version;return[2,n];case 3:a=o.sent();throw x.error('Failed to fetch version for "'.concat(e,'": ').concat(a.message)),a;case 4:return[2]}})});return eD.apply(this,arguments)}function eF(e,t){return eM.apply(this,arguments)}function eM(){eM=a(function(e,t){var r,n,a,o,c,i,s,u,f,d,p,v,y,m,g,b,w,I,O,S,_;return h(this,function(h){switch(h.label){case 0:h.trys.push([0,4,,5]);r=eR(e);if(!r)return[2,l({},D)];s=r.path,u=r.file,f=r.isCurrentProject,d=r.isDepend,p=r.isDevDepend,v=(n=u.dependencies)!==null&&n!==void 0?n:{},y=(a=u.devDependencies)!==null&&a!==void 0?a:{},m=f?(o=u.version)!==null&&o!==void 0?o:"0.0.0":d?(c=v[e])!==null&&c!==void 0?c:"0.0.0":p?(i=y[e])!==null&&i!==void 0?i:"0.0.0":"0.0.0";if(!f)return[3,1];w=m;return[3,3];case 1:return[4,ex(e)];case 2:w=h.sent();h.label=3;case 3:g=w,b=f||m===g;if(!b&&(t===null||t===void 0?void 0:t.update)){;O=d?"dependencies":p?"devDependencies":null;O&&((I=u[O])===null||I===void 0?void 0:I[e])!==g&&(u[O]=(S=u[O])!==null&&S!==void 0?S:{},u[O][e]=g,J(s,u,{isJson:!0}),x.info('Updated "'.concat(e,'" to version ').concat(g)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:b}];case 4:_=h.sent();return[2,(x.error('Error checking package "'.concat(e,'": ').concat(_.message)),l({},D))];case 5:return[2]}})});return eM.apply(this,arguments)}function eU(){return eq.apply(this,arguments)}function eq(){eq=a(function(){var e,t,r,n,a,o,c,i,s,u,l,f;return h(this,function(d){switch(d.label){case 0:e=[{command:function(){return eG.pnpmInstallStandard()},message:"Installing dependencies (standard)"},{command:function(){return eG.pnpmInstallLegacy()},message:"Retrying with legacy peer dependencies"},{command:function(){return eG.pnpmInstallForce()},message:"Retrying with force install"}];t=true,r=false,n=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);a=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];c=o.value,i=c.command,s=c.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,i()];case 4:u=d.sent();return[4,ta("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();x.warn("Installation attempt failed: ".concat(s)),x.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();r=true;n=f;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw n}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eq.apply(this,arguments)}function eJ(e,t){return eW.apply(this,arguments)}function eW(){eW=a(function(e,t){var r,n,a,o,c,i,s,u,l,f,p;return h(this,function(v){switch(v.label){case 0:if(!U(eA.PACKAGE_JSON)){x.error("package.json not found. Aborting setup.");return[2]}v.label=1;case 1:v.trys.push([1,13,,14]);r=d(new Set(e)).sort();return[4,Promise.all(r.map(function(e){return eF(e,{update:t===null||t===void 0?void 0:t.update})}))];case 2:n=v.sent().every(function(e){return e.isUpToDate});if(n)return[3,4];return[4,eU()];case 3:n=v.sent();v.label=4;case 4:n;o=true,c=false,i=undefined;v.label=5;case 5:v.trys.push([5,10,11,12]);s=((a=t===null||t===void 0?void 0:t.postInstallActions)!==null&&a!==void 0?a:[])[Symbol.iterator]();v.label=6;case 6:if(!!(o=(u=s.next()).done))return[3,9];l=u.value;return[4,l()];case 7:v.sent();v.label=8;case 8:o=true;return[3,6];case 9:return[3,12];case 10:f=v.sent();c=true;i=f;return[3,12];case 11:try{if(!o&&s.return!=null){s.return()}}finally{if(c){throw i}}return[7];case 12:return[3,14];case 13:p=v.sent();throw x.error('Failed to setup "'.concat(e.join(", "),'": ').concat(p.message)),p;case 14:return[2]}})});return eW.apply(this,arguments)}var eK=_(require("node-persist"),1),eY=_(require("os"),1),eB=_(require("process"),1);function eH(){return eB.default.env.CYBERSKILL_STORAGE_DIR||B(eY.default.homedir(),z)}function e$(){return ez.apply(this,arguments)}function ez(){ez=a(function(){var e;return h(this,function(t){switch(t.label){case 0:e=eK.default.defaultInstance;if(e)return[3,2];return[4,eK.default.init({dir:eH(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return ez.apply(this,arguments)}var eQ={get:function e(e){return a(function(){var t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(x.error('[Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,t){return a(function(){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e$()];case 1:n.sent();return[4,eK.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();x.error('[Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();x.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,t;return h(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e$()];case 1:r.sent();return[4,eK.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(x.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return h(this,function(t){try{return[2,"".concat(eH()," (key: ").concat(e,")")]}catch(e){return[2,(x.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eV=k.promisify(T.exec);function eX(e){return"error_list:".concat(e)}function eZ(e){return e0.apply(this,arguments)}function e0(){e0=a(function(e){var t,r,n;return h(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];t=Date.now(),r=eX(t);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,eQ.set(r,{errors:e,timestamp:t})];case 2:o.sent(),setTimeout(/*#__PURE__*/a(function(){var e;return h(this,function(t){switch(t.label){case 0:return[4,eQ.getLogLink(r)];case 1:e=t.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:n=o.sent();x.error("Failed to save errors: ".concat(n.message));return[3,4];case 4:return[2]}})});return e0.apply(this,arguments)}function e1(){return e2.apply(this,arguments)}function e2(){e2=a(function(){var e,t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eQ.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=a(function(e){var t;return h(this,function(r){switch(r.label){case 0:return[4,eQ.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,n.sent().flat()];case 3:r=n.sent();return[2,(x.error("Failed to retrieve stored errors: ".concat(r.message)),[])];case 4:return[2]}})});return e2.apply(this,arguments)}function e4(){return e3.apply(this,arguments)}function e3(){e3=a(function(){var e,t,r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eQ.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return eQ.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();x.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return e3.apply(this,arguments)}function e5(e){var t=[],r=[],n="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var i=a.exec(e)||[],s=o.exec(e)||[],u=c.exec(e)||[];i.length&&n?t.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):s.length?t.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4]==="error"?"error":"warning",message:s[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&eZ(t),L&&r.length&&(x.warn("Unmatched lines:"),r.forEach(function(e){return x.info(" ".concat(e))}))}function e6(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,a=e.line,o=e.column,c=e.ruleId,i=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(a,":").concat(o),rule:c,message:i})})}),r.length&&eZ(r)}catch(t){e5(e)}}function e8(e){return e7.apply(this,arguments)}function e7(){e7=a(function(e){var t,r,n,a,o,c,i,s,u;var l=arguments;return h(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:e6;r=new AbortController;j.default.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),r.abort(),j.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,eV(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=f.sent(),a=n.stdout,o=n.stderr;[a,o].forEach(function(e){return e&&t(e)});return[3,4];case 3:c=f.sent();i=c.stdout,s=c.stderr,u=c.message;[i,s].forEach(function(e){return e&&t(e)}),!s&&!i&&x.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return e7.apply(this,arguments)}function e9(e){return{raw:!0,cmd:e}}function te(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eS," ").concat($," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eS," ").concat(ew," ").concat(es," ").concat(e):"".concat(eS," ").concat(ei," ").concat(e)}function tt(e,t){return typeof e=="function"?te(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?te(e,t):e}function tr(e){return tn.apply(this,arguments)}function tn(){tn=a(function(e){var t,r,n,a,o,c,i;var s=arguments;return h(this,function(u){switch(u.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};n=(r=t===null||t===void 0?void 0:t.isRemote)!==null&&r!==void 0?r:!1;if(!n)return[3,1];i=!1;return[3,3];case 1:return[4,eF($)];case 2:i=u.sent().isCurrentProject;u.label=3;case 3:a=i,o={isRemote:n,isCurrentProject:a},c=typeof e=="function"?e(o):e;return[2,Object.fromEntries(Object.entries(c).map(function(e){var t=f(e,2),r=t[0],n=t[1];return[r,tt(n,o)]}))]}})});return tn.apply(this,arguments)}function ta(e,t){return to.apply(this,arguments)}function to(){to=a(function(e,t){var r;return h(this,function(n){switch(n.label){case 0:n.trys.push([0,2,,3]);x.start("".concat(e)),L&&x.info("→ ".concat(t));return[4,e8(t)];case 1:n.sent(),x.success("".concat(e," done."));return[3,3];case 2:r=n.sent();throw x.error("".concat(e," failed: ").concat(r.message)),r;case 3:return[2]}})});return to.apply(this,arguments)}0&&(module.exports={clearAllErrorLists:clearAllErrorLists,formatCommand:formatCommand,getStoredErrorLists:getStoredErrorLists,rawCommand:rawCommand,resolveCommands:resolveCommands,runCommand:runCommand});
|