@cyberskill/shared 1.171.0 → 1.173.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 (50) hide show
  1. package/dist/config/config.util.cjs +1 -1
  2. package/dist/config/config.util.js +1 -1
  3. package/dist/config/index.cjs +1 -1
  4. package/dist/config/index.d.cts +2 -0
  5. package/dist/config/index.d.ts +2 -0
  6. package/dist/config/index.js +1 -1
  7. package/dist/{react → config}/vitest/index.cjs +1 -1
  8. package/dist/{react → config}/vitest/index.js +1 -1
  9. package/dist/{react → config}/vitest/vitest.unit.cjs +1 -1
  10. package/dist/{react → config}/vitest/vitest.unit.js +1 -1
  11. package/dist/node/cli/cli.util.cjs +1 -1
  12. package/dist/node/cli/cli.util.js +1 -1
  13. package/dist/node/cli/index.cjs +1 -1
  14. package/dist/node/cli/index.js +1 -1
  15. package/dist/node/command/command.util.cjs +1 -1
  16. package/dist/node/command/command.util.js +1 -1
  17. package/dist/node/command/index.cjs +1 -1
  18. package/dist/node/command/index.js +1 -1
  19. package/dist/node/index.cjs +1 -1
  20. package/dist/node/index.js +1 -1
  21. package/dist/node/mongo/index.cjs +1 -1
  22. package/dist/node/mongo/index.js +1 -1
  23. package/dist/node/mongo/mongo.util.cjs +1 -1
  24. package/dist/node/mongo/mongo.util.js +1 -1
  25. package/dist/node/package/index.cjs +1 -1
  26. package/dist/node/package/index.js +1 -1
  27. package/dist/node/package/package.util.cjs +1 -1
  28. package/dist/node/package/package.util.js +1 -1
  29. package/dist/node/path/index.cjs +1 -1
  30. package/dist/node/path/index.js +1 -1
  31. package/dist/node/path/path.constant.cjs +1 -1
  32. package/dist/node/path/path.constant.js +1 -1
  33. package/dist/react/index.cjs +1 -1
  34. package/dist/react/index.d.cts +0 -2
  35. package/dist/react/index.d.ts +0 -2
  36. package/dist/react/index.js +1 -1
  37. package/package.json +10 -10
  38. package/public/renovate.base.json +1 -2
  39. /package/dist/{react → config}/vitest/index.d.cts +0 -0
  40. /package/dist/{react → config}/vitest/index.d.ts +0 -0
  41. /package/dist/{react → config}/vitest/vitest.e2e.cjs +0 -0
  42. /package/dist/{react → config}/vitest/vitest.e2e.d.cts +0 -0
  43. /package/dist/{react → config}/vitest/vitest.e2e.d.ts +0 -0
  44. /package/dist/{react → config}/vitest/vitest.e2e.js +0 -0
  45. /package/dist/{react → config}/vitest/vitest.unit.d.cts +0 -0
  46. /package/dist/{react → config}/vitest/vitest.unit.d.ts +0 -0
  47. /package/dist/{react → config}/vitest/vitest.unit.setup.cjs +0 -0
  48. /package/dist/{react → config}/vitest/vitest.unit.setup.d.cts +0 -0
  49. /package/dist/{react → config}/vitest/vitest.unit.setup.d.ts +0 -0
  50. /package/dist/{react → config}/vitest/vitest.unit.setup.js +0 -0
@@ -1 +1 @@
1
- function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var a=e[s](o);var c=a.value}catch(e){n(e);return}if(a.done){t(c)}else{Promise.resolve(c).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function a(e){r(o,i,s,a,c,"next",e)}function c(e){r(o,i,s,a,c,"throw",e)}a(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function a(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function c(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw a}}return r}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function p(e,n){return t(e)||c(e,n)||f(e,n)||u()}function E(e){return n(e)||a(e)||f(e)||l()}function m(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function g(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=a(0),o["throw"]=a(1),o["return"]=a(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(s=0)),s)try{if(n=1,r&&(i=a[0]&2?r["return"]:a[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;if(r=0,i)a=[a[0]&2,i.value];switch(a[0]){case 0:case 1:i=a;break;case 4:s.label++;return{value:a[1],done:false};case 5:s.label++;r=a[1];a=[0];continue;case 7:a=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){s=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(a[0]===6&&s.label<i[1]){s.label=i[1];i=a;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(a);break}if(i[2])s.ops.pop();s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e];r=0}finally{n=i=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}}var y=Object.defineProperty;var h=function(e,t){return y(e,"name",{value:t,configurable:!0})};import S from"process";import{hideBin as v}from"yargs/helpers";import D from"yargs/yargs";var O={name:"@cyberskill/shared",type:"module",version:"1.170.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./config":{types:"./dist/config/index.d.ts",import:"./dist/config/index.js",require:"./dist/config/index.cjs"},"./config/commitlint":{types:"./dist/config/commitlint/index.d.ts",import:"./dist/config/commitlint/index.js",require:"./dist/config/commitlint/index.cjs"},"./config/env":{types:"./dist/config/env/index.d.ts",import:"./dist/config/env/index.js",require:"./dist/config/env/index.cjs"},"./config/eslint":{types:"./dist/config/eslint/index.d.ts",import:"./dist/config/eslint/index.js",require:"./dist/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/config/graphql-codegen/index.d.ts",import:"./dist/config/graphql-codegen/index.js",require:"./dist/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/config/lint-staged/index.d.ts",import:"./dist/config/lint-staged/index.js",require:"./dist/config/lint-staged/index.cjs"},"./constant":{types:"./dist/constant/index.d.ts",import:"./dist/constant/index.js",require:"./dist/constant/index.cjs"},"./node":{types:"./dist/node/index.d.ts",import:"./dist/node/index.js",require:"./dist/node/index.cjs"},"./node/apollo-server":{types:"./dist/node/apollo-server/index.d.ts",import:"./dist/node/apollo-server/index.js",require:"./dist/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/node/cli/index.d.ts",import:"./dist/node/cli/index.js",require:"./dist/node/cli/index.cjs"},"./node/command":{types:"./dist/node/command/index.d.ts",import:"./dist/node/command/index.js",require:"./dist/node/command/index.cjs"},"./node/express":{types:"./dist/node/express/index.d.ts",import:"./dist/node/express/index.js",require:"./dist/node/express/index.cjs"},"./node/fs":{types:"./dist/node/fs/index.d.ts",import:"./dist/node/fs/index.js",require:"./dist/node/fs/index.cjs"},"./node/log":{types:"./dist/node/log/index.d.ts",import:"./dist/node/log/index.js",require:"./dist/node/log/index.cjs"},"./node/mongo":{types:"./dist/node/mongo/index.d.ts",import:"./dist/node/mongo/index.js",require:"./dist/node/mongo/index.cjs"},"./node/package":{types:"./dist/node/package/index.d.ts",import:"./dist/node/package/index.js",require:"./dist/node/package/index.cjs"},"./node/path":{types:"./dist/node/path/index.d.ts",import:"./dist/node/path/index.js",require:"./dist/node/path/index.cjs"},"./node/storage":{types:"./dist/node/storage/index.d.ts",import:"./dist/node/storage/index.js",require:"./dist/node/storage/index.cjs"},"./node/ws":{types:"./dist/node/ws/index.d.ts",import:"./dist/node/ws/index.js",require:"./dist/node/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./react/vitest":{types:"./dist/react/vitest/index.d.ts",import:"./dist/react/vitest/index.js",require:"./dist/react/vitest/index.cjs"},"./style/reset.css":{import:"./dist/style/reset.css",require:"./dist/style/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./util":{types:"./dist/util/index.d.ts",import:"./dist/util/index.js",require:"./dist/util/index.cjs"}},typesVersions:{"*":{config:["dist/config/index.d.ts"],constant:["dist/constant/index.d.ts"],node:["dist/node/index.d.ts"],react:["dist/react/index.d.ts"],typescript:["dist/typescript/index.d.ts"],util:["dist/util/index.d.ts"]}},bin:{cyberskill:"dist/node/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",reset:"tsx src/node/cli/index.ts reset",prepare:"tsx src/node/cli/index.ts prepare",inspect:"tsx src/node/cli/index.ts inspect","test:unit":"tsx src/node/cli/index.ts test:unit","test:e2e":"tsx src/node/cli/index.ts test:e2e",commitlint:"tsx src/node/cli/index.ts commitlint"},dependencies:{"@antfu/eslint-config":"4.13.2","@apollo/client":"3.13.8","@apollo/server":"4.12.1","@dotenvx/dotenvx":"1.44.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@eslint-react/eslint-plugin":"1.49.0","@graphql-codegen/cli":"5.0.6","@graphql-codegen/client-preset":"4.8.1","@microsoft/api-extractor":"7.52.8","@nestjs/common":"11.1.1","@nestjs/core":"11.1.1","@next/eslint-plugin-next":"15.3.2","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.9.0","@vitest/browser":"3.1.4","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.2","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.1.0",graphql:"16.11.0","graphql-ws":"6.0.5",i18next:"25.2.0",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.15.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.1","react-icons":"5.5.0",sass:"1.89.0",slugify:"1.6.6",tsup:"8.5.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.5",vitest:"3.1.4","vitest-browser-react":"0.2.0",ws:"8.18.2",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint/config-inspector":"1.0.2","@types/body-parser":"1.19.5","@types/compression":"1.8.0","@types/cookie-parser":"1.4.8","@types/cors":"2.8.18","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/node":"22.15.21","@types/node-persist":"3.1.8","@types/react":"19.1.5","@types/react-dom":"19.1.5","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.27.0","lint-staged":"16.0.0","node-modules-inspector":"0.6.8","simple-git-hooks":"2.13.0"}};var C=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as I}from"child_process";import N from"process";import*as T from"util";var x=".cyberskill-storage";import A from"@dotenvx/dotenvx";import{bool as _,cleanEnv as R,str as G}from"envalid";import b from"os";import P from"path";import M from"process";var w=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var L=!1;function j(){M.env.NODE_ENV!==w.PRODUCTION&&!L&&(A.config(),L=!0)}h(j,"loadEnvFile");function U(){j();var e=R(M.env,{CWD:G({default:M.cwd()}),DEBUG:_({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:G({default:P.join(b.homedir(),x)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}h(U,"getEnv");var k=function(e){return e.Error="error",e.Warning="warning",e}({});import F from"chalk";import q from"consola";import{GraphQLError as V}from"graphql";var Y={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var B=U();B.DEBUG||(q.level=4);function K(e){var t=F[e];return typeof t=="function"?t:F.green}h(K,"chalkKeyword");var H={silent:q.silent,level:q.level,fatal:q.fatal,error:q.error,warn:q.warn,log:q.log,info:q.info,success:q.success,ready:q.ready,start:q.start,box:q.box,debug:q.debug,trace:q.trace,verbose:q.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){q.box(F.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;q.log("".concat(F.gray("File:")," ").concat(F.blue("".concat(t).concat(r?":".concat(r):"")))),i&&q.log(" ".concat(K(n)("Rule:")," ").concat(i)),q.log(" ".concat(K(n)("Message:")," ").concat(s))}),q.box(K(n)("".concat(e," : ").concat(t.length))),q.log(F.gray("─".repeat(40)))}};function Q(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,i=r===void 0?!0:r,s=n.returnValue,a=n.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return i&&H.error(c.message),a&&typeof a=="function"&&a(c),s||{success:!1,message:c.message,code:Y.INTERNAL_SERVER_ERROR.CODE}}h(Q,"catchError");var W=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import J from"node-fetch";import $ from"fs-extra";import z from"path";var X=$.lstatSync,Z=$.readdirSync,ee=$.mkdirSync,et=$.readFileSync,en=$.unlinkSync,er=$.statSync,ei=$.readJsonSync;function es(e,t,n){$.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}h(es,"writeFileSync");function eo(e,t,n){$.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}h(eo,"appendFileSync");function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return $.pathExistsSync(e)})}h(ea,"pathExistsSync");function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){ea(e)&&$.removeSync(e)})}h(ec,"removeSync");import eu from"fs-extra";import el from"path";var ed=U(),ep=el;function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ep).resolve.apply(r,[ed.CWD].concat(E(t)))}h(eE,"resolveWorkingPath");function em(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ep).join.apply(r,E(t))}h(em,"join");var ef=U(),eg=ef.CWD,ey="@cyberskill/shared",eh="node_modules",eS="dist",ev="package.json",eD="package-lock.json",eO="tsconfig.json",eC=".gitignore",eI=".simple-git-hooks.json",eN="pnpm-lock.yaml",eT=".git/hooks/",ex=".git/COMMIT_EDITMSG",eA=".migrate-mongo.config.js",e_=function(){var e=eu.readJsonSync(eE(ev)).name===ey?eg:em(eg,eh,ey);return em(e,eS)}(),eR="cyberskill",eG="src/node/cli/index.ts",eb="eslint",eP="eslint",eM="vitest";var ew="vitest",eL="@commitlint/cli",ej="@commitlint/config-conventional",eU="commitlint",ek="lint-staged",eF="lint-staged",eq="typescript",eV="tsc",eY="tsx",eB="git",eK="pnpm",eH="pnpm exec",eQ="simple-git-hooks",eW="simple-git-hooks",eJ="@eslint/config-inspector",e$="eslint-config-inspector",ez="node-modules-inspector",eX="node-modules-inspector",eZ="migrate-mongo",e0="./node_modules/migrate-mongo/bin/migrate-mongo",e1={CYBERSKILL_DIRECTORY:e_,WORKING_DIRECTORY:eg,TS_CONFIG:eE(eO),GIT_IGNORE:eE(eC),GIT_HOOK:eE(eT),GIT_COMMIT_MSG:eE(ex),SIMPLE_GIT_HOOKS_JSON:eE(eI),PACKAGE_JSON:eE(ev),PACKAGE_LOCK_JSON:eE(eD),PNPM_LOCK_YAML:eE(eN),NODE_MODULES:eE(eh),MIGRATE_MONGO_CONFIG:eE(eA),LINT_STAGED_CONFIG:eE("".concat(e_,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eE("".concat(e_,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eE("".concat(e_,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eE("".concat(e_,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eE("".concat(e_,"/react/vitest/vitest.e2e.js"))};function e2(e){var t=e.isCurrentProject;return d({"pre-commit":eF,"commit-msg":eU},t&&{"pre-push":tm("".concat(eB," pull"))})}h(e2,"createGitHooksConfig");function e4(e){var t=e.type,n=e.packages,r=e.command;var s=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return i(function(){var e;return g(this,function(n){switch(n.label){case 0:switch(t){case C.CLI:return[3,1];case C.STRING:return[3,4]}return[3,5];case 1:e=s===null||s===void 0?void 0:s.length;if(!e)return[3,3];return[4,te(s,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tg(tm("".concat(eH," ").concat(r))))];case 4:return[2,tg(tm(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}h(e4,"buildCommand");var e3={simpleGitHooks:e4({type:C.CLI,packages:[{name:eQ,type:W.DEV_DEPENDENCY}],command:eW}),eslintInspect:e4({type:C.CLI,packages:[{name:eJ,type:W.DEV_DEPENDENCY}],command:e$}),nodeModulesInspect:e4({type:C.CLI,packages:[{name:ez,type:W.DEV_DEPENDENCY}],command:eX}),eslintCheck:e4({type:C.CLI,packages:[{name:eb,type:W.DEV_DEPENDENCY}],command:"".concat(eP," ").concat(e1.WORKING_DIRECTORY," --no-cache")}),eslintFix:e4({type:C.CLI,packages:[{name:eb,type:W.DEV_DEPENDENCY}],command:"".concat(eP," ").concat(e1.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:e4({type:C.CLI,packages:[{name:eq,type:W.DEPENDENCY}],command:"".concat(eV," -p ").concat(e1.TS_CONFIG," --noEmit")}),testUnit:e4({type:C.CLI,packages:[{name:eM,type:W.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e1.UNIT_TEST_CONFIG)}),testE2e:e4({type:C.CLI,packages:[{name:eM,type:W.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e1.E2E_TEST_CONFIG)}),mongoMigrateCreate:h(function(e){return e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," create ").concat(e," -f ").concat(e1.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," up -f ").concat(e1.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," down -f ").concat(e1.MIGRATE_MONGO_CONFIG)}),commitLint:e4({type:C.CLI,packages:[{name:eL,type:W.DEV_DEPENDENCY},{name:ej,type:W.DEV_DEPENDENCY}],command:"".concat(eU," --edit ").concat(e1.GIT_COMMIT_MSG," --config ").concat(e1.COMMITLINT_CONFIG)}),lintStaged:e4({type:C.CLI,packages:[{name:ek,type:W.DEV_DEPENDENCY}],command:"".concat(eF," --config ").concat(e1.LINT_STAGED_CONFIG)}),configureGitHook:e4({type:C.STRING,command:"".concat(eB," config core.hooksPath ").concat(e1.GIT_HOOK)}),build:e4({type:C.STRING,command:"".concat(eK," run --if-present build")}),pnpmInstallStandard:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts")}),pnpmInstallLegacy:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts --force")}),pnpmPruneStore:e4({type:C.STRING,command:"".concat(eK," store prune")}),pnpmCleanCache:e4({type:C.STRING,command:"".concat(eK," cache delete")})};var e5=U();function e8(e){return i(function(){var t,n,r,i;return g(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,J("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:i=s.sent();return[2,Q(i)];case 4:return[2]}})})()}h(e8,"getLatestPackageVersion");function e6(e){return i(function(){var t,n,r,i,s,o,a,c,u,l,d,p,E,m,f,y,h,S,v,D,O,C,I,N;return g(this,function(g){switch(g.label){case 0:g.trys.push([0,2,,3]);if(!e){if(ea(e1.PACKAGE_JSON)){t=ei(e1.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,i=t.version,s=i===void 0?"":i;return[2,{success:!0,result:{name:r,currentVersion:s,latestVersion:s,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:e1.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!ea(e1.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}}];o=ei(e1.PACKAGE_JSON),a=o.name,c=o.version,u=c===void 0?"":c,l=o.dependencies,d=l===void 0?{}:l,p=o.devDependencies,E=p===void 0?{}:p;if(e.name===a)return[2,{success:!0,result:{name:a,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:e1.PACKAGE_JSON,file:o}}];m=e.name in d,f=e.name in E;return[4,e8(e.name)];case 1:y=g.sent();if(!y.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:"",file:{}}}];if(!m&&!f)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(S=(h=d[e.name])!==null&&h!==void 0?h:E[e.name])!==null&&S!==void 0?S:"",D=em(e5.CWD,eh,e.name,ev);if(!ea(D))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:"",file:{}}}];O=ei(D),C=O.version,I=C===void 0?"":C;return[2,v!==I?{success:!0,result:{name:e.name,currentVersion:I||v,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:D,file:O}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===y.result,isDependency:m,isDevDependency:f,installedPath:D,file:O}}];case 2:N=g.sent();return[2,Q(N)];case 3:return[2]}})})()}h(e6,"getPackage");function e7(e){return i(function(){var t,n,r,i,s;return g(this,function(o){try{;r=ei(e1.PACKAGE_JSON),i=(t=r.dependencies)!==null&&t!==void 0?t:{},s=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?i[e.name]=e.latestVersion:e.isDevDependency&&(s[e.name]=e.latestVersion),es(e1.PACKAGE_JSON,JSON.stringify(r,null,4)),H.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){Q(e)}return[2]})})()}h(e7,"updatePackage");function e9(){return i(function(){var e,t,n,r,i,s,o,a,c,u,l,d,p;return g(this,function(E){switch(E.label){case 0:E.trys.push([0,12,,13]);e=[{command:h(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return e3.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;E.label=1;case 1:E.trys.push([1,9,10,11]);i=e[Symbol.iterator]();E.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,a=o.command,c=o.message;E.label=3;case 3:E.trys.push([3,6,,7]);return[4,a()];case 4:u=E.sent();return[4,th("".concat(c," using: ").concat(u),u)];case 5:E.sent();return[2];case 6:l=E.sent();Q(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=E.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:p=E.sent();Q(p);return[3,13];case 13:return[2]}})})()}h(e9,"installDependencies");function te(e,t){return i(function(){var n,r,i,s,o,a,c,u,l,d,p,m,f,y,h,S,v;return g(this,function(g){switch(g.label){case 0:g.trys.push([0,15,,16]);if(!ea(e1.PACKAGE_JSON)){H.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(e6))];case 1:i=g.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),s=i.filter(function(e){return!e.isInstalled}),o=i.filter(function(e){return!e.isUpToDate}),a=[];(t===null||t===void 0?void 0:t.install)&&s.length>0&&(n=a).push.apply(n,E(s.map(e7))),(t===null||t===void 0?void 0:t.update)&&o.length>0&&(r=a).push.apply(r,E(o.map(e7)));c=a.length>0;if(!c)return[3,6];return[4,Promise.all(a)];case 2:g.sent();return[4,e9()];case 3:g.sent();u=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 4:return[4,th.apply(void 0,u.concat([g.sent()]))];case 5:c=g.sent();g.label=6;case 6:c;d=true,p=false,m=undefined;g.label=7;case 7:g.trys.push([7,12,13,14]);f=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();g.label=8;case 8:if(!!(d=(y=f.next()).done))return[3,11];h=y.value;return[4,h()];case 9:g.sent();g.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:S=g.sent();p=true;m=S;return[3,14];case 13:try{if(!d&&f.return!=null){f.return()}}finally{if(p){throw m}}return[7];case 14:return[3,16];case 15:v=g.sent();Q(v);return[3,16];case 16:return[2]}})})()}h(te,"setupPackages");import tt from"node-persist";var tn=U();function tr(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=tt.defaultInstance;if(e)return[3,2];return[4,tt.init({dir:tn.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}h(tr,"initNodePersist");var ti={get:function e(e){return i(function(){var t,n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,Q(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();Q(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();Q(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,Q(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return g(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,Q(e,{returnValue:null})]}return[2]})})()}};var ts=U(),to=T.promisify(I);function ta(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:return[4,e6()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}h(ta,"getPackageName");function tc(e){return i(function(){var t,n;return g(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,ta()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,ti.set(t,e)];case 3:r.sent(),setTimeout(function(){return i(function(){var e;return g(this,function(n){switch(n.label){case 0:return[4,ti.getLogLink(t)];case 1:e=n.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();Q(n);return[3,5];case 5:return[2]}})})()}h(tc,"saveErrorListToStorage");function tu(){return i(function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ta()];case 1:e=r.sent();return[4,ti.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,Q(n,{returnValue:[]})];case 4:return[2]}})})()}h(tu,"getStoredErrorLists");function tl(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ta()];case 1:e=n.sent();return[4,ti.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();Q(t);return[3,4];case 4:return[2]}})})()}h(tl,"clearAllErrorLists");function td(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a,c,u,l,d;var p=i.exec(e)||[],E=s.exec(e)||[],m=o.exec(e)||[];var f,g,y,h,S,v;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===k.Error?k.Error:k.Warning,message:(f=p===null||p===void 0?void 0:(a=p[4])===null||a===void 0?void 0:a.trim())!==null&&f!==void 0?f:"",rule:(g=p===null||p===void 0?void 0:(c=p[5])===null||c===void 0?void 0:c.trim())!==null&&g!==void 0?g:""}):E.length?t.push({file:(y=E===null||E===void 0?void 0:E[1])!==null&&y!==void 0?y:"",position:"".concat(E[2],":").concat(E[3]),type:E[4]===k.Error?k.Error:k.Warning,message:(h=E===null||E===void 0?void 0:(u=E[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):m.length?t.push({file:"commitlint",type:k.Error,message:(S=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&S!==void 0?S:"",rule:(v=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&v!==void 0?v:""}):n.push(e.trim())}}),t.length&&tc(t),ts.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}h(td,"parseTextErrors");function tp(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?k.Error:k.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:a})})}),n.length&&tc(n)}catch(t){td(e)}}h(tp,"parseCommandOutput");function tE(e){return i(function(e){var t,n,r,i,s,o,a,c,u;var l=arguments;return g(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tp;n=new AbortController;N.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),N.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,to(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();a=o.stdout,c=o.stderr,u=o.message;[a,c].forEach(function(e){return e&&t(e)}),!c&&!a&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}h(tE,"executeCommand");function tm(e){return{raw:!0,cmd:e}}h(tm,"rawCommand");function tf(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eH," ").concat(eY," ").concat(eG," ").concat(e):"".concat(eH," ").concat(eR," ").concat(e)}h(tf,"formatCLI");function tg(e,t){return typeof e=="function"?tf(e(t),t):(typeof e==="undefined"?"undefined":m(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tf(e,t):e}h(tg,"formatCommand");function ty(e){return i(function(){var t,n,r;return g(this,function(i){switch(i.label){case 0:return[4,e6({name:ey})];case 1:t=i.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=p(e,2),r=t[0],i=t[1];return[r,tg(i,n)]}))]}return[2]}})})()}h(ty,"resolveCommands");function th(e,t){return i(function(){var n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),ts.DEBUG&&H.info("→ ".concat(t));return[4,tE(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();Q(n);return[3,3];case 3:return[2]}})})()}h(th,"runCommand");function tS(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:if(!ea(e1.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e3.typescriptCheck()];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=H.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}h(tS,"checkTypescript");function tv(){return i(function(){var e,t,n,r;var i=arguments;return g(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 1:return[4,th.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e3.eslintCheck()];case 4:return[4,th.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})}).apply(this,arguments)}h(tv,"checkEslint");function tD(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";H.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}h(tD,"printIssues");function tO(){return i(function(){return g(this,function(e){setTimeout(function(){return i(function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:return[4,tu()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===k.Error}),n=e.filter(function(e){return e.type===k.Warning});!t.length&&!n.length?H.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tD("Warnings",n),tD("Errors",t),(t.length>0||n.length>0)&&S.exit(1));return[2]}})})()},0);return[2]})})()}h(tO,"showCheckResult");function tC(){return i(function(){var e,t,n,r;return g(this,function(i){switch(i.label){case 0:return[4,tl()];case 1:i.sent();return[4,e6({name:ey})];case 2:e=i.sent();if(!e.success){H.error("Failed to retrieve package information. Aborting lint-staged.");return[2]}t=e.result.isCurrentProject;if(!t)return[3,5];n=["Building package: ".concat(ey)];return[4,e3.build()];case 3:return[4,th.apply(void 0,n.concat([i.sent()]))];case 4:t=i.sent();i.label=5;case 5:t;r=["Executing lint-staged"];return[4,e3.lintStaged()];case 6:return[4,th.apply(void 0,r.concat([i.sent()]))];case 7:i.sent(),tO();return[2]}})})()}h(tC,"lintStaged");function tI(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e3.eslintInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tI,"inspectLint");function tN(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tS(),tv()])];case 2:e.sent(),tO();return[2]}})})()}h(tN,"lintCheck");function tT(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tS(),tv(!0)])];case 2:e.sent(),tO();return[2]}})})()}h(tT,"lintFix");function tx(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:return[4,tl()];case 1:t.sent();e=["Validating commit message"];return[4,e3.commitLint()];case 2:return[4,th.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tO();return[2]}})})()}h(tx,"commitLint");function tA(){return i(function(){var e,t,n,r;return g(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,e3.configureGitHook()];case 1:return[4,th.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),ec(e1.GIT_HOOK);return[4,ty(e2)];case 3:t=i.sent();es(e1.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(eI,"\n");ea(e1.GIT_IGNORE)?et(e1.GIT_IGNORE,"utf-8").split("\n").includes(eI)||eo(e1.GIT_IGNORE,n):es(e1.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,e3.simpleGitHooks()];case 4:return[4,th.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})})()}h(tA,"setupGitHook");function t_(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,e9()];case 1:e.sent();return[4,tA()];case 2:e.sent();return[2]}})})()}h(t_,"prepare");function tR(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:ec(e1.NODE_MODULES,e1.PNPM_LOCK_YAML);e=["Pruning pnpm store"];return[4,e3.pnpmPruneStore()];case 1:return[4,th.apply(void 0,e.concat([n.sent()]))];case 2:n.sent();t=["Clearing pnpm cache"];return[4,e3.pnpmCleanCache()];case 3:return[4,th.apply(void 0,t.concat([n.sent()]))];case 4:n.sent();return[4,e9()];case 5:n.sent();return[4,tA()];case 6:n.sent();return[2]}})})()}h(tR,"reset");function tG(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e3.nodeModulesInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tG,"inspect");function tb(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e3.testUnit()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tb,"testUnit");function tP(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e3.testE2e()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tP,"testE2E");function tM(e){return i(function(){var t;return g(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,e3.mongoMigrateCreate(e)];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}h(tM,"mongoMigrateCreate");function tw(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,e3.mongoMigrateUp()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tw,"mongoMigrateUp");function tL(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,e3.mongoMigrateDown()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tL,"mongoMigrateDown");(function(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,D(v(S.argv)).scriptName(eR).usage("$0 <command> [options]").command("lint","Check code for linting issues",tN).command("lint:fix","Fix linting issues automatically",tT).command("lint:inspect","View active ESLint configuration",tI).command("lint-staged","Run lint checks on staged files",tC).command("commitlint","Validate commit message format",tx).command("prepare","Initialize project and dependencies",t_).command("reset","Reset the project and reinstall dependencies",tR).command("inspect","Analyze installed project dependencies",tG).command("test:unit","Run unit test suite",tb).command("test:e2e","Run end-to-end test suite",tP).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return i(function(){return g(this,function(t){switch(t.label){case 0:if(!e.name){H.error("Migration name is required.");return[2]}return[4,tM(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tw).command("mongo:migrate:down","Rollback last MongoDB migration",tL).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(O.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();Q(e),S.exit(1);return[3,3];case 3:return[2]}})})()})();
1
+ function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,s,o){try{var c=e[s](o);var a=c.value}catch(e){n(e);return}if(c.done){t(a)}else{Promise.resolve(a).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,s){var o=e.apply(t,n);function c(e){r(o,i,s,c,a,"next",e)}function a(e){r(o,i,s,c,a,"throw",e)}c(undefined)})}}function s(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var s=false;var o,c;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){s=true;c=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(s)throw c}}return r}function u(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){s(e,t,n[t])})}return e}function p(e,n){return t(e)||a(e,n)||f(e,n)||u()}function E(e){return n(e)||c(e)||f(e)||l()}function m(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function g(e,t){var n,r,i,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return o.next=c(0),o["throw"]=c(1),o["return"]=c(2),typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(e){return function(t){return a([e,t])}}function a(c){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,c[0]&&(s=0)),s)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:s.label++;return{value:c[1],done:false};case 5:s.label++;r=c[1];c=[0];continue;case 7:c=s.ops.pop();s.trys.pop();continue;default:if(!(i=s.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){s=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){s.label=c[1];break}if(c[0]===6&&s.label<i[1]){s.label=i[1];i=c;break}if(i&&s.label<i[2]){s.label=i[2];s.ops.push(c);break}if(i[2])s.ops.pop();s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var y=Object.defineProperty;var h=function(e,t){return y(e,"name",{value:t,configurable:!0})};import S from"process";import{hideBin as v}from"yargs/helpers";import D from"yargs/yargs";var O={name:"@cyberskill/shared",type:"module",version:"1.172.0",description:"CyberSkill Shared",author:"Stephen Cheng",license:"MIT",homepage:"https://github.com/cyberskill-world/shared#readme",repository:{type:"git",url:"git+https://github.com/cyberskill-world/shared.git"},bugs:{url:"https://github.com/cyberskill-world/shared/issues"},exports:{".":{types:"./dist/index.d.ts",import:"./dist/index.js",require:"./dist/index.cjs"},"./config":{types:"./dist/config/index.d.ts",import:"./dist/config/index.js",require:"./dist/config/index.cjs"},"./config/commitlint":{types:"./dist/config/commitlint/index.d.ts",import:"./dist/config/commitlint/index.js",require:"./dist/config/commitlint/index.cjs"},"./config/env":{types:"./dist/config/env/index.d.ts",import:"./dist/config/env/index.js",require:"./dist/config/env/index.cjs"},"./config/eslint":{types:"./dist/config/eslint/index.d.ts",import:"./dist/config/eslint/index.js",require:"./dist/config/eslint/index.cjs"},"./config/graphql-codegen":{types:"./dist/config/graphql-codegen/index.d.ts",import:"./dist/config/graphql-codegen/index.js",require:"./dist/config/graphql-codegen/index.cjs"},"./config/lint-staged":{types:"./dist/config/lint-staged/index.d.ts",import:"./dist/config/lint-staged/index.js",require:"./dist/config/lint-staged/index.cjs"},"./config/vitest":{types:"./dist/config/vitest/index.d.ts",import:"./dist/config/vitest/index.js",require:"./dist/config/vitest/index.cjs"},"./constant":{types:"./dist/constant/index.d.ts",import:"./dist/constant/index.js",require:"./dist/constant/index.cjs"},"./node":{types:"./dist/node/index.d.ts",import:"./dist/node/index.js",require:"./dist/node/index.cjs"},"./node/apollo-server":{types:"./dist/node/apollo-server/index.d.ts",import:"./dist/node/apollo-server/index.js",require:"./dist/node/apollo-server/index.cjs"},"./node/cli":{types:"./dist/node/cli/index.d.ts",import:"./dist/node/cli/index.js",require:"./dist/node/cli/index.cjs"},"./node/command":{types:"./dist/node/command/index.d.ts",import:"./dist/node/command/index.js",require:"./dist/node/command/index.cjs"},"./node/express":{types:"./dist/node/express/index.d.ts",import:"./dist/node/express/index.js",require:"./dist/node/express/index.cjs"},"./node/fs":{types:"./dist/node/fs/index.d.ts",import:"./dist/node/fs/index.js",require:"./dist/node/fs/index.cjs"},"./node/log":{types:"./dist/node/log/index.d.ts",import:"./dist/node/log/index.js",require:"./dist/node/log/index.cjs"},"./node/mongo":{types:"./dist/node/mongo/index.d.ts",import:"./dist/node/mongo/index.js",require:"./dist/node/mongo/index.cjs"},"./node/package":{types:"./dist/node/package/index.d.ts",import:"./dist/node/package/index.js",require:"./dist/node/package/index.cjs"},"./node/path":{types:"./dist/node/path/index.d.ts",import:"./dist/node/path/index.js",require:"./dist/node/path/index.cjs"},"./node/storage":{types:"./dist/node/storage/index.d.ts",import:"./dist/node/storage/index.js",require:"./dist/node/storage/index.cjs"},"./node/ws":{types:"./dist/node/ws/index.d.ts",import:"./dist/node/ws/index.js",require:"./dist/node/ws/index.cjs"},"./react":{types:"./dist/react/index.d.ts",import:"./dist/react/index.js",require:"./dist/react/index.cjs"},"./react/apollo-client":{types:"./dist/react/apollo-client/index.d.ts",import:"./dist/react/apollo-client/index.js",require:"./dist/react/apollo-client/index.cjs"},"./react/apollo-error":{types:"./dist/react/apollo-error/index.d.ts",import:"./dist/react/apollo-error/index.js",require:"./dist/react/apollo-error/index.cjs"},"./react/i18next":{types:"./dist/react/i18next/index.d.ts",import:"./dist/react/i18next/index.js",require:"./dist/react/i18next/index.cjs"},"./react/loading":{types:"./dist/react/loading/index.d.ts",import:"./dist/react/loading/index.js",require:"./dist/react/loading/index.cjs"},"./react/log":{types:"./dist/react/log/index.d.ts",import:"./dist/react/log/index.js",require:"./dist/react/log/index.cjs"},"./react/next-intl":{types:"./dist/react/next-intl/index.d.ts",import:"./dist/react/next-intl/index.js",require:"./dist/react/next-intl/index.cjs"},"./react/storage":{types:"./dist/react/storage/index.d.ts",import:"./dist/react/storage/index.js",require:"./dist/react/storage/index.cjs"},"./react/toast":{types:"./dist/react/toast/index.d.ts",import:"./dist/react/toast/index.js",require:"./dist/react/toast/index.cjs"},"./style/reset.css":{import:"./dist/style/reset.css",require:"./dist/style/reset.css"},"./typescript":{types:"./dist/typescript/index.d.ts",import:"./dist/typescript/index.js",require:"./dist/typescript/index.cjs"},"./util":{types:"./dist/util/index.d.ts",import:"./dist/util/index.js",require:"./dist/util/index.cjs"}},typesVersions:{"*":{config:["dist/config/index.d.ts"],constant:["dist/constant/index.d.ts"],node:["dist/node/index.d.ts"],react:["dist/react/index.d.ts"],typescript:["dist/typescript/index.d.ts"],util:["dist/util/index.d.ts"]}},bin:{cyberskill:"dist/node/cli/index.js"},files:["dist","public"],scripts:{build:"tsup",dev:"tsup --watch",lint:"tsx src/node/cli/index.ts lint","lint:fix":"tsx src/node/cli/index.ts lint:fix","lint:inspect":"tsx src/node/cli/index.ts lint:inspect",reset:"tsx src/node/cli/index.ts reset",prepare:"tsx src/node/cli/index.ts prepare",inspect:"tsx src/node/cli/index.ts inspect","test:unit":"tsx src/node/cli/index.ts test:unit","test:e2e":"tsx src/node/cli/index.ts test:e2e",commitlint:"tsx src/node/cli/index.ts commitlint"},dependencies:{"@antfu/eslint-config":"4.13.2","@apollo/client":"3.13.8","@apollo/server":"4.12.1","@dotenvx/dotenvx":"1.44.1","@eddeee888/gcg-typescript-resolver-files":"0.12.1","@eslint-react/eslint-plugin":"1.49.0","@graphql-codegen/cli":"5.0.6","@graphql-codegen/client-preset":"4.8.1","@microsoft/api-extractor":"7.52.8","@nestjs/common":"11.1.1","@nestjs/core":"11.1.1","@next/eslint-plugin-next":"15.3.2","@testing-library/jest-dom":"6.6.3","@testing-library/react":"16.3.0","@vitejs/plugin-react-swc":"3.10.0","@vitest/browser":"3.1.4","body-parser":"2.2.0",chalk:"5.4.1",clsx:"2.1.1",compression:"1.8.0",consola:"3.4.2","cookie-parser":"1.4.7",cors:"2.8.5","crypto-js":"4.2.0","date-fns":"4.1.0","dotenv-cli":"8.0.0",envalid:"8.0.0","eslint-config-next":"15.3.2","eslint-plugin-format":"1.0.1","eslint-plugin-react-hooks":"5.2.0","eslint-plugin-react-refresh":"0.4.20",express:"4.21.2","express-session":"1.18.1","express-useragent":"1.0.15","fs-extra":"11.3.0",globals:"16.2.0",graphql:"16.11.0","graphql-ws":"6.0.5",i18next:"25.2.1",jsdom:"26.1.0",localforage:"1.10.0","migrate-mongo":"12.1.3","modern-normalize":"3.0.1",mongodb:"6.16.0",mongoose:"8.15.0","mongoose-aggregate-paginate-v2":"1.1.4","mongoose-paginate-v2":"1.9.0","next-intl":"4.1.0","node-fetch":"3.3.2","node-persist":"4.0.4",playwright:"1.52.0","postcss-modules":"6.0.1",qs:"6.14.0",react:"19.1.0","react-dom":"19.1.0","react-hot-toast":"2.5.2","react-i18next":"15.5.2","react-icons":"5.5.0",sass:"1.89.0",slugify:"1.6.6",tsup:"8.5.0",tsx:"4.19.4",typescript:"5.8.3",unorm:"1.6.0",uuid:"11.1.0",vite:"6.3.5",vitest:"3.1.4","vitest-browser-react":"0.2.0",ws:"8.18.2",yargs:"17.7.2"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},devDependencies:{"@commitlint/cli":"19.8.1","@commitlint/config-conventional":"19.8.1","@eslint/config-inspector":"1.0.2","@types/body-parser":"1.19.5","@types/compression":"1.8.0","@types/cookie-parser":"1.4.8","@types/cors":"2.8.18","@types/crypto-js":"4.2.2","@types/express":"4.17.21","@types/express-session":"1.18.1","@types/express-useragent":"1.0.5","@types/fs-extra":"11.0.4","@types/migrate-mongo":"10.0.5","@types/node":"22.15.21","@types/node-persist":"3.1.8","@types/react":"19.1.5","@types/react-dom":"19.1.5","@types/unorm":"1.3.31","@types/uuid":"10.0.0","@types/ws":"8.18.1","@types/yargs":"17.0.33",eslint:"9.27.0","lint-staged":"16.0.0","node-modules-inspector":"0.6.8","simple-git-hooks":"2.13.0"}};var C=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as I}from"child_process";import N from"process";import*as T from"util";var x=".cyberskill-storage";import A from"@dotenvx/dotenvx";import{bool as _,cleanEnv as R,str as G}from"envalid";import b from"os";import P from"path";import M from"process";var w=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var L=!1;function j(){M.env.NODE_ENV!==w.PRODUCTION&&!L&&(A.config(),L=!0)}h(j,"loadEnvFile");function U(){j();var e=R(M.env,{CWD:G({default:M.cwd()}),DEBUG:_({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:G({default:P.join(b.homedir(),x)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}h(U,"getEnv");var k=function(e){return e.Error="error",e.Warning="warning",e}({});import F from"chalk";import q from"consola";import{GraphQLError as V}from"graphql";var Y={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var B=U();B.DEBUG||(q.level=4);function K(e){var t=F[e];return typeof t=="function"?t:F.green}h(K,"chalkKeyword");var H={silent:q.silent,level:q.level,fatal:q.fatal,error:q.error,warn:q.warn,log:q.log,info:q.info,success:q.success,ready:q.ready,start:q.start,box:q.box,debug:q.debug,trace:q.trace,verbose:q.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){q.box(F.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,i=e.rule,s=e.message;q.log("".concat(F.gray("File:")," ").concat(F.blue("".concat(t).concat(r?":".concat(r):"")))),i&&q.log(" ".concat(K(n)("Rule:")," ").concat(i)),q.log(" ".concat(K(n)("Message:")," ").concat(s))}),q.box(K(n)("".concat(e," : ").concat(t.length))),q.log(F.gray("─".repeat(40)))}};function Q(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,i=r===void 0?!0:r,s=n.returnValue,c=n.callback,a=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return i&&H.error(a.message),c&&typeof c=="function"&&c(a),s||{success:!1,message:a.message,code:Y.INTERNAL_SERVER_ERROR.CODE}}h(Q,"catchError");var W=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import J from"node-fetch";import $ from"fs-extra";import z from"path";var X=$.lstatSync,Z=$.readdirSync,ee=$.mkdirSync,et=$.readFileSync,en=$.unlinkSync,er=$.statSync,ei=$.readJsonSync;function es(e,t,n){$.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}h(es,"writeFileSync");function eo(e,t,n){$.appendFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}h(eo,"appendFileSync");function ec(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return $.pathExistsSync(e)})}h(ec,"pathExistsSync");function ea(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}t.forEach(function(e){ec(e)&&$.removeSync(e)})}h(ea,"removeSync");import eu from"fs-extra";import el from"path";var ed=U(),ep=el;function eE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ep).resolve.apply(r,[ed.CWD].concat(E(t)))}h(eE,"resolveWorkingPath");function em(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ep).join.apply(r,E(t))}h(em,"join");var ef=U(),eg=ef.CWD,ey="@cyberskill/shared",eh="node_modules",eS="dist",ev="package.json",eD="package-lock.json",eO="tsconfig.json",eC=".gitignore",eI=".simple-git-hooks.json",eN="pnpm-lock.yaml",eT=".git/hooks/",ex=".git/COMMIT_EDITMSG",eA=".migrate-mongo.config.js",e_=function(){var e=eu.readJsonSync(eE(ev)).name===ey?eg:em(eg,eh,ey);return em(e,eS)}(),eR="cyberskill",eG="src/node/cli/index.ts",eb="eslint",eP="eslint",eM="vitest";var ew="vitest",eL="@commitlint/cli",ej="@commitlint/config-conventional",eU="commitlint",ek="lint-staged",eF="lint-staged",eq="typescript",eV="tsc",eY="tsx",eB="git",eK="pnpm",eH="pnpm exec",eQ="simple-git-hooks",eW="simple-git-hooks",eJ="@eslint/config-inspector",e$="eslint-config-inspector",ez="node-modules-inspector",eX="node-modules-inspector",eZ="migrate-mongo",e0="./node_modules/migrate-mongo/bin/migrate-mongo",e1={CYBERSKILL_DIRECTORY:e_,WORKING_DIRECTORY:eg,TS_CONFIG:eE(eO),GIT_IGNORE:eE(eC),GIT_HOOK:eE(eT),GIT_COMMIT_MSG:eE(ex),SIMPLE_GIT_HOOKS_JSON:eE(eI),PACKAGE_JSON:eE(ev),PACKAGE_LOCK_JSON:eE(eD),PNPM_LOCK_YAML:eE(eN),NODE_MODULES:eE(eh),MIGRATE_MONGO_CONFIG:eE(eA),LINT_STAGED_CONFIG:eE("".concat(e_,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eE("".concat(e_,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eE("".concat(e_,"/config/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eE("".concat(e_,"/config/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eE("".concat(e_,"/config/vitest/vitest.e2e.js"))};function e2(e){var t=e.isCurrentProject;return d({"pre-commit":eF,"commit-msg":eU},t&&{"pre-push":tm("".concat(eB," pull"))})}h(e2,"createGitHooksConfig");function e4(e){var t=e.type,n=e.packages,r=e.command;var s=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return i(function(){var e;return g(this,function(n){switch(n.label){case 0:switch(t){case C.CLI:return[3,1];case C.STRING:return[3,4]}return[3,5];case 1:e=s===null||s===void 0?void 0:s.length;if(!e)return[3,3];return[4,te(s,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tg(tm("".concat(eH," ").concat(r))))];case 4:return[2,tg(tm(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}h(e4,"buildCommand");var e3={simpleGitHooks:e4({type:C.CLI,packages:[{name:eQ,type:W.DEV_DEPENDENCY}],command:eW}),eslintInspect:e4({type:C.CLI,packages:[{name:eJ,type:W.DEV_DEPENDENCY}],command:e$}),nodeModulesInspect:e4({type:C.CLI,packages:[{name:ez,type:W.DEV_DEPENDENCY}],command:eX}),eslintCheck:e4({type:C.CLI,packages:[{name:eb,type:W.DEV_DEPENDENCY}],command:"".concat(eP," ").concat(e1.WORKING_DIRECTORY," --no-cache")}),eslintFix:e4({type:C.CLI,packages:[{name:eb,type:W.DEV_DEPENDENCY}],command:"".concat(eP," ").concat(e1.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:e4({type:C.CLI,packages:[{name:eq,type:W.DEPENDENCY}],command:"".concat(eV," -p ").concat(e1.TS_CONFIG," --noEmit")}),testUnit:e4({type:C.CLI,packages:[{name:eM,type:W.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e1.UNIT_TEST_CONFIG)}),testE2e:e4({type:C.CLI,packages:[{name:eM,type:W.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e1.E2E_TEST_CONFIG)}),mongoMigrateCreate:h(function(e){return e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," create ").concat(e," -f ").concat(e1.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," up -f ").concat(e1.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:e4({type:C.CLI,packages:[{name:eZ,type:W.DEPENDENCY}],command:"".concat(eY," ").concat(e0," down -f ").concat(e1.MIGRATE_MONGO_CONFIG)}),commitLint:e4({type:C.CLI,packages:[{name:eL,type:W.DEV_DEPENDENCY},{name:ej,type:W.DEV_DEPENDENCY}],command:"".concat(eU," --edit ").concat(e1.GIT_COMMIT_MSG," --config ").concat(e1.COMMITLINT_CONFIG)}),lintStaged:e4({type:C.CLI,packages:[{name:ek,type:W.DEV_DEPENDENCY}],command:"".concat(eF," --config ").concat(e1.LINT_STAGED_CONFIG)}),configureGitHook:e4({type:C.STRING,command:"".concat(eB," config core.hooksPath ").concat(e1.GIT_HOOK)}),build:e4({type:C.STRING,command:"".concat(eK," run --if-present build")}),pnpmInstallStandard:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts")}),pnpmInstallLegacy:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:e4({type:C.STRING,command:"".concat(eK," install --ignore-scripts --force")}),pnpmPruneStore:e4({type:C.STRING,command:"".concat(eK," store prune")}),pnpmCleanCache:e4({type:C.STRING,command:"".concat(eK," cache delete")})};var e5=U();function e8(e){return i(function(){var t,n,r,i;return g(this,function(s){switch(s.label){case 0:s.trys.push([0,3,,4]);return[4,J("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=s.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=s.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:i=s.sent();return[2,Q(i)];case 4:return[2]}})})()}h(e8,"getLatestPackageVersion");function e6(e){return i(function(){var t,n,r,i,s,o,c,a,u,l,d,p,E,m,f,y,h,S,v,D,O,C,I,N;return g(this,function(g){switch(g.label){case 0:g.trys.push([0,2,,3]);if(!e){if(ec(e1.PACKAGE_JSON)){t=ei(e1.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,i=t.version,s=i===void 0?"":i;return[2,{success:!0,result:{name:r,currentVersion:s,latestVersion:s,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:e1.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!ec(e1.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}}];o=ei(e1.PACKAGE_JSON),c=o.name,a=o.version,u=a===void 0?"":a,l=o.dependencies,d=l===void 0?{}:l,p=o.devDependencies,E=p===void 0?{}:p;if(e.name===c)return[2,{success:!0,result:{name:c,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:e1.PACKAGE_JSON,file:o}}];m=e.name in d,f=e.name in E;return[4,e8(e.name)];case 1:y=g.sent();if(!y.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:"",file:{}}}];if(!m&&!f)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===W.DEPENDENCY,isDevDependency:e.type===W.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(S=(h=d[e.name])!==null&&h!==void 0?h:E[e.name])!==null&&S!==void 0?S:"",D=em(e5.CWD,eh,e.name,ev);if(!ec(D))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:y.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:"",file:{}}}];O=ei(D),C=O.version,I=C===void 0?"":C;return[2,v!==I?{success:!0,result:{name:e.name,currentVersion:I||v,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:f,installedPath:D,file:O}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:y.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===y.result,isDependency:m,isDevDependency:f,installedPath:D,file:O}}];case 2:N=g.sent();return[2,Q(N)];case 3:return[2]}})})()}h(e6,"getPackage");function e7(e){return i(function(){var t,n,r,i,s;return g(this,function(o){try{;r=ei(e1.PACKAGE_JSON),i=(t=r.dependencies)!==null&&t!==void 0?t:{},s=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?i[e.name]=e.latestVersion:e.isDevDependency&&(s[e.name]=e.latestVersion),es(e1.PACKAGE_JSON,JSON.stringify(r,null,4)),H.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){Q(e)}return[2]})})()}h(e7,"updatePackage");function e9(){return i(function(){var e,t,n,r,i,s,o,c,a,u,l,d,p;return g(this,function(E){switch(E.label){case 0:E.trys.push([0,12,,13]);e=[{command:h(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:h(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:h(function(){return e3.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;E.label=1;case 1:E.trys.push([1,9,10,11]);i=e[Symbol.iterator]();E.label=2;case 2:if(!!(t=(s=i.next()).done))return[3,8];o=s.value,c=o.command,a=o.message;E.label=3;case 3:E.trys.push([3,6,,7]);return[4,c()];case 4:u=E.sent();return[4,th("".concat(a," using: ").concat(u),u)];case 5:E.sent();return[2];case 6:l=E.sent();Q(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:d=E.sent();n=true;r=d;return[3,11];case 10:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:p=E.sent();Q(p);return[3,13];case 13:return[2]}})})()}h(e9,"installDependencies");function te(e,t){return i(function(){var n,r,i,s,o,c,a,u,l,d,p,m,f,y,h,S,v;return g(this,function(g){switch(g.label){case 0:g.trys.push([0,15,,16]);if(!ec(e1.PACKAGE_JSON)){H.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(e6))];case 1:i=g.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),s=i.filter(function(e){return!e.isInstalled}),o=i.filter(function(e){return!e.isUpToDate}),c=[];(t===null||t===void 0?void 0:t.install)&&s.length>0&&(n=c).push.apply(n,E(s.map(e7))),(t===null||t===void 0?void 0:t.update)&&o.length>0&&(r=c).push.apply(r,E(o.map(e7)));a=c.length>0;if(!a)return[3,6];return[4,Promise.all(c)];case 2:g.sent();return[4,e9()];case 3:g.sent();u=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 4:return[4,th.apply(void 0,u.concat([g.sent()]))];case 5:a=g.sent();g.label=6;case 6:a;d=true,p=false,m=undefined;g.label=7;case 7:g.trys.push([7,12,13,14]);f=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();g.label=8;case 8:if(!!(d=(y=f.next()).done))return[3,11];h=y.value;return[4,h()];case 9:g.sent();g.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:S=g.sent();p=true;m=S;return[3,14];case 13:try{if(!d&&f.return!=null){f.return()}}finally{if(p){throw m}}return[7];case 14:return[3,16];case 15:v=g.sent();Q(v);return[3,16];case 16:return[2]}})})()}h(te,"setupPackages");import tt from"node-persist";var tn=U();function tr(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=tt.defaultInstance;if(e)return[3,2];return[4,tt.init({dir:tn.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}h(tr,"initNodePersist");var ti={get:function e(e){return i(function(){var t,n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,Q(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();Q(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();Q(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,Q(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return g(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,Q(e,{returnValue:null})]}return[2]})})()}};var ts=U(),to=T.promisify(I);function tc(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:return[4,e6()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}h(tc,"getPackageName");function ta(e){return i(function(){var t,n;return g(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,tc()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,ti.set(t,e)];case 3:r.sent(),setTimeout(function(){return i(function(){var e;return g(this,function(n){switch(n.label){case 0:return[4,ti.getLogLink(t)];case 1:e=n.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();Q(n);return[3,5];case 5:return[2]}})})()}h(ta,"saveErrorListToStorage");function tu(){return i(function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tc()];case 1:e=r.sent();return[4,ti.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,Q(n,{returnValue:[]})];case 4:return[2]}})})()}h(tu,"getStoredErrorLists");function tl(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tc()];case 1:e=n.sent();return[4,ti.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();Q(t);return[3,4];case 4:return[2]}})})()}h(tl,"clearAllErrorLists");function td(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,s=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,a,u,l,d;var p=i.exec(e)||[],E=s.exec(e)||[],m=o.exec(e)||[];var f,g,y,h,S,v;p.length&&r?t.push({file:r,position:"".concat(p[1],":").concat(p[2]),type:p[3]===k.Error?k.Error:k.Warning,message:(f=p===null||p===void 0?void 0:(c=p[4])===null||c===void 0?void 0:c.trim())!==null&&f!==void 0?f:"",rule:(g=p===null||p===void 0?void 0:(a=p[5])===null||a===void 0?void 0:a.trim())!==null&&g!==void 0?g:""}):E.length?t.push({file:(y=E===null||E===void 0?void 0:E[1])!==null&&y!==void 0?y:"",position:"".concat(E[2],":").concat(E[3]),type:E[4]===k.Error?k.Error:k.Warning,message:(h=E===null||E===void 0?void 0:(u=E[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):m.length?t.push({file:"commitlint",type:k.Error,message:(S=m===null||m===void 0?void 0:(l=m[1])===null||l===void 0?void 0:l.trim())!==null&&S!==void 0?S:"",rule:(v=m===null||m===void 0?void 0:(d=m[2])===null||d===void 0?void 0:d.trim())!==null&&v!==void 0?v:""}):n.push(e.trim())}}),t.length&&ta(t),ts.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}h(td,"parseTextErrors");function tp(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,s=e.column,o=e.ruleId,c=e.message;n.push({type:r===2?k.Error:k.Warning,file:t,position:"".concat(i,":").concat(s),rule:o,message:c})})}),n.length&&ta(n)}catch(t){td(e)}}h(tp,"parseCommandOutput");function tE(e){return i(function(e){var t,n,r,i,s,o,c,a,u;var l=arguments;return g(this,function(d){switch(d.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:tp;n=new AbortController;N.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),N.exit()});d.label=1;case 1:d.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,to(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=d.sent(),i=r.stdout,s=r.stderr;[i,s].forEach(function(e){return e&&t(e)});d.label=3;case 3:return[3,5];case 4:o=d.sent();c=o.stdout,a=o.stderr,u=o.message;[c,a].forEach(function(e){return e&&t(e)}),!a&&!c&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}h(tE,"executeCommand");function tm(e){return{raw:!0,cmd:e}}h(tm,"rawCommand");function tf(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eH," ").concat(eY," ").concat(eG," ").concat(e):"".concat(eH," ").concat(eR," ").concat(e)}h(tf,"formatCLI");function tg(e,t){return typeof e=="function"?tf(e(t),t):(typeof e==="undefined"?"undefined":m(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tf(e,t):e}h(tg,"formatCommand");function ty(e){return i(function(){var t,n,r;return g(this,function(i){switch(i.label){case 0:return[4,e6({name:ey})];case 1:t=i.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=p(e,2),r=t[0],i=t[1];return[r,tg(i,n)]}))]}return[2]}})})()}h(ty,"resolveCommands");function th(e,t){return i(function(){var n;return g(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),ts.DEBUG&&H.info("→ ".concat(t));return[4,tE(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();Q(n);return[3,3];case 3:return[2]}})})()}h(th,"runCommand");function tS(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:if(!ec(e1.TS_CONFIG))return[3,3];t=["Performing TypeScript validation"];return[4,e3.typescriptCheck()];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:e=n.sent();return[3,4];case 3:e=H.warn("No TypeScript configuration found. Skipping type check.");n.label=4;case 4:e;return[2]}})})()}h(tS,"checkTypescript");function tv(){return i(function(){var e,t,n,r;var i=arguments;return g(this,function(s){switch(s.label){case 0:e=i.length>0&&i[0]!==void 0?i[0]:!1;if(!e)return[3,3];n=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 1:return[4,th.apply(void 0,n.concat([s.sent()]))];case 2:t=s.sent();return[3,6];case 3:r=["Running ESLint check"];return[4,e3.eslintCheck()];case 4:return[4,th.apply(void 0,r.concat([s.sent()]))];case 5:t=s.sent();s.label=6;case 6:t;return[2]}})}).apply(this,arguments)}h(tv,"checkEslint");function tD(e,t){if(!t.length)return;var n=e==="Errors"?"red":"yellow";H.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",t,n)}h(tD,"printIssues");function tO(){return i(function(){return g(this,function(e){setTimeout(function(){return i(function(){var e,t,n;return g(this,function(r){switch(r.label){case 0:return[4,tu()];case 1:e=r.sent(),t=e.filter(function(e){return e.type===k.Error}),n=e.filter(function(e){return e.type===k.Warning});!t.length&&!n.length?H.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(tD("Warnings",n),tD("Errors",t),(t.length>0||n.length>0)&&S.exit(1));return[2]}})})()},0);return[2]})})()}h(tO,"showCheckResult");function tC(){return i(function(){var e,t,n,r;return g(this,function(i){switch(i.label){case 0:return[4,tl()];case 1:i.sent();return[4,e6({name:ey})];case 2:e=i.sent();if(!e.success){H.error("Failed to retrieve package information. Aborting lint-staged.");return[2]}t=e.result.isCurrentProject;if(!t)return[3,5];n=["Building package: ".concat(ey)];return[4,e3.build()];case 3:return[4,th.apply(void 0,n.concat([i.sent()]))];case 4:t=i.sent();i.label=5;case 5:t;r=["Executing lint-staged"];return[4,e3.lintStaged()];case 6:return[4,th.apply(void 0,r.concat([i.sent()]))];case 7:i.sent(),tO();return[2]}})})()}h(tC,"lintStaged");function tI(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Inspecting ESLint configuration"];return[4,e3.eslintInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tI,"inspectLint");function tN(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tS(),tv()])];case 2:e.sent(),tO();return[2]}})})()}h(tN,"lintCheck");function tT(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,tl()];case 1:e.sent();return[4,Promise.all([tS(),tv(!0)])];case 2:e.sent(),tO();return[2]}})})()}h(tT,"lintFix");function tx(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:return[4,tl()];case 1:t.sent();e=["Validating commit message"];return[4,e3.commitLint()];case 2:return[4,th.apply(void 0,e.concat([t.sent()]))];case 3:t.sent(),tO();return[2]}})})()}h(tx,"commitLint");function tA(){return i(function(){var e,t,n,r;return g(this,function(i){switch(i.label){case 0:e=["Configuring Git hooks"];return[4,e3.configureGitHook()];case 1:return[4,th.apply(void 0,e.concat([i.sent()]))];case 2:i.sent(),ea(e1.GIT_HOOK);return[4,ty(e2)];case 3:t=i.sent();es(e1.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(t,null,4));n="\n".concat(eI,"\n");ec(e1.GIT_IGNORE)?et(e1.GIT_IGNORE,"utf-8").split("\n").includes(eI)||eo(e1.GIT_IGNORE,n):es(e1.GIT_IGNORE,n);r=["Setting up simple-git-hooks"];return[4,e3.simpleGitHooks()];case 4:return[4,th.apply(void 0,r.concat([i.sent()]))];case 5:i.sent();return[2]}})})()}h(tA,"setupGitHook");function t_(){return i(function(){return g(this,function(e){switch(e.label){case 0:return[4,e9()];case 1:e.sent();return[4,tA()];case 2:e.sent();return[2]}})})()}h(t_,"prepare");function tR(){return i(function(){var e,t;return g(this,function(n){switch(n.label){case 0:ea(e1.NODE_MODULES,e1.PNPM_LOCK_YAML);e=["Pruning pnpm store"];return[4,e3.pnpmPruneStore()];case 1:return[4,th.apply(void 0,e.concat([n.sent()]))];case 2:n.sent();t=["Clearing pnpm cache"];return[4,e3.pnpmCleanCache()];case 3:return[4,th.apply(void 0,t.concat([n.sent()]))];case 4:n.sent();return[4,e9()];case 5:n.sent();return[4,tA()];case 6:n.sent();return[2]}})})()}h(tR,"reset");function tG(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Inspecting project dependencies"];return[4,e3.nodeModulesInspect()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tG,"inspect");function tb(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running unit tests"];return[4,e3.testUnit()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tb,"testUnit");function tP(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running end-to-end tests"];return[4,e3.testE2e()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tP,"testE2E");function tM(e){return i(function(){var t;return g(this,function(n){switch(n.label){case 0:t=["Creating MongoDB migration"];return[4,e3.mongoMigrateCreate(e)];case 1:return[4,th.apply(void 0,t.concat([n.sent()]))];case 2:n.sent();return[2]}})})()}h(tM,"mongoMigrateCreate");function tw(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Running MongoDB migrations"];return[4,e3.mongoMigrateUp()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tw,"mongoMigrateUp");function tL(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:e=["Rolling back MongoDB migration"];return[4,e3.mongoMigrateDown()];case 1:return[4,th.apply(void 0,e.concat([t.sent()]))];case 2:t.sent();return[2]}})})()}h(tL,"mongoMigrateDown");(function(){return i(function(){var e;return g(this,function(t){switch(t.label){case 0:t.trys.push([0,2,,3]);return[4,D(v(S.argv)).scriptName(eR).usage("$0 <command> [options]").command("lint","Check code for linting issues",tN).command("lint:fix","Fix linting issues automatically",tT).command("lint:inspect","View active ESLint configuration",tI).command("lint-staged","Run lint checks on staged files",tC).command("commitlint","Validate commit message format",tx).command("prepare","Initialize project and dependencies",t_).command("reset","Reset the project and reinstall dependencies",tR).command("inspect","Analyze installed project dependencies",tG).command("test:unit","Run unit test suite",tb).command("test:e2e","Run end-to-end test suite",tP).command("mongo:migrate:create <name>","Create a MongoDB migration",function(e){return e.positional("name",{describe:"Migration name",type:"string"})},function(e){return i(function(){return g(this,function(t){switch(t.label){case 0:if(!e.name){H.error("Migration name is required.");return[2]}return[4,tM(e.name)];case 1:t.sent();return[2]}})})()}).command("mongo:migrate:up","Apply all MongoDB migrations",tw).command("mongo:migrate:down","Rollback last MongoDB migration",tL).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(O.version).epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse()];case 1:t.sent();return[3,3];case 2:e=t.sent();Q(e),S.exit(1);return[3,3];case 3:return[2]}})})()})();
@@ -1 +1 @@
1
- "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,a,o,s){try{var i=e[o](s);var c=i.value}catch(e){n(e);return}if(i.done){t(c)}else{Promise.resolve(c).then(r,a)}}function a(e){return function(){var t=this,n=arguments;return new Promise(function(a,o){var s=e.apply(t,n);function i(e){r(s,a,o,i,c,"next",e)}function c(e){r(s,a,o,i,c,"throw",e)}i(undefined)})}}function o(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var a=true;var o=false;var s,i;try{for(n=n.call(e);!(a=(s=n.next()).done);a=true){r.push(s.value);if(t&&r.length===t)break}}catch(e){o=true;i=e}finally{try{if(!a&&n["return"]!=null)n["return"]()}finally{if(o)throw i}}return r}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,n){return t(e)||i(e,n)||f(e,n)||c()}function E(e){return n(e)||s(e)||f(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function p(e,t){var n,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(o=0)),o)try{if(n=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.create;var S=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var y=function(e,t){return S(e,"name",{value:t,configurable:!0})};var h=function(e,t){for(var n in t)S(e,n,{get:t[n],enumerable:!0})},I=function(e,t,n,r){var a=true,o=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":d(t))=="object"||typeof t=="function")try{var i=function(){var a=u.value;!C.call(e,a)&&a!==n&&S(e,a,{get:function(){return t[a]},enumerable:!(r=D(t,a))||r.enumerable})};for(var c=O(t)[Symbol.iterator](),u;!(a=(u=c.next()).done);a=true)i()}catch(e){o=true;s=e}finally{try{if(!a&&c.return!=null){c.return()}}finally{if(o){throw s}}}return e};var N=function(e,t,n){return n=e!=null?m(v(e)):{},I(t||!e||!e.__esModule?S(n,"default",{value:e,enumerable:!0}):n,e)},T=function(e){return I(S({},"__esModule",{value:!0}),e)};var A={};h(A,{clearAllErrorLists:function(){return tl},formatCommand:function(){return tS},getStoredErrorLists:function(){return tu},rawCommand:function(){return tp},resolveCommands:function(){return tD},runCommand:function(){return tO}});module.exports=T(A);var g=require("child_process"),_=N(require("process"),1),R=N(require("util"),1);var G=".cyberskill-storage";var P=N(require("@dotenvx/dotenvx"),1),M=require("envalid"),b=N(require("os"),1),L=N(require("path"),1),U=N(require("process"),1);var w=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var k=!1;function F(){U.default.env.NODE_ENV!==w.PRODUCTION&&!k&&(P.default.config(),k=!0)}y(F,"loadEnvFile");function Y(){F();var e=(0,M.cleanEnv)(U.default.env,{CWD:(0,M.str)({default:U.default.cwd()}),DEBUG:(0,M.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,M.str)({default:L.default.join(b.default.homedir(),G)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}y(Y,"getEnv");var V=function(e){return e.Error="error",e.Warning="warning",e}({});var x=N(require("chalk"),1),j=N(require("consola"),1),q=require("graphql");var K={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var B=Y();B.DEBUG||(j.default.level=4);function Q(e){var t=x.default[e];return typeof t=="function"?t:x.default.green}y(Q,"chalkKeyword");var H={silent:j.default.silent,level:j.default.level,fatal:j.default.fatal,error:j.default.error,warn:j.default.warn,log:j.default.log,info:j.default.info,success:j.default.success,ready:j.default.ready,start:j.default.start,box:j.default.box,debug:j.default.debug,trace:j.default.trace,verbose:j.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){j.default.box(x.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,a=e.rule,o=e.message;j.default.log("".concat(x.default.gray("File:")," ").concat(x.default.blue("".concat(t).concat(r?":".concat(r):"")))),a&&j.default.log(" ".concat(Q(n)("Rule:")," ").concat(a)),j.default.log(" ".concat(Q(n)("Message:")," ").concat(o))}),j.default.box(Q(n)("".concat(e," : ").concat(t.length))),j.default.log(x.default.gray("─".repeat(40)))}};function W(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,a=r===void 0?!0:r,s=n.returnValue,i=n.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&H.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:K.INTERNAL_SERVER_ERROR.CODE}}y(W,"catchError");var J=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});var $=N(require("node-fetch"),1);var X=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var z=N(require("fs-extra"),1),Z=N(require("path"),1);var ee=z.default,et=ee.lstatSync,en=ee.readdirSync,er=ee.mkdirSync,ea=ee.readFileSync,eo=ee.unlinkSync,es=ee.statSync,ei=z.default.readJsonSync;function ec(e,t,n){z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}y(ec,"writeFileSync");function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return z.default.pathExistsSync(e)})}y(eu,"pathExistsSync");var el=N(require("fs-extra"),1);var eE=N(require("path"),1);var ed=Y(),ef=eE.default;function ep(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ef).resolve.apply(r,[ed.CWD].concat(E(t)))}y(ep,"resolveWorkingPath");function em(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ef).join.apply(r,E(t))}y(em,"join");var eS=Y(),eD=eS.CWD,eO="@cyberskill/shared",ev="node_modules",eC="dist",ey="package.json",eh="package-lock.json",eI="tsconfig.json",eN=".gitignore",eT=".simple-git-hooks.json",eA="pnpm-lock.yaml",eg=".git/hooks/",e_=".git/COMMIT_EDITMSG",eR=".migrate-mongo.config.js",eG=function(){var e=el.default.readJsonSync(ep(ey)).name===eO?eD:em(eD,ev,eO);return em(e,eC)}(),eP="cyberskill",eM="src/node/cli/index.ts",eb="eslint",eL="eslint",eU="vitest";var ew="vitest",ek="@commitlint/cli",eF="@commitlint/config-conventional",eY="commitlint",eV="lint-staged",ex="lint-staged",ej="typescript",eq="tsc",eK="tsx",eB="git",eQ="pnpm",eH="pnpm exec",eW="simple-git-hooks",eJ="simple-git-hooks",e$="@eslint/config-inspector",eX="eslint-config-inspector",ez="node-modules-inspector",eZ="node-modules-inspector",e0="migrate-mongo",e1="./node_modules/migrate-mongo/bin/migrate-mongo",e2={CYBERSKILL_DIRECTORY:eG,WORKING_DIRECTORY:eD,TS_CONFIG:ep(eI),GIT_IGNORE:ep(eN),GIT_HOOK:ep(eg),GIT_COMMIT_MSG:ep(e_),SIMPLE_GIT_HOOKS_JSON:ep(eT),PACKAGE_JSON:ep(ey),PACKAGE_LOCK_JSON:ep(eh),PNPM_LOCK_YAML:ep(eA),NODE_MODULES:ep(ev),MIGRATE_MONGO_CONFIG:ep(eR),LINT_STAGED_CONFIG:ep("".concat(eG,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:ep("".concat(eG,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:ep("".concat(eG,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ep("".concat(eG,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ep("".concat(eG,"/react/vitest/vitest.e2e.js"))};function e4(e){var t=e.type,n=e.packages,r=e.command;var o=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:switch(t){case X.CLI:return[3,1];case X.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,te(o,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tS(tp("".concat(eH," ").concat(r))))];case 4:return[2,tS(tp(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}y(e4,"buildCommand");var e3={simpleGitHooks:e4({type:X.CLI,packages:[{name:eW,type:J.DEV_DEPENDENCY}],command:eJ}),eslintInspect:e4({type:X.CLI,packages:[{name:e$,type:J.DEV_DEPENDENCY}],command:eX}),nodeModulesInspect:e4({type:X.CLI,packages:[{name:ez,type:J.DEV_DEPENDENCY}],command:eZ}),eslintCheck:e4({type:X.CLI,packages:[{name:eb,type:J.DEV_DEPENDENCY}],command:"".concat(eL," ").concat(e2.WORKING_DIRECTORY," --no-cache")}),eslintFix:e4({type:X.CLI,packages:[{name:eb,type:J.DEV_DEPENDENCY}],command:"".concat(eL," ").concat(e2.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:e4({type:X.CLI,packages:[{name:ej,type:J.DEPENDENCY}],command:"".concat(eq," -p ").concat(e2.TS_CONFIG," --noEmit")}),testUnit:e4({type:X.CLI,packages:[{name:eU,type:J.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e2.UNIT_TEST_CONFIG)}),testE2e:e4({type:X.CLI,packages:[{name:eU,type:J.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e2.E2E_TEST_CONFIG)}),mongoMigrateCreate:y(function(e){return e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," create ").concat(e," -f ").concat(e2.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," up -f ").concat(e2.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," down -f ").concat(e2.MIGRATE_MONGO_CONFIG)}),commitLint:e4({type:X.CLI,packages:[{name:ek,type:J.DEV_DEPENDENCY},{name:eF,type:J.DEV_DEPENDENCY}],command:"".concat(eY," --edit ").concat(e2.GIT_COMMIT_MSG," --config ").concat(e2.COMMITLINT_CONFIG)}),lintStaged:e4({type:X.CLI,packages:[{name:eV,type:J.DEV_DEPENDENCY}],command:"".concat(ex," --config ").concat(e2.LINT_STAGED_CONFIG)}),configureGitHook:e4({type:X.STRING,command:"".concat(eB," config core.hooksPath ").concat(e2.GIT_HOOK)}),build:e4({type:X.STRING,command:"".concat(eQ," run --if-present build")}),pnpmInstallStandard:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts")}),pnpmInstallLegacy:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts --force")}),pnpmPruneStore:e4({type:X.STRING,command:"".concat(eQ," store prune")}),pnpmCleanCache:e4({type:X.STRING,command:"".concat(eQ," cache delete")})};var e5=Y();function e6(e){return a(function(){var t,n,r,a;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,$.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=o.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,W(a)];case 4:return[2]}})})()}y(e6,"getLatestPackageVersion");function e7(e){return a(function(){var t,n,r,a,o,s,i,c,u,l,E,d,f,m,S,D,O,v,C,y,h,I,N,T;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,2,,3]);if(!e){if(eu(e2.PACKAGE_JSON)){t=ei(e2.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,a=t.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:e2.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!eu(e2.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=ei(e2.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,l=s.dependencies,E=l===void 0?{}:l,d=s.devDependencies,f=d===void 0?{}:d;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:e2.PACKAGE_JSON,file:s}}];m=e.name in E,S=e.name in f;return[4,e6(e.name)];case 1:D=p.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:"",file:{}}}];C=(v=(O=E[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&v!==void 0?v:"",y=em(e5.CWD,ev,e.name,ey);if(!eu(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];h=ei(y),I=h.version,N=I===void 0?"":I;return[2,C!==N?{success:!0,result:{name:e.name,currentVersion:N||C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:y,file:h}}:{success:!0,result:{name:e.name,currentVersion:C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:C===D.result,isDependency:m,isDevDependency:S,installedPath:y,file:h}}];case 2:T=p.sent();return[2,W(T)];case 3:return[2]}})})()}y(e7,"getPackage");function e8(e){return a(function(){var t,n,r,a,o;return p(this,function(s){try{;r=ei(e2.PACKAGE_JSON),a=(t=r.dependencies)!==null&&t!==void 0?t:{},o=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),ec(e2.PACKAGE_JSON,JSON.stringify(r,null,4)),H.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){W(e)}return[2]})})()}y(e8,"updatePackage");function e9(){return a(function(){var e,t,n,r,a,o,s,i,c,u,l,E,d;return p(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:y(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return e3.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);a=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];s=o.value,i=s.command,c=s.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,tO("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();W(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:E=f.sent();n=true;r=E;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();W(d);return[3,13];case 13:return[2]}})})()}y(e9,"installDependencies");function te(e,t){return a(function(){var n,r,a,o,s,i,c,u,l,d,f,m,S,D,O,v,C;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,15,,16]);if(!eu(e2.PACKAGE_JSON)){H.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(e7))];case 1:a=p.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),o=a.filter(function(e){return!e.isInstalled}),s=a.filter(function(e){return!e.isUpToDate}),i=[];(t===null||t===void 0?void 0:t.install)&&o.length>0&&(n=i).push.apply(n,E(o.map(e8))),(t===null||t===void 0?void 0:t.update)&&s.length>0&&(r=i).push.apply(r,E(s.map(e8)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:p.sent();return[4,e9()];case 3:p.sent();u=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 4:return[4,tO.apply(void 0,u.concat([p.sent()]))];case 5:c=p.sent();p.label=6;case 6:c;d=true,f=false,m=undefined;p.label=7;case 7:p.trys.push([7,12,13,14]);S=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();p.label=8;case 8:if(!!(d=(D=S.next()).done))return[3,11];O=D.value;return[4,O()];case 9:p.sent();p.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:v=p.sent();f=true;m=v;return[3,14];case 13:try{if(!d&&S.return!=null){S.return()}}finally{if(f){throw m}}return[7];case 14:return[3,16];case 15:C=p.sent();W(C);return[3,16];case 16:return[2]}})})()}y(te,"setupPackages");var tt=N(require("node-persist"),1);var tn=Y();function tr(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:e=tt.default.defaultInstance;if(e)return[3,2];return[4,tt.default.init({dir:tn.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}y(tr,"initNodePersist");var ta={get:function e(e){return a(function(){var t,n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,W(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return a(function(){var n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();W(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,W(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return p(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,W(e,{returnValue:null})]}return[2]})})()}};var to=Y(),ts=R.promisify(g.exec);function ti(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,e7()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}y(ti,"getPackageName");function tc(e){return a(function(){var t,n;return p(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,ti()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,ta.set(t,e)];case 3:r.sent(),setTimeout(function(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,ta.getLogLink(t)];case 1:e=n.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();W(n);return[3,5];case 5:return[2]}})})()}y(tc,"saveErrorListToStorage");function tu(){return a(function(){var e,t,n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ti()];case 1:e=r.sent();return[4,ta.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,W(n,{returnValue:[]})];case 4:return[2]}})})()}y(tu,"getStoredErrorLists");function tl(){return a(function(){var e,t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ti()];case 1:e=n.sent();return[4,ta.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W(t);return[3,4];case 4:return[2]}})})()}y(tl,"clearAllErrorLists");function tE(e){var t=[],n=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=s.exec(e)||[];var m,S,D,O,v,C;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===V.Error?V.Error:V.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):f.length?t.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===V.Error?V.Error:V.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?t.push({file:"commitlint",type:V.Error,message:(v=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(C=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:""}):n.push(e.trim())}}),t.length&&tc(t),to.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}y(tE,"parseTextErrors");function td(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,a=e.line,o=e.column,s=e.ruleId,i=e.message;n.push({type:r===2?V.Error:V.Warning,file:t,position:"".concat(a,":").concat(o),rule:s,message:i})})}),n.length&&tc(n)}catch(t){tE(e)}}y(td,"parseCommandOutput");function tf(e){return a(function(e){var t,n,r,a,o,s,i,c,u;var l=arguments;return p(this,function(E){switch(E.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:td;n=new AbortController;_.default.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),_.default.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ts(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&t(e)});E.label=3;case 3:return[3,5];case 4:s=E.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&t(e)}),!c&&!i&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}y(tf,"executeCommand");function tp(e){return{raw:!0,cmd:e}}y(tp,"rawCommand");function tm(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eH," ").concat(eK," ").concat(eM," ").concat(e):"".concat(eH," ").concat(eP," ").concat(e)}y(tm,"formatCLI");function tS(e,t){return typeof e=="function"?tm(e(t),t):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tm(e,t):e}y(tS,"formatCommand");function tD(e){return a(function(){var t,n,r;return p(this,function(a){switch(a.label){case 0:return[4,e7({name:eO})];case 1:t=a.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=l(e,2),r=t[0],a=t[1];return[r,tS(a,n)]}))]}return[2]}})})()}y(tD,"resolveCommands");function tO(e,t){return a(function(){var n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),to.DEBUG&&H.info("→ ".concat(t));return[4,tf(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();W(n);return[3,3];case 3:return[2]}})})()}y(tO,"runCommand");0&&(module.exports={clearAllErrorLists:clearAllErrorLists,formatCommand:formatCommand,getStoredErrorLists:getStoredErrorLists,rawCommand:rawCommand,resolveCommands:resolveCommands,runCommand:runCommand});
1
+ "use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,a,o,s){try{var i=e[o](s);var c=i.value}catch(e){n(e);return}if(i.done){t(c)}else{Promise.resolve(c).then(r,a)}}function a(e){return function(){var t=this,n=arguments;return new Promise(function(a,o){var s=e.apply(t,n);function i(e){r(s,a,o,i,c,"next",e)}function c(e){r(s,a,o,i,c,"throw",e)}i(undefined)})}}function o(e,t){if(t!=null&&typeof Symbol!=="undefined"&&t[Symbol.hasInstance]){return!!t[Symbol.hasInstance](e)}else{return e instanceof t}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var a=true;var o=false;var s,i;try{for(n=n.call(e);!(a=(s=n.next()).done);a=true){r.push(s.value);if(t&&r.length===t)break}}catch(e){o=true;i=e}finally{try{if(!a&&n["return"]!=null)n["return"]()}finally{if(o)throw i}}return r}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,n){return t(e)||i(e,n)||f(e,n)||c()}function E(e){return n(e)||s(e)||f(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(t,n){if(!t)return;if(typeof t==="string")return e(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor)r=t.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(t,n)}function p(e,t){var n,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(t){return c([e,t])}}function c(i){if(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(o=0)),o)try{if(n=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e];r=0}finally{n=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.create;var S=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var y=function(e,t){return S(e,"name",{value:t,configurable:!0})};var h=function(e,t){for(var n in t)S(e,n,{get:t[n],enumerable:!0})},I=function(e,t,n,r){var a=true,o=false,s=undefined;if(t&&(typeof t==="undefined"?"undefined":d(t))=="object"||typeof t=="function")try{var i=function(){var a=u.value;!C.call(e,a)&&a!==n&&S(e,a,{get:function(){return t[a]},enumerable:!(r=D(t,a))||r.enumerable})};for(var c=O(t)[Symbol.iterator](),u;!(a=(u=c.next()).done);a=true)i()}catch(e){o=true;s=e}finally{try{if(!a&&c.return!=null){c.return()}}finally{if(o){throw s}}}return e};var N=function(e,t,n){return n=e!=null?m(v(e)):{},I(t||!e||!e.__esModule?S(n,"default",{value:e,enumerable:!0}):n,e)},T=function(e){return I(S({},"__esModule",{value:!0}),e)};var A={};h(A,{clearAllErrorLists:function(){return tl},formatCommand:function(){return tS},getStoredErrorLists:function(){return tu},rawCommand:function(){return tp},resolveCommands:function(){return tD},runCommand:function(){return tO}});module.exports=T(A);var g=require("child_process"),_=N(require("process"),1),R=N(require("util"),1);var G=".cyberskill-storage";var P=N(require("@dotenvx/dotenvx"),1),M=require("envalid"),b=N(require("os"),1),L=N(require("path"),1),U=N(require("process"),1);var w=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var k=!1;function F(){U.default.env.NODE_ENV!==w.PRODUCTION&&!k&&(P.default.config(),k=!0)}y(F,"loadEnvFile");function Y(){F();var e=(0,M.cleanEnv)(U.default.env,{CWD:(0,M.str)({default:U.default.cwd()}),DEBUG:(0,M.bool)({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:(0,M.str)({default:L.default.join(b.default.homedir(),G)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}y(Y,"getEnv");var V=function(e){return e.Error="error",e.Warning="warning",e}({});var x=N(require("chalk"),1),j=N(require("consola"),1),q=require("graphql");var K={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var B=Y();B.DEBUG||(j.default.level=4);function Q(e){var t=x.default[e];return typeof t=="function"?t:x.default.green}y(Q,"chalkKeyword");var H={silent:j.default.silent,level:j.default.level,fatal:j.default.fatal,error:j.default.error,warn:j.default.warn,log:j.default.log,info:j.default.info,success:j.default.success,ready:j.default.ready,start:j.default.start,box:j.default.box,debug:j.default.debug,trace:j.default.trace,verbose:j.default.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){j.default.box(x.default.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,a=e.rule,o=e.message;j.default.log("".concat(x.default.gray("File:")," ").concat(x.default.blue("".concat(t).concat(r?":".concat(r):"")))),a&&j.default.log(" ".concat(Q(n)("Rule:")," ").concat(a)),j.default.log(" ".concat(Q(n)("Message:")," ").concat(o))}),j.default.box(Q(n)("".concat(e," : ").concat(t.length))),j.default.log(x.default.gray("─".repeat(40)))}};function W(e,t){var n=t!==null&&t!==void 0?t:{},r=n.shouldLog,a=r===void 0?!0:r,s=n.returnValue,i=n.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&H.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:K.INTERNAL_SERVER_ERROR.CODE}}y(W,"catchError");var J=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});var $=N(require("node-fetch"),1);var X=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});var z=N(require("fs-extra"),1),Z=N(require("path"),1);var ee=z.default,et=ee.lstatSync,en=ee.readdirSync,er=ee.mkdirSync,ea=ee.readFileSync,eo=ee.unlinkSync,es=ee.statSync,ei=z.default.readJsonSync;function ec(e,t,n){z.default.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}y(ec,"writeFileSync");function eu(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return z.default.pathExistsSync(e)})}y(eu,"pathExistsSync");var el=N(require("fs-extra"),1);var eE=N(require("path"),1);var ed=Y(),ef=eE.default;function ep(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ef).resolve.apply(r,[ed.CWD].concat(E(t)))}y(ep,"resolveWorkingPath");function em(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=ef).join.apply(r,E(t))}y(em,"join");var eS=Y(),eD=eS.CWD,eO="@cyberskill/shared",ev="node_modules",eC="dist",ey="package.json",eh="package-lock.json",eI="tsconfig.json",eN=".gitignore",eT=".simple-git-hooks.json",eA="pnpm-lock.yaml",eg=".git/hooks/",e_=".git/COMMIT_EDITMSG",eR=".migrate-mongo.config.js",eG=function(){var e=el.default.readJsonSync(ep(ey)).name===eO?eD:em(eD,ev,eO);return em(e,eC)}(),eP="cyberskill",eM="src/node/cli/index.ts",eb="eslint",eL="eslint",eU="vitest";var ew="vitest",ek="@commitlint/cli",eF="@commitlint/config-conventional",eY="commitlint",eV="lint-staged",ex="lint-staged",ej="typescript",eq="tsc",eK="tsx",eB="git",eQ="pnpm",eH="pnpm exec",eW="simple-git-hooks",eJ="simple-git-hooks",e$="@eslint/config-inspector",eX="eslint-config-inspector",ez="node-modules-inspector",eZ="node-modules-inspector",e0="migrate-mongo",e1="./node_modules/migrate-mongo/bin/migrate-mongo",e2={CYBERSKILL_DIRECTORY:eG,WORKING_DIRECTORY:eD,TS_CONFIG:ep(eI),GIT_IGNORE:ep(eN),GIT_HOOK:ep(eg),GIT_COMMIT_MSG:ep(e_),SIMPLE_GIT_HOOKS_JSON:ep(eT),PACKAGE_JSON:ep(ey),PACKAGE_LOCK_JSON:ep(eh),PNPM_LOCK_YAML:ep(eA),NODE_MODULES:ep(ev),MIGRATE_MONGO_CONFIG:ep(eR),LINT_STAGED_CONFIG:ep("".concat(eG,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:ep("".concat(eG,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:ep("".concat(eG,"/config/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:ep("".concat(eG,"/config/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:ep("".concat(eG,"/config/vitest/vitest.e2e.js"))};function e4(e){var t=e.type,n=e.packages,r=e.command;var o=n===null||n===void 0?void 0:n.reduce(function(e,t){return e.some(function(e){return e.name===t.name})||e.push(t),e},[]);return function(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:switch(t){case X.CLI:return[3,1];case X.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,te(o,{install:!0})];case 2:e=n.sent();n.label=3;case 3:return[2,(e,tS(tp("".concat(eH," ").concat(r))))];case 4:return[2,tS(tp(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}y(e4,"buildCommand");var e3={simpleGitHooks:e4({type:X.CLI,packages:[{name:eW,type:J.DEV_DEPENDENCY}],command:eJ}),eslintInspect:e4({type:X.CLI,packages:[{name:e$,type:J.DEV_DEPENDENCY}],command:eX}),nodeModulesInspect:e4({type:X.CLI,packages:[{name:ez,type:J.DEV_DEPENDENCY}],command:eZ}),eslintCheck:e4({type:X.CLI,packages:[{name:eb,type:J.DEV_DEPENDENCY}],command:"".concat(eL," ").concat(e2.WORKING_DIRECTORY," --no-cache")}),eslintFix:e4({type:X.CLI,packages:[{name:eb,type:J.DEV_DEPENDENCY}],command:"".concat(eL," ").concat(e2.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:e4({type:X.CLI,packages:[{name:ej,type:J.DEPENDENCY}],command:"".concat(eq," -p ").concat(e2.TS_CONFIG," --noEmit")}),testUnit:e4({type:X.CLI,packages:[{name:eU,type:J.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e2.UNIT_TEST_CONFIG)}),testE2e:e4({type:X.CLI,packages:[{name:eU,type:J.DEV_DEPENDENCY}],command:"".concat(ew," --config ").concat(e2.E2E_TEST_CONFIG)}),mongoMigrateCreate:y(function(e){return e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," create ").concat(e," -f ").concat(e2.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," up -f ").concat(e2.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:e4({type:X.CLI,packages:[{name:e0,type:J.DEPENDENCY}],command:"".concat(eK," ").concat(e1," down -f ").concat(e2.MIGRATE_MONGO_CONFIG)}),commitLint:e4({type:X.CLI,packages:[{name:ek,type:J.DEV_DEPENDENCY},{name:eF,type:J.DEV_DEPENDENCY}],command:"".concat(eY," --edit ").concat(e2.GIT_COMMIT_MSG," --config ").concat(e2.COMMITLINT_CONFIG)}),lintStaged:e4({type:X.CLI,packages:[{name:eV,type:J.DEV_DEPENDENCY}],command:"".concat(ex," --config ").concat(e2.LINT_STAGED_CONFIG)}),configureGitHook:e4({type:X.STRING,command:"".concat(eB," config core.hooksPath ").concat(e2.GIT_HOOK)}),build:e4({type:X.STRING,command:"".concat(eQ," run --if-present build")}),pnpmInstallStandard:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts")}),pnpmInstallLegacy:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:e4({type:X.STRING,command:"".concat(eQ," install --ignore-scripts --force")}),pnpmPruneStore:e4({type:X.STRING,command:"".concat(eQ," store prune")}),pnpmCleanCache:e4({type:X.STRING,command:"".concat(eQ," cache delete")})};var e5=Y();function e6(e){return a(function(){var t,n,r,a;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,(0,$.default)("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=o.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=o.sent(),r=n.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,W(a)];case 4:return[2]}})})()}y(e6,"getLatestPackageVersion");function e7(e){return a(function(){var t,n,r,a,o,s,i,c,u,l,E,d,f,m,S,D,O,v,C,y,h,I,N,T;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,2,,3]);if(!e){if(eu(e2.PACKAGE_JSON)){t=ei(e2.PACKAGE_JSON),n=t.name,r=n===void 0?"":n,a=t.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:e2.PACKAGE_JSON,file:t}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!eu(e2.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=ei(e2.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,l=s.dependencies,E=l===void 0?{}:l,d=s.devDependencies,f=d===void 0?{}:d;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:e2.PACKAGE_JSON,file:s}}];m=e.name in E,S=e.name in f;return[4,e6(e.name)];case 1:D=p.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===J.DEPENDENCY,isDevDependency:e.type===J.DEV_DEPENDENCY,installedPath:"",file:{}}}];C=(v=(O=E[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&v!==void 0?v:"",y=em(e5.CWD,ev,e.name,ey);if(!eu(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];h=ei(y),I=h.version,N=I===void 0?"":I;return[2,C!==N?{success:!0,result:{name:e.name,currentVersion:N||C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:y,file:h}}:{success:!0,result:{name:e.name,currentVersion:C,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:C===D.result,isDependency:m,isDevDependency:S,installedPath:y,file:h}}];case 2:T=p.sent();return[2,W(T)];case 3:return[2]}})})()}y(e7,"getPackage");function e8(e){return a(function(){var t,n,r,a,o;return p(this,function(s){try{;r=ei(e2.PACKAGE_JSON),a=(t=r.dependencies)!==null&&t!==void 0?t:{},o=(n=r.devDependencies)!==null&&n!==void 0?n:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),ec(e2.PACKAGE_JSON,JSON.stringify(r,null,4)),H.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){W(e)}return[2]})})()}y(e8,"updatePackage");function e9(){return a(function(){var e,t,n,r,a,o,s,i,c,u,l,E,d;return p(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:y(function(){return e3.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:y(function(){return e3.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:y(function(){return e3.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);a=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(o=a.next()).done))return[3,8];s=o.value,i=s.command,c=s.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,tO("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();W(l);return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:E=f.sent();n=true;r=E;return[3,11];case 10:try{if(!t&&a.return!=null){a.return()}}finally{if(n){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();W(d);return[3,13];case 13:return[2]}})})()}y(e9,"installDependencies");function te(e,t){return a(function(){var n,r,a,o,s,i,c,u,l,d,f,m,S,D,O,v,C;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,15,,16]);if(!eu(e2.PACKAGE_JSON)){H.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(e7))];case 1:a=p.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),o=a.filter(function(e){return!e.isInstalled}),s=a.filter(function(e){return!e.isUpToDate}),i=[];(t===null||t===void 0?void 0:t.install)&&o.length>0&&(n=i).push.apply(n,E(o.map(e8))),(t===null||t===void 0?void 0:t.update)&&s.length>0&&(r=i).push.apply(r,E(s.map(e8)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:p.sent();return[4,e9()];case 3:p.sent();u=["Running ESLint with auto-fix"];return[4,e3.eslintFix()];case 4:return[4,tO.apply(void 0,u.concat([p.sent()]))];case 5:c=p.sent();p.label=6;case 6:c;d=true,f=false,m=undefined;p.label=7;case 7:p.trys.push([7,12,13,14]);S=((l=t===null||t===void 0?void 0:t.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();p.label=8;case 8:if(!!(d=(D=S.next()).done))return[3,11];O=D.value;return[4,O()];case 9:p.sent();p.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:v=p.sent();f=true;m=v;return[3,14];case 13:try{if(!d&&S.return!=null){S.return()}}finally{if(f){throw m}}return[7];case 14:return[3,16];case 15:C=p.sent();W(C);return[3,16];case 16:return[2]}})})()}y(te,"setupPackages");var tt=N(require("node-persist"),1);var tn=Y();function tr(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:e=tt.default.defaultInstance;if(e)return[3,2];return[4,tt.default.init({dir:tn.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}y(tr,"initNodePersist");var ta={get:function e(e){return a(function(){var t,n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,W(n,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,t){return a(function(){var n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,tr()];case 1:r.sent();return[4,tt.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();W(n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W(t);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,tr()];case 1:n.sent();return[4,tt.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(H.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,W(t,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return p(this,function(t){try{return[2,"".concat(tn.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,W(e,{returnValue:null})]}return[2]})})()}};var to=Y(),ts=R.promisify(g.exec);function ti(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,e7()];case 1:e=t.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}y(ti,"getPackageName");function tc(e){return a(function(){var t,n;return p(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,ti()];case 1:t=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,ta.set(t,e)];case 3:r.sent(),setTimeout(function(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,ta.getLogLink(t)];case 1:e=n.sent();e&&H.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:n=r.sent();W(n);return[3,5];case 5:return[2]}})})()}y(tc,"saveErrorListToStorage");function tu(){return a(function(){var e,t,n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ti()];case 1:e=r.sent();return[4,ta.get(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:[]];case 3:n=r.sent();return[2,W(n,{returnValue:[]})];case 4:return[2]}})})()}y(tu,"getStoredErrorLists");function tl(){return a(function(){var e,t;return p(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,ti()];case 1:e=n.sent();return[4,ta.remove(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();W(t);return[3,4];case 4:return[2]}})})()}y(tl,"clearAllErrorLists");function tE(e){var t=[],n=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=s.exec(e)||[];var m,S,D,O,v,C;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===V.Error?V.Error:V.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):f.length?t.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===V.Error?V.Error:V.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?t.push({file:"commitlint",type:V.Error,message:(v=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&v!==void 0?v:"",rule:(C=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&C!==void 0?C:""}):n.push(e.trim())}}),t.length&&tc(t),to.DEBUG&&n.length&&(H.warn("Unmatched lines:"),n.forEach(function(e){return H.info(" ".concat(e))}))}y(tE,"parseTextErrors");function td(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,a=e.line,o=e.column,s=e.ruleId,i=e.message;n.push({type:r===2?V.Error:V.Warning,file:t,position:"".concat(a,":").concat(o),rule:s,message:i})})}),n.length&&tc(n)}catch(t){tE(e)}}y(td,"parseCommandOutput");function tf(e){return a(function(e){var t,n,r,a,o,s,i,c,u;var l=arguments;return p(this,function(E){switch(E.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:td;n=new AbortController;_.default.on("SIGINT",function(){H.warn("Process interrupted. Terminating..."),n.abort(),_.default.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,ts(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&t(e)});E.label=3;case 3:return[3,5];case 4:s=E.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&t(e)}),!c&&!i&&H.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}y(tf,"executeCommand");function tp(e){return{raw:!0,cmd:e}}y(tp,"rawCommand");function tm(e,t){return(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eH," ").concat(eK," ").concat(eM," ").concat(e):"".concat(eH," ").concat(eP," ").concat(e)}y(tm,"formatCLI");function tS(e,t){return typeof e=="function"?tm(e(t),t):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?tm(e,t):e}y(tS,"formatCommand");function tD(e){return a(function(){var t,n,r;return p(this,function(a){switch(a.label){case 0:return[4,e7({name:eO})];case 1:t=a.sent();if(t.success){n={isCurrentProject:t.result.isCurrentProject},r=typeof e=="function"?e(n):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var t=l(e,2),r=t[0],a=t[1];return[r,tS(a,n)]}))]}return[2]}})})()}y(tD,"resolveCommands");function tO(e,t){return a(function(){var n;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);H.start("".concat(e)),to.DEBUG&&H.info("→ ".concat(t));return[4,tf(t)];case 1:r.sent(),H.success("".concat(e," done."));return[3,3];case 2:n=r.sent();W(n);return[3,3];case 3:return[2]}})})()}y(tO,"runCommand");0&&(module.exports={clearAllErrorLists:clearAllErrorLists,formatCommand:formatCommand,getStoredErrorLists:getStoredErrorLists,rawCommand:rawCommand,resolveCommands:resolveCommands,runCommand:runCommand});
@@ -1 +1 @@
1
- function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(e){if(Array.isArray(e))return e}function t(n){if(Array.isArray(n))return e(n)}function r(e,n,t,r,a,o,s){try{var i=e[o](s);var c=i.value}catch(e){t(e);return}if(i.done){n(c)}else{Promise.resolve(c).then(r,a)}}function a(e){return function(){var n=this,t=arguments;return new Promise(function(a,o){var s=e.apply(n,t);function i(e){r(s,a,o,i,c,"next",e)}function c(e){r(s,a,o,i,c,"throw",e)}i(undefined)})}}function o(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var a=true;var o=false;var s,i;try{for(t=t.call(e);!(a=(s=t.next()).done);a=true){r.push(s.value);if(n&&r.length===n)break}}catch(e){o=true;i=e}finally{try{if(!a&&t["return"]!=null)t["return"]()}finally{if(o)throw i}}return r}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t){return n(e)||i(e,t)||f(e,t)||c()}function E(e){return t(e)||s(e)||f(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(n,t)}function p(e,n){var t,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(o=0)),o)try{if(t=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=n.call(e,o)}catch(e){i=[6,e];r=0}finally{t=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.defineProperty;var S=function(e,n){return m(e,"name",{value:n,configurable:!0})};import{exec as D}from"child_process";import O from"process";import*as C from"util";var v=".cyberskill-storage";import y from"@dotenvx/dotenvx";import{bool as I,cleanEnv as h,str as N}from"envalid";import T from"os";import A from"path";import g from"process";var _=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var R=!1;function G(){g.env.NODE_ENV!==_.PRODUCTION&&!R&&(y.config(),R=!0)}S(G,"loadEnvFile");function P(){G();var e=h(g.env,{CWD:N({default:g.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:N({default:A.join(T.homedir(),v)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}S(P,"getEnv");var M=function(e){return e.Error="error",e.Warning="warning",e}({});import L from"chalk";import b from"consola";import{GraphQLError as U}from"graphql";var w={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var k=P();k.DEBUG||(b.level=4);function F(e){var n=L[e];return typeof n=="function"?n:L.green}S(F,"chalkKeyword");var Y={silent:b.silent,level:b.level,fatal:b.fatal,error:b.error,warn:b.warn,log:b.log,info:b.info,success:b.success,ready:b.ready,start:b.start,box:b.box,debug:b.debug,trace:b.trace,verbose:b.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){b.box(L.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,a=e.rule,o=e.message;b.log("".concat(L.gray("File:")," ").concat(L.blue("".concat(n).concat(r?":".concat(r):"")))),a&&b.log(" ".concat(F(t)("Rule:")," ").concat(a)),b.log(" ".concat(F(t)("Message:")," ").concat(o))}),b.box(F(t)("".concat(e," : ").concat(n.length))),b.log(L.gray("─".repeat(40)))}};function V(e,n){var t=n!==null&&n!==void 0?n:{},r=t.shouldLog,a=r===void 0?!0:r,s=t.returnValue,i=t.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&Y.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:w.INTERNAL_SERVER_ERROR.CODE}}S(V,"catchError");var x=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import j from"node-fetch";var K=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import Q from"fs-extra";import B from"path";var q=Q.lstatSync,H=Q.readdirSync,W=Q.mkdirSync,J=Q.readFileSync,$=Q.unlinkSync,X=Q.statSync,z=Q.readJsonSync;function Z(e,n,t){Q.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}S(Z,"writeFileSync");function ee(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return Q.pathExistsSync(e)})}S(ee,"pathExistsSync");import en from"fs-extra";import et from"path";var er=P(),ea=et;function eo(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=ea).resolve.apply(r,[er.CWD].concat(E(n)))}S(eo,"resolveWorkingPath");function es(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=ea).join.apply(r,E(n))}S(es,"join");var ei=P(),ec=ei.CWD,eu="@cyberskill/shared",el="node_modules",eE="dist",ed="package.json",ef="package-lock.json",ep="tsconfig.json",em=".gitignore",eS=".simple-git-hooks.json",eD="pnpm-lock.yaml",eO=".git/hooks/",eC=".git/COMMIT_EDITMSG",ev=".migrate-mongo.config.js",ey=function(){var e=en.readJsonSync(eo(ed)).name===eu?ec:es(ec,el,eu);return es(e,eE)}(),eI="cyberskill",eh="src/node/cli/index.ts",eN="eslint",eT="eslint",eA="vitest";var eg="vitest",e_="@commitlint/cli",eR="@commitlint/config-conventional",eG="commitlint",eP="lint-staged",eM="lint-staged",eL="typescript",eb="tsc",eU="tsx",ew="git",ek="pnpm",eF="pnpm exec",eY="simple-git-hooks",eV="simple-git-hooks",ex="@eslint/config-inspector",ej="eslint-config-inspector",eK="node-modules-inspector",eQ="node-modules-inspector",eB="migrate-mongo",eq="./node_modules/migrate-mongo/bin/migrate-mongo",eH={CYBERSKILL_DIRECTORY:ey,WORKING_DIRECTORY:ec,TS_CONFIG:eo(ep),GIT_IGNORE:eo(em),GIT_HOOK:eo(eO),GIT_COMMIT_MSG:eo(eC),SIMPLE_GIT_HOOKS_JSON:eo(eS),PACKAGE_JSON:eo(ed),PACKAGE_LOCK_JSON:eo(ef),PNPM_LOCK_YAML:eo(eD),NODE_MODULES:eo(el),MIGRATE_MONGO_CONFIG:eo(ev),LINT_STAGED_CONFIG:eo("".concat(ey,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eo("".concat(ey,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eo("".concat(ey,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eo("".concat(ey,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eo("".concat(ey,"/react/vitest/vitest.e2e.js"))};function eW(e){var n=e.type,t=e.packages,r=e.command;var o=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:switch(n){case K.CLI:return[3,1];case K.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,e1(o,{install:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,ni(no("".concat(eF," ").concat(r))))];case 4:return[2,ni(no(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}S(eW,"buildCommand");var eJ={simpleGitHooks:eW({type:K.CLI,packages:[{name:eY,type:x.DEV_DEPENDENCY}],command:eV}),eslintInspect:eW({type:K.CLI,packages:[{name:ex,type:x.DEV_DEPENDENCY}],command:ej}),nodeModulesInspect:eW({type:K.CLI,packages:[{name:eK,type:x.DEV_DEPENDENCY}],command:eQ}),eslintCheck:eW({type:K.CLI,packages:[{name:eN,type:x.DEV_DEPENDENCY}],command:"".concat(eT," ").concat(eH.WORKING_DIRECTORY," --no-cache")}),eslintFix:eW({type:K.CLI,packages:[{name:eN,type:x.DEV_DEPENDENCY}],command:"".concat(eT," ").concat(eH.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:eW({type:K.CLI,packages:[{name:eL,type:x.DEPENDENCY}],command:"".concat(eb," -p ").concat(eH.TS_CONFIG," --noEmit")}),testUnit:eW({type:K.CLI,packages:[{name:eA,type:x.DEV_DEPENDENCY}],command:"".concat(eg," --config ").concat(eH.UNIT_TEST_CONFIG)}),testE2e:eW({type:K.CLI,packages:[{name:eA,type:x.DEV_DEPENDENCY}],command:"".concat(eg," --config ").concat(eH.E2E_TEST_CONFIG)}),mongoMigrateCreate:S(function(e){return eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," create ").concat(e," -f ").concat(eH.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," up -f ").concat(eH.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," down -f ").concat(eH.MIGRATE_MONGO_CONFIG)}),commitLint:eW({type:K.CLI,packages:[{name:e_,type:x.DEV_DEPENDENCY},{name:eR,type:x.DEV_DEPENDENCY}],command:"".concat(eG," --edit ").concat(eH.GIT_COMMIT_MSG," --config ").concat(eH.COMMITLINT_CONFIG)}),lintStaged:eW({type:K.CLI,packages:[{name:eP,type:x.DEV_DEPENDENCY}],command:"".concat(eM," --config ").concat(eH.LINT_STAGED_CONFIG)}),configureGitHook:eW({type:K.STRING,command:"".concat(ew," config core.hooksPath ").concat(eH.GIT_HOOK)}),build:eW({type:K.STRING,command:"".concat(ek," run --if-present build")}),pnpmInstallStandard:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts")}),pnpmInstallLegacy:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts --force")}),pnpmPruneStore:eW({type:K.STRING,command:"".concat(ek," store prune")}),pnpmCleanCache:eW({type:K.STRING,command:"".concat(ek," cache delete")})};var e$=P();function eX(e){return a(function(){var n,t,r,a;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,j("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=o.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=o.sent(),r=t.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,V(a)];case 4:return[2]}})})()}S(eX,"getLatestPackageVersion");function ez(e){return a(function(){var n,t,r,a,o,s,i,c,u,l,E,d,f,m,S,D,O,C,v,y,I,h,N,T;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,2,,3]);if(!e){if(ee(eH.PACKAGE_JSON)){n=z(eH.PACKAGE_JSON),t=n.name,r=t===void 0?"":t,a=n.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:eH.PACKAGE_JSON,file:n}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!ee(eH.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=z(eH.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,l=s.dependencies,E=l===void 0?{}:l,d=s.devDependencies,f=d===void 0?{}:d;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:eH.PACKAGE_JSON,file:s}}];m=e.name in E,S=e.name in f;return[4,eX(e.name)];case 1:D=p.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(C=(O=E[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&C!==void 0?C:"",y=es(e$.CWD,el,e.name,ed);if(!ee(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];I=z(y),h=I.version,N=h===void 0?"":h;return[2,v!==N?{success:!0,result:{name:e.name,currentVersion:N||v,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:y,file:I}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===D.result,isDependency:m,isDevDependency:S,installedPath:y,file:I}}];case 2:T=p.sent();return[2,V(T)];case 3:return[2]}})})()}S(ez,"getPackage");function eZ(e){return a(function(){var n,t,r,a,o;return p(this,function(s){try{;r=z(eH.PACKAGE_JSON),a=(n=r.dependencies)!==null&&n!==void 0?n:{},o=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),Z(eH.PACKAGE_JSON,JSON.stringify(r,null,4)),Y.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){V(e)}return[2]})})()}S(eZ,"updatePackage");function e0(){return a(function(){var e,n,t,r,a,o,s,i,c,u,l,E,d;return p(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:S(function(){return eJ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:S(function(){return eJ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:S(function(){return eJ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);a=e[Symbol.iterator]();f.label=2;case 2:if(!!(n=(o=a.next()).done))return[3,8];s=o.value,i=s.command,c=s.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,nu("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();V(l);return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:E=f.sent();t=true;r=E;return[3,11];case 10:try{if(!n&&a.return!=null){a.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();V(d);return[3,13];case 13:return[2]}})})()}S(e0,"installDependencies");function e1(e,n){return a(function(){var t,r,a,o,s,i,c,u,l,d,f,m,S,D,O,C,v;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,15,,16]);if(!ee(eH.PACKAGE_JSON)){Y.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(ez))];case 1:a=p.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),o=a.filter(function(e){return!e.isInstalled}),s=a.filter(function(e){return!e.isUpToDate}),i=[];(n===null||n===void 0?void 0:n.install)&&o.length>0&&(t=i).push.apply(t,E(o.map(eZ))),(n===null||n===void 0?void 0:n.update)&&s.length>0&&(r=i).push.apply(r,E(s.map(eZ)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:p.sent();return[4,e0()];case 3:p.sent();u=["Running ESLint with auto-fix"];return[4,eJ.eslintFix()];case 4:return[4,nu.apply(void 0,u.concat([p.sent()]))];case 5:c=p.sent();p.label=6;case 6:c;d=true,f=false,m=undefined;p.label=7;case 7:p.trys.push([7,12,13,14]);S=((l=n===null||n===void 0?void 0:n.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();p.label=8;case 8:if(!!(d=(D=S.next()).done))return[3,11];O=D.value;return[4,O()];case 9:p.sent();p.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:C=p.sent();f=true;m=C;return[3,14];case 13:try{if(!d&&S.return!=null){S.return()}}finally{if(f){throw m}}return[7];case 14:return[3,16];case 15:v=p.sent();V(v);return[3,16];case 16:return[2]}})})()}S(e1,"setupPackages");import e2 from"node-persist";var e4=P();function e3(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:e=e2.defaultInstance;if(e)return[3,2];return[4,e2.init({dir:e4.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}S(e3,"initNodePersist");var e5={get:function e(e){return a(function(){var n,t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e3()];case 1:r.sent();return[4,e2.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,V(t,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,n){return a(function(){var t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e3()];case 1:r.sent();return[4,e2.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();V(t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e3()];case 1:t.sent();return[4,e2.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();V(n);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e3()];case 1:t.sent();return[4,e2.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(Y.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,V(n,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return p(this,function(n){try{return[2,"".concat(e4.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,V(e,{returnValue:null})]}return[2]})})()}};var e6=P(),e7=C.promisify(D);function e8(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,ez()];case 1:e=n.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}S(e8,"getPackageName");function e9(e){return a(function(){var n,t;return p(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,e8()];case 1:n=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,e5.set(n,e)];case 3:r.sent(),setTimeout(function(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,e5.getLogLink(n)];case 1:e=t.sent();e&&Y.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:t=r.sent();V(t);return[3,5];case 5:return[2]}})})()}S(e9,"saveErrorListToStorage");function ne(){return a(function(){var e,n,t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e8()];case 1:e=r.sent();return[4,e5.get(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:[]];case 3:t=r.sent();return[2,V(t,{returnValue:[]})];case 4:return[2]}})})()}S(ne,"getStoredErrorLists");function nn(){return a(function(){var e,n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e8()];case 1:e=t.sent();return[4,e5.remove(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();V(n);return[3,4];case 4:return[2]}})})()}S(nn,"clearAllErrorLists");function nt(e){var n=[],t=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=s.exec(e)||[];var m,S,D,O,C,v;d.length&&r?n.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===M.Error?M.Error:M.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):f.length?n.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===M.Error?M.Error:M.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?n.push({file:"commitlint",type:M.Error,message:(C=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&C!==void 0?C:"",rule:(v=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&v!==void 0?v:""}):t.push(e.trim())}}),n.length&&e9(n),e6.DEBUG&&t.length&&(Y.warn("Unmatched lines:"),t.forEach(function(e){return Y.info(" ".concat(e))}))}S(nt,"parseTextErrors");function nr(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,a=e.line,o=e.column,s=e.ruleId,i=e.message;t.push({type:r===2?M.Error:M.Warning,file:n,position:"".concat(a,":").concat(o),rule:s,message:i})})}),t.length&&e9(t)}catch(n){nt(e)}}S(nr,"parseCommandOutput");function na(e){return a(function(e){var n,t,r,a,o,s,i,c,u;var l=arguments;return p(this,function(E){switch(E.label){case 0:n=l.length>1&&l[1]!==void 0?l[1]:nr;t=new AbortController;O.on("SIGINT",function(){Y.warn("Process interrupted. Terminating..."),t.abort(),O.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,e7(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&n(e)});E.label=3;case 3:return[3,5];case 4:s=E.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&n(e)}),!c&&!i&&Y.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}S(na,"executeCommand");function no(e){return{raw:!0,cmd:e}}S(no,"rawCommand");function ns(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(eF," ").concat(eU," ").concat(eh," ").concat(e):"".concat(eF," ").concat(eI," ").concat(e)}S(ns,"formatCLI");function ni(e,n){return typeof e=="function"?ns(e(n),n):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ns(e,n):e}S(ni,"formatCommand");function nc(e){return a(function(){var n,t,r;return p(this,function(a){switch(a.label){case 0:return[4,ez({name:eu})];case 1:n=a.sent();if(n.success){t={isCurrentProject:n.result.isCurrentProject},r=typeof e=="function"?e(t):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var n=l(e,2),r=n[0],a=n[1];return[r,ni(a,t)]}))]}return[2]}})})()}S(nc,"resolveCommands");function nu(e,n){return a(function(){var t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);Y.start("".concat(e)),e6.DEBUG&&Y.info("→ ".concat(n));return[4,na(n)];case 1:r.sent(),Y.success("".concat(e," done."));return[3,3];case 2:t=r.sent();V(t);return[3,3];case 3:return[2]}})})()}S(nu,"runCommand");export{nn as clearAllErrorLists,ni as formatCommand,ne as getStoredErrorLists,no as rawCommand,nc as resolveCommands,nu as runCommand};
1
+ function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function n(e){if(Array.isArray(e))return e}function t(n){if(Array.isArray(n))return e(n)}function r(e,n,t,r,a,o,s){try{var i=e[o](s);var c=i.value}catch(e){t(e);return}if(i.done){n(c)}else{Promise.resolve(c).then(r,a)}}function a(e){return function(){var n=this,t=arguments;return new Promise(function(a,o){var s=e.apply(n,t);function i(e){r(s,a,o,i,c,"next",e)}function c(e){r(s,a,o,i,c,"throw",e)}i(undefined)})}}function o(e,n){if(n!=null&&typeof Symbol!=="undefined"&&n[Symbol.hasInstance]){return!!n[Symbol.hasInstance](e)}else{return e instanceof n}}function s(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function i(e,n){var t=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(t==null)return;var r=[];var a=true;var o=false;var s,i;try{for(t=t.call(e);!(a=(s=t.next()).done);a=true){r.push(s.value);if(n&&r.length===n)break}}catch(e){o=true;i=e}finally{try{if(!a&&t["return"]!=null)t["return"]()}finally{if(o)throw i}}return r}function c(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e,t){return n(e)||i(e,t)||f(e,t)||c()}function E(e){return t(e)||s(e)||f(e)||u()}function d(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function f(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);if(r==="Object"&&n.constructor)r=n.constructor.name;if(r==="Map"||r==="Set")return Array.from(r);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return e(n,t)}function p(e,n){var t,r,a,o={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},s=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return s.next=i(0),s["throw"]=i(1),s["return"]=i(2),typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(n){return c([e,n])}}function c(i){if(t)throw new TypeError("Generator is already executing.");while(s&&(s=0,i[0]&&(o=0)),o)try{if(t=1,r&&(a=i[0]&2?r["return"]:i[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,i[1])).done)return a;if(r=0,a)i=[i[0]&2,a.value];switch(i[0]){case 0:case 1:a=i;break;case 4:o.label++;return{value:i[1],done:false};case 5:o.label++;r=i[1];i=[0];continue;case 7:i=o.ops.pop();o.trys.pop();continue;default:if(!(a=o.trys,a=a.length>0&&a[a.length-1])&&(i[0]===6||i[0]===2)){o=0;continue}if(i[0]===3&&(!a||i[1]>a[0]&&i[1]<a[3])){o.label=i[1];break}if(i[0]===6&&o.label<a[1]){o.label=a[1];a=i;break}if(a&&o.label<a[2]){o.label=a[2];o.ops.push(i);break}if(a[2])o.ops.pop();o.trys.pop();continue}i=n.call(e,o)}catch(e){i=[6,e];r=0}finally{t=a=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}var m=Object.defineProperty;var S=function(e,n){return m(e,"name",{value:n,configurable:!0})};import{exec as D}from"child_process";import O from"process";import*as C from"util";var v=".cyberskill-storage";import y from"@dotenvx/dotenvx";import{bool as I,cleanEnv as h,str as N}from"envalid";import T from"os";import A from"path";import g from"process";var _=function(e){return e.PRODUCTION="production",e.STAGING="staging",e.DEVELOPMENT="development",e}({});var R=!1;function G(){g.env.NODE_ENV!==_.PRODUCTION&&!R&&(y.config(),R=!0)}S(G,"loadEnvFile");function P(){G();var e=h(g.env,{CWD:N({default:g.cwd()}),DEBUG:I({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:N({default:A.join(T.homedir(),v)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}S(P,"getEnv");var M=function(e){return e.Error="error",e.Warning="warning",e}({});import L from"chalk";import b from"consola";import{GraphQLError as U}from"graphql";var w={GRAPHQL_PARSE_FAILED:{CODE:"GRAPHQL_PARSE_FAILED",MESSAGE:"The GraphQL operation string contains a syntax error."},GRAPHQL_VALIDATION_FAILED:{CODE:"GRAPHQL_VALIDATION_FAILED",MESSAGE:"The GraphQL operation is not valid against the server's schema."},BAD_USER_INPUT:{CODE:"BAD_USER_INPUT",MESSAGE:"The GraphQL operation includes an invalid value for a field argument."},PERSISTED_QUERY_NOT_FOUND:{CODE:"PERSISTED_QUERY_NOT_FOUND",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ cache."},PERSISTED_QUERY_NOT_SUPPORTED:{CODE:"PERSISTED_QUERY_NOT_SUPPORTED",MESSAGE:"A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ."},OPERATION_RESOLUTION_FAILURE:{CODE:"OPERATION_RESOLUTION_FAILURE",MESSAGE:"The request was parsed successfully and is valid against the server's schema, but the server couldn't resolve which operation to run. This occurs when a request containing multiple named operations doesn't specify which operation to run (i.e.,operationName), or if the named operation isn't included in the request."},CONTINUE:{CODE:100,MESSAGE:"Continue"},SWITCHING_PROTOCOLS:{CODE:101,MESSAGE:"Switching Protocols"},PROCESSING:{CODE:102,MESSAGE:"Processing"},OK:{CODE:200,MESSAGE:"OK"},CREATED:{CODE:201,MESSAGE:"Created"},ACCEPTED:{CODE:202,MESSAGE:"Accepted"},NON_AUTHORITATIVE_INFORMATION:{CODE:203,MESSAGE:"Non Authoritative Information"},NO_CONTENT:{CODE:204,MESSAGE:"No Content"},RESET_CONTENT:{CODE:205,MESSAGE:"Reset Content"},PARTIAL_CONTENT:{CODE:206,MESSAGE:"Partial Content"},MULTI_STATUS:{CODE:207,MESSAGE:"Multi-Status"},MULTIPLE_CHOICES:{CODE:300,MESSAGE:"Multiple Choices"},MOVED_PERMANENTLY:{CODE:301,MESSAGE:"Moved Permanently"},MOVED_TEMPORARILY:{CODE:302,MESSAGE:"Moved Temporarily"},SEE_OTHER:{CODE:303,MESSAGE:"See Other"},NOT_MODIFIED:{CODE:304,MESSAGE:"Not Modified"},USE_PROXY:{CODE:305,MESSAGE:"Use Proxy"},TEMPORARY_REDIRECT:{CODE:307,MESSAGE:"Temporary Redirect"},PERMANENT_REDIRECT:{CODE:308,MESSAGE:"Permanent Redirect"},BAD_REQUEST:{CODE:400,MESSAGE:"Bad Request"},UNAUTHORIZED:{CODE:401,MESSAGE:"Unauthorized"},PAYMENT_REQUIRED:{CODE:402,MESSAGE:"Payment Required"},FORBIDDEN:{CODE:403,MESSAGE:"Forbidden"},NOT_FOUND:{CODE:404,MESSAGE:"Not Found"},METHOD_NOT_ALLOWED:{CODE:405,MESSAGE:"Method Not Allowed"},NOT_ACCEPTABLE:{CODE:406,MESSAGE:"Not Acceptable"},PROXY_AUTHENTICATION_REQUIRED:{CODE:407,MESSAGE:"Proxy Authentication Required"},REQUEST_TIMEOUT:{CODE:408,MESSAGE:"Request Timeout"},CONFLICT:{CODE:409,MESSAGE:"Conflict"},GONE:{CODE:410,MESSAGE:"Gone"},LENGTH_REQUIRED:{CODE:411,MESSAGE:"Length Required"},PRECONDITION_FAILED:{CODE:412,MESSAGE:"Precondition Failed"},REQUEST_TOO_LONG:{CODE:413,MESSAGE:"Request Entity Too Large"},REQUEST_URI_TOO_LONG:{CODE:414,MESSAGE:"Request-URI Too Long"},UNSUPPORTED_MEDIA_TYPE:{CODE:415,MESSAGE:"Unsupported Media Type"},REQUESTED_RANGE_NOT_SATISFIABLE:{CODE:416,MESSAGE:"Requested Range Not Satisfiable"},EXPECTATION_FAILED:{CODE:417,MESSAGE:"Expectation Failed"},IM_A_TEAPOT:{CODE:418,MESSAGE:"I'm a teapot"},INSUFFICIENT_SPACE_ON_RESOURCE:{CODE:419,MESSAGE:"Insufficient Space on Resource"},METHOD_FAILURE:{CODE:420,MESSAGE:"Method Failure"},MISDIRECTED_REQUEST:{CODE:421,MESSAGE:"Misdirected Request"},UNPROCESSABLE_ENTITY:{CODE:422,MESSAGE:"Unprocessable Entity"},LOCKED:{CODE:423,MESSAGE:"Locked"},FAILED_DEPENDENCY:{CODE:424,MESSAGE:"Failed Dependency"},PRECONDITION_REQUIRED:{CODE:428,MESSAGE:"Precondition Required"},TOO_MANY_REQUESTS:{CODE:429,MESSAGE:"Too Many Requests"},REQUEST_HEADER_FIELDS_TOO_LARGE:{CODE:431,MESSAGE:"Request Header Fields Too Large"},UNAVAILABLE_FOR_LEGAL_REASONS:{CODE:451,MESSAGE:"Unavailable For Legal Reasons"},INTERNAL_SERVER_ERROR:{CODE:500,MESSAGE:"Internal Server Error"},NOT_IMPLEMENTED:{CODE:501,MESSAGE:"Not Implemented"},BAD_GATEWAY:{CODE:502,MESSAGE:"Bad Gateway"},SERVICE_UNAVAILABLE:{CODE:503,MESSAGE:"Service Unavailable"},GATEWAY_TIMEOUT:{CODE:504,MESSAGE:"Gateway Timeout"},HTTP_VERSION_NOT_SUPPORTED:{CODE:505,MESSAGE:"HTTP Version Not Supported"},INSUFFICIENT_STORAGE:{CODE:507,MESSAGE:"Insufficient Storage"},NETWORK_AUTHENTICATION_REQUIRED:{CODE:511,MESSAGE:"Network Authentication Required"}};var k=P();k.DEBUG||(b.level=4);function F(e){var n=L[e];return typeof n=="function"?n:L.green}S(F,"chalkKeyword");var Y={silent:b.silent,level:b.level,fatal:b.fatal,error:b.error,warn:b.warn,log:b.log,info:b.info,success:b.success,ready:b.ready,start:b.start,box:b.box,debug:b.debug,trace:b.trace,verbose:b.verbose,printBoxedLog:function e(e,n){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(n===null||n===void 0?void 0:n.length)){b.box(L.green(e));return}n.forEach(function(e){var n=e.file,r=e.position,a=e.rule,o=e.message;b.log("".concat(L.gray("File:")," ").concat(L.blue("".concat(n).concat(r?":".concat(r):"")))),a&&b.log(" ".concat(F(t)("Rule:")," ").concat(a)),b.log(" ".concat(F(t)("Message:")," ").concat(o))}),b.box(F(t)("".concat(e," : ").concat(n.length))),b.log(L.gray("─".repeat(40)))}};function V(e,n){var t=n!==null&&n!==void 0?n:{},r=t.shouldLog,a=r===void 0?!0:r,s=t.returnValue,i=t.callback,c=o(e,Error)?e:new Error(typeof e=="string"?e:"Unknown error");return a&&Y.error(c.message),i&&typeof i=="function"&&i(c),s||{success:!1,message:c.message,code:w.INTERNAL_SERVER_ERROR.CODE}}S(V,"catchError");var x=function(e){return e.DEPENDENCY="dependencies",e.DEV_DEPENDENCY="devDependencies",e.PEER_DEPENDENCY="peerDependencies",e.BUNDLE_DEPENDENCY="bundleDependencies",e.OPTIONAL_DEPENDENCY="optionalDependencies",e}({});import j from"node-fetch";var K=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import Q from"fs-extra";import B from"path";var q=Q.lstatSync,H=Q.readdirSync,W=Q.mkdirSync,J=Q.readFileSync,$=Q.unlinkSync,X=Q.statSync,z=Q.readJsonSync;function Z(e,n,t){Q.writeFileSync(e,n,t!==null&&t!==void 0?t:"utf-8")}S(Z,"writeFileSync");function ee(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}return n.every(function(e){return Q.pathExistsSync(e)})}S(ee,"pathExistsSync");import en from"fs-extra";import et from"path";var er=P(),ea=et;function eo(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=ea).resolve.apply(r,[er.CWD].concat(E(n)))}S(eo,"resolveWorkingPath");function es(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++){n[t]=arguments[t]}var r;return(r=ea).join.apply(r,E(n))}S(es,"join");var ei=P(),ec=ei.CWD,eu="@cyberskill/shared",el="node_modules",eE="dist",ed="package.json",ef="package-lock.json",ep="tsconfig.json",em=".gitignore",eS=".simple-git-hooks.json",eD="pnpm-lock.yaml",eO=".git/hooks/",eC=".git/COMMIT_EDITMSG",ev=".migrate-mongo.config.js",ey=function(){var e=en.readJsonSync(eo(ed)).name===eu?ec:es(ec,el,eu);return es(e,eE)}(),eI="cyberskill",eh="src/node/cli/index.ts",eN="eslint",eT="eslint",eA="vitest";var eg="vitest",e_="@commitlint/cli",eR="@commitlint/config-conventional",eG="commitlint",eP="lint-staged",eM="lint-staged",eL="typescript",eb="tsc",eU="tsx",ew="git",ek="pnpm",eF="pnpm exec",eY="simple-git-hooks",eV="simple-git-hooks",ex="@eslint/config-inspector",ej="eslint-config-inspector",eK="node-modules-inspector",eQ="node-modules-inspector",eB="migrate-mongo",eq="./node_modules/migrate-mongo/bin/migrate-mongo",eH={CYBERSKILL_DIRECTORY:ey,WORKING_DIRECTORY:ec,TS_CONFIG:eo(ep),GIT_IGNORE:eo(em),GIT_HOOK:eo(eO),GIT_COMMIT_MSG:eo(eC),SIMPLE_GIT_HOOKS_JSON:eo(eS),PACKAGE_JSON:eo(ed),PACKAGE_LOCK_JSON:eo(ef),PNPM_LOCK_YAML:eo(eD),NODE_MODULES:eo(el),MIGRATE_MONGO_CONFIG:eo(ev),LINT_STAGED_CONFIG:eo("".concat(ey,"/config/lint-staged/index.js")),COMMITLINT_CONFIG:eo("".concat(ey,"/config/commitlint/index.js")),UNIT_TEST_CONFIG:eo("".concat(ey,"/config/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eo("".concat(ey,"/config/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eo("".concat(ey,"/config/vitest/vitest.e2e.js"))};function eW(e){var n=e.type,t=e.packages,r=e.command;var o=t===null||t===void 0?void 0:t.reduce(function(e,n){return e.some(function(e){return e.name===n.name})||e.push(n),e},[]);return function(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:switch(n){case K.CLI:return[3,1];case K.STRING:return[3,4]}return[3,5];case 1:e=o===null||o===void 0?void 0:o.length;if(!e)return[3,3];return[4,e1(o,{install:!0})];case 2:e=t.sent();t.label=3;case 3:return[2,(e,ni(no("".concat(eF," ").concat(r))))];case 4:return[2,ni(no(r))];case 5:throw new Error("Unsupported command type");case 6:return[2]}})})()}}S(eW,"buildCommand");var eJ={simpleGitHooks:eW({type:K.CLI,packages:[{name:eY,type:x.DEV_DEPENDENCY}],command:eV}),eslintInspect:eW({type:K.CLI,packages:[{name:ex,type:x.DEV_DEPENDENCY}],command:ej}),nodeModulesInspect:eW({type:K.CLI,packages:[{name:eK,type:x.DEV_DEPENDENCY}],command:eQ}),eslintCheck:eW({type:K.CLI,packages:[{name:eN,type:x.DEV_DEPENDENCY}],command:"".concat(eT," ").concat(eH.WORKING_DIRECTORY," --no-cache")}),eslintFix:eW({type:K.CLI,packages:[{name:eN,type:x.DEV_DEPENDENCY}],command:"".concat(eT," ").concat(eH.WORKING_DIRECTORY," --fix --no-cache")}),typescriptCheck:eW({type:K.CLI,packages:[{name:eL,type:x.DEPENDENCY}],command:"".concat(eb," -p ").concat(eH.TS_CONFIG," --noEmit")}),testUnit:eW({type:K.CLI,packages:[{name:eA,type:x.DEV_DEPENDENCY}],command:"".concat(eg," --config ").concat(eH.UNIT_TEST_CONFIG)}),testE2e:eW({type:K.CLI,packages:[{name:eA,type:x.DEV_DEPENDENCY}],command:"".concat(eg," --config ").concat(eH.E2E_TEST_CONFIG)}),mongoMigrateCreate:S(function(e){return eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," create ").concat(e," -f ").concat(eH.MIGRATE_MONGO_CONFIG)})()},"mongoMigrateCreate"),mongoMigrateUp:eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," up -f ").concat(eH.MIGRATE_MONGO_CONFIG)}),mongoMigrateDown:eW({type:K.CLI,packages:[{name:eB,type:x.DEPENDENCY}],command:"".concat(eU," ").concat(eq," down -f ").concat(eH.MIGRATE_MONGO_CONFIG)}),commitLint:eW({type:K.CLI,packages:[{name:e_,type:x.DEV_DEPENDENCY},{name:eR,type:x.DEV_DEPENDENCY}],command:"".concat(eG," --edit ").concat(eH.GIT_COMMIT_MSG," --config ").concat(eH.COMMITLINT_CONFIG)}),lintStaged:eW({type:K.CLI,packages:[{name:eP,type:x.DEV_DEPENDENCY}],command:"".concat(eM," --config ").concat(eH.LINT_STAGED_CONFIG)}),configureGitHook:eW({type:K.STRING,command:"".concat(ew," config core.hooksPath ").concat(eH.GIT_HOOK)}),build:eW({type:K.STRING,command:"".concat(ek," run --if-present build")}),pnpmInstallStandard:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts")}),pnpmInstallLegacy:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts --legacy-peer-deps")}),pnpmInstallForce:eW({type:K.STRING,command:"".concat(ek," install --ignore-scripts --force")}),pnpmPruneStore:eW({type:K.STRING,command:"".concat(ek," store prune")}),pnpmCleanCache:eW({type:K.STRING,command:"".concat(ek," cache delete")})};var e$=P();function eX(e){return a(function(){var n,t,r,a;return p(this,function(o){switch(o.label){case 0:o.trys.push([0,3,,4]);return[4,j("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:n=o.sent();if(!n.ok)throw new Error("Failed to fetch latest version: ".concat(n.status," ").concat(n.statusText));return[4,n.json()];case 2:t=o.sent(),r=t.version;return[2,{success:!0,result:r}];case 3:a=o.sent();return[2,V(a)];case 4:return[2]}})})()}S(eX,"getLatestPackageVersion");function ez(e){return a(function(){var n,t,r,a,o,s,i,c,u,l,E,d,f,m,S,D,O,C,v,y,I,h,N,T;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,2,,3]);if(!e){if(ee(eH.PACKAGE_JSON)){n=z(eH.PACKAGE_JSON),t=n.name,r=t===void 0?"":t,a=n.version,o=a===void 0?"":a;return[2,{success:!0,result:{name:r,currentVersion:o,latestVersion:o,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:!1,isDevDependency:!1,installedPath:eH.PACKAGE_JSON,file:n}}]}return[2,{success:!0,result:{name:"",currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:!1,isDevDependency:!1,installedPath:"",file:{}}}]}if(!ee(eH.PACKAGE_JSON))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}}];s=z(eH.PACKAGE_JSON),i=s.name,c=s.version,u=c===void 0?"":c,l=s.dependencies,E=l===void 0?{}:l,d=s.devDependencies,f=d===void 0?{}:d;if(e.name===i)return[2,{success:!0,result:{name:i,currentVersion:u,latestVersion:u,isCurrentProject:!0,isInstalled:!0,isUpToDate:!0,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:eH.PACKAGE_JSON,file:s}}];m=e.name in E,S=e.name in f;return[4,eX(e.name)];case 1:D=p.sent();if(!D.success)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:"",isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];if(!m&&!S)return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:e.type===x.DEPENDENCY,isDevDependency:e.type===x.DEV_DEPENDENCY,installedPath:"",file:{}}}];v=(C=(O=E[e.name])!==null&&O!==void 0?O:f[e.name])!==null&&C!==void 0?C:"",y=es(e$.CWD,el,e.name,ed);if(!ee(y))return[2,{success:!0,result:{name:e.name,currentVersion:"",latestVersion:D.result,isCurrentProject:!1,isInstalled:!1,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:"",file:{}}}];I=z(y),h=I.version,N=h===void 0?"":h;return[2,v!==N?{success:!0,result:{name:e.name,currentVersion:N||v,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:!1,isDependency:m,isDevDependency:S,installedPath:y,file:I}}:{success:!0,result:{name:e.name,currentVersion:v,latestVersion:D.result,isCurrentProject:!1,isInstalled:!0,isUpToDate:v===D.result,isDependency:m,isDevDependency:S,installedPath:y,file:I}}];case 2:T=p.sent();return[2,V(T)];case 3:return[2]}})})()}S(ez,"getPackage");function eZ(e){return a(function(){var n,t,r,a,o;return p(this,function(s){try{;r=z(eH.PACKAGE_JSON),a=(n=r.dependencies)!==null&&n!==void 0?n:{},o=(t=r.devDependencies)!==null&&t!==void 0?t:{};e.isDependency?a[e.name]=e.latestVersion:e.isDevDependency&&(o[e.name]=e.latestVersion),Z(eH.PACKAGE_JSON,JSON.stringify(r,null,4)),Y.info('Updated "'.concat(e.name,'" to version ').concat(e.latestVersion))}catch(e){V(e)}return[2]})})()}S(eZ,"updatePackage");function e0(){return a(function(){var e,n,t,r,a,o,s,i,c,u,l,E,d;return p(this,function(f){switch(f.label){case 0:f.trys.push([0,12,,13]);e=[{command:S(function(){return eJ.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:S(function(){return eJ.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:S(function(){return eJ.pnpmInstallForce()},"command"),message:"Retrying with force install"}];n=true,t=false,r=undefined;f.label=1;case 1:f.trys.push([1,9,10,11]);a=e[Symbol.iterator]();f.label=2;case 2:if(!!(n=(o=a.next()).done))return[3,8];s=o.value,i=s.command,c=s.message;f.label=3;case 3:f.trys.push([3,6,,7]);return[4,i()];case 4:u=f.sent();return[4,nu("".concat(c," using: ").concat(u),u)];case 5:f.sent();return[2];case 6:l=f.sent();V(l);return[3,7];case 7:n=true;return[3,2];case 8:return[3,11];case 9:E=f.sent();t=true;r=E;return[3,11];case 10:try{if(!n&&a.return!=null){a.return()}}finally{if(t){throw r}}return[7];case 11:return[3,13];case 12:d=f.sent();V(d);return[3,13];case 13:return[2]}})})()}S(e0,"installDependencies");function e1(e,n){return a(function(){var t,r,a,o,s,i,c,u,l,d,f,m,S,D,O,C,v;return p(this,function(p){switch(p.label){case 0:p.trys.push([0,15,,16]);if(!ee(eH.PACKAGE_JSON)){Y.error("package.json not found. Aborting setup.");return[2]}return[4,Promise.all(e.map(ez))];case 1:a=p.sent().filter(function(e){return e.success&&!!e.result&&!e.result.isCurrentProject}).map(function(e){return e.result}),o=a.filter(function(e){return!e.isInstalled}),s=a.filter(function(e){return!e.isUpToDate}),i=[];(n===null||n===void 0?void 0:n.install)&&o.length>0&&(t=i).push.apply(t,E(o.map(eZ))),(n===null||n===void 0?void 0:n.update)&&s.length>0&&(r=i).push.apply(r,E(s.map(eZ)));c=i.length>0;if(!c)return[3,6];return[4,Promise.all(i)];case 2:p.sent();return[4,e0()];case 3:p.sent();u=["Running ESLint with auto-fix"];return[4,eJ.eslintFix()];case 4:return[4,nu.apply(void 0,u.concat([p.sent()]))];case 5:c=p.sent();p.label=6;case 6:c;d=true,f=false,m=undefined;p.label=7;case 7:p.trys.push([7,12,13,14]);S=((l=n===null||n===void 0?void 0:n.callbacks)!==null&&l!==void 0?l:[])[Symbol.iterator]();p.label=8;case 8:if(!!(d=(D=S.next()).done))return[3,11];O=D.value;return[4,O()];case 9:p.sent();p.label=10;case 10:d=true;return[3,8];case 11:return[3,14];case 12:C=p.sent();f=true;m=C;return[3,14];case 13:try{if(!d&&S.return!=null){S.return()}}finally{if(f){throw m}}return[7];case 14:return[3,16];case 15:v=p.sent();V(v);return[3,16];case 16:return[2]}})})()}S(e1,"setupPackages");import e2 from"node-persist";var e4=P();function e3(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:e=e2.defaultInstance;if(e)return[3,2];return[4,e2.init({dir:e4.CYBERSKILL_STORAGE_DIRECTORY})];case 1:e=n.sent();n.label=2;case 2:e;return[2]}})})()}S(e3,"initNodePersist");var e5={get:function e(e){return a(function(){var n,t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e3()];case 1:r.sent();return[4,e2.getItem(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:null];case 3:t=r.sent();return[2,V(t,{returnValue:null})];case 4:return[2]}})})()},set:function e(e,n){return a(function(){var t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e3()];case 1:r.sent();return[4,e2.setItem(e,n)];case 2:r.sent();return[3,4];case 3:t=r.sent();V(t);return[3,4];case 4:return[2]}})})()},remove:function e(e){return a(function(){var n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e3()];case 1:t.sent();return[4,e2.removeItem(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();V(n);return[3,4];case 4:return[2]}})})()},keys:function e(){return a(function(){var e,n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e3()];case 1:t.sent();return[4,e2.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(Y.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:n=t.sent();return[2,V(n,{returnValue:[]})];case 4:return[2]}})})()},getLogLink:function e(e){return a(function(){return p(this,function(n){try{return[2,"".concat(e4.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,V(e,{returnValue:null})]}return[2]})})()}};var e6=P(),e7=C.promisify(D);function e8(){return a(function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,ez()];case 1:e=n.sent();return[2,e.success?e.result.name:Date.now().toString()]}})})()}S(e8,"getPackageName");function e9(e){return a(function(){var n,t;return p(this,function(r){switch(r.label){case 0:if(e.length===0)return[2];return[4,e8()];case 1:n=r.sent();r.label=2;case 2:r.trys.push([2,4,,5]);return[4,e5.set(n,e)];case 3:r.sent(),setTimeout(function(){return a(function(){var e;return p(this,function(t){switch(t.label){case 0:return[4,e5.getLogLink(n)];case 1:e=t.sent();e&&Y.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},0);return[3,5];case 4:t=r.sent();V(t);return[3,5];case 5:return[2]}})})()}S(e9,"saveErrorListToStorage");function ne(){return a(function(){var e,n,t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,e8()];case 1:e=r.sent();return[4,e5.get(e)];case 2:return[2,(n=r.sent())!==null&&n!==void 0?n:[]];case 3:t=r.sent();return[2,V(t,{returnValue:[]})];case 4:return[2]}})})()}S(ne,"getStoredErrorLists");function nn(){return a(function(){var e,n;return p(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,e8()];case 1:e=t.sent();return[4,e5.remove(e)];case 2:t.sent();return[3,4];case 3:n=t.sent();V(n);return[3,4];case 4:return[2]}})})()}S(nn,"clearAllErrorLists");function nt(e){var n=[],t=[],r="",a=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,o=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,s=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var i,c,u,l,E;var d=a.exec(e)||[],f=o.exec(e)||[],p=s.exec(e)||[];var m,S,D,O,C,v;d.length&&r?n.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===M.Error?M.Error:M.Warning,message:(m=d===null||d===void 0?void 0:(i=d[4])===null||i===void 0?void 0:i.trim())!==null&&m!==void 0?m:"",rule:(S=d===null||d===void 0?void 0:(c=d[5])===null||c===void 0?void 0:c.trim())!==null&&S!==void 0?S:""}):f.length?n.push({file:(D=f===null||f===void 0?void 0:f[1])!==null&&D!==void 0?D:"",position:"".concat(f[2],":").concat(f[3]),type:f[4]===M.Error?M.Error:M.Warning,message:(O=f===null||f===void 0?void 0:(u=f[5])===null||u===void 0?void 0:u.trim())!==null&&O!==void 0?O:""}):p.length?n.push({file:"commitlint",type:M.Error,message:(C=p===null||p===void 0?void 0:(l=p[1])===null||l===void 0?void 0:l.trim())!==null&&C!==void 0?C:"",rule:(v=p===null||p===void 0?void 0:(E=p[2])===null||E===void 0?void 0:E.trim())!==null&&v!==void 0?v:""}):t.push(e.trim())}}),n.length&&e9(n),e6.DEBUG&&t.length&&(Y.warn("Unmatched lines:"),t.forEach(function(e){return Y.info(" ".concat(e))}))}S(nt,"parseTextErrors");function nr(e){try{var n=JSON.parse(e),t=[];n.forEach(function(e){var n=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,a=e.line,o=e.column,s=e.ruleId,i=e.message;t.push({type:r===2?M.Error:M.Warning,file:n,position:"".concat(a,":").concat(o),rule:s,message:i})})}),t.length&&e9(t)}catch(n){nt(e)}}S(nr,"parseCommandOutput");function na(e){return a(function(e){var n,t,r,a,o,s,i,c,u;var l=arguments;return p(this,function(E){switch(E.label){case 0:n=l.length>1&&l[1]!==void 0?l[1]:nr;t=new AbortController;O.on("SIGINT",function(){Y.warn("Process interrupted. Terminating..."),t.abort(),O.exit()});E.label=1;case 1:E.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,e7(e,{maxBuffer:0x6400000,signal:t.signal})];case 2:r=E.sent(),a=r.stdout,o=r.stderr;[a,o].forEach(function(e){return e&&n(e)});E.label=3;case 3:return[3,5];case 4:s=E.sent();i=s.stdout,c=s.stderr,u=s.message;[i,c].forEach(function(e){return e&&n(e)}),!c&&!i&&Y.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}S(na,"executeCommand");function no(e){return{raw:!0,cmd:e}}S(no,"rawCommand");function ns(e,n){return(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(eF," ").concat(eU," ").concat(eh," ").concat(e):"".concat(eF," ").concat(eI," ").concat(e)}S(ns,"formatCLI");function ni(e,n){return typeof e=="function"?ns(e(n),n):(typeof e==="undefined"?"undefined":d(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?ns(e,n):e}S(ni,"formatCommand");function nc(e){return a(function(){var n,t,r;return p(this,function(a){switch(a.label){case 0:return[4,ez({name:eu})];case 1:n=a.sent();if(n.success){t={isCurrentProject:n.result.isCurrentProject},r=typeof e=="function"?e(t):e;return[2,Object.fromEntries(Object.entries(r).map(function(e){var n=l(e,2),r=n[0],a=n[1];return[r,ni(a,t)]}))]}return[2]}})})()}S(nc,"resolveCommands");function nu(e,n){return a(function(){var t;return p(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);Y.start("".concat(e)),e6.DEBUG&&Y.info("→ ".concat(n));return[4,na(n)];case 1:r.sent(),Y.success("".concat(e," done."));return[3,3];case 2:t=r.sent();V(t);return[3,3];case 3:return[2]}})})()}S(nu,"runCommand");export{nn as clearAllErrorLists,ni as formatCommand,ne as getStoredErrorLists,no as rawCommand,nc as resolveCommands,nu as runCommand};