@cyberskill/shared 1.59.0 → 1.61.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.
- package/dist/_tsup-dts-rollup.d.cts +3 -23
- package/dist/_tsup-dts-rollup.d.ts +3 -23
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/configs/graphql/graphql-codegen.cjs +1 -1
- package/dist/configs/graphql/graphql-codegen.js +1 -1
- package/dist/configs/graphql/index.cjs +1 -1
- package/dist/configs/graphql/index.js +1 -1
- package/dist/configs/index.cjs +1 -1
- package/dist/configs/index.js +1 -1
- package/dist/configs/vitest/react/unit.cjs +1 -1
- package/dist/configs/vitest/react/unit.js +1 -1
- package/dist/constants/common.cjs +1 -1
- package/dist/constants/common.d.cts +1 -3
- package/dist/constants/common.d.ts +1 -3
- package/dist/constants/common.js +1 -1
- package/dist/constants/graphql.cjs +1 -0
- package/dist/constants/graphql.d.cts +1 -0
- package/dist/constants/graphql.d.ts +1 -0
- package/dist/constants/graphql.js +1 -0
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.d.cts +1 -2
- package/dist/constants/index.d.ts +1 -2
- package/dist/constants/index.js +1 -1
- package/dist/constants/path.cjs +1 -1
- package/dist/constants/path.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/react/apollo-client.cjs +1 -1
- package/dist/react/apollo-client.js +1 -1
- package/dist/react/apollo-error.cjs +1 -1
- package/dist/react/apollo-error.d.cts +1 -2
- package/dist/react/apollo-error.d.ts +1 -2
- package/dist/react/apollo-error.js +1 -1
- package/dist/react/apollo-error.module.d.cts +1 -0
- package/dist/react/apollo-error.module.d.ts +1 -0
- package/dist/react/apollo-error.module.scss +111 -0
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.d.cts +1 -2
- package/dist/react/index.d.ts +1 -2
- package/dist/react/index.js +1 -1
- package/dist/react/loading.module.scss +1 -8
- package/dist/typescript/apollo-error.d.cts +0 -1
- package/dist/typescript/apollo-error.d.ts +0 -1
- package/dist/utils/command.cjs +1 -1
- package/dist/utils/command.js +1 -1
- package/dist/utils/index-nodejs.cjs +1 -1
- package/dist/utils/index-nodejs.js +1 -1
- package/dist/utils/package.cjs +1 -1
- package/dist/utils/package.js +1 -1
- package/dist/utils/path.cjs +1 -1
- package/dist/utils/path.js +1 -1
- package/dist/utils/storage-server.cjs +1 -1
- package/dist/utils/storage-server.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import type { AggregatePaginateResult } from 'mongoose';
|
|
|
5
5
|
import { ApolloCache } from '@apollo/client';
|
|
6
6
|
import { ApolloClient } from '@apollo/client';
|
|
7
7
|
import { ApolloClientOptions } from '@apollo/client';
|
|
8
|
-
import { ApolloError } from '@apollo/client';
|
|
8
|
+
import type { ApolloError } from '@apollo/client';
|
|
9
9
|
import type { ApolloLink } from '@apollo/client';
|
|
10
10
|
import type { ClientSession } from 'mongoose';
|
|
11
11
|
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -46,7 +46,7 @@ import type { ProjectionType } from 'mongoose';
|
|
|
46
46
|
import type { QueryOptions } from 'mongoose';
|
|
47
47
|
import type { QueryWithHelpers } from 'mongoose';
|
|
48
48
|
import type { ReactElement } from 'react';
|
|
49
|
-
import { ReactNode } from 'react';
|
|
49
|
+
import type { ReactNode } from 'react';
|
|
50
50
|
import type { Schema } from 'mongoose';
|
|
51
51
|
import type { SchemaDefinition } from 'mongoose';
|
|
52
52
|
import { TFunction } from 'i18next';
|
|
@@ -73,21 +73,6 @@ export { ApolloClientOptions }
|
|
|
73
73
|
export { ApolloClientOptions as ApolloClientOptions_alias_1 }
|
|
74
74
|
export { ApolloClientOptions as ApolloClientOptions_alias_2 }
|
|
75
75
|
|
|
76
|
-
declare const ApolloErrorScreen: ({ error, refetch }: ApolloErrorScreenProps_2) => JSX_2.Element;
|
|
77
|
-
export { ApolloErrorScreen }
|
|
78
|
-
export { ApolloErrorScreen as ApolloErrorScreen_alias_1 }
|
|
79
|
-
export { ApolloErrorScreen as ApolloErrorScreen_alias_2 }
|
|
80
|
-
|
|
81
|
-
export declare interface ApolloErrorScreenProps {
|
|
82
|
-
error: ApolloError;
|
|
83
|
-
refetch?: () => void;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
declare interface ApolloErrorScreenProps_2 {
|
|
87
|
-
error: ApolloError;
|
|
88
|
-
refetch?: () => void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
76
|
declare function ApolloErrorViewerModal(): JSX_2.Element | null;
|
|
92
77
|
export { ApolloErrorViewerModal }
|
|
93
78
|
export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_1 }
|
|
@@ -1537,7 +1522,7 @@ export { GIT_IGNORE }
|
|
|
1537
1522
|
export { GIT_IGNORE as GIT_IGNORE_alias_1 }
|
|
1538
1523
|
export { GIT_IGNORE as GIT_IGNORE_alias_2 }
|
|
1539
1524
|
|
|
1540
|
-
declare const GRAPHQL_URI_DEFAULT
|
|
1525
|
+
declare const GRAPHQL_URI_DEFAULT = "/graphql";
|
|
1541
1526
|
export { GRAPHQL_URI_DEFAULT }
|
|
1542
1527
|
export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_1 }
|
|
1543
1528
|
export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_2 }
|
|
@@ -2100,11 +2085,6 @@ export { IS_BROWSER }
|
|
|
2100
2085
|
export { IS_BROWSER as IS_BROWSER_alias_1 }
|
|
2101
2086
|
export { IS_BROWSER as IS_BROWSER_alias_2 }
|
|
2102
2087
|
|
|
2103
|
-
declare const IS_DEV: boolean;
|
|
2104
|
-
export { IS_DEV }
|
|
2105
|
-
export { IS_DEV as IS_DEV_alias_1 }
|
|
2106
|
-
export { IS_DEV as IS_DEV_alias_2 }
|
|
2107
|
-
|
|
2108
2088
|
declare function isJson(str: string): boolean;
|
|
2109
2089
|
export { isJson }
|
|
2110
2090
|
export { isJson as isJson_alias_1 }
|
|
@@ -5,7 +5,7 @@ import type { AggregatePaginateResult } from 'mongoose';
|
|
|
5
5
|
import { ApolloCache } from '@apollo/client';
|
|
6
6
|
import { ApolloClient } from '@apollo/client';
|
|
7
7
|
import { ApolloClientOptions } from '@apollo/client';
|
|
8
|
-
import { ApolloError } from '@apollo/client';
|
|
8
|
+
import type { ApolloError } from '@apollo/client';
|
|
9
9
|
import type { ApolloLink } from '@apollo/client';
|
|
10
10
|
import type { ClientSession } from 'mongoose';
|
|
11
11
|
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
@@ -46,7 +46,7 @@ import type { ProjectionType } from 'mongoose';
|
|
|
46
46
|
import type { QueryOptions } from 'mongoose';
|
|
47
47
|
import type { QueryWithHelpers } from 'mongoose';
|
|
48
48
|
import type { ReactElement } from 'react';
|
|
49
|
-
import { ReactNode } from 'react';
|
|
49
|
+
import type { ReactNode } from 'react';
|
|
50
50
|
import type { Schema } from 'mongoose';
|
|
51
51
|
import type { SchemaDefinition } from 'mongoose';
|
|
52
52
|
import { TFunction } from 'i18next';
|
|
@@ -73,21 +73,6 @@ export { ApolloClientOptions }
|
|
|
73
73
|
export { ApolloClientOptions as ApolloClientOptions_alias_1 }
|
|
74
74
|
export { ApolloClientOptions as ApolloClientOptions_alias_2 }
|
|
75
75
|
|
|
76
|
-
declare const ApolloErrorScreen: ({ error, refetch }: ApolloErrorScreenProps_2) => JSX_2.Element;
|
|
77
|
-
export { ApolloErrorScreen }
|
|
78
|
-
export { ApolloErrorScreen as ApolloErrorScreen_alias_1 }
|
|
79
|
-
export { ApolloErrorScreen as ApolloErrorScreen_alias_2 }
|
|
80
|
-
|
|
81
|
-
export declare interface ApolloErrorScreenProps {
|
|
82
|
-
error: ApolloError;
|
|
83
|
-
refetch?: () => void;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
declare interface ApolloErrorScreenProps_2 {
|
|
87
|
-
error: ApolloError;
|
|
88
|
-
refetch?: () => void;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
76
|
declare function ApolloErrorViewerModal(): JSX_2.Element | null;
|
|
92
77
|
export { ApolloErrorViewerModal }
|
|
93
78
|
export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_1 }
|
|
@@ -1537,7 +1522,7 @@ export { GIT_IGNORE }
|
|
|
1537
1522
|
export { GIT_IGNORE as GIT_IGNORE_alias_1 }
|
|
1538
1523
|
export { GIT_IGNORE as GIT_IGNORE_alias_2 }
|
|
1539
1524
|
|
|
1540
|
-
declare const GRAPHQL_URI_DEFAULT
|
|
1525
|
+
declare const GRAPHQL_URI_DEFAULT = "/graphql";
|
|
1541
1526
|
export { GRAPHQL_URI_DEFAULT }
|
|
1542
1527
|
export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_1 }
|
|
1543
1528
|
export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_2 }
|
|
@@ -2100,11 +2085,6 @@ export { IS_BROWSER }
|
|
|
2100
2085
|
export { IS_BROWSER as IS_BROWSER_alias_1 }
|
|
2101
2086
|
export { IS_BROWSER as IS_BROWSER_alias_2 }
|
|
2102
2087
|
|
|
2103
|
-
declare const IS_DEV: boolean;
|
|
2104
|
-
export { IS_DEV }
|
|
2105
|
-
export { IS_DEV as IS_DEV_alias_1 }
|
|
2106
|
-
export { IS_DEV as IS_DEV_alias_2 }
|
|
2107
|
-
|
|
2108
2088
|
declare function isJson(str: string): boolean;
|
|
2109
2089
|
export { isJson }
|
|
2110
2090
|
export { isJson as isJson_alias_1 }
|
package/dist/cli.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,c,o){try{var a=e[c](o);var s=a.value}catch(e){n(e);return}if(a.done){t(s)}else{Promise.resolve(s).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,c){var o=e.apply(t,n);function a(e){r(o,i,c,a,s,"next",e)}function s(e){r(o,i,c,a,s,"throw",e)}a(undefined)})}}function c(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function a(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var c=false;var o,a;try{for(n=n.call(e);!(i=(o=n.next()).done);i=true){r.push(o.value);if(t&&r.length===t)break}}catch(e){c=true;a=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(c)throw a}}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){c(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 p(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 d(e,n){return t(e)||a(e,n)||y(e,n)||s()}function h(e){return n(e)||o(e)||y(e)||u()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function y(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 v(e,t){var n,r,i,c,o={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return c={next:a(0),"throw":a(1),"return":a(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function a(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:o.label++;return{value:c[1],done:false};case 5:o.label++;r=c[1];c=[0];continue;case 7:c=o.ops.pop();o.trys.pop();continue;default:if(!(i=o.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){o=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){o.label=c[1];break}if(c[0]===6&&o.label<i[1]){o.label=i[1];i=c;break}if(i&&o.label<i[2]){o.label=i[2];o.ops.push(c);break}if(i[2])o.ops.pop();o.trys.pop();continue}c=t.call(e,o)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var m=Object.create;var _=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var O=function(e,t,n,r){var i=true,c=false,o=undefined;if(t&&(typeof t==="undefined"?"undefined":g(t))=="object"||typeof t=="function")try{var a=function(){var i=u.value;!S.call(e,i)&&i!==n&&_(e,i,{get:function(){return t[i]},enumerable:!(r=E(t,i))||r.enumerable})};for(var s=b(t)[Symbol.iterator](),u;!(i=(u=s.next()).done);i=true)a()}catch(e){c=true;o=e}finally{try{if(!i&&s.return!=null){s.return()}}finally{if(c){throw o}}}return e};var N=function(e,t,n){return n=e!=null?m(I(e)):{},O(t||!e||!e.__esModule?_(n,"default",{value:e,enumerable:!0}):n,e)};var w=N(require("process"),1),T=require("yargs/helpers"),P=N(require("yargs/yargs"),1);var C=process.env.DEBUG==="true",D=process.env.NODE_ENV!=="production",L=process.env.GRAPHQL_URI_DEFAULT||"/graphql";var A=N(require("process"),1);var R=N(require("boxen"),1),j=N(require("chalk"),1),G=require("child_process"),M=N(require("process"),1),k=N(require("util"),1);var F=N(require("node-fetch"),1);var K=N(require("fs"),1),x=function(e){return K.existsSync(e)};function U(e,t){var n=K.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":g(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function B(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,c=i&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);K.writeFileSync(e,c,"utf-8")}function Y(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,c=i&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);K.appendFileSync(e,c,"utf-8")}function J(e){e.forEach(function(e){x(e)&&K.rmSync(e,{recursive:!0,force:!0})})}var V=N(require("path"),1);function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).resolve.apply(r,[eA].concat(h(t)))}function q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=V).join.apply(r,h(t))}var H=N(require("node-persist"),1),X=N(require("os"),1),$=N(require("process"),1);function z(){return $.default.env.CYBERSKILL_STORAGE_DIR||q(X.default.homedir(),ej)}function Q(){return Z.apply(this,arguments)}function Z(){Z=i(function(){var e;return v(this,function(t){switch(t.label){case 0:e=H.default.defaultInstance;if(e)return[3,2];return[4,H.default.init({dir:z(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return Z.apply(this,arguments)}var ee={get:function e(e){return i(function(){var t,n;return v(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Q()];case 1:r.sent();return[4,H.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return v(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Q()];case 1:r.sent();return[4,H.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return v(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,Q()];case 1:n.sent();return[4,H.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return v(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,Q()];case 1:n.sent();return[4,H.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return v(this,function(t){try{return[2,"".concat(z()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var et=24*60*60*1e3;function en(e){var t=q(eA,ek);if(x(t))try{var n=U(t,{asJson:!0});if(n.name===e)return{path:t,file:n,isCurrentProject:!0}}catch(e){eg.warning("Failed to read local package.json: ".concat(e.message))}var r=q(eA,eG,e,ek);if(x(r))try{var i=U(r,{asJson:!0});if(i.name===e)return{path:r,file:i,isCurrentProject:!1}}catch(t){eg.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(t.message))}return!1}function er(e){return ei.apply(this,arguments)}function ei(){ei=i(function(e){var t,n,r,i,c,o,a,s,u,l;var f=arguments;return v(this,function(p){switch(p.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:!1;n="npm_version:".concat(e),r="npm_metadata:".concat(e);return[4,ee.get(n)];case 1:i=p.sent();return[4,ee.get(r)];case 2:c=p.sent(),o=i&&Date.now()-i.timestamp<et;if(!t&&o)return[2,i.version];a={};(c===null||c===void 0?void 0:c.etag)&&(a["If-None-Match"]=c.etag),(c===null||c===void 0?void 0:c.lastModified)&&(a["If-Modified-Since"]=c.lastModified);p.label=3;case 3:p.trys.push([3,8,,9]);return[4,(0,F.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:a})];case 4:s=p.sent();if(s.status===304&&i)return[2,i.version];if(!s.ok)throw new Error("Failed to fetch latest version: ".concat(s.statusText));return[4,s.json()];case 5:u=p.sent().version;return[4,ee.set(n,{version:u,timestamp:Date.now()})];case 6:p.sent();return[4,ee.set(r,{etag:s.headers.get("ETag")||void 0,lastModified:s.headers.get("Last-Modified")||void 0})];case 7:return[2,(p.sent(),u)];case 8:l=p.sent();if(eg.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),i)return[2,(eg.warning("Falling back to cached version for ".concat(e,": ").concat(i.version)),i.version)];throw l;case 9:return[2]}})});return ei.apply(this,arguments)}function ec(e){return eo.apply(this,arguments)}function eo(){eo=i(function(e){var t,n,r,i,c;return v(this,function(o){switch(o.label){case 0:t={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};o.label=1;case 1:o.trys.push([1,6,,7]);n=en(e);r=n;if(!r)return[3,5];t.file=n.file,t.isInstalled=!0,t.installedPath=n.path,t.installedVersion=n.file.version,t.isCurrentProject=n.isCurrentProject;if(!n.isCurrentProject)return[3,2];i=n.file.version;return[3,4];case 2:return[4,er(e,!0)];case 3:i=o.sent();o.label=4;case 4:r=t.latestVersion=i;o.label=5;case 5:return[2,(r,t)];case 6:c=o.sent();return[2,(eg.error('Error checking package "'.concat(e,'": ').concat(c.message)),t)];case 7:return[2]}})});return eo.apply(this,arguments)}var ea=k.promisify(G.exec),es=j.default,eu=es.gray,el=es.blue;function ef(){return eu("[".concat(new Date().toLocaleTimeString(),"]"))}function ep(e){var t=j.default[e];return typeof t=="function"?t:j.default.green}function ed(e,t,n,r){var i=ep(t);console.log("".concat(ef()," ").concat(i("".concat(n," ").concat(e))," ").concat(r))}function eh(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.color,i=r===void 0?"green":r,c=n.padding,o=c===void 0?1:c,a=n.margin,s=a===void 0?1:a,u=n.borderStyle,l=u===void 0?"round":u,f=n.titleColor,p=f===void 0?"bold":f;var d=ep(i),h=ep(p);if(typeof t=="string"){console.log((0,R.default)(h(d("".concat(e,"\n").concat(t))),{padding:o,margin:s,borderStyle:l,borderColor:i}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,n=e.position,r=e.rule,i=e.message;console.log("".concat(ef()," ").concat(d("File:")," ").concat(el("".concat(t).concat(n?":".concat(n):"")))),r&&console.log(" ".concat(d("Rule:")," ").concat(d(r))),console.log(" ".concat(d("Message:")," ").concat(d(i)))}),console.log((0,R.default)(h(d("".concat(e,": ").concat(t.length))),{padding:o,margin:s,borderStyle:l,borderColor:i})),console.log(eu("─".repeat(40))))}var eg={success:function(e){return ed("SUCCESS","green","✔",e)},error:function(e){return ed("ERROR","red","✖",e)},warning:function(e){return ed("WARNING","yellow","⚠",e)},info:function(e){return ed("INFO","blue","ℹ",e)},printBoxedLog:eh};function ey(e){return"error_list:".concat(e)}function ev(e){return em.apply(this,arguments)}function em(){em=i(function(e){var t,n,r;return v(this,function(c){switch(c.label){case 0:if(e.length===0)return[2];t=Date.now(),n=ey(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,ee.set(n,{errors:e,timestamp:t})];case 2:c.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return v(this,function(t){switch(t.label){case 0:return[4,ee.getLogLink(n)];case 1:e=t.sent();e&&eg.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=c.sent();eg.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return em.apply(this,arguments)}function e_(){return eE.apply(this,arguments)}function eE(){eE=i(function(){var e,t,n;return v(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ee.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return v(this,function(n){switch(n.label){case 0:return[4,ee.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(eg.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return eE.apply(this,arguments)}function eb(){return eI.apply(this,arguments)}function eI(){eI=i(function(){var e,t,n;return v(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,ee.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return ee.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();eg.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return eI.apply(this,arguments)}function eS(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,o=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var a=i.exec(e)||[],s=c.exec(e)||[],u=o.exec(e)||[];a.length&&r?t.push({file:r,position:"".concat(a[1],":").concat(a[2]),type:a[3]==="error"?"error":"warning",message:a[4].trim(),rule:a[5].trim()}):s.length?t.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4]==="error"?"error":"warning",message:s[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ev(t),n.length&&C&&(eg.warning("Unmatched lines:"),n.forEach(function(e){return console.log(" ".concat(e))}))}function eO(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,c=e.column,o=e.ruleId,a=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(i,":").concat(c),rule:o,message:a})})}),n.length&&ev(n)}catch(t){eS(e)}}function eN(e){return ew.apply(this,arguments)}function ew(){ew=i(function(e){var t,n,r,i,c,o,a,s,u;var l=arguments;return v(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eO;n=new AbortController;M.default.on("SIGINT",function(){eg.warning("Process interrupted. Terminating..."),n.abort(),M.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ea(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),i=r.stdout,c=r.stderr;[i,c].forEach(function(e){return e&&t(e)});return[3,4];case 3:o=f.sent();a=o.stdout,s=o.stderr,u=o.message;[a,s].forEach(function(e){return e&&t(e)}),!s&&!a&&eg.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return ew.apply(this,arguments)}function eT(e){return{raw:!0,cmd:e}}function eP(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e8," ").concat(eR," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e8," ").concat(e3," src/cli.ts ").concat(e):"".concat(e8," ").concat(eW," ").concat(e)}function eC(e,t){return typeof e=="function"?eP(e(t),t):(typeof e==="undefined"?"undefined":g(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eP(e,t):e}function eD(e){return eL.apply(this,arguments)}function eL(){eL=i(function(e){var t,n,r,i,c,o,a;var s=arguments;return v(this,function(u){switch(u.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];a=!1;return[3,3];case 1:return[4,ec(eR)];case 2:a=u.sent().isCurrentProject;u.label=3;case 3:i=a,c={isRemote:r,isCurrentProject:i},o=typeof e=="function"?e(c):e;return[2,Object.fromEntries(Object.entries(o).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,eC(r,c)]}))]}})});return eL.apply(this,arguments)}var eA=A.default.env.INIT_CWD||A.default.cwd(),eR="@cyberskill/shared",ej=".cyberskill-storage",eG="node_modules",eM="dist",ek="package.json",eF="package-lock.json",eK="tsconfig.json",ex=".gitignore",eU=".simple-git-hooks.json",eB="pnpm-lock.yaml",eY=".git/hooks/",eJ=".git/COMMIT_EDITMSG",eV=q(eA,eG,eR,eM),eW="cyberskill",eq="eslint",eH="eslint",eX="vitest",e$="playwright",ez="vitest",eQ="@commitlint/cli",eZ="commitlint",e0="lint-staged",e1="lint-staged",e2="typescript",e4="tsc",e3="tsx",e5="git",e6="pnpm",e8="pnpm exec",e7="simple-git-hooks",e9="simple-git-hooks",te="@eslint/config-inspector",tt="eslint-config-inspector",tn="node-modules-inspector",tr="node-modules-inspector",ti={CYBERSKILL_DIRECTORY:eV,WORKING_DIRECTORY:eA,TS_CONFIG:W(eK),GIT_IGNORE:W(ex),GIT_HOOK:W(eY),GIT_COMMIT_MSG:W(eJ),SIMPLE_GIT_HOOKS_JSON:W(eU),PACKAGE_JSON:W(ek),PACKAGE_LOCK_JSON:W(eF),PNPM_LOCK_YAML:W(eB),NODE_MODULES:W(eG),CYBERSKILL:{LINT_STAGED_CONFIG:W("".concat(eV,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:W("".concat(eV,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:W("".concat(eV,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:W("".concat(eV,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:W("".concat(eV,"/configs/vitest/react/e2e.js"))}};function tc(e){var t=e.isCurrentProject;return l({"pre-commit":e1,"commit-msg":eZ},t&&{"pre-push":eT("".concat(e5," pull"))})}function to(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 i=d(n,2),c=i[0],o=i[1],a=e==="RAW"?!0:x(q(ti.NODE_MODULES,c));switch(e){case"PNPM_ADD_AND_EXEC":return eC(eT("".concat(a?"":"".concat(e6," add ").concat(c," && ")).concat(e8," ").concat(o)));case"PNPM_ADD_DEV_AND_EXEC":return eC(eT("".concat(a?"":"".concat(e6," add -D ").concat(c," && ")).concat(e8," ").concat(o)));case"RAW":return eC(eT(c))}}var ta={SIMPLE_GIT_HOOKS:to("PNPM_ADD_DEV_AND_EXEC",e7,e9),ESLINT_INSPECT:to("PNPM_ADD_DEV_AND_EXEC",te,tt),NODE_MODULES_INSPECT:to("PNPM_ADD_DEV_AND_EXEC",tn,tr),ESLINT_CHECK:to("PNPM_ADD_DEV_AND_EXEC",eq,"".concat(eH," ").concat(ti.WORKING_DIRECTORY)),ESLINT_FIX:to("PNPM_ADD_DEV_AND_EXEC",eq,"".concat(eH," ").concat(ti.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:to("PNPM_ADD_AND_EXEC",e2,"".concat(e4," -p ").concat(ti.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:to("RAW","".concat(e5," config core.hooksPath ").concat(ti.GIT_HOOK)),BUILD:to("RAW","".concat(e6," run build")),STAGE_BUILD_DIRECTORY:to("RAW","".concat(e5," add ").concat(eM)),PNPM_INSTALL_STANDARD:to("RAW","".concat(e6," install")),PNPM_INSTALL_LEGACY:to("RAW","".concat(e6," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:to("RAW","".concat(e6," install --force")),CYBERSKILL:{TEST_UNIT:to("PNPM_ADD_AND_EXEC",eX,"".concat(ez," --config ").concat(ti.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:to("PNPM_ADD_AND_EXEC","".concat(eX," ").concat(e$),"".concat(ez," --config ").concat(ti.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:to("PNPM_ADD_DEV_AND_EXEC",eQ,"".concat(eZ," --edit ").concat(ti.GIT_COMMIT_MSG," --config ").concat(ti.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:to("PNPM_ADD_DEV_AND_EXEC",e0,"".concat(e1," --config ").concat(ti.CYBERSKILL.LINT_STAGED_CONFIG))}};function ts(e,t){return tu.apply(this,arguments)}function tu(){tu=i(function(e,t){return v(this,function(n){switch(n.label){case 0:eg.info("".concat(e,"...")),C&&eg.info("Executing command: ".concat(t));return[4,eN(t)];case 1:n.sent(),eg.success("".concat(e," completed successfully."));return[2]}})});return tu.apply(this,arguments)}function tl(){return tf.apply(this,arguments)}function tf(){tf=i(function(){var e;return v(this,function(t){switch(t.label){case 0:if(!x(ti.TS_CONFIG))return[3,2];return[4,ts("Performing TypeScript validation",ta.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=eg.warning("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tf.apply(this,arguments)}function tp(){return td.apply(this,arguments)}function td(){td=i(function(){var e,t;var n=arguments;return v(this,function(r){switch(r.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:!1;if(!e)return[3,2];return[4,ts("Running ESLint with auto-fix",ta.ESLINT_FIX)];case 1:t=r.sent();return[3,4];case 2:return[4,ts("Running ESLint check",ta.ESLINT_CHECK)];case 3:t=r.sent();r.label=4;case 4:t;return[2]}})});return td.apply(this,arguments)}function th(){return tg.apply(this,arguments)}function tg(){tg=i(function(){var e,t,n;return v(this,function(r){switch(r.label){case 0:return[4,e_()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?eg.printBoxedLog("✔ NO ISSUES FOUND","",{color:"green"}):(eg.printBoxedLog("⚠ Warnings",n,{color:"yellow"}),eg.printBoxedLog("✖ Errors",t,{color:"red"}));return[2]}})});return tg.apply(this,arguments)}function ty(){return tv.apply(this,arguments)}function tv(){tv=i(function(){var e,t,n;return v(this,function(r){switch(r.label){case 0:return[4,eb()];case 1:r.sent();return[4,ec(eR)];case 2:e=r.sent(),t=e.isCurrentProject;if(!t)return[3,7];r.label=3;case 3:r.trys.push([3,6,,7]);return[4,ts("Building package: ".concat(eR),ta.BUILD)];case 4:r.sent();return[4,ts("Staging build artifacts",ta.STAGE_BUILD_DIRECTORY)];case 5:r.sent();return[3,7];case 6:n=r.sent();throw eg.error("Error building and staging ".concat(eR,": ").concat(n.message)),n;case 7:return[4,ts("Executing lint-staged",ta.CYBERSKILL.LINT_STAGED)];case 8:r.sent(),th();return[2]}})});return tv.apply(this,arguments)}function tm(){return t_.apply(this,arguments)}function t_(){t_=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,ts("Inspecting ESLint configuration",ta.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return t_.apply(this,arguments)}function tE(){return tb.apply(this,arguments)}function tb(){tb=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,eb()];case 1:e.sent();return[4,Promise.all([tl(),tp()])];case 2:e.sent(),th();return[2]}})});return tb.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,eb()];case 1:e.sent();return[4,Promise.all([tl(),tp(!0)])];case 2:e.sent(),th();return[2]}})});return tS.apply(this,arguments)}function tO(){return tN.apply(this,arguments)}function tN(){tN=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,eb()];case 1:e.sent();return[4,ts("Validating commit message",ta.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),th();return[2]}})});return tN.apply(this,arguments)}function tw(){return tT.apply(this,arguments)}function tT(){tT=i(function(){var e,t;return v(this,function(n){switch(n.label){case 0:return[4,ts("Configuring Git hooks",ta.CONFIGURE_GIT_HOOK)];case 1:n.sent(),J([ti.GIT_HOOK]);return[4,eD(tc)];case 2:e=n.sent();B(ti.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(eU,"\n");x(ti.GIT_IGNORE)?U(ti.GIT_IGNORE).split("\n").includes(eU)||Y(ti.GIT_IGNORE,t):B(ti.GIT_IGNORE,t);return[4,ts("Installing simple-git-hooks",ta.SIMPLE_GIT_HOOKS)];case 3:n.sent();return[2]}})});return tT.apply(this,arguments)}function tP(){return tC.apply(this,arguments)}function tC(){tC=i(function(){var e,t,n,r,i,c,o,a,s,u,l;return v(this,function(f){switch(f.label){case 0:e=[{command:ta.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:ta.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:ta.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,8,9,10]);i=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(c=i.next()).done))return[3,7];o=c.value,a=o.command,s=o.message;f.label=3;case 3:f.trys.push([3,5,,6]);return[4,ts("".concat(s," using: ").concat(a),a)];case 4:f.sent();return[2];case 5:u=f.sent();eg.warning("Installation attempt failed: ".concat(a)),eg.error("Details: ".concat(u.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:l=f.sent();n=true;r=l;return[3,10];case 9:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return tC.apply(this,arguments)}function tD(e){return tL.apply(this,arguments)}function tL(){tL=i(function(e){var t,n,r,i,o;return v(this,function(a){switch(a.label){case 0:a.trys.push([0,4,,5]);return[4,ec(e)];case 1:t=a.sent(),n=t.installedPath,r=t.latestVersion,i=t.file;i.dependencies=p(l({},i.dependencies),c({},i.name,r)),B(n,i,{isJson:!0});return[4,tP()];case 2:a.sent();return[4,tI()];case 3:a.sent();return[3,5];case 4:o=a.sent();throw eg.error('Failed to update "'.concat(e,'": ').concat(o.message)),o;case 5:return[2]}})});return tL.apply(this,arguments)}function tA(){return tR.apply(this,arguments)}function tR(){tR=i(function(){var e,t,n,r,i,c,o;return v(this,function(a){switch(a.label){case 0:if(!x(ti.PACKAGE_JSON)){eg.error("package.json not found. Aborting setup.");return[2]}a.label=1;case 1:a.trys.push([1,7,,8]);return[4,ec(eR)];case 2:e=a.sent(),t=e.isInstalled,n=e.installedVersion,r=e.latestVersion,i=e.isCurrentProject;if(!(i||t&&n===r))return[3,3];c=eg.success("Cyberskill package is already up to date.");return[3,5];case 3:return[4,tD(eR)];case 4:c=a.sent();a.label=5;case 5:c;return[4,tw()];case 6:a.sent();return[3,8];case 7:o=a.sent();throw eg.error("Project setup failed: ".concat(o.message)),o;case 8:return[2]}})});return tR.apply(this,arguments)}function tj(){return tG.apply(this,arguments)}function tG(){tG=i(function(){return v(this,function(e){switch(e.label){case 0:J([ti.NODE_MODULES,ti.PNPM_LOCK_YAML]);return[4,tP()];case 1:e.sent();return[4,tw()];case 2:e.sent();return[2]}})});return tG.apply(this,arguments)}function tM(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,ts("Inspecting project dependencies",ta.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return tk.apply(this,arguments)}function tF(){return tK.apply(this,arguments)}function tK(){tK=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,ts("Running unit tests",ta.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return tK.apply(this,arguments)}function tx(){return tU.apply(this,arguments)}function tU(){tU=i(function(){return v(this,function(e){switch(e.label){case 0:return[4,ts("Running end-to-end tests",ta.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return tU.apply(this,arguments)}(0,P.default)((0,T.hideBin)(w.default.argv)).scriptName(eW).usage("$0 <command> [options]").command("lint","Check code for linting issues",tE).command("lint:fix","Fix linting issues automatically",tI).command("lint:inspect","View active ESLint configuration",tm).command("lint-staged","Run lint checks on staged files",ty).command("commitlint","Validate commit message format",tO).command("setup","Initialize project setup and dependencies",tA).command("reset","Reset the project and reinstall dependencies",tj).command("inspect","Analyze installed project dependencies",tM).command("test:unit","Run unit test suite",tF).command("test:e2e","Run end-to-end test suite",tx).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse();
|
|
2
|
+
"use strict";function e(e,t){if(t==null||t>e.length)t=e.length;for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(t){if(Array.isArray(t))return e(t)}function r(e,t,n,r,i,c,a){try{var o=e[c](a);var s=o.value}catch(e){n(e);return}if(o.done){t(s)}else{Promise.resolve(s).then(r,i)}}function i(e){return function(){var t=this,n=arguments;return new Promise(function(i,c){var a=e.apply(t,n);function o(e){r(a,i,c,o,s,"next",e)}function s(e){r(a,i,c,o,s,"throw",e)}o(undefined)})}}function c(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 o(e,t){var n=e==null?null:typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(n==null)return;var r=[];var i=true;var c=false;var a,o;try{for(n=n.call(e);!(i=(a=n.next()).done);i=true){r.push(a.value);if(t&&r.length===t)break}}catch(e){c=true;o=e}finally{try{if(!i&&n["return"]!=null)n["return"]()}finally{if(c)throw o}}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){c(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 p(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 d(e,n){return t(e)||o(e,n)||y(e,n)||s()}function h(e){return n(e)||a(e)||y(e)||u()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function y(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 m(e,t){var n,r,i,c,a={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return c={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function o(e){return function(t){return s([e,t])}}function s(c){if(n)throw new TypeError("Generator is already executing.");while(a)try{if(n=1,r&&(i=c[0]&2?r["return"]:c[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;if(r=0,i)c=[c[0]&2,i.value];switch(c[0]){case 0:case 1:i=c;break;case 4:a.label++;return{value:c[1],done:false};case 5:a.label++;r=c[1];c=[0];continue;case 7:c=a.ops.pop();a.trys.pop();continue;default:if(!(i=a.trys,i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){a=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){a.label=c[1];break}if(c[0]===6&&a.label<i[1]){a.label=i[1];i=c;break}if(i&&a.label<i[2]){a.label=i[2];a.ops.push(c);break}if(i[2])a.ops.pop();a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e];r=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:true}}}var v=Object.create;var _=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var O=function(e,t,n,r){var i=true,c=false,a=undefined;if(t&&(typeof t==="undefined"?"undefined":g(t))=="object"||typeof t=="function")try{var o=function(){var i=u.value;!S.call(e,i)&&i!==n&&_(e,i,{get:function(){return t[i]},enumerable:!(r=E(t,i))||r.enumerable})};for(var s=b(t)[Symbol.iterator](),u;!(i=(u=s.next()).done);i=true)o()}catch(e){c=true;a=e}finally{try{if(!i&&s.return!=null){s.return()}}finally{if(c){throw a}}}return e};var N=function(e,t,n){return n=e!=null?v(I(e)):{},O(t||!e||!e.__esModule?_(n,"default",{value:e,enumerable:!0}):n,e)};var w=N(require("process"),1),T=require("yargs/helpers"),P=N(require("yargs/yargs"),1);var C=N(require("process"),1);var D=C.default.env.DEBUG==="true";var L=N(require("process"),1);var A=N(require("boxen"),1),R=N(require("chalk"),1),j=require("child_process"),G=N(require("process"),1),M=N(require("util"),1);var k=N(require("node-fetch"),1);var F=N(require("fs"),1),K=function(e){return F.existsSync(e)};function x(e,t){var n=F.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":g(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function U(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,c=i&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);F.writeFileSync(e,c,"utf-8")}function B(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,i=r===void 0?!1:r,c=i&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);F.appendFileSync(e,c,"utf-8")}function Y(e){e.forEach(function(e){K(e)&&F.rmSync(e,{recursive:!0,force:!0})})}var J=N(require("path"),1);function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).resolve.apply(r,[eL].concat(h(t)))}function W(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=J).join.apply(r,h(t))}var q=N(require("node-persist"),1),X=N(require("os"),1),H=N(require("process"),1);function $(){return H.default.env.CYBERSKILL_STORAGE_DIR||W(X.default.homedir(),eR)}function z(){return Q.apply(this,arguments)}function Q(){Q=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=q.default.defaultInstance;if(e)return[3,2];return[4,q.default.init({dir:$(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return Q.apply(this,arguments)}var Z={get:function e(e){return i(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,z()];case 1:r.sent();return[4,q.default.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return i(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,z()];case 1:r.sent();return[4,q.default.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return i(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,z()];case 1:n.sent();return[4,q.default.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,z()];case 1:n.sent();return[4,q.default.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return i(function(){return m(this,function(t){try{return[2,"".concat($()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var ee=24*60*60*1e3;function et(e){var t=W(eL,eM);if(K(t))try{var n=x(t,{asJson:!0});if(n.name===e)return{path:t,file:n,isCurrentProject:!0}}catch(e){eh.warning("Failed to read local package.json: ".concat(e.message))}var r=W(eL,ej,e,eM);if(K(r))try{var i=x(r,{asJson:!0});if(i.name===e)return{path:r,file:i,isCurrentProject:!1}}catch(t){eh.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(t.message))}return!1}function en(e){return er.apply(this,arguments)}function er(){er=i(function(e){var t,n,r,i,c,a,o,s,u,l;var f=arguments;return m(this,function(p){switch(p.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:!1;n="npm_version:".concat(e),r="npm_metadata:".concat(e);return[4,Z.get(n)];case 1:i=p.sent();return[4,Z.get(r)];case 2:c=p.sent(),a=i&&Date.now()-i.timestamp<ee;if(!t&&a)return[2,i.version];o={};(c===null||c===void 0?void 0:c.etag)&&(o["If-None-Match"]=c.etag),(c===null||c===void 0?void 0:c.lastModified)&&(o["If-Modified-Since"]=c.lastModified);p.label=3;case 3:p.trys.push([3,8,,9]);return[4,(0,k.default)("https://registry.npmjs.org/".concat(e,"/latest"),{headers:o})];case 4:s=p.sent();if(s.status===304&&i)return[2,i.version];if(!s.ok)throw new Error("Failed to fetch latest version: ".concat(s.statusText));return[4,s.json()];case 5:u=p.sent().version;return[4,Z.set(n,{version:u,timestamp:Date.now()})];case 6:p.sent();return[4,Z.set(r,{etag:s.headers.get("ETag")||void 0,lastModified:s.headers.get("Last-Modified")||void 0})];case 7:return[2,(p.sent(),u)];case 8:l=p.sent();if(eh.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),i)return[2,(eh.warning("Falling back to cached version for ".concat(e,": ").concat(i.version)),i.version)];throw l;case 9:return[2]}})});return er.apply(this,arguments)}function ei(e){return ec.apply(this,arguments)}function ec(){ec=i(function(e){var t,n,r,i,c;return m(this,function(a){switch(a.label){case 0:t={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};a.label=1;case 1:a.trys.push([1,6,,7]);n=et(e);r=n;if(!r)return[3,5];t.file=n.file,t.isInstalled=!0,t.installedPath=n.path,t.installedVersion=n.file.version,t.isCurrentProject=n.isCurrentProject;if(!n.isCurrentProject)return[3,2];i=n.file.version;return[3,4];case 2:return[4,en(e,!0)];case 3:i=a.sent();a.label=4;case 4:r=t.latestVersion=i;a.label=5;case 5:return[2,(r,t)];case 6:c=a.sent();return[2,(eh.error('Error checking package "'.concat(e,'": ').concat(c.message)),t)];case 7:return[2]}})});return ec.apply(this,arguments)}var ea=M.promisify(j.exec),eo=R.default,es=eo.gray,eu=eo.blue;function el(){return es("[".concat(new Date().toLocaleTimeString(),"]"))}function ef(e){var t=R.default[e];return typeof t=="function"?t:R.default.green}function ep(e,t,n,r){var i=ef(t);console.log("".concat(el()," ").concat(i("".concat(n," ").concat(e))," ").concat(r))}function ed(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.color,i=r===void 0?"green":r,c=n.padding,a=c===void 0?1:c,o=n.margin,s=o===void 0?1:o,u=n.borderStyle,l=u===void 0?"round":u,f=n.titleColor,p=f===void 0?"bold":f;var d=ef(i),h=ef(p);if(typeof t=="string"){console.log((0,A.default)(h(d("".concat(e,"\n").concat(t))),{padding:a,margin:s,borderStyle:l,borderColor:i}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,n=e.position,r=e.rule,i=e.message;console.log("".concat(el()," ").concat(d("File:")," ").concat(eu("".concat(t).concat(n?":".concat(n):"")))),r&&console.log(" ".concat(d("Rule:")," ").concat(d(r))),console.log(" ".concat(d("Message:")," ").concat(d(i)))}),console.log((0,A.default)(h(d("".concat(e,": ").concat(t.length))),{padding:a,margin:s,borderStyle:l,borderColor:i})),console.log(es("─".repeat(40))))}var eh={success:function(e){return ep("SUCCESS","green","✔",e)},error:function(e){return ep("ERROR","red","✖",e)},warning:function(e){return ep("WARNING","yellow","⚠",e)},info:function(e){return ep("INFO","blue","ℹ",e)},printBoxedLog:ed};function eg(e){return"error_list:".concat(e)}function ey(e){return em.apply(this,arguments)}function em(){em=i(function(e){var t,n,r;return m(this,function(c){switch(c.label){case 0:if(e.length===0)return[2];t=Date.now(),n=eg(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,Z.set(n,{errors:e,timestamp:t})];case 2:c.sent(),setTimeout(/*#__PURE__*/i(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,Z.getLogLink(n)];case 1:e=t.sent();e&&eh.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=c.sent();eh.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return em.apply(this,arguments)}function ev(){return e_.apply(this,arguments)}function e_(){e_=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Z.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=i(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,Z.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(eh.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return e_.apply(this,arguments)}function eE(){return eb.apply(this,arguments)}function eb(){eb=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Z.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return Z.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();eh.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return eb.apply(this,arguments)}function eI(e){var t=[],n=[],r="",i=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,c=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,a=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var o=i.exec(e)||[],s=c.exec(e)||[],u=a.exec(e)||[];o.length&&r?t.push({file:r,position:"".concat(o[1],":").concat(o[2]),type:o[3]==="error"?"error":"warning",message:o[4].trim(),rule:o[5].trim()}):s.length?t.push({file:s[1],position:"".concat(s[2],":").concat(s[3]),type:s[4]==="error"?"error":"warning",message:s[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ey(t),n.length&&D&&(eh.warning("Unmatched lines:"),n.forEach(function(e){return console.log(" ".concat(e))}))}function eS(e){try{var t=JSON.parse(e),n=[];t.forEach(function(e){var t=e.filePath,r=e.messages;r.forEach(function(e){var r=e.severity,i=e.line,c=e.column,a=e.ruleId,o=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(i,":").concat(c),rule:a,message:o})})}),n.length&&ey(n)}catch(t){eI(e)}}function eO(e){return eN.apply(this,arguments)}function eN(){eN=i(function(e){var t,n,r,i,c,a,o,s,u;var l=arguments;return m(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eS;n=new AbortController;G.default.on("SIGINT",function(){eh.warning("Process interrupted. Terminating..."),n.abort(),G.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ea(e,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),i=r.stdout,c=r.stderr;[i,c].forEach(function(e){return e&&t(e)});return[3,4];case 3:a=f.sent();o=a.stdout,s=a.stderr,u=a.message;[o,s].forEach(function(e){return e&&t(e)}),!s&&!o&&eh.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return eN.apply(this,arguments)}function ew(e){return{raw:!0,cmd:e}}function eT(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e6," ").concat(eA," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e6," ").concat(e4," src/cli.ts ").concat(e):"".concat(e6," ").concat(eV," ").concat(e)}function eP(e,t){return typeof e=="function"?eT(e(t),t):(typeof e==="undefined"?"undefined":g(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eT(e,t):e}function eC(e){return eD.apply(this,arguments)}function eD(){eD=i(function(e){var t,n,r,i,c,a,o;var s=arguments;return m(this,function(u){switch(u.label){case 0:t=s.length>1&&s[1]!==void 0?s[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];o=!1;return[3,3];case 1:return[4,ei(eA)];case 2:o=u.sent().isCurrentProject;u.label=3;case 3:i=o,c={isRemote:r,isCurrentProject:i},a=typeof e=="function"?e(c):e;return[2,Object.fromEntries(Object.entries(a).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,eP(r,c)]}))]}})});return eD.apply(this,arguments)}var eL=L.default.env.INIT_CWD||L.default.cwd(),eA="@cyberskill/shared",eR=".cyberskill-storage",ej="node_modules",eG="dist",eM="package.json",ek="package-lock.json",eF="tsconfig.json",eK=".gitignore",ex=".simple-git-hooks.json",eU="pnpm-lock.yaml",eB=".git/hooks/",eY=".git/COMMIT_EDITMSG",eJ=W(eL,ej,eA,eG),eV="cyberskill",eW="eslint",eq="eslint",eX="vitest",eH="playwright",e$="vitest",ez="@commitlint/cli",eQ="commitlint",eZ="lint-staged",e0="lint-staged",e1="typescript",e2="tsc",e4="tsx",e3="git",e5="pnpm",e6="pnpm exec",e8="simple-git-hooks",e7="simple-git-hooks",e9="@eslint/config-inspector",te="eslint-config-inspector",tt="node-modules-inspector",tn="node-modules-inspector",tr={CYBERSKILL_DIRECTORY:eJ,WORKING_DIRECTORY:eL,TS_CONFIG:V(eF),GIT_IGNORE:V(eK),GIT_HOOK:V(eB),GIT_COMMIT_MSG:V(eY),SIMPLE_GIT_HOOKS_JSON:V(ex),PACKAGE_JSON:V(eM),PACKAGE_LOCK_JSON:V(ek),PNPM_LOCK_YAML:V(eU),NODE_MODULES:V(ej),CYBERSKILL:{LINT_STAGED_CONFIG:V("".concat(eJ,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:V("".concat(eJ,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:V("".concat(eJ,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:V("".concat(eJ,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:V("".concat(eJ,"/configs/vitest/react/e2e.js"))}};function ti(e){var t=e.isCurrentProject;return l({"pre-commit":e0,"commit-msg":eQ},t&&{"pre-push":ew("".concat(e3," pull"))})}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 i=d(n,2),c=i[0],a=i[1],o=e==="RAW"?!0:K(W(tr.NODE_MODULES,c));switch(e){case"PNPM_ADD_AND_EXEC":return eP(ew("".concat(o?"":"".concat(e5," add ").concat(c," && ")).concat(e6," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return eP(ew("".concat(o?"":"".concat(e5," add -D ").concat(c," && ")).concat(e6," ").concat(a)));case"RAW":return eP(ew(c))}}var ta={SIMPLE_GIT_HOOKS:tc("PNPM_ADD_DEV_AND_EXEC",e8,e7),ESLINT_INSPECT:tc("PNPM_ADD_DEV_AND_EXEC",e9,te),NODE_MODULES_INSPECT:tc("PNPM_ADD_DEV_AND_EXEC",tt,tn),ESLINT_CHECK:tc("PNPM_ADD_DEV_AND_EXEC",eW,"".concat(eq," ").concat(tr.WORKING_DIRECTORY)),ESLINT_FIX:tc("PNPM_ADD_DEV_AND_EXEC",eW,"".concat(eq," ").concat(tr.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tc("PNPM_ADD_AND_EXEC",e1,"".concat(e2," -p ").concat(tr.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tc("RAW","".concat(e3," config core.hooksPath ").concat(tr.GIT_HOOK)),BUILD:tc("RAW","".concat(e5," run build")),STAGE_BUILD_DIRECTORY:tc("RAW","".concat(e3," add ").concat(eG)),PNPM_INSTALL_STANDARD:tc("RAW","".concat(e5," install")),PNPM_INSTALL_LEGACY:tc("RAW","".concat(e5," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tc("RAW","".concat(e5," install --force")),CYBERSKILL:{TEST_UNIT:tc("PNPM_ADD_AND_EXEC",eX,"".concat(e$," --config ").concat(tr.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tc("PNPM_ADD_AND_EXEC","".concat(eX," ").concat(eH),"".concat(e$," --config ").concat(tr.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tc("PNPM_ADD_DEV_AND_EXEC",ez,"".concat(eQ," --edit ").concat(tr.GIT_COMMIT_MSG," --config ").concat(tr.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tc("PNPM_ADD_DEV_AND_EXEC",eZ,"".concat(e0," --config ").concat(tr.CYBERSKILL.LINT_STAGED_CONFIG))}};function to(e,t){return ts.apply(this,arguments)}function ts(){ts=i(function(e,t){return m(this,function(n){switch(n.label){case 0:eh.info("".concat(e,"...")),D&&eh.info("Executing command: ".concat(t));return[4,eO(t)];case 1:n.sent(),eh.success("".concat(e," completed successfully."));return[2]}})});return ts.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=i(function(){var e;return m(this,function(t){switch(t.label){case 0:if(!K(tr.TS_CONFIG))return[3,2];return[4,to("Performing TypeScript validation",ta.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=eh.warning("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tl.apply(this,arguments)}function tf(){return tp.apply(this,arguments)}function tp(){tp=i(function(){var e,t;var n=arguments;return m(this,function(r){switch(r.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:!1;if(!e)return[3,2];return[4,to("Running ESLint with auto-fix",ta.ESLINT_FIX)];case 1:t=r.sent();return[3,4];case 2:return[4,to("Running ESLint check",ta.ESLINT_CHECK)];case 3:t=r.sent();r.label=4;case 4:t;return[2]}})});return tp.apply(this,arguments)}function td(){return th.apply(this,arguments)}function th(){th=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,ev()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?eh.printBoxedLog("✔ NO ISSUES FOUND","",{color:"green"}):(eh.printBoxedLog("⚠ Warnings",n,{color:"yellow"}),eh.printBoxedLog("✖ Errors",t,{color:"red"}));return[2]}})});return th.apply(this,arguments)}function tg(){return ty.apply(this,arguments)}function ty(){ty=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,eE()];case 1:r.sent();return[4,ei(eA)];case 2:e=r.sent(),t=e.isCurrentProject;if(!t)return[3,7];r.label=3;case 3:r.trys.push([3,6,,7]);return[4,to("Building package: ".concat(eA),ta.BUILD)];case 4:r.sent();return[4,to("Staging build artifacts",ta.STAGE_BUILD_DIRECTORY)];case 5:r.sent();return[3,7];case 6:n=r.sent();throw eh.error("Error building and staging ".concat(eA,": ").concat(n.message)),n;case 7:return[4,to("Executing lint-staged",ta.CYBERSKILL.LINT_STAGED)];case 8:r.sent(),td();return[2]}})});return ty.apply(this,arguments)}function tm(){return tv.apply(this,arguments)}function tv(){tv=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Inspecting ESLint configuration",ta.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return tv.apply(this,arguments)}function t_(){return tE.apply(this,arguments)}function tE(){tE=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eE()];case 1:e.sent();return[4,Promise.all([tu(),tf()])];case 2:e.sent(),td();return[2]}})});return tE.apply(this,arguments)}function tb(){return tI.apply(this,arguments)}function tI(){tI=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eE()];case 1:e.sent();return[4,Promise.all([tu(),tf(!0)])];case 2:e.sent(),td();return[2]}})});return tI.apply(this,arguments)}function tS(){return tO.apply(this,arguments)}function tO(){tO=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,eE()];case 1:e.sent();return[4,to("Validating commit message",ta.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),td();return[2]}})});return tO.apply(this,arguments)}function tN(){return tw.apply(this,arguments)}function tw(){tw=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:return[4,to("Configuring Git hooks",ta.CONFIGURE_GIT_HOOK)];case 1:n.sent(),Y([tr.GIT_HOOK]);return[4,eC(ti)];case 2:e=n.sent();U(tr.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(ex,"\n");K(tr.GIT_IGNORE)?x(tr.GIT_IGNORE).split("\n").includes(ex)||B(tr.GIT_IGNORE,t):U(tr.GIT_IGNORE,t);return[4,to("Installing simple-git-hooks",ta.SIMPLE_GIT_HOOKS)];case 3:n.sent();return[2]}})});return tw.apply(this,arguments)}function tT(){return tP.apply(this,arguments)}function tP(){tP=i(function(){var e,t,n,r,i,c,a,o,s,u,l;return m(this,function(f){switch(f.label){case 0:e=[{command:ta.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:ta.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:ta.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,8,9,10]);i=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(c=i.next()).done))return[3,7];a=c.value,o=a.command,s=a.message;f.label=3;case 3:f.trys.push([3,5,,6]);return[4,to("".concat(s," using: ").concat(o),o)];case 4:f.sent();return[2];case 5:u=f.sent();eh.warning("Installation attempt failed: ".concat(o)),eh.error("Details: ".concat(u.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:l=f.sent();n=true;r=l;return[3,10];case 9:try{if(!t&&i.return!=null){i.return()}}finally{if(n){throw r}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return tP.apply(this,arguments)}function tC(e){return tD.apply(this,arguments)}function tD(){tD=i(function(e){var t,n,r,i,a;return m(this,function(o){switch(o.label){case 0:o.trys.push([0,4,,5]);return[4,ei(e)];case 1:t=o.sent(),n=t.installedPath,r=t.latestVersion,i=t.file;i.dependencies=p(l({},i.dependencies),c({},i.name,r)),U(n,i,{isJson:!0});return[4,tT()];case 2:o.sent();return[4,tb()];case 3:o.sent();return[3,5];case 4:a=o.sent();throw eh.error('Failed to update "'.concat(e,'": ').concat(a.message)),a;case 5:return[2]}})});return tD.apply(this,arguments)}function tL(){return tA.apply(this,arguments)}function tA(){tA=i(function(){var e,t,n,r,i,c,a;return m(this,function(o){switch(o.label){case 0:if(!K(tr.PACKAGE_JSON)){eh.error("package.json not found. Aborting setup.");return[2]}o.label=1;case 1:o.trys.push([1,7,,8]);return[4,ei(eA)];case 2:e=o.sent(),t=e.isInstalled,n=e.installedVersion,r=e.latestVersion,i=e.isCurrentProject;if(!(i||t&&n===r))return[3,3];c=eh.success("Cyberskill package is already up to date.");return[3,5];case 3:return[4,tC(eA)];case 4:c=o.sent();o.label=5;case 5:c;return[4,tN()];case 6:o.sent();return[3,8];case 7:a=o.sent();throw eh.error("Project setup failed: ".concat(a.message)),a;case 8:return[2]}})});return tA.apply(this,arguments)}function tR(){return tj.apply(this,arguments)}function tj(){tj=i(function(){return m(this,function(e){switch(e.label){case 0:Y([tr.NODE_MODULES,tr.PNPM_LOCK_YAML]);return[4,tT()];case 1:e.sent();return[4,tN()];case 2:e.sent();return[2]}})});return tj.apply(this,arguments)}function tG(){return tM.apply(this,arguments)}function tM(){tM=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Inspecting project dependencies",ta.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return tM.apply(this,arguments)}function tk(){return tF.apply(this,arguments)}function tF(){tF=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Running unit tests",ta.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return tF.apply(this,arguments)}function tK(){return tx.apply(this,arguments)}function tx(){tx=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Running end-to-end tests",ta.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return tx.apply(this,arguments)}(0,P.default)((0,T.hideBin)(w.default.argv)).scriptName(eV).usage("$0 <command> [options]").command("lint","Check code for linting issues",t_).command("lint:fix","Fix linting issues automatically",tb).command("lint:inspect","View active ESLint configuration",tm).command("lint-staged","Run lint checks on staged files",tg).command("commitlint","Validate commit message format",tS).command("setup","Initialize project setup and dependencies",tL).command("reset","Reset the project and reinstall dependencies",tR).command("inspect","Analyze installed project dependencies",tG).command("test:unit","Run unit test suite",tk).command("test:e2e","Run end-to-end test suite",tK).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse();
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
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,c){try{var s=e[i](c);var a=s.value}catch(e){n(e);return}if(s.done){t(a)}else{Promise.resolve(a).then(r,o)}}function o(e){return function(){var t=this,n=arguments;return new Promise(function(o,i){var c=e.apply(t,n);function s(e){r(c,o,i,s,a,"next",e)}function a(e){r(c,o,i,s,a,"throw",e)}s(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 c(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function s(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 c,s;try{for(n=n.call(e);!(o=(c=n.next()).done);o=true){r.push(c.value);if(t&&r.length===t)break}}catch(e){i=true;s=e}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw s}}return r}function a(){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 p(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 d(e,n){return t(e)||s(e,n)||y(e,n)||a()}function h(e){return n(e)||c(e)||y(e)||u()}function g(e){"@swc/helpers - typeof";return e&&typeof Symbol!=="undefined"&&e.constructor===Symbol?"symbol":typeof e}function y(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 m(e,t){var n,r,o,i,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(e){return function(t){return a([e,t])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(c)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:c.label++;return{value:i[1],done:false};case 5:c.label++;r=i[1];i=[0];continue;case 7:i=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){c=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(i[0]===6&&c.label<o[1]){c.label=o[1];o=i;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(i);break}if(o[2])c.ops.pop();c.trys.pop();continue}i=t.call(e,c)}catch(e){i=[6,e];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import v from"node:process";import{hideBin as E}from"yargs/helpers";import _ from"yargs/yargs";var b=process.env.DEBUG==="true",I=process.env.NODE_ENV!=="production",S=process.env.GRAPHQL_URI_DEFAULT||"/graphql";import O from"node:process";import N from"boxen";import T from"chalk";import{exec as w}from"node:child_process";import C from"node:process";import*as P from"node:util";import D from"node-fetch";import*as L from"node:fs";var A=function(e){return L.existsSync(e)};function R(e,t){var n=L.readFileSync(e,"utf-8");if(t===null||t===void 0?void 0:t.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":g(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(t){throw new Error("Failed to parse JSON from file: ".concat(e))}return n}function G(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,i=o&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);L.writeFileSync(e,i,"utf-8")}function j(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,i=o&&(typeof t==="undefined"?"undefined":g(t))=="object"?JSON.stringify(t,null,4):String(t);L.appendFileSync(e,i,"utf-8")}function M(e){e.forEach(function(e){A(e)&&L.rmSync(e,{recursive:!0,force:!0})})}import*as k from"node:path";function F(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=k).resolve.apply(r,[eS].concat(h(t)))}function K(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=k).join.apply(r,h(t))}import x from"node-persist";import U from"node:os";import B from"node:process";function Y(){return B.env.CYBERSKILL_STORAGE_DIR||K(U.homedir(),eN)}function J(){return V.apply(this,arguments)}function V(){V=o(function(){var e;return m(this,function(t){switch(t.label){case 0:e=x.defaultInstance;if(e)return[3,2];return[4,x.init({dir:Y(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:e=t.sent();t.label=2;case 2:e;return[2]}})});return V.apply(this,arguments)}var W={get:function e(e){return o(function(){var t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,J()];case 1:r.sent();return[4,x.getItem(e)];case 2:return[2,(t=r.sent())!==null&&t!==void 0?t:null];case 3:n=r.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(e,'":'),n),null)];case 4:return[2]}})})()},set:function e(e,t){return o(function(){var n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,J()];case 1:r.sent();return[4,x.setItem(e,t)];case 2:r.sent();return[3,4];case 3:n=r.sent();console.error('❌ [Storage:set] Error setting key "'.concat(e,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function e(e){return o(function(){var t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,J()];case 1:n.sent();return[4,x.removeItem(e)];case 2:n.sent();return[3,4];case 3:t=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(e,'":'),t);return[3,4];case 4:return[2]}})})()},keys:function e(){return o(function(){var e,t;return m(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,J()];case 1:n.sent();return[4,x.keys()];case 2:e=n.sent();return[2,Array.isArray(e)?e:(console.warn("⚠️ [Storage:keys] Invalid keys response:",e),[])];case 3:t=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",t),[])];case 4:return[2]}})})()},getLogLink:function e(e){return o(function(){return m(this,function(t){try{return[2,"".concat(Y()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var H=24*60*60*1e3;function X(e){var t=K(eS,eC);if(A(t))try{var n=R(t,{asJson:!0});if(n.name===e)return{path:t,file:n,isCurrentProject:!0}}catch(e){ec.warning("Failed to read local package.json: ".concat(e.message))}var r=K(eS,eT,e,eC);if(A(r))try{var o=R(r,{asJson:!0});if(o.name===e)return{path:r,file:o,isCurrentProject:!1}}catch(t){ec.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(t.message))}return!1}function $(e){return z.apply(this,arguments)}function z(){z=o(function(e){var t,n,r,o,i,c,s,a,u,l;var f=arguments;return m(this,function(p){switch(p.label){case 0:t=f.length>1&&f[1]!==void 0?f[1]:!1;n="npm_version:".concat(e),r="npm_metadata:".concat(e);return[4,W.get(n)];case 1:o=p.sent();return[4,W.get(r)];case 2:i=p.sent(),c=o&&Date.now()-o.timestamp<H;if(!t&&c)return[2,o.version];s={};(i===null||i===void 0?void 0:i.etag)&&(s["If-None-Match"]=i.etag),(i===null||i===void 0?void 0:i.lastModified)&&(s["If-Modified-Since"]=i.lastModified);p.label=3;case 3:p.trys.push([3,8,,9]);return[4,D("https://registry.npmjs.org/".concat(e,"/latest"),{headers:s})];case 4:a=p.sent();if(a.status===304&&o)return[2,o.version];if(!a.ok)throw new Error("Failed to fetch latest version: ".concat(a.statusText));return[4,a.json()];case 5:u=p.sent().version;return[4,W.set(n,{version:u,timestamp:Date.now()})];case 6:p.sent();return[4,W.set(r,{etag:a.headers.get("ETag")||void 0,lastModified:a.headers.get("Last-Modified")||void 0})];case 7:return[2,(p.sent(),u)];case 8:l=p.sent();if(ec.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),o)return[2,(ec.warning("Falling back to cached version for ".concat(e,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return z.apply(this,arguments)}function q(e){return Q.apply(this,arguments)}function Q(){Q=o(function(e){var t,n,r,o,i;return m(this,function(c){switch(c.label){case 0:t={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};c.label=1;case 1:c.trys.push([1,6,,7]);n=X(e);r=n;if(!r)return[3,5];t.file=n.file,t.isInstalled=!0,t.installedPath=n.path,t.installedVersion=n.file.version,t.isCurrentProject=n.isCurrentProject;if(!n.isCurrentProject)return[3,2];o=n.file.version;return[3,4];case 2:return[4,$(e,!0)];case 3:o=c.sent();c.label=4;case 4:r=t.latestVersion=o;c.label=5;case 5:return[2,(r,t)];case 6:i=c.sent();return[2,(ec.error('Error checking package "'.concat(e,'": ').concat(i.message)),t)];case 7:return[2]}})});return Q.apply(this,arguments)}var Z=P.promisify(w),ee=T.gray,et=T.blue;function en(){return ee("[".concat(new Date().toLocaleTimeString(),"]"))}function er(e){var t=T[e];return typeof t=="function"?t:T.green}function eo(e,t,n,r){var o=er(t);console.log("".concat(en()," ").concat(o("".concat(n," ").concat(e))," ").concat(r))}function ei(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.color,o=r===void 0?"green":r,i=n.padding,c=i===void 0?1:i,s=n.margin,a=s===void 0?1:s,u=n.borderStyle,l=u===void 0?"round":u,f=n.titleColor,p=f===void 0?"bold":f;var d=er(o),h=er(p);if(typeof t=="string"){console.log(N(h(d("".concat(e,"\n").concat(t))),{padding:c,margin:a,borderStyle:l,borderColor:o}));return}Array.isArray(t)&&t.length&&(t.forEach(function(e){var t=e.file,n=e.position,r=e.rule,o=e.message;console.log("".concat(en()," ").concat(d("File:")," ").concat(et("".concat(t).concat(n?":".concat(n):"")))),r&&console.log(" ".concat(d("Rule:")," ").concat(d(r))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log(N(h(d("".concat(e,": ").concat(t.length))),{padding:c,margin:a,borderStyle:l,borderColor:o})),console.log(ee("─".repeat(40))))}var ec={success:function(e){return eo("SUCCESS","green","✔",e)},error:function(e){return eo("ERROR","red","✖",e)},warning:function(e){return eo("WARNING","yellow","⚠",e)},info:function(e){return eo("INFO","blue","ℹ",e)},printBoxedLog:ei};function es(e){return"error_list:".concat(e)}function ea(e){return eu.apply(this,arguments)}function eu(){eu=o(function(e){var t,n,r;return m(this,function(i){switch(i.label){case 0:if(e.length===0)return[2];t=Date.now(),n=es(t);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,W.set(n,{errors:e,timestamp:t})];case 2:i.sent(),setTimeout(/*#__PURE__*/o(function(){var e;return m(this,function(t){switch(t.label){case 0:return[4,W.getLogLink(n)];case 1:e=t.sent();e&&ec.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=i.sent();ec.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return eu.apply(this,arguments)}function el(){return ef.apply(this,arguments)}function ef(){ef=o(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,W.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(/*#__PURE__*/function(){var e=o(function(e){var t;return m(this,function(n){switch(n.label){case 0:return[4,W.get(e)];case 1:return[2,((t=n.sent())===null||t===void 0?void 0:t.errors)||[]]}})});return function(t){return e.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(ec.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return ef.apply(this,arguments)}function ep(){return ed.apply(this,arguments)}function ed(){ed=o(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,W.keys()];case 1:e=r.sent(),t=Array.isArray(e)?e.filter(function(e){var t;return e===null||e===void 0?void 0:(t=e.startsWith)===null||t===void 0?void 0:t.call(e,"error_list:")}):[];return[4,Promise.all(t.map(function(e){return W.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();ec.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return ed.apply(this,arguments)}function eh(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.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;e.split("\n").forEach(function(e){if(e.startsWith("/"))r=e.trim();else{var s=o.exec(e)||[],a=i.exec(e)||[],u=c.exec(e)||[];s.length&&r?t.push({file:r,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):a.length?t.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?t.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(e.trim())}}),t.length&&ea(t),n.length&&b&&(ec.warning("Unmatched lines:"),n.forEach(function(e){return console.log(" ".concat(e))}))}function eg(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,c=e.ruleId,s=e.message;n.push({type:r===2?"error":"warning",file:t,position:"".concat(o,":").concat(i),rule:c,message:s})})}),n.length&&ea(n)}catch(t){eh(e)}}function ey(e){return em.apply(this,arguments)}function em(){em=o(function(e){var t,n,r,o,i,c,s,a,u;var l=arguments;return m(this,function(f){switch(f.label){case 0:t=l.length>1&&l[1]!==void 0?l[1]:eg;n=new AbortController;C.on("SIGINT",function(){ec.warning("Process interrupted. Terminating..."),n.abort(),C.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,Z(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)});return[3,4];case 3:c=f.sent();s=c.stdout,a=c.stderr,u=c.message;[s,a].forEach(function(e){return e&&t(e)}),!a&&!s&&ec.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return em.apply(this,arguments)}function ev(e){return{raw:!0,cmd:e}}function eE(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(eQ," ").concat(eO," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(eQ," ").concat(e$," src/cli.ts ").concat(e):"".concat(eQ," ").concat(ek," ").concat(e)}function e_(e,t){return typeof e=="function"?eE(e(t),t):(typeof e==="undefined"?"undefined":g(e))=="object"&&(e===null||e===void 0?void 0:e.raw)===!0?e.cmd:typeof e=="string"?eE(e,t):e}function eb(e){return eI.apply(this,arguments)}function eI(){eI=o(function(e){var t,n,r,o,i,c,s;var a=arguments;return m(this,function(u){switch(u.label){case 0:t=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=t===null||t===void 0?void 0:t.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];s=!1;return[3,3];case 1:return[4,q(eO)];case 2:s=u.sent().isCurrentProject;u.label=3;case 3:o=s,i={isRemote:r,isCurrentProject:o},c=typeof e=="function"?e(i):e;return[2,Object.fromEntries(Object.entries(c).map(function(e){var t=d(e,2),n=t[0],r=t[1];return[n,e_(r,i)]}))]}})});return eI.apply(this,arguments)}var eS=O.env.INIT_CWD||O.cwd(),eO="@cyberskill/shared",eN=".cyberskill-storage",eT="node_modules",ew="dist",eC="package.json",eP="package-lock.json",eD="tsconfig.json",eL=".gitignore",eA=".simple-git-hooks.json",eR="pnpm-lock.yaml",eG=".git/hooks/",ej=".git/COMMIT_EDITMSG",eM=K(eS,eT,eO,ew),ek="cyberskill",eF="eslint",eK="eslint",ex="vitest",eU="playwright",eB="vitest",eY="@commitlint/cli",eJ="commitlint",eV="lint-staged",eW="lint-staged",eH="typescript",eX="tsc",e$="tsx",ez="git",eq="pnpm",eQ="pnpm exec",eZ="simple-git-hooks",e0="simple-git-hooks",e2="@eslint/config-inspector",e4="eslint-config-inspector",e1="node-modules-inspector",e3="node-modules-inspector",e5={CYBERSKILL_DIRECTORY:eM,WORKING_DIRECTORY:eS,TS_CONFIG:F(eD),GIT_IGNORE:F(eL),GIT_HOOK:F(eG),GIT_COMMIT_MSG:F(ej),SIMPLE_GIT_HOOKS_JSON:F(eA),PACKAGE_JSON:F(eC),PACKAGE_LOCK_JSON:F(eP),PNPM_LOCK_YAML:F(eR),NODE_MODULES:F(eT),CYBERSKILL:{LINT_STAGED_CONFIG:F("".concat(eM,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:F("".concat(eM,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:F("".concat(eM,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:F("".concat(eM,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:F("".concat(eM,"/configs/vitest/react/e2e.js"))}};function e6(e){var t=e.isCurrentProject;return l({"pre-commit":eW,"commit-msg":eJ},t&&{"pre-push":ev("".concat(ez," pull"))})}function e8(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=d(n,2),i=o[0],c=o[1],s=e==="RAW"?!0:A(K(e5.NODE_MODULES,i));switch(e){case"PNPM_ADD_AND_EXEC":return e_(ev("".concat(s?"":"".concat(eq," add ").concat(i," && ")).concat(eQ," ").concat(c)));case"PNPM_ADD_DEV_AND_EXEC":return e_(ev("".concat(s?"":"".concat(eq," add -D ").concat(i," && ")).concat(eQ," ").concat(c)));case"RAW":return e_(ev(i))}}var e7={SIMPLE_GIT_HOOKS:e8("PNPM_ADD_DEV_AND_EXEC",eZ,e0),ESLINT_INSPECT:e8("PNPM_ADD_DEV_AND_EXEC",e2,e4),NODE_MODULES_INSPECT:e8("PNPM_ADD_DEV_AND_EXEC",e1,e3),ESLINT_CHECK:e8("PNPM_ADD_DEV_AND_EXEC",eF,"".concat(eK," ").concat(e5.WORKING_DIRECTORY)),ESLINT_FIX:e8("PNPM_ADD_DEV_AND_EXEC",eF,"".concat(eK," ").concat(e5.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:e8("PNPM_ADD_AND_EXEC",eH,"".concat(eX," -p ").concat(e5.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:e8("RAW","".concat(ez," config core.hooksPath ").concat(e5.GIT_HOOK)),BUILD:e8("RAW","".concat(eq," run build")),STAGE_BUILD_DIRECTORY:e8("RAW","".concat(ez," add ").concat(ew)),PNPM_INSTALL_STANDARD:e8("RAW","".concat(eq," install")),PNPM_INSTALL_LEGACY:e8("RAW","".concat(eq," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:e8("RAW","".concat(eq," install --force")),CYBERSKILL:{TEST_UNIT:e8("PNPM_ADD_AND_EXEC",ex,"".concat(eB," --config ").concat(e5.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:e8("PNPM_ADD_AND_EXEC","".concat(ex," ").concat(eU),"".concat(eB," --config ").concat(e5.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:e8("PNPM_ADD_DEV_AND_EXEC",eY,"".concat(eJ," --edit ").concat(e5.GIT_COMMIT_MSG," --config ").concat(e5.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:e8("PNPM_ADD_DEV_AND_EXEC",eV,"".concat(eW," --config ").concat(e5.CYBERSKILL.LINT_STAGED_CONFIG))}};function e9(e,t){return te.apply(this,arguments)}function te(){te=o(function(e,t){return m(this,function(n){switch(n.label){case 0:ec.info("".concat(e,"...")),b&&ec.info("Executing command: ".concat(t));return[4,ey(t)];case 1:n.sent(),ec.success("".concat(e," completed successfully."));return[2]}})});return te.apply(this,arguments)}function tt(){return tn.apply(this,arguments)}function tn(){tn=o(function(){var e;return m(this,function(t){switch(t.label){case 0:if(!A(e5.TS_CONFIG))return[3,2];return[4,e9("Performing TypeScript validation",e7.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=ec.warning("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tn.apply(this,arguments)}function tr(){return to.apply(this,arguments)}function to(){to=o(function(){var e,t;var n=arguments;return m(this,function(r){switch(r.label){case 0:e=n.length>0&&n[0]!==void 0?n[0]:!1;if(!e)return[3,2];return[4,e9("Running ESLint with auto-fix",e7.ESLINT_FIX)];case 1:t=r.sent();return[3,4];case 2:return[4,e9("Running ESLint check",e7.ESLINT_CHECK)];case 3:t=r.sent();r.label=4;case 4:t;return[2]}})});return to.apply(this,arguments)}function ti(){return tc.apply(this,arguments)}function tc(){tc=o(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,el()];case 1:e=r.sent(),t=e.filter(function(e){return e.type==="error"}),n=e.filter(function(e){return e.type==="warning"});!t.length&&!n.length?ec.printBoxedLog("✔ NO ISSUES FOUND","",{color:"green"}):(ec.printBoxedLog("⚠ Warnings",n,{color:"yellow"}),ec.printBoxedLog("✖ Errors",t,{color:"red"}));return[2]}})});return tc.apply(this,arguments)}function ts(){return ta.apply(this,arguments)}function ta(){ta=o(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,ep()];case 1:r.sent();return[4,q(eO)];case 2:e=r.sent(),t=e.isCurrentProject;if(!t)return[3,7];r.label=3;case 3:r.trys.push([3,6,,7]);return[4,e9("Building package: ".concat(eO),e7.BUILD)];case 4:r.sent();return[4,e9("Staging build artifacts",e7.STAGE_BUILD_DIRECTORY)];case 5:r.sent();return[3,7];case 6:n=r.sent();throw ec.error("Error building and staging ".concat(eO,": ").concat(n.message)),n;case 7:return[4,e9("Executing lint-staged",e7.CYBERSKILL.LINT_STAGED)];case 8:r.sent(),ti();return[2]}})});return ta.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,e9("Inspecting ESLint configuration",e7.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return tl.apply(this,arguments)}function tf(){return tp.apply(this,arguments)}function tp(){tp=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,ep()];case 1:e.sent();return[4,Promise.all([tt(),tr()])];case 2:e.sent(),ti();return[2]}})});return tp.apply(this,arguments)}function td(){return th.apply(this,arguments)}function th(){th=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,ep()];case 1:e.sent();return[4,Promise.all([tt(),tr(!0)])];case 2:e.sent(),ti();return[2]}})});return th.apply(this,arguments)}function tg(){return ty.apply(this,arguments)}function ty(){ty=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,ep()];case 1:e.sent();return[4,e9("Validating commit message",e7.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),ti();return[2]}})});return ty.apply(this,arguments)}function tm(){return tv.apply(this,arguments)}function tv(){tv=o(function(){var e,t;return m(this,function(n){switch(n.label){case 0:return[4,e9("Configuring Git hooks",e7.CONFIGURE_GIT_HOOK)];case 1:n.sent(),M([e5.GIT_HOOK]);return[4,eb(e6)];case 2:e=n.sent();G(e5.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(eA,"\n");A(e5.GIT_IGNORE)?R(e5.GIT_IGNORE).split("\n").includes(eA)||j(e5.GIT_IGNORE,t):G(e5.GIT_IGNORE,t);return[4,e9("Installing simple-git-hooks",e7.SIMPLE_GIT_HOOKS)];case 3:n.sent();return[2]}})});return tv.apply(this,arguments)}function tE(){return t_.apply(this,arguments)}function t_(){t_=o(function(){var e,t,n,r,o,i,c,s,a,u,l;return m(this,function(f){switch(f.label){case 0:e=[{command:e7.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:e7.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:e7.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];t=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,8,9,10]);o=e[Symbol.iterator]();f.label=2;case 2:if(!!(t=(i=o.next()).done))return[3,7];c=i.value,s=c.command,a=c.message;f.label=3;case 3:f.trys.push([3,5,,6]);return[4,e9("".concat(a," using: ").concat(s),s)];case 4:f.sent();return[2];case 5:u=f.sent();ec.warning("Installation attempt failed: ".concat(s)),ec.error("Details: ".concat(u.message));return[3,6];case 6:t=true;return[3,2];case 7:return[3,10];case 8:l=f.sent();n=true;r=l;return[3,10];case 9:try{if(!t&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return t_.apply(this,arguments)}function tb(e){return tI.apply(this,arguments)}function tI(){tI=o(function(e){var t,n,r,o,c;return m(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,q(e)];case 1:t=s.sent(),n=t.installedPath,r=t.latestVersion,o=t.file;o.dependencies=p(l({},o.dependencies),i({},o.name,r)),G(n,o,{isJson:!0});return[4,tE()];case 2:s.sent();return[4,td()];case 3:s.sent();return[3,5];case 4:c=s.sent();throw ec.error('Failed to update "'.concat(e,'": ').concat(c.message)),c;case 5:return[2]}})});return tI.apply(this,arguments)}function tS(){return tO.apply(this,arguments)}function tO(){tO=o(function(){var e,t,n,r,o,i,c;return m(this,function(s){switch(s.label){case 0:if(!A(e5.PACKAGE_JSON)){ec.error("package.json not found. Aborting setup.");return[2]}s.label=1;case 1:s.trys.push([1,7,,8]);return[4,q(eO)];case 2:e=s.sent(),t=e.isInstalled,n=e.installedVersion,r=e.latestVersion,o=e.isCurrentProject;if(!(o||t&&n===r))return[3,3];i=ec.success("Cyberskill package is already up to date.");return[3,5];case 3:return[4,tb(eO)];case 4:i=s.sent();s.label=5;case 5:i;return[4,tm()];case 6:s.sent();return[3,8];case 7:c=s.sent();throw ec.error("Project setup failed: ".concat(c.message)),c;case 8:return[2]}})});return tO.apply(this,arguments)}function tN(){return tT.apply(this,arguments)}function tT(){tT=o(function(){return m(this,function(e){switch(e.label){case 0:M([e5.NODE_MODULES,e5.PNPM_LOCK_YAML]);return[4,tE()];case 1:e.sent();return[4,tm()];case 2:e.sent();return[2]}})});return tT.apply(this,arguments)}function tw(){return tC.apply(this,arguments)}function tC(){tC=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,e9("Inspecting project dependencies",e7.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return tC.apply(this,arguments)}function tP(){return tD.apply(this,arguments)}function tD(){tD=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,e9("Running unit tests",e7.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return tD.apply(this,arguments)}function tL(){return tA.apply(this,arguments)}function tA(){tA=o(function(){return m(this,function(e){switch(e.label){case 0:return[4,e9("Running end-to-end tests",e7.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return tA.apply(this,arguments)}_(E(v.argv)).scriptName(ek).usage("$0 <command> [options]").command("lint","Check code for linting issues",tf).command("lint:fix","Fix linting issues automatically",td).command("lint:inspect","View active ESLint configuration",tu).command("lint-staged","Run lint checks on staged files",ts).command("commitlint","Validate commit message format",tg).command("setup","Initialize project setup and dependencies",tS).command("reset","Reset the project and reinstall dependencies",tN).command("inspect","Analyze installed project dependencies",tw).command("test:unit","Run unit test suite",tP).command("test:e2e","Run end-to-end test suite",tL).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse();
|
|
2
|
+
function t(t,e){if(e==null||e>t.length)e=t.length;for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function e(t){if(Array.isArray(t))return t}function n(e){if(Array.isArray(e))return t(e)}function r(t,e,n,r,o,i,c){try{var s=t[i](c);var a=s.value}catch(t){n(t);return}if(s.done){e(a)}else{Promise.resolve(a).then(r,o)}}function o(t){return function(){var e=this,n=arguments;return new Promise(function(o,i){var c=t.apply(e,n);function s(t){r(c,o,i,s,a,"next",t)}function a(t){r(c,o,i,s,a,"throw",t)}s(undefined)})}}function i(t,e,n){if(e in t){Object.defineProperty(t,e,{value:n,enumerable:true,configurable:true,writable:true})}else{t[e]=n}return t}function c(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function s(t,e){var n=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(n==null)return;var r=[];var o=true;var i=false;var c,s;try{for(n=n.call(t);!(o=(c=n.next()).done);o=true){r.push(c.value);if(e&&r.length===e)break}}catch(t){i=true;s=t}finally{try{if(!o&&n["return"]!=null)n["return"]()}finally{if(i)throw s}}return r}function a(){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(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};var r=Object.keys(n);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))}r.forEach(function(e){i(t,e,n[e])})}return t}function f(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);if(e){r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})}n.push.apply(n,r)}return n}function p(t,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}else{f(Object(e)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}return t}function d(t,n){return e(t)||s(t,n)||m(t,n)||a()}function h(t){return n(t)||c(t)||m(t)||u()}function g(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function m(e,n){if(!e)return;if(typeof e==="string")return t(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor)r=e.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 t(e,n)}function y(t,e){var n,r,o,i,c={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),"throw":s(1),"return":s(2)},typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function s(t){return function(e){return a([t,e])}}function a(i){if(n)throw new TypeError("Generator is already executing.");while(c)try{if(n=1,r&&(o=i[0]&2?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;if(r=0,o)i=[i[0]&2,o.value];switch(i[0]){case 0:case 1:o=i;break;case 4:c.label++;return{value:i[1],done:false};case 5:c.label++;r=i[1];i=[0];continue;case 7:i=c.ops.pop();c.trys.pop();continue;default:if(!(o=c.trys,o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){c=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(i[0]===6&&c.label<o[1]){c.label=o[1];o=i;break}if(o&&c.label<o[2]){c.label=o[2];c.ops.push(i);break}if(o[2])c.ops.pop();c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t];r=0}finally{n=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:true}}}import v from"node:process";import{hideBin as E}from"yargs/helpers";import _ from"yargs/yargs";import b from"node:process";var I=b.env.DEBUG==="true";import S from"node:process";import O from"boxen";import N from"chalk";import{exec as T}from"node:child_process";import w from"node:process";import*as C from"node:util";import P from"node-fetch";import*as D from"node:fs";var L=function(t){return D.existsSync(t)};function A(t,e){var n=D.readFileSync(t,"utf-8");if(e===null||e===void 0?void 0:e.asJson)try{var r=JSON.parse(n);if((typeof r==="undefined"?"undefined":g(r))=="object"&&r!==null)return r;throw new Error("Parsed JSON is not an object or array")}catch(e){throw new Error("Failed to parse JSON from file: ".concat(t))}return n}function R(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,i=o&&(typeof e==="undefined"?"undefined":g(e))=="object"?JSON.stringify(e,null,4):String(e);D.writeFileSync(t,i,"utf-8")}function j(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var r=n.isJson,o=r===void 0?!1:r,i=o&&(typeof e==="undefined"?"undefined":g(e))=="object"?JSON.stringify(e,null,4):String(e);D.appendFileSync(t,i,"utf-8")}function G(t){t.forEach(function(t){L(t)&&D.rmSync(t,{recursive:!0,force:!0})})}import*as M from"node:path";function k(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++){e[n]=arguments[n]}var r;return(r=M).resolve.apply(r,[tI].concat(h(e)))}function F(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++){e[n]=arguments[n]}var r;return(r=M).join.apply(r,h(e))}import K from"node-persist";import x from"node:os";import U from"node:process";function B(){return U.env.CYBERSKILL_STORAGE_DIR||F(x.homedir(),tO)}function Y(){return J.apply(this,arguments)}function J(){J=o(function(){var t;return y(this,function(e){switch(e.label){case 0:t=K.defaultInstance;if(t)return[3,2];return[4,K.init({dir:B(),stringify:JSON.stringify,parse:JSON.parse,encoding:"utf8",logging:!1,forgiveParseErrors:!0})];case 1:t=e.sent();e.label=2;case 2:t;return[2]}})});return J.apply(this,arguments)}var V={get:function t(t){return o(function(){var e,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Y()];case 1:r.sent();return[4,K.getItem(t)];case 2:return[2,(e=r.sent())!==null&&e!==void 0?e:null];case 3:n=r.sent();return[2,(console.error('❌ [Storage:get] Error getting key "'.concat(t,'":'),n),null)];case 4:return[2]}})})()},set:function t(t,e){return o(function(){var n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Y()];case 1:r.sent();return[4,K.setItem(t,e)];case 2:r.sent();return[3,4];case 3:n=r.sent();console.error('❌ [Storage:set] Error setting key "'.concat(t,'":'),n);return[3,4];case 4:return[2]}})})()},remove:function t(t){return o(function(){var e;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,Y()];case 1:n.sent();return[4,K.removeItem(t)];case 2:n.sent();return[3,4];case 3:e=n.sent();console.error('❌ [Storage:remove] Error removing key "'.concat(t,'":'),e);return[3,4];case 4:return[2]}})})()},keys:function t(){return o(function(){var t,e;return y(this,function(n){switch(n.label){case 0:n.trys.push([0,3,,4]);return[4,Y()];case 1:n.sent();return[4,K.keys()];case 2:t=n.sent();return[2,Array.isArray(t)?t:(console.warn("⚠️ [Storage:keys] Invalid keys response:",t),[])];case 3:e=n.sent();return[2,(console.error("❌ [Storage:keys] Error getting keys:",e),[])];case 4:return[2]}})})()},getLogLink:function t(t){return o(function(){return y(this,function(e){try{return[2,"".concat(B()," (key: ").concat(t,")")]}catch(t){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",t),null)]}return[2]})})()}};var W=24*60*60*1e3;function X(t){var e=F(tI,tw);if(L(e))try{var n=A(e,{asJson:!0});if(n.name===t)return{path:e,file:n,isCurrentProject:!0}}catch(t){ti.warning("Failed to read local package.json: ".concat(t.message))}var r=F(tI,tN,t,tw);if(L(r))try{var o=A(r,{asJson:!0});if(o.name===t)return{path:r,file:o,isCurrentProject:!1}}catch(e){ti.warning("Failed to read node_modules package.json for ".concat(t,": ").concat(e.message))}return!1}function H(t){return $.apply(this,arguments)}function $(){$=o(function(t){var e,n,r,o,i,c,s,a,u,l;var f=arguments;return y(this,function(p){switch(p.label){case 0:e=f.length>1&&f[1]!==void 0?f[1]:!1;n="npm_version:".concat(t),r="npm_metadata:".concat(t);return[4,V.get(n)];case 1:o=p.sent();return[4,V.get(r)];case 2:i=p.sent(),c=o&&Date.now()-o.timestamp<W;if(!e&&c)return[2,o.version];s={};(i===null||i===void 0?void 0:i.etag)&&(s["If-None-Match"]=i.etag),(i===null||i===void 0?void 0:i.lastModified)&&(s["If-Modified-Since"]=i.lastModified);p.label=3;case 3:p.trys.push([3,8,,9]);return[4,P("https://registry.npmjs.org/".concat(t,"/latest"),{headers:s})];case 4:a=p.sent();if(a.status===304&&o)return[2,o.version];if(!a.ok)throw new Error("Failed to fetch latest version: ".concat(a.statusText));return[4,a.json()];case 5:u=p.sent().version;return[4,V.set(n,{version:u,timestamp:Date.now()})];case 6:p.sent();return[4,V.set(r,{etag:a.headers.get("ETag")||void 0,lastModified:a.headers.get("Last-Modified")||void 0})];case 7:return[2,(p.sent(),u)];case 8:l=p.sent();if(ti.error("Error fetching latest version for ".concat(t,": ").concat(l.message)),o)return[2,(ti.warning("Falling back to cached version for ".concat(t,": ").concat(o.version)),o.version)];throw l;case 9:return[2]}})});return $.apply(this,arguments)}function z(t){return q.apply(this,arguments)}function q(){q=o(function(t){var e,n,r,o,i;return y(this,function(c){switch(c.label){case 0:e={isInstalled:!1,isCurrentProject:!1,installedPath:"",installedVersion:"",latestVersion:"",file:{}};c.label=1;case 1:c.trys.push([1,6,,7]);n=X(t);r=n;if(!r)return[3,5];e.file=n.file,e.isInstalled=!0,e.installedPath=n.path,e.installedVersion=n.file.version,e.isCurrentProject=n.isCurrentProject;if(!n.isCurrentProject)return[3,2];o=n.file.version;return[3,4];case 2:return[4,H(t,!0)];case 3:o=c.sent();c.label=4;case 4:r=e.latestVersion=o;c.label=5;case 5:return[2,(r,e)];case 6:i=c.sent();return[2,(ti.error('Error checking package "'.concat(t,'": ').concat(i.message)),e)];case 7:return[2]}})});return q.apply(this,arguments)}var Q=C.promisify(T),Z=N.gray,tt=N.blue;function te(){return Z("[".concat(new Date().toLocaleTimeString(),"]"))}function tn(t){var e=N[t];return typeof e=="function"?e:N.green}function tr(t,e,n,r){var o=tn(e);console.log("".concat(te()," ").concat(o("".concat(n," ").concat(t))," ").concat(r))}function to(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.color,o=r===void 0?"green":r,i=n.padding,c=i===void 0?1:i,s=n.margin,a=s===void 0?1:s,u=n.borderStyle,l=u===void 0?"round":u,f=n.titleColor,p=f===void 0?"bold":f;var d=tn(o),h=tn(p);if(typeof e=="string"){console.log(O(h(d("".concat(t,"\n").concat(e))),{padding:c,margin:a,borderStyle:l,borderColor:o}));return}Array.isArray(e)&&e.length&&(e.forEach(function(t){var e=t.file,n=t.position,r=t.rule,o=t.message;console.log("".concat(te()," ").concat(d("File:")," ").concat(tt("".concat(e).concat(n?":".concat(n):"")))),r&&console.log(" ".concat(d("Rule:")," ").concat(d(r))),console.log(" ".concat(d("Message:")," ").concat(d(o)))}),console.log(O(h(d("".concat(t,": ").concat(e.length))),{padding:c,margin:a,borderStyle:l,borderColor:o})),console.log(Z("─".repeat(40))))}var ti={success:function(t){return tr("SUCCESS","green","✔",t)},error:function(t){return tr("ERROR","red","✖",t)},warning:function(t){return tr("WARNING","yellow","⚠",t)},info:function(t){return tr("INFO","blue","ℹ",t)},printBoxedLog:to};function tc(t){return"error_list:".concat(t)}function ts(t){return ta.apply(this,arguments)}function ta(){ta=o(function(t){var e,n,r;return y(this,function(i){switch(i.label){case 0:if(t.length===0)return[2];e=Date.now(),n=tc(e);i.label=1;case 1:i.trys.push([1,3,,4]);return[4,V.set(n,{errors:t,timestamp:e})];case 2:i.sent(),setTimeout(/*#__PURE__*/o(function(){var t;return y(this,function(e){switch(e.label){case 0:return[4,V.getLogLink(n)];case 1:t=e.sent();t&&ti.info("\uD83D\uDCC2 Open the error list manually: ".concat(t));return[2]}})}),10);return[3,4];case 3:r=i.sent();ti.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return ta.apply(this,arguments)}function tu(){return tl.apply(this,arguments)}function tl(){tl=o(function(){var t,e,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,V.keys()];case 1:t=r.sent(),e=Array.isArray(t)?t.filter(function(t){var e;return t===null||t===void 0?void 0:(e=t.startsWith)===null||e===void 0?void 0:e.call(t,"error_list:")}):[];return[4,Promise.all(e.map(/*#__PURE__*/function(){var t=o(function(t){var e;return y(this,function(n){switch(n.label){case 0:return[4,V.get(t)];case 1:return[2,((e=n.sent())===null||e===void 0?void 0:e.errors)||[]]}})});return function(e){return t.apply(this,arguments)}}()))];case 2:return[2,r.sent().flat()];case 3:n=r.sent();return[2,(ti.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return tl.apply(this,arguments)}function tf(){return tp.apply(this,arguments)}function tp(){tp=o(function(){var t,e,n;return y(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,V.keys()];case 1:t=r.sent(),e=Array.isArray(t)?t.filter(function(t){var e;return t===null||t===void 0?void 0:(e=t.startsWith)===null||e===void 0?void 0:e.call(t,"error_list:")}):[];return[4,Promise.all(e.map(function(t){return V.remove(t)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();ti.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return tp.apply(this,arguments)}function td(t){var e=[],n=[],r="",o=/^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$/,i=/^(.+?)\((\d+),(\d+)\):\s+(error|warning)\s+TS\d+:\s+(\S.+)$/,c=/^✖\s+(.*?)\s+\[(.*?)\]$/;t.split("\n").forEach(function(t){if(t.startsWith("/"))r=t.trim();else{var s=o.exec(t)||[],a=i.exec(t)||[],u=c.exec(t)||[];s.length&&r?e.push({file:r,position:"".concat(s[1],":").concat(s[2]),type:s[3]==="error"?"error":"warning",message:s[4].trim(),rule:s[5].trim()}):a.length?e.push({file:a[1],position:"".concat(a[2],":").concat(a[3]),type:a[4]==="error"?"error":"warning",message:a[5].trim()}):u.length?e.push({file:"commitlint",type:"error",message:u[1].trim(),rule:u[2].trim()}):n.push(t.trim())}}),e.length&&ts(e),n.length&&I&&(ti.warning("Unmatched lines:"),n.forEach(function(t){return console.log(" ".concat(t))}))}function th(t){try{var e=JSON.parse(t),n=[];e.forEach(function(t){var e=t.filePath,r=t.messages;r.forEach(function(t){var r=t.severity,o=t.line,i=t.column,c=t.ruleId,s=t.message;n.push({type:r===2?"error":"warning",file:e,position:"".concat(o,":").concat(i),rule:c,message:s})})}),n.length&&ts(n)}catch(e){td(t)}}function tg(t){return tm.apply(this,arguments)}function tm(){tm=o(function(t){var e,n,r,o,i,c,s,a,u;var l=arguments;return y(this,function(f){switch(f.label){case 0:e=l.length>1&&l[1]!==void 0?l[1]:th;n=new AbortController;w.on("SIGINT",function(){ti.warning("Process interrupted. Terminating..."),n.abort(),w.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,Q(t,{maxBuffer:0x6400000,signal:n.signal})];case 2:r=f.sent(),o=r.stdout,i=r.stderr;[o,i].forEach(function(t){return t&&e(t)});return[3,4];case 3:c=f.sent();s=c.stdout,a=c.stderr,u=c.message;[s,a].forEach(function(t){return t&&e(t)}),!a&&!s&&ti.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return tm.apply(this,arguments)}function ty(t){return{raw:!0,cmd:t}}function tv(t,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(tq," ").concat(tS," ").concat(t):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(tq," ").concat(tH," src/cli.ts ").concat(t):"".concat(tq," ").concat(tM," ").concat(t)}function tE(t,e){return typeof t=="function"?tv(t(e),e):(typeof t==="undefined"?"undefined":g(t))=="object"&&(t===null||t===void 0?void 0:t.raw)===!0?t.cmd:typeof t=="string"?tv(t,e):t}function t_(t){return tb.apply(this,arguments)}function tb(){tb=o(function(t){var e,n,r,o,i,c,s;var a=arguments;return y(this,function(u){switch(u.label){case 0:e=a.length>1&&a[1]!==void 0?a[1]:{};r=(n=e===null||e===void 0?void 0:e.isRemote)!==null&&n!==void 0?n:!1;if(!r)return[3,1];s=!1;return[3,3];case 1:return[4,z(tS)];case 2:s=u.sent().isCurrentProject;u.label=3;case 3:o=s,i={isRemote:r,isCurrentProject:o},c=typeof t=="function"?t(i):t;return[2,Object.fromEntries(Object.entries(c).map(function(t){var e=d(t,2),n=e[0],r=e[1];return[n,tE(r,i)]}))]}})});return tb.apply(this,arguments)}var tI=S.env.INIT_CWD||S.cwd(),tS="@cyberskill/shared",tO=".cyberskill-storage",tN="node_modules",tT="dist",tw="package.json",tC="package-lock.json",tP="tsconfig.json",tD=".gitignore",tL=".simple-git-hooks.json",tA="pnpm-lock.yaml",tR=".git/hooks/",tj=".git/COMMIT_EDITMSG",tG=F(tI,tN,tS,tT),tM="cyberskill",tk="eslint",tF="eslint",tK="vitest",tx="playwright",tU="vitest",tB="@commitlint/cli",tY="commitlint",tJ="lint-staged",tV="lint-staged",tW="typescript",tX="tsc",tH="tsx",t$="git",tz="pnpm",tq="pnpm exec",tQ="simple-git-hooks",tZ="simple-git-hooks",t0="@eslint/config-inspector",t2="eslint-config-inspector",t4="node-modules-inspector",t1="node-modules-inspector",t3={CYBERSKILL_DIRECTORY:tG,WORKING_DIRECTORY:tI,TS_CONFIG:k(tP),GIT_IGNORE:k(tD),GIT_HOOK:k(tR),GIT_COMMIT_MSG:k(tj),SIMPLE_GIT_HOOKS_JSON:k(tL),PACKAGE_JSON:k(tw),PACKAGE_LOCK_JSON:k(tC),PNPM_LOCK_YAML:k(tA),NODE_MODULES:k(tN),CYBERSKILL:{LINT_STAGED_CONFIG:k("".concat(tG,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:k("".concat(tG,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:k("".concat(tG,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:k("".concat(tG,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:k("".concat(tG,"/configs/vitest/react/e2e.js"))}};function t5(t){var e=t.isCurrentProject;return l({"pre-commit":tV,"commit-msg":tY},e&&{"pre-push":ty("".concat(t$," pull"))})}function t6(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++){n[r-1]=arguments[r]}var o=d(n,2),i=o[0],c=o[1],s=t==="RAW"?!0:L(F(t3.NODE_MODULES,i));switch(t){case"PNPM_ADD_AND_EXEC":return tE(ty("".concat(s?"":"".concat(tz," add ").concat(i," && ")).concat(tq," ").concat(c)));case"PNPM_ADD_DEV_AND_EXEC":return tE(ty("".concat(s?"":"".concat(tz," add -D ").concat(i," && ")).concat(tq," ").concat(c)));case"RAW":return tE(ty(i))}}var t8={SIMPLE_GIT_HOOKS:t6("PNPM_ADD_DEV_AND_EXEC",tQ,tZ),ESLINT_INSPECT:t6("PNPM_ADD_DEV_AND_EXEC",t0,t2),NODE_MODULES_INSPECT:t6("PNPM_ADD_DEV_AND_EXEC",t4,t1),ESLINT_CHECK:t6("PNPM_ADD_DEV_AND_EXEC",tk,"".concat(tF," ").concat(t3.WORKING_DIRECTORY)),ESLINT_FIX:t6("PNPM_ADD_DEV_AND_EXEC",tk,"".concat(tF," ").concat(t3.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:t6("PNPM_ADD_AND_EXEC",tW,"".concat(tX," -p ").concat(t3.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:t6("RAW","".concat(t$," config core.hooksPath ").concat(t3.GIT_HOOK)),BUILD:t6("RAW","".concat(tz," run build")),STAGE_BUILD_DIRECTORY:t6("RAW","".concat(t$," add ").concat(tT)),PNPM_INSTALL_STANDARD:t6("RAW","".concat(tz," install")),PNPM_INSTALL_LEGACY:t6("RAW","".concat(tz," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:t6("RAW","".concat(tz," install --force")),CYBERSKILL:{TEST_UNIT:t6("PNPM_ADD_AND_EXEC",tK,"".concat(tU," --config ").concat(t3.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:t6("PNPM_ADD_AND_EXEC","".concat(tK," ").concat(tx),"".concat(tU," --config ").concat(t3.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:t6("PNPM_ADD_DEV_AND_EXEC",tB,"".concat(tY," --edit ").concat(t3.GIT_COMMIT_MSG," --config ").concat(t3.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:t6("PNPM_ADD_DEV_AND_EXEC",tJ,"".concat(tV," --config ").concat(t3.CYBERSKILL.LINT_STAGED_CONFIG))}};function t7(t,e){return t9.apply(this,arguments)}function t9(){t9=o(function(t,e){return y(this,function(n){switch(n.label){case 0:ti.info("".concat(t,"...")),I&&ti.info("Executing command: ".concat(e));return[4,tg(e)];case 1:n.sent(),ti.success("".concat(t," completed successfully."));return[2]}})});return t9.apply(this,arguments)}function et(){return ee.apply(this,arguments)}function ee(){ee=o(function(){var t;return y(this,function(e){switch(e.label){case 0:if(!L(t3.TS_CONFIG))return[3,2];return[4,t7("Performing TypeScript validation",t8.TYPESCRIPT_CHECK)];case 1:t=e.sent();return[3,3];case 2:t=ti.warning("No TypeScript configuration found. Skipping type check.");e.label=3;case 3:t;return[2]}})});return ee.apply(this,arguments)}function en(){return er.apply(this,arguments)}function er(){er=o(function(){var t,e;var n=arguments;return y(this,function(r){switch(r.label){case 0:t=n.length>0&&n[0]!==void 0?n[0]:!1;if(!t)return[3,2];return[4,t7("Running ESLint with auto-fix",t8.ESLINT_FIX)];case 1:e=r.sent();return[3,4];case 2:return[4,t7("Running ESLint check",t8.ESLINT_CHECK)];case 3:e=r.sent();r.label=4;case 4:e;return[2]}})});return er.apply(this,arguments)}function eo(){return ei.apply(this,arguments)}function ei(){ei=o(function(){var t,e,n;return y(this,function(r){switch(r.label){case 0:return[4,tu()];case 1:t=r.sent(),e=t.filter(function(t){return t.type==="error"}),n=t.filter(function(t){return t.type==="warning"});!e.length&&!n.length?ti.printBoxedLog("✔ NO ISSUES FOUND","",{color:"green"}):(ti.printBoxedLog("⚠ Warnings",n,{color:"yellow"}),ti.printBoxedLog("✖ Errors",e,{color:"red"}));return[2]}})});return ei.apply(this,arguments)}function ec(){return es.apply(this,arguments)}function es(){es=o(function(){var t,e,n;return y(this,function(r){switch(r.label){case 0:return[4,tf()];case 1:r.sent();return[4,z(tS)];case 2:t=r.sent(),e=t.isCurrentProject;if(!e)return[3,7];r.label=3;case 3:r.trys.push([3,6,,7]);return[4,t7("Building package: ".concat(tS),t8.BUILD)];case 4:r.sent();return[4,t7("Staging build artifacts",t8.STAGE_BUILD_DIRECTORY)];case 5:r.sent();return[3,7];case 6:n=r.sent();throw ti.error("Error building and staging ".concat(tS,": ").concat(n.message)),n;case 7:return[4,t7("Executing lint-staged",t8.CYBERSKILL.LINT_STAGED)];case 8:r.sent(),eo();return[2]}})});return es.apply(this,arguments)}function ea(){return eu.apply(this,arguments)}function eu(){eu=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,t7("Inspecting ESLint configuration",t8.ESLINT_INSPECT)];case 1:t.sent();return[2]}})});return eu.apply(this,arguments)}function el(){return ef.apply(this,arguments)}function ef(){ef=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,tf()];case 1:t.sent();return[4,Promise.all([et(),en()])];case 2:t.sent(),eo();return[2]}})});return ef.apply(this,arguments)}function ep(){return ed.apply(this,arguments)}function ed(){ed=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,tf()];case 1:t.sent();return[4,Promise.all([et(),en(!0)])];case 2:t.sent(),eo();return[2]}})});return ed.apply(this,arguments)}function eh(){return eg.apply(this,arguments)}function eg(){eg=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,tf()];case 1:t.sent();return[4,t7("Validating commit message",t8.CYBERSKILL.COMMIT_LINT)];case 2:t.sent(),eo();return[2]}})});return eg.apply(this,arguments)}function em(){return ey.apply(this,arguments)}function ey(){ey=o(function(){var t,e;return y(this,function(n){switch(n.label){case 0:return[4,t7("Configuring Git hooks",t8.CONFIGURE_GIT_HOOK)];case 1:n.sent(),G([t3.GIT_HOOK]);return[4,t_(t5)];case 2:t=n.sent();R(t3.SIMPLE_GIT_HOOKS_JSON,t,{isJson:!0});e="\n".concat(tL,"\n");L(t3.GIT_IGNORE)?A(t3.GIT_IGNORE).split("\n").includes(tL)||j(t3.GIT_IGNORE,e):R(t3.GIT_IGNORE,e);return[4,t7("Installing simple-git-hooks",t8.SIMPLE_GIT_HOOKS)];case 3:n.sent();return[2]}})});return ey.apply(this,arguments)}function ev(){return eE.apply(this,arguments)}function eE(){eE=o(function(){var t,e,n,r,o,i,c,s,a,u,l;return y(this,function(f){switch(f.label){case 0:t=[{command:t8.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:t8.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:t8.PNPM_INSTALL_FORCE,message:"Retrying with force install"}];e=true,n=false,r=undefined;f.label=1;case 1:f.trys.push([1,8,9,10]);o=t[Symbol.iterator]();f.label=2;case 2:if(!!(e=(i=o.next()).done))return[3,7];c=i.value,s=c.command,a=c.message;f.label=3;case 3:f.trys.push([3,5,,6]);return[4,t7("".concat(a," using: ").concat(s),s)];case 4:f.sent();return[2];case 5:u=f.sent();ti.warning("Installation attempt failed: ".concat(s)),ti.error("Details: ".concat(u.message));return[3,6];case 6:e=true;return[3,2];case 7:return[3,10];case 8:l=f.sent();n=true;r=l;return[3,10];case 9:try{if(!e&&o.return!=null){o.return()}}finally{if(n){throw r}}return[7];case 10:throw new Error("All dependency installation strategies failed.")}})});return eE.apply(this,arguments)}function e_(t){return eb.apply(this,arguments)}function eb(){eb=o(function(t){var e,n,r,o,c;return y(this,function(s){switch(s.label){case 0:s.trys.push([0,4,,5]);return[4,z(t)];case 1:e=s.sent(),n=e.installedPath,r=e.latestVersion,o=e.file;o.dependencies=p(l({},o.dependencies),i({},o.name,r)),R(n,o,{isJson:!0});return[4,ev()];case 2:s.sent();return[4,ep()];case 3:s.sent();return[3,5];case 4:c=s.sent();throw ti.error('Failed to update "'.concat(t,'": ').concat(c.message)),c;case 5:return[2]}})});return eb.apply(this,arguments)}function eI(){return eS.apply(this,arguments)}function eS(){eS=o(function(){var t,e,n,r,o,i,c;return y(this,function(s){switch(s.label){case 0:if(!L(t3.PACKAGE_JSON)){ti.error("package.json not found. Aborting setup.");return[2]}s.label=1;case 1:s.trys.push([1,7,,8]);return[4,z(tS)];case 2:t=s.sent(),e=t.isInstalled,n=t.installedVersion,r=t.latestVersion,o=t.isCurrentProject;if(!(o||e&&n===r))return[3,3];i=ti.success("Cyberskill package is already up to date.");return[3,5];case 3:return[4,e_(tS)];case 4:i=s.sent();s.label=5;case 5:i;return[4,em()];case 6:s.sent();return[3,8];case 7:c=s.sent();throw ti.error("Project setup failed: ".concat(c.message)),c;case 8:return[2]}})});return eS.apply(this,arguments)}function eO(){return eN.apply(this,arguments)}function eN(){eN=o(function(){return y(this,function(t){switch(t.label){case 0:G([t3.NODE_MODULES,t3.PNPM_LOCK_YAML]);return[4,ev()];case 1:t.sent();return[4,em()];case 2:t.sent();return[2]}})});return eN.apply(this,arguments)}function eT(){return ew.apply(this,arguments)}function ew(){ew=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,t7("Inspecting project dependencies",t8.NODE_MODULES_INSPECT)];case 1:t.sent();return[2]}})});return ew.apply(this,arguments)}function eC(){return eP.apply(this,arguments)}function eP(){eP=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,t7("Running unit tests",t8.CYBERSKILL.TEST_UNIT)];case 1:t.sent();return[2]}})});return eP.apply(this,arguments)}function eD(){return eL.apply(this,arguments)}function eL(){eL=o(function(){return y(this,function(t){switch(t.label){case 0:return[4,t7("Running end-to-end tests",t8.CYBERSKILL.TEST_E2E)];case 1:t.sent();return[2]}})});return eL.apply(this,arguments)}_(E(v.argv)).scriptName(tM).usage("$0 <command> [options]").command("lint","Check code for linting issues",el).command("lint:fix","Fix linting issues automatically",ep).command("lint:inspect","View active ESLint configuration",ea).command("lint-staged","Run lint checks on staged files",ec).command("commitlint","Validate commit message format",eh).command("setup","Initialize project setup and dependencies",eI).command("reset","Reset the project and reinstall dependencies",eO).command("inspect","Analyze installed project dependencies",eT).command("test:unit","Run unit test suite",eC).command("test:e2e","Run end-to-end test suite",eD).demandCommand(1,"Please specify a valid command.").strict().help().alias("h","help").alias("v","version").epilog('\uD83D\uDCA1 Tip: Use "--help" with any command to see options\n').parse();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var
|
|
1
|
+
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(t){if(Array.isArray(t))return t}function r(e){if(Array.isArray(e))return t(e)}function n(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function o(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function c(t,e){var r=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(r==null)return;var n=[];var o=true;var c=false;var a,i;try{for(r=r.call(t);!(o=(a=r.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(t){c=true;i=t}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(c)throw i}}return n}function a(){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 i(){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 u(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};var o=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))}o.forEach(function(e){n(t,e,r[e])})}return t}function l(t,r){return e(t)||c(t,r)||_(t,r)||a()}function s(t){return r(t)||o(t)||_(t)||i()}function f(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function _(e,r){if(!e)return;if(typeof e==="string")return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}var E=Object.create;var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var O=function(t,e){for(var r in e)p(t,r,{get:e[r],enumerable:!0})},C=function(t,e,r,n){var o=true,c=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":f(e))=="object"||typeof e=="function")try{var i=function(){var o=l.value;!N.call(t,o)&&o!==r&&p(t,o,{get:function(){return e[o]},enumerable:!(n=I(e,o))||n.enumerable})};for(var u=d(e)[Symbol.iterator](),l;!(o=(l=u.next()).done);o=true)i()}catch(t){c=true;a=t}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(c){throw a}}}return t};var D=function(t,e,r){return r=t!=null?E(y(t)):{},C(e||!t||!t.__esModule?p(r,"default",{value:t,enumerable:!0}):r,t)},v=function(t){return C(p({},"__esModule",{value:!0}),t)};var T={};O(T,{createGraphqlCodegenConfig:function(){return tG}});module.exports=v(T);var A=D(require("process"),1);var g=D(require("boxen"),1),S=D(require("chalk"),1),m=require("child_process"),b=D(require("process"),1),h=D(require("util"),1);var P=D(require("process"),1);var M=P.default.env.DEBUG==="true";var L=D(require("node-fetch"),1);var G=D(require("fs"),1),R=function(t){return G.existsSync(t)};var w=D(require("path"),1);function j(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++){e[r]=arguments[r]}var n;return(n=w).resolve.apply(n,[J].concat(s(e)))}function K(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++){e[r]=arguments[r]}var n;return(n=w).join.apply(n,s(e))}var F=D(require("node-persist"),1),k=D(require("os"),1),q=D(require("process"),1);var Y=24*60*60*1e3;var X=h.promisify(m.exec),U=S.default,W=U.gray,H=U.blue;function x(t){return{raw:!0,cmd:t}}function B(t,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(tT," ").concat($," ").concat(t):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(tT," ").concat(tC," src/cli.ts ").concat(t):"".concat(tT," ").concat(tu," ").concat(t)}function V(t,e){return typeof t=="function"?B(t(e),e):(typeof t==="undefined"?"undefined":f(t))=="object"&&(t===null||t===void 0?void 0:t.raw)===!0?t.cmd:typeof t=="string"?B(t,e):t}var J=A.default.env.INIT_CWD||A.default.cwd(),$="@cyberskill/shared";var z="node_modules",Q="dist",Z="package.json",tt="package-lock.json",te="tsconfig.json",tr=".gitignore",tn=".simple-git-hooks.json",to="pnpm-lock.yaml",tc=".git/hooks/",ta=".git/COMMIT_EDITMSG",ti=K(J,z,$,Q),tu="cyberskill",tl="eslint",ts="eslint",tf="vitest",t_="playwright",tE="vitest",tp="@commitlint/cli",tI="commitlint",td="lint-staged",ty="lint-staged",tN="typescript",tO="tsc",tC="tsx",tD="git",tv="pnpm",tT="pnpm exec",tA="simple-git-hooks",tg="simple-git-hooks",tS="@eslint/config-inspector",tm="eslint-config-inspector",tb="node-modules-inspector",th="node-modules-inspector",tP={CYBERSKILL_DIRECTORY:ti,WORKING_DIRECTORY:J,TS_CONFIG:j(te),GIT_IGNORE:j(tr),GIT_HOOK:j(tc),GIT_COMMIT_MSG:j(ta),SIMPLE_GIT_HOOKS_JSON:j(tn),PACKAGE_JSON:j(Z),PACKAGE_LOCK_JSON:j(tt),PNPM_LOCK_YAML:j(to),NODE_MODULES:j(z),CYBERSKILL:{LINT_STAGED_CONFIG:j("".concat(ti,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:j("".concat(ti,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:j("".concat(ti,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:j("".concat(ti,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:j("".concat(ti,"/configs/vitest/react/e2e.js"))}};function tM(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}var o=l(r,2),c=o[0],a=o[1],i=t==="RAW"?!0:R(K(tP.NODE_MODULES,c));switch(t){case"PNPM_ADD_AND_EXEC":return V(x("".concat(i?"":"".concat(tv," add ").concat(c," && ")).concat(tT," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return V(x("".concat(i?"":"".concat(tv," add -D ").concat(c," && ")).concat(tT," ").concat(a)));case"RAW":return V(x(c))}}var tL={SIMPLE_GIT_HOOKS:tM("PNPM_ADD_DEV_AND_EXEC",tA,tg),ESLINT_INSPECT:tM("PNPM_ADD_DEV_AND_EXEC",tS,tm),NODE_MODULES_INSPECT:tM("PNPM_ADD_DEV_AND_EXEC",tb,th),ESLINT_CHECK:tM("PNPM_ADD_DEV_AND_EXEC",tl,"".concat(ts," ").concat(tP.WORKING_DIRECTORY)),ESLINT_FIX:tM("PNPM_ADD_DEV_AND_EXEC",tl,"".concat(ts," ").concat(tP.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tM("PNPM_ADD_AND_EXEC",tN,"".concat(tO," -p ").concat(tP.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tM("RAW","".concat(tD," config core.hooksPath ").concat(tP.GIT_HOOK)),BUILD:tM("RAW","".concat(tv," run build")),STAGE_BUILD_DIRECTORY:tM("RAW","".concat(tD," add ").concat(Q)),PNPM_INSTALL_STANDARD:tM("RAW","".concat(tv," install")),PNPM_INSTALL_LEGACY:tM("RAW","".concat(tv," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tM("RAW","".concat(tv," install --force")),CYBERSKILL:{TEST_UNIT:tM("PNPM_ADD_AND_EXEC",tf,"".concat(tE," --config ").concat(tP.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tM("PNPM_ADD_AND_EXEC","".concat(tf," ").concat(t_),"".concat(tE," --config ").concat(tP.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tM("PNPM_ADD_DEV_AND_EXEC",tp,"".concat(tI," --edit ").concat(tP.GIT_COMMIT_MSG," --config ").concat(tP.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tM("PNPM_ADD_DEV_AND_EXEC",td,"".concat(ty," --config ").concat(tP.CYBERSKILL.LINT_STAGED_CONFIG))}};function tG(t){var e=t.uri,r=t.from,o=t.to,c=t.withComponent,a=t.withHOC,i=t.withHooks,l=t.withMutationFn,s=t.withRefetchFn;var f=u({},c&&{withComponent:c},a&&{withHOC:a},i&&{withHooks:i},l&&{withMutationFn:l},s&&{withRefetchFn:s});return{schema:e,documents:[r],generates:n({},o,u({plugins:["typescript","typescript-operations","typescript-react-apollo"]},Object.keys(f).length>0&&{config:f})),hooks:{afterAllFileWrite:[tL.ESLINT_FIX]}}}0&&(module.exports={createGraphqlCodegenConfig:createGraphqlCodegenConfig});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t,n){if(n==null||n>t.length)n=t.length;for(var o=0,e=new Array(n);o<n;o++)e[o]=t[o];return e}function n(t){if(Array.isArray(t))return t}function o(n){if(Array.isArray(n))return t(n)}function e(t,n,o){if(n in t){Object.defineProperty(t,n,{value:o,enumerable:true,configurable:true,writable:true})}else{t[n]=o}return t}function r(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function c(t,n){var o=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(o==null)return;var e=[];var r=true;var c=false;var i,a;try{for(o=o.call(t);!(r=(i=o.next()).done);r=true){e.push(i.value);if(n&&e.length===n)break}}catch(t){c=true;a=t}finally{try{if(!r&&o["return"]!=null)o["return"]()}finally{if(c)throw a}}return e}function i(){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 a(){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 s(t){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};var r=Object.keys(o);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))}r.forEach(function(n){e(t,n,o[n])})}return t}function l(t,o){return n(t)||c(t,o)||f(t,o)||i()}function _(t){return o(t)||r(t)||f(t)||a()}function u(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function f(n,o){if(!n)return;if(typeof n==="string")return t(n,o);var e=Object.prototype.toString.call(n).slice(8,-1);if(e==="Object"&&n.constructor)e=n.constructor.name;if(e==="Map"||e==="Set")return Array.from(e);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return t(n,o)}import E from"node:process";import p from"boxen";import I from"chalk";import{exec as N}from"node:child_process";import*as
|
|
1
|
+
function t(t,n){if(n==null||n>t.length)n=t.length;for(var o=0,e=new Array(n);o<n;o++)e[o]=t[o];return e}function n(t){if(Array.isArray(t))return t}function o(n){if(Array.isArray(n))return t(n)}function e(t,n,o){if(n in t){Object.defineProperty(t,n,{value:o,enumerable:true,configurable:true,writable:true})}else{t[n]=o}return t}function r(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function c(t,n){var o=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(o==null)return;var e=[];var r=true;var c=false;var i,a;try{for(o=o.call(t);!(r=(i=o.next()).done);r=true){e.push(i.value);if(n&&e.length===n)break}}catch(t){c=true;a=t}finally{try{if(!r&&o["return"]!=null)o["return"]()}finally{if(c)throw a}}return e}function i(){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 a(){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 s(t){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};var r=Object.keys(o);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))}r.forEach(function(n){e(t,n,o[n])})}return t}function l(t,o){return n(t)||c(t,o)||f(t,o)||i()}function _(t){return o(t)||r(t)||f(t)||a()}function u(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function f(n,o){if(!n)return;if(typeof n==="string")return t(n,o);var e=Object.prototype.toString.call(n).slice(8,-1);if(e==="Object"&&n.constructor)e=n.constructor.name;if(e==="Map"||e==="Set")return Array.from(e);if(e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return t(n,o)}import E from"node:process";import p from"boxen";import I from"chalk";import{exec as N}from"node:child_process";import*as m from"node:util";import D from"node:process";var T=D.env.DEBUG==="true";import C from"node-fetch";import*as O from"node:fs";var d=function(t){return O.existsSync(t)};import*as y from"node:path";function A(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++){n[o]=arguments[o]}var e;return(e=y).resolve.apply(e,[R].concat(_(n)))}function S(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++){n[o]=arguments[o]}var e;return(e=y).join.apply(e,_(n))}import g from"node-persist";var h=24*60*60*1e3;var P=m.promisify(N),v=I.gray,L=I.blue;function b(t){return{raw:!0,cmd:t}}function M(t,n){return(n===null||n===void 0?void 0:n.isRemote)?"".concat(ts," ").concat(w," ").concat(t):(n===null||n===void 0?void 0:n.isCurrentProject)?"".concat(ts," ").concat(tc," src/cli.ts ").concat(t):"".concat(ts," ").concat(V," ").concat(t)}function G(t,n){return typeof t=="function"?M(t(n),n):(typeof t==="undefined"?"undefined":u(t))=="object"&&(t===null||t===void 0?void 0:t.raw)===!0?t.cmd:typeof t=="string"?M(t,n):t}var R=E.env.INIT_CWD||E.cwd(),w="@cyberskill/shared";var j="node_modules",K="dist",F="package.json",k="package-lock.json",Y="tsconfig.json",X=".gitignore",U=".simple-git-hooks.json",W="pnpm-lock.yaml",H=".git/hooks/",B=".git/COMMIT_EDITMSG",x=S(R,j,w,K),V="cyberskill",J="eslint",q="eslint",$="vitest",z="playwright",Q="vitest",Z="@commitlint/cli",tt="commitlint",tn="lint-staged",to="lint-staged",te="typescript",tr="tsc",tc="tsx",ti="git",ta="pnpm",ts="pnpm exec",tl="simple-git-hooks",t_="simple-git-hooks",tu="@eslint/config-inspector",tf="eslint-config-inspector",tE="node-modules-inspector",tp="node-modules-inspector",tI={CYBERSKILL_DIRECTORY:x,WORKING_DIRECTORY:R,TS_CONFIG:A(Y),GIT_IGNORE:A(X),GIT_HOOK:A(H),GIT_COMMIT_MSG:A(B),SIMPLE_GIT_HOOKS_JSON:A(U),PACKAGE_JSON:A(F),PACKAGE_LOCK_JSON:A(k),PNPM_LOCK_YAML:A(W),NODE_MODULES:A(j),CYBERSKILL:{LINT_STAGED_CONFIG:A("".concat(x,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:A("".concat(x,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:A("".concat(x,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:A("".concat(x,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:A("".concat(x,"/configs/vitest/react/e2e.js"))}};function tN(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),e=1;e<n;e++){o[e-1]=arguments[e]}var r=l(o,2),c=r[0],i=r[1],a=t==="RAW"?!0:d(S(tI.NODE_MODULES,c));switch(t){case"PNPM_ADD_AND_EXEC":return G(b("".concat(a?"":"".concat(ta," add ").concat(c," && ")).concat(ts," ").concat(i)));case"PNPM_ADD_DEV_AND_EXEC":return G(b("".concat(a?"":"".concat(ta," add -D ").concat(c," && ")).concat(ts," ").concat(i)));case"RAW":return G(b(c))}}var tm={SIMPLE_GIT_HOOKS:tN("PNPM_ADD_DEV_AND_EXEC",tl,t_),ESLINT_INSPECT:tN("PNPM_ADD_DEV_AND_EXEC",tu,tf),NODE_MODULES_INSPECT:tN("PNPM_ADD_DEV_AND_EXEC",tE,tp),ESLINT_CHECK:tN("PNPM_ADD_DEV_AND_EXEC",J,"".concat(q," ").concat(tI.WORKING_DIRECTORY)),ESLINT_FIX:tN("PNPM_ADD_DEV_AND_EXEC",J,"".concat(q," ").concat(tI.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tN("PNPM_ADD_AND_EXEC",te,"".concat(tr," -p ").concat(tI.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tN("RAW","".concat(ti," config core.hooksPath ").concat(tI.GIT_HOOK)),BUILD:tN("RAW","".concat(ta," run build")),STAGE_BUILD_DIRECTORY:tN("RAW","".concat(ti," add ").concat(K)),PNPM_INSTALL_STANDARD:tN("RAW","".concat(ta," install")),PNPM_INSTALL_LEGACY:tN("RAW","".concat(ta," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tN("RAW","".concat(ta," install --force")),CYBERSKILL:{TEST_UNIT:tN("PNPM_ADD_AND_EXEC",$,"".concat(Q," --config ").concat(tI.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tN("PNPM_ADD_AND_EXEC","".concat($," ").concat(z),"".concat(Q," --config ").concat(tI.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tN("PNPM_ADD_DEV_AND_EXEC",Z,"".concat(tt," --edit ").concat(tI.GIT_COMMIT_MSG," --config ").concat(tI.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tN("PNPM_ADD_DEV_AND_EXEC",tn,"".concat(to," --config ").concat(tI.CYBERSKILL.LINT_STAGED_CONFIG))}};function tD(t){var n=t.uri,o=t.from,r=t.to,c=t.withComponent,i=t.withHOC,a=t.withHooks,l=t.withMutationFn,_=t.withRefetchFn;var u=s({},c&&{withComponent:c},i&&{withHOC:i},a&&{withHooks:a},l&&{withMutationFn:l},_&&{withRefetchFn:_});return{schema:n,documents:[o],generates:e({},r,s({plugins:["typescript","typescript-operations","typescript-react-apollo"]},Object.keys(u).length>0&&{config:u})),hooks:{afterAllFileWrite:[tm.ESLINT_FIX]}}}export{tD as createGraphqlCodegenConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var
|
|
1
|
+
"use strict";function t(t,e){if(e==null||e>t.length)e=t.length;for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function e(t){if(Array.isArray(t))return t}function r(e){if(Array.isArray(e))return t(e)}function n(t,e,r){if(e in t){Object.defineProperty(t,e,{value:r,enumerable:true,configurable:true,writable:true})}else{t[e]=r}return t}function o(t){if(typeof Symbol!=="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function c(t,e){var r=t==null?null:typeof Symbol!=="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(r==null)return;var n=[];var o=true;var c=false;var a,i;try{for(r=r.call(t);!(o=(a=r.next()).done);o=true){n.push(a.value);if(e&&n.length===e)break}}catch(t){c=true;i=t}finally{try{if(!o&&r["return"]!=null)r["return"]()}finally{if(c)throw i}}return n}function a(){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 i(){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 u(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};var o=Object.keys(r);if(typeof Object.getOwnPropertySymbols==="function"){o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))}o.forEach(function(e){n(t,e,r[e])})}return t}function l(t,r){return e(t)||c(t,r)||_(t,r)||a()}function s(t){return r(t)||o(t)||_(t)||i()}function f(t){"@swc/helpers - typeof";return t&&typeof Symbol!=="undefined"&&t.constructor===Symbol?"symbol":typeof t}function _(e,r){if(!e)return;if(typeof e==="string")return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor)n=e.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}var E=Object.create;var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var O=function(t,e){for(var r in e)p(t,r,{get:e[r],enumerable:!0})},C=function(t,e,r,n){var o=true,c=false,a=undefined;if(e&&(typeof e==="undefined"?"undefined":f(e))=="object"||typeof e=="function")try{var i=function(){var o=l.value;!N.call(t,o)&&o!==r&&p(t,o,{get:function(){return e[o]},enumerable:!(n=I(e,o))||n.enumerable})};for(var u=d(e)[Symbol.iterator](),l;!(o=(l=u.next()).done);o=true)i()}catch(t){c=true;a=t}finally{try{if(!o&&u.return!=null){u.return()}}finally{if(c){throw a}}}return t};var D=function(t,e,r){return r=t!=null?E(y(t)):{},C(e||!t||!t.__esModule?p(r,"default",{value:t,enumerable:!0}):r,t)},v=function(t){return C(p({},"__esModule",{value:!0}),t)};var T={};O(T,{createGraphqlCodegenConfig:function(){return tG}});module.exports=v(T);var A=D(require("process"),1);var g=D(require("boxen"),1),S=D(require("chalk"),1),m=require("child_process"),b=D(require("process"),1),h=D(require("util"),1);var P=D(require("process"),1);var M=P.default.env.DEBUG==="true";var L=D(require("node-fetch"),1);var G=D(require("fs"),1),R=function(t){return G.existsSync(t)};var w=D(require("path"),1);function j(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++){e[r]=arguments[r]}var n;return(n=w).resolve.apply(n,[J].concat(s(e)))}function K(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++){e[r]=arguments[r]}var n;return(n=w).join.apply(n,s(e))}var F=D(require("node-persist"),1),k=D(require("os"),1),q=D(require("process"),1);var Y=24*60*60*1e3;var X=h.promisify(m.exec),U=S.default,W=U.gray,H=U.blue;function x(t){return{raw:!0,cmd:t}}function B(t,e){return(e===null||e===void 0?void 0:e.isRemote)?"".concat(tT," ").concat($," ").concat(t):(e===null||e===void 0?void 0:e.isCurrentProject)?"".concat(tT," ").concat(tC," src/cli.ts ").concat(t):"".concat(tT," ").concat(tu," ").concat(t)}function V(t,e){return typeof t=="function"?B(t(e),e):(typeof t==="undefined"?"undefined":f(t))=="object"&&(t===null||t===void 0?void 0:t.raw)===!0?t.cmd:typeof t=="string"?B(t,e):t}var J=A.default.env.INIT_CWD||A.default.cwd(),$="@cyberskill/shared";var z="node_modules",Q="dist",Z="package.json",tt="package-lock.json",te="tsconfig.json",tr=".gitignore",tn=".simple-git-hooks.json",to="pnpm-lock.yaml",tc=".git/hooks/",ta=".git/COMMIT_EDITMSG",ti=K(J,z,$,Q),tu="cyberskill",tl="eslint",ts="eslint",tf="vitest",t_="playwright",tE="vitest",tp="@commitlint/cli",tI="commitlint",td="lint-staged",ty="lint-staged",tN="typescript",tO="tsc",tC="tsx",tD="git",tv="pnpm",tT="pnpm exec",tA="simple-git-hooks",tg="simple-git-hooks",tS="@eslint/config-inspector",tm="eslint-config-inspector",tb="node-modules-inspector",th="node-modules-inspector",tP={CYBERSKILL_DIRECTORY:ti,WORKING_DIRECTORY:J,TS_CONFIG:j(te),GIT_IGNORE:j(tr),GIT_HOOK:j(tc),GIT_COMMIT_MSG:j(ta),SIMPLE_GIT_HOOKS_JSON:j(tn),PACKAGE_JSON:j(Z),PACKAGE_LOCK_JSON:j(tt),PNPM_LOCK_YAML:j(to),NODE_MODULES:j(z),CYBERSKILL:{LINT_STAGED_CONFIG:j("".concat(ti,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:j("".concat(ti,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:j("".concat(ti,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:j("".concat(ti,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:j("".concat(ti,"/configs/vitest/react/e2e.js"))}};function tM(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++){r[n-1]=arguments[n]}var o=l(r,2),c=o[0],a=o[1],i=t==="RAW"?!0:R(K(tP.NODE_MODULES,c));switch(t){case"PNPM_ADD_AND_EXEC":return V(x("".concat(i?"":"".concat(tv," add ").concat(c," && ")).concat(tT," ").concat(a)));case"PNPM_ADD_DEV_AND_EXEC":return V(x("".concat(i?"":"".concat(tv," add -D ").concat(c," && ")).concat(tT," ").concat(a)));case"RAW":return V(x(c))}}var tL={SIMPLE_GIT_HOOKS:tM("PNPM_ADD_DEV_AND_EXEC",tA,tg),ESLINT_INSPECT:tM("PNPM_ADD_DEV_AND_EXEC",tS,tm),NODE_MODULES_INSPECT:tM("PNPM_ADD_DEV_AND_EXEC",tb,th),ESLINT_CHECK:tM("PNPM_ADD_DEV_AND_EXEC",tl,"".concat(ts," ").concat(tP.WORKING_DIRECTORY)),ESLINT_FIX:tM("PNPM_ADD_DEV_AND_EXEC",tl,"".concat(ts," ").concat(tP.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:tM("PNPM_ADD_AND_EXEC",tN,"".concat(tO," -p ").concat(tP.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:tM("RAW","".concat(tD," config core.hooksPath ").concat(tP.GIT_HOOK)),BUILD:tM("RAW","".concat(tv," run build")),STAGE_BUILD_DIRECTORY:tM("RAW","".concat(tD," add ").concat(Q)),PNPM_INSTALL_STANDARD:tM("RAW","".concat(tv," install")),PNPM_INSTALL_LEGACY:tM("RAW","".concat(tv," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:tM("RAW","".concat(tv," install --force")),CYBERSKILL:{TEST_UNIT:tM("PNPM_ADD_AND_EXEC",tf,"".concat(tE," --config ").concat(tP.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:tM("PNPM_ADD_AND_EXEC","".concat(tf," ").concat(t_),"".concat(tE," --config ").concat(tP.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:tM("PNPM_ADD_DEV_AND_EXEC",tp,"".concat(tI," --edit ").concat(tP.GIT_COMMIT_MSG," --config ").concat(tP.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:tM("PNPM_ADD_DEV_AND_EXEC",td,"".concat(ty," --config ").concat(tP.CYBERSKILL.LINT_STAGED_CONFIG))}};function tG(t){var e=t.uri,r=t.from,o=t.to,c=t.withComponent,a=t.withHOC,i=t.withHooks,l=t.withMutationFn,s=t.withRefetchFn;var f=u({},c&&{withComponent:c},a&&{withHOC:a},i&&{withHooks:i},l&&{withMutationFn:l},s&&{withRefetchFn:s});return{schema:e,documents:[r],generates:n({},o,u({plugins:["typescript","typescript-operations","typescript-react-apollo"]},Object.keys(f).length>0&&{config:f})),hooks:{afterAllFileWrite:[tL.ESLINT_FIX]}}}0&&(module.exports={createGraphqlCodegenConfig:createGraphqlCodegenConfig});
|