@keystrokehq/cli 0.1.162 → 0.1.163
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/README.md +1 -1
- package/dist/{dist-Cy2nsWsI.mjs → dist-BgPOKEEt.mjs} +7 -4
- package/dist/dist-BgPOKEEt.mjs.map +1 -0
- package/dist/dist-CE_RfXDS.mjs +4 -0
- package/dist/dist-Co-J5D_c.mjs +3 -0
- package/dist/{dist-Dg-PHK0j.mjs → dist-fy1jz-eq.mjs} +40 -2
- package/dist/dist-fy1jz-eq.mjs.map +1 -0
- package/dist/{dist-DeMzV-BR.mjs → dist-v54rjb2O.mjs} +4 -4
- package/dist/{dist-DeMzV-BR.mjs.map → dist-v54rjb2O.mjs.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{maybe-auto-update-J-Am1CbS.mjs → maybe-auto-update-oRHYV8-i.mjs} +2 -2
- package/dist/{maybe-auto-update-J-Am1CbS.mjs.map → maybe-auto-update-oRHYV8-i.mjs.map} +1 -1
- package/dist/{program-BWeEKhR_.mjs → program-CKQqD-RE.mjs} +146 -146
- package/dist/program-CKQqD-RE.mjs.map +1 -0
- package/dist/{run-package-manager-update-CuLe-Jux.mjs → run-package-manager-update-D_nLqg4e.mjs} +2 -2
- package/dist/{run-package-manager-update-CuLe-Jux.mjs.map → run-package-manager-update-D_nLqg4e.mjs.map} +1 -1
- package/dist/skills-bundle/_AGENTS.mcp.md +5 -5
- package/dist/skills-bundle/_AGENTS.md +9 -7
- package/package.json +1 -1
- package/dist/dist-B_Dy4mW_.mjs +0 -3
- package/dist/dist-Cy2nsWsI.mjs.map +0 -1
- package/dist/dist-DMlQ27mb.mjs +0 -4
- package/dist/dist-Dg-PHK0j.mjs.map +0 -1
- package/dist/program-BWeEKhR_.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -40,7 +40,7 @@ process.emitWarning = ((warning, ...args) => {
|
|
|
40
40
|
if ((type === "ExperimentalWarning" || /ExperimentalWarning/i.test(type)) && /SQLite/i.test(message)) return;
|
|
41
41
|
return Reflect.apply(originalEmitWarning, process, [warning, ...args]);
|
|
42
42
|
});
|
|
43
|
-
const { runCli } = await import("./program-
|
|
43
|
+
const { runCli } = await import("./program-CKQqD-RE.mjs");
|
|
44
44
|
await runCli(process.argv);
|
|
45
45
|
//#endregion
|
|
46
46
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { S as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, i as readPnpmMinimumReleaseAgeMinutes, o as isReleaseAgeBlock, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-
|
|
2
|
+
import { S as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, i as readPnpmMinimumReleaseAgeMinutes, o as isReleaseAgeBlock, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-D_nLqg4e.mjs";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
@@ -141,4 +141,4 @@ async function maybeAutoUpdate(argv) {
|
|
|
141
141
|
//#endregion
|
|
142
142
|
export { maybeAutoUpdate };
|
|
143
143
|
|
|
144
|
-
//# sourceMappingURL=maybe-auto-update-
|
|
144
|
+
//# sourceMappingURL=maybe-auto-update-oRHYV8-i.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe-auto-update-J-Am1CbS.mjs","names":[],"sources":["../src/update/update-block-cache.ts","../src/update/maybe-auto-update.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getCliConfigDir } from \"../config\";\n\nexport type UpdateBlockCache = {\n registryLatest?: string;\n blockedUntil?: string;\n lastFailedAt?: string;\n};\n\nconst CACHE_FILE = \"update-check.json\";\nconst GENERIC_RETRY_MS = 24 * 60 * 60 * 1000;\n\nfunction cachePath(configDir = getCliConfigDir()): string {\n return join(configDir, CACHE_FILE);\n}\n\nexport function readUpdateBlockCache(configDir?: string): UpdateBlockCache {\n const path = cachePath(configDir);\n if (!existsSync(path)) {\n return {};\n }\n\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as UpdateBlockCache;\n } catch {\n return {};\n }\n}\n\nexport function writeUpdateBlockCache(cache: UpdateBlockCache, configDir?: string): void {\n const dir = configDir ?? getCliConfigDir();\n mkdirSync(dir, { recursive: true });\n writeFileSync(cachePath(dir), `${JSON.stringify(cache, null, 2)}\\n`, \"utf8\");\n}\n\nexport function shouldSkipCachedUpdate(\n cache: UpdateBlockCache,\n registryLatest: string,\n now = Date.now(),\n): boolean {\n if (cache.registryLatest !== registryLatest) {\n return false;\n }\n\n if (cache.blockedUntil) {\n const blockedUntilMs = Date.parse(cache.blockedUntil);\n if (Number.isFinite(blockedUntilMs) && blockedUntilMs > now) {\n return true;\n }\n }\n\n if (cache.lastFailedAt) {\n const lastFailedMs = Date.parse(cache.lastFailedAt);\n if (Number.isFinite(lastFailedMs) && now - lastFailedMs < GENERIC_RETRY_MS) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function clearUpdateBlockCache(configDir?: string): void {\n writeUpdateBlockCache({}, configDir);\n}\n\nexport function recordReleaseAgeBlock(options: {\n registryLatest: string;\n retryAfter?: Date;\n configDir?: string;\n}): void {\n writeUpdateBlockCache(\n {\n registryLatest: options.registryLatest,\n blockedUntil: options.retryAfter?.toISOString(),\n },\n options.configDir,\n );\n}\n\nexport function recordGenericUpdateFailure(registryLatest: string, configDir?: string): void {\n writeUpdateBlockCache(\n {\n registryLatest,\n lastFailedAt: new Date().toISOString(),\n },\n configDir,\n );\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport { resolveCliRoot } from \"../project/resolve-cli-root\";\nimport { readCliVersion } from \"../version\";\nimport { shouldUpdateCliVersion } from \"./compare-version\";\nimport { detectCliInstall } from \"./detect-cli-install\";\nimport { formatReleaseAgeBlockMessage, isReleaseAgeBlock } from \"./detect-release-age-block\";\nimport { fetchLatestCliRelease } from \"./fetch-latest-version\";\nimport {\n computeReleaseAgeRetryAfter,\n readPnpmMinimumReleaseAgeMinutes,\n} from \"./read-pnpm-release-age-minutes\";\nimport { resolveCliDistTag } from \"./resolve-cli-dist-tag\";\nimport { runPackageManagerUpdate } from \"./run-package-manager-update\";\nimport {\n clearUpdateBlockCache,\n readUpdateBlockCache,\n recordGenericUpdateFailure,\n recordReleaseAgeBlock,\n shouldSkipCachedUpdate,\n} from \"./update-block-cache\";\n\nfunction isTopLevelUpdateCommand(args: string[]): boolean {\n const valueFlags = new Set([\"--project\", \"--organization\", \"--dir\"]);\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === undefined) {\n return false;\n }\n\n if (arg === \"--\") {\n return args[i + 1] === \"update\";\n }\n\n if (arg.startsWith(\"-\")) {\n if (\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg.startsWith(\"-V\")\n ) {\n continue;\n }\n\n if (arg.includes(\"=\")) {\n continue;\n }\n\n if (valueFlags.has(arg) || arg.startsWith(\"--\")) {\n i++;\n }\n continue;\n }\n\n return arg === \"update\";\n }\n\n return false;\n}\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 // Explicit `keystroke update` owns CLI + project package updates.\n if (isTopLevelUpdateCommand(args)) {\n return true;\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 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\nfunction releaseAgeRetryAfter(\n install: NonNullable<ReturnType<typeof detectCliInstall>>,\n publishedAt: string | undefined,\n): Date | undefined {\n if (install.packageManager !== \"pnpm\") {\n return undefined;\n }\n\n return computeReleaseAgeRetryAfter(publishedAt, readPnpmMinimumReleaseAgeMinutes());\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 distTag = resolveCliDistTag();\n const release = await fetchLatestCliRelease(distTag);\n\n if (\n !release ||\n !shouldUpdateCliVersion({\n registryVersion: release.version,\n currentVersion,\n distTag,\n })\n ) {\n clearUpdateBlockCache();\n return;\n }\n\n const cache = readUpdateBlockCache();\n if (shouldSkipCachedUpdate(cache, release.version)) {\n return;\n }\n\n process.stderr.write(\n `Updating @keystrokehq/cli ${currentVersion} -> ${release.version} (@${distTag}) via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install, distTag);\n const installedVersion = readCliVersion();\n\n if (installedVersion.trim() !== currentVersion.trim()) {\n clearUpdateBlockCache();\n process.stderr.write(`Updated @keystrokehq/cli ${currentVersion} -> ${installedVersion}.\\n`);\n reexecCli(argv);\n }\n\n if (result.ok) {\n clearUpdateBlockCache();\n return;\n }\n\n if (isReleaseAgeBlock(result.output)) {\n const retryAfter = releaseAgeRetryAfter(install, release.publishedAt);\n recordReleaseAgeBlock({\n registryLatest: release.version,\n retryAfter,\n });\n process.stderr.write(\n `${formatReleaseAgeBlockMessage({\n currentVersion,\n availableVersion: release.version,\n retryAfter,\n })}\\n`,\n );\n return;\n }\n\n recordGenericUpdateFailure(release.version);\n process.stderr.write(\"Auto-update failed; continuing with the current version.\\n\");\n}\n"],"mappings":";;;;;;AAWA,MAAM,aAAa;AACnB,MAAM,mBAAmB,OAAU,KAAK;AAExC,SAAS,UAAU,YAAY,gBAAgB,GAAW;CACxD,OAAO,KAAK,WAAW,UAAU;AACnC;AAEA,SAAgB,qBAAqB,WAAsC;CACzE,MAAM,OAAO,UAAU,SAAS;CAChC,IAAI,CAAC,WAAW,IAAI,GAClB,OAAO,CAAC;CAGV,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,SAAgB,sBAAsB,OAAyB,WAA0B;CACvF,MAAM,MAAM,aAAa,gBAAgB;CACzC,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;CAClC,cAAc,UAAU,GAAG,GAAG,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,MAAM;AAC7E;AAEA,SAAgB,uBACd,OACA,gBACA,MAAM,KAAK,IAAI,GACN;CACT,IAAI,MAAM,mBAAmB,gBAC3B,OAAO;CAGT,IAAI,MAAM,cAAc;EACtB,MAAM,iBAAiB,KAAK,MAAM,MAAM,YAAY;EACpD,IAAI,OAAO,SAAS,cAAc,KAAK,iBAAiB,KACtD,OAAO;CAEX;CAEA,IAAI,MAAM,cAAc;EACtB,MAAM,eAAe,KAAK,MAAM,MAAM,YAAY;EAClD,IAAI,OAAO,SAAS,YAAY,KAAK,MAAM,eAAe,kBACxD,OAAO;CAEX;CAEA,OAAO;AACT;AAEA,SAAgB,sBAAsB,WAA0B;CAC9D,sBAAsB,CAAC,GAAG,SAA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AAQ;GAC1B;EACF,CAAC,EAAE,GACL;EACA;CACF;CAEA,2BAA2B,QAAQ,OAAO;CAC1C,QAAQ,OAAO,MAAM,4DAA4D;AACnF"}
|
|
1
|
+
{"version":3,"file":"maybe-auto-update-oRHYV8-i.mjs","names":[],"sources":["../src/update/update-block-cache.ts","../src/update/maybe-auto-update.ts"],"sourcesContent":["import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nimport { getCliConfigDir } from \"../config\";\n\nexport type UpdateBlockCache = {\n registryLatest?: string;\n blockedUntil?: string;\n lastFailedAt?: string;\n};\n\nconst CACHE_FILE = \"update-check.json\";\nconst GENERIC_RETRY_MS = 24 * 60 * 60 * 1000;\n\nfunction cachePath(configDir = getCliConfigDir()): string {\n return join(configDir, CACHE_FILE);\n}\n\nexport function readUpdateBlockCache(configDir?: string): UpdateBlockCache {\n const path = cachePath(configDir);\n if (!existsSync(path)) {\n return {};\n }\n\n try {\n return JSON.parse(readFileSync(path, \"utf8\")) as UpdateBlockCache;\n } catch {\n return {};\n }\n}\n\nexport function writeUpdateBlockCache(cache: UpdateBlockCache, configDir?: string): void {\n const dir = configDir ?? getCliConfigDir();\n mkdirSync(dir, { recursive: true });\n writeFileSync(cachePath(dir), `${JSON.stringify(cache, null, 2)}\\n`, \"utf8\");\n}\n\nexport function shouldSkipCachedUpdate(\n cache: UpdateBlockCache,\n registryLatest: string,\n now = Date.now(),\n): boolean {\n if (cache.registryLatest !== registryLatest) {\n return false;\n }\n\n if (cache.blockedUntil) {\n const blockedUntilMs = Date.parse(cache.blockedUntil);\n if (Number.isFinite(blockedUntilMs) && blockedUntilMs > now) {\n return true;\n }\n }\n\n if (cache.lastFailedAt) {\n const lastFailedMs = Date.parse(cache.lastFailedAt);\n if (Number.isFinite(lastFailedMs) && now - lastFailedMs < GENERIC_RETRY_MS) {\n return true;\n }\n }\n\n return false;\n}\n\nexport function clearUpdateBlockCache(configDir?: string): void {\n writeUpdateBlockCache({}, configDir);\n}\n\nexport function recordReleaseAgeBlock(options: {\n registryLatest: string;\n retryAfter?: Date;\n configDir?: string;\n}): void {\n writeUpdateBlockCache(\n {\n registryLatest: options.registryLatest,\n blockedUntil: options.retryAfter?.toISOString(),\n },\n options.configDir,\n );\n}\n\nexport function recordGenericUpdateFailure(registryLatest: string, configDir?: string): void {\n writeUpdateBlockCache(\n {\n registryLatest,\n lastFailedAt: new Date().toISOString(),\n },\n configDir,\n );\n}\n","import { spawnSync } from \"node:child_process\";\n\nimport { resolveCliRoot } from \"../project/resolve-cli-root\";\nimport { readCliVersion } from \"../version\";\nimport { shouldUpdateCliVersion } from \"./compare-version\";\nimport { detectCliInstall } from \"./detect-cli-install\";\nimport { formatReleaseAgeBlockMessage, isReleaseAgeBlock } from \"./detect-release-age-block\";\nimport { fetchLatestCliRelease } from \"./fetch-latest-version\";\nimport {\n computeReleaseAgeRetryAfter,\n readPnpmMinimumReleaseAgeMinutes,\n} from \"./read-pnpm-release-age-minutes\";\nimport { resolveCliDistTag } from \"./resolve-cli-dist-tag\";\nimport { runPackageManagerUpdate } from \"./run-package-manager-update\";\nimport {\n clearUpdateBlockCache,\n readUpdateBlockCache,\n recordGenericUpdateFailure,\n recordReleaseAgeBlock,\n shouldSkipCachedUpdate,\n} from \"./update-block-cache\";\n\nfunction isTopLevelUpdateCommand(args: string[]): boolean {\n const valueFlags = new Set([\"--project\", \"--organization\", \"--dir\"]);\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (arg === undefined) {\n return false;\n }\n\n if (arg === \"--\") {\n return args[i + 1] === \"update\";\n }\n\n if (arg.startsWith(\"-\")) {\n if (\n arg === \"-h\" ||\n arg === \"--help\" ||\n arg === \"-V\" ||\n arg === \"--version\" ||\n arg.startsWith(\"-V\")\n ) {\n continue;\n }\n\n if (arg.includes(\"=\")) {\n continue;\n }\n\n if (valueFlags.has(arg) || arg.startsWith(\"--\")) {\n i++;\n }\n continue;\n }\n\n return arg === \"update\";\n }\n\n return false;\n}\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 // Explicit `keystroke update` owns CLI + project package updates.\n if (isTopLevelUpdateCommand(args)) {\n return true;\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 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\nfunction releaseAgeRetryAfter(\n install: NonNullable<ReturnType<typeof detectCliInstall>>,\n publishedAt: string | undefined,\n): Date | undefined {\n if (install.packageManager !== \"pnpm\") {\n return undefined;\n }\n\n return computeReleaseAgeRetryAfter(publishedAt, readPnpmMinimumReleaseAgeMinutes());\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 distTag = resolveCliDistTag();\n const release = await fetchLatestCliRelease(distTag);\n\n if (\n !release ||\n !shouldUpdateCliVersion({\n registryVersion: release.version,\n currentVersion,\n distTag,\n })\n ) {\n clearUpdateBlockCache();\n return;\n }\n\n const cache = readUpdateBlockCache();\n if (shouldSkipCachedUpdate(cache, release.version)) {\n return;\n }\n\n process.stderr.write(\n `Updating @keystrokehq/cli ${currentVersion} -> ${release.version} (@${distTag}) via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install, distTag);\n const installedVersion = readCliVersion();\n\n if (installedVersion.trim() !== currentVersion.trim()) {\n clearUpdateBlockCache();\n process.stderr.write(`Updated @keystrokehq/cli ${currentVersion} -> ${installedVersion}.\\n`);\n reexecCli(argv);\n }\n\n if (result.ok) {\n clearUpdateBlockCache();\n return;\n }\n\n if (isReleaseAgeBlock(result.output)) {\n const retryAfter = releaseAgeRetryAfter(install, release.publishedAt);\n recordReleaseAgeBlock({\n registryLatest: release.version,\n retryAfter,\n });\n process.stderr.write(\n `${formatReleaseAgeBlockMessage({\n currentVersion,\n availableVersion: release.version,\n retryAfter,\n })}\\n`,\n );\n return;\n }\n\n recordGenericUpdateFailure(release.version);\n process.stderr.write(\"Auto-update failed; continuing with the current version.\\n\");\n}\n"],"mappings":";;;;;;AAWA,MAAM,aAAa;AACnB,MAAM,mBAAmB,OAAU,KAAK;AAExC,SAAS,UAAU,YAAY,gBAAgB,GAAW;CACxD,OAAO,KAAK,WAAW,UAAU;AACnC;AAEA,SAAgB,qBAAqB,WAAsC;CACzE,MAAM,OAAO,UAAU,SAAS;CAChC,IAAI,CAAC,WAAW,IAAI,GAClB,OAAO,CAAC;CAGV,IAAI;EACF,OAAO,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CAC9C,QAAQ;EACN,OAAO,CAAC;CACV;AACF;AAEA,SAAgB,sBAAsB,OAAyB,WAA0B;CACvF,MAAM,MAAM,aAAa,gBAAgB;CACzC,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;CAClC,cAAc,UAAU,GAAG,GAAG,GAAG,KAAK,UAAU,OAAO,MAAM,CAAC,EAAE,KAAK,MAAM;AAC7E;AAEA,SAAgB,uBACd,OACA,gBACA,MAAM,KAAK,IAAI,GACN;CACT,IAAI,MAAM,mBAAmB,gBAC3B,OAAO;CAGT,IAAI,MAAM,cAAc;EACtB,MAAM,iBAAiB,KAAK,MAAM,MAAM,YAAY;EACpD,IAAI,OAAO,SAAS,cAAc,KA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A,IAAI,OAAO,IAAI;EACb,sBAAsB;EACtB;CACF;CAEA,IAAI,kBAAkB,OAAO,MAAM,GAAG;EACpC,MAAM,aAAa,qBAAqB,SAAS,QAAQ,WAAW;EACpE,sBAAsB;GACpB,gBAAgB,QAAQ;GACxB;EACF,CAAC;EACD,QAAQ,OAAO,MACb,GAAG,6BAA6B;GAC9B;GACA,kBAAkB,QAAQ;GAC1B;EACF,CAAC,EAAE,GACL;EACA;CACF;CAEA,2BAA2B,QAAQ,OAAO;CAC1C,QAAQ,OAAO,MAAM,4DAA4D;AACnF"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-
|
|
3
|
-
import { $ as DownloadActiveProjectArtifactResponseSchema, $i as CreateBillingPortalRequestSchema, $n as SkillSummaryDetailResponseSchema, $r as WorkflowSummaryDetailResponseSchema, $t as OpenApiDiscoverResponseSchema, A as CreateApiKeyResponseSchema, Ai as CredentialAssignmentRecordSchema, An as ProjectGitStatusResponseSchema, Ar as UpdateOrganizationRequestSchema, At as ListApiKeysResponseSchema, B as CreateProjectArtifactRequestSchema, Bi as ACTIVE_ORG_HEADER, Bn as PublicFormSubmitResponseSchema, Br as UserPreferencesPatchSchema, Bt as ListOrganizationMembersPageResponseSchema, C as CompleteManagedDeployArtifactResponseSchema, Ci as resolveConnectAppSlug, Cn as PresignProjectSourceRequestSchema, Cr as TriggerRunListResponseSchema, Ct as HistoryRunListResponseSchema, D as ConnectManagedServiceCredentialRequestSchema, Di as AssignCredentialBodySchema, Dr as UpdateManagedServiceCredentialRequestSchema, Dt as InviteProjectMembersResponseSchema, E as ConnectAuthorizeUrlResponseSchema, En as PresignUserAvatarResponseSchema, Er as UpdateCredentialRequestSchema, Et as InviteProjectMembersRequestSchema, F as CreateCustomAppResponseSchema, Fn as ProjectSlugAvailabilityResponseSchema, Fr as UploadProjectSourceManifestRequestSchema, Ft as ListDraftFilesResponseSchema, G as CreateSlackAppResponseSchema, Gi as AutoTopupSummarySchema, Gn as QueuedAgentPromptResponseSchema, Gr as WorkflowFormResponseSchema, Gt as ListProjectMetricsResponseSchema, H as CreateProjectRequestSchema, Hi as PresignChatAttachmentRequestSchema, Hn as PublishManagedDeployCandidateResponseSchema, Hr as WorkflowCanvasCredentialBindingsSchema, Ht as ListProjectDeploymentsResponseSchema, I as CreateDraftCommitRequestSchema, In as PromptInputSchema, Ir as UploadProjectSourceResponseSchema, It as ListManagedServiceCredentialsResponseSchema, J as CredentialInstanceListResponseSchema, Ji as BillingRedirectResponseSchema, Jn as RenewManagedDeployUploadRequestSchema, Jr as WorkflowRunHooksResponseSchema, Jt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, K as CreateSlackChannelBodySchema, Ki as BillingActivityResponseSchema, Kn as QueuedRunResponseSchema, Kr as WorkflowFormUpsertBodySchema, Kt as ListProjectsResponseSchema, L as CreateDraftDiffCommitRequestSchema, Ln as PromptResponseSchema, Lr as UpsertGatewayAttachmentBodySchema, Lt as ListMcpAppToolsResponseSchema, M as CreateCredentialsRequestSchema, Mi as CredentialConsumerListResponseSchema, Mn as ProjectReachabilityResponseSchema, Mr as UpdateProjectMemberResponseSchema, Mt as ListChannelPlatformsResponseSchema, N as CreateCredentialsResponseSchema, Ni as ExecuteKeystrokeToolRequestSchema, Nn as ProjectResponseSchema, Nr as UpdateProjectRequestSchema, Nt as ListCredentialsPageQuerySchema, O as ConnectProvidersResponseSchema, Oi as CredentialAssignmentListQuerySchema, On as ProjectGitRemoteRequestSchema, Or as UpdateOrganizationMemberRequestSchema, Ot as ListAgentMemoryFilesResponseSchema, P as CreateCustomAppRequestSchema, Pn as ProjectSettingsResponseSchema, Pr as UpdateProjectSettingsRequestSchema, Pt as ListCredentialsPageResponseSchema, Q as DeclineOrganizationInvitationResponseSchema, Qi as ConfirmCheckoutResponseSchema, Qr as WorkflowRunResponseSchema, Qt as McpDiscoverResponseSchema, R as CreateOrganizationRequestSchema, Rn as PublicFormMetadataSchema, Rr as UserAvatarPatchSchema, Rt as ListOrganizationInvitationsResponseSchema, S as CompleteManagedDeployArtifactRequestSchema, Sn as PresignOrgLogoResponseSchema, Sr as TriggerRunDetailResponseSchema, St as HistoryRunListQuerySchema, T as CompleteProjectArtifactResponseSchema, Ti as slugifyAppName, Tn as PresignUserAvatarRequestSchema, Tr as UpdateCredentialInstanceBodySchema, Tt as InviteOrganizationMembersResponseSchema, U as CreateProjectResponseSchema, Ui as PresignChatAttachmentResponseSchema, Un as PublishedFormListResponseSchema, Ur as WorkflowCanvasRunSchema, Ut as ListProjectFilesResponseSchema, V as CreateProjectArtifactResponseSchema, Vi as CLIENT_CHANNEL_HEADER, Vn as PublishManagedDeployCandidateRequestSchema, Vr as UserPreferencesSchema, Vt as ListOrganizationsResponseSchema, W as CreateSlackAppRequestSchema, Wn as PublishedFormSchema, Wr as WorkflowCanvasSchema, Wt as ListProjectMembersResponseSchema, X as DOCS_QUERY_TOOL, Xi as BillingUsageResponseSchema, Xr as WorkflowRunInputsSchema, Xt as ManagedServiceCredentialSchema, Y as CredentialInstanceRecordSchema, Yi as BillingSummaryResponseSchema, Yn as RenewManagedDeployUploadResponseSchema, Yr as WorkflowRunInputsPutBodySchema, Yt as ManagedDeployResourceKeySchema, Z as DOCS_SEARCH_TOOL, Zi as ConfirmCheckoutRequestSchema, Zn as SLACK_PERSONAL_APP_SLUG, Zr as WorkflowRunListResponseSchema, Zt as ManagedServiceKindSchema, _ as CatalogAppsPageResponseSchema, _n as PrepareManagedDeployRequestSchema, _r as TemplateFilesResponseSchema, _t as HealthResponseSchema, a as AgentSessionListResponseSchema, ai as WorkspaceTriggerRunListResponseSchema, ar as SlackAppManifestResponseSchema, at as DraftUpdateEventSchema, b as ChannelConnectionSchema, bn as PresignCustomAppLogoResponseSchema, br as TriggerInvokeResponseSchema, bt as HistoryRunCancelResponseSchema, c as AgentTriggerSummaryListResponseSchema, ci as buildConnectDeeplink, cr as StartKeystrokeConnectionInputSchema, ct as FinalizeCustomAppLogoRequestSchema, d as BindChannelBodySchema, di as gitPorcelainLineTouchesManagedDraftPublishPath, dr as StartMcpOAuthConnectionResultSchema, dt as GatewayAttachmentRecordSchema, ea as CreateCreditsCheckoutRequestSchema, ei as WorkflowSummaryListResponseSchema, en as OrganizationSidebarBrandingPatchSchema, er as SkillSummaryListResponseSchema, et as DownloadActiveProjectSourceResponseSchema, f as CancelManagedDeployRequestSchema, fi as isAcceptableInstallExit, fn as PlatformAgentCancelResponseSchema, fr as StartOAuthConnectionInputSchema, ft as GetAppCatalogEntryResponseSchema, g as CatalogAppDetailResponseSchema, gi as normalizeDocsSearchPaths, gn as PlatformAgentSessionListResponseSchema, gr as SubmitTeamRequestRequestSchema, gt as GraphqlDiscoverResponseSchema, h as CatalogActionsPageResponseSchema, hn as PlatformAgentSessionDetailResponseSchema, hr as SubmitMarketingContactRequestSchema, ht as GetTemplateResponseSchema, i as AgentSessionDetailResponseSchema, ii as WorkspaceTriggerOverviewSchema, in as PROJECT_DRAFT_DIFF_MAX_BYTES, ir as SlackAppManifestRequestSchema, it as DraftRevisionResponseSchema, j as CreateCredentialInstanceBodySchema, ji as CredentialConsumerListQuerySchema, jn as ProjectPullStateSchema, jr as UpdateProjectMemberRequestSchema, jt as ListAppsResponseSchema, k as CreateApiKeyRequestSchema, ki as CredentialAssignmentListResponseSchema, kn as ProjectGitRemoteResponseSchema, kr as UpdateOrganizationMemberResponseSchema, kt as ListAgentWorkspaceFilesResponseSchema, l as AppSlugAvailabilityResponseSchema, li as deriveCustomAppDisplay, lr as StartKeystrokeConnectionResultSchema, lt as FinalizeCustomAppLogoResponseSchema, m as CatalogActionDetailResponseSchema, mi as isIgnoredProjectSourcePath, mn as PlatformAgentPromptResponseSchema, mr as SubmitAgentFeedbackRequestSchema, mt as GetCustomAppResponseSchema, n as ActiveOrganizationResponseSchema, na as UpdateAutoTopupRequestSchema, ni as WorkspaceTriggerFileSchema, nn as PNPM_FROZEN_INSTALL_ARGS, nr as SlackAppInstallStartResponseSchema, nt as DraftConflictResponseSchema, o as AgentSummaryDetailResponseSchema, oi as WorkspaceWorkflowOverviewSchema, on as PROJECT_PULL_STATE_RELATIVE_PATH, or as SlackMembershipChannelBodySchema, ot as DuplicateCredentialRequestSchema, p as CancelManagedDeployResponseSchema, pn as PlatformAgentPromptInputSchema, pr as StartOAuthConnectionResultSchema, pt as GetCredentialResponseSchema, q as CreateSlackChannelResponseSchema, qi as BillingInvoiceUrlResponseSchema, qn as RecentResourceListResponseSchema, qr as WorkflowRunDetailResponseSchema, qt as ListTemplatesResponseSchema, r as ActiveProjectSourceRevisionSchema, ri as WorkspaceTriggerListResponseSchema, rn as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, rr as SlackAppListResponseSchema, rt as DraftFileContentResponseSchema, s as AgentSummaryListResponseSchema, si as buildAgentSlackDeeplink, sn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, sr as SlugAvailabilityResponseSchema, st as DuplicateCredentialsResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ta as CreateSubscriptionCheckoutRequestSchema, ti as WorkspaceTriggerDetailSchema, tn as OrganizationSidebarBrandingSchema, tr as SlackAgentMembershipsResponseSchema, tt as DraftCommitResponseSchema, u as BindAgentSlackAppBodySchema, ui as detectProjectPackageManagerFromSnapshot, ur as StartMcpOAuthConnectionInputSchema, ut as FormFieldConfigSchema, v as ChannelAccountListResponseSchema, vi as parseAppSlug, vn as PrepareManagedDeployResponseSchema, vr as TriggerDetailResponseSchema, vt as HeartbeatManagedDeployRequestSchema, w as CompleteProjectArtifactRequestSchema, wi as resolveDocsMcpUrl, wn as PresignProjectSourceResponseSchema, wr as UpdateChannelBindingBodySchema, wt as InviteOrganizationMembersRequestSchema, x as ChannelDirectoryListResponseSchema, xi as parseSlackConnectFlow, xn as PresignOrgLogoRequestSchema, xr as TriggerListResponseSchema, xt as HistoryRunDetailResponseSchema, y as ChannelConnectionListResponseSchema, yi as parseErrorResponse, yn as PresignCustomAppLogoRequestSchema, yr as TriggerInvokeInputsSchema, yt as HeartbeatManagedDeployResponseSchema, z as CreateOrganizationResponseSchema, zn as PublicFormSubmitBodySchema, zr as UserAvatarSchema, zt as ListOrganizationMembersPageQuerySchema } from "./dist-
|
|
4
|
-
import { $ as artifactIndexFromModules, Q as withMcpReadClient, X as PublicHttpUrlError, Z as assertPublicHttpUrl, _t as configureTelemetry, bt as shutdownTelemetry, et as collectArtifactModules, gt as captureException, ht as alias, nt as moduleBlobRefsFromModules, tt as mapInParallelBatches, vt as event, yt as flushTelemetry } from "./dist-
|
|
5
|
-
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-
|
|
2
|
+
import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-D_nLqg4e.mjs";
|
|
3
|
+
import { $ as DownloadActiveProjectArtifactResponseSchema, $i as CreateBillingPortalRequestSchema, $n as SkillSummaryDetailResponseSchema, $r as WorkflowSummaryDetailResponseSchema, $t as OpenApiDiscoverResponseSchema, A as CreateApiKeyResponseSchema, Ai as CredentialAssignmentRecordSchema, An as ProjectGitStatusResponseSchema, Ar as UpdateOrganizationRequestSchema, At as ListApiKeysResponseSchema, B as CreateProjectArtifactRequestSchema, Bi as ACTIVE_ORG_HEADER, Bn as PublicFormSubmitResponseSchema, Br as UserPreferencesPatchSchema, Bt as ListOrganizationMembersPageResponseSchema, C as CompleteManagedDeployArtifactResponseSchema, Ci as resolveConnectAppSlug, Cn as PresignProjectSourceRequestSchema, Cr as TriggerRunListResponseSchema, Ct as HistoryRunListResponseSchema, D as ConnectManagedServiceCredentialRequestSchema, Di as AssignCredentialBodySchema, Dr as UpdateManagedServiceCredentialRequestSchema, Dt as InviteProjectMembersResponseSchema, E as ConnectAuthorizeUrlResponseSchema, En as PresignUserAvatarResponseSchema, Er as UpdateCredentialRequestSchema, Et as InviteProjectMembersRequestSchema, F as CreateCustomAppResponseSchema, Fn as ProjectSlugAvailabilityResponseSchema, Fr as UploadProjectSourceManifestRequestSchema, Ft as ListDraftFilesResponseSchema, G as CreateSlackAppResponseSchema, Gi as AutoTopupSummarySchema, Gn as QueuedAgentPromptResponseSchema, Gr as WorkflowFormResponseSchema, Gt as ListProjectMetricsResponseSchema, H as CreateProjectRequestSchema, Hi as PresignChatAttachmentRequestSchema, Hn as PublishManagedDeployCandidateResponseSchema, Hr as WorkflowCanvasCredentialBindingsSchema, Ht as ListProjectDeploymentsResponseSchema, I as CreateDraftCommitRequestSchema, In as PromptInputSchema, Ir as UploadProjectSourceResponseSchema, It as ListManagedServiceCredentialsResponseSchema, J as CredentialInstanceListResponseSchema, Ji as BillingRedirectResponseSchema, Jn as RenewManagedDeployUploadRequestSchema, Jr as WorkflowRunHooksResponseSchema, Jt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, K as CreateSlackChannelBodySchema, Ki as BillingActivityResponseSchema, Kn as QueuedRunResponseSchema, Kr as WorkflowFormUpsertBodySchema, Kt as ListProjectsResponseSchema, L as CreateDraftDiffCommitRequestSchema, Ln as PromptResponseSchema, Lr as UpsertGatewayAttachmentBodySchema, Lt as ListMcpAppToolsResponseSchema, M as CreateCredentialsRequestSchema, Mi as CredentialConsumerListResponseSchema, Mn as ProjectReachabilityResponseSchema, Mr as UpdateProjectMemberResponseSchema, Mt as ListChannelPlatformsResponseSchema, N as CreateCredentialsResponseSchema, Ni as ExecuteKeystrokeToolRequestSchema, Nn as ProjectResponseSchema, Nr as UpdateProjectRequestSchema, Nt as ListCredentialsPageQuerySchema, O as ConnectProvidersResponseSchema, Oi as CredentialAssignmentListQuerySchema, On as ProjectGitRemoteRequestSchema, Or as UpdateOrganizationMemberRequestSchema, Ot as ListAgentMemoryFilesResponseSchema, P as CreateCustomAppRequestSchema, Pn as ProjectSettingsResponseSchema, Pr as UpdateProjectSettingsRequestSchema, Pt as ListCredentialsPageResponseSchema, Q as DeclineOrganizationInvitationResponseSchema, Qi as ConfirmCheckoutResponseSchema, Qr as WorkflowRunResponseSchema, Qt as McpDiscoverResponseSchema, R as CreateOrganizationRequestSchema, Rn as PublicFormMetadataSchema, Rr as UserAvatarPatchSchema, Rt as ListOrganizationInvitationsResponseSchema, S as CompleteManagedDeployArtifactRequestSchema, Sn as PresignOrgLogoResponseSchema, Sr as TriggerRunDetailResponseSchema, St as HistoryRunListQuerySchema, T as CompleteProjectArtifactResponseSchema, Ti as slugifyAppName, Tn as PresignUserAvatarRequestSchema, Tr as UpdateCredentialInstanceBodySchema, Tt as InviteOrganizationMembersResponseSchema, U as CreateProjectResponseSchema, Ui as PresignChatAttachmentResponseSchema, Un as PublishedFormListResponseSchema, Ur as WorkflowCanvasRunSchema, Ut as ListProjectFilesResponseSchema, V as CreateProjectArtifactResponseSchema, Vi as CLIENT_CHANNEL_HEADER, Vn as PublishManagedDeployCandidateRequestSchema, Vr as UserPreferencesSchema, Vt as ListOrganizationsResponseSchema, W as CreateSlackAppRequestSchema, Wn as PublishedFormSchema, Wr as WorkflowCanvasSchema, Wt as ListProjectMembersResponseSchema, X as DOCS_QUERY_TOOL, Xi as BillingUsageResponseSchema, Xr as WorkflowRunInputsSchema, Xt as ManagedServiceCredentialSchema, Y as CredentialInstanceRecordSchema, Yi as BillingSummaryResponseSchema, Yn as RenewManagedDeployUploadResponseSchema, Yr as WorkflowRunInputsPutBodySchema, Yt as ManagedDeployResourceKeySchema, Z as DOCS_SEARCH_TOOL, Zi as ConfirmCheckoutRequestSchema, Zn as SLACK_PERSONAL_APP_SLUG, Zr as WorkflowRunListResponseSchema, Zt as ManagedServiceKindSchema, _ as CatalogAppsPageResponseSchema, _n as PrepareManagedDeployRequestSchema, _r as TemplateFilesResponseSchema, _t as HealthResponseSchema, a as AgentSessionListResponseSchema, ai as WorkspaceTriggerRunListResponseSchema, ar as SlackAppManifestResponseSchema, at as DraftUpdateEventSchema, b as ChannelConnectionSchema, bn as PresignCustomAppLogoResponseSchema, br as TriggerInvokeResponseSchema, bt as HistoryRunCancelResponseSchema, c as AgentTriggerSummaryListResponseSchema, ci as buildConnectDeeplink, cr as StartKeystrokeConnectionInputSchema, ct as FinalizeCustomAppLogoRequestSchema, d as BindChannelBodySchema, di as gitPorcelainLineTouchesManagedDraftPublishPath, dr as StartMcpOAuthConnectionResultSchema, dt as GatewayAttachmentRecordSchema, ea as CreateCreditsCheckoutRequestSchema, ei as WorkflowSummaryListResponseSchema, en as OrganizationSidebarBrandingPatchSchema, er as SkillSummaryListResponseSchema, et as DownloadActiveProjectSourceResponseSchema, f as CancelManagedDeployRequestSchema, fi as isAcceptableInstallExit, fn as PlatformAgentCancelResponseSchema, fr as StartOAuthConnectionInputSchema, ft as GetAppCatalogEntryResponseSchema, g as CatalogAppDetailResponseSchema, gi as normalizeDocsSearchPaths, gn as PlatformAgentSessionListResponseSchema, gr as SubmitTeamRequestRequestSchema, gt as GraphqlDiscoverResponseSchema, h as CatalogActionsPageResponseSchema, hn as PlatformAgentSessionDetailResponseSchema, hr as SubmitMarketingContactRequestSchema, ht as GetTemplateResponseSchema, i as AgentSessionDetailResponseSchema, ii as WorkspaceTriggerOverviewSchema, in as PROJECT_DRAFT_DIFF_MAX_BYTES, ir as SlackAppManifestRequestSchema, it as DraftRevisionResponseSchema, j as CreateCredentialInstanceBodySchema, ji as CredentialConsumerListQuerySchema, jn as ProjectPullStateSchema, jr as UpdateProjectMemberRequestSchema, jt as ListAppsResponseSchema, k as CreateApiKeyRequestSchema, ki as CredentialAssignmentListResponseSchema, kn as ProjectGitRemoteResponseSchema, kr as UpdateOrganizationMemberResponseSchema, kt as ListAgentWorkspaceFilesResponseSchema, l as AppSlugAvailabilityResponseSchema, li as deriveCustomAppDisplay, lr as StartKeystrokeConnectionResultSchema, lt as FinalizeCustomAppLogoResponseSchema, m as CatalogActionDetailResponseSchema, mi as isIgnoredProjectSourcePath, mn as PlatformAgentPromptResponseSchema, mr as SubmitAgentFeedbackRequestSchema, mt as GetCustomAppResponseSchema, n as ActiveOrganizationResponseSchema, na as UpdateAutoTopupRequestSchema, ni as WorkspaceTriggerFileSchema, nn as PNPM_FROZEN_INSTALL_ARGS, nr as SlackAppInstallStartResponseSchema, nt as DraftConflictResponseSchema, o as AgentSummaryDetailResponseSchema, oi as WorkspaceWorkflowOverviewSchema, on as PROJECT_PULL_STATE_RELATIVE_PATH, or as SlackMembershipChannelBodySchema, ot as DuplicateCredentialRequestSchema, p as CancelManagedDeployResponseSchema, pn as PlatformAgentPromptInputSchema, pr as StartOAuthConnectionResultSchema, pt as GetCredentialResponseSchema, q as CreateSlackChannelResponseSchema, qi as BillingInvoiceUrlResponseSchema, qn as RecentResourceListResponseSchema, qr as WorkflowRunDetailResponseSchema, qt as ListTemplatesResponseSchema, r as ActiveProjectSourceRevisionSchema, ri as WorkspaceTriggerListResponseSchema, rn as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, rr as SlackAppListResponseSchema, rt as DraftFileContentResponseSchema, s as AgentSummaryListResponseSchema, si as buildAgentSlackDeeplink, sn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, sr as SlugAvailabilityResponseSchema, st as DuplicateCredentialsResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ta as CreateSubscriptionCheckoutRequestSchema, ti as WorkspaceTriggerDetailSchema, tn as OrganizationSidebarBrandingSchema, tr as SlackAgentMembershipsResponseSchema, tt as DraftCommitResponseSchema, u as BindAgentSlackAppBodySchema, ui as detectProjectPackageManagerFromSnapshot, ur as StartMcpOAuthConnectionInputSchema, ut as FormFieldConfigSchema, v as ChannelAccountListResponseSchema, vi as parseAppSlug, vn as PrepareManagedDeployResponseSchema, vr as TriggerDetailResponseSchema, vt as HeartbeatManagedDeployRequestSchema, w as CompleteProjectArtifactRequestSchema, wi as resolveDocsMcpUrl, wn as PresignProjectSourceResponseSchema, wr as UpdateChannelBindingBodySchema, wt as InviteOrganizationMembersRequestSchema, x as ChannelDirectoryListResponseSchema, xi as parseSlackConnectFlow, xn as PresignOrgLogoRequestSchema, xr as TriggerListResponseSchema, xt as HistoryRunDetailResponseSchema, y as ChannelConnectionListResponseSchema, yi as parseErrorResponse, yn as PresignCustomAppLogoRequestSchema, yr as TriggerInvokeInputsSchema, yt as HeartbeatManagedDeployResponseSchema, z as CreateOrganizationResponseSchema, zn as PublicFormSubmitBodySchema, zr as UserAvatarSchema, zt as ListOrganizationMembersPageQuerySchema } from "./dist-BgPOKEEt.mjs";
|
|
4
|
+
import { $ as artifactIndexFromModules, Q as withMcpReadClient, X as PublicHttpUrlError, Z as assertPublicHttpUrl, _t as configureTelemetry, bt as shutdownTelemetry, et as collectArtifactModules, gt as captureException, ht as alias, nt as moduleBlobRefsFromModules, tt as mapInParallelBatches, vt as event, yt as flushTelemetry } from "./dist-fy1jz-eq.mjs";
|
|
5
|
+
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-v54rjb2O.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import { homedir, platform, release, tmpdir } from "node:os";
|
|
@@ -11,7 +11,7 @@ import { chmodSync, cpSync, existsSync, lstatSync, mkdirSync, readFileSync, real
|
|
|
11
11
|
import { execFile, spawn, spawnSync } from "node:child_process";
|
|
12
12
|
import { Entry } from "@napi-rs/keyring";
|
|
13
13
|
import { PostHog } from "posthog-node";
|
|
14
|
-
import { access, chmod,
|
|
14
|
+
import { access, chmod, lstat, mkdir, mkdtemp, readFile, readdir, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
15
15
|
import { confirm, input } from "@inquirer/prompts";
|
|
16
16
|
import { createHash, randomUUID } from "node:crypto";
|
|
17
17
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
|
|
@@ -7739,21 +7739,21 @@ function listActionsHint(app) {
|
|
|
7739
7739
|
/** Hint when listing actions for a custom org app (no toolkit tools). */
|
|
7740
7740
|
function listCustomAppActionsHint(app) {
|
|
7741
7741
|
const bin = cliBinaryName();
|
|
7742
|
-
return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n Smoke-test: deploy a thin workflow that calls the action, then\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n (${bin} apps execute is catalog
|
|
7742
|
+
return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n Smoke-test: deploy a thin workflow that calls the action, then\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n (${bin} apps execute is for catalog toolkit actions and custom MCP tools.)\n`;
|
|
7743
7743
|
}
|
|
7744
7744
|
/**
|
|
7745
|
-
* Error when `apps execute` is pointed at a custom org app (`{org}/{name}`).
|
|
7745
|
+
* Error when `apps execute` is pointed at a non-MCP custom org app (`{org}/{name}`).
|
|
7746
7746
|
* Catalog toolkit execute cannot reach defineApp(...).action(...) project code.
|
|
7747
7747
|
*/
|
|
7748
7748
|
function customAppExecuteError(app, options) {
|
|
7749
7749
|
const bin = cliBinaryName();
|
|
7750
|
-
|
|
7751
|
-
return `${bin} apps execute
|
|
7750
|
+
if (options?.source === "mcp") return `"${app}" is a custom MCP app. Smoke-test a remote tool after connect:\n ${bin} apps actions list ${app}\n ${bin} apps execute ${app} <tool> --input '{...}'\n`;
|
|
7751
|
+
return `${bin} apps execute runs catalog toolkit actions and custom MCP tools.\n"${app}" is a custom org app — its actions live in project code as defineApp(...).action(...), not in the catalog.\n\nSmoke-test a custom app action by deploying a thin workflow that calls it, then:\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n\n Inspect app: ${bin} apps get ${app}\n Scaffold/author: ${bin} apps sync ${app}\n`;
|
|
7752
7752
|
}
|
|
7753
7753
|
/** Hint after listing live tools on a connected custom MCP app. */
|
|
7754
7754
|
function listMcpAppActionsHint(app) {
|
|
7755
7755
|
const bin = cliBinaryName();
|
|
7756
|
-
return `\nMCP tool registry (live tools/list).\n Docs first: ${bin} docs search "custom apps MCP"\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Author actions: defineApp(
|
|
7756
|
+
return `\nMCP tool registry (live tools/list).\n Docs first: ${bin} docs search "custom apps MCP"\n Inspect app: ${bin} apps get ${app}\n Smoke-test tool: ${bin} apps execute ${app} <tool> --input '{...}'\n Scaffold code: ${bin} apps sync ${app}\n Author actions: defineApp(...).action(...) from the tool schemas above\n Attach to agent: tools: [<app>] for every registered action, or pick actions\n Do not use defineMcp from @keystrokehq/keystroke/agent.\n`;
|
|
7757
7757
|
}
|
|
7758
7758
|
/** Hint when MCP list fails because the app is not connected. */
|
|
7759
7759
|
function listMcpAppConnectHint(app) {
|
|
@@ -8101,10 +8101,27 @@ function isNotFoundError(error) {
|
|
|
8101
8101
|
if (error.status === 404) return true;
|
|
8102
8102
|
return /not found/i.test(error.message);
|
|
8103
8103
|
}
|
|
8104
|
+
async function executeConnectedAppTool(client, app, tool, options) {
|
|
8105
|
+
const credentialSlug = options.credentialSlug?.trim() || void 0;
|
|
8106
|
+
const projectSlug = options.projectSlug?.trim() || void 0;
|
|
8107
|
+
try {
|
|
8108
|
+
const { result } = await client.apps.executeTool({
|
|
8109
|
+
app,
|
|
8110
|
+
tool,
|
|
8111
|
+
...options.version ? { version: options.version } : {},
|
|
8112
|
+
arguments: typeof options.input === "object" && options.input !== null && !Array.isArray(options.input) ? options.input : {},
|
|
8113
|
+
...credentialSlug ? { credentialSlug } : {},
|
|
8114
|
+
...projectSlug ? { projectSlug } : {}
|
|
8115
|
+
});
|
|
8116
|
+
return result;
|
|
8117
|
+
} catch (error) {
|
|
8118
|
+
if (isNotConnectedError(error) && !credentialSlug) throw new Error(`Not connected to ${app}. Run: ${cliBinaryName()} connect ${app}`);
|
|
8119
|
+
throw error;
|
|
8120
|
+
}
|
|
8121
|
+
}
|
|
8104
8122
|
async function runAppExecute(client, appSlug, toolSlug, options) {
|
|
8105
8123
|
const app = appSlug.trim().toLowerCase();
|
|
8106
|
-
|
|
8107
|
-
if (!app || !tool) throw new Error("App and tool slugs are required (e.g. github github_get_the_authenticated_user)");
|
|
8124
|
+
if (!app || !toolSlug.trim()) throw new Error("App and tool slugs are required (e.g. github github_get_the_authenticated_user)");
|
|
8108
8125
|
const parsed = parseAppSlug(app);
|
|
8109
8126
|
if (parsed.kind === "org") {
|
|
8110
8127
|
let source;
|
|
@@ -8112,35 +8129,26 @@ async function runAppExecute(client, appSlug, toolSlug, options) {
|
|
|
8112
8129
|
const shown = await runAppShow(client, parsed.slug);
|
|
8113
8130
|
if (shown.kind === "custom") source = shown.app.source;
|
|
8114
8131
|
} catch {}
|
|
8132
|
+
if (source === "mcp") return executeConnectedAppTool(client, parsed.slug, toolSlug.trim(), options);
|
|
8115
8133
|
throw new Error(customAppExecuteError(parsed.slug, { source }));
|
|
8116
8134
|
}
|
|
8117
|
-
const
|
|
8118
|
-
const projectSlug = options.projectSlug?.trim() || void 0;
|
|
8135
|
+
const tool = toolSlug.trim().toUpperCase();
|
|
8119
8136
|
let version = options.version?.trim() || void 0;
|
|
8120
8137
|
if (!version) try {
|
|
8121
8138
|
version = (await client.apps.getCatalogAction(tool)).version?.trim() || void 0;
|
|
8122
8139
|
} catch (error) {
|
|
8123
8140
|
if (isNotFoundError(error)) {
|
|
8124
8141
|
const shown = await runAppShow(client, app).catch(() => null);
|
|
8142
|
+
if (shown?.kind === "custom" && shown.app.source === "mcp") return executeConnectedAppTool(client, shown.app.slug, toolSlug.trim(), options);
|
|
8125
8143
|
if (shown?.kind === "custom") throw new Error(customAppExecuteError(shown.app.slug, { source: shown.app.source }));
|
|
8126
8144
|
}
|
|
8127
8145
|
throw error;
|
|
8128
8146
|
}
|
|
8129
8147
|
if (!version) throw new Error(`Catalog action "${tool}" has no pinned version. Pass --version explicitly.`);
|
|
8130
|
-
|
|
8131
|
-
|
|
8132
|
-
|
|
8133
|
-
|
|
8134
|
-
version,
|
|
8135
|
-
arguments: typeof options.input === "object" && options.input !== null && !Array.isArray(options.input) ? options.input : {},
|
|
8136
|
-
...credentialSlug ? { credentialSlug } : {},
|
|
8137
|
-
...projectSlug ? { projectSlug } : {}
|
|
8138
|
-
});
|
|
8139
|
-
return result;
|
|
8140
|
-
} catch (error) {
|
|
8141
|
-
if (isNotConnectedError(error) && !credentialSlug) throw new Error(`Not connected to ${app}. Run: ${cliBinaryName()} connect ${app}`);
|
|
8142
|
-
throw error;
|
|
8143
|
-
}
|
|
8148
|
+
return executeConnectedAppTool(client, app, tool, {
|
|
8149
|
+
...options,
|
|
8150
|
+
version
|
|
8151
|
+
});
|
|
8144
8152
|
}
|
|
8145
8153
|
//#endregion
|
|
8146
8154
|
//#region src/commands/apps/execute.ts
|
|
@@ -8228,13 +8236,15 @@ function resolveSyncedAppDirName(slug) {
|
|
|
8228
8236
|
}
|
|
8229
8237
|
function generateAppStub(app) {
|
|
8230
8238
|
const exportName = resolveSyncedAppExportName(app.slug);
|
|
8231
|
-
const
|
|
8239
|
+
const isMcp = app.source === "mcp";
|
|
8240
|
+
const mcpNote = isMcp ? `\n * MCP URL: ${app.url ?? "(missing)"}. After connect, run \`keystroke apps actions list ${app.slug}\` to inspect tools, author \`app.action(...)\` wrappers, then put \`${exportName}\` in an agent's \`tools: [${exportName}]\` (or pick individual actions).` : "";
|
|
8241
|
+
const sourceField = isMcp ? `\n source: "mcp",` : "";
|
|
8232
8242
|
if (app.authKind === "oauth") return `import { defineApp } from "@keystrokehq/keystroke/app";
|
|
8233
8243
|
|
|
8234
8244
|
/** Synced from platform app \`${app.slug}\`. Re-run \`keystroke apps sync ${app.slug}\` after template changes.${mcpNote} */
|
|
8235
8245
|
export const ${exportName} = defineApp({
|
|
8236
8246
|
slug: ${JSON.stringify(app.slug)},
|
|
8237
|
-
auth: "oauth"
|
|
8247
|
+
auth: "oauth",${sourceField}
|
|
8238
8248
|
});
|
|
8239
8249
|
`;
|
|
8240
8250
|
const credentialLines = Object.entries(app.credentialFields ?? {}).map(([key, field]) => {
|
|
@@ -8246,7 +8256,7 @@ import { z } from "zod";
|
|
|
8246
8256
|
/** Synced from platform app \`${app.slug}\`. Re-run \`keystroke apps sync ${app.slug}\` after template changes.${mcpNote} */
|
|
8247
8257
|
export const ${exportName} = defineApp({
|
|
8248
8258
|
slug: ${JSON.stringify(app.slug)},
|
|
8249
|
-
auth: "api_key"
|
|
8259
|
+
auth: "api_key",${sourceField}
|
|
8250
8260
|
credential: {
|
|
8251
8261
|
${credentialLines}
|
|
8252
8262
|
},
|
|
@@ -8966,7 +8976,7 @@ function registerBuildCommand(program) {
|
|
|
8966
8976
|
try {
|
|
8967
8977
|
const root = resolveProjectRoot(options.dir);
|
|
8968
8978
|
await ensureSdkCurrent(root);
|
|
8969
|
-
const { buildApp } = await import("./dist-
|
|
8979
|
+
const { buildApp } = await import("./dist-Co-J5D_c.mjs");
|
|
8970
8980
|
await buildApp({ root });
|
|
8971
8981
|
process.stdout.write(`Built ${root}\n`);
|
|
8972
8982
|
} catch (error) {
|
|
@@ -9793,136 +9803,31 @@ function managedDeployNeedsImpactAcceptance(preflight) {
|
|
|
9793
9803
|
return preflight.mode === "filtered" && (preflight.impactCompleteness === "unknown" || preflight.impactedResourceKeys.length > 0 || preflight.expansions.length > 0 || preflight.requestedResourceKeys.length !== preflight.resourceKeys.length || !preflight.requestedResourceKeys.every((key) => preflight.resourceKeys.includes(key)));
|
|
9794
9804
|
}
|
|
9795
9805
|
//#endregion
|
|
9796
|
-
//#region src/git/compute-working-tree-diff.ts
|
|
9797
|
-
/** Resolve a path returned by `git rev-parse --git-path` (absolute or cwd-relative). */
|
|
9798
|
-
function resolveGitPath(cwd, gitPath) {
|
|
9799
|
-
return isAbsolute(gitPath) ? gitPath : resolve(cwd, gitPath);
|
|
9800
|
-
}
|
|
9801
|
-
async function listNullSeparatedPaths(cwd, args, env) {
|
|
9802
|
-
const { stdout } = await runGit(args, {
|
|
9803
|
-
cwd,
|
|
9804
|
-
env
|
|
9805
|
-
});
|
|
9806
|
-
return stdout.split("\0").filter((path) => path.length > 0);
|
|
9807
|
-
}
|
|
9808
|
-
/**
|
|
9809
|
-
* Build a `git diff --binary` from `baseSha` to the desired working tree
|
|
9810
|
-
* (staged + unstaged + untracked), without mutating the real index.
|
|
9811
|
-
*
|
|
9812
|
-
* Uses `GIT_INDEX_FILE` against a copied index. Source-excluded paths
|
|
9813
|
-
* (`.env`, `node_modules`, `.keystroke`, …) keep their `baseSha` blob when
|
|
9814
|
-
* present on D0 (so the patch never deletes or locally-edits them); otherwise
|
|
9815
|
-
* they are dropped from the temp index so untracked secrets stay out.
|
|
9816
|
-
*/
|
|
9817
|
-
async function computeWorkingTreeDiff(input) {
|
|
9818
|
-
const baseEnv = input.env;
|
|
9819
|
-
const gitIndexPath = (await runGit([
|
|
9820
|
-
"rev-parse",
|
|
9821
|
-
"--git-path",
|
|
9822
|
-
"index"
|
|
9823
|
-
], {
|
|
9824
|
-
cwd: input.cwd,
|
|
9825
|
-
env: baseEnv
|
|
9826
|
-
})).stdout.trim();
|
|
9827
|
-
const realIndexPath = resolveGitPath(input.cwd, gitIndexPath);
|
|
9828
|
-
const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-index-"));
|
|
9829
|
-
const tempIndexPath = input.resolveTempIndexPath?.() ?? join(tempDir, "index");
|
|
9830
|
-
try {
|
|
9831
|
-
await copyFile(realIndexPath, tempIndexPath);
|
|
9832
|
-
const indexEnv = {
|
|
9833
|
-
...baseEnv,
|
|
9834
|
-
GIT_INDEX_FILE: tempIndexPath
|
|
9835
|
-
};
|
|
9836
|
-
await runGit([
|
|
9837
|
-
"add",
|
|
9838
|
-
"-A",
|
|
9839
|
-
"--",
|
|
9840
|
-
"."
|
|
9841
|
-
], {
|
|
9842
|
-
cwd: input.cwd,
|
|
9843
|
-
env: indexEnv
|
|
9844
|
-
});
|
|
9845
|
-
const baseExcluded = (await listNullSeparatedPaths(input.cwd, [
|
|
9846
|
-
"ls-tree",
|
|
9847
|
-
"-r",
|
|
9848
|
-
"--name-only",
|
|
9849
|
-
"-z",
|
|
9850
|
-
input.baseSha
|
|
9851
|
-
], baseEnv)).filter((path) => isIgnoredProjectSourcePath(path));
|
|
9852
|
-
for (const path of baseExcluded) await runGit([
|
|
9853
|
-
"restore",
|
|
9854
|
-
"--source",
|
|
9855
|
-
input.baseSha,
|
|
9856
|
-
"--staged",
|
|
9857
|
-
"--",
|
|
9858
|
-
path
|
|
9859
|
-
], {
|
|
9860
|
-
cwd: input.cwd,
|
|
9861
|
-
env: indexEnv
|
|
9862
|
-
});
|
|
9863
|
-
const indexExcluded = (await listNullSeparatedPaths(input.cwd, ["ls-files", "-z"], indexEnv)).filter((path) => isIgnoredProjectSourcePath(path));
|
|
9864
|
-
const baseExcludedSet = new Set(baseExcluded);
|
|
9865
|
-
const toRemove = indexExcluded.filter((path) => !baseExcludedSet.has(path));
|
|
9866
|
-
if (toRemove.length > 0) await runGit([
|
|
9867
|
-
"rm",
|
|
9868
|
-
"--cached",
|
|
9869
|
-
"-f",
|
|
9870
|
-
"-q",
|
|
9871
|
-
"--",
|
|
9872
|
-
...toRemove
|
|
9873
|
-
], {
|
|
9874
|
-
cwd: input.cwd,
|
|
9875
|
-
env: indexEnv
|
|
9876
|
-
});
|
|
9877
|
-
const diff = await runGitBuffer([
|
|
9878
|
-
"diff",
|
|
9879
|
-
"--binary",
|
|
9880
|
-
"--cached",
|
|
9881
|
-
input.baseSha
|
|
9882
|
-
], {
|
|
9883
|
-
cwd: input.cwd,
|
|
9884
|
-
env: indexEnv,
|
|
9885
|
-
reject: false
|
|
9886
|
-
});
|
|
9887
|
-
if (diff.code !== 0 && diff.code !== 1) throw new Error(`git diff --binary failed (exit ${diff.code}): ${diff.stderr.toString("utf8")}`);
|
|
9888
|
-
if (diff.stdout.byteLength > 2097152) throw new ExpectedCliError(`Working tree diff exceeds the ${PROJECT_DRAFT_DIFF_MAX_BYTES} byte limit. Reduce local changes or split them before syncing.`);
|
|
9889
|
-
return new Uint8Array(diff.stdout);
|
|
9890
|
-
} finally {
|
|
9891
|
-
await rm(tempDir, {
|
|
9892
|
-
recursive: true,
|
|
9893
|
-
force: true
|
|
9894
|
-
}).catch(() => {});
|
|
9895
|
-
}
|
|
9896
|
-
}
|
|
9897
|
-
//#endregion
|
|
9898
9806
|
//#region src/git/commit-working-tree.ts
|
|
9899
9807
|
/**
|
|
9900
9808
|
* Create a local commit from the desired working tree (source-filtered),
|
|
9901
9809
|
* parented by `baseSha`, without mutating the real index. Returns null when
|
|
9902
9810
|
* the resulting tree matches `baseSha`.
|
|
9811
|
+
*
|
|
9812
|
+
* Seeds the temp index with `read-tree baseSha` (not a copy of the real index)
|
|
9813
|
+
* so same-size same-mtime worktree rewrites cannot be skipped under racy-git.
|
|
9903
9814
|
*/
|
|
9904
9815
|
async function commitWorkingTreeOntoBase(input) {
|
|
9905
9816
|
const baseEnv = await resolveGitCommitEnv({
|
|
9906
9817
|
cwd: input.cwd,
|
|
9907
9818
|
env: input.env
|
|
9908
9819
|
});
|
|
9909
|
-
const gitIndexPath = (await runGit([
|
|
9910
|
-
"rev-parse",
|
|
9911
|
-
"--git-path",
|
|
9912
|
-
"index"
|
|
9913
|
-
], {
|
|
9914
|
-
cwd: input.cwd,
|
|
9915
|
-
env: baseEnv
|
|
9916
|
-
})).stdout.trim();
|
|
9917
|
-
const realIndexPath = resolveGitPath(input.cwd, gitIndexPath);
|
|
9918
9820
|
const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-commit-"));
|
|
9919
9821
|
const tempIndexPath = join(tempDir, "index");
|
|
9920
9822
|
try {
|
|
9921
|
-
await copyFile(realIndexPath, tempIndexPath);
|
|
9922
9823
|
const indexEnv = {
|
|
9923
9824
|
...baseEnv,
|
|
9924
9825
|
GIT_INDEX_FILE: tempIndexPath
|
|
9925
9826
|
};
|
|
9827
|
+
await runGit(["read-tree", input.baseSha], {
|
|
9828
|
+
cwd: input.cwd,
|
|
9829
|
+
env: indexEnv
|
|
9830
|
+
});
|
|
9926
9831
|
await runGit([
|
|
9927
9832
|
"add",
|
|
9928
9833
|
"-A",
|
|
@@ -10000,6 +9905,101 @@ async function commitWorkingTreeOntoBase(input) {
|
|
|
10000
9905
|
}
|
|
10001
9906
|
}
|
|
10002
9907
|
//#endregion
|
|
9908
|
+
//#region src/git/compute-working-tree-diff.ts
|
|
9909
|
+
async function listNullSeparatedPaths(cwd, args, env) {
|
|
9910
|
+
const { stdout } = await runGit(args, {
|
|
9911
|
+
cwd,
|
|
9912
|
+
env
|
|
9913
|
+
});
|
|
9914
|
+
return stdout.split("\0").filter((path) => path.length > 0);
|
|
9915
|
+
}
|
|
9916
|
+
/**
|
|
9917
|
+
* Build a `git diff --binary` from `baseSha` to the desired working tree
|
|
9918
|
+
* (staged + unstaged + untracked), without mutating the real index.
|
|
9919
|
+
*
|
|
9920
|
+
* Seeds a temp `GIT_INDEX_FILE` with `read-tree baseSha` (zeroed stats) then
|
|
9921
|
+
* `git add -A`. Copying the real index is unsafe: same-size same-mtime rewrites
|
|
9922
|
+
* can look clean under racy-git once the copied index file is newer than the
|
|
9923
|
+
* worktree. Source-excluded paths (`.env`, `node_modules`, `.keystroke`, …)
|
|
9924
|
+
* keep their `baseSha` blob when present on D0 (so the patch never deletes or
|
|
9925
|
+
* locally-edits them); otherwise they are dropped from the temp index so
|
|
9926
|
+
* untracked secrets stay out.
|
|
9927
|
+
*/
|
|
9928
|
+
async function computeWorkingTreeDiff(input) {
|
|
9929
|
+
const baseEnv = input.env;
|
|
9930
|
+
const tempDir = await mkdtemp(join(tmpdir(), "keystroke-draft-index-"));
|
|
9931
|
+
const tempIndexPath = input.resolveTempIndexPath?.() ?? join(tempDir, "index");
|
|
9932
|
+
try {
|
|
9933
|
+
const indexEnv = {
|
|
9934
|
+
...baseEnv,
|
|
9935
|
+
GIT_INDEX_FILE: tempIndexPath
|
|
9936
|
+
};
|
|
9937
|
+
await runGit(["read-tree", input.baseSha], {
|
|
9938
|
+
cwd: input.cwd,
|
|
9939
|
+
env: indexEnv
|
|
9940
|
+
});
|
|
9941
|
+
await runGit([
|
|
9942
|
+
"add",
|
|
9943
|
+
"-A",
|
|
9944
|
+
"--",
|
|
9945
|
+
"."
|
|
9946
|
+
], {
|
|
9947
|
+
cwd: input.cwd,
|
|
9948
|
+
env: indexEnv
|
|
9949
|
+
});
|
|
9950
|
+
const baseExcluded = (await listNullSeparatedPaths(input.cwd, [
|
|
9951
|
+
"ls-tree",
|
|
9952
|
+
"-r",
|
|
9953
|
+
"--name-only",
|
|
9954
|
+
"-z",
|
|
9955
|
+
input.baseSha
|
|
9956
|
+
], baseEnv)).filter((path) => isIgnoredProjectSourcePath(path));
|
|
9957
|
+
for (const path of baseExcluded) await runGit([
|
|
9958
|
+
"restore",
|
|
9959
|
+
"--source",
|
|
9960
|
+
input.baseSha,
|
|
9961
|
+
"--staged",
|
|
9962
|
+
"--",
|
|
9963
|
+
path
|
|
9964
|
+
], {
|
|
9965
|
+
cwd: input.cwd,
|
|
9966
|
+
env: indexEnv
|
|
9967
|
+
});
|
|
9968
|
+
const indexExcluded = (await listNullSeparatedPaths(input.cwd, ["ls-files", "-z"], indexEnv)).filter((path) => isIgnoredProjectSourcePath(path));
|
|
9969
|
+
const baseExcludedSet = new Set(baseExcluded);
|
|
9970
|
+
const toRemove = indexExcluded.filter((path) => !baseExcludedSet.has(path));
|
|
9971
|
+
if (toRemove.length > 0) await runGit([
|
|
9972
|
+
"rm",
|
|
9973
|
+
"--cached",
|
|
9974
|
+
"-f",
|
|
9975
|
+
"-q",
|
|
9976
|
+
"--",
|
|
9977
|
+
...toRemove
|
|
9978
|
+
], {
|
|
9979
|
+
cwd: input.cwd,
|
|
9980
|
+
env: indexEnv
|
|
9981
|
+
});
|
|
9982
|
+
const diff = await runGitBuffer([
|
|
9983
|
+
"diff",
|
|
9984
|
+
"--binary",
|
|
9985
|
+
"--cached",
|
|
9986
|
+
input.baseSha
|
|
9987
|
+
], {
|
|
9988
|
+
cwd: input.cwd,
|
|
9989
|
+
env: indexEnv,
|
|
9990
|
+
reject: false
|
|
9991
|
+
});
|
|
9992
|
+
if (diff.code !== 0 && diff.code !== 1) throw new Error(`git diff --binary failed (exit ${diff.code}): ${diff.stderr.toString("utf8")}`);
|
|
9993
|
+
if (diff.stdout.byteLength > 2097152) throw new ExpectedCliError(`Working tree diff exceeds the ${PROJECT_DRAFT_DIFF_MAX_BYTES} byte limit. Reduce local changes or split them before syncing.`);
|
|
9994
|
+
return new Uint8Array(diff.stdout);
|
|
9995
|
+
} finally {
|
|
9996
|
+
await rm(tempDir, {
|
|
9997
|
+
recursive: true,
|
|
9998
|
+
force: true
|
|
9999
|
+
}).catch(() => {});
|
|
10000
|
+
}
|
|
10001
|
+
}
|
|
10002
|
+
//#endregion
|
|
10003
10003
|
//#region src/git/managed-transport.ts
|
|
10004
10004
|
/**
|
|
10005
10005
|
* Fetch a remote branch into a temporary ref, then pin to an exact commit SHA.
|
|
@@ -14210,7 +14210,7 @@ function createProgram() {
|
|
|
14210
14210
|
async function runCli(argv) {
|
|
14211
14211
|
initCliTelemetry();
|
|
14212
14212
|
try {
|
|
14213
|
-
const { maybeAutoUpdate } = await import("./maybe-auto-update-
|
|
14213
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-oRHYV8-i.mjs");
|
|
14214
14214
|
await maybeAutoUpdate(argv);
|
|
14215
14215
|
await createProgram().parseAsync(argv);
|
|
14216
14216
|
} finally {
|
|
@@ -14220,4 +14220,4 @@ async function runCli(argv) {
|
|
|
14220
14220
|
//#endregion
|
|
14221
14221
|
export { runCli };
|
|
14222
14222
|
|
|
14223
|
-
//# sourceMappingURL=program-
|
|
14223
|
+
//# sourceMappingURL=program-CKQqD-RE.mjs.map
|