@cyberskill/shared 1.164.0 → 1.166.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.
Files changed (46) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +4 -1
  2. package/dist/_tsup-dts-rollup.d.ts +4 -1
  3. package/dist/config/config.util.cjs +1 -1
  4. package/dist/config/config.util.js +1 -1
  5. package/dist/config/index.cjs +1 -1
  6. package/dist/config/index.js +1 -1
  7. package/dist/node/cli/cli.util.cjs +1 -1
  8. package/dist/node/cli/cli.util.js +1 -1
  9. package/dist/node/cli/index.cjs +1 -1
  10. package/dist/node/cli/index.js +1 -1
  11. package/dist/node/command/command.util.cjs +1 -1
  12. package/dist/node/command/command.util.js +1 -1
  13. package/dist/node/command/index.cjs +1 -1
  14. package/dist/node/command/index.js +1 -1
  15. package/dist/node/express/express.util.cjs +1 -1
  16. package/dist/node/express/express.util.js +1 -1
  17. package/dist/node/express/index.cjs +1 -1
  18. package/dist/node/express/index.js +1 -1
  19. package/dist/node/index.cjs +1 -1
  20. package/dist/node/index.js +1 -1
  21. package/dist/node/mongo/index.cjs +1 -1
  22. package/dist/node/mongo/index.js +1 -1
  23. package/dist/node/mongo/mongo.util.cjs +1 -1
  24. package/dist/node/mongo/mongo.util.js +1 -1
  25. package/dist/node/package/index.cjs +1 -1
  26. package/dist/node/package/index.js +1 -1
  27. package/dist/node/package/package.util.cjs +1 -1
  28. package/dist/node/package/package.util.js +1 -1
  29. package/dist/node/path/index.cjs +1 -1
  30. package/dist/node/path/index.js +1 -1
  31. package/dist/node/path/path.constant.cjs +1 -1
  32. package/dist/node/path/path.constant.js +1 -1
  33. package/dist/react/index.cjs +1 -1
  34. package/dist/react/index.js +1 -1
  35. package/dist/react/vitest/index.cjs +1 -1
  36. package/dist/react/vitest/index.js +1 -1
  37. package/dist/react/vitest/vitest.unit.cjs +1 -1
  38. package/dist/react/vitest/vitest.unit.js +1 -1
  39. package/package.json +4 -4
  40. package/public/renovate.base.json +6 -3
  41. package/public/wiki/clone-project.md +99 -0
  42. package/public/wiki/setup-mongo.md +29 -0
  43. package/public/wiki/setup-nginx.md +55 -0
  44. package/public/wiki/setup-node.md +29 -0
  45. package/public/wiki/setup-pm2.md +27 -0
  46. package/public/wiki/setup-redis.md +17 -0
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,a,o,s){try{var i=e[o](s);var c=i.value}catch(e){n(e);return}if(i.done){t(c)}else{Promise.resolve(c).then(r,a)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(a,o){var s=e.apply(t,r);function i(e){n(s,a,o,i,c,"next",e)}function c(e){n(s,a,o,i,c,"throw",e)}i(undefined)})}}function a(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,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){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 c(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){a(e,t,n[t])})}return e}function u(e){return t(e)||s(e)||E(e)||i()}function l(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function E(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 d(e,t){var n,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(o=0)),o)try{if(n=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var f=Object.create;var p=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var v=function(e,t){return p(e,"name",{value:t,configurable:!0})};var C=function(e,t){for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=function(e,t,n,r){var a=true,o=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":l(t))=="object"||typeof t=="function")try{var i=function(){var a=u.value;!O.call(e,a)&&a!==n&&p(e,a,{get:function(){return t[a]},enumerable:!(r=S(t,a))||r.enumerable})};for(var c=m(t)[Symbol.iterator](),u;!(a=(u=c.next()).done);a=true)i()}catch(e){o=true;s=e}finally{try{if(!a&&c.return!=null){c.return()}}finally{if(o){throw s}}}return e};var I=function(e,t,n){return n=e!=null?f(D(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)},N=function(e){return y(p({},"__esModule",{value:!0}),e)};var T={};C(T,{vitestUnit:function(){return tm}});module.exports=N(T);var h=I(require("@vitejs/plugin-react-swc"),1),g=require("vitest/config");var A=I(require("fs-extra"),1);var _=".cyberskill-storage";var R=I(require("@dotenvx/dotenvx"),1),G=require("envalid"),P=I(require("os"),1),M=I(require("path"),1),b=I(require("process"),1);var L=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var U=!1;function w(){b.default.env.NODE_ENV!==L.PRODUCTION&&!U&&(R.default.config(),U=!0)}v(w,"loadEnvFile");function F(){w();var e=(0,G.cleanEnv)(b.default.env,{CWD:(0,G.str)({default:b.default.cwd()}),DEBUG:(0,G.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,G.str)({default:M.default.join(P.default.homedir(),_)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}v(F,"getEnv");var k=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var Y=require("child_process"),V=I(require("process"),1),j=I(require("util"),1);var x=function(e){return e.Error="error",e.Warning="warning",e}({});var q=I(require("chalk"),1),K=I(require("consola"),1),B=require("graphql");var Q={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var H=F();H.DEBUG||(K.default.level=4);function W(e){var t=q.default[e];return typeof t=="function"?t:q.default.green}v(W,"chalkKeyword");var J={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){K.default.box(q.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,a=e.rule,o=e.message;K.default.log("".concat(q.default.gray("File:")," ").concat(q.default.blue("".concat(t).concat(r?":".concat(r):"")))),a&&K.default.log(" ".concat(W(n)("Rule:")," ").concat(a)),K.default.log(" ".concat(W(n)("Message:")," ").concat(o))}),K.default.box(W(n)("".concat(e," : ").concat(t.length))),K.default.log(q.default.gray("─".repeat(40)))}};function $(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,a=r===void 0?!0:r,s=n.returnValue,i=n.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&J.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:Q.INTERNAL_SERVER_ERROR.CODE}}v($,"catchError");var X=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 Z=I(require("fs-extra"),1),ee=I(require("path"),1);var et=Z.default,en=et.lstatSync,er=et.readdirSync,ea=et.mkdirSync,eo=et.readFileSync,es=et.unlinkSync,ei=et.statSync,ec=Z.default.readJsonSync;function eu(e,t,n){Z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(eu,"writeFileSync");function el(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Z.default.pathExistsSync(e)})}v(el,"pathExistsSync");var eE=F();function ed(e){return r(function(){var t,n,r,a;return d(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,z.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=o.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,$(a)];case 4:return[2]}})})()}v(ed,"getLatestPackageVersion");function ef(e){return r(function(){var t,n,r,a,o,s,i,c,u,l,E,f,p,S,m,D,O,v,C,y,I,N,T,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(el(tf.PACKAGE_JSON)){t=ec(tf.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,a=t.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:tf.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!el(tf.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=ec(tf.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,l=s.dependencies,E=l===void 0?{}:l,f=s.devDependencies,p=f===void 0?{}:f;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:tf.PACKAGE_JSON,file:s}}];S=e.name in E,m=e.name in p;return[4,ed(e.name)];case 1:D=d.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:"",file:{}}}];if(!S&&!m)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:"",file:{}}}];C=(v=(O=E[e.name])!==null&&O!==void 0?O:p[e.name])!==null&&v!==void 0?v:"",y=ew(eE.CWD,eV,e.name,ex);if(!el(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:"",file:{}}}];I=ec(y),N=I.version,T=N===void 0?"":N;return[2,C!==T?{success:!0,result:{name:e.name,currentVersion:T||C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:y,file:I}}:{success:!0,result:{name:e.name,currentVersion:C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:C===D.result,isDependency:S,isDevDependency:m,installedPath:y,file:I}}];case 2:h=d.sent();return[2,$(h)];case 3:return[2]}})})()}v(ef,"getPackage");function ep(e){return r(function(){var t,n,r,a,o;return d(this,function(s){try{;r=ec(tf.PACKAGE_JSON),a=(t=r.dependencies)!==null&&t!==void 0?t:{},o=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),eu(tf.PACKAGE_JSON,JSON.stringify(r,null,4)),J.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){$(e)}return[2]})})()}v(ep,"updatePackage");function eS(){return r(function(){var e,t,n,r,a,o,s,i,c,u,l,E,f;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,12,,13]);e=[{command:v(function(){return tS.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return tS.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(function(){return tS.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);a=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];s=o.value,i=s.command,c=s.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,i()];case 4:u=d.sent();return[4,eP("".concat(c," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();$(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:E=d.sent();n=true;r=E;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:f=d.sent();$(f);return[3,13];case 13:return[2]}})})()}v(eS,"installDependencies");function em(e,t){return r(function(){var n,r,a,o,s,i,c,u,l,E,f,p;return d(this,function(d){switch(d.label){case 0:if(!el(tf.PACKAGE_JSON)){J.error("package.json not found. Aborting setup.");return[2]}d.label=1;case 1:d.trys.push([1,16,,17]);return[4,Promise.all(e.map(ef))];case 2:n=d.sent().filter(function(e){return e.success?!e.result.isCurrentProject&&(!e.result.isInstalled||!e.result.isUpToDate):!1});r=n.length>0;if(!r)return[3,7];return[4,Promise.all(n.map(function(e){return e.success?ep(e.result):Promise.resolve()}))];case 3:d.sent();return[4,eS()];case 4:d.sent();a=["Running ESLint with auto-fix"];return[4,tS.eslintFix()];case 5:return[4,eP.apply(void 0,a.concat([d.sent()]))];case 6:r=d.sent();d.label=7;case 7:r;s=true,i=false,c=undefined;d.label=8;case 8:d.trys.push([8,13,14,15]);u=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();d.label=9;case 9:if(!!(s=(l=u.next()).done))return[3,12];E=l.value;return[4,E()];case 10:d.sent();d.label=11;case 11:s=true;return[3,9];case 12:return[3,15];case 13:f=d.sent();i=true;c=f;return[3,15];case 14:try{if(!s&&u.return!=null){u.return()}}finally{if(i){throw c}}return[7];case 15:return[3,17];case 16:p=d.sent();$(p);return[3,17];case 17:return[2]}})})()}v(em,"setupPackages");var eD=I(require("node-persist"),1);var eO=F();function ev(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:e=eD.default.defaultInstance;if(e)return[3,2];return[4,eD.default.init({dir:eO.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}v(ev,"initNodePersist");var eC={get:function e(e){return r(function(){var t,n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,eD.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,$(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,eD.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();$(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return d(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,eD.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();$(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return d(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,eD.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(J.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,$(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(t){try{return[2,"".concat(eO.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,$(e,{returnValue:null})]}return[2]})})()}};var ey=F(),eI=j.promisify(Y.exec);function eN(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,ef()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}v(eN,"getPackageName");function eT(e){return r(function(){var t,n;return d(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];return[4,eN()];case 1:t=a.sent();a.label=2;case 2:a.trys.push([2,4,,5]);return[4,eC.set(t,e)];case 3:a.sent(),setTimeout(function(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,eC.getLogLink(t)];case 1:e=n.sent();e&&J.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=a.sent();$(n);return[3,5];case 5:return[2]}})})()}v(eT,"saveErrorListToStorage");function eh(e){var t=[],n=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=s.exec(e)||[];var S,m,D,O,v,C;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===x.Error?x.Error:x.Warning,message:(S=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&S!==void 0?S:"",rule:(m=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:""}):f.length?t.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===x.Error?x.Error:x.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?t.push({file:"commitlint",type:x.Error,message:(v=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(C=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:""}):n.push(e.trim())}}),t.length&&eT(t),ey.DEBUG&&n.length&&(J.warn("Unmatched lines:"),n.forEach(function(e){return J.info(" ".concat(e))}))}v(eh,"parseTextErrors");function eg(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,a=e.line,o=e.column,s=e.ruleId,i=e.message;n.push({type:r===2?x.Error:x.Warning,file:t,position:"".concat(a,":").concat(o),rule:s,message:i})})}),n.length&&eT(n)}catch(t){eh(e)}}v(eg,"parseCommandOutput");function eA(e){return r(function(e){var t,n,r,a,o,s,i,c,u;var l=arguments;return d(this,function(E){switch(E.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eg;n=new AbortController;V.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),V.default.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eI(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&t(e)});E.label=3;case 3:return[3,5];case 4:s=E.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&t(e)}),!c&&!i&&J.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}v(eA,"executeCommand");function e_(e){return{raw:!0,cmd:e}}v(e_,"rawCommand");function eR(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ta," ").concat(tt," ").concat(eZ," ").concat(e):"".concat(ta," ").concat(ez," ").concat(e)}v(eR,"formatCLI");function eG(e,t){return typeof e=="function"?eR(e(t),t):(typeof e==="undefined"?"undefined":l(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eR(e,t):e}v(eG,"formatCommand");function eP(e,t){return r(function(){var n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);J.start("".concat(e)),ey.DEBUG&&J.info("→ ".concat(t));return[4,eA(t)];case 1:r.sent(),J.success("".concat(e," done."));return[3,3];case 2:n=r.sent();$(n);return[3,3];case 3:return[2]}})})()}v(eP,"runCommand");var eM=I(require("path"),1);var eb=F(),eL=eM.default;function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eL).resolve.apply(r,[eb.CWD].concat(u(t)))}v(eU,"resolveWorkingPath");function ew(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eL).join.apply(r,u(t))}v(ew,"join");var eF=F(),ek=eF.CWD,eY="@cyberskill/shared",eV="node_modules",ej="dist",ex="package.json",eq="package-lock.json",eK="tsconfig.json",eB=".gitignore",eQ=".simple-git-hooks.json",eH="pnpm-lock.yaml",eW=".git/hooks/",eJ=".git/COMMIT_EDITMSG",e$=".migrate-mongo.config.js",eX=function(){var e=A.default.readJsonSync(eU(ex)).name===eY?ek:ew(ek,eV,eY);return ew(e,ej)}(),ez="cyberskill",eZ="src/node/cli/index.ts",e0="eslint",e1="eslint",e2="vitest";var e4="vitest",e3="@commitlint/cli",e5="@commitlint/config-conventional",e7="commitlint",e6="lint-staged",e8="lint-staged",e9="typescript",te="tsc",tt="tsx",tn="git",tr="pnpm",ta="pnpm exec",to="simple-git-hooks",ts="simple-git-hooks",ti="@eslint/config-inspector",tc="eslint-config-inspector",tu="node-modules-inspector",tl="node-modules-inspector",tE="migrate-mongo",td="./node_modules/migrate-mongo/bin/migrate-mongo",tf={CYBERSKILL_DIRECTORY:eX,WORKING_DIRECTORY:ek,TS_CONFIG:eU(eK),GIT_IGNORE:eU(eB),GIT_HOOK:eU(eW),GIT_COMMIT_MSG:eU(eJ),SIMPLE_GIT_HOOKS_JSON:eU(eQ),PACKAGE_JSON:eU(ex),PACKAGE_LOCK_JSON:eU(eq),PNPM_LOCK_YAML:eU(eH),NODE_MODULES:eU(eV),MIGRATE_MONGO_CONFIG:eU(e$),LINT_STAGED_CONFIG:eU("".concat(eX,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eU("".concat(eX,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eU("".concat(eX,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eU("".concat(eX,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eU("".concat(eX,"/react/vitest/vitest.e2e.js"))};function tp(e){var t=e.type,n=e.packages,a=e.command;var o=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 r(function(){var e;return d(this,function(n){switch(n.label){case 0:switch(t){case k.CLI:return[3,1];case k.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,em(o,{update:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,eG(e_("".concat(ta," ").concat(a))))];case 4:return[2,eG(e_(a))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}v(tp,"buildCommand");var tS={simpleGitHooks:tp({type:k.CLI,packages:[{name:to,type:X.DEV_DEPENDENCY}],command:ts}),eslintInspect:tp({type:k.CLI,packages:[{name:ti,type:X.DEV_DEPENDENCY}],command:tc}),nodeModulesInspect:tp({type:k.CLI,packages:[{name:tu,type:X.DEV_DEPENDENCY}],command:tl}),eslintCheck:tp({type:k.CLI,packages:[{name:e0,type:X.DEV_DEPENDENCY}],command:"".concat(e1," ").concat(tf.WORKING_DIRECTORY," --no-cache")}),eslintFix:tp({type:k.CLI,packages:[{name:e0,type:X.DEV_DEPENDENCY}],command:"".concat(e1," ").concat(tf.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tp({type:k.CLI,packages:[{name:e9,type:X.DEPENDENCY}],command:"".concat(te," -p ").concat(tf.TS_CONFIG," --noEmit")}),testUnit:tp({type:k.CLI,packages:[{name:e2,type:X.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(tf.UNIT_TEST_CONFIG)}),testE2e:tp({type:k.CLI,packages:[{name:e2,type:X.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(tf.E2E_TEST_CONFIG)}),mongoMigrateCreate:v(function(e){return tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," create ").concat(e," -f ").concat(tf.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," up -f ").concat(tf.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," down -f ").concat(tf.MIGRATE_MONGO_CONFIG)}),commitLint:tp({type:k.CLI,packages:[{name:e3,type:X.DEV_DEPENDENCY},{name:e5,type:X.DEV_DEPENDENCY}],command:"".concat(e7," --edit ").concat(tf.GIT_COMMIT_MSG," --config ").concat(tf.COMMITLINT_CONFIG)}),lintStaged:tp({type:k.CLI,packages:[{name:e6,type:X.DEV_DEPENDENCY}],command:"".concat(e8," --config ").concat(tf.LINT_STAGED_CONFIG)}),configureGitHook:tp({type:k.STRING,command:"".concat(tn," config core.hooksPath ").concat(tf.GIT_HOOK)}),build:tp({type:k.STRING,command:"".concat(tr," run --if-present build")}),pnpmInstallStandard:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts")}),pnpmInstallLegacy:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts --force")})};function tm(e){return(0,g.defineConfig)(c({plugins:[(0,h.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tf.UNIT_TEST_SETUP_CONFIG]}},e))}v(tm,"vitestUnit");0&&(module.exports={vitestUnit:vitestUnit});
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,a,o,i){try{var s=e[o](i);var c=s.value}catch(e){n(e);return}if(s.done){t(c)}else{Promise.resolve(c).then(r,a)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(a,o){var i=e.apply(t,r);function s(e){n(i,a,o,s,c,"next",e)}function c(e){n(i,a,o,s,c,"throw",e)}s(undefined)})}}function a(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,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function i(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s(){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 c(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){a(e,t,n[t])})}return e}function u(e){return t(e)||i(e)||E(e)||s()}function l(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function E(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 d(e,t){var n,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=s(0),i["throw"]=s(1),i["return"]=s(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return c([e,t])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,s[0]&&(o=0)),o)try{if(n=1,r&&(a=s[0]&2?r["return"]:s[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;if(r=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:o.label++;return{value:s[1],done:false};case 5:o.label++;r=s[1];s=[0];continue;case 7:s=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){o=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(s[0]===6&&o.label<a[1]){o.label=a[1];a=s;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(s);break}if(a[2])o.ops.pop();o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e];r=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}var f=Object.create;var p=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var v=function(e,t){return p(e,"name",{value:t,configurable:!0})};var C=function(e,t){for(var n in t)p(e,n,{get:t[n],enumerable:!0})},y=function(e,t,n,r){var a=true,o=false,i=undefined;if(t&&(typeof t==="undefined"?"undefined":l(t))=="object"||typeof t=="function")try{var s=function(){var a=u.value;!O.call(e,a)&&a!==n&&p(e,a,{get:function(){return t[a]},enumerable:!(r=S(t,a))||r.enumerable})};for(var c=m(t)[Symbol.iterator](),u;!(a=(u=c.next()).done);a=true)s()}catch(e){o=true;i=e}finally{try{if(!a&&c.return!=null){c.return()}}finally{if(o){throw i}}}return e};var I=function(e,t,n){return n=e!=null?f(D(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)},N=function(e){return y(p({},"__esModule",{value:!0}),e)};var T={};C(T,{vitestUnit:function(){return tm}});module.exports=N(T);var h=I(require("@vitejs/plugin-react-swc"),1),g=require("vitest/config");var A=I(require("fs-extra"),1);var _=".cyberskill-storage";var R=I(require("@dotenvx/dotenvx"),1),G=require("envalid"),P=I(require("os"),1),M=I(require("path"),1),b=I(require("process"),1);var L=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var U=!1;function w(){b.default.env.NODE_ENV!==L.PRODUCTION&&!U&&(R.default.config(),U=!0)}v(w,"loadEnvFile");function F(){w();var e=(0,G.cleanEnv)(b.default.env,{CWD:(0,G.str)({default:b.default.cwd()}),DEBUG:(0,G.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,G.str)({default:M.default.join(P.default.homedir(),_)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}v(F,"getEnv");var k=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var Y=require("child_process"),V=I(require("process"),1),j=I(require("util"),1);var x=function(e){return e.Error="error",e.Warning="warning",e}({});var q=I(require("chalk"),1),K=I(require("consola"),1),B=require("graphql");var Q={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var H=F();H.DEBUG||(K.default.level=4);function W(e){var t=q.default[e];return typeof t=="function"?t:q.default.green}v(W,"chalkKeyword");var J={silent:K.default.silent,level:K.default.level,fatal:K.default.fatal,error:K.default.error,warn:K.default.warn,log:K.default.log,info:K.default.info,success:K.default.success,ready:K.default.ready,start:K.default.start,box:K.default.box,debug:K.default.debug,trace:K.default.trace,verbose:K.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){K.default.box(q.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,a=e.rule,o=e.message;K.default.log("".concat(q.default.gray("File:")," ").concat(q.default.blue("".concat(t).concat(r?":".concat(r):"")))),a&&K.default.log(" ".concat(W(n)("Rule:")," ").concat(a)),K.default.log(" ".concat(W(n)("Message:")," ").concat(o))}),K.default.box(W(n)("".concat(e," : ").concat(t.length))),K.default.log(q.default.gray("─".repeat(40)))}};function $(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,a=r===void 0?!0:r,i=n.returnValue,s=n.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&J.error(c.message),s&&typeof s=="function"&&s(c),i||{success:!1,message:c.message,code:Q.INTERNAL_SERVER_ERROR.CODE}}v($,"catchError");var X=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 Z=I(require("fs-extra"),1),ee=I(require("path"),1);var et=Z.default,en=et.lstatSync,er=et.readdirSync,ea=et.mkdirSync,eo=et.readFileSync,ei=et.unlinkSync,es=et.statSync,ec=Z.default.readJsonSync;function eu(e,t,n){Z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}v(eu,"writeFileSync");function el(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Z.default.pathExistsSync(e)})}v(el,"pathExistsSync");var eE=F();function ed(e){return r(function(){var t,n,r,a;return d(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,z.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=o.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,$(a)];case 4:return[2]}})})()}v(ed,"getLatestPackageVersion");function ef(e){return r(function(){var t,n,r,a,o,i,s,c,u,l,E,f,p,S,m,D,O,v,C,y,I,N,T,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(el(tf.PACKAGE_JSON)){t=ec(tf.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,a=t.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:tf.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!el(tf.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:"",file:{}}}];i=ec(tf.PACKAGE_JSON),s=i.name,c=i.version,u=c===void 0?"":c,l=i.dependencies,E=l===void 0?{}:l,f=i.devDependencies,p=f===void 0?{}:f;if(e.name===s)return[2,{success:!0,result:{name:s,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:tf.PACKAGE_JSON,file:i}}];S=e.name in E,m=e.name in p;return[4,ed(e.name)];case 1:D=d.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:"",file:{}}}];if(!S&&!m)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===X.DEPENDENCY,isDevDependency:e.type===X.DEV_DEPENDENCY,installedPath:"",file:{}}}];C=(v=(O=E[e.name])!==null&&O!==void 0?O:p[e.name])!==null&&v!==void 0?v:"",y=ew(eE.CWD,eV,e.name,ex);if(!el(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:"",file:{}}}];I=ec(y),N=I.version,T=N===void 0?"":N;return[2,C!==T?{success:!0,result:{name:e.name,currentVersion:T||C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:y,file:I}}:{success:!0,result:{name:e.name,currentVersion:C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:C===D.result,isDependency:S,isDevDependency:m,installedPath:y,file:I}}];case 2:h=d.sent();return[2,$(h)];case 3:return[2]}})})()}v(ef,"getPackage");function ep(e){return r(function(){var t,n,r,a,o;return d(this,function(i){try{;r=ec(tf.PACKAGE_JSON),a=(t=r.dependencies)!==null&&t!==void 0?t:{},o=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),eu(tf.PACKAGE_JSON,JSON.stringify(r,null,4)),J.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){$(e)}return[2]})})()}v(ep,"updatePackage");function eS(){return r(function(){var e,t,n,r,a,o,i,s,c,u,l,E,f;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,12,,13]);e=[{command:v(function(){return tS.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return tS.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(function(){return tS.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);a=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];i=o.value,s=i.command,c=i.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,s()];case 4:u=d.sent();return[4,eP("".concat(c," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();$(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:E=d.sent();n=true;r=E;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:f=d.sent();$(f);return[3,13];case 13:return[2]}})})()}v(eS,"installDependencies");function em(e,t){return r(function(){var n,r,a,o,i,s,c,l,E,f,p,S,m,D,O,v,C;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,15,,16]);if(!el(tf.PACKAGE_JSON)){J.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(ef))];case 1:a=d.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),o=a.filter(function(e){return!e.isInstalled}),i=a.filter(function(e){return!e.isUpToDate}),s=[];(t===null||t===void 0?void 0:t.install)&&o.length>0&&(n=s).push.apply(n,u(o.map(ep))),(t===null||t===void 0?void 0:t.update)&&i.length>0&&(r=s).push.apply(r,u(i.map(ep)));c=s.length>0;if(!c)return[3,6];return[4,Promise.all(s)];case 2:d.sent();return[4,eS()];case 3:d.sent();l=["Running ESLint with auto-fix"];return[4,tS.eslintFix()];case 4:return[4,eP.apply(void 0,l.concat([d.sent()]))];case 5:c=d.sent();d.label=6;case 6:c;f=true,p=false,S=undefined;d.label=7;case 7:d.trys.push([7,12,13,14]);m=((E=t===null||t===void 0?void 0:t.callbacks)!==null&&E!==void 0?E:[])[Symbol.iterator]();d.label=8;case 8:if(!!(f=(D=m.next()).done))return[3,11];O=D.value;return[4,O()];case 9:d.sent();d.label=10;case 10:f=true;return[3,8];case 11:return[3,14];case 12:v=d.sent();p=true;S=v;return[3,14];case 13:try{if(!f&&m.return!=null){m.return()}}finally{if(p){throw S}}return[7];case 14:return[3,16];case 15:C=d.sent();$(C);return[3,16];case 16:return[2]}})})()}v(em,"setupPackages");var eD=I(require("node-persist"),1);var eO=F();function ev(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:e=eD.default.defaultInstance;if(e)return[3,2];return[4,eD.default.init({dir:eO.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}v(ev,"initNodePersist");var eC={get:function e(e){return r(function(){var t,n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,eD.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,$(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ev()];case 1:r.sent();return[4,eD.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();$(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var t;return d(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,eD.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();$(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,t;return d(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ev()];case 1:n.sent();return[4,eD.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(J.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,$(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(t){try{return[2,"".concat(eO.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,$(e,{returnValue:null})]}return[2]})})()}};var ey=F(),eI=j.promisify(Y.exec);function eN(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,ef()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}v(eN,"getPackageName");function eT(e){return r(function(){var t,n;return d(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];return[4,eN()];case 1:t=a.sent();a.label=2;case 2:a.trys.push([2,4,,5]);return[4,eC.set(t,e)];case 3:a.sent(),setTimeout(function(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,eC.getLogLink(t)];case 1:e=n.sent();e&&J.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=a.sent();$(n);return[3,5];case 5:return[2]}})})()}v(eT,"saveErrorListToStorage");function eh(e){var t=[],n=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var s,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=i.exec(e)||[];var S,m,D,O,v,C;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===x.Error?x.Error:x.Warning,message:(S=d===null||d===void 0?void 0:(s=d[4])===null||s===void 0?void 0:s.trim())!==null&&S!==void 0?S:"",rule:(m=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:""}):f.length?t.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===x.Error?x.Error:x.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?t.push({file:"commitlint",type:x.Error,message:(v=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(C=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:""}):n.push(e.trim())}}),t.length&&eT(t),ey.DEBUG&&n.length&&(J.warn("Unmatched lines:"),n.forEach(function(e){return J.info(" ".concat(e))}))}v(eh,"parseTextErrors");function eg(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,a=e.line,o=e.column,i=e.ruleId,s=e.message;n.push({type:r===2?x.Error:x.Warning,file:t,position:"".concat(a,":").concat(o),rule:i,message:s})})}),n.length&&eT(n)}catch(t){eh(e)}}v(eg,"parseCommandOutput");function eA(e){return r(function(e){var t,n,r,a,o,i,s,c,u;var l=arguments;return d(this,function(E){switch(E.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eg;n=new AbortController;V.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),V.default.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eI(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&t(e)});E.label=3;case 3:return[3,5];case 4:i=E.sent();s=i.stdout,c=i.stderr,u=i.message;[s,c].forEach(function(e){return e&&t(e)}),!c&&!s&&J.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}v(eA,"executeCommand");function e_(e){return{raw:!0,cmd:e}}v(e_,"rawCommand");function eR(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ta," ").concat(tt," ").concat(eZ," ").concat(e):"".concat(ta," ").concat(ez," ").concat(e)}v(eR,"formatCLI");function eG(e,t){return typeof e=="function"?eR(e(t),t):(typeof e==="undefined"?"undefined":l(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eR(e,t):e}v(eG,"formatCommand");function eP(e,t){return r(function(){var n;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);J.start("".concat(e)),ey.DEBUG&&J.info("→ ".concat(t));return[4,eA(t)];case 1:r.sent(),J.success("".concat(e," done."));return[3,3];case 2:n=r.sent();$(n);return[3,3];case 3:return[2]}})})()}v(eP,"runCommand");var eM=I(require("path"),1);var eb=F(),eL=eM.default;function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eL).resolve.apply(r,[eb.CWD].concat(u(t)))}v(eU,"resolveWorkingPath");function ew(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eL).join.apply(r,u(t))}v(ew,"join");var eF=F(),ek=eF.CWD,eY="@cyberskill/shared",eV="node_modules",ej="dist",ex="package.json",eq="package-lock.json",eK="tsconfig.json",eB=".gitignore",eQ=".simple-git-hooks.json",eH="pnpm-lock.yaml",eW=".git/hooks/",eJ=".git/COMMIT_EDITMSG",e$=".migrate-mongo.config.js",eX=function(){var e=A.default.readJsonSync(eU(ex)).name===eY?ek:ew(ek,eV,eY);return ew(e,ej)}(),ez="cyberskill",eZ="src/node/cli/index.ts",e0="eslint",e1="eslint",e2="vitest";var e4="vitest",e3="@commitlint/cli",e5="@commitlint/config-conventional",e6="commitlint",e7="lint-staged",e8="lint-staged",e9="typescript",te="tsc",tt="tsx",tn="git",tr="pnpm",ta="pnpm exec",to="simple-git-hooks",ti="simple-git-hooks",ts="@eslint/config-inspector",tc="eslint-config-inspector",tu="node-modules-inspector",tl="node-modules-inspector",tE="migrate-mongo",td="./node_modules/migrate-mongo/bin/migrate-mongo",tf={CYBERSKILL_DIRECTORY:eX,WORKING_DIRECTORY:ek,TS_CONFIG:eU(eK),GIT_IGNORE:eU(eB),GIT_HOOK:eU(eW),GIT_COMMIT_MSG:eU(eJ),SIMPLE_GIT_HOOKS_JSON:eU(eQ),PACKAGE_JSON:eU(ex),PACKAGE_LOCK_JSON:eU(eq),PNPM_LOCK_YAML:eU(eH),NODE_MODULES:eU(eV),MIGRATE_MONGO_CONFIG:eU(e$),LINT_STAGED_CONFIG:eU("".concat(eX,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eU("".concat(eX,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eU("".concat(eX,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eU("".concat(eX,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eU("".concat(eX,"/react/vitest/vitest.e2e.js"))};function tp(e){var t=e.type,n=e.packages,a=e.command;var o=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 r(function(){var e;return d(this,function(n){switch(n.label){case 0:switch(t){case k.CLI:return[3,1];case k.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,em(o,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,eG(e_("".concat(ta," ").concat(a))))];case 4:return[2,eG(e_(a))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}v(tp,"buildCommand");var tS={simpleGitHooks:tp({type:k.CLI,packages:[{name:to,type:X.DEV_DEPENDENCY}],command:ti}),eslintInspect:tp({type:k.CLI,packages:[{name:ts,type:X.DEV_DEPENDENCY}],command:tc}),nodeModulesInspect:tp({type:k.CLI,packages:[{name:tu,type:X.DEV_DEPENDENCY}],command:tl}),eslintCheck:tp({type:k.CLI,packages:[{name:e0,type:X.DEV_DEPENDENCY}],command:"".concat(e1," ").concat(tf.WORKING_DIRECTORY," --no-cache")}),eslintFix:tp({type:k.CLI,packages:[{name:e0,type:X.DEV_DEPENDENCY}],command:"".concat(e1," ").concat(tf.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tp({type:k.CLI,packages:[{name:e9,type:X.DEPENDENCY}],command:"".concat(te," -p ").concat(tf.TS_CONFIG," --noEmit")}),testUnit:tp({type:k.CLI,packages:[{name:e2,type:X.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(tf.UNIT_TEST_CONFIG)}),testE2e:tp({type:k.CLI,packages:[{name:e2,type:X.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(tf.E2E_TEST_CONFIG)}),mongoMigrateCreate:v(function(e){return tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," create ").concat(e," -f ").concat(tf.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," up -f ").concat(tf.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tp({type:k.CLI,packages:[{name:tE,type:X.DEPENDENCY}],command:"".concat(tt," ").concat(td," down -f ").concat(tf.MIGRATE_MONGO_CONFIG)}),commitLint:tp({type:k.CLI,packages:[{name:e3,type:X.DEV_DEPENDENCY},{name:e5,type:X.DEV_DEPENDENCY}],command:"".concat(e6," --edit ").concat(tf.GIT_COMMIT_MSG," --config ").concat(tf.COMMITLINT_CONFIG)}),lintStaged:tp({type:k.CLI,packages:[{name:e7,type:X.DEV_DEPENDENCY}],command:"".concat(e8," --config ").concat(tf.LINT_STAGED_CONFIG)}),configureGitHook:tp({type:k.STRING,command:"".concat(tn," config core.hooksPath ").concat(tf.GIT_HOOK)}),build:tp({type:k.STRING,command:"".concat(tr," run --if-present build")}),pnpmInstallStandard:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts")}),pnpmInstallLegacy:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:tp({type:k.STRING,command:"".concat(tr," install --ignore-scripts --force")}),pnpmPruneStore:tp({type:k.STRING,command:"".concat(tr," store prune")}),pnpmCleanCache:tp({type:k.STRING,command:"".concat(tr," cache delete")})};function tm(e){return(0,g.defineConfig)(c({plugins:[(0,h.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tf.UNIT_TEST_SETUP_CONFIG]}},e))}v(tm,"vitestUnit");0&&(module.exports={vitestUnit:vitestUnit});
@@ -1 +1 @@
1
- function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(n){if(Array.isArray(n))return e(n)}function t(e,n,t,r,o,a,s){try{var i=e[a](s);var c=i.value}catch(e){t(e);return}if(i.done){n(c)}else{Promise.resolve(c).then(r,o)}}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,a){var s=e.apply(n,r);function i(e){t(s,o,a,i,c,"next",e)}function c(e){t(s,o,a,i,c,"throw",e)}i(undefined)})}}function o(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function a(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){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 c(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}r.forEach(function(n){o(e,n,t[n])})}return e}function u(e){return n(e)||s(e)||l(e)||i()}function E(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.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(n,t)}function d(e,n){var t,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(a=0)),a)try{if(t=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e];r=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var p=Object.defineProperty;var f=function(e,n){return p(e,"name",{value:n,configurable:!0})};import m from"@vitejs/plugin-react-swc";import{defineConfig as S}from"vitest/config";import D from"fs-extra";var O=".cyberskill-storage";import C from"@dotenvx/dotenvx";import{bool as I,cleanEnv as T,str as v}from"envalid";import N from"os";import y from"path";import A from"process";var h=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var g=!1;function _(){A.env.NODE_ENV!==h.PRODUCTION&&!g&&(C.config(),g=!0)}f(_,"loadEnvFile");function R(){_();var e=T(A.env,{CWD:v({default:A.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:v({default:y.join(N.homedir(),O)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}f(R,"getEnv");var G=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as P}from"child_process";import M from"process";import*as L from"util";var b=function(e){return e.Error="error",e.Warning="warning",e}({});import U from"chalk";import w from"consola";import{GraphQLError as F}from"graphql";var k={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var Y=R();Y.DEBUG||(w.level=4);function V(e){var n=U[e];return typeof n=="function"?n:U.green}f(V,"chalkKeyword");var x={silent:w.silent,level:w.level,fatal:w.fatal,error:w.error,warn:w.warn,log:w.log,info:w.info,success:w.success,ready:w.ready,start:w.start,box:w.box,debug:w.debug,trace:w.trace,verbose:w.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){w.box(U.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,o=e.rule,a=e.message;w.log("".concat(U.gray("File:")," ").concat(U.blue("".concat(n).concat(r?":".concat(r):"")))),o&&w.log(" ".concat(V(t)("Rule:")," ").concat(o)),w.log(" ".concat(V(t)("Message:")," ").concat(a))}),w.box(V(t)("".concat(e," : ").concat(n.length))),w.log(U.gray("─".repeat(40)))}};function j(e,n){var t=n!==null&&n!==void 0?n:{},r=t.shouldLog,o=r===void 0?!0:r,s=t.returnValue,i=t.callback,c=a(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return o&&x.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:k.INTERNAL_SERVER_ERROR.CODE}}f(j,"catchError");var K=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import B from"node-fetch";import Q from"fs-extra";import H from"path";var q=Q.lstatSync,W=Q.readdirSync,J=Q.mkdirSync,$=Q.readFileSync,X=Q.unlinkSync,z=Q.statSync,Z=Q.readJsonSync;function ee(e,n,t){Q.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}f(ee,"writeFileSync");function en(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return Q.pathExistsSync(e)})}f(en,"pathExistsSync");var et=R();function er(e){return r(function(){var n,t,r,o;return d(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,B("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=a.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=a.sent(),r=t.version;return[2,{success:!0,result:r}];case 3:o=a.sent();return[2,j(o)];case 4:return[2]}})})()}f(er,"getLatestPackageVersion");function eo(e){return r(function(){var n,t,r,o,a,s,i,c,u,E,l,p,f,m,S,D,O,C,I,T,v,N,y,A;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(en(no.PACKAGE_JSON)){n=Z(no.PACKAGE_JSON),t=n.name,r=t===void 0?"":t,o=n.version,a=o===void 0?"":o;return[2,{success:!0,result:{name:r,currentVersion:a,latestVersion:a,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:no.PACKAGE_JSON,file:n}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!en(no.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=Z(no.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,E=s.dependencies,l=E===void 0?{}:E,p=s.devDependencies,f=p===void 0?{}:p;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:no.PACKAGE_JSON,file:s}}];m=e.name in l,S=e.name in f;return[4,er(e.name)];case 1:D=d.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:"",file:{}}}];I=(C=(O=l[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&C!==void 0?C:"",T=eg(et.CWD,eP,e.name,eL);if(!en(T))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];v=Z(T),N=v.version,y=N===void 0?"":N;return[2,I!==y?{success:!0,result:{name:e.name,currentVersion:y||I,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:T,file:v}}:{success:!0,result:{name:e.name,currentVersion:I,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:I===D.result,isDependency:m,isDevDependency:S,installedPath:T,file:v}}];case 2:A=d.sent();return[2,j(A)];case 3:return[2]}})})()}f(eo,"getPackage");function ea(e){return r(function(){var n,t,r,o,a;return d(this,function(s){try{;r=Z(no.PACKAGE_JSON),o=(n=r.dependencies)!==null&&n!==void 0?n:{},a=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?o[e.name]=e.latestVersion:e.isDevDependency&&(a[e.name]=e.latestVersion),ee(no.PACKAGE_JSON,JSON.stringify(r,null,4)),x.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){j(e)}return[2]})})()}f(ea,"updatePackage");function es(){return r(function(){var e,n,t,r,o,a,s,i,c,u,E,l,p;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,12,,13]);e=[{command:f(function(){return ns.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return ns.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return ns.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(n=(a=o.next()).done))return[3,8];s=a.value,i=s.command,c=s.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,i()];case 4:u=d.sent();return[4,ev("".concat(c," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:E=d.sent();j(E);return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:l=d.sent();t=true;r=l;return[3,11];case 10:try{if(!n&&o.return!=null){o.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:p=d.sent();j(p);return[3,13];case 13:return[2]}})})()}f(es,"installDependencies");function ei(e,n){return r(function(){var t,r,o,a,s,i,c,u,E,l,p,f;return d(this,function(d){switch(d.label){case 0:if(!en(no.PACKAGE_JSON)){x.error("package.json not found. Aborting setup.");return[2]}d.label=1;case 1:d.trys.push([1,16,,17]);return[4,Promise.all(e.map(eo))];case 2:t=d.sent().filter(function(e){return e.success?!e.result.isCurrentProject&&(!e.result.isInstalled||!e.result.isUpToDate):!1});r=t.length>0;if(!r)return[3,7];return[4,Promise.all(t.map(function(e){return e.success?ea(e.result):Promise.resolve()}))];case 3:d.sent();return[4,es()];case 4:d.sent();o=["Running ESLint with auto-fix"];return[4,ns.eslintFix()];case 5:return[4,ev.apply(void 0,o.concat([d.sent()]))];case 6:r=d.sent();d.label=7;case 7:r;s=true,i=false,c=undefined;d.label=8;case 8:d.trys.push([8,13,14,15]);u=((a=n===null||n===void 0?void 0:n.postInstallActions)!==null&&a!==void 0?a:[])[Symbol.iterator]();d.label=9;case 9:if(!!(s=(E=u.next()).done))return[3,12];l=E.value;return[4,l()];case 10:d.sent();d.label=11;case 11:s=true;return[3,9];case 12:return[3,15];case 13:p=d.sent();i=true;c=p;return[3,15];case 14:try{if(!s&&u.return!=null){u.return()}}finally{if(i){throw c}}return[7];case 15:return[3,17];case 16:f=d.sent();j(f);return[3,17];case 17:return[2]}})})()}f(ei,"setupPackages");import ec from"node-persist";var eu=R();function eE(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:e=ec.defaultInstance;if(e)return[3,2];return[4,ec.init({dir:eu.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}f(eE,"initNodePersist");var el={get:function e(e){return r(function(){var n,t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eE()];case 1:r.sent();return[4,ec.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,j(t,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,n){return r(function(){var t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eE()];case 1:r.sent();return[4,ec.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();j(t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var n;return d(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eE()];case 1:t.sent();return[4,ec.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();j(n);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,n;return d(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eE()];case 1:t.sent();return[4,ec.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,j(n,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(n){try{return[2,"".concat(eu.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,j(e,{returnValue:null})]}return[2]})})()}};var ed=R(),ep=L.promisify(P);function ef(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,eo()];case 1:e=n.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}f(ef,"getPackageName");function em(e){return r(function(){var n,t;return d(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];return[4,ef()];case 1:n=o.sent();o.label=2;case 2:o.trys.push([2,4,,5]);return[4,el.set(n,e)];case 3:o.sent(),setTimeout(function(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,el.getLogLink(n)];case 1:e=t.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:t=o.sent();j(t);return[3,5];case 5:return[2]}})})()}f(em,"saveErrorListToStorage");function eS(e){var n=[],t=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,E,l;var d=o.exec(e)||[],p=a.exec(e)||[],f=s.exec(e)||[];var m,S,D,O,C,I;d.length&&r?n.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===b.Error?b.Error:b.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):p.length?n.push({file:(D=p===null||p===void 0?void 0:p[1])!==null&&D!==void 0?D:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===b.Error?b.Error:b.Warning,message:(O=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):f.length?n.push({file:"commitlint",type:b.Error,message:(C=f===null||f===void 0?void 0:(E=f[1])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:"",rule:(I=f===null||f===void 0?void 0:(l=f[2])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:""}):t.push(e.trim())}}),n.length&&em(n),ed.DEBUG&&t.length&&(x.warn("Unmatched lines:"),t.forEach(function(e){return x.info(" ".concat(e))}))}f(eS,"parseTextErrors");function eD(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,s=e.ruleId,i=e.message;t.push({type:r===2?b.Error:b.Warning,file:n,position:"".concat(o,":").concat(a),rule:s,message:i})})}),t.length&&em(t)}catch(n){eS(e)}}f(eD,"parseCommandOutput");function eO(e){return r(function(e){var n,t,r,o,a,s,i,c,u;var E=arguments;return d(this,function(l){switch(l.label){case 0:n=E.length>1&&E[1]!==void 0?E[1]:eD;t=new AbortController;M.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),t.abort(),M.exit()});l.label=1;case 1:l.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ep(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=l.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&n(e)});l.label=3;case 3:return[3,5];case 4:s=l.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&n(e)}),!c&&!i&&x.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}f(eO,"executeCommand");function eC(e){return{raw:!0,cmd:e}}f(eC,"rawCommand");function eI(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(e5," ").concat(e2," ").concat(eB," ").concat(e):"".concat(e5," ").concat(eK," ").concat(e)}f(eI,"formatCLI");function eT(e,n){return typeof e=="function"?eI(e(n),n):(typeof e==="undefined"?"undefined":E(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eI(e,n):e}f(eT,"formatCommand");function ev(e,n){return r(function(){var t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);x.start("".concat(e)),ed.DEBUG&&x.info("→ ".concat(n));return[4,eO(n)];case 1:r.sent(),x.success("".concat(e," done."));return[3,3];case 2:t=r.sent();j(t);return[3,3];case 3:return[2]}})})()}f(ev,"runCommand");import eN from"path";var ey=R(),eA=eN;function eh(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eA).resolve.apply(r,[ey.CWD].concat(u(n)))}f(eh,"resolveWorkingPath");function eg(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eA).join.apply(r,u(n))}f(eg,"join");var e_=R(),eR=e_.CWD,eG="@cyberskill/shared",eP="node_modules",eM="dist",eL="package.json",eb="package-lock.json",eU="tsconfig.json",ew=".gitignore",eF=".simple-git-hooks.json",ek="pnpm-lock.yaml",eY=".git/hooks/",eV=".git/COMMIT_EDITMSG",ex=".migrate-mongo.config.js",ej=function(){var e=D.readJsonSync(eh(eL)).name===eG?eR:eg(eR,eP,eG);return eg(e,eM)}(),eK="cyberskill",eB="src/node/cli/index.ts",eQ="eslint",eH="eslint",eq="vitest";var eW="vitest",eJ="@commitlint/cli",e$="@commitlint/config-conventional",eX="commitlint",ez="lint-staged",eZ="lint-staged",e0="typescript",e1="tsc",e2="tsx",e4="git",e3="pnpm",e5="pnpm exec",e7="simple-git-hooks",e6="simple-git-hooks",e8="@eslint/config-inspector",e9="eslint-config-inspector",ne="node-modules-inspector",nn="node-modules-inspector",nt="migrate-mongo",nr="./node_modules/migrate-mongo/bin/migrate-mongo",no={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:eR,TS_CONFIG:eh(eU),GIT_IGNORE:eh(ew),GIT_HOOK:eh(eY),GIT_COMMIT_MSG:eh(eV),SIMPLE_GIT_HOOKS_JSON:eh(eF),PACKAGE_JSON:eh(eL),PACKAGE_LOCK_JSON:eh(eb),PNPM_LOCK_YAML:eh(ek),NODE_MODULES:eh(eP),MIGRATE_MONGO_CONFIG:eh(ex),LINT_STAGED_CONFIG:eh("".concat(ej,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eh("".concat(ej,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eh("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eh("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eh("".concat(ej,"/react/vitest/vitest.e2e.js"))};function na(e){var n=e.type,t=e.packages,o=e.command;var a=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:switch(n){case G.CLI:return[3,1];case G.STRING:return[3,4]}return[3,5];case 1:e=a===null||a===void 0?void 0:a.length;if(!e)return[3,3];return[4,ei(a,{update:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,eT(eC("".concat(e5," ").concat(o))))];case 4:return[2,eT(eC(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(na,"buildCommand");var ns={simpleGitHooks:na({type:G.CLI,packages:[{name:e7,type:K.DEV_DEPENDENCY}],command:e6}),eslintInspect:na({type:G.CLI,packages:[{name:e8,type:K.DEV_DEPENDENCY}],command:e9}),nodeModulesInspect:na({type:G.CLI,packages:[{name:ne,type:K.DEV_DEPENDENCY}],command:nn}),eslintCheck:na({type:G.CLI,packages:[{name:eQ,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(no.WORKING_DIRECTORY," --no-cache")}),eslintFix:na({type:G.CLI,packages:[{name:eQ,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(no.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:na({type:G.CLI,packages:[{name:e0,type:K.DEPENDENCY}],command:"".concat(e1," -p ").concat(no.TS_CONFIG," --noEmit")}),testUnit:na({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(no.UNIT_TEST_CONFIG)}),testE2e:na({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(no.E2E_TEST_CONFIG)}),mongoMigrateCreate:f(function(e){return na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," create ").concat(e," -f ").concat(no.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," up -f ").concat(no.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," down -f ").concat(no.MIGRATE_MONGO_CONFIG)}),commitLint:na({type:G.CLI,packages:[{name:eJ,type:K.DEV_DEPENDENCY},{name:e$,type:K.DEV_DEPENDENCY}],command:"".concat(eX," --edit ").concat(no.GIT_COMMIT_MSG," --config ").concat(no.COMMITLINT_CONFIG)}),lintStaged:na({type:G.CLI,packages:[{name:ez,type:K.DEV_DEPENDENCY}],command:"".concat(eZ," --config ").concat(no.LINT_STAGED_CONFIG)}),configureGitHook:na({type:G.STRING,command:"".concat(e4," config core.hooksPath ").concat(no.GIT_HOOK)}),build:na({type:G.STRING,command:"".concat(e3," run --if-present build")}),pnpmInstallStandard:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts")}),pnpmInstallLegacy:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts --force")})};function ni(e){return S(c({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[no.UNIT_TEST_SETUP_CONFIG]}},e))}f(ni,"vitestUnit");export{ni as vitestUnit};
1
+ function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(n){if(Array.isArray(n))return e(n)}function t(e,n,t,r,o,a,s){try{var i=e[a](s);var c=i.value}catch(e){t(e);return}if(i.done){n(c)}else{Promise.resolve(c).then(r,o)}}function r(e){return function(){var n=this,r=arguments;return new Promise(function(o,a){var s=e.apply(n,r);function i(e){t(s,o,a,i,c,"next",e)}function c(e){t(s,o,a,i,c,"throw",e)}i(undefined)})}}function o(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function a(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(){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 c(e){for(var n=1;n<arguments.length;n++){var t=arguments[n]!=null?arguments[n]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}r.forEach(function(n){o(e,n,t[n])})}return e}function u(e){return n(e)||s(e)||l(e)||i()}function E(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function l(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.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(n,t)}function d(e,n){var t,r,o,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(a=0)),a)try{if(t=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:a.label++;return{value:i[1],done:false};case 5:a.label++;r=i[1];i=[0];continue;case 7:i=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){a=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(i[0]===6&&a.label<o[1]){a.label=o[1];o=i;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(i);break}if(o[2])a.ops.pop();a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e];r=0}finally{t=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var p=Object.defineProperty;var f=function(e,n){return p(e,"name",{value:n,configurable:!0})};import m from"@vitejs/plugin-react-swc";import{defineConfig as S}from"vitest/config";import D from"fs-extra";var O=".cyberskill-storage";import C from"@dotenvx/dotenvx";import{bool as I,cleanEnv as v,str as y}from"envalid";import T from"os";import N from"path";import h from"process";var A=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var g=!1;function _(){h.env.NODE_ENV!==A.PRODUCTION&&!g&&(C.config(),g=!0)}f(_,"loadEnvFile");function R(){_();var e=v(h.env,{CWD:y({default:h.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:y({default:N.join(T.homedir(),O)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}f(R,"getEnv");var G=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as P}from"child_process";import M from"process";import*as L from"util";var b=function(e){return e.Error="error",e.Warning="warning",e}({});import U from"chalk";import w from"consola";import{GraphQLError as F}from"graphql";var k={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var Y=R();Y.DEBUG||(w.level=4);function V(e){var n=U[e];return typeof n=="function"?n:U.green}f(V,"chalkKeyword");var x={silent:w.silent,level:w.level,fatal:w.fatal,error:w.error,warn:w.warn,log:w.log,info:w.info,success:w.success,ready:w.ready,start:w.start,box:w.box,debug:w.debug,trace:w.trace,verbose:w.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){w.box(U.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,o=e.rule,a=e.message;w.log("".concat(U.gray("File:")," ").concat(U.blue("".concat(n).concat(r?":".concat(r):"")))),o&&w.log(" ".concat(V(t)("Rule:")," ").concat(o)),w.log(" ".concat(V(t)("Message:")," ").concat(a))}),w.box(V(t)("".concat(e," : ").concat(n.length))),w.log(U.gray("─".repeat(40)))}};function j(e,n){var t=n!==null&&n!==void 0?n:{},r=t.shouldLog,o=r===void 0?!0:r,s=t.returnValue,i=t.callback,c=a(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return o&&x.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:k.INTERNAL_SERVER_ERROR.CODE}}f(j,"catchError");var K=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import B from"node-fetch";import Q from"fs-extra";import H from"path";var q=Q.lstatSync,W=Q.readdirSync,J=Q.mkdirSync,$=Q.readFileSync,X=Q.unlinkSync,z=Q.statSync,Z=Q.readJsonSync;function ee(e,n,t){Q.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}f(ee,"writeFileSync");function en(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return Q.pathExistsSync(e)})}f(en,"pathExistsSync");var et=R();function er(e){return r(function(){var n,t,r,o;return d(this,function(a){switch(a.label){case 0:a.trys.push([0,3,,4]);return[4,B("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=a.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=a.sent(),r=t.version;return[2,{success:!0,result:r}];case 3:o=a.sent();return[2,j(o)];case 4:return[2]}})})()}f(er,"getLatestPackageVersion");function eo(e){return r(function(){var n,t,r,o,a,s,i,c,u,E,l,p,f,m,S,D,O,C,I,v,y,T,N,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(en(no.PACKAGE_JSON)){n=Z(no.PACKAGE_JSON),t=n.name,r=t===void 0?"":t,o=n.version,a=o===void 0?"":o;return[2,{success:!0,result:{name:r,currentVersion:a,latestVersion:a,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:no.PACKAGE_JSON,file:n}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!en(no.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=Z(no.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,E=s.dependencies,l=E===void 0?{}:E,p=s.devDependencies,f=p===void 0?{}:p;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:no.PACKAGE_JSON,file:s}}];m=e.name in l,S=e.name in f;return[4,er(e.name)];case 1:D=d.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===K.DEPENDENCY,isDevDependency:e.type===K.DEV_DEPENDENCY,installedPath:"",file:{}}}];I=(C=(O=l[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&C!==void 0?C:"",v=eg(et.CWD,eP,e.name,eL);if(!en(v))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];y=Z(v),T=y.version,N=T===void 0?"":T;return[2,I!==N?{success:!0,result:{name:e.name,currentVersion:N||I,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:v,file:y}}:{success:!0,result:{name:e.name,currentVersion:I,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:I===D.result,isDependency:m,isDevDependency:S,installedPath:v,file:y}}];case 2:h=d.sent();return[2,j(h)];case 3:return[2]}})})()}f(eo,"getPackage");function ea(e){return r(function(){var n,t,r,o,a;return d(this,function(s){try{;r=Z(no.PACKAGE_JSON),o=(n=r.dependencies)!==null&&n!==void 0?n:{},a=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?o[e.name]=e.latestVersion:e.isDevDependency&&(a[e.name]=e.latestVersion),ee(no.PACKAGE_JSON,JSON.stringify(r,null,4)),x.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){j(e)}return[2]})})()}f(ea,"updatePackage");function es(){return r(function(){var e,n,t,r,o,a,s,i,c,u,E,l,p;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,12,,13]);e=[{command:f(function(){return ns.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return ns.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return ns.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(n=(a=o.next()).done))return[3,8];s=a.value,i=s.command,c=s.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,i()];case 4:u=d.sent();return[4,ey("".concat(c," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:E=d.sent();j(E);return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:l=d.sent();t=true;r=l;return[3,11];case 10:try{if(!n&&o.return!=null){o.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:p=d.sent();j(p);return[3,13];case 13:return[2]}})})()}f(es,"installDependencies");function ei(e,n){return r(function(){var t,r,o,a,s,i,c,E,l,p,f,m,S,D,O,C,I;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,15,,16]);if(!en(no.PACKAGE_JSON)){x.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(eo))];case 1:o=d.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),a=o.filter(function(e){return!e.isInstalled}),s=o.filter(function(e){return!e.isUpToDate}),i=[];(n===null||n===void 0?void 0:n.install)&&a.length>0&&(t=i).push.apply(t,u(a.map(ea))),(n===null||n===void 0?void 0:n.update)&&s.length>0&&(r=i).push.apply(r,u(s.map(ea)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:d.sent();return[4,es()];case 3:d.sent();E=["Running ESLint with auto-fix"];return[4,ns.eslintFix()];case 4:return[4,ey.apply(void 0,E.concat([d.sent()]))];case 5:c=d.sent();d.label=6;case 6:c;p=true,f=false,m=undefined;d.label=7;case 7:d.trys.push([7,12,13,14]);S=((l=n===null||n===void 0?void 0:n.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();d.label=8;case 8:if(!!(p=(D=S.next()).done))return[3,11];O=D.value;return[4,O()];case 9:d.sent();d.label=10;case 10:p=true;return[3,8];case 11:return[3,14];case 12:C=d.sent();f=true;m=C;return[3,14];case 13:try{if(!p&&S.return!=null){S.return()}}finally{if(f){throw m}}return[7];case 14:return[3,16];case 15:I=d.sent();j(I);return[3,16];case 16:return[2]}})})()}f(ei,"setupPackages");import ec from"node-persist";var eu=R();function eE(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:e=ec.defaultInstance;if(e)return[3,2];return[4,ec.init({dir:eu.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}f(eE,"initNodePersist");var el={get:function e(e){return r(function(){var n,t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eE()];case 1:r.sent();return[4,ec.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,j(t,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,n){return r(function(){var t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eE()];case 1:r.sent();return[4,ec.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();j(t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var n;return d(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eE()];case 1:t.sent();return[4,ec.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();j(n);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,n;return d(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,eE()];case 1:t.sent();return[4,ec.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,j(n,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(n){try{return[2,"".concat(eu.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,j(e,{returnValue:null})]}return[2]})})()}};var ed=R(),ep=L.promisify(P);function ef(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,eo()];case 1:e=n.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}f(ef,"getPackageName");function em(e){return r(function(){var n,t;return d(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];return[4,ef()];case 1:n=o.sent();o.label=2;case 2:o.trys.push([2,4,,5]);return[4,el.set(n,e)];case 3:o.sent(),setTimeout(function(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,el.getLogLink(n)];case 1:e=t.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:t=o.sent();j(t);return[3,5];case 5:return[2]}})})()}f(em,"saveErrorListToStorage");function eS(e){var n=[],t=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,E,l;var d=o.exec(e)||[],p=a.exec(e)||[],f=s.exec(e)||[];var m,S,D,O,C,I;d.length&&r?n.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===b.Error?b.Error:b.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):p.length?n.push({file:(D=p===null||p===void 0?void 0:p[1])!==null&&D!==void 0?D:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===b.Error?b.Error:b.Warning,message:(O=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):f.length?n.push({file:"commitlint",type:b.Error,message:(C=f===null||f===void 0?void 0:(E=f[1])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:"",rule:(I=f===null||f===void 0?void 0:(l=f[2])===null||l===void 0?void 0:l.trim())!==null&&I!==void 0?I:""}):t.push(e.trim())}}),n.length&&em(n),ed.DEBUG&&t.length&&(x.warn("Unmatched lines:"),t.forEach(function(e){return x.info(" ".concat(e))}))}f(eS,"parseTextErrors");function eD(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,a=e.column,s=e.ruleId,i=e.message;t.push({type:r===2?b.Error:b.Warning,file:n,position:"".concat(o,":").concat(a),rule:s,message:i})})}),t.length&&em(t)}catch(n){eS(e)}}f(eD,"parseCommandOutput");function eO(e){return r(function(e){var n,t,r,o,a,s,i,c,u;var E=arguments;return d(this,function(l){switch(l.label){case 0:n=E.length>1&&E[1]!==void 0?E[1]:eD;t=new AbortController;M.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),t.abort(),M.exit()});l.label=1;case 1:l.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ep(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=l.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&n(e)});l.label=3;case 3:return[3,5];case 4:s=l.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&n(e)}),!c&&!i&&x.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}f(eO,"executeCommand");function eC(e){return{raw:!0,cmd:e}}f(eC,"rawCommand");function eI(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(e5," ").concat(e2," ").concat(eB," ").concat(e):"".concat(e5," ").concat(eK," ").concat(e)}f(eI,"formatCLI");function ev(e,n){return typeof e=="function"?eI(e(n),n):(typeof e==="undefined"?"undefined":E(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eI(e,n):e}f(ev,"formatCommand");function ey(e,n){return r(function(){var t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);x.start("".concat(e)),ed.DEBUG&&x.info("→ ".concat(n));return[4,eO(n)];case 1:r.sent(),x.success("".concat(e," done."));return[3,3];case 2:t=r.sent();j(t);return[3,3];case 3:return[2]}})})()}f(ey,"runCommand");import eT from"path";var eN=R(),eh=eT;function eA(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eh).resolve.apply(r,[eN.CWD].concat(u(n)))}f(eA,"resolveWorkingPath");function eg(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=eh).join.apply(r,u(n))}f(eg,"join");var e_=R(),eR=e_.CWD,eG="@cyberskill/shared",eP="node_modules",eM="dist",eL="package.json",eb="package-lock.json",eU="tsconfig.json",ew=".gitignore",eF=".simple-git-hooks.json",ek="pnpm-lock.yaml",eY=".git/hooks/",eV=".git/COMMIT_EDITMSG",ex=".migrate-mongo.config.js",ej=function(){var e=D.readJsonSync(eA(eL)).name===eG?eR:eg(eR,eP,eG);return eg(e,eM)}(),eK="cyberskill",eB="src/node/cli/index.ts",eQ="eslint",eH="eslint",eq="vitest";var eW="vitest",eJ="@commitlint/cli",e$="@commitlint/config-conventional",eX="commitlint",ez="lint-staged",eZ="lint-staged",e0="typescript",e1="tsc",e2="tsx",e4="git",e3="pnpm",e5="pnpm exec",e6="simple-git-hooks",e7="simple-git-hooks",e8="@eslint/config-inspector",e9="eslint-config-inspector",ne="node-modules-inspector",nn="node-modules-inspector",nt="migrate-mongo",nr="./node_modules/migrate-mongo/bin/migrate-mongo",no={CYBERSKILL_DIRECTORY:ej,WORKING_DIRECTORY:eR,TS_CONFIG:eA(eU),GIT_IGNORE:eA(ew),GIT_HOOK:eA(eY),GIT_COMMIT_MSG:eA(eV),SIMPLE_GIT_HOOKS_JSON:eA(eF),PACKAGE_JSON:eA(eL),PACKAGE_LOCK_JSON:eA(eb),PNPM_LOCK_YAML:eA(ek),NODE_MODULES:eA(eP),MIGRATE_MONGO_CONFIG:eA(ex),LINT_STAGED_CONFIG:eA("".concat(ej,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eA("".concat(ej,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eA("".concat(ej,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eA("".concat(ej,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eA("".concat(ej,"/react/vitest/vitest.e2e.js"))};function na(e){var n=e.type,t=e.packages,o=e.command;var a=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:switch(n){case G.CLI:return[3,1];case G.STRING:return[3,4]}return[3,5];case 1:e=a===null||a===void 0?void 0:a.length;if(!e)return[3,3];return[4,ei(a,{install:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,ev(eC("".concat(e5," ").concat(o))))];case 4:return[2,ev(eC(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(na,"buildCommand");var ns={simpleGitHooks:na({type:G.CLI,packages:[{name:e6,type:K.DEV_DEPENDENCY}],command:e7}),eslintInspect:na({type:G.CLI,packages:[{name:e8,type:K.DEV_DEPENDENCY}],command:e9}),nodeModulesInspect:na({type:G.CLI,packages:[{name:ne,type:K.DEV_DEPENDENCY}],command:nn}),eslintCheck:na({type:G.CLI,packages:[{name:eQ,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(no.WORKING_DIRECTORY," --no-cache")}),eslintFix:na({type:G.CLI,packages:[{name:eQ,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(no.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:na({type:G.CLI,packages:[{name:e0,type:K.DEPENDENCY}],command:"".concat(e1," -p ").concat(no.TS_CONFIG," --noEmit")}),testUnit:na({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(no.UNIT_TEST_CONFIG)}),testE2e:na({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(no.E2E_TEST_CONFIG)}),mongoMigrateCreate:f(function(e){return na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," create ").concat(e," -f ").concat(no.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," up -f ").concat(no.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:na({type:G.CLI,packages:[{name:nt,type:K.DEPENDENCY}],command:"".concat(e2," ").concat(nr," down -f ").concat(no.MIGRATE_MONGO_CONFIG)}),commitLint:na({type:G.CLI,packages:[{name:eJ,type:K.DEV_DEPENDENCY},{name:e$,type:K.DEV_DEPENDENCY}],command:"".concat(eX," --edit ").concat(no.GIT_COMMIT_MSG," --config ").concat(no.COMMITLINT_CONFIG)}),lintStaged:na({type:G.CLI,packages:[{name:ez,type:K.DEV_DEPENDENCY}],command:"".concat(eZ," --config ").concat(no.LINT_STAGED_CONFIG)}),configureGitHook:na({type:G.STRING,command:"".concat(e4," config core.hooksPath ").concat(no.GIT_HOOK)}),build:na({type:G.STRING,command:"".concat(e3," run --if-present build")}),pnpmInstallStandard:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts")}),pnpmInstallLegacy:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:na({type:G.STRING,command:"".concat(e3," install --ignore-scripts --force")}),pnpmPruneStore:na({type:G.STRING,command:"".concat(e3," store prune")}),pnpmCleanCache:na({type:G.STRING,command:"".concat(e3," cache delete")})};function ni(e){return S(c({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[no.UNIT_TEST_SETUP_CONFIG]}},e))}f(ni,"vitestUnit");export{ni as vitestUnit};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.164.0",
4
+ "version": "1.166.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -226,7 +226,7 @@
226
226
  "@apollo/client": "3.13.8",
227
227
  "@apollo/server": "4.12.1",
228
228
  "@dotenvx/dotenvx": "1.44.0",
229
- "@eddeee888/gcg-typescript-resolver-files": "0.12.0",
229
+ "@eddeee888/gcg-typescript-resolver-files": "0.12.1",
230
230
  "@eslint-react/eslint-plugin": "1.49.0",
231
231
  "@graphql-codegen/cli": "5.0.6",
232
232
  "@graphql-codegen/client-preset": "4.8.1",
@@ -266,7 +266,7 @@
266
266
  "migrate-mongo": "12.1.3",
267
267
  "modern-normalize": "3.0.1",
268
268
  "mongodb": "6.16.0",
269
- "mongoose": "8.14.3",
269
+ "mongoose": "8.15.0",
270
270
  "mongoose-aggregate-paginate-v2": "1.1.4",
271
271
  "mongoose-paginate-v2": "1.9.0",
272
272
  "next-intl": "4.1.0",
@@ -319,7 +319,7 @@
319
319
  "@types/uuid": "10.0.0",
320
320
  "@types/ws": "8.18.1",
321
321
  "@types/yargs": "17.0.33",
322
- "eslint": "9.26.0",
322
+ "eslint": "9.27.0",
323
323
  "lint-staged": "16.0.0",
324
324
  "node-modules-inspector": "0.6.8",
325
325
  "simple-git-hooks": "2.13.0"
@@ -8,7 +8,10 @@
8
8
  ":pinDevDependencies",
9
9
  "group:allNonMajor"
10
10
  ],
11
- "ignoreDeps": [
12
- "node"
13
- ]
11
+ "dockerfile": {
12
+ "enabled": false
13
+ },
14
+ "nvm": {
15
+ "enabled": false
16
+ }
14
17
  }
@@ -0,0 +1,99 @@
1
+ ## ✅ Bước 1: Tạo SSH key
2
+
3
+ Mở terminal và chạy lệnh sau:
4
+
5
+ ```bash
6
+ ssh-keygen -t ed25519 -C "địa-chỉ-email"
7
+ ```
8
+
9
+ - Khi được hỏi "Enter a file in which to save the key", nhấn `Enter` để dùng mặc định (`~/.ssh/id_ed25519`)
10
+
11
+ > ⚠️ Lưu ý:
12
+
13
+ - Có thể đặt passphrase để tăng độ bảo mật (hoặc để trống nếu muốn nhanh)
14
+ - Nên thêm hậu tố để tránh trùng lặp đối với trường hợp dùng nhiều dự án/tài khoản, ví dụ `~/.ssh/id_ed25519_stephen_cyberskill` hoặc `~/.ssh/id_ed25519_project_xxx`
15
+
16
+ ## ✅ Bước 2: Khởi động SSH Agent
17
+
18
+ ```bash
19
+ eval "$(ssh-agent -s)"
20
+ ```
21
+
22
+ ## ✅ Bước 3: Cấu hình SSH cho GitHub
23
+
24
+ Tạo và sửa file cấu hình SSH:
25
+
26
+ ```bash
27
+ touch ~/.ssh/config
28
+ nano ~/.ssh/config
29
+ ```
30
+
31
+ Thêm nội dung sau:
32
+
33
+ ```ssh
34
+ Host github.com
35
+ User git
36
+ UseKeychain yes
37
+ HostName github.com
38
+ AddKeysToAgent yes
39
+ IdentitiesOnly yes
40
+ IdentityFile ~/.ssh/id_ed25519
41
+ ```
42
+
43
+ > ⚠️ Lưu ý:
44
+
45
+ - `User git` có thể không cần để, trừ một số trường hợp đặc biệt như kết nối với google cloud VM, ví dụ `User stephen.cheng` và `HostName xxx.xxx.xxx.xxx` là địa chỉ IP của server
46
+ - `UseKeychain yes` chỉ áp dụng cho macOS, nếu dùng Linux/Windows thì không cần cấu hình này.
47
+ - Trường hợp dùng nhiều tài khoản có thể tạo nhiều Host với IdentityFile và Host khác nhau, ví dụ `Host github.com` và `IdentityFile ~/.ssh/id_ed25519` khi dùng các dự án cá nhân, `Host github.com-cyberskill` và `IdentityFile ~/.ssh/id_ed25519_cyberskill` khi dùng các dự án cyberskill
48
+
49
+ Lưu và thoát (`Ctrl + X`, nhấn `Y`, rồi `Enter`).
50
+
51
+ ## ✅ Bước 4: Thêm SSH key vào GitHub
52
+
53
+ Hiển thị public key:
54
+
55
+ ```bash
56
+ cat ~/.ssh/id_ed25519.pub
57
+ ```
58
+
59
+ Copy toàn bộ nội dung và vào [GitHub SSH Keys Settings](https://github.com/settings/keys):
60
+
61
+ - Bấm **"New SSH key"**
62
+ - Đặt **Title** dễ nhớ (có thể dùng hậu tố ở bước 1)
63
+ - Dán public key vào phần **Key**
64
+
65
+ ## ✅ Bước 5: Kiểm tra kết nối SSH
66
+
67
+ ```bash
68
+ ssh -T git@XXX
69
+ ```
70
+
71
+ > ⚠️ Lưu ý: XXX là Host đã đặt lúc tạo file config ở bước 3, ví dụ `ssh -T git@github.com`
72
+
73
+ Nếu thành công, terminal sẽ hiển thị:
74
+
75
+ ```
76
+ Hi your-username! You've successfully authenticated, but GitHub does not provide shell access.
77
+ ```
78
+
79
+ ## ✅ Bước 6: Clone dự án
80
+
81
+ Clone dự án bằng SSH:
82
+
83
+ ```bash
84
+ git clone git@XXX:tên-người-dùng/tên-dự-án.git
85
+ ```
86
+
87
+ > ⚠️ Lưu ý:
88
+
89
+ - Tạo thư mục phù hợp trên máy và mở terminal tại thư mục đó trước khi clone dự án
90
+ - XXX là Host đã đặt lúc tạo file config ở bước 3, ví dụ `git clone git@github.com:cyberskill-world/cyberskill-example.git`
91
+
92
+ ## 🛠 Tuỳ chọn: Cấu hình tên và email
93
+
94
+ ```bash
95
+ git config --global user.name "Tên hiển thị"
96
+ git config --global user.email "địa-chỉ-email"
97
+ ```
98
+
99
+ > ⚠️ Lưu ý: `--global` sẽ áp dụng mặc định cho toàn bộ dự án trong máy (kể cả các dự án sau này), nếu muốn dùng riêng cho từng dự án thì mở terminal tại vị trí dự án rồi chạy lệnh nhưng không để cấu hình `--global`, ví dụ `git config user.name "Stephen Cheng"`
@@ -0,0 +1,29 @@
1
+ ## ✅ Bước 1: Cài đặt mongo 8.0 (Ubuntu 24.04)
2
+
3
+ ```
4
+ sudo apt-get install gnupg curl
5
+ ```
6
+
7
+ ```
8
+ curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
9
+ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
10
+ --dearmor
11
+ ```
12
+
13
+ ```
14
+ echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
15
+ ```
16
+
17
+ ```
18
+ sudo apt-get update
19
+ ```
20
+
21
+ ```
22
+ sudo apt-get install -y mongodb-org
23
+ ```
24
+
25
+ ## ✅ Bước 2: Chạy mongo
26
+
27
+ ```
28
+ sudo systemctl start mongod
29
+ ```
@@ -0,0 +1,55 @@
1
+ ## ✅ Bước 1: Cài đặt homebrew (nếu chưa cài)
2
+
3
+ ```
4
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5
+ ```
6
+
7
+ ## ✅ Bước 2: Cài đặt nginx
8
+
9
+ ```
10
+ brew install nginx
11
+ ```
12
+
13
+ ## ✅ Bước 3: Cấu hình nginx
14
+
15
+ ```
16
+ cd $HOMEBREW_PREFIX/etc/nginx
17
+ ```
18
+
19
+ ```
20
+ nano nginx.conf
21
+ ```
22
+
23
+ Thiết lập cấu hình
24
+
25
+ ```
26
+ server {
27
+ listen port-sẽ-chạy;
28
+ server_name địa-chỉ-ip;
29
+
30
+ location / {
31
+ proxy_pass http://localhost:port-sẽ-chạy;
32
+ proxy_http_version 1.1;
33
+ proxy_set_header Upgrade $http_upgrade;
34
+ proxy_set_header Connection 'upgrade';
35
+ proxy_set_header Host $host;
36
+ proxy_cache_bypass $http_upgrade;
37
+ }
38
+ }
39
+ ```
40
+
41
+ ## ✅ Bước 4: Kiểm tra cấu hình
42
+
43
+ ```
44
+ nginx -t
45
+ ```
46
+
47
+ Nếu hiện như sau là cấu hình ok
48
+ `nginx: the configuration file /home/linuxbrew/.linuxbrew/etc/nginx/nginx.conf syntax is ok`
49
+ `nginx: configuration file /home/linuxbrew/.linuxbrew/etc/nginx/nginx.conf test is successful`
50
+
51
+ ## ✅ Bước 4: Khởi động lại nginx với cấu hình mới
52
+
53
+ ```
54
+ nginx -s reload
55
+ ```
@@ -0,0 +1,29 @@
1
+ ## ✅ Bước 1: Cài đặt homebrew (nếu chưa cài)
2
+
3
+ ```
4
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5
+ ```
6
+
7
+ ## ✅ Bước 2: Cài đặt nvm
8
+
9
+ ```
10
+ brew install nvm
11
+ ```
12
+
13
+ Thêm đoạn script dưới đây vào `~/.profile` hoặc `~/.zshrc`
14
+
15
+ ```
16
+ export NVM_DIR="$HOME/.nvm"
17
+ [ -s "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh" ] && \. "/home/linuxbrew/.linuxbrew/opt/nvm/nvm.sh" # This loads nvm
18
+ [ -s "/home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/home/linuxbrew/.linuxbrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
19
+ ```
20
+
21
+ Tắt mở lại terminal hoặc chạy lệnh `source ~/.profile` hoặc `source ~/.zshrc`
22
+
23
+ ## ✅ Bước 3: Cài đặt phiên bản node tương ứng
24
+
25
+ ```
26
+ nvm install phiên-bản-node
27
+ ```
28
+
29
+ > ⚠️ Lưu ý: ví dụ `nvm install 22.15.0`
@@ -0,0 +1,27 @@
1
+ ## ✅ Bước 1: Cài đặt node (nếu chưa cài)
2
+
3
+ [Xem tại đây](./setup-node.md)
4
+
5
+ ## ✅ Bước 2: Cài đặt pm2
6
+
7
+ ```
8
+ npm install pm2 -g
9
+ ```
10
+
11
+ ## ✅ Bước 3: Chạy pm2
12
+
13
+ Chạy bằng node mặc định
14
+
15
+ ```
16
+ pm2 start tên-file.js --name tên-app
17
+ ```
18
+
19
+ > ⚠️ Lưu ý: ví dụ `pm2 start index.js --name cyberskill-example`
20
+
21
+ Đối với dự án có script chạy từ package.json
22
+
23
+ ```
24
+ pm2 start pnpm --name tên-app -- run tên-script-chạy
25
+ ```
26
+
27
+ > ⚠️ Lưu ý: ví dụ `pm2 start pnpm --name cyberskill-example -- run start`
@@ -0,0 +1,17 @@
1
+ ## ✅ Bước 1: Cài đặt homebrew (nếu chưa cài)
2
+
3
+ ```
4
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5
+ ```
6
+
7
+ ## ✅ Bước 2: Cài đặt redis
8
+
9
+ ```
10
+ brew install redis
11
+ ```
12
+
13
+ ## ✅ Bước 3: Chạy redis
14
+
15
+ ```
16
+ brew services start redis
17
+ ```