@cyberskill/shared 1.111.0 → 1.112.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,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "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 _=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var b=function(e,t){return y(e,"name",{value:t,configurable:!0})};var E=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;!j.call(e,s)&&s!==n&&y(e,s,{get:function(){return t[s]},enumerable:!(r=h(t,s))||r.enumerable})};for(var c=_(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 I=function(e,t,n){return n=e!=null?v(x(e)):{},E(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)};var w=I(require("process"),1),S=require("yargs/helpers"),R=I(require("yargs/yargs"),1);var O={name:"@cyberskill/shared",type:"module",version:"1.110.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@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",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.1",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.0","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",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var C=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var P=require("child_process"),T=I(require("process"),1),k=I(require("util"),1);var G=".cyberskill-storage";var U=I(require("dotenv"),1),N=require("envalid"),L=I(require("os"),1),q=I(require("path"),1),D=I(require("process"),1);U.default.config();function M(){var e={DEBUG:D.default.env.DEBUG||!1,CWD:D.default.env.CWD||D.default.cwd(),CYBERSKILL_STORAGE_DIRECTORY:D.default.env.CYBERSKILL_STORAGE_DIRECTORY||q.default.join(L.default.homedir(),G)};return(0,N.cleanEnv)(e,{DEBUG:(0,N.bool)(),CWD:(0,N.str)(),CYBERSKILL_STORAGE_DIRECTORY:(0,N.str)()})}b(M,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});var F=I(require("chalk"),1),B=I(require("consola"),1),K=require("graphql");var W=M();W.DEBUG||(B.default.level=4);function Y(e){var t=F.default[e];return typeof t=="function"?t:F.default.green}b(Y,"chalkKeyword");var H={silent:B.default.silent,level:B.default.level,fatal:B.default.fatal,error:B.default.error,warn:B.default.warn,log:B.default.log,info:B.default.info,success:B.default.success,ready:B.default.ready,start:B.default.start,box:B.default.box,debug:B.default.debug,trace:B.default.trace,verbose:B.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)){B.default.box(F.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;B.default.log("".concat(F.default.gray("File:")," ").concat(F.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&B.default.log(" ".concat(Y(n)("Rule:")," ").concat(s)),B.default.log(" ".concat(Y(n)("Message:")," ").concat(i))}),B.default.box(Y(n)("".concat(e," : ").concat(t.length))),B.default.log(F.default.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var $=I(require("node-fetch"),1);var V=I(require("fs-extra"),1),z=require("path");var Q=V.default,X=Q.lstatSync,Z=Q.readdirSync,ee=Q.mkdirSync,et=Q.readFileSync,en=Q.writeFileSync,er=Q.appendFileSync,es=Q.unlinkSync,ei=Q.statSync,eo=V.default.readJsonSync,ea=V.default.writeJsonSync;function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return V.default.pathExistsSync(e)})}b(ec,"pathExistsSync");function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){ec(e)&&V.default.removeSync(e)})}b(eu,"removeSync");var el=I(require("path"),1);var ed=M();function ef(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,el.resolve).apply(this,[ed.CWD].concat(f(t)))}b(ef,"resolveWorkingPath");function ep(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,el.join).apply(this,f(t))}b(ep,"join");var eg=M(),em=eg.CWD,ev="@cyberskill/shared",ey="node_modules",eh="dist",e_="package.json",ex="package-lock.json",ej="tsconfig.json",eb=".gitignore",eE=".simple-git-hooks.json",eI="pnpm-lock.yaml",ew=".git/hooks/",eS=".git/COMMIT_EDITMSG",eR=".migrate-mongo.config.js",eO=ep(em,ey,ev,eh),eC="cyberskill",eP="src/nodejs/cli/index.ts",eT="eslint",ek="eslint",eG="vitest",eU="playwright",eN="vitest",eL="@commitlint/cli",eq="commitlint",eD="lint-staged",eM="lint-staged",eA="typescript",eF="tsc",eB="tsx",eK="git",eW="pnpm",eY="pnpm exec",eH="simple-git-hooks",eJ="simple-git-hooks",e$="@eslint/config-inspector",eV="eslint-config-inspector",ez="node-modules-inspector",eQ="node-modules-inspector",eX="migrate-mongo",eZ="./node_modules/migrate-mongo/bin/migrate-mongo",e0={CYBERSKILL_DIRECTORY:eO,WORKING_DIRECTORY:em,TS_CONFIG:ef(ej),GIT_IGNORE:ef(eb),GIT_HOOK:ef(ew),GIT_COMMIT_MSG:ef(eS),SIMPLE_GIT_HOOKS_JSON:ef(eE),PACKAGE_JSON:ef(e_),PACKAGE_LOCK_JSON:ef(ex),PNPM_LOCK_YAML:ef(eI),NODE_MODULES:ef(ey),MIGRATE_MONGO_CONFIG:ef(eR),LINT_STAGED_CONFIG:ef("".concat(eO,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ef("".concat(eO,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ef("".concat(eO,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ef("".concat(eO,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ef("".concat(eO,"/react/vitest/vitest.e2e.js"))};function e1(e){var t=e.isCurrentProject;return l({"pre-commit":eM,"commit-msg":eq},t&&{"pre-push":tg("".concat(eK," pull"))})}b(e1,"createGitHooksConfig");function e2(e,t,n){return /*#__PURE__*/s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case C.CLI:return[3,1];case C.STRING:return[3,3]}return[3,4];case 1:return[4,te(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tv(tg("".concat(eY," ").concat(n))))];case 3:return[2,tv(tg(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}b(e2,"buildCommand");function e4(e,t,n){return function(){return /*#__PURE__*/s(function(){return m(this,function(r){return[2,e2(e,t,n)]})})()}}b(e4,"commandFactory");var e3={simpleGitHooks:e4(C.CLI,eH,eJ),eslintInspect:e4(C.CLI,e$,eV),nodeModulesInspect:e4(C.CLI,ez,eQ),eslintCheck:e4(C.CLI,eT,"".concat(ek," ").concat(e0.WORKING_DIRECTORY)),eslintFix:e4(C.CLI,eT,"".concat(ek," ").concat(e0.WORKING_DIRECTORY," --fix")),typescriptCheck:e4(C.CLI,eA,"".concat(eF," -p ").concat(e0.TS_CONFIG," --noEmit")),configureGitHook:e4(C.STRING,"".concat(eK," config core.hooksPath ").concat(e0.GIT_HOOK)),testUnit:e4(C.CLI,eG,"".concat(eN," --config ").concat(e0.UNIT_TEST_CONFIG)),testE2e:e4(C.CLI,"".concat(eG," ").concat(eU),"".concat(eN," --config ").concat(e0.E2E_TEST_CONFIG)),mongoMigrateCreate:b(function(e){return e4(C.CLI,eX,"".concat(eB," ").concat(eZ," create ").concat(e," -f ").concat(e0.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:e4(C.CLI,eX,"".concat(eB," ").concat(eZ," up -f ").concat(e0.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:e4(C.CLI,eX,"".concat(eB," ").concat(eZ," down -f ").concat(e0.MIGRATE_MONGO_CONFIG)),commitLint:e4(C.CLI,eL,"".concat(eq," --edit ").concat(e0.GIT_COMMIT_MSG," --config ").concat(e0.COMMITLINT_CONFIG)),lintStaged:e4(C.CLI,eD,"".concat(eM," --config ").concat(e0.LINT_STAGED_CONFIG)),stageBuildDirectory:e4(C.STRING,"".concat(eK," add ").concat(eh)),build:e4(C.STRING,"".concat(eW," run build")),pnpmInstallStandard:e4(C.STRING,"".concat(eW," install")),pnpmInstallLegacy:e4(C.STRING,"".concat(eW," install --legacy-peer-deps")),pnpmInstallForce:e4(C.STRING,"".concat(eW," install --force"))};var e5=M();function e8(e){var t=ep(e5.CWD,e_);if(!ec(t))return!1;try{var n=eo(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 H.warn("Failed to read package.json: ".concat(e.message)),!1}}b(e8,"getPackage");function e6(e){return /*#__PURE__*/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,$.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 H.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}b(e6,"getLatestPackageVersion");function e7(e,t){return /*#__PURE__*/s(function(){var n,r,s,i,o,a,c,u,d,f,p,g,v,y,h,_,x,j,b,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e8(e);if(!n)return[2,l({},J)];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];x=y;return[3,3];case 1:return[4,e6(e)];case 2:x=m.sent();m.label=3;case 3:h=x,_=d||y===h;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=f?"dependencies":p?"devDependencies":null;b&&((j=u[b])===null||j===void 0?void 0:j[e])!==h&&(u[b]=(E=u[b])!==null&&E!==void 0?E:{},u[b][e]=h,ea(c,u),H.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:_}];case 4:I=m.sent();return[2,(H.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},J))];case 5:return[2]}})})()}b(e7,"checkPackage");function e9(){return /*#__PURE__*/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:b(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:b(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:b(function(){return e3.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,th("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();H.warn("Installation attempt failed: ".concat(c)),H.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.")}})})()}b(e9,"installDependencies");function te(e,t){return /*#__PURE__*/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(!ec(e0.PACKAGE_JSON)){H.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 e7(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,e9()];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 H.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}b(te,"setupPackages");var tt=I(require("node-persist"),1);var tn=M();function tr(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=tt.default.defaultInstance;if(e)return[3,2];return[4,tt.default.init({dir:tn.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]}})})()}b(tr,"initNodePersist");var ts={get:function e(e){return /*#__PURE__*/s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(H.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();H.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();H.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(H.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/s(function(){return m(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(H.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ti=M(),to=k.promisify(P.exec);function ta(e){return"error_list:".concat(e)}b(ta,"getErrorListKey");function tc(e){return /*#__PURE__*/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=ta(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,ts.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ts.getLogLink(n)];case 1:e=t.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();H.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}b(tc,"saveErrorListToStorage");function tu(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ts.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 /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,ts.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,(H.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}b(tu,"getStoredErrorLists");function tl(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ts.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 ts.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();H.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}b(tl,"clearAllErrorLists");function td(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;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===A.Error?A.Error:A.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]===A.Error?A.Error:A.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:A.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&tc(t),ti.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}b(td,"parseTextErrors");function tf(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tc(n)}catch(t){td(e)}}b(tf,"parseCommandOutput");function tp(e){return /*#__PURE__*/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]:tf;n=new AbortController;T.default.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),T.default.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,to(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&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}b(tp,"executeCommand");function tg(e){return{raw:!0,cmd:e}}b(tg,"rawCommand");function tm(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eY," ").concat(ev," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eY," ").concat(eB," ").concat(eP," ").concat(e):"".concat(eY," ").concat(eC," ").concat(e)}b(tm,"formatCLI");function tv(e,t){return typeof e=="function"?tm(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"?tm(e,t):e}b(tv,"formatCommand");function ty(e){return /*#__PURE__*/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,e7(ev)];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,tv(r,i)]}))]}})}).apply(this,arguments)}b(ty,"resolveCommands");function th(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),ti.DEBUG&&H.info("→ ".concat(t));return[4,tp(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw H.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}b(th,"runCommand");function t_(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!ec(e0.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e3.typescriptCheck()];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=H.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}b(t_,"checkTypescript");function tx(){return /*#__PURE__*/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,e3.eslintFix()];case 1:return[4,th.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e3.eslintCheck()];case 4:return[4,th.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}b(tx,"checkEslint");function tj(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";H.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}b(tj,"printIssues");function tb(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tu()];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?H.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tj("Warnings",n),tj("Errors",t),(t.length>0||n.length>0)&&w.default.exit(1));return[2]}})})()}b(tb,"showCheckResult");function tE(){return /*#__PURE__*/s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,tl()];case 1:o.sent();return[4,e7(ev)];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(ev)];return[4,e3.build()];case 4:return[4,th.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,e3.stageBuildDirectory()];case 6:return[4,th.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw H.error("Error building and staging ".concat(ev,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,e3.lintStaged()];case 10:return[4,th.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tb();return[2]}})})()}b(tE,"lintStaged");function tI(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e3.eslintInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tI,"inspectLint");function tw(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([t_(),tx()])];case 2:e.sent(),tb();return[2]}})})()}b(tw,"lintCheck");function tS(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([t_(),tx(!0)])];case 2:e.sent(),tb();return[2]}})})()}b(tS,"lintFix");function tR(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tl()];case 1:t.sent();e=["Validating commit message"];return[4,e3.commitLint()];case 2:return[4,th.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tb();return[2]}})})()}b(tR,"commitLint");function tO(){return /*#__PURE__*/s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,e3.configureGitHook()];case 1:return[4,th.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eu(e0.GIT_HOOK);return[4,ty(e1)];case 3:t=s.sent();ea(e0.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(eE,"\n");ec(e0.GIT_IGNORE)?et(e0.GIT_IGNORE,"utf-8").split("\n").includes(eE)||er(e0.GIT_IGNORE,n,"utf-8"):en(e0.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,e3.simpleGitHooks()];case 4:return[4,th.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}b(tO,"setupGitHook");function tC(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,te([ev],{update:!0,postInstallActions:[tO]})];case 1:e.sent();return[2]}})})()}b(tC,"setup");function tP(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:eu(e0.NODE_MODULES,e0.PNPM_LOCK_YAML);return[4,e9()];case 1:e.sent();return[4,tO()];case 2:e.sent();return[2]}})})()}b(tP,"reset");function tT(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e3.nodeModulesInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tT,"inspect");function tk(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e3.testUnit()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tk,"testUnit");function tG(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e3.testE2e()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tG,"testE2E");function tU(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,e3.mongoMigrateCreate(e)];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}b(tU,"mongoMigrateCreate");function tN(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,e3.mongoMigrateUp()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tN,"mongoMigrateUp");function tL(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,e3.mongoMigrateDown()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tL,"mongoMigrateDown");(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,R.default)((0,S.hideBin)(w.default.argv)).scriptName(eC).usage("$0 <command> [options]").command("lint","Check code for linting issues",tw).command("lint:fix","Fix linting issues automatically",tS).command("lint:inspect","View active ESLint configuration",tI).command("lint-staged","Run lint checks on staged files",tE).command("commitlint","Validate commit message format",tR).command("setup","Initialize project setup and dependencies",tC).command("reset","Reset the project and reinstall dependencies",tP).command("inspect","Analyze installed project dependencies",tT).command("test:unit","Run unit test suite",tk).command("test:e2e","Run end-to-end test suite",tG).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){H.error("Migration name is required.");return[2]}return[4,tU(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tN).command("mongo:migrate:down","Rollback last MongoDB migration",tL).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(O.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();H.error("Fatal: ".concat(e.message)),w.default.exit(1);return[3,3];case 3:return[2]}})})()})();
2
+ "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 _=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var b=function(e,t){return y(e,"name",{value:t,configurable:!0})};var E=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;!j.call(e,s)&&s!==n&&y(e,s,{get:function(){return t[s]},enumerable:!(r=h(t,s))||r.enumerable})};for(var c=_(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 I=function(e,t,n){return n=e!=null?v(x(e)):{},E(t||!e||!e.__esModule?y(n,"default",{value:e,enumerable:!0}):n,e)};var w=I(require("process"),1),S=require("yargs/helpers"),R=I(require("yargs/yargs"),1);var O={name:"@cyberskill/shared",type:"module",version:"1.111.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@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",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.1",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.0","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",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var C=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var P=require("child_process"),T=I(require("process"),1),k=I(require("util"),1);var G=".cyberskill-storage";var U=I(require("dotenv"),1),N=require("envalid"),L=I(require("os"),1),q=I(require("path"),1),D=I(require("process"),1);U.default.config();function M(){var e={DEBUG:D.default.env.DEBUG||!1,CWD:D.default.env.CWD||D.default.cwd(),CYBERSKILL_STORAGE_DIRECTORY:D.default.env.CYBERSKILL_STORAGE_DIRECTORY||q.default.join(L.default.homedir(),G)};return(0,N.cleanEnv)(e,{DEBUG:(0,N.bool)(),CWD:(0,N.str)(),CYBERSKILL_STORAGE_DIRECTORY:(0,N.str)()})}b(M,"getEnv");var A=function(e){return e.Error="error",e.Warning="warning",e}({});var F=I(require("chalk"),1),B=I(require("consola"),1),K=require("graphql");var W=M();W.DEBUG||(B.default.level=4);function Y(e){var t=F.default[e];return typeof t=="function"?t:F.default.green}b(Y,"chalkKeyword");var H={silent:B.default.silent,level:B.default.level,fatal:B.default.fatal,error:B.default.error,warn:B.default.warn,log:B.default.log,info:B.default.info,success:B.default.success,ready:B.default.ready,start:B.default.start,box:B.default.box,debug:B.default.debug,trace:B.default.trace,verbose:B.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)){B.default.box(F.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;B.default.log("".concat(F.default.gray("File:")," ").concat(F.default.blue("".concat(t).concat(r?":".concat(r):"")))),s&&B.default.log(" ".concat(Y(n)("Rule:")," ").concat(s)),B.default.log(" ".concat(Y(n)("Message:")," ").concat(i))}),B.default.box(Y(n)("".concat(e," : ").concat(t.length))),B.default.log(F.default.gray("─".repeat(40)))}};var J={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};var $=I(require("node-fetch"),1);var V=I(require("fs-extra"),1),z=require("path");var Q=V.default,X=Q.lstatSync,Z=Q.readdirSync,ee=Q.mkdirSync,et=Q.readFileSync,en=Q.writeFileSync,er=Q.appendFileSync,es=Q.unlinkSync,ei=Q.statSync,eo=V.default.readJsonSync,ea=V.default.writeJsonSync;function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return V.default.pathExistsSync(e)})}b(ec,"pathExistsSync");function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){ec(e)&&V.default.removeSync(e)})}b(eu,"removeSync");var el=I(require("path"),1);var ed=M();function ef(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,el.resolve).apply(this,[ed.CWD].concat(f(t)))}b(ef,"resolveWorkingPath");function ep(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return(0,el.join).apply(this,f(t))}b(ep,"join");var eg=M(),em=eg.CWD,ev="@cyberskill/shared",ey="node_modules",eh="dist",e_="package.json",ex="package-lock.json",ej="tsconfig.json",eb=".gitignore",eE=".simple-git-hooks.json",eI="pnpm-lock.yaml",ew=".git/hooks/",eS=".git/COMMIT_EDITMSG",eR=".migrate-mongo.config.js",eO=ep(em,ey,ev,eh),eC="cyberskill",eP="src/nodejs/cli/index.ts",eT="eslint",ek="eslint",eG="vitest",eU="playwright",eN="vitest",eL="@commitlint/cli",eq="commitlint",eD="lint-staged",eM="lint-staged",eA="typescript",eF="tsc",eB="tsx",eK="git",eW="pnpm",eY="pnpm exec",eH="simple-git-hooks",eJ="simple-git-hooks",e$="@eslint/config-inspector",eV="eslint-config-inspector",ez="node-modules-inspector",eQ="node-modules-inspector",eX="migrate-mongo",eZ="./node_modules/migrate-mongo/bin/migrate-mongo",e0={CYBERSKILL_DIRECTORY:eO,WORKING_DIRECTORY:em,TS_CONFIG:ef(ej),GIT_IGNORE:ef(eb),GIT_HOOK:ef(ew),GIT_COMMIT_MSG:ef(eS),SIMPLE_GIT_HOOKS_JSON:ef(eE),PACKAGE_JSON:ef(e_),PACKAGE_LOCK_JSON:ef(ex),PNPM_LOCK_YAML:ef(eI),NODE_MODULES:ef(ey),MIGRATE_MONGO_CONFIG:ef(eR),LINT_STAGED_CONFIG:ef("".concat(eO,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ef("".concat(eO,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ef("".concat(eO,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ef("".concat(eO,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ef("".concat(eO,"/react/vitest/vitest.e2e.js"))};function e1(e){var t=e.isCurrentProject;return l({"pre-commit":eM,"commit-msg":eq},t&&{"pre-push":tg("".concat(eK," pull"))})}b(e1,"createGitHooksConfig");function e2(e,t,n){return /*#__PURE__*/s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case C.CLI:return[3,1];case C.STRING:return[3,3]}return[3,4];case 1:return[4,te(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),tv(tg("".concat(eY," ").concat(n))))];case 3:return[2,tv(tg(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}b(e2,"buildCommand");function e4(e,t,n){return function(){return /*#__PURE__*/s(function(){return m(this,function(r){return[2,e2(e,t,n)]})})()}}b(e4,"commandFactory");var e3={simpleGitHooks:e4(C.CLI,eH,eJ),eslintInspect:e4(C.CLI,e$,eV),nodeModulesInspect:e4(C.CLI,ez,eQ),eslintCheck:e4(C.CLI,eT,"".concat(ek," ").concat(e0.WORKING_DIRECTORY)),eslintFix:e4(C.CLI,eT,"".concat(ek," ").concat(e0.WORKING_DIRECTORY," --fix")),typescriptCheck:e4(C.CLI,eA,"".concat(eF," -p ").concat(e0.TS_CONFIG," --noEmit")),configureGitHook:e4(C.STRING,"".concat(eK," config core.hooksPath ").concat(e0.GIT_HOOK)),testUnit:e4(C.CLI,eG,"".concat(eN," --config ").concat(e0.UNIT_TEST_CONFIG)),testE2e:e4(C.CLI,"".concat(eG," ").concat(eU),"".concat(eN," --config ").concat(e0.E2E_TEST_CONFIG)),mongoMigrateCreate:b(function(e){return e4(C.CLI,eX,"".concat(eB," ").concat(eZ," create ").concat(e," -f ").concat(e0.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:e4(C.CLI,eX,"".concat(eB," ").concat(eZ," up -f ").concat(e0.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:e4(C.CLI,eX,"".concat(eB," ").concat(eZ," down -f ").concat(e0.MIGRATE_MONGO_CONFIG)),commitLint:e4(C.CLI,eL,"".concat(eq," --edit ").concat(e0.GIT_COMMIT_MSG," --config ").concat(e0.COMMITLINT_CONFIG)),lintStaged:e4(C.CLI,eD,"".concat(eM," --config ").concat(e0.LINT_STAGED_CONFIG)),stageBuildDirectory:e4(C.STRING,"".concat(eK," add ").concat(eh)),build:e4(C.STRING,"".concat(eW," run build")),pnpmInstallStandard:e4(C.STRING,"".concat(eW," install")),pnpmInstallLegacy:e4(C.STRING,"".concat(eW," install --legacy-peer-deps")),pnpmInstallForce:e4(C.STRING,"".concat(eW," install --force"))};var e5=M();function e8(e){var t=ep(e5.CWD,e_);if(!ec(t))return!1;try{var n=eo(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 H.warn("Failed to read package.json: ".concat(e.message)),!1}}b(e8,"getPackage");function e6(e){return /*#__PURE__*/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,$.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 H.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}b(e6,"getLatestPackageVersion");function e7(e,t){return /*#__PURE__*/s(function(){var n,r,s,i,o,a,c,u,d,f,p,g,v,y,h,_,x,j,b,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e8(e);if(!n)return[2,l({},J)];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];x=y;return[3,3];case 1:return[4,e6(e)];case 2:x=m.sent();m.label=3;case 3:h=x,_=d||y===h;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=f?"dependencies":p?"devDependencies":null;b&&((j=u[b])===null||j===void 0?void 0:j[e])!==h&&(u[b]=(E=u[b])!==null&&E!==void 0?E:{},u[b][e]=h,ea(c,u),H.info('Updated "'.concat(e,'" to version ').concat(h)))}return[2,{isCurrentProject:d,installedPath:c,file:u,isUpToDate:_}];case 4:I=m.sent();return[2,(H.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},J))];case 5:return[2]}})})()}b(e7,"checkPackage");function e9(){return /*#__PURE__*/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:b(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:b(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:b(function(){return e3.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,th("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();H.warn("Installation attempt failed: ".concat(c)),H.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.")}})})()}b(e9,"installDependencies");function te(e,t){return /*#__PURE__*/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(!ec(e0.PACKAGE_JSON)){H.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 e7(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,e9()];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 H.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}b(te,"setupPackages");var tt=I(require("node-persist"),1);var tn=M();function tr(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=tt.default.defaultInstance;if(e)return[3,2];return[4,tt.default.init({dir:tn.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]}})})()}b(tr,"initNodePersist");var ts={get:function e(e){return /*#__PURE__*/s(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(H.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();H.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();H.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(H.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/s(function(){return m(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(H.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ti=M(),to=k.promisify(P.exec);function ta(e){return"error_list:".concat(e)}b(ta,"getErrorListKey");function tc(e){return /*#__PURE__*/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=ta(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,ts.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,ts.getLogLink(n)];case 1:e=t.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();H.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}b(tc,"saveErrorListToStorage");function tu(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ts.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 /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:return[4,ts.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,(H.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}b(tu,"getStoredErrorLists");function tl(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ts.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 ts.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();H.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}b(tl,"clearAllErrorLists");function td(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;f.length&&r?t.push({file:r,position:"".concat(f[1],":").concat(f[2]),type:f[3]===A.Error?A.Error:A.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]===A.Error?A.Error:A.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:A.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&tc(t),ti.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}b(td,"parseTextErrors");function tf(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,s=e.line,i=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?A.Error:A.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:a})})}),n.length&&tc(n)}catch(t){td(e)}}b(tf,"parseCommandOutput");function tp(e){return /*#__PURE__*/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]:tf;n=new AbortController;T.default.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),T.default.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,to(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&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}b(tp,"executeCommand");function tg(e){return{raw:!0,cmd:e}}b(tg,"rawCommand");function tm(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eY," ").concat(ev," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eY," ").concat(eB," ").concat(eP," ").concat(e):"".concat(eY," ").concat(eC," ").concat(e)}b(tm,"formatCLI");function tv(e,t){return typeof e=="function"?tm(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"?tm(e,t):e}b(tv,"formatCommand");function ty(e){return /*#__PURE__*/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,e7(ev)];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,tv(r,i)]}))]}})}).apply(this,arguments)}b(ty,"resolveCommands");function th(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),ti.DEBUG&&H.info("→ ".concat(t));return[4,tp(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw H.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}b(th,"runCommand");function t_(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!ec(e0.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e3.typescriptCheck()];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=H.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}b(t_,"checkTypescript");function tx(){return /*#__PURE__*/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,e3.eslintFix()];case 1:return[4,th.apply(void 0,n.concat([i.sent()]))];case 2:t=i.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e3.eslintCheck()];case 4:return[4,th.apply(void 0,r.concat([i.sent()]))];case 5:t=i.sent();i.label=6;case 6:t;return[2]}})}).apply(this,arguments)}b(tx,"checkEslint");function tj(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";H.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}b(tj,"printIssues");function tb(){return /*#__PURE__*/s(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,tu()];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?H.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tj("Warnings",n),tj("Errors",t),(t.length>0||n.length>0)&&w.default.exit(1));return[2]}})})()}b(tb,"showCheckResult");function tE(){return /*#__PURE__*/s(function(){var e,t,n,r,s,i;return m(this,function(o){switch(o.label){case 0:return[4,tl()];case 1:o.sent();return[4,e7(ev)];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(ev)];return[4,e3.build()];case 4:return[4,th.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,e3.stageBuildDirectory()];case 6:return[4,th.apply(void 0,r.concat([o.sent()]))];case 7:o.sent();return[3,9];case 8:s=o.sent();throw H.error("Error building and staging ".concat(ev,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,e3.lintStaged()];case 10:return[4,th.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),tb();return[2]}})})()}b(tE,"lintStaged");function tI(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e3.eslintInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tI,"inspectLint");function tw(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([t_(),tx()])];case 2:e.sent(),tb();return[2]}})})()}b(tw,"lintCheck");function tS(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([t_(),tx(!0)])];case 2:e.sent(),tb();return[2]}})})()}b(tS,"lintFix");function tR(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,tl()];case 1:t.sent();e=["Validating commit message"];return[4,e3.commitLint()];case 2:return[4,th.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tb();return[2]}})})()}b(tR,"commitLint");function tO(){return /*#__PURE__*/s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,e3.configureGitHook()];case 1:return[4,th.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),eu(e0.GIT_HOOK);return[4,ty(e1)];case 3:t=s.sent();ea(e0.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(eE,"\n");ec(e0.GIT_IGNORE)?et(e0.GIT_IGNORE,"utf-8").split("\n").includes(eE)||er(e0.GIT_IGNORE,n,"utf-8"):en(e0.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,e3.simpleGitHooks()];case 4:return[4,th.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}b(tO,"setupGitHook");function tC(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,te([ev],{update:!0,postInstallActions:[tO]})];case 1:e.sent();return[2]}})})()}b(tC,"setup");function tP(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:eu(e0.NODE_MODULES,e0.PNPM_LOCK_YAML);return[4,e9()];case 1:e.sent();return[4,tO()];case 2:e.sent();return[2]}})})()}b(tP,"reset");function tT(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e3.nodeModulesInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tT,"inspect");function tk(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e3.testUnit()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tk,"testUnit");function tG(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e3.testE2e()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tG,"testE2E");function tU(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,e3.mongoMigrateCreate(e)];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}b(tU,"mongoMigrateCreate");function tN(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,e3.mongoMigrateUp()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tN,"mongoMigrateUp");function tL(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,e3.mongoMigrateDown()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}b(tL,"mongoMigrateDown");(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,(0,R.default)((0,S.hideBin)(w.default.argv)).scriptName(eC).usage("$0 <command> [options]").command("lint","Check code for linting issues",tw).command("lint:fix","Fix linting issues automatically",tS).command("lint:inspect","View active ESLint configuration",tI).command("lint-staged","Run lint checks on staged files",tE).command("commitlint","Validate commit message format",tR).command("setup","Initialize project setup and dependencies",tC).command("reset","Reset the project and reinstall dependencies",tP).command("inspect","Analyze installed project dependencies",tT).command("test:unit","Run unit test suite",tk).command("test:e2e","Run end-to-end test suite",tG).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){H.error("Migration name is required.");return[2]}return[4,tU(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tN).command("mongo:migrate:down","Rollback last MongoDB migration",tL).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(O.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();H.error("Fatal: ".concat(e.message)),w.default.exit(1);return[3,3];case 3:return[2]}})})()})();
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- 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 v=Object.defineProperty;var h=function(e,t){return v(e,"name",{value:t,configurable:!0})};import y from"node:process";import{hideBin as _}from"yargs/helpers";import x from"yargs/yargs";var j={name:"@cyberskill/shared",type:"module",version:"1.110.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@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",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.1",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.0","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",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var b=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as E}from"node:child_process";import I from"node:process";import*as w from"node:util";var S=".cyberskill-storage";import R from"dotenv";import{bool as C,cleanEnv as O,str as T}from"envalid";import k from"node:os";import P from"node:path";import G from"node:process";R.config();function U(){var e={DEBUG:G.env.DEBUG||!1,CWD:G.env.CWD||G.cwd(),CYBERSKILL_STORAGE_DIRECTORY:G.env.CYBERSKILL_STORAGE_DIRECTORY||P.join(k.homedir(),S)};return O(e,{DEBUG:C(),CWD:T(),CYBERSKILL_STORAGE_DIRECTORY:T()})}h(U,"getEnv");var L=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import D from"consola";import{GraphQLError as M}from"graphql";var A=U();A.DEBUG||(D.level=4);function q(e){var t=N[e];return typeof t=="function"?t:N.green}h(q,"chalkKeyword");var F={silent:D.silent,level:D.level,fatal:D.fatal,error:D.error,warn:D.warn,log:D.log,info:D.info,success:D.success,ready:D.ready,start:D.start,box:D.box,debug:D.debug,trace:D.trace,verbose:D.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)){D.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;D.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),s&&D.log(" ".concat(q(n)("Rule:")," ").concat(s)),D.log(" ".concat(q(n)("Message:")," ").concat(i))}),D.box(q(n)("".concat(e," : ").concat(t.length))),D.log(N.gray("─".repeat(40)))}};var B={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import K from"node-fetch";import W from"fs-extra";var Y=W.lstatSync,H=W.readdirSync,J=W.mkdirSync,$=W.readFileSync,V=W.writeFileSync,z=W.appendFileSync,Q=W.unlinkSync,X=W.statSync,Z=W.readJsonSync,ee=W.writeJsonSync;function et(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return W.pathExistsSync(e)})}h(et,"pathExistsSync");function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){et(e)&&W.removeSync(e)})}h(en,"removeSync");import er,{join as es,resolve as ei}from"node:path";var eo=U();function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ei.apply(void 0,[eo.CWD].concat(p(t)))}h(ec,"resolveWorkingPath");function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return es.apply(void 0,p(t))}h(ea,"join");var eu=U(),el=eu.CWD,ed="@cyberskill/shared",ep="node_modules",ef="dist",eg="package.json",em="package-lock.json",ev="tsconfig.json",eh=".gitignore",ey=".simple-git-hooks.json",e_="pnpm-lock.yaml",ex=".git/hooks/",ej=".git/COMMIT_EDITMSG",eb=".migrate-mongo.config.js",eE=ea(el,ep,ed,ef),eI="cyberskill",ew="src/nodejs/cli/index.ts",eS="eslint",eR="eslint",eC="vitest",eO="playwright",eT="vitest",ek="@commitlint/cli",eP="commitlint",eG="lint-staged",eU="lint-staged",eL="typescript",eN="tsc",eD="tsx",eM="git",eA="pnpm",eq="pnpm exec",eF="simple-git-hooks",eB="simple-git-hooks",eK="@eslint/config-inspector",eW="eslint-config-inspector",eY="node-modules-inspector",eH="node-modules-inspector",eJ="migrate-mongo",e$="./node_modules/migrate-mongo/bin/migrate-mongo",eV={CYBERSKILL_DIRECTORY:eE,WORKING_DIRECTORY:el,TS_CONFIG:ec(ev),GIT_IGNORE:ec(eh),GIT_HOOK:ec(ex),GIT_COMMIT_MSG:ec(ej),SIMPLE_GIT_HOOKS_JSON:ec(ey),PACKAGE_JSON:ec(eg),PACKAGE_LOCK_JSON:ec(em),PNPM_LOCK_YAML:ec(e_),NODE_MODULES:ec(ep),MIGRATE_MONGO_CONFIG:ec(eb),LINT_STAGED_CONFIG:ec("".concat(eE,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ec("".concat(eE,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ec("".concat(eE,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ec("".concat(eE,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ec("".concat(eE,"/react/vitest/vitest.e2e.js"))};function ez(e){var t=e.isCurrentProject;return l({"pre-commit":eU,"commit-msg":eP},t&&{"pre-push":tu("".concat(eM," pull"))})}h(ez,"createGitHooksConfig");function eQ(e,t,n){return /*#__PURE__*/s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case b.CLI:return[3,1];case b.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(eq," ").concat(n))))];case 3:return[2,td(tu(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}h(eQ,"buildCommand");function eX(e,t,n){return function(){return /*#__PURE__*/s(function(){return m(this,function(r){return[2,eQ(e,t,n)]})})()}}h(eX,"commandFactory");var eZ={simpleGitHooks:eX(b.CLI,eF,eB),eslintInspect:eX(b.CLI,eK,eW),nodeModulesInspect:eX(b.CLI,eY,eH),eslintCheck:eX(b.CLI,eS,"".concat(eR," ").concat(eV.WORKING_DIRECTORY)),eslintFix:eX(b.CLI,eS,"".concat(eR," ").concat(eV.WORKING_DIRECTORY," --fix")),typescriptCheck:eX(b.CLI,eL,"".concat(eN," -p ").concat(eV.TS_CONFIG," --noEmit")),configureGitHook:eX(b.STRING,"".concat(eM," config core.hooksPath ").concat(eV.GIT_HOOK)),testUnit:eX(b.CLI,eC,"".concat(eT," --config ").concat(eV.UNIT_TEST_CONFIG)),testE2e:eX(b.CLI,"".concat(eC," ").concat(eO),"".concat(eT," --config ").concat(eV.E2E_TEST_CONFIG)),mongoMigrateCreate:h(function(e){return eX(b.CLI,eJ,"".concat(eD," ").concat(e$," create ").concat(e," -f ").concat(eV.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:eX(b.CLI,eJ,"".concat(eD," ").concat(e$," up -f ").concat(eV.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:eX(b.CLI,eJ,"".concat(eD," ").concat(e$," down -f ").concat(eV.MIGRATE_MONGO_CONFIG)),commitLint:eX(b.CLI,ek,"".concat(eP," --edit ").concat(eV.GIT_COMMIT_MSG," --config ").concat(eV.COMMITLINT_CONFIG)),lintStaged:eX(b.CLI,eG,"".concat(eU," --config ").concat(eV.LINT_STAGED_CONFIG)),stageBuildDirectory:eX(b.STRING,"".concat(eM," add ").concat(ef)),build:eX(b.STRING,"".concat(eA," run build")),pnpmInstallStandard:eX(b.STRING,"".concat(eA," install")),pnpmInstallLegacy:eX(b.STRING,"".concat(eA," install --legacy-peer-deps")),pnpmInstallForce:eX(b.STRING,"".concat(eA," install --force"))};var e0=U();function e1(e){var t=ea(e0.CWD,eg);if(!et(t))return!1;try{var n=Z(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 F.warn("Failed to read package.json: ".concat(e.message)),!1}}h(e1,"getPackage");function e2(e){return /*#__PURE__*/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,K("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw F.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}h(e2,"getLatestPackageVersion");function e4(e,t){return /*#__PURE__*/s(function(){var n,r,s,i,o,c,a,u,d,p,f,g,v,h,y,_,x,j,b,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e1(e);if(!n)return[2,l({},B)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},v=(s=u.devDependencies)!==null&&s!==void 0?s:{},h=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=v[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=h;return[3,3];case 1:return[4,e2(e)];case 2:x=m.sent();m.label=3;case 3:y=x,_=d||h===y;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=p?"dependencies":f?"devDependencies":null;b&&((j=u[b])===null||j===void 0?void 0:j[e])!==y&&(u[b]=(E=u[b])!==null&&E!==void 0?E:{},u[b][e]=y,ee(a,u),F.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:_}];case 4:I=m.sent();return[2,(F.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},B))];case 5:return[2]}})})()}h(e4,"checkPackage");function e3(){return /*#__PURE__*/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:h(function(){return eZ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return eZ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return eZ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);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();F.warn("Installation attempt failed: ".concat(a)),F.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}h(e3,"installDependencies");function e5(e,t){return /*#__PURE__*/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(!et(eV.PACKAGE_JSON)){F.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 F.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}h(e5,"setupPackages");import e8 from"node-persist";var e6=U();function e7(){return /*#__PURE__*/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]}})})()}h(e7,"initNodePersist");var e9={get:function e(e){return /*#__PURE__*/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,(F.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/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();F.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/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();F.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/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:(F.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(F.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/s(function(){return m(this,function(t){try{return[2,"".concat(e6.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(F.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var te=U(),tt=w.promisify(E);function tn(e){return"error_list:".concat(e)}h(tn,"getErrorListKey");function tr(e){return /*#__PURE__*/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 /*#__PURE__*/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&&F.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();F.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}h(tr,"saveErrorListToStorage");function ts(){return /*#__PURE__*/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 /*#__PURE__*/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,(F.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}h(ts,"getStoredErrorLists");function ti(){return /*#__PURE__*/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();F.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}h(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,v,h,y,_,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===L.Error?L.Error:L.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:(v=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&v!==void 0?v:""}):f.length?t.push({file:(h=f===null||f===void 0?void 0:f[1])!==null&&h!==void 0?h:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===L.Error?L.Error:L.Warning,message:(y=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):g.length?t.push({file:"commitlint",type:L.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&tr(t),te.DEBUG&&n.length&&(F.warn("Unmatched lines:"),n.forEach(function(e){return F.info(" ".concat(e))}))}h(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?L.Error:L.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&tr(n)}catch(t){to(e)}}h(tc,"parseCommandOutput");function ta(e){return /*#__PURE__*/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;I.on("SIGINT",function(){F.warn("Process interrupted. Terminating..."),n.abort(),I.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&&F.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}h(ta,"executeCommand");function tu(e){return{raw:!0,cmd:e}}h(tu,"rawCommand");function tl(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eq," ").concat(ed," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eq," ").concat(eD," ").concat(ew," ").concat(e):"".concat(eq," ").concat(eI," ").concat(e)}h(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}h(td,"formatCommand");function tp(e){return /*#__PURE__*/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(ed)];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)}h(tp,"resolveCommands");function tf(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);F.start("".concat(e)),te.DEBUG&&F.info("→ ".concat(t));return[4,ta(t)];case 1:r.sent(),F.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw F.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}h(tf,"runCommand");function tg(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!et(eV.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eZ.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=F.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}h(tg,"checkTypescript");function tm(){return /*#__PURE__*/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,eZ.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,eZ.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)}h(tm,"checkEslint");function tv(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";F.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}h(tv,"printIssues");function th(){return /*#__PURE__*/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===L.Error}),n=e.filter(function(e){return e.type===L.Warning});!t.length&&!n.length?F.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tv("Warnings",n),tv("Errors",t),(t.length>0||n.length>0)&&y.exit(1));return[2]}})})()}h(th,"showCheckResult");function ty(){return /*#__PURE__*/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(ed)];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(ed)];return[4,eZ.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eZ.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 F.error("Error building and staging ".concat(ed,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eZ.lintStaged()];case 10:return[4,tf.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),th();return[2]}})})()}h(ty,"lintStaged");function t_(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eZ.eslintInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(t_,"inspectLint");function tx(){return /*#__PURE__*/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(),th();return[2]}})})()}h(tx,"lintCheck");function tj(){return /*#__PURE__*/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(),th();return[2]}})})()}h(tj,"lintFix");function tb(){return /*#__PURE__*/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,eZ.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),th();return[2]}})})()}h(tb,"commitLint");function tE(){return /*#__PURE__*/s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eZ.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),en(eV.GIT_HOOK);return[4,tp(ez)];case 3:t=s.sent();ee(eV.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(ey,"\n");et(eV.GIT_IGNORE)?$(eV.GIT_IGNORE,"utf-8").split("\n").includes(ey)||z(eV.GIT_IGNORE,n,"utf-8"):V(eV.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,eZ.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}h(tE,"setupGitHook");function tI(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,e5([ed],{update:!0,postInstallActions:[tE]})];case 1:e.sent();return[2]}})})()}h(tI,"setup");function tw(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:en(eV.NODE_MODULES,eV.PNPM_LOCK_YAML);return[4,e3()];case 1:e.sent();return[4,tE()];case 2:e.sent();return[2]}})})()}h(tw,"reset");function tS(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eZ.nodeModulesInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tS,"inspect");function tR(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eZ.testUnit()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tR,"testUnit");function tC(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eZ.testE2e()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tC,"testE2E");function tO(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eZ.mongoMigrateCreate(e)];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}h(tO,"mongoMigrateCreate");function tT(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eZ.mongoMigrateUp()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tT,"mongoMigrateUp");function tk(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eZ.mongoMigrateDown()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tk,"mongoMigrateDown");(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,x(_(y.argv)).scriptName(eI).usage("$0 <command> [options]").command("lint","Check code for linting issues",tx).command("lint:fix","Fix linting issues automatically",tj).command("lint:inspect","View active ESLint configuration",t_).command("lint-staged","Run lint checks on staged files",ty).command("commitlint","Validate commit message format",tb).command("setup","Initialize project setup and dependencies",tI).command("reset","Reset the project and reinstall dependencies",tw).command("inspect","Analyze installed project dependencies",tS).command("test:unit","Run unit test suite",tR).command("test:e2e","Run end-to-end test suite",tC).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){F.error("Migration name is required.");return[2]}return[4,tO(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tT).command("mongo:migrate:down","Rollback last MongoDB migration",tk).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(j.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();F.error("Fatal: ".concat(e.message)),y.exit(1);return[3,3];case 3:return[2]}})})()})();
2
+ 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 v=Object.defineProperty;var h=function(e,t){return v(e,"name",{value:t,configurable:!0})};import y from"node:process";import{hideBin as _}from"yargs/helpers";import x from"yargs/yargs";var j={name:"@cyberskill/shared",type:"module",version:"1.111.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./configs":{types:"./dist/configs/index.d.ts",import:"./dist/configs/index.js",require:"./dist/configs/index.cjs"},"./configs/commitlint":{types:"./dist/configs/commitlint/index.d.ts",import:"./dist/configs/commitlint/index.js",require:"./dist/configs/commitlint/index.cjs"},"./configs/eslint":{types:"./dist/configs/eslint/index.d.ts",import:"./dist/configs/eslint/index.js",require:"./dist/configs/eslint/index.cjs"},"./configs/graphql-codegen":{types:"./dist/configs/graphql-codegen/index.d.ts",import:"./dist/configs/graphql-codegen/index.js",require:"./dist/configs/graphql-codegen/index.cjs"},"./configs/lint-staged":{types:"./dist/configs/lint-staged/index.d.ts",import:"./dist/configs/lint-staged/index.js",require:"./dist/configs/lint-staged/index.cjs"},"./constants":{types:"./dist/constants/index.d.ts",import:"./dist/constants/index.js",require:"./dist/constants/index.cjs"},"./nodejs":{types:"./dist/nodejs/index.d.ts",import:"./dist/nodejs/index.js",require:"./dist/nodejs/index.cjs"},"./nodejs/apollo-server":{types:"./dist/nodejs/apollo-server/index.d.ts",import:"./dist/nodejs/apollo-server/index.js",require:"./dist/nodejs/apollo-server/index.cjs"},"./nodejs/cli":{types:"./dist/nodejs/cli/index.d.ts",import:"./dist/nodejs/cli/index.js",require:"./dist/nodejs/cli/index.cjs"},"./nodejs/command":{types:"./dist/nodejs/command/index.d.ts",import:"./dist/nodejs/command/index.js",require:"./dist/nodejs/command/index.cjs"},"./nodejs/express":{types:"./dist/nodejs/express/index.d.ts",import:"./dist/nodejs/express/index.js",require:"./dist/nodejs/express/index.cjs"},"./nodejs/fs":{types:"./dist/nodejs/fs/index.d.ts",import:"./dist/nodejs/fs/index.js",require:"./dist/nodejs/fs/index.cjs"},"./nodejs/log":{types:"./dist/nodejs/log/index.d.ts",import:"./dist/nodejs/log/index.js",require:"./dist/nodejs/log/index.cjs"},"./nodejs/mongo":{types:"./dist/nodejs/mongo/index.d.ts",import:"./dist/nodejs/mongo/index.js",require:"./dist/nodejs/mongo/index.cjs"},"./nodejs/package":{types:"./dist/nodejs/package/index.d.ts",import:"./dist/nodejs/package/index.js",require:"./dist/nodejs/package/index.cjs"},"./nodejs/path":{types:"./dist/nodejs/path/index.d.ts",import:"./dist/nodejs/path/index.js",require:"./dist/nodejs/path/index.cjs"},"./nodejs/storage":{types:"./dist/nodejs/storage/index.d.ts",import:"./dist/nodejs/storage/index.js",require:"./dist/nodejs/storage/index.cjs"},"./nodejs/ws":{types:"./dist/nodejs/ws/index.d.ts",import:"./dist/nodejs/ws/index.js",require:"./dist/nodejs/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./styles/reset.css":{import:"./dist/styles/reset.css",require:"./dist/styles/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./utils":{types:"./dist/utils/index.d.ts",import:"./dist/utils/index.js",require:"./dist/utils/index.cjs"}},main:"./dist/index.cjs",module:"./dist/index.js",types:"./dist/index.d.ts",bin:{cyberskill:"./dist/nodejs/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"dotenv -e .env -- tsup --watch",lint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint","lint:fix":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:fix","lint:inspect":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint:inspect",reset:"dotenv -e .env -- tsx src/nodejs/cli/index.ts reset",setup:"dotenv -e .env -- tsx src/nodejs/cli/index.ts setup",inspect:"dotenv -e .env -- tsx src/nodejs/cli/index.ts inspect","test:unit":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:unit","test:e2e":"dotenv -e .env -- tsx src/nodejs/cli/index.ts test:e2e",commitlint:"dotenv -e .env -- tsx src/nodejs/cli/index.ts commitlint","lint-staged":"dotenv -e .env -- tsx src/nodejs/cli/index.ts lint-staged"},dependencies:{"@antfu/eslint-config":"4.12.0","@apollo/client":"3.13.8","@apollo/server":"4.12.0","@eddeee888/gcg-typescript-resolver-files":"0.12.0","@eslint-react/eslint-plugin":"1.48.5","@graphql-codegen/cli":"5.0.5","@graphql-codegen/client-preset":"4.8.0","@microsoft/api-extractor":"7.52.5","@next/eslint-plugin-next":"15.3.1","@swc/core":"1.11.22","@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",chalk:"5.4.1",classnames:"2.5.1",compression:"1.8.0",consola:"3.4.2",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0",dotenv:"16.5.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.1","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-device":"0.4.2","express-session":"1.18.1","fs-extra":"11.3.0",globals:"16.0.0",graphql:"16.10.0","graphql-ws":"6.0.4",i18next:"25.0.1",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.0","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",ora:"8.2.0",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.87.0",slugify:"1.6.6",tsup:"8.4.0",tsx:"4.19.3",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.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/compression":"1.7.5","@types/cors":"2.8.17","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/mongoose-aggregate-paginate-v2":"1.0.12","@types/node-persist":"3.1.8","@types/react":"19.1.2","@types/react-dom":"19.1.2","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.25.1","lint-staged":"15.5.1","node-modules-inspector":"0.6.7","simple-git-hooks":"2.13.0"}};var b=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as E}from"node:child_process";import I from"node:process";import*as w from"node:util";var S=".cyberskill-storage";import R from"dotenv";import{bool as C,cleanEnv as O,str as T}from"envalid";import k from"node:os";import P from"node:path";import G from"node:process";R.config();function U(){var e={DEBUG:G.env.DEBUG||!1,CWD:G.env.CWD||G.cwd(),CYBERSKILL_STORAGE_DIRECTORY:G.env.CYBERSKILL_STORAGE_DIRECTORY||P.join(k.homedir(),S)};return O(e,{DEBUG:C(),CWD:T(),CYBERSKILL_STORAGE_DIRECTORY:T()})}h(U,"getEnv");var L=function(e){return e.Error="error",e.Warning="warning",e}({});import N from"chalk";import D from"consola";import{GraphQLError as M}from"graphql";var A=U();A.DEBUG||(D.level=4);function q(e){var t=N[e];return typeof t=="function"?t:N.green}h(q,"chalkKeyword");var F={silent:D.silent,level:D.level,fatal:D.fatal,error:D.error,warn:D.warn,log:D.log,info:D.info,success:D.success,ready:D.ready,start:D.start,box:D.box,debug:D.debug,trace:D.trace,verbose:D.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)){D.box(N.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,s=e.rule,i=e.message;D.log("".concat(N.gray("File:")," ").concat(N.blue("".concat(t).concat(r?":".concat(r):"")))),s&&D.log(" ".concat(q(n)("Rule:")," ").concat(s)),D.log(" ".concat(q(n)("Message:")," ").concat(i))}),D.box(q(n)("".concat(e," : ").concat(t.length))),D.log(N.gray("─".repeat(40)))}};var B={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import K from"node-fetch";import W from"fs-extra";var Y=W.lstatSync,H=W.readdirSync,J=W.mkdirSync,$=W.readFileSync,V=W.writeFileSync,z=W.appendFileSync,Q=W.unlinkSync,X=W.statSync,Z=W.readJsonSync,ee=W.writeJsonSync;function et(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return W.pathExistsSync(e)})}h(et,"pathExistsSync");function en(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){et(e)&&W.removeSync(e)})}h(en,"removeSync");import er,{join as es,resolve as ei}from"node:path";var eo=U();function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ei.apply(void 0,[eo.CWD].concat(p(t)))}h(ec,"resolveWorkingPath");function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return es.apply(void 0,p(t))}h(ea,"join");var eu=U(),el=eu.CWD,ed="@cyberskill/shared",ep="node_modules",ef="dist",eg="package.json",em="package-lock.json",ev="tsconfig.json",eh=".gitignore",ey=".simple-git-hooks.json",e_="pnpm-lock.yaml",ex=".git/hooks/",ej=".git/COMMIT_EDITMSG",eb=".migrate-mongo.config.js",eE=ea(el,ep,ed,ef),eI="cyberskill",ew="src/nodejs/cli/index.ts",eS="eslint",eR="eslint",eC="vitest",eO="playwright",eT="vitest",ek="@commitlint/cli",eP="commitlint",eG="lint-staged",eU="lint-staged",eL="typescript",eN="tsc",eD="tsx",eM="git",eA="pnpm",eq="pnpm exec",eF="simple-git-hooks",eB="simple-git-hooks",eK="@eslint/config-inspector",eW="eslint-config-inspector",eY="node-modules-inspector",eH="node-modules-inspector",eJ="migrate-mongo",e$="./node_modules/migrate-mongo/bin/migrate-mongo",eV={CYBERSKILL_DIRECTORY:eE,WORKING_DIRECTORY:el,TS_CONFIG:ec(ev),GIT_IGNORE:ec(eh),GIT_HOOK:ec(ex),GIT_COMMIT_MSG:ec(ej),SIMPLE_GIT_HOOKS_JSON:ec(ey),PACKAGE_JSON:ec(eg),PACKAGE_LOCK_JSON:ec(em),PNPM_LOCK_YAML:ec(e_),NODE_MODULES:ec(ep),MIGRATE_MONGO_CONFIG:ec(eb),LINT_STAGED_CONFIG:ec("".concat(eE,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:ec("".concat(eE,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:ec("".concat(eE,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ec("".concat(eE,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ec("".concat(eE,"/react/vitest/vitest.e2e.js"))};function ez(e){var t=e.isCurrentProject;return l({"pre-commit":eU,"commit-msg":eP},t&&{"pre-push":tu("".concat(eM," pull"))})}h(ez,"createGitHooksConfig");function eQ(e,t,n){return /*#__PURE__*/s(function(){return m(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case b.CLI:return[3,1];case b.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(eq," ").concat(n))))];case 3:return[2,td(tu(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}h(eQ,"buildCommand");function eX(e,t,n){return function(){return /*#__PURE__*/s(function(){return m(this,function(r){return[2,eQ(e,t,n)]})})()}}h(eX,"commandFactory");var eZ={simpleGitHooks:eX(b.CLI,eF,eB),eslintInspect:eX(b.CLI,eK,eW),nodeModulesInspect:eX(b.CLI,eY,eH),eslintCheck:eX(b.CLI,eS,"".concat(eR," ").concat(eV.WORKING_DIRECTORY)),eslintFix:eX(b.CLI,eS,"".concat(eR," ").concat(eV.WORKING_DIRECTORY," --fix")),typescriptCheck:eX(b.CLI,eL,"".concat(eN," -p ").concat(eV.TS_CONFIG," --noEmit")),configureGitHook:eX(b.STRING,"".concat(eM," config core.hooksPath ").concat(eV.GIT_HOOK)),testUnit:eX(b.CLI,eC,"".concat(eT," --config ").concat(eV.UNIT_TEST_CONFIG)),testE2e:eX(b.CLI,"".concat(eC," ").concat(eO),"".concat(eT," --config ").concat(eV.E2E_TEST_CONFIG)),mongoMigrateCreate:h(function(e){return eX(b.CLI,eJ,"".concat(eD," ").concat(e$," create ").concat(e," -f ").concat(eV.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:eX(b.CLI,eJ,"".concat(eD," ").concat(e$," up -f ").concat(eV.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:eX(b.CLI,eJ,"".concat(eD," ").concat(e$," down -f ").concat(eV.MIGRATE_MONGO_CONFIG)),commitLint:eX(b.CLI,ek,"".concat(eP," --edit ").concat(eV.GIT_COMMIT_MSG," --config ").concat(eV.COMMITLINT_CONFIG)),lintStaged:eX(b.CLI,eG,"".concat(eU," --config ").concat(eV.LINT_STAGED_CONFIG)),stageBuildDirectory:eX(b.STRING,"".concat(eM," add ").concat(ef)),build:eX(b.STRING,"".concat(eA," run build")),pnpmInstallStandard:eX(b.STRING,"".concat(eA," install")),pnpmInstallLegacy:eX(b.STRING,"".concat(eA," install --legacy-peer-deps")),pnpmInstallForce:eX(b.STRING,"".concat(eA," install --force"))};var e0=U();function e1(e){var t=ea(e0.CWD,eg);if(!et(t))return!1;try{var n=Z(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 F.warn("Failed to read package.json: ".concat(e.message)),!1}}h(e1,"getPackage");function e2(e){return /*#__PURE__*/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,K("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:s=i.sent();throw F.error('Failed to fetch version for "'.concat(e,'": ').concat(s.message)),s;case 4:return[2]}})})()}h(e2,"getLatestPackageVersion");function e4(e,t){return /*#__PURE__*/s(function(){var n,r,s,i,o,c,a,u,d,p,f,g,v,h,y,_,x,j,b,E,I;return m(this,function(m){switch(m.label){case 0:m.trys.push([0,4,,5]);n=e1(e);if(!n)return[2,l({},B)];a=n.path,u=n.file,d=n.isCurrentProject,p=n.isDepend,f=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},v=(s=u.devDependencies)!==null&&s!==void 0?s:{},h=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=v[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!d)return[3,1];x=h;return[3,3];case 1:return[4,e2(e)];case 2:x=m.sent();m.label=3;case 3:y=x,_=d||h===y;if(!_&&(t===null||t===void 0?void 0:t.update)){;b=p?"dependencies":f?"devDependencies":null;b&&((j=u[b])===null||j===void 0?void 0:j[e])!==y&&(u[b]=(E=u[b])!==null&&E!==void 0?E:{},u[b][e]=y,ee(a,u),F.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:d,installedPath:a,file:u,isUpToDate:_}];case 4:I=m.sent();return[2,(F.error('Error checking package "'.concat(e,'": ').concat(I.message)),l({},B))];case 5:return[2]}})})()}h(e4,"checkPackage");function e3(){return /*#__PURE__*/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:h(function(){return eZ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return eZ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return eZ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;p.label=1;case 1:p.trys.push([1,9,10,11]);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();F.warn("Installation attempt failed: ".concat(a)),F.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=p.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&s.return!=null){s.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}h(e3,"installDependencies");function e5(e,t){return /*#__PURE__*/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(!et(eV.PACKAGE_JSON)){F.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 F.error('Failed to setup "'.concat(e.join(", "),'": ').concat(g.message)),g;case 14:return[2]}})})()}h(e5,"setupPackages");import e8 from"node-persist";var e6=U();function e7(){return /*#__PURE__*/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]}})})()}h(e7,"initNodePersist");var e9={get:function e(e){return /*#__PURE__*/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,(F.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/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();F.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/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();F.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/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:(F.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(F.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/s(function(){return m(this,function(t){try{return[2,"".concat(e6.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(F.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var te=U(),tt=w.promisify(E);function tn(e){return"error_list:".concat(e)}h(tn,"getErrorListKey");function tr(e){return /*#__PURE__*/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 /*#__PURE__*/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&&F.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();F.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}h(tr,"saveErrorListToStorage");function ts(){return /*#__PURE__*/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 /*#__PURE__*/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,(F.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})})()}h(ts,"getStoredErrorLists");function ti(){return /*#__PURE__*/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();F.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})})()}h(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,v,h,y,_,x;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===L.Error?L.Error:L.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:(v=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&v!==void 0?v:""}):f.length?t.push({file:(h=f===null||f===void 0?void 0:f[1])!==null&&h!==void 0?h:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===L.Error?L.Error:L.Warning,message:(y=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&y!==void 0?y:""}):g.length?t.push({file:"commitlint",type:L.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(x=g===null||g===void 0?void 0:(d=g[2])===null||d===void 0?void 0:d.trim())!==null&&x!==void 0?x:""}):n.push(e.trim())}}),t.length&&tr(t),te.DEBUG&&n.length&&(F.warn("Unmatched lines:"),n.forEach(function(e){return F.info(" ".concat(e))}))}h(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?L.Error:L.Warning,file:t,position:"".concat(s,":").concat(i),rule:o,message:c})})}),n.length&&tr(n)}catch(t){to(e)}}h(tc,"parseCommandOutput");function ta(e){return /*#__PURE__*/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;I.on("SIGINT",function(){F.warn("Process interrupted. Terminating..."),n.abort(),I.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&&F.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}h(ta,"executeCommand");function tu(e){return{raw:!0,cmd:e}}h(tu,"rawCommand");function tl(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eq," ").concat(ed," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eq," ").concat(eD," ").concat(ew," ").concat(e):"".concat(eq," ").concat(eI," ").concat(e)}h(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}h(td,"formatCommand");function tp(e){return /*#__PURE__*/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(ed)];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)}h(tp,"resolveCommands");function tf(e,t){return /*#__PURE__*/s(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);F.start("".concat(e)),te.DEBUG&&F.info("→ ".concat(t));return[4,ta(t)];case 1:r.sent(),F.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw F.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}h(tf,"runCommand");function tg(){return /*#__PURE__*/s(function(){var e,t;return m(this,function(n){switch(n.label){case 0:if(!et(eV.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,eZ.typescriptCheck()];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=F.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}h(tg,"checkTypescript");function tm(){return /*#__PURE__*/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,eZ.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,eZ.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)}h(tm,"checkEslint");function tv(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";F.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}h(tv,"printIssues");function th(){return /*#__PURE__*/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===L.Error}),n=e.filter(function(e){return e.type===L.Warning});!t.length&&!n.length?F.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tv("Warnings",n),tv("Errors",t),(t.length>0||n.length>0)&&y.exit(1));return[2]}})})()}h(th,"showCheckResult");function ty(){return /*#__PURE__*/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(ed)];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(ed)];return[4,eZ.build()];case 4:return[4,tf.apply(void 0,n.concat([o.sent()]))];case 5:o.sent();r=["Staging build artifacts"];return[4,eZ.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 F.error("Error building and staging ".concat(ed,": ").concat(s.message)),s;case 9:i=["Executing lint-staged"];return[4,eZ.lintStaged()];case 10:return[4,tf.apply(void 0,i.concat([o.sent()]))];case 11:o.sent(),th();return[2]}})})()}h(ty,"lintStaged");function t_(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,eZ.eslintInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(t_,"inspectLint");function tx(){return /*#__PURE__*/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(),th();return[2]}})})()}h(tx,"lintCheck");function tj(){return /*#__PURE__*/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(),th();return[2]}})})()}h(tj,"lintFix");function tb(){return /*#__PURE__*/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,eZ.commitLint()];case 2:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),th();return[2]}})})()}h(tb,"commitLint");function tE(){return /*#__PURE__*/s(function(){var e,t,n,r;return m(this,function(s){switch(s.label){case 0:e=["Configuring Git hooks"];return[4,eZ.configureGitHook()];case 1:return[4,tf.apply(void 0,e.concat([s.sent()]))];case 2:s.sent(),en(eV.GIT_HOOK);return[4,tp(ez)];case 3:t=s.sent();ee(eV.SIMPLE_GIT_HOOKS_JSON,t);n="\n".concat(ey,"\n");et(eV.GIT_IGNORE)?$(eV.GIT_IGNORE,"utf-8").split("\n").includes(ey)||z(eV.GIT_IGNORE,n,"utf-8"):V(eV.GIT_IGNORE,n,"utf-8");r=["Setting up simple-git-hooks"];return[4,eZ.simpleGitHooks()];case 4:return[4,tf.apply(void 0,r.concat([s.sent()]))];case 5:s.sent();return[2]}})})()}h(tE,"setupGitHook");function tI(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:return[4,e5([ed],{update:!0,postInstallActions:[tE]})];case 1:e.sent();return[2]}})})()}h(tI,"setup");function tw(){return /*#__PURE__*/s(function(){return m(this,function(e){switch(e.label){case 0:en(eV.NODE_MODULES,eV.PNPM_LOCK_YAML);return[4,e3()];case 1:e.sent();return[4,tE()];case 2:e.sent();return[2]}})})()}h(tw,"reset");function tS(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,eZ.nodeModulesInspect()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tS,"inspect");function tR(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,eZ.testUnit()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tR,"testUnit");function tC(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,eZ.testE2e()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tC,"testE2E");function tO(e){return /*#__PURE__*/s(function(){var t;return m(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,eZ.mongoMigrateCreate(e)];case 1:return[4,tf.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}h(tO,"mongoMigrateCreate");function tT(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,eZ.mongoMigrateUp()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tT,"mongoMigrateUp");function tk(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,eZ.mongoMigrateDown()];case 1:return[4,tf.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tk,"mongoMigrateDown");(function(){return /*#__PURE__*/s(function(){var e;return m(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,x(_(y.argv)).scriptName(eI).usage("$0 <command> [options]").command("lint","Check code for linting issues",tx).command("lint:fix","Fix linting issues automatically",tj).command("lint:inspect","View active ESLint configuration",t_).command("lint-staged","Run lint checks on staged files",ty).command("commitlint","Validate commit message format",tb).command("setup","Initialize project setup and dependencies",tI).command("reset","Reset the project and reinstall dependencies",tw).command("inspect","Analyze installed project dependencies",tS).command("test:unit","Run unit test suite",tR).command("test:e2e","Run end-to-end test suite",tC).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return /*#__PURE__*/s(function(){return m(this,function(t){switch(t.label){case 0:if(!e.name){F.error("Migration name is required.");return[2]}return[4,tO(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tT).command("mongo:migrate:down","Rollback last MongoDB migration",tk).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(j.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();F.error("Fatal: ".concat(e.message)),y.exit(1);return[3,3];case 3:return[2]}})})()})();