@cyberskill/shared 2.21.0 → 2.26.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 (41) hide show
  1. package/dist/config/eslint/index.cjs +1 -1
  2. package/dist/config/eslint/index.d.ts +2 -7
  3. package/dist/config/eslint/index.js +1 -1
  4. package/dist/config/vitest/vitest.e2e.cjs +1 -1
  5. package/dist/config/vitest/vitest.e2e.js +1 -1
  6. package/dist/config/vitest/vitest.unit.cjs +1 -1
  7. package/dist/config/vitest/vitest.unit.js +1 -1
  8. package/dist/config/vitest/vitest.unit.setup.d.ts +0 -1
  9. package/dist/node/cli/index.cjs +4 -4
  10. package/dist/node/cli/index.js +56 -51
  11. package/dist/node/command/command.util.cjs +2 -2
  12. package/dist/node/command/command.util.d.ts +4 -1
  13. package/dist/node/command/command.util.js +125 -112
  14. package/dist/node/express/express.type.d.ts +2 -0
  15. package/dist/node/express/express.util.cjs +1 -1
  16. package/dist/node/express/express.util.js +53 -47
  17. package/dist/node/mongo/index.cjs +1 -1
  18. package/dist/node/mongo/index.d.ts +1 -0
  19. package/dist/node/mongo/index.js +15 -12
  20. package/dist/node/mongo/mongo.controller.cjs +1 -0
  21. package/dist/node/mongo/mongo.controller.d.ts +317 -0
  22. package/dist/node/mongo/mongo.controller.js +956 -0
  23. package/dist/node/mongo/mongo.type.d.ts +9 -10
  24. package/dist/node/mongo/mongo.util.cjs +5 -5
  25. package/dist/node/mongo/mongo.util.d.ts +26 -315
  26. package/dist/node/mongo/mongo.util.js +314 -1241
  27. package/dist/node/path/path.constant.cjs +1 -1
  28. package/dist/node/path/path.constant.d.ts +2 -2
  29. package/dist/node/path/path.constant.js +43 -43
  30. package/dist/util/common/common.util.cjs +1 -1
  31. package/dist/util/common/common.util.d.ts +3 -0
  32. package/dist/util/common/common.util.js +36 -35
  33. package/dist/util/object/object.util.cjs +1 -1
  34. package/dist/util/object/object.util.js +49 -45
  35. package/dist/util/validate/validate.util.cjs +1 -1
  36. package/dist/util/validate/validate.util.js +1 -1
  37. package/package.json +25 -24
  38. /package/dist/node/mongo/{mongo-controller.test.unit.d.ts → mongo.controller.test.unit.d.ts} +0 -0
  39. /package/dist/node/mongo/{mongo.test.unit.d.ts → mongo.util.test.unit.d.ts} +0 -0
  40. /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.cjs +0 -0
  41. /package/dist/node_modules/.pnpm/{vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2 → vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2}/node_modules/vitest/dist/config.js +0 -0
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("globals");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const n=u(i);var c=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(t,r,e[r]);if(a)for(var r of a(e))p.call(e,r)&&l(t,r,e[r]);return t};const d=[{languageOptions:{globals:s(s({},n.node),n.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["build","dist"]}];exports.default=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("globals");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const n=u(i);var c=Object.defineProperty,a=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,l=(t,e,r)=>e in t?c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,s=(t,e)=>{for(var r in e||(e={}))f.call(e,r)&&l(t,r,e[r]);if(a)for(var r of a(e))p.call(e,r)&&l(t,r,e[r]);return t};const d=[{languageOptions:{globals:s(s({},n.node),n.browser)},rules:{"perfectionist/sort-imports":["error",{internalPattern:["^#.*","^@/.*"]}],"dot-notation":"off"},ignores:["**/node_modules/**","**/.git/**","build","dist"]}];exports.default=d;
@@ -41,9 +41,7 @@ declare const _default: {
41
41
  AudioScheduledSourceNode: false;
42
42
  AudioSinkInfo: false;
43
43
  AudioWorklet: false;
44
- AudioWorkletGlobalScope: false;
45
44
  AudioWorkletNode: false;
46
- AudioWorkletProcessor: false;
47
45
  AuthenticatorAssertionResponse: false;
48
46
  AuthenticatorAttestationResponse: false;
49
47
  AuthenticatorResponse: false;
@@ -177,6 +175,7 @@ declare const _default: {
177
175
  CSSSkewY: false;
178
176
  CSSStartingStyleRule: false;
179
177
  CSSStyleDeclaration: false;
178
+ CSSStyleProperties: false;
180
179
  CSSStyleRule: false;
181
180
  CSSStyleSheet: false;
182
181
  CSSStyleValue: false;
@@ -189,8 +188,6 @@ declare const _default: {
189
188
  CSSUnparsedValue: false;
190
189
  CSSVariableReferenceValue: false;
191
190
  CSSViewTransitionRule: false;
192
- currentFrame: false;
193
- currentTime: false;
194
191
  CustomElementRegistry: false;
195
192
  customElements: false;
196
193
  CustomEvent: false;
@@ -787,7 +784,6 @@ declare const _default: {
787
784
  ReadableStreamBYOBRequest: false;
788
785
  ReadableStreamDefaultController: false;
789
786
  ReadableStreamDefaultReader: false;
790
- registerProcessor: false;
791
787
  RelativeOrientationSensor: false;
792
788
  RemotePlayback: false;
793
789
  removeEventListener: false;
@@ -827,7 +823,6 @@ declare const _default: {
827
823
  RTCSessionDescription: false;
828
824
  RTCStatsReport: false;
829
825
  RTCTrackEvent: false;
830
- sampleRate: false;
831
826
  scheduler: false;
832
827
  Scheduler: false;
833
828
  Scheduling: false;
@@ -1012,6 +1007,7 @@ declare const _default: {
1012
1007
  TaskController: false;
1013
1008
  TaskPriorityChangeEvent: false;
1014
1009
  TaskSignal: false;
1010
+ Temporal: false;
1015
1011
  TEMPORARY: false;
1016
1012
  Text: false;
1017
1013
  TextDecoder: false;
@@ -1123,7 +1119,6 @@ declare const _default: {
1123
1119
  WindowControlsOverlayGeometryChangeEvent: false;
1124
1120
  Worker: false;
1125
1121
  Worklet: false;
1126
- WorkletGlobalScope: false;
1127
1122
  WritableStream: false;
1128
1123
  WritableStreamDefaultController: false;
1129
1124
  WritableStreamDefaultWriter: false;
@@ -18,7 +18,7 @@ const f = [
18
18
  }],
19
19
  "dot-notation": "off"
20
20
  },
21
- ignores: ["build", "dist"]
21
+ ignores: ["**/node_modules/**", "**/.git/**", "build", "dist"]
22
22
  }
23
23
  ];
24
24
  export {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@vitejs/plugin-react-swc"),i=require("../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),o=require("../../util/object/object.util.cjs");function n(e){const r={plugins:[t()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}};return i.defineConfig(o.deepMerge(r,e))}exports.vitestE2E=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@vitejs/plugin-react-swc"),i=require("../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),o=require("../../util/object/object.util.cjs");function n(e){const r={plugins:[t()],test:{include:["**/*.test.e2e.?(c|m)[jt]s?(x)"],browser:{enabled:!0,provider:"playwright",instances:[{browser:"chromium"},{browser:"firefox"},{browser:"webkit"}]}}};return i.defineConfig(o.deepMerge(r,e))}exports.vitestE2E=n;
@@ -1,5 +1,5 @@
1
1
  import t from "@vitejs/plugin-react-swc";
2
- import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
2
+ import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
3
3
  import { deepMerge as i } from "../../util/object/object.util.js";
4
4
  function m(e) {
5
5
  const r = {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vitejs/plugin-react-swc"),n=require("../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),s=require("../../util/object/object.util.cjs");function r(e){const t={plugins:[i()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:["./vitest.unit.setup.ts"]}};return n.defineConfig(s.deepMerge(t,e))}exports.vitestUnit=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@vitejs/plugin-react-swc"),n=require("../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.cjs"),s=require("../../util/object/object.util.cjs");function r(e){const t={plugins:[i()],test:{globals:!0,environment:"jsdom",pool:"vmThreads",include:["**/*.test.unit.?(c|m)[jt]s?(x)"],setupFiles:["./vitest.unit.setup.ts"]}};return n.defineConfig(s.deepMerge(t,e))}exports.vitestUnit=r;
@@ -1,5 +1,5 @@
1
1
  import i from "@vitejs/plugin-react-swc";
2
- import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.3.0_sass@1.97.0_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
2
+ import { defineConfig as o } from "../../node_modules/.pnpm/vitest@4.0.16_@types_node@25.0.3_jiti@2.6.1_jsdom@27.4.0_sass@1.97.2_tsx@4.21.0_yaml@2.8.2/node_modules/vitest/dist/config.js";
3
3
  import { deepMerge as n } from "../../util/object/object.util.js";
4
4
  function p(t) {
5
5
  const e = {
@@ -1 +0,0 @@
1
- export {};
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- "use strict";const g=require("node:process"),I=require("yargs/helpers"),v=require("yargs/yargs"),i=require("../command/command.util.cjs"),y=require("../package/package.util.cjs"),l=require("../fs/fs.util.cjs"),L=require("../path/path.util.cjs"),n=require("../path/path.constant.cjs"),s=require("../log/log.util.cjs"),f=require("../log/log.type.cjs");var t=(e,o,r)=>new Promise((c,p)=>{var k=a=>{try{m(r.next(a))}catch(d){p(d)}},_=a=>{try{m(r.throw(a))}catch(d){p(d)}},m=a=>a.done?c(a.value):Promise.resolve(a.value).then(k,_);m((r=r.apply(e,o)).next())});function P(){try{return JSON.parse(l.readFileSync(L.resolve(__dirname,"../../../package.json"),"utf-8")).version}catch(e){return"1.0.0"}}function C(){return t(this,null,function*(){l.pathExistsSync(n.PATH.TS_CONFIG)?yield i.runCommand("Performing TypeScript validation",yield n.command.typescriptCheck()):s.log.warn("No TypeScript configuration found. Skipping type check.")})}function S(e=!1){return t(this,null,function*(){e?yield i.runCommand("Running ESLint with auto-fix",yield n.command.eslintFix()):yield i.runCommand("Running ESLint check",yield n.command.eslintCheck())})}function h(e,o){if(!o.length)return;const r=e==="Errors"?"red":"yellow";s.log.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",o,r)}function u(){return t(this,null,function*(){setTimeout(()=>t(null,null,function*(){const e=yield i.getStoredErrorLists(),o=e.filter(c=>c.type===f.E_IssueType.Error),r=e.filter(c=>c.type===f.E_IssueType.Warning);!o.length&&!r.length?s.log.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(h("Warnings",r),h("Errors",o),o.length>0&&g.exit(1))}),0)})}function T(){return t(this,null,function*(){yield i.clearAllErrorLists();const e=yield y.getPackage({name:n.CYBERSKILL_PACKAGE_NAME});if(!e.success){s.log.error("Failed to retrieve package information. Aborting lint-staged.");return}e.result.isCurrentProject&&(yield i.runCommand(`Building package: ${n.CYBERSKILL_PACKAGE_NAME}`,yield n.command.build())),yield i.runCommand("Executing lint-staged",yield n.command.lintStaged()),u()})}function A(){return t(this,null,function*(){yield i.runCommand("Inspecting ESLint configuration",yield n.command.eslintInspect())})}function M(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield Promise.all([C(),S()]),u()})}function O(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield Promise.all([C(),S(!0)]),u()})}function G(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield i.runCommand("Validating commit message",yield n.command.commitLint()),u()})}function E(){return t(this,null,function*(){yield i.runCommand("Configuring Git hooks",yield n.command.configureGitHook()),l.removeSync(n.PATH.GIT_HOOK);const e=yield i.resolveCommands(n.createGitHooksConfig);l.writeFileSync(n.PATH.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(e,null,4));const o=`
2
+ "use strict";const u=require("node:process"),I=require("yargs/helpers"),T=require("yargs/yargs"),i=require("../command/command.util.cjs"),y=require("../package/package.util.cjs"),a=require("../fs/fs.util.cjs"),v=require("../path/path.util.cjs"),n=require("../path/path.constant.cjs"),c=require("../log/log.util.cjs"),f=require("../log/log.type.cjs");var t=(e,o,r)=>new Promise((l,p)=>{var k=s=>{try{m(r.next(s))}catch(g){p(g)}},_=s=>{try{m(r.throw(s))}catch(g){p(g)}},m=s=>s.done?l(s.value):Promise.resolve(s.value).then(k,_);m((r=r.apply(e,o)).next())});function L(){try{return JSON.parse(a.readFileSync(v.resolve(__dirname,"../../../package.json"),"utf-8")).version}catch(e){return"1.0.0"}}function E(){return t(this,null,function*(){a.pathExistsSync(n.PATH.TS_CONFIG)?yield i.runCommand("Performing TypeScript validation",yield n.command.typescriptCheck()):c.log.warn("No TypeScript configuration found. Skipping type check.")})}function S(e=!1){return t(this,null,function*(){const o=e?yield n.command.eslintFix():yield n.command.eslintCheck(),r=e?"Running ESLint with auto-fix":"Running ESLint check";try{yield i.runCommand(r,o,{timeout:6e4,throwOnError:!0})}catch(l){l.code==="ETIMEDOUT"||l.killed||l.signal==="SIGTERM"?(c.log.warn("Lint check timed out. Retrying with debug mode enabled..."),u.env.DEBUG="true",yield i.runCommand(`${r} (Debug Mode)`,o)):c.catchError(l)}})}function h(e,o){if(!o.length)return;const r=e==="Errors"?"red":"yellow";c.log.printBoxedLog(e==="Errors"?"✖ Errors":"⚠ Warnings",o,r)}function d(){return t(this,null,function*(){setTimeout(()=>t(null,null,function*(){const e=(yield i.getStoredErrorLists())||[],o=e.filter(l=>l.type===f.E_IssueType.Error),r=e.filter(l=>l.type===f.E_IssueType.Warning);!o.length&&!r.length?c.log.printBoxedLog("✔ NO ISSUES FOUND",[],"green"):(h("Warnings",r),h("Errors",o),o.length>0&&u.exit(1))}),0)})}function M(){return t(this,null,function*(){yield i.clearAllErrorLists();const e=yield y.getPackage({name:n.CYBERSKILL_PACKAGE_NAME});if(!e.success){c.log.error("Failed to retrieve package information. Aborting lint-staged.");return}e.result.isCurrentProject&&(yield i.runCommand(`Building package: ${n.CYBERSKILL_PACKAGE_NAME}`,yield n.command.build())),yield i.runCommand("Executing lint-staged",yield n.command.lintStaged()),d()})}function O(){return t(this,null,function*(){yield i.runCommand("Inspecting ESLint configuration",yield n.command.eslintInspect())})}function P(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield E(),yield S(),d()})}function A(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield E(),yield S(!0),d()})}function R(){return t(this,null,function*(){yield i.clearAllErrorLists(),yield i.runCommand("Validating commit message",yield n.command.commitLint()),d()})}function C(){return t(this,null,function*(){yield i.runCommand("Configuring Git hooks",yield n.command.configureGitHook()),a.removeSync(n.PATH.GIT_HOOK);const e=yield i.resolveCommands(n.createGitHooksConfig);a.writeFileSync(n.PATH.SIMPLE_GIT_HOOKS_JSON,JSON.stringify(e,null,4));const o=`
3
3
  ${n.SIMPLE_GIT_HOOK_JSON}
4
- `;l.pathExistsSync(n.PATH.GIT_IGNORE)?l.readFileSync(n.PATH.GIT_IGNORE,"utf-8").split(`
5
- `).includes(n.SIMPLE_GIT_HOOK_JSON)||l.appendFileSync(n.PATH.GIT_IGNORE,o):l.writeFileSync(n.PATH.GIT_IGNORE,o),yield i.runCommand("Setting up simple-git-hooks",yield n.command.simpleGitHooks())})}function R(){return t(this,null,function*(){yield y.installDependencies(),yield E()})}function N(){return t(this,null,function*(){l.removeSync(n.PATH.NODE_MODULES,n.PATH.PNPM_LOCK_YAML),yield i.runCommand("Pruning pnpm store",yield n.command.pnpmPruneStore()),yield i.runCommand("Clearing pnpm cache",yield n.command.pnpmCleanCache()),yield y.installDependencies(),yield E()})}function b(){return t(this,null,function*(){yield i.runCommand("Inspecting project dependencies",yield n.command.nodeModulesInspect())})}function B(){return t(this,null,function*(){yield i.runCommand("Running unit tests",yield n.command.testUnit())})}function H(){return t(this,null,function*(){yield i.runCommand("Running end-to-end tests",yield n.command.testE2e())})}function D(e){return t(this,null,function*(){yield i.runCommand("Creating MongoDB migration",yield n.command.mongoMigrateCreate(e))})}function w(){return t(this,null,function*(){yield i.runCommand("Running MongoDB migrations",yield n.command.mongoMigrateUp())})}function x(){return t(this,null,function*(){yield i.runCommand("Rolling back MongoDB migration",yield n.command.mongoMigrateDown())})}function q(){return t(this,null,function*(){yield i.runCommand("Starting Storybook development server",yield n.command.storybookDev())})}function F(){return t(this,null,function*(){yield i.runCommand("Building Storybook",yield n.command.storybookBuild())})}t(null,null,function*(){try{yield v(I.hideBin(g.argv)).scriptName(n.CYBERSKILL_CLI).usage("$0 <command> [options]").command("lint","Check code for linting issues",M).command("lint:fix","Fix linting issues automatically",O).command("lint:inspect","View active ESLint configuration",A).command("lint-staged","Run lint checks on staged files",T).command("commitlint","Validate commit message format",G).command("ready","Initialize project and dependencies",R).command("reset","Reset the project and reinstall dependencies",N).command("inspect","Analyze installed project dependencies",b).command("test:unit","Run unit test suite",B).command("test:e2e","Run end-to-end test suite",H).command("mongo:migrate:create <name>","Create a MongoDB migration",e=>e.positional("name",{describe:"Migration name",type:"string"}),e=>t(null,null,function*(){if(!e.name){s.log.error("Migration name is required.");return}yield D(e.name)})).command("mongo:migrate:up","Apply all MongoDB migrations",w).command("mongo:migrate:down","Rollback last MongoDB migration",x).command("storybook:dev","Start Storybook development server",q).command("storybook:build","Build Storybook for production",F).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(P()).epilog(`💡 Tip: Use "--help" with any command to see options
6
- `).parse()}catch(e){s.catchError(e),g.exit(1)}});
4
+ `;a.pathExistsSync(n.PATH.GIT_IGNORE)?a.readFileSync(n.PATH.GIT_IGNORE,"utf-8").split(`
5
+ `).includes(n.SIMPLE_GIT_HOOK_JSON)||a.appendFileSync(n.PATH.GIT_IGNORE,o):a.writeFileSync(n.PATH.GIT_IGNORE,o),yield i.runCommand("Setting up simple-git-hooks",yield n.command.simpleGitHooks())})}function G(){return t(this,null,function*(){yield y.installDependencies(),yield C()})}function b(){return t(this,null,function*(){a.removeSync(n.PATH.NODE_MODULES,n.PATH.PNPM_LOCK_YAML),yield i.runCommand("Pruning pnpm store",yield n.command.pnpmPruneStore()),yield i.runCommand("Clearing pnpm cache",yield n.command.pnpmCleanCache()),yield y.installDependencies(),yield C()})}function D(){return t(this,null,function*(){yield i.runCommand("Inspecting project dependencies",yield n.command.nodeModulesInspect())})}function B(){return t(this,null,function*(){yield i.runCommand("Running unit tests",yield n.command.testUnit())})}function N(){return t(this,null,function*(){yield i.runCommand("Running end-to-end tests",yield n.command.testE2e())})}function w(e){return t(this,null,function*(){yield i.runCommand("Creating MongoDB migration",yield n.command.mongoMigrateCreate(e))})}function H(){return t(this,null,function*(){yield i.runCommand("Running MongoDB migrations",yield n.command.mongoMigrateUp())})}function q(){return t(this,null,function*(){yield i.runCommand("Rolling back MongoDB migration",yield n.command.mongoMigrateDown())})}function x(){return t(this,null,function*(){yield i.runCommand("Starting Storybook development server",yield n.command.storybookDev())})}function F(){return t(this,null,function*(){yield i.runCommand("Building Storybook",yield n.command.storybookBuild())})}t(null,null,function*(){try{yield T(I.hideBin(u.argv)).scriptName(n.CYBERSKILL_CLI).usage("$0 <command> [options]").command("lint","Check code for linting issues",P).command("lint:fix","Fix linting issues automatically",A).command("lint:inspect","View active ESLint configuration",O).command("lint-staged","Run lint checks on staged files",M).command("commitlint","Validate commit message format",R).command("ready","Initialize project and dependencies",G).command("reset","Reset the project and reinstall dependencies",b).command("inspect","Analyze installed project dependencies",D).command("test:unit","Run unit test suite",B).command("test:e2e","Run end-to-end test suite",N).command("mongo:migrate:create <name>","Create a MongoDB migration",e=>e.positional("name",{describe:"Migration name",type:"string"}),e=>t(null,null,function*(){if(!e.name){c.log.error("Migration name is required.");return}yield w(e.name)})).command("mongo:migrate:up","Apply all MongoDB migrations",H).command("mongo:migrate:down","Rollback last MongoDB migration",q).command("storybook:dev","Start Storybook development server",x).command("storybook:build","Build Storybook for production",F).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").version(L()).epilog(`💡 Tip: Use "--help" with any command to see options
6
+ `).parse()}catch(e){c.catchError(e),u.exit(1)}});
@@ -1,34 +1,34 @@
1
1
  #!/usr/bin/env node
2
- import y from "node:process";
3
- import { hideBin as b } from "yargs/helpers";
4
- import B from "yargs/yargs";
5
- import { clearAllErrorLists as a, runCommand as i, getStoredErrorLists as N, resolveCommands as P } from "../command/command.util.js";
6
- import { getPackage as D, installDependencies as v } from "../package/package.util.js";
7
- import { removeSync as I, readFileSync as C, pathExistsSync as _, writeFileSync as f, appendFileSync as T } from "../fs/fs.util.js";
8
- import { resolve as w } from "../path/path.util.js";
9
- import { CYBERSKILL_CLI as x, command as t, CYBERSKILL_PACKAGE_NAME as h, PATH as l, SIMPLE_GIT_HOOK_JSON as k, createGitHooksConfig as A } from "../path/path.constant.js";
10
- import { log as u, catchError as F } from "../log/log.util.js";
11
- import { E_IssueType as S } from "../log/log.type.js";
12
- var e = (n, o, r) => new Promise((c, p) => {
13
- var R = (s) => {
2
+ import a from "node:process";
3
+ import { hideBin as T } from "yargs/helpers";
4
+ import D from "yargs/yargs";
5
+ import { clearAllErrorLists as d, runCommand as i, getStoredErrorLists as B, resolveCommands as w } from "../command/command.util.js";
6
+ import { getPackage as N, installDependencies as I } from "../package/package.util.js";
7
+ import { removeSync as v, readFileSync as C, pathExistsSync as M, writeFileSync as f, appendFileSync as P } from "../fs/fs.util.js";
8
+ import { resolve as x } from "../path/path.util.js";
9
+ import { CYBERSKILL_CLI as U, command as t, CYBERSKILL_PACKAGE_NAME as h, PATH as s, SIMPLE_GIT_HOOK_JSON as k, createGitHooksConfig as A } from "../path/path.constant.js";
10
+ import { log as u, catchError as _ } from "../log/log.util.js";
11
+ import { E_IssueType as E } from "../log/log.type.js";
12
+ var e = (n, o, r) => new Promise((l, p) => {
13
+ var b = (c) => {
14
14
  try {
15
- m(r.next(s));
16
- } catch (g) {
17
- p(g);
15
+ g(r.next(c));
16
+ } catch (y) {
17
+ p(y);
18
18
  }
19
- }, G = (s) => {
19
+ }, G = (c) => {
20
20
  try {
21
- m(r.throw(s));
22
- } catch (g) {
23
- p(g);
21
+ g(r.throw(c));
22
+ } catch (y) {
23
+ p(y);
24
24
  }
25
- }, m = (s) => s.done ? c(s.value) : Promise.resolve(s.value).then(R, G);
26
- m((r = r.apply(n, o)).next());
25
+ }, g = (c) => c.done ? l(c.value) : Promise.resolve(c.value).then(b, G);
26
+ g((r = r.apply(n, o)).next());
27
27
  });
28
- function H() {
28
+ function F() {
29
29
  try {
30
30
  return JSON.parse(
31
- C(w(__dirname, "../../../package.json"), "utf-8")
31
+ C(x(__dirname, "../../../package.json"), "utf-8")
32
32
  ).version;
33
33
  } catch (n) {
34
34
  return "1.0.0";
@@ -36,37 +36,42 @@ function H() {
36
36
  }
37
37
  function L() {
38
38
  return e(this, null, function* () {
39
- _(l.TS_CONFIG) ? yield i("Performing TypeScript validation", yield t.typescriptCheck()) : u.warn("No TypeScript configuration found. Skipping type check.");
39
+ M(s.TS_CONFIG) ? yield i("Performing TypeScript validation", yield t.typescriptCheck()) : u.warn("No TypeScript configuration found. Skipping type check.");
40
40
  });
41
41
  }
42
- function M(n = !1) {
42
+ function O(n = !1) {
43
43
  return e(this, null, function* () {
44
- n ? yield i("Running ESLint with auto-fix", yield t.eslintFix()) : yield i("Running ESLint check", yield t.eslintCheck());
44
+ const o = n ? yield t.eslintFix() : yield t.eslintCheck(), r = n ? "Running ESLint with auto-fix" : "Running ESLint check";
45
+ try {
46
+ yield i(r, o, { timeout: 6e4, throwOnError: !0 });
47
+ } catch (l) {
48
+ l.code === "ETIMEDOUT" || l.killed || l.signal === "SIGTERM" ? (u.warn("Lint check timed out. Retrying with debug mode enabled..."), a.env.DEBUG = "true", yield i(`${r} (Debug Mode)`, o)) : _(l);
49
+ }
45
50
  });
46
51
  }
47
- function E(n, o) {
52
+ function S(n, o) {
48
53
  if (!o.length)
49
54
  return;
50
55
  const r = n === "Errors" ? "red" : "yellow";
51
56
  u.printBoxedLog(n === "Errors" ? "✖ Errors" : "⚠ Warnings", o, r);
52
57
  }
53
- function d() {
58
+ function m() {
54
59
  return e(this, null, function* () {
55
60
  setTimeout(() => e(null, null, function* () {
56
- const n = yield N(), o = n.filter((c) => c.type === S.Error), r = n.filter((c) => c.type === S.Warning);
57
- !o.length && !r.length ? u.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (E("Warnings", r), E("Errors", o), o.length > 0 && y.exit(1));
61
+ const n = (yield B()) || [], o = n.filter((l) => l.type === E.Error), r = n.filter((l) => l.type === E.Warning);
62
+ !o.length && !r.length ? u.printBoxedLog("✔ NO ISSUES FOUND", [], "green") : (S("Warnings", r), S("Errors", o), o.length > 0 && a.exit(1));
58
63
  }), 0);
59
64
  });
60
65
  }
61
- function U() {
66
+ function H() {
62
67
  return e(this, null, function* () {
63
- yield a();
64
- const n = yield D({ name: h });
68
+ yield d();
69
+ const n = yield N({ name: h });
65
70
  if (!n.success) {
66
71
  u.error("Failed to retrieve package information. Aborting lint-staged.");
67
72
  return;
68
73
  }
69
- n.result.isCurrentProject && (yield i(`Building package: ${h}`, yield t.build())), yield i("Executing lint-staged", yield t.lintStaged()), d();
74
+ n.result.isCurrentProject && (yield i(`Building package: ${h}`, yield t.build())), yield i("Executing lint-staged", yield t.lintStaged()), m();
70
75
  });
71
76
  }
72
77
  function K() {
@@ -76,42 +81,42 @@ function K() {
76
81
  }
77
82
  function j() {
78
83
  return e(this, null, function* () {
79
- yield a(), yield Promise.all([L(), M()]), d();
84
+ yield d(), yield L(), yield O(), m();
80
85
  });
81
86
  }
82
87
  function J() {
83
88
  return e(this, null, function* () {
84
- yield a(), yield Promise.all([L(), M(!0)]), d();
89
+ yield d(), yield L(), yield O(!0), m();
85
90
  });
86
91
  }
87
92
  function V() {
88
93
  return e(this, null, function* () {
89
- yield a(), yield i("Validating commit message", yield t.commitLint()), d();
94
+ yield d(), yield i("Validating commit message", yield t.commitLint()), m();
90
95
  });
91
96
  }
92
- function O() {
97
+ function R() {
93
98
  return e(this, null, function* () {
94
- yield i("Configuring Git hooks", yield t.configureGitHook()), I(l.GIT_HOOK);
95
- const n = yield P(A);
96
- f(l.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4));
99
+ yield i("Configuring Git hooks", yield t.configureGitHook()), v(s.GIT_HOOK);
100
+ const n = yield w(A);
101
+ f(s.SIMPLE_GIT_HOOKS_JSON, JSON.stringify(n, null, 4));
97
102
  const o = `
98
103
  ${k}
99
104
  `;
100
- _(l.GIT_IGNORE) ? C(l.GIT_IGNORE, "utf-8").split(`
101
- `).includes(k) || T(l.GIT_IGNORE, o) : f(l.GIT_IGNORE, o), yield i("Setting up simple-git-hooks", yield t.simpleGitHooks());
105
+ M(s.GIT_IGNORE) ? C(s.GIT_IGNORE, "utf-8").split(`
106
+ `).includes(k) || P(s.GIT_IGNORE, o) : f(s.GIT_IGNORE, o), yield i("Setting up simple-git-hooks", yield t.simpleGitHooks());
102
107
  });
103
108
  }
104
- function W() {
109
+ function $() {
105
110
  return e(this, null, function* () {
106
- yield v(), yield O();
111
+ yield I(), yield R();
107
112
  });
108
113
  }
109
- function Y() {
114
+ function W() {
110
115
  return e(this, null, function* () {
111
- I(l.NODE_MODULES, l.PNPM_LOCK_YAML), yield i("Pruning pnpm store", yield t.pnpmPruneStore()), yield i("Clearing pnpm cache", yield t.pnpmCleanCache()), yield v(), yield O();
116
+ v(s.NODE_MODULES, s.PNPM_LOCK_YAML), yield i("Pruning pnpm store", yield t.pnpmPruneStore()), yield i("Clearing pnpm cache", yield t.pnpmCleanCache()), yield I(), yield R();
112
117
  });
113
118
  }
114
- function $() {
119
+ function Y() {
115
120
  return e(this, null, function* () {
116
121
  yield i("Inspecting project dependencies", yield t.nodeModulesInspect());
117
122
  });
@@ -153,7 +158,7 @@ function en() {
153
158
  }
154
159
  e(null, null, function* () {
155
160
  try {
156
- yield B(b(y.argv)).scriptName(x).usage("$0 <command> [options]").command("lint", "Check code for linting issues", j).command("lint:fix", "Fix linting issues automatically", J).command("lint:inspect", "View active ESLint configuration", K).command("lint-staged", "Run lint checks on staged files", U).command("commitlint", "Validate commit message format", V).command("ready", "Initialize project and dependencies", W).command("reset", "Reset the project and reinstall dependencies", Y).command("inspect", "Analyze installed project dependencies", $).command("test:unit", "Run unit test suite", z).command("test:e2e", "Run end-to-end test suite", q).command("mongo:migrate:create <name>", "Create a MongoDB migration", (n) => n.positional("name", {
161
+ yield D(T(a.argv)).scriptName(U).usage("$0 <command> [options]").command("lint", "Check code for linting issues", j).command("lint:fix", "Fix linting issues automatically", J).command("lint:inspect", "View active ESLint configuration", K).command("lint-staged", "Run lint checks on staged files", H).command("commitlint", "Validate commit message format", V).command("ready", "Initialize project and dependencies", $).command("reset", "Reset the project and reinstall dependencies", W).command("inspect", "Analyze installed project dependencies", Y).command("test:unit", "Run unit test suite", z).command("test:e2e", "Run end-to-end test suite", q).command("mongo:migrate:create <name>", "Create a MongoDB migration", (n) => n.positional("name", {
157
162
  describe: "Migration name",
158
163
  type: "string"
159
164
  }), (n) => e(null, null, function* () {
@@ -162,9 +167,9 @@ e(null, null, function* () {
162
167
  return;
163
168
  }
164
169
  yield Q(n.name);
165
- })).command("mongo:migrate:up", "Apply all MongoDB migrations", X).command("mongo:migrate:down", "Rollback last MongoDB migration", Z).command("storybook:dev", "Start Storybook development server", nn).command("storybook:build", "Build Storybook for production", en).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(H()).epilog(`💡 Tip: Use "--help" with any command to see options
170
+ })).command("mongo:migrate:up", "Apply all MongoDB migrations", X).command("mongo:migrate:down", "Rollback last MongoDB migration", Z).command("storybook:dev", "Start Storybook development server", nn).command("storybook:build", "Build Storybook for production", en).demandCommand(1, "Please specify a valid command.").strict().help().alias("h", "help").alias("v", "version").version(F()).epilog(`💡 Tip: Use "--help" with any command to see options
166
171
  `).parse();
167
172
  } catch (n) {
168
- F(n), y.exit(1);
173
+ _(n), a.exit(1);
169
174
  }
170
175
  });
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("node:child_process"),b=require("node:process"),q=require("node:util"),y=require("../storage/storage.util.cjs"),j=require("../package/package.util.cjs"),p=require("../path/path.constant.cjs"),a=require("../log/log.type.cjs"),u=require("../log/log.util.cjs"),M=require("../../config/env/env.util.cjs");function A(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const D=A(q);var h=(e,r,t)=>new Promise((o,i)=>{var l=s=>{try{n(t.next(s))}catch(f){i(f)}},c=s=>{try{n(t.throw(s))}catch(f){i(f)}},n=s=>s.done?o(s.value):Promise.resolve(s.value).then(l,c);n((t=t.apply(e,r)).next())});const k=M.getEnv(),B=D.promisify(N.exec);function E(){return h(this,null,function*(){const e=yield j.getPackage();return e.success?e.result.name:Date.now().toString()})}function O(e){return h(this,null,function*(){if(e.length===0)return;const r=yield E();try{yield y.storage.set(r,e),setTimeout(()=>h(null,null,function*(){const t=yield y.storage.getLogLink(r);t&&u.log.info(`📂 Open the error list manually: ${t}`)}),0)}catch(t){u.catchError(t)}})}function R(){return h(this,null,function*(){try{const e=yield E(),r=yield y.storage.get(e);return r!=null?r:[]}catch(e){return u.catchError(e,{returnValue:[]})}})}function G(){return h(this,null,function*(){try{const e=yield E();yield y.storage.remove(e)}catch(e){u.catchError(e)}})}function K(e){const r=[],t=[];let o="";const i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,l=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split(`
2
- `).forEach(n=>{var s,f,_,v,C,$,L,P,I,T,S;if(n.startsWith("/"))o=n.trim();else{const g=i.exec(n)||[],d=l.exec(n)||[],m=c.exec(n)||[];g.length&&o?r.push({file:o,position:`${g[1]}:${g[2]}`,type:g[3]===a.E_IssueType.Error?a.E_IssueType.Error:a.E_IssueType.Warning,message:(f=(s=g==null?void 0:g[4])==null?void 0:s.trim())!=null?f:"",rule:(v=(_=g==null?void 0:g[5])==null?void 0:_.trim())!=null?v:""}):d.length?r.push({file:(C=d==null?void 0:d[1])!=null?C:"",position:`${d[2]}:${d[3]}`,type:d[4]===a.E_IssueType.Error?a.E_IssueType.Error:a.E_IssueType.Warning,message:(L=($=d==null?void 0:d[5])==null?void 0:$.trim())!=null?L:""}):m.length?r.push({file:"commitlint",type:a.E_IssueType.Error,message:(I=(P=m==null?void 0:m[1])==null?void 0:P.trim())!=null?I:"",rule:(S=(T=m==null?void 0:m[2])==null?void 0:T.trim())!=null?S:""}):t.push(n.trim())}}),r.length&&O(r),k.DEBUG&&t.length&&(u.log.warn("Unmatched lines:"),t.forEach(n=>u.log.info(` ${n}`)))}function W(e){try{const r=JSON.parse(e),t=[];r.forEach(({filePath:o,messages:i})=>{i.forEach(({severity:l,line:c,column:n,ruleId:s,message:f})=>{t.push({type:l===2?a.E_IssueType.Error:a.E_IssueType.Warning,file:o,position:`${c}:${n}`,rule:s,message:f})})}),t.length&&O(t)}catch(r){K(e)}}function U(e){return h(this,arguments,function*(r,t=W){const o=new AbortController;b.on("SIGINT",()=>{u.log.warn("Process interrupted. Terminating..."),o.abort(),b.exit()});try{if(typeof r=="string"){const{stdout:i,stderr:l}=yield B(r,{maxBuffer:104857600,signal:o.signal});[i,l].forEach(c=>c&&t(c))}}catch(i){const{stdout:l,stderr:c,message:n}=i;[l,c].forEach(s=>s&&t(s)),!c&&!l&&u.log.error(`Command failed: ${n}`)}})}function X(e){return{raw:!0,cmd:e}}function w(e,r){return r!=null&&r.isCurrentProject?`${p.PNPM_EXEC_CLI} ${p.TSX_CLI} ${p.CYBERSKILL_CLI_PATH} ${e}`:`${p.PNPM_EXEC_CLI} ${p.CYBERSKILL_CLI} ${e}`}function x(e,r){return typeof e=="function"?w(e(r),r):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?w(e,r):e}function Y(e){return h(this,null,function*(){const r=yield j.getPackage({name:p.CYBERSKILL_PACKAGE_NAME});if(r.success){const t={isCurrentProject:r.result.isCurrentProject},o=typeof e=="function"?e(t):e;return Object.fromEntries(Object.entries(o).map(([i,l])=>[i,x(l,t)]))}})}function z(e,r){return h(this,null,function*(){try{u.log.start(`${e}`),k.DEBUG&&u.log.info(`→ ${r}`),yield U(r),u.log.success(`${e} done.`)}catch(t){u.catchError(t)}})}exports.clearAllErrorLists=G;exports.formatCommand=x;exports.getStoredErrorLists=R;exports.rawCommand=X;exports.resolveCommands=Y;exports.runCommand=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("node:child_process"),p=require("node:process"),M=require("node:util"),E=require("../storage/storage.util.cjs"),b=require("../package/package.util.cjs"),h=require("../path/path.constant.cjs"),g=require("../log/log.type.cjs"),c=require("../log/log.util.cjs"),j=require("../../config/env/env.util.cjs");function B(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const A=B(M);var f=(e,r,t)=>new Promise((o,s)=>{var i=u=>{try{n(t.next(u))}catch(a){s(a)}},l=u=>{try{n(t.throw(u))}catch(a){s(a)}},n=u=>u.done?o(u.value):Promise.resolve(u.value).then(i,l);n((t=t.apply(e,r)).next())});const K=A.promisify(D.exec);function _(){return f(this,null,function*(){const e=yield b.getPackage();return e.success?e.result.name:Date.now().toString()})}function k(e){return f(this,null,function*(){if(e.length===0)return;const r=yield _();try{const o=[...yield O(),...e];yield E.storage.set(r,o),setTimeout(()=>f(null,null,function*(){const s=yield E.storage.getLogLink(r);s&&c.log.info(`📂 Open the error list manually: ${s}`)}),0)}catch(t){c.catchError(t)}})}function O(){return f(this,null,function*(){try{const e=yield _(),r=yield E.storage.get(e);return r!=null?r:[]}catch(e){return c.catchError(e,{returnValue:[]})}})}function R(){return f(this,null,function*(){try{const e=yield _();yield E.storage.remove(e)}catch(e){c.catchError(e)}})}function G(e){return f(this,null,function*(){const r=[],t=[];let o="";const s=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,l=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split(`
2
+ `).forEach(n=>{var u,a,v,C,$,I,P,L,w,T,S;if(n.startsWith("/"))o=n.trim();else{const d=s.exec(n)||[],m=i.exec(n)||[],y=l.exec(n)||[];d.length&&o?r.push({file:o,position:`${d[1]}:${d[2]}`,type:d[3]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(a=(u=d==null?void 0:d[4])==null?void 0:u.trim())!=null?a:"",rule:(C=(v=d==null?void 0:d[5])==null?void 0:v.trim())!=null?C:""}):m.length?r.push({file:($=m==null?void 0:m[1])!=null?$:"",position:`${m[2]}:${m[3]}`,type:m[4]===g.E_IssueType.Error?g.E_IssueType.Error:g.E_IssueType.Warning,message:(P=(I=m==null?void 0:m[5])==null?void 0:I.trim())!=null?P:""}):y.length?r.push({file:"commitlint",type:g.E_IssueType.Error,message:(w=(L=y==null?void 0:y[1])==null?void 0:L.trim())!=null?w:"",rule:(S=(T=y==null?void 0:y[2])==null?void 0:T.trim())!=null?S:""}):t.push(n.trim())}}),r.length&&(yield k(r)),j.getEnv().DEBUG&&t.length&&(c.log.warn("Unmatched lines:"),t.forEach(n=>c.log.info(` ${n}`)))})}function N(e){return f(this,null,function*(){try{const r=JSON.parse(e),t=[];r.forEach(({filePath:o,messages:s})=>{s.forEach(({severity:i,line:l,column:n,ruleId:u,message:a})=>{t.push({type:i===2?g.E_IssueType.Error:g.E_IssueType.Warning,file:o,position:`${l}:${n}`,rule:u,message:a})})}),t.length&&(yield k(t))}catch(r){yield G(e)}})}function W(e){return f(this,arguments,function*(r,t=N,o={}){const s=new AbortController;p.on("SIGINT",()=>{c.log.warn("Process interrupted. Terminating..."),s.abort(),p.exit()});try{if(typeof r=="string"){const{stdout:i,stderr:l}=yield K(r,{maxBuffer:104857600,signal:s.signal,timeout:o.timeout});yield Promise.all([i,l].map(n=>n&&t(n)))}}catch(i){const{stdout:l,stderr:n,message:u}=i;yield Promise.all([l,n].map(a=>a&&t(a))),!n&&!l&&c.log.error(`Command failed: ${u}`)}})}function U(e){return{raw:!0,cmd:e}}function x(e,r){return r!=null&&r.isCurrentProject?`${h.PNPM_EXEC_CLI} ${h.TSX_CLI} ${h.CYBERSKILL_CLI_PATH} ${e}`:`${h.PNPM_EXEC_CLI} ${h.CYBERSKILL_CLI} ${e}`}function q(e,r){return typeof e=="function"?x(e(r),r):typeof e=="object"&&(e==null?void 0:e.raw)===!0?e.cmd:typeof e=="string"?x(e,r):e}function X(e){return f(this,null,function*(){const r=yield b.getPackage({name:h.CYBERSKILL_PACKAGE_NAME});if(r.success){const t={isCurrentProject:r.result.isCurrentProject},o=typeof e=="function"?e(t):e;return Object.fromEntries(Object.entries(o).map(([s,i])=>[s,q(i,t)]))}})}function Y(e,r){return f(this,arguments,function*(t,o,s={}){let i;try{const l=Date.now();c.log.start(`${t}`),j.getEnv().DEBUG?c.log.info(`→ ${o}`):i=setInterval(()=>{const n=Math.floor((Date.now()-l)/1e3);n>0&&p.stdout.write(`\r⏳ ${t}... ${n}s`)},100),yield W(o,N,s),i&&(clearInterval(i),p.stdout.write("\r\x1B[K")),c.log.success(`${t} done.`)}catch(l){if(i&&(clearInterval(i),p.stdout.write("\r\x1B[K")),s.throwOnError)throw l;c.catchError(l)}})}exports.clearAllErrorLists=R;exports.formatCommand=q;exports.getStoredErrorLists=O;exports.rawCommand=U;exports.resolveCommands=X;exports.runCommand=Y;
@@ -60,4 +60,7 @@ export declare function resolveCommands(input: T_CommandMapInput): Promise<{
60
60
  * @param command - The command string to execute, or undefined if no command should be run.
61
61
  * @returns A promise that resolves when the command execution is complete.
62
62
  */
63
- export declare function runCommand(label: string, command: string | void): Promise<void>;
63
+ export declare function runCommand(label: string, command: string | void, options?: {
64
+ timeout?: number;
65
+ throwOnError?: boolean;
66
+ }): Promise<void>;