@cyberskill/shared 1.126.0 → 1.127.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.
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function a(e){r(o,s,i,a,c,"next",e)}function c(e){r(o,s,i,a,c,"throw",e)}a(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)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){i(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}function f(e){return n(e)||o(e)||g(e)||u()}function p(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,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[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]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var v=Object.create;var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var I=function(e,t){return y(e,"name",{value:t,configurable:!0})};var w=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":p(t))=="object"||typeof t=="function")try{var a=function(){var s=u.value;!b.call(e,s)&&s!==n&&y(e,s,{get:function(){return t[s]},enumerable:!(r=h(t,s))||r.enumerable})};for(var c=x(t)[Symbol.iterator](),u;!(s=(u=c.next()).done);s=true)a()}catch(e){i=true;o=e}finally{try{if(!s&&c.return!=null){c.return()}}finally{if(i){throw o}}}return e};var E=function(e,t,n){return n=e!=null?v(j(e)):{},w(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return w(y({},"__esModule",{value:!0}),e)};var O={};module.exports=S(O);var C=E(require("process"),1),k=require("yargs/helpers"),T=E(require("yargs/yargs"),1);var G={name:"@cyberskill/shared",type:"module",version:"1.125.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"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","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","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/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@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.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var _=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var N=require("child_process"),R=E(require("process"),1),L=E(require("util"),1);var q=".cyberskill-storage";var D=E(require("@dotenvx/dotenvx"),1),M=require("envalid"),P=E(require("os"),1),A=E(require("path"),1),F=E(require("process"),1);var U=!1;function B(){U||(D.default.config(),U=!0)}I(B,"loadEnvFile");function K(){B();var e=(0,M.cleanEnv)(F.default.env,{CWD:(0,M.str)({default:F.default.cwd()}),DEBUG:(0,M.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,M.str)({default:A.default.join(P.default.homedir(),q)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}I(K,"getEnv");var W=function(e){return e.Error="error",e.Warning="warning",e}({});var Y=E(require("chalk"),1),H=E(require("consola"),1),J=require("graphql");var $=K();$.DEBUG||(H.default.level=4);function V(e){var t=Y.default[e];return typeof t=="function"?t:Y.default.green}I(V,"chalkKeyword");var z={silent:H.default.silent,level:H.default.level,fatal:H.default.fatal,error:H.default.error,warn:H.default.warn,log:H.default.log,info:H.default.info,success:H.default.success,ready:H.default.ready,start:H.default.start,box:H.default.box,debug:H.default.debug,trace:H.default.trace,verbose:H.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)){H.default.box(Y.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;H.default.log("".concat(Y.default.gray("File:")," ").concat(Y.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&H.default.log(" ".concat(V(n)("Rule:")," ").concat(s)),H.default.log(" ".concat(V(n)("Message:")," ").concat(i))}),H.default.box(V(n)("".concat(e," : ").concat(t.length))),H.default.log(Y.default.gray("─".repeat(40)))}};var Q={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var X=E(require("node-fetch"),1);var Z=E(require("fs-extra"),1);var ee=E(require("path"),1);var et=K(),en=ee.default;function er(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=en).resolve.apply(r,[et.CWD].concat(f(t)))}I(er,"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=en).join.apply(r,f(t))}I(es,"join");var ei=K(),eo=ei.CWD,ea="@cyberskill/shared",ec="node_modules",eu="dist",el="package.json",ed="package-lock.json",ef="tsconfig.json",ep=".gitignore",eg=".simple-git-hooks.json",em="pnpm-lock.yaml",ev=".git/hooks/",ey=".git/COMMIT_EDITMSG",eh=".migrate-mongo.config.js",ex=es(eo,ec,ea,eu),ej="cyberskill",eb="src/nodejs/cli/index.ts",eI="eslint",ew="eslint",eE="vitest",eS="playwright",eO="vitest",eC="@commitlint/cli",ek="commitlint",eT="lint-staged",eG="lint-staged",e_="typescript",eN="tsc",eR="tsx",eL="git",eq="pnpm",eD="pnpm exec",eM="simple-git-hooks",eP="simple-git-hooks",eA="@eslint/config-inspector",eF="eslint-config-inspector",eU="node-modules-inspector",eB="node-modules-inspector",eK="migrate-mongo",eW="./node_modules/migrate-mongo/bin/migrate-mongo",eY={CYBERSKILL_DIRECTORY:ex,WORKING_DIRECTORY:eo,TS_CONFIG:er(ef),GIT_IGNORE:er(ep),GIT_HOOK:er(ev),GIT_COMMIT_MSG:er(ey),SIMPLE_GIT_HOOKS_JSON:er(eg),PACKAGE_JSON:er(el),PACKAGE_LOCK_JSON:er(ed),PNPM_LOCK_YAML:er(em),NODE_MODULES:er(ec),MIGRATE_MONGO_CONFIG:er(eh),LINT_STAGED_CONFIG:er("".concat(ex,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:er("".concat(ex,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:er("".concat(ex,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:er("".concat(ex,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:er("".concat(ex,"/react/vitest/vitest.e2e.js"))};function eH(e){var t=e.isCurrentProject;return l({"pre-commit":eG,"commit-msg":ek},t&&{"pre-push":ty("".concat(eL," pull"))})}I(eH,"createGitHooksConfig");function eJ(e,t,n){return s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case _.CLI:return[3,1];case _.STRING:return[3,3]}return[3,4];case 1:return[4,tr(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tx(ty("".concat(eD," ").concat(n))))];case 3:return[2,tx(ty(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}I(eJ,"buildCommand");function e$(e,t,n){return function(){return s(function(){return m(this,function(r){return[2,eJ(e,t,n)]})})()}}I(e$,"commandFactory");var eV={simpleGitHooks:e$(_.CLI,eM,eP),eslintInspect:e$(_.CLI,eA,eF),nodeModulesInspect:e$(_.CLI,eU,eB),eslintCheck:e$(_.CLI,eI,"".concat(ew," ").concat(eY.WORKING_DIRECTORY," --no-cache")),eslintFix:e$(_.CLI,eI,"".concat(ew," ").concat(eY.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:e$(_.CLI,e_,"".concat(eN," -p ").concat(eY.TS_CONFIG," --noEmit")),configureGitHook:e$(_.STRING,"".concat(eL," config core.hooksPath ").concat(eY.GIT_HOOK)),testUnit:e$(_.CLI,eE,"".concat(eO," --config ").concat(eY.UNIT_TEST_CONFIG)),testE2e:e$(_.CLI,"".concat(eE," ").concat(eS),"".concat(eO," --config ").concat(eY.E2E_TEST_CONFIG)),mongoMigrateCreate:I(function(e){return e$(_.CLI,eK,"".concat(eR," ").concat(eW," create ").concat(e," -f ").concat(eY.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:e$(_.CLI,eK,"".concat(eR," ").concat(eW," up -f ").concat(eY.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:e$(_.CLI,eK,"".concat(eR," ").concat(eW," down -f ").concat(eY.MIGRATE_MONGO_CONFIG)),commitLint:e$(_.CLI,eC,"".concat(ek," --edit ").concat(eY.GIT_COMMIT_MSG," --config ").concat(eY.COMMITLINT_CONFIG)),lintStaged:e$(_.CLI,eT,"".concat(eG," --config ").concat(eY.LINT_STAGED_CONFIG)),stageBuildDirectory:e$(_.STRING,"".concat(eL," add ").concat(eu)),build:e$(_.STRING,"".concat(eq," run build")),pnpmInstallStandard:e$(_.STRING,"".concat(eq," install")),pnpmInstallLegacy:e$(_.STRING,"".concat(eq," install --legacy-peer-deps")),pnpmInstallForce:e$(_.STRING,"".concat(eq," install --force"))};var ez=Z.default,eQ=ez.lstatSync,eX=ez.readdirSync,eZ=ez.mkdirSync,e0=ez.readFileSync,e1=ez.unlinkSync,e2=ez.statSync,e4=Z.default.readJsonSync;function e3(e,t,n){Z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}I(e3,"writeFileSync");function e5(e,t,n){Z.default.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}I(e5,"appendFileSync");function e8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Z.default.pathExistsSync(e)})}I(e8,"pathExistsSync");function e6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){e8(e)&&Z.default.removeSync(e)})}I(e6,"removeSync");var e7=K();function e9(e){var t=es(e7.CWD,el);if(!e8(t))return!1;try{var n=e4(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return z.warn("Failed to read package.json: ".concat(e.message)),!1}}I(e9,"getPackage");function te(e){return s(function(){var t,n,r,s;return m(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,X.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw z.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}I(te,"getLatestPackageVersion");function tt(e,t){return s(function(){var n,r,s,i,o,a,c,u,d,f,p,g,v,y,h,x,j,b,I,w,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e9(e);if(!n)return[2,l({},Q)];c=n.path,u=n.file,d=n.isCurrentProject,f=n.isDepend,p=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},v=(s=u.devDependencies)!==null&&s!==void 0?s:{},y=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":f?(o=g[e])!==null&&o!==void 0?o:"0.0.0":p?(a=v[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];j=y;return[3,3];case 1:return[4,te(e)];case 2:j=m.sent();m.label=3;case 3:h=j,x=d||y===h;if(!x&&(t===null||t===void 0?void 0:t.update)){;I=f?"dependencies":p?"devDependencies":null;I&&((b=u[I])===null||b===void 0?void 0:b[e])!==h&&(u[I]=(w=u[I])!==null&&w!==void 0?w:{},u[I][e]=h,e3(c,JSON.stringify(u,null,4)),z.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:x}];case 4:E=m.sent();return[2,(z.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},Q))];case 5:return[2]}})})()}I(tt,"checkPackage");function tn(){return s(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return m(this,function(f){switch(f.label){case 0:e=[{command:I(function(){return eV.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:I(function(){return eV.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:I(function(){return eV.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tb("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();z.warn("Installation attempt failed: ".concat(c)),z.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}I(tn,"installDependencies");function tr(e,t){return s(function(){var n,r,s,i,o,a,c,u,d,p,g;return m(this,function(m){switch(m.label){case 0:if(!e8(eY.PACKAGE_JSON)){z.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=f(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tt(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,tn()];case 3:r=m.sent();m.label=4;case 4:r;i=true,o=false,a=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();m.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:p=m.sent();o=true;a=p;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=m.sent();throw z.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}I(tr,"setupPackages");var ts=E(require("node-persist"),1);var ti=K();function to(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=ts.default.defaultInstance;if(e)return[3,2];return[4,ts.default.init({dir:ti.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]}})})()}I(to,"initNodePersist");var ta={get:function e(e){return s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,to()];case 1:r.sent();return[4,ts.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(z.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,to()];case 1:r.sent();return[4,ts.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();z.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,to()];case 1:n.sent();return[4,ts.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();z.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,to()];case 1:n.sent();return[4,ts.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(z.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(z.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return m(this,function(t){try{return[2,"".concat(ti.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(z.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tc=K(),tu=L.promisify(N.exec);function tl(e){return"error_list:".concat(e)}I(tl,"getErrorListKey");function td(e){return s(function(){var t,n,r;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tl(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,ta.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ta.getLogLink(n)];case 1:e=t.sent();e&&z.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();z.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}I(td,"saveErrorListToStorage");function tf(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ta.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 s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,ta.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(z.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}I(tf,"getStoredErrorLists");function tp(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ta.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 ta.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();z.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}I(tp,"clearAllErrorLists");function tg(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],g=o.exec(e)||[];var m,v,y,h,x,j;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===W.Error?W.Error:W.Warning,message:(m=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(v=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===W.Error?W.Error:W.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):g.length?t.push({file:"commitlint",type:W.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&&td(t),tc.DEBUG&&n.length&&(z.warn("Unmatched lines:"),n.forEach(function(e){return z.info(" ".concat(e))}))}I(tg,"parseTextErrors");function tm(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?W.Error:W.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&td(n)}catch(t){tg(e)}}I(tm,"parseCommandOutput");function tv(e){return s(function(e){var t,n,r,s,i,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]:tm;n=new AbortController;R.default.on("SIGINT",function(){z.warn("Process interrupted. Terminating..."),n.abort(),R.default.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tu(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&z.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}I(tv,"executeCommand");function ty(e){return{raw:!0,cmd:e}}I(ty,"rawCommand");function th(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eD," ").concat(ea," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eD," ").concat(eR," ").concat(eb," ").concat(e):"".concat(eD," ").concat(ej," ").concat(e)}I(th,"formatCLI");function tx(e,t){return typeof e=="function"?th(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?th(e,t):e}I(tx,"formatCommand");function tj(e){return s(function(e){var t,n,r,s,i,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,tt(ea)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tx(r,i)]}))]}})}).apply(this,arguments)}I(tj,"resolveCommands");function tb(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);z.start("".concat(e)),tc.DEBUG&&z.info("→ ".concat(t));return[4,tv(t)];case 1:r.sent(),z.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw z.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}I(tb,"runCommand");function tI(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!e8(eY.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eV.typescriptCheck()];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=z.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}I(tI,"checkTypescript");function tw(){return s(function(){var e,t,n,r;var s=arguments;return m(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eV.eslintFix()];case 1:return[4,tb.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eV.eslintCheck()];case 4:return[4,tb.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}I(tw,"checkEslint");function tE(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";z.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}I(tE,"printIssues");function tS(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tf()];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?z.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tE("Warnings",n),tE("Errors",t),(t.length>0||n.length>0)&&C.default.exit(1));return[2]}})})()}I(tS,"showCheckResult");function tO(){return s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,tp()];case 1:o.sent();return[4,tt(ea)];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(ea)];return[4,eV.build()];case 4:return[4,tb.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eV.stageBuildDirectory()];case 6:return[4,tb.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw z.error("Error building and staging ".concat(ea,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eV.lintStaged()];case 10:return[4,tb.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tS();return[2]}})})()}I(tO,"lintStaged");function tC(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eV.eslintInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tC,"inspectLint");function tk(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tp()];case 1:e.sent();return[4,Promise.all([tI(),tw()])];case 2:e.sent(),tS();return[2]}})})()}I(tk,"lintCheck");function tT(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tp()];case 1:e.sent();return[4,Promise.all([tI(),tw(!0)])];case 2:e.sent(),tS();return[2]}})})()}I(tT,"lintFix");function tG(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tp()];case 1:t.sent();e=["Validating commit message"];return[4,eV.commitLint()];case 2:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tS();return[2]}})})()}I(tG,"commitLint");function t_(){return s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eV.configureGitHook()];case 1:return[4,tb.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),e6(eY.GIT_HOOK);return[4,tj(eH)];case 3:t=s.sent();e3(eY.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(eg,"\n");e8(eY.GIT_IGNORE)?e0(eY.GIT_IGNORE,"utf-8").split("\n").includes(eg)||e5(eY.GIT_IGNORE,n):e3(eY.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eV.simpleGitHooks()];case 4:return[4,tb.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}I(t_,"setupGitHook");function tN(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tr([ea],{update:!0,postInstallActions:[t_]})];case 1:e.sent();return[2]}})})()}I(tN,"setup");function tR(){return s(function(){return m(this,function(e){switch(e.label){case 0:e6(eY.NODE_MODULES,eY.PNPM_LOCK_YAML);return[4,tn()];case 1:e.sent();return[4,t_()];case 2:e.sent();return[2]}})})()}I(tR,"reset");function tL(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eV.nodeModulesInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tL,"inspect");function tq(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eV.testUnit()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tq,"testUnit");function tD(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eV.testE2e()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tD,"testE2E");function tM(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eV.mongoMigrateCreate(e)];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}I(tM,"mongoMigrateCreate");function tP(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eV.mongoMigrateUp()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tP,"mongoMigrateUp");function tA(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eV.mongoMigrateDown()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tA,"mongoMigrateDown");(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,T.default)((0,k.hideBin)(C.default.argv)).scriptName(ej).usage("$0 <command> [options]").command("lint","Check code for linting issues",tk).command("lint:fix","Fix linting issues automatically",tT).command("lint:inspect","View active ESLint configuration",tC).command("lint-staged","Run lint checks on staged files",tO).command("commitlint","Validate commit message format",tG).command("setup","Initialize project setup and dependencies",tN).command("reset","Reset the project and reinstall dependencies",tR).command("inspect","Analyze installed project dependencies",tL).command("test:unit","Run unit test suite",tq).command("test:e2e","Run end-to-end test suite",tD).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){z.error("Migration name is required.");return[2]}return[4,tM(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tP).command("mongo:migrate:down","Rollback last MongoDB migration",tA).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(G.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();z.error("Fatal: ".concat(e.message)),C.default.exit(1);return[3,3];case 3:return[2]}})})()})();
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var a=e[i](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function a(e){r(o,s,i,a,c,"next",e)}function c(e){r(o,s,i,a,c,"throw",e)}a(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,a;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;a=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)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){i(e,t,n[t])})}return e}function d(e,n){return t(e)||a(e,n)||g(e,n)||c()}function f(e){return n(e)||o(e)||g(e)||u()}function p(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,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[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]&&(i=0)),i)try{if(n=1,r&&(s=a[0]&2?r["return"]:a[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,a[1])).done)return s;if(r=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var v=Object.create;var y=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var I=function(e,t){return y(e,"name",{value:t,configurable:!0})};var w=function(e,t,n,r){var s=true,i=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":p(t))=="object"||typeof t=="function")try{var a=function(){var s=u.value;!b.call(e,s)&&s!==n&&y(e,s,{get:function(){return t[s]},enumerable:!(r=h(t,s))||r.enumerable})};for(var c=x(t)[Symbol.iterator](),u;!(s=(u=c.next()).done);s=true)a()}catch(e){i=true;o=e}finally{try{if(!s&&c.return!=null){c.return()}}finally{if(i){throw o}}}return e};var E=function(e,t,n){return n=e!=null?v(j(e)):{},w(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)},S=function(e){return w(y({},"__esModule",{value:!0}),e)};var O={};module.exports=S(O);var C=E(require("process"),1),k=require("yargs/helpers"),T=E(require("yargs/yargs"),1);var G={name:"@cyberskill/shared",type:"module",version:"1.126.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"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","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","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/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@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.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var _=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var N=require("child_process"),R=E(require("process"),1),L=E(require("util"),1);var q=".cyberskill-storage";var D=E(require("@dotenvx/dotenvx"),1),M=require("envalid"),P=E(require("os"),1),A=E(require("path"),1),F=E(require("process"),1);var U=!1;function B(){U||(D.default.config(),U=!0)}I(B,"loadEnvFile");function K(){B();var e=(0,M.cleanEnv)(F.default.env,{CWD:(0,M.str)({default:F.default.cwd()}),DEBUG:(0,M.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,M.str)({default:A.default.join(P.default.homedir(),q)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}I(K,"getEnv");var W=function(e){return e.Error="error",e.Warning="warning",e}({});var Y=E(require("chalk"),1),H=E(require("consola"),1),J=require("graphql");var $=K();$.DEBUG||(H.default.level=4);function V(e){var t=Y.default[e];return typeof t=="function"?t:Y.default.green}I(V,"chalkKeyword");var z={silent:H.default.silent,level:H.default.level,fatal:H.default.fatal,error:H.default.error,warn:H.default.warn,log:H.default.log,info:H.default.info,success:H.default.success,ready:H.default.ready,start:H.default.start,box:H.default.box,debug:H.default.debug,trace:H.default.trace,verbose:H.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)){H.default.box(Y.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;H.default.log("".concat(Y.default.gray("File:")," ").concat(Y.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&H.default.log(" ".concat(V(n)("Rule:")," ").concat(s)),H.default.log(" ".concat(V(n)("Message:")," ").concat(i))}),H.default.box(V(n)("".concat(e," : ").concat(t.length))),H.default.log(Y.default.gray("─".repeat(40)))}};var Q={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var X=E(require("node-fetch"),1);var Z=E(require("fs-extra"),1);var ee=E(require("path"),1);var et=K(),en=ee.default;function er(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=en).resolve.apply(r,[et.CWD].concat(f(t)))}I(er,"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=en).join.apply(r,f(t))}I(es,"join");var ei=K(),eo=ei.CWD,ea="@cyberskill/shared",ec="node_modules",eu="dist",el="package.json",ed="package-lock.json",ef="tsconfig.json",ep=".gitignore",eg=".simple-git-hooks.json",em="pnpm-lock.yaml",ev=".git/hooks/",ey=".git/COMMIT_EDITMSG",eh=".migrate-mongo.config.js",ex=es(eo,ec,ea,eu),ej="cyberskill",eb="src/nodejs/cli/index.ts",eI="eslint",ew="eslint",eE="vitest",eS="playwright",eO="vitest",eC="@commitlint/cli",ek="commitlint",eT="lint-staged",eG="lint-staged",e_="typescript",eN="tsc",eR="tsx",eL="git",eq="pnpm",eD="pnpm exec",eM="simple-git-hooks",eP="simple-git-hooks",eA="@eslint/config-inspector",eF="eslint-config-inspector",eU="node-modules-inspector",eB="node-modules-inspector",eK="migrate-mongo",eW="./node_modules/migrate-mongo/bin/migrate-mongo",eY={CYBERSKILL_DIRECTORY:ex,WORKING_DIRECTORY:eo,TS_CONFIG:er(ef),GIT_IGNORE:er(ep),GIT_HOOK:er(ev),GIT_COMMIT_MSG:er(ey),SIMPLE_GIT_HOOKS_JSON:er(eg),PACKAGE_JSON:er(el),PACKAGE_LOCK_JSON:er(ed),PNPM_LOCK_YAML:er(em),NODE_MODULES:er(ec),MIGRATE_MONGO_CONFIG:er(eh),LINT_STAGED_CONFIG:er("".concat(ex,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:er("".concat(ex,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:er("".concat(ex,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:er("".concat(ex,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:er("".concat(ex,"/react/vitest/vitest.e2e.js"))};function eH(e){var t=e.isCurrentProject;return l({"pre-commit":eG,"commit-msg":ek},t&&{"pre-push":ty("".concat(eL," pull"))})}I(eH,"createGitHooksConfig");function eJ(e,t,n){return s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case _.CLI:return[3,1];case _.STRING:return[3,3]}return[3,4];case 1:return[4,tr(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tx(ty("".concat(eD," ").concat(n))))];case 3:return[2,tx(ty(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}I(eJ,"buildCommand");function e$(e,t,n){return function(){return s(function(){return m(this,function(r){return[2,eJ(e,t,n)]})})()}}I(e$,"commandFactory");var eV={simpleGitHooks:e$(_.CLI,eM,eP),eslintInspect:e$(_.CLI,eA,eF),nodeModulesInspect:e$(_.CLI,eU,eB),eslintCheck:e$(_.CLI,eI,"".concat(ew," ").concat(eY.WORKING_DIRECTORY," --no-cache")),eslintFix:e$(_.CLI,eI,"".concat(ew," ").concat(eY.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:e$(_.CLI,e_,"".concat(eN," -p ").concat(eY.TS_CONFIG," --noEmit")),configureGitHook:e$(_.STRING,"".concat(eL," config core.hooksPath ").concat(eY.GIT_HOOK)),testUnit:e$(_.CLI,eE,"".concat(eO," --config ").concat(eY.UNIT_TEST_CONFIG)),testE2e:e$(_.CLI,"".concat(eE," ").concat(eS),"".concat(eO," --config ").concat(eY.E2E_TEST_CONFIG)),mongoMigrateCreate:I(function(e){return e$(_.CLI,eK,"".concat(eR," ").concat(eW," create ").concat(e," -f ").concat(eY.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:e$(_.CLI,eK,"".concat(eR," ").concat(eW," up -f ").concat(eY.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:e$(_.CLI,eK,"".concat(eR," ").concat(eW," down -f ").concat(eY.MIGRATE_MONGO_CONFIG)),commitLint:e$(_.CLI,eC,"".concat(ek," --edit ").concat(eY.GIT_COMMIT_MSG," --config ").concat(eY.COMMITLINT_CONFIG)),lintStaged:e$(_.CLI,eT,"".concat(eG," --config ").concat(eY.LINT_STAGED_CONFIG)),stageBuildDirectory:e$(_.STRING,"".concat(eL," add ").concat(eu)),build:e$(_.STRING,"".concat(eq," run build")),pnpmInstallStandard:e$(_.STRING,"".concat(eq," install")),pnpmInstallLegacy:e$(_.STRING,"".concat(eq," install --legacy-peer-deps")),pnpmInstallForce:e$(_.STRING,"".concat(eq," install --force"))};var ez=Z.default,eQ=ez.lstatSync,eX=ez.readdirSync,eZ=ez.mkdirSync,e0=ez.readFileSync,e1=ez.unlinkSync,e2=ez.statSync,e4=Z.default.readJsonSync;function e3(e,t,n){Z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}I(e3,"writeFileSync");function e5(e,t,n){Z.default.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}I(e5,"appendFileSync");function e8(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Z.default.pathExistsSync(e)})}I(e8,"pathExistsSync");function e6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){e8(e)&&Z.default.removeSync(e)})}I(e6,"removeSync");var e7=K();function e9(e){var t=es(e7.CWD,el);if(!e8(t))return!1;try{var n=e4(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,a=o===void 0?{}:o,c=r===e,u=e in i,l=e in a;return c||u||l?{path:t,file:n,isCurrentProject:c,isDepend:u,isDevDepend:l}:!1}catch(e){return z.warn("Failed to read package.json: ".concat(e.message)),!1}}I(e9,"getPackage");function te(e){return s(function(){var t,n,r,s;return m(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,(0,X.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw z.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}I(te,"getLatestPackageVersion");function tt(e,t){return s(function(){var n,r,s,i,o,a,c,u,d,f,p,g,v,y,h,x,j,b,I,w,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e9(e);if(!n)return[2,l({},Q)];c=n.path,u=n.file,d=n.isCurrentProject,f=n.isDepend,p=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},v=(s=u.devDependencies)!==null&&s!==void 0?s:{},y=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":f?(o=g[e])!==null&&o!==void 0?o:"0.0.0":p?(a=v[e])!==null&&a!==void 0?a:"0.0.0":"0.0.0";if(!d)return[3,1];j=y;return[3,3];case 1:return[4,te(e)];case 2:j=m.sent();m.label=3;case 3:h=j,x=d||y===h;if(!x&&(t===null||t===void 0?void 0:t.update)){;I=f?"dependencies":p?"devDependencies":null;I&&((b=u[I])===null||b===void 0?void 0:b[e])!==h&&(u[I]=(w=u[I])!==null&&w!==void 0?w:{},u[I][e]=h,e3(c,JSON.stringify(u,null,4)),z.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:x}];case 4:E=m.sent();return[2,(z.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},Q))];case 5:return[2]}})})()}I(tt,"checkPackage");function tn(){return s(function(){var e,t,n,r,s,i,o,a,c,u,l,d;return m(this,function(f){switch(f.label){case 0:e=[{command:I(function(){return eV.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:I(function(){return eV.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:I(function(){return eV.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);s=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,a=o.command,c=o.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,a()];case 4:u=f.sent();return[4,tb("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();z.warn("Installation attempt failed: ".concat(c)),z.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=f.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}I(tn,"installDependencies");function tr(e,t){return s(function(){var n,r,s,i,o,a,c,u,d,p,g;return m(this,function(m){switch(m.label){case 0:if(!e8(eY.PACKAGE_JSON)){z.error("package.json not found. Aborting setup.");return[2]}m.label=1;case 1:m.trys.push([1,13,,14]);n=f(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return tt(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,tn()];case 3:r=m.sent();m.label=4;case 4:r;i=true,o=false,a=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);c=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();m.label=6;case 6:if(!!(i=(u=c.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:p=m.sent();o=true;a=p;return[3,12];case 11:try{if(!i&&c.return!=null){c.return()}}finally{if(o){throw a}}return[7];case 12:return[3,14];case 13:g=m.sent();throw z.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}I(tr,"setupPackages");var ts=E(require("node-persist"),1);var ti=K();function to(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=ts.default.defaultInstance;if(e)return[3,2];return[4,ts.default.init({dir:ti.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]}})})()}I(to,"initNodePersist");var ta={get:function e(e){return s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,to()];case 1:r.sent();return[4,ts.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(z.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,to()];case 1:r.sent();return[4,ts.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();z.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,to()];case 1:n.sent();return[4,ts.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();z.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,to()];case 1:n.sent();return[4,ts.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(z.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(z.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return m(this,function(t){try{return[2,"".concat(ti.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(z.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var tc=K(),tu=L.promisify(N.exec);function tl(e){return"error_list:".concat(e)}I(tl,"getErrorListKey");function td(e){return s(function(){var t,n,r;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tl(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,ta.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ta.getLogLink(n)];case 1:e=t.sent();e&&z.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();z.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}I(td,"saveErrorListToStorage");function tf(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ta.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 s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,ta.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(z.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}I(tf,"getStoredErrorLists");function tp(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ta.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 ta.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();z.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}I(tp,"clearAllErrorLists");function tg(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var f=s.exec(e)||[],p=i.exec(e)||[],g=o.exec(e)||[];var m,v,y,h,x,j;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===W.Error?W.Error:W.Warning,message:(m=f===null||f===void 0?void 0:(a=f[4])===null||a===void 0?void 0:a.trim())!==null&&m!==void 0?m:"",rule:(v=f===null||f===void 0?void 0:(c=f[5])===null||c===void 0?void 0:c.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===W.Error?W.Error:W.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):g.length?t.push({file:"commitlint",type:W.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&&td(t),tc.DEBUG&&n.length&&(z.warn("Unmatched lines:"),n.forEach(function(e){return z.info(" ".concat(e))}))}I(tg,"parseTextErrors");function tm(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?W.Error:W.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&td(n)}catch(t){tg(e)}}I(tm,"parseCommandOutput");function tv(e){return s(function(e){var t,n,r,s,i,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]:tm;n=new AbortController;R.default.on("SIGINT",function(){z.warn("Process interrupted. Terminating..."),n.abort(),R.default.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tu(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&z.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}I(tv,"executeCommand");function ty(e){return{raw:!0,cmd:e}}I(ty,"rawCommand");function th(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eD," ").concat(ea," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eD," ").concat(eR," ").concat(eb," ").concat(e):"".concat(eD," ").concat(ej," ").concat(e)}I(th,"formatCLI");function tx(e,t){return typeof e=="function"?th(e(t),t):(typeof e==="undefined"?"undefined":p(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?th(e,t):e}I(tx,"formatCommand");function tj(e){return s(function(e){var t,n,r,s,i,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,tt(ea)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:s=a,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,tx(r,i)]}))]}})}).apply(this,arguments)}I(tj,"resolveCommands");function tb(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);z.start("".concat(e)),tc.DEBUG&&z.info("→ ".concat(t));return[4,tv(t)];case 1:r.sent(),z.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw z.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}I(tb,"runCommand");function tI(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!e8(eY.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eV.typescriptCheck()];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=z.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}I(tI,"checkTypescript");function tw(){return s(function(){var e,t,n,r;var s=arguments;return m(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eV.eslintFix()];case 1:return[4,tb.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eV.eslintCheck()];case 4:return[4,tb.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}I(tw,"checkEslint");function tE(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";z.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}I(tE,"printIssues");function tS(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tf()];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?z.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tE("Warnings",n),tE("Errors",t),(t.length>0||n.length>0)&&C.default.exit(1));return[2]}})})()}I(tS,"showCheckResult");function tO(){return s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,tp()];case 1:o.sent();return[4,tt(ea)];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(ea)];return[4,eV.build()];case 4:return[4,tb.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eV.stageBuildDirectory()];case 6:return[4,tb.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw z.error("Error building and staging ".concat(ea,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eV.lintStaged()];case 10:return[4,tb.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tS();return[2]}})})()}I(tO,"lintStaged");function tC(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eV.eslintInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tC,"inspectLint");function tk(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tp()];case 1:e.sent();return[4,Promise.all([tI(),tw()])];case 2:e.sent(),tS();return[2]}})})()}I(tk,"lintCheck");function tT(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tp()];case 1:e.sent();return[4,Promise.all([tI(),tw(!0)])];case 2:e.sent(),tS();return[2]}})})()}I(tT,"lintFix");function tG(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tp()];case 1:t.sent();e=["Validating commit message"];return[4,eV.commitLint()];case 2:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tS();return[2]}})})()}I(tG,"commitLint");function t_(){return s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eV.configureGitHook()];case 1:return[4,tb.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),e6(eY.GIT_HOOK);return[4,tj(eH)];case 3:t=s.sent();e3(eY.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(eg,"\n");e8(eY.GIT_IGNORE)?e0(eY.GIT_IGNORE,"utf-8").split("\n").includes(eg)||e5(eY.GIT_IGNORE,n):e3(eY.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eV.simpleGitHooks()];case 4:return[4,tb.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}I(t_,"setupGitHook");function tN(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tr([ea],{update:!0,postInstallActions:[t_]})];case 1:e.sent();return[2]}})})()}I(tN,"setup");function tR(){return s(function(){return m(this,function(e){switch(e.label){case 0:e6(eY.NODE_MODULES,eY.PNPM_LOCK_YAML);return[4,tn()];case 1:e.sent();return[4,t_()];case 2:e.sent();return[2]}})})()}I(tR,"reset");function tL(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eV.nodeModulesInspect()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tL,"inspect");function tq(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eV.testUnit()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tq,"testUnit");function tD(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eV.testE2e()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tD,"testE2E");function tM(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eV.mongoMigrateCreate(e)];case 1:return[4,tb.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}I(tM,"mongoMigrateCreate");function tP(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eV.mongoMigrateUp()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tP,"mongoMigrateUp");function tA(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eV.mongoMigrateDown()];case 1:return[4,tb.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}I(tA,"mongoMigrateDown");(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,T.default)((0,k.hideBin)(C.default.argv)).scriptName(ej).usage("$0 <command> [options]").command("lint","Check code for linting issues",tk).command("lint:fix","Fix linting issues automatically",tT).command("lint:inspect","View active ESLint configuration",tC).command("lint-staged","Run lint checks on staged files",tO).command("commitlint","Validate commit message format",tG).command("setup","Initialize project setup and dependencies",tN).command("reset","Reset the project and reinstall dependencies",tR).command("inspect","Analyze installed project dependencies",tL).command("test:unit","Run unit test suite",tq).command("test:e2e","Run end-to-end test suite",tD).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){z.error("Migration name is required.");return[2]}return[4,tM(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tP).command("mongo:migrate:down","Rollback last MongoDB migration",tA).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(G.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();z.error("Fatal: ".concat(e.message)),C.default.exit(1);return[3,3];case 3:return[2]}})})()})();
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[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]&&(i=0)),i)try{if(n=1,r&&(s=c[0]&2?r["return"]:c[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;if(r=0,s)c=[c[0]&2,s.value];switch(c[0]){case 0:case 1:s=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;r=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){i.label=c[1];break}if(c[0]===6&&i.label<s[1]){i.label=s[1];s=c;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(c);break}if(s[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];r=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var y=Object.defineProperty;var v=function(e,t){return y(e,"name",{value:t,configurable:!0})};import h from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.125.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"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","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","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/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@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.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var I=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as w}from"node:child_process";import E from"node:process";import*as S from"node:util";var C=".cyberskill-storage";import O from"@dotenvx/dotenvx";import{bool as k,cleanEnv as T,str as G}from"envalid";import _ from"node:os";import N from"node:path";import R from"node:process";var L=!1;function D(){L||(O.config(),L=!0)}v(D,"loadEnvFile");function M(){D();var e=T(R.env,{CWD:G({default:R.cwd()}),DEBUG:k({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:G({default:N.join(_.homedir(),C)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}v(M,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});import P from"chalk";import q from"consola";import{GraphQLError as F}from"graphql";var U=M();U.DEBUG||(q.level=4);function B(e){var t=P[e];return typeof t=="function"?t:P.green}v(B,"chalkKeyword");var K={silent:q.silent,level:q.level,fatal:q.fatal,error:q.error,warn:q.warn,log:q.log,info:q.info,success:q.success,ready:q.ready,start:q.start,box:q.box,debug:q.debug,trace:q.trace,verbose:q.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)){q.box(P.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;q.log("".concat(P.gray("File:")," ").concat(P.blue("".concat(t).concat(r?":".concat(r):"")))),s&&q.log(" ".concat(B(n)("Rule:")," ").concat(s)),q.log(" ".concat(B(n)("Message:")," ").concat(i))}),q.box(B(n)("".concat(e," : ").concat(t.length))),q.log(P.gray("─".repeat(40)))}};var W={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import Y from"node-fetch";import H from"fs-extra";import J from"node:path";var $=M(),V=J;function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).resolve.apply(r,[$.CWD].concat(p(t)))}v(z,"resolveWorkingPath");function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).join.apply(r,p(t))}v(Q,"join");var X=M(),Z=X.CWD,ee="@cyberskill/shared",et="node_modules",en="dist",er="package.json",es="package-lock.json",ei="tsconfig.json",eo=".gitignore",ec=".simple-git-hooks.json",ea="pnpm-lock.yaml",eu=".git/hooks/",el=".git/COMMIT_EDITMSG",ed=".migrate-mongo.config.js",ep=Q(Z,et,ee,en),ef="cyberskill",eg="src/nodejs/cli/index.ts",em="eslint",ey="eslint",ev="vitest",eh="playwright",ex="vitest",ej="@commitlint/cli",eb="commitlint",eI="lint-staged",ew="lint-staged",eE="typescript",eS="tsc",eC="tsx",eO="git",ek="pnpm",eT="pnpm exec",eG="simple-git-hooks",e_="simple-git-hooks",eN="@eslint/config-inspector",eR="eslint-config-inspector",eL="node-modules-inspector",eD="node-modules-inspector",eM="migrate-mongo",eA="./node_modules/migrate-mongo/bin/migrate-mongo",eP={CYBERSKILL_DIRECTORY:ep,WORKING_DIRECTORY:Z,TS_CONFIG:z(ei),GIT_IGNORE:z(eo),GIT_HOOK:z(eu),GIT_COMMIT_MSG:z(el),SIMPLE_GIT_HOOKS_JSON:z(ec),PACKAGE_JSON:z(er),PACKAGE_LOCK_JSON:z(es),PNPM_LOCK_YAML:z(ea),NODE_MODULES:z(et),MIGRATE_MONGO_CONFIG:z(ed),LINT_STAGED_CONFIG:z("".concat(ep,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:z("".concat(ep,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:z("".concat(ep,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:z("".concat(ep,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:z("".concat(ep,"/react/vitest/vitest.e2e.js"))};function eq(e){var t=e.isCurrentProject;return l({"pre-commit":ew,"commit-msg":eb},t&&{"pre-push":tu("".concat(eO," pull"))})}v(eq,"createGitHooksConfig");function eF(e,t,n){return s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case I.CLI:return[3,1];case I.STRING:return[3,3]}return[3,4];case 1:return[4,e5(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),td(tu("".concat(eT," ").concat(n))))];case 3:return[2,td(tu(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}v(eF,"buildCommand");function eU(e,t,n){return function(){return s(function(){return m(this,function(r){return[2,eF(e,t,n)]})})()}}v(eU,"commandFactory");var eB={simpleGitHooks:eU(I.CLI,eG,e_),eslintInspect:eU(I.CLI,eN,eR),nodeModulesInspect:eU(I.CLI,eL,eD),eslintCheck:eU(I.CLI,em,"".concat(ey," ").concat(eP.WORKING_DIRECTORY," --no-cache")),eslintFix:eU(I.CLI,em,"".concat(ey," ").concat(eP.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:eU(I.CLI,eE,"".concat(eS," -p ").concat(eP.TS_CONFIG," --noEmit")),configureGitHook:eU(I.STRING,"".concat(eO," config core.hooksPath ").concat(eP.GIT_HOOK)),testUnit:eU(I.CLI,ev,"".concat(ex," --config ").concat(eP.UNIT_TEST_CONFIG)),testE2e:eU(I.CLI,"".concat(ev," ").concat(eh),"".concat(ex," --config ").concat(eP.E2E_TEST_CONFIG)),mongoMigrateCreate:v(function(e){return eU(I.CLI,eM,"".concat(eC," ").concat(eA," create ").concat(e," -f ").concat(eP.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:eU(I.CLI,eM,"".concat(eC," ").concat(eA," up -f ").concat(eP.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:eU(I.CLI,eM,"".concat(eC," ").concat(eA," down -f ").concat(eP.MIGRATE_MONGO_CONFIG)),commitLint:eU(I.CLI,ej,"".concat(eb," --edit ").concat(eP.GIT_COMMIT_MSG," --config ").concat(eP.COMMITLINT_CONFIG)),lintStaged:eU(I.CLI,eI,"".concat(ew," --config ").concat(eP.LINT_STAGED_CONFIG)),stageBuildDirectory:eU(I.STRING,"".concat(eO," add ").concat(en)),build:eU(I.STRING,"".concat(ek," run build")),pnpmInstallStandard:eU(I.STRING,"".concat(ek," install")),pnpmInstallLegacy:eU(I.STRING,"".concat(ek," install --legacy-peer-deps")),pnpmInstallForce:eU(I.STRING,"".concat(ek," install --force"))};var eK=H.lstatSync,eW=H.readdirSync,eY=H.mkdirSync,eH=H.readFileSync,eJ=H.unlinkSync,e$=H.statSync,eV=H.readJsonSync;function ez(e,t,n){H.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(ez,"writeFileSync");function eQ(e,t,n){H.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(eQ,"appendFileSync");function eX(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return H.pathExistsSync(e)})}v(eX,"pathExistsSync");function eZ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eX(e)&&H.removeSync(e)})}v(eZ,"removeSync");var e0=M();function e1(e){var t=Q(e0.CWD,er);if(!eX(t))return!1;try{var n=eV(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return K.warn("Failed to read package.json: ".concat(e.message)),!1}}v(e1,"getPackage");function e2(e){return s(function(){var t,n,r,s;return m(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,Y("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw K.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}v(e2,"getLatestPackageVersion");function e4(e,t){return s(function(){var n,r,s,i,o,c,a,u,d,p,f,g,y,v,h,x,j,b,I,w,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e1(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:{},y=(s=u.devDependencies)!==null&&s!==void 0?s:{},v=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=y[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];j=v;return[3,3];case 1:return[4,e2(e)];case 2:j=m.sent();m.label=3;case 3:h=j,x=d||v===h;if(!x&&(t===null||t===void 0?void 0:t.update)){;I=p?"dependencies":f?"devDependencies":null;I&&((b=u[I])===null||b===void 0?void 0:b[e])!==h&&(u[I]=(w=u[I])!==null&&w!==void 0?w:{},u[I][e]=h,ez(a,JSON.stringify(u,null,4)),K.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:E=m.sent();return[2,(K.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},W))];case 5:return[2]}})})()}v(e4,"checkPackage");function e3(){return s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:v(function(){return eB.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return eB.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(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]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,tf("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();K.warn("Installation attempt failed: ".concat(a)),K.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}v(e3,"installDependencies");function e5(e,t){return s(function(){var n,r,s,i,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!eX(eP.PACKAGE_JSON)){K.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 e4(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;i=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();m.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:i=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(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw K.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}v(e5,"setupPackages");import e8 from"node-persist";var e6=M();function e7(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=e8.defaultInstance;if(e)return[3,2];return[4,e8.init({dir:e6.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]}})})()}v(e7,"initNodePersist");var e9={get:function e(e){return s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e7()];case 1:r.sent();return[4,e8.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(K.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e7()];case 1:r.sent();return[4,e8.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();K.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e7()];case 1:n.sent();return[4,e8.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();K.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e7()];case 1:n.sent();return[4,e8.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(K.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(K.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return m(this,function(t){try{return[2,"".concat(e6.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(K.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var te=M(),tt=S.promisify(w);function tn(e){return"error_list:".concat(e)}v(tn,"getErrorListKey");function tr(e){return s(function(){var t,n,r;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tn(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,e9.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e9.getLogLink(n)];case 1:e=t.sent();e&&K.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();K.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}v(tr,"saveErrorListToStorage");function ts(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9.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 s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,e9.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(K.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}v(ts,"getStoredErrorLists");function ti(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9.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 e9.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();K.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}v(ti,"clearAllErrorLists");function to(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,a,u,l,d;var p=s.exec(e)||[],f=i.exec(e)||[],g=o.exec(e)||[];var m,y,v,h,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:(y=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&y!==void 0?y:""}):f.length?t.push({file:(v=f===null||f===void 0?void 0:f[1])!==null&&v!==void 0?v:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===A.Error?A.Error:A.Warning,message:(h=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):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&&tr(t),te.DEBUG&&n.length&&(K.warn("Unmatched lines:"),n.forEach(function(e){return K.info(" ".concat(e))}))}v(to,"parseTextErrors");function tc(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&tr(n)}catch(t){to(e)}}v(tc,"parseCommandOutput");function ta(e){return s(function(e){var t,n,r,s,i,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]:tc;n=new AbortController;E.on("SIGINT",function(){K.warn("Process interrupted. Terminating..."),n.abort(),E.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tt(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&K.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}v(ta,"executeCommand");function tu(e){return{raw:!0,cmd:e}}v(tu,"rawCommand");function tl(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eT," ").concat(ee," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eT," ").concat(eC," ").concat(eg," ").concat(e):"".concat(eT," ").concat(ef," ").concat(e)}v(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}v(td,"formatCommand");function tp(e){return s(function(e){var t,n,r,s,i,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,e4(ee)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,td(r,i)]}))]}})}).apply(this,arguments)}v(tp,"resolveCommands");function tf(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);K.start("".concat(e)),te.DEBUG&&K.info("→ ".concat(t));return[4,ta(t)];case 1:r.sent(),K.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw K.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}v(tf,"runCommand");function tg(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!eX(eP.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eB.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=K.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}v(tg,"checkTypescript");function tm(){return s(function(){var e,t,n,r;var s=arguments;return m(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eB.eslintFix()];case 1:return[4,tf.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eB.eslintCheck()];case 4:return[4,tf.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}v(tm,"checkEslint");function ty(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";K.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}v(ty,"printIssues");function tv(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,ts()];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?K.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(ty("Warnings",n),ty("Errors",t),(t.length>0||n.length>0)&&h.exit(1));return[2]}})})()}v(tv,"showCheckResult");function th(){return s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,ti()];case 1:o.sent();return[4,e4(ee)];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(ee)];return[4,eB.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eB.stageBuildDirectory()];case 6:return[4,tf.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw K.error("Error building and staging ".concat(ee,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eB.lintStaged()];case 10:return[4,tf.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tv();return[2]}})})()}v(th,"lintStaged");function tx(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tx,"inspectLint");function tj(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,ti()];case 1:e.sent();return[4,Promise.all([tg(),tm()])];case 2:e.sent(),tv();return[2]}})})()}v(tj,"lintCheck");function tb(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,ti()];case 1:e.sent();return[4,Promise.all([tg(),tm(!0)])];case 2:e.sent(),tv();return[2]}})})()}v(tb,"lintFix");function tI(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ti()];case 1:t.sent();e=["Validating commit message"];return[4,eB.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tv();return[2]}})})()}v(tI,"commitLint");function tw(){return s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eB.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eZ(eP.GIT_HOOK);return[4,tp(eq)];case 3:t=s.sent();ez(eP.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(ec,"\n");eX(eP.GIT_IGNORE)?eH(eP.GIT_IGNORE,"utf-8").split("\n").includes(ec)||eQ(eP.GIT_IGNORE,n):ez(eP.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eB.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}v(tw,"setupGitHook");function tE(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,e5([ee],{update:!0,postInstallActions:[tw]})];case 1:e.sent();return[2]}})})()}v(tE,"setup");function tS(){return s(function(){return m(this,function(e){switch(e.label){case 0:eZ(eP.NODE_MODULES,eP.PNPM_LOCK_YAML);return[4,e3()];case 1:e.sent();return[4,tw()];case 2:e.sent();return[2]}})})()}v(tS,"reset");function tC(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tC,"inspect");function tO(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tO,"testUnit");function tk(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tk,"testE2E");function tT(e){return s(function(){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,tf.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}v(tT,"mongoMigrateCreate");function tG(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tG,"mongoMigrateUp");function t_(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(t_,"mongoMigrateDown");(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(h.argv)).scriptName(ef).usage("$0 <command> [options]").command("lint","Check code for linting issues",tj).command("lint:fix","Fix linting issues automatically",tb).command("lint:inspect","View active ESLint configuration",tx).command("lint-staged","Run lint checks on staged files",th).command("commitlint","Validate commit message format",tI).command("setup","Initialize project setup and dependencies",tE).command("reset","Reset the project and reinstall dependencies",tS).command("inspect","Analyze installed project dependencies",tC).command("test:unit","Run unit test suite",tO).command("test:e2e","Run end-to-end test suite",tk).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){K.error("Migration name is required.");return[2]}return[4,tT(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tG).command("mongo:migrate:down","Rollback last MongoDB migration",t_).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();K.error("Fatal: ".concat(e.message)),h.exit(1);return[3,3];case 3:return[2]}})})()})();
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,s,i,o){try{var c=e[i](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,s)}}function s(e){return function(){var t=this,n=arguments;return new Promise(function(s,i){var o=e.apply(t,n);function c(e){r(o,s,i,c,a,"next",e)}function a(e){r(o,s,i,c,a,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var s=true;var i=false;var o,c;try{for(n=n.call(e);!(s=(o=n.next()).done);s=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!s&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function d(e,n){return t(e)||c(e,n)||g(e,n)||a()}function p(e){return n(e)||o(e)||g(e)||u()}function f(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function g(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function m(e,t){var n,r,s,i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[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]&&(i=0)),i)try{if(n=1,r&&(s=c[0]&2?r["return"]:c[0]?r["throw"]||((s=r["return"])&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;if(r=0,s)c=[c[0]&2,s.value];switch(c[0]){case 0:case 1:s=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;r=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){i.label=c[1];break}if(c[0]===6&&i.label<s[1]){i.label=s[1];s=c;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(c);break}if(s[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];r=0}finally{n=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var y=Object.defineProperty;var v=function(e,t){return y(e,"name",{value:t,configurable:!0})};import h from"node:process";import{hideBin as x}from"yargs/helpers";import j from"yargs/yargs";var b={name:"@cyberskill/shared",type:"module",version:"1.126.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/env":{types:"./dist/configs/env/index.d.ts",import:"./dist/configs/env/index.js",require:"./dist/configs/env/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:"tsup --watch",lint:"tsx src/nodejs/cli/index.ts lint","lint:fix":"tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"tsx src/nodejs/cli/index.ts lint:inspect",reset:"tsx src/nodejs/cli/index.ts reset",setup:"tsx src/nodejs/cli/index.ts setup",inspect:"tsx src/nodejs/cli/index.ts inspect","test:unit":"tsx src/nodejs/cli/index.ts test:unit","test:e2e":"tsx src/nodejs/cli/index.ts test:e2e",commitlint:"tsx src/nodejs/cli/index.ts commitlint","lint-staged":"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","@dotenvx/dotenvx":"1.41.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@nestjs/common":"11.1.0","@nestjs/core":"11.1.0","@next/eslint-plugin-next":"15.3.1","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.2","body-parser":"2.2.0",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.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.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.11.0","graphql-ws":"6.0.4",i18next:"25.0.2",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.14.1","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",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.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.3",vitest:"3.1.2","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/body-parser":"1.19.5","@types/compression":"1.7.5","@types/cookie-parser":"1.4.8","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node":"22.15.3","@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.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var I=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as w}from"node:child_process";import E from"node:process";import*as S from"node:util";var C=".cyberskill-storage";import O from"@dotenvx/dotenvx";import{bool as k,cleanEnv as T,str as G}from"envalid";import _ from"node:os";import N from"node:path";import R from"node:process";var L=!1;function D(){L||(O.config(),L=!0)}v(D,"loadEnvFile");function M(){D();var e=T(R.env,{CWD:G({default:R.cwd()}),DEBUG:k({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:G({default:N.join(_.homedir(),C)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}v(M,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});import P from"chalk";import q from"consola";import{GraphQLError as F}from"graphql";var U=M();U.DEBUG||(q.level=4);function B(e){var t=P[e];return typeof t=="function"?t:P.green}v(B,"chalkKeyword");var K={silent:q.silent,level:q.level,fatal:q.fatal,error:q.error,warn:q.warn,log:q.log,info:q.info,success:q.success,ready:q.ready,start:q.start,box:q.box,debug:q.debug,trace:q.trace,verbose:q.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)){q.box(P.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;q.log("".concat(P.gray("File:")," ").concat(P.blue("".concat(t).concat(r?":".concat(r):"")))),s&&q.log(" ".concat(B(n)("Rule:")," ").concat(s)),q.log(" ".concat(B(n)("Message:")," ").concat(i))}),q.box(B(n)("".concat(e," : ").concat(t.length))),q.log(P.gray("─".repeat(40)))}};var W={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import Y from"node-fetch";import H from"fs-extra";import J from"node:path";var $=M(),V=J;function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).resolve.apply(r,[$.CWD].concat(p(t)))}v(z,"resolveWorkingPath");function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).join.apply(r,p(t))}v(Q,"join");var X=M(),Z=X.CWD,ee="@cyberskill/shared",et="node_modules",en="dist",er="package.json",es="package-lock.json",ei="tsconfig.json",eo=".gitignore",ec=".simple-git-hooks.json",ea="pnpm-lock.yaml",eu=".git/hooks/",el=".git/COMMIT_EDITMSG",ed=".migrate-mongo.config.js",ep=Q(Z,et,ee,en),ef="cyberskill",eg="src/nodejs/cli/index.ts",em="eslint",ey="eslint",ev="vitest",eh="playwright",ex="vitest",ej="@commitlint/cli",eb="commitlint",eI="lint-staged",ew="lint-staged",eE="typescript",eS="tsc",eC="tsx",eO="git",ek="pnpm",eT="pnpm exec",eG="simple-git-hooks",e_="simple-git-hooks",eN="@eslint/config-inspector",eR="eslint-config-inspector",eL="node-modules-inspector",eD="node-modules-inspector",eM="migrate-mongo",eA="./node_modules/migrate-mongo/bin/migrate-mongo",eP={CYBERSKILL_DIRECTORY:ep,WORKING_DIRECTORY:Z,TS_CONFIG:z(ei),GIT_IGNORE:z(eo),GIT_HOOK:z(eu),GIT_COMMIT_MSG:z(el),SIMPLE_GIT_HOOKS_JSON:z(ec),PACKAGE_JSON:z(er),PACKAGE_LOCK_JSON:z(es),PNPM_LOCK_YAML:z(ea),NODE_MODULES:z(et),MIGRATE_MONGO_CONFIG:z(ed),LINT_STAGED_CONFIG:z("".concat(ep,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:z("".concat(ep,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:z("".concat(ep,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:z("".concat(ep,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:z("".concat(ep,"/react/vitest/vitest.e2e.js"))};function eq(e){var t=e.isCurrentProject;return l({"pre-commit":ew,"commit-msg":eb},t&&{"pre-push":tu("".concat(eO," pull"))})}v(eq,"createGitHooksConfig");function eF(e,t,n){return s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case I.CLI:return[3,1];case I.STRING:return[3,3]}return[3,4];case 1:return[4,e5(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),td(tu("".concat(eT," ").concat(n))))];case 3:return[2,td(tu(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}v(eF,"buildCommand");function eU(e,t,n){return function(){return s(function(){return m(this,function(r){return[2,eF(e,t,n)]})})()}}v(eU,"commandFactory");var eB={simpleGitHooks:eU(I.CLI,eG,e_),eslintInspect:eU(I.CLI,eN,eR),nodeModulesInspect:eU(I.CLI,eL,eD),eslintCheck:eU(I.CLI,em,"".concat(ey," ").concat(eP.WORKING_DIRECTORY," --no-cache")),eslintFix:eU(I.CLI,em,"".concat(ey," ").concat(eP.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:eU(I.CLI,eE,"".concat(eS," -p ").concat(eP.TS_CONFIG," --noEmit")),configureGitHook:eU(I.STRING,"".concat(eO," config core.hooksPath ").concat(eP.GIT_HOOK)),testUnit:eU(I.CLI,ev,"".concat(ex," --config ").concat(eP.UNIT_TEST_CONFIG)),testE2e:eU(I.CLI,"".concat(ev," ").concat(eh),"".concat(ex," --config ").concat(eP.E2E_TEST_CONFIG)),mongoMigrateCreate:v(function(e){return eU(I.CLI,eM,"".concat(eC," ").concat(eA," create ").concat(e," -f ").concat(eP.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:eU(I.CLI,eM,"".concat(eC," ").concat(eA," up -f ").concat(eP.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:eU(I.CLI,eM,"".concat(eC," ").concat(eA," down -f ").concat(eP.MIGRATE_MONGO_CONFIG)),commitLint:eU(I.CLI,ej,"".concat(eb," --edit ").concat(eP.GIT_COMMIT_MSG," --config ").concat(eP.COMMITLINT_CONFIG)),lintStaged:eU(I.CLI,eI,"".concat(ew," --config ").concat(eP.LINT_STAGED_CONFIG)),stageBuildDirectory:eU(I.STRING,"".concat(eO," add ").concat(en)),build:eU(I.STRING,"".concat(ek," run build")),pnpmInstallStandard:eU(I.STRING,"".concat(ek," install")),pnpmInstallLegacy:eU(I.STRING,"".concat(ek," install --legacy-peer-deps")),pnpmInstallForce:eU(I.STRING,"".concat(ek," install --force"))};var eK=H.lstatSync,eW=H.readdirSync,eY=H.mkdirSync,eH=H.readFileSync,eJ=H.unlinkSync,e$=H.statSync,eV=H.readJsonSync;function ez(e,t,n){H.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(ez,"writeFileSync");function eQ(e,t,n){H.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(eQ,"appendFileSync");function eX(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return H.pathExistsSync(e)})}v(eX,"pathExistsSync");function eZ(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){eX(e)&&H.removeSync(e)})}v(eZ,"removeSync");var e0=M();function e1(e){var t=Q(e0.CWD,er);if(!eX(t))return!1;try{var n=eV(t),r=n.name,s=n.dependencies,i=s===void 0?{}:s,o=n.devDependencies,c=o===void 0?{}:o,a=r===e,u=e in i,l=e in c;return a||u||l?{path:t,file:n,isCurrentProject:a,isDepend:u,isDevDepend:l}:!1}catch(e){return K.warn("Failed to read package.json: ".concat(e.message)),!1}}v(e1,"getPackage");function e2(e){return s(function(){var t,n,r,s;return m(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,Y("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw K.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}v(e2,"getLatestPackageVersion");function e4(e,t){return s(function(){var n,r,s,i,o,c,a,u,d,p,f,g,y,v,h,x,j,b,I,w,E;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e1(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:{},y=(s=u.devDependencies)!==null&&s!==void 0?s:{},v=d?(i=u.version)!==null&&i!==void 0?i:"0.0.0":p?(o=g[e])!==null&&o!==void 0?o:"0.0.0":f?(c=y[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];j=v;return[3,3];case 1:return[4,e2(e)];case 2:j=m.sent();m.label=3;case 3:h=j,x=d||v===h;if(!x&&(t===null||t===void 0?void 0:t.update)){;I=p?"dependencies":f?"devDependencies":null;I&&((b=u[I])===null||b===void 0?void 0:b[e])!==h&&(u[I]=(w=u[I])!==null&&w!==void 0?w:{},u[I][e]=h,ez(a,JSON.stringify(u,null,4)),K.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:x}];case 4:E=m.sent();return[2,(K.error('Error checking package "'.concat(e,'": ').concat(E.message)),l({},W))];case 5:return[2]}})})()}v(e4,"checkPackage");function e3(){return s(function(){var e,t,n,r,s,i,o,c,a,u,l,d;return m(this,function(p){switch(p.label){case 0:e=[{command:v(function(){return eB.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return eB.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(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]);s=e[Symbol.iterator]();p.label=2;case 2:if(!!(t=(i=s.next()).done))return[3,8];o=i.value,c=o.command,a=o.message;p.label=3;case 3:p.trys.push([3,6,,7]);return[4,c()];case 4:u=p.sent();return[4,tf("".concat(a," using: ").concat(u),u)];case 5:p.sent();return[2];case 6:l=p.sent();K.warn("Installation attempt failed: ".concat(a)),K.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}v(e3,"installDependencies");function e5(e,t){return s(function(){var n,r,s,i,o,c,a,u,d,f,g;return m(this,function(m){switch(m.label){case 0:if(!eX(eP.PACKAGE_JSON)){K.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 e4(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;i=true,o=false,c=undefined;m.label=5;case 5:m.trys.push([5,10,11,12]);a=((s=t===null||t===void 0?void 0:t.postInstallActions)!==null&&s!==void 0?s:[])[Symbol.iterator]();m.label=6;case 6:if(!!(i=(u=a.next()).done))return[3,9];d=u.value;return[4,d()];case 7:m.sent();m.label=8;case 8:i=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(!i&&a.return!=null){a.return()}}finally{if(o){throw c}}return[7];case 12:return[3,14];case 13:g=m.sent();throw K.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}v(e5,"setupPackages");import e8 from"node-persist";var e6=M();function e7(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=e8.defaultInstance;if(e)return[3,2];return[4,e8.init({dir:e6.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]}})})()}v(e7,"initNodePersist");var e9={get:function e(e){return s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e7()];case 1:r.sent();return[4,e8.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(K.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e7()];case 1:r.sent();return[4,e8.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();K.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e7()];case 1:n.sent();return[4,e8.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();K.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,e7()];case 1:n.sent();return[4,e8.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(K.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(K.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return s(function(){return m(this,function(t){try{return[2,"".concat(e6.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(K.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var te=M(),tt=S.promisify(w);function tn(e){return"error_list:".concat(e)}v(tn,"getErrorListKey");function tr(e){return s(function(){var t,n,r;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=tn(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,e9.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,e9.getLogLink(n)];case 1:e=t.sent();e&&K.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();K.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}v(tr,"saveErrorListToStorage");function ts(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9.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 s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,e9.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})})()}))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(K.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}v(ts,"getStoredErrorLists");function ti(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e9.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 e9.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();K.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}v(ti,"clearAllErrorLists");function to(e){var t=[],n=[],r="",s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,a,u,l,d;var p=s.exec(e)||[],f=i.exec(e)||[],g=o.exec(e)||[];var m,y,v,h,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:(y=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&y!==void 0?y:""}):f.length?t.push({file:(v=f===null||f===void 0?void 0:f[1])!==null&&v!==void 0?v:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===A.Error?A.Error:A.Warning,message:(h=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):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&&tr(t),te.DEBUG&&n.length&&(K.warn("Unmatched lines:"),n.forEach(function(e){return K.info(" ".concat(e))}))}v(to,"parseTextErrors");function tc(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&tr(n)}catch(t){to(e)}}v(tc,"parseCommandOutput");function ta(e){return s(function(e){var t,n,r,s,i,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]:tc;n=new AbortController;E.on("SIGINT",function(){K.warn("Process interrupted. Terminating..."),n.abort(),E.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,tt(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),s=r.stdout,i=r.stderr;[s,i].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&K.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}v(ta,"executeCommand");function tu(e){return{raw:!0,cmd:e}}v(tu,"rawCommand");function tl(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eT," ").concat(ee," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eT," ").concat(eC," ").concat(eg," ").concat(e):"".concat(eT," ").concat(ef," ").concat(e)}v(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}v(td,"formatCommand");function tp(e){return s(function(e){var t,n,r,s,i,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,e4(ee)];case 2:c=u.sent().isCurrentProject;u.label=3;case 3:s=c,i={isRemote:r,isCurrentProject:s},o=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,td(r,i)]}))]}})}).apply(this,arguments)}v(tp,"resolveCommands");function tf(e,t){return s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);K.start("".concat(e)),te.DEBUG&&K.info("→ ".concat(t));return[4,ta(t)];case 1:r.sent(),K.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw K.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}v(tf,"runCommand");function tg(){return s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!eX(eP.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eB.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=K.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}v(tg,"checkTypescript");function tm(){return s(function(){var e,t,n,r;var s=arguments;return m(this,function(i){switch(i.label){case 0:e=s.length>0&&s[0]!==void 0?s[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,eB.eslintFix()];case 1:return[4,tf.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,eB.eslintCheck()];case 4:return[4,tf.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}v(tm,"checkEslint");function ty(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";K.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}v(ty,"printIssues");function tv(){return s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,ts()];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?K.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(ty("Warnings",n),ty("Errors",t),(t.length>0||n.length>0)&&h.exit(1));return[2]}})})()}v(tv,"showCheckResult");function th(){return s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,ti()];case 1:o.sent();return[4,e4(ee)];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(ee)];return[4,eB.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eB.stageBuildDirectory()];case 6:return[4,tf.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw K.error("Error building and staging ".concat(ee,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eB.lintStaged()];case 10:return[4,tf.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tv();return[2]}})})()}v(th,"lintStaged");function tx(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tx,"inspectLint");function tj(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,ti()];case 1:e.sent();return[4,Promise.all([tg(),tm()])];case 2:e.sent(),tv();return[2]}})})()}v(tj,"lintCheck");function tb(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,ti()];case 1:e.sent();return[4,Promise.all([tg(),tm(!0)])];case 2:e.sent(),tv();return[2]}})})()}v(tb,"lintFix");function tI(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ti()];case 1:t.sent();e=["Validating commit message"];return[4,eB.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tv();return[2]}})})()}v(tI,"commitLint");function tw(){return s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eB.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eZ(eP.GIT_HOOK);return[4,tp(eq)];case 3:t=s.sent();ez(eP.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(ec,"\n");eX(eP.GIT_IGNORE)?eH(eP.GIT_IGNORE,"utf-8").split("\n").includes(ec)||eQ(eP.GIT_IGNORE,n):ez(eP.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,eB.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}v(tw,"setupGitHook");function tE(){return s(function(){return m(this,function(e){switch(e.label){case 0:return[4,e5([ee],{update:!0,postInstallActions:[tw]})];case 1:e.sent();return[2]}})})()}v(tE,"setup");function tS(){return s(function(){return m(this,function(e){switch(e.label){case 0:eZ(eP.NODE_MODULES,eP.PNPM_LOCK_YAML);return[4,e3()];case 1:e.sent();return[4,tw()];case 2:e.sent();return[2]}})})()}v(tS,"reset");function tC(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tC,"inspect");function tO(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tO,"testUnit");function tk(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tk,"testE2E");function tT(e){return s(function(){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,tf.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}v(tT,"mongoMigrateCreate");function tG(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(tG,"mongoMigrateUp");function t_(){return s(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,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}v(t_,"mongoMigrateDown");(function(){return s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,j(x(h.argv)).scriptName(ef).usage("$0 <command> [options]").command("lint","Check code for linting issues",tj).command("lint:fix","Fix linting issues automatically",tb).command("lint:inspect","View active ESLint configuration",tx).command("lint-staged","Run lint checks on staged files",th).command("commitlint","Validate commit message format",tI).command("setup","Initialize project setup and dependencies",tE).command("reset","Reset the project and reinstall dependencies",tS).command("inspect","Analyze installed project dependencies",tC).command("test:unit","Run unit test suite",tO).command("test:e2e","Run end-to-end test suite",tk).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){K.error("Migration name is required.");return[2]}return[4,tT(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tG).command("mongo:migrate:down","Rollback last MongoDB migration",t_).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();K.error("Fatal: ".concat(e.message)),h.exit(1);return[3,3];case 3:return[2]}})})()})();