@cyberskill/shared 1.45.0 → 1.47.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 (48) hide show
  1. package/README.md +12 -18
  2. package/dist/_tsup-dts-rollup.d.cts +39 -29
  3. package/dist/_tsup-dts-rollup.d.ts +39 -29
  4. package/dist/cli.cjs +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/configs/eslint/base.cjs +1 -1
  7. package/dist/configs/eslint/base.js +1 -1
  8. package/dist/configs/eslint/nestjs.cjs +1 -1
  9. package/dist/configs/eslint/nestjs.js +1 -1
  10. package/dist/configs/eslint/nextjs.cjs +1 -1
  11. package/dist/configs/eslint/nextjs.js +1 -1
  12. package/dist/configs/eslint/nodejs.cjs +1 -1
  13. package/dist/configs/eslint/nodejs.js +1 -1
  14. package/dist/configs/eslint/vite-react.cjs +1 -1
  15. package/dist/configs/eslint/vite-react.js +1 -1
  16. package/dist/configs/graphql/graphql-codegen.cjs +1 -1
  17. package/dist/configs/graphql/graphql-codegen.js +1 -1
  18. package/dist/configs/graphql/index.cjs +1 -1
  19. package/dist/configs/graphql/index.js +1 -1
  20. package/dist/configs/index.cjs +1 -1
  21. package/dist/configs/index.js +1 -1
  22. package/dist/configs/lint-staged/base.cjs +1 -1
  23. package/dist/configs/lint-staged/base.js +1 -1
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.d.cts +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/nodejs/index.cjs +1 -1
  29. package/dist/nodejs/index.d.cts +0 -1
  30. package/dist/nodejs/index.d.ts +0 -1
  31. package/dist/nodejs/index.js +1 -1
  32. package/dist/nodejs/mongo.cjs +1 -1
  33. package/dist/nodejs/mongo.d.cts +0 -1
  34. package/dist/nodejs/mongo.d.ts +0 -1
  35. package/dist/nodejs/mongo.js +1 -1
  36. package/dist/typescript/index.cjs +1 -1
  37. package/dist/typescript/index.js +1 -1
  38. package/dist/typescript/mongo.cjs +1 -1
  39. package/dist/typescript/mongo.js +1 -1
  40. package/dist/utils/index-nodejs.cjs +1 -1
  41. package/dist/utils/index-nodejs.d.cts +1 -0
  42. package/dist/utils/index-nodejs.d.ts +1 -0
  43. package/dist/utils/index-nodejs.js +1 -1
  44. package/dist/utils/npm-package.cjs +1 -1
  45. package/dist/utils/npm-package.d.cts +1 -0
  46. package/dist/utils/npm-package.d.ts +1 -0
  47. package/dist/utils/npm-package.js +1 -1
  48. package/package.json +12 -9
@@ -1 +1 @@
1
- "use strict";function e(e,r,t,n,o,a,i){try{var s=e[a](i);var c=s.value}catch(e){t(e);return}if(s.done){r(c)}else{Promise.resolve(c).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,a){var i=r.apply(t,n);function s(r){e(i,o,a,s,c,"next",r)}function c(r){e(i,o,a,s,c,"throw",r)}s(undefined)})}}function t(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function n(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(r){t(e,r,n[r])})}return e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function a(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(e,r){var t,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(i)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=r.call(e,i)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var c=Object.create;var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var S=function(e,r){for(var t in r)u(e,t,{get:r[t],enumerable:!0})},p=function(e,r,t,n){var o=true,a=false,s=undefined;if(r&&(typeof r==="undefined"?"undefined":i(r))=="object"||typeof r=="function")try{var c=function(){var o=S.value;!d.call(e,o)&&o!==t&&u(e,o,{get:function(){return r[o]},enumerable:!(n=l(r,o))||n.enumerable})};for(var f=E(r)[Symbol.iterator](),S;!(o=(S=f.next()).done);o=true)c()}catch(e){a=true;s=e}finally{try{if(!o&&f.return!=null){f.return()}}finally{if(a){throw s}}}return e};var O=function(e,r,t){return t=e!=null?c(f(e)):{},p(r||!e||!e.__esModule?u(t,"default",{value:e,enumerable:!0}):t,e)},h=function(e){return p(u({},"__esModule",{value:!0}),e)};var g={};S(g,{clearAllErrorLists:function(){return K},commandLog:function(){return H},executeCommand:function(){return Z},fileExists:function(){return et},getLatestPackageVersion:function(){return eh},getStoredErrorLists:function(){return W},initNodePersist:function(){return P},isCurrentProject:function(){return eD},isPackageOutdated:function(){return ev},saveErrorListToStorage:function(){return B},storageDir:function(){return M},storageServer:function(){return G},throwResponse:function(){return ea},updatePackage:function(){return ey}});module.exports=h(g);var v=function(){return(typeof document==="undefined"?"undefined":i(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},A=v();var y=O(require("boxen"),1),T=O(require("chalk"),1),D=require("child_process"),R=O(require("process"),1),m=O(require("util"),1);var _=O(require("node-persist"),1),C=O(require("os"),1),I=O(require("path"),1),N=O(require("process"),1),M=N.default.env.CYBERSKILL_STORAGE_DIR||I.default.join(C.default.homedir(),".cyberskill-storage");function P(){return b.apply(this,arguments)}function b(){b=r(function(){var e;return s(this,function(r){switch(r.label){case 0:e=_.default.defaultInstance;if(e)return[3,2];return[4,_.default.init({dir:M,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return b.apply(this,arguments)}var G={get:function e(e){return r(function(){var r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,_.default.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,_.default.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,_.default.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,_.default.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return s(this,function(r){try{return[2,"".concat(M," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var L=R.default.env.DEBUG==="true",w=m.promisify(D.exec),U=T.default,F=U.gray,k=U.blue,q=function(){return F("[".concat(new Date().toLocaleTimeString(),"]"))};function j(e){var r=T.default[e];return typeof r=="function"?r:T.default.green}function x(e,r,t,n){var o=j(r);console.log("".concat(q()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function Q(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,a=t.padding,i=a===void 0?1:a,s=t.margin,c=s===void 0?1:s,u=t.borderStyle,l=u===void 0?"round":u,E=t.titleColor,f=E===void 0?"bold":E;var d=j(o),S=j(f);if(typeof r=="string"){console.log((0,y.default)(S(d("".concat(e,"\n").concat(r))),{padding:i,margin:c,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(q()," ").concat(d("File:")," ").concat(k("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(d("Rule:")," ").concat(d(n))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log((0,y.default)(S(d("".concat(e,": ").concat(r.length))),{padding:i,margin:c,borderStyle:l,borderColor:o})),console.log(F("─".repeat(40))))}var H={success:function(e){return x("SUCCESS","green","✔",e)},error:function(e){return x("ERROR","red","✖",e)},warning:function(e){return x("WARNING","yellow","⚠",e)},info:function(e){return x("INFO","blue","ℹ",e)},printBoxedLog:Q},Y=function(e){return"error_list:".concat(e)};function B(e){return V.apply(this,arguments)}function V(){V=r(function(e){var t,n,o;return s(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=Y(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,G.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return s(this,function(r){switch(r.label){case 0:return[4,G.getLogLink(n)];case 1:e=r.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();H.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return V.apply(this,arguments)}function W(){return J.apply(this,arguments)}function J(){J=r(function(){var e,t,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,G.keys()];case 1:e=o.sent(),t=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=r(function(e){var r;return s(this,function(t){switch(t.label){case 0:return[4,G.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,o.sent().flat()];case 3:n=o.sent();return[2,(H.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return J.apply(this,arguments)}function K(){return X.apply(this,arguments)}function X(){X=r(function(){var e,r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,G.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return G.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();H.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return X.apply(this,arguments)}function $(e){var r=[],t=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s=o.exec(e)||[],c=a.exec(e)||[],u=i.exec(e)||[];s.length&&n?r.push({file:n,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):c.length?r.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&B(r),t.length&&L&&(H.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function z(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,i=e.ruleId,s=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(a),rule:i,message:s})})}),t.length&&B(t)}catch(r){$(e)}}function Z(e){return ee.apply(this,arguments)}function ee(){ee=r(function(e){var r,t,n,o,a,i,c,u,l;var E=arguments;return s(this,function(s){switch(s.label){case 0:r=E.length>1&&E[1]!==void 0?E[1]:z;t=new AbortController;R.default.on("SIGINT",function(){H.warning("Process interrupted. Terminating..."),t.abort(),R.default.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,w(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=s.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});return[3,4];case 3:i=s.sent();c=i.stdout,u=i.stderr,l=i.message;[c,u].forEach(function(e){return e&&r(e)}),!u&&!c&&H.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return ee.apply(this,arguments)}var er=O(require("fs"),1),et=function(e){return er.existsSync(e)};var en=require("graphql");var eo={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"}};function ea(e){var r=e.message,t=e.status,n=t===void 0?eo.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var i;var s=(i=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&i!==void 0?i:"Internal server error";throw a==="graphql"?new en.GraphQLError(s,{extensions:{code:n.CODE}}):new Error(s)}var ei=O(require("node-fetch"),1),es=O(require("fs"),1),ec=O(require("path"),1);var eu=require("path"),el=O(require("process"),1),eE=require("url"),ef=(0,eE.fileURLToPath)(A),ed=(0,eu.dirname)(ef),eS=el.default.env.INIT_CWD||el.default.cwd();var ep=24*60*60*1e3;function eO(e){return e?ec.default.join(eS,"node_modules",e,"package.json"):ec.default.join(eS,"package.json")}function eh(e){return eg.apply(this,arguments)}function eg(){eg=r(function(e){var r,t,n,o,a,i,c,u,l,E;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,G.get(t)];case 1:o=s.sent();return[4,G.get(n)];case 2:a=s.sent(),i=o&&Date.now()-o.timestamp<ep;if(!r&&i)return[2,o.version];c={};(a===null||a===void 0?void 0:a.etag)&&(c["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(c["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,(0,ei.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:c})];case 4:u=s.sent();if(u.status===304&&o)return[2,o.version];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:l=s.sent().version;return[4,G.set(t,{version:l,timestamp:Date.now()})];case 6:s.sent();return[4,G.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),l)];case 8:E=s.sent();if(H.error("Error fetching latest version for ".concat(e,": ").concat(E.message)),o)return[2,(H.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw E;case 9:return[2]}})});return eg.apply(this,arguments)}function ev(e){return eA.apply(this,arguments)}function eA(){eA=r(function(e){var r,t,n,o,a;var i=arguments;return s(this,function(s){switch(s.label){case 0:r=i.length>1&&i[1]!==void 0?i[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);t=eO(e);if(!es.default.existsSync(t))return[2,(H.info("".concat(e," is not installed.")),!0)];n=JSON.parse(es.default.readFileSync(t,"utf-8")).version;return[4,eh(e,r)];case 2:o=s.sent();return[2,(H.info("Installed version of ".concat(e,": ").concat(n)),H.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(H.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return eA.apply(this,arguments)}function ey(e){return eT.apply(this,arguments)}function eT(){eT=r(function(e){var r,o,i,c;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,eh(e,!0)];case 1:r=s.sent(),o=eO();if(!es.default.existsSync(o)){H.error("package.json not found. Cannot update ".concat(e));return[2]}i=JSON.parse(es.default.readFileSync(o,"utf-8"));i.dependencies=a(n({},i.dependencies),t({},e,r)),es.default.writeFileSync(o,JSON.stringify(i,null,2)),H.info("Updated ".concat(e," to version ").concat(r));return[4,Z("npm i -f")];case 2:s.sent();return[4,Z("npm run lint:fix")];case 3:s.sent(),H.success("".concat(e," updated successfully."));return[3,5];case 4:c=s.sent();throw H.error("Failed to update ".concat(e,": ").concat(c.message)),c;case 5:return[2]}})});return eT.apply(this,arguments)}function eD(e,r){try{var t=ec.default.join(e,"package.json");return es.default.existsSync(t)?JSON.parse(es.default.readFileSync(t,"utf-8")).name===r:!1}catch(e){return H.error("Error reading package.json: ".concat(e.message)),!1}}0&&(module.exports={clearAllErrorLists:clearAllErrorLists,commandLog:commandLog,executeCommand:executeCommand,fileExists:fileExists,getLatestPackageVersion:getLatestPackageVersion,getStoredErrorLists:getStoredErrorLists,initNodePersist:initNodePersist,isCurrentProject:isCurrentProject,isPackageOutdated:isPackageOutdated,saveErrorListToStorage:saveErrorListToStorage,storageDir:storageDir,storageServer:storageServer,throwResponse:throwResponse,updatePackage:updatePackage});
1
+ "use strict";function e(e,t,r,n,o,a,i){try{var s=e[a](i);var c=s.value}catch(e){r(e);return}if(s.done){t(c)}else{Promise.resolve(c).then(n,o)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,a){var i=t.apply(r,n);function s(t){e(i,o,a,s,c,"next",t)}function c(t){e(i,o,a,s,c,"throw",t)}s(undefined)})}}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function a(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{o(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function i(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(e,t){var r,n,o,a,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return c([e,t])}}function c(a){if(r)throw new TypeError("Generator is already executing.");while(i)try{if(r=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var c=Object.create;var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var S=function(e,t){for(var r in t)u(e,r,{get:t[r],enumerable:!0})},p=function(e,t,r,n){var o=true,a=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":i(t))=="object"||typeof t=="function")try{var c=function(){var o=S.value;!d.call(e,o)&&o!==r&&u(e,o,{get:function(){return t[o]},enumerable:!(n=l(t,o))||n.enumerable})};for(var f=E(t)[Symbol.iterator](),S;!(o=(S=f.next()).done);o=true)c()}catch(e){a=true;s=e}finally{try{if(!o&&f.return!=null){f.return()}}finally{if(a){throw s}}}return e};var O=function(e,t,r){return r=e!=null?c(f(e)):{},p(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)},h=function(e){return p(u({},"__esModule",{value:!0}),e)};var g={};S(g,{clearAllErrorLists:function(){return K},commandLog:function(){return H},executeCommand:function(){return Z},fileExists:function(){return er},getLatestPackageVersion:function(){return eh},getStoredErrorLists:function(){return W},initNodePersist:function(){return b},installDependencies:function(){return eT},isCurrentProject:function(){return eD},isPackageOutdated:function(){return ev},saveErrorListToStorage:function(){return B},storageDir:function(){return M},storageServer:function(){return G},throwResponse:function(){return ea},updatePackage:function(){return ey}});module.exports=h(g);var v=function(){return(typeof document==="undefined"?"undefined":i(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},A=v();var y=O(require("boxen"),1),m=O(require("chalk"),1),D=require("child_process"),T=O(require("process"),1),R=O(require("util"),1);var _=O(require("node-persist"),1),C=O(require("os"),1),I=O(require("path"),1),N=O(require("process"),1),M=N.default.env.CYBERSKILL_STORAGE_DIR||I.default.join(C.default.homedir(),".cyberskill-storage");function b(){return P.apply(this,arguments)}function P(){P=t(function(){var e;return s(this,function(t){switch(t.label){case 0:e=_.default.defaultInstance;if(e)return[3,2];return[4,_.default.init({dir:M,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return P.apply(this,arguments)}var G={get:function e(e){return t(function(){var t,r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,b()];case 1:n.sent();return[4,_.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,r){return t(function(){var t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,b()];case 1:n.sent();return[4,_.default.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,b()];case 1:r.sent();return[4,_.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return t(function(){var e,t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,b()];case 1:r.sent();return[4,_.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return t(function(){return s(this,function(t){try{return[2,"".concat(M," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var w=T.default.env.DEBUG==="true",L=R.promisify(D.exec),U=m.default,F=U.gray,k=U.blue,q=function(){return F("[".concat(new Date().toLocaleTimeString(),"]"))};function j(e){var t=m.default[e];return typeof t=="function"?t:m.default.green}function x(e,t,r,n){var o=j(t);console.log("".concat(q()," ").concat(o("".concat(r," ").concat(e))," ").concat(n))}function Q(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.color,o=n===void 0?"green":n,a=r.padding,i=a===void 0?1:a,s=r.margin,c=s===void 0?1:s,u=r.borderStyle,l=u===void 0?"round":u,E=r.titleColor,f=E===void 0?"bold":E;var d=j(o),S=j(f);if(typeof t=="string"){console.log((0,y.default)(S(d("".concat(e,"\n").concat(t))),{padding:i,margin:c,borderStyle:l,borderColor:o}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,r=e.position,n=e.rule,o=e.message;console.log("".concat(q()," ").concat(d("File:")," ").concat(k("".concat(t).concat(r?":".concat(r):"")))),n&&console.log(" ".concat(d("Rule:")," ").concat(d(n))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log((0,y.default)(S(d("".concat(e,": ").concat(t.length))),{padding:i,margin:c,borderStyle:l,borderColor:o})),console.log(F("─".repeat(40))))}var H={success:function(e){return x("SUCCESS","green","✔",e)},error:function(e){return x("ERROR","red","✖",e)},warning:function(e){return x("WARNING","yellow","⚠",e)},info:function(e){return x("INFO","blue","ℹ",e)},printBoxedLog:Q},Y=function(e){return"error_list:".concat(e)};function B(e){return V.apply(this,arguments)}function V(){V=t(function(e){var r,n,o;return s(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];r=Date.now(),n=Y(r);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,G.set(n,{errors:e,timestamp:r})];case 2:a.sent(),setTimeout(/*#__PURE__*/t(function(){var e;return s(this,function(t){switch(t.label){case 0:return[4,G.getLogLink(n)];case 1:e=t.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();H.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return V.apply(this,arguments)}function W(){return J.apply(this,arguments)}function J(){J=t(function(){var e,r,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,G.keys()];case 1:e=o.sent(),r=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(r.map(/*#__PURE__*/function(){var e=t(function(e){var t;return s(this,function(r){switch(r.label){case 0:return[4,G.get(e)];case 1:return[2,((t=r.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,o.sent().flat()];case 3:n=o.sent();return[2,(H.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return J.apply(this,arguments)}function K(){return X.apply(this,arguments)}function X(){X=t(function(){var e,t,r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,G.keys()];case 1:e=n.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return G.remove(e)}))];case 2:n.sent();return[3,4];case 3:r=n.sent();H.error("Failed to clear error lists: ".concat(r.message));return[3,4];case 4:return[2]}})});return X.apply(this,arguments)}function $(e){var t=[],r=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,i=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s=o.exec(e)||[],c=a.exec(e)||[],u=i.exec(e)||[];s.length&&n?t.push({file:n,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):c.length?t.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&B(t),r.length&&w&&(H.warning("Unmatched lines:"),r.forEach(function(e){return console.log(" ".concat(e))}))}function z(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,i=e.ruleId,s=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(o,":").concat(a),rule:i,message:s})})}),r.length&&B(r)}catch(t){$(e)}}function Z(e){return ee.apply(this,arguments)}function ee(){ee=t(function(e){var t,r,n,o,a,i,c,u,l;var E=arguments;return s(this,function(s){switch(s.label){case 0:t=E.length>1&&E[1]!==void 0?E[1]:z;r=new AbortController;T.default.on("SIGINT",function(){H.warning("Process interrupted. Terminating..."),r.abort(),T.default.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,L(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=s.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:i=s.sent();c=i.stdout,u=i.stderr,l=i.message;[c,u].forEach(function(e){return e&&t(e)}),!u&&!c&&H.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return ee.apply(this,arguments)}var et=O(require("fs"),1),er=function(e){return et.existsSync(e)};var en=require("graphql");var eo={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"}};function ea(e){var t=e.message,r=e.status,n=r===void 0?eo.INTERNAL_SERVER_ERROR:r,o=e.type,a=o===void 0?"graphql":o;var i;var s=(i=t!==null&&t!==void 0?t:n.MESSAGE)!==null&&i!==void 0?i:"Internal server error";throw a==="graphql"?new en.GraphQLError(s,{extensions:{code:n.CODE}}):new Error(s)}var ei=O(require("node-fetch"),1),es=O(require("fs"),1),ec=O(require("path"),1);var eu=require("path"),el=O(require("process"),1),eE=require("url"),ef=(0,eE.fileURLToPath)(A),ed=(0,eu.dirname)(ef),eS=el.default.env.INIT_CWD||el.default.cwd();var ep=24*60*60*1e3;function eO(e){return e?ec.default.join(eS,"node_modules",e,"package.json"):ec.default.join(eS,"package.json")}function eh(e){return eg.apply(this,arguments)}function eg(){eg=t(function(e){var t,r,n,o,a,i,c,u,l,E;var f=arguments;return s(this,function(s){switch(s.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:!1;r="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,G.get(r)];case 1:o=s.sent();return[4,G.get(n)];case 2:a=s.sent(),i=o&&Date.now()-o.timestamp<ep;if(!t&&i)return[2,o.version];c={};(a===null||a===void 0?void 0:a.etag)&&(c["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(c["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,(0,ei.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:c})];case 4:u=s.sent();if(u.status===304&&o)return[2,o.version];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:l=s.sent().version;return[4,G.set(r,{version:l,timestamp:Date.now()})];case 6:s.sent();return[4,G.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),l)];case 8:E=s.sent();if(H.error("Error fetching latest version for ".concat(e,": ").concat(E.message)),o)return[2,(H.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw E;case 9:return[2]}})});return eg.apply(this,arguments)}function ev(e){return eA.apply(this,arguments)}function eA(){eA=t(function(e){var t,r,n,o,a;var i=arguments;return s(this,function(s){switch(s.label){case 0:t=i.length>1&&i[1]!==void 0?i[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);r=eO(e);if(!es.default.existsSync(r))return[2,(H.info("".concat(e," is not installed.")),!0)];n=JSON.parse(es.default.readFileSync(r,"utf-8")).version;return[4,eh(e,t)];case 2:o=s.sent();return[2,(H.info("Installed version of ".concat(e,": ").concat(n)),H.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(H.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return eA.apply(this,arguments)}function ey(e){return em.apply(this,arguments)}function em(){em=t(function(e){var t,o,i,c;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,eh(e,!0)];case 1:t=s.sent(),o=eO();if(!es.default.existsSync(o)){H.error("package.json not found. Cannot update ".concat(e));return[2]}i=JSON.parse(es.default.readFileSync(o,"utf-8"));i.dependencies=a(n({},i.dependencies),r({},e,t)),es.default.writeFileSync(o,JSON.stringify(i,null,2)),H.info("Updated ".concat(e," to version ").concat(t));return[4,eT()];case 2:s.sent();return[4,Z("pnpm run lint:fix")];case 3:s.sent(),H.success("".concat(e," updated successfully."));return[3,5];case 4:c=s.sent();throw H.error("Failed to update ".concat(e,": ").concat(c.message)),c;case 5:return[2]}})});return em.apply(this,arguments)}function eD(e,t){try{var r=ec.default.join(e,"package.json");return es.default.existsSync(r)?JSON.parse(es.default.readFileSync(r,"utf-8")).name===t:!1}catch(e){return H.error("Error reading package.json: ".concat(e.message)),!1}}function eT(){return eR.apply(this,arguments)}function eR(){eR=t(function(){var e,t,r,n,o,a,i,c,u,l,E;return s(this,function(s){switch(s.label){case 0:e=[{command:"pnpm install",message:"Standard installation"},{command:"pnpm install --legacy-peer-deps",message:"Attempting installation with --legacy-peer-deps"},{command:"pnpm install --force",message:"Attempting forced installation"}];t=true,r=false,n=undefined;s.label=1;case 1:s.trys.push([1,8,9,10]);o=e[Symbol.iterator]();s.label=2;case 2:if(!!(t=(a=o.next()).done))return[3,7];i=a.value,c=i.command,u=i.message;s.label=3;case 3:s.trys.push([3,5,,6]);H.info("".concat(u,"..."));return[4,Z(c)];case 4:s.sent(),H.success("Dependencies installed using: ".concat(c));return[2];case 5:l=s.sent();H.warning("Failed with: ".concat(c)),H.error("Error: ".concat(l.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:E=s.sent();r=true;n=E;return[3,10];case 9:try{if(!t&&o.return!=null){o.return()}}finally{if(r){throw n}}return[7];case 10:throw new Error("Failed to install dependencies after multiple attempts.")}})});return eR.apply(this,arguments)}0&&(module.exports={clearAllErrorLists:clearAllErrorLists,commandLog:commandLog,executeCommand:executeCommand,fileExists:fileExists,getLatestPackageVersion:getLatestPackageVersion,getStoredErrorLists:getStoredErrorLists,initNodePersist:initNodePersist,installDependencies:installDependencies,isCurrentProject:isCurrentProject,isPackageOutdated:isPackageOutdated,saveErrorListToStorage:saveErrorListToStorage,storageDir:storageDir,storageServer:storageServer,throwResponse:throwResponse,updatePackage:updatePackage});
@@ -9,6 +9,7 @@ export { getLatestPackageVersion_alias_1 as getLatestPackageVersion } from '../_
9
9
  export { isPackageOutdated_alias_1 as isPackageOutdated } from '../_tsup-dts-rollup.cjs';
10
10
  export { updatePackage_alias_1 as updatePackage } from '../_tsup-dts-rollup.cjs';
11
11
  export { isCurrentProject_alias_1 as isCurrentProject } from '../_tsup-dts-rollup.cjs';
12
+ export { installDependencies_alias_1 as installDependencies } from '../_tsup-dts-rollup.cjs';
12
13
  export { initNodePersist_alias_1 as initNodePersist } from '../_tsup-dts-rollup.cjs';
13
14
  export { storageDir_alias_1 as storageDir } from '../_tsup-dts-rollup.cjs';
14
15
  export { storageServer_alias_1 as storageServer } from '../_tsup-dts-rollup.cjs';
@@ -9,6 +9,7 @@ export { getLatestPackageVersion_alias_1 as getLatestPackageVersion } from '../_
9
9
  export { isPackageOutdated_alias_1 as isPackageOutdated } from '../_tsup-dts-rollup.js';
10
10
  export { updatePackage_alias_1 as updatePackage } from '../_tsup-dts-rollup.js';
11
11
  export { isCurrentProject_alias_1 as isCurrentProject } from '../_tsup-dts-rollup.js';
12
+ export { installDependencies_alias_1 as installDependencies } from '../_tsup-dts-rollup.js';
12
13
  export { initNodePersist_alias_1 as initNodePersist } from '../_tsup-dts-rollup.js';
13
14
  export { storageDir_alias_1 as storageDir } from '../_tsup-dts-rollup.js';
14
15
  export { storageServer_alias_1 as storageServer } from '../_tsup-dts-rollup.js';
@@ -1 +1 @@
1
- function e(e,r,t,n,o,a,s){try{var i=e[a](s);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,a){var s=r.apply(t,n);function i(r){e(s,o,a,i,c,"next",r)}function c(r){e(s,o,a,i,c,"throw",r)}i(undefined)})}}function t(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function n(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(r){t(e,r,n[r])})}return e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function a(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,r){var t,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import i from"boxen";import c from"chalk";import{exec as u}from"node:child_process";import E from"node:process";import*as l from"node:util";import f from"node-persist";import S from"node:os";import p from"node:path";import d from"node:process";var O=d.env.CYBERSKILL_STORAGE_DIR||p.join(S.homedir(),".cyberskill-storage");function h(){return A.apply(this,arguments)}function A(){A=r(function(){var e;return s(this,function(r){switch(r.label){case 0:e=f.defaultInstance;if(e)return[3,2];return[4,f.init({dir:O,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return A.apply(this,arguments)}var g={get:function e(e){return r(function(){var r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,h()];case 1:n.sent();return[4,f.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,h()];case 1:n.sent();return[4,f.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,h()];case 1:t.sent();return[4,f.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,h()];case 1:t.sent();return[4,f.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return s(this,function(r){try{return[2,"".concat(O," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var v=E.env.DEBUG==="true",m=l.promisify(u),T=c.gray,y=c.blue,D=function(){return T("[".concat(new Date().toLocaleTimeString(),"]"))};function R(e){var r=c[e];return typeof r=="function"?r:c.green}function _(e,r,t,n){var o=R(r);console.log("".concat(D()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function C(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,a=t.padding,s=a===void 0?1:a,c=t.margin,u=c===void 0?1:c,E=t.borderStyle,l=E===void 0?"round":E,f=t.titleColor,S=f===void 0?"bold":f;var p=R(o),d=R(S);if(typeof r=="string"){console.log(i(d(p("".concat(e,"\n").concat(r))),{padding:s,margin:u,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(D()," ").concat(p("File:")," ").concat(y("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(p("Rule:")," ").concat(p(n))),console.log(" ".concat(p("Message:")," ").concat(p(o)))}),console.log(i(d(p("".concat(e,": ").concat(r.length))),{padding:s,margin:u,borderStyle:l,borderColor:o})),console.log(T("─".repeat(40))))}var I={success:function(e){return _("SUCCESS","green","✔",e)},error:function(e){return _("ERROR","red","✖",e)},warning:function(e){return _("WARNING","yellow","⚠",e)},info:function(e){return _("INFO","blue","ℹ",e)},printBoxedLog:C},N=function(e){return"error_list:".concat(e)};function M(e){return G.apply(this,arguments)}function G(){G=r(function(e){var t,n,o;return s(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=N(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,g.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return s(this,function(r){switch(r.label){case 0:return[4,g.getLogLink(n)];case 1:e=r.sent();e&&I.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();I.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return G.apply(this,arguments)}function P(){return b.apply(this,arguments)}function b(){b=r(function(){var e,t,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,g.keys()];case 1:e=o.sent(),t=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=r(function(e){var r;return s(this,function(t){switch(t.label){case 0:return[4,g.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,o.sent().flat()];case 3:n=o.sent();return[2,(I.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return b.apply(this,arguments)}function L(){return w.apply(this,arguments)}function w(){w=r(function(){var e,r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,g.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return g.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();I.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return w.apply(this,arguments)}function U(e){var r=[],t=[],n="",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("/"))n=e.trim();else{var i=o.exec(e)||[],c=a.exec(e)||[],u=s.exec(e)||[];i.length&&n?r.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):c.length?r.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&M(r),t.length&&v&&(I.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function F(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,s=e.ruleId,i=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(a),rule:s,message:i})})}),t.length&&M(t)}catch(r){U(e)}}function k(e){return x.apply(this,arguments)}function x(){x=r(function(e){var r,t,n,o,a,i,c,u,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:F;t=new AbortController;E.on("SIGINT",function(){I.warning("Process interrupted. Terminating..."),t.abort(),E.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,m(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=s.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});return[3,4];case 3:i=s.sent();c=i.stdout,u=i.stderr,l=i.message;[c,u].forEach(function(e){return e&&r(e)}),!u&&!c&&I.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return x.apply(this,arguments)}import*as j from"node:fs";var Q=function(e){return j.existsSync(e)};import{GraphQLError as q}from"graphql";var H={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"}};function B(e){var r=e.message,t=e.status,n=t===void 0?H.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var s;var i=(s=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&s!==void 0?s:"Internal server error";throw a==="graphql"?new q(i,{extensions:{code:n.CODE}}):new Error(i)}import Y from"node-fetch";import V from"node:fs";import W from"node:path";import{dirname as J}from"node:path";import K from"node:process";import{fileURLToPath as $}from"node:url";var X=$(import.meta.url),z=J(X),Z=K.env.INIT_CWD||K.cwd();var ee=24*60*60*1e3;function er(e){return e?W.join(Z,"node_modules",e,"package.json"):W.join(Z,"package.json")}function et(e){return en.apply(this,arguments)}function en(){en=r(function(e){var r,t,n,o,a,i,c,u,E,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,g.get(t)];case 1:o=s.sent();return[4,g.get(n)];case 2:a=s.sent(),i=o&&Date.now()-o.timestamp<ee;if(!r&&i)return[2,o.version];c={};(a===null||a===void 0?void 0:a.etag)&&(c["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(c["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,Y("https://registry.npmjs.org/".concat(e,"/latest"),{headers:c})];case 4:u=s.sent();if(u.status===304&&o)return[2,o.version];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:E=s.sent().version;return[4,g.set(t,{version:E,timestamp:Date.now()})];case 6:s.sent();return[4,g.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),E)];case 8:l=s.sent();if(I.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(I.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return en.apply(this,arguments)}function eo(e){return ea.apply(this,arguments)}function ea(){ea=r(function(e){var r,t,n,o,a;var i=arguments;return s(this,function(s){switch(s.label){case 0:r=i.length>1&&i[1]!==void 0?i[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);t=er(e);if(!V.existsSync(t))return[2,(I.info("".concat(e," is not installed.")),!0)];n=JSON.parse(V.readFileSync(t,"utf-8")).version;return[4,et(e,r)];case 2:o=s.sent();return[2,(I.info("Installed version of ".concat(e,": ").concat(n)),I.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(I.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return ea.apply(this,arguments)}function es(e){return ei.apply(this,arguments)}function ei(){ei=r(function(e){var r,o,i,c;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,et(e,!0)];case 1:r=s.sent(),o=er();if(!V.existsSync(o)){I.error("package.json not found. Cannot update ".concat(e));return[2]}i=JSON.parse(V.readFileSync(o,"utf-8"));i.dependencies=a(n({},i.dependencies),t({},e,r)),V.writeFileSync(o,JSON.stringify(i,null,2)),I.info("Updated ".concat(e," to version ").concat(r));return[4,k("npm i -f")];case 2:s.sent();return[4,k("npm run lint:fix")];case 3:s.sent(),I.success("".concat(e," updated successfully."));return[3,5];case 4:c=s.sent();throw I.error("Failed to update ".concat(e,": ").concat(c.message)),c;case 5:return[2]}})});return ei.apply(this,arguments)}function ec(e,r){try{var t=W.join(e,"package.json");return V.existsSync(t)?JSON.parse(V.readFileSync(t,"utf-8")).name===r:!1}catch(e){return I.error("Error reading package.json: ".concat(e.message)),!1}}export{L as clearAllErrorLists,I as commandLog,k as executeCommand,Q as fileExists,et as getLatestPackageVersion,P as getStoredErrorLists,h as initNodePersist,ec as isCurrentProject,eo as isPackageOutdated,M as saveErrorListToStorage,O as storageDir,g as storageServer,B as throwResponse,es as updatePackage};
1
+ function e(e,r,t,n,o,a,s){try{var i=e[a](s);var c=i.value}catch(e){t(e);return}if(i.done){r(c)}else{Promise.resolve(c).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,a){var s=r.apply(t,n);function i(r){e(s,o,a,i,c,"next",r)}function c(r){e(s,o,a,i,c,"throw",r)}i(undefined)})}}function t(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function n(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(r){t(e,r,n[r])})}return e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function a(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,r){var t,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(r){return c([e,r])}}function c(a){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import i from"boxen";import c from"chalk";import{exec as u}from"node:child_process";import E from"node:process";import*as l from"node:util";import f from"node-persist";import S from"node:os";import p from"node:path";import d from"node:process";var O=d.env.CYBERSKILL_STORAGE_DIR||p.join(S.homedir(),".cyberskill-storage");function h(){return g.apply(this,arguments)}function g(){g=r(function(){var e;return s(this,function(r){switch(r.label){case 0:e=f.defaultInstance;if(e)return[3,2];return[4,f.init({dir:O,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return g.apply(this,arguments)}var A={get:function e(e){return r(function(){var r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,h()];case 1:n.sent();return[4,f.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,h()];case 1:n.sent();return[4,f.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,h()];case 1:t.sent();return[4,f.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,h()];case 1:t.sent();return[4,f.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return s(this,function(r){try{return[2,"".concat(O," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var m=E.env.DEBUG==="true",v=l.promisify(u),y=c.gray,D=c.blue,T=function(){return y("[".concat(new Date().toLocaleTimeString(),"]"))};function R(e){var r=c[e];return typeof r=="function"?r:c.green}function _(e,r,t,n){var o=R(r);console.log("".concat(T()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function C(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,a=t.padding,s=a===void 0?1:a,c=t.margin,u=c===void 0?1:c,E=t.borderStyle,l=E===void 0?"round":E,f=t.titleColor,S=f===void 0?"bold":f;var p=R(o),d=R(S);if(typeof r=="string"){console.log(i(d(p("".concat(e,"\n").concat(r))),{padding:s,margin:u,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(T()," ").concat(p("File:")," ").concat(D("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(p("Rule:")," ").concat(p(n))),console.log(" ".concat(p("Message:")," ").concat(p(o)))}),console.log(i(d(p("".concat(e,": ").concat(r.length))),{padding:s,margin:u,borderStyle:l,borderColor:o})),console.log(y("─".repeat(40))))}var I={success:function(e){return _("SUCCESS","green","✔",e)},error:function(e){return _("ERROR","red","✖",e)},warning:function(e){return _("WARNING","yellow","⚠",e)},info:function(e){return _("INFO","blue","ℹ",e)},printBoxedLog:C},N=function(e){return"error_list:".concat(e)};function M(e){return G.apply(this,arguments)}function G(){G=r(function(e){var t,n,o;return s(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=N(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,A.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return s(this,function(r){switch(r.label){case 0:return[4,A.getLogLink(n)];case 1:e=r.sent();e&&I.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();I.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return G.apply(this,arguments)}function b(){return P.apply(this,arguments)}function P(){P=r(function(){var e,t,n;return s(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,A.keys()];case 1:e=o.sent(),t=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=r(function(e){var r;return s(this,function(t){switch(t.label){case 0:return[4,A.get(e)];case 1:return[2,((r=t.sent())===null||r===void 0?void 0:r.errors)||[]]}})});return function(r){return e.apply(this,arguments)}}()))];case 2:return[2,o.sent().flat()];case 3:n=o.sent();return[2,(I.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return P.apply(this,arguments)}function w(){return L.apply(this,arguments)}function L(){L=r(function(){var e,r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,A.keys()];case 1:e=n.sent(),r=Array.isArray(e)?e.filter(function(e){var r;return e===null||e===void 0?void 0:(r=e.startsWith)===null||r===void 0?void 0:r.call(e,"error_list:")}):[];return[4,Promise.all(r.map(function(e){return A.remove(e)}))];case 2:n.sent();return[3,4];case 3:t=n.sent();I.error("Failed to clear error lists: ".concat(t.message));return[3,4];case 4:return[2]}})});return L.apply(this,arguments)}function U(e){var r=[],t=[],n="",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("/"))n=e.trim();else{var i=o.exec(e)||[],c=a.exec(e)||[],u=s.exec(e)||[];i.length&&n?r.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):c.length?r.push({file:c[1],position:"".concat(c[2],":").concat(c[3]),type:c[4]==="error"?"error":"warning",message:c[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&M(r),t.length&&m&&(I.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function F(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,s=e.ruleId,i=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(a),rule:s,message:i})})}),t.length&&M(t)}catch(r){U(e)}}function k(e){return x.apply(this,arguments)}function x(){x=r(function(e){var r,t,n,o,a,i,c,u,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:F;t=new AbortController;E.on("SIGINT",function(){I.warning("Process interrupted. Terminating..."),t.abort(),E.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,v(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=s.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});return[3,4];case 3:i=s.sent();c=i.stdout,u=i.stderr,l=i.message;[c,u].forEach(function(e){return e&&r(e)}),!u&&!c&&I.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return x.apply(this,arguments)}import*as j from"node:fs";var Q=function(e){return j.existsSync(e)};import{GraphQLError as q}from"graphql";var H={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"}};function Y(e){var r=e.message,t=e.status,n=t===void 0?H.INTERNAL_SERVER_ERROR:t,o=e.type,a=o===void 0?"graphql":o;var s;var i=(s=r!==null&&r!==void 0?r:n.MESSAGE)!==null&&s!==void 0?s:"Internal server error";throw a==="graphql"?new q(i,{extensions:{code:n.CODE}}):new Error(i)}import B from"node-fetch";import V from"node:fs";import W from"node:path";import{dirname as J}from"node:path";import K from"node:process";import{fileURLToPath as X}from"node:url";var $=X(import.meta.url),z=J($),Z=K.env.INIT_CWD||K.cwd();var ee=24*60*60*1e3;function er(e){return e?W.join(Z,"node_modules",e,"package.json"):W.join(Z,"package.json")}function et(e){return en.apply(this,arguments)}function en(){en=r(function(e){var r,t,n,o,a,i,c,u,E,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,A.get(t)];case 1:o=s.sent();return[4,A.get(n)];case 2:a=s.sent(),i=o&&Date.now()-o.timestamp<ee;if(!r&&i)return[2,o.version];c={};(a===null||a===void 0?void 0:a.etag)&&(c["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(c["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,B("https://registry.npmjs.org/".concat(e,"/latest"),{headers:c})];case 4:u=s.sent();if(u.status===304&&o)return[2,o.version];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:E=s.sent().version;return[4,A.set(t,{version:E,timestamp:Date.now()})];case 6:s.sent();return[4,A.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),E)];case 8:l=s.sent();if(I.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(I.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return en.apply(this,arguments)}function eo(e){return ea.apply(this,arguments)}function ea(){ea=r(function(e){var r,t,n,o,a;var i=arguments;return s(this,function(s){switch(s.label){case 0:r=i.length>1&&i[1]!==void 0?i[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);t=er(e);if(!V.existsSync(t))return[2,(I.info("".concat(e," is not installed.")),!0)];n=JSON.parse(V.readFileSync(t,"utf-8")).version;return[4,et(e,r)];case 2:o=s.sent();return[2,(I.info("Installed version of ".concat(e,": ").concat(n)),I.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(I.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return ea.apply(this,arguments)}function es(e){return ei.apply(this,arguments)}function ei(){ei=r(function(e){var r,o,i,c;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,et(e,!0)];case 1:r=s.sent(),o=er();if(!V.existsSync(o)){I.error("package.json not found. Cannot update ".concat(e));return[2]}i=JSON.parse(V.readFileSync(o,"utf-8"));i.dependencies=a(n({},i.dependencies),t({},e,r)),V.writeFileSync(o,JSON.stringify(i,null,2)),I.info("Updated ".concat(e," to version ").concat(r));return[4,eu()];case 2:s.sent();return[4,k("pnpm run lint:fix")];case 3:s.sent(),I.success("".concat(e," updated successfully."));return[3,5];case 4:c=s.sent();throw I.error("Failed to update ".concat(e,": ").concat(c.message)),c;case 5:return[2]}})});return ei.apply(this,arguments)}function ec(e,r){try{var t=W.join(e,"package.json");return V.existsSync(t)?JSON.parse(V.readFileSync(t,"utf-8")).name===r:!1}catch(e){return I.error("Error reading package.json: ".concat(e.message)),!1}}function eu(){return eE.apply(this,arguments)}function eE(){eE=r(function(){var e,r,t,n,o,a,i,c,u,E,l;return s(this,function(s){switch(s.label){case 0:e=[{command:"pnpm install",message:"Standard installation"},{command:"pnpm install --legacy-peer-deps",message:"Attempting installation with --legacy-peer-deps"},{command:"pnpm install --force",message:"Attempting forced installation"}];r=true,t=false,n=undefined;s.label=1;case 1:s.trys.push([1,8,9,10]);o=e[Symbol.iterator]();s.label=2;case 2:if(!!(r=(a=o.next()).done))return[3,7];i=a.value,c=i.command,u=i.message;s.label=3;case 3:s.trys.push([3,5,,6]);I.info("".concat(u,"..."));return[4,k(c)];case 4:s.sent(),I.success("Dependencies installed using: ".concat(c));return[2];case 5:E=s.sent();I.warning("Failed with: ".concat(c)),I.error("Error: ".concat(E.message));return[3,6];case 6:r=true;return[3,2];case 7:return[3,10];case 8:l=s.sent();t=true;n=l;return[3,10];case 9:try{if(!r&&o.return!=null){o.return()}}finally{if(t){throw n}}return[7];case 10:throw new Error("Failed to install dependencies after multiple attempts.")}})});return eE.apply(this,arguments)}export{w as clearAllErrorLists,I as commandLog,k as executeCommand,Q as fileExists,et as getLatestPackageVersion,b as getStoredErrorLists,h as initNodePersist,eu as installDependencies,ec as isCurrentProject,eo as isPackageOutdated,M as saveErrorListToStorage,O as storageDir,A as storageServer,Y as throwResponse,es as updatePackage};
@@ -1 +1 @@
1
- "use strict";function e(e,t,r,n,o,a,c){try{var i=e[a](c);var u=i.value}catch(e){r(e);return}if(i.done){t(u)}else{Promise.resolve(u).then(n,o)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,a){var c=t.apply(r,n);function i(t){e(c,o,a,i,u,"next",t)}function u(t){e(c,o,a,i,u,"throw",t)}i(undefined)})}}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(t){r(e,t,n[t])})}return e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function a(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{o(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function i(e,t){var r,n,o,a,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function i(e){return function(t){return u([e,t])}}function u(a){if(r)throw new TypeError("Generator is already executing.");while(c)try{if(r=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:c.label++;return{value:a[1],done:false};case 5:c.label++;n=a[1];a=[0];continue;case 7:a=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){c=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){c.label=a[1];break}if(a[0]===6&&c.label<o[1]){c.label=o[1];o=a;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(a);break}if(o[2])c.ops.pop();c.trys.pop();continue}a=t.call(e,c)}catch(e){a=[6,e];n=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var u=Object.create;var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var g=function(e,t){for(var r in t)s(e,r,{get:t[r],enumerable:!0})},h=function(e,t,r,n){var o=true,a=false,i=undefined;if(t&&(typeof t==="undefined"?"undefined":c(t))=="object"||typeof t=="function")try{var u=function(){var o=g.value;!p.call(e,o)&&o!==r&&s(e,o,{get:function(){return t[o]},enumerable:!(n=l(t,o))||n.enumerable})};for(var d=f(t)[Symbol.iterator](),g;!(o=(g=d.next()).done);o=true)u()}catch(e){a=true;i=e}finally{try{if(!o&&d.return!=null){d.return()}}finally{if(a){throw i}}}return e};var y=function(e,t,r){return r=e!=null?u(d(e)):{},h(t||!e||!e.__esModule?s(r,"default",{value:e,enumerable:!0}):r,e)},v=function(e){return h(s({},"__esModule",{value:!0}),e)};var m={};g(m,{getLatestPackageVersion:function(){return eu},isCurrentProject:function(){return eg},isPackageOutdated:function(){return el},updatePackage:function(){return ed}});module.exports=v(m);var b=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},w=b();var O=y(require("node-fetch"),1),S=y(require("fs"),1),k=y(require("path"),1);var j=require("path"),P=y(require("process"),1),E=require("url"),x=(0,E.fileURLToPath)(w),I=(0,j.dirname)(x),L=P.default.env.INIT_CWD||P.default.cwd();var _=y(require("boxen"),1),q=y(require("chalk"),1),N=require("child_process"),C=y(require("process"),1),D=y(require("util"),1);var R=y(require("node-persist"),1),F=y(require("os"),1),T=y(require("path"),1),M=y(require("process"),1),U=M.default.env.CYBERSKILL_STORAGE_DIR||T.default.join(F.default.homedir(),".cyberskill-storage");function A(){return J.apply(this,arguments)}function J(){J=t(function(){var e;return i(this,function(t){switch(t.label){case 0:e=R.default.defaultInstance;if(e)return[3,2];return[4,R.default.init({dir:U,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return J.apply(this,arguments)}var G={get:function e(e){return t(function(){var t,r;return i(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,A()];case 1:n.sent();return[4,R.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,r){return t(function(){var t;return i(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,A()];case 1:n.sent();return[4,R.default.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return t(function(){var t;return i(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,A()];case 1:r.sent();return[4,R.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return t(function(){var e,t;return i(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,A()];case 1:r.sent();return[4,R.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return t(function(){return i(this,function(t){try{return[2,"".concat(U," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var B=C.default.env.DEBUG==="true",V=D.promisify(N.exec),W=q.default,$=W.gray,K=W.blue,Y=function(){return $("[".concat(new Date().toLocaleTimeString(),"]"))};function z(e){var t=q.default[e];return typeof t=="function"?t:q.default.green}function H(e,t,r,n){var o=z(t);console.log("".concat(Y()," ").concat(o("".concat(r," ").concat(e))," ").concat(n))}function Q(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.color,o=n===void 0?"green":n,a=r.padding,c=a===void 0?1:a,i=r.margin,u=i===void 0?1:i,s=r.borderStyle,l=s===void 0?"round":s,f=r.titleColor,d=f===void 0?"bold":f;var p=z(o),g=z(d);if(typeof t=="string"){console.log((0,_.default)(g(p("".concat(e,"\n").concat(t))),{padding:c,margin:u,borderStyle:l,borderColor:o}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,r=e.position,n=e.rule,o=e.message;console.log("".concat(Y()," ").concat(p("File:")," ").concat(K("".concat(t).concat(r?":".concat(r):"")))),n&&console.log(" ".concat(p("Rule:")," ").concat(p(n))),console.log(" ".concat(p("Message:")," ").concat(p(o)))}),console.log((0,_.default)(g(p("".concat(e,": ").concat(t.length))),{padding:c,margin:u,borderStyle:l,borderColor:o})),console.log($("─".repeat(40))))}var X={success:function(e){return H("SUCCESS","green","✔",e)},error:function(e){return H("ERROR","red","✖",e)},warning:function(e){return H("WARNING","yellow","⚠",e)},info:function(e){return H("INFO","blue","ℹ",e)},printBoxedLog:Q},Z=function(e){return"error_list:".concat(e)};function ee(e){return et.apply(this,arguments)}function et(){et=t(function(e){var r,n,o;return i(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];r=Date.now(),n=Z(r);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,G.set(n,{errors:e,timestamp:r})];case 2:a.sent(),setTimeout(/*#__PURE__*/t(function(){var e;return i(this,function(t){switch(t.label){case 0:return[4,G.getLogLink(n)];case 1:e=t.sent();e&&X.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();X.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return et.apply(this,arguments)}function er(e){var t=[],r=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,a=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var i=o.exec(e)||[],u=a.exec(e)||[],s=c.exec(e)||[];i.length&&n?t.push({file:n,position:"".concat(i[1],":").concat(i[2]),type:i[3]==="error"?"error":"warning",message:i[4].trim(),rule:i[5].trim()}):u.length?t.push({file:u[1],position:"".concat(u[2],":").concat(u[3]),type:u[4]==="error"?"error":"warning",message:u[5].trim()}):s.length?t.push({file:"commitlint",type:"error",message:s[1].trim(),rule:s[2].trim()}):r.push(e.trim())}}),t.length&&ee(t),r.length&&B&&(X.warning("Unmatched lines:"),r.forEach(function(e){return console.log(" ".concat(e))}))}function en(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,c=e.ruleId,i=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(o,":").concat(a),rule:c,message:i})})}),r.length&&ee(r)}catch(t){er(e)}}function eo(e){return ea.apply(this,arguments)}function ea(){ea=t(function(e){var t,r,n,o,a,c,u,s,l;var f=arguments;return i(this,function(i){switch(i.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:en;r=new AbortController;C.default.on("SIGINT",function(){X.warning("Process interrupted. Terminating..."),r.abort(),C.default.exit()});i.label=1;case 1:i.trys.push([1,3,,4]);return[4,V(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=i.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&t(e)});return[3,4];case 3:c=i.sent();u=c.stdout,s=c.stderr,l=c.message;[u,s].forEach(function(e){return e&&t(e)}),!s&&!u&&X.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return ea.apply(this,arguments)}var ec=24*60*60*1e3;function ei(e){return e?k.default.join(L,"node_modules",e,"package.json"):k.default.join(L,"package.json")}function eu(e){return es.apply(this,arguments)}function es(){es=t(function(e){var t,r,n,o,a,c,u,s,l,f;var d=arguments;return i(this,function(i){switch(i.label){case 0:t=d.length>1&&d[1]!==void 0?d[1]:!1;r="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,G.get(r)];case 1:o=i.sent();return[4,G.get(n)];case 2:a=i.sent(),c=o&&Date.now()-o.timestamp<ec;if(!t&&c)return[2,o.version];u={};(a===null||a===void 0?void 0:a.etag)&&(u["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(u["If-Modified-Since"]=a.lastModified);i.label=3;case 3:i.trys.push([3,8,,9]);return[4,(0,O.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:s=i.sent();if(s.status===304&&o)return[2,o.version];if(!s.ok)throw new Error("Failed to fetch latest version: ".concat(s.statusText));return[4,s.json()];case 5:l=i.sent().version;return[4,G.set(r,{version:l,timestamp:Date.now()})];case 6:i.sent();return[4,G.set(n,{etag:s.headers.get("ETag")||void 0,lastModified:s.headers.get("Last-Modified")||void 0})];case 7:return[2,(i.sent(),l)];case 8:f=i.sent();if(X.error("Error fetching latest version for ".concat(e,": ").concat(f.message)),o)return[2,(X.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw f;case 9:return[2]}})});return es.apply(this,arguments)}function el(e){return ef.apply(this,arguments)}function ef(){ef=t(function(e){var t,r,n,o,a;var c=arguments;return i(this,function(i){switch(i.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:!0;i.label=1;case 1:i.trys.push([1,3,,4]);r=ei(e);if(!S.default.existsSync(r))return[2,(X.info("".concat(e," is not installed.")),!0)];n=JSON.parse(S.default.readFileSync(r,"utf-8")).version;return[4,eu(e,t)];case 2:o=i.sent();return[2,(X.info("Installed version of ".concat(e,": ").concat(n)),X.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=i.sent();return[2,(X.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return ef.apply(this,arguments)}function ed(e){return ep.apply(this,arguments)}function ep(){ep=t(function(e){var t,o,c,u;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,4,,5]);return[4,eu(e,!0)];case 1:t=i.sent(),o=ei();if(!S.default.existsSync(o)){X.error("package.json not found. Cannot update ".concat(e));return[2]}c=JSON.parse(S.default.readFileSync(o,"utf-8"));c.dependencies=a(n({},c.dependencies),r({},e,t)),S.default.writeFileSync(o,JSON.stringify(c,null,2)),X.info("Updated ".concat(e," to version ").concat(t));return[4,eo("npm i -f")];case 2:i.sent();return[4,eo("npm run lint:fix")];case 3:i.sent(),X.success("".concat(e," updated successfully."));return[3,5];case 4:u=i.sent();throw X.error("Failed to update ".concat(e,": ").concat(u.message)),u;case 5:return[2]}})});return ep.apply(this,arguments)}function eg(e,t){try{var r=k.default.join(e,"package.json");return S.default.existsSync(r)?JSON.parse(S.default.readFileSync(r,"utf-8")).name===t:!1}catch(e){return X.error("Error reading package.json: ".concat(e.message)),!1}}0&&(module.exports={getLatestPackageVersion:getLatestPackageVersion,isCurrentProject:isCurrentProject,isPackageOutdated:isPackageOutdated,updatePackage:updatePackage});
1
+ "use strict";function e(e,t,r,n,a,o,c){try{var s=e[o](c);var i=s.value}catch(e){r(e);return}if(s.done){t(i)}else{Promise.resolve(i).then(n,a)}}function t(t){return function(){var r=this,n=arguments;return new Promise(function(a,o){var c=t.apply(r,n);function s(t){e(c,a,o,s,i,"next",t)}function i(t){e(c,a,o,s,i,"throw",t)}s(undefined)})}}function r(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function n(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var a=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){a=a.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}a.forEach(function(t){r(e,t,n[t])})}return e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}r.push.apply(r,n)}return r}function o(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{a(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function c(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function s(e,t){var r,n,a,o,c={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return i([e,t])}}function i(o){if(r)throw new TypeError("Generator is already executing.");while(c)try{if(r=1,n&&(a=o[0]&2?n["return"]:o[0]?n["throw"]||((a=n["return"])&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;if(n=0,a)o=[o[0]&2,a.value];switch(o[0]){case 0:case 1:a=o;break;case 4:c.label++;return{value:o[1],done:false};case 5:c.label++;n=o[1];o=[0];continue;case 7:o=c.ops.pop();c.trys.pop();continue;default:if(!(a=c.trys,a=a.length>0&&a[a.length-1])&&(o[0]===6||o[0]===2)){c=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){c.label=o[1];break}if(o[0]===6&&c.label<a[1]){c.label=a[1];a=o;break}if(a&&c.label<a[2]){c.label=a[2];c.ops.push(o);break}if(a[2])c.ops.pop();c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e];n=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}}var i=Object.create;var u=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var g=function(e,t){for(var r in t)u(e,r,{get:t[r],enumerable:!0})},h=function(e,t,r,n){var a=true,o=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":c(t))=="object"||typeof t=="function")try{var i=function(){var a=g.value;!p.call(e,a)&&a!==r&&u(e,a,{get:function(){return t[a]},enumerable:!(n=l(t,a))||n.enumerable})};for(var d=f(t)[Symbol.iterator](),g;!(a=(g=d.next()).done);a=true)i()}catch(e){o=true;s=e}finally{try{if(!a&&d.return!=null){d.return()}}finally{if(o){throw s}}}return e};var y=function(e,t,r){return r=e!=null?i(d(e)):{},h(t||!e||!e.__esModule?u(r,"default",{value:e,enumerable:!0}):r,e)},v=function(e){return h(u({},"__esModule",{value:!0}),e)};var m={};g(m,{getLatestPackageVersion:function(){return ei},installDependencies:function(){return eh},isCurrentProject:function(){return eg},isPackageOutdated:function(){return el},updatePackage:function(){return ed}});module.exports=v(m);var b=function(){return(typeof document==="undefined"?"undefined":c(document))>"u"?new URL("file:".concat(__filename)).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href},w=b();var O=y(require("node-fetch"),1),S=y(require("fs"),1),k=y(require("path"),1);var j=require("path"),P=y(require("process"),1),E=require("url"),x=(0,E.fileURLToPath)(w),I=(0,j.dirname)(x),L=P.default.env.INIT_CWD||P.default.cwd();var _=y(require("boxen"),1),D=y(require("chalk"),1),q=require("child_process"),N=y(require("process"),1),C=y(require("util"),1);var F=y(require("node-persist"),1),R=y(require("os"),1),T=y(require("path"),1),A=y(require("process"),1),M=A.default.env.CYBERSKILL_STORAGE_DIR||T.default.join(R.default.homedir(),".cyberskill-storage");function U(){return J.apply(this,arguments)}function J(){J=t(function(){var e;return s(this,function(t){switch(t.label){case 0:e=F.default.defaultInstance;if(e)return[3,2];return[4,F.default.init({dir:M,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return J.apply(this,arguments)}var G={get:function e(e){return t(function(){var t,r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,U()];case 1:n.sent();return[4,F.default.getItem(e)];case 2:return[2,(t=n.sent())!==null&&t!==void 0?t:null];case 3:r=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),r),null)];case 4:return[2]}})})()},set:function e(e,r){return t(function(){var t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,U()];case 1:n.sent();return[4,F.default.setItem(e,r)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return t(function(){var t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,U()];case 1:r.sent();return[4,F.default.removeItem(e)];case 2:r.sent();return[3,4];case 3:t=r.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return t(function(){var e,t;return s(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,U()];case 1:r.sent();return[4,F.default.keys()];case 2:e=r.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=r.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return t(function(){return s(this,function(t){try{return[2,"".concat(M," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var B=N.default.env.DEBUG==="true",V=C.promisify(q.exec),W=D.default,$=W.gray,K=W.blue,Y=function(){return $("[".concat(new Date().toLocaleTimeString(),"]"))};function z(e){var t=D.default[e];return typeof t=="function"?t:D.default.green}function H(e,t,r,n){var a=z(t);console.log("".concat(Y()," ").concat(a("".concat(r," ").concat(e))," ").concat(n))}function Q(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.color,a=n===void 0?"green":n,o=r.padding,c=o===void 0?1:o,s=r.margin,i=s===void 0?1:s,u=r.borderStyle,l=u===void 0?"round":u,f=r.titleColor,d=f===void 0?"bold":f;var p=z(a),g=z(d);if(typeof t=="string"){console.log((0,_.default)(g(p("".concat(e,"\n").concat(t))),{padding:c,margin:i,borderStyle:l,borderColor:a}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,r=e.position,n=e.rule,a=e.message;console.log("".concat(Y()," ").concat(p("File:")," ").concat(K("".concat(t).concat(r?":".concat(r):"")))),n&&console.log(" ".concat(p("Rule:")," ").concat(p(n))),console.log(" ".concat(p("Message:")," ").concat(p(a)))}),console.log((0,_.default)(g(p("".concat(e,": ").concat(t.length))),{padding:c,margin:i,borderStyle:l,borderColor:a})),console.log($("─".repeat(40))))}var X={success:function(e){return H("SUCCESS","green","✔",e)},error:function(e){return H("ERROR","red","✖",e)},warning:function(e){return H("WARNING","yellow","⚠",e)},info:function(e){return H("INFO","blue","ℹ",e)},printBoxedLog:Q},Z=function(e){return"error_list:".concat(e)};function ee(e){return et.apply(this,arguments)}function et(){et=t(function(e){var r,n,a;return s(this,function(o){switch(o.label){case 0:if(e.length===0)return[2];r=Date.now(),n=Z(r);o.label=1;case 1:o.trys.push([1,3,,4]);return[4,G.set(n,{errors:e,timestamp:r})];case 2:o.sent(),setTimeout(/*#__PURE__*/t(function(){var e;return s(this,function(t){switch(t.label){case 0:return[4,G.getLogLink(n)];case 1:e=t.sent();e&&X.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:a=o.sent();X.error("Failed to save errors: ".concat(a.message));return[3,4];case 4:return[2]}})});return et.apply(this,arguments)}function er(e){var t=[],r=[],n="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s=a.exec(e)||[],i=o.exec(e)||[],u=c.exec(e)||[];s.length&&n?t.push({file:n,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):i.length?t.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4]==="error"?"error":"warning",message:i[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):r.push(e.trim())}}),t.length&&ee(t),r.length&&B&&(X.warning("Unmatched lines:"),r.forEach(function(e){return console.log(" ".concat(e))}))}function en(e){try{var t=JSON.parse(e),r=[];t.forEach(function(e){var t=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,a=e.line,o=e.column,c=e.ruleId,s=e.message;r.push({type:n===2?"error":"warning",file:t,position:"".concat(a,":").concat(o),rule:c,message:s})})}),r.length&&ee(r)}catch(t){er(e)}}function ea(e){return eo.apply(this,arguments)}function eo(){eo=t(function(e){var t,r,n,a,o,c,i,u,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:en;r=new AbortController;N.default.on("SIGINT",function(){X.warning("Process interrupted. Terminating..."),r.abort(),N.default.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,V(e,{maxBuffer:0x6400000,signal:r.signal})];case 2:n=s.sent(),a=n.stdout,o=n.stderr;[a,o].forEach(function(e){return e&&t(e)});return[3,4];case 3:c=s.sent();i=c.stdout,u=c.stderr,l=c.message;[i,u].forEach(function(e){return e&&t(e)}),!u&&!i&&X.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return eo.apply(this,arguments)}var ec=24*60*60*1e3;function es(e){return e?k.default.join(L,"node_modules",e,"package.json"):k.default.join(L,"package.json")}function ei(e){return eu.apply(this,arguments)}function eu(){eu=t(function(e){var t,r,n,a,o,c,i,u,l,f;var d=arguments;return s(this,function(s){switch(s.label){case 0:t=d.length>1&&d[1]!==void 0?d[1]:!1;r="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,G.get(r)];case 1:a=s.sent();return[4,G.get(n)];case 2:o=s.sent(),c=a&&Date.now()-a.timestamp<ec;if(!t&&c)return[2,a.version];i={};(o===null||o===void 0?void 0:o.etag)&&(i["If-None-Match"]=o.etag),(o===null||o===void 0?void 0:o.lastModified)&&(i["If-Modified-Since"]=o.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,(0,O.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:i})];case 4:u=s.sent();if(u.status===304&&a)return[2,a.version];if(!u.ok)throw new Error("Failed to fetch latest version: ".concat(u.statusText));return[4,u.json()];case 5:l=s.sent().version;return[4,G.set(r,{version:l,timestamp:Date.now()})];case 6:s.sent();return[4,G.set(n,{etag:u.headers.get("ETag")||void 0,lastModified:u.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),l)];case 8:f=s.sent();if(X.error("Error fetching latest version for ".concat(e,": ").concat(f.message)),a)return[2,(X.warning("Falling back to cached version for ".concat(e,": ").concat(a.version)),a.version)];throw f;case 9:return[2]}})});return eu.apply(this,arguments)}function el(e){return ef.apply(this,arguments)}function ef(){ef=t(function(e){var t,r,n,a,o;var c=arguments;return s(this,function(s){switch(s.label){case 0:t=c.length>1&&c[1]!==void 0?c[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);r=es(e);if(!S.default.existsSync(r))return[2,(X.info("".concat(e," is not installed.")),!0)];n=JSON.parse(S.default.readFileSync(r,"utf-8")).version;return[4,ei(e,t)];case 2:a=s.sent();return[2,(X.info("Installed version of ".concat(e,": ").concat(n)),X.info("Latest version of ".concat(e,": ").concat(a)),n!==a)];case 3:o=s.sent();return[2,(X.warning("Failed to check version for ".concat(e,": ").concat(o.message)),!0)];case 4:return[2]}})});return ef.apply(this,arguments)}function ed(e){return ep.apply(this,arguments)}function ep(){ep=t(function(e){var t,a,c,i;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,ei(e,!0)];case 1:t=s.sent(),a=es();if(!S.default.existsSync(a)){X.error("package.json not found. Cannot update ".concat(e));return[2]}c=JSON.parse(S.default.readFileSync(a,"utf-8"));c.dependencies=o(n({},c.dependencies),r({},e,t)),S.default.writeFileSync(a,JSON.stringify(c,null,2)),X.info("Updated ".concat(e," to version ").concat(t));return[4,eh()];case 2:s.sent();return[4,ea("pnpm run lint:fix")];case 3:s.sent(),X.success("".concat(e," updated successfully."));return[3,5];case 4:i=s.sent();throw X.error("Failed to update ".concat(e,": ").concat(i.message)),i;case 5:return[2]}})});return ep.apply(this,arguments)}function eg(e,t){try{var r=k.default.join(e,"package.json");return S.default.existsSync(r)?JSON.parse(S.default.readFileSync(r,"utf-8")).name===t:!1}catch(e){return X.error("Error reading package.json: ".concat(e.message)),!1}}function eh(){return ey.apply(this,arguments)}function ey(){ey=t(function(){var e,t,r,n,a,o,c,i,u,l,f;return s(this,function(s){switch(s.label){case 0:e=[{command:"pnpm install",message:"Standard installation"},{command:"pnpm install --legacy-peer-deps",message:"Attempting installation with --legacy-peer-deps"},{command:"pnpm install --force",message:"Attempting forced installation"}];t=true,r=false,n=undefined;s.label=1;case 1:s.trys.push([1,8,9,10]);a=e[Symbol.iterator]();s.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,7];c=o.value,i=c.command,u=c.message;s.label=3;case 3:s.trys.push([3,5,,6]);X.info("".concat(u,"..."));return[4,ea(i)];case 4:s.sent(),X.success("Dependencies installed using: ".concat(i));return[2];case 5:l=s.sent();X.warning("Failed with: ".concat(i)),X.error("Error: ".concat(l.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:f=s.sent();r=true;n=f;return[3,10];case 9:try{if(!t&&a.return!=null){a.return()}}finally{if(r){throw n}}return[7];case 10:throw new Error("Failed to install dependencies after multiple attempts.")}})});return ey.apply(this,arguments)}0&&(module.exports={getLatestPackageVersion:getLatestPackageVersion,installDependencies:installDependencies,isCurrentProject:isCurrentProject,isPackageOutdated:isPackageOutdated,updatePackage:updatePackage});
@@ -2,3 +2,4 @@ export { getLatestPackageVersion_alias_2 as getLatestPackageVersion } from '../_
2
2
  export { isPackageOutdated_alias_2 as isPackageOutdated } from '../_tsup-dts-rollup.cjs';
3
3
  export { updatePackage_alias_2 as updatePackage } from '../_tsup-dts-rollup.cjs';
4
4
  export { isCurrentProject_alias_2 as isCurrentProject } from '../_tsup-dts-rollup.cjs';
5
+ export { installDependencies_alias_2 as installDependencies } from '../_tsup-dts-rollup.cjs';
@@ -2,3 +2,4 @@ export { getLatestPackageVersion_alias_2 as getLatestPackageVersion } from '../_
2
2
  export { isPackageOutdated_alias_2 as isPackageOutdated } from '../_tsup-dts-rollup.js';
3
3
  export { updatePackage_alias_2 as updatePackage } from '../_tsup-dts-rollup.js';
4
4
  export { isCurrentProject_alias_2 as isCurrentProject } from '../_tsup-dts-rollup.js';
5
+ export { installDependencies_alias_2 as installDependencies } from '../_tsup-dts-rollup.js';
@@ -1 +1 @@
1
- function e(e,r,t,n,o,c,a){try{var s=e[c](a);var i=s.value}catch(e){t(e);return}if(s.done){r(i)}else{Promise.resolve(i).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,c){var a=r.apply(t,n);function s(r){e(a,o,c,s,i,"next",r)}function i(r){e(a,o,c,s,i,"throw",r)}s(undefined)})}}function t(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function n(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(r){t(e,r,n[r])})}return e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function c(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function a(e,r){var t,n,o,c,a={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return c={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function s(e){return function(r){return i([e,r])}}function i(c){if(t)throw new TypeError("Generator is already executing.");while(a)try{if(t=1,n&&(o=c[0]&2?n["return"]:c[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;if(n=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;n=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(o=a.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(c[0]===6&&a.label<o[1]){a.label=o[1];o=c;break}if(o&&a.label<o[2]){a.label=o[2];a.ops.push(c);break}if(o[2])a.ops.pop();a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e];n=0}finally{t=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}import s from"node-fetch";import i from"node:fs";import u from"node:path";import{dirname as l}from"node:path";import f from"node:process";import{fileURLToPath as p}from"node:url";var g=p(import.meta.url),d=l(g),h=f.env.INIT_CWD||f.cwd();import m from"boxen";import y from"chalk";import{exec as v}from"node:child_process";import b from"node:process";import*as w from"node:util";import S from"node-persist";import O from"node:os";import k from"node:path";import j from"node:process";var E=j.env.CYBERSKILL_STORAGE_DIR||k.join(O.homedir(),".cyberskill-storage");function P(){return x.apply(this,arguments)}function x(){x=r(function(){var e;return a(this,function(r){switch(r.label){case 0:e=S.defaultInstance;if(e)return[3,2];return[4,S.init({dir:E,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return x.apply(this,arguments)}var I={get:function e(e){return r(function(){var r,t;return a(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,S.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return a(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,S.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return a(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,S.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return a(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,S.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return a(this,function(r){try{return[2,"".concat(E," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var L=b.env.DEBUG==="true",N=w.promisify(v),_=y.gray,C=y.blue,D=function(){return _("[".concat(new Date().toLocaleTimeString(),"]"))};function F(e){var r=y[e];return typeof r=="function"?r:y.green}function T(e,r,t,n){var o=F(r);console.log("".concat(D()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function R(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,c=t.padding,a=c===void 0?1:c,s=t.margin,i=s===void 0?1:s,u=t.borderStyle,l=u===void 0?"round":u,f=t.titleColor,p=f===void 0?"bold":f;var g=F(o),d=F(p);if(typeof r=="string"){console.log(m(d(g("".concat(e,"\n").concat(r))),{padding:a,margin:i,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(D()," ").concat(g("File:")," ").concat(C("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(g("Rule:")," ").concat(g(n))),console.log(" ".concat(g("Message:")," ").concat(g(o)))}),console.log(m(d(g("".concat(e,": ").concat(r.length))),{padding:a,margin:i,borderStyle:l,borderColor:o})),console.log(_("─".repeat(40))))}var A={success:function(e){return T("SUCCESS","green","✔",e)},error:function(e){return T("ERROR","red","✖",e)},warning:function(e){return T("WARNING","yellow","⚠",e)},info:function(e){return T("INFO","blue","ℹ",e)},printBoxedLog:R},J=function(e){return"error_list:".concat(e)};function M(e){return U.apply(this,arguments)}function U(){U=r(function(e){var t,n,o;return a(this,function(c){switch(c.label){case 0:if(e.length===0)return[2];t=Date.now(),n=J(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,I.set(n,{errors:e,timestamp:t})];case 2:c.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return a(this,function(r){switch(r.label){case 0:return[4,I.getLogLink(n)];case 1:e=r.sent();e&&A.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=c.sent();A.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return U.apply(this,arguments)}function G(e){var r=[],t=[],n="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))n=e.trim();else{var s=o.exec(e)||[],i=c.exec(e)||[],u=a.exec(e)||[];s.length&&n?r.push({file:n,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):i.length?r.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4]==="error"?"error":"warning",message:i[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&M(r),t.length&&L&&(A.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function B(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,c=e.column,a=e.ruleId,s=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(c),rule:a,message:s})})}),t.length&&M(t)}catch(r){G(e)}}function W(e){return $.apply(this,arguments)}function $(){$=r(function(e){var r,t,n,o,c,s,i,u,l;var f=arguments;return a(this,function(a){switch(a.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:B;t=new AbortController;b.on("SIGINT",function(){A.warning("Process interrupted. Terminating..."),t.abort(),b.exit()});a.label=1;case 1:a.trys.push([1,3,,4]);return[4,N(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=a.sent(),o=n.stdout,c=n.stderr;[o,c].forEach(function(e){return e&&r(e)});return[3,4];case 3:s=a.sent();i=s.stdout,u=s.stderr,l=s.message;[i,u].forEach(function(e){return e&&r(e)}),!u&&!i&&A.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return $.apply(this,arguments)}var K=24*60*60*1e3;function V(e){return e?u.join(h,"node_modules",e,"package.json"):u.join(h,"package.json")}function Y(e){return q.apply(this,arguments)}function q(){q=r(function(e){var r,t,n,o,c,i,u,l,f,p;var g=arguments;return a(this,function(a){switch(a.label){case 0:r=g.length>1&&g[1]!==void 0?g[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,I.get(t)];case 1:o=a.sent();return[4,I.get(n)];case 2:c=a.sent(),i=o&&Date.now()-o.timestamp<K;if(!r&&i)return[2,o.version];u={};(c===null||c===void 0?void 0:c.etag)&&(u["If-None-Match"]=c.etag),(c===null||c===void 0?void 0:c.lastModified)&&(u["If-Modified-Since"]=c.lastModified);a.label=3;case 3:a.trys.push([3,8,,9]);return[4,s("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:l=a.sent();if(l.status===304&&o)return[2,o.version];if(!l.ok)throw new Error("Failed to fetch latest version: ".concat(l.statusText));return[4,l.json()];case 5:f=a.sent().version;return[4,I.set(t,{version:f,timestamp:Date.now()})];case 6:a.sent();return[4,I.set(n,{etag:l.headers.get("ETag")||void 0,lastModified:l.headers.get("Last-Modified")||void 0})];case 7:return[2,(a.sent(),f)];case 8:p=a.sent();if(A.error("Error fetching latest version for ".concat(e,": ").concat(p.message)),o)return[2,(A.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw p;case 9:return[2]}})});return q.apply(this,arguments)}function z(e){return H.apply(this,arguments)}function H(){H=r(function(e){var r,t,n,o,c;var s=arguments;return a(this,function(a){switch(a.label){case 0:r=s.length>1&&s[1]!==void 0?s[1]:!0;a.label=1;case 1:a.trys.push([1,3,,4]);t=V(e);if(!i.existsSync(t))return[2,(A.info("".concat(e," is not installed.")),!0)];n=JSON.parse(i.readFileSync(t,"utf-8")).version;return[4,Y(e,r)];case 2:o=a.sent();return[2,(A.info("Installed version of ".concat(e,": ").concat(n)),A.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:c=a.sent();return[2,(A.warning("Failed to check version for ".concat(e,": ").concat(c.message)),!0)];case 4:return[2]}})});return H.apply(this,arguments)}function Q(e){return X.apply(this,arguments)}function X(){X=r(function(e){var r,o,s,u;return a(this,function(a){switch(a.label){case 0:a.trys.push([0,4,,5]);return[4,Y(e,!0)];case 1:r=a.sent(),o=V();if(!i.existsSync(o)){A.error("package.json not found. Cannot update ".concat(e));return[2]}s=JSON.parse(i.readFileSync(o,"utf-8"));s.dependencies=c(n({},s.dependencies),t({},e,r)),i.writeFileSync(o,JSON.stringify(s,null,2)),A.info("Updated ".concat(e," to version ").concat(r));return[4,W("npm i -f")];case 2:a.sent();return[4,W("npm run lint:fix")];case 3:a.sent(),A.success("".concat(e," updated successfully."));return[3,5];case 4:u=a.sent();throw A.error("Failed to update ".concat(e,": ").concat(u.message)),u;case 5:return[2]}})});return X.apply(this,arguments)}function Z(e,r){try{var t=u.join(e,"package.json");return i.existsSync(t)?JSON.parse(i.readFileSync(t,"utf-8")).name===r:!1}catch(e){return A.error("Error reading package.json: ".concat(e.message)),!1}}export{Y as getLatestPackageVersion,Z as isCurrentProject,z as isPackageOutdated,Q as updatePackage};
1
+ function e(e,r,t,n,o,a,s){try{var c=e[a](s);var i=c.value}catch(e){t(e);return}if(c.done){r(i)}else{Promise.resolve(i).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,a){var s=r.apply(t,n);function c(r){e(s,o,a,c,i,"next",r)}function i(r){e(s,o,a,c,i,"throw",r)}c(undefined)})}}function t(e,r,t){if(r in e){Object.defineProperty(e,r,{value:t,enumerable:true,configurable:true,writable:true})}else{e[r]=t}return e}function n(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};var o=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}o.forEach(function(r){t(e,r,n[r])})}return e}function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(r){n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})}t.push.apply(t,n)}return t}function a(e,r){r=r!=null?r:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(r))}else{o(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function s(e,r){var t,n,o,a,s={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),"throw":c(1),"return":c(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(r){return i([e,r])}}function i(a){if(t)throw new TypeError("Generator is already executing.");while(s)try{if(t=1,n&&(o=a[0]&2?n["return"]:a[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;if(n=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;n=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(o=s.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(a[0]===6&&s.label<o[1]){s.label=o[1];o=a;break}if(o&&s.label<o[2]){s.label=o[2];s.ops.push(a);break}if(o[2])s.ops.pop();s.trys.pop();continue}a=r.call(e,s)}catch(e){a=[6,e];n=0}finally{t=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}import c from"node-fetch";import i from"node:fs";import u from"node:path";import{dirname as l}from"node:path";import f from"node:process";import{fileURLToPath as p}from"node:url";var g=p(import.meta.url),d=l(g),h=f.env.INIT_CWD||f.cwd();import m from"boxen";import y from"chalk";import{exec as v}from"node:child_process";import b from"node:process";import*as w from"node:util";import S from"node-persist";import O from"node:os";import k from"node:path";import E from"node:process";var j=E.env.CYBERSKILL_STORAGE_DIR||k.join(O.homedir(),".cyberskill-storage");function P(){return x.apply(this,arguments)}function x(){x=r(function(){var e;return s(this,function(r){switch(r.label){case 0:e=S.defaultInstance;if(e)return[3,2];return[4,S.init({dir:j,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return x.apply(this,arguments)}var I={get:function e(e){return r(function(){var r,t;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,S.getItem(e)];case 2:return[2,(r=n.sent())!==null&&r!==void 0?r:null];case 3:t=n.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),t),null)];case 4:return[2]}})})()},set:function e(e,t){return r(function(){var r;return s(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,P()];case 1:n.sent();return[4,S.setItem(e,t)];case 2:n.sent();return[3,4];case 3:r=n.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,S.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return s(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,P()];case 1:t.sent();return[4,S.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return s(this,function(r){try{return[2,"".concat(j," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var L=b.env.DEBUG==="true",D=w.promisify(v),F=y.gray,N=y.blue,C=function(){return F("[".concat(new Date().toLocaleTimeString(),"]"))};function T(e){var r=y[e];return typeof r=="function"?r:y.green}function _(e,r,t,n){var o=T(r);console.log("".concat(C()," ").concat(o("".concat(t," ").concat(e))," ").concat(n))}function A(e,r){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=t.color,o=n===void 0?"green":n,a=t.padding,s=a===void 0?1:a,c=t.margin,i=c===void 0?1:c,u=t.borderStyle,l=u===void 0?"round":u,f=t.titleColor,p=f===void 0?"bold":f;var g=T(o),d=T(p);if(typeof r=="string"){console.log(m(d(g("".concat(e,"\n").concat(r))),{padding:s,margin:i,borderStyle:l,borderColor:o}));return}Array.isArray(r)&&r.length&&(r.forEach(function(e){var r=e.file,t=e.position,n=e.rule,o=e.message;console.log("".concat(C()," ").concat(g("File:")," ").concat(N("".concat(r).concat(t?":".concat(t):"")))),n&&console.log(" ".concat(g("Rule:")," ").concat(g(n))),console.log(" ".concat(g("Message:")," ").concat(g(o)))}),console.log(m(d(g("".concat(e,": ").concat(r.length))),{padding:s,margin:i,borderStyle:l,borderColor:o})),console.log(F("─".repeat(40))))}var R={success:function(e){return _("SUCCESS","green","✔",e)},error:function(e){return _("ERROR","red","✖",e)},warning:function(e){return _("WARNING","yellow","⚠",e)},info:function(e){return _("INFO","blue","ℹ",e)},printBoxedLog:A},J=function(e){return"error_list:".concat(e)};function M(e){return U.apply(this,arguments)}function U(){U=r(function(e){var t,n,o;return s(this,function(a){switch(a.label){case 0:if(e.length===0)return[2];t=Date.now(),n=J(t);a.label=1;case 1:a.trys.push([1,3,,4]);return[4,I.set(n,{errors:e,timestamp:t})];case 2:a.sent(),setTimeout(/*#__PURE__*/r(function(){var e;return s(this,function(r){switch(r.label){case 0:return[4,I.getLogLink(n)];case 1:e=r.sent();e&&R.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:o=a.sent();R.error("Failed to save errors: ".concat(o.message));return[3,4];case 4:return[2]}})});return U.apply(this,arguments)}function G(e){var r=[],t=[],n="",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("/"))n=e.trim();else{var c=o.exec(e)||[],i=a.exec(e)||[],u=s.exec(e)||[];c.length&&n?r.push({file:n,position:"".concat(c[1],":").concat(c[2]),type:c[3]==="error"?"error":"warning",message:c[4].trim(),rule:c[5].trim()}):i.length?r.push({file:i[1],position:"".concat(i[2],":").concat(i[3]),type:i[4]==="error"?"error":"warning",message:i[5].trim()}):u.length?r.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):t.push(e.trim())}}),r.length&&M(r),t.length&&L&&(R.warning("Unmatched lines:"),t.forEach(function(e){return console.log(" ".concat(e))}))}function B(e){try{var r=JSON.parse(e),t=[];r.forEach(function(e){var r=e.filePath,n=e.messages;n.forEach(function(e){var n=e.severity,o=e.line,a=e.column,s=e.ruleId,c=e.message;t.push({type:n===2?"error":"warning",file:r,position:"".concat(o,":").concat(a),rule:s,message:c})})}),t.length&&M(t)}catch(r){G(e)}}function W(e){return $.apply(this,arguments)}function $(){$=r(function(e){var r,t,n,o,a,c,i,u,l;var f=arguments;return s(this,function(s){switch(s.label){case 0:r=f.length>1&&f[1]!==void 0?f[1]:B;t=new AbortController;b.on("SIGINT",function(){R.warning("Process interrupted. Terminating..."),t.abort(),b.exit()});s.label=1;case 1:s.trys.push([1,3,,4]);return[4,D(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:n=s.sent(),o=n.stdout,a=n.stderr;[o,a].forEach(function(e){return e&&r(e)});return[3,4];case 3:c=s.sent();i=c.stdout,u=c.stderr,l=c.message;[i,u].forEach(function(e){return e&&r(e)}),!u&&!i&&R.error("Command failed: ".concat(l));return[3,4];case 4:return[2]}})});return $.apply(this,arguments)}var K=24*60*60*1e3;function Q(e){return e?u.join(h,"node_modules",e,"package.json"):u.join(h,"package.json")}function V(e){return Y.apply(this,arguments)}function Y(){Y=r(function(e){var r,t,n,o,a,i,u,l,f,p;var g=arguments;return s(this,function(s){switch(s.label){case 0:r=g.length>1&&g[1]!==void 0?g[1]:!1;t="npm_version:".concat(e),n="npm_metadata:".concat(e);return[4,I.get(t)];case 1:o=s.sent();return[4,I.get(n)];case 2:a=s.sent(),i=o&&Date.now()-o.timestamp<K;if(!r&&i)return[2,o.version];u={};(a===null||a===void 0?void 0:a.etag)&&(u["If-None-Match"]=a.etag),(a===null||a===void 0?void 0:a.lastModified)&&(u["If-Modified-Since"]=a.lastModified);s.label=3;case 3:s.trys.push([3,8,,9]);return[4,c("https://registry.npmjs.org/".concat(e,"/latest"),{headers:u})];case 4:l=s.sent();if(l.status===304&&o)return[2,o.version];if(!l.ok)throw new Error("Failed to fetch latest version: ".concat(l.statusText));return[4,l.json()];case 5:f=s.sent().version;return[4,I.set(t,{version:f,timestamp:Date.now()})];case 6:s.sent();return[4,I.set(n,{etag:l.headers.get("ETag")||void 0,lastModified:l.headers.get("Last-Modified")||void 0})];case 7:return[2,(s.sent(),f)];case 8:p=s.sent();if(R.error("Error fetching latest version for ".concat(e,": ").concat(p.message)),o)return[2,(R.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw p;case 9:return[2]}})});return Y.apply(this,arguments)}function q(e){return z.apply(this,arguments)}function z(){z=r(function(e){var r,t,n,o,a;var c=arguments;return s(this,function(s){switch(s.label){case 0:r=c.length>1&&c[1]!==void 0?c[1]:!0;s.label=1;case 1:s.trys.push([1,3,,4]);t=Q(e);if(!i.existsSync(t))return[2,(R.info("".concat(e," is not installed.")),!0)];n=JSON.parse(i.readFileSync(t,"utf-8")).version;return[4,V(e,r)];case 2:o=s.sent();return[2,(R.info("Installed version of ".concat(e,": ").concat(n)),R.info("Latest version of ".concat(e,": ").concat(o)),n!==o)];case 3:a=s.sent();return[2,(R.warning("Failed to check version for ".concat(e,": ").concat(a.message)),!0)];case 4:return[2]}})});return z.apply(this,arguments)}function H(e){return X.apply(this,arguments)}function X(){X=r(function(e){var r,o,c,u;return s(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,V(e,!0)];case 1:r=s.sent(),o=Q();if(!i.existsSync(o)){R.error("package.json not found. Cannot update ".concat(e));return[2]}c=JSON.parse(i.readFileSync(o,"utf-8"));c.dependencies=a(n({},c.dependencies),t({},e,r)),i.writeFileSync(o,JSON.stringify(c,null,2)),R.info("Updated ".concat(e," to version ").concat(r));return[4,ee()];case 2:s.sent();return[4,W("pnpm run lint:fix")];case 3:s.sent(),R.success("".concat(e," updated successfully."));return[3,5];case 4:u=s.sent();throw R.error("Failed to update ".concat(e,": ").concat(u.message)),u;case 5:return[2]}})});return X.apply(this,arguments)}function Z(e,r){try{var t=u.join(e,"package.json");return i.existsSync(t)?JSON.parse(i.readFileSync(t,"utf-8")).name===r:!1}catch(e){return R.error("Error reading package.json: ".concat(e.message)),!1}}function ee(){return er.apply(this,arguments)}function er(){er=r(function(){var e,r,t,n,o,a,c,i,u,l,f;return s(this,function(s){switch(s.label){case 0:e=[{command:"pnpm install",message:"Standard installation"},{command:"pnpm install --legacy-peer-deps",message:"Attempting installation with --legacy-peer-deps"},{command:"pnpm install --force",message:"Attempting forced installation"}];r=true,t=false,n=undefined;s.label=1;case 1:s.trys.push([1,8,9,10]);o=e[Symbol.iterator]();s.label=2;case 2:if(!!(r=(a=o.next()).done))return[3,7];c=a.value,i=c.command,u=c.message;s.label=3;case 3:s.trys.push([3,5,,6]);R.info("".concat(u,"..."));return[4,W(i)];case 4:s.sent(),R.success("Dependencies installed using: ".concat(i));return[2];case 5:l=s.sent();R.warning("Failed with: ".concat(i)),R.error("Error: ".concat(l.message));return[3,6];case 6:r=true;return[3,2];case 7:return[3,10];case 8:f=s.sent();t=true;n=f;return[3,10];case 9:try{if(!r&&o.return!=null){o.return()}}finally{if(t){throw n}}return[7];case 10:throw new Error("Failed to install dependencies after multiple attempts.")}})});return er.apply(this,arguments)}export{V as getLatestPackageVersion,ee as installDependencies,Z as isCurrentProject,q as isPackageOutdated,H as updatePackage};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cyberskill/shared",
3
3
  "type": "module",
4
- "version": "1.45.0",
4
+ "version": "1.47.0",
5
5
  "description": "CyberSkill Shared",
6
6
  "author": "Stephen Cheng",
7
7
  "license": "MIT",
@@ -152,22 +152,22 @@
152
152
  "scripts": {
153
153
  "build": "tsup",
154
154
  "dev": "tsup --watch",
155
- "lint": "npx tsx src/cli.ts lint",
156
- "lint:fix": "npx tsx src/cli.ts lint:fix",
157
- "lint:inspect": "npx @eslint/config-inspector",
158
- "reset": "npx tsx src/cli.ts reset",
159
- "setup": "npx tsx src/cli.ts setup",
160
- "inspect": "npx tsx src/cli.ts inspect"
155
+ "lint": "pnpm exec tsx src/cli.ts lint",
156
+ "lint:fix": "pnpm exec tsx src/cli.ts lint:fix",
157
+ "lint:inspect": "pnpm exec @eslint/config-inspector",
158
+ "reset": "pnpm exec tsx src/cli.ts reset",
159
+ "setup": "pnpm exec tsx src/cli.ts setup",
160
+ "inspect": "pnpm exec tsx src/cli.ts inspect"
161
161
  },
162
162
  "dependencies": {
163
163
  "@antfu/eslint-config": "4.11.0",
164
164
  "@apollo/client": "3.13.5",
165
165
  "@commitlint/cli": "19.8.0",
166
166
  "@commitlint/config-conventional": "19.8.0",
167
- "@eslint-react/eslint-plugin": "1.38.0",
167
+ "@eslint-react/eslint-plugin": "1.38.2",
168
168
  "@eslint/config-inspector": "1.0.2",
169
169
  "@graphql-codegen/cli": "5.0.5",
170
- "@graphql-codegen/client-preset": "4.7.0",
170
+ "@graphql-codegen/client-preset": "4.8.0",
171
171
  "@graphql-codegen/typescript-react-apollo": "4.3.2",
172
172
  "@microsoft/api-extractor": "7.52.2",
173
173
  "@next/eslint-plugin-next": "15.2.4",
@@ -194,6 +194,7 @@
194
194
  "eslint-plugin-format": "1.0.1",
195
195
  "eslint-plugin-react-hooks": "5.2.0",
196
196
  "eslint-plugin-react-refresh": "0.4.19",
197
+ "globals": "16.0.0",
197
198
  "graphql": "16.10.0",
198
199
  "graphql-ws": "6.0.4",
199
200
  "i18next": "24.2.3",
@@ -201,6 +202,7 @@
201
202
  "lint-staged": "15.5.0",
202
203
  "localforage": "1.10.0",
203
204
  "modern-normalize": "3.0.1",
205
+ "mongodb": "6.15.0",
204
206
  "mongoose": "8.13.0",
205
207
  "mongoose-aggregate-paginate-v2": "1.1.4",
206
208
  "mongoose-paginate-v2": "1.9.0",
@@ -223,6 +225,7 @@
223
225
  "typescript": "5.8.2",
224
226
  "unorm": "1.6.0",
225
227
  "uuid": "11.1.0",
228
+ "vite": "6.2.3",
226
229
  "vitest": "3.0.9",
227
230
  "vitest-browser-react": "0.1.1",
228
231
  "yargs": "17.7.2"