@supernovaio/cli-next 2.0.13 → 2.0.15

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 (79) hide show
  1. package/README.md +47 -31
  2. package/dist/commands/describe-design-system.d.ts +1 -7
  3. package/dist/commands/describe-design-system.d.ts.map +1 -1
  4. package/dist/commands/describe-design-system.js +2 -4
  5. package/dist/commands/describe-design-system.js.map +1 -1
  6. package/dist/commands/describe-workspaces.d.ts +1 -8
  7. package/dist/commands/describe-workspaces.d.ts.map +1 -1
  8. package/dist/commands/describe-workspaces.js +3 -6
  9. package/dist/commands/describe-workspaces.js.map +1 -1
  10. package/dist/commands/import-components.d.ts +1 -6
  11. package/dist/commands/import-components.d.ts.map +1 -1
  12. package/dist/commands/import-components.js +1 -3
  13. package/dist/commands/import-components.js.map +1 -1
  14. package/dist/commands/import-storybook.d.ts +1 -7
  15. package/dist/commands/import-storybook.d.ts.map +1 -1
  16. package/dist/commands/import-storybook.js +5 -14
  17. package/dist/commands/import-storybook.js.map +1 -1
  18. package/dist/commands/login.d.ts +5 -20
  19. package/dist/commands/login.d.ts.map +1 -1
  20. package/dist/commands/login.js +3 -10
  21. package/dist/commands/login.js.map +1 -1
  22. package/dist/commands/logout.d.ts +5 -20
  23. package/dist/commands/logout.d.ts.map +1 -1
  24. package/dist/commands/logout.js +3 -10
  25. package/dist/commands/logout.js.map +1 -1
  26. package/dist/commands/publish-documentation.d.ts +4 -24
  27. package/dist/commands/publish-documentation.d.ts.map +1 -1
  28. package/dist/commands/publish-documentation.js +3 -16
  29. package/dist/commands/publish-documentation.js.map +1 -1
  30. package/dist/commands/sync-tokens.d.ts +2 -24
  31. package/dist/commands/sync-tokens.d.ts.map +1 -1
  32. package/dist/commands/sync-tokens.js +3 -16
  33. package/dist/commands/sync-tokens.js.map +1 -1
  34. package/dist/services/auth.service.d.ts +2 -2
  35. package/dist/services/auth.service.d.ts.map +1 -1
  36. package/dist/services/auth.service.js +5 -7
  37. package/dist/services/auth.service.js.map +1 -1
  38. package/dist/services/vault.service.d.ts +2 -1
  39. package/dist/services/vault.service.d.ts.map +1 -1
  40. package/dist/services/vault.service.js +1 -0
  41. package/dist/services/vault.service.js.map +1 -1
  42. package/dist/types/base-command.d.ts +2 -2
  43. package/dist/types/base-command.d.ts.map +1 -1
  44. package/dist/types/base-command.js +5 -9
  45. package/dist/types/base-command.js.map +1 -1
  46. package/dist/types/environment.d.ts +8 -0
  47. package/dist/types/environment.d.ts.map +1 -0
  48. package/dist/types/environment.js +69 -0
  49. package/dist/types/environment.js.map +1 -0
  50. package/dist/types/flags.d.ts +1 -3
  51. package/dist/types/flags.d.ts.map +1 -1
  52. package/dist/types/flags.js +1 -10
  53. package/dist/types/flags.js.map +1 -1
  54. package/dist/types/index.d.ts +1 -0
  55. package/dist/types/index.d.ts.map +1 -1
  56. package/dist/types/index.js +1 -0
  57. package/dist/types/index.js.map +1 -1
  58. package/dist/types/login.d.ts +1 -11
  59. package/dist/types/login.d.ts.map +1 -1
  60. package/dist/types/login.js +2 -10
  61. package/dist/types/login.js.map +1 -1
  62. package/dist/types/types.d.ts +0 -7
  63. package/dist/types/types.d.ts.map +1 -1
  64. package/dist/types/types.js +0 -8
  65. package/dist/types/types.js.map +1 -1
  66. package/dist/utils/api-client.d.ts +2 -2
  67. package/dist/utils/api-client.d.ts.map +1 -1
  68. package/dist/utils/api-client.js +3 -4
  69. package/dist/utils/api-client.js.map +1 -1
  70. package/dist/utils/sdk.d.ts +1 -2
  71. package/dist/utils/sdk.d.ts.map +1 -1
  72. package/dist/utils/sdk.js +3 -5
  73. package/dist/utils/sdk.js.map +1 -1
  74. package/oclif.manifest.json +3 -119
  75. package/package.json +2 -1
  76. package/dist/utils/network.d.ts +0 -3
  77. package/dist/utils/network.d.ts.map +0 -1
  78. package/dist/utils/network.js +0 -13
  79. package/dist/utils/network.js.map +0 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@ You can now test that everything was properly set up by running the `supernova`
22
22
  > @supernovaio/cli/1.x.x ...
23
23
  ```
24
24
 
25
- `Node 21` or newer environment is required to run the Supernova CLI.
25
+ `Node 20` or newer environment is required to run the Supernova CLI.
26
26
 
27
27
  ### Updating CLI globally
28
28
 
@@ -38,65 +38,76 @@ This will upgrade the CLI to the latest version and make it immediately last def
38
38
  ## Login Command
39
39
 
40
40
  The login command is a crucial part of the Supernova CLI, as it establishes authentication required before using any other commands. This section explains how the login process works and how to use it effectively.
41
+
41
42
  ### Overview
43
+
42
44
  The login command authenticates you with Supernova services using a secure OAuth flow with PKCE (Proof Key for Code Exchange). This authentication method is secure and follows modern best practices for CLI authorization.
43
- ``` bash
45
+
46
+ ```bash
44
47
  supernova login
45
48
  ```
49
+
46
50
  ### How It Works
51
+
47
52
  The login process follows these steps:
53
+
48
54
  1. **Initiate Authentication**: The CLI generates a secure code challenge using PKCE.
49
55
  2. **Browser Authentication**: Your default browser will open automatically to Supernova's authentication page.
50
56
  3. **Authorization**: Complete the authentication in your browser.
51
57
  4. **Token Storage**: Once authenticated, the CLI securely stores your tokens for future use.
52
58
  5. **Completion**: You'll see a confirmation message when successfully logged in.
53
59
 
54
- ### Command Options
55
-
56
- | Flag | Description |
57
- | --- | --- |
58
- | `--environment` | Specify the environment (production by default) |
59
60
  ### Token Storage
61
+
60
62
  Your authentication tokens are securely stored using one of the following methods:
63
+
61
64
  1. **System Keychain** (Primary method): The CLI uses your operating system's secure credential store.
62
65
  2. **Local File** (Fallback): If keychain access fails, tokens are stored in . `~/.supernova/tokens.json`
63
66
  3. **Environment Variable**: You can bypass the login process by setting the environment variable. `SUPERNOVA_TOKEN`
64
67
 
65
68
  ### Automatic Token Refresh
69
+
66
70
  The CLI automatically handles token refreshing:
71
+
67
72
  - Tokens nearing expiration (within 5 minutes) are automatically refreshed.
68
73
  - If a refresh token fails, you'll be prompted to log in again.
69
74
 
70
75
  ### Usage Examples
71
- Standard login to production environment:
72
- ``` bash
76
+
77
+ Standard login:
78
+
79
+ ```bash
73
80
  supernova login
74
81
  ```
75
- Login to a specific environment:
76
- ``` bash
77
- supernova login --environment=staging
78
- ```
82
+
79
83
  ### Troubleshooting
84
+
80
85
  If your browser doesn't open automatically, the CLI will display a URL that you can manually copy and paste into your browser to complete the authentication process.
81
86
  If you encounter authentication issues, you can try:
87
+
82
88
  1. Running the login command again
83
89
  2. Checking your internet connection
84
90
  3. Ensuring you have the correct permissions in Supernova
85
91
 
86
92
  ### Important Notes
93
+
87
94
  - You must complete the authentication process within 5 minutes (300 seconds)
88
95
  - All other CLI commands will verify authentication before execution
89
96
  - To log out, you can use the `logout` command (which removes stored tokens)
90
97
 
91
98
  ## Configuration File
99
+
92
100
  The Supernova CLI supports configuration files to streamline your workflow by persisting command options and preferences.
93
101
 
94
102
  ### Overview
103
+
95
104
  When working with Supernova CLI, you can use a configuration file named located in your current working directory. This file stores your command-specific options, eliminating the need to repeatedly provide the same flags and parameters in subsequent commands. `.supernova.json`
96
105
 
97
106
  ### File Structure
107
+
98
108
  The configuration file uses a simple JSON structure:
99
- ``` json
109
+
110
+ ```json
100
111
  {
101
112
  "commands": {
102
113
  "command-name": {
@@ -109,24 +120,26 @@ The configuration file uses a simple JSON structure:
109
120
  ```
110
121
 
111
122
  The file consists of two main sections:
123
+
112
124
  - **commands**: Contains configurations for specific CLI commands, organized by command ID
113
- - **global**: Reserved for future global settings that apply across all commands
125
+ - **global**: Reserved for future global settings that apply across all commands
114
126
 
115
127
  ### How Configuration Works
128
+
116
129
  The configuration system operates through the following mechanisms:
130
+
117
131
  1. **Automatic Loading**: When you run a command, the CLI checks for a file in your current directory `.supernova.json`
118
132
  2. **Command Options**: Any options defined in the configuration file for the current command are automatically applied
119
133
  3. **Override Precedence**: Command-line flags take precedence over configuration file values
120
134
  4. **Automatic Saving**: After a successful command execution, the CLI saves the used options back to the configuration file
121
135
 
122
136
  ### Example Configuration
137
+
123
138
  Here's an example of a configuration file for token synchronization:
124
- ``` json
139
+
140
+ ```json
125
141
  {
126
142
  "commands": {
127
- "login": {
128
- "environment": "production"
129
- },
130
143
  "figma-tokens-sync": {
131
144
  "mode": "single-file",
132
145
  "dryRun": false
@@ -137,52 +150,55 @@ Here's an example of a configuration file for token synchronization:
137
150
  ```
138
151
 
139
152
  ### Benefits
153
+
140
154
  Using the configuration file offers several advantages:
155
+
141
156
  - **Simplifies Command Usage**: No need to repeatedly type the same options
142
157
  - **Improves Workflow Efficiency**: Saves time and reduces errors when executing commands
143
158
  - **Enhances Team Collaboration**: Share consistent settings across your team by committing the configuration file to version control
144
159
  - **Supports CI/CD Integration**: Makes it easier to integrate CLI commands into automated pipelines
145
160
 
146
161
  ### Command-Specific Configuration
162
+
147
163
  Each command can store its specific configuration options. For example:
148
- 1. **Login Command**: Stores the target environment
149
- ``` json
150
- "login": {
151
- "environment": "production"
152
- }
153
- ```
164
+
154
165
  1. **Import Storybook Command**: Stores paths and IDs needed for importing
155
- ``` json
166
+
167
+ ```json
156
168
  "import-storybook": {
157
- "environment": "production",
158
169
  "dir": "./storybook-static",
159
170
  "designSystemId": "37355",
160
171
  "versionId": "37352"
161
172
  }
162
173
  ```
174
+
163
175
  ### Managing Configuration
176
+
164
177
  The CLI handles configuration automatically:
178
+
165
179
  - **Required Flags**: If a required flag has a value in the configuration file, it becomes optional in the command line
166
180
  - **Updating Values**: When you provide a flag in the command line, its value is saved back to the configuration file for future use
167
181
  - **Feedback**: The CLI will inform you when configuration is loaded and saved
168
182
 
169
183
  ### Best Practices
184
+
170
185
  - **Version Control**: Consider adding the file to version control if you want to share settings with your team `.supernova.json`
171
186
  - **Sensitive Information**: Avoid storing sensitive information in the configuration file as it might be committed to version control
172
187
 
173
188
  ### Troubleshooting
189
+
174
190
  If you encounter issues with your configuration:
191
+
175
192
  1. **Check File Format**: Ensure the JSON is valid and properly formatted
176
193
  2. **Check Permissions**: Ensure the CLI has write permissions in the current directory
177
194
  3. **Reset Configuration**: Simply delete the file to start fresh `.supernova.json`
178
195
 
179
196
  By leveraging the configuration file, you can significantly streamline your workflow when working with the Supernova CLI.
180
197
 
181
-
182
198
  ## Next Steps
183
- After successfully logging in, you can use other Supernova CLI commands.
184
- See the additional use cases section for more information about available commands.
185
199
 
200
+ After successfully logging in, you can use other Supernova CLI commands.
201
+ See the additional use cases section for more information about available commands.
186
202
 
187
203
  ### Use cases
188
204
 
@@ -194,7 +210,7 @@ Following is the list of use cases for Supernova CLI. We will be adding more ove
194
210
 
195
211
  ## Contributions
196
212
 
197
- If you have additional ideas about how to make this project better, let us know by opening an issue! You can also open pull requests if you've worked on improving something yourself and would like to contribute back to the community.
213
+ If you have additional ideas about how to make this project better, let us know by opening an issue! You can also open pull requests if you've worked on improving something yourself and would like to contribute back to the community.
198
214
 
199
215
  We will be reviewing feature-pull-requests on case-by-case basis, but in general, we are super open to your new ideas and we welcome them! And finally, thank you for your support! You are an amazing community.
200
216
 
@@ -1,29 +1,24 @@
1
1
  import { z } from "zod";
2
- import { Environment, SentryCommand } from "../types/index.js";
2
+ import { SentryCommand } from "../types/index.js";
3
3
  declare const DescribeDesignSystemConfigSchema: z.ZodEffects<z.ZodObject<{
4
4
  apiKey: z.ZodString;
5
5
  designSystemId: z.ZodString;
6
- environment: z.ZodNativeEnum<typeof Environment>;
7
6
  proxyUrl: z.ZodOptional<z.ZodString>;
8
7
  }, "strip", z.ZodTypeAny, {
9
8
  designSystemId: string;
10
9
  apiKey: string;
11
- environment: Environment;
12
10
  proxyUrl?: string | undefined;
13
11
  }, {
14
12
  designSystemId: string;
15
13
  apiKey: string;
16
- environment: Environment;
17
14
  proxyUrl?: string | undefined;
18
15
  }>, {
19
- environment: Environment;
20
16
  designSystemId: string;
21
17
  apiKey: string;
22
18
  proxyUrl?: string | undefined;
23
19
  }, {
24
20
  designSystemId: string;
25
21
  apiKey: string;
26
- environment: Environment;
27
22
  proxyUrl?: string | undefined;
28
23
  }>;
29
24
  type DescribeDesignSystemConfig = z.infer<typeof DescribeDesignSystemConfigSchema>;
@@ -35,7 +30,6 @@ export declare class DescribeDesignSystem extends SentryCommand<DescribeDesignSy
35
30
  apiKey: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
36
31
  designSystemId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
37
32
  proxyUrl: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
38
- environment: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
39
33
  };
40
34
  get commandId(): string;
41
35
  get configSchema(): z.ZodType<DescribeDesignSystemConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"describe-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAS,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAYrE,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;EAUjC,CAAA;AAEL,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAGlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,OAAgB,OAAO,EAAE,CAAC,wBAAwB,CAAC,CAAA;IAEnD,OAAgB,WAAW,SAA8D;IAEzF,OAAgB,QAAQ,WAEvB;IAED,OAAgB,KAAK;;;;;MASpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAExD;IAMK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB3B"}
1
+ {"version":3,"file":"describe-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAe,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAY9D,QAAA,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;EAQjC,CAAA;AAEL,KAAK,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA;AAGlF,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,0BAA0B,CAAC;IAKjF,OAAgB,OAAO,EAAE,CAAC,wBAAwB,CAAC,CAAA;IAEnD,OAAgB,WAAW,SAA8D;IAEzF,OAAgB,QAAQ,WAEvB;IAED,OAAgB,KAAK;;;;MASpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAExD;IAMK,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyB3B"}
@@ -10,18 +10,16 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { Flags } from "@oclif/core";
11
11
  import { SentryTraced } from "@sentry/nestjs";
12
12
  import { z } from "zod";
13
- import { Environment, flags, SentryCommand } from "../types/index.js";
13
+ import { commonFlags, SentryCommand } from "../types/index.js";
14
14
  import { getWritableVersion } from "../utils/sdk.js";
15
15
  const DescribeDesignSystemConfigSchema = z
16
16
  .object({
17
17
  apiKey: z.string(),
18
18
  designSystemId: z.string(),
19
- environment: z.nativeEnum(Environment),
20
19
  proxyUrl: z.string().url().optional(),
21
20
  })
22
21
  .transform(data => ({
23
22
  ...data,
24
- environment: data.environment ?? Environment.production,
25
23
  }));
26
24
  export class DescribeDesignSystem extends SentryCommand {
27
25
  static aliases;
@@ -30,7 +28,7 @@ export class DescribeDesignSystem extends SentryCommand {
30
28
  `$ @supernovaio/cli describe-design-system --apiKey="{xxx-xxx-xxx}" --designSystemId="{1234}"`,
31
29
  ];
32
30
  static flags = {
33
- ...flags,
31
+ ...commonFlags,
34
32
  apiKey: Flags.string({ description: "API key to use for accessing Supernova instance", required: true }),
35
33
  designSystemId: Flags.string({ description: "Design System to describe structure of", required: true }),
36
34
  proxyUrl: Flags.string({
@@ -1 +1 @@
1
- {"version":3,"file":"describe-design-system.js","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAWpD,MAAM,gCAAgC,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACtC,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;IACP,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,UAAU;CACxD,CAAC,CAAC,CAAA;AAKL,MAAM,OAAO,oBAAqB,SAAQ,aAAyC;IAKjF,MAAM,CAAU,OAAO,CAA4B;IAEnD,MAAM,CAAU,WAAW,GAAG,2DAA2D,CAAA;IAEzF,MAAM,CAAU,QAAQ,GAAG;QACzB,8FAA8F;KAC/F,CAAA;IAED,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,KAAK;QACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,iDAAiD,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QACxG,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EA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AK,CAAC,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC3D,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,CAAC,uCAAuC,CAAC,IAAI,CAAC,CAAA;YACxD,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;;AAxBK;IADL,YAAY,EAAE;;;;+CAyBd","sourcesContent":["//\n// describe-design-system.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport { z } from \"zod\"\n\nimport { Environment, flags, SentryCommand } from \"../types/index.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\nconst DescribeDesignSystemConfigSchema = z\n .object({\n apiKey: z.string(),\n designSystemId: z.string(),\n environment: z.nativeEnum(Environment),\n proxyUrl: z.string().url().optional(),\n })\n .transform(data => ({\n ...data,\n environment: data.environment ?? Environment.production,\n }))\n\ntype DescribeDesignSystemConfig = z.infer<typeof DescribeDesignSystemConfigSchema>\n\n/** Command that describes the structure of provided design system */\nexport class DescribeDesignSystem extends SentryCommand<DescribeDesignSystemConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static override aliases: [\"describe-design-system\"]\n // Command help description\n static override description = \"Describe structure of single design system by provided ID\"\n // Examples how to use the command\n static override examples = [\n `$ @supernovaio/cli describe-design-system --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\"`,\n ]\n // Static flags to enable / disable features\n static override flags = {\n ...flags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n designSystemId: Flags.string({ description: \"Design System to describe structure of\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n get commandId(): string {\n return DescribeDesignSystem.id\n }\n\n get configSchema(): z.ZodType<DescribeDesignSystemConfig> {\n return DescribeDesignSystemConfigSchema\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeDesignSystem)\n\n // Get workspace -> design system –> version\n const { designSystem, id, instance } = await getWritableVersion(flags)\n\n // Get brands and themes\n const brands = await instance.brands.getBrands(id)\n const themes = await instance.tokens.getTokenThemes(id)\n\n this.log(`\\n↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
1
+ {"version":3,"file":"describe-design-system.js","sourceRoot":"","sources":["../../src/commands/describe-design-system.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,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trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport { z } from \"zod\"\n\nimport { commonFlags, SentryCommand } from \"../types/index.js\"\nimport { getWritableVersion } from \"../utils/sdk.js\"\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\nconst DescribeDesignSystemConfigSchema = z\n .object({\n apiKey: z.string(),\n designSystemId: z.string(),\n proxyUrl: z.string().url().optional(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype DescribeDesignSystemConfig = z.infer<typeof DescribeDesignSystemConfigSchema>\n\n/** Command that describes the structure of provided design system */\nexport class DescribeDesignSystem extends SentryCommand<DescribeDesignSystemConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static override aliases: [\"describe-design-system\"]\n // Command help description\n static override description = \"Describe structure of single design system by provided ID\"\n // Examples how to use the command\n static override examples = [\n `$ @supernovaio/cli describe-design-system --apiKey=\"{xxx-xxx-xxx}\" --designSystemId=\"{1234}\"`,\n ]\n // Static flags to enable / disable features\n static override flags = {\n ...commonFlags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n designSystemId: Flags.string({ description: \"Design System to describe structure of\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n get commandId(): string {\n return DescribeDesignSystem.id\n }\n\n get configSchema(): z.ZodType<DescribeDesignSystemConfig> {\n return DescribeDesignSystemConfigSchema\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeDesignSystem)\n\n // Get workspace -> design system –> version\n const { designSystem, id, instance } = await getWritableVersion(flags)\n\n // Get brands and themes\n const brands = await instance.brands.getBrands(id)\n const themes = await instance.tokens.getTokenThemes(id)\n\n this.log(`\\n↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
@@ -1,35 +1,29 @@
1
1
  import * as sdkTypes from "@supernovaio/sdk";
2
2
  import { z, ZodType } from "zod";
3
- import { Environment, SentryCommand } from "../types/index.js";
3
+ import { SentryCommand } from "../types/index.js";
4
4
  interface DescribeWorkspacesFlags {
5
5
  apiKey: string;
6
- environment: string;
7
6
  proxyUrl?: string;
8
7
  }
9
8
  declare const DescribeWorkspaceConfigSchema: z.ZodEffects<z.ZodObject<{
10
9
  apiKey: z.ZodString;
11
- environment: z.ZodNativeEnum<typeof Environment>;
12
10
  proxyUrl: z.ZodOptional<z.ZodString>;
13
11
  workspaceId: z.ZodString;
14
12
  }, "strip", z.ZodTypeAny, {
15
13
  workspaceId: string;
16
14
  apiKey: string;
17
- environment: Environment;
18
15
  proxyUrl?: string | undefined;
19
16
  }, {
20
17
  workspaceId: string;
21
18
  apiKey: string;
22
- environment: Environment;
23
19
  proxyUrl?: string | undefined;
24
20
  }>, {
25
- environment: Environment;
26
21
  workspaceId: string;
27
22
  apiKey: string;
28
23
  proxyUrl?: string | undefined;
29
24
  }, {
30
25
  workspaceId: string;
31
26
  apiKey: string;
32
- environment: Environment;
33
27
  proxyUrl?: string | undefined;
34
28
  }>;
35
29
  type DescribeWorkspaceConfig = z.infer<typeof DescribeWorkspaceConfigSchema>;
@@ -40,7 +34,6 @@ export declare class DescribeWorkspaces extends SentryCommand<DescribeWorkspaceC
40
34
  static flags: {
41
35
  apiKey: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
42
36
  proxyUrl: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
43
- environment: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
44
37
  };
45
38
  get commandId(): string;
46
39
  get configSchema(): ZodType<DescribeWorkspaceConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"describe-workspaces.d.ts","sourceRoot":"","sources":["../../src/commands/describe-workspaces.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAS,aAAa,EAAE,MAAM,mBAAmB,CAAA;AASrE,UAAU,uBAAuB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAKD,QAAA,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;EAU9B,CAAA;AAEL,KAAK,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAM5E,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,uBAAuB,CAAC;IAK5E,MAAM,CAAC,OAAO,EAAE,CAAC,qBAAqB,CAAC,CAAA;IAE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EAAE,uBAAuB,GAAG,OAAO,CAAC;QAC3D,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAA;QAC5B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;KACtC,CAAC;IAqBI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA0C3B"}
@@ -11,27 +11,24 @@ import { Flags } from "@oclif/core";
11
11
  import { SentryTraced } from "@sentry/nestjs";
12
12
  import { createRequire } from "node:module";
13
13
  import { z } from "zod";
14
- import { Environment, flags, SentryCommand } from "../types/index.js";
15
- import { environmentAPI } from "../utils/network.js";
14
+ import { apiUrlForEnvironment, commonFlags, getTargetEnv, SentryCommand } from "../types/index.js";
16
15
  const require = createRequire(import.meta.url);
17
16
  const sdkProvider = require("@supernovaio/sdk");
18
17
  const DescribeWorkspaceConfigSchema = z
19
18
  .object({
20
19
  apiKey: z.string(),
21
- environment: z.nativeEnum(Environment),
22
20
  proxyUrl: z.string().url().optional(),
23
21
  workspaceId: z.string(),
24
22
  })
25
23
  .transform(data => ({
26
24
  ...data,
27
- environment: data.environment ?? Environment.production,
28
25
  }));
29
26
  export class DescribeWorkspaces extends SentryCommand {
30
27
  static aliases;
31
28
  static description = "Describe structure of all workspaces and design systems available under those workspaces available for specified API key";
32
29
  static examples = [`$ @supernovaio/cli describe-workspaces --apiKey="{xxx-xxx-xxx}"`];
33
30
  static flags = {
34
- ...flags,
31
+ ...commonFlags,
35
32
  apiKey: Flags.string({ description: "API key to use for accessing Supernova instance", required: true }),
36
33
  proxyUrl: Flags.string({
37
34
  description: "When set, CLI will use provided proxy URL for all requests",
@@ -49,7 +46,7 @@ export class DescribeWorkspaces extends SentryCommand {
49
46
  if (!flags.apiKey || flags.apiKey.length === 0) {
50
47
  throw new Error(`API key must not be empty`);
51
48
  }
52
- const apiUrl = environmentAPI(flags.environment, "v2");
49
+ const apiUrl = apiUrlForEnvironment(getTargetEnv());
53
50
  const sdkInstance = new sdkProvider.Supernova(flags.apiKey, {
54
51
  apiUrl,
55
52
  bypassEnvFetch: true,
@@ -1 +1 @@
1
- {"version":3,"file":"describe-workspaces.js","sourceRoot":"","sources":["../../src/commands/describe-workspaces.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAoB,CAAA;AAclE,MAAM,6BAA6B,GAAG,CAAC;KACpC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;IACP,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,UAAU;CACxD,CAAC,CAAC,CAAA;AAQL,MAAM,OAAO,kBAAmB,SAAQ,aAAsC;IAK5E,MAAM,CAAC,OAAO,CAAyB;IAEvC,MAAM,CAAC,WAAW,GAChB,0HAA0H,CAAA;IAE5H,MAAM,CAAC,QAAQ,GAAG,CAAC,iEAAiE,CAAC,CAAA;IAErF,MAAM,CAAC,K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BACzD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,EAAE,CAAC,CAAA;oBAC9D,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC3B,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;4BAChC,IAAI,CAAC,GAAG,CAAC,mBAAmB,KAAK,CAAC,IAAI,UAAU,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAA;wBAClE,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,GAAG,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAA;oBAC1D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;;AAjEK;IADL,YAAY,EAAE;;;;uDAsBd;AAGK;IADL,YAAY,EAAE;;;;6CA0Cd","sourcesContent":["//\n// describe-workspaces.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport * as sdkTypes from \"@supernovaio/sdk\"\nimport { createRequire } from \"node:module\"\nimport { z, ZodType } from \"zod\"\n\nimport { Environment, flags, SentryCommand } from \"../types/index.js\"\nimport { environmentAPI } from \"../utils/network.js\"\n\nconst require = createRequire(import.meta.url)\nconst sdkProvider = require(\"@supernovaio/sdk\") as typeof sdkTypes\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\ninterface DescribeWorkspacesFlags {\n apiKey: string\n environment: string\n proxyUrl?: string\n}\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\nconst DescribeWorkspaceConfigSchema = z\n .object({\n apiKey: z.string(),\n environment: z.nativeEnum(Environment),\n proxyUrl: z.string().url().optional(),\n workspaceId: z.string(),\n })\n .transform(data => ({\n ...data,\n environment: data.environment ?? Environment.production,\n }))\n\ntype DescribeWorkspaceConfig = z.infer<typeof DescribeWorkspaceConfigSchema>\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that describes the structure of provided design system */\nexport class DescribeWorkspaces extends SentryCommand<DescribeWorkspaceConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases: [\"describe-workspaces\"]\n // Command help description\n static description =\n \"Describe structure of all workspaces and design systems available under those workspaces available for specified API key\"\n // Examples how to use the command\n static examples = [`$ @supernovaio/cli describe-workspaces --apiKey=\"{xxx-xxx-xxx}\"`]\n // Static flags to enable / disable features\n static flags = {\n ...flags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n get commandId(): string {\n return DescribeWorkspaces.id\n }\n\n get configSchema(): ZodType<DescribeWorkspaceConfig> {\n return DescribeWorkspaceConfigSchema\n }\n\n @SentryTraced()\n async getWorkspaces(flags: DescribeWorkspacesFlags): Promise<{\n instance: sdkTypes.Supernova\n workspaces: Array<sdkTypes.Workspace>\n }> {\n if (!flags.apiKey || flags.apiKey.length === 0) {\n throw new Error(`API key must not be empty`)\n }\n\n // Create instance for prod / dev\n const apiUrl = environmentAPI(flags.environment as Environment, \"v2\")\n const sdkInstance = new sdkProvider.Supernova(flags.apiKey, {\n apiUrl,\n bypassEnvFetch: true,\n proxyUrl: flags.proxyUrl,\n })\n const user = await sdkInstance.me.me()\n const workspaces = await sdkInstance.workspaces.workspaces(user.id)\n return {\n instance: sdkInstance,\n workspaces,\n }\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeWorkspaces)\n\n // Get workspaces\n const { instance, workspaces } = await this.getWorkspaces(flags)\n this.log(`\\n`)\n\n for (const workspace of workspaces) {\n // Get design systems and log\n // eslint-disable-next-line no-await-in-loop\n const designSystems = await instance.designSystems.designSystems(workspace.id)\n this.log(`↳ Workspace \"${workspace.profile.name}\", id: ${workspace.id}`.magenta)\n for (const designSystem of designSystems) {\n this.log(` ↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n // eslint-disable-next-line no-await-in-loop\n const version = await instance.versions.getActiveVersion(designSystem.id)\n if (!version) {\n this.log(`Design system ${designSystem.id} active version not found or not available under provided API key`)\n continue\n }\n\n const id: sdkTypes.RemoteVersionIdentifier = { designSystemId: designSystem.id, versionId: version.id }\n // eslint-disable-next-line no-await-in-loop\n const brands = await instance.brands.getBrands(id)\n // eslint-disable-next-line no-await-in-loop\n const themes = await instance.tokens.getTokenThemes(id)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`.gray)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
1
+ {"version":3,"file":"describe-workspaces.js","sourceRoot":"","sources":["../../src/commands/describe-workspaces.ts"],"names":[],"mappings":";;;;;;;;;AAWA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,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AC;oBACH,CAAC;yBAAM,CAAC;wBACN,IAAI,CAAC,GAAG,CAAC,yCAAyC,CAAC,IAAI,CAAC,CAAA;oBAC1D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;;AAjEK;IADL,YAAY,EAAE;;;;uDAsBd;AAGK;IADL,YAAY,EAAE;;;;6CA0Cd","sourcesContent":["//\n// describe-workspaces.ts\n// Supernova CLI\n//\n// Created by Jiri Trecak.\n// Copyright Ā© Supernova.io. All rights reserved.\n//\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Imports\n\nimport { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\nimport * as sdkTypes from \"@supernovaio/sdk\"\nimport { createRequire } from \"node:module\"\nimport { z, ZodType } from \"zod\"\n\nimport { apiUrlForEnvironment, commonFlags, getTargetEnv, SentryCommand } from \"../types/index.js\"\n\nconst require = createRequire(import.meta.url)\nconst sdkProvider = require(\"@supernovaio/sdk\") as typeof sdkTypes\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Definition\n\ninterface DescribeWorkspacesFlags {\n apiKey: string\n proxyUrl?: string\n}\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Configuration\n\nconst DescribeWorkspaceConfigSchema = z\n .object({\n apiKey: z.string(),\n proxyUrl: z.string().url().optional(),\n workspaceId: z.string(),\n })\n .transform(data => ({\n ...data,\n }))\n\ntype DescribeWorkspaceConfig = z.infer<typeof DescribeWorkspaceConfigSchema>\n\n// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n// MARK: - Tool implementation\n\n/** Command that describes the structure of provided design system */\nexport class DescribeWorkspaces extends SentryCommand<DescribeWorkspaceConfig> {\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command configuration\n\n // How this command can be run\n static aliases: [\"describe-workspaces\"]\n // Command help description\n static description =\n \"Describe structure of all workspaces and design systems available under those workspaces available for specified API key\"\n // Examples how to use the command\n static examples = [`$ @supernovaio/cli describe-workspaces --apiKey=\"{xxx-xxx-xxx}\"`]\n // Static flags to enable / disable features\n static flags = {\n ...commonFlags,\n apiKey: Flags.string({ description: \"API key to use for accessing Supernova instance\", required: true }),\n proxyUrl: Flags.string({\n description: \"When set, CLI will use provided proxy URL for all requests\",\n hidden: true,\n required: false,\n }),\n }\n\n // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n // MARK: - Command runtime\n\n get commandId(): string {\n return DescribeWorkspaces.id\n }\n\n get configSchema(): ZodType<DescribeWorkspaceConfig> {\n return DescribeWorkspaceConfigSchema\n }\n\n @SentryTraced()\n async getWorkspaces(flags: DescribeWorkspacesFlags): Promise<{\n instance: sdkTypes.Supernova\n workspaces: Array<sdkTypes.Workspace>\n }> {\n if (!flags.apiKey || flags.apiKey.length === 0) {\n throw new Error(`API key must not be empty`)\n }\n\n // Create instance for prod / dev\n const apiUrl = apiUrlForEnvironment(getTargetEnv())\n const sdkInstance = new sdkProvider.Supernova(flags.apiKey, {\n apiUrl,\n bypassEnvFetch: true,\n proxyUrl: flags.proxyUrl,\n })\n const user = await sdkInstance.me.me()\n const workspaces = await sdkInstance.workspaces.workspaces(user.id)\n return {\n instance: sdkInstance,\n workspaces,\n }\n }\n\n @SentryTraced()\n async run(): Promise<void> {\n const { flags } = await this.parse(DescribeWorkspaces)\n\n // Get workspaces\n const { instance, workspaces } = await this.getWorkspaces(flags)\n this.log(`\\n`)\n\n for (const workspace of workspaces) {\n // Get design systems and log\n // eslint-disable-next-line no-await-in-loop\n const designSystems = await instance.designSystems.designSystems(workspace.id)\n this.log(`↳ Workspace \"${workspace.profile.name}\", id: ${workspace.id}`.magenta)\n for (const designSystem of designSystems) {\n this.log(` ↳ Design system \"${designSystem.name}\", id: ${designSystem.id}`.cyan)\n // eslint-disable-next-line no-await-in-loop\n const version = await instance.versions.getActiveVersion(designSystem.id)\n if (!version) {\n this.log(`Design system ${designSystem.id} active version not found or not available under provided API key`)\n continue\n }\n\n const id: sdkTypes.RemoteVersionIdentifier = { designSystemId: designSystem.id, versionId: version.id }\n // eslint-disable-next-line no-await-in-loop\n const brands = await instance.brands.getBrands(id)\n // eslint-disable-next-line no-await-in-loop\n const themes = await instance.tokens.getTokenThemes(id)\n for (const brand of brands) {\n this.log(` ↳ Brand: \"${brand.name}\", id: ${brand.id}`)\n const brandThemes = themes.filter(t => t.brandId === brand.id)\n if (brandThemes.length > 0) {\n for (const theme of brandThemes) {\n this.log(` ↳ Theme: \"${theme.name}\", id: ${theme.id}`.gray)\n }\n } else {\n this.log(` ↳ No themes defined in this brand`.gray)\n }\n }\n }\n }\n\n this.log(\"\\nDone\".green)\n }\n}\n"]}
@@ -1,32 +1,27 @@
1
1
  import { z, ZodType } from "zod";
2
- import { Environment, SentryCommand } from "../types/index.js";
2
+ import { SentryCommand } from "../types/index.js";
3
3
  declare const ImportComponentsConfigSchema: z.ZodEffects<z.ZodObject<{
4
4
  designSystemId: z.ZodString;
5
- environment: z.ZodNativeEnum<typeof Environment>;
6
5
  importFrom: z.ZodString;
7
6
  rootDir: z.ZodString;
8
7
  versionId: z.ZodString;
9
8
  }, "strip", z.ZodTypeAny, {
10
9
  designSystemId: string;
11
- environment: Environment;
12
10
  importFrom: string;
13
11
  rootDir: string;
14
12
  versionId: string;
15
13
  }, {
16
14
  designSystemId: string;
17
- environment: Environment;
18
15
  importFrom: string;
19
16
  rootDir: string;
20
17
  versionId: string;
21
18
  }>, {
22
- environment: Environment;
23
19
  rootDir: string;
24
20
  designSystemId: string;
25
21
  importFrom: string;
26
22
  versionId: string;
27
23
  }, {
28
24
  designSystemId: string;
29
- environment: Environment;
30
25
  importFrom: string;
31
26
  rootDir: string;
32
27
  versionId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"import-components.d.ts","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE9D,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY7B,CAAA;AAEL,KAAK,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAE1E,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IACjF,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAA+E;IAC1G,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;MAcpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
1
+ {"version":3,"file":"import-components.d.ts","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAA;AAEL,KAAK,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAE1E,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,aAAa,CAAC,sBAAsB,CAAC;IACjF,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAA+E;IAC1G,OAAgB,QAAQ,WAGvB;IACD,OAAgB,KAAK;;;;;MAcpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAElD;IAGY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiDlC"}
@@ -12,18 +12,16 @@ import { SentryTraced } from "@sentry/nestjs";
12
12
  import { analyzeComponents } from "@supernovaio/code-analyzer";
13
13
  import * as process from "node:process";
14
14
  import { z } from "zod";
15
- import { Environment, SentryCommand } from "../types/index.js";
15
+ import { SentryCommand } from "../types/index.js";
16
16
  const ImportComponentsConfigSchema = z
17
17
  .object({
18
18
  designSystemId: z.string(),
19
- environment: z.nativeEnum(Environment),
20
19
  importFrom: z.string(),
21
20
  rootDir: z.string(),
22
21
  versionId: z.string(),
23
22
  })
24
23
  .transform(data => ({
25
24
  ...data,
26
- environment: data.environment ?? Environment.production,
27
25
  rootDir: data.rootDir ?? process.cwd(),
28
26
  }));
29
27
  export default class ImportComponents extends SentryCommand {
@@ -1 +1 @@
1
- {"version":3,"file":"import-components.js","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAE9D,MAAM,4BAA4B,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC;IACtC,UAAU,EAA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AC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;gBAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;gBACpD,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;gBACxD,MAAM,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;gBAE3F,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,QAAQ,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;YACpE,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;QAUvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AAhDY;IADZ,YAAY,EAAE;;;;2CAiDd","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\n// eslint-disable-next-line n/no-extraneous-import\nimport { analyzeComponents } from \"@supernovaio/code-analyzer\"\nimport * as process from \"node:process\"\nimport { z, ZodType } from \"zod\"\n\nimport { Environment, SentryCommand } from \"../types/index.js\"\n\nconst ImportComponentsConfigSchema = z\n .object({\n designSystemId: z.string(),\n environment: z.nativeEnum(Environment),\n importFrom: z.string(),\n rootDir: z.string(),\n versionId: z.string(),\n })\n .transform(data => ({\n ...data,\n environment: data.environment ?? Environment.production,\n rootDir: data.rootDir ?? process.cwd(),\n }))\n\ntype ImportComponentsConfig = z.infer<typeof ImportComponentsConfigSchema>\n\nexport default class ImportComponents extends SentryCommand<ImportComponentsConfig> {\n static override args = {}\n static override description = \"Analyze react components from given package and import them into Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --importFrom components-package --rootDir ./src\",\n \"<%= config.bin %> <%= command.id %> --importFrom @mui/material\",\n ]\n static override flags = {\n designSystemId: Flags.string({ description: \"Import code components to design system of\", required: true }),\n importFrom: Flags.string({\n char: \"i\",\n description: \"Package or directory path to import components from\",\n required: true,\n }),\n rootDir: Flags.string({\n char: \"r\",\n default: process.cwd(), // Defaults to the current directory\n description:\n \"Root directory of the package where the import should resolve from. Defaults to the current directory\",\n }),\n versionId: Flags.string({ description: \"Import code components to version of\", required: true }),\n }\n\n get commandId(): string {\n return ImportComponents.id\n }\n\n get configSchema(): ZodType<ImportComponentsConfig> {\n return ImportComponentsConfigSchema\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(ImportComponents)\n\n const { importFrom, rootDir } = flags\n\n // const client = await getClient(environment as TargetEnv)\n\n this.log(\"šŸ“¦ Component Import Summary\".green)\n this.log(\"========================\")\n this.log(`Source: ${importFrom}`)\n this.log(`Root Directory: ${rootDir}`)\n\n const components = await analyzeComponents({ importFrom, rootDir })\n\n if (components.length > 0) {\n this.log(\"\\nComponent Summary Table:\")\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Component Name Props.Num Required Props Names \")\n this.log(\"──────────────────────────────────────────────────────────\")\n\n for (const component of components) {\n const propsCount = Object.keys(component.properties).length\n const requiredCount = Object.values(component.properties).filter(prop => prop.required).length\n const propsNames = new Set(Object.values(component.properties).map(prop => prop.name))\n\n // Format each row with fixed width columns\n const name = component.exportName.padEnd(16, \" \").slice(0, 16)\n const propsNum = String(propsCount).padStart(5, \" \")\n const required = String(requiredCount).padStart(10, \" \")\n const props = [...propsNames].slice(0, 2).join(\", \") + (propsNames.size > 2 ? \", ...\" : \"\")\n\n this.log(`${name} ${propsNum} ${required} ${props}`)\n }\n\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Importing to Supernova...\")\n /*\n const result = await client.designSystems.versions.codeComponents.import(designSystemId, versionId, {\n codeComponents: components.map(c => ({\n ...c,\n persistentId: `${designSystemId}-${versionId}${c.exportName}}`,\n })),\n })\n this.log(`Total: ${result.created} components imported`.green)\n */\n } else {\n this.log(\"\\nāš ļø No components were imported\".green)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"import-components.js","sourceRoot":"","sources":["../../src/commands/import-components.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,CAAC,EAAW,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,4BAA4B,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC;KACD,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClB,GAAG,IAAI;IACP,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,EAAE;CACvC,CAAC,CAAC,CAAA;AAIL,MAAM,CAAC,OAAO,OAA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AC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;gBAE3F,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,IAAI,QAAQ,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAA;YACvD,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAA;YACpE,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;QAUvC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;;AAhDY;IADZ,YAAY,EAAE;;;;2CAiDd","sourcesContent":["import { Flags } from \"@oclif/core\"\nimport { SentryTraced } from \"@sentry/nestjs\"\n// eslint-disable-next-line n/no-extraneous-import\nimport { analyzeComponents } from \"@supernovaio/code-analyzer\"\nimport * as process from \"node:process\"\nimport { z, ZodType } from \"zod\"\n\nimport { SentryCommand } from \"../types/index.js\"\n\nconst ImportComponentsConfigSchema = z\n .object({\n designSystemId: z.string(),\n importFrom: z.string(),\n rootDir: z.string(),\n versionId: z.string(),\n })\n .transform(data => ({\n ...data,\n rootDir: data.rootDir ?? process.cwd(),\n }))\n\ntype ImportComponentsConfig = z.infer<typeof ImportComponentsConfigSchema>\n\nexport default class ImportComponents extends SentryCommand<ImportComponentsConfig> {\n static override args = {}\n static override description = \"Analyze react components from given package and import them into Supernova\"\n static override examples = [\n \"<%= config.bin %> <%= command.id %> --importFrom components-package --rootDir ./src\",\n \"<%= config.bin %> <%= command.id %> --importFrom @mui/material\",\n ]\n static override flags = {\n designSystemId: Flags.string({ description: \"Import code components to design system of\", required: true }),\n importFrom: Flags.string({\n char: \"i\",\n description: \"Package or directory path to import components from\",\n required: true,\n }),\n rootDir: Flags.string({\n char: \"r\",\n default: process.cwd(), // Defaults to the current directory\n description:\n \"Root directory of the package where the import should resolve from. Defaults to the current directory\",\n }),\n versionId: Flags.string({ description: \"Import code components to version of\", required: true }),\n }\n\n get commandId(): string {\n return ImportComponents.id\n }\n\n get configSchema(): ZodType<ImportComponentsConfig> {\n return ImportComponentsConfigSchema\n }\n\n @SentryTraced()\n public async run(): Promise<void> {\n const { flags } = await this.parse(ImportComponents)\n\n const { importFrom, rootDir } = flags\n\n // const client = await getClient(environment as TargetEnv)\n\n this.log(\"šŸ“¦ Component Import Summary\".green)\n this.log(\"========================\")\n this.log(`Source: ${importFrom}`)\n this.log(`Root Directory: ${rootDir}`)\n\n const components = await analyzeComponents({ importFrom, rootDir })\n\n if (components.length > 0) {\n this.log(\"\\nComponent Summary Table:\")\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Component Name Props.Num Required Props Names \")\n this.log(\"──────────────────────────────────────────────────────────\")\n\n for (const component of components) {\n const propsCount = Object.keys(component.properties).length\n const requiredCount = Object.values(component.properties).filter(prop => prop.required).length\n const propsNames = new Set(Object.values(component.properties).map(prop => prop.name))\n\n // Format each row with fixed width columns\n const name = component.exportName.padEnd(16, \" \").slice(0, 16)\n const propsNum = String(propsCount).padStart(5, \" \")\n const required = String(requiredCount).padStart(10, \" \")\n const props = [...propsNames].slice(0, 2).join(\", \") + (propsNames.size > 2 ? \", ...\" : \"\")\n\n this.log(`${name} ${propsNum} ${required} ${props}`)\n }\n\n this.log(\"━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\")\n this.log(\"Importing to Supernova...\")\n /*\n const result = await client.designSystems.versions.codeComponents.import(designSystemId, versionId, {\n codeComponents: components.map(c => ({\n ...c,\n persistentId: `${designSystemId}-${versionId}${c.exportName}}`,\n })),\n })\n this.log(`Total: ${result.created} components imported`.green)\n */\n } else {\n this.log(\"\\nāš ļø No components were imported\".green)\n }\n }\n}\n"]}
@@ -1,15 +1,13 @@
1
1
  import { z, ZodType } from "zod";
2
- import { Environment, SentryCommand } from "../types/index.js";
2
+ import { SentryCommand } from "../types/index.js";
3
3
  declare const ImportStorybookConfigSchema: z.ZodEffects<z.ZodObject<{
4
4
  brandId: z.ZodOptional<z.ZodString>;
5
5
  designSystemId: z.ZodOptional<z.ZodString>;
6
6
  dir: z.ZodOptional<z.ZodString>;
7
- environment: z.ZodNativeEnum<typeof Environment>;
8
7
  name: z.ZodOptional<z.ZodString>;
9
8
  sourceId: z.ZodOptional<z.ZodString>;
10
9
  versionId: z.ZodOptional<z.ZodString>;
11
10
  }, "strip", z.ZodTypeAny, {
12
- environment: Environment;
13
11
  name?: string | undefined;
14
12
  designSystemId?: string | undefined;
15
13
  versionId?: string | undefined;
@@ -17,7 +15,6 @@ declare const ImportStorybookConfigSchema: z.ZodEffects<z.ZodObject<{
17
15
  dir?: string | undefined;
18
16
  sourceId?: string | undefined;
19
17
  }, {
20
- environment: Environment;
21
18
  name?: string | undefined;
22
19
  designSystemId?: string | undefined;
23
20
  versionId?: string | undefined;
@@ -25,7 +22,6 @@ declare const ImportStorybookConfigSchema: z.ZodEffects<z.ZodObject<{
25
22
  dir?: string | undefined;
26
23
  sourceId?: string | undefined;
27
24
  }>, {
28
- environment: Environment;
29
25
  name?: string | undefined;
30
26
  designSystemId?: string | undefined;
31
27
  versionId?: string | undefined;
@@ -33,7 +29,6 @@ declare const ImportStorybookConfigSchema: z.ZodEffects<z.ZodObject<{
33
29
  dir?: string | undefined;
34
30
  sourceId?: string | undefined;
35
31
  }, {
36
- environment: Environment;
37
32
  name?: string | undefined;
38
33
  designSystemId?: string | undefined;
39
34
  versionId?: string | undefined;
@@ -52,7 +47,6 @@ export default class ImportStorybook extends SentryCommand<ImportStorybookConfig
52
47
  dir: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
53
48
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
54
49
  sourceId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
55
- environment: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
56
50
  };
57
51
  get commandId(): string;
58
52
  get configSchema(): ZodType<ImportStorybookConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"import-storybook.d.ts","sourceRoot":"","sources":["../../src/commands/import-storybook.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAS,aAAa,EAAa,MAAM,mBAAmB,CAAA;AAUhF,QAAA,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa5B,CAAA;AAEL,KAAK,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAA;AAmBxE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,qBAAqB,CAAC;IAC/E,OAAgB,IAAI,KAAK;IACzB,OAAgB,WAAW,SAAgD;IAC3E,OAAgB,QAAQ,WAEvB;IACD,OAAgB,KAAK;;;;;;;MAWpB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAEjD;IAIY,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;YAqInB,OAAO;IAwBrB,OAAO,CAAC,sBAAsB;IA0E9B,OAAO,CAAC,YAAY;YAYN,wBAAwB;IA4DtC,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,eAAe;CAiBxB"}
1
+ {"version":3,"file":"import-storybook.d.ts","sourceRoot":"","sources":["../../src/commands/import-storybook.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,KAAK,CAAA;AAEhC,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