@kubb/cli 5.14.6 → 5.15.1
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/bin/kubb.js +2 -1
- package/dist/{Telemetry-B5V_ufmv.cjs → Telemetry-B52pKz9i.cjs} +14 -118
- package/dist/Telemetry-B52pKz9i.cjs.map +1 -0
- package/dist/{Telemetry-DrnGartf.js → Telemetry-C7Qwy2s7.js} +12 -86
- package/dist/Telemetry-C7Qwy2s7.js.map +1 -0
- package/dist/{background-DlK0by5c.js → background-BJCuXYuB.js} +5 -6
- package/dist/{background-DlK0by5c.js.map → background-BJCuXYuB.js.map} +1 -1
- package/dist/{background-CdPT1eaq.cjs → background-CK2gQtTU.cjs} +5 -6
- package/dist/{background-CdPT1eaq.cjs.map → background-CK2gQtTU.cjs.map} +1 -1
- package/dist/{background-C6XHpEo7.js → background-D4mZCg-4.js} +1 -1
- package/dist/banner-BdTTDFkG.js +140 -0
- package/dist/banner-BdTTDFkG.js.map +1 -0
- package/dist/banner-wJFk-L-c.cjs +163 -0
- package/dist/banner-wJFk-L-c.cjs.map +1 -0
- package/dist/config-BL3HnFhb.js +1 -0
- package/dist/config-BWj9jBVj.cjs +62 -0
- package/dist/config-BWj9jBVj.cjs.map +1 -0
- package/dist/{config-CNqgDSu3.js → config-CQTxXvIG.js} +6 -52
- package/dist/config-CQTxXvIG.js.map +1 -0
- package/dist/{config-BG_Nr2CZ.cjs → config-CRrmj88c.cjs} +15 -62
- package/dist/config-CRrmj88c.cjs.map +1 -0
- package/dist/config-Uk3rbZfb.js +49 -0
- package/dist/config-Uk3rbZfb.js.map +1 -0
- package/dist/configFile-C0DIXNMD.js +993 -0
- package/dist/configFile-C0DIXNMD.js.map +1 -0
- package/dist/configFile-CoEpHdXG.cjs +1028 -0
- package/dist/configFile-CoEpHdXG.cjs.map +1 -0
- package/dist/{credentials-C8tjAhTo.js → credentials-B77iJx9H.js} +1 -1
- package/dist/{credentials-DDaKqtJn.cjs → credentials-DEsGwcGD.cjs} +3 -4
- package/dist/{credentials-DDaKqtJn.cjs.map → credentials-DEsGwcGD.cjs.map} +1 -1
- package/dist/{credentials-CZK6zPLv.js → credentials-osgjujE_.js} +3 -4
- package/dist/{credentials-CZK6zPLv.js.map → credentials-osgjujE_.js.map} +1 -1
- package/dist/env-C3xHRMez.js +1 -0
- package/dist/env-eu3XyKqJ.cjs +55 -0
- package/dist/env-eu3XyKqJ.cjs.map +1 -0
- package/dist/env-rv-VgSGN.js +34 -0
- package/dist/env-rv-VgSGN.js.map +1 -0
- package/dist/{errors-Cl69p_vI.cjs → errors-BponpdjN.cjs} +3 -4
- package/dist/{errors-Cl69p_vI.cjs.map → errors-BponpdjN.cjs.map} +1 -1
- package/dist/{errors-DmC83ALX.js → errors-wzqmMpMo.js} +3 -4
- package/dist/{errors-DmC83ALX.js.map → errors-wzqmMpMo.js.map} +1 -1
- package/dist/index.cjs +37 -2719
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +35 -2713
- package/dist/index.js.map +1 -1
- package/dist/installWithSpinner-DpnpxHq5.js +49 -0
- package/dist/installWithSpinner-DpnpxHq5.js.map +1 -0
- package/dist/installWithSpinner-ONGfIVUJ.cjs +56 -0
- package/dist/installWithSpinner-ONGfIVUJ.cjs.map +1 -0
- package/dist/{text-CL6N6yPS.js → intro-9PB8sE8z.js} +8 -52
- package/dist/intro-9PB8sE8z.js.map +1 -0
- package/dist/{text-DrsG1EDN.cjs → intro-YPaf1Imr.cjs} +12 -80
- package/dist/intro-YPaf1Imr.cjs.map +1 -0
- package/dist/isCIEnvironment-D6xtAAZ2.js +14 -0
- package/dist/isCIEnvironment-D6xtAAZ2.js.map +1 -0
- package/dist/isCIEnvironment-DiVOMI5Q.cjs +20 -0
- package/dist/isCIEnvironment-DiVOMI5Q.cjs.map +1 -0
- package/dist/mascot--q1xjKw1.js +63 -0
- package/dist/mascot--q1xjKw1.js.map +1 -0
- package/dist/mascot-JSA0j3Q_.cjs +80 -0
- package/dist/mascot-JSA0j3Q_.cjs.map +1 -0
- package/dist/mcp-CcseJJwh.cjs +20 -0
- package/dist/mcp-CcseJJwh.cjs.map +1 -0
- package/dist/mcp-DUTsS8tR.js +21 -0
- package/dist/mcp-DUTsS8tR.js.map +1 -0
- package/dist/package-B1hUUjio.cjs +10 -0
- package/dist/package-B1hUUjio.cjs.map +1 -0
- package/dist/package-MYPMnnTX.js +5 -0
- package/dist/package-MYPMnnTX.js.map +1 -0
- package/dist/{registry-DOGpflct.js → registry-B3eYk4LN.js} +7 -67
- package/dist/registry-B3eYk4LN.js.map +1 -0
- package/dist/{registry-BzBp6aZI.cjs → registry-YE1pFWL-.cjs} +4 -82
- package/dist/registry-YE1pFWL-.cjs.map +1 -0
- package/dist/{reporters-GzXlc4CK.cjs → reporters-2cgjvXwR.cjs} +32 -40
- package/dist/{reporters-GzXlc4CK.cjs.map → reporters-2cgjvXwR.cjs.map} +1 -1
- package/dist/{reporters-mYHIUZSx.js → reporters-BM430HdQ.js} +19 -27
- package/dist/{reporters-mYHIUZSx.js.map → reporters-BM430HdQ.js.map} +1 -1
- package/dist/{rolldown-runtime-CPE0t6oh.cjs → rolldown-runtime-C3-Zg-KD.cjs} +1 -2
- package/dist/{rolldown-runtime-CRm0XQPb.js → rolldown-runtime-xo6NMXYd.js} +1 -2
- package/dist/run-1H9TGT8v.js +77 -0
- package/dist/run-1H9TGT8v.js.map +1 -0
- package/dist/run-BYP_t9dR.cjs +324 -0
- package/dist/run-BYP_t9dR.cjs.map +1 -0
- package/dist/run-Bq6gcfkS.js +1 -0
- package/dist/run-BrM7-NSV.js +181 -0
- package/dist/run-BrM7-NSV.js.map +1 -0
- package/dist/run-BsrNfFIl.js +228 -0
- package/dist/run-BsrNfFIl.js.map +1 -0
- package/dist/{run-l8IiOR_c.js → run-CLiHI99L.js} +9 -9
- package/dist/{run-l8IiOR_c.js.map → run-CLiHI99L.js.map} +1 -1
- package/dist/{run-C8Prej7s.cjs → run-CQORv7Gq.cjs} +44 -37
- package/dist/run-CQORv7Gq.cjs.map +1 -0
- package/dist/{run-EJtgdIin.js → run-CXVhxFfC.js} +31 -23
- package/dist/run-CXVhxFfC.js.map +1 -0
- package/dist/run-CrM4jsix.cjs +80 -0
- package/dist/run-CrM4jsix.cjs.map +1 -0
- package/dist/run-CvFakE3B.cjs +185 -0
- package/dist/run-CvFakE3B.cjs.map +1 -0
- package/dist/{run-DC_xH5H3.cjs → run-CyzKy-0p.cjs} +49 -41
- package/dist/run-CyzKy-0p.cjs.map +1 -0
- package/dist/run-D-nn9-Wq.js +319 -0
- package/dist/run-D-nn9-Wq.js.map +1 -0
- package/dist/run-DBnSbwtU.cjs +389 -0
- package/dist/run-DBnSbwtU.cjs.map +1 -0
- package/dist/{run-j1g5si5R.js → run-DTqMrPS9.js} +5 -6
- package/dist/{run-j1g5si5R.js.map → run-DTqMrPS9.js.map} +1 -1
- package/dist/{run-9fs2T2Je.js → run-DUwX6Icx.js} +26 -20
- package/dist/run-DUwX6Icx.js.map +1 -0
- package/dist/run-FEiyv6_U.js +385 -0
- package/dist/run-FEiyv6_U.js.map +1 -0
- package/dist/run-LY_UAYyM.cjs +233 -0
- package/dist/run-LY_UAYyM.cjs.map +1 -0
- package/dist/{run-sjzj0ir-.cjs → run-dMTJfs4_.cjs} +10 -10
- package/dist/{run-sjzj0ir-.cjs.map → run-dMTJfs4_.cjs.map} +1 -1
- package/dist/{run-CypFtkVE.cjs → run-uPA5s3rI.cjs} +5 -6
- package/dist/{run-CypFtkVE.cjs.map → run-uPA5s3rI.cjs.map} +1 -1
- package/dist/shared-C0EtrdUm.cjs +123 -0
- package/dist/shared-C0EtrdUm.cjs.map +1 -0
- package/dist/shared-Ct9stKpp.js +94 -0
- package/dist/shared-Ct9stKpp.js.map +1 -0
- package/dist/{snapshot-laSRD0z1.cjs → snapshot-CPF9zyZj.cjs} +13 -14
- package/dist/{snapshot-laSRD0z1.cjs.map → snapshot-CPF9zyZj.cjs.map} +1 -1
- package/dist/{snapshot-BJWnL6hE.js → snapshot-CiV08NJr.js} +10 -11
- package/dist/{snapshot-BJWnL6hE.js.map → snapshot-CiV08NJr.js.map} +1 -1
- package/dist/spinner-BZaln7O8.js +160 -0
- package/dist/spinner-BZaln7O8.js.map +1 -0
- package/dist/spinner-CfB0sIPy.cjs +208 -0
- package/dist/spinner-CfB0sIPy.cjs.map +1 -0
- package/dist/{status-DFEdbBPu.cjs → status-C066YA-4.cjs} +7 -8
- package/dist/{status-DFEdbBPu.cjs.map → status-C066YA-4.cjs.map} +1 -1
- package/dist/{status-BjmXLRm2.js → status-Dj8tivag.js} +6 -7
- package/dist/{status-BjmXLRm2.js.map → status-Dj8tivag.js.map} +1 -1
- package/dist/studio-B4XsXgKj.js +215 -0
- package/dist/studio-B4XsXgKj.js.map +1 -0
- package/dist/studio-D9_-mKee.cjs +218 -0
- package/dist/studio-D9_-mKee.cjs.map +1 -0
- package/dist/studioWorker.js +4 -5
- package/dist/{summary-DDnI70tn.js → summary-CbmQKA8l.js} +5 -6
- package/dist/{summary-DDnI70tn.js.map → summary-CbmQKA8l.js.map} +1 -1
- package/dist/{summary-1DCwzWEU.cjs → summary-Clvl5Hxs.cjs} +7 -8
- package/dist/{summary-1DCwzWEU.cjs.map → summary-Clvl5Hxs.cjs.map} +1 -1
- package/dist/table-BlRe9YTZ.cjs +15 -0
- package/dist/table-BlRe9YTZ.cjs.map +1 -0
- package/dist/table-CR7iZJGo.js +10 -0
- package/dist/table-CR7iZJGo.js.map +1 -0
- package/dist/text-BmiI4s6N.js +13 -0
- package/dist/text-BmiI4s6N.js.map +1 -0
- package/dist/text-Ep3AulAS.cjs +24 -0
- package/dist/text-Ep3AulAS.cjs.map +1 -0
- package/dist/time-3BKoci3G.cjs +82 -0
- package/dist/time-3BKoci3G.cjs.map +1 -0
- package/dist/time-C-wU7VhC.js +65 -0
- package/dist/time-C-wU7VhC.js.map +1 -0
- package/dist/utils-BdibacYq.js +244 -0
- package/dist/utils-BdibacYq.js.map +1 -0
- package/dist/utils-CO89mxRU.cjs +290 -0
- package/dist/utils-CO89mxRU.cjs.map +1 -0
- package/dist/utils-CbJ6hS_t.js +222 -0
- package/dist/utils-CbJ6hS_t.js.map +1 -0
- package/dist/utils-CcARPB45.cjs +286 -0
- package/dist/utils-CcARPB45.cjs.map +1 -0
- package/dist/validate-B3tLWYJU.cjs +27 -0
- package/dist/validate-B3tLWYJU.cjs.map +1 -0
- package/dist/validate-C5fyNF4v.js +28 -0
- package/dist/validate-C5fyNF4v.js.map +1 -0
- package/package.json +7 -7
- package/dist/Telemetry-B5V_ufmv.cjs.map +0 -1
- package/dist/Telemetry-DrnGartf.js.map +0 -1
- package/dist/config-BG_Nr2CZ.cjs.map +0 -1
- package/dist/config-CNqgDSu3.js.map +0 -1
- package/dist/config-DWDpFSn1.js +0 -1
- package/dist/registry-BzBp6aZI.cjs.map +0 -1
- package/dist/registry-DOGpflct.js.map +0 -1
- package/dist/run-9fs2T2Je.js.map +0 -1
- package/dist/run-C8Prej7s.cjs.map +0 -1
- package/dist/run-CXVme-aS.js +0 -1
- package/dist/run-DC_xH5H3.cjs.map +0 -1
- package/dist/run-EJtgdIin.js.map +0 -1
- package/dist/text-CL6N6yPS.js.map +0 -1
- package/dist/text-DrsG1EDN.cjs.map +0 -1
- package/dist/utils-C3vTpUje.cjs +0 -645
- package/dist/utils-C3vTpUje.cjs.map +0 -1
- package/dist/utils-CIc8YFtr.js +0 -536
- package/dist/utils-CIc8YFtr.js.map +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
|
|
2
|
+
const require_errors = require("./errors-BponpdjN.cjs");
|
|
3
|
+
const require_spinner = require("./spinner-CfB0sIPy.cjs");
|
|
4
|
+
const require_utils = require("./utils-CcARPB45.cjs");
|
|
5
|
+
const require_intro = require("./intro-YPaf1Imr.cjs");
|
|
6
|
+
const require_shared = require("./shared-C0EtrdUm.cjs");
|
|
7
|
+
const require_config = require("./config-CRrmj88c.cjs");
|
|
8
|
+
const require_summary = require("./summary-Clvl5Hxs.cjs");
|
|
9
|
+
const require_registry = require("./registry-YE1pFWL-.cjs");
|
|
10
|
+
const require_utils$1 = require("./utils-CO89mxRU.cjs");
|
|
11
|
+
const require_installWithSpinner = require("./installWithSpinner-ONGfIVUJ.cjs");
|
|
12
|
+
const require_text = require("./text-Ep3AulAS.cjs");
|
|
13
|
+
const require_table = require("./table-BlRe9YTZ.cjs");
|
|
14
|
+
let node_util = require("node:util");
|
|
15
|
+
let gunshi = require("gunshi");
|
|
16
|
+
let node_process = require("node:process");
|
|
17
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
18
|
+
let node_path = require("node:path");
|
|
19
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
20
|
+
let _clack_prompts = require("@clack/prompts");
|
|
21
|
+
_clack_prompts = require_rolldown_runtime.__toESM(_clack_prompts, 1);
|
|
22
|
+
let _kubb_core = require("@kubb/core");
|
|
23
|
+
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
24
|
+
// src/runners/update/run.ts
|
|
25
|
+
/**
|
|
26
|
+
* Generates every config in this process, the way `kubb generate` does, and returns the output files
|
|
27
|
+
* it changed. Runs after the install, so the config loads the new versions. `undefined` when the
|
|
28
|
+
* config fails to load or a build fails.
|
|
29
|
+
*/
|
|
30
|
+
async function regenerate({ cwd, configPath }) {
|
|
31
|
+
const spinner = require_spinner.createSpinner();
|
|
32
|
+
spinner.start("Generating with the new versions");
|
|
33
|
+
try {
|
|
34
|
+
const [{ getConfigs }, { generate }] = await Promise.all([Promise.resolve().then(() => require("./config-BWj9jBVj.cjs")).then((n) => n.config_exports), Promise.resolve().then(() => require("./run-CyzKy-0p.cjs"))]);
|
|
35
|
+
const { configs } = await getConfigs({ configPath });
|
|
36
|
+
const dirs = configs.map((config) => node_path.default.resolve(config.root ?? cwd, config.output.path));
|
|
37
|
+
const before = new Map((await Promise.all(dirs.map(require_utils.readOutputFiles))).flatMap((files) => [...files]));
|
|
38
|
+
const hooks = new _kubb_core.Hookable();
|
|
39
|
+
for (const config of configs) if (!await generate({
|
|
40
|
+
config,
|
|
41
|
+
hooks
|
|
42
|
+
})) throw new Error("Generation failed");
|
|
43
|
+
const after = new Map((await Promise.all(dirs.map(require_utils.readOutputFiles))).flatMap((files) => [...files]));
|
|
44
|
+
const diff = require_utils.diffFiles(before, after);
|
|
45
|
+
spinner.stop(diff.files.length ? `Generated: ${require_text.pluralize(diff.files.length, "file")} changed` : "Generated: no files changed");
|
|
46
|
+
return {
|
|
47
|
+
...diff,
|
|
48
|
+
output: dirs.map((dir) => node_path.default.relative(cwd, dir) || ".").join(", ")
|
|
49
|
+
};
|
|
50
|
+
} catch (error) {
|
|
51
|
+
spinner.error(`Generation failed: ${require_errors.getErrorMessage(error)}`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Moves installed extensions to the version the registry pins. Shows each version change with its
|
|
57
|
+
* bump, asks which to install with majors left out, installs them, and regenerates to show which
|
|
58
|
+
* files changed. With `dryRun`, only lists the updates and installs nothing.
|
|
59
|
+
*/
|
|
60
|
+
async function run({ ids, dryRun, yes }) {
|
|
61
|
+
const cwd = node_process.default.cwd();
|
|
62
|
+
const hrStart = node_process.default.hrtime();
|
|
63
|
+
const installedPackages = [];
|
|
64
|
+
const summary = (title, status, lines) => require_summary.logCommandSummary({
|
|
65
|
+
title,
|
|
66
|
+
status,
|
|
67
|
+
hrStart,
|
|
68
|
+
block: true,
|
|
69
|
+
lines
|
|
70
|
+
});
|
|
71
|
+
require_intro.logIntro({ title: require_intro.isInteractiveRun({
|
|
72
|
+
yes,
|
|
73
|
+
dryRun
|
|
74
|
+
}) ? void 0 : (0, node_util.styleText)("bgCyan", (0, node_util.styleText)("black", " Kubb Update ")) });
|
|
75
|
+
try {
|
|
76
|
+
const wanted = new Set(ids.map(require_registry.toRegistryId));
|
|
77
|
+
const [entries, installed] = await require_spinner.withSpinner({
|
|
78
|
+
message: "Checking the registry",
|
|
79
|
+
promise: Promise.all([require_registry.fetchRegistryIndex({ registry: require_registry.registryUrl() }), (0, _kubb_core.readInstalledPackages)({ root: cwd })])
|
|
80
|
+
});
|
|
81
|
+
const versions = new Map(installed.map((item) => [item.package, item.version]));
|
|
82
|
+
const tracked = entries.filter((entry) => versions.has(entry.artifact.package) && (!wanted.size || wanted.has(entry.id)));
|
|
83
|
+
for (const id of wanted) {
|
|
84
|
+
if (tracked.some((entry) => entry.id === id)) continue;
|
|
85
|
+
require_intro.logWarn(`${id} is not installed, or not in the registry.`);
|
|
86
|
+
node_process.default.exitCode = 1;
|
|
87
|
+
}
|
|
88
|
+
const current = ({ artifact }) => versions.get(artifact.package);
|
|
89
|
+
const isMajor = (entry) => require_registry.bumpOf({
|
|
90
|
+
installed: current(entry),
|
|
91
|
+
latest: entry.artifact.version
|
|
92
|
+
}) === "major";
|
|
93
|
+
const outdated = tracked.filter((entry) => require_registry.isOutdated({
|
|
94
|
+
installed: current(entry),
|
|
95
|
+
latest: entry.artifact.version
|
|
96
|
+
}));
|
|
97
|
+
const proposals = outdated.filter((entry) => {
|
|
98
|
+
const problem = require_registry.incompatibility(entry.manifest);
|
|
99
|
+
if (problem) {
|
|
100
|
+
require_intro.logWarn(`Skipped ${entry.id}: ${problem}`);
|
|
101
|
+
if (wanted.has(entry.id)) node_process.default.exitCode = 1;
|
|
102
|
+
}
|
|
103
|
+
return !problem;
|
|
104
|
+
});
|
|
105
|
+
if (!proposals.length) {
|
|
106
|
+
const title = outdated.length ? "No compatible updates available" : "Already up to date";
|
|
107
|
+
summary(tracked.length ? title : "No installed extensions to update", outdated.length ? "warning" : "success", [` ${tracked.length - outdated.length} of ${tracked.length} up to date`, ...ids.length ? ["", `No updates for ${ids.join(", ")}.`] : []]);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (tracked.length) {
|
|
111
|
+
const header = [
|
|
112
|
+
"Extension",
|
|
113
|
+
"Current",
|
|
114
|
+
"Latest",
|
|
115
|
+
""
|
|
116
|
+
];
|
|
117
|
+
const rows = tracked.map((entry) => {
|
|
118
|
+
if (!outdated.includes(entry)) return [
|
|
119
|
+
entry.artifact.package,
|
|
120
|
+
current(entry) ?? "-",
|
|
121
|
+
"up to date",
|
|
122
|
+
""
|
|
123
|
+
];
|
|
124
|
+
const bump = require_registry.bumpOf({
|
|
125
|
+
installed: current(entry),
|
|
126
|
+
latest: entry.artifact.version
|
|
127
|
+
}) ?? "";
|
|
128
|
+
return [
|
|
129
|
+
entry.artifact.package,
|
|
130
|
+
current(entry) ?? "not installed",
|
|
131
|
+
entry.artifact.version,
|
|
132
|
+
bump === "major" ? "major · breaking" : bump
|
|
133
|
+
];
|
|
134
|
+
});
|
|
135
|
+
const lines = require_table.formatTable([header, ...rows]);
|
|
136
|
+
require_intro.logStep(`Checked ${require_text.pluralize(tracked.length, "extension")} against the registry`);
|
|
137
|
+
require_intro.logBlock([(0, node_util.styleText)("dim", lines[0]), ...lines.slice(1).map((line, index) => {
|
|
138
|
+
if (!outdated.includes(tracked[index])) return (0, node_util.styleText)("dim", line);
|
|
139
|
+
return line.endsWith("major · breaking") ? (0, node_util.styleText)("yellow", line) : line;
|
|
140
|
+
})]);
|
|
141
|
+
}
|
|
142
|
+
if (dryRun) {
|
|
143
|
+
summary("Updates available", "planned", [`Dry run: nothing was installed. Run kubb update to install ${proposals.length === 1 ? "it" : "them"}.`]);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const defaults = proposals.filter((entry) => wanted.has(entry.id) || !isMajor(entry));
|
|
147
|
+
const chosen = yes ? defaults.map((entry) => entry.id) : await _clack_prompts.multiselect({
|
|
148
|
+
message: "Select the updates to install",
|
|
149
|
+
options: proposals.map((entry) => ({
|
|
150
|
+
value: entry.id,
|
|
151
|
+
label: entry.artifact.package,
|
|
152
|
+
hint: `${current(entry) ?? "not installed"} → ${entry.artifact.version}`
|
|
153
|
+
})),
|
|
154
|
+
initialValues: defaults.map((entry) => entry.id),
|
|
155
|
+
required: false
|
|
156
|
+
});
|
|
157
|
+
if (_clack_prompts.isCancel(chosen)) {
|
|
158
|
+
summary("Update canceled", "canceled", [" No changes made"]);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const selected = proposals.filter((entry) => chosen.includes(entry.id));
|
|
162
|
+
const skipped = proposals.filter((entry) => !selected.includes(entry)).map((entry) => {
|
|
163
|
+
const kind = entry.manifest.kind.charAt(0).toUpperCase() + entry.manifest.kind.slice(1);
|
|
164
|
+
return ` ${(0, node_util.styleText)("dim", "Skipped")} ${kind} ${entry.artifact.package} ${entry.artifact.version} ${(0, node_util.styleText)("dim", `run kubb update ${require_registry.toShortId(entry.id)} later`)}`;
|
|
165
|
+
});
|
|
166
|
+
if (!selected.length) {
|
|
167
|
+
summary("No updates installed", "canceled", [" No updates selected.", ...skipped]);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const packageManager = require_utils$1.detectPackageManager(cwd);
|
|
171
|
+
const names = selected.map(({ artifact }) => artifact.package).join(", ");
|
|
172
|
+
await require_installWithSpinner.installWithSpinner({
|
|
173
|
+
packages: selected.map(({ artifact }) => require_registry.installSpec(artifact)),
|
|
174
|
+
names,
|
|
175
|
+
packageManager,
|
|
176
|
+
cwd
|
|
177
|
+
});
|
|
178
|
+
installedPackages.push(...selected.map((entry) => entry.artifact.package));
|
|
179
|
+
const foundConfig = require_config.findConfigFile(cwd);
|
|
180
|
+
const configPath = foundConfig && !yes && await _clack_prompts.confirm({
|
|
181
|
+
message: "Regenerate now? This rewrites the generated files.",
|
|
182
|
+
initialValue: true
|
|
183
|
+
}) === true ? foundConfig : void 0;
|
|
184
|
+
const changed = configPath ? await regenerate({
|
|
185
|
+
cwd,
|
|
186
|
+
configPath
|
|
187
|
+
}) : void 0;
|
|
188
|
+
const generationFailed = Boolean(configPath && !changed);
|
|
189
|
+
const fileCounts = {
|
|
190
|
+
A: 0,
|
|
191
|
+
M: 0,
|
|
192
|
+
D: 0
|
|
193
|
+
};
|
|
194
|
+
for (const file of changed?.files ?? []) fileCounts[file.status]++;
|
|
195
|
+
summary(generationFailed ? "Extensions updated; generation failed" : "Update complete", generationFailed ? "warning" : "success", [
|
|
196
|
+
` Packages ${selected.length} installed with ${packageManager.name}${skipped.length ? ` · ${skipped.length} skipped` : ""}`,
|
|
197
|
+
...skipped,
|
|
198
|
+
...changed ? [` Files ${fileCounts.A} added · ${fileCounts.M} modified · ${fileCounts.D} deleted`] : [],
|
|
199
|
+
...!configPath ? [" Regeneration not run"] : [],
|
|
200
|
+
...generationFailed ? ["", "Fix the generation error, then run kubb generate."] : []
|
|
201
|
+
]);
|
|
202
|
+
} catch (error) {
|
|
203
|
+
require_intro.logError(require_errors.getErrorMessage(error));
|
|
204
|
+
summary("Update failed", "failed", installedPackages.length ? [` Packages ${installedPackages.join(", ")} installed`] : [" No changes made"]);
|
|
205
|
+
node_process.default.exitCode = 1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const command = (0, gunshi.defineWithTypes)()({
|
|
209
|
+
name: "update",
|
|
210
|
+
description: "Update installed extensions, regenerate, and summarize file changes.",
|
|
211
|
+
examples: [
|
|
212
|
+
"kubb update",
|
|
213
|
+
"kubb update --dry-run",
|
|
214
|
+
"kubb update plugin-zod plugin-ts --yes"
|
|
215
|
+
].join("\n"),
|
|
216
|
+
args: {
|
|
217
|
+
ids: {
|
|
218
|
+
type: "positional",
|
|
219
|
+
description: "Registry ids to update, all installed extensions when omitted",
|
|
220
|
+
multiple: true
|
|
221
|
+
},
|
|
222
|
+
...require_shared.yesArg
|
|
223
|
+
},
|
|
224
|
+
run: ({ values, extensions }) => run({
|
|
225
|
+
ids: values.ids ?? [],
|
|
226
|
+
dryRun: extensions[_gunshi_plugin_dryrun.pluginId].enabled,
|
|
227
|
+
yes: values.yes
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
exports.command = command;
|
|
231
|
+
exports.run = run;
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=run-LY_UAYyM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-LY_UAYyM.cjs","names":["createSpinner","path","readOutputFiles","Hookable","diffFiles","pluralize","getErrorMessage","process","logCommandSummary","isInteractiveRun","styleText","toRegistryId","withSpinner","fetchRegistryIndex","registryUrl","readInstalledPackages","bumpOf","isOutdated","incompatibility","formatTable","clack","toShortId","detectPackageManager","installWithSpinner","installSpec","findConfigFile","defineWithTypes","yesArg","dryRunId"],"sources":["../src/runners/update/run.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { defineWithTypes } from 'gunshi'\nimport { findConfigFile } from '@internals/shared'\nimport { getErrorMessage } from '@internals/utils'\nimport { Hookable, type KubbHooks, readInstalledPackages, type RegistryEntry } from '@kubb/core'\nimport { pluralize } from '../../ui/text.ts'\nimport { dryRunId, type DryRunExtensions, yesArg } from '../../commands/shared.ts'\nimport { isInteractiveRun, logIntro } from '../../ui/intro.ts'\nimport { logBlock, logError, logStep, logWarn } from '../../ui/log.ts'\nimport { createSpinner, withSpinner } from '../../ui/spinner.ts'\nimport { logCommandSummary } from '../../ui/summary.ts'\nimport { formatTable } from '../../ui/table.ts'\nimport { bumpOf, fetchRegistryIndex, incompatibility, installSpec, isOutdated, registryUrl, toRegistryId, toShortId } from '../../utils/registry.ts'\nimport { detectPackageManager } from '../init/utils.ts'\nimport { installWithSpinner } from '../installWithSpinner.ts'\nimport { diffFiles, type FileChange, readOutputFiles } from '../generate/utils.ts'\n\nexport type UpdateOptions = {\n /**\n * Registry ids to update. Empty updates every installed extension the registry lists.\n */\n ids: Array<string>\n /**\n * List the updates without installing anything.\n */\n dryRun: boolean\n yes: boolean\n}\n\n/**\n * Generates every config in this process, the way `kubb generate` does, and returns the output files\n * it changed. Runs after the install, so the config loads the new versions. `undefined` when the\n * config fails to load or a build fails.\n */\nasync function regenerate({\n cwd,\n configPath,\n}: {\n cwd: string\n configPath: string\n}): Promise<{ files: Array<FileChange>; unchanged: number; output: string } | undefined> {\n const spinner = createSpinner()\n spinner.start('Generating with the new versions')\n try {\n // Imported here, so the config loader and the generate path never slow down `kubb --help`.\n const [{ getConfigs }, { generate }] = await Promise.all([import('../../config.ts'), import('../generate/run.ts')])\n const { configs } = await getConfigs({ configPath })\n const dirs = configs.map((config) => path.resolve(config.root ?? cwd, config.output.path))\n const before = new Map((await Promise.all(dirs.map(readOutputFiles))).flatMap((files) => [...files]))\n const hooks = new Hookable<KubbHooks>()\n for (const config of configs) {\n if (!(await generate({ config, hooks }))) throw new Error('Generation failed')\n }\n const after = new Map((await Promise.all(dirs.map(readOutputFiles))).flatMap((files) => [...files]))\n const diff = diffFiles(before, after)\n spinner.stop(diff.files.length ? `Generated: ${pluralize(diff.files.length, 'file')} changed` : 'Generated: no files changed')\n return { ...diff, output: dirs.map((dir) => path.relative(cwd, dir) || '.').join(', ') }\n } catch (error) {\n spinner.error(`Generation failed: ${getErrorMessage(error)}`)\n return undefined\n }\n}\n\n/**\n * Moves installed extensions to the version the registry pins. Shows each version change with its\n * bump, asks which to install with majors left out, installs them, and regenerates to show which\n * files changed. With `dryRun`, only lists the updates and installs nothing.\n */\nexport async function run({ ids, dryRun, yes }: UpdateOptions): Promise<void> {\n const cwd = process.cwd()\n const hrStart = process.hrtime()\n const installedPackages: Array<string> = []\n const summary = (title: string, status: Parameters<typeof logCommandSummary>[0]['status'], lines: ReadonlyArray<string>) =>\n logCommandSummary({ title, status, hrStart, block: true, lines })\n logIntro({ title: isInteractiveRun({ yes, dryRun }) ? undefined : styleText('bgCyan', styleText('black', ' Kubb Update ')) })\n\n try {\n const wanted = new Set(ids.map(toRegistryId))\n const [entries, installed] = await withSpinner({\n message: 'Checking the registry',\n promise: Promise.all([fetchRegistryIndex({ registry: registryUrl() }), readInstalledPackages({ root: cwd })]),\n })\n const versions = new Map(installed.map((item) => [item.package, item.version]))\n\n const tracked = entries.filter((entry) => versions.has(entry.artifact.package) && (!wanted.size || wanted.has(entry.id)))\n for (const id of wanted) {\n if (tracked.some((entry) => entry.id === id)) continue\n logWarn(`${id} is not installed, or not in the registry.`)\n // A caller that named it, such as Studio, must not read the run as a successful update.\n process.exitCode = 1\n }\n\n const current = ({ artifact }: RegistryEntry) => versions.get(artifact.package)\n const isMajor = (entry: RegistryEntry) => bumpOf({ installed: current(entry), latest: entry.artifact.version }) === 'major'\n const outdated = tracked.filter((entry) => isOutdated({ installed: current(entry), latest: entry.artifact.version }))\n const proposals = outdated.filter((entry) => {\n const problem = incompatibility(entry.manifest)\n if (problem) {\n logWarn(`Skipped ${entry.id}: ${problem}`)\n // Same as a missing id: Studio would report an update that installed nothing.\n if (wanted.has(entry.id)) process.exitCode = 1\n }\n return !problem\n })\n\n if (!proposals.length) {\n const title = outdated.length ? 'No compatible updates available' : 'Already up to date'\n summary(tracked.length ? title : 'No installed extensions to update', outdated.length ? 'warning' : 'success', [\n ` ${tracked.length - outdated.length} of ${tracked.length} up to date`,\n ...(ids.length ? ['', `No updates for ${ids.join(', ')}.`] : []),\n ])\n return\n }\n\n if (tracked.length) {\n const header = ['Extension', 'Current', 'Latest', '']\n const rows = tracked.map((entry) => {\n if (!outdated.includes(entry)) return [entry.artifact.package, current(entry) ?? '-', 'up to date', '']\n const bump = bumpOf({ installed: current(entry), latest: entry.artifact.version }) ?? ''\n return [entry.artifact.package, current(entry) ?? 'not installed', entry.artifact.version, bump === 'major' ? 'major · breaking' : bump]\n })\n const lines = formatTable([header, ...rows])\n logStep(`Checked ${pluralize(tracked.length, 'extension')} against the registry`)\n logBlock([\n styleText('dim', lines[0]!),\n ...lines.slice(1).map((line, index) => {\n if (!outdated.includes(tracked[index]!)) return styleText('dim', line)\n return line.endsWith('major · breaking') ? styleText('yellow', line) : line\n }),\n ])\n }\n\n if (dryRun) {\n summary('Updates available', 'planned', [`Dry run: nothing was installed. Run kubb update to install ${proposals.length === 1 ? 'it' : 'them'}.`])\n return\n }\n\n // A major can break the generated code, so it is only picked for you when you named it.\n const defaults = proposals.filter((entry) => wanted.has(entry.id) || !isMajor(entry))\n const chosen = yes\n ? defaults.map((entry) => entry.id)\n : await clack.multiselect({\n message: 'Select the updates to install',\n options: proposals.map((entry) => ({\n value: entry.id,\n label: entry.artifact.package,\n hint: `${current(entry) ?? 'not installed'} → ${entry.artifact.version}`,\n })),\n initialValues: defaults.map((entry) => entry.id),\n required: false,\n })\n if (clack.isCancel(chosen)) {\n summary('Update canceled', 'canceled', [' No changes made'])\n return\n }\n const selected = proposals.filter((entry) => chosen.includes(entry.id))\n\n const skipped = proposals\n .filter((entry) => !selected.includes(entry))\n .map((entry) => {\n const kind = entry.manifest.kind.charAt(0).toUpperCase() + entry.manifest.kind.slice(1)\n return ` ${styleText('dim', 'Skipped')} ${kind} ${entry.artifact.package} ${entry.artifact.version} ${styleText('dim', `run kubb update ${toShortId(entry.id)} later`)}`\n })\n if (!selected.length) {\n summary('No updates installed', 'canceled', [' No updates selected.', ...skipped])\n return\n }\n\n const packageManager = detectPackageManager(cwd)\n const names = selected.map(({ artifact }) => artifact.package).join(', ')\n await installWithSpinner({\n packages: selected.map(({ artifact }) => installSpec(artifact)),\n names,\n packageManager,\n cwd,\n })\n installedPackages.push(...selected.map((entry) => entry.artifact.package))\n\n // Regenerating rewrites output files, so it is asked for. `--yes` only accepts the install.\n const foundConfig = findConfigFile(cwd)\n const regenerateNow =\n foundConfig && !yes && (await clack.confirm({ message: 'Regenerate now? This rewrites the generated files.', initialValue: true })) === true\n const configPath = regenerateNow ? foundConfig : undefined\n const changed = configPath ? await regenerate({ cwd, configPath }) : undefined\n\n const generationFailed = Boolean(configPath && !changed)\n const fileCounts = { A: 0, M: 0, D: 0 }\n for (const file of changed?.files ?? []) fileCounts[file.status]++\n summary(generationFailed ? 'Extensions updated; generation failed' : 'Update complete', generationFailed ? 'warning' : 'success', [\n ` Packages ${selected.length} installed with ${packageManager.name}${skipped.length ? ` · ${skipped.length} skipped` : ''}`,\n ...skipped,\n ...(changed ? [` Files ${fileCounts.A} added · ${fileCounts.M} modified · ${fileCounts.D} deleted`] : []),\n ...(!configPath ? [' Regeneration not run'] : []),\n ...(generationFailed ? ['', 'Fix the generation error, then run kubb generate.'] : []),\n ])\n } catch (error) {\n logError(getErrorMessage(error))\n summary('Update failed', 'failed', installedPackages.length ? [` Packages ${installedPackages.join(', ')} installed`] : [' No changes made'])\n process.exitCode = 1\n }\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'update',\n description: 'Update installed extensions, regenerate, and summarize file changes.',\n examples: ['kubb update', 'kubb update --dry-run', 'kubb update plugin-zod plugin-ts --yes'].join('\\n'),\n args: {\n ids: {\n type: 'positional',\n description: 'Registry ids to update, all installed extensions when omitted',\n multiple: true,\n },\n ...yesArg,\n },\n run: ({ values, extensions }) => run({ ids: values.ids ?? [], dryRun: extensions[dryRunId].enabled, yes: values.yes }),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,eAAe,WAAW,EACxB,KACA,cAIuF;CACvF,MAAM,UAAUA,gBAAAA,cAAc;CAC9B,QAAQ,MAAM,kCAAkC;CAChD,IAAI;EAEF,MAAM,CAAC,EAAE,cAAc,EAAE,cAAc,MAAM,QAAQ,IAAI,CAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAC,uBAAA,CAAA,CAAA,CAAA,MAAA,MAAA,EAAA,cAAA,GAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAA2B,oBAAA,CAAA,CAA4B,CAAC;EAClH,MAAM,EAAE,YAAY,MAAM,WAAW,EAAE,WAAW,CAAC;EACnD,MAAM,OAAO,QAAQ,KAAK,WAAWC,UAAAA,QAAK,QAAQ,OAAO,QAAQ,KAAK,OAAO,OAAO,IAAI,CAAC;EACzF,MAAM,SAAS,IAAI,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B;AACF;AAEA,MAAa,WAAA,GAAUoB,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aAAa;CACb,UAAU;EAAC;EAAe;EAAyB;CAAwC,CAAC,CAAC,KAAK,IAAI;CACtG,MAAM;EACJ,KAAK;GACH,MAAM;GACN,aAAa;GACb,UAAU;EACZ;EACA,GAAGC,eAAAA;CACL;CACA,MAAM,EAAE,QAAQ,iBAAiB,IAAI;EAAE,KAAK,OAAO,OAAO,CAAC;EAAG,QAAQ,WAAWC,sBAAAA,SAAS,CAAC;EAAS,KAAK,OAAO;CAAI,CAAC;AACvH,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const require_Telemetry = require("./Telemetry-
|
|
4
|
-
const
|
|
5
|
-
const require_config = require("./config-
|
|
6
|
-
const require_summary = require("./summary-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
|
|
2
|
+
const require_errors = require("./errors-BponpdjN.cjs");
|
|
3
|
+
const require_Telemetry = require("./Telemetry-B52pKz9i.cjs");
|
|
4
|
+
const require_config = require("./config-CRrmj88c.cjs");
|
|
5
|
+
const require_config$1 = require("./config-BWj9jBVj.cjs");
|
|
6
|
+
const require_summary = require("./summary-Clvl5Hxs.cjs");
|
|
7
|
+
const require_text = require("./text-Ep3AulAS.cjs");
|
|
7
8
|
let node_util = require("node:util");
|
|
8
9
|
let node_process = require("node:process");
|
|
9
10
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
10
11
|
let node_path = require("node:path");
|
|
11
12
|
let _kubb_core = require("@kubb/core");
|
|
12
|
-
|
|
13
|
+
// src/runners/validate/run.ts
|
|
13
14
|
/**
|
|
14
15
|
* Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.
|
|
15
16
|
* Exits the process with code 1 on validation failure or missing dependency.
|
|
@@ -23,7 +24,7 @@ async function run({ input, configPath }) {
|
|
|
23
24
|
let adapterName;
|
|
24
25
|
try {
|
|
25
26
|
const configFile = configPath ?? require_config.findConfigFile();
|
|
26
|
-
const loaded = configFile ? await require_config.getConfigs({
|
|
27
|
+
const loaded = configFile ? await require_config$1.getConfigs({
|
|
27
28
|
configPath: configFile,
|
|
28
29
|
input
|
|
29
30
|
}).catch((error) => {
|
|
@@ -94,7 +95,6 @@ async function run({ input, configPath }) {
|
|
|
94
95
|
node_process.default.exit(1);
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
|
-
//#endregion
|
|
98
98
|
exports.run = run;
|
|
99
99
|
|
|
100
|
-
//# sourceMappingURL=run-
|
|
100
|
+
//# sourceMappingURL=run-dMTJfs4_.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-dMTJfs4_.cjs","names":["process","trackRun","findConfigFile","getConfigs","getInputKind","resolve","checkoutGitInput","styleText","pluralize","toError"],"sources":["../src/runners/validate/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { resolve } from 'node:path'\nimport { styleText } from 'node:util'\nimport { findConfigFile } from '@internals/shared'\nimport { toError } from '@internals/utils'\nimport { type Config, checkoutGitInput, getInputKind } from '@kubb/core'\nimport { trackRun } from '../../Telemetry.ts'\nimport { getConfigs } from '../../config.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport { logCommandSummary } from '../../ui/summary.ts'\n\ntype ValidateOptions = {\n /**\n * Path, URL, or git input (`git+<repo>#<ref>:<path>`) of the specification to validate.\n */\n input: string\n configPath?: string\n}\n\n/**\n * Validates `input` with the configured adapters, falling back to OpenAPI when no config exists.\n * Exits the process with code 1 on validation failure or missing dependency.\n */\nexport async function run({ input, configPath }: ValidateOptions): Promise<void> {\n const hrStart = process.hrtime()\n const report = trackRun({ command: 'validate', hrStart })\n let adapterName: string | undefined\n\n try {\n const configFile = configPath ?? findConfigFile()\n // A config found by search that does not load must not block validating a file; an explicit `--config` still fails.\n const loaded = configFile\n ? await getConfigs({ configPath: configFile, input }).catch((error) => {\n if (configPath) throw error\n })\n : undefined\n const fallback = async () => {\n adapterName = '@kubb/adapter-oas'\n const { adapterOas } = await import('@kubb/adapter-oas')\n return [{ adapter: adapterOas(), input }]\n }\n // An array config often repeats one adapter, so each adapter and input pair is validated once.\n const unique = new Map(\n (loaded?.configs ?? []).map((config) => {\n const resolved = getInputKind(input) === 'file' ? resolve(config.root || process.cwd(), input) : input\n return [`${config.adapter?.name}\\0${resolved}`, { adapter: config.adapter, input: resolved }] as const\n }),\n )\n const targets: Array<{ adapter: Config['adapter']; input: string }> = loaded ? [...unique.values()] : await fallback()\n if (!targets.length) throw new Error('The Kubb config contains no configurations to validate.')\n for (const target of targets) {\n adapterName = target.adapter?.name\n if (!target.adapter) throw new Error('No adapter is configured. Set adapter in your Kubb config to validate this specification.')\n const checkout = getInputKind(target.input) === 'git' ? await checkoutGitInput(target.input) : undefined\n try {\n await target.adapter.validate(checkout?.path ?? target.input, { throwOnError: true })\n } finally {\n await checkout?.dispose()\n }\n }\n const specifications = new Set(targets.map((target) => target.input)).size\n const adapterNames = [...new Set(targets.flatMap((target) => target.adapter?.name ?? []))]\n await report({ status: 'success' })\n\n logCommandSummary({\n title: 'Validation passed',\n status: 'success',\n hrStart,\n lines: [\n ` ${styleText('bold', `${pluralize(specifications, 'specification')} validated`)}`,\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', adapterNames.length === 1 ? 'Adapter' : 'Adapters')} ${adapterNames.join(', ')}`,\n ],\n })\n } catch (error) {\n await report({ status: 'failed' })\n const message = toError(error).message\n const missingAdapter = adapterName === '@kubb/adapter-oas' && /(?:Cannot find|Cannot resolve|not found)[\\s\\S]*@kubb\\/adapter-oas/.test(message)\n logCommandSummary({\n title: missingAdapter ? 'Could not validate' : 'Validation failed',\n status: 'failed',\n hrStart,\n lines: [\n ` ${styleText('dim', 'Input')} ${styleText('cyan', input)}`,\n ` ${styleText('dim', 'Adapter')} ${adapterName ?? 'not configured'}${missingAdapter ? ' · not installed' : ''}`,\n '',\n styleText('bold', missingAdapter ? 'Required package' : 'Validation error'),\n ` ${styleText('red', message)}`,\n ...(missingAdapter\n ? ['', 'Install it with:', styleText('cyan', ' npm install @kubb/adapter-oas'), styleText('cyan', ' pnpm add @kubb/adapter-oas')]\n : []),\n ],\n })\n\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,eAAsB,IAAI,EAAE,OAAO,cAA8C;CAC/E,MAAM,UAAUA,aAAAA,QAAQ,OAAO;CAC/B,MAAM,SAASC,kBAAAA,SAAS;EAAE,SAAS;EAAY;CAAQ,CAAC;CACxD,IAAI;CAEJ,IAAI;EACF,MAAM,aAAa,cAAcC,eAAAA,eAAe;EAEhD,MAAM,SAAS,aACX,MAAMC,iBAAAA,WAAW;GAAE,YAAY;GAAY;EAAM,CAAC,CAAC,CAAC,OAAO,UAAU;GACnE,IAAI,YAAY,MAAM;EACxB,CAAC,IACD,KAAA;EACJ,MAAM,WAAW,YAAY;GAC3B,cAAc;GACd,MAAM,EAAE,eAAe,MAAM,OAAO;GACpC,OAAO,CAAC;IAAE,SAAS,WAAW;IAAG;GAAM,CAAC;EAC1C;EAEA,MAAM,SAAS,IAAI,KAChB,QAAQ,WAAW,CAAC,EAAA,CAAG,KAAK,WAAW;GACtC,MAAM,YAAA,GAAWC,WAAAA,aAAAA,CAAa,KAAK,MAAM,UAAA,GAASC,UAAAA,QAAAA,CAAQ,OAAO,QAAQL,aAAAA,QAAQ,IAAI,GAAG,KAAK,IAAI;GACjG,OAAO,CAAC,GAAG,OAAO,SAAS,KAAK,IAAI,YAAY;IAAE,SAAS,OAAO;IAAS,OAAO;GAAS,CAAC;EAC9F,CAAC,CACH;EACA,MAAM,UAAgE,SAAS,CAAC,GAAG,OAAO,OAAO,CAAC,IAAI,MAAM,SAAS;EACrH,IAAI,CAAC,QAAQ,QAAQ,MAA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uBAAuB;GAC/C,QAAQ;GACR;GACA,OAAO;IACL,MAAA,GAAKF,UAAAA,UAAAA,CAAU,OAAO,OAAO,EAAE,OAAA,GAAMA,UAAAA,UAAAA,CAAU,QAAQ,KAAK;IAC5D,MAAA,GAAKA,UAAAA,UAAAA,CAAU,OAAO,SAAS,EAAE,IAAI,eAAe,mBAAmB,iBAAiB,qBAAqB;IAC7G;KACAA,GAAAA,UAAAA,UAAAA,CAAU,QAAQ,iBAAiB,qBAAqB,kBAAkB;IAC1E,MAAA,GAAKA,UAAAA,UAAAA,CAAU,OAAO,OAAO;IAC7B,GAAI,iBACA;KAAC;KAAI;MAAoBA,GAAAA,UAAAA,UAAAA,CAAU,QAAQ,iCAAiC;MAAGA,GAAAA,UAAAA,UAAAA,CAAU,QAAQ,8BAA8B;IAAC,IAChI,CAAC;GACP;EACF,CAAC;EAED,aAAA,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const require_rolldown_runtime = require("./rolldown-runtime-
|
|
2
|
-
const require_errors = require("./errors-
|
|
3
|
-
const require_Telemetry = require("./Telemetry-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
|
|
2
|
+
const require_errors = require("./errors-BponpdjN.cjs");
|
|
3
|
+
const require_Telemetry = require("./Telemetry-B52pKz9i.cjs");
|
|
4
4
|
let node_util = require("node:util");
|
|
5
5
|
let node_process = require("node:process");
|
|
6
6
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
7
|
-
|
|
7
|
+
// src/runners/mcp/run.ts
|
|
8
8
|
/**
|
|
9
9
|
* Starts the `@kubb/mcp` server over stdio and reports the outcome to telemetry.
|
|
10
10
|
*/
|
|
@@ -27,7 +27,6 @@ async function run() {
|
|
|
27
27
|
node_process.default.exitCode = 1;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
//#endregion
|
|
31
30
|
exports.run = run;
|
|
32
31
|
|
|
33
|
-
//# sourceMappingURL=run-
|
|
32
|
+
//# sourceMappingURL=run-uPA5s3rI.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-
|
|
1
|
+
{"version":3,"file":"run-uPA5s3rI.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 const server = startMcpServer()\n // Report once the client introduces itself, so the event names the client (e.g. `claude-code`, `cursor-vscode`).\n server.on('initialize', ({ clientInfo }) => void report({ status: 'success', mcpClient: clientInfo.name }), { once: true })\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;EAG7F,eAAK,CAAC,CAAC,GAAG,eAAe,EAAE,iBAAiB,KAAK,OAAO;GAAE,QAAQ;GAAW,WAAW,WAAW;EAAK,CAAC,GAAG,EAAE,MAAM,KAAK,CAAC;CAC5H,SAAS,OAAO;EACd,MAAM,OAAO,EAAE,QAAQ,SAAS,CAAC;EACjC,QAAQ,MAAMC,eAAAA,QAAQ,KAAK,CAAC,CAAC,OAAO;EACpC,aAAA,QAAA,WAAmB;CACrB;AACF"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
require("@gunshi/plugin-dryrun");
|
|
2
|
+
// src/commands/shared.ts
|
|
3
|
+
const configArg = { config: {
|
|
4
|
+
type: "string",
|
|
5
|
+
description: "Path to the Kubb config",
|
|
6
|
+
short: "c"
|
|
7
|
+
} };
|
|
8
|
+
const yesArg = { yes: {
|
|
9
|
+
type: "boolean",
|
|
10
|
+
description: "Skip the confirmation",
|
|
11
|
+
short: "y",
|
|
12
|
+
default: false
|
|
13
|
+
} };
|
|
14
|
+
const logLevelArg = { logLevel: {
|
|
15
|
+
type: "enum",
|
|
16
|
+
choices: [
|
|
17
|
+
"silent",
|
|
18
|
+
"info",
|
|
19
|
+
"verbose"
|
|
20
|
+
],
|
|
21
|
+
description: "Info, silent or verbose",
|
|
22
|
+
short: "l",
|
|
23
|
+
default: "info",
|
|
24
|
+
toKebab: true
|
|
25
|
+
} };
|
|
26
|
+
const studioConnectionArgs = {
|
|
27
|
+
url: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Base URL of the Kubb Studio instance"
|
|
30
|
+
},
|
|
31
|
+
token: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const studioPermissionArgs = {
|
|
37
|
+
allowRead: {
|
|
38
|
+
type: "boolean",
|
|
39
|
+
description: "Read the source of files a generation produced. Asked for once per project when omitted",
|
|
40
|
+
default: false,
|
|
41
|
+
toKebab: true
|
|
42
|
+
},
|
|
43
|
+
allowReadAst: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Read the parsed spec (the Kubb AST). Asked for once per project when omitted",
|
|
46
|
+
default: false,
|
|
47
|
+
toKebab: true
|
|
48
|
+
},
|
|
49
|
+
allowWrite: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Write generated files to disk. Asked for once per project when omitted",
|
|
52
|
+
default: false,
|
|
53
|
+
toKebab: true
|
|
54
|
+
},
|
|
55
|
+
allowConfigEdit: {
|
|
56
|
+
type: "boolean",
|
|
57
|
+
description: "Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted",
|
|
58
|
+
default: false,
|
|
59
|
+
toKebab: true
|
|
60
|
+
},
|
|
61
|
+
allowInstall: {
|
|
62
|
+
type: "boolean",
|
|
63
|
+
description: "Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
64
|
+
default: false,
|
|
65
|
+
toKebab: true
|
|
66
|
+
},
|
|
67
|
+
allowUpdate: {
|
|
68
|
+
type: "boolean",
|
|
69
|
+
description: "Let Studio update installed extensions with kubb update. Asked for once per project when omitted",
|
|
70
|
+
default: false,
|
|
71
|
+
toKebab: true
|
|
72
|
+
},
|
|
73
|
+
allowRemove: {
|
|
74
|
+
type: "boolean",
|
|
75
|
+
description: "Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
76
|
+
default: false,
|
|
77
|
+
toKebab: true
|
|
78
|
+
},
|
|
79
|
+
allowSaveInput: {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
description: "Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
82
|
+
default: false,
|
|
83
|
+
toKebab: true
|
|
84
|
+
},
|
|
85
|
+
allowExec: {
|
|
86
|
+
type: "boolean",
|
|
87
|
+
description: "Run the formatter, the linter, and output.postGenerate after a generation",
|
|
88
|
+
default: false,
|
|
89
|
+
toKebab: true
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
Object.defineProperty(exports, "configArg", {
|
|
93
|
+
enumerable: true,
|
|
94
|
+
get: function() {
|
|
95
|
+
return configArg;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "logLevelArg", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function() {
|
|
101
|
+
return logLevelArg;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
Object.defineProperty(exports, "studioConnectionArgs", {
|
|
105
|
+
enumerable: true,
|
|
106
|
+
get: function() {
|
|
107
|
+
return studioConnectionArgs;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "studioPermissionArgs", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: function() {
|
|
113
|
+
return studioPermissionArgs;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
Object.defineProperty(exports, "yesArg", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function() {
|
|
119
|
+
return yesArg;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=shared-C0EtrdUm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-C0EtrdUm.cjs","names":[],"sources":["../src/commands/shared.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowReadAst: {\n type: 'boolean',\n description: 'Read the parsed spec (the Kubb AST). Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowInstall: {\n type: 'boolean',\n description: 'Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowUpdate: {\n type: 'boolean',\n description: 'Let Studio update installed extensions with kubb update. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowRemove: {\n type: 'boolean',\n description:\n 'Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowSaveInput: {\n type: 'boolean',\n description: 'Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n"],"mappings":";;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aACE;EACF,SAAS;EACT,SAAS;CACX;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { pluginId as dryRunId } from "@gunshi/plugin-dryrun";
|
|
2
|
+
// src/commands/shared.ts
|
|
3
|
+
const configArg = { config: {
|
|
4
|
+
type: "string",
|
|
5
|
+
description: "Path to the Kubb config",
|
|
6
|
+
short: "c"
|
|
7
|
+
} };
|
|
8
|
+
const yesArg = { yes: {
|
|
9
|
+
type: "boolean",
|
|
10
|
+
description: "Skip the confirmation",
|
|
11
|
+
short: "y",
|
|
12
|
+
default: false
|
|
13
|
+
} };
|
|
14
|
+
const logLevelArg = { logLevel: {
|
|
15
|
+
type: "enum",
|
|
16
|
+
choices: [
|
|
17
|
+
"silent",
|
|
18
|
+
"info",
|
|
19
|
+
"verbose"
|
|
20
|
+
],
|
|
21
|
+
description: "Info, silent or verbose",
|
|
22
|
+
short: "l",
|
|
23
|
+
default: "info",
|
|
24
|
+
toKebab: true
|
|
25
|
+
} };
|
|
26
|
+
const studioConnectionArgs = {
|
|
27
|
+
url: {
|
|
28
|
+
type: "string",
|
|
29
|
+
description: "Base URL of the Kubb Studio instance"
|
|
30
|
+
},
|
|
31
|
+
token: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const studioPermissionArgs = {
|
|
37
|
+
allowRead: {
|
|
38
|
+
type: "boolean",
|
|
39
|
+
description: "Read the source of files a generation produced. Asked for once per project when omitted",
|
|
40
|
+
default: false,
|
|
41
|
+
toKebab: true
|
|
42
|
+
},
|
|
43
|
+
allowReadAst: {
|
|
44
|
+
type: "boolean",
|
|
45
|
+
description: "Read the parsed spec (the Kubb AST). Asked for once per project when omitted",
|
|
46
|
+
default: false,
|
|
47
|
+
toKebab: true
|
|
48
|
+
},
|
|
49
|
+
allowWrite: {
|
|
50
|
+
type: "boolean",
|
|
51
|
+
description: "Write generated files to disk. Asked for once per project when omitted",
|
|
52
|
+
default: false,
|
|
53
|
+
toKebab: true
|
|
54
|
+
},
|
|
55
|
+
allowConfigEdit: {
|
|
56
|
+
type: "boolean",
|
|
57
|
+
description: "Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted",
|
|
58
|
+
default: false,
|
|
59
|
+
toKebab: true
|
|
60
|
+
},
|
|
61
|
+
allowInstall: {
|
|
62
|
+
type: "boolean",
|
|
63
|
+
description: "Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
64
|
+
default: false,
|
|
65
|
+
toKebab: true
|
|
66
|
+
},
|
|
67
|
+
allowUpdate: {
|
|
68
|
+
type: "boolean",
|
|
69
|
+
description: "Let Studio update installed extensions with kubb update. Asked for once per project when omitted",
|
|
70
|
+
default: false,
|
|
71
|
+
toKebab: true
|
|
72
|
+
},
|
|
73
|
+
allowRemove: {
|
|
74
|
+
type: "boolean",
|
|
75
|
+
description: "Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
76
|
+
default: false,
|
|
77
|
+
toKebab: true
|
|
78
|
+
},
|
|
79
|
+
allowSaveInput: {
|
|
80
|
+
type: "boolean",
|
|
81
|
+
description: "Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted",
|
|
82
|
+
default: false,
|
|
83
|
+
toKebab: true
|
|
84
|
+
},
|
|
85
|
+
allowExec: {
|
|
86
|
+
type: "boolean",
|
|
87
|
+
description: "Run the formatter, the linter, and output.postGenerate after a generation",
|
|
88
|
+
default: false,
|
|
89
|
+
toKebab: true
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
export { studioPermissionArgs as a, studioConnectionArgs as i, dryRunId as n, yesArg as o, logLevelArg as r, configArg as t };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=shared-Ct9stKpp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-Ct9stKpp.js","names":[],"sources":["../src/commands/shared.ts"],"sourcesContent":["import { pluginId as dryRunId } from '@gunshi/plugin-dryrun'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\n\nexport { dryRunId }\n\n/** Extension shape gunshi's command context carries with `@gunshi/plugin-dryrun`; the `extensions` type parameter of `defineWithTypes`. */\nexport type DryRunExtensions = {\n [dryRunId]: DryRunExtension\n}\n\nexport const configArg = {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n} as const\n\nexport const yesArg = {\n yes: {\n type: 'boolean',\n description: 'Skip the confirmation',\n short: 'y',\n default: false,\n },\n} as const\n\nexport const logLevelArg = {\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n toKebab: true,\n },\n} as const\n\nexport const studioConnectionArgs = {\n url: {\n type: 'string',\n description: 'Base URL of the Kubb Studio instance',\n },\n token: {\n type: 'string',\n description: 'Organization CI API key for `snapshot`. Defaults to KUBB_TOKEN',\n },\n} as const\n\nexport const studioPermissionArgs = {\n allowRead: {\n type: 'boolean',\n description: 'Read the source of files a generation produced. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowReadAst: {\n type: 'boolean',\n description: 'Read the parsed spec (the Kubb AST). Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowWrite: {\n type: 'boolean',\n description: 'Write generated files to disk. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowConfigEdit: {\n type: 'boolean',\n description: 'Let Studio change plugin options in kubb.config.ts. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowInstall: {\n type: 'boolean',\n description: 'Let Studio install extensions from the registry with kubb add; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowUpdate: {\n type: 'boolean',\n description: 'Let Studio update installed extensions with kubb update. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowRemove: {\n type: 'boolean',\n description:\n 'Let Studio remove extensions with kubb remove, which edits kubb.config.ts and uninstalls packages; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowSaveInput: {\n type: 'boolean',\n description: 'Let Studio save the spec it sends as the input in kubb.config.ts; needs --allow-config-edit too. Asked for once per project when omitted',\n default: false,\n toKebab: true,\n },\n allowExec: {\n type: 'boolean',\n description: 'Run the formatter, the linter, and output.postGenerate after a generation',\n default: false,\n toKebab: true,\n },\n} as const\n"],"mappings":";;AAUA,MAAa,YAAY,EACvB,QAAQ;CACN,MAAM;CACN,aAAa;CACb,OAAO;AACT,EACF;AAEA,MAAa,SAAS,EACpB,KAAK;CACH,MAAM;CACN,aAAa;CACb,OAAO;CACP,SAAS;AACX,EACF;AAEA,MAAa,cAAc,EACzB,UAAU;CACR,MAAM;CACN,SAAS;EAAC;EAAU;EAAQ;CAAS;CACrC,aAAa;CACb,OAAO;CACP,SAAS;CACT,SAAS;AACX,EACF;AAEA,MAAa,uBAAuB;CAClC,KAAK;EACH,MAAM;EACN,aAAa;CACf;CACA,OAAO;EACL,MAAM;EACN,aAAa;CACf;AACF;AAEA,MAAa,uBAAuB;CAClC,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,iBAAiB;EACf,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,cAAc;EACZ,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,aAAa;EACX,MAAM;EACN,aACE;EACF,SAAS;EACT,SAAS;CACX;CACA,gBAAgB;EACd,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;CACA,WAAW;EACT,MAAM;EACN,aAAa;EACb,SAAS;EACT,SAAS;CACX;AACF"}
|