@kubb/cli 5.9.2 → 5.9.4
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-ByFeVTz5.cjs +314 -0
- package/dist/Telemetry-ByFeVTz5.cjs.map +1 -0
- package/dist/Telemetry-E_BBHmnT.js +259 -0
- package/dist/Telemetry-E_BBHmnT.js.map +1 -0
- package/dist/background-CZ2nVKwB.js +1 -0
- package/dist/{background-Bh4FDWa3.cjs → background-DdUVvDwi.cjs} +7 -6
- package/dist/{background-Bh4FDWa3.cjs.map → background-DdUVvDwi.cjs.map} +1 -1
- package/dist/{background-B0YbkZ0s.js → background-H30JH70B.js} +3 -2
- package/dist/{background-B0YbkZ0s.js.map → background-H30JH70B.js.map} +1 -1
- package/dist/{reporters-B4rZOlo8.cjs → config-Ck2JHe5r.cjs} +36 -4
- package/dist/config-Ck2JHe5r.cjs.map +1 -0
- package/dist/{reporters-H21Jvrff.js → config-DxePdyxe.js} +29 -3
- package/dist/config-DxePdyxe.js.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 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +697 -206
- package/dist/index.js.map +1 -1
- package/dist/{output-BnK0scpX.cjs → output-Cd3Kmvo0.cjs} +141 -66
- package/dist/output-Cd3Kmvo0.cjs.map +1 -0
- package/dist/{output-qFt4vV7K.js → output-DS5hyqwL.js} +173 -129
- package/dist/output-DS5hyqwL.js.map +1 -0
- package/dist/{registry-B7BvdrGE.js → registry-CSXUuuCy.js} +2 -2
- package/dist/{registry-B7BvdrGE.js.map → registry-CSXUuuCy.js.map} +1 -1
- package/dist/{registry-DER9aRyg.cjs → registry-CrvQxnxy.cjs} +6 -6
- package/dist/{registry-DER9aRyg.cjs.map → registry-CrvQxnxy.cjs.map} +1 -1
- package/dist/rolldown-runtime-CPE0t6oh.cjs +53 -0
- package/dist/{run-BcMMYk7G.js → run-BPD5Vaon.js} +5 -7
- package/dist/{run-BcMMYk7G.js.map → run-BPD5Vaon.js.map} +1 -1
- package/dist/{run-e8gMz1M_.cjs → run-C0Tfrddq.cjs} +5 -6
- package/dist/{run-e8gMz1M_.cjs.map → run-C0Tfrddq.cjs.map} +1 -1
- package/dist/{run-fg0ycsS_.cjs → run-CbN00IHp.cjs} +16 -18
- package/dist/{run-fg0ycsS_.cjs.map → run-CbN00IHp.cjs.map} +1 -1
- package/dist/{run-KLPSFEv-.js → run-CecrPSop.js} +2 -3
- package/dist/{run-KLPSFEv-.js.map → run-CecrPSop.js.map} +1 -1
- package/dist/{run-BCswmM8Q.js → run-Ck04_W4q.js} +2 -3
- package/dist/{run-BCswmM8Q.js.map → run-Ck04_W4q.js.map} +1 -1
- package/dist/{run-BQQhNg8I.js → run-DcP1czVQ.js} +25 -84
- package/dist/run-DcP1czVQ.js.map +1 -0
- package/dist/{run-D8EJ2hKI.cjs → run-Dyc52IzX.cjs} +5 -6
- package/dist/{run-D8EJ2hKI.cjs.map → run-Dyc52IzX.cjs.map} +1 -1
- package/dist/{run-C8dyBAPb.cjs → run-QqLDhthl.cjs} +46 -158
- package/dist/run-QqLDhthl.cjs.map +1 -0
- package/dist/run-WkXSXG2V.js +1 -0
- package/dist/{snapshot-B45A4RfA.cjs → snapshot-NGLcfG6E.cjs} +17 -26
- package/dist/snapshot-NGLcfG6E.cjs.map +1 -0
- package/dist/{snapshot-C0WaZZiF.js → snapshot-iEjgROga.js} +15 -24
- package/dist/snapshot-iEjgROga.js.map +1 -0
- package/dist/studioWorker.js +2 -2
- package/package.json +7 -8
- package/dist/Telemetry-B_C4MVJd.cjs +0 -231
- package/dist/Telemetry-B_C4MVJd.cjs.map +0 -1
- package/dist/Telemetry-DER8LIO5.js +0 -207
- package/dist/Telemetry-DER8LIO5.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-DSKoOwcG.js +0 -1
- package/dist/commands-BegVe5Mt.js +0 -81
- package/dist/commands-BegVe5Mt.js.map +0 -1
- package/dist/commands-hXDwA0zn.cjs +0 -87
- package/dist/commands-hXDwA0zn.cjs.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-89YfZJuo.cjs +0 -67
- package/dist/run-89YfZJuo.cjs.map +0 -1
- package/dist/run-8HrdMihy.js +0 -1
- package/dist/run-BQQhNg8I.js.map +0 -1
- package/dist/run-BYff_byB.js +0 -71
- package/dist/run-BYff_byB.js.map +0 -1
- package/dist/run-C8dyBAPb.cjs.map +0 -1
- package/dist/run-CJHsZZB8.js +0 -178
- package/dist/run-CJHsZZB8.js.map +0 -1
- package/dist/run-Ca_OX3WZ.js +0 -105
- package/dist/run-Ca_OX3WZ.js.map +0 -1
- package/dist/run-Ct6kzKpg.cjs +0 -109
- package/dist/run-Ct6kzKpg.cjs.map +0 -1
- package/dist/run-DL2wLwBZ.cjs +0 -182
- package/dist/run-DL2wLwBZ.cjs.map +0 -1
- package/dist/run-Dej-hm91.js +0 -65
- package/dist/run-Dej-hm91.js.map +0 -1
- package/dist/run-DpAMfkm5.cjs +0 -72
- package/dist/run-DpAMfkm5.cjs.map +0 -1
- package/dist/snapshot-B45A4RfA.cjs.map +0 -1
- package/dist/snapshot-C0WaZZiF.js.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,207 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { i as isCIEnvironment, r as getElapsedMs, t as getAgentName } from "./agent-BPIqnEl2.js";
|
|
3
|
-
import { randomBytes } from "node:crypto";
|
|
4
|
-
import os from "node:os";
|
|
5
|
-
import process$1 from "node:process";
|
|
6
|
-
//#region ../../internals/utils/src/runtime.ts
|
|
7
|
-
const isBun = typeof Bun !== "undefined";
|
|
8
|
-
const isDeno = "Deno" in globalThis;
|
|
9
|
-
/**
|
|
10
|
-
* The JavaScript runtime executing the current process: its name, version and whether it is Bun.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
const runtime = {
|
|
18
|
-
isBun,
|
|
19
|
-
...detect()
|
|
20
|
-
};
|
|
21
|
-
function detect() {
|
|
22
|
-
if (isBun) return {
|
|
23
|
-
name: "bun",
|
|
24
|
-
version: process.versions.bun ?? ""
|
|
25
|
-
};
|
|
26
|
-
if (isDeno) return {
|
|
27
|
-
name: "deno",
|
|
28
|
-
version: globalThis.Deno?.version?.deno ?? ""
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
name: "node",
|
|
32
|
-
version: process.versions?.node ?? ""
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region package.json
|
|
37
|
-
var version = "5.9.2";
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/Telemetry.ts
|
|
40
|
-
/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */
|
|
41
|
-
const OTLP_ENDPOINT = "https://otlp.kubb.dev";
|
|
42
|
-
/**
|
|
43
|
-
* Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.
|
|
44
|
-
*/
|
|
45
|
-
function isDisabled() {
|
|
46
|
-
return ["DO_NOT_TRACK", "KUBB_DISABLE_TELEMETRY"].some((name) => ["1", "true"].includes(process$1.env[name] ?? ""));
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Build an anonymous telemetry payload from a completed generation run.
|
|
50
|
-
*/
|
|
51
|
-
function buildTelemetryEvent(options) {
|
|
52
|
-
const duration = Math.round(getElapsedMs(options.hrStart));
|
|
53
|
-
return {
|
|
54
|
-
command: options.command,
|
|
55
|
-
kubbVersion: options.kubbVersion,
|
|
56
|
-
nodeVersion: process$1.versions.node.split(".")[0],
|
|
57
|
-
runtime: runtime.name,
|
|
58
|
-
runtimeVersion: runtime.version.split(".")[0],
|
|
59
|
-
platform: os.platform(),
|
|
60
|
-
ci: isCIEnvironment(),
|
|
61
|
-
agent: getAgentName(),
|
|
62
|
-
plugins: options.plugins ?? [],
|
|
63
|
-
duration,
|
|
64
|
-
filesCreated: options.filesCreated ?? 0,
|
|
65
|
-
status: options.status
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/** Tracks one command run for the running CLI version; returns the reporter the command calls once it knows how it ended. */
|
|
69
|
-
function trackRun({ command, hrStart }) {
|
|
70
|
-
return (result) => sendTelemetry(buildTelemetryEvent({
|
|
71
|
-
command,
|
|
72
|
-
kubbVersion: version,
|
|
73
|
-
hrStart,
|
|
74
|
-
...result
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.
|
|
79
|
-
*
|
|
80
|
-
* @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/
|
|
81
|
-
*/
|
|
82
|
-
function buildOtlpPayload(event) {
|
|
83
|
-
const traceId = randomBytes(16).toString("hex");
|
|
84
|
-
const spanId = randomBytes(8).toString("hex");
|
|
85
|
-
const endTimeNs = BigInt(Date.now()) * 1000000n;
|
|
86
|
-
const startTimeNs = endTimeNs - BigInt(event.duration) * 1000000n;
|
|
87
|
-
const pluginNames = [...new Set(event.plugins.map((plugin) => plugin.name))].sort();
|
|
88
|
-
const attributes = [
|
|
89
|
-
{
|
|
90
|
-
key: "kubb.command",
|
|
91
|
-
value: { stringValue: event.command }
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
key: "kubb.version",
|
|
95
|
-
value: { stringValue: event.kubbVersion }
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
key: "kubb.node_version",
|
|
99
|
-
value: { stringValue: event.nodeVersion }
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
key: "kubb.runtime",
|
|
103
|
-
value: { stringValue: event.runtime }
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
key: "kubb.runtime_version",
|
|
107
|
-
value: { stringValue: event.runtimeVersion }
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
key: "kubb.platform",
|
|
111
|
-
value: { stringValue: event.platform }
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
key: "kubb.ci",
|
|
115
|
-
value: { boolValue: event.ci }
|
|
116
|
-
},
|
|
117
|
-
...event.agent ? [{
|
|
118
|
-
key: "kubb.agent",
|
|
119
|
-
value: { stringValue: event.agent }
|
|
120
|
-
}] : [],
|
|
121
|
-
{
|
|
122
|
-
key: "kubb.files_created",
|
|
123
|
-
value: { intValue: event.filesCreated }
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
key: "kubb.status",
|
|
127
|
-
value: { stringValue: event.status }
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
key: "kubb.plugins",
|
|
131
|
-
value: { arrayValue: { values: pluginNames.map((name) => ({ stringValue: name })) } }
|
|
132
|
-
},
|
|
133
|
-
...pluginNames.map((name) => ({
|
|
134
|
-
key: `kubb.plugin.${name}`,
|
|
135
|
-
value: { boolValue: true }
|
|
136
|
-
})),
|
|
137
|
-
{
|
|
138
|
-
key: "kubb.plugin_options",
|
|
139
|
-
value: { arrayValue: { values: event.plugins.map((p) => ({ kvlistValue: { values: [{
|
|
140
|
-
key: "name",
|
|
141
|
-
value: { stringValue: p.name }
|
|
142
|
-
}, {
|
|
143
|
-
key: "options",
|
|
144
|
-
value: { stringValue: JSON.stringify({
|
|
145
|
-
...p.options,
|
|
146
|
-
usedEnumNames: void 0
|
|
147
|
-
}) }
|
|
148
|
-
}] } })) } }
|
|
149
|
-
}
|
|
150
|
-
];
|
|
151
|
-
return { resourceSpans: [{
|
|
152
|
-
resource: { attributes: [
|
|
153
|
-
{
|
|
154
|
-
key: "service.name",
|
|
155
|
-
value: { stringValue: "kubb" }
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
key: "service.version",
|
|
159
|
-
value: { stringValue: event.kubbVersion }
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
key: "telemetry.sdk.language",
|
|
163
|
-
value: { stringValue: "nodejs" }
|
|
164
|
-
}
|
|
165
|
-
] },
|
|
166
|
-
scopeSpans: [{
|
|
167
|
-
scope: {
|
|
168
|
-
name: "kubb-core",
|
|
169
|
-
version: event.kubbVersion
|
|
170
|
-
},
|
|
171
|
-
spans: [{
|
|
172
|
-
traceId,
|
|
173
|
-
spanId,
|
|
174
|
-
name: event.command,
|
|
175
|
-
kind: 1,
|
|
176
|
-
startTimeUnixNano: String(startTimeNs),
|
|
177
|
-
endTimeUnixNano: String(endTimeNs),
|
|
178
|
-
attributes,
|
|
179
|
-
status: { code: event.status === "success" ? 1 : 2 }
|
|
180
|
-
}]
|
|
181
|
-
}]
|
|
182
|
-
}] };
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and
|
|
186
|
-
* `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run. No file
|
|
187
|
-
* paths, OpenAPI specs, or secrets are sent.
|
|
188
|
-
*/
|
|
189
|
-
async function sendTelemetry(event) {
|
|
190
|
-
if (isDisabled()) return;
|
|
191
|
-
try {
|
|
192
|
-
await fetch(`${OTLP_ENDPOINT}/v1/traces`, {
|
|
193
|
-
method: "POST",
|
|
194
|
-
headers: {
|
|
195
|
-
"Content-Type": "application/json",
|
|
196
|
-
"Kubb-Telemetry-Version": "1",
|
|
197
|
-
"Kubb-Telemetry-Source": "kubb-cli"
|
|
198
|
-
},
|
|
199
|
-
body: JSON.stringify(buildOtlpPayload(event)),
|
|
200
|
-
signal: AbortSignal.timeout(5e3)
|
|
201
|
-
});
|
|
202
|
-
} catch (_e) {}
|
|
203
|
-
}
|
|
204
|
-
//#endregion
|
|
205
|
-
export { runtime as i, trackRun as n, version as r, isDisabled as t };
|
|
206
|
-
|
|
207
|
-
//# sourceMappingURL=Telemetry-DER8LIO5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Telemetry-DER8LIO5.js","names":["process"],"sources":["../../../internals/utils/src/runtime.ts","../package.json","../src/Telemetry.ts"],"sourcesContent":["// Bun polyfills `process.versions.node`, so detection keys off the globals instead.\nconst isBun = typeof Bun !== 'undefined'\nconst isDeno = 'Deno' in globalThis\n\n/**\n * The JavaScript runtime executing the current process: its name, version and whether it is Bun.\n *\n * @example\n * ```ts\n * runtime.name // 'bun' when run with `bun kubb`, 'node' otherwise\n * ```\n */\nexport const runtime = { isBun, ...detect() } as const\n\nfunction detect(): { name: 'bun' | 'deno' | 'node'; version: string } {\n if (isBun) return { name: 'bun', version: process.versions.bun ?? '' }\n if (isDeno) return { name: 'deno', version: (globalThis as { Deno?: { version?: { deno?: string } } }).Deno?.version?.deno ?? '' }\n return { name: 'node', version: process.versions?.node ?? '' }\n}\n","","import { randomBytes } from 'node:crypto'\nimport os from 'node:os'\nimport process from 'node:process'\nimport { getElapsedMs, isCIEnvironment, runtime } from '@internals/utils'\nimport { getAgentName } from './agent.ts'\nimport { version } from '../package.json'\n\n/** OpenTelemetry ingestion endpoint for anonymous usage telemetry. */\nconst OTLP_ENDPOINT = 'https://otlp.kubb.dev' as const\n\ntype TelemetryCommand = 'generate' | 'mcp' | 'studio' | 'validate'\n\ntype OtlpValue =\n | { stringValue: string }\n | { boolValue: boolean }\n | { intValue: number }\n | { arrayValue: { values: Array<OtlpValue> } }\n | { kvlistValue: { values: Array<OtlpKeyValue> } }\n\ntype OtlpKeyValue = {\n key: string\n value: OtlpValue\n}\n\ntype OtlpSpan = {\n traceId: string\n spanId: string\n name: string\n kind: 1\n startTimeUnixNano: string\n endTimeUnixNano: string\n attributes: Array<OtlpKeyValue>\n status: { code: 1 | 2 }\n}\n\ntype OtlpExportTraceServiceRequest = {\n resourceSpans: Array<{\n resource: { attributes: Array<OtlpKeyValue> }\n scopeSpans: Array<{\n scope: { name: string; version: string }\n spans: Array<OtlpSpan>\n }>\n }>\n}\n\n/**\n * Anonymous plugin name and options snapshot sent with each telemetry event.\n */\nexport type TelemetryPlugin = {\n /**\n * Plugin name as registered in the Kubb config, e.g. `'@kubb/plugin-ts'`.\n */\n name: string\n /**\n * Anonymized snapshot of the plugin options. Values are included but cannot be traced back to a user.\n */\n options: Record<string, unknown>\n}\n\n/**\n * Anonymous snapshot of a single Kubb run, built by {@link buildTelemetryEvent} and sent by {@link sendTelemetry}.\n */\ntype TelemetryEvent = {\n command: string\n kubbVersion: string\n /**\n * Major version of Node that executed the run, e.g. `'22'`.\n */\n nodeVersion: string\n /**\n * Name of the JavaScript runtime that executed the run, `'bun'`, `'deno'`, or `'node'`.\n */\n runtime: string\n /**\n * Major version of the active runtime, e.g. `'1'` under Bun or `'22'` under Node.\n */\n runtimeVersion: string\n platform: string\n ci: boolean\n /**\n * Name of the detected AI coding agent (e.g. `'claude'`, `'cursor'`), when the CLI is invoked\n * by one. `undefined` when run by a human or an unrecognized caller.\n */\n agent?: string\n plugins: Array<TelemetryPlugin>\n duration: number\n filesCreated: number\n status: 'success' | 'failed'\n}\n\n/**\n * Returns `true` when telemetry is disabled via `DO_NOT_TRACK` or `KUBB_DISABLE_TELEMETRY`.\n */\nexport function isDisabled(): boolean {\n return ['DO_NOT_TRACK', 'KUBB_DISABLE_TELEMETRY'].some((name) => ['1', 'true'].includes(process.env[name] ?? ''))\n}\n\n/**\n * Build an anonymous telemetry payload from a completed generation run.\n */\nexport function buildTelemetryEvent(options: {\n command: TelemetryCommand\n kubbVersion: string\n plugins?: Array<TelemetryPlugin>\n hrStart: [number, number]\n filesCreated?: number\n status: 'success' | 'failed'\n}): TelemetryEvent {\n const duration = Math.round(getElapsedMs(options.hrStart))\n\n return {\n command: options.command,\n kubbVersion: options.kubbVersion,\n nodeVersion: process.versions.node.split('.')[0] as string,\n runtime: runtime.name,\n runtimeVersion: runtime.version.split('.')[0] as string,\n platform: os.platform(),\n ci: isCIEnvironment(),\n agent: getAgentName(),\n plugins: options.plugins ?? [],\n duration,\n filesCreated: options.filesCreated ?? 0,\n status: options.status,\n }\n}\n\ntype TrackRunOptions = {\n command: TelemetryCommand\n /** `process.hrtime()` snapshot taken when the command started. */\n hrStart: [number, number]\n}\n\ntype RunResult = Pick<TelemetryEvent, 'status'> & Partial<Pick<TelemetryEvent, 'plugins' | 'filesCreated'>>\n\n/** Tracks one command run for the running CLI version; returns the reporter the command calls once it knows how it ended. */\nexport function trackRun({ command, hrStart }: TrackRunOptions): (result: RunResult) => Promise<void> {\n return (result) => sendTelemetry(buildTelemetryEvent({ command, kubbVersion: version, hrStart, ...result }))\n}\n\n/**\n * Convert a {@link TelemetryEvent} into an OTLP-compatible JSON trace payload.\n *\n * @see https://opentelemetry.io/docs/languages/sdk-configuration/otlp-exporter/\n */\nexport function buildOtlpPayload(event: TelemetryEvent): OtlpExportTraceServiceRequest {\n const traceId = randomBytes(16).toString('hex')\n const spanId = randomBytes(8).toString('hex')\n const endTimeNs = BigInt(Date.now()) * 1_000_000n\n const startTimeNs = endTimeNs - BigInt(event.duration) * 1_000_000n\n const pluginNames = [...new Set(event.plugins.map((plugin) => plugin.name))].sort()\n\n const attributes: Array<OtlpKeyValue> = [\n { key: 'kubb.command', value: { stringValue: event.command } },\n { key: 'kubb.version', value: { stringValue: event.kubbVersion } },\n { key: 'kubb.node_version', value: { stringValue: event.nodeVersion } },\n { key: 'kubb.runtime', value: { stringValue: event.runtime } },\n { key: 'kubb.runtime_version', value: { stringValue: event.runtimeVersion } },\n { key: 'kubb.platform', value: { stringValue: event.platform } },\n { key: 'kubb.ci', value: { boolValue: event.ci } },\n ...(event.agent ? [{ key: 'kubb.agent', value: { stringValue: event.agent } }] : []),\n { key: 'kubb.files_created', value: { intValue: event.filesCreated } },\n { key: 'kubb.status', value: { stringValue: event.status } },\n {\n key: 'kubb.plugins',\n value: { arrayValue: { values: pluginNames.map((name) => ({ stringValue: name })) } },\n },\n ...pluginNames.map((name) => ({ key: `kubb.plugin.${name}`, value: { boolValue: true } })),\n {\n key: 'kubb.plugin_options',\n value: {\n arrayValue: {\n values: event.plugins.map((p) => ({\n kvlistValue: {\n values: [\n { key: 'name', value: { stringValue: p.name } },\n {\n key: 'options',\n value: {\n stringValue: JSON.stringify({\n ...p.options,\n usedEnumNames: undefined,\n }),\n },\n },\n ],\n },\n })),\n },\n },\n },\n ]\n\n return {\n resourceSpans: [\n {\n resource: {\n attributes: [\n { key: 'service.name', value: { stringValue: 'kubb' } },\n {\n key: 'service.version',\n value: { stringValue: event.kubbVersion },\n },\n { key: 'telemetry.sdk.language', value: { stringValue: 'nodejs' } },\n ],\n },\n scopeSpans: [\n {\n scope: { name: 'kubb-core', version: event.kubbVersion },\n spans: [\n {\n traceId,\n spanId,\n name: event.command,\n kind: 1,\n startTimeUnixNano: String(startTimeNs),\n endTimeUnixNano: String(endTimeNs),\n attributes,\n status: {\n code: event.status === 'success' ? 1 : 2,\n },\n },\n ],\n },\n ],\n },\n ],\n }\n}\n\n/**\n * Send an anonymous telemetry event to the Kubb OTLP endpoint. Respects `DO_NOT_TRACK` and\n * `KUBB_DISABLE_TELEMETRY`, and fails silently so telemetry never interrupts a run. No file\n * paths, OpenAPI specs, or secrets are sent.\n */\nexport async function sendTelemetry(event: TelemetryEvent): Promise<void> {\n if (isDisabled()) {\n return\n }\n\n try {\n await fetch(`${OTLP_ENDPOINT}/v1/traces`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Kubb-Telemetry-Version': '1',\n 'Kubb-Telemetry-Source': 'kubb-cli',\n },\n body: JSON.stringify(buildOtlpPayload(event)),\n signal: AbortSignal.timeout(5_000),\n })\n } catch (_e) {\n // Fail silently, telemetry must never break the run\n }\n}\n"],"mappings":";;;;;;AACA,MAAM,QAAQ,OAAO,QAAQ;AAC7B,MAAM,SAAS,UAAU;;;;;;;;;AAUzB,MAAa,UAAU;CAAE;CAAO,GAAG,OAAO;AAAE;AAE5C,SAAS,SAA6D;CACpE,IAAI,OAAO,OAAO;EAAE,MAAM;EAAO,SAAS,QAAQ,SAAS,OAAO;CAAG;CACrE,IAAI,QAAQ,OAAO;EAAE,MAAM;EAAQ,SAAU,WAA0D,MAAM,SAAS,QAAQ;CAAG;CACjI,OAAO;EAAE,MAAM;EAAQ,SAAS,QAAQ,UAAU,QAAQ;CAAG;AAC/D;;;;;;;AEVA,MAAM,gBAAgB;;;;AAqFtB,SAAgB,aAAsB;CACpC,OAAO,CAAC,gBAAgB,wBAAwB,CAAC,CAAC,MAAM,SAAS,CAAC,KAAK,MAAM,CAAC,CAAC,SAASA,UAAQ,IAAI,SAAS,EAAE,CAAC;AAClH;;;;AA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AAO,WAAW;IACrC,iBAAiB,OAAO,SAAS;IACjC;IACA,QAAQ,EACN,MAAM,MAAM,WAAW,YAAY,IAAI,EACzC;GACF,CACF;EACF,CACF;CACF,CACF,EACF;AACF;;;;;;AAOA,eAAsB,cAAc,OAAsC;CACxE,IAAI,WAAW,GACb;CAGF,IAAI;EACF,MAAM,MAAM,GAAG,cAAc,aAAa;GACxC,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,0BAA0B;IAC1B,yBAAyB;GAC3B;GACA,MAAM,KAAK,UAAU,iBAAiB,KAAK,CAAC;GAC5C,QAAQ,YAAY,QAAQ,GAAK;EACnC,CAAC;CACH,SAAS,IAAI,CAEb;AACF"}
|
package/dist/agent-BPIqnEl2.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import process$1 from "node:process";
|
|
3
|
-
import { getAgentProfile } from "gunshi/agent";
|
|
4
|
-
//#region ../../internals/utils/src/isCIEnvironment.ts
|
|
5
|
-
/**
|
|
6
|
-
* Returns `true` when a known CI provider has set its environment variable.
|
|
7
|
-
* `CI=false` and `CI=0` count as not CI, so a user can opt out locally.
|
|
8
|
-
*/
|
|
9
|
-
function isCIEnvironment() {
|
|
10
|
-
const ci = process$1.env.CI;
|
|
11
|
-
return !!(ci && ci !== "false" && ci !== "0" || process$1.env.GITHUB_ACTIONS || process$1.env.GITLAB_CI || process$1.env.BITBUCKET_BUILD_NUMBER || process$1.env.JENKINS_URL || process$1.env.CIRCLECI || process$1.env.TRAVIS || process$1.env.TEAMCITY_VERSION || process$1.env.BUILDKITE || process$1.env.TF_BUILD);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region ../../internals/utils/src/time.ts
|
|
15
|
-
/**
|
|
16
|
-
* Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.
|
|
17
|
-
* Rounds to 2 decimal places for sub-millisecond precision without noise.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* const start = process.hrtime()
|
|
22
|
-
* doWork()
|
|
23
|
-
* getElapsedMs(start) // 42.35
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
function getElapsedMs(hrStart) {
|
|
27
|
-
const [seconds, nanoseconds] = process.hrtime(hrStart);
|
|
28
|
-
const ms = seconds * 1e3 + nanoseconds / 1e6;
|
|
29
|
-
return Math.round(ms * 100) / 100;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Converts a millisecond duration into a human-readable string (`ms`, `s`, or `m s`).
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* formatMs(250) // '250ms'
|
|
37
|
-
* formatMs(1500) // '1.50s'
|
|
38
|
-
* formatMs(90000) // '1m 30.0s'
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
function formatMs(ms) {
|
|
42
|
-
if (ms >= 6e4) return `${Math.floor(ms / 6e4)}m ${(ms % 6e4 / 1e3).toFixed(1)}s`;
|
|
43
|
-
if (ms >= 1e3) return `${(ms / 1e3).toFixed(2)}s`;
|
|
44
|
-
return `${Math.round(ms)}ms`;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/agent.ts
|
|
48
|
-
/**
|
|
49
|
-
* Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
|
|
50
|
-
* `'cursor'`). `undefined` when run by a human or an unrecognized caller.
|
|
51
|
-
*/
|
|
52
|
-
function getAgentName() {
|
|
53
|
-
const profile = getAgentProfile();
|
|
54
|
-
return profile.isAgent ? profile.name : void 0;
|
|
55
|
-
}
|
|
56
|
-
//#endregion
|
|
57
|
-
export { isCIEnvironment as i, formatMs as n, getElapsedMs as r, getAgentName as t };
|
|
58
|
-
|
|
59
|
-
//# sourceMappingURL=agent-BPIqnEl2.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-BPIqnEl2.js","names":["process"],"sources":["../../../internals/utils/src/isCIEnvironment.ts","../../../internals/utils/src/time.ts","../src/agent.ts"],"sourcesContent":["import process from 'node:process'\n\n/**\n * Returns `true` when a known CI provider has set its environment variable.\n * `CI=false` and `CI=0` count as not CI, so a user can opt out locally.\n */\nexport function isCIEnvironment(): boolean {\n const ci = process.env.CI\n return !!(\n (ci && ci !== 'false' && ci !== '0') ||\n process.env.GITHUB_ACTIONS ||\n process.env.GITLAB_CI ||\n process.env.BITBUCKET_BUILD_NUMBER ||\n process.env.JENKINS_URL ||\n process.env.CIRCLECI ||\n process.env.TRAVIS ||\n process.env.TEAMCITY_VERSION ||\n process.env.BUILDKITE ||\n process.env.TF_BUILD\n )\n}\n","/**\n * Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.\n * Rounds to 2 decimal places for sub-millisecond precision without noise.\n *\n * @example\n * ```ts\n * const start = process.hrtime()\n * doWork()\n * getElapsedMs(start) // 42.35\n * ```\n */\nexport function getElapsedMs(hrStart: [number, number]): number {\n const [seconds, nanoseconds] = process.hrtime(hrStart)\n const ms = seconds * 1000 + nanoseconds / 1e6\n return Math.round(ms * 100) / 100\n}\n\n/**\n * Converts a millisecond duration into a human-readable string (`ms`, `s`, or `m s`).\n *\n * @example\n * ```ts\n * formatMs(250) // '250ms'\n * formatMs(1500) // '1.50s'\n * formatMs(90000) // '1m 30.0s'\n * ```\n */\nexport function formatMs(ms: number): string {\n if (ms >= 60000) {\n const mins = Math.floor(ms / 60000)\n const secs = ((ms % 60000) / 1000).toFixed(1)\n return `${mins}m ${secs}s`\n }\n\n if (ms >= 1000) {\n return `${(ms / 1000).toFixed(2)}s`\n }\n return `${Math.round(ms)}ms`\n}\n","import { getAgentProfile } from 'gunshi/agent'\n\n/**\n * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,\n * `'cursor'`). `undefined` when run by a human or an unrecognized caller.\n */\nexport function getAgentName(): string | undefined {\n const profile = getAgentProfile()\n return profile.isAgent ? profile.name : undefined\n}\n"],"mappings":";;;;;;;;AAMA,SAAgB,kBAA2B;CACzC,MAAM,KAAKA,UAAQ,IAAI;CACvB,OAAO,CAAC,EACL,MAAM,OAAO,WAAW,OAAO,OAChCA,UAAQ,IAAI,kBACZA,UAAQ,IAAI,aACZA,UAAQ,IAAI,0BACZA,UAAQ,IAAI,eACZA,UAAQ,IAAI,YACZA,UAAQ,IAAI,UACZA,UAAQ,IAAI,oBACZA,UAAQ,IAAI,aACZA,UAAQ,IAAI;AAEhB;;;;;;;;;;;;;;ACTA,SAAgB,aAAa,SAAmC;CAC9D,MAAM,CAAC,SAAS,eAAe,QAAQ,OAAO,OAAO;CACrD,MAAM,KAAK,UAAU,MAAO,cAAc;CAC1C,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAChC;;;;;;;;;;;AAYA,SAAgB,SAAS,IAAoB;CAC3C,IAAI,MAAM,KAGR,OAAO,GAFM,KAAK,MAAM,KAAK,GAEhB,EAAE,KADA,KAAK,MAAS,IAAA,CAAM,QAAQ,CACrB,EAAE;CAG1B,IAAI,MAAM,KACR,OAAO,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE;CAEnC,OAAO,GAAG,KAAK,MAAM,EAAE,EAAE;AAC3B;;;;;;;AChCA,SAAgB,eAAmC;CACjD,MAAM,UAAU,gBAAgB;CAChC,OAAO,QAAQ,UAAU,QAAQ,OAAO,KAAA;AAC1C"}
|
package/dist/agent-DElUuYuy.cjs
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
-
get: ((k) => from[k]).bind(null, key),
|
|
17
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
//#endregion
|
|
27
|
-
let node_process = require("node:process");
|
|
28
|
-
node_process = __toESM(node_process, 1);
|
|
29
|
-
let gunshi_agent = require("gunshi/agent");
|
|
30
|
-
//#region ../../internals/utils/src/isCIEnvironment.ts
|
|
31
|
-
/**
|
|
32
|
-
* Returns `true` when a known CI provider has set its environment variable.
|
|
33
|
-
* `CI=false` and `CI=0` count as not CI, so a user can opt out locally.
|
|
34
|
-
*/
|
|
35
|
-
function isCIEnvironment() {
|
|
36
|
-
const ci = node_process.default.env.CI;
|
|
37
|
-
return !!(ci && ci !== "false" && ci !== "0" || node_process.default.env.GITHUB_ACTIONS || node_process.default.env.GITLAB_CI || node_process.default.env.BITBUCKET_BUILD_NUMBER || node_process.default.env.JENKINS_URL || node_process.default.env.CIRCLECI || node_process.default.env.TRAVIS || node_process.default.env.TEAMCITY_VERSION || node_process.default.env.BUILDKITE || node_process.default.env.TF_BUILD);
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region ../../internals/utils/src/time.ts
|
|
41
|
-
/**
|
|
42
|
-
* Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.
|
|
43
|
-
* Rounds to 2 decimal places for sub-millisecond precision without noise.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
* const start = process.hrtime()
|
|
48
|
-
* doWork()
|
|
49
|
-
* getElapsedMs(start) // 42.35
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
function getElapsedMs(hrStart) {
|
|
53
|
-
const [seconds, nanoseconds] = process.hrtime(hrStart);
|
|
54
|
-
const ms = seconds * 1e3 + nanoseconds / 1e6;
|
|
55
|
-
return Math.round(ms * 100) / 100;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Converts a millisecond duration into a human-readable string (`ms`, `s`, or `m s`).
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```ts
|
|
62
|
-
* formatMs(250) // '250ms'
|
|
63
|
-
* formatMs(1500) // '1.50s'
|
|
64
|
-
* formatMs(90000) // '1m 30.0s'
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
function formatMs(ms) {
|
|
68
|
-
if (ms >= 6e4) return `${Math.floor(ms / 6e4)}m ${(ms % 6e4 / 1e3).toFixed(1)}s`;
|
|
69
|
-
if (ms >= 1e3) return `${(ms / 1e3).toFixed(2)}s`;
|
|
70
|
-
return `${Math.round(ms)}ms`;
|
|
71
|
-
}
|
|
72
|
-
//#endregion
|
|
73
|
-
//#region src/agent.ts
|
|
74
|
-
/**
|
|
75
|
-
* Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,
|
|
76
|
-
* `'cursor'`). `undefined` when run by a human or an unrecognized caller.
|
|
77
|
-
*/
|
|
78
|
-
function getAgentName() {
|
|
79
|
-
const profile = (0, gunshi_agent.getAgentProfile)();
|
|
80
|
-
return profile.isAgent ? profile.name : void 0;
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
Object.defineProperty(exports, "__name", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function() {
|
|
86
|
-
return __name;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(exports, "__toESM", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: function() {
|
|
92
|
-
return __toESM;
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
Object.defineProperty(exports, "formatMs", {
|
|
96
|
-
enumerable: true,
|
|
97
|
-
get: function() {
|
|
98
|
-
return formatMs;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
Object.defineProperty(exports, "getAgentName", {
|
|
102
|
-
enumerable: true,
|
|
103
|
-
get: function() {
|
|
104
|
-
return getAgentName;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(exports, "getElapsedMs", {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function() {
|
|
110
|
-
return getElapsedMs;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
Object.defineProperty(exports, "isCIEnvironment", {
|
|
114
|
-
enumerable: true,
|
|
115
|
-
get: function() {
|
|
116
|
-
return isCIEnvironment;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
//# sourceMappingURL=agent-DElUuYuy.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent-DElUuYuy.cjs","names":["process","getAgentProfile"],"sources":["../../../internals/utils/src/isCIEnvironment.ts","../../../internals/utils/src/time.ts","../src/agent.ts"],"sourcesContent":["import process from 'node:process'\n\n/**\n * Returns `true` when a known CI provider has set its environment variable.\n * `CI=false` and `CI=0` count as not CI, so a user can opt out locally.\n */\nexport function isCIEnvironment(): boolean {\n const ci = process.env.CI\n return !!(\n (ci && ci !== 'false' && ci !== '0') ||\n process.env.GITHUB_ACTIONS ||\n process.env.GITLAB_CI ||\n process.env.BITBUCKET_BUILD_NUMBER ||\n process.env.JENKINS_URL ||\n process.env.CIRCLECI ||\n process.env.TRAVIS ||\n process.env.TEAMCITY_VERSION ||\n process.env.BUILDKITE ||\n process.env.TF_BUILD\n )\n}\n","/**\n * Calculates elapsed time in milliseconds from a high-resolution `process.hrtime` start time.\n * Rounds to 2 decimal places for sub-millisecond precision without noise.\n *\n * @example\n * ```ts\n * const start = process.hrtime()\n * doWork()\n * getElapsedMs(start) // 42.35\n * ```\n */\nexport function getElapsedMs(hrStart: [number, number]): number {\n const [seconds, nanoseconds] = process.hrtime(hrStart)\n const ms = seconds * 1000 + nanoseconds / 1e6\n return Math.round(ms * 100) / 100\n}\n\n/**\n * Converts a millisecond duration into a human-readable string (`ms`, `s`, or `m s`).\n *\n * @example\n * ```ts\n * formatMs(250) // '250ms'\n * formatMs(1500) // '1.50s'\n * formatMs(90000) // '1m 30.0s'\n * ```\n */\nexport function formatMs(ms: number): string {\n if (ms >= 60000) {\n const mins = Math.floor(ms / 60000)\n const secs = ((ms % 60000) / 1000).toFixed(1)\n return `${mins}m ${secs}s`\n }\n\n if (ms >= 1000) {\n return `${(ms / 1000).toFixed(2)}s`\n }\n return `${Math.round(ms)}ms`\n}\n","import { getAgentProfile } from 'gunshi/agent'\n\n/**\n * Name of the AI coding agent driving this process, when one is detected (e.g. `'claude'`,\n * `'cursor'`). `undefined` when run by a human or an unrecognized caller.\n */\nexport function getAgentName(): string | undefined {\n const profile = getAgentProfile()\n return profile.isAgent ? profile.name : undefined\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,SAAgB,kBAA2B;CACzC,MAAM,KAAKA,aAAAA,QAAQ,IAAI;CACvB,OAAO,CAAC,EACL,MAAM,OAAO,WAAW,OAAO,OAChCA,aAAAA,QAAQ,IAAI,kBACZA,aAAAA,QAAQ,IAAI,aACZA,aAAAA,QAAQ,IAAI,0BACZA,aAAAA,QAAQ,IAAI,eACZA,aAAAA,QAAQ,IAAI,YACZA,aAAAA,QAAQ,IAAI,UACZA,aAAAA,QAAQ,IAAI,oBACZA,aAAAA,QAAQ,IAAI,aACZA,aAAAA,QAAQ,IAAI;AAEhB;;;;;;;;;;;;;;ACTA,SAAgB,aAAa,SAAmC;CAC9D,MAAM,CAAC,SAAS,eAAe,QAAQ,OAAO,OAAO;CACrD,MAAM,KAAK,UAAU,MAAO,cAAc;CAC1C,OAAO,KAAK,MAAM,KAAK,GAAG,IAAI;AAChC;;;;;;;;;;;AAYA,SAAgB,SAAS,IAAoB;CAC3C,IAAI,MAAM,KAGR,OAAO,GAFM,KAAK,MAAM,KAAK,GAEhB,EAAE,KADA,KAAK,MAAS,IAAA,CAAM,QAAQ,CACrB,EAAE;CAG1B,IAAI,MAAM,KACR,OAAO,IAAI,KAAK,IAAA,CAAM,QAAQ,CAAC,EAAE;CAEnC,OAAO,GAAG,KAAK,MAAM,EAAE,EAAE;AAC3B;;;;;;;AChCA,SAAgB,eAAmC;CACjD,MAAM,WAAA,GAAUC,aAAAA,gBAAAA,CAAgB;CAChC,OAAO,QAAQ,UAAU,QAAQ,OAAO,KAAA;AAC1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as getWorkerStatus } from "./background-B0YbkZ0s.js";
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { a as login, c as clearCredentials, n as createStudioOptions, r as formatPermissionRows, s as run, t as connect, u as readCredentials } from "./run-BQQhNg8I.js";
|
|
3
|
-
import { a as stopWorker, i as startWorker, n as getWorkerStatus, t as getWorkerLogPath } from "./background-B0YbkZ0s.js";
|
|
4
|
-
import { styleText } from "node:util";
|
|
5
|
-
import process from "node:process";
|
|
6
|
-
//#region src/runners/studio/commands.ts
|
|
7
|
-
/** Reports the paired agent and any saved permissions for the current project. */
|
|
8
|
-
async function status(options) {
|
|
9
|
-
const credentials = await readCredentials();
|
|
10
|
-
if (!credentials) {
|
|
11
|
-
console.log("Not paired. Run `kubb studio login`.");
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
console.log(`Paired with ${credentials.studioUrl} as ${styleText("cyan", credentials.agentSlug || credentials.agentId)}`);
|
|
15
|
-
if (credentials.studioUrl !== options.studioUrl) console.log(styleText("yellow", `Connecting to ${options.studioUrl} needs pairing again.`));
|
|
16
|
-
const remembered = credentials.projects?.[process.cwd()];
|
|
17
|
-
if (!remembered) {
|
|
18
|
-
console.log(styleText("dim", "No saved permissions for this project. Run `kubb studio` to connect and choose."));
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
console.log(styleText("dim", "Saved permissions"));
|
|
22
|
-
for (const row of formatPermissionRows({
|
|
23
|
-
allowRead: remembered.allowRead === true,
|
|
24
|
-
allowWrite: remembered.allowWrite === true,
|
|
25
|
-
allowConfigEdit: remembered.allowConfigEdit === true,
|
|
26
|
-
allowExec: remembered.allowExec === true
|
|
27
|
-
})) console.log(row);
|
|
28
|
-
}
|
|
29
|
-
const connectRunner = async ({ values }) => {
|
|
30
|
-
const options = createStudioOptions(values);
|
|
31
|
-
await run({
|
|
32
|
-
options,
|
|
33
|
-
action: () => connect(options),
|
|
34
|
-
block: true
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
const loginRunner = async ({ values }) => {
|
|
38
|
-
const options = createStudioOptions(values);
|
|
39
|
-
await run({
|
|
40
|
-
options,
|
|
41
|
-
action: () => login(options)
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
const logoutRunner = async ({ values }) => {
|
|
45
|
-
const options = createStudioOptions(values);
|
|
46
|
-
await run({
|
|
47
|
-
options,
|
|
48
|
-
action: async () => {
|
|
49
|
-
await stopWorker();
|
|
50
|
-
await clearCredentials();
|
|
51
|
-
console.log("Signed out of Kubb Studio.");
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const startRunner = async ({ values }) => {
|
|
56
|
-
const options = createStudioOptions(values);
|
|
57
|
-
await run({
|
|
58
|
-
options,
|
|
59
|
-
action: () => startWorker(options)
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
const statusRunner = async ({ values }) => {
|
|
63
|
-
const options = createStudioOptions(values);
|
|
64
|
-
await run({
|
|
65
|
-
options,
|
|
66
|
-
action: async () => {
|
|
67
|
-
const worker = await getWorkerStatus();
|
|
68
|
-
console.log(`Background connection: ${worker.state}${worker.running ? ` (PID ${worker.pid})` : ""}`);
|
|
69
|
-
console.log(`Logs: ${getWorkerLogPath()}`);
|
|
70
|
-
await status(options);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
async function stopRunner() {
|
|
75
|
-
await stopWorker();
|
|
76
|
-
console.log("Background connection stopped.");
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
export { connectRunner, loginRunner, logoutRunner, startRunner, statusRunner, stopRunner };
|
|
80
|
-
|
|
81
|
-
//# sourceMappingURL=commands-BegVe5Mt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands-BegVe5Mt.js","names":[],"sources":["../src/runners/studio/commands.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport type { CommandRunner } from 'gunshi'\nimport type { command as connectCommand } from '../../commands/studio/connect.ts'\nimport type { command as logoutCommand } from '../../commands/studio/logout.ts'\nimport type { command as statusCommand } from '../../commands/studio/status.ts'\nimport { getWorkerLogPath, getWorkerStatus, startWorker, stopWorker } from './background.ts'\nimport { clearCredentials, readCredentials } from './credentials.ts'\nimport { connect, createStudioOptions, formatPermissionRows, login, run, type StudioOptions } from './run.ts'\n\ntype Runner<T extends { args: object }> = CommandRunner<{ args: T['args']; extensions: {} }>\n\n/** Reports the paired agent and any saved permissions for the current project. */\nasync function status(options: StudioOptions): Promise<void> {\n const credentials = await readCredentials()\n\n if (!credentials) {\n console.log('Not paired. Run `kubb studio login`.')\n\n return\n }\n\n console.log(`Paired with ${credentials.studioUrl} as ${styleText('cyan', credentials.agentSlug || credentials.agentId)}`)\n\n if (credentials.studioUrl !== options.studioUrl) {\n console.log(styleText('yellow', `Connecting to ${options.studioUrl} needs pairing again.`))\n }\n\n const remembered = credentials.projects?.[process.cwd()]\n\n if (!remembered) {\n console.log(styleText('dim', 'No saved permissions for this project. Run `kubb studio` to connect and choose.'))\n\n return\n }\n\n console.log(styleText('dim', 'Saved permissions'))\n\n for (const row of formatPermissionRows({\n allowRead: remembered.allowRead === true,\n allowWrite: remembered.allowWrite === true,\n allowConfigEdit: remembered.allowConfigEdit === true,\n allowExec: remembered.allowExec === true,\n })) {\n console.log(row)\n }\n}\n\nexport const connectRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => connect(options), block: true })\n}\n\nexport const loginRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => login(options) })\n}\n\nexport const logoutRunner: Runner<typeof logoutCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({\n options,\n action: async () => {\n await stopWorker()\n await clearCredentials()\n console.log('Signed out of Kubb Studio.')\n },\n })\n}\n\nexport const startRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => startWorker(options) })\n}\n\nexport const statusRunner: Runner<typeof statusCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({\n options,\n action: async () => {\n const worker = await getWorkerStatus()\n console.log(`Background connection: ${worker.state}${worker.running ? ` (PID ${worker.pid})` : ''}`)\n console.log(`Logs: ${getWorkerLogPath()}`)\n await status(options)\n },\n })\n}\n\nexport async function stopRunner(): Promise<void> {\n await stopWorker()\n console.log('Background connection stopped.')\n}\n"],"mappings":";;;;;;;AAaA,eAAe,OAAO,SAAuC;CAC3D,MAAM,cAAc,MAAM,gBAAgB;CAE1C,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,sCAAsC;EAElD;CACF;CAEA,QAAQ,IAAI,eAAe,YAAY,UAAU,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AQ,YAAY;GAClB,MAAM,SAAS,MAAM,gBAAgB;GACrC,QAAQ,IAAI,0BAA0B,OAAO,QAAQ,OAAO,UAAU,SAAS,OAAO,IAAI,KAAK,IAAI;GACnG,QAAQ,IAAI,SAAS,iBAAiB,GAAG;GACzC,MAAM,OAAO,OAAO;EACtB;CACF,CAAC;AACH;AAEA,eAAsB,aAA4B;CAChD,MAAM,WAAW;CACjB,QAAQ,IAAI,gCAAgC;AAC9C"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
const require_agent = require("./agent-DElUuYuy.cjs");
|
|
2
|
-
const require_run = require("./run-C8dyBAPb.cjs");
|
|
3
|
-
const require_background = require("./background-Bh4FDWa3.cjs");
|
|
4
|
-
let node_util = require("node:util");
|
|
5
|
-
let node_process = require("node:process");
|
|
6
|
-
node_process = require_agent.__toESM(node_process, 1);
|
|
7
|
-
//#region src/runners/studio/commands.ts
|
|
8
|
-
/** Reports the paired agent and any saved permissions for the current project. */
|
|
9
|
-
async function status(options) {
|
|
10
|
-
const credentials = await require_run.readCredentials();
|
|
11
|
-
if (!credentials) {
|
|
12
|
-
console.log("Not paired. Run `kubb studio login`.");
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
console.log(`Paired with ${credentials.studioUrl} as ${(0, node_util.styleText)("cyan", credentials.agentSlug || credentials.agentId)}`);
|
|
16
|
-
if (credentials.studioUrl !== options.studioUrl) console.log((0, node_util.styleText)("yellow", `Connecting to ${options.studioUrl} needs pairing again.`));
|
|
17
|
-
const remembered = credentials.projects?.[node_process.default.cwd()];
|
|
18
|
-
if (!remembered) {
|
|
19
|
-
console.log((0, node_util.styleText)("dim", "No saved permissions for this project. Run `kubb studio` to connect and choose."));
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
console.log((0, node_util.styleText)("dim", "Saved permissions"));
|
|
23
|
-
for (const row of require_run.formatPermissionRows({
|
|
24
|
-
allowRead: remembered.allowRead === true,
|
|
25
|
-
allowWrite: remembered.allowWrite === true,
|
|
26
|
-
allowConfigEdit: remembered.allowConfigEdit === true,
|
|
27
|
-
allowExec: remembered.allowExec === true
|
|
28
|
-
})) console.log(row);
|
|
29
|
-
}
|
|
30
|
-
const connectRunner = async ({ values }) => {
|
|
31
|
-
const options = require_run.createStudioOptions(values);
|
|
32
|
-
await require_run.run({
|
|
33
|
-
options,
|
|
34
|
-
action: () => require_run.connect(options),
|
|
35
|
-
block: true
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
const loginRunner = async ({ values }) => {
|
|
39
|
-
const options = require_run.createStudioOptions(values);
|
|
40
|
-
await require_run.run({
|
|
41
|
-
options,
|
|
42
|
-
action: () => require_run.login(options)
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
const logoutRunner = async ({ values }) => {
|
|
46
|
-
const options = require_run.createStudioOptions(values);
|
|
47
|
-
await require_run.run({
|
|
48
|
-
options,
|
|
49
|
-
action: async () => {
|
|
50
|
-
await require_background.stopWorker();
|
|
51
|
-
await require_run.clearCredentials();
|
|
52
|
-
console.log("Signed out of Kubb Studio.");
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
const startRunner = async ({ values }) => {
|
|
57
|
-
const options = require_run.createStudioOptions(values);
|
|
58
|
-
await require_run.run({
|
|
59
|
-
options,
|
|
60
|
-
action: () => require_background.startWorker(options)
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
const statusRunner = async ({ values }) => {
|
|
64
|
-
const options = require_run.createStudioOptions(values);
|
|
65
|
-
await require_run.run({
|
|
66
|
-
options,
|
|
67
|
-
action: async () => {
|
|
68
|
-
const worker = await require_background.getWorkerStatus();
|
|
69
|
-
console.log(`Background connection: ${worker.state}${worker.running ? ` (PID ${worker.pid})` : ""}`);
|
|
70
|
-
console.log(`Logs: ${require_background.getWorkerLogPath()}`);
|
|
71
|
-
await status(options);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
async function stopRunner() {
|
|
76
|
-
await require_background.stopWorker();
|
|
77
|
-
console.log("Background connection stopped.");
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
exports.connectRunner = connectRunner;
|
|
81
|
-
exports.loginRunner = loginRunner;
|
|
82
|
-
exports.logoutRunner = logoutRunner;
|
|
83
|
-
exports.startRunner = startRunner;
|
|
84
|
-
exports.statusRunner = statusRunner;
|
|
85
|
-
exports.stopRunner = stopRunner;
|
|
86
|
-
|
|
87
|
-
//# sourceMappingURL=commands-hXDwA0zn.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands-hXDwA0zn.cjs","names":["readCredentials","styleText","process","formatPermissionRows","createStudioOptions","run","connect","login","stopWorker","clearCredentials","startWorker","getWorkerStatus","getWorkerLogPath"],"sources":["../src/runners/studio/commands.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport type { CommandRunner } from 'gunshi'\nimport type { command as connectCommand } from '../../commands/studio/connect.ts'\nimport type { command as logoutCommand } from '../../commands/studio/logout.ts'\nimport type { command as statusCommand } from '../../commands/studio/status.ts'\nimport { getWorkerLogPath, getWorkerStatus, startWorker, stopWorker } from './background.ts'\nimport { clearCredentials, readCredentials } from './credentials.ts'\nimport { connect, createStudioOptions, formatPermissionRows, login, run, type StudioOptions } from './run.ts'\n\ntype Runner<T extends { args: object }> = CommandRunner<{ args: T['args']; extensions: {} }>\n\n/** Reports the paired agent and any saved permissions for the current project. */\nasync function status(options: StudioOptions): Promise<void> {\n const credentials = await readCredentials()\n\n if (!credentials) {\n console.log('Not paired. Run `kubb studio login`.')\n\n return\n }\n\n console.log(`Paired with ${credentials.studioUrl} as ${styleText('cyan', credentials.agentSlug || credentials.agentId)}`)\n\n if (credentials.studioUrl !== options.studioUrl) {\n console.log(styleText('yellow', `Connecting to ${options.studioUrl} needs pairing again.`))\n }\n\n const remembered = credentials.projects?.[process.cwd()]\n\n if (!remembered) {\n console.log(styleText('dim', 'No saved permissions for this project. Run `kubb studio` to connect and choose.'))\n\n return\n }\n\n console.log(styleText('dim', 'Saved permissions'))\n\n for (const row of formatPermissionRows({\n allowRead: remembered.allowRead === true,\n allowWrite: remembered.allowWrite === true,\n allowConfigEdit: remembered.allowConfigEdit === true,\n allowExec: remembered.allowExec === true,\n })) {\n console.log(row)\n }\n}\n\nexport const connectRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => connect(options), block: true })\n}\n\nexport const loginRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => login(options) })\n}\n\nexport const logoutRunner: Runner<typeof logoutCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({\n options,\n action: async () => {\n await stopWorker()\n await clearCredentials()\n console.log('Signed out of Kubb Studio.')\n },\n })\n}\n\nexport const startRunner: Runner<typeof connectCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({ options, action: () => startWorker(options) })\n}\n\nexport const statusRunner: Runner<typeof statusCommand> = async ({ values }) => {\n const options = createStudioOptions(values)\n await run({\n options,\n action: async () => {\n const worker = await getWorkerStatus()\n console.log(`Background connection: ${worker.state}${worker.running ? ` (PID ${worker.pid})` : ''}`)\n console.log(`Logs: ${getWorkerLogPath()}`)\n await status(options)\n },\n })\n}\n\nexport async function stopRunner(): Promise<void> {\n await stopWorker()\n console.log('Background connection stopped.')\n}\n"],"mappings":";;;;;;;;AAaA,eAAe,OAAO,SAAuC;CAC3D,MAAM,cAAc,MAAMA,YAAAA,gBAAgB;CAE1C,IAAI,CAAC,aAAa;EAChB,QAAQ,IAAI,sCAAsC;EAElD;CACF;CAEA,QAAQ,IAAI,eAAe,YAAY,UAAU,OAAA,GAAMC,UAAAA,UAAAA,CAAU,QAAQ,YAAY,aAAa,YAAY,OAAO,GAAG;CAExH,IAAI,YAAY,cAAc,QAAQ,WACpC,QAAQ,KAAA,GAAIA,UAAAA,UAAAA,CAAU,UAAU,iB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