@kittl/cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,129 +1,39 @@
1
1
  # Kittl CLI
2
2
 
3
- Official command-line interface for Kittl.
3
+ Official command-line interface for [Kittl](https://www.kittl.com).
4
4
 
5
- ## Install
6
-
7
- From repo root:
8
-
9
- ```bash
10
- pnpm install
11
- ```
12
-
13
- ## Build
14
-
15
- From repo root:
16
-
17
- ```bash
18
- pnpm --filter ./packages/cli build
19
- ```
20
-
21
- Or from `packages/cli`:
22
-
23
- ```bash
24
- pnpm build
25
- ```
26
-
27
- ## Use locally
28
-
29
- From `packages/cli` after build:
30
-
31
- ```bash
32
- node bin/run.js --help
33
- node bin/run.js app --help
34
- node bin/run.js auth login
35
- ```
36
-
37
- Subcommands are space-separated (for example `app init`, `app upload`, `auth login`). `whoami` is available as `auth whoami` or as a top-level shortcut. Command names, flags, and descriptions live in the tool: run `kittl --help`, then `kittl <topic> --help`. This README only covers install, build, and dev workflow, not a duplicate of the help text.
38
-
39
- Note: run **`pnpm build`** before using `bin/run.js`.
40
-
41
- Using pnpm exec from repo root:
42
-
43
- ```bash
44
- pnpm --filter ./packages/cli exec kittl --help
45
- ```
46
-
47
- ## Published usage
5
+ ## Requirements
48
6
 
49
- After publishing:
7
+ - [Node.js](https://nodejs.org/) 18 or newer
50
8
 
51
- - package name is `@kittl/cli`
52
- - executable command is `kittl`
9
+ ## Install
53
10
 
54
- Examples:
11
+ The package is published as **`@kittl/cli`**. The executable is **`kittl`**.
55
12
 
56
13
  ```bash
57
14
  # Global install
58
- npm i -g @kittl/cli
59
- kittl --help
60
- kittl app --help
61
-
62
- # Without global install
63
- npx @kittl/cli --help
15
+ npm install -g @kittl/cli
64
16
  ```
65
17
 
66
- Most commands that call the API expect you to be signed in (`kittl auth login`).
67
-
68
- ## Environment
69
-
70
- Copy and edit:
71
-
72
- ```bash
73
- cp .env.example .env
74
- ```
75
-
76
- Supported vars are documented in `.env.example`.
77
- They are optional overrides for local development and testing.
78
-
79
-
80
- ## Developer docs
81
-
82
- Internal architecture and implementation notes live in `docs/internals.md`.
83
-
84
- ## Local development scripts
85
-
86
- Run from `packages/cli`:
87
-
88
18
  ```bash
89
- # Run CLI once in development mode (no build required)
90
- pnpm dev app --help
91
-
92
- # Re-run the CLI when source changes
93
- pnpm dev:watch app --help
94
-
95
- # Watch + rebuild dist and regenerate oclif manifest
96
- pnpm build:watch
19
+ # Run without installing globally
20
+ npx @kittl/cli --help
97
21
  ```
98
22
 
99
- ## Global CLI on your PATH (linked)
23
+ ## Usage
100
24
 
101
- From `packages/cli` (after `pnpm install` at the repo root):
25
+ Discover commands and flags via `--help`:
102
26
 
103
27
  ```bash
104
- cd packages/cli
105
- pnpm link --global
28
+ kittl --help
106
29
  ```
107
30
 
108
- This puts **`kittl`** and **`kittl-dev`** on your global `PATH`, pointing at your local clone:
109
-
110
- | Command | When to use it |
111
- | ------------- | -------------- |
112
- | `kittl` | Production entry. Run **`pnpm build`** first so `dist/` is up to date. |
113
- | `kittl-dev` | Dev entry (`bin/dev.js` + `tsx`), same as **`pnpm dev`**, no build required. |
114
-
115
- To remove the global install later:
31
+ Most commands that call the Kittl API expect you to be signed in:
116
32
 
117
33
  ```bash
118
- pnpm uninstall --global @kittl/cli
34
+ kittl auth login
119
35
  ```
120
36
 
121
- The npm package only ships the **`kittl`** binary; **`kittl-dev`** exists in this repo for contributors (`publishConfig` strips it from the published manifest).
122
-
123
- ## Debug logging
37
+ ## Documentation
124
38
 
125
- Enable debug output with `DEBUG`:
126
-
127
- ```bash
128
- DEBUG=oclif:kittl:* kittl app --help #TODO: need to get rid of oclif prefix here
129
- ```
39
+ Guides and deeper context for the CLI are in the [Kittl CLI documentation](https://sdk-docs.kittl.dev/getting-started/kittl-cli).
@@ -0,0 +1,51 @@
1
+ // src/ui/theme/tokens.ts
2
+ var colors = {
3
+ textPrimary: "white",
4
+ textMuted: "gray",
5
+ success: "green",
6
+ warning: "yellow",
7
+ danger: "red",
8
+ accent: "cyan"
9
+ };
10
+ var spacing = {
11
+ xs: 0,
12
+ sm: 1,
13
+ md: 2
14
+ };
15
+
16
+ // src/ui/theme/styles.ts
17
+ var layoutStyles = {
18
+ viewColumn: {
19
+ flexDirection: "column",
20
+ padding: spacing.sm
21
+ },
22
+ section: {
23
+ marginTop: spacing.sm
24
+ }
25
+ };
26
+ var textStyles = {
27
+ title: {
28
+ bold: true,
29
+ color: colors.accent
30
+ },
31
+ muted: {
32
+ color: colors.textMuted
33
+ },
34
+ success: {
35
+ color: colors.success
36
+ },
37
+ warning: {
38
+ color: colors.warning
39
+ },
40
+ error: {
41
+ color: colors.danger
42
+ }
43
+ };
44
+
45
+ export {
46
+ colors,
47
+ spacing,
48
+ layoutStyles,
49
+ textStyles
50
+ };
51
+ //# sourceMappingURL=chunk-3BPIJLS7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/theme/tokens.ts","../src/ui/theme/styles.ts"],"sourcesContent":["export const colors = {\n textPrimary: 'white',\n textMuted: 'gray',\n success: 'green',\n warning: 'yellow',\n danger: 'red',\n accent: 'cyan',\n} as const;\n\nexport const spacing = {\n xs: 0,\n sm: 1,\n md: 2,\n} as const;\n","import { colors, spacing } from './tokens';\n\nexport const layoutStyles = {\n viewColumn: {\n flexDirection: 'column' as const,\n padding: spacing.sm,\n },\n section: {\n marginTop: spacing.sm,\n },\n};\n\nexport const textStyles = {\n title: {\n bold: true,\n color: colors.accent,\n },\n muted: {\n color: colors.textMuted,\n },\n success: {\n color: colors.success,\n },\n warning: {\n color: colors.warning,\n },\n error: {\n color: colors.danger,\n },\n};\n"],"mappings":";AAAO,IAAM,SAAS;AAAA,EACpB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,QAAQ;AACV;AAEO,IAAM,UAAU;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN;;;ACXO,IAAM,eAAe;AAAA,EAC1B,YAAY;AAAA,IACV,eAAe;AAAA,IACf,SAAS,QAAQ;AAAA,EACnB;AAAA,EACA,SAAS;AAAA,IACP,WAAW,QAAQ;AAAA,EACrB;AACF;AAEO,IAAM,aAAa;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO,OAAO;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,OAAO,OAAO;AAAA,EAChB;AAAA,EACA,SAAS;AAAA,IACP,OAAO,OAAO;AAAA,EAChB;AAAA,EACA,SAAS;AAAA,IACP,OAAO,OAAO;AAAA,EAChB;AAAA,EACA,OAAO;AAAA,IACL,OAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BaseCommand
3
- } from "./chunk-JGD3QFQS.js";
3
+ } from "./chunk-TK44DTSK.js";
4
4
 
5
5
  // src/commands/auth/whoami.ts
6
6
  import { jwtDecode } from "jwt-decode";
@@ -11,7 +11,7 @@ var AuthWhoAmI = class _AuthWhoAmI extends BaseCommand {
11
11
  const session = await this.ensureAuthenticated();
12
12
  if (!session.idToken) {
13
13
  this.error(
14
- `No ID token found in session. Run \`${this.config.bin} auth:login\` again.`,
14
+ `No ID token found in session. Run \`${this.config.bin} auth login\` again.`,
15
15
  { exit: 2 }
16
16
  );
17
17
  }
@@ -26,4 +26,4 @@ var AuthWhoAmI = class _AuthWhoAmI extends BaseCommand {
26
26
  export {
27
27
  AuthWhoAmI
28
28
  };
29
- //# sourceMappingURL=chunk-4ISWSLZ5.js.map
29
+ //# sourceMappingURL=chunk-637YZAKM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/auth/whoami.ts"],"sourcesContent":["import { jwtDecode } from 'jwt-decode';\nimport type { IDToken } from 'openid-client';\nimport { BaseCommand } from '../../core/core.command';\n\nexport default class AuthWhoAmI extends BaseCommand {\n public static override description =\n 'Show authenticated Kittl account details';\n\n public async run(): Promise<void> {\n await this.parse(AuthWhoAmI);\n\n const session = await this.ensureAuthenticated();\n\n if (!session.idToken) {\n this.error(\n `No ID token found in session. Run \\`${this.config.bin} auth login\\` again.`,\n { exit: 2 },\n );\n }\n\n const claims = jwtDecode<IDToken>(session.idToken);\n const email = claims.email ?? 'unknown';\n const name =\n claims.name ?? claims.preferred_username ?? claims.sub ?? 'unknown';\n\n this.log(`Name: ${name}`);\n this.log(`Email: ${email}`);\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAI1B,IAAqB,aAArB,MAAqB,oBAAmB,YAAY;AAAA,EAClD,OAAuB,cACrB;AAAA,EAEF,MAAa,MAAqB;AAChC,UAAM,KAAK,MAAM,WAAU;AAE3B,UAAM,UAAU,MAAM,KAAK,oBAAoB;AAE/C,QAAI,CAAC,QAAQ,SAAS;AACpB,WAAK;AAAA,QACH,uCAAuC,KAAK,OAAO,GAAG;AAAA,QACtD,EAAE,MAAM,EAAE;AAAA,MACZ;AAAA,IACF;AAEA,UAAM,SAAS,UAAmB,QAAQ,OAAO;AACjD,UAAM,QAAQ,OAAO,SAAS;AAC9B,UAAM,OACJ,OAAO,QAAQ,OAAO,sBAAsB,OAAO,OAAO;AAE5D,SAAK,IAAI,SAAS,IAAI,EAAE;AACxB,SAAK,IAAI,UAAU,KAAK,EAAE;AAAA,EAC5B;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ // src/ui/hooks/useTerminalWidth.ts
2
+ import { useStdout } from "ink";
3
+ import { useEffect, useState } from "react";
4
+ function useTerminalWidth() {
5
+ const { stdout } = useStdout();
6
+ const [width, setWidth] = useState(() => stdout.columns ?? 80);
7
+ useEffect(() => {
8
+ const onResize = () => setWidth(stdout.columns ?? 80);
9
+ stdout.on("resize", onResize);
10
+ return () => {
11
+ stdout.off("resize", onResize);
12
+ };
13
+ }, [stdout]);
14
+ return width;
15
+ }
16
+
17
+ export {
18
+ useTerminalWidth
19
+ };
20
+ //# sourceMappingURL=chunk-EKU4DKQK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/hooks/useTerminalWidth.ts"],"sourcesContent":["import { useStdout } from 'ink';\nimport { useEffect, useState } from 'react';\n\nexport function useTerminalWidth(): number {\n const { stdout } = useStdout();\n const [width, setWidth] = useState(() => stdout.columns ?? 80);\n\n useEffect(() => {\n const onResize = () => setWidth(stdout.columns ?? 80);\n stdout.on('resize', onResize);\n return () => {\n stdout.off('resize', onResize);\n };\n }, [stdout]);\n\n return width;\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,WAAW,gBAAgB;AAE7B,SAAS,mBAA2B;AACzC,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,MAAM,OAAO,WAAW,EAAE;AAE7D,YAAU,MAAM;AACd,UAAM,WAAW,MAAM,SAAS,OAAO,WAAW,EAAE;AACpD,WAAO,GAAG,UAAU,QAAQ;AAC5B,WAAO,MAAM;AACX,aAAO,IAAI,UAAU,QAAQ;AAAA,IAC/B;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT;","names":[]}
@@ -0,0 +1,98 @@
1
+ import {
2
+ formatZodErrorSummary
3
+ } from "./chunk-XU2ZHSRY.js";
4
+ import {
5
+ parseJsonObjectFromFile
6
+ } from "./chunk-TK44DTSK.js";
7
+
8
+ // src/services/extensions.service.ts
9
+ import { z as z2 } from "zod";
10
+
11
+ // src/core/schemas/extension-manifest.ts
12
+ import { z } from "zod";
13
+ var extensionScopeSchema = z.enum([
14
+ "design:state:read",
15
+ "design:state:write",
16
+ "uploads:create",
17
+ "fonts:create",
18
+ "uploads:global:read",
19
+ "ai:credit:spend",
20
+ "workspace:state:read",
21
+ "workspace:state:write"
22
+ ]);
23
+ var oauthProviderSchema = z.object({
24
+ authorizationUrl: z.string().min(1),
25
+ clientId: z.string().min(1),
26
+ scope: z.string().min(1).optional(),
27
+ accessType: z.string().min(1).optional(),
28
+ tokenUrl: z.string().min(1),
29
+ customFieldMappings: z.record(z.string(), z.unknown()).optional()
30
+ }).strict();
31
+ var extensionManifestSchema = z.object({
32
+ //needs sign-off on each release.
33
+ displayName: z.string().min(1),
34
+ icon: z.string().min(1),
35
+ tagline: z.string().min(1),
36
+ installPage: z.object({
37
+ description: z.string().min(1),
38
+ coverImage: z.string().min(1),
39
+ termsAndConditionsLink: z.string().min(1),
40
+ privacyPolicyLink: z.string().min(1)
41
+ }).strict(),
42
+ config: z.object({
43
+ scopes: z.array(extensionScopeSchema),
44
+ embed: z.object({
45
+ mainAppPanel: z.object({
46
+ path: z.string().min(1)
47
+ }).strict()
48
+ }).strict(),
49
+ appDevelopment: z.object({
50
+ local: z.object({
51
+ requireHTTPS: z.boolean().optional(),
52
+ port: z.number().int().min(1).max(65535).optional()
53
+ }).strict()
54
+ }).strict().optional(),
55
+ oauthProviders: z.record(z.string(), oauthProviderSchema).optional()
56
+ }).strict()
57
+ }).strict();
58
+
59
+ // src/services/extensions.service.ts
60
+ var createExtensionVersionResponseSchema = z2.object({
61
+ success: z2.literal(true),
62
+ result: z2.object({
63
+ extensionVersionId: z2.string()
64
+ })
65
+ });
66
+ async function createExtensionDraftVersion(client, extensionId, manifestFilePath) {
67
+ const rawObject = await parseJsonObjectFromFile(manifestFilePath);
68
+ const manifestParsed = extensionManifestSchema.safeParse(rawObject);
69
+ if (!manifestParsed.success) {
70
+ throw new Error(
71
+ `Invalid manifest.json (${manifestFilePath}): ${formatZodErrorSummary(manifestParsed.error)}`
72
+ );
73
+ }
74
+ const manifest = manifestParsed.data;
75
+ const path = `/extensions/${extensionId}/versions`;
76
+ const { data } = await client.post(path, { manifest });
77
+ const parsed = createExtensionVersionResponseSchema.parse(data);
78
+ return parsed.result.extensionVersionId;
79
+ }
80
+ var readyForReviewResponseSchema = z2.object({
81
+ success: z2.literal(true),
82
+ result: z2.object({
83
+ extensionVersionId: z2.string(),
84
+ status: z2.literal("READY_FOR_REVIEW")
85
+ })
86
+ });
87
+ async function markExtensionDraftReadyForReview(client, extensionId) {
88
+ const path = `/extensions/${extensionId}/versions/review/ready`;
89
+ const { data } = await client.post(path, {});
90
+ const parsed = readyForReviewResponseSchema.parse(data);
91
+ return parsed.result;
92
+ }
93
+
94
+ export {
95
+ createExtensionDraftVersion,
96
+ markExtensionDraftReadyForReview
97
+ };
98
+ //# sourceMappingURL=chunk-GJPVFQRF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/extensions.service.ts","../src/core/schemas/extension-manifest.ts"],"sourcesContent":["import type { AxiosInstance } from 'axios';\nimport { z } from 'zod';\nimport { formatZodErrorSummary } from '../core/error';\nimport { extensionManifestSchema } from '../core/schemas/extension-manifest';\nimport { parseJsonObjectFromFile } from '../core/utils';\n\nconst createExtensionVersionResponseSchema = z.object({\n success: z.literal(true),\n result: z.object({\n extensionVersionId: z.string(),\n }),\n});\n\n/**\n * POST /extensions/{extensionId}/versions : reads `manifestFilePath`, validates\n * manifest JSON, then POSTs `{ manifest }` to create or update the draft version.\n */\nexport async function createExtensionDraftVersion(\n client: AxiosInstance,\n extensionId: string,\n manifestFilePath: string,\n): Promise<string> {\n const rawObject = await parseJsonObjectFromFile(manifestFilePath);\n const manifestParsed = extensionManifestSchema.safeParse(rawObject);\n if (!manifestParsed.success) {\n throw new Error(\n `Invalid manifest.json (${manifestFilePath}): ${formatZodErrorSummary(manifestParsed.error)}`,\n );\n }\n const manifest = manifestParsed.data;\n const path = `/extensions/${extensionId}/versions`;\n const { data } = await client.post(path, { manifest });\n const parsed = createExtensionVersionResponseSchema.parse(data);\n return parsed.result.extensionVersionId;\n}\n\nconst readyForReviewResponseSchema = z.object({\n success: z.literal(true),\n result: z.object({\n extensionVersionId: z.string(),\n status: z.literal('READY_FOR_REVIEW'),\n }),\n});\n\nexport type ExtensionReadyForReviewResult = z.infer<\n typeof readyForReviewResponseSchema\n>['result'];\n\n/**\n * POST /extensions/{extensionId}/versions/review/ready : moves the current draft\n * version to READY_FOR_REVIEW.\n */\nexport async function markExtensionDraftReadyForReview(\n client: AxiosInstance,\n extensionId: string,\n): Promise<ExtensionReadyForReviewResult> {\n const path = `/extensions/${extensionId}/versions/review/ready`;\n const { data } = await client.post(path, {});\n const parsed = readyForReviewResponseSchema.parse(data);\n return parsed.result;\n}\n","import { z } from 'zod';\n\n/**\n * Shape of `manifest.json`.\n * Keep in sync with def in @kittl/mono://src/controllers/extensions.controller/schemas.ts.\n */\nconst extensionScopeSchema = z.enum([\n 'design:state:read',\n 'design:state:write',\n 'uploads:create',\n 'fonts:create',\n 'uploads:global:read',\n 'ai:credit:spend',\n 'workspace:state:read',\n 'workspace:state:write',\n]);\n\n/**\n * Provider-specific OAuth configuration.\n */\nconst oauthProviderSchema = z\n .object({\n authorizationUrl: z.string().min(1),\n clientId: z.string().min(1),\n scope: z.string().min(1).optional(),\n accessType: z.string().min(1).optional(),\n tokenUrl: z.string().min(1),\n customFieldMappings: z.record(z.string(), z.unknown()).optional(),\n })\n .strict();\n\n/**\n * Full extension manifest schema used by the CLI when validating draft uploads.\n */\nexport const extensionManifestSchema = z\n .object({\n //needs sign-off on each release.\n displayName: z.string().min(1),\n icon: z.string().min(1),\n tagline: z.string().min(1),\n installPage: z\n .object({\n description: z.string().min(1),\n coverImage: z.string().min(1),\n termsAndConditionsLink: z.string().min(1),\n privacyPolicyLink: z.string().min(1),\n })\n .strict(),\n config: z\n .object({\n scopes: z.array(extensionScopeSchema),\n embed: z\n .object({\n mainAppPanel: z\n .object({\n path: z.string().min(1),\n })\n .strict(),\n })\n .strict(),\n appDevelopment: z\n .object({\n local: z\n .object({\n requireHTTPS: z.boolean().optional(),\n port: z.number().int().min(1).max(65535).optional(),\n })\n .strict(),\n })\n .strict()\n .optional(),\n oauthProviders: z.record(z.string(), oauthProviderSchema).optional(),\n })\n .strict(),\n })\n .strict();\n\nexport type ExtensionManifest = z.infer<typeof extensionManifestSchema>;\n"],"mappings":"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","names":["z","z"]}