@cyberskill/shared 1.96.0 → 1.97.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/dist/_tsup-dts-rollup.d.cts +1 -7
- package/dist/_tsup-dts-rollup.d.ts +1 -7
- package/dist/configs/config.util.cjs +1 -1
- package/dist/configs/config.util.js +1 -1
- package/dist/configs/env/env.util.cjs +1 -1
- package/dist/configs/env/env.util.js +1 -1
- package/dist/configs/env/index.cjs +1 -1
- package/dist/configs/env/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.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -1
- package/dist/nodejs/apollo-server/apollo-server.util.cjs +1 -1
- package/dist/nodejs/apollo-server/apollo-server.util.js +1 -1
- package/dist/nodejs/apollo-server/index.cjs +1 -1
- package/dist/nodejs/apollo-server/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.d.cts +0 -1
- package/dist/nodejs/index.d.ts +0 -1
- package/dist/nodejs/index.js +1 -1
- package/dist/nodejs/log/index.cjs +1 -1
- package/dist/nodejs/log/index.js +1 -1
- package/dist/nodejs/log/log.util.cjs +1 -1
- package/dist/nodejs/log/log.util.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.d.cts +0 -1
- package/dist/nodejs/path/index.d.ts +0 -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.d.cts +0 -1
- package/dist/nodejs/path/path.util.d.ts +0 -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 +1 -1
|
@@ -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,i,s,o){try{var a=e[s](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(undefined)})}}function s(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 a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw a}}return r}function c(){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){s(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}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 m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(s=0)),s)try{if(n=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;r=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(a[0]===6&&s.label<i[1]){s.label=i[1];i=a;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(a);break}if(i[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var y=Object.create;var h=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t){return h(e,"name",{value:t,configurable:!0})};var I=function(e,t,n,r){var i=true,s=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var a=function(){var i=u.value;!b.call(e,i)&&i!==n&&h(e,i,{get:function(){return t[i]},enumerable:!(r=v(t,i))||r.enumerable})};for(var c=j(t)[Symbol.iterator](),u;!(i=(u=c.next()).done);i=true)a()}catch(e){s=true;o=e}finally{try{if(!i&&c.return!=null){c.return()}}finally{if(s){throw o}}}return e};var E=function(e,t,n){return n=e!=null?y(x(e)):{},I(t||!e||!e.__esModule?h(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return I(h({},"__esModule",{value:!0}),e)};var C={};module.exports=S(C);var O=E(require("process"),1),_=require("yargs/helpers"),k=E(require("yargs/yargs"),1);var L={name:"@cyberskill/shared",type:"module",version:"1.95.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"},"./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/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/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/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/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"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/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.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","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.52.0","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.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var T=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var R=require("child_process"),D=E(require("process"),1),G=E(require("util"),1);var q=".cyberskill-storage";var A=E(require("dotenv"),1),P=require("envalid"),N=E(require("os"),1),M=E(require("path"),1),F=E(require("process"),1);A.default.config();function U(){var e={DEBUG:F.default.env.DEBUG,CWD:F.default.env.CWD,CYBERSKILL_STORAGE_DIR:F.default.env.CYBERSKILL_STORAGE_DIR},t=(0,P.cleanEnv)(e,{DEBUG:(0,P.bool)({default:!1}),CWD:(0,P.str)({default:F.default.cwd()}),CYBERSKILL_STORAGE_DIR:(0,P.str)({default:M.default.join(N.default.homedir(),q)})});return{DEBUG:t.DEBUG,CWD:t.CWD,CYBERSKILL_STORAGE_DIR:t.CYBERSKILL_STORAGE_DIR}}w(U,"getEnv");var W=function(e){return e.Error="error",e.Warning="warning",e}({});var B=E(require("chalk"),1),K=E(require("consola"),1),J=require("graphql");var Y=U();Y.DEBUG||(K.default.level=4);function H(e){var t=B.default[e];return typeof t=="function"?t:B.default.green}w(H,"chalkKeyword");var $={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.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)){K.default.box(B.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;K.default.log("".concat(B.default.gray("File:")," ").concat(B.default.blue("".concat(t).concat(r?":".concat(r):"")))),i&&K.default.log(" ".concat(H(n)("Rule:")," ").concat(i)),K.default.log(" ".concat(H(n)("Message:")," ").concat(s))}),K.default.box(H(n)("".concat(e," : ").concat(t.length))),K.default.log(B.default.gray("─".repeat(40)))}};var V={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var z=E(require("node-fetch"),1);var Q=E(require("fs"),1);function X(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Q.existsSync(e)})}w(X,"existsSync");function Z(e,t){var n=Q.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}w(Z,"readFileSync");function ee(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);Q.writeFileSync(e,s,"utf-8")}w(ee,"writeFileSync");function et(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);Q.appendFileSync(e,s,"utf-8")}w(et,"appendFileSync");function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){X(e)&&Q.rmSync(e,{recursive:!0,force:!0})})}w(en,"rmSync");var er=E(require("path"),1);function ei(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;var i=U();return(r=er).resolve.apply(r,[i.CWD].concat(p(t)))}w(ei,"resolveWorkingPath");function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=er).join.apply(r,p(t))}w(es,"join");var eo=U(),ea=eo.CWD,ec="@cyberskill/shared",eu="node_modules",el="dist",ed="package.json",ep="package-lock.json",ef="tsconfig.json",eg=".gitignore",em=".simple-git-hooks.json",ey="pnpm-lock.yaml",eh=".git/hooks/",ev=".git/COMMIT_EDITMSG",ej=es(ea,eu,ec,el),ex="cyberskill",eb="src/nodejs/cli/index.ts",ew="eslint",eI="eslint",eE="vitest",eS="playwright",eC="vitest",eO="@commitlint/cli",e_="commitlint",ek="lint-staged",eL="lint-staged",eT="typescript",eR="tsc",eD="tsx",eG="git",eq="pnpm",eA="pnpm exec",eP="simple-git-hooks",eN="simple-git-hooks",eM="@eslint/config-inspector",eF="eslint-config-inspector",eU="node-modules-inspector",eW="node-modules-inspector",eB="migrate-mongo",eK="migrate-mongo",eJ={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:ea,TS_CONFIG:ei(ef),GIT_IGNORE:ei(eg),GIT_HOOK:ei(eh),GIT_COMMIT_MSG:ei(ev),SIMPLE_GIT_HOOKS_JSON:ei(em),PACKAGE_JSON:ei(ed),PACKAGE_LOCK_JSON:ei(ep),PNPM_LOCK_YAML:ei(ey),NODE_MODULES:ei(eu),LINT_STAGED_CONFIG:ei("".concat(ej,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ei("".concat(ej,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ei("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ei("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ei("".concat(ej,"/react/vitest/vitest.e2e.js"))};function eY(e){var t=e.isCurrentProject;return l({"pre-commit":eL,"commit-msg":e_},t&&{"pre-push":tg("".concat(eG," pull"))})}w(eY,"HOOK");function eH(e){return e$.apply(this,arguments)}function e$(){e$=i(function(e){var t,n,r,i,s,o;var a=arguments;return m(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case T.CLI:return[3,1];case T.RAW:return[3,3]}return[3,4];case 1:return[4,e3(s.split(" "),{update:!0})];case 2:return[2,(c.sent(),ty(tg("".concat(eA," ").concat(o))))];case 3:return[2,ty(tg(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return e$.apply(this,arguments)}w(eH,"buildCommand");function eV(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__*/i(function(){return m(this,function(t){return[2,eH.apply(void 0,[e].concat(p(n)))]})})}w(eV,"commandFactory");var ez={simpleGitHooks:eV(T.CLI,eP,eN),eslintInspect:eV(T.CLI,eM,eF),nodeModulesInspect:eV(T.CLI,eU,eW),eslintCheck:eV(T.CLI,ew,"".concat(eI," ").concat(eJ.WORKING_DIRECTORY)),eslintFix:eV(T.CLI,ew,"".concat(eI," ").concat(eJ.WORKING_DIRECTORY," --fix")),typescriptCheck:eV(T.CLI,eT,"".concat(eR," -p ").concat(eJ.TS_CONFIG," --noEmit")),configureGitHook:eV(T.RAW,"".concat(eG," config core.hooksPath ").concat(eJ.GIT_HOOK)),testUnit:eV(T.CLI,eE,"".concat(eC," --config ").concat(eJ.UNIT_TEST_CONFIG)),testE2e:eV(T.CLI,"".concat(eE," ").concat(eS),"".concat(eC," --config ").concat(eJ.E2E_TEST_CONFIG)),mongoMigrateCreate:w(function(e){return eV(T.CLI,"".concat(eB),"".concat(eK," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:eV(T.CLI,"".concat(eB),"".concat(eK," up")),mongoMigrateDown:eV(T.CLI,"".concat(eB),"".concat(eK," down")),commitLint:eV(T.CLI,eO,"".concat(e_," --edit ").concat(eJ.GIT_COMMIT_MSG," --config ").concat(eJ.COMMITLINT_CONFIG)),lintStaged:eV(T.CLI,ek,"".concat(eL," --config ").concat(eJ.LINT_STAGED_CONFIG)),stageBuildDirectory:eV(T.RAW,"".concat(eG," add ").concat(el)),build:eV(T.RAW,"".concat(eq," run build")),pnpmInstallStandard:eV(T.RAW,"".concat(eq," install")),pnpmInstallLegacy:eV(T.RAW,"".concat(eq," install --legacy-peer-deps")),pnpmInstallForce:eV(T.RAW,"".concat(eq," install --force"))};function eQ(e){var t=U(),n=es(t.CWD,ed);if(!X(n))return!1;try{var r=Z(n,{asJson:!0}),i=r.name,s=r.dependencies,o=s===void 0?{}:s,a=r.devDependencies,c=a===void 0?{}:a,u=i===e,l=e in o,d=e in c;return u||l||d?{path:n,file:r,isCurrentProject:u,isDepend:l,isDevDepend:d}:!1}catch(e){return $.warn("Failed to read package.json: ".concat(e.message)),!1}}w(eQ,"getPackage");function eX(e){return eZ.apply(this,arguments)}function eZ(){eZ=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,(0,z.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.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=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw $.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eZ.apply(this,arguments)}w(eX,"getLatestPackageVersion");function e0(e,t){return e1.apply(this,arguments)}function e1(){e1=i(function(e,t){var n,r,i,s,o,a,c,u,d,p,f,g,y,h,v,j,x,b,w,I,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eQ(e);if(!n)return[2,l({},V)];c=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},y=(i=u.devDependencies)!==null&&i!==void 0?i:{},h=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(a=y[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];x=h;return[3,3];case 1:return[4,eX(e)];case 2:x=m.sent();m.label=3;case 3:v=x,j=d||h===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,ee(c,u,{isJson:!0}),$.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:j}];case 4:E=m.sent();return[2,($.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},V))];case 5:return[2]}})});return e1.apply(this,arguments)}w(e0,"checkPackage");function e2(){return e4.apply(this,arguments)}function e4(){e4=i(function(){var e,t,n,r,i,s,o,a,c,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:w(function(){return ez.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:w(function(){return ez.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:w(function(){return ez.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,a=o.command,c=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,a()];case 4:u=p.sent();return[4,tj("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();$.warn("Installation attempt failed: ".concat(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&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return e4.apply(this,arguments)}w(e2,"installDependencies");function e3(e,t){return e8.apply(this,arguments)}function e8(){e8=i(function(e,t){var n,r,i,s,o,a,c,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!X(eJ.PACKAGE_JSON)){$.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return e0(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,e2()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,a=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);c=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;a=f;return[3,12];case 11:try{if(!s&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=m.sent();throw $.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return e8.apply(this,arguments)}w(e3,"setupPackages");var e5=E(require("node-persist"),1);var e6=U();function e9(){return e7.apply(this,arguments)}function e7(){e7=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=e5.default.defaultInstance;if(e)return[3,2];return[4,e5.default.init({dir:e6.CYBERSKILL_STORAGE_DIR,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 e7.apply(this,arguments)}w(e9,"initNodePersist");var te={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9()];case 1:r.sent();return[4,e5.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9()];case 1:r.sent();return[4,e5.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();$.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e9()];case 1:n.sent();return[4,e5.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();$.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e9()];case 1:n.sent();return[4,e5.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:($.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,($.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(e6.CYBERSKILL_STORAGE_DIR," (key: ").concat(e,")")]}catch(e){return[2,($.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tt=U(),tn=G.promisify(R.exec);function tr(e){return"error_list:".concat(e)}w(tr,"getErrorListKey");function ti(e){return ts.apply(this,arguments)}function ts(){ts=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tr(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,te.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,te.getLogLink(n)];case 1:e=t.sent();e&&$.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();$.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return ts.apply(this,arguments)}w(ti,"saveErrorListToStorage");function to(){return ta.apply(this,arguments)}function ta(){ta=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te.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=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,te.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,($.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return ta.apply(this,arguments)}w(to,"getStoredErrorLists");function tc(){return tu.apply(this,arguments)}function tu(){tu=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te.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 te.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();$.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tu.apply(this,arguments)}w(tc,"clearAllErrorLists");function tl(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\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 a,c,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,y,h,v,j,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===W.Error?W.Error:W.Warning,message:(m=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(y=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&y!==void 0?y:""}):f.length?t.push({file:(h=f===null||f===void 0?void 0:f[1])!==null&&h!==void 0?h:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===W.Error?W.Error:W.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:W.Error,message:(j=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&j!==void 0?j:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&ti(t),tt.DEBUG&&n.length&&($.warn("Unmatched lines:"),n.forEach(function(e){return $.info(" ".concat(e))}))}w(tl,"parseTextErrors");function td(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,i=e.line,s=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?W.Error:W.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:a})})}),n.length&&ti(n)}catch(t){tl(e)}}w(td,"parseCommandOutput");function tp(e){return tf.apply(this,arguments)}function tf(){tf=i(function(e){var t,n,r,i,s,o,a,c,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:td;n=new AbortController;D.default.on("SIGINT",function(){$.warn("Process interrupted. Terminating..."),n.abort(),D.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,tn(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&$.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tf.apply(this,arguments)}w(tp,"executeCommand");function tg(e){return{raw:!0,cmd:e}}w(tg,"rawCommand");function tm(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eA," ").concat(ec," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eA," ").concat(eD," ").concat(eb," ").concat(e):"".concat(eA," ").concat(ex," ").concat(e)}w(tm,"formatCLI");function ty(e,t){return typeof e=="function"?tm(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"?tm(e,t):e}w(ty,"formatCommand");function th(e){return tv.apply(this,arguments)}function tv(){tv=i(function(e){var t,n,r,i,s,o,a;var c=arguments;return m(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,e0(ec)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:i=a,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,ty(r,s)]}))]}})});return tv.apply(this,arguments)}w(th,"resolveCommands");function tj(e,t){return tx.apply(this,arguments)}function tx(){tx=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);$.start("".concat(e)),tt.DEBUG&&$.info("→ ".concat(t));return[4,tp(t)];case 1:r.sent(),$.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw $.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tx.apply(this,arguments)}w(tj,"runCommand");function tb(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!X(eJ.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,ez.typescriptCheck()];case 1:return[4,tj.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=$.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tw.apply(this,arguments)}w(tb,"checkTypescript");function tI(){return tE.apply(this,arguments)}function tE(){tE=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,ez.eslintFix()];case 1:return[4,tj.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,ez.eslintCheck()];case 4:return[4,tj.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tE.apply(this,arguments)}w(tI,"checkEslint");function tS(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";$.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}w(tS,"printIssues");function tC(){return tO.apply(this,arguments)}function tO(){tO=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,to()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===W.Error}),n=e.filter(function(e){return e.type===W.Warning});!t.length&&!n.length?$.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tS("Warnings",n),tS("Errors",t),(t.length>0||n.length>0)&&O.default.exit(1));return[2]}})});return tO.apply(this,arguments)}w(tC,"showCheckResult");function t_(){return tk.apply(this,arguments)}function tk(){tk=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,tc()];case 1:o.sent();return[4,e0(ec)];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(ec)];return[4,ez.build()];case 4:return[4,tj.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,ez.stageBuildDirectory()];case 6:return[4,tj.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw $.error("Error building and staging ".concat(ec,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,ez.lintStaged()];case 10:return[4,tj.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),tC();return[2]}})});return tk.apply(this,arguments)}w(t_,"lintStaged");function tL(){return tT.apply(this,arguments)}function tT(){tT=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,ez.eslintInspect()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tT.apply(this,arguments)}w(tL,"inspectLint");function tR(){return tD.apply(this,arguments)}function tD(){tD=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tc()];case 1:e.sent();return[4,Promise.all([tb(),tI()])];case 2:e.sent(),tC();return[2]}})});return tD.apply(this,arguments)}w(tR,"lintCheck");function tG(){return tq.apply(this,arguments)}function tq(){tq=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tc()];case 1:e.sent();return[4,Promise.all([tb(),tI(!0)])];case 2:e.sent(),tC();return[2]}})});return tq.apply(this,arguments)}w(tG,"lintFix");function tA(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tc()];case 1:t.sent();e=["Validating commit message"];return[4,ez.commitLint()];case 2:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tC();return[2]}})});return tP.apply(this,arguments)}w(tA,"commitLint");function tN(){return tM.apply(this,arguments)}function tM(){tM=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,ez.configureGitHook()];case 1:return[4,tj.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),en(eJ.GIT_HOOK);return[4,th(eY)];case 3:t=i.sent();ee(eJ.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(em,"\n");X(eJ.GIT_IGNORE)?Z(eJ.GIT_IGNORE).split("\n").includes(em)||et(eJ.GIT_IGNORE,n):ee(eJ.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,ez.simpleGitHooks()];case 4:return[4,tj.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tM.apply(this,arguments)}w(tN,"setupGitHook");function tF(){return tU.apply(this,arguments)}function tU(){tU=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e3([ec],{update:!0,postInstallActions:[tN]})];case 1:e.sent();return[2]}})});return tU.apply(this,arguments)}w(tF,"setup");function tW(){return tB.apply(this,arguments)}function tB(){tB=i(function(){return m(this,function(e){switch(e.label){case 0:en(eJ.NODE_MODULES,eJ.PNPM_LOCK_YAML);return[4,e2()];case 1:e.sent();return[4,tN()];case 2:e.sent();return[2]}})});return tB.apply(this,arguments)}w(tW,"reset");function tK(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,ez.nodeModulesInspect()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tJ.apply(this,arguments)}w(tK,"inspect");function tY(){return tH.apply(this,arguments)}function tH(){tH=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,ez.testUnit()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tH.apply(this,arguments)}w(tY,"testUnit");function t$(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,ez.testE2e()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tV.apply(this,arguments)}w(t$,"testE2E");function tz(e){return tQ.apply(this,arguments)}function tQ(){tQ=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,ez.mongoMigrateCreate(e)];case 1:return[4,tj.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return tQ.apply(this,arguments)}w(tz,"mongoMigrateCreate");function tX(){return tZ.apply(this,arguments)}function tZ(){tZ=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,ez.mongoMigrateUp()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tZ.apply(this,arguments)}w(tX,"mongoMigrateUp");function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,ez.mongoMigrateDown()];case 1:return[4,tj.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t1.apply(this,arguments)}w(t0,"mongoMigrateDown");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,k.default)((0,_.hideBin)(O.default.argv)).scriptName(ex).usage("$0 <command> [options]").command("lint","Check code for linting issues",tR).command("lint:fix","Fix linting issues automatically",tG).command("lint:inspect","View active ESLint configuration",tL).command("lint-staged","Run lint checks on staged files",t_).command("commitlint","Validate commit message format",tA).command("setup","Initialize project setup and dependencies",tF).command("reset","Reset the project and reinstall dependencies",tW).command("inspect","Analyze installed project dependencies",tK).command("test:unit","Run unit test suite",tY).command("test:e2e","Run end-to-end test suite",t$).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return m(this,function(t){switch(t.label){case 0:if(!e.name){$.error("Migration name is required.");return[2]}return[4,tz(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",tX).command("mongo:migrate:down","Rollback last MongoDB migration",t0).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(L.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();$.error("Fatal: ".concat(e.message)),O.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,i,s,o){try{var a=e[s](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(undefined)})}}function s(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 a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw a}}return r}function c(){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){s(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}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 m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(s=0)),s)try{if(n=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;r=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(a[0]===6&&s.label<i[1]){s.label=i[1];i=a;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(a);break}if(i[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var y=Object.create;var h=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var w=function(e,t){return h(e,"name",{value:t,configurable:!0})};var E=function(e,t,n,r){var i=true,s=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":f(t))=="object"||typeof t=="function")try{var a=function(){var i=u.value;!b.call(e,i)&&i!==n&&h(e,i,{get:function(){return t[i]},enumerable:!(r=v(t,i))||r.enumerable})};for(var c=j(t)[Symbol.iterator](),u;!(i=(u=c.next()).done);i=true)a()}catch(e){s=true;o=e}finally{try{if(!i&&c.return!=null){c.return()}}finally{if(s){throw o}}}return e};var I=function(e,t,n){return n=e!=null?y(x(e)):{},E(t||!e||!e.__esModule?h(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return E(h({},"__esModule",{value:!0}),e)};var O={};module.exports=S(O);var C=I(require("process"),1),_=require("yargs/helpers"),k=I(require("yargs/yargs"),1);var T={name:"@cyberskill/shared",type:"module",version:"1.96.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"},"./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/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/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/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/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"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/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.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","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.52.0","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.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var R=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});var L=require("child_process"),q=I(require("process"),1),G=I(require("util"),1);var D=".cyberskill-storage";var P=I(require("dotenv"),1),A=require("envalid"),N=I(require("os"),1),M=I(require("path"),1),F=I(require("process"),1);P.default.config();function U(){var e={DEBUG:F.default.env.DEBUG||!1,CWD:F.default.env.CWD,CYBERSKILL_STORAGE_DIRECTORY:F.default.env.CYBERSKILL_STORAGE_DIRECTORY||D};return(0,A.cleanEnv)(e,{DEBUG:(0,A.bool)(),CWD:(0,A.str)({default:F.default.cwd()}),CYBERSKILL_STORAGE_DIRECTORY:(0,A.str)({default:M.default.join(N.default.homedir(),D)})})}w(U,"getEnv");var W=function(e){return e.Error="error",e.Warning="warning",e}({});var B=I(require("chalk"),1),K=I(require("consola"),1),J=require("graphql");var Y=U();Y.DEBUG||(K.default.level=4);function H(e){var t=B.default[e];return typeof t=="function"?t:B.default.green}w(H,"chalkKeyword");var $={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.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)){K.default.box(B.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;K.default.log("".concat(B.default.gray("File:")," ").concat(B.default.blue("".concat(t).concat(r?":".concat(r):"")))),i&&K.default.log(" ".concat(H(n)("Rule:")," ").concat(i)),K.default.log(" ".concat(H(n)("Message:")," ").concat(s))}),K.default.box(H(n)("".concat(e," : ").concat(t.length))),K.default.log(B.default.gray("─".repeat(40)))}};var V={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var z=I(require("node-fetch"),1);var Q=I(require("fs"),1);function X(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Q.existsSync(e)})}w(X,"existsSync");function Z(e,t){var n=Q.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}w(Z,"readFileSync");function ee(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);Q.writeFileSync(e,s,"utf-8")}w(ee,"writeFileSync");function et(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);Q.appendFileSync(e,s,"utf-8")}w(et,"appendFileSync");function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){X(e)&&Q.rmSync(e,{recursive:!0,force:!0})})}w(en,"rmSync");var er=I(require("path"),1);var ei=U();function es(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=er).resolve.apply(r,[ei.CWD].concat(p(t)))}w(es,"resolveWorkingPath");function eo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=er).join.apply(r,p(t))}w(eo,"join");var ea=U(),ec=ea.CWD,eu="@cyberskill/shared",el="node_modules",ed="dist",ep="package.json",ef="package-lock.json",eg="tsconfig.json",em=".gitignore",ey=".simple-git-hooks.json",eh="pnpm-lock.yaml",ev=".git/hooks/",ej=".git/COMMIT_EDITMSG",ex=eo(ec,el,eu,ed),eb="cyberskill",ew="src/nodejs/cli/index.ts",eE="eslint",eI="eslint",eS="vitest",eO="playwright",eC="vitest",e_="@commitlint/cli",ek="commitlint",eT="lint-staged",eR="lint-staged",eL="typescript",eq="tsc",eG="tsx",eD="git",eP="pnpm",eA="pnpm exec",eN="simple-git-hooks",eM="simple-git-hooks",eF="@eslint/config-inspector",eU="eslint-config-inspector",eW="node-modules-inspector",eB="node-modules-inspector",eK="migrate-mongo",eJ="migrate-mongo",eY={CYBERSKILL_DIRECTORY:ex,WORKING_DIRECTORY:ec,TS_CONFIG:es(eg),GIT_IGNORE:es(em),GIT_HOOK:es(ev),GIT_COMMIT_MSG:es(ej),SIMPLE_GIT_HOOKS_JSON:es(ey),PACKAGE_JSON:es(ep),PACKAGE_LOCK_JSON:es(ef),PNPM_LOCK_YAML:es(eh),NODE_MODULES:es(el),LINT_STAGED_CONFIG:es("".concat(ex,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:es("".concat(ex,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:es("".concat(ex,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:es("".concat(ex,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:es("".concat(ex,"/react/vitest/vitest.e2e.js"))};function eH(e){var t=e.isCurrentProject;return l({"pre-commit":eR,"commit-msg":ek},t&&{"pre-push":ty("".concat(eD," pull"))})}w(eH,"HOOK");function e$(e){return eV.apply(this,arguments)}function eV(){eV=i(function(e){var t,n,r,i,s,o;var a=arguments;return m(this,function(c){switch(c.label){case 0:for(t=a.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=a[r]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case R.CLI:return[3,1];case R.RAW:return[3,3]}return[3,4];case 1:return[4,e5(s.split(" "),{update:!0})];case 2:return[2,(c.sent(),tv(ty("".concat(eA," ").concat(o))))];case 3:return[2,tv(ty(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eV.apply(this,arguments)}w(e$,"buildCommand");function ez(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__*/i(function(){return m(this,function(t){return[2,e$.apply(void 0,[e].concat(p(n)))]})})}w(ez,"commandFactory");var eQ={simpleGitHooks:ez(R.CLI,eN,eM),eslintInspect:ez(R.CLI,eF,eU),nodeModulesInspect:ez(R.CLI,eW,eB),eslintCheck:ez(R.CLI,eE,"".concat(eI," ").concat(eY.WORKING_DIRECTORY)),eslintFix:ez(R.CLI,eE,"".concat(eI," ").concat(eY.WORKING_DIRECTORY," --fix")),typescriptCheck:ez(R.CLI,eL,"".concat(eq," -p ").concat(eY.TS_CONFIG," --noEmit")),configureGitHook:ez(R.RAW,"".concat(eD," config core.hooksPath ").concat(eY.GIT_HOOK)),testUnit:ez(R.CLI,eS,"".concat(eC," --config ").concat(eY.UNIT_TEST_CONFIG)),testE2e:ez(R.CLI,"".concat(eS," ").concat(eO),"".concat(eC," --config ").concat(eY.E2E_TEST_CONFIG)),mongoMigrateCreate:w(function(e){return ez(R.CLI,"".concat(eK),"".concat(eJ," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:ez(R.CLI,"".concat(eK),"".concat(eJ," up")),mongoMigrateDown:ez(R.CLI,"".concat(eK),"".concat(eJ," down")),commitLint:ez(R.CLI,e_,"".concat(ek," --edit ").concat(eY.GIT_COMMIT_MSG," --config ").concat(eY.COMMITLINT_CONFIG)),lintStaged:ez(R.CLI,eT,"".concat(eR," --config ").concat(eY.LINT_STAGED_CONFIG)),stageBuildDirectory:ez(R.RAW,"".concat(eD," add ").concat(ed)),build:ez(R.RAW,"".concat(eP," run build")),pnpmInstallStandard:ez(R.RAW,"".concat(eP," install")),pnpmInstallLegacy:ez(R.RAW,"".concat(eP," install --legacy-peer-deps")),pnpmInstallForce:ez(R.RAW,"".concat(eP," install --force"))};var eX=U();function eZ(e){var t=eo(eX.CWD,ep);if(!X(t))return!1;try{var n=Z(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in s,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return $.warn("Failed to read package.json: ".concat(e.message)),!1}}w(eZ,"getPackage");function e0(e){return e1.apply(this,arguments)}function e1(){e1=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,(0,z.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.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=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw $.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return e1.apply(this,arguments)}w(e0,"getLatestPackageVersion");function e2(e,t){return e4.apply(this,arguments)}function e4(){e4=i(function(e,t){var n,r,i,s,o,a,c,u,d,p,f,g,y,h,v,j,x,b,w,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eZ(e);if(!n)return[2,l({},V)];c=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},y=(i=u.devDependencies)!==null&&i!==void 0?i:{},h=d?(s=u.version)!==null&&s!==void 0?s:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(a=y[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];x=h;return[3,3];case 1:return[4,e0(e)];case 2:x=m.sent();m.label=3;case 3:v=x,j=d||h===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]=(E=u[w])!==null&&E!==void 0?E:{},u[w][e]=v,ee(c,u,{isJson:!0}),$.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:j}];case 4:I=m.sent();return[2,($.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},V))];case 5:return[2]}})});return e4.apply(this,arguments)}w(e2,"checkPackage");function e3(){return e8.apply(this,arguments)}function e8(){e8=i(function(){var e,t,n,r,i,s,o,a,c,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:w(function(){return eQ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:w(function(){return eQ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:w(function(){return eQ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,a=o.command,c=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,a()];case 4:u=p.sent();return[4,tb("".concat(c," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();$.warn("Installation attempt failed: ".concat(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&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return e8.apply(this,arguments)}w(e3,"installDependencies");function e5(e,t){return e6.apply(this,arguments)}function e6(){e6=i(function(e,t){var n,r,i,s,o,a,c,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!X(eY.PACKAGE_JSON)){$.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return e2(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,e3()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,a=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);c=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;a=f;return[3,12];case 11:try{if(!s&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=m.sent();throw $.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return e6.apply(this,arguments)}w(e5,"setupPackages");var e9=I(require("node-persist"),1);var e7=U();function te(){return tt.apply(this,arguments)}function tt(){tt=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=e9.default.defaultInstance;if(e)return[3,2];return[4,e9.default.init({dir:e7.CYBERSKILL_STORAGE_DIRECTORY,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 tt.apply(this,arguments)}w(te,"initNodePersist");var tn={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e9.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,($.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,te()];case 1:r.sent();return[4,e9.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();$.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e9.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();$.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,te()];case 1:n.sent();return[4,e9.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:($.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,($.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(e7.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,($.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tr=U(),ti=G.promisify(L.exec);function ts(e){return"error_list:".concat(e)}w(ts,"getErrorListKey");function to(e){return ta.apply(this,arguments)}function ta(){ta=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ts(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,tn.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tn.getLogLink(n)];case 1:e=t.sent();e&&$.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();$.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return ta.apply(this,arguments)}w(to,"saveErrorListToStorage");function tc(){return tu.apply(this,arguments)}function tu(){tu=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.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=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,tn.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,($.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tu.apply(this,arguments)}w(tc,"getStoredErrorLists");function tl(){return td.apply(this,arguments)}function td(){td=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tn.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 tn.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();$.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return td.apply(this,arguments)}w(tl,"clearAllErrorLists");function tp(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\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 a,c,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,y,h,v,j,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===W.Error?W.Error:W.Warning,message:(m=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(y=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&y!==void 0?y:""}):f.length?t.push({file:(h=f===null||f===void 0?void 0:f[1])!==null&&h!==void 0?h:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===W.Error?W.Error:W.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:W.Error,message:(j=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&j!==void 0?j:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&to(t),tr.DEBUG&&n.length&&($.warn("Unmatched lines:"),n.forEach(function(e){return $.info(" ".concat(e))}))}w(tp,"parseTextErrors");function tf(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,i=e.line,s=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?W.Error:W.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:a})})}),n.length&&to(n)}catch(t){tp(e)}}w(tf,"parseCommandOutput");function tg(e){return tm.apply(this,arguments)}function tm(){tm=i(function(e){var t,n,r,i,s,o,a,c,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tf;n=new AbortController;q.default.on("SIGINT",function(){$.warn("Process interrupted. Terminating..."),n.abort(),q.default.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,ti(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&$.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tm.apply(this,arguments)}w(tg,"executeCommand");function ty(e){return{raw:!0,cmd:e}}w(ty,"rawCommand");function th(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eA," ").concat(eu," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eA," ").concat(eG," ").concat(ew," ").concat(e):"".concat(eA," ").concat(eb," ").concat(e)}w(th,"formatCLI");function tv(e,t){return typeof e=="function"?th(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"?th(e,t):e}w(tv,"formatCommand");function tj(e){return tx.apply(this,arguments)}function tx(){tx=i(function(e){var t,n,r,i,s,o,a;var c=arguments;return m(this,function(u){switch(u.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,e2(eu)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:i=a,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tv(r,s)]}))]}})});return tx.apply(this,arguments)}w(tj,"resolveCommands");function tb(e,t){return tw.apply(this,arguments)}function tw(){tw=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);$.start("".concat(e)),tr.DEBUG&&$.info("→ ".concat(t));return[4,tg(t)];case 1:r.sent(),$.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw $.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tw.apply(this,arguments)}w(tb,"runCommand");function tE(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!X(eY.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eQ.typescriptCheck()];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=$.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tI.apply(this,arguments)}w(tE,"checkTypescript");function tS(){return tO.apply(this,arguments)}function tO(){tO=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eQ.eslintFix()];case 1:return[4,tb.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eQ.eslintCheck()];case 4:return[4,tb.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tO.apply(this,arguments)}w(tS,"checkEslint");function tC(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";$.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}w(tC,"printIssues");function t_(){return tk.apply(this,arguments)}function tk(){tk=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tc()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===W.Error}),n=e.filter(function(e){return e.type===W.Warning});!t.length&&!n.length?$.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tC("Warnings",n),tC("Errors",t),(t.length>0||n.length>0)&&C.default.exit(1));return[2]}})});return tk.apply(this,arguments)}w(t_,"showCheckResult");function tT(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,tl()];case 1:o.sent();return[4,e2(eu)];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(eu)];return[4,eQ.build()];case 4:return[4,tb.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eQ.stageBuildDirectory()];case 6:return[4,tb.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw $.error("Error building and staging ".concat(eu,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eQ.lintStaged()];case 10:return[4,tb.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),t_();return[2]}})});return tR.apply(this,arguments)}w(tT,"lintStaged");function tL(){return tq.apply(this,arguments)}function tq(){tq=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eQ.eslintInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tq.apply(this,arguments)}w(tL,"inspectLint");function tG(){return tD.apply(this,arguments)}function tD(){tD=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tE(),tS()])];case 2:e.sent(),t_();return[2]}})});return tD.apply(this,arguments)}w(tG,"lintCheck");function tP(){return tA.apply(this,arguments)}function tA(){tA=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tE(),tS(!0)])];case 2:e.sent(),t_();return[2]}})});return tA.apply(this,arguments)}w(tP,"lintFix");function tN(){return tM.apply(this,arguments)}function tM(){tM=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tl()];case 1:t.sent();e=["Validating commit message"];return[4,eQ.commitLint()];case 2:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),t_();return[2]}})});return tM.apply(this,arguments)}w(tN,"commitLint");function tF(){return tU.apply(this,arguments)}function tU(){tU=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eQ.configureGitHook()];case 1:return[4,tb.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),en(eY.GIT_HOOK);return[4,tj(eH)];case 3:t=i.sent();ee(eY.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(ey,"\n");X(eY.GIT_IGNORE)?Z(eY.GIT_IGNORE).split("\n").includes(ey)||et(eY.GIT_IGNORE,n):ee(eY.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eQ.simpleGitHooks()];case 4:return[4,tb.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tU.apply(this,arguments)}w(tF,"setupGitHook");function tW(){return tB.apply(this,arguments)}function tB(){tB=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e5([eu],{update:!0,postInstallActions:[tF]})];case 1:e.sent();return[2]}})});return tB.apply(this,arguments)}w(tW,"setup");function tK(){return tJ.apply(this,arguments)}function tJ(){tJ=i(function(){return m(this,function(e){switch(e.label){case 0:en(eY.NODE_MODULES,eY.PNPM_LOCK_YAML);return[4,e3()];case 1:e.sent();return[4,tF()];case 2:e.sent();return[2]}})});return tJ.apply(this,arguments)}w(tK,"reset");function tY(){return tH.apply(this,arguments)}function tH(){tH=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eQ.nodeModulesInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tH.apply(this,arguments)}w(tY,"inspect");function t$(){return tV.apply(this,arguments)}function tV(){tV=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eQ.testUnit()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tV.apply(this,arguments)}w(t$,"testUnit");function tz(){return tQ.apply(this,arguments)}function tQ(){tQ=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eQ.testE2e()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tQ.apply(this,arguments)}w(tz,"testE2E");function tX(e){return tZ.apply(this,arguments)}function tZ(){tZ=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eQ.mongoMigrateCreate(e)];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return tZ.apply(this,arguments)}w(tX,"mongoMigrateCreate");function t0(){return t1.apply(this,arguments)}function t1(){t1=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eQ.mongoMigrateUp()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t1.apply(this,arguments)}w(t0,"mongoMigrateUp");function t2(){return t4.apply(this,arguments)}function t4(){t4=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eQ.mongoMigrateDown()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t4.apply(this,arguments)}w(t2,"mongoMigrateDown");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,k.default)((0,_.hideBin)(C.default.argv)).scriptName(eb).usage("$0 <command> [options]").command("lint","Check code for linting issues",tG).command("lint:fix","Fix linting issues automatically",tP).command("lint:inspect","View active ESLint configuration",tL).command("lint-staged","Run lint checks on staged files",tT).command("commitlint","Validate commit message format",tN).command("setup","Initialize project setup and dependencies",tW).command("reset","Reset the project and reinstall dependencies",tK).command("inspect","Analyze installed project dependencies",tY).command("test:unit","Run unit test suite",t$).command("test:e2e","Run end-to-end test suite",tz).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return m(this,function(t){switch(t.label){case 0:if(!e.name){$.error("Migration name is required.");return[2]}return[4,tX(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",t0).command("mongo:migrate:down","Rollback last MongoDB migration",t2).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(T.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();$.error("Fatal: ".concat(e.message)),C.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,i,s,o){try{var c=e[s](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function c(e){r(o,i,s,c,a,"next",e)}function a(e){r(o,i,s,c,a,"throw",e)}c(undefined)})}}function s(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 i=true;var s=false;var o,c;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;c=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)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){s(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 m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=c(0),o["throw"]=c(1),o["return"]=c(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(e){return function(t){return a([e,t])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(s=0)),s)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:s.label++;return{value:c[1],done:false};case 5:s.label++;r=c[1];c=[0];continue;case 7:c=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){s=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(c[0]===6&&s.label<i[1]){s.label=i[1];i=c;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(c);break}if(i[2])s.ops.pop();s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var h=Object.defineProperty;var y=function(e,t){return h(e,"name",{value:t,configurable:!0})};import v from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.95.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"},"./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/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/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/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/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"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/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.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","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.52.0","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.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var w=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as I}from"node:child_process";import E from"node:process";import*as S from"node:util";var C=".cyberskill-storage";import _ from"dotenv";import{bool as O,cleanEnv as k,str as L}from"envalid";import T from"node:os";import R from"node:path";import G from"node:process";_.config();function D(){var e={DEBUG:G.env.DEBUG,CWD:G.env.CWD,CYBERSKILL_STORAGE_DIR:G.env.CYBERSKILL_STORAGE_DIR},t=k(e,{DEBUG:O({default:!1}),CWD:L({default:G.cwd()}),CYBERSKILL_STORAGE_DIR:L({default:R.join(T.homedir(),C)})});return{DEBUG:t.DEBUG,CWD:t.CWD,CYBERSKILL_STORAGE_DIR:t.CYBERSKILL_STORAGE_DIR}}y(D,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import P from"consola";import{GraphQLError as M}from"graphql";var q=D();q.DEBUG||(P.level=4);function F(e){var t=N[e];return typeof t=="function"?t:N.green}y(F,"chalkKeyword");var U={silent:P.silent,level:P.level,fatal:P.fatal,error:P.error,warn:P.warn,log:P.log,info:P.info,success:P.success,ready:P.ready,start:P.start,box:P.box,debug:P.debug,trace:P.trace,verbose:P.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)){P.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;P.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),i&&P.log(" ".concat(F(n)("Rule:")," ").concat(i)),P.log(" ".concat(F(n)("Message:")," ").concat(s))}),P.box(F(n)("".concat(e," : ").concat(t.length))),P.log(N.gray("─".repeat(40)))}};var W={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import B from"node-fetch";import*as K from"node:fs";function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return K.existsSync(e)})}y(J,"existsSync");function Y(e,t){var n=K.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}y(Y,"readFileSync");function H(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);K.writeFileSync(e,s,"utf-8")}y(H,"writeFileSync");function $(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);K.appendFileSync(e,s,"utf-8")}y($,"appendFileSync");function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){J(e)&&K.rmSync(e,{recursive:!0,force:!0})})}y(V,"rmSync");import*as z from"node:path";function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;var i=D();return(r=z).resolve.apply(r,[i.CWD].concat(p(t)))}y(Q,"resolveWorkingPath");function X(){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))}y(X,"join");var Z=D(),ee=Z.CWD,et="@cyberskill/shared",en="node_modules",er="dist",ei="package.json",es="package-lock.json",eo="tsconfig.json",ec=".gitignore",ea=".simple-git-hooks.json",eu="pnpm-lock.yaml",el=".git/hooks/",ed=".git/COMMIT_EDITMSG",ep=X(ee,en,et,er),ef="cyberskill",eg="src/nodejs/cli/index.ts",em="eslint",eh="eslint",ey="vitest",ev="playwright",ex="vitest",ej="@commitlint/cli",eb="commitlint",ew="lint-staged",eI="lint-staged",eE="typescript",eS="tsc",eC="tsx",e_="git",eO="pnpm",ek="pnpm exec",eL="simple-git-hooks",eT="simple-git-hooks",eR="@eslint/config-inspector",eG="eslint-config-inspector",eD="node-modules-inspector",eA="node-modules-inspector",eN="migrate-mongo",eP="migrate-mongo",eM={CYBERSKILL_DIRECTORY:ep,WORKING_DIRECTORY:ee,TS_CONFIG:Q(eo),GIT_IGNORE:Q(ec),GIT_HOOK:Q(el),GIT_COMMIT_MSG:Q(ed),SIMPLE_GIT_HOOKS_JSON:Q(ea),PACKAGE_JSON:Q(ei),PACKAGE_LOCK_JSON:Q(es),PNPM_LOCK_YAML:Q(eu),NODE_MODULES:Q(en),LINT_STAGED_CONFIG:Q("".concat(ep,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:Q("".concat(ep,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:Q("".concat(ep,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:Q("".concat(ep,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:Q("".concat(ep,"/react/vitest/vitest.e2e.js"))};function eq(e){var t=e.isCurrentProject;return l({"pre-commit":eI,"commit-msg":eb},t&&{"pre-push":tc("".concat(e_," pull"))})}y(eq,"HOOK");function eF(e){return eU.apply(this,arguments)}function eU(){eU=i(function(e){var t,n,r,i,s,o;var c=arguments;return m(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]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case w.CLI:return[3,1];case w.RAW:return[3,3]}return[3,4];case 1:return[4,eQ(s.split(" "),{update:!0})];case 2:return[2,(a.sent(),tu(tc("".concat(ek," ").concat(o))))];case 3:return[2,tu(tc(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eU.apply(this,arguments)}y(eF,"buildCommand");function eW(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__*/i(function(){return m(this,function(t){return[2,eF.apply(void 0,[e].concat(p(n)))]})})}y(eW,"commandFactory");var eB={simpleGitHooks:eW(w.CLI,eL,eT),eslintInspect:eW(w.CLI,eR,eG),nodeModulesInspect:eW(w.CLI,eD,eA),eslintCheck:eW(w.CLI,em,"".concat(eh," ").concat(eM.WORKING_DIRECTORY)),eslintFix:eW(w.CLI,em,"".concat(eh," ").concat(eM.WORKING_DIRECTORY," --fix")),typescriptCheck:eW(w.CLI,eE,"".concat(eS," -p ").concat(eM.TS_CONFIG," --noEmit")),configureGitHook:eW(w.RAW,"".concat(e_," config core.hooksPath ").concat(eM.GIT_HOOK)),testUnit:eW(w.CLI,ey,"".concat(ex," --config ").concat(eM.UNIT_TEST_CONFIG)),testE2e:eW(w.CLI,"".concat(ey," ").concat(ev),"".concat(ex," --config ").concat(eM.E2E_TEST_CONFIG)),mongoMigrateCreate:y(function(e){return eW(w.CLI,"".concat(eN),"".concat(eP," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:eW(w.CLI,"".concat(eN),"".concat(eP," up")),mongoMigrateDown:eW(w.CLI,"".concat(eN),"".concat(eP," down")),commitLint:eW(w.CLI,ej,"".concat(eb," --edit ").concat(eM.GIT_COMMIT_MSG," --config ").concat(eM.COMMITLINT_CONFIG)),lintStaged:eW(w.CLI,ew,"".concat(eI," --config ").concat(eM.LINT_STAGED_CONFIG)),stageBuildDirectory:eW(w.RAW,"".concat(e_," add ").concat(er)),build:eW(w.RAW,"".concat(eO," run build")),pnpmInstallStandard:eW(w.RAW,"".concat(eO," install")),pnpmInstallLegacy:eW(w.RAW,"".concat(eO," install --legacy-peer-deps")),pnpmInstallForce:eW(w.RAW,"".concat(eO," install --force"))};function eK(e){var t=D(),n=X(t.CWD,ei);if(!J(n))return!1;try{var r=Y(n,{asJson:!0}),i=r.name,s=r.dependencies,o=s===void 0?{}:s,c=r.devDependencies,a=c===void 0?{}:c,u=i===e,l=e in o,d=e in a;return u||l||d?{path:n,file:r,isCurrentProject:u,isDepend:l,isDevDepend:d}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}y(eK,"getPackage");function eJ(e){return eY.apply(this,arguments)}function eY(){eY=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,B("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.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=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return eY.apply(this,arguments)}y(eJ,"getLatestPackageVersion");function eH(e,t){return e$.apply(this,arguments)}function e$(){e$=i(function(e,t){var n,r,i,s,o,c,a,u,d,p,f,g,h,y,v,x,j,b,w,I,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eK(e);if(!n)return[2,l({},W)];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=(i=u.devDependencies)!==null&&i!==void 0?i:{},y=d?(s=u.version)!==null&&s!==void 0?s:"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];j=y;return[3,3];case 1:return[4,eJ(e)];case 2:j=m.sent();m.label=3;case 3:v=j,x=d||y===v;if(!x&&(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,H(a,u,{isJson:!0}),U.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:E=m.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},W))];case 5:return[2]}})});return e$.apply(this,arguments)}y(eH,"checkPackage");function eV(){return ez.apply(this,arguments)}function ez(){ez=i(function(){var e,t,n,r,i,s,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:y(function(){return eB.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return eB.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return eB.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.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,tp("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();U.warn("Installation attempt failed: ".concat(a)),U.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&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return ez.apply(this,arguments)}y(eV,"installDependencies");function eQ(e,t){return eX.apply(this,arguments)}function eX(){eX=i(function(e,t){var n,r,i,s,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!J(eM.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eH(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eV()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;c=f;return[3,12];case 11:try{if(!s&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return eX.apply(this,arguments)}y(eQ,"setupPackages");import eZ from"node-persist";var e0=D();function e1(){return e2.apply(this,arguments)}function e2(){e2=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=eZ.defaultInstance;if(e)return[3,2];return[4,eZ.init({dir:e0.CYBERSKILL_STORAGE_DIR,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 e2.apply(this,arguments)}y(e1,"initNodePersist");var e4={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e1()];case 1:r.sent();return[4,eZ.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e1()];case 1:r.sent();return[4,eZ.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e1()];case 1:n.sent();return[4,eZ.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e1()];case 1:n.sent();return[4,eZ.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(e0.CYBERSKILL_STORAGE_DIR," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e3=D(),e8=S.promisify(I);function e5(e){return"error_list:".concat(e)}y(e5,"getErrorListKey");function e6(e){return e9.apply(this,arguments)}function e9(){e9=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e5(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,e4.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e4.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();U.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return e9.apply(this,arguments)}y(e6,"saveErrorListToStorage");function e7(){return te.apply(this,arguments)}function te(){te=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4.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=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,e4.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,(U.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return te.apply(this,arguments)}y(e7,"getStoredErrorLists");function tt(){return tn.apply(this,arguments)}function tn(){tn=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4.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 e4.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tn.apply(this,arguments)}y(tt,"clearAllErrorLists");function tr(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\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,a,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,h,y,v,x,j;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===A.Error?A.Error:A.Warning,message:(m=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(h=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(y=f===null||f===void 0?void 0:f[1])!==null&&y!==void 0?y:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===A.Error?A.Error:A.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:A.Error,message:(x=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&x!==void 0?x:"",rule:(j=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&j!==void 0?j:""}):n.push(e.trim())}}),t.length&&e6(t),e3.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}y(tr,"parseTextErrors");function ti(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,i=e.line,s=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:c})})}),n.length&&e6(n)}catch(t){tr(e)}}y(ti,"parseCommandOutput");function ts(e){return to.apply(this,arguments)}function to(){to=i(function(e){var t,n,r,i,s,o,c,a,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ti;n=new AbortController;E.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),E.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e8(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].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&&U.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return to.apply(this,arguments)}y(ts,"executeCommand");function tc(e){return{raw:!0,cmd:e}}y(tc,"rawCommand");function ta(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ek," ").concat(et," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ek," ").concat(eC," ").concat(eg," ").concat(e):"".concat(ek," ").concat(ef," ").concat(e)}y(ta,"formatCLI");function tu(e,t){return typeof e=="function"?ta(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"?ta(e,t):e}y(tu,"formatCommand");function tl(e){return td.apply(this,arguments)}function td(){td=i(function(e){var t,n,r,i,s,o,c;var a=arguments;return m(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,eH(et)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:i=c,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tu(r,s)]}))]}})});return td.apply(this,arguments)}y(tl,"resolveCommands");function tp(e,t){return tf.apply(this,arguments)}function tf(){tf=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),e3.DEBUG&&U.info("→ ".concat(t));return[4,ts(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tf.apply(this,arguments)}y(tp,"runCommand");function tg(){return tm.apply(this,arguments)}function tm(){tm=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!J(eM.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eB.typescriptCheck()];case 1:return[4,tp.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=U.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return tm.apply(this,arguments)}y(tg,"checkTypescript");function th(){return ty.apply(this,arguments)}function ty(){ty=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eB.eslintFix()];case 1:return[4,tp.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eB.eslintCheck()];case 4:return[4,tp.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return ty.apply(this,arguments)}y(th,"checkEslint");function tv(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";U.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}y(tv,"printIssues");function tx(){return tj.apply(this,arguments)}function tj(){tj=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,e7()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===A.Error}),n=e.filter(function(e){return e.type===A.Warning});!t.length&&!n.length?U.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tv("Warnings",n),tv("Errors",t),(t.length>0||n.length>0)&&v.exit(1));return[2]}})});return tj.apply(this,arguments)}y(tx,"showCheckResult");function tb(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,tt()];case 1:o.sent();return[4,eH(et)];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(et)];return[4,eB.build()];case 4:return[4,tp.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eB.stageBuildDirectory()];case 6:return[4,tp.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw U.error("Error building and staging ".concat(et,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eB.lintStaged()];case 10:return[4,tp.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),tx();return[2]}})});return tw.apply(this,arguments)}y(tb,"lintStaged");function tI(){return tE.apply(this,arguments)}function tE(){tE=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eB.eslintInspect()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tE.apply(this,arguments)}y(tI,"inspectLint");function tS(){return tC.apply(this,arguments)}function tC(){tC=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tt()];case 1:e.sent();return[4,Promise.all([tg(),th()])];case 2:e.sent(),tx();return[2]}})});return tC.apply(this,arguments)}y(tS,"lintCheck");function t_(){return tO.apply(this,arguments)}function tO(){tO=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tt()];case 1:e.sent();return[4,Promise.all([tg(),th(!0)])];case 2:e.sent(),tx();return[2]}})});return tO.apply(this,arguments)}y(t_,"lintFix");function tk(){return tL.apply(this,arguments)}function tL(){tL=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tt()];case 1:t.sent();e=["Validating commit message"];return[4,eB.commitLint()];case 2:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tx();return[2]}})});return tL.apply(this,arguments)}y(tk,"commitLint");function tT(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eB.configureGitHook()];case 1:return[4,tp.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),V(eM.GIT_HOOK);return[4,tl(eq)];case 3:t=i.sent();H(eM.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(ea,"\n");J(eM.GIT_IGNORE)?Y(eM.GIT_IGNORE).split("\n").includes(ea)||$(eM.GIT_IGNORE,n):H(eM.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eB.simpleGitHooks()];case 4:return[4,tp.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tR.apply(this,arguments)}y(tT,"setupGitHook");function tG(){return tD.apply(this,arguments)}function tD(){tD=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eQ([et],{update:!0,postInstallActions:[tT]})];case 1:e.sent();return[2]}})});return tD.apply(this,arguments)}y(tG,"setup");function tA(){return tN.apply(this,arguments)}function tN(){tN=i(function(){return m(this,function(e){switch(e.label){case 0:V(eM.NODE_MODULES,eM.PNPM_LOCK_YAML);return[4,eV()];case 1:e.sent();return[4,tT()];case 2:e.sent();return[2]}})});return tN.apply(this,arguments)}y(tA,"reset");function tP(){return tM.apply(this,arguments)}function tM(){tM=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eB.nodeModulesInspect()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tM.apply(this,arguments)}y(tP,"inspect");function tq(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eB.testUnit()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tF.apply(this,arguments)}y(tq,"testUnit");function tU(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eB.testE2e()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}y(tU,"testE2E");function tB(e){return tK.apply(this,arguments)}function tK(){tK=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eB.mongoMigrateCreate(e)];case 1:return[4,tp.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return tK.apply(this,arguments)}y(tB,"mongoMigrateCreate");function tJ(){return tY.apply(this,arguments)}function tY(){tY=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eB.mongoMigrateUp()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tY.apply(this,arguments)}y(tJ,"mongoMigrateUp");function tH(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eB.mongoMigrateDown()];case 1:return[4,tp.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t$.apply(this,arguments)}y(tH,"mongoMigrateDown");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(v.argv)).scriptName(ef).usage("$0 <command> [options]").command("lint","Check code for linting issues",tS).command("lint:fix","Fix linting issues automatically",t_).command("lint:inspect","View active ESLint configuration",tI).command("lint-staged","Run lint checks on staged files",tb).command("commitlint","Validate commit message format",tk).command("setup","Initialize project setup and dependencies",tG).command("reset","Reset the project and reinstall dependencies",tA).command("inspect","Analyze installed project dependencies",tP).command("test:unit","Run unit test suite",tq).command("test:e2e","Run end-to-end test suite",tU).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return m(this,function(t){switch(t.label){case 0:if(!e.name){U.error("Migration name is required.");return[2]}return[4,tB(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",tJ).command("mongo:migrate:down","Rollback last MongoDB migration",tH).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(b.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();U.error("Fatal: ".concat(e.message)),v.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,i,s,o){try{var c=e[s](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function c(e){r(o,i,s,c,a,"next",e)}function a(e){r(o,i,s,c,a,"throw",e)}c(undefined)})}}function s(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 i=true;var s=false;var o,c;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;c=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)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){s(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 m(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=c(0),o["throw"]=c(1),o["return"]=c(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(e){return function(t){return a([e,t])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(s=0)),s)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:s.label++;return{value:c[1],done:false};case 5:s.label++;r=c[1];c=[0];continue;case 7:c=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){s=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(c[0]===6&&s.label<i[1]){s.label=i[1];i=c;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(c);break}if(i[2])s.ops.pop();s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var h=Object.defineProperty;var y=function(e,t){return h(e,"name",{value:t,configurable:!0})};import v from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.96.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"},"./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/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/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/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/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"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/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.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.4","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.4","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.21","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.1",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.19",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","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.52.0","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.3.2",vitest:"3.1.1","vitest-browser-react":"0.1.1",ws:"8.18.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.0","lint-staged":"15.5.1","node-modules-inspector":"0.6.6","simple-git-hooks":"2.12.1"}};var w=function(e){return e.CLI="CLI",e.RAW="RAW",e}({});import{exec as E}from"node:child_process";import I from"node:process";import*as S from"node:util";var C=".cyberskill-storage";import O from"dotenv";import{bool as _,cleanEnv as k,str as T}from"envalid";import R from"node:os";import L from"node:path";import G from"node:process";O.config();function D(){var e={DEBUG:G.env.DEBUG||!1,CWD:G.env.CWD,CYBERSKILL_STORAGE_DIRECTORY:G.env.CYBERSKILL_STORAGE_DIRECTORY||C};return k(e,{DEBUG:_(),CWD:T({default:G.cwd()}),CYBERSKILL_STORAGE_DIRECTORY:T({default:L.join(R.homedir(),C)})})}y(D,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import P from"consola";import{GraphQLError as M}from"graphql";var q=D();q.DEBUG||(P.level=4);function F(e){var t=N[e];return typeof t=="function"?t:N.green}y(F,"chalkKeyword");var U={silent:P.silent,level:P.level,fatal:P.fatal,error:P.error,warn:P.warn,log:P.log,info:P.info,success:P.success,ready:P.ready,start:P.start,box:P.box,debug:P.debug,trace:P.trace,verbose:P.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)){P.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;P.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),i&&P.log(" ".concat(F(n)("Rule:")," ").concat(i)),P.log(" ".concat(F(n)("Message:")," ").concat(s))}),P.box(F(n)("".concat(e," : ").concat(t.length))),P.log(N.gray("─".repeat(40)))}};var W={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import B from"node-fetch";import*as K from"node:fs";function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return K.existsSync(e)})}y(J,"existsSync");function Y(e,t){var n=K.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}y(Y,"readFileSync");function H(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);K.writeFileSync(e,s,"utf-8")}y(H,"writeFileSync");function $(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,s=i&&(typeof t==="undefined"?"undefined":f(t))=="object"?JSON.stringify(t,null,4):String(t);K.appendFileSync(e,s,"utf-8")}y($,"appendFileSync");function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){J(e)&&K.rmSync(e,{recursive:!0,force:!0})})}y(V,"rmSync");import*as z from"node:path";var Q=D();function X(){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,[Q.CWD].concat(p(t)))}y(X,"resolveWorkingPath");function Z(){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))}y(Z,"join");var ee=D(),et=ee.CWD,en="@cyberskill/shared",er="node_modules",ei="dist",es="package.json",eo="package-lock.json",ec="tsconfig.json",ea=".gitignore",eu=".simple-git-hooks.json",el="pnpm-lock.yaml",ed=".git/hooks/",ep=".git/COMMIT_EDITMSG",ef=Z(et,er,en,ei),eg="cyberskill",em="src/nodejs/cli/index.ts",eh="eslint",ey="eslint",ev="vitest",ex="playwright",ej="vitest",eb="@commitlint/cli",ew="commitlint",eE="lint-staged",eI="lint-staged",eS="typescript",eC="tsc",eO="tsx",e_="git",ek="pnpm",eT="pnpm exec",eR="simple-git-hooks",eL="simple-git-hooks",eG="@eslint/config-inspector",eD="eslint-config-inspector",eA="node-modules-inspector",eN="node-modules-inspector",eP="migrate-mongo",eM="migrate-mongo",eq={CYBERSKILL_DIRECTORY:ef,WORKING_DIRECTORY:et,TS_CONFIG:X(ec),GIT_IGNORE:X(ea),GIT_HOOK:X(ed),GIT_COMMIT_MSG:X(ep),SIMPLE_GIT_HOOKS_JSON:X(eu),PACKAGE_JSON:X(es),PACKAGE_LOCK_JSON:X(eo),PNPM_LOCK_YAML:X(el),NODE_MODULES:X(er),LINT_STAGED_CONFIG:X("".concat(ef,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:X("".concat(ef,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:X("".concat(ef,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:X("".concat(ef,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:X("".concat(ef,"/react/vitest/vitest.e2e.js"))};function eF(e){var t=e.isCurrentProject;return l({"pre-commit":eI,"commit-msg":ew},t&&{"pre-push":tu("".concat(e_," pull"))})}y(eF,"HOOK");function eU(e){return eW.apply(this,arguments)}function eW(){eW=i(function(e){var t,n,r,i,s,o;var c=arguments;return m(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]}i=d(n,2),s=i[0],o=i[1];if(!s)throw new Error("'first' argument is undefined");switch(e){case w.CLI:return[3,1];case w.RAW:return[3,3]}return[3,4];case 1:return[4,eZ(s.split(" "),{update:!0})];case 2:return[2,(a.sent(),td(tu("".concat(eT," ").concat(o))))];case 3:return[2,td(tu(s))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})});return eW.apply(this,arguments)}y(eU,"buildCommand");function eB(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__*/i(function(){return m(this,function(t){return[2,eU.apply(void 0,[e].concat(p(n)))]})})}y(eB,"commandFactory");var eK={simpleGitHooks:eB(w.CLI,eR,eL),eslintInspect:eB(w.CLI,eG,eD),nodeModulesInspect:eB(w.CLI,eA,eN),eslintCheck:eB(w.CLI,eh,"".concat(ey," ").concat(eq.WORKING_DIRECTORY)),eslintFix:eB(w.CLI,eh,"".concat(ey," ").concat(eq.WORKING_DIRECTORY," --fix")),typescriptCheck:eB(w.CLI,eS,"".concat(eC," -p ").concat(eq.TS_CONFIG," --noEmit")),configureGitHook:eB(w.RAW,"".concat(e_," config core.hooksPath ").concat(eq.GIT_HOOK)),testUnit:eB(w.CLI,ev,"".concat(ej," --config ").concat(eq.UNIT_TEST_CONFIG)),testE2e:eB(w.CLI,"".concat(ev," ").concat(ex),"".concat(ej," --config ").concat(eq.E2E_TEST_CONFIG)),mongoMigrateCreate:y(function(e){return eB(w.CLI,"".concat(eP),"".concat(eM," create ").concat(e))()},"mongoMigrateCreate"),mongoMigrateUp:eB(w.CLI,"".concat(eP),"".concat(eM," up")),mongoMigrateDown:eB(w.CLI,"".concat(eP),"".concat(eM," down")),commitLint:eB(w.CLI,eb,"".concat(ew," --edit ").concat(eq.GIT_COMMIT_MSG," --config ").concat(eq.COMMITLINT_CONFIG)),lintStaged:eB(w.CLI,eE,"".concat(eI," --config ").concat(eq.LINT_STAGED_CONFIG)),stageBuildDirectory:eB(w.RAW,"".concat(e_," add ").concat(ei)),build:eB(w.RAW,"".concat(ek," run build")),pnpmInstallStandard:eB(w.RAW,"".concat(ek," install")),pnpmInstallLegacy:eB(w.RAW,"".concat(ek," install --legacy-peer-deps")),pnpmInstallForce:eB(w.RAW,"".concat(ek," install --force"))};var eJ=D();function eY(e){var t=Z(eJ.CWD,es);if(!J(t))return!1;try{var n=Y(t,{asJson:!0}),r=n.name,i=n.dependencies,s=i===void 0?{}:i,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in s,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return U.warn("Failed to read package.json: ".concat(e.message)),!1}}y(eY,"getPackage");function eH(e){return e$.apply(this,arguments)}function e$(){e$=i(function(e){var t,n,r,i;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,B("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.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=s.sent(),r=n.version;return[2,r];case 3:i=s.sent();throw U.error('Failed to fetch version for "'.concat(e,'": ').concat(i.message)),i;case 4:return[2]}})});return e$.apply(this,arguments)}y(eH,"getLatestPackageVersion");function eV(e,t){return ez.apply(this,arguments)}function ez(){ez=i(function(e,t){var n,r,i,s,o,c,a,u,d,p,f,g,h,y,v,x,j,b,w,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=eY(e);if(!n)return[2,l({},W)];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=(i=u.devDependencies)!==null&&i!==void 0?i:{},y=d?(s=u.version)!==null&&s!==void 0?s:"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];j=y;return[3,3];case 1:return[4,eH(e)];case 2:j=m.sent();m.label=3;case 3:v=j,x=d||y===v;if(!x&&(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]=(E=u[w])!==null&&E!==void 0?E:{},u[w][e]=v,H(a,u,{isJson:!0}),U.info('Updated "'.concat(e,'" to version ').concat(v)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:I=m.sent();return[2,(U.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},W))];case 5:return[2]}})});return ez.apply(this,arguments)}y(eV,"checkPackage");function eQ(){return eX.apply(this,arguments)}function eX(){eX=i(function(){var e,t,n,r,i,s,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:y(function(){return eK.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return eK.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return eK.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);i=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.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,tg("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();U.warn("Installation attempt failed: ".concat(a)),U.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&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})});return eX.apply(this,arguments)}y(eQ,"installDependencies");function eZ(e,t){return e0.apply(this,arguments)}function e0(){e0=i(function(e,t){var n,r,i,s,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!J(eq.PACKAGE_JSON)){U.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=p(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return eV(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=m.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eQ()];case 3:r=m.sent();m.label=4;case 4:r;s=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((i=t===null||t===void 0?void 0:t.postInstallActions)!==null&&i!==void 0?i:[])[Symbol.iterator]();m.label=6;case 6:if(!!(s=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:s=true;return[3,6];case 9:return[3,12];case 10:f=m.sent();o=true;c=f;return[3,12];case 11:try{if(!s&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw U.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})});return e0.apply(this,arguments)}y(eZ,"setupPackages");import e1 from"node-persist";var e2=D();function e4(){return e3.apply(this,arguments)}function e3(){e3=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=e1.defaultInstance;if(e)return[3,2];return[4,e1.init({dir:e2.CYBERSKILL_STORAGE_DIRECTORY,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 e3.apply(this,arguments)}y(e4,"initNodePersist");var e8={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,e1.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(U.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e4()];case 1:r.sent();return[4,e1.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,e1.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();U.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e4()];case 1:n.sent();return[4,e1.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(U.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(U.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat(e2.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(U.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var e5=D(),e6=S.promisify(E);function e9(e){return"error_list:".concat(e)}y(e9,"getErrorListKey");function e7(e){return te.apply(this,arguments)}function te(){te=i(function(e){var t,n,r;return m(this,function(s){switch(s.label){case 0:if(e.length===0)return[2];t=Date.now(),n=e9(t);s.label=1;case 1:s.trys.push([1,3,,4]);return[4,e8.set(n,{errors:e,timestamp:t})];case 2:s.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e8.getLogLink(n)];case 1:e=t.sent();e&&U.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=s.sent();U.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return te.apply(this,arguments)}y(e7,"saveErrorListToStorage");function tt(){return tn.apply(this,arguments)}function tn(){tn=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e8.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=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,e8.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,(U.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tn.apply(this,arguments)}y(tt,"getStoredErrorLists");function tr(){return ti.apply(this,arguments)}function ti(){ti=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e8.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 e8.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();U.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return ti.apply(this,arguments)}y(tr,"clearAllErrorLists");function ts(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\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,a,u,l,d;var p=i.exec(e)||[],f=s.exec(e)||[],g=o.exec(e)||[];var m,h,y,v,x,j;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===A.Error?A.Error:A.Warning,message:(m=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(h=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&h!==void 0?h:""}):f.length?t.push({file:(y=f===null||f===void 0?void 0:f[1])!==null&&y!==void 0?y:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===A.Error?A.Error:A.Warning,message:(v=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&v!==void 0?v:""}):g.length?t.push({file:"commitlint",type:A.Error,message:(x=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&x!==void 0?x:"",rule:(j=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&j!==void 0?j:""}):n.push(e.trim())}}),t.length&&e7(t),e5.DEBUG&&n.length&&(U.warn("Unmatched lines:"),n.forEach(function(e){return U.info(" ".concat(e))}))}y(ts,"parseTextErrors");function to(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,i=e.line,s=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:c})})}),n.length&&e7(n)}catch(t){ts(e)}}y(to,"parseCommandOutput");function tc(e){return ta.apply(this,arguments)}function ta(){ta=i(function(e){var t,n,r,i,s,o,c,a,u;var l=arguments;return m(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:to;n=new AbortController;I.on("SIGINT",function(){U.warn("Process interrupted. Terminating..."),n.abort(),I.exit()});d.label=1;case 1:d.trys.push([1,3,,4]);return[4,e6(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].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&&U.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ta.apply(this,arguments)}y(tc,"executeCommand");function tu(e){return{raw:!0,cmd:e}}y(tu,"rawCommand");function tl(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eT," ").concat(en," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eT," ").concat(eO," ").concat(em," ").concat(e):"".concat(eT," ").concat(eg," ").concat(e)}y(tl,"formatCLI");function td(e,t){return typeof e=="function"?tl(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"?tl(e,t):e}y(td,"formatCommand");function tp(e){return tf.apply(this,arguments)}function tf(){tf=i(function(e){var t,n,r,i,s,o,c;var a=arguments;return m(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,eV(en)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:i=c,s={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(s):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,td(r,s)]}))]}})});return tf.apply(this,arguments)}y(tp,"resolveCommands");function tg(e,t){return tm.apply(this,arguments)}function tm(){tm=i(function(e,t){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);U.start("".concat(e)),e5.DEBUG&&U.info("→ ".concat(t));return[4,tc(t)];case 1:r.sent(),U.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw U.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})});return tm.apply(this,arguments)}y(tg,"runCommand");function th(){return ty.apply(this,arguments)}function ty(){ty=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!J(eq.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eK.typescriptCheck()];case 1:return[4,tg.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=U.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})});return ty.apply(this,arguments)}y(th,"checkTypescript");function tv(){return tx.apply(this,arguments)}function tx(){tx=i(function(){var e,t,n,r;var i=arguments;return m(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eK.eslintFix()];case 1:return[4,tg.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eK.eslintCheck()];case 4:return[4,tg.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})});return tx.apply(this,arguments)}y(tv,"checkEslint");function tj(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";U.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}y(tj,"printIssues");function tb(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tt()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===A.Error}),n=e.filter(function(e){return e.type===A.Warning});!t.length&&!n.length?U.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tj("Warnings",n),tj("Errors",t),(t.length>0||n.length>0)&&v.exit(1));return[2]}})});return tw.apply(this,arguments)}y(tb,"showCheckResult");function tE(){return tI.apply(this,arguments)}function tI(){tI=i(function(){var e,t,n,r,i,s;return m(this,function(o){switch(o.label){case 0:return[4,tr()];case 1:o.sent();return[4,eV(en)];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(en)];return[4,eK.build()];case 4:return[4,tg.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eK.stageBuildDirectory()];case 6:return[4,tg.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:i=o.sent();throw U.error("Error building and staging ".concat(en,": ").concat(i.message)),i;case 9:s=["Executing lint-staged"];return[4,eK.lintStaged()];case 10:return[4,tg.apply(void 0,s.concat([o.sent()]))];case 11:o.sent(),tb();return[2]}})});return tI.apply(this,arguments)}y(tE,"lintStaged");function tS(){return tC.apply(this,arguments)}function tC(){tC=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eK.eslintInspect()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tC.apply(this,arguments)}y(tS,"inspectLint");function tO(){return t_.apply(this,arguments)}function t_(){t_=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tr()];case 1:e.sent();return[4,Promise.all([th(),tv()])];case 2:e.sent(),tb();return[2]}})});return t_.apply(this,arguments)}y(tO,"lintCheck");function tk(){return tT.apply(this,arguments)}function tT(){tT=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,tr()];case 1:e.sent();return[4,Promise.all([th(),tv(!0)])];case 2:e.sent(),tb();return[2]}})});return tT.apply(this,arguments)}y(tk,"lintFix");function tR(){return tL.apply(this,arguments)}function tL(){tL=i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tr()];case 1:t.sent();e=["Validating commit message"];return[4,eK.commitLint()];case 2:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tb();return[2]}})});return tL.apply(this,arguments)}y(tR,"commitLint");function tG(){return tD.apply(this,arguments)}function tD(){tD=i(function(){var e,t,n,r;return m(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,eK.configureGitHook()];case 1:return[4,tg.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),V(eq.GIT_HOOK);return[4,tp(eF)];case 3:t=i.sent();H(eq.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});n="\n".concat(eu,"\n");J(eq.GIT_IGNORE)?Y(eq.GIT_IGNORE).split("\n").includes(eu)||$(eq.GIT_IGNORE,n):H(eq.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eK.simpleGitHooks()];case 4:return[4,tg.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})});return tD.apply(this,arguments)}y(tG,"setupGitHook");function tA(){return tN.apply(this,arguments)}function tN(){tN=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eZ([en],{update:!0,postInstallActions:[tG]})];case 1:e.sent();return[2]}})});return tN.apply(this,arguments)}y(tA,"setup");function tP(){return tM.apply(this,arguments)}function tM(){tM=i(function(){return m(this,function(e){switch(e.label){case 0:V(eq.NODE_MODULES,eq.PNPM_LOCK_YAML);return[4,eQ()];case 1:e.sent();return[4,tG()];case 2:e.sent();return[2]}})});return tM.apply(this,arguments)}y(tP,"reset");function tq(){return tF.apply(this,arguments)}function tF(){tF=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eK.nodeModulesInspect()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tF.apply(this,arguments)}y(tq,"inspect");function tU(){return tW.apply(this,arguments)}function tW(){tW=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eK.testUnit()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tW.apply(this,arguments)}y(tU,"testUnit");function tB(){return tK.apply(this,arguments)}function tK(){tK=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eK.testE2e()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tK.apply(this,arguments)}y(tB,"testE2E");function tJ(e){return tY.apply(this,arguments)}function tY(){tY=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eK.mongoMigrateCreate(e)];case 1:return[4,tg.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})});return tY.apply(this,arguments)}y(tJ,"mongoMigrateCreate");function tH(){return t$.apply(this,arguments)}function t$(){t$=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eK.mongoMigrateUp()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return t$.apply(this,arguments)}y(tH,"mongoMigrateUp");function tV(){return tz.apply(this,arguments)}function tz(){tz=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eK.mongoMigrateDown()];case 1:return[4,tg.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})});return tz.apply(this,arguments)}y(tV,"mongoMigrateDown");i(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(v.argv)).scriptName(eg).usage("$0 <command> [options]").command("lint","Check code for linting issues",tO).command("lint:fix","Fix linting issues automatically",tk).command("lint:inspect","View active ESLint configuration",tS).command("lint-staged","Run lint checks on staged files",tE).command("commitlint","Validate commit message format",tR).command("setup","Initialize project setup and dependencies",tA).command("reset","Reset the project and reinstall dependencies",tP).command("inspect","Analyze installed project dependencies",tq).command("test:unit","Run unit test suite",tU).command("test:e2e","Run end-to-end test suite",tB).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},/*#__PURE__*/function(){var e=i(function(e){return m(this,function(t){switch(t.label){case 0:if(!e.name){U.error("Migration name is required.");return[2]}return[4,tJ(e.name)];case 1:t.sent();return[2]}})});return function(t){return e.apply(this,arguments)}}()).command("mongo:migrate:up","Apply all MongoDB migrations",tH).command("mongo:migrate:down","Rollback last MongoDB migration",tV).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(b.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();U.error("Fatal: ".concat(e.message)),v.exit(1);return[3,3];case 3:return[2]}})})();
|