@kubb/cli 5.9.3 → 5.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Telemetry-BFKg5ZFx.js +259 -0
- package/dist/Telemetry-BFKg5ZFx.js.map +1 -0
- package/dist/Telemetry-iUSXePwR.cjs +314 -0
- package/dist/Telemetry-iUSXePwR.cjs.map +1 -0
- package/dist/{background-BcRoKru0.cjs → background-BA5mxYa1.cjs} +7 -6
- package/dist/{background-BcRoKru0.cjs.map → background-BA5mxYa1.cjs.map} +1 -1
- package/dist/{background-CCex47-d.js → background-Dtk2M5B8.js} +3 -2
- package/dist/{background-CCex47-d.js.map → background-Dtk2M5B8.js.map} +1 -1
- package/dist/background-uX93zloA.js +1 -0
- package/dist/{reporters-H21Jvrff.js → config-66zh0aCP.js} +29 -3
- package/dist/config-66zh0aCP.js.map +1 -0
- package/dist/{reporters-B4rZOlo8.cjs → config-cb2nhvBt.cjs} +36 -4
- package/dist/config-cb2nhvBt.cjs.map +1 -0
- package/dist/credentials-C8tjAhTo.js +1 -0
- package/dist/credentials-CZK6zPLv.js +62 -0
- package/dist/credentials-CZK6zPLv.js.map +1 -0
- package/dist/credentials-DDaKqtJn.cjs +113 -0
- package/dist/credentials-DDaKqtJn.cjs.map +1 -0
- package/dist/index.cjs +702 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +697 -207
- package/dist/index.js.map +1 -1
- package/dist/{output-qFt4vV7K.js → output-CCiHzIPS.js} +173 -129
- package/dist/output-CCiHzIPS.js.map +1 -0
- package/dist/{output-BnK0scpX.cjs → output-DOC3zu6i.cjs} +141 -66
- package/dist/output-DOC3zu6i.cjs.map +1 -0
- package/dist/{registry-DER9aRyg.cjs → registry-DTPOQwZN.cjs} +6 -6
- package/dist/{registry-DER9aRyg.cjs.map → registry-DTPOQwZN.cjs.map} +1 -1
- package/dist/{registry-B7BvdrGE.js → registry-O3AelRfj.js} +2 -2
- package/dist/{registry-B7BvdrGE.js.map → registry-O3AelRfj.js.map} +1 -1
- package/dist/rolldown-runtime-CPE0t6oh.cjs +53 -0
- package/dist/{run-CIvFRMLt.cjs → run--pbGQ3Rm.cjs} +5 -6
- package/dist/{run-CIvFRMLt.cjs.map → run--pbGQ3Rm.cjs.map} +1 -1
- package/dist/{run-Co732JNO.cjs → run-BehbQsS7.cjs} +5 -6
- package/dist/{run-Co732JNO.cjs.map → run-BehbQsS7.cjs.map} +1 -1
- package/dist/{run-B1jaQu6Q.js → run-BzoydGZo.js} +2 -3
- package/dist/{run-B1jaQu6Q.js.map → run-BzoydGZo.js.map} +1 -1
- package/dist/{run-DunTcXOS.js → run-CB3YAq5e.js} +2 -3
- package/dist/{run-DunTcXOS.js.map → run-CB3YAq5e.js.map} +1 -1
- package/dist/run-CWWSCB8I.js +1 -0
- package/dist/{run-DxGkjzRm.cjs → run-CfBk4wgw.cjs} +47 -159
- package/dist/run-CfBk4wgw.cjs.map +1 -0
- package/dist/{run-DFos0eOY.cjs → run-DIeXldF6.cjs} +16 -18
- package/dist/{run-DFos0eOY.cjs.map → run-DIeXldF6.cjs.map} +1 -1
- package/dist/{run-QPsBYkq_.js → run-Dut1ksMl.js} +5 -7
- package/dist/{run-QPsBYkq_.js.map → run-Dut1ksMl.js.map} +1 -1
- package/dist/{run-BRUwQ5Y7.js → run-S-4lnViv.js} +26 -85
- package/dist/run-S-4lnViv.js.map +1 -0
- package/dist/{snapshot-DUJU70H_.cjs → snapshot-CFyEQsu-.cjs} +17 -26
- package/dist/snapshot-CFyEQsu-.cjs.map +1 -0
- package/dist/{snapshot-CkpJr-gr.js → snapshot-Cv_SImjr.js} +15 -24
- package/dist/snapshot-Cv_SImjr.js.map +1 -0
- package/dist/studioWorker.js +2 -2
- package/package.json +7 -8
- package/dist/Telemetry-C9gmBTr0.cjs +0 -231
- package/dist/Telemetry-C9gmBTr0.cjs.map +0 -1
- package/dist/Telemetry-CSc7OVsv.js +0 -207
- package/dist/Telemetry-CSc7OVsv.js.map +0 -1
- package/dist/agent-BPIqnEl2.js +0 -59
- package/dist/agent-BPIqnEl2.js.map +0 -1
- package/dist/agent-DElUuYuy.cjs +0 -120
- package/dist/agent-DElUuYuy.cjs.map +0 -1
- package/dist/background-1AFVK_yN.js +0 -1
- package/dist/commands-BuY0nrlU.cjs +0 -87
- package/dist/commands-BuY0nrlU.cjs.map +0 -1
- package/dist/commands-atq2z0Bo.js +0 -81
- package/dist/commands-atq2z0Bo.js.map +0 -1
- package/dist/config-B6UIKcl1.js +0 -117
- package/dist/config-B6UIKcl1.js.map +0 -1
- package/dist/config-Bo9ro7vg.cjs +0 -129
- package/dist/config-Bo9ro7vg.cjs.map +0 -1
- package/dist/constants-Cii4HX64.js +0 -12
- package/dist/constants-Cii4HX64.js.map +0 -1
- package/dist/constants-Df449N47.cjs +0 -29
- package/dist/constants-Df449N47.cjs.map +0 -1
- package/dist/errors-BdA8M78q.cjs +0 -43
- package/dist/errors-BdA8M78q.cjs.map +0 -1
- package/dist/errors-DmC83ALX.js +0 -32
- package/dist/errors-DmC83ALX.js.map +0 -1
- package/dist/output-BnK0scpX.cjs.map +0 -1
- package/dist/output-qFt4vV7K.js.map +0 -1
- package/dist/reporters-B4rZOlo8.cjs.map +0 -1
- package/dist/reporters-H21Jvrff.js.map +0 -1
- package/dist/run-BGTUbY2h.cjs +0 -130
- package/dist/run-BGTUbY2h.cjs.map +0 -1
- package/dist/run-BPQzGEIs.js +0 -178
- package/dist/run-BPQzGEIs.js.map +0 -1
- package/dist/run-BRUwQ5Y7.js.map +0 -1
- package/dist/run-BYff_byB.js +0 -71
- package/dist/run-BYff_byB.js.map +0 -1
- package/dist/run-Bhs7mJ1f.cjs +0 -79
- package/dist/run-Bhs7mJ1f.cjs.map +0 -1
- package/dist/run-CH48n-MJ.js +0 -1
- package/dist/run-DfEoWJuy.js +0 -126
- package/dist/run-DfEoWJuy.js.map +0 -1
- package/dist/run-Dm9OZUkQ.cjs +0 -182
- package/dist/run-Dm9OZUkQ.cjs.map +0 -1
- package/dist/run-DpAMfkm5.cjs +0 -72
- package/dist/run-DpAMfkm5.cjs.map +0 -1
- package/dist/run-DxGkjzRm.cjs.map +0 -1
- package/dist/run-DxxYCqEo.js +0 -77
- package/dist/run-DxxYCqEo.js.map +0 -1
- package/dist/snapshot-CkpJr-gr.js.map +0 -1
- package/dist/snapshot-DUJU70H_.cjs.map +0 -1
- package/dist/utils-BHW8kA8P.js +0 -83
- package/dist/utils-BHW8kA8P.js.map +0 -1
- package/dist/utils-BzQ46pgd.cjs +0 -109
- package/dist/utils-BzQ46pgd.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-
|
|
1
|
+
{"version":3,"file":"registry-DTPOQwZN.cjs","names":["process","getErrorMessage","isRegistryEntry","isValid","isLessThan"],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport { checkCompatibility, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryDetail, type RegistryEntry } from '@kubb/core'\nimport { isLessThan, isValid } from 'verkit'\n\nexport const DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url)) throw new Error(`KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`)\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input)) throw new Error(`\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`)\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** GETs `url` as JSON. A non-2xx answer returns only its status; a network error throws with the URL. */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n try {\n const response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: (await response.json()) as unknown }\n } catch (cause) {\n throw new Error(`Could not read ${url}: ${getErrorMessage(cause)}`, { cause })\n }\n}\n\n/** Fetches one extension's detail document. */\nexport async function fetchRegistryDetail({ id, registry }: { id: string; registry: string }): Promise<RegistryDetail> {\n const { status, body } = await fetchJSON(`${registry}/${id}.json`)\n if (status === 404) throw new Error(`\"${id}\" is not in the registry at ${registry}.`)\n if (status !== 200 || !isRegistryEntry(body) || body.id !== id)\n throw new Error(`The registry at ${registry} sent an invalid entry for \"${id}\" (HTTP ${status}).`)\n\n const { overview } = body as { overview?: unknown }\n return { ...body, overview: typeof overview === 'string' ? overview : null }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Error(`The registry at ${registry} sent an invalid index (HTTP ${status}).`)\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n"],"mappings":";;;;;;AAOA,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAMA,aAAAA,QAAQ,IAAI,iBAAA;CACxB,IAAI,CAAC,eAAe,KAAK,GAAG,GAAG,MAAM,IAAI,MAAM,8CAA8C,IAAI,GAAG;CACpG,OAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;;;;;;AAOA,SAAgB,aAAa,OAAuB;CAClD,IAAI,CAAC,GAAG,KAAK,KAAK,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,qGAAqG;CACpJ,OAAO,MAAM,SAAS,GAAG,IAAI,QAAQ,aAAa;AACpD;;AAGA,eAAe,UAAU,KAA0D;CACjF,IAAI;EACF,MAAM,WAAW,MAAM,WAAW,MAAM,KAAK,EAAE,SAAS,EAAE,QAAQ,mBAAmB,EAAE,CAAC;EACxF,IAAI,CAAC,SAAS,IAAI,OAAO,EAAE,QAAQ,SAAS,OAAO;EACnD,OAAO;GAAE,QAAQ,SAAS;GAAQ,MAAO,MAAM,SAAS,KAAK;EAAc;CAC7E,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,kBAAkB,IAAI,IAAIC,kBAAAA,gBAAgB,KAAK,KAAK,EAAE,MAAM,CAAC;CAC/E;AACF;;AAGA,eAAsB,oBAAoB,EAAE,IAAI,YAAuE;CACrH,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,GAAG,SAAS,GAAG,GAAG,MAAM;CACjE,IAAI,WAAW,KAAK,MAAM,IAAI,MAAM,IAAI,GAAG,8BAA8B,SAAS,EAAE;CACpF,IAAI,WAAW,OAAO,EAAA,GAACC,WAAAA,gBAAAA,CAAgB,IAAI,KAAK,KAAK,OAAO,IAC1D,MAAM,IAAI,MAAM,mBAAmB,SAAS,8BAA8B,GAAG,UAAU,OAAO,GAAG;CAEnG,MAAM,EAAE,aAAa;CACrB,OAAO;EAAE,GAAG;EAAM,UAAU,OAAO,aAAa,WAAW,WAAW;CAAK;AAC7E;;AAGA,eAAsB,mBAAmB,EAAE,YAAiE;CAC1G,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,GAAG,SAAS,YAAY;CACjE,MAAM,QAAQ;CACd,IAAI,WAAW,OAAO,OAAO,YAAY,KAAK,CAAC,MAAM,QAAQ,MAAM,UAAU,GAC3E,MAAM,IAAI,MAAM,mBAAmB,SAAS,+BAA+B,OAAO,GAAG;CAEvF,OAAO,MAAM,WAAW,OAAOA,WAAAA,eAAe;AAChD;;AAGA,SAAgB,YAAY,UAAoC;CAC9D,OAAO,SAAS,SAAS,WAAW,UAAU,SAAS,MAAM,GAAG,SAAS,KAAK,GAAG,SAAS,WAAW,GAAG,SAAS,QAAQ,GAAG,SAAS;AACvI;;AAGA,SAAgB,gBAAgB,UAAiD;CAC/E,IAAI;EACF,CAAA,GAAA,WAAA,mBAAA,CAAmB;GAAE,MAAM,SAAS;GAAM,eAAe,SAAS;EAAc,CAAC;EACjF;CACF,SAAS,OAAO;EACd,OAAOD,kBAAAA,gBAAgB,KAAK;CAC9B;AACF;;;;;AAMA,SAAgB,WAAW,EAAE,WAAW,UAAsE;CAC5G,IAAI,EAAA,GAACE,OAAAA,QAAAA,CAAQ,MAAM,GAAG,OAAO;CAC7B,OAAO,CAAC,aAAa,EAAA,GAACA,OAAAA,QAAAA,CAAQ,SAAS,MAAA,GAAKC,OAAAA,WAAAA,CAAW,WAAW,MAAM;AAC1E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as getErrorMessage } from "./Telemetry-BFKg5ZFx.js";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { checkCompatibility, isRegistryEntry } from "@kubb/core";
|
|
5
5
|
import { isLessThan, isValid } from "verkit";
|
|
@@ -78,4 +78,4 @@ function isOutdated({ installed, latest }) {
|
|
|
78
78
|
//#endregion
|
|
79
79
|
export { isOutdated as a, installSpec as i, fetchRegistryIndex as n, registryUrl as o, incompatibility as r, toRegistryId as s, fetchRegistryDetail as t };
|
|
80
80
|
|
|
81
|
-
//# sourceMappingURL=registry-
|
|
81
|
+
//# sourceMappingURL=registry-O3AelRfj.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-
|
|
1
|
+
{"version":3,"file":"registry-O3AelRfj.js","names":[],"sources":["../src/utils/registry.ts"],"sourcesContent":["import process from 'node:process'\nimport { getErrorMessage } from '@internals/utils'\nimport { checkCompatibility, type ExtensionManifest, isRegistryEntry, type RegistryArtifact, type RegistryDetail, type RegistryEntry } from '@kubb/core'\nimport { isLessThan, isValid } from 'verkit'\n\nexport const DEFAULT_REGISTRY = 'https://kubb.dev/registry'\n\nconst SLUG = '[a-z0-9]+(?:-[a-z0-9]+)*'\nconst ID = new RegExp(`^${SLUG}(\\\\/${SLUG})?$`)\n\n/** The registry base URL: `KUBB_REGISTRY`, or kubb.dev. */\nexport function registryUrl(): string {\n const url = process.env.KUBB_REGISTRY || DEFAULT_REGISTRY\n if (!/^https?:\\/\\//.test(url)) throw new Error(`KUBB_REGISTRY must be an http(s) URL, got \"${url}\".`)\n return url.replace(/\\/+$/, '')\n}\n\n/**\n * Turns `owner/slug`, or a bare `slug` meaning `kubb-labs/<slug>`, into a registry id.\n *\n * @throws when the id has another shape, so it never reaches a URL unchecked.\n */\nexport function toRegistryId(input: string): string {\n if (!ID.test(input)) throw new Error(`\"${input}\" is not a registry id. Use owner/slug, such as kubb-labs/plugin-zod, or a slug, such as plugin-zod.`)\n return input.includes('/') ? input : `kubb-labs/${input}`\n}\n\n/** GETs `url` as JSON. A non-2xx answer returns only its status; a network error throws with the URL. */\nasync function fetchJSON(url: string): Promise<{ status: number; body?: unknown }> {\n try {\n const response = await globalThis.fetch(url, { headers: { accept: 'application/json' } })\n if (!response.ok) return { status: response.status }\n return { status: response.status, body: (await response.json()) as unknown }\n } catch (cause) {\n throw new Error(`Could not read ${url}: ${getErrorMessage(cause)}`, { cause })\n }\n}\n\n/** Fetches one extension's detail document. */\nexport async function fetchRegistryDetail({ id, registry }: { id: string; registry: string }): Promise<RegistryDetail> {\n const { status, body } = await fetchJSON(`${registry}/${id}.json`)\n if (status === 404) throw new Error(`\"${id}\" is not in the registry at ${registry}.`)\n if (status !== 200 || !isRegistryEntry(body) || body.id !== id)\n throw new Error(`The registry at ${registry} sent an invalid entry for \"${id}\" (HTTP ${status}).`)\n\n const { overview } = body as { overview?: unknown }\n return { ...body, overview: typeof overview === 'string' ? overview : null }\n}\n\n/** Fetches the registry index, leaving out entries that fail validation. */\nexport async function fetchRegistryIndex({ registry }: { registry: string }): Promise<Array<RegistryEntry>> {\n const { status, body } = await fetchJSON(`${registry}/index.json`)\n const index = body as { version?: unknown; extensions?: unknown } | null | undefined\n if (status !== 200 || index?.version !== 1 || !Array.isArray(index.extensions)) {\n throw new Error(`The registry at ${registry} sent an invalid index (HTTP ${status}).`)\n }\n return index.extensions.filter(isRegistryEntry)\n}\n\n/** What the package manager installs: `<package>@<version>`, or a GitHub release's commit, so the install cannot move with the tag. */\nexport function installSpec(artifact: RegistryArtifact): string {\n return artifact.kind === 'github' ? `github:${artifact.owner}/${artifact.repo}#${artifact.commit}` : `${artifact.package}@${artifact.version}`\n}\n\n/** Why the running Kubb or Node.js version cannot use this extension, or `undefined` when it can. */\nexport function incompatibility(manifest: ExtensionManifest): string | undefined {\n try {\n checkCompatibility({ name: manifest.name, compatibility: manifest.compatibility })\n return undefined\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\n/**\n * Whether `latest` is newer than `installed`. An unknown installed version counts as outdated, and an\n * invalid `latest` never does.\n */\nexport function isOutdated({ installed, latest }: { installed: string | undefined; latest: string }): boolean {\n if (!isValid(latest)) return false\n return !installed || !isValid(installed) || isLessThan(installed, latest)\n}\n"],"mappings":";;;;;AAOA,MAAM,OAAO;AACb,MAAM,KAAK,IAAI,OAAO,IAAI,KAAK,MAAM,KAAK,IAAI;;AAG9C,SAAgB,cAAsB;CACpC,MAAM,MAAM,QAAQ,IAAI,iBAAA;CACxB,IAAI,CAAC,eAAe,KAAK,GAAG,GAAG,MAAM,IAAI,MAAM,8CAA8C,IAAI,GAAG;CACpG,OAAO,IAAI,QAAQ,QAAQ,EAAE;AAC/B;;;;;;AAOA,SAAgB,aAAa,OAAuB;CAClD,IAAI,CAAC,GAAG,KAAK,KAAK,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,qGAAqG;CACpJ,OAAO,MAAM,SAAS,GAAG,IAAI,QAAQ,aAAa;AACpD;;AAGA,eAAe,UAAU,KAA0D;CACjF,IAAI;EACF,MAAM,WAAW,MAAM,WAAW,MAAM,KAAK,EAAE,SAAS,EAAE,QAAQ,mBAAmB,EAAE,CAAC;EACxF,IAAI,CAAC,SAAS,IAAI,OAAO,EAAE,QAAQ,SAAS,OAAO;EACnD,OAAO;GAAE,QAAQ,SAAS;GAAQ,MAAO,MAAM,SAAS,KAAK;EAAc;CAC7E,SAAS,OAAO;EACd,MAAM,IAAI,MAAM,kBAAkB,IAAI,IAAI,gBAAgB,KAAK,KAAK,EAAE,MAAM,CAAC;CAC/E;AACF;;AAGA,eAAsB,oBAAoB,EAAE,IAAI,YAAuE;CACrH,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,GAAG,SAAS,GAAG,GAAG,MAAM;CACjE,IAAI,WAAW,KAAK,MAAM,IAAI,MAAM,IAAI,GAAG,8BAA8B,SAAS,EAAE;CACpF,IAAI,WAAW,OAAO,CAAC,gBAAgB,IAAI,KAAK,KAAK,OAAO,IAC1D,MAAM,IAAI,MAAM,mBAAmB,SAAS,8BAA8B,GAAG,UAAU,OAAO,GAAG;CAEnG,MAAM,EAAE,aAAa;CACrB,OAAO;EAAE,GAAG;EAAM,UAAU,OAAO,aAAa,WAAW,WAAW;CAAK;AAC7E;;AAGA,eAAsB,mBAAmB,EAAE,YAAiE;CAC1G,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,GAAG,SAAS,YAAY;CACjE,MAAM,QAAQ;CACd,IAAI,WAAW,OAAO,OAAO,YAAY,KAAK,CAAC,MAAM,QAAQ,MAAM,UAAU,GAC3E,MAAM,IAAI,MAAM,mBAAmB,SAAS,+BAA+B,OAAO,GAAG;CAEvF,OAAO,MAAM,WAAW,OAAO,eAAe;AAChD;;AAGA,SAAgB,YAAY,UAAoC;CAC9D,OAAO,SAAS,SAAS,WAAW,UAAU,SAAS,MAAM,GAAG,SAAS,KAAK,GAAG,SAAS,WAAW,GAAG,SAAS,QAAQ,GAAG,SAAS;AACvI;;AAGA,SAAgB,gBAAgB,UAAiD;CAC/E,IAAI;EACF,mBAAmB;GAAE,MAAM,SAAS;GAAM,eAAe,SAAS;EAAc,CAAC;EACjF;CACF,SAAS,OAAO;EACd,OAAO,gBAAgB,KAAK;CAC9B;AACF;;;;;AAMA,SAAgB,WAAW,EAAE,WAAW,UAAsE;CAC5G,IAAI,CAAC,QAAQ,MAAM,GAAG,OAAO;CAC7B,OAAO,CAAC,aAAa,CAAC,QAAQ,SAAS,KAAK,WAAW,WAAW,MAAM;AAC1E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __exportAll = (all, no_symbols) => {
|
|
13
|
+
let target = {};
|
|
14
|
+
for (var name in all) __defProp(target, name, {
|
|
15
|
+
get: all[name],
|
|
16
|
+
enumerable: true
|
|
17
|
+
});
|
|
18
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
32
|
+
value: mod,
|
|
33
|
+
enumerable: true
|
|
34
|
+
}) : target, mod));
|
|
35
|
+
//#endregion
|
|
36
|
+
Object.defineProperty(exports, "__exportAll", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function() {
|
|
39
|
+
return __exportAll;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "__name", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function() {
|
|
45
|
+
return __name;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "__toESM", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function() {
|
|
51
|
+
return __toESM;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_Telemetry = require("./Telemetry-C9gmBTr0.cjs");
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
|
|
2
|
+
const require_Telemetry = require("./Telemetry-iUSXePwR.cjs");
|
|
4
3
|
let node_util = require("node:util");
|
|
5
4
|
let node_process = require("node:process");
|
|
6
|
-
node_process =
|
|
5
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
7
6
|
//#region src/runners/mcp/run.ts
|
|
8
7
|
/**
|
|
9
8
|
* Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.
|
|
@@ -21,11 +20,11 @@ async function run() {
|
|
|
21
20
|
await report({ status: "success" });
|
|
22
21
|
} catch (error) {
|
|
23
22
|
await report({ status: "failed" });
|
|
24
|
-
console.error(
|
|
23
|
+
console.error(require_Telemetry.toError(error).message);
|
|
25
24
|
node_process.default.exitCode = 1;
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
//#endregion
|
|
29
28
|
exports.run = run;
|
|
30
29
|
|
|
31
|
-
//# sourceMappingURL=run
|
|
30
|
+
//# sourceMappingURL=run--pbGQ3Rm.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run
|
|
1
|
+
{"version":3,"file":"run--pbGQ3Rm.cjs","names":["trackRun","process","styleText","toError"],"sources":["../src/runners/mcp/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { trackRun } from '../../Telemetry.ts'\n\n/**\n * Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.\n */\nexport async function run(): Promise<void> {\n const { run: startMcpServer } = (await import('@kubb/mcp')) as typeof McpModule\n\n const report = trackRun({ command: 'mcp', hrStart: process.hrtime() })\n\n try {\n // The MCP stdio transport owns stdout: anything else written there corrupts the JSON-RPC stream.\n console.error(styleText('cyan', '⏳ Starting MCP server...'))\n console.warn(styleText('yellow', 'This feature is still under development, use with caution'))\n await startMcpServer()\n await report({ status: 'success' })\n } catch (error) {\n await report({ status: 'failed' })\n console.error(toError(error).message)\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;AASA,eAAsB,MAAqB;CACzC,MAAM,EAAE,KAAK,mBAAoB,MAAM,OAAO;CAE9C,MAAM,SAASA,kBAAAA,SAAS;EAAE,SAAS;EAAO,SAASC,aAAAA,QAAQ,OAAO;CAAE,CAAC;CAErE,IAAI;EAEF,QAAQ,OAAA,GAAMC,UAAAA,UAAAA,CAAU,QAAQ,0BAA0B,CAAC;EAC3D,QAAQ,MAAA,GAAKA,UAAAA,UAAAA,CAAU,UAAU,2DAA2D,CAAC;EAC7F,MAAM,eAAe;EACrB,MAAM,OAAO,EAAE,QAAQ,UAAU,CAAC;CACpC,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAMC,kBAAAA,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,aAAA,QAAA,WAAmB;CACrB;AACF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_Telemetry = require("./Telemetry-C9gmBTr0.cjs");
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
|
|
2
|
+
const require_Telemetry = require("./Telemetry-iUSXePwR.cjs");
|
|
4
3
|
let node_util = require("node:util");
|
|
5
4
|
let node_process = require("node:process");
|
|
6
|
-
node_process =
|
|
5
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
7
6
|
//#region src/runners/validate/run.ts
|
|
8
7
|
/**
|
|
9
8
|
* Validates an OpenAPI/Swagger file at `input` using `@kubb/adapter-oas`.
|
|
@@ -31,11 +30,11 @@ async function run({ input }) {
|
|
|
31
30
|
console.error("");
|
|
32
31
|
}
|
|
33
32
|
console.error("❌ Validation failed");
|
|
34
|
-
console.error(
|
|
33
|
+
console.error(require_Telemetry.toError(error).message);
|
|
35
34
|
node_process.default.exit(1);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
//#endregion
|
|
39
38
|
exports.run = run;
|
|
40
39
|
|
|
41
|
-
//# sourceMappingURL=run-
|
|
40
|
+
//# sourceMappingURL=run-BehbQsS7.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-BehbQsS7.cjs","names":["trackRun","process","styleText","toError"],"sources":["../src/runners/validate/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport { trackRun } from '../../Telemetry.ts'\n\ntype ValidateOptions = {\n /**\n * Path or URL to the OpenAPI/Swagger file to validate.\n */\n input: string\n}\n\n/**\n * Validates an OpenAPI/Swagger file at `input` using `@kubb/adapter-oas`.\n * Exits the process with code 1 on validation failure or missing dependency.\n */\nexport async function run({ input }: ValidateOptions): Promise<void> {\n const report = trackRun({ command: 'validate', hrStart: process.hrtime() })\n\n try {\n const { adapterOas } = await import('@kubb/adapter-oas')\n\n await adapterOas().validate(input, { throwOnError: true })\n await report({ status: 'success' })\n\n console.log('✅ Validation success')\n } catch (error) {\n await report({ status: 'failed' })\n if (error instanceof Error && /@kubb\\/adapter-oas/.test(error.message)) {\n console.error(styleText('red', 'The @kubb/adapter-oas package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/adapter-oas'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/adapter-oas'))\n console.error('')\n }\n console.error('❌ Validation failed')\n console.error(toError(error).message)\n\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;AAgBA,eAAsB,IAAI,EAAE,SAAyC;CACnE,MAAM,SAASA,kBAAAA,SAAS;EAAE,SAAS;EAAY,SAASC,aAAAA,QAAQ,OAAO;CAAE,CAAC;CAE1E,IAAI;EACF,MAAM,EAAE,eAAe,MAAM,OAAO;EAEpC,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,cAAc,KAAK,CAAC;EACzD,MAAM,OAAO,EAAE,QAAQ,UAAU,CAAC;EAElC,QAAQ,IAAI,sBAAsB;CACpC,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,IAAI,iBAAiB,SAAS,qBAAqB,KAAK,MAAM,OAAO,GAAG;GACtE,QAAQ,OAAA,GAAMC,UAAAA,UAAAA,CAAU,OAAO,iDAAiD,CAAC;GACjF,QAAQ,MAAM,EAAE;GAChB,QAAQ,MAAM,kBAAkB;GAChC,QAAQ,OAAA,GAAMA,UAAAA,UAAAA,CAAU,QAAQ,iCAAiC,CAAC;GAClE,QAAQ,OAAA,GAAMA,UAAAA,UAAAA,CAAU,QAAQ,QAAQ,CAAC;GACzC,QAAQ,OAAA,GAAMA,UAAAA,UAAAA,CAAU,QAAQ,kCAAkC,CAAC;GACnE,QAAQ,MAAM,EAAE;EAClB;EACA,QAAQ,MAAM,qBAAqB;EACnC,QAAQ,MAAMC,kBAAAA,QAAQ,KAAK,CAAC,CAAC,OAAO;EAEpC,aAAA,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as trackRun } from "./Telemetry-CSc7OVsv.js";
|
|
2
|
+
import { l as toError, n as trackRun } from "./Telemetry-BFKg5ZFx.js";
|
|
4
3
|
import { styleText } from "node:util";
|
|
5
4
|
import process from "node:process";
|
|
6
5
|
//#region src/runners/mcp/run.ts
|
|
@@ -27,4 +26,4 @@ async function run() {
|
|
|
27
26
|
//#endregion
|
|
28
27
|
export { run };
|
|
29
28
|
|
|
30
|
-
//# sourceMappingURL=run-
|
|
29
|
+
//# sourceMappingURL=run-BzoydGZo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-BzoydGZo.js","names":[],"sources":["../src/runners/mcp/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport type * as McpModule from '@kubb/mcp'\nimport { trackRun } from '../../Telemetry.ts'\n\n/**\n * Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.\n */\nexport async function run(): Promise<void> {\n const { run: startMcpServer } = (await import('@kubb/mcp')) as typeof McpModule\n\n const report = trackRun({ command: 'mcp', hrStart: process.hrtime() })\n\n try {\n // The MCP stdio transport owns stdout: anything else written there corrupts the JSON-RPC stream.\n console.error(styleText('cyan', '⏳ Starting MCP server...'))\n console.warn(styleText('yellow', 'This feature is still under development, use with caution'))\n await startMcpServer()\n await report({ status: 'success' })\n } catch (error) {\n await report({ status: 'failed' })\n console.error(toError(error).message)\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;AASA,eAAsB,MAAqB;CACzC,MAAM,EAAE,KAAK,mBAAoB,MAAM,OAAO;CAE9C,MAAM,SAAS,SAAS;EAAE,SAAS;EAAO,SAAS,QAAQ,OAAO;CAAE,CAAC;CAErE,IAAI;EAEF,QAAQ,MAAM,UAAU,QAAQ,0BAA0B,CAAC;EAC3D,QAAQ,KAAK,UAAU,UAAU,2DAA2D,CAAC;EAC7F,MAAM,eAAe;EACrB,MAAM,OAAO,EAAE,QAAQ,UAAU,CAAC;CACpC,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,QAAQ,WAAW;CACrB;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as trackRun } from "./Telemetry-CSc7OVsv.js";
|
|
2
|
+
import { l as toError, n as trackRun } from "./Telemetry-BFKg5ZFx.js";
|
|
4
3
|
import { styleText } from "node:util";
|
|
5
4
|
import process from "node:process";
|
|
6
5
|
//#region src/runners/validate/run.ts
|
|
@@ -37,4 +36,4 @@ async function run({ input }) {
|
|
|
37
36
|
//#endregion
|
|
38
37
|
export { run };
|
|
39
38
|
|
|
40
|
-
//# sourceMappingURL=run-
|
|
39
|
+
//# sourceMappingURL=run-CB3YAq5e.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-CB3YAq5e.js","names":[],"sources":["../src/runners/validate/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { toError } from '@internals/utils'\nimport { trackRun } from '../../Telemetry.ts'\n\ntype ValidateOptions = {\n /**\n * Path or URL to the OpenAPI/Swagger file to validate.\n */\n input: string\n}\n\n/**\n * Validates an OpenAPI/Swagger file at `input` using `@kubb/adapter-oas`.\n * Exits the process with code 1 on validation failure or missing dependency.\n */\nexport async function run({ input }: ValidateOptions): Promise<void> {\n const report = trackRun({ command: 'validate', hrStart: process.hrtime() })\n\n try {\n const { adapterOas } = await import('@kubb/adapter-oas')\n\n await adapterOas().validate(input, { throwOnError: true })\n await report({ status: 'success' })\n\n console.log('✅ Validation success')\n } catch (error) {\n await report({ status: 'failed' })\n if (error instanceof Error && /@kubb\\/adapter-oas/.test(error.message)) {\n console.error(styleText('red', 'The @kubb/adapter-oas package is not installed.'))\n console.error('')\n console.error('Install it with:')\n console.error(styleText('cyan', ' npm install @kubb/adapter-oas'))\n console.error(styleText('cyan', ' # or'))\n console.error(styleText('cyan', ' pnpm install @kubb/adapter-oas'))\n console.error('')\n }\n console.error('❌ Validation failed')\n console.error(toError(error).message)\n\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;AAgBA,eAAsB,IAAI,EAAE,SAAyC;CACnE,MAAM,SAAS,SAAS;EAAE,SAAS;EAAY,SAAS,QAAQ,OAAO;CAAE,CAAC;CAE1E,IAAI;EACF,MAAM,EAAE,eAAe,MAAM,OAAO;EAEpC,MAAM,WAAW,CAAC,CAAC,SAAS,OAAO,EAAE,cAAc,KAAK,CAAC;EACzD,MAAM,OAAO,EAAE,QAAQ,UAAU,CAAC;EAElC,QAAQ,IAAI,sBAAsB;CACpC,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,IAAI,iBAAiB,SAAS,qBAAqB,KAAK,MAAM,OAAO,GAAG;GACtE,QAAQ,MAAM,UAAU,OAAO,iDAAiD,CAAC;GACjF,QAAQ,MAAM,EAAE;GAChB,QAAQ,MAAM,kBAAkB;GAChC,QAAQ,MAAM,UAAU,QAAQ,iCAAiC,CAAC;GAClE,QAAQ,MAAM,UAAU,QAAQ,QAAQ,CAAC;GACzC,QAAQ,MAAM,UAAU,QAAQ,kCAAkC,CAAC;GACnE,QAAQ,MAAM,EAAE;EAClB;EACA,QAAQ,MAAM,qBAAqB;EACnC,QAAQ,MAAM,QAAQ,KAAK,CAAC,CAAC,OAAO;EAEpC,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as connect, n as formatPermissionRows, i as login, s as runStudio } from "./run-S-4lnViv.js";
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const require_output = require("./output-BnK0scpX.cjs");
|
|
7
|
-
const require_reporters = require("./reporters-B4rZOlo8.cjs");
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CPE0t6oh.cjs");
|
|
2
|
+
const require_Telemetry = require("./Telemetry-iUSXePwR.cjs");
|
|
3
|
+
const require_output = require("./output-DOC3zu6i.cjs");
|
|
4
|
+
const require_config = require("./config-cb2nhvBt.cjs");
|
|
5
|
+
const require_credentials = require("./credentials-DDaKqtJn.cjs");
|
|
8
6
|
let node_util = require("node:util");
|
|
9
|
-
let node_crypto = require("node:crypto");
|
|
10
7
|
let node_os = require("node:os");
|
|
11
8
|
let node_process = require("node:process");
|
|
12
|
-
node_process =
|
|
9
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
13
10
|
let tinyexec = require("tinyexec");
|
|
14
11
|
let node_path = require("node:path");
|
|
15
|
-
node_path =
|
|
12
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
16
13
|
let _clack_prompts = require("@clack/prompts");
|
|
17
|
-
_clack_prompts =
|
|
14
|
+
_clack_prompts = require_rolldown_runtime.__toESM(_clack_prompts, 1);
|
|
18
15
|
let _kubb_core = require("@kubb/core");
|
|
19
16
|
let _kubb_studio = require("@kubb/studio");
|
|
20
17
|
//#region ../../internals/utils/src/openInBrowser.ts
|
|
@@ -23,7 +20,7 @@ const ignore = () => {};
|
|
|
23
20
|
* Opens a URL or local file in the default browser, unless running in CI.
|
|
24
21
|
*/
|
|
25
22
|
function openInBrowser(target) {
|
|
26
|
-
if (
|
|
23
|
+
if (require_Telemetry.isCIEnvironment()) return;
|
|
27
24
|
if (node_process.default.platform === "win32") {
|
|
28
25
|
(0, tinyexec.x)("cmd", [
|
|
29
26
|
"/c",
|
|
@@ -36,76 +33,7 @@ function openInBrowser(target) {
|
|
|
36
33
|
(0, tinyexec.x)(node_process.default.platform === "darwin" ? "open" : "xdg-open", [target]).then(ignore, ignore);
|
|
37
34
|
}
|
|
38
35
|
//#endregion
|
|
39
|
-
//#region src/runners/studio/credentials.ts
|
|
40
|
-
const projectBase = (project = node_process.default.cwd()) => node_path.default.join("projects", (0, node_crypto.hash)("sha256", project));
|
|
41
|
-
/**
|
|
42
|
-
* Root for the credential and machine identity of the current project, inside `KUBB_HOME`.
|
|
43
|
-
*
|
|
44
|
-
* Studio agents are project connections, so two projects on one machine must not share the same
|
|
45
|
-
* persisted token or machine secret.
|
|
46
|
-
*/
|
|
47
|
-
function getProjectKubbHome(project = node_process.default.cwd()) {
|
|
48
|
-
return (0, _kubb_core.resolveKubbDir)(projectBase(project));
|
|
49
|
-
}
|
|
50
|
-
const projectStorage = () => (0, _kubb_core.kubbStorage)({ base: projectBase() });
|
|
51
|
-
const CREDENTIALS_FILENAME = "credentials.json";
|
|
52
|
-
/**
|
|
53
|
-
* Absolute path of the stored credential, so callers can name it in output without rebuilding it.
|
|
54
|
-
*/
|
|
55
|
-
function getCredentialsPath() {
|
|
56
|
-
return node_path.default.join(getProjectKubbHome(), CREDENTIALS_FILENAME);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Reads the stored credential, or null when this machine has not paired yet or the file is
|
|
60
|
-
* unreadable or corrupt. A bad file is treated as "not paired" so `kubb studio login` can
|
|
61
|
-
* overwrite it rather than the CLI dying on it.
|
|
62
|
-
*/
|
|
63
|
-
async function readCredentials() {
|
|
64
|
-
const stored = await projectStorage().getItem(CREDENTIALS_FILENAME).catch(() => null);
|
|
65
|
-
return typeof stored?.token === "string" && stored.token !== "" ? stored : null;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Writes the credential into the project folder, which only its owner can open.
|
|
69
|
-
*/
|
|
70
|
-
async function writeCredentials(credentials) {
|
|
71
|
-
await projectStorage().setItem(CREDENTIALS_FILENAME, credentials);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Forgets the stored credential. Succeeds when there was nothing to forget.
|
|
75
|
-
*/
|
|
76
|
-
async function clearCredentials() {
|
|
77
|
-
await projectStorage().removeItem(CREDENTIALS_FILENAME);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Reads this project's machine secret, creating it on first use. Pairing sends its hash, so pairing
|
|
81
|
-
* the same project again rotates one agent's token instead of creating a second agent. It lives
|
|
82
|
-
* apart from the credential, which {@link clearCredentials} deletes.
|
|
83
|
-
*/
|
|
84
|
-
async function getMachineId() {
|
|
85
|
-
const storage = projectStorage();
|
|
86
|
-
const stored = await storage.getItem("machine-secret").catch(() => null);
|
|
87
|
-
if (typeof stored === "string" && stored.trim()) return stored.trim();
|
|
88
|
-
const secret = (0, node_crypto.randomBytes)(32).toString("hex");
|
|
89
|
-
await storage.setItem("machine-secret", secret);
|
|
90
|
-
return secret;
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
36
|
//#region src/runners/studio/run.ts
|
|
94
|
-
function createStudioOptions(values) {
|
|
95
|
-
return {
|
|
96
|
-
version: require_Telemetry.version,
|
|
97
|
-
configPath: values.config,
|
|
98
|
-
studioUrl: values.url ?? _kubb_studio.defaultStudioUrl,
|
|
99
|
-
permission: {
|
|
100
|
-
allowRead: values.allowRead,
|
|
101
|
-
allowWrite: values.allowWrite,
|
|
102
|
-
allowConfigEdit: values.allowConfigEdit,
|
|
103
|
-
allowExec: values.allowExec
|
|
104
|
-
},
|
|
105
|
-
autoOpen: values.open ?? true,
|
|
106
|
-
logLevel: values.logLevel
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
37
|
/**
|
|
110
38
|
* Pairs this machine with Studio and stores the resulting token.
|
|
111
39
|
*
|
|
@@ -122,7 +50,7 @@ async function login({ studioUrl, autoOpen }, { signal, previousCredentials } =
|
|
|
122
50
|
type: "cli",
|
|
123
51
|
name: node_path.default.basename(node_process.default.cwd()),
|
|
124
52
|
hostname: (0, node_os.hostname)(),
|
|
125
|
-
machineId: await getMachineId(),
|
|
53
|
+
machineId: await require_credentials.getMachineId(),
|
|
126
54
|
signal,
|
|
127
55
|
onCode: (session) => {
|
|
128
56
|
console.log(`\nOpen ${(0, node_util.styleText)("cyan", session.verification_uri)} and approve the code ${(0, node_util.styleText)("bold", session.user_code)}`);
|
|
@@ -141,8 +69,8 @@ async function login({ studioUrl, autoOpen }, { signal, previousCredentials } =
|
|
|
141
69
|
agentSlug: agent.slug,
|
|
142
70
|
...keepsIdentity && previousCredentials?.projects ? { projects: previousCredentials.projects } : {}
|
|
143
71
|
};
|
|
144
|
-
await writeCredentials(credentials);
|
|
145
|
-
console.log(`Credentials stored in ${getCredentialsPath()}`);
|
|
72
|
+
await require_credentials.writeCredentials(credentials);
|
|
73
|
+
console.log(`Credentials stored in ${require_credentials.getCredentialsPath()}`);
|
|
146
74
|
return credentials;
|
|
147
75
|
} catch (error) {
|
|
148
76
|
if (waiting) spinner.stop(error instanceof _kubb_studio.PairingCanceledError ? "Pairing canceled" : "Pairing failed");
|
|
@@ -156,7 +84,7 @@ const PERMISSIONS = [
|
|
|
156
84
|
{
|
|
157
85
|
key: "allowRead",
|
|
158
86
|
label: "read generated files",
|
|
159
|
-
question: () => "Let Kubb Studio read the files a generation produced?"
|
|
87
|
+
question: () => "Let Kubb Studio read the files a generation produced and its parsed spec?"
|
|
160
88
|
},
|
|
161
89
|
{
|
|
162
90
|
key: "allowWrite",
|
|
@@ -185,7 +113,7 @@ function formatPermissionRows(granted) {
|
|
|
185
113
|
* Resolves Studio permissions for the current project.
|
|
186
114
|
* Flags win, saved answers are reused, and new answers are stored unless `persist` is false.
|
|
187
115
|
*/
|
|
188
|
-
async function resolvePermissions(options, credentials, configPath =
|
|
116
|
+
async function resolvePermissions(options, credentials, configPath = require_output.KUBB_CONFIG_FILENAME, persist = true) {
|
|
189
117
|
const project = node_process.default.cwd();
|
|
190
118
|
const remembered = credentials.projects?.[project];
|
|
191
119
|
const granted = {
|
|
@@ -201,7 +129,7 @@ async function resolvePermissions(options, credentials, configPath = require_con
|
|
|
201
129
|
granted[key] = options.permission[key] || remembered?.[key] === true;
|
|
202
130
|
continue;
|
|
203
131
|
}
|
|
204
|
-
if (
|
|
132
|
+
if (require_Telemetry.isCIEnvironment() || !require_output.canUseTTY()) {
|
|
205
133
|
granted[key] = false;
|
|
206
134
|
continue;
|
|
207
135
|
}
|
|
@@ -211,7 +139,7 @@ async function resolvePermissions(options, credentials, configPath = require_con
|
|
|
211
139
|
}) === true;
|
|
212
140
|
answers[key] = granted[key];
|
|
213
141
|
}
|
|
214
|
-
if (persist && Object.keys(answers).length) await writeCredentials({
|
|
142
|
+
if (persist && Object.keys(answers).length) await require_credentials.writeCredentials({
|
|
215
143
|
...credentials,
|
|
216
144
|
projects: {
|
|
217
145
|
...credentials.projects,
|
|
@@ -252,7 +180,7 @@ function explainRejectedToken(error, reason) {
|
|
|
252
180
|
async function prepareConnection(options, signal) {
|
|
253
181
|
const { configPath } = await loadConfigs(options);
|
|
254
182
|
const envToken = node_process.default.env.KUBB_AGENT_TOKEN;
|
|
255
|
-
const stored = envToken ? null : await readCredentials();
|
|
183
|
+
const stored = envToken ? null : await require_credentials.readCredentials();
|
|
256
184
|
const credentials = await (async () => {
|
|
257
185
|
if (envToken) return {
|
|
258
186
|
studioUrl: options.studioUrl,
|
|
@@ -261,7 +189,7 @@ async function prepareConnection(options, signal) {
|
|
|
261
189
|
agentSlug: ""
|
|
262
190
|
};
|
|
263
191
|
if (stored?.studioUrl === options.studioUrl) return stored;
|
|
264
|
-
if (
|
|
192
|
+
if (require_Telemetry.isCIEnvironment()) throw new Error(`Not paired with ${options.studioUrl}. Set KUBB_AGENT_TOKEN, or run \`kubb studio login\` on a machine with a browser.`);
|
|
265
193
|
return login(options, { signal });
|
|
266
194
|
})();
|
|
267
195
|
return {
|
|
@@ -282,7 +210,7 @@ async function connect(options, context = {}) {
|
|
|
282
210
|
}
|
|
283
211
|
try {
|
|
284
212
|
if (!context.prepared) {
|
|
285
|
-
const { getWorkerStatus } = await Promise.resolve().then(() => require("./background-
|
|
213
|
+
const { getWorkerStatus } = await Promise.resolve().then(() => require("./background-BA5mxYa1.cjs"));
|
|
286
214
|
if ((await getWorkerStatus()).running) throw new Error("This project is running in the background. Run `kubb studio stop` first.");
|
|
287
215
|
}
|
|
288
216
|
const prepared = context.prepared ?? await prepareConnection(options, signal);
|
|
@@ -291,7 +219,7 @@ async function connect(options, context = {}) {
|
|
|
291
219
|
let hinted = false;
|
|
292
220
|
let pairedAgain = false;
|
|
293
221
|
const hooks = new _kubb_core.Hookable();
|
|
294
|
-
|
|
222
|
+
require_config.setupReporters(hooks, {
|
|
295
223
|
logLevel: _kubb_core.logLevel[options.logLevel ?? "info"],
|
|
296
224
|
reporters: [_kubb_core.cliReporter],
|
|
297
225
|
...context.onState ? { logger: require_output.plainLogger } : {}
|
|
@@ -322,9 +250,9 @@ async function connect(options, context = {}) {
|
|
|
322
250
|
if (!(error instanceof _kubb_studio.InvalidAgentTokenError)) throw error;
|
|
323
251
|
await context.onState?.("authentication required");
|
|
324
252
|
if (node_process.default.env.KUBB_AGENT_TOKEN) throw explainRejectedToken(error, "envToken");
|
|
325
|
-
await clearCredentials();
|
|
253
|
+
await require_credentials.clearCredentials();
|
|
326
254
|
if (pairedAgain) throw explainRejectedToken(error, "reauthExhausted");
|
|
327
|
-
if (context.onState ||
|
|
255
|
+
if (context.onState || require_Telemetry.isCIEnvironment() || !require_output.canUseTTY()) throw explainRejectedToken(error, "nonInteractive");
|
|
328
256
|
console.log((0, node_util.styleText)("yellow", `${error.message} Pairing again...`));
|
|
329
257
|
credentials = await login(options, {
|
|
330
258
|
signal,
|
|
@@ -342,9 +270,23 @@ async function connect(options, context = {}) {
|
|
|
342
270
|
}
|
|
343
271
|
}
|
|
344
272
|
/**
|
|
345
|
-
* Runs a Studio command
|
|
273
|
+
* Runs a Studio command from its parsed flags: builds the {@link StudioOptions}, prints the intro,
|
|
274
|
+
* and reports the run to telemetry. A failure is printed and sets the exit code instead of throwing.
|
|
346
275
|
*/
|
|
347
|
-
async function
|
|
276
|
+
async function runStudio(values, action, { block = false, json = false } = {}) {
|
|
277
|
+
const options = {
|
|
278
|
+
version: require_Telemetry.version,
|
|
279
|
+
configPath: values.config,
|
|
280
|
+
studioUrl: values.url ?? _kubb_studio.defaultStudioUrl,
|
|
281
|
+
permission: {
|
|
282
|
+
allowRead: values.allowRead ?? false,
|
|
283
|
+
allowWrite: values.allowWrite ?? false,
|
|
284
|
+
allowConfigEdit: values.allowConfigEdit ?? false,
|
|
285
|
+
allowExec: values.allowExec ?? false
|
|
286
|
+
},
|
|
287
|
+
autoOpen: values.open ?? true,
|
|
288
|
+
logLevel: values.logLevel
|
|
289
|
+
};
|
|
348
290
|
const report = require_Telemetry.trackRun({
|
|
349
291
|
command: "studio",
|
|
350
292
|
hrStart: node_process.default.hrtime()
|
|
@@ -354,74 +296,20 @@ async function run({ options, action, block = false, json = false }) {
|
|
|
354
296
|
warning: (0, node_util.styleText)("yellow", "This feature is still under development, use with caution"),
|
|
355
297
|
block
|
|
356
298
|
});
|
|
357
|
-
await action();
|
|
299
|
+
await action(options);
|
|
358
300
|
await report({ status: "success" });
|
|
359
301
|
} catch (error) {
|
|
360
302
|
await report({ status: "failed" });
|
|
361
|
-
console.error(
|
|
303
|
+
console.error(require_Telemetry.toError(error).message);
|
|
362
304
|
node_process.default.exitCode = 1;
|
|
363
305
|
}
|
|
364
306
|
}
|
|
365
307
|
//#endregion
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
Object.defineProperty(exports, "connect", {
|
|
373
|
-
enumerable: true,
|
|
374
|
-
get: function() {
|
|
375
|
-
return connect;
|
|
376
|
-
}
|
|
377
|
-
});
|
|
378
|
-
Object.defineProperty(exports, "createStudioOptions", {
|
|
379
|
-
enumerable: true,
|
|
380
|
-
get: function() {
|
|
381
|
-
return createStudioOptions;
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
Object.defineProperty(exports, "formatPermissionRows", {
|
|
385
|
-
enumerable: true,
|
|
386
|
-
get: function() {
|
|
387
|
-
return formatPermissionRows;
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
Object.defineProperty(exports, "getProjectKubbHome", {
|
|
391
|
-
enumerable: true,
|
|
392
|
-
get: function() {
|
|
393
|
-
return getProjectKubbHome;
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
Object.defineProperty(exports, "loadConfigs", {
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function() {
|
|
399
|
-
return loadConfigs;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
Object.defineProperty(exports, "login", {
|
|
403
|
-
enumerable: true,
|
|
404
|
-
get: function() {
|
|
405
|
-
return login;
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
Object.defineProperty(exports, "prepareConnection", {
|
|
409
|
-
enumerable: true,
|
|
410
|
-
get: function() {
|
|
411
|
-
return prepareConnection;
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
Object.defineProperty(exports, "readCredentials", {
|
|
415
|
-
enumerable: true,
|
|
416
|
-
get: function() {
|
|
417
|
-
return readCredentials;
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
Object.defineProperty(exports, "run", {
|
|
421
|
-
enumerable: true,
|
|
422
|
-
get: function() {
|
|
423
|
-
return run;
|
|
424
|
-
}
|
|
425
|
-
});
|
|
308
|
+
exports.connect = connect;
|
|
309
|
+
exports.formatPermissionRows = formatPermissionRows;
|
|
310
|
+
exports.loadConfigs = loadConfigs;
|
|
311
|
+
exports.login = login;
|
|
312
|
+
exports.prepareConnection = prepareConnection;
|
|
313
|
+
exports.runStudio = runStudio;
|
|
426
314
|
|
|
427
|
-
//# sourceMappingURL=run-
|
|
315
|
+
//# sourceMappingURL=run-CfBk4wgw.cjs.map
|