@cyberskill/shared 1.119.0 → 1.121.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 (55) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +3 -8
  2. package/dist/_tsup-dts-rollup.d.ts +3 -8
  3. package/dist/configs/config.util.cjs +1 -1
  4. package/dist/configs/config.util.js +1 -1
  5. package/dist/configs/eslint/index.cjs +1 -1
  6. package/dist/configs/eslint/index.js +1 -1
  7. package/dist/configs/index.cjs +1 -1
  8. package/dist/configs/index.js +1 -1
  9. package/dist/index.cjs +1 -1
  10. package/dist/index.d.cts +2 -3
  11. package/dist/index.d.ts +2 -3
  12. package/dist/index.js +1 -1
  13. package/dist/nodejs/cli/cli.util.cjs +1 -1
  14. package/dist/nodejs/cli/cli.util.js +1 -1
  15. package/dist/nodejs/cli/index.cjs +1 -1
  16. package/dist/nodejs/cli/index.js +1 -1
  17. package/dist/nodejs/command/command.util.cjs +1 -1
  18. package/dist/nodejs/command/command.util.js +1 -1
  19. package/dist/nodejs/command/index.cjs +1 -1
  20. package/dist/nodejs/command/index.js +1 -1
  21. package/dist/nodejs/fs/fs.util.cjs +1 -1
  22. package/dist/nodejs/fs/fs.util.d.cts +2 -3
  23. package/dist/nodejs/fs/fs.util.d.ts +2 -3
  24. package/dist/nodejs/fs/fs.util.js +1 -1
  25. package/dist/nodejs/fs/index.cjs +1 -1
  26. package/dist/nodejs/fs/index.d.cts +2 -3
  27. package/dist/nodejs/fs/index.d.ts +2 -3
  28. package/dist/nodejs/fs/index.js +1 -1
  29. package/dist/nodejs/index.cjs +1 -1
  30. package/dist/nodejs/index.d.cts +2 -3
  31. package/dist/nodejs/index.d.ts +2 -3
  32. package/dist/nodejs/index.js +1 -1
  33. package/dist/nodejs/mongo/index.cjs +1 -1
  34. package/dist/nodejs/mongo/index.js +1 -1
  35. package/dist/nodejs/mongo/mongo.util.cjs +1 -1
  36. package/dist/nodejs/mongo/mongo.util.js +1 -1
  37. package/dist/nodejs/package/index.cjs +1 -1
  38. package/dist/nodejs/package/index.js +1 -1
  39. package/dist/nodejs/package/package.util.cjs +1 -1
  40. package/dist/nodejs/package/package.util.js +1 -1
  41. package/dist/nodejs/path/index.cjs +1 -1
  42. package/dist/nodejs/path/index.js +1 -1
  43. package/dist/nodejs/path/path.constant.cjs +1 -1
  44. package/dist/nodejs/path/path.constant.js +1 -1
  45. package/dist/react/apollo-client/apollo-client.component.cjs +1 -1
  46. package/dist/react/apollo-client/apollo-client.component.js +1 -1
  47. package/dist/react/apollo-client/index.cjs +1 -1
  48. package/dist/react/apollo-client/index.js +1 -1
  49. package/dist/react/index.cjs +1 -1
  50. package/dist/react/index.js +1 -1
  51. package/dist/react/vitest/index.cjs +1 -1
  52. package/dist/react/vitest/index.js +1 -1
  53. package/dist/react/vitest/vitest.unit.cjs +1 -1
  54. package/dist/react/vitest/vitest.unit.js +1 -1
  55. package/package.json +1 -2
@@ -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,o,i,a){try{var c=e[i](a);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function c(e){r(a,o,i,c,s,"next",e)}function s(e){r(a,o,i,c,s,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function 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 o=true;var i=false;var a,c;try{for(n=n.call(e);!(o=(a=n.next()).done);o=true){r.push(a.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function d(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{f(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function p(e,t){if(e==null)return{};var n=g(e,t);var r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){r=i[o];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function g(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var o,i;for(i=0;i<r.length;i++){o=r[i];if(t.indexOf(o)>=0)continue;n[o]=e[o]}return n}function m(e,n){return t(e)||c(e,n)||h(e,n)||s()}function v(e){return n(e)||a(e)||h(e)||u()}function y(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function h(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 _(e,t){var n,r,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=c(0),a["throw"]=c(1),a["return"]=c(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(i=0)),i)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;r=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(c[0]===6&&i.label<o[1]){i.label=o[1];o=c;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(c);break}if(o[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var b=Object.defineProperty;var E=function(e,t){return b(e,"name",{value:t,configurable:!0})};var I={extends:["@commitlint/config-conventional"]};var O=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import T from"@antfu/eslint-config";import C from"@vitejs/plugin-react-swc";import{defineConfig as S}from"vitest/config";function w(e){return S(l({plugins:[C()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}E(w,"vitestE2E");import R from"@vitejs/plugin-react-swc";import{defineConfig as G}from"vitest/config";var N=".cyberskill-storage";import L from"@dotenvx/dotenvx";import{bool as P,cleanEnv as j,str as k}from"envalid";import A from"node:os";import D from"node:path";import U from"node:process";var x=!1;function M(){x||(L.config(),x=!0)}E(M,"loadEnvFile");function F(){M();var e=j(U.env,{CWD:k({default:U.cwd()}),DEBUG:P({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:k({default:D.join(A.homedir(),N)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}E(F,"getEnv");var K=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as Y}from"node:child_process";import B from"node:process";import*as W from"node:util";var J=function(e){return e.Error="error",e.Warning="warning",e}({});import q from"chalk";import H from"consola";import{GraphQLError as V}from"graphql";var $=F();$.DEBUG||(H.level=4);function Q(e){var t=q[e];return typeof t=="function"?t:q.green}E(Q,"chalkKeyword");var X={silent:H.silent,level:H.level,fatal:H.fatal,error:H.error,warn:H.warn,log:H.log,info:H.info,success:H.success,ready:H.ready,start:H.start,box:H.box,debug:H.debug,trace:H.trace,verbose:H.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)){H.box(q.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,i=e.message;H.log("".concat(q.gray("File:")," ").concat(q.blue("".concat(t).concat(r?":".concat(r):"")))),o&&H.log(" ".concat(Q(n)("Rule:")," ").concat(o)),H.log(" ".concat(Q(n)("Message:")," ").concat(i))}),H.box(Q(n)("".concat(e," : ").concat(t.length))),H.log(q.gray("─".repeat(40)))}};var z={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import Z from"node-fetch";import ee from"fs-extra";var et=ee.lstatSync,en=ee.readdirSync,er=ee.mkdirSync,eo=ee.readFileSync,ei=ee.writeFileSync,ea=ee.appendFileSync,ec=ee.unlinkSync,es=ee.statSync,eu=ee.readJsonSync,el=ee.writeJsonSync;function ef(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return t.every(function(e){return ee.pathExistsSync(e)})}E(ef,"pathExistsSync");var ed=F();function ep(e){var t=ex(ed.CWD,eW);if(!ef(t))return!1;try{var n=eu(t),r=n.name,o=n.dependencies,i=o===void 0?{}:o,a=n.devDependencies,c=a===void 0?{}:a,s=r===e,u=e in i,l=e in c;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return X.warn("Failed to read package.json: ".concat(e.message)),!1}}E(ep,"getPackage");function eg(e){return /*#__PURE__*/o(function(){var t,n,r,o;return _(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,Z("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:o=i.sent();throw X.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}E(eg,"getLatestPackageVersion");function em(e,t){return /*#__PURE__*/o(function(){var n,r,o,i,a,c,s,u,f,d,p,g,m,v,y,h,b,E,I,O,T;return _(this,function(_){switch(_.label){case 0:_.trys.push([0,4,,5]);n=ep(e);if(!n)return[2,l({},z)];s=n.path,u=n.file,f=n.isCurrentProject,d=n.isDepend,p=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},m=(o=u.devDependencies)!==null&&o!==void 0?o:{},v=f?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(a=g[e])!==null&&a!==void 0?a:"0.0.0":p?(c=m[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];b=v;return[3,3];case 1:return[4,eg(e)];case 2:b=_.sent();_.label=3;case 3:y=b,h=f||v===y;if(!h&&(t===null||t===void 0?void 0:t.update)){;I=d?"dependencies":p?"devDependencies":null;I&&((E=u[I])===null||E===void 0?void 0:E[e])!==y&&(u[I]=(O=u[I])!==null&&O!==void 0?O:{},u[I][e]=y,el(s,u),X.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:h}];case 4:T=_.sent();return[2,(X.error('Error checking package "'.concat(e,'": ').concat(T.message)),l({},z))];case 5:return[2]}})})()}E(em,"checkPackage");function ev(){return /*#__PURE__*/o(function(){var e,t,n,r,o,i,a,c,s,u,l,f;return _(this,function(d){switch(d.label){case 0:e=[{command:E(function(){return th.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:E(function(){return th.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:E(function(){return th.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(i=o.next()).done))return[3,8];a=i.value,c=a.command,s=a.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,c()];case 4:u=d.sent();return[4,eP("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();X.warn("Installation attempt failed: ".concat(s)),X.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}E(ev,"installDependencies");function ey(e,t){return /*#__PURE__*/o(function(){var n,r,o,i,a,c,s,u,f,d,p;return _(this,function(g){switch(g.label){case 0:if(!ef(tm.PACKAGE_JSON)){X.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=v(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return em(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,ev()];case 3:r=g.sent();g.label=4;case 4:r;i=true,a=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=s.next()).done))return[3,9];f=u.value;return[4,f()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();a=true;c=d;return[3,12];case 11:try{if(!i&&s.return!=null){s.return()}}finally{if(a){throw c}}return[7];case 12:return[3,14];case 13:p=g.sent();throw X.error('Failed to setup "'.concat(e.join(", "),'": ').concat(p.message)),p;case 14:return[2]}})})()}E(ey,"setupPackages");import eh from"node-persist";var e_=F();function eb(){return /*#__PURE__*/o(function(){var e;return _(this,function(t){switch(t.label){case 0:e=eh.defaultInstance;if(e)return[3,2];return[4,eh.init({dir:e_.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}E(eb,"initNodePersist");var eE={get:function e(e){return /*#__PURE__*/o(function(){var t,n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eb()];case 1:r.sent();return[4,eh.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(X.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/o(function(){var n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eb()];case 1:r.sent();return[4,eh.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();X.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/o(function(){var t;return _(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eb()];case 1:n.sent();return[4,eh.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();X.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/o(function(){var e,t;return _(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eb()];case 1:n.sent();return[4,eh.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(X.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(X.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/o(function(){return _(this,function(t){try{return[2,"".concat(e_.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(X.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eI=F(),eO=W.promisify(Y);function eT(e){return"error_list:".concat(e)}E(eT,"getErrorListKey");function eC(e){return /*#__PURE__*/o(function(){var t,n,r;return _(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eT(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,eE.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return /*#__PURE__*/o(function(){var e;return _(this,function(t){switch(t.label){case 0:return[4,eE.getLogLink(n)];case 1:e=t.sent();e&&X.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();X.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}E(eC,"saveErrorListToStorage");function eS(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var d=o.exec(e)||[],p=i.exec(e)||[],g=a.exec(e)||[];var m,v,y,h,_,b;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===J.Error?J.Error:J.Warning,message:(m=d===null||d===void 0?void 0:(c=d[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(v=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===J.Error?J.Error:J.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):g.length?t.push({file:"commitlint",type:J.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(b=g===null||g===void 0?void 0:(f=g[2])===null||f===void 0?void 0:f.trim())!==null&&b!==void 0?b:""}):n.push(e.trim())}}),t.length&&eC(t),eI.DEBUG&&n.length&&(X.warn("Unmatched lines:"),n.forEach(function(e){return X.info(" ".concat(e))}))}E(eS,"parseTextErrors");function ew(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,i=e.column,a=e.ruleId,c=e.message;n.push({type:r===2?J.Error:J.Warning,file:t,position:"".concat(o,":").concat(i),rule:a,message:c})})}),n.length&&eC(n)}catch(t){eS(e)}}E(ew,"parseCommandOutput");function eR(e){return /*#__PURE__*/o(function(e){var t,n,r,o,i,a,c,s,u;var l=arguments;return _(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:ew;n=new AbortController;B.on("SIGINT",function(){X.warn("Process interrupted. Terminating..."),n.abort(),B.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eO(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,i=r.stderr;[o,i].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:a=f.sent();c=a.stdout,s=a.stderr,u=a.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&X.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}E(eR,"executeCommand");function eG(e){return{raw:!0,cmd:e}}E(eG,"rawCommand");function eN(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(ta," ").concat(eK," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(ta," ").concat(tr," ").concat(e1," ").concat(e):"".concat(ta," ").concat(e0," ").concat(e)}E(eN,"formatCLI");function eL(e,t){return typeof e=="function"?eN(e(t),t):(typeof e==="undefined"?"undefined":y(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eN(e,t):e}E(eL,"formatCommand");function eP(e,t){return /*#__PURE__*/o(function(){var n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);X.start("".concat(e)),eI.DEBUG&&X.info("→ ".concat(t));return[4,eR(t)];case 1:r.sent(),X.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw X.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}E(eP,"runCommand");import ej,{join as ek,resolve as eA}from"node:path";var eD=F();function eU(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eA.apply(void 0,[eD.CWD].concat(v(t)))}E(eU,"resolveWorkingPath");function ex(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ek.apply(void 0,v(t))}E(ex,"join");var eM=F(),eF=eM.CWD,eK="@cyberskill/shared",eY="node_modules",eB="dist",eW="package.json",eJ="package-lock.json",eq="tsconfig.json",eH=".gitignore",eV=".simple-git-hooks.json",e$="pnpm-lock.yaml",eQ=".git/hooks/",eX=".git/COMMIT_EDITMSG",ez=".migrate-mongo.config.js",eZ=ex(eF,eY,eK,eB),e0="cyberskill",e1="src/nodejs/cli/index.ts",e2="eslint",e3="eslint",e4="vitest",e5="playwright",e6="vitest",e8="@commitlint/cli",e7="commitlint",e9="lint-staged",te="lint-staged",tt="typescript",tn="tsc",tr="tsx",to="git",ti="pnpm",ta="pnpm exec",tc="simple-git-hooks",ts="simple-git-hooks",tu="@eslint/config-inspector",tl="eslint-config-inspector",tf="node-modules-inspector",td="node-modules-inspector",tp="migrate-mongo",tg="./node_modules/migrate-mongo/bin/migrate-mongo",tm={CYBERSKILL_DIRECTORY:eZ,WORKING_DIRECTORY:eF,TS_CONFIG:eU(eq),GIT_IGNORE:eU(eH),GIT_HOOK:eU(eQ),GIT_COMMIT_MSG:eU(eX),SIMPLE_GIT_HOOKS_JSON:eU(eV),PACKAGE_JSON:eU(eW),PACKAGE_LOCK_JSON:eU(eJ),PNPM_LOCK_YAML:eU(e$),NODE_MODULES:eU(eY),MIGRATE_MONGO_CONFIG:eU(ez),LINT_STAGED_CONFIG:eU("".concat(eZ,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:eU("".concat(eZ,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:eU("".concat(eZ,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eU("".concat(eZ,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eU("".concat(eZ,"/react/vitest/vitest.e2e.js"))};function tv(e,t,n){return /*#__PURE__*/o(function(){return _(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case K.CLI:return[3,1];case K.STRING:return[3,3]}return[3,4];case 1:return[4,ey(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eL(eG("".concat(ta," ").concat(n))))];case 3:return[2,eL(eG(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}E(tv,"buildCommand");function ty(e,t,n){return function(){return /*#__PURE__*/o(function(){return _(this,function(r){return[2,tv(e,t,n)]})})()}}E(ty,"commandFactory");var th={simpleGitHooks:ty(K.CLI,tc,ts),eslintInspect:ty(K.CLI,tu,tl),nodeModulesInspect:ty(K.CLI,tf,td),eslintCheck:ty(K.CLI,e2,"".concat(e3," ").concat(tm.WORKING_DIRECTORY)),eslintFix:ty(K.CLI,e2,"".concat(e3," ").concat(tm.WORKING_DIRECTORY," --fix")),typescriptCheck:ty(K.CLI,tt,"".concat(tn," -p ").concat(tm.TS_CONFIG," --noEmit")),configureGitHook:ty(K.STRING,"".concat(to," config core.hooksPath ").concat(tm.GIT_HOOK)),testUnit:ty(K.CLI,e4,"".concat(e6," --config ").concat(tm.UNIT_TEST_CONFIG)),testE2e:ty(K.CLI,"".concat(e4," ").concat(e5),"".concat(e6," --config ").concat(tm.E2E_TEST_CONFIG)),mongoMigrateCreate:E(function(e){return ty(K.CLI,tp,"".concat(tr," ").concat(tg," create ").concat(e," -f ").concat(tm.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:ty(K.CLI,tp,"".concat(tr," ").concat(tg," up -f ").concat(tm.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:ty(K.CLI,tp,"".concat(tr," ").concat(tg," down -f ").concat(tm.MIGRATE_MONGO_CONFIG)),commitLint:ty(K.CLI,e8,"".concat(e7," --edit ").concat(tm.GIT_COMMIT_MSG," --config ").concat(tm.COMMITLINT_CONFIG)),lintStaged:ty(K.CLI,e9,"".concat(te," --config ").concat(tm.LINT_STAGED_CONFIG)),stageBuildDirectory:ty(K.STRING,"".concat(to," add ").concat(eB)),build:ty(K.STRING,"".concat(ti," run build")),pnpmInstallStandard:ty(K.STRING,"".concat(ti," install")),pnpmInstallLegacy:ty(K.STRING,"".concat(ti," install --legacy-peer-deps")),pnpmInstallForce:ty(K.STRING,"".concat(ti," install --force"))};function t_(e){return G(l({plugins:[R()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tm.UNIT_TEST_SETUP_CONFIG]}},e))}E(t_,"vitestUnit");function tb(e){return(typeof e==="undefined"?"undefined":y(e))=="object"&&e!==null&&!Array.isArray(e)}E(tb,"isObject");function tE(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r={};var o=true,i=false,a=undefined,c=true,s=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),f;!(c=(f=l.next()).done);c=true){var d=f.value;try{for(var p=Object.entries(d)[Symbol.iterator](),g;!(o=(g=p.next()).done);o=true){var y=m(g.value,2),h=y[0],_=y[1];var b=r[h];if(Array.isArray(_)){var E=Array.isArray(b)?b:[];r[h]=v(new Set(v(E).concat(v(_))));continue}if(tb(_)){r[h]=tE(tb(b)?b:{},_);continue}r[h]=_}}catch(e){i=true;a=e}finally{try{if(!o&&p.return!=null){p.return()}}finally{if(i){throw a}}}}}catch(e){s=true;u=e}finally{try{if(!c&&l.return!=null){l.return()}}finally{if(s){throw u}}}return r}E(tE,"deepMerge");import*as tI from"globals";var tO=[{languageOptions:{globals:l({},tI.node,tI.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}]},ignores:["build","dist"]}];var tT;var tC=E(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r=tE.apply(void 0,[tO].concat(v(t.map(function(e){return e})))),o=r.ignores,i=p(r,["ignores"]),a=Array.isArray(o)&&o.every(function(e){return typeof e=="string"})?{ignores:o}:void 0,c=[i].concat(v(a?[a]:[]));return T.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(v(c)))},"handleESLint"),tS=(tT={},i(tT,O.ESLINT,function(e){return tC(e)}),i(tT,O.COMMITLINT,function(e){return tE(e)}),i(tT,O.LINT_STAGED,function(e){return tE(e)}),i(tT,O.VITEST_REACT_UNIT,function(e){return t_(e)}),i(tT,O.VITEST_REACT_E2E,function(e){return w(e)}),tT);function tw(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}var o=tS[e];if(!o)throw new Error("Unknown config type: ".concat(e));return o.apply(void 0,v(n))}E(tw,"mergeConfigs");import{defineConfig as tR}from"@eddeee888/gcg-typescript-resolver-files";M();function tG(e){var t=e.uri,n=e.from,r=e.to,o=e.target,a=o===void 0?"client":o;var c=a==="client",s=a==="server";return d(l({schema:t,ignoreNoDocuments:!0,overwrite:!0},c&&{documents:[n]}),{generates:l({},c&&i({},r,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),s&&i({},r,tR()))})}E(tG,"createGraphqlCodegenConfig");var tN={"*":["eslint --fix"]};export{N as CYBERSKILL_STORAGE_DIRECTORY,O as E_ConfigType,I as commitlintConfig,tG as createGraphqlCodegenConfig,tO as eslintConfig,F as getEnv,tN as lintStagedConfig,M as loadEnvFile,tw as mergeConfigs};
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,o,i,a){try{var c=e[i](a);var s=c.value}catch(e){n(e);return}if(c.done){t(s)}else{Promise.resolve(s).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var a=e.apply(t,n);function c(e){r(a,o,i,c,s,"next",e)}function s(e){r(a,o,i,c,s,"throw",e)}c(undefined)})}}function i(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function 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 o=true;var i=false;var a,c;try{for(n=n.call(e);!(o=(a=n.next()).done);o=true){r.push(a.value);if(t&&r.length===t)break}}catch(e){i=true;c=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw c}}return r}function s(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function u(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function l(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))}r.forEach(function(t){i(e,t,n[t])})}return e}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);if(t){r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})}n.push.apply(n,r)}return n}function d(e,t){t=t!=null?t:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(t))}else{f(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function p(e,t){if(e==null)return{};var n=g(e,t);var r,o;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++){r=i[o];if(t.indexOf(r)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,r))continue;n[r]=e[r]}}return n}function g(e,t){if(e==null)return{};var n={};var r=Object.keys(e);var o,i;for(i=0;i<r.length;i++){o=r[i];if(t.indexOf(o)>=0)continue;n[o]=e[o]}return n}function m(e,n){return t(e)||c(e,n)||h(e,n)||s()}function v(e){return n(e)||a(e)||h(e)||u()}function y(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function h(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 _(e,t){var n,r,o,i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},a=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return a.next=c(0),a["throw"]=c(1),a["return"]=c(2),typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,c[0]&&(i=0)),i)try{if(n=1,r&&(o=c[0]&2?r["return"]:c[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;if(r=0,o)c=[c[0]&2,o.value];switch(c[0]){case 0:case 1:o=c;break;case 4:i.label++;return{value:c[1],done:false};case 5:i.label++;r=c[1];c=[0];continue;case 7:c=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){i=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(c[0]===6&&i.label<o[1]){i.label=o[1];o=c;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(c);break}if(o[2])i.ops.pop();i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e];r=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var E=Object.defineProperty;var b=function(e,t){return E(e,"name",{value:t,configurable:!0})};var I={extends:["@commitlint/config-conventional"]};var O=function(e){return e.ESLINT="eslint",e.COMMITLINT="commitlint",e.LINT_STAGED="lint-staged",e.VITEST_REACT_E2E="vitest-react-e2e",e.VITEST_REACT_UNIT="vitest-react-unit",e}({});import T from"@antfu/eslint-config";import C from"@vitejs/plugin-react-swc";import{defineConfig as S}from"vitest/config";function w(e){return S(l({plugins:[C()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}},e))}b(w,"vitestE2E");import R from"@vitejs/plugin-react-swc";import{defineConfig as G}from"vitest/config";var N=".cyberskill-storage";import L from"@dotenvx/dotenvx";import{bool as P,cleanEnv as j,str as k}from"envalid";import A from"node:os";import D from"node:path";import x from"node:process";var U=!1;function M(){U||(L.config(),U=!0)}b(M,"loadEnvFile");function F(){M();var e=j(x.env,{CWD:k({default:x.cwd()}),DEBUG:P({default:!1}),CYBERSKILL_STORAGE_DIRECTORY:k({default:D.join(A.homedir(),N)})});return{CWD:e.CWD,DEBUG:e.DEBUG,CYBERSKILL_STORAGE_DIRECTORY:e.CYBERSKILL_STORAGE_DIRECTORY}}b(F,"getEnv");var K=function(e){return e.CLI="CLI",e.STRING="STRING",e.FUNCTION="FUNCTION",e}({});import{exec as Y}from"node:child_process";import B from"node:process";import*as W from"node:util";var J=function(e){return e.Error="error",e.Warning="warning",e}({});import H from"chalk";import V from"consola";import{GraphQLError as q}from"graphql";var $=F();$.DEBUG||(V.level=4);function Q(e){var t=H[e];return typeof t=="function"?t:H.green}b(Q,"chalkKeyword");var X={silent:V.silent,level:V.level,fatal:V.fatal,error:V.error,warn:V.warn,log:V.log,info:V.info,success:V.success,ready:V.ready,start:V.start,box:V.box,debug:V.debug,trace:V.trace,verbose:V.verbose,printBoxedLog:function e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"red";if(!(t===null||t===void 0?void 0:t.length)){V.box(H.green(e));return}t.forEach(function(e){var t=e.file,r=e.position,o=e.rule,i=e.message;V.log("".concat(H.gray("File:")," ").concat(H.blue("".concat(t).concat(r?":".concat(r):"")))),o&&V.log(" ".concat(Q(n)("Rule:")," ").concat(o)),V.log(" ".concat(Q(n)("Message:")," ").concat(i))}),V.box(Q(n)("".concat(e," : ").concat(t.length))),V.log(H.gray("─".repeat(40)))}};var z={isCurrentProject:!1,installedPath:"",file:{},isUpToDate:!1};import Z from"node-fetch";import ee from"fs-extra";var et=ee.lstatSync,en=ee.readdirSync,er=ee.mkdirSync,eo=ee.readFileSync,ei=ee.unlinkSync,ea=ee.statSync,ec=ee.readJsonSync;function es(e,t,n){ee.writeFileSync(e,t,n!==null&&n!==void 0?n:"utf-8")}b(es,"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 ee.pathExistsSync(e)})}b(eu,"pathExistsSync");var el=F();function ef(e){var t=eD(el.CWD,eY);if(!eu(t))return!1;try{var n=ec(t),r=n.name,o=n.dependencies,i=o===void 0?{}:o,a=n.devDependencies,c=a===void 0?{}:a,s=r===e,u=e in i,l=e in c;return s||u||l?{path:t,file:n,isCurrentProject:s,isDepend:u,isDevDepend:l}:!1}catch(e){return X.warn("Failed to read package.json: ".concat(e.message)),!1}}b(ef,"getPackage");function ed(e){return /*#__PURE__*/o(function(){var t,n,r,o;return _(this,function(i){switch(i.label){case 0:i.trys.push([0,3,,4]);return[4,Z("https://registry.npmjs.org/".concat(e,"/latest"))];case 1:t=i.sent();if(!t.ok)throw new Error("Failed to fetch latest version: ".concat(t.status," ").concat(t.statusText));return[4,t.json()];case 2:n=i.sent(),r=n.version;return[2,r];case 3:o=i.sent();throw X.error('Failed to fetch version for "'.concat(e,'": ').concat(o.message)),o;case 4:return[2]}})})()}b(ed,"getLatestPackageVersion");function ep(e,t){return /*#__PURE__*/o(function(){var n,r,o,i,a,c,s,u,f,d,p,g,m,v,y,h,E,b,I,O,T;return _(this,function(_){switch(_.label){case 0:_.trys.push([0,4,,5]);n=ef(e);if(!n)return[2,l({},z)];s=n.path,u=n.file,f=n.isCurrentProject,d=n.isDepend,p=n.isDevDepend,g=(r=u.dependencies)!==null&&r!==void 0?r:{},m=(o=u.devDependencies)!==null&&o!==void 0?o:{},v=f?(i=u.version)!==null&&i!==void 0?i:"0.0.0":d?(a=g[e])!==null&&a!==void 0?a:"0.0.0":p?(c=m[e])!==null&&c!==void 0?c:"0.0.0":"0.0.0";if(!f)return[3,1];E=v;return[3,3];case 1:return[4,ed(e)];case 2:E=_.sent();_.label=3;case 3:y=E,h=f||v===y;if(!h&&(t===null||t===void 0?void 0:t.update)){;I=d?"dependencies":p?"devDependencies":null;I&&((b=u[I])===null||b===void 0?void 0:b[e])!==y&&(u[I]=(O=u[I])!==null&&O!==void 0?O:{},u[I][e]=y,es(s,JSON.stringify(u,null,4)),X.info('Updated "'.concat(e,'" to version ').concat(y)))}return[2,{isCurrentProject:f,installedPath:s,file:u,isUpToDate:h}];case 4:T=_.sent();return[2,(X.error('Error checking package "'.concat(e,'": ').concat(T.message)),l({},z))];case 5:return[2]}})})()}b(ep,"checkPackage");function eg(){return /*#__PURE__*/o(function(){var e,t,n,r,o,i,a,c,s,u,l,f;return _(this,function(d){switch(d.label){case 0:e=[{command:b(function(){return tv.pnpmInstallStandard()},"command"),message:"Installing dependencies (standard)"},{command:b(function(){return tv.pnpmInstallLegacy()},"command"),message:"Retrying with legacy peer dependencies"},{command:b(function(){return tv.pnpmInstallForce()},"command"),message:"Retrying with force install"}];t=true,n=false,r=undefined;d.label=1;case 1:d.trys.push([1,9,10,11]);o=e[Symbol.iterator]();d.label=2;case 2:if(!!(t=(i=o.next()).done))return[3,8];a=i.value,c=a.command,s=a.message;d.label=3;case 3:d.trys.push([3,6,,7]);return[4,c()];case 4:u=d.sent();return[4,eN("".concat(s," using: ").concat(u),u)];case 5:d.sent();return[2];case 6:l=d.sent();X.warn("Installation attempt failed: ".concat(s)),X.error("Details: ".concat(l.message));return[3,7];case 7:t=true;return[3,2];case 8:return[3,11];case 9:f=d.sent();n=true;r=f;return[3,11];case 10:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 11:throw new Error("All dependency installation strategies failed.")}})})()}b(eg,"installDependencies");function em(e,t){return /*#__PURE__*/o(function(){var n,r,o,i,a,c,s,u,f,d,p;return _(this,function(g){switch(g.label){case 0:if(!eu(tp.PACKAGE_JSON)){X.error("package.json not found. Aborting setup.");return[2]}g.label=1;case 1:g.trys.push([1,13,,14]);n=v(new Set(e)).sort();return[4,Promise.all(n.map(function(e){return ep(e,l({},(t===null||t===void 0?void 0:t.update)&&{update:t.update}))}))];case 2:r=g.sent().every(function(e){return e.isUpToDate});if(r)return[3,4];return[4,eg()];case 3:r=g.sent();g.label=4;case 4:r;i=true,a=false,c=undefined;g.label=5;case 5:g.trys.push([5,10,11,12]);s=((o=t===null||t===void 0?void 0:t.postInstallActions)!==null&&o!==void 0?o:[])[Symbol.iterator]();g.label=6;case 6:if(!!(i=(u=s.next()).done))return[3,9];f=u.value;return[4,f()];case 7:g.sent();g.label=8;case 8:i=true;return[3,6];case 9:return[3,12];case 10:d=g.sent();a=true;c=d;return[3,12];case 11:try{if(!i&&s.return!=null){s.return()}}finally{if(a){throw c}}return[7];case 12:return[3,14];case 13:p=g.sent();throw X.error('Failed to setup "'.concat(e.join(", "),'": ').concat(p.message)),p;case 14:return[2]}})})()}b(em,"setupPackages");import ev from"node-persist";var ey=F();function eh(){return /*#__PURE__*/o(function(){var e;return _(this,function(t){switch(t.label){case 0:e=ev.defaultInstance;if(e)return[3,2];return[4,ev.init({dir:ey.CYBERSKILL_STORAGE_DIRECTORY,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})})()}b(eh,"initNodePersist");var e_={get:function e(e){return /*#__PURE__*/o(function(){var t,n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eh()];case 1:r.sent();return[4,ev.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(X.error('[Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return /*#__PURE__*/o(function(){var n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,eh()];case 1:r.sent();return[4,ev.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();X.error('[Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return /*#__PURE__*/o(function(){var t;return _(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eh()];case 1:n.sent();return[4,ev.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();X.error('[Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return /*#__PURE__*/o(function(){var e,t;return _(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,eh()];case 1:n.sent();return[4,ev.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(X.warn("[Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(X.error("[Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return /*#__PURE__*/o(function(){return _(this,function(t){try{return[2,"".concat(ey.CYBERSKILL_STORAGE_DIRECTORY," (key: ").concat(e,")")]}catch(e){return[2,(X.error("[Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var eE=F(),eb=W.promisify(Y);function eI(e){return"error_list:".concat(e)}b(eI,"getErrorListKey");function eO(e){return /*#__PURE__*/o(function(){var t,n,r;return _(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eI(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,e_.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(function(){return /*#__PURE__*/o(function(){var e;return _(this,function(t){switch(t.label){case 0:return[4,e_.getLogLink(n)];case 1:e=t.sent();e&&X.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})})()},10);return[3,4];case 3:r=i.sent();X.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})})()}b(eO,"saveErrorListToStorage");function eT(e){var t=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var c,s,u,l,f;var d=o.exec(e)||[],p=i.exec(e)||[],g=a.exec(e)||[];var m,v,y,h,_,E;d.length&&r?t.push({file:r,position:"".concat(d[1],":").concat(d[2]),type:d[3]===J.Error?J.Error:J.Warning,message:(m=d===null||d===void 0?void 0:(c=d[4])===null||c===void 0?void 0:c.trim())!==null&&m!==void 0?m:"",rule:(v=d===null||d===void 0?void 0:(s=d[5])===null||s===void 0?void 0:s.trim())!==null&&v!==void 0?v:""}):p.length?t.push({file:(y=p===null||p===void 0?void 0:p[1])!==null&&y!==void 0?y:"",position:"".concat(p[2],":").concat(p[3]),type:p[4]===J.Error?J.Error:J.Warning,message:(h=p===null||p===void 0?void 0:(u=p[5])===null||u===void 0?void 0:u.trim())!==null&&h!==void 0?h:""}):g.length?t.push({file:"commitlint",type:J.Error,message:(_=g===null||g===void 0?void 0:(l=g[1])===null||l===void 0?void 0:l.trim())!==null&&_!==void 0?_:"",rule:(E=g===null||g===void 0?void 0:(f=g[2])===null||f===void 0?void 0:f.trim())!==null&&E!==void 0?E:""}):n.push(e.trim())}}),t.length&&eO(t),eE.DEBUG&&n.length&&(X.warn("Unmatched lines:"),n.forEach(function(e){return X.info(" ".concat(e))}))}b(eT,"parseTextErrors");function eC(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,o=e.line,i=e.column,a=e.ruleId,c=e.message;n.push({type:r===2?J.Error:J.Warning,file:t,position:"".concat(o,":").concat(i),rule:a,message:c})})}),n.length&&eO(n)}catch(t){eT(e)}}b(eC,"parseCommandOutput");function eS(e){return /*#__PURE__*/o(function(e){var t,n,r,o,i,a,c,s,u;var l=arguments;return _(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eC;n=new AbortController;B.on("SIGINT",function(){X.warn("Process interrupted. Terminating..."),n.abort(),B.exit()});f.label=1;case 1:f.trys.push([1,4,,5]);if(!(typeof e=="string"))return[3,3];return[4,eb(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,i=r.stderr;[o,i].forEach(function(e){return e&&t(e)});f.label=3;case 3:return[3,5];case 4:a=f.sent();c=a.stdout,s=a.stderr,u=a.message;[c,s].forEach(function(e){return e&&t(e)}),!s&&!c&&X.error("Command failed: ".concat(u));return[3,5];case 5:return[2]}})}).apply(this,arguments)}b(eS,"executeCommand");function ew(e){return{raw:!0,cmd:e}}b(ew,"rawCommand");function eR(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(to," ").concat(eM," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(to," ").concat(tt," ").concat(eZ," ").concat(e):"".concat(to," ").concat(ez," ").concat(e)}b(eR,"formatCLI");function eG(e,t){return typeof e=="function"?eR(e(t),t):(typeof e==="undefined"?"undefined":y(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eR(e,t):e}b(eG,"formatCommand");function eN(e,t){return /*#__PURE__*/o(function(){var n;return _(this,function(r){switch(r.label){case 0:r.trys.push([0,2,,3]);X.start("".concat(e)),eE.DEBUG&&X.info("→ ".concat(t));return[4,eS(t)];case 1:r.sent(),X.success("".concat(e," done."));return[3,3];case 2:n=r.sent();throw X.error("".concat(e," failed: ").concat(n.message)),n;case 3:return[2]}})})()}b(eN,"runCommand");import eL,{join as eP,resolve as ej}from"node:path";var ek=F();function eA(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return ej.apply(void 0,[ek.CWD].concat(v(t)))}b(eA,"resolveWorkingPath");function eD(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}return eP.apply(void 0,v(t))}b(eD,"join");var ex=F(),eU=ex.CWD,eM="@cyberskill/shared",eF="node_modules",eK="dist",eY="package.json",eB="package-lock.json",eW="tsconfig.json",eJ=".gitignore",eH=".simple-git-hooks.json",eV="pnpm-lock.yaml",eq=".git/hooks/",e$=".git/COMMIT_EDITMSG",eQ=".migrate-mongo.config.js",eX=eD(eU,eF,eM,eK),ez="cyberskill",eZ="src/nodejs/cli/index.ts",e0="eslint",e1="eslint",e2="vitest",e3="playwright",e4="vitest",e5="@commitlint/cli",e8="commitlint",e6="lint-staged",e7="lint-staged",e9="typescript",te="tsc",tt="tsx",tn="git",tr="pnpm",to="pnpm exec",ti="simple-git-hooks",ta="simple-git-hooks",tc="@eslint/config-inspector",ts="eslint-config-inspector",tu="node-modules-inspector",tl="node-modules-inspector",tf="migrate-mongo",td="./node_modules/migrate-mongo/bin/migrate-mongo",tp={CYBERSKILL_DIRECTORY:eX,WORKING_DIRECTORY:eU,TS_CONFIG:eA(eW),GIT_IGNORE:eA(eJ),GIT_HOOK:eA(eq),GIT_COMMIT_MSG:eA(e$),SIMPLE_GIT_HOOKS_JSON:eA(eH),PACKAGE_JSON:eA(eY),PACKAGE_LOCK_JSON:eA(eB),PNPM_LOCK_YAML:eA(eV),NODE_MODULES:eA(eF),MIGRATE_MONGO_CONFIG:eA(eQ),LINT_STAGED_CONFIG:eA("".concat(eX,"/configs/lint-staged/index.js")),COMMITLINT_CONFIG:eA("".concat(eX,"/configs/commitlint/index.js")),UNIT_TEST_CONFIG:eA("".concat(eX,"/react/vitest/vitest.unit.js")),UNIT_TEST_SETUP_CONFIG:eA("".concat(eX,"/react/vitest/vitest.unit.setup.js")),E2E_TEST_CONFIG:eA("".concat(eX,"/react/vitest/vitest.e2e.js"))};function tg(e,t,n){return /*#__PURE__*/o(function(){return _(this,function(r){switch(r.label){case 0:if(!t)throw new Error("'first' argument is undefined");switch(e){case K.CLI:return[3,1];case K.STRING:return[3,3]}return[3,4];case 1:return[4,em(t.split(" "),{update:!0})];case 2:return[2,(r.sent(),eG(ew("".concat(to," ").concat(n))))];case 3:return[2,eG(ew(t))];case 4:throw new Error("Unsupported command type");case 5:return[2]}})})()}b(tg,"buildCommand");function tm(e,t,n){return function(){return /*#__PURE__*/o(function(){return _(this,function(r){return[2,tg(e,t,n)]})})()}}b(tm,"commandFactory");var tv={simpleGitHooks:tm(K.CLI,ti,ta),eslintInspect:tm(K.CLI,tc,ts),nodeModulesInspect:tm(K.CLI,tu,tl),eslintCheck:tm(K.CLI,e0,"".concat(e1," ").concat(tp.WORKING_DIRECTORY," --no-cache")),eslintFix:tm(K.CLI,e0,"".concat(e1," ").concat(tp.WORKING_DIRECTORY," --fix --no-cache")),typescriptCheck:tm(K.CLI,e9,"".concat(te," -p ").concat(tp.TS_CONFIG," --noEmit")),configureGitHook:tm(K.STRING,"".concat(tn," config core.hooksPath ").concat(tp.GIT_HOOK)),testUnit:tm(K.CLI,e2,"".concat(e4," --config ").concat(tp.UNIT_TEST_CONFIG)),testE2e:tm(K.CLI,"".concat(e2," ").concat(e3),"".concat(e4," --config ").concat(tp.E2E_TEST_CONFIG)),mongoMigrateCreate:b(function(e){return tm(K.CLI,tf,"".concat(tt," ").concat(td," create ").concat(e," -f ").concat(tp.MIGRATE_MONGO_CONFIG))()},"mongoMigrateCreate"),mongoMigrateUp:tm(K.CLI,tf,"".concat(tt," ").concat(td," up -f ").concat(tp.MIGRATE_MONGO_CONFIG)),mongoMigrateDown:tm(K.CLI,tf,"".concat(tt," ").concat(td," down -f ").concat(tp.MIGRATE_MONGO_CONFIG)),commitLint:tm(K.CLI,e5,"".concat(e8," --edit ").concat(tp.GIT_COMMIT_MSG," --config ").concat(tp.COMMITLINT_CONFIG)),lintStaged:tm(K.CLI,e6,"".concat(e7," --config ").concat(tp.LINT_STAGED_CONFIG)),stageBuildDirectory:tm(K.STRING,"".concat(tn," add ").concat(eK)),build:tm(K.STRING,"".concat(tr," run build")),pnpmInstallStandard:tm(K.STRING,"".concat(tr," install")),pnpmInstallLegacy:tm(K.STRING,"".concat(tr," install --legacy-peer-deps")),pnpmInstallForce:tm(K.STRING,"".concat(tr," install --force"))};function ty(e){return G(l({plugins:[R()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:[tp.UNIT_TEST_SETUP_CONFIG]}},e))}b(ty,"vitestUnit");function th(e){return(typeof e==="undefined"?"undefined":y(e))=="object"&&e!==null&&!Array.isArray(e)}b(th,"isObject");function t_(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r={};var o=true,i=false,a=undefined,c=true,s=false,u=undefined;try{for(var l=t.flat()[Symbol.iterator](),f;!(c=(f=l.next()).done);c=true){var d=f.value;try{for(var p=Object.entries(d)[Symbol.iterator](),g;!(o=(g=p.next()).done);o=true){var y=m(g.value,2),h=y[0],_=y[1];var E=r[h];if(Array.isArray(_)){var b=Array.isArray(E)?E:[];r[h]=v(new Set(v(b).concat(v(_))));continue}if(th(_)){r[h]=t_(th(E)?E:{},_);continue}r[h]=_}}catch(e){i=true;a=e}finally{try{if(!o&&p.return!=null){p.return()}}finally{if(i){throw a}}}}}catch(e){s=true;u=e}finally{try{if(!c&&l.return!=null){l.return()}}finally{if(s){throw u}}}return r}b(t_,"deepMerge");import*as tE from"globals";var tb=[{languageOptions:{globals:l({},tE.node,tE.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["build","dist"]}];var tI;var tO=b(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r=t_.apply(void 0,[tb].concat(v(t.map(function(e){return e})))),o=r.ignores,i=p(r,["ignores"]),a=Array.isArray(o)&&o.every(function(e){return typeof e=="string"})?{ignores:o}:void 0,c=[i].concat(v(a?[a]:[]));return T.apply(void 0,[{stylistic:{semi:!0,indent:4,quotes:"single"},formatters:{css:!0,html:!0,markdown:"prettier"},yaml:!1,react:!0}].concat(v(c)))},"handleESLint"),tT=(tI={},i(tI,O.ESLINT,function(e){return tO(e)}),i(tI,O.COMMITLINT,function(e){return t_(e)}),i(tI,O.LINT_STAGED,function(e){return t_(e)}),i(tI,O.VITEST_REACT_UNIT,function(e){return ty(e)}),i(tI,O.VITEST_REACT_E2E,function(e){return w(e)}),tI);function tC(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}var o=tT[e];if(!o)throw new Error("Unknown config type: ".concat(e));return o.apply(void 0,v(n))}b(tC,"mergeConfigs");import{defineConfig as tS}from"@eddeee888/gcg-typescript-resolver-files";M();function tw(e){var t=e.uri,n=e.from,r=e.to,o=e.target,a=o===void 0?"client":o;var c=a==="client",s=a==="server";return d(l({schema:t,ignoreNoDocuments:!0,overwrite:!0},c&&{documents:[n]}),{generates:l({},c&&i({},r,{preset:"client",presetConfig:{fragmentMasking:!1,persistedDocuments:!0},config:{useTypeImports:!0}}),s&&i({},r,tS()))})}b(tw,"createGraphqlCodegenConfig");var tR={"*":["eslint --fix"]};export{N as CYBERSKILL_STORAGE_DIRECTORY,O as E_ConfigType,I as commitlintConfig,tw as createGraphqlCodegenConfig,tb as eslintConfig,F as getEnv,tR as lintStagedConfig,M as loadEnvFile,tC as mergeConfigs};