@keystrokehq/cli 0.0.106 → 0.0.108
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/{dist-DvDsEErE.mjs → dist-D1ip549D.mjs} +2 -2
- package/dist/{dist-DvDsEErE.mjs.map → dist-D1ip549D.mjs.map} +1 -1
- package/dist/index.mjs +33 -4387
- package/dist/index.mjs.map +1 -1
- package/dist/maybe-auto-update-DCsPT080.mjs +247 -0
- package/dist/maybe-auto-update-DCsPT080.mjs.map +1 -0
- package/dist/schemas-DwAYtN9C.mjs +4296 -0
- package/dist/schemas-DwAYtN9C.mjs.map +1 -0
- package/dist/skills-bundle/_AGENTS.md +12 -12
- package/dist/skills-bundle/skills/{actions → keystroke-actions}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{agents → keystroke-agents}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{cli → keystroke-cli}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{credentials → keystroke-credentials}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{credentials → keystroke-credentials}/references/cli-and-oauth.md +1 -1
- package/dist/skills-bundle/skills/{files → keystroke-files}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{gateways → keystroke-gateways}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{skills → keystroke-skills}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{triggers → keystroke-triggers}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/SKILL.md +2 -2
- package/dist/version-DESgLEkE.mjs +94 -0
- package/dist/version-DESgLEkE.mjs.map +1 -0
- package/package.json +1 -1
- /package/dist/skills-bundle/skills/{actions → keystroke-actions}/references/catalog-and-imports.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/models.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/tools-mcp-codemode.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/workflows-and-testing.md +0 -0
- /package/dist/skills-bundle/skills/{cli → keystroke-cli}/references/api-targets.md +0 -0
- /package/dist/skills-bundle/skills/{gateways → keystroke-gateways}/references/slack-setup.md +0 -0
- /package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/references/authoring.md +0 -0
- /package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/references/testing.md +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { r as detectPackageManager, s as resolveCliRoot, t as readCliVersion } from "./version-DESgLEkE.mjs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
//#region src/update/build-update-command.ts
|
|
7
|
+
const PACKAGE_NAME = "@keystrokehq/cli@latest";
|
|
8
|
+
function buildUpdateCommand(install) {
|
|
9
|
+
const { kind, packageManager } = install;
|
|
10
|
+
if (kind === "global") switch (packageManager) {
|
|
11
|
+
case "pnpm": return {
|
|
12
|
+
command: "pnpm",
|
|
13
|
+
args: [
|
|
14
|
+
"add",
|
|
15
|
+
"-g",
|
|
16
|
+
PACKAGE_NAME
|
|
17
|
+
]
|
|
18
|
+
};
|
|
19
|
+
case "yarn": return {
|
|
20
|
+
command: "yarn",
|
|
21
|
+
args: [
|
|
22
|
+
"global",
|
|
23
|
+
"add",
|
|
24
|
+
PACKAGE_NAME
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
case "bun": return {
|
|
28
|
+
command: "bun",
|
|
29
|
+
args: [
|
|
30
|
+
"add",
|
|
31
|
+
"-g",
|
|
32
|
+
PACKAGE_NAME
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
default: return {
|
|
36
|
+
command: "npm",
|
|
37
|
+
args: [
|
|
38
|
+
"install",
|
|
39
|
+
"-g",
|
|
40
|
+
PACKAGE_NAME
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const cwd = install.projectRoot;
|
|
45
|
+
switch (packageManager) {
|
|
46
|
+
case "pnpm": return {
|
|
47
|
+
command: "pnpm",
|
|
48
|
+
args: [
|
|
49
|
+
"add",
|
|
50
|
+
"-D",
|
|
51
|
+
PACKAGE_NAME
|
|
52
|
+
],
|
|
53
|
+
cwd
|
|
54
|
+
};
|
|
55
|
+
case "yarn": return {
|
|
56
|
+
command: "yarn",
|
|
57
|
+
args: [
|
|
58
|
+
"add",
|
|
59
|
+
"-D",
|
|
60
|
+
PACKAGE_NAME
|
|
61
|
+
],
|
|
62
|
+
cwd
|
|
63
|
+
};
|
|
64
|
+
case "bun": return {
|
|
65
|
+
command: "bun",
|
|
66
|
+
args: [
|
|
67
|
+
"add",
|
|
68
|
+
"-D",
|
|
69
|
+
PACKAGE_NAME
|
|
70
|
+
],
|
|
71
|
+
cwd
|
|
72
|
+
};
|
|
73
|
+
default: return {
|
|
74
|
+
command: "npm",
|
|
75
|
+
args: [
|
|
76
|
+
"install",
|
|
77
|
+
"-D",
|
|
78
|
+
PACKAGE_NAME
|
|
79
|
+
],
|
|
80
|
+
cwd
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/update/compare-version.ts
|
|
86
|
+
function parseVersion(version) {
|
|
87
|
+
const [major = 0, minor = 0, patch = 0] = (version.trim().replace(/^v/, "").split("-")[0] ?? "").split(".").map((part) => {
|
|
88
|
+
const value = Number.parseInt(part, 10);
|
|
89
|
+
return Number.isFinite(value) ? value : 0;
|
|
90
|
+
});
|
|
91
|
+
return [
|
|
92
|
+
major,
|
|
93
|
+
minor,
|
|
94
|
+
patch
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
function isNewerVersion(latest, current) {
|
|
98
|
+
const [latestMajor, latestMinor, latestPatch] = parseVersion(latest);
|
|
99
|
+
const [currentMajor, currentMinor, currentPatch] = parseVersion(current);
|
|
100
|
+
if (latestMajor !== currentMajor) return latestMajor > currentMajor;
|
|
101
|
+
if (latestMinor !== currentMinor) return latestMinor > currentMinor;
|
|
102
|
+
return latestPatch > currentPatch;
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/update/detect-cli-install.ts
|
|
106
|
+
function realpathSafe(path) {
|
|
107
|
+
try {
|
|
108
|
+
return realpathSync(path);
|
|
109
|
+
} catch {
|
|
110
|
+
return path;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function detectManagerFromLockfile(dir) {
|
|
114
|
+
if (existsSync(join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
115
|
+
if (existsSync(join(dir, "bun.lockb")) || existsSync(join(dir, "bun.lock"))) return "bun";
|
|
116
|
+
if (existsSync(join(dir, "yarn.lock"))) return "yarn";
|
|
117
|
+
if (existsSync(join(dir, "package-lock.json"))) return "npm";
|
|
118
|
+
}
|
|
119
|
+
function findLocalProjectRoot(packageRoot) {
|
|
120
|
+
const normalizedRoot = realpathSafe(packageRoot);
|
|
121
|
+
let dir = dirname(packageRoot);
|
|
122
|
+
while (dir !== dirname(dir)) {
|
|
123
|
+
const installedCliPath = join(dir, "node_modules", "@keystrokehq", "cli");
|
|
124
|
+
if (existsSync(join(dir, "package.json")) && realpathSafe(installedCliPath) === normalizedRoot) return dir;
|
|
125
|
+
dir = dirname(dir);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function globalRootForManager(manager) {
|
|
129
|
+
const { command, args } = {
|
|
130
|
+
pnpm: {
|
|
131
|
+
command: "pnpm",
|
|
132
|
+
args: ["root", "-g"]
|
|
133
|
+
},
|
|
134
|
+
npm: {
|
|
135
|
+
command: "npm",
|
|
136
|
+
args: ["root", "-g"]
|
|
137
|
+
},
|
|
138
|
+
yarn: {
|
|
139
|
+
command: "yarn",
|
|
140
|
+
args: ["global", "dir"]
|
|
141
|
+
},
|
|
142
|
+
bun: {
|
|
143
|
+
command: "bun",
|
|
144
|
+
args: ["pm", "bin"]
|
|
145
|
+
}
|
|
146
|
+
}[manager];
|
|
147
|
+
const result = spawnSync(command, args, { encoding: "utf8" });
|
|
148
|
+
if (result.status !== 0) return;
|
|
149
|
+
const root = result.stdout.trim();
|
|
150
|
+
return root ? realpathSafe(root) : void 0;
|
|
151
|
+
}
|
|
152
|
+
function detectGlobalManager(packageRoot) {
|
|
153
|
+
const normalizedRoot = realpathSafe(packageRoot);
|
|
154
|
+
if (normalizedRoot.includes(`${join("", ".pnpm")}`)) return "pnpm";
|
|
155
|
+
for (const manager of [
|
|
156
|
+
"pnpm",
|
|
157
|
+
"npm",
|
|
158
|
+
"yarn",
|
|
159
|
+
"bun"
|
|
160
|
+
]) {
|
|
161
|
+
const globalRoot = globalRootForManager(manager);
|
|
162
|
+
if (globalRoot && normalizedRoot.startsWith(globalRoot)) return manager;
|
|
163
|
+
}
|
|
164
|
+
if (process.env.PNPM_HOME) return "pnpm";
|
|
165
|
+
return detectPackageManager();
|
|
166
|
+
}
|
|
167
|
+
function detectCliInstall(packageRoot) {
|
|
168
|
+
const normalizedRoot = realpathSafe(packageRoot);
|
|
169
|
+
const projectRoot = findLocalProjectRoot(normalizedRoot);
|
|
170
|
+
if (projectRoot) return {
|
|
171
|
+
kind: "local",
|
|
172
|
+
packageManager: detectManagerFromLockfile(projectRoot) ?? detectPackageManager(),
|
|
173
|
+
packageRoot: normalizedRoot,
|
|
174
|
+
projectRoot
|
|
175
|
+
};
|
|
176
|
+
return {
|
|
177
|
+
kind: "global",
|
|
178
|
+
packageManager: detectGlobalManager(normalizedRoot),
|
|
179
|
+
packageRoot: normalizedRoot
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/update/fetch-latest-version.ts
|
|
184
|
+
const REGISTRY_URL = "https://registry.npmjs.org/@keystrokehq%2Fcli";
|
|
185
|
+
const REQUEST_TIMEOUT_MS = 3e3;
|
|
186
|
+
async function fetchLatestCliVersion() {
|
|
187
|
+
const controller = new AbortController();
|
|
188
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
189
|
+
try {
|
|
190
|
+
const response = await fetch(REGISTRY_URL, {
|
|
191
|
+
signal: controller.signal,
|
|
192
|
+
headers: { Accept: "application/json" }
|
|
193
|
+
});
|
|
194
|
+
if (!response.ok) return;
|
|
195
|
+
return (await response.json())["dist-tags"]?.latest?.trim() || void 0;
|
|
196
|
+
} catch {
|
|
197
|
+
return;
|
|
198
|
+
} finally {
|
|
199
|
+
clearTimeout(timeout);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region src/update/maybe-auto-update.ts
|
|
204
|
+
function shouldSkipAutoUpdate(argv) {
|
|
205
|
+
if (process.env.KEYSTROKE_DEV || process.env.KEYSTROKE_SKIP_UPDATE || process.env.KEYSTROKE_UPDATING) return true;
|
|
206
|
+
if (process.env.CI === "true" || process.env.CI === "1") return true;
|
|
207
|
+
const args = argv.slice(2);
|
|
208
|
+
if (args.length === 0) return false;
|
|
209
|
+
return args.every((arg) => arg === "-V" || arg === "--version" || arg === "-h" || arg === "--help" || arg.startsWith("-V"));
|
|
210
|
+
}
|
|
211
|
+
function runUpdate(install) {
|
|
212
|
+
if (!install) return false;
|
|
213
|
+
const { command, args, cwd } = buildUpdateCommand(install);
|
|
214
|
+
return spawnSync(command, args, {
|
|
215
|
+
cwd,
|
|
216
|
+
stdio: "inherit",
|
|
217
|
+
env: process.env
|
|
218
|
+
}).status === 0;
|
|
219
|
+
}
|
|
220
|
+
function reexecCli(argv) {
|
|
221
|
+
const result = spawnSync(process.execPath, argv.slice(1), {
|
|
222
|
+
stdio: "inherit",
|
|
223
|
+
env: {
|
|
224
|
+
...process.env,
|
|
225
|
+
KEYSTROKE_UPDATING: "1"
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
process.exit(result.status ?? 1);
|
|
229
|
+
}
|
|
230
|
+
async function maybeAutoUpdate(argv) {
|
|
231
|
+
if (shouldSkipAutoUpdate(argv)) return;
|
|
232
|
+
const install = detectCliInstall(resolveCliRoot(import.meta.url));
|
|
233
|
+
if (!install || install.kind === "local" && !install.projectRoot) return;
|
|
234
|
+
const currentVersion = readCliVersion();
|
|
235
|
+
const latestVersion = await fetchLatestCliVersion();
|
|
236
|
+
if (!latestVersion || !isNewerVersion(latestVersion, currentVersion)) return;
|
|
237
|
+
process.stderr.write(`Updating @keystrokehq/cli ${currentVersion} -> ${latestVersion} via ${install.packageManager}...\n`);
|
|
238
|
+
if (!runUpdate(install)) {
|
|
239
|
+
process.stderr.write("Auto-update failed; continuing with the current version.\n");
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
reexecCli(argv);
|
|
243
|
+
}
|
|
244
|
+
//#endregion
|
|
245
|
+
export { maybeAutoUpdate };
|
|
246
|
+
|
|
247
|
+
//# sourceMappingURL=maybe-auto-update-DCsPT080.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"maybe-auto-update-DCsPT080.mjs","names":[],"sources":["../src/update/build-update-command.ts","../src/update/compare-version.ts","../src/update/detect-cli-install.ts","../src/update/fetch-latest-version.ts","../src/update/maybe-auto-update.ts"],"sourcesContent":["import type { CliInstallInfo } from \"./detect-cli-install\";\n\nconst PACKAGE_NAME = \"@keystrokehq/cli@latest\";\n\nexport function buildUpdateCommand(install: CliInstallInfo): {\n command: string;\n args: string[];\n cwd?: string;\n} {\n const { kind, packageManager } = install;\n\n if (kind === \"global\") {\n switch (packageManager) {\n case \"pnpm\":\n return { command: \"pnpm\", args: [\"add\", \"-g\", PACKAGE_NAME] };\n case \"yarn\":\n return { command: \"yarn\", args: [\"global\", \"add\", PACKAGE_NAME] };\n case \"bun\":\n return { command: \"bun\", args: [\"add\", \"-g\", PACKAGE_NAME] };\n case \"npm\":\n default:\n return { command: \"npm\", args: [\"install\", \"-g\", PACKAGE_NAME] };\n }\n }\n\n const cwd = install.projectRoot;\n switch (packageManager) {\n case \"pnpm\":\n return { command: \"pnpm\", args: [\"add\", \"-D\", PACKAGE_NAME], cwd };\n case \"yarn\":\n return { command: \"yarn\", args: [\"add\", \"-D\", PACKAGE_NAME], cwd };\n case \"bun\":\n return { command: \"bun\", args: [\"add\", \"-D\", PACKAGE_NAME], cwd };\n case \"npm\":\n default:\n return { command: \"npm\", args: [\"install\", \"-D\", PACKAGE_NAME], cwd };\n }\n}\n","function parseVersion(version: string): [number, number, number] {\n const normalized = version.trim().replace(/^v/, \"\").split(\"-\")[0] ?? \"\";\n const [major = 0, minor = 0, patch = 0] = normalized.split(\".\").map((part) => {\n const value = Number.parseInt(part, 10);\n return Number.isFinite(value) ? value : 0;\n });\n\n return [major, minor, patch];\n}\n\nexport function isNewerVersion(latest: string, current: string): boolean {\n const [latestMajor, latestMinor, latestPatch] = parseVersion(latest);\n const [currentMajor, currentMinor, currentPatch] = parseVersion(current);\n\n if (latestMajor !== currentMajor) {\n return latestMajor > currentMajor;\n }\n\n if (latestMinor !== currentMinor) {\n return latestMinor > currentMinor;\n }\n\n return latestPatch > currentPatch;\n}\n","import { existsSync, realpathSync } from \"node:fs\";\nimport { spawnSync } from \"node:child_process\";\nimport { dirname, join } from \"node:path\";\n\nimport { detectPackageManager, type PackageManager } from \"../init/package-manager\";\n\nexport type CliInstallKind = \"global\" | \"local\";\n\nexport type CliInstallInfo = {\n kind: CliInstallKind;\n packageManager: PackageManager;\n packageRoot: string;\n projectRoot?: string;\n};\n\nfunction realpathSafe(path: string): string {\n try {\n return realpathSync(path);\n } catch {\n return path;\n }\n}\n\nfunction detectManagerFromLockfile(dir: string): PackageManager | undefined {\n if (existsSync(join(dir, \"pnpm-lock.yaml\"))) {\n return \"pnpm\";\n }\n\n if (existsSync(join(dir, \"bun.lockb\")) || existsSync(join(dir, \"bun.lock\"))) {\n return \"bun\";\n }\n\n if (existsSync(join(dir, \"yarn.lock\"))) {\n return \"yarn\";\n }\n\n if (existsSync(join(dir, \"package-lock.json\"))) {\n return \"npm\";\n }\n\n return undefined;\n}\n\nfunction findLocalProjectRoot(packageRoot: string): string | undefined {\n const normalizedRoot = realpathSafe(packageRoot);\n let dir = dirname(packageRoot);\n\n while (dir !== dirname(dir)) {\n const installedCliPath = join(dir, \"node_modules\", \"@keystrokehq\", \"cli\");\n if (\n existsSync(join(dir, \"package.json\")) &&\n realpathSafe(installedCliPath) === normalizedRoot\n ) {\n return dir;\n }\n\n dir = dirname(dir);\n }\n\n return undefined;\n}\n\nfunction globalRootForManager(manager: PackageManager): string | undefined {\n const commands: Record<PackageManager, { command: string; args: string[] }> = {\n pnpm: { command: \"pnpm\", args: [\"root\", \"-g\"] },\n npm: { command: \"npm\", args: [\"root\", \"-g\"] },\n yarn: { command: \"yarn\", args: [\"global\", \"dir\"] },\n bun: { command: \"bun\", args: [\"pm\", \"bin\"] },\n };\n\n const { command, args } = commands[manager];\n const result = spawnSync(command, args, { encoding: \"utf8\" });\n\n if (result.status !== 0) {\n return undefined;\n }\n\n const root = result.stdout.trim();\n return root ? realpathSafe(root) : undefined;\n}\n\nfunction detectGlobalManager(packageRoot: string): PackageManager {\n const normalizedRoot = realpathSafe(packageRoot);\n\n if (normalizedRoot.includes(`${join(\"\", \".pnpm\")}`)) {\n return \"pnpm\";\n }\n\n for (const manager of [\"pnpm\", \"npm\", \"yarn\", \"bun\"] as const) {\n const globalRoot = globalRootForManager(manager);\n if (globalRoot && normalizedRoot.startsWith(globalRoot)) {\n return manager;\n }\n }\n\n if (process.env.PNPM_HOME) {\n return \"pnpm\";\n }\n\n return detectPackageManager();\n}\n\nexport function detectCliInstall(packageRoot: string): CliInstallInfo | undefined {\n const normalizedRoot = realpathSafe(packageRoot);\n const projectRoot = findLocalProjectRoot(normalizedRoot);\n\n if (projectRoot) {\n const packageManager = detectManagerFromLockfile(projectRoot) ?? detectPackageManager();\n\n return {\n kind: \"local\",\n packageManager,\n packageRoot: normalizedRoot,\n projectRoot,\n };\n }\n\n return {\n kind: \"global\",\n packageManager: detectGlobalManager(normalizedRoot),\n packageRoot: normalizedRoot,\n };\n}\n","const REGISTRY_URL = \"https://registry.npmjs.org/@keystrokehq%2Fcli\";\nconst REQUEST_TIMEOUT_MS = 3_000;\n\ntype RegistryPackage = {\n \"dist-tags\"?: {\n latest?: string;\n };\n};\n\nexport async function fetchLatestCliVersion(): Promise<string | undefined> {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);\n\n try {\n const response = await fetch(REGISTRY_URL, {\n signal: controller.signal,\n headers: {\n Accept: \"application/json\",\n },\n });\n\n if (!response.ok) {\n return undefined;\n }\n\n const payload = (await response.json()) as RegistryPackage;\n const latest = payload[\"dist-tags\"]?.latest?.trim();\n return latest || undefined;\n } catch {\n return undefined;\n } finally {\n clearTimeout(timeout);\n }\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport { resolveCliRoot } from \"../project/resolve-cli-root\";\nimport { readCliVersion } from \"../version\";\nimport { buildUpdateCommand } from \"./build-update-command\";\nimport { isNewerVersion } from \"./compare-version\";\nimport { detectCliInstall } from \"./detect-cli-install\";\nimport { fetchLatestCliVersion } from \"./fetch-latest-version\";\n\nfunction shouldSkipAutoUpdate(argv: string[]): boolean {\n if (\n process.env.KEYSTROKE_DEV ||\n process.env.KEYSTROKE_SKIP_UPDATE ||\n process.env.KEYSTROKE_UPDATING\n ) {\n return true;\n }\n\n if (process.env.CI === \"true\" || process.env.CI === \"1\") {\n return true;\n }\n\n const args = argv.slice(2);\n if (args.length === 0) {\n return false;\n }\n\n return args.every(\n (arg) =>\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg.startsWith(\"-V\"),\n );\n}\n\nfunction runUpdate(install: ReturnType<typeof detectCliInstall>): boolean {\n if (!install) {\n return false;\n }\n\n const { command, args, cwd } = buildUpdateCommand(install);\n const result = spawnSync(command, args, {\n cwd,\n stdio: \"inherit\",\n env: process.env,\n });\n\n return result.status === 0;\n}\n\nfunction reexecCli(argv: string[]): never {\n const result = spawnSync(process.execPath, argv.slice(1), {\n stdio: \"inherit\",\n env: {\n ...process.env,\n KEYSTROKE_UPDATING: \"1\",\n },\n });\n\n process.exit(result.status ?? 1);\n}\n\nexport async function maybeAutoUpdate(argv: string[]): Promise<void> {\n if (shouldSkipAutoUpdate(argv)) {\n return;\n }\n\n const install = detectCliInstall(resolveCliRoot(import.meta.url));\n if (!install || (install.kind === \"local\" && !install.projectRoot)) {\n return;\n }\n\n const currentVersion = readCliVersion();\n const latestVersion = await fetchLatestCliVersion();\n\n if (!latestVersion || !isNewerVersion(latestVersion, currentVersion)) {\n return;\n }\n\n process.stderr.write(\n `Updating @keystrokehq/cli ${currentVersion} -> ${latestVersion} via ${install.packageManager}...\\n`,\n );\n\n if (!runUpdate(install)) {\n process.stderr.write(\"Auto-update failed; continuing with the current version.\\n\");\n return;\n }\n\n reexecCli(argv);\n}\n"],"mappings":";;;;;;AAEA,MAAM,eAAe;AAErB,SAAgB,mBAAmB,SAIjC;CACA,MAAM,EAAE,MAAM,mBAAmB;CAEjC,IAAI,SAAS,UACX,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;GAAE,SAAS;GAAQ,MAAM;IAAC;IAAO;IAAM;GAAY;EAAE;EAC9D,KAAK,QACH,OAAO;GAAE,SAAS;GAAQ,MAAM;IAAC;IAAU;IAAO;GAAY;EAAE;EAClE,KAAK,OACH,OAAO;GAAE,SAAS;GAAO,MAAM;IAAC;IAAO;IAAM;GAAY;EAAE;EAE7D,SACE,OAAO;GAAE,SAAS;GAAO,MAAM;IAAC;IAAW;IAAM;GAAY;EAAE;CACnE;CAGF,MAAM,MAAM,QAAQ;CACpB,QAAQ,gBAAR;EACE,KAAK,QACH,OAAO;GAAE,SAAS;GAAQ,MAAM;IAAC;IAAO;IAAM;GAAY;GAAG;EAAI;EACnE,KAAK,QACH,OAAO;GAAE,SAAS;GAAQ,MAAM;IAAC;IAAO;IAAM;GAAY;GAAG;EAAI;EACnE,KAAK,OACH,O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