@keystrokehq/cli 0.1.106 → 0.1.107

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.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { g as emitStoredRouteManifestForProject } from "./dist-BvmFovtv.mjs";
2
+ import { g as emitStoredRouteManifestForProject } from "./dist-BFOvwXwm.mjs";
3
3
  export { emitStoredRouteManifestForProject };
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as __toESM, t as __commonJSMin } from "./chunk-DiodbrVj.mjs";
3
- import { $r as datetime, Ar as number$1, Br as intersection, Fr as any, Gr as object, Hr as literal, Ir as array, Jr as record, Kr as optional, Lr as boolean, Mr as _enum, Pr as _null, Qr as url, Rr as custom, Ur as looseObject, Wr as number, Xr as union, Yr as string, Zr as unknown, ni as NEVER, pn as ROUTE_MANIFEST_REL_PATH, qr as preprocess, ti as safeParse$1, wr as parseStoredRouteManifest, zr as discriminatedUnion } from "./dist-ZZlE2vk6.mjs";
3
+ import { $r as url, Br as discriminatedUnion, Fr as _null, Gr as number, Ir as any, Jr as preprocess, Kr as object, Lr as array, Nr as _enum, Qr as unknown, Rr as boolean, Tr as parseStoredRouteManifest, Ur as literal, Vr as intersection, Wr as looseObject, Xr as string, Yr as record, Zr as union, ei as datetime, jr as number$1, mn as ROUTE_MANIFEST_REL_PATH, ni as safeParse$1, qr as optional, ri as NEVER, zr as custom } from "./dist-BoZPZ9Sz.mjs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { dirname, join, relative } from "node:path";
6
6
  import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
7
+ import { AsyncLocalStorage } from "node:async_hooks";
7
8
  import { spawnSync } from "node:child_process";
8
9
  import "@aws-sdk/client-s3";
9
10
  import "@aws-sdk/s3-request-presigner";
@@ -27,6 +28,105 @@ const ZodIssueCode = {
27
28
  var ZodFirstPartyTypeKind;
28
29
  (function(ZodFirstPartyTypeKind) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
29
30
  //#endregion
31
+ //#region ../../packages/telemetry/dist/index.mjs
32
+ const storage = new AsyncLocalStorage();
33
+ function getTelemetryContext() {
34
+ return storage.getStore();
35
+ }
36
+ /**
37
+ * Returns true when an error is an expected client/control-flow failure that
38
+ * should not become an Error Tracking issue.
39
+ */
40
+ function isExpectedError(error) {
41
+ if (!error || typeof error !== "object") return false;
42
+ const status = readStatus(error);
43
+ if (status !== void 0 && (status === 0 || status >= 400 && status < 500)) return true;
44
+ if ("name" in error && typeof error.name === "string") {
45
+ if (error.name === "AbortError" || error.name === "CanceledError" || error.name === "CancelledError" || error.name === "RunTimeoutError") return true;
46
+ }
47
+ return false;
48
+ }
49
+ function readStatus(error) {
50
+ if ("status" in error && typeof error.status === "number") return error.status;
51
+ if ("statusCode" in error && typeof error.statusCode === "number") return error.statusCode;
52
+ }
53
+ const EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*(:[a-z][a-z0-9_]*)?$/;
54
+ let sink;
55
+ function configureTelemetry(options) {
56
+ sink = options.sink;
57
+ }
58
+ async function flushTelemetry() {
59
+ await sink?.flush?.();
60
+ }
61
+ async function shutdownTelemetry() {
62
+ const current = sink;
63
+ sink = void 0;
64
+ await current?.shutdown?.();
65
+ }
66
+ async function captureException(input) {
67
+ if (isExpectedError(input.error) || !sink?.captureException) return;
68
+ const context = getTelemetryContext();
69
+ const actorId = input.actorId ?? context?.actorId;
70
+ const analyticsId = input.analyticsId ?? context?.analyticsId;
71
+ const organizationId = input.organizationId ?? context?.organizationId;
72
+ const projectId = input.projectId ?? context?.projectId;
73
+ const sessionId = input.sessionId ?? context?.sessionId;
74
+ const enriched = {
75
+ error: input.error,
76
+ ...actorId ? { actorId } : {},
77
+ ...analyticsId ? { analyticsId } : {},
78
+ ...organizationId ? { organizationId } : {},
79
+ ...projectId ? { projectId } : {},
80
+ ...sessionId ? { sessionId } : {},
81
+ ...input.operation ? { operation: input.operation } : {},
82
+ ...input.properties ? { properties: input.properties } : {}
83
+ };
84
+ try {
85
+ await sink.captureException(enriched);
86
+ } catch (error) {
87
+ console.error("[telemetry] captureException sink failed", error);
88
+ }
89
+ }
90
+ async function event(input) {
91
+ if (!EVENT_NAME_PATTERN.test(input.name)) {
92
+ console.error(`[telemetry] rejected invalid event name: ${input.name}`);
93
+ return;
94
+ }
95
+ const actorId = input.actorId.trim();
96
+ if (!actorId) {
97
+ console.error("[telemetry] rejected event without actorId");
98
+ return;
99
+ }
100
+ if (!sink?.event) return;
101
+ try {
102
+ await sink.event({
103
+ ...input,
104
+ actorId,
105
+ timestamp: input.timestamp ?? /* @__PURE__ */ new Date(),
106
+ uuid: input.uuid ?? globalThis.crypto.randomUUID()
107
+ });
108
+ } catch (error) {
109
+ console.error("[telemetry] event sink failed", error);
110
+ }
111
+ }
112
+ async function alias(input) {
113
+ const distinctId = input.distinctId.trim();
114
+ const aliasId = input.alias.trim();
115
+ if (!distinctId || !aliasId) {
116
+ console.error("[telemetry] rejected alias without distinctId/alias");
117
+ return;
118
+ }
119
+ if (!sink?.alias) return;
120
+ try {
121
+ await sink.alias({
122
+ distinctId,
123
+ alias: aliasId
124
+ });
125
+ } catch (error) {
126
+ console.error("[telemetry] alias sink failed", error);
127
+ }
128
+ }
129
+ //#endregion
30
130
  //#region ../../packages/storage/dist/pack-artifact-DYN-lXBn.mjs
31
131
  let forceLocalSupported;
32
132
  /**
@@ -11575,6 +11675,6 @@ async function mapInParallelBatches(items, batchSize, fn) {
11575
11675
  return results;
11576
11676
  }
11577
11677
  //#endregion
11578
- export { packProjectArtifact as i, withMcpReadClient as n, mergeFilteredArtifact as r, mapInParallelBatches as t };
11678
+ export { alias as a, event as c, packProjectArtifact as i, flushTelemetry as l, withMcpReadClient as n, captureException as o, mergeFilteredArtifact as r, configureTelemetry as s, mapInParallelBatches as t, shutdownTelemetry as u };
11579
11679
 
11580
- //# sourceMappingURL=dist-odLBD6p1.mjs.map
11680
+ //# sourceMappingURL=dist-De18Uq1U.mjs.map