@cyberskill/shared 1.46.0 → 1.48.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 (134) hide show
  1. package/README.md +12 -18
  2. package/dist/_tsup-dts-rollup.d.cts +413 -31
  3. package/dist/_tsup-dts-rollup.d.ts +413 -31
  4. package/dist/cli.cjs +2136 -1
  5. package/dist/cli.d.cts +2 -1
  6. package/dist/cli.d.ts +2 -1
  7. package/dist/cli.js +2056 -1
  8. package/dist/configs/commitlint/base.cjs +64 -1
  9. package/dist/configs/commitlint/base.js +7 -1
  10. package/dist/configs/eslint/base.cjs +121 -1
  11. package/dist/configs/eslint/base.js +52 -1
  12. package/dist/configs/eslint/nestjs.cjs +155 -1
  13. package/dist/configs/eslint/nestjs.js +85 -1
  14. package/dist/configs/eslint/nextjs.cjs +155 -1
  15. package/dist/configs/eslint/nextjs.js +85 -1
  16. package/dist/configs/eslint/nodejs.cjs +156 -1
  17. package/dist/configs/eslint/nodejs.js +86 -1
  18. package/dist/configs/eslint/vite-react.cjs +159 -1
  19. package/dist/configs/eslint/vite-react.js +89 -1
  20. package/dist/configs/graphql/graphql-codegen.cjs +125 -1
  21. package/dist/configs/graphql/graphql-codegen.js +64 -1
  22. package/dist/configs/graphql/index.cjs +126 -1
  23. package/dist/configs/graphql/index.js +64 -1
  24. package/dist/configs/i18n/react/i18next.cjs +80 -1
  25. package/dist/configs/i18n/react/i18next.js +7 -1
  26. package/dist/configs/i18n/react/index.cjs +81 -1
  27. package/dist/configs/i18n/react/index.js +7 -1
  28. package/dist/configs/index.cjs +232 -1
  29. package/dist/configs/index.js +166 -1
  30. package/dist/configs/lint-staged/base.cjs +64 -1
  31. package/dist/configs/lint-staged/base.js +7 -1
  32. package/dist/configs/vitest/react/e2e.cjs +128 -1
  33. package/dist/configs/vitest/react/e2e.js +59 -1
  34. package/dist/configs/vitest/react/unit.cjs +305 -1
  35. package/dist/configs/vitest/react/unit.js +228 -1
  36. package/dist/configs/vitest/react/unit.setup.cjs +60 -1
  37. package/dist/configs/vitest/react/unit.setup.js +8 -1
  38. package/dist/constants/index.cjs +678 -1
  39. package/dist/constants/index.d.cts +31 -1
  40. package/dist/constants/index.d.ts +31 -1
  41. package/dist/constants/index.js +469 -1
  42. package/dist/constants/path.cjs +423 -1
  43. package/dist/constants/path.d.cts +31 -1
  44. package/dist/constants/path.d.ts +31 -1
  45. package/dist/constants/path.js +218 -1
  46. package/dist/constants/response-status.cjs +313 -1
  47. package/dist/constants/response-status.js +252 -1
  48. package/dist/index.cjs +4546 -1
  49. package/dist/index.d.cts +51 -6
  50. package/dist/index.d.ts +51 -6
  51. package/dist/index.js +4133 -1
  52. package/dist/nodejs/index.cjs +2138 -1
  53. package/dist/nodejs/index.js +2054 -1
  54. package/dist/nodejs/mongo.cjs +2137 -1
  55. package/dist/nodejs/mongo.js +2054 -1
  56. package/dist/react/apollo-client.cjs +177 -1
  57. package/dist/react/apollo-client.js +116 -1
  58. package/dist/react/index.cjs +990 -1
  59. package/dist/react/index.js +876 -1
  60. package/dist/react/loading.cjs +301 -1
  61. package/dist/react/loading.js +216 -1
  62. package/dist/react/next-intl.cjs +744 -1
  63. package/dist/react/next-intl.js +655 -1
  64. package/dist/react/storage.cjs +631 -1
  65. package/dist/react/storage.js +558 -1
  66. package/dist/typescript/api-response.cjs +48 -1
  67. package/dist/typescript/apollo.cjs +48 -1
  68. package/dist/typescript/command.cjs +68 -1
  69. package/dist/typescript/command.d.cts +4 -0
  70. package/dist/typescript/command.d.ts +4 -0
  71. package/dist/typescript/command.js +7 -1
  72. package/dist/typescript/config.cjs +48 -1
  73. package/dist/typescript/fs.cjs +48 -0
  74. package/dist/typescript/fs.d.cts +1 -0
  75. package/dist/typescript/fs.d.ts +1 -0
  76. package/dist/typescript/fs.js +0 -0
  77. package/dist/typescript/graphql-codegen.cjs +48 -1
  78. package/dist/typescript/index.cjs +175 -1
  79. package/dist/typescript/index.d.cts +5 -0
  80. package/dist/typescript/index.d.ts +5 -0
  81. package/dist/typescript/index.js +151 -1
  82. package/dist/typescript/loading.cjs +48 -1
  83. package/dist/typescript/log.cjs +48 -1
  84. package/dist/typescript/mongo.cjs +164 -1
  85. package/dist/typescript/mongo.js +145 -1
  86. package/dist/typescript/next-intl.cjs +48 -1
  87. package/dist/typescript/react.cjs +48 -1
  88. package/dist/typescript/serializer.cjs +48 -1
  89. package/dist/typescript/string.cjs +48 -1
  90. package/dist/utils/command.cjs +1387 -1
  91. package/dist/utils/command.d.cts +2 -0
  92. package/dist/utils/command.d.ts +2 -0
  93. package/dist/utils/command.js +1287 -1
  94. package/dist/utils/common.cjs +300 -1
  95. package/dist/utils/common.js +219 -1
  96. package/dist/utils/config.cjs +146 -1
  97. package/dist/utils/config.js +89 -1
  98. package/dist/utils/fs.cjs +118 -1
  99. package/dist/utils/fs.d.cts +4 -1
  100. package/dist/utils/fs.d.ts +4 -1
  101. package/dist/utils/fs.js +37 -1
  102. package/dist/utils/index-nodejs.cjs +1738 -1
  103. package/dist/utils/index-nodejs.d.cts +15 -5
  104. package/dist/utils/index-nodejs.d.ts +15 -5
  105. package/dist/utils/index-nodejs.js +1571 -1
  106. package/dist/utils/index.cjs +727 -1
  107. package/dist/utils/index.js +625 -1
  108. package/dist/utils/log.cjs +330 -1
  109. package/dist/utils/log.js +269 -1
  110. package/dist/utils/package.cjs +941 -0
  111. package/dist/utils/package.d.cts +3 -0
  112. package/dist/utils/package.d.ts +3 -0
  113. package/dist/utils/package.js +857 -0
  114. package/dist/utils/path.cjs +291 -0
  115. package/dist/utils/path.d.cts +6 -0
  116. package/dist/utils/path.d.ts +6 -0
  117. package/dist/utils/path.js +191 -0
  118. package/dist/utils/serializer.cjs +91 -1
  119. package/dist/utils/serializer.js +30 -1
  120. package/dist/utils/storage-client.cjs +349 -1
  121. package/dist/utils/storage-client.js +276 -1
  122. package/dist/utils/storage-server.cjs +636 -1
  123. package/dist/utils/storage-server.d.cts +1 -1
  124. package/dist/utils/storage-server.d.ts +1 -1
  125. package/dist/utils/storage-server.js +550 -1
  126. package/dist/utils/string.cjs +152 -1
  127. package/dist/utils/string.js +75 -1
  128. package/dist/utils/validate.cjs +90 -1
  129. package/dist/utils/validate.js +33 -1
  130. package/package.json +19 -16
  131. package/dist/utils/npm-package.cjs +0 -1
  132. package/dist/utils/npm-package.d.cts +0 -4
  133. package/dist/utils/npm-package.d.ts +0 -4
  134. package/dist/utils/npm-package.js +0 -1
@@ -1 +1,550 @@
1
- function e(e,r,t,n,o,s,u){try{var i=e[s](u);var a=i.value}catch(e){t(e);return}if(i.done){r(a)}else{Promise.resolve(a).then(n,o)}}function r(r){return function(){var t=this,n=arguments;return new Promise(function(o,s){var u=r.apply(t,n);function i(r){e(u,o,s,i,a,"next",r)}function a(r){e(u,o,s,i,a,"throw",r)}i(undefined)})}}function t(e,r){var t,n,o,s,u={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return s={next:i(0),"throw":i(1),"return":i(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function i(e){return function(r){return a([e,r])}}function a(s){if(t)throw new TypeError("Generator is already executing.");while(u)try{if(t=1,n&&(o=s[0]&2?n["return"]:s[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;if(n=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:u.label++;return{value:s[1],done:false};case 5:u.label++;n=s[1];s=[0];continue;case 7:s=u.ops.pop();u.trys.pop();continue;default:if(!(o=u.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){u=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){u.label=s[1];break}if(s[0]===6&&u.label<o[1]){u.label=o[1];o=s;break}if(o&&u.label<o[2]){u.label=o[2];u.ops.push(s);break}if(o[2])u.ops.pop();u.trys.pop();continue}s=r.call(e,u)}catch(e){s=[6,e];n=0}finally{t=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}}import n from"node-persist";import o from"node:os";import s from"node:path";import u from"node:process";var i=u.env.CYBERSKILL_STORAGE_DIR||s.join(o.homedir(),".cyberskill-storage");function a(){return c.apply(this,arguments)}function c(){c=r(function(){var e;return t(this,function(r){switch(r.label){case 0:e=n.defaultInstance;if(e)return[3,2];return[4,n.init({dir:i,stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=r.sent();r.label=2;case 2:e;return[2]}})});return c.apply(this,arguments)}var l={get:function e(e){return r(function(){var r,o;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,a()];case 1:t.sent();return[4,n.getItem(e)];case 2:return[2,(r=t.sent())!==null&&r!==void 0?r:null];case 3:o=t.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),o),null)];case 4:return[2]}})})()},set:function e(e,o){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,a()];case 1:t.sent();return[4,n.setItem(e,o)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},remove:function e(e){return r(function(){var r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,a()];case 1:t.sent();return[4,n.removeItem(e)];case 2:t.sent();return[3,4];case 3:r=t.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),r);return[3,4];case 4:return[2]}})})()},keys:function e(){return r(function(){var e,r;return t(this,function(t){switch(t.label){case 0:t.trys.push([0,3,,4]);return[4,a()];case 1:t.sent();return[4,n.keys()];case 2:e=t.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:r=t.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",r),[])];case 4:return[2]}})})()},getLogLink:function e(e){return r(function(){return t(this,function(r){try{return[2,"".concat(i," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};export{a as initNodePersist,i as storageDir,l as storageServer};
1
+ // src/utils/storage-server.ts
2
+ function _array_like_to_array(arr, len) {
3
+ if (len == null || len > arr.length) len = arr.length;
4
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
5
+ return arr2;
6
+ }
7
+ function _array_without_holes(arr) {
8
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
9
+ }
10
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
+ try {
12
+ var info = gen[key](arg);
13
+ var value = info.value;
14
+ } catch (error) {
15
+ reject(error);
16
+ return;
17
+ }
18
+ if (info.done) {
19
+ resolve(value);
20
+ } else {
21
+ Promise.resolve(value).then(_next, _throw);
22
+ }
23
+ }
24
+ function _async_to_generator(fn) {
25
+ return function() {
26
+ var self = this, args = arguments;
27
+ return new Promise(function(resolve, reject) {
28
+ var gen = fn.apply(self, args);
29
+ function _next(value) {
30
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
+ }
32
+ function _throw(err) {
33
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
+ }
35
+ _next(undefined);
36
+ });
37
+ };
38
+ }
39
+ function _iterable_to_array(iter) {
40
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
41
+ }
42
+ function _non_iterable_spread() {
43
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
44
+ }
45
+ function _to_consumable_array(arr) {
46
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
47
+ }
48
+ function _type_of(obj) {
49
+ "@swc/helpers - typeof";
50
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
51
+ }
52
+ function _unsupported_iterable_to_array(o, minLen) {
53
+ if (!o) return;
54
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
55
+ var n = Object.prototype.toString.call(o).slice(8, -1);
56
+ if (n === "Object" && o.constructor) n = o.constructor.name;
57
+ if (n === "Map" || n === "Set") return Array.from(n);
58
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
59
+ }
60
+ function _ts_generator(thisArg, body) {
61
+ var f, y, t, g, _ = {
62
+ label: 0,
63
+ sent: function() {
64
+ if (t[0] & 1) throw t[1];
65
+ return t[1];
66
+ },
67
+ trys: [],
68
+ ops: []
69
+ };
70
+ return g = {
71
+ next: verb(0),
72
+ "throw": verb(1),
73
+ "return": verb(2)
74
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
75
+ return this;
76
+ }), g;
77
+ function verb(n) {
78
+ return function(v) {
79
+ return step([
80
+ n,
81
+ v
82
+ ]);
83
+ };
84
+ }
85
+ function step(op) {
86
+ if (f) throw new TypeError("Generator is already executing.");
87
+ while(_)try {
88
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
89
+ if (y = 0, t) op = [
90
+ op[0] & 2,
91
+ t.value
92
+ ];
93
+ switch(op[0]){
94
+ case 0:
95
+ case 1:
96
+ t = op;
97
+ break;
98
+ case 4:
99
+ _.label++;
100
+ return {
101
+ value: op[1],
102
+ done: false
103
+ };
104
+ case 5:
105
+ _.label++;
106
+ y = op[1];
107
+ op = [
108
+ 0
109
+ ];
110
+ continue;
111
+ case 7:
112
+ op = _.ops.pop();
113
+ _.trys.pop();
114
+ continue;
115
+ default:
116
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
117
+ _ = 0;
118
+ continue;
119
+ }
120
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
121
+ _.label = op[1];
122
+ break;
123
+ }
124
+ if (op[0] === 6 && _.label < t[1]) {
125
+ _.label = t[1];
126
+ t = op;
127
+ break;
128
+ }
129
+ if (t && _.label < t[2]) {
130
+ _.label = t[2];
131
+ _.ops.push(op);
132
+ break;
133
+ }
134
+ if (t[2]) _.ops.pop();
135
+ _.trys.pop();
136
+ continue;
137
+ }
138
+ op = body.call(thisArg, _);
139
+ } catch (e) {
140
+ op = [
141
+ 6,
142
+ e
143
+ ];
144
+ y = 0;
145
+ } finally{
146
+ f = t = 0;
147
+ }
148
+ if (op[0] & 5) throw op[1];
149
+ return {
150
+ value: op[0] ? op[1] : void 0,
151
+ done: true
152
+ };
153
+ }
154
+ }
155
+ import nodePersist from "node-persist";
156
+ import os from "node:os";
157
+ import path2 from "node:path";
158
+ import process3 from "node:process";
159
+ // src/constants/path.ts
160
+ import process2 from "node:process";
161
+ import { fileURLToPath } from "node:url";
162
+ // src/utils/command.ts
163
+ import boxen from "boxen";
164
+ import chalk from "chalk";
165
+ import { exec } from "node:child_process";
166
+ import process from "node:process";
167
+ import * as util from "node:util";
168
+ // src/utils/package.ts
169
+ import fetch from "node-fetch";
170
+ // src/utils/path.ts
171
+ import * as path from "node:path";
172
+ function resolveCyberSkillPath() {
173
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
174
+ urls[_key] = arguments[_key];
175
+ }
176
+ var _path;
177
+ return (_path = path).resolve.apply(_path, [
178
+ CYBERSKILL_DIRECTORY
179
+ ].concat(_to_consumable_array(urls)));
180
+ }
181
+ function resolveWorkingPath() {
182
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
183
+ urls[_key] = arguments[_key];
184
+ }
185
+ var _path;
186
+ return (_path = path).resolve.apply(_path, [
187
+ WORKING_DIRECTORY
188
+ ].concat(_to_consumable_array(urls)));
189
+ }
190
+ function resolve2() {
191
+ for(var _len = arguments.length, urls = new Array(_len), _key = 0; _key < _len; _key++){
192
+ urls[_key] = arguments[_key];
193
+ }
194
+ var _path;
195
+ return (_path = path).resolve.apply(_path, _to_consumable_array(urls));
196
+ }
197
+ function dirname2(url) {
198
+ return path.dirname(url);
199
+ }
200
+ // src/utils/package.ts
201
+ var CACHE_EXPIRATION_MS = 24 * 60 * 60 * 1e3;
202
+ // src/utils/command.ts
203
+ var DEBUG = process.env.DEBUG === "true";
204
+ var execPromise = util.promisify(exec);
205
+ var gray = chalk.gray, blue = chalk.blue;
206
+ var commandFormatter = {
207
+ raw: function(cmd) {
208
+ return {
209
+ raw: true,
210
+ cmd: cmd
211
+ };
212
+ },
213
+ isRaw: function isRaw(cmd) {
214
+ return (typeof cmd === "undefined" ? "undefined" : _type_of(cmd)) === "object" && cmd !== null && cmd.raw === true;
215
+ },
216
+ format: function format(command, context) {
217
+ if (typeof command === "function") {
218
+ return commandFormatter.formatCLI(command(context), context);
219
+ }
220
+ if (commandFormatter.isRaw(command)) {
221
+ return command.cmd;
222
+ }
223
+ return commandFormatter.formatCLI(command, context);
224
+ },
225
+ formatCLI: function formatCLI(command, context) {
226
+ if (context === null || context === void 0 ? void 0 : context.isRemote) {
227
+ return "".concat(PNPM_DLX_CLI, " ").concat(CYBERSKILL_PACKAGE_NAME, " ").concat(command);
228
+ }
229
+ if (context === null || context === void 0 ? void 0 : context.isCurrentProject) {
230
+ return "".concat(PNPM_EXEC_CLI, " ").concat(TSX_CLI, " src/cli.ts ").concat(command);
231
+ }
232
+ return "".concat(PNPM_EXEC_CLI, " ").concat(CYBERSKILL_CLI, " ").concat(command);
233
+ }
234
+ };
235
+ // src/constants/path.ts
236
+ var __filename2 = fileURLToPath(import.meta.url);
237
+ var __dirname2 = dirname2(__filename2);
238
+ var CYBERSKILL_DIRECTORY = resolve2(__dirname2, "../../");
239
+ var WORKING_DIRECTORY = process2.env.INIT_CWD || process2.cwd();
240
+ var CYBERSKILL_PACKAGE_NAME = "@cyberskill/shared";
241
+ var CYBERSKILL_STORAGE = ".cyberskill-storage";
242
+ var NODE_MODULES = "node_modules";
243
+ var BUILD_DIRECTORY = "dist";
244
+ var PACKAGE_JSON = "package.json";
245
+ var PACKAGE_LOCK_JSON = "package-lock.json";
246
+ var TSCONFIG_JSON = "tsconfig.json";
247
+ var GIT_IGNORE = ".gitignore";
248
+ var SIMPLE_GIT_HOOK_JSON = ".simple-git-hooks.json";
249
+ var PNPM_LOCK_YAML = "pnpm-lock.yaml";
250
+ var GIT_HOOK = ".git/hooks";
251
+ var GIT_COMMIT_EDITMSG = ".git/COMMIT_EDITMSG";
252
+ var CYBERSKILL_CLI = "cyberskill";
253
+ var ESLINT_CLI = "eslint";
254
+ var VITEST_CLI = "vitest";
255
+ var COMMIT_LINT_CLI = "commitlint";
256
+ var LINT_STAGED_CLI = "lint-staged";
257
+ var RIMRAF_CLI = "rimraf";
258
+ var TSC_CLI = "tsc";
259
+ var TSX_CLI = "tsx";
260
+ var GIT_CLI = "git";
261
+ var PNPM_CLI = "pnpm";
262
+ var PNPM_DLX_CLI = "pnpm dlx";
263
+ var PNPM_EXEC_CLI = "pnpm exec";
264
+ var SIMPLE_GIT_HOOK_CLI = "simple-git-hooks";
265
+ var ESLINT_INSPECT_CLI = "@eslint/config-inspector";
266
+ var NODE_MODULES_INSPECT_CLI = "node_modules-inspect";
267
+ var PATH = {
268
+ CYBERSKILL_DIRECTORY: CYBERSKILL_DIRECTORY,
269
+ WORKING_DIRECTORY: WORKING_DIRECTORY,
270
+ TS_CONFIG: resolveWorkingPath(TSCONFIG_JSON),
271
+ GIT_IGNORE: resolveWorkingPath(GIT_IGNORE),
272
+ GIT_HOOK: resolveWorkingPath(GIT_HOOK),
273
+ GIT_COMMIT_MSG: resolveWorkingPath(GIT_COMMIT_EDITMSG),
274
+ SIMPLE_GIT_HOOKS: resolveWorkingPath(SIMPLE_GIT_HOOK_JSON),
275
+ PACKAGE_JSON: resolveWorkingPath(PACKAGE_JSON),
276
+ PACKAGE_LOCK_JSON: resolveWorkingPath(PACKAGE_LOCK_JSON),
277
+ PNPM_LOCK_YAML: resolveWorkingPath(PNPM_LOCK_YAML),
278
+ NODE_MODULES: resolveWorkingPath(NODE_MODULES),
279
+ CYBERSKILL: {
280
+ LINT_STAGED_CONFIG: resolveCyberSkillPath("./configs/lint-staged/base.js"),
281
+ COMMITLINT_CONFIG: resolveCyberSkillPath("./configs/commitlint/base.js"),
282
+ UNIT_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/unit.js"),
283
+ E2E_TEST_CONFIG: resolveCyberSkillPath("./configs/vitest/react/e2e.js")
284
+ }
285
+ };
286
+ var COMMAND = {
287
+ SIMPLE_GIT_HOOKS: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(SIMPLE_GIT_HOOK_CLI)),
288
+ ESLINT_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_INSPECT_CLI)),
289
+ NODE_MODULES_INSPECT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(NODE_MODULES_INSPECT_CLI)),
290
+ RESET: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(RIMRAF_CLI, " ").concat(NODE_MODULES, " ").concat(PNPM_LOCK_YAML)),
291
+ ESLINT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY)),
292
+ ESLINT_FIX: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(ESLINT_CLI, " ").concat(PATH.WORKING_DIRECTORY, " --fix")),
293
+ TYPESCRIPT_CHECK: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(TSC_CLI, " -p ").concat(PATH.TS_CONFIG, " --noEmit")),
294
+ CYBERSKILL: {
295
+ TEST_UNIT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.UNIT_TEST_CONFIG)),
296
+ TEST_E2E: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(VITEST_CLI, " --config ").concat(PATH.CYBERSKILL.E2E_TEST_CONFIG)),
297
+ COMMIT_LINT: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(COMMIT_LINT_CLI, " --edit ").concat(PATH.GIT_COMMIT_MSG, " --config ").concat(PATH.CYBERSKILL.COMMITLINT_CONFIG)),
298
+ LINT_STAGED: commandFormatter.raw("".concat(PNPM_EXEC_CLI, " ").concat(LINT_STAGED_CLI, " --config ").concat(PATH.CYBERSKILL.LINT_STAGED_CONFIG))
299
+ },
300
+ CONFIGURE_GIT_HOOK: commandFormatter.raw("".concat(GIT_CLI, " config core.hooksPath ").concat(PATH.GIT_HOOK)),
301
+ BUILD: commandFormatter.raw("".concat(PNPM_CLI, " run build")),
302
+ STAGE_BUILD_DIRECTORY: commandFormatter.raw("".concat(GIT_CLI, " add ").concat(BUILD_DIRECTORY)),
303
+ PNPM_INSTALL_STANDARD: commandFormatter.raw("".concat(PNPM_CLI, " install")),
304
+ PNPM_INSTALL_LEGACY: commandFormatter.raw("".concat(PNPM_CLI, " install --legacy-peer-deps")),
305
+ PNPM_INSTALL_FORCE: commandFormatter.raw("".concat(PNPM_CLI, " install --force"))
306
+ };
307
+ // src/utils/storage-server.ts
308
+ function getStorageDir() {
309
+ return process3.env.CYBERSKILL_STORAGE_DIR || path2.join(os.homedir(), CYBERSKILL_STORAGE);
310
+ }
311
+ function initNodePersist() {
312
+ return _initNodePersist.apply(this, arguments);
313
+ }
314
+ function _initNodePersist() {
315
+ _initNodePersist = _async_to_generator(function() {
316
+ return _ts_generator(this, function(_state) {
317
+ switch(_state.label){
318
+ case 0:
319
+ if (!!nodePersist.defaultInstance) return [
320
+ 3,
321
+ 2
322
+ ];
323
+ return [
324
+ 4,
325
+ nodePersist.init({
326
+ dir: getStorageDir(),
327
+ stringify: JSON.stringify,
328
+ parse: JSON.parse,
329
+ encoding: "utf8",
330
+ logging: false,
331
+ forgiveParseErrors: true
332
+ })
333
+ ];
334
+ case 1:
335
+ _state.sent();
336
+ _state.label = 2;
337
+ case 2:
338
+ return [
339
+ 2
340
+ ];
341
+ }
342
+ });
343
+ });
344
+ return _initNodePersist.apply(this, arguments);
345
+ }
346
+ var storageServer = {
347
+ get: function get(key) {
348
+ return _async_to_generator(function() {
349
+ var result, error;
350
+ return _ts_generator(this, function(_state) {
351
+ switch(_state.label){
352
+ case 0:
353
+ _state.trys.push([
354
+ 0,
355
+ 3,
356
+ ,
357
+ 4
358
+ ]);
359
+ return [
360
+ 4,
361
+ initNodePersist()
362
+ ];
363
+ case 1:
364
+ _state.sent();
365
+ return [
366
+ 4,
367
+ nodePersist.getItem(key)
368
+ ];
369
+ case 2:
370
+ result = _state.sent();
371
+ return [
372
+ 2,
373
+ result !== null && result !== void 0 ? result : null
374
+ ];
375
+ case 3:
376
+ error = _state.sent();
377
+ console.error('❌ [Storage:get] Error getting key "'.concat(key, '":'), error);
378
+ return [
379
+ 2,
380
+ null
381
+ ];
382
+ case 4:
383
+ return [
384
+ 2
385
+ ];
386
+ }
387
+ });
388
+ })();
389
+ },
390
+ set: function set(key, value) {
391
+ return _async_to_generator(function() {
392
+ var error;
393
+ return _ts_generator(this, function(_state) {
394
+ switch(_state.label){
395
+ case 0:
396
+ _state.trys.push([
397
+ 0,
398
+ 3,
399
+ ,
400
+ 4
401
+ ]);
402
+ return [
403
+ 4,
404
+ initNodePersist()
405
+ ];
406
+ case 1:
407
+ _state.sent();
408
+ return [
409
+ 4,
410
+ nodePersist.setItem(key, value)
411
+ ];
412
+ case 2:
413
+ _state.sent();
414
+ return [
415
+ 3,
416
+ 4
417
+ ];
418
+ case 3:
419
+ error = _state.sent();
420
+ console.error('❌ [Storage:set] Error setting key "'.concat(key, '":'), error);
421
+ return [
422
+ 3,
423
+ 4
424
+ ];
425
+ case 4:
426
+ return [
427
+ 2
428
+ ];
429
+ }
430
+ });
431
+ })();
432
+ },
433
+ remove: function remove(key) {
434
+ return _async_to_generator(function() {
435
+ var error;
436
+ return _ts_generator(this, function(_state) {
437
+ switch(_state.label){
438
+ case 0:
439
+ _state.trys.push([
440
+ 0,
441
+ 3,
442
+ ,
443
+ 4
444
+ ]);
445
+ return [
446
+ 4,
447
+ initNodePersist()
448
+ ];
449
+ case 1:
450
+ _state.sent();
451
+ return [
452
+ 4,
453
+ nodePersist.removeItem(key)
454
+ ];
455
+ case 2:
456
+ _state.sent();
457
+ return [
458
+ 3,
459
+ 4
460
+ ];
461
+ case 3:
462
+ error = _state.sent();
463
+ console.error('❌ [Storage:remove] Error removing key "'.concat(key, '":'), error);
464
+ return [
465
+ 3,
466
+ 4
467
+ ];
468
+ case 4:
469
+ return [
470
+ 2
471
+ ];
472
+ }
473
+ });
474
+ })();
475
+ },
476
+ keys: function keys() {
477
+ return _async_to_generator(function() {
478
+ var keys, error;
479
+ return _ts_generator(this, function(_state) {
480
+ switch(_state.label){
481
+ case 0:
482
+ _state.trys.push([
483
+ 0,
484
+ 3,
485
+ ,
486
+ 4
487
+ ]);
488
+ return [
489
+ 4,
490
+ initNodePersist()
491
+ ];
492
+ case 1:
493
+ _state.sent();
494
+ return [
495
+ 4,
496
+ nodePersist.keys()
497
+ ];
498
+ case 2:
499
+ keys = _state.sent();
500
+ if (!Array.isArray(keys)) {
501
+ console.warn("⚠️ [Storage:keys] Invalid keys response:", keys);
502
+ return [
503
+ 2,
504
+ []
505
+ ];
506
+ }
507
+ return [
508
+ 2,
509
+ keys
510
+ ];
511
+ case 3:
512
+ error = _state.sent();
513
+ console.error("❌ [Storage:keys] Error getting keys:", error);
514
+ return [
515
+ 2,
516
+ []
517
+ ];
518
+ case 4:
519
+ return [
520
+ 2
521
+ ];
522
+ }
523
+ });
524
+ })();
525
+ },
526
+ getLogLink: function getLogLink(key) {
527
+ return _async_to_generator(function() {
528
+ var storagePath;
529
+ return _ts_generator(this, function(_state) {
530
+ try {
531
+ storagePath = getStorageDir();
532
+ return [
533
+ 2,
534
+ "".concat(storagePath, " (key: ").concat(key, ")")
535
+ ];
536
+ } catch (error) {
537
+ console.error("❌ [Storage:getLogLink] Error getting log link:", error);
538
+ return [
539
+ 2,
540
+ null
541
+ ];
542
+ }
543
+ return [
544
+ 2
545
+ ];
546
+ });
547
+ })();
548
+ }
549
+ };
550
+ export { getStorageDir, initNodePersist, storageServer };