@cyberskill/shared 1.176.0 → 1.178.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 (64) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +4 -21
  2. package/dist/_tsup-dts-rollup.d.ts +4 -21
  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.d.cts +0 -1
  7. package/dist/config/index.d.ts +0 -1
  8. package/dist/config/index.js +1 -1
  9. package/dist/config/vitest/index.cjs +1 -1
  10. package/dist/config/vitest/index.d.cts +0 -1
  11. package/dist/config/vitest/index.d.ts +0 -1
  12. package/dist/config/vitest/index.js +1 -1
  13. package/dist/config/vitest/vitest.unit.cjs +1 -1
  14. package/dist/config/vitest/vitest.unit.js +1 -1
  15. package/dist/node/cli/cli.util.cjs +1 -1
  16. package/dist/node/cli/cli.util.js +1 -1
  17. package/dist/node/cli/index.cjs +1 -1
  18. package/dist/node/cli/index.js +1 -1
  19. package/dist/node/command/command.util.cjs +1 -1
  20. package/dist/node/command/command.util.js +1 -1
  21. package/dist/node/command/index.cjs +1 -1
  22. package/dist/node/command/index.js +1 -1
  23. package/dist/node/index.cjs +1 -1
  24. package/dist/node/index.d.cts +0 -1
  25. package/dist/node/index.d.ts +0 -1
  26. package/dist/node/index.js +1 -1
  27. package/dist/node/mongo/index.cjs +1 -1
  28. package/dist/node/mongo/index.d.cts +0 -1
  29. package/dist/node/mongo/index.d.ts +0 -1
  30. package/dist/node/mongo/index.js +1 -1
  31. package/dist/node/mongo/mongo.type.d.cts +0 -1
  32. package/dist/node/mongo/mongo.type.d.ts +0 -1
  33. package/dist/node/mongo/mongo.util.cjs +1 -1
  34. package/dist/node/mongo/mongo.util.js +1 -1
  35. package/dist/node/package/index.cjs +1 -1
  36. package/dist/node/package/index.js +1 -1
  37. package/dist/node/package/package.util.cjs +1 -1
  38. package/dist/node/package/package.util.js +1 -1
  39. package/dist/node/path/index.cjs +1 -1
  40. package/dist/node/path/index.js +1 -1
  41. package/dist/node/path/path.constant.cjs +1 -1
  42. package/dist/node/path/path.constant.js +1 -1
  43. package/package.json +12 -23
  44. package/dist/config/vitest/storybook/index.cjs +0 -1
  45. package/dist/config/vitest/storybook/index.d.cts +0 -1
  46. package/dist/config/vitest/storybook/index.d.ts +0 -1
  47. package/dist/config/vitest/storybook/index.js +0 -1
  48. package/dist/config/vitest/storybook/nextjs/index.cjs +0 -1
  49. package/dist/config/vitest/storybook/nextjs/index.d.cts +0 -1
  50. package/dist/config/vitest/storybook/nextjs/index.d.ts +0 -1
  51. package/dist/config/vitest/storybook/nextjs/index.js +0 -1
  52. package/dist/config/vitest/storybook/nextjs/main.cjs +0 -1
  53. package/dist/config/vitest/storybook/nextjs/main.d.cts +0 -1
  54. package/dist/config/vitest/storybook/nextjs/main.d.ts +0 -1
  55. package/dist/config/vitest/storybook/nextjs/main.js +0 -1
  56. package/dist/config/vitest/storybook/nextjs/preview.cjs +0 -1
  57. package/dist/config/vitest/storybook/nextjs/preview.d.cts +0 -1
  58. package/dist/config/vitest/storybook/nextjs/preview.d.ts +0 -1
  59. package/dist/config/vitest/storybook/nextjs/preview.js +0 -1
  60. package/dist/config/vitest/storybook/nextjs/vitest.setup.cjs +0 -1
  61. package/dist/config/vitest/storybook/nextjs/vitest.setup.d.cts +0 -1
  62. package/dist/config/vitest/storybook/nextjs/vitest.setup.d.ts +0 -1
  63. package/dist/config/vitest/storybook/nextjs/vitest.setup.js +0 -1
  64. package/public/renovate.base.json +0 -10
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(t){if(Array.isArray(t))return e(t)}function n(e,t,n,r,o,a,s){try{var i=e[a](s);var c=i.value}catch(e){n(e);return}if(i.done){t(c)}else{Promise.resolve(c).then(r,o)}}function r(e){return function(){var t=this,r=arguments;return new Promise(function(o,a){var s=e.apply(t,r);function i(e){n(s,o,a,i,c,"next",e)}function c(e){n(s,o,a,i,c,"throw",e)}i(undefined)})}}function o(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 a(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){o(e,t,n[t])})}return e}function u(e){return t(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(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,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(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(a=0)),a)try{if(n=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=t.call(e,a)}catch(e){i=[6,e];r=0}finally{n=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,t){return p(e,"name",{value:t,configurable:!0})};import{storybookTest as m}from"@storybook/addon-vitest/vitest-plugin";import{defineConfig as S}from"vitest/config";import D from"fs-extra";var O=".cyberskill-storage";import C from"@dotenvx/dotenvx";import{bool as T,cleanEnv as I,str as v}from"envalid";import y from"os";import N from"path";import g from"process";var h=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var _=!1;function A(){g.env.NODE_ENV!==h.PRODUCTION&&!_&&(C.config(),_=!0)}f(A,"loadEnvFile");function R(){A();var e=I(g.env,{CWD:v({default:g.cwd()}),DEBUG:T({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:v({default:N.join(y.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 b from"util";var L=function(e){return e.Error="error",e.Warning="warning",e}({});import U from"chalk";import w from"consola";import{GraphQLError as k}from"graphql";var F={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 V=R();V.DEBUG||(w.level=4);function Y(e){var t=U[e];return typeof t=="function"?t:U.green}f(Y,"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,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){w.box(U.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,a=e.message;w.log("".concat(U.gray("File:")," ").concat(U.blue("".concat(t).concat(r?":".concat(r):"")))),o&&w.log(" ".concat(Y(n)("Rule:")," ").concat(o)),w.log(" ".concat(Y(n)("Message:")," ").concat(a))}),w.box(Y(n)("".concat(e," : ").concat(t.length))),w.log(U.gray("─".repeat(40)))}};function j(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,o=r===void 0?!0:r,s=n.returnValue,i=n.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:F.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 q from"path";var H=Q.lstatSync,J=Q.readdirSync,W=Q.mkdirSync,X=Q.readFileSync,$=Q.unlinkSync,z=Q.statSync,Z=Q.readJsonSync;function ee(e,t,n){Q.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}f(ee,"writeFileSync");function et(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return Q.pathExistsSync(e)})}f(et,"pathExistsSync");var en=R();function er(e){return r(function(){var t,n,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:t=a.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=a.sent(),r=n.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 t,n,r,o,a,s,i,c,u,E,l,p,f,m,S,D,O,C,T,I,v,y,N,g;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(et(ta.PACKAGE_JSON)){t=Z(ta.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,o=t.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:ta.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(!et(ta.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(ta.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:ta.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:{}}}];T=(C=(O=l[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&C!==void 0?C:"",I=e_(en.CWD,eP,e.name,eL);if(!et(I))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(I),y=v.version,N=y===void 0?"":y;return[2,T!==N?{success:!0,result:{name:e.name,currentVersion:N||T,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:I,file:v}}:{success:!0,result:{name:e.name,currentVersion:T,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:T===D.result,isDependency:m,isDevDependency:S,installedPath:I,file:v}}];case 2:g=d.sent();return[2,j(g)];case 3:return[2]}})})()}f(eo,"getPackage");function ea(e){return r(function(){var t,n,r,o,a;return d(this,function(s){try{;r=Z(ta.PACKAGE_JSON),o=(t=r.dependencies)!==null&&t!==void 0?t:{},a=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?o[e.name]=e.latestVersion:e.isDevDependency&&(a[e.name]=e.latestVersion),ee(ta.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,t,n,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 ti.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return ti.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return ti.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]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(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:t=true;return[3,2];case 8:return[3,11];case 9:l=d.sent();n=true;r=l;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){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,t){return r(function(){var n,r,o,a,s,i,c,E,l,p,f,m,S,D,O,C,T;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,15,,16]);if(!et(ta.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=[];(t===null||t===void 0?void 0:t.install)&&a.length>0&&(n=i).push.apply(n,u(a.map(ea))),(t===null||t===void 0?void 0:t.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,ti.eslintFix()];case 4:return[4,ev.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=t===null||t===void 0?void 0:t.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:T=d.sent();j(T);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(t){switch(t.label){case 0:e=ec.defaultInstance;if(e)return[3,2];return[4,ec.init({dir:eu.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}f(eE,"initNodePersist");var el={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,eE()];case 1:r.sent();return[4,ec.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,j(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,eE()];case 1:r.sent();return[4,ec.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();j(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,eE()];case 1:n.sent();return[4,ec.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();j(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,eE()];case 1:n.sent();return[4,ec.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(x.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,j(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(t){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=b.promisify(P);function ef(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:return[4,eo()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}f(ef,"getPackageName");function em(e){return r(function(){var t,n;return d(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];return[4,ef()];case 1:t=o.sent();o.label=2;case 2:o.trys.push([2,4,,5]);return[4,el.set(t,e)];case 3:o.sent(),setTimeout(function(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,el.getLogLink(t)];case 1:e=n.sent();e&&x.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=o.sent();j(n);return[3,5];case 5:return[2]}})})()}f(em,"saveErrorListToStorage");function eS(e){var t=[],n=[],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,T;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===L.Error?L.Error:L.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?t.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]===L.Error?L.Error:L.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?t.push({file:"commitlint",type:L.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:(T=f===null||f===void 0?void 0:(l=f[2])===null||l===void 0?void 0:l.trim())!==null&&T!==void 0?T:""}):n.push(e.trim())}}),t.length&&em(t),ed.DEBUG&&n.length&&(x.warn("Unmatched lines:"),n.forEach(function(e){return x.info(" ".concat(e))}))}f(eS,"parseTextErrors");function eD(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,o=e.line,a=e.column,s=e.ruleId,i=e.message;n.push({type:r===2?L.Error:L.Warning,file:t,position:"".concat(o,":").concat(a),rule:s,message:i})})}),n.length&&em(n)}catch(t){eS(e)}}f(eD,"parseCommandOutput");function eO(e){return r(function(e){var t,n,r,o,a,s,i,c,u;var E=arguments;return d(this,function(l){switch(l.label){case 0:t=E.length>1&&E[1]!==void 0?E[1]:eD;n=new AbortController;M.on("SIGINT",function(){x.warn("Process interrupted. Terminating..."),n.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:n.signal})];case 2:r=l.sent(),o=r.stdout,a=r.stderr;[o,a].forEach(function(e){return e&&t(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&&t(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 eT(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e6," ").concat(e4," ").concat(eQ," ").concat(e):"".concat(e6," ").concat(eB," ").concat(e)}f(eT,"formatCLI");function eI(e,t){return typeof e=="function"?eT(e(t),t):(typeof e==="undefined"?"undefined":E(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eT(e,t):e}f(eI,"formatCommand");function ev(e,t){return r(function(){var n;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(t));return[4,eO(t)];case 1:r.sent(),x.success("".concat(e," done."));return[3,3];case 2:n=r.sent();j(n);return[3,3];case 3:return[2]}})})()}f(ev,"runCommand");import ey from"path";var eN=R(),eg=ey;function eh(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eg).resolve.apply(r,[eN.CWD].concat(u(t)))}f(eh,"resolveWorkingPath");function e_(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=eg).join.apply(r,u(t))}f(e_,"join");var eA=R(),eR=eA.CWD,eG="@cyberskill/shared",eP="node_modules",eM="dist",eb="public",eL="package.json",eU="package-lock.json",ew="tsconfig.json",ek=".gitignore",eF=".simple-git-hooks.json",eV="pnpm-lock.yaml",eY=".git/hooks/",ex=".git/COMMIT_EDITMSG",ej=".migrate-mongo.config.js",eK=function(){var e=D.readJsonSync(eh(eL)).name===eG?eR:e_(eR,eP,eG);return e_(e,eM)}(),eB="cyberskill",eQ="src/node/cli/index.ts",eq="eslint",eH="eslint",eJ="vitest";var eW="vitest",eX="@commitlint/cli",e$="@commitlint/config-conventional",ez="commitlint",eZ="lint-staged",e0="lint-staged",e1="typescript",e2="tsc",e4="tsx",e3="git",e5="pnpm",e6="pnpm exec",e7="simple-git-hooks",e8="simple-git-hooks",e9="@eslint/config-inspector",te="eslint-config-inspector",tt="node-modules-inspector",tn="node-modules-inspector",tr="migrate-mongo",to="./node_modules/migrate-mongo/bin/migrate-mongo",ta={CYBERSKILL_DIRECTORY:eK,WORKING_DIRECTORY:eR,PUBLIC_DIRECTORY:eh(eb),TS_CONFIG:eh(ew),GIT_IGNORE:eh(ek),GIT_HOOK:eh(eY),GIT_COMMIT_MSG:eh(ex),SIMPLE_GIT_HOOKS_JSON:eh(eF),PACKAGE_JSON:eh(eL),PACKAGE_LOCK_JSON:eh(eU),PNPM_LOCK_YAML:eh(eV),NODE_MODULES:eh(eP),MIGRATE_MONGO_CONFIG:eh(ej),LINT_STAGED_CONFIG:eh("".concat(eK,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eh("".concat(eK,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eh("".concat(eK,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eh("".concat(eK,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eh("".concat(eK,"/config/vitest/vitest.e2e.js")),VITEST_STORYBOOK_NEXTJS:eh("".concat(eK,"/config/vitest/storybook/nextjs")),VITEST_STORYBOOK_NEXTJS_CONFIG:eh("".concat(eK,"/config/vitest/storybook/nextjs/index.js"))};function ts(e){var t=e.type,n=e.packages,o=e.command;var a=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 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=n.sent();n.label=3;case 3:return[2,(e,eI(eC("".concat(e6," ").concat(o))))];case 4:return[2,eI(eC(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(ts,"buildCommand");var ti={simpleGitHooks:ts({type:G.CLI,packages:[{name:e7,type:K.DEV_DEPENDENCY}],command:e8}),eslintInspect:ts({type:G.CLI,packages:[{name:e9,type:K.DEV_DEPENDENCY}],command:te}),nodeModulesInspect:ts({type:G.CLI,packages:[{name:tt,type:K.DEV_DEPENDENCY}],command:tn}),eslintCheck:ts({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(ta.WORKING_DIRECTORY," --no-cache")}),eslintFix:ts({type:G.CLI,packages:[{name:eq,type:K.DEV_DEPENDENCY}],command:"".concat(eH," ").concat(ta.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:ts({type:G.CLI,packages:[{name:e1,type:K.DEPENDENCY}],command:"".concat(e2," -p ").concat(ta.TS_CONFIG," --noEmit")}),testUnit:ts({type:G.CLI,packages:[{name:eJ,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(ta.VITEST_UNIT_CONFIG)}),testE2e:ts({type:G.CLI,packages:[{name:eJ,type:K.DEV_DEPENDENCY}],command:"".concat(eW," --config ").concat(ta.VITEST_E2E_CONFIG)}),mongoMigrateCreate:f(function(e){return ts({type:G.CLI,packages:[{name:tr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(to," create ").concat(e," -f ").concat(ta.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:ts({type:G.CLI,packages:[{name:tr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(to," up -f ").concat(ta.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:ts({type:G.CLI,packages:[{name:tr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(to," down -f ").concat(ta.MIGRATE_MONGO_CONFIG)}),commitLint:ts({type:G.CLI,packages:[{name:eX,type:K.DEV_DEPENDENCY},{name:e$,type:K.DEV_DEPENDENCY}],command:"".concat(ez," --edit ").concat(ta.GIT_COMMIT_MSG," --config ").concat(ta.COMMITLINT_CONFIG)}),lintStaged:ts({type:G.CLI,packages:[{name:eZ,type:K.DEV_DEPENDENCY}],command:"".concat(e0," --config ").concat(ta.LINT_STAGED_CONFIG)}),configureGitHook:ts({type:G.STRING,command:"".concat(e3," config core.hooksPath ").concat(ta.GIT_HOOK)}),build:ts({type:G.STRING,command:"".concat(e5," run --if-present build")}),pnpmInstallStandard:ts({type:G.STRING,command:"".concat(e5," install --ignore-scripts")}),pnpmInstallLegacy:ts({type:G.STRING,command:"".concat(e5," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:ts({type:G.STRING,command:"".concat(e5," install --ignore-scripts --force")}),pnpmPruneStore:ts({type:G.STRING,command:"".concat(e5," store prune")}),pnpmCleanCache:ts({type:G.STRING,command:"".concat(e5," cache delete")})};function tc(){return S({test:{workspace:[{extends:!0,plugins:[m({configDir:ta.VITEST_STORYBOOK_NEXTJS})],test:{name:"storybook",browser:{enabled:!0,headless:!0,provider:"playwright",instances:[{browser:"chromium"}]},setupFiles:[ta.VITEST_UNIT_SETUP_CONFIG]}}]}})}f(tc,"vitestStorybookNextJS");import tu from"@vitejs/plugin-react-swc";import{defineConfig as tE}from"vitest/config";function tl(e){return tE(c({plugins:[tu()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}f(tl,"vitestE2E");import td from"@vitejs/plugin-react-swc";import{defineConfig as tp}from"vitest/config";function tf(e){return tp(c({plugins:[td()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[ta.VITEST_UNIT_SETUP_CONFIG]}},e))}f(tf,"vitestUnit");export{tl as vitestE2E,tc as vitestStorybookNextJS,tf 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";function D(e){return S(c({plugins:[m()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}f(D,"vitestE2E");import O from"@vitejs/plugin-react-swc";import{defineConfig as C}from"vitest/config";import I from"fs-extra";var v=".cyberskill-storage";import T from"@dotenvx/dotenvx";import{bool as y,cleanEnv as N,str as h}from"envalid";import g from"os";import A from"path";import _ from"process";var R=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var G=!1;function P(){_.env.NODE_ENV!==R.PRODUCTION&&!G&&(T.config(),G=!0)}f(P,"loadEnvFile");function M(){P();var e=N(_.env,{CWD:h({default:_.cwd()}),DEBUG:y({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:h({default:A.join(g.homedir(),v)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}f(M,"getEnv");var b=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as L}from"child_process";import U from"process";import*as w from"util";var F=function(e){return e.Error="error",e.Warning="warning",e}({});import k from"chalk";import V from"consola";import{GraphQLError as Y}from"graphql";var x={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 j=M();j.DEBUG||(V.level=4);function K(e){var n=k[e];return typeof n=="function"?n:k.green}f(K,"chalkKeyword");var B={silent:V.silent,level:V.level,fatal:V.fatal,error:V.error,warn:V.warn,log:V.log,info:V.info,success:V.success,ready:V.ready,start:V.start,box:V.box,debug:V.debug,trace:V.trace,verbose:V.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)){V.box(k.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,o=e.rule,a=e.message;V.log("".concat(k.gray("File:")," ").concat(k.blue("".concat(n).concat(r?":".concat(r):"")))),o&&V.log(" ".concat(K(t)("Rule:")," ").concat(o)),V.log(" ".concat(K(t)("Message:")," ").concat(a))}),V.box(K(t)("".concat(e," : ").concat(n.length))),V.log(k.gray("─".repeat(40)))}};function Q(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&&B.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:x.INTERNAL_SERVER_ERROR.CODE}}f(Q,"catchError");var H=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import q from"node-fetch";import W from"fs-extra";import J from"path";var $=W.lstatSync,X=W.readdirSync,z=W.mkdirSync,Z=W.readFileSync,ee=W.unlinkSync,en=W.statSync,et=W.readJsonSync;function er(e,n,t){W.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}f(er,"writeFileSync");function eo(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return W.pathExistsSync(e)})}f(eo,"pathExistsSync");var ea=M();function es(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,q("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,Q(o)];case 4:return[2]}})})()}f(es,"getLatestPackageVersion");function ei(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,T,y,N,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(eo(nc.PACKAGE_JSON)){n=et(nc.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:nc.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(!eo(nc.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===H.DEPENDENCY,isDevDependency:e.type===H.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=et(nc.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===H.DEPENDENCY,isDevDependency:e.type===H.DEV_DEPENDENCY,installedPath:nc.PACKAGE_JSON,file:s}}];m=e.name in l,S=e.name in f;return[4,es(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===H.DEPENDENCY,isDevDependency:e.type===H.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(ea.CWD,eL,e.name,eF);if(!eo(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:{}}}];T=et(v),y=T.version,N=y===void 0?"":y;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:T}}:{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:T}}];case 2:h=d.sent();return[2,Q(h)];case 3:return[2]}})})()}f(ei,"getPackage");function ec(e){return r(function(){var n,t,r,o,a;return d(this,function(s){try{;r=et(nc.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),er(nc.PACKAGE_JSON,JSON.stringify(r,null,4)),B.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){Q(e)}return[2]})})()}f(ec,"updatePackage");function eu(){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 nE.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return nE.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return nE.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,eh("".concat(c," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:E=d.sent();Q(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();Q(p);return[3,13];case 13:return[2]}})})()}f(eu,"installDependencies");function eE(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(!eo(nc.PACKAGE_JSON)){B.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(ei))];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(ec))),(n===null||n===void 0?void 0:n.update)&&s.length>0&&(r=i).push.apply(r,u(s.map(ec)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:d.sent();return[4,eu()];case 3:d.sent();E=["Running ESLint with auto-fix"];return[4,nE.eslintFix()];case 4:return[4,eh.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();Q(I);return[3,16];case 16:return[2]}})})()}f(eE,"setupPackages");import el from"node-persist";var ed=M();function ep(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:e=el.defaultInstance;if(e)return[3,2];return[4,el.init({dir:ed.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}f(ep,"initNodePersist");var ef={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,ep()];case 1:r.sent();return[4,el.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,Q(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,ep()];case 1:r.sent();return[4,el.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();Q(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,ep()];case 1:t.sent();return[4,el.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();Q(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,ep()];case 1:t.sent();return[4,el.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(B.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,Q(n,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(n){try{return[2,"".concat(ed.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,Q(e,{returnValue:null})]}return[2]})})()}};var em=M(),eS=w.promisify(L);function eD(){return r(function(){var e;return d(this,function(n){switch(n.label){case 0:return[4,ei()];case 1:e=n.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}f(eD,"getPackageName");function eO(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,eD()];case 1:n=o.sent();o.label=2;case 2:o.trys.push([2,4,,5]);return[4,ef.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,ef.getLogLink(n)];case 1:e=t.sent();e&&B.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:t=o.sent();Q(t);return[3,5];case 5:return[2]}})})()}f(eO,"saveErrorListToStorage");function eC(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]===F.Error?F.Error:F.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]===F.Error?F.Error:F.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:F.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&&eO(n),em.DEBUG&&t.length&&(B.warn("Unmatched lines:"),t.forEach(function(e){return B.info(" ".concat(e))}))}f(eC,"parseTextErrors");function eI(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?F.Error:F.Warning,file:n,position:"".concat(o,":").concat(a),rule:s,message:i})})}),t.length&&eO(t)}catch(n){eC(e)}}f(eI,"parseCommandOutput");function ev(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]:eI;t=new AbortController;U.on("SIGINT",function(){B.warn("Process interrupted. Terminating..."),t.abort(),U.exit()});l.label=1;case 1:l.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eS(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&&B.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}f(ev,"executeCommand");function eT(e){return{raw:!0,cmd:e}}f(eT,"rawCommand");function ey(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(e9," ").concat(e6," ").concat(eW," ").concat(e):"".concat(e9," ").concat(eq," ").concat(e)}f(ey,"formatCLI");function eN(e,n){return typeof e=="function"?ey(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"?ey(e,n):e}f(eN,"formatCommand");function eh(e,n){return r(function(){var t;return d(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);B.start("".concat(e)),em.DEBUG&&B.info("→ ".concat(n));return[4,ev(n)];case 1:r.sent(),B.success("".concat(e," done."));return[3,3];case 2:t=r.sent();Q(t);return[3,3];case 3:return[2]}})})()}f(eh,"runCommand");import eg from"path";var eA=M(),e_=eg;function eR(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=e_).resolve.apply(r,[eA.CWD].concat(u(n)))}f(eR,"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=e_).join.apply(r,u(n))}f(eG,"join");var eP=M(),eM=eP.CWD,eb="@cyberskill/shared",eL="node_modules",eU="dist",ew="public",eF="package.json",ek="package-lock.json",eV="tsconfig.json",eY=".gitignore",ex=".simple-git-hooks.json",ej="pnpm-lock.yaml",eK=".git/hooks/",eB=".git/COMMIT_EDITMSG",eQ=".migrate-mongo.config.js",eH=function(){var e=I.readJsonSync(eR(eF)).name===eb?eM:eG(eM,eL,eb);return eG(e,eU)}(),eq="cyberskill",eW="src/node/cli/index.ts",eJ="eslint",e$="eslint",eX="vitest";var ez="vitest",eZ="@commitlint/cli",e0="@commitlint/config-conventional",e1="commitlint",e2="lint-staged",e4="lint-staged",e3="typescript",e5="tsc",e6="tsx",e7="git",e8="pnpm",e9="pnpm exec",ne="simple-git-hooks",nn="simple-git-hooks",nt="@eslint/config-inspector",nr="eslint-config-inspector",no="node-modules-inspector",na="node-modules-inspector",ns="migrate-mongo",ni="./node_modules/migrate-mongo/bin/migrate-mongo",nc={CYBERSKILL_DIRECTORY:eH,WORKING_DIRECTORY:eM,PUBLIC_DIRECTORY:eR(ew),TS_CONFIG:eR(eV),GIT_IGNORE:eR(eY),GIT_HOOK:eR(eK),GIT_COMMIT_MSG:eR(eB),SIMPLE_GIT_HOOKS_JSON:eR(ex),PACKAGE_JSON:eR(eF),PACKAGE_LOCK_JSON:eR(ek),PNPM_LOCK_YAML:eR(ej),NODE_MODULES:eR(eL),MIGRATE_MONGO_CONFIG:eR(eQ),LINT_STAGED_CONFIG:eR("".concat(eH,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eR("".concat(eH,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eR("".concat(eH,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eR("".concat(eH,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eR("".concat(eH,"/config/vitest/vitest.e2e.js"))};function nu(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 b.CLI:return[3,1];case b.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,eE(a,{install:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,eN(eT("".concat(e9," ").concat(o))))];case 4:return[2,eN(eT(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(nu,"buildCommand");var nE={simpleGitHooks:nu({type:b.CLI,packages:[{name:ne,type:H.DEV_DEPENDENCY}],command:nn}),eslintInspect:nu({type:b.CLI,packages:[{name:nt,type:H.DEV_DEPENDENCY}],command:nr}),nodeModulesInspect:nu({type:b.CLI,packages:[{name:no,type:H.DEV_DEPENDENCY}],command:na}),eslintCheck:nu({type:b.CLI,packages:[{name:eJ,type:H.DEV_DEPENDENCY}],command:"".concat(e$," ").concat(nc.WORKING_DIRECTORY," --no-cache")}),eslintFix:nu({type:b.CLI,packages:[{name:eJ,type:H.DEV_DEPENDENCY}],command:"".concat(e$," ").concat(nc.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:nu({type:b.CLI,packages:[{name:e3,type:H.DEPENDENCY}],command:"".concat(e5," -p ").concat(nc.TS_CONFIG," --noEmit")}),testUnit:nu({type:b.CLI,packages:[{name:eX,type:H.DEV_DEPENDENCY}],command:"".concat(ez," --config ").concat(nc.VITEST_UNIT_CONFIG)}),testE2e:nu({type:b.CLI,packages:[{name:eX,type:H.DEV_DEPENDENCY}],command:"".concat(ez," --config ").concat(nc.VITEST_E2E_CONFIG)}),mongoMigrateCreate:f(function(e){return nu({type:b.CLI,packages:[{name:ns,type:H.DEPENDENCY}],command:"".concat(e6," ").concat(ni," create ").concat(e," -f ").concat(nc.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:nu({type:b.CLI,packages:[{name:ns,type:H.DEPENDENCY}],command:"".concat(e6," ").concat(ni," up -f ").concat(nc.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:nu({type:b.CLI,packages:[{name:ns,type:H.DEPENDENCY}],command:"".concat(e6," ").concat(ni," down -f ").concat(nc.MIGRATE_MONGO_CONFIG)}),commitLint:nu({type:b.CLI,packages:[{name:eZ,type:H.DEV_DEPENDENCY},{name:e0,type:H.DEV_DEPENDENCY}],command:"".concat(e1," --edit ").concat(nc.GIT_COMMIT_MSG," --config ").concat(nc.COMMITLINT_CONFIG)}),lintStaged:nu({type:b.CLI,packages:[{name:e2,type:H.DEV_DEPENDENCY}],command:"".concat(e4," --config ").concat(nc.LINT_STAGED_CONFIG)}),configureGitHook:nu({type:b.STRING,command:"".concat(e7," config core.hooksPath ").concat(nc.GIT_HOOK)}),build:nu({type:b.STRING,command:"".concat(e8," run --if-present build")}),pnpmInstallStandard:nu({type:b.STRING,command:"".concat(e8," install --ignore-scripts")}),pnpmInstallLegacy:nu({type:b.STRING,command:"".concat(e8," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:nu({type:b.STRING,command:"".concat(e8," install --ignore-scripts --force")}),pnpmPruneStore:nu({type:b.STRING,command:"".concat(e8," store prune")}),pnpmCleanCache:nu({type:b.STRING,command:"".concat(e8," cache delete")})};function nl(e){return C(c({plugins:[O()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[nc.VITEST_UNIT_SETUP_CONFIG]}},e))}f(nl,"vitestUnit");export{D as vitestE2E,nl as vitestUnit};
@@ -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,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 O=Object.getPrototypeOf,D=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;!D.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(O(e)):{},y(t||!e||!e.__esModule?p(n,"default",{value:e,enumerable:!0}):n,e)},T=function(e){return y(p({},"__esModule",{value:!0}),e)};var N={};C(N,{vitestUnit:function(){return tO}});module.exports=T(N);var g=I(require("@vitejs/plugin-react-swc"),1),h=require("vitest/config");var _=I(require("fs-extra"),1);var A=".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(),A)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}v(F,"getEnv");var V=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var k=require("child_process"),Y=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 X(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(X,"catchError");var $=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});var z=I(require("node-fetch"),1);var 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,X(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,O,D,v,C,y,I,T,N,g;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(el(tp.PACKAGE_JSON)){t=ec(tp.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:tp.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(tp.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===$.DEPENDENCY,isDevDependency:e.type===$.DEV_DEPENDENCY,installedPath:"",file:{}}}];i=ec(tp.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===$.DEPENDENCY,isDevDependency:e.type===$.DEV_DEPENDENCY,installedPath:tp.PACKAGE_JSON,file:i}}];S=e.name in E,m=e.name in p;return[4,ed(e.name)];case 1:O=d.sent();if(!O.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:O.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===$.DEPENDENCY,isDevDependency:e.type===$.DEV_DEPENDENCY,installedPath:"",file:{}}}];C=(v=(D=E[e.name])!==null&&D!==void 0?D:p[e.name])!==null&&v!==void 0?v:"",y=ew(eE.CWD,eY,e.name,eq);if(!el(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:O.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:"",file:{}}}];I=ec(y),T=I.version,N=T===void 0?"":T;return[2,C!==N?{success:!0,result:{name:e.name,currentVersion:N||C,latestVersion:O.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:S,isDevDependency:m,installedPath:y,file:I}}:{success:!0,result:{name:e.name,currentVersion:C,latestVersion:O.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:C===O.result,isDependency:S,isDevDependency:m,installedPath:y,file:I}}];case 2:g=d.sent();return[2,X(g)];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(tp.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(tp.PACKAGE_JSON,JSON.stringify(r,null,4)),J.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){X(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 tm.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return tm.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(function(){return tm.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();X(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();X(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,O,D,v,C;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,15,,16]);if(!el(tp.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,tm.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=(O=m.next()).done))return[3,11];D=O.value;return[4,D()];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();X(C);return[3,16];case 16:return[2]}})})()}v(em,"setupPackages");var eO=I(require("node-persist"),1);var eD=F();function ev(){return r(function(){var e;return d(this,function(t){switch(t.label){case 0:e=eO.default.defaultInstance;if(e)return[3,2];return[4,eO.default.init({dir:eD.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,eO.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,X(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,eO.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();X(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,eO.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();X(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,eO.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,X(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return d(this,function(t){try{return[2,"".concat(eD.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,X(e,{returnValue:null})]}return[2]})})()}};var ey=F(),eI=j.promisify(k.exec);function eT(){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(eT,"getPackageName");function eN(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,eT()];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();X(n);return[3,5];case 5:return[2]}})})()}v(eN,"saveErrorListToStorage");function eg(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,O,D,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:(O=f===null||f===void 0?void 0:f[1])!==null&&O!==void 0?O:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===x.Error?x.Error:x.Warning,message:(D=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&D!==void 0?D:""}):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&&eN(t),ey.DEBUG&&n.length&&(J.warn("Unmatched lines:"),n.forEach(function(e){return J.info(" ".concat(e))}))}v(eg,"parseTextErrors");function eh(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&&eN(n)}catch(t){eg(e)}}v(eh,"parseCommandOutput");function e_(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]:eh;n=new AbortController;Y.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),Y.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(e_,"executeCommand");function eA(e){return{raw:!0,cmd:e}}v(eA,"rawCommand");function eR(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(to," ").concat(tn," ").concat(e0," ").concat(e):"".concat(to," ").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,e_(t)];case 1:r.sent(),J.success("".concat(e," done."));return[3,3];case 2:n=r.sent();X(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(),eV=eF.CWD,ek="@cyberskill/shared",eY="node_modules",ej="dist",ex="public",eq="package.json",eK="package-lock.json",eB="tsconfig.json",eQ=".gitignore",eH=".simple-git-hooks.json",eW="pnpm-lock.yaml",eJ=".git/hooks/",eX=".git/COMMIT_EDITMSG",e$=".migrate-mongo.config.js",ez=function(){var e=_.default.readJsonSync(eU(eq)).name===ek?eV:ew(eV,eY,ek);return ew(e,ej)}(),eZ="cyberskill",e0="src/node/cli/index.ts",e1="eslint",e2="eslint",e4="vitest";var e3="vitest",e5="@commitlint/cli",e6="@commitlint/config-conventional",e7="commitlint",e8="lint-staged",e9="lint-staged",te="typescript",tt="tsc",tn="tsx",tr="git",ta="pnpm",to="pnpm exec",ti="simple-git-hooks",ts="simple-git-hooks",tc="@eslint/config-inspector",tu="eslint-config-inspector",tl="node-modules-inspector",tE="node-modules-inspector",td="migrate-mongo",tf="./node_modules/migrate-mongo/bin/migrate-mongo",tp={CYBERSKILL_DIRECTORY:ez,WORKING_DIRECTORY:eV,PUBLIC_DIRECTORY:eU(ex),TS_CONFIG:eU(eB),GIT_IGNORE:eU(eQ),GIT_HOOK:eU(eJ),GIT_COMMIT_MSG:eU(eX),SIMPLE_GIT_HOOKS_JSON:eU(eH),PACKAGE_JSON:eU(eq),PACKAGE_LOCK_JSON:eU(eK),PNPM_LOCK_YAML:eU(eW),NODE_MODULES:eU(eY),MIGRATE_MONGO_CONFIG:eU(e$),LINT_STAGED_CONFIG:eU("".concat(ez,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eU("".concat(ez,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eU("".concat(ez,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eU("".concat(ez,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eU("".concat(ez,"/config/vitest/vitest.e2e.js")),VITEST_STORYBOOK_NEXTJS:eU("".concat(ez,"/config/vitest/storybook/nextjs")),VITEST_STORYBOOK_NEXTJS_CONFIG:eU("".concat(ez,"/config/vitest/storybook/nextjs/index.js"))};function tS(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 V.CLI:return[3,1];case V.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(eA("".concat(to," ").concat(a))))];case 4:return[2,eG(eA(a))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}v(tS,"buildCommand");var tm={simpleGitHooks:tS({type:V.CLI,packages:[{name:ti,type:$.DEV_DEPENDENCY}],command:ts}),eslintInspect:tS({type:V.CLI,packages:[{name:tc,type:$.DEV_DEPENDENCY}],command:tu}),nodeModulesInspect:tS({type:V.CLI,packages:[{name:tl,type:$.DEV_DEPENDENCY}],command:tE}),eslintCheck:tS({type:V.CLI,packages:[{name:e1,type:$.DEV_DEPENDENCY}],command:"".concat(e2," ").concat(tp.WORKING_DIRECTORY," --no-cache")}),eslintFix:tS({type:V.CLI,packages:[{name:e1,type:$.DEV_DEPENDENCY}],command:"".concat(e2," ").concat(tp.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tS({type:V.CLI,packages:[{name:te,type:$.DEPENDENCY}],command:"".concat(tt," -p ").concat(tp.TS_CONFIG," --noEmit")}),testUnit:tS({type:V.CLI,packages:[{name:e4,type:$.DEV_DEPENDENCY}],command:"".concat(e3," --config ").concat(tp.VITEST_UNIT_CONFIG)}),testE2e:tS({type:V.CLI,packages:[{name:e4,type:$.DEV_DEPENDENCY}],command:"".concat(e3," --config ").concat(tp.VITEST_E2E_CONFIG)}),mongoMigrateCreate:v(function(e){return tS({type:V.CLI,packages:[{name:td,type:$.DEPENDENCY}],command:"".concat(tn," ").concat(tf," create ").concat(e," -f ").concat(tp.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tS({type:V.CLI,packages:[{name:td,type:$.DEPENDENCY}],command:"".concat(tn," ").concat(tf," up -f ").concat(tp.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tS({type:V.CLI,packages:[{name:td,type:$.DEPENDENCY}],command:"".concat(tn," ").concat(tf," down -f ").concat(tp.MIGRATE_MONGO_CONFIG)}),commitLint:tS({type:V.CLI,packages:[{name:e5,type:$.DEV_DEPENDENCY},{name:e6,type:$.DEV_DEPENDENCY}],command:"".concat(e7," --edit ").concat(tp.GIT_COMMIT_MSG," --config ").concat(tp.COMMITLINT_CONFIG)}),lintStaged:tS({type:V.CLI,packages:[{name:e8,type:$.DEV_DEPENDENCY}],command:"".concat(e9," --config ").concat(tp.LINT_STAGED_CONFIG)}),configureGitHook:tS({type:V.STRING,command:"".concat(tr," config core.hooksPath ").concat(tp.GIT_HOOK)}),build:tS({type:V.STRING,command:"".concat(ta," run --if-present build")}),pnpmInstallStandard:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts")}),pnpmInstallLegacy:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts --force")}),pnpmPruneStore:tS({type:V.STRING,command:"".concat(ta," store prune")}),pnpmCleanCache:tS({type:V.STRING,command:"".concat(ta," cache delete")})};function tO(e){return(0,h.defineConfig)(c({plugins:[(0,g.default)()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tp.VITEST_UNIT_SETUP_CONFIG]}},e))}v(tO,"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)},T=function(e){return y(p({},"__esModule",{value:!0}),e)};var N={};C(N,{vitestUnit:function(){return tD}});module.exports=T(N);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 V=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var k=require("child_process"),Y=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,T,N,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(el(tp.PACKAGE_JSON)){t=ec(tp.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:tp.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(tp.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(tp.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:tp.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,eY,e.name,eq);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),T=I.version,N=T===void 0?"":T;return[2,C!==N?{success:!0,result:{name:e.name,currentVersion:N||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(tp.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(tp.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 tm.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:v(function(){return tm.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:v(function(){return tm.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(tp.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,tm.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(k.exec);function eT(){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(eT,"getPackageName");function eN(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,eT()];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(eN,"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&&eN(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&&eN(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;Y.default.on("SIGINT",function(){J.warn("Process interrupted. Terminating..."),n.abort(),Y.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(to," ").concat(tn," ").concat(e0," ").concat(e):"".concat(to," ").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(),eV=eF.CWD,ek="@cyberskill/shared",eY="node_modules",ej="dist",ex="public",eq="package.json",eK="package-lock.json",eB="tsconfig.json",eQ=".gitignore",eH=".simple-git-hooks.json",eW="pnpm-lock.yaml",eJ=".git/hooks/",e$=".git/COMMIT_EDITMSG",eX=".migrate-mongo.config.js",ez=function(){var e=A.default.readJsonSync(eU(eq)).name===ek?eV:ew(eV,eY,ek);return ew(e,ej)}(),eZ="cyberskill",e0="src/node/cli/index.ts",e1="eslint",e2="eslint",e4="vitest";var e3="vitest",e5="@commitlint/cli",e6="@commitlint/config-conventional",e7="commitlint",e8="lint-staged",e9="lint-staged",te="typescript",tt="tsc",tn="tsx",tr="git",ta="pnpm",to="pnpm exec",ti="simple-git-hooks",ts="simple-git-hooks",tc="@eslint/config-inspector",tu="eslint-config-inspector",tl="node-modules-inspector",tE="node-modules-inspector",td="migrate-mongo",tf="./node_modules/migrate-mongo/bin/migrate-mongo",tp={CYBERSKILL_DIRECTORY:ez,WORKING_DIRECTORY:eV,PUBLIC_DIRECTORY:eU(ex),TS_CONFIG:eU(eB),GIT_IGNORE:eU(eQ),GIT_HOOK:eU(eJ),GIT_COMMIT_MSG:eU(e$),SIMPLE_GIT_HOOKS_JSON:eU(eH),PACKAGE_JSON:eU(eq),PACKAGE_LOCK_JSON:eU(eK),PNPM_LOCK_YAML:eU(eW),NODE_MODULES:eU(eY),MIGRATE_MONGO_CONFIG:eU(eX),LINT_STAGED_CONFIG:eU("".concat(ez,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eU("".concat(ez,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eU("".concat(ez,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eU("".concat(ez,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eU("".concat(ez,"/config/vitest/vitest.e2e.js"))};function tS(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 V.CLI:return[3,1];case V.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(to," ").concat(a))))];case 4:return[2,eG(e_(a))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}v(tS,"buildCommand");var tm={simpleGitHooks:tS({type:V.CLI,packages:[{name:ti,type:X.DEV_DEPENDENCY}],command:ts}),eslintInspect:tS({type:V.CLI,packages:[{name:tc,type:X.DEV_DEPENDENCY}],command:tu}),nodeModulesInspect:tS({type:V.CLI,packages:[{name:tl,type:X.DEV_DEPENDENCY}],command:tE}),eslintCheck:tS({type:V.CLI,packages:[{name:e1,type:X.DEV_DEPENDENCY}],command:"".concat(e2," ").concat(tp.WORKING_DIRECTORY," --no-cache")}),eslintFix:tS({type:V.CLI,packages:[{name:e1,type:X.DEV_DEPENDENCY}],command:"".concat(e2," ").concat(tp.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:tS({type:V.CLI,packages:[{name:te,type:X.DEPENDENCY}],command:"".concat(tt," -p ").concat(tp.TS_CONFIG," --noEmit")}),testUnit:tS({type:V.CLI,packages:[{name:e4,type:X.DEV_DEPENDENCY}],command:"".concat(e3," --config ").concat(tp.VITEST_UNIT_CONFIG)}),testE2e:tS({type:V.CLI,packages:[{name:e4,type:X.DEV_DEPENDENCY}],command:"".concat(e3," --config ").concat(tp.VITEST_E2E_CONFIG)}),mongoMigrateCreate:v(function(e){return tS({type:V.CLI,packages:[{name:td,type:X.DEPENDENCY}],command:"".concat(tn," ").concat(tf," create ").concat(e," -f ").concat(tp.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:tS({type:V.CLI,packages:[{name:td,type:X.DEPENDENCY}],command:"".concat(tn," ").concat(tf," up -f ").concat(tp.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:tS({type:V.CLI,packages:[{name:td,type:X.DEPENDENCY}],command:"".concat(tn," ").concat(tf," down -f ").concat(tp.MIGRATE_MONGO_CONFIG)}),commitLint:tS({type:V.CLI,packages:[{name:e5,type:X.DEV_DEPENDENCY},{name:e6,type:X.DEV_DEPENDENCY}],command:"".concat(e7," --edit ").concat(tp.GIT_COMMIT_MSG," --config ").concat(tp.COMMITLINT_CONFIG)}),lintStaged:tS({type:V.CLI,packages:[{name:e8,type:X.DEV_DEPENDENCY}],command:"".concat(e9," --config ").concat(tp.LINT_STAGED_CONFIG)}),configureGitHook:tS({type:V.STRING,command:"".concat(tr," config core.hooksPath ").concat(tp.GIT_HOOK)}),build:tS({type:V.STRING,command:"".concat(ta," run --if-present build")}),pnpmInstallStandard:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts")}),pnpmInstallLegacy:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:tS({type:V.STRING,command:"".concat(ta," install --ignore-scripts --force")}),pnpmPruneStore:tS({type:V.STRING,command:"".concat(ta," store prune")}),pnpmCleanCache:tS({type:V.STRING,command:"".concat(ta," cache delete")})};function tD(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:[tp.VITEST_UNIT_SETUP_CONFIG]}},e))}v(tD,"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 h from"process";var g=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var A=!1;function _(){h.env.NODE_ENV!==g.PRODUCTION&&!A&&(C.config(),A=!0)}f(_,"loadEnvFile");function R(){_();var e=T(h.env,{CWD:v({default:h.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 b from"util";var L=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 V={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 k=R();k.DEBUG||(w.level=4);function Y(e){var n=U[e];return typeof n=="function"?n:U.green}f(Y,"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(Y(t)("Rule:")," ").concat(o)),w.log(" ".concat(Y(t)("Message:")," ").concat(a))}),w.box(Y(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:V.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,X=Q.readFileSync,$=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,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(en(na.PACKAGE_JSON)){n=Z(na.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:na.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(na.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(na.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:na.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=eA(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: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(na.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(na.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 ni.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return ni.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return ni.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,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(na.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,ni.eslintFix()];case 4:return[4,ev.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=b.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]===L.Error?L.Error:L.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]===L.Error?L.Error:L.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:L.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?L.Error:L.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(e6," ").concat(e4," ").concat(eQ," ").concat(e):"".concat(e6," ").concat(eB," ").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(),eh=eN;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).resolve.apply(r,[ey.CWD].concat(u(n)))}f(eg,"resolveWorkingPath");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).join.apply(r,u(n))}f(eA,"join");var e_=R(),eR=e_.CWD,eG="@cyberskill/shared",eP="node_modules",eM="dist",eb="public",eL="package.json",eU="package-lock.json",ew="tsconfig.json",eF=".gitignore",eV=".simple-git-hooks.json",ek="pnpm-lock.yaml",eY=".git/hooks/",ex=".git/COMMIT_EDITMSG",ej=".migrate-mongo.config.js",eK=function(){var e=D.readJsonSync(eg(eL)).name===eG?eR:eA(eR,eP,eG);return eA(e,eM)}(),eB="cyberskill",eQ="src/node/cli/index.ts",eH="eslint",eq="eslint",eW="vitest";var eJ="vitest",eX="@commitlint/cli",e$="@commitlint/config-conventional",ez="commitlint",eZ="lint-staged",e0="lint-staged",e1="typescript",e2="tsc",e4="tsx",e3="git",e5="pnpm",e6="pnpm exec",e7="simple-git-hooks",e8="simple-git-hooks",e9="@eslint/config-inspector",ne="eslint-config-inspector",nn="node-modules-inspector",nt="node-modules-inspector",nr="migrate-mongo",no="./node_modules/migrate-mongo/bin/migrate-mongo",na={CYBERSKILL_DIRECTORY:eK,WORKING_DIRECTORY:eR,PUBLIC_DIRECTORY:eg(eb),TS_CONFIG:eg(ew),GIT_IGNORE:eg(eF),GIT_HOOK:eg(eY),GIT_COMMIT_MSG:eg(ex),SIMPLE_GIT_HOOKS_JSON:eg(eV),PACKAGE_JSON:eg(eL),PACKAGE_LOCK_JSON:eg(eU),PNPM_LOCK_YAML:eg(ek),NODE_MODULES:eg(eP),MIGRATE_MONGO_CONFIG:eg(ej),LINT_STAGED_CONFIG:eg("".concat(eK,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eg("".concat(eK,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eg("".concat(eK,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eg("".concat(eK,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eg("".concat(eK,"/config/vitest/vitest.e2e.js")),VITEST_STORYBOOK_NEXTJS:eg("".concat(eK,"/config/vitest/storybook/nextjs")),VITEST_STORYBOOK_NEXTJS_CONFIG:eg("".concat(eK,"/config/vitest/storybook/nextjs/index.js"))};function ns(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,eT(eC("".concat(e6," ").concat(o))))];case 4:return[2,eT(eC(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(ns,"buildCommand");var ni={simpleGitHooks:ns({type:G.CLI,packages:[{name:e7,type:K.DEV_DEPENDENCY}],command:e8}),eslintInspect:ns({type:G.CLI,packages:[{name:e9,type:K.DEV_DEPENDENCY}],command:ne}),nodeModulesInspect:ns({type:G.CLI,packages:[{name:nn,type:K.DEV_DEPENDENCY}],command:nt}),eslintCheck:ns({type:G.CLI,packages:[{name:eH,type:K.DEV_DEPENDENCY}],command:"".concat(eq," ").concat(na.WORKING_DIRECTORY," --no-cache")}),eslintFix:ns({type:G.CLI,packages:[{name:eH,type:K.DEV_DEPENDENCY}],command:"".concat(eq," ").concat(na.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:ns({type:G.CLI,packages:[{name:e1,type:K.DEPENDENCY}],command:"".concat(e2," -p ").concat(na.TS_CONFIG," --noEmit")}),testUnit:ns({type:G.CLI,packages:[{name:eW,type:K.DEV_DEPENDENCY}],command:"".concat(eJ," --config ").concat(na.VITEST_UNIT_CONFIG)}),testE2e:ns({type:G.CLI,packages:[{name:eW,type:K.DEV_DEPENDENCY}],command:"".concat(eJ," --config ").concat(na.VITEST_E2E_CONFIG)}),mongoMigrateCreate:f(function(e){return ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," create ").concat(e," -f ").concat(na.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," up -f ").concat(na.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," down -f ").concat(na.MIGRATE_MONGO_CONFIG)}),commitLint:ns({type:G.CLI,packages:[{name:eX,type:K.DEV_DEPENDENCY},{name:e$,type:K.DEV_DEPENDENCY}],command:"".concat(ez," --edit ").concat(na.GIT_COMMIT_MSG," --config ").concat(na.COMMITLINT_CONFIG)}),lintStaged:ns({type:G.CLI,packages:[{name:eZ,type:K.DEV_DEPENDENCY}],command:"".concat(e0," --config ").concat(na.LINT_STAGED_CONFIG)}),configureGitHook:ns({type:G.STRING,command:"".concat(e3," config core.hooksPath ").concat(na.GIT_HOOK)}),build:ns({type:G.STRING,command:"".concat(e5," run --if-present build")}),pnpmInstallStandard:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts")}),pnpmInstallLegacy:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts --force")}),pnpmPruneStore:ns({type:G.STRING,command:"".concat(e5," store prune")}),pnpmCleanCache:ns({type:G.STRING,command:"".concat(e5," cache delete")})};function nc(e){return S(c({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[na.VITEST_UNIT_SETUP_CONFIG]}},e))}f(nc,"vitestUnit");export{nc 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 T,str as v}from"envalid";import y from"os";import N from"path";import h from"process";var g=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var A=!1;function _(){h.env.NODE_ENV!==g.PRODUCTION&&!A&&(C.config(),A=!0)}f(_,"loadEnvFile");function R(){_();var e=T(h.env,{CWD:v({default:h.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:v({default:N.join(y.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 V={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 k=R();k.DEBUG||(w.level=4);function Y(e){var n=U[e];return typeof n=="function"?n:U.green}f(Y,"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(Y(t)("Rule:")," ").concat(o)),w.log(" ".concat(Y(t)("Message:")," ").concat(a))}),w.box(Y(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:V.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,y,N,h;return d(this,function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);if(!e){if(en(na.PACKAGE_JSON)){n=Z(na.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:na.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(na.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(na.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:na.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=eA(et.CWD,eP,e.name,eb);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),y=v.version,N=y===void 0?"":y;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: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: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(na.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(na.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 ni.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:f(function(){return ni.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:f(function(){return ni.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,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(na.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,ni.eslintFix()];case 4:return[4,ev.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(e6," ").concat(e4," ").concat(eQ," ").concat(e):"".concat(e6," ").concat(eB," ").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 ey from"path";var eN=R(),eh=ey;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).resolve.apply(r,[eN.CWD].concat(u(n)))}f(eg,"resolveWorkingPath");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).join.apply(r,u(n))}f(eA,"join");var e_=R(),eR=e_.CWD,eG="@cyberskill/shared",eP="node_modules",eM="dist",eL="public",eb="package.json",eU="package-lock.json",ew="tsconfig.json",eF=".gitignore",eV=".simple-git-hooks.json",ek="pnpm-lock.yaml",eY=".git/hooks/",ex=".git/COMMIT_EDITMSG",ej=".migrate-mongo.config.js",eK=function(){var e=D.readJsonSync(eg(eb)).name===eG?eR:eA(eR,eP,eG);return eA(e,eM)}(),eB="cyberskill",eQ="src/node/cli/index.ts",eH="eslint",eq="eslint",eW="vitest";var eJ="vitest",e$="@commitlint/cli",eX="@commitlint/config-conventional",ez="commitlint",eZ="lint-staged",e0="lint-staged",e1="typescript",e2="tsc",e4="tsx",e3="git",e5="pnpm",e6="pnpm exec",e7="simple-git-hooks",e8="simple-git-hooks",e9="@eslint/config-inspector",ne="eslint-config-inspector",nn="node-modules-inspector",nt="node-modules-inspector",nr="migrate-mongo",no="./node_modules/migrate-mongo/bin/migrate-mongo",na={CYBERSKILL_DIRECTORY:eK,WORKING_DIRECTORY:eR,PUBLIC_DIRECTORY:eg(eL),TS_CONFIG:eg(ew),GIT_IGNORE:eg(eF),GIT_HOOK:eg(eY),GIT_COMMIT_MSG:eg(ex),SIMPLE_GIT_HOOKS_JSON:eg(eV),PACKAGE_JSON:eg(eb),PACKAGE_LOCK_JSON:eg(eU),PNPM_LOCK_YAML:eg(ek),NODE_MODULES:eg(eP),MIGRATE_MONGO_CONFIG:eg(ej),LINT_STAGED_CONFIG:eg("".concat(eK,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eg("".concat(eK,"/config/commitlint/index.js")),VITEST_UNIT_CONFIG:eg("".concat(eK,"/config/vitest/vitest.unit.js")),VITEST_UNIT_SETUP_CONFIG:eg("".concat(eK,"/config/vitest/vitest.unit.setup.ts")),VITEST_E2E_CONFIG:eg("".concat(eK,"/config/vitest/vitest.e2e.js"))};function ns(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,eT(eC("".concat(e6," ").concat(o))))];case 4:return[2,eT(eC(o))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}f(ns,"buildCommand");var ni={simpleGitHooks:ns({type:G.CLI,packages:[{name:e7,type:K.DEV_DEPENDENCY}],command:e8}),eslintInspect:ns({type:G.CLI,packages:[{name:e9,type:K.DEV_DEPENDENCY}],command:ne}),nodeModulesInspect:ns({type:G.CLI,packages:[{name:nn,type:K.DEV_DEPENDENCY}],command:nt}),eslintCheck:ns({type:G.CLI,packages:[{name:eH,type:K.DEV_DEPENDENCY}],command:"".concat(eq," ").concat(na.WORKING_DIRECTORY," --no-cache")}),eslintFix:ns({type:G.CLI,packages:[{name:eH,type:K.DEV_DEPENDENCY}],command:"".concat(eq," ").concat(na.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:ns({type:G.CLI,packages:[{name:e1,type:K.DEPENDENCY}],command:"".concat(e2," -p ").concat(na.TS_CONFIG," --noEmit")}),testUnit:ns({type:G.CLI,packages:[{name:eW,type:K.DEV_DEPENDENCY}],command:"".concat(eJ," --config ").concat(na.VITEST_UNIT_CONFIG)}),testE2e:ns({type:G.CLI,packages:[{name:eW,type:K.DEV_DEPENDENCY}],command:"".concat(eJ," --config ").concat(na.VITEST_E2E_CONFIG)}),mongoMigrateCreate:f(function(e){return ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," create ").concat(e," -f ").concat(na.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," up -f ").concat(na.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:ns({type:G.CLI,packages:[{name:nr,type:K.DEPENDENCY}],command:"".concat(e4," ").concat(no," down -f ").concat(na.MIGRATE_MONGO_CONFIG)}),commitLint:ns({type:G.CLI,packages:[{name:e$,type:K.DEV_DEPENDENCY},{name:eX,type:K.DEV_DEPENDENCY}],command:"".concat(ez," --edit ").concat(na.GIT_COMMIT_MSG," --config ").concat(na.COMMITLINT_CONFIG)}),lintStaged:ns({type:G.CLI,packages:[{name:eZ,type:K.DEV_DEPENDENCY}],command:"".concat(e0," --config ").concat(na.LINT_STAGED_CONFIG)}),configureGitHook:ns({type:G.STRING,command:"".concat(e3," config core.hooksPath ").concat(na.GIT_HOOK)}),build:ns({type:G.STRING,command:"".concat(e5," run --if-present build")}),pnpmInstallStandard:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts")}),pnpmInstallLegacy:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:ns({type:G.STRING,command:"".concat(e5," install --ignore-scripts --force")}),pnpmPruneStore:ns({type:G.STRING,command:"".concat(e5," store prune")}),pnpmCleanCache:ns({type:G.STRING,command:"".concat(e5," cache delete")})};function nc(e){return S(c({plugins:[m()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[na.VITEST_UNIT_SETUP_CONFIG]}},e))}f(nc,"vitestUnit");export{nc as vitestUnit};