@cyberskill/shared 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/_tsup-dts-rollup.d.cts +87 -11
  2. package/dist/_tsup-dts-rollup.d.ts +87 -11
  3. package/dist/cli.cjs +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/configs/graphql/graphql-codegen.cjs +1 -1
  6. package/dist/configs/graphql/graphql-codegen.js +1 -1
  7. package/dist/configs/graphql/index.cjs +1 -1
  8. package/dist/configs/graphql/index.js +1 -1
  9. package/dist/configs/index.cjs +1 -1
  10. package/dist/configs/index.js +1 -1
  11. package/dist/configs/vitest/react/unit.cjs +1 -1
  12. package/dist/configs/vitest/react/unit.js +1 -1
  13. package/dist/constants/common.cjs +1 -1
  14. package/dist/constants/common.d.cts +3 -0
  15. package/dist/constants/common.d.ts +3 -0
  16. package/dist/constants/common.js +1 -1
  17. package/dist/constants/index.cjs +1 -1
  18. package/dist/constants/index.d.cts +3 -0
  19. package/dist/constants/index.d.ts +3 -0
  20. package/dist/constants/index.js +1 -1
  21. package/dist/constants/path.cjs +1 -1
  22. package/dist/constants/path.js +1 -1
  23. package/dist/index.cjs +1 -1
  24. package/dist/index.d.cts +9 -0
  25. package/dist/index.d.ts +9 -0
  26. package/dist/index.js +1 -1
  27. package/dist/react/apollo-client.cjs +1 -1
  28. package/dist/react/apollo-client.js +1 -1
  29. package/dist/react/apollo-error.cjs +1 -0
  30. package/dist/react/apollo-error.d.cts +6 -0
  31. package/dist/react/apollo-error.d.ts +6 -0
  32. package/dist/react/apollo-error.js +1 -0
  33. package/dist/react/index.cjs +1 -1
  34. package/dist/react/index.d.cts +6 -0
  35. package/dist/react/index.d.ts +6 -0
  36. package/dist/react/index.js +1 -1
  37. package/dist/typescript/apollo-error.cjs +1 -0
  38. package/dist/typescript/apollo-error.d.cts +2 -0
  39. package/dist/typescript/apollo-error.d.ts +2 -0
  40. package/dist/typescript/apollo-error.js +0 -0
  41. package/dist/utils/command.cjs +1 -1
  42. package/dist/utils/command.js +1 -1
  43. package/dist/utils/index-nodejs.cjs +1 -1
  44. package/dist/utils/index-nodejs.js +1 -1
  45. package/dist/utils/package.cjs +1 -1
  46. package/dist/utils/package.js +1 -1
  47. package/dist/utils/path.cjs +1 -1
  48. package/dist/utils/path.js +1 -1
  49. package/dist/utils/storage-server.cjs +1 -1
  50. package/dist/utils/storage-server.js +1 -1
  51. package/package.json +8 -5
@@ -5,6 +5,8 @@ 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';
9
+ import type { ApolloLink } from '@apollo/client';
8
10
  import type { ClientSession } from 'mongoose';
9
11
  import type { CodegenConfig } from '@graphql-codegen/cli';
10
12
  import { Collection } from 'mongodb';
@@ -29,6 +31,7 @@ import { Model } from 'mongoose';
29
31
  import type mongoose from 'mongoose';
30
32
  import mongoosePaginate from 'mongoose-paginate-v2';
31
33
  import type mongooseRaw from 'mongoose';
34
+ import type { NormalizedCacheObject } from '@apollo/client';
32
35
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
36
  import type { PaginateModel } from 'mongoose';
34
37
  import type { PaginateOptions } from 'mongoose';
@@ -43,7 +46,7 @@ import type { ProjectionType } from 'mongoose';
43
46
  import type { QueryOptions } from 'mongoose';
44
47
  import type { QueryWithHelpers } from 'mongoose';
45
48
  import type { ReactElement } from 'react';
46
- import type { ReactNode } from 'react';
49
+ import { ReactNode } from 'react';
47
50
  import type { Schema } from 'mongoose';
48
51
  import type { SchemaDefinition } from 'mongoose';
49
52
  import { TFunction } from 'i18next';
@@ -70,6 +73,33 @@ export { ApolloClientOptions }
70
73
  export { ApolloClientOptions as ApolloClientOptions_alias_1 }
71
74
  export { ApolloClientOptions as ApolloClientOptions_alias_2 }
72
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
+ declare function ApolloErrorViewerModal(): JSX_2.Element | null;
92
+ export { ApolloErrorViewerModal }
93
+ export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_1 }
94
+ export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_2 }
95
+
96
+ declare function ApolloErrorViewerProvider({ children }: {
97
+ children: ReactNode;
98
+ }): JSX_2.Element;
99
+ export { ApolloErrorViewerProvider }
100
+ export { ApolloErrorViewerProvider as ApolloErrorViewerProvider_alias_1 }
101
+ export { ApolloErrorViewerProvider as ApolloErrorViewerProvider_alias_2 }
102
+
73
103
  declare function ApolloProvider({ isNextJS, options, children, client: CustomClient, provider: CustomProvider, cache: CustomCache, }: I_ApolloProviderProps_2): JSX_2.Element;
74
104
  export { ApolloProvider }
75
105
  export { ApolloProvider as ApolloProvider_alias_1 }
@@ -1507,6 +1537,11 @@ export { GIT_IGNORE }
1507
1537
  export { GIT_IGNORE as GIT_IGNORE_alias_1 }
1508
1538
  export { GIT_IGNORE as GIT_IGNORE_alias_2 }
1509
1539
 
1540
+ declare const GRAPHQL_URI_DEFAULT: string;
1541
+ export { GRAPHQL_URI_DEFAULT }
1542
+ export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_1 }
1543
+ export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_2 }
1544
+
1510
1545
  declare function HOOK({ isCurrentProject }: Partial<I_CommandContext_2>): {
1511
1546
  'pre-push'?: {
1512
1547
  raw: boolean;
@@ -1519,29 +1554,45 @@ export { HOOK }
1519
1554
  export { HOOK as HOOK_alias_1 }
1520
1555
  export { HOOK as HOOK_alias_2 }
1521
1556
 
1522
- declare interface I_ApolloOptions extends Omit<ApolloClientOptions<unknown>, 'cache'> {
1557
+ export declare interface I_ApolloErrorViewerContext {
1558
+ error: ApolloError | null;
1559
+ showError: (error: ApolloError) => void;
1560
+ hideError: () => void;
1561
+ }
1562
+
1563
+ declare interface I_ApolloErrorViewerContext_2 {
1564
+ error: ApolloError | null;
1565
+ showError: (error: ApolloError) => void;
1566
+ hideError: () => void;
1567
+ }
1568
+
1569
+ declare interface I_ApolloOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, 'cache'> {
1523
1570
  uri?: string;
1524
1571
  wsUrl?: string;
1525
- cache?: ApolloCache<unknown>;
1572
+ cache?: ApolloCache<NormalizedCacheObject>;
1573
+ customLinks?: ApolloLink[];
1574
+ ssrMode?: boolean;
1526
1575
  }
1527
1576
  export { I_ApolloOptions }
1528
1577
  export { I_ApolloOptions as I_ApolloOptions_alias_1 }
1529
1578
  export { I_ApolloOptions as I_ApolloOptions_alias_2 }
1530
1579
 
1531
- declare interface I_ApolloOptions_2 extends Omit<ApolloClientOptions<unknown>, 'cache'> {
1580
+ declare interface I_ApolloOptions_2 extends Omit<ApolloClientOptions<NormalizedCacheObject>, 'cache'> {
1532
1581
  uri?: string;
1533
1582
  wsUrl?: string;
1534
- cache?: ApolloCache<unknown>;
1583
+ cache?: ApolloCache<NormalizedCacheObject>;
1584
+ customLinks?: ApolloLink[];
1585
+ ssrMode?: boolean;
1535
1586
  }
1536
1587
 
1537
1588
  declare interface I_ApolloProviderProps {
1538
1589
  children: T_Children;
1539
1590
  isNextJS?: boolean;
1540
1591
  options?: I_ApolloOptions;
1541
- client?: ApolloClient<unknown>;
1542
- makeClient?: () => ApolloClient<unknown>;
1592
+ client?: ApolloClient<NormalizedCacheObject>;
1593
+ makeClient?: () => ApolloClient<NormalizedCacheObject>;
1543
1594
  provider?: ComponentType<I_ApolloProviderProps>;
1544
- cache?: ApolloCache<unknown>;
1595
+ cache?: ApolloCache<NormalizedCacheObject>;
1545
1596
  }
1546
1597
  export { I_ApolloProviderProps }
1547
1598
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_1 }
@@ -1551,10 +1602,10 @@ declare interface I_ApolloProviderProps_2 {
1551
1602
  children: T_Children_2;
1552
1603
  isNextJS?: boolean;
1553
1604
  options?: I_ApolloOptions_2;
1554
- client?: ApolloClient<unknown>;
1555
- makeClient?: () => ApolloClient<unknown>;
1605
+ client?: ApolloClient<NormalizedCacheObject>;
1606
+ makeClient?: () => ApolloClient<NormalizedCacheObject>;
1556
1607
  provider?: ComponentType<I_ApolloProviderProps_2>;
1557
- cache?: ApolloCache<unknown>;
1608
+ cache?: ApolloCache<NormalizedCacheObject>;
1558
1609
  }
1559
1610
 
1560
1611
  declare interface I_BoxedLogOptions {
@@ -2044,6 +2095,16 @@ export { initNodePersist }
2044
2095
  export { initNodePersist as initNodePersist_alias_1 }
2045
2096
  export { initNodePersist as initNodePersist_alias_2 }
2046
2097
 
2098
+ declare const IS_BROWSER: boolean;
2099
+ export { IS_BROWSER }
2100
+ export { IS_BROWSER as IS_BROWSER_alias_1 }
2101
+ export { IS_BROWSER as IS_BROWSER_alias_2 }
2102
+
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
+
2047
2108
  declare function isJson(str: string): boolean;
2048
2109
  export { isJson }
2049
2110
  export { isJson as isJson_alias_1 }
@@ -2314,6 +2375,11 @@ export { regexSearchMapper }
2314
2375
  export { regexSearchMapper as regexSearchMapper_alias_1 }
2315
2376
  export { regexSearchMapper as regexSearchMapper_alias_2 }
2316
2377
 
2378
+ declare function registerApolloErrorViewerCallback(fn: (err: ApolloError) => void): void;
2379
+ export { registerApolloErrorViewerCallback }
2380
+ export { registerApolloErrorViewerCallback as registerApolloErrorViewerCallback_alias_1 }
2381
+ export { registerApolloErrorViewerCallback as registerApolloErrorViewerCallback_alias_2 }
2382
+
2317
2383
  declare function removeAccent(str: string): string;
2318
2384
  export { removeAccent }
2319
2385
  export { removeAccent as removeAccent_alias_1 }
@@ -2600,6 +2666,11 @@ export { serializer }
2600
2666
  export { serializer as serializer_alias_1 }
2601
2667
  export { serializer as serializer_alias_2 }
2602
2668
 
2669
+ declare function showGlobalApolloError(error: ApolloError): void;
2670
+ export { showGlobalApolloError }
2671
+ export { showGlobalApolloError as showGlobalApolloError_alias_1 }
2672
+ export { showGlobalApolloError as showGlobalApolloError_alias_2 }
2673
+
2603
2674
  declare const SIMPLE_GIT_HOOK_CLI = "simple-git-hooks";
2604
2675
  export { SIMPLE_GIT_HOOK_CLI }
2605
2676
  export { SIMPLE_GIT_HOOK_CLI as SIMPLE_GIT_HOOK_CLI_alias_1 }
@@ -2995,6 +3066,11 @@ export { TSX_CLI }
2995
3066
  export { TSX_CLI as TSX_CLI_alias_1 }
2996
3067
  export { TSX_CLI as TSX_CLI_alias_2 }
2997
3068
 
3069
+ declare function useApolloErrorViewer(): I_ApolloErrorViewerContext_2;
3070
+ export { useApolloErrorViewer }
3071
+ export { useApolloErrorViewer as useApolloErrorViewer_alias_1 }
3072
+ export { useApolloErrorViewer as useApolloErrorViewer_alias_2 }
3073
+
2998
3074
  declare function useLoading(): I_LoadingContext_2;
2999
3075
  export { useLoading }
3000
3076
  export { useLoading as useLoading_alias_1 }
@@ -5,6 +5,8 @@ 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';
9
+ import type { ApolloLink } from '@apollo/client';
8
10
  import type { ClientSession } from 'mongoose';
9
11
  import type { CodegenConfig } from '@graphql-codegen/cli';
10
12
  import { Collection } from 'mongodb';
@@ -29,6 +31,7 @@ import { Model } from 'mongoose';
29
31
  import type mongoose from 'mongoose';
30
32
  import mongoosePaginate from 'mongoose-paginate-v2';
31
33
  import type mongooseRaw from 'mongoose';
34
+ import type { NormalizedCacheObject } from '@apollo/client';
32
35
  import type { OptionalUnlessRequiredId } from 'mongodb';
33
36
  import type { PaginateModel } from 'mongoose';
34
37
  import type { PaginateOptions } from 'mongoose';
@@ -43,7 +46,7 @@ import type { ProjectionType } from 'mongoose';
43
46
  import type { QueryOptions } from 'mongoose';
44
47
  import type { QueryWithHelpers } from 'mongoose';
45
48
  import type { ReactElement } from 'react';
46
- import type { ReactNode } from 'react';
49
+ import { ReactNode } from 'react';
47
50
  import type { Schema } from 'mongoose';
48
51
  import type { SchemaDefinition } from 'mongoose';
49
52
  import { TFunction } from 'i18next';
@@ -70,6 +73,33 @@ export { ApolloClientOptions }
70
73
  export { ApolloClientOptions as ApolloClientOptions_alias_1 }
71
74
  export { ApolloClientOptions as ApolloClientOptions_alias_2 }
72
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
+ declare function ApolloErrorViewerModal(): JSX_2.Element | null;
92
+ export { ApolloErrorViewerModal }
93
+ export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_1 }
94
+ export { ApolloErrorViewerModal as ApolloErrorViewerModal_alias_2 }
95
+
96
+ declare function ApolloErrorViewerProvider({ children }: {
97
+ children: ReactNode;
98
+ }): JSX_2.Element;
99
+ export { ApolloErrorViewerProvider }
100
+ export { ApolloErrorViewerProvider as ApolloErrorViewerProvider_alias_1 }
101
+ export { ApolloErrorViewerProvider as ApolloErrorViewerProvider_alias_2 }
102
+
73
103
  declare function ApolloProvider({ isNextJS, options, children, client: CustomClient, provider: CustomProvider, cache: CustomCache, }: I_ApolloProviderProps_2): JSX_2.Element;
74
104
  export { ApolloProvider }
75
105
  export { ApolloProvider as ApolloProvider_alias_1 }
@@ -1507,6 +1537,11 @@ export { GIT_IGNORE }
1507
1537
  export { GIT_IGNORE as GIT_IGNORE_alias_1 }
1508
1538
  export { GIT_IGNORE as GIT_IGNORE_alias_2 }
1509
1539
 
1540
+ declare const GRAPHQL_URI_DEFAULT: string;
1541
+ export { GRAPHQL_URI_DEFAULT }
1542
+ export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_1 }
1543
+ export { GRAPHQL_URI_DEFAULT as GRAPHQL_URI_DEFAULT_alias_2 }
1544
+
1510
1545
  declare function HOOK({ isCurrentProject }: Partial<I_CommandContext_2>): {
1511
1546
  'pre-push'?: {
1512
1547
  raw: boolean;
@@ -1519,29 +1554,45 @@ export { HOOK }
1519
1554
  export { HOOK as HOOK_alias_1 }
1520
1555
  export { HOOK as HOOK_alias_2 }
1521
1556
 
1522
- declare interface I_ApolloOptions extends Omit<ApolloClientOptions<unknown>, 'cache'> {
1557
+ export declare interface I_ApolloErrorViewerContext {
1558
+ error: ApolloError | null;
1559
+ showError: (error: ApolloError) => void;
1560
+ hideError: () => void;
1561
+ }
1562
+
1563
+ declare interface I_ApolloErrorViewerContext_2 {
1564
+ error: ApolloError | null;
1565
+ showError: (error: ApolloError) => void;
1566
+ hideError: () => void;
1567
+ }
1568
+
1569
+ declare interface I_ApolloOptions extends Omit<ApolloClientOptions<NormalizedCacheObject>, 'cache'> {
1523
1570
  uri?: string;
1524
1571
  wsUrl?: string;
1525
- cache?: ApolloCache<unknown>;
1572
+ cache?: ApolloCache<NormalizedCacheObject>;
1573
+ customLinks?: ApolloLink[];
1574
+ ssrMode?: boolean;
1526
1575
  }
1527
1576
  export { I_ApolloOptions }
1528
1577
  export { I_ApolloOptions as I_ApolloOptions_alias_1 }
1529
1578
  export { I_ApolloOptions as I_ApolloOptions_alias_2 }
1530
1579
 
1531
- declare interface I_ApolloOptions_2 extends Omit<ApolloClientOptions<unknown>, 'cache'> {
1580
+ declare interface I_ApolloOptions_2 extends Omit<ApolloClientOptions<NormalizedCacheObject>, 'cache'> {
1532
1581
  uri?: string;
1533
1582
  wsUrl?: string;
1534
- cache?: ApolloCache<unknown>;
1583
+ cache?: ApolloCache<NormalizedCacheObject>;
1584
+ customLinks?: ApolloLink[];
1585
+ ssrMode?: boolean;
1535
1586
  }
1536
1587
 
1537
1588
  declare interface I_ApolloProviderProps {
1538
1589
  children: T_Children;
1539
1590
  isNextJS?: boolean;
1540
1591
  options?: I_ApolloOptions;
1541
- client?: ApolloClient<unknown>;
1542
- makeClient?: () => ApolloClient<unknown>;
1592
+ client?: ApolloClient<NormalizedCacheObject>;
1593
+ makeClient?: () => ApolloClient<NormalizedCacheObject>;
1543
1594
  provider?: ComponentType<I_ApolloProviderProps>;
1544
- cache?: ApolloCache<unknown>;
1595
+ cache?: ApolloCache<NormalizedCacheObject>;
1545
1596
  }
1546
1597
  export { I_ApolloProviderProps }
1547
1598
  export { I_ApolloProviderProps as I_ApolloProviderProps_alias_1 }
@@ -1551,10 +1602,10 @@ declare interface I_ApolloProviderProps_2 {
1551
1602
  children: T_Children_2;
1552
1603
  isNextJS?: boolean;
1553
1604
  options?: I_ApolloOptions_2;
1554
- client?: ApolloClient<unknown>;
1555
- makeClient?: () => ApolloClient<unknown>;
1605
+ client?: ApolloClient<NormalizedCacheObject>;
1606
+ makeClient?: () => ApolloClient<NormalizedCacheObject>;
1556
1607
  provider?: ComponentType<I_ApolloProviderProps_2>;
1557
- cache?: ApolloCache<unknown>;
1608
+ cache?: ApolloCache<NormalizedCacheObject>;
1558
1609
  }
1559
1610
 
1560
1611
  declare interface I_BoxedLogOptions {
@@ -2044,6 +2095,16 @@ export { initNodePersist }
2044
2095
  export { initNodePersist as initNodePersist_alias_1 }
2045
2096
  export { initNodePersist as initNodePersist_alias_2 }
2046
2097
 
2098
+ declare const IS_BROWSER: boolean;
2099
+ export { IS_BROWSER }
2100
+ export { IS_BROWSER as IS_BROWSER_alias_1 }
2101
+ export { IS_BROWSER as IS_BROWSER_alias_2 }
2102
+
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
+
2047
2108
  declare function isJson(str: string): boolean;
2048
2109
  export { isJson }
2049
2110
  export { isJson as isJson_alias_1 }
@@ -2314,6 +2375,11 @@ export { regexSearchMapper }
2314
2375
  export { regexSearchMapper as regexSearchMapper_alias_1 }
2315
2376
  export { regexSearchMapper as regexSearchMapper_alias_2 }
2316
2377
 
2378
+ declare function registerApolloErrorViewerCallback(fn: (err: ApolloError) => void): void;
2379
+ export { registerApolloErrorViewerCallback }
2380
+ export { registerApolloErrorViewerCallback as registerApolloErrorViewerCallback_alias_1 }
2381
+ export { registerApolloErrorViewerCallback as registerApolloErrorViewerCallback_alias_2 }
2382
+
2317
2383
  declare function removeAccent(str: string): string;
2318
2384
  export { removeAccent }
2319
2385
  export { removeAccent as removeAccent_alias_1 }
@@ -2600,6 +2666,11 @@ export { serializer }
2600
2666
  export { serializer as serializer_alias_1 }
2601
2667
  export { serializer as serializer_alias_2 }
2602
2668
 
2669
+ declare function showGlobalApolloError(error: ApolloError): void;
2670
+ export { showGlobalApolloError }
2671
+ export { showGlobalApolloError as showGlobalApolloError_alias_1 }
2672
+ export { showGlobalApolloError as showGlobalApolloError_alias_2 }
2673
+
2603
2674
  declare const SIMPLE_GIT_HOOK_CLI = "simple-git-hooks";
2604
2675
  export { SIMPLE_GIT_HOOK_CLI }
2605
2676
  export { SIMPLE_GIT_HOOK_CLI as SIMPLE_GIT_HOOK_CLI_alias_1 }
@@ -2995,6 +3066,11 @@ export { TSX_CLI }
2995
3066
  export { TSX_CLI as TSX_CLI_alias_1 }
2996
3067
  export { TSX_CLI as TSX_CLI_alias_2 }
2997
3068
 
3069
+ declare function useApolloErrorViewer(): I_ApolloErrorViewerContext_2;
3070
+ export { useApolloErrorViewer }
3071
+ export { useApolloErrorViewer as useApolloErrorViewer_alias_1 }
3072
+ export { useApolloErrorViewer as useApolloErrorViewer_alias_2 }
3073
+
2998
3074
  declare function useLoading(): I_LoadingContext_2;
2999
3075
  export { useLoading }
3000
3076
  export { useLoading as useLoading_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 m(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 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,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?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=process.env.DEBUG==="true";var D=N(require("process"),1);var L=N(require("boxen"),1),A=N(require("chalk"),1),R=require("child_process"),j=N(require("process"),1),G=N(require("util"),1);var M=N(require("node-fetch"),1);var k=N(require("fs"),1),F=function(e){return k.existsSync(e)};function K(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 x(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 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);k.appendFileSync(e,c,"utf-8")}function B(e){e.forEach(function(e){F(e)&&k.rmSync(e,{recursive:!0,force:!0})})}var Y=N(require("path"),1);function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=Y).resolve.apply(r,[eD].concat(h(t)))}function V(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++){t[n]=arguments[n]}var r;return(r=Y).join.apply(r,h(t))}var W=N(require("node-persist"),1),q=N(require("os"),1),X=N(require("process"),1);function H(){return X.default.env.CYBERSKILL_STORAGE_DIR||V(q.default.homedir(),eA)}function $(){return z.apply(this,arguments)}function z(){z=i(function(){var e;return m(this,function(t){switch(t.label){case 0:e=W.default.defaultInstance;if(e)return[3,2];return[4,W.default.init({dir:H(),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 Q={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,$()];case 1:r.sent();return[4,W.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,$()];case 1:r.sent();return[4,W.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,$()];case 1:n.sent();return[4,W.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,$()];case 1:n.sent();return[4,W.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(H()," (key: ").concat(e,")")]}catch(e){return[2,(console.error("❌ [Storage:getLogLink] Error getting log link:",e),null)]}return[2]})})()}};var Z=24*60*60*1e3;function ee(e){var t=V(eD,eG);if(F(t))try{var n=K(t,{asJson:!0});if(n.name===e)return{path:t,file:n,isCurrentProject:!0}}catch(e){ed.warning("Failed to read local package.json: ".concat(e.message))}var r=V(eD,eR,e,eG);if(F(r))try{var i=K(r,{asJson:!0});if(i.name===e)return{path:r,file:i,isCurrentProject:!1}}catch(t){ed.warning("Failed to read node_modules package.json for ".concat(e,": ").concat(t.message))}return!1}function et(e){return en.apply(this,arguments)}function en(){en=i(function(e){var t,n,r,i,c,o,a,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,Q.get(n)];case 1:i=p.sent();return[4,Q.get(r)];case 2:c=p.sent(),o=i&&Date.now()-i.timestamp<Z;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,M.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,Q.set(n,{version:u,timestamp:Date.now()})];case 6:p.sent();return[4,Q.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(ed.error("Error fetching latest version for ".concat(e,": ").concat(l.message)),i)return[2,(ed.warning("Falling back to cached version for ".concat(e,": ").concat(i.version)),i.version)];throw l;case 9:return[2]}})});return en.apply(this,arguments)}function er(e){return ei.apply(this,arguments)}function ei(){ei=i(function(e){var t,n,r,i,c;return m(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=ee(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,et(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,(ed.error('Error checking package "'.concat(e,'": ').concat(c.message)),t)];case 7:return[2]}})});return ei.apply(this,arguments)}var ec=G.promisify(R.exec),eo=A.default,ea=eo.gray,es=eo.blue;function eu(){return ea("[".concat(new Date().toLocaleTimeString(),"]"))}function el(e){var t=A.default[e];return typeof t=="function"?t:A.default.green}function ef(e,t,n,r){var i=el(t);console.log("".concat(eu()," ").concat(i("".concat(n," ").concat(e))," ").concat(r))}function ep(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=el(i),h=el(p);if(typeof t=="string"){console.log((0,L.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(eu()," ").concat(d("File:")," ").concat(es("".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,L.default)(h(d("".concat(e,": ").concat(t.length))),{padding:o,margin:s,borderStyle:l,borderColor:i})),console.log(ea("─".repeat(40))))}var ed={success:function(e){return ef("SUCCESS","green","✔",e)},error:function(e){return ef("ERROR","red","✖",e)},warning:function(e){return ef("WARNING","yellow","⚠",e)},info:function(e){return ef("INFO","blue","ℹ",e)},printBoxedLog:ep};function eh(e){return"error_list:".concat(e)}function eg(e){return ey.apply(this,arguments)}function ey(){ey=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=eh(t);c.label=1;case 1:c.trys.push([1,3,,4]);return[4,Q.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,Q.getLogLink(n)];case 1:e=t.sent();e&&ed.info("\uD83D\uDCC2 Open the error list manually: ".concat(e));return[2]}})}),10);return[3,4];case 3:r=c.sent();ed.error("Failed to save errors: ".concat(r.message));return[3,4];case 4:return[2]}})});return ey.apply(this,arguments)}function em(){return ev.apply(this,arguments)}function ev(){ev=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Q.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,Q.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,(ed.error("Failed to retrieve stored errors: ".concat(n.message)),[])];case 4:return[2]}})});return ev.apply(this,arguments)}function e_(){return eE.apply(this,arguments)}function eE(){eE=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:r.trys.push([0,3,,4]);return[4,Q.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 Q.remove(e)}))];case 2:r.sent();return[3,4];case 3:n=r.sent();ed.error("Failed to clear error lists: ".concat(n.message));return[3,4];case 4:return[2]}})});return eE.apply(this,arguments)}function eb(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&&eg(t),n.length&&C&&(ed.warning("Unmatched lines:"),n.forEach(function(e){return console.log(" ".concat(e))}))}function eI(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&&eg(n)}catch(t){eb(e)}}function eS(e){return eO.apply(this,arguments)}function eO(){eO=i(function(e){var t,n,r,i,c,o,a,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]:eI;n=new AbortController;j.default.on("SIGINT",function(){ed.warning("Process interrupted. Terminating..."),n.abort(),j.default.exit()});f.label=1;case 1:f.trys.push([1,3,,4]);return[4,ec(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&&ed.error("Command failed: ".concat(u));return[3,4];case 4:return[2]}})});return eO.apply(this,arguments)}function eN(e){return{raw:!0,cmd:e}}function ew(e,t){return(t===null||t===void 0?void 0:t.isRemote)?"".concat(e5," ").concat(eL," ").concat(e):(t===null||t===void 0?void 0:t.isCurrentProject)?"".concat(e5," ").concat(e2," src/cli.ts ").concat(e):"".concat(e5," ").concat(eJ," ").concat(e)}function eT(e,t){return typeof e=="function"?ew(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"?ew(e,t):e}function eP(e){return eC.apply(this,arguments)}function eC(){eC=i(function(e){var t,n,r,i,c,o,a;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];a=!1;return[3,3];case 1:return[4,er(eL)];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,eT(r,c)]}))]}})});return eC.apply(this,arguments)}var eD=D.default.env.INIT_CWD||D.default.cwd(),eL="@cyberskill/shared",eA=".cyberskill-storage",eR="node_modules",ej="dist",eG="package.json",eM="package-lock.json",ek="tsconfig.json",eF=".gitignore",eK=".simple-git-hooks.json",ex="pnpm-lock.yaml",eU=".git/hooks/",eB=".git/COMMIT_EDITMSG",eY=V(eD,eR,eL,ej),eJ="cyberskill",eV="eslint",eW="eslint",eq="vitest",eX="playwright",eH="vitest",e$="@commitlint/cli",ez="commitlint",eQ="lint-staged",eZ="lint-staged",e0="typescript",e1="tsc",e2="tsx",e4="git",e3="pnpm",e5="pnpm exec",e6="simple-git-hooks",e8="simple-git-hooks",e7="@eslint/config-inspector",e9="eslint-config-inspector",te="node-modules-inspector",tt="node-modules-inspector",tn={CYBERSKILL_DIRECTORY:eY,WORKING_DIRECTORY:eD,TS_CONFIG:J(ek),GIT_IGNORE:J(eF),GIT_HOOK:J(eU),GIT_COMMIT_MSG:J(eB),SIMPLE_GIT_HOOKS_JSON:J(eK),PACKAGE_JSON:J(eG),PACKAGE_LOCK_JSON:J(eM),PNPM_LOCK_YAML:J(ex),NODE_MODULES:J(eR),CYBERSKILL:{LINT_STAGED_CONFIG:J("".concat(eY,"/configs/lint-staged/base.js")),COMMITLINT_CONFIG:J("".concat(eY,"/configs/commitlint/base.js")),UNIT_TEST_CONFIG:J("".concat(eY,"/configs/vitest/react/unit.js")),UNIT_TEST_SETUP_CONFIG:J("".concat(eY,"/configs/vitest/react/unit.setup.js")),E2E_TEST_CONFIG:J("".concat(eY,"/configs/vitest/react/e2e.js"))}};function tr(e){var t=e.isCurrentProject;return l({"pre-commit":eZ,"commit-msg":ez},t&&{"pre-push":eN("".concat(e4," pull"))})}function ti(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];switch(e){case"PNPM_ADD_AND_EXEC":return eT(eN("".concat(e3," add ").concat(c," && ").concat(e5," ").concat(o)));case"PNPM_ADD_DEV_AND_EXEC":return eT(eN("".concat(e3," add -D ").concat(c," && ").concat(e5," ").concat(o)));case"RAW":return eT(eN(c))}}var tc={SIMPLE_GIT_HOOKS:ti("PNPM_ADD_DEV_AND_EXEC",e6,e8),ESLINT_INSPECT:ti("PNPM_ADD_DEV_AND_EXEC",e7,e9),NODE_MODULES_INSPECT:ti("PNPM_ADD_DEV_AND_EXEC",te,tt),ESLINT_CHECK:ti("PNPM_ADD_DEV_AND_EXEC",eV,"".concat(eW," ").concat(tn.WORKING_DIRECTORY)),ESLINT_FIX:ti("PNPM_ADD_DEV_AND_EXEC",eV,"".concat(eW," ").concat(tn.WORKING_DIRECTORY," --fix")),TYPESCRIPT_CHECK:ti("PNPM_ADD_AND_EXEC",e0,"".concat(e1," -p ").concat(tn.TS_CONFIG," --noEmit")),CONFIGURE_GIT_HOOK:ti("RAW","".concat(e4," config core.hooksPath ").concat(tn.GIT_HOOK)),BUILD:ti("RAW","".concat(e3," run build")),STAGE_BUILD_DIRECTORY:ti("RAW","".concat(e4," add ").concat(ej)),PNPM_INSTALL_STANDARD:ti("RAW","".concat(e3," install")),PNPM_INSTALL_LEGACY:ti("RAW","".concat(e3," install --legacy-peer-deps")),PNPM_INSTALL_FORCE:ti("RAW","".concat(e3," install --force")),CYBERSKILL:{TEST_UNIT:ti("PNPM_ADD_AND_EXEC",eq,"".concat(eH," --config ").concat(tn.CYBERSKILL.UNIT_TEST_CONFIG)),TEST_E2E:ti("PNPM_ADD_AND_EXEC","".concat(eq," ").concat(eX),"".concat(eH," --config ").concat(tn.CYBERSKILL.E2E_TEST_CONFIG)),COMMIT_LINT:ti("PNPM_ADD_DEV_AND_EXEC",e$,"".concat(ez," --edit ").concat(tn.GIT_COMMIT_MSG," --config ").concat(tn.CYBERSKILL.COMMITLINT_CONFIG)),LINT_STAGED:ti("PNPM_ADD_DEV_AND_EXEC",eQ,"".concat(eZ," --config ").concat(tn.CYBERSKILL.LINT_STAGED_CONFIG))}};function to(e,t){return ta.apply(this,arguments)}function ta(){ta=i(function(e,t){return m(this,function(n){switch(n.label){case 0:ed.info("".concat(e,"...")),C&&ed.info("Executing command: ".concat(t));return[4,eS(t)];case 1:n.sent(),ed.success("".concat(e," completed successfully."));return[2]}})});return ta.apply(this,arguments)}function ts(){return tu.apply(this,arguments)}function tu(){tu=i(function(){var e;return m(this,function(t){switch(t.label){case 0:if(!F(tn.TS_CONFIG))return[3,2];return[4,to("Performing TypeScript validation",tc.TYPESCRIPT_CHECK)];case 1:e=t.sent();return[3,3];case 2:e=ed.warning("No TypeScript configuration found. Skipping type check.");t.label=3;case 3:e;return[2]}})});return tu.apply(this,arguments)}function tl(){return tf.apply(this,arguments)}function tf(){tf=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",tc.ESLINT_FIX)];case 1:t=r.sent();return[3,4];case 2:return[4,to("Running ESLint check",tc.ESLINT_CHECK)];case 3:t=r.sent();r.label=4;case 4:t;return[2]}})});return tf.apply(this,arguments)}function tp(){return td.apply(this,arguments)}function td(){td=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,em()];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?ed.printBoxedLog("✔ NO ISSUES FOUND","",{color:"green"}):(ed.printBoxedLog("⚠ Warnings",n,{color:"yellow"}),ed.printBoxedLog("✖ Errors",t,{color:"red"}));return[2]}})});return td.apply(this,arguments)}function th(){return tg.apply(this,arguments)}function tg(){tg=i(function(){var e,t,n;return m(this,function(r){switch(r.label){case 0:return[4,e_()];case 1:r.sent();return[4,er(eL)];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(eL),tc.BUILD)];case 4:r.sent();return[4,to("Staging build artifacts",tc.STAGE_BUILD_DIRECTORY)];case 5:r.sent();return[3,7];case 6:n=r.sent();throw ed.error("Error building and staging ".concat(eL,": ").concat(n.message)),n;case 7:return[4,to("Executing lint-staged",tc.CYBERSKILL.LINT_STAGED)];case 8:r.sent(),tp();return[2]}})});return tg.apply(this,arguments)}function ty(){return tm.apply(this,arguments)}function tm(){tm=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Inspecting ESLint configuration",tc.ESLINT_INSPECT)];case 1:e.sent();return[2]}})});return tm.apply(this,arguments)}function tv(){return t_.apply(this,arguments)}function t_(){t_=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e_()];case 1:e.sent();return[4,Promise.all([ts(),tl()])];case 2:e.sent(),tp();return[2]}})});return t_.apply(this,arguments)}function tE(){return tb.apply(this,arguments)}function tb(){tb=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e_()];case 1:e.sent();return[4,Promise.all([ts(),tl(!0)])];case 2:e.sent(),tp();return[2]}})});return tb.apply(this,arguments)}function tI(){return tS.apply(this,arguments)}function tS(){tS=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,e_()];case 1:e.sent();return[4,to("Validating commit message",tc.CYBERSKILL.COMMIT_LINT)];case 2:e.sent(),tp();return[2]}})});return tS.apply(this,arguments)}function tO(){return tN.apply(this,arguments)}function tN(){tN=i(function(){var e,t;return m(this,function(n){switch(n.label){case 0:return[4,to("Configuring Git hooks",tc.CONFIGURE_GIT_HOOK)];case 1:n.sent(),B([tn.GIT_HOOK]);return[4,eP(tr)];case 2:e=n.sent();x(tn.SIMPLE_GIT_HOOKS_JSON,e,{isJson:!0});t="\n".concat(eK,"\n");F(tn.GIT_IGNORE)?K(tn.GIT_IGNORE).split("\n").includes(eK)||U(tn.GIT_IGNORE,t):x(tn.GIT_IGNORE,t);return[4,to("Installing simple-git-hooks",tc.SIMPLE_GIT_HOOKS)];case 3:n.sent();return[2]}})});return tN.apply(this,arguments)}function tw(){return tT.apply(this,arguments)}function tT(){tT=i(function(){var e,t,n,r,i,c,o,a,s,u,l;return m(this,function(f){switch(f.label){case 0:e=[{command:tc.PNPM_INSTALL_STANDARD,message:"Installing dependencies (standard)"},{command:tc.PNPM_INSTALL_LEGACY,message:"Retrying with legacy peer dependencies"},{command:tc.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,to("".concat(s," using: ").concat(a),a)];case 4:f.sent();return[2];case 5:u=f.sent();ed.warning("Installation attempt failed: ".concat(a)),ed.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 tT.apply(this,arguments)}function tP(e){return tC.apply(this,arguments)}function tC(){tC=i(function(e){var t,n,r,i,o;return m(this,function(a){switch(a.label){case 0:a.trys.push([0,4,,5]);return[4,er(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)),x(n,i,{isJson:!0});return[4,tw()];case 2:a.sent();return[4,tE()];case 3:a.sent();return[3,5];case 4:o=a.sent();throw ed.error('Failed to update "'.concat(e,'": ').concat(o.message)),o;case 5:return[2]}})});return tC.apply(this,arguments)}function tD(){return tL.apply(this,arguments)}function tL(){tL=i(function(){var e,t,n,r,i,c,o;return m(this,function(a){switch(a.label){case 0:if(!F(tn.PACKAGE_JSON)){ed.error("package.json not found. Aborting setup.");return[2]}a.label=1;case 1:a.trys.push([1,7,,8]);return[4,er(eL)];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=ed.success("Cyberskill package is already up to date.");return[3,5];case 3:return[4,tP(eL)];case 4:c=a.sent();a.label=5;case 5:c;return[4,tO()];case 6:a.sent();return[3,8];case 7:o=a.sent();throw ed.error("Project setup failed: ".concat(o.message)),o;case 8:return[2]}})});return tL.apply(this,arguments)}function tA(){return tR.apply(this,arguments)}function tR(){tR=i(function(){return m(this,function(e){switch(e.label){case 0:B([tn.NODE_MODULES,tn.PNPM_LOCK_YAML]);return[4,tw()];case 1:e.sent();return[4,tO()];case 2:e.sent();return[2]}})});return tR.apply(this,arguments)}function tj(){return tG.apply(this,arguments)}function tG(){tG=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Inspecting project dependencies",tc.NODE_MODULES_INSPECT)];case 1:e.sent();return[2]}})});return tG.apply(this,arguments)}function tM(){return tk.apply(this,arguments)}function tk(){tk=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Running unit tests",tc.CYBERSKILL.TEST_UNIT)];case 1:e.sent();return[2]}})});return tk.apply(this,arguments)}function tF(){return tK.apply(this,arguments)}function tK(){tK=i(function(){return m(this,function(e){switch(e.label){case 0:return[4,to("Running end-to-end tests",tc.CYBERSKILL.TEST_E2E)];case 1:e.sent();return[2]}})});return tK.apply(this,arguments)}(0,P.default)((0,T.hideBin)(w.default.argv)).scriptName(eJ).usage("$0 <command> [options]").command("lint","Check code for linting issues",tv).command("lint:fix","Fix linting issues automatically",tE).command("lint:inspect","View active ESLint configuration",ty).command("lint-staged","Run lint checks on staged files",th).command("commitlint","Validate commit message format",tI).command("setup","Initialize project setup and dependencies",tD).command("reset","Reset the project and reinstall dependencies",tA).command("inspect","Analyze installed project dependencies",tj).command("test:unit","Run unit test suite",tM).command("test:e2e","Run end-to-end test suite",tF).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,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();