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