@keystrokehq/cli 0.1.129 → 0.1.130

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/index.mjs CHANGED
@@ -32,7 +32,7 @@ try {
32
32
  process.exitCode = 1;
33
33
  process.exit(1);
34
34
  }
35
- const { runCli } = await import("./program-P9sMfvOJ.mjs");
35
+ const { runCli } = await import("./program-F1fudP02.mjs");
36
36
  await runCli(process.argv);
37
37
  //#endregion
38
38
  export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { _ as resolveCliRoot, a as formatReleaseAgeBlockMessage, g as readCliVersion, h as isNewerVersion, i as fetchLatestCliRelease, n as computeReleaseAgeRetryAfter, o as isReleaseAgeBlock, r as readPnpmMinimumReleaseAgeMinutes, s as detectCliInstall, t as runPackageManagerUpdate, y as getCliConfigDir } from "./run-package-manager-update-VgnhaJJP.mjs";
2
+ import { _ as resolveCliRoot, a as formatReleaseAgeBlockMessage, g as readCliVersion, h as isNewerVersion, i as fetchLatestCliRelease, n as computeReleaseAgeRetryAfter, o as isReleaseAgeBlock, r as readPnpmMinimumReleaseAgeMinutes, s as detectCliInstall, t as runPackageManagerUpdate, y as getCliConfigDir } from "./run-package-manager-update-D1GM1hMJ.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";
@@ -136,4 +136,4 @@ async function maybeAutoUpdate(argv) {
136
136
  //#endregion
137
137
  export { maybeAutoUpdate };
138
138
 
139
- //# sourceMappingURL=maybe-auto-update-Cmv6qJkE.mjs.map
139
+ //# sourceMappingURL=maybe-auto-update-C81fdNvj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"maybe-auto-update-Cmv6qJkE.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 { isNewerVersion } 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 { 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 === \"--local\" ||\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 release = await fetchLatestCliRelease();\n\n if (!release || !isNewerVersion(release.version, currentVersion)) {\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} via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install);\n const installedVersion = readCliVersion();\n\n if (isNewerVersion(installedVersion, currentVersion)) {\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,SAAS;AACrC;AAEA,SAAgB,sBAAsB,SAI7B;CACP,sBACE;EACE,gBAAgB,QAAQ;EACxB,cAAc,QAAQ,YAAY,YAAY;CAChD,GACA,QAAQ,SACV;AACF;AAEA,SAAg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cesContent":["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 { isNewerVersion } 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 { 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 === \"--local\" ||\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 release = await fetchLatestCliRelease();\n\n if (!release || !isNewerVersion(release.version, currentVersion)) {\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} via ${install.packageManager}...\\n`,\n );\n\n const result = runPackageManagerUpdate(install);\n const installedVersion = readCliVersion();\n\n if (isNewerVersion(installedVersion, currentVersion)) {\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,SAAS;AACrC;AAEA,SAAgB,sBAAsB,SAI7B;CACP,sBACE;EACE,gBAAgB,QAAQ;EACxB,cAAc,QAAQ,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$ as CredentialInstanceListResponseSchema, $n as UpdateProjectRequestSchema, $t as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, A as ConnectAuthorizeUrlResponseSchema, An as StartKeystrokeConnectionResultSchema, Ar as detectProjectPackageManagerFromSnapshot, At as ListAgentWorkspaceFilesResponseSchema, B as CreateCustomAppRequestSchema, Bn as TriggerListResponseSchema, Br as resolveDocsMcpUrl, Bt as ListOrganizationsResponseSchema, C as ChannelAccountListResponseSchema, Cn as QueuedRunResponseSchema, Cr as WorkspaceTriggerListResponseSchema, Ct as HistoryRunListResponseSchema, D as CompleteProjectArtifactResponseSchema, Dn as SkillSummaryListResponseSchema, Dr as buildConnectDeeplink, Dt as InviteProjectMembersResponseSchema, E as ChannelDirectoryListResponseSchema, En as SkillSummaryDetailResponseSchema, Er as WorkspaceWorkflowOverviewSchema, Et as InviteProjectMembersRequestSchema, F as CreateBillingPortalRequestSchema, Fn as SubmitMarketingContactRequestSchema, Fr as parseAppSlug, Ft as ListCredentialsPageResponseSchema, G as CreateProjectRequestSchema, Gn as UpdateCredentialInstanceBodySchema, Gt as ListProjectsResponseSchema, H as CreateOrganizationRequestSchema, Hn as TriggerRunListResponseSchema, Hr as slugifyAppName, Ht as ListProjectFilesResponseSchema, I as CreateCredentialInstanceBodySchema, In as SubmitTeamRequestRequestSchema, Ir as parseErrorResponse, It as ListManagedServiceCredentialsResponseSchema, J as CredentialAssignmentListQuerySchema, Jn as UpdateOrganizationMemberRequestSchema, Jt as McpDiscoverResponseSchema, K as CreateProjectResponseSchema, Kn as UpdateCredentialRequestSchema, Kt as ManagedServiceCredentialSchema, L as CreateCredentialsRequestSchema, Ln as TriggerDetailResponseSchema, Lt as ListOrganizationInvitationsResponseSchema, M as ConnectProvidersResponseSchema, Mn as StartMcpOAuthConnectionResultSchema, Mr as listenPortFromPublicUrl, Mt as ListAppsResponseSchema, N as CreateApiKeyRequestSchema, Nn as StartOAuthConnectionInputSchema, Nt as ListChannelPlatformsResponseSchema, O as ConfirmCheckoutRequestSchema, On as SlugAvailabilityResponseSchema, P as CreateApiKeyResponseSchema, Pn as StartOAuthConnectionResultSchema, Pt as ListCredentialsPageQuerySchema, Q as CredentialConsumerListResponseSchema, Qn as UpdateProjectMemberResponseSchema, Qt as PROJECT_PULL_STATE_RELATIVE_PATH, R as CreateCredentialsResponseSchema, Rn as TriggerInvokeInputsSchema, Rt as ListOrganizationMembersPageQuerySchema, S as CatalogAppsPageResponseSchema, Sn as QueuedAgentPromptResponseSchema, Sr as WorkspaceTriggerFileSchema, St as HistoryRunListQuerySchema, T as ChannelConnectionSchema, Tn as RecentResourceListResponseSchema, Tr as WorkspaceTriggerRunListResponseSchema, Tt as InviteOrganizationMembersResponseSchema, U as CreateOrganizationResponseSchema, Un as UpdateAutoTopupRequestSchema, Ut as ListProjectMembersResponseSchema, V as CreateCustomAppResponseSchema, Vn as TriggerRunDetailResponseSchema, Vr as resolvePublicPlatformOrigin, Vt as ListProjectDeploymentsResponseSchema, W as CreateProjectArtifactResponseSchema, Wn as UpdateChannelBindingBodySchema, Wt as ListProjectMetricsResponseSchema, X as CredentialAssignmentRecordSchema, Xn as UpdateOrganizationRequestSchema, Xt as OrganizationSidebarBrandingPatchSchema, Y as CredentialAssignmentListResponseSchema, Yn as UpdateOrganizationMemberResponseSchema, Yt as OpenApiDiscoverResponseSchema, Z as CredentialConsumerListQuerySchema, Zn as UpdateProjectMemberRequestSchema, Zt as OrganizationSidebarBrandingSchema, _ as BindChannelBodySchema, _n as PublicFormMetadataSchema, _r as WorkflowRunListResponseSchema, _t as GetCustomAppResponseSchema, a as AgentSessionListResponseSchema, an as PresignOrgLogoResponseSchema, ar as UserAvatarSchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, br as WorkflowSummaryListResponseSchema, bt as HistoryRunCancelResponseSchema, c as AgentTriggerSummaryListResponseSchema, cn as PresignUserAvatarRequestSchema, cr as WorkflowCanvasCredentialBindingsSchema, ct as DuplicateCredentialsResponseSchema, d as AutoTopupSummarySchema, dn as ProjectReachabilityResponseSchema, dr as WorkflowFormResponseSchema, dt as FinalizeCustomAppLogoRequestSchema, en as PresignChatAttachmentRequestSchema, er as UpdateProjectSettingsRequestSchema, et as CredentialInstanceRecordSchema, f as BillingActivityResponseSchema, fn as ProjectResponseSchema, fr as WorkflowFormUpsertBodySchema, ft as FinalizeCustomAppLogoResponseSchema, g as BillingUsageResponseSchema, gn as PromptResponseSchema, gr as WorkflowRunInputsSchema, gt as GetCredentialResponseSchema, h as BillingSummaryResponseSchema, hn as PromptInputSchema, hr as WorkflowRunInputsPutBodySchema, ht as GetAppCatalogEntryResponseSchema, i as AgentSessionDetailResponseSchema, in as PresignOrgLogoRequestSchema, ir as UserAvatarPatchSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as StartMcpOAuthConnectionInputSchema, jr as isAcceptableInstallExit, jt as ListApiKeysResponseSchema, k as ConfirmCheckoutResponseSchema, kn as StartKeystrokeConnectionInputSchema, kr as deriveCustomAppDisplay, kt as ListAgentMemoryFilesResponseSchema, l as AppSlugAvailabilityResponseSchema, ln as PresignUserAvatarResponseSchema, lr as WorkflowCanvasRunSchema, lt as ExecuteKeystrokeToolRequestSchema, m as BillingRedirectResponseSchema, mn as ProjectSlugAvailabilityResponseSchema, mr as WorkflowRunHooksResponseSchema, mt as GatewayAttachmentRecordSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignCustomAppLogoRequestSchema, nr as UploadProjectSourceResponseSchema, nt as DOCS_QUERY_TOOL, o as AgentSummaryDetailResponseSchema, on as PresignProjectSourceRequestSchema, or as UserPreferencesPatchSchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingInvoiceUrlResponseSchema, pn as ProjectSettingsResponseSchema, pr as WorkflowRunDetailResponseSchema, pt as FormFieldConfigSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UpdateManagedServiceCredentialRequestSchema, qt as ManagedServiceKindSchema, r as ActiveOrganizationResponseSchema, rn as PresignCustomAppLogoResponseSchema, rr as UpsertGatewayAttachmentBodySchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryListResponseSchema, sn as PresignProjectSourceResponseSchema, sr as UserPreferencesSchema, st as DuplicateCredentialRequestSchema, t as ACTIVE_ORG_HEADER, tn as PresignChatAttachmentResponseSchema, tr as UploadProjectSourceManifestRequestSchema, u as AssignCredentialBodySchema, un as ProjectPullStateSchema, ur as WorkflowCanvasSchema, v as CLIENT_CHANNEL_HEADER, vn as PublicFormSubmitBodySchema, vr as WorkflowRunResponseSchema, vt as GraphqlDiscoverResponseSchema, w as ChannelConnectionListResponseSchema, wr as WorkspaceTriggerOverviewSchema, wt as InviteOrganizationMembersRequestSchema, x as CatalogAppDetailResponseSchema, xn as PublishedFormSchema, xr as WorkspaceTriggerDetailSchema, xt as HistoryRunDetailResponseSchema, y as CatalogActionDetailResponseSchema, yn as PublicFormSubmitResponseSchema, yr as WorkflowSummaryDetailResponseSchema, yt as HealthResponseSchema, z as CreateCreditsCheckoutRequestSchema, zn as TriggerInvokeResponseSchema, zr as resolveConnectAppSlug, zt as ListOrganizationMembersPageResponseSchema } from "./dist-Ch_-Crz0.mjs";
3
- import { a as alias, c as event, i as packProjectArtifact, l as flushTelemetry, n as withMcpReadClient, o as captureException, r as mergeFilteredArtifact, s as configureTelemetry, t as mapInParallelBatches, u as shutdownTelemetry } from "./dist-CwpJaAYE.mjs";
4
- import { C as getWebUrl, E as resolvePlatformUrlForWebUrl, S as getPlatformUrl, _ as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as getConfigDir, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as readCliVersion, h as isNewerVersion, i as fetchLatestCliRelease, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as computeReleaseAgeRetryAfter, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as readPnpmMinimumReleaseAgeMinutes, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager, v as createCliConfig, w as DEFAULT_PLATFORM_URL, x as getEffectiveApiTarget, y as getCliConfigDir } from "./run-package-manager-update-VgnhaJJP.mjs";
2
+ import { $ as CredentialInstanceListResponseSchema, $n as UpdateOrganizationRequestSchema, $t as OrganizationSidebarBrandingSchema, A as ConnectAuthorizeUrlResponseSchema, An as SlugAvailabilityResponseSchema, Ar as buildConnectDeeplink, At as ListAgentMemoryFilesResponseSchema, B as CreateCustomAppRequestSchema, Bn as TriggerDetailResponseSchema, Bt as ListOrganizationMembersPageResponseSchema, C as ChannelAccountListResponseSchema, Cn as PublishedFormSchema, Cr as WorkflowSummaryListResponseSchema, Ct as HistoryRunListQuerySchema, D as CompleteProjectArtifactResponseSchema, Dn as RecentResourceListResponseSchema, Dr as WorkspaceTriggerOverviewSchema, Dt as InviteProjectMembersRequestSchema, E as ChannelDirectoryListResponseSchema, Er as WorkspaceTriggerListResponseSchema, Et as InviteOrganizationMembersResponseSchema, F as CreateBillingPortalRequestSchema, Fn as StartOAuthConnectionInputSchema, Fr as listenPortFromPublicUrl, Ft as ListCredentialsPageQuerySchema, G as CreateProjectRequestSchema, Gn as TriggerRunListResponseSchema, Gr as slugifyAppName, Gt as ListProjectMetricsResponseSchema, H as CreateOrganizationRequestSchema, Hn as TriggerInvokeResponseSchema, Hr as resolveConnectAppSlug, Ht as ListProjectDeploymentsResponseSchema, I as CreateCredentialInstanceBodySchema, In as StartOAuthConnectionResultSchema, It as ListCredentialsPageResponseSchema, J as CredentialAssignmentListQuerySchema, Jn as UpdateCredentialInstanceBodySchema, Jt as ManagedServiceCredentialSchema, K as CreateProjectResponseSchema, Kn as UpdateAutoTopupRequestSchema, Kt as ListProjectsResponseSchema, L as CreateCredentialsRequestSchema, Ln as SubmitMarketingContactRequestSchema, Lt as ListManagedServiceCredentialsResponseSchema, M as ConnectProvidersResponseSchema, Mn as StartKeystrokeConnectionResultSchema, Mr as deriveCustomAppDisplay, Mt as ListApiKeysResponseSchema, N as CreateApiKeyRequestSchema, Nn as StartMcpOAuthConnectionInputSchema, Nr as detectProjectPackageManagerFromSnapshot, Nt as ListAppsResponseSchema, O as ConfirmCheckoutRequestSchema, On as SkillSummaryDetailResponseSchema, Or as WorkspaceTriggerRunListResponseSchema, Ot as InviteProjectMembersResponseSchema, P as CreateApiKeyResponseSchema, Pn as StartMcpOAuthConnectionResultSchema, Pr as isAcceptableInstallExit, Pt as ListChannelPlatformsResponseSchema, Q as CredentialConsumerListResponseSchema, Qn as UpdateOrganizationMemberResponseSchema, Qt as OrganizationSidebarBrandingPatchSchema, R as CreateCredentialsResponseSchema, Rn as SubmitTeamRequestRequestSchema, Rr as parseAppSlug, Rt as ListOrganizationInvitationsResponseSchema, S as CatalogAppsPageResponseSchema, Sr as WorkflowSummaryDetailResponseSchema, St as HistoryRunDetailResponseSchema, T as ChannelConnectionSchema, Tn as QueuedRunResponseSchema, Tr as WorkspaceTriggerFileSchema, Tt as InviteOrganizationMembersRequestSchema, U as CreateOrganizationResponseSchema, Un as TriggerListResponseSchema, Ur as resolveDocsMcpUrl, Ut as ListProjectFilesResponseSchema, V as CreateCustomAppResponseSchema, Vn as TriggerInvokeInputsSchema, Vt as ListOrganizationsResponseSchema, W as CreateProjectArtifactResponseSchema, Wn as TriggerRunDetailResponseSchema, Wr as resolvePublicPlatformOrigin, Wt as ListProjectMembersResponseSchema, X as CredentialAssignmentRecordSchema, Xn as UpdateManagedServiceCredentialRequestSchema, Xt as McpDiscoverResponseSchema, Y as CredentialAssignmentListResponseSchema, Yn as UpdateCredentialRequestSchema, Yt as ManagedServiceKindSchema, Z as CredentialConsumerListQuerySchema, Zn as UpdateOrganizationMemberRequestSchema, Zt as OpenApiDiscoverResponseSchema, _ as BindChannelBodySchema, _n as PromptInputSchema, _r as WorkflowRunHooksResponseSchema, _t as GetCustomAppResponseSchema, a as AgentSessionListResponseSchema, an as PresignCustomAppLogoResponseSchema, ar as UploadProjectSourceResponseSchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, bn as PublicFormSubmitBodySchema, br as WorkflowRunListResponseSchema, bt as HealthResponseSchema, c as AgentTriggerSummaryListResponseSchema, cn as PresignProjectSourceRequestSchema, cr as UserAvatarSchema, ct as DuplicateCredentialsResponseSchema, d as AutoTopupSummarySchema, dn as PresignUserAvatarResponseSchema, dr as WorkflowCanvasCredentialBindingsSchema, dt as FinalizeCustomAppLogoRequestSchema, en as PROJECT_PULL_STATE_RELATIVE_PATH, er as UpdateProjectMemberRequestSchema, et as CredentialInstanceRecordSchema, f as BillingActivityResponseSchema, fn as ProjectPullStateSchema, fr as WorkflowCanvasRunSchema, ft as FinalizeCustomAppLogoResponseSchema, g as BillingUsageResponseSchema, gn as ProjectSlugAvailabilityResponseSchema, gr as WorkflowRunDetailResponseSchema, gt as GetCredentialResponseSchema, h as BillingSummaryResponseSchema, hn as ProjectSettingsResponseSchema, hr as WorkflowFormUpsertBodySchema, ht as GetAppCatalogEntryResponseSchema, i as AgentSessionDetailResponseSchema, in as PresignCustomAppLogoRequestSchema, ir as UploadProjectSourceManifestRequestSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as StartKeystrokeConnectionInputSchema, jt as ListAgentWorkspaceFilesResponseSchema, k as ConfirmCheckoutResponseSchema, kn as SkillSummaryListResponseSchema, kr as WorkspaceWorkflowOverviewSchema, l as AppSlugAvailabilityResponseSchema, ln as PresignProjectSourceResponseSchema, lr as UserPreferencesPatchSchema, lt as ExecuteKeystrokeToolRequestSchema, m as BillingRedirectResponseSchema, mn as ProjectResponseSchema, mr as WorkflowFormResponseSchema, mt as GatewayAttachmentRecordSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignChatAttachmentRequestSchema, nr as UpdateProjectRequestSchema, nt as DOCS_QUERY_TOOL, o as AgentSummaryDetailResponseSchema, on as PresignOrgLogoRequestSchema, or as UpsertGatewayAttachmentBodySchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingInvoiceUrlResponseSchema, pn as ProjectReachabilityResponseSchema, pr as WorkflowCanvasSchema, pt as FormFieldConfigSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UpdateChannelBindingBodySchema, qt as ListTemplatesResponseSchema, r as ActiveOrganizationResponseSchema, rn as PresignChatAttachmentResponseSchema, rr as UpdateProjectSettingsRequestSchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryListResponseSchema, sn as PresignOrgLogoResponseSchema, sr as UserAvatarPatchSchema, st as DuplicateCredentialRequestSchema, t as ACTIVE_ORG_HEADER, tn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, tr as UpdateProjectMemberResponseSchema, u as AssignCredentialBodySchema, un as PresignUserAvatarRequestSchema, ur as UserPreferencesSchema, v as CLIENT_CHANNEL_HEADER, vn as PromptResponseSchema, vr as WorkflowRunInputsPutBodySchema, vt as GetTemplateResponseSchema, w as ChannelConnectionListResponseSchema, wn as QueuedAgentPromptResponseSchema, wr as WorkspaceTriggerDetailSchema, wt as HistoryRunListResponseSchema, x as CatalogAppDetailResponseSchema, xn as PublicFormSubmitResponseSchema, xr as WorkflowRunResponseSchema, xt as HistoryRunCancelResponseSchema, y as CatalogActionDetailResponseSchema, yn as PublicFormMetadataSchema, yr as WorkflowRunInputsSchema, yt as GraphqlDiscoverResponseSchema, z as CreateCreditsCheckoutRequestSchema, zn as TemplateFilesResponseSchema, zr as parseErrorResponse, zt as ListOrganizationMembersPageQuerySchema } from "./dist-BhhQyRN9.mjs";
3
+ import { a as alias, c as event, i as packProjectArtifact, l as flushTelemetry, n as withMcpReadClient, o as captureException, r as mergeFilteredArtifact, s as configureTelemetry, t as mapInParallelBatches, u as shutdownTelemetry } from "./dist-Di9E6tcC.mjs";
4
+ import { C as getWebUrl, E as resolvePlatformUrlForWebUrl, S as getPlatformUrl, _ as resolveCliRoot, a as formatReleaseAgeBlockMessage, b as getConfigDir, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as readCliVersion, h as isNewerVersion, i as fetchLatestCliRelease, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as computeReleaseAgeRetryAfter, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as readPnpmMinimumReleaseAgeMinutes, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager, v as createCliConfig, w as DEFAULT_PLATFORM_URL, x as getEffectiveApiTarget, y as getCliConfigDir } from "./run-package-manager-update-D1GM1hMJ.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { Command } from "commander";
7
7
  import { platform, release } from "node:os";
8
- import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
8
+ import { basename, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
9
9
  import { Entry } from "@napi-rs/keyring";
10
10
  import { existsSync, lstatSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
11
11
  import { PostHog } from "posthog-node";
@@ -4351,6 +4351,37 @@ function createTeamRequestsResource(http) {
4351
4351
  }
4352
4352
  } };
4353
4353
  }
4354
+ function createTemplatesResource(http) {
4355
+ return {
4356
+ async list(options) {
4357
+ try {
4358
+ const searchParams = new URLSearchParams();
4359
+ if (options?.kind) searchParams.set("kind", options.kind);
4360
+ const suffix = searchParams.size > 0 ? `?${searchParams}` : "";
4361
+ const data = await http.get(`/api/templates${suffix}`).json();
4362
+ return ListTemplatesResponseSchema.parse(data);
4363
+ } catch (error) {
4364
+ throw await toPlatformError(error);
4365
+ }
4366
+ },
4367
+ async get(slug) {
4368
+ try {
4369
+ const data = await http.get(`/api/templates/${encodeURIComponent(slug)}`).json();
4370
+ return GetTemplateResponseSchema.parse(data);
4371
+ } catch (error) {
4372
+ throw await toPlatformError(error);
4373
+ }
4374
+ },
4375
+ async files(slug) {
4376
+ try {
4377
+ const data = await http.get(`/api/templates/${encodeURIComponent(slug)}/files`).json();
4378
+ return TemplateFilesResponseSchema.parse(data);
4379
+ } catch (error) {
4380
+ throw await toPlatformError(error);
4381
+ }
4382
+ }
4383
+ };
4384
+ }
4354
4385
  function createMarketingContactResource(http) {
4355
4386
  return { async submit(input) {
4356
4387
  const body = SubmitMarketingContactRequestSchema.parse(input);
@@ -5229,6 +5260,7 @@ function createPlatformClient(options) {
5229
5260
  customAppLogo: createCustomAppLogoResource(http),
5230
5261
  organizationSidebarBranding: createOrganizationSidebarBrandingResource(http, { getActiveOrganizationId: resolveActiveOrganizationId }),
5231
5262
  teamRequests: createTeamRequestsResource(http),
5263
+ templates: createTemplatesResource(http),
5232
5264
  marketingContact: createMarketingContactResource(http),
5233
5265
  getActiveOrganizationId: resolveActiveOrganizationId,
5234
5266
  setActiveOrganizationId
@@ -6871,6 +6903,113 @@ function registerAppsCommand(program) {
6871
6903
  registerAppSyncCommand(apps);
6872
6904
  }
6873
6905
  //#endregion
6906
+ //#region src/commands/templates/apply-template-files.ts
6907
+ async function pathExists(absolutePath) {
6908
+ try {
6909
+ await access(absolutePath);
6910
+ return true;
6911
+ } catch {
6912
+ return false;
6913
+ }
6914
+ }
6915
+ function resolveTemplateFilePath(projectRoot, filePath) {
6916
+ const normalizedRoot = resolve(projectRoot);
6917
+ const absolutePath = resolve(normalizedRoot, filePath);
6918
+ const relativePath = relative(normalizedRoot, absolutePath);
6919
+ const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath);
6920
+ const isCanonicalSourcePath = filePath.startsWith("src/") && !filePath.includes("\\") && !filePath.includes("\0") && posix.normalize(filePath) === filePath;
6921
+ if (escapesRoot || !isCanonicalSourcePath) throw new ExpectedCliError(`Unsafe template file path: ${filePath}`);
6922
+ return absolutePath;
6923
+ }
6924
+ /**
6925
+ * Write template files into a project. Refuses to overwrite unless `force` is set.
6926
+ * Returns the relative paths written (sorted).
6927
+ */
6928
+ async function applyTemplateFiles(options) {
6929
+ const paths = Object.keys(options.files).sort();
6930
+ const resolvedPaths = paths.map((filePath) => ({
6931
+ relative: filePath,
6932
+ absolute: resolveTemplateFilePath(options.projectRoot, filePath)
6933
+ }));
6934
+ if (!options.force) {
6935
+ const existing = [];
6936
+ for (const filePath of resolvedPaths) if (await pathExists(filePath.absolute)) existing.push(filePath.relative);
6937
+ if (existing.length > 0) throw new ExpectedCliError(["Refusing to overwrite existing files (pass --force to overwrite):", ...existing.map((path) => ` ${path}`)].join("\n"));
6938
+ }
6939
+ for (const filePath of resolvedPaths) {
6940
+ await mkdir(dirname(filePath.absolute), { recursive: true });
6941
+ await writeFile(filePath.absolute, options.files[filePath.relative], "utf8");
6942
+ }
6943
+ return paths;
6944
+ }
6945
+ //#endregion
6946
+ //#region src/commands/templates/apply.ts
6947
+ function registerTemplatesApplyCommand(templates) {
6948
+ templates.command("apply").description("Copy a template's files into the current keystroke project (fails if paths exist; --force overwrites)").argument("<slug>", "Template slug").option("--dir <path>", "Project directory", process.cwd()).option("--force", "Overwrite existing files", false).action((slug, options) => runCliCommand("Apply template failed", async () => {
6949
+ const projectRoot = resolveKeystrokeConfigRoot(options.dir);
6950
+ if (!projectRoot) throw new Error("Not in a keystroke project (keystroke.config.ts not found)");
6951
+ const config = createCliConfig();
6952
+ const client = createCliPlatformClient(config);
6953
+ await resolveActiveOrganization(config);
6954
+ const { files } = await client.templates.files(slug);
6955
+ const paths = await applyTemplateFiles({
6956
+ projectRoot,
6957
+ files,
6958
+ force: options.force
6959
+ });
6960
+ process.stdout.write(`${JSON.stringify({
6961
+ slug,
6962
+ projectRoot,
6963
+ written: paths,
6964
+ force: options.force
6965
+ }, null, 2)}\n`);
6966
+ }, void 0, { orgScoped: true }));
6967
+ }
6968
+ //#endregion
6969
+ //#region src/commands/templates/list.ts
6970
+ function registerTemplatesListCommand(templates) {
6971
+ templates.command("list").description("List official templates").option("--kind <kind>", "Filter by kind: agent, workflow, or both").action((options) => runCliCommand("List templates failed", async () => {
6972
+ const config = createCliConfig();
6973
+ const client = createCliPlatformClient(config);
6974
+ await resolveActiveOrganization(config);
6975
+ const kind = parseKind(options.kind);
6976
+ const rows = await client.templates.list(kind ? { kind } : void 0);
6977
+ process.stdout.write(`${JSON.stringify(rows, null, 2)}\n`);
6978
+ }, void 0, { orgScoped: true }));
6979
+ }
6980
+ function parseKind(value) {
6981
+ if (!value) return;
6982
+ if (value === "agent" || value === "workflow" || value === "both") return value;
6983
+ throw new Error(`Invalid --kind ${value}. Expected agent, workflow, or both.`);
6984
+ }
6985
+ //#endregion
6986
+ //#region src/commands/templates/show.ts
6987
+ function registerTemplatesShowCommand(templates) {
6988
+ templates.command("show").description("Show a template and its file paths").argument("<slug>", "Template slug").option("--files", "Include file contents in the output").action((slug, options) => runCliCommand("Show template failed", async () => {
6989
+ const config = createCliConfig();
6990
+ const client = createCliPlatformClient(config);
6991
+ await resolveActiveOrganization(config);
6992
+ const template = await client.templates.get(slug);
6993
+ if (!options.files) {
6994
+ const { files: _files, ...summary } = template;
6995
+ process.stdout.write(`${JSON.stringify({
6996
+ ...summary,
6997
+ filePaths: Object.keys(template.files).sort()
6998
+ }, null, 2)}\n`);
6999
+ return;
7000
+ }
7001
+ process.stdout.write(`${JSON.stringify(template, null, 2)}\n`);
7002
+ }, void 0, { orgScoped: true }));
7003
+ }
7004
+ //#endregion
7005
+ //#region src/commands/templates/index.ts
7006
+ function registerTemplatesCommand(program) {
7007
+ const templates = program.command("templates").description("Browse and add official agent/workflow templates to a project");
7008
+ registerTemplatesListCommand(templates);
7009
+ registerTemplatesShowCommand(templates);
7010
+ registerTemplatesApplyCommand(templates);
7011
+ }
7012
+ //#endregion
6874
7013
  //#region src/auth/open-url.ts
6875
7014
  function openUrl(url) {
6876
7015
  const platform = process.platform;
@@ -7619,7 +7758,7 @@ function registerBuildCommand(program) {
7619
7758
  try {
7620
7759
  const root = resolveProjectRoot(options.dir);
7621
7760
  await ensureSdkCurrent(root);
7622
- const { buildApp } = await import("./dist-He8QacOy.mjs");
7761
+ const { buildApp } = await import("./dist-BHWdrE8w.mjs");
7623
7762
  await buildApp({ root });
7624
7763
  process.stdout.write(`Built ${root}\n`);
7625
7764
  } catch (error) {
@@ -7754,7 +7893,7 @@ async function sleep(ms) {
7754
7893
  }
7755
7894
  async function buildDeployArchive(client, root, projectId, filter) {
7756
7895
  if (filter?.length) {
7757
- const { buildFilteredApp } = await import("./dist-He8QacOy.mjs");
7896
+ const { buildFilteredApp } = await import("./dist-BHWdrE8w.mjs");
7758
7897
  const filtered = await buildFilteredApp({
7759
7898
  root,
7760
7899
  filter,
@@ -7776,7 +7915,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
7776
7915
  sourceFiles: filtered.sourceFiles
7777
7916
  };
7778
7917
  }
7779
- const { buildApp } = await import("./dist-He8QacOy.mjs");
7918
+ const { buildApp } = await import("./dist-BHWdrE8w.mjs");
7780
7919
  const { sourceFiles } = await buildApp({
7781
7920
  root,
7782
7921
  collectSources: true,
@@ -7907,7 +8046,7 @@ function runtimeChildEnv(parentEnv, overrides) {
7907
8046
  //#region src/project/bootstrap-run.ts
7908
8047
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
7909
8048
  async function resolveBootstrapRun(options) {
7910
- const { resolveRuntimeBuildArtifact } = await import("./dist-He8QacOy.mjs");
8049
+ const { resolveRuntimeBuildArtifact } = await import("./dist-BHWdrE8w.mjs");
7911
8050
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
7912
8051
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
7913
8052
  const args = [`--import=${loader}`];
@@ -8057,7 +8196,7 @@ async function runDev(options) {
8057
8196
  process.on("SIGINT", shutdown);
8058
8197
  process.on("SIGTERM", shutdown);
8059
8198
  try {
8060
- const { watchApp } = await import("./dist-He8QacOy.mjs");
8199
+ const { watchApp } = await import("./dist-BHWdrE8w.mjs");
8061
8200
  await watchApp({
8062
8201
  root,
8063
8202
  clean: false,
@@ -9119,7 +9258,7 @@ async function runStart(options) {
9119
9258
  const apiPort = Number(new URL(serverUrl).port || 80);
9120
9259
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
9121
9260
  ensureNativeDeps(runtimeNodeModules);
9122
- const { buildApp } = await import("./dist-He8QacOy.mjs");
9261
+ const { buildApp } = await import("./dist-BHWdrE8w.mjs");
9123
9262
  await buildApp({
9124
9263
  root,
9125
9264
  clean: false
@@ -10000,6 +10139,7 @@ function createProgram() {
10000
10139
  registerAgentsCommand(program);
10001
10140
  registerChannelsCommand(program);
10002
10141
  registerAppsCommand(program);
10142
+ registerTemplatesCommand(program);
10003
10143
  registerWorkflowsCommand(program);
10004
10144
  registerTriggersCommand(program);
10005
10145
  return program;
@@ -10007,7 +10147,7 @@ function createProgram() {
10007
10147
  async function runCli(argv) {
10008
10148
  initCliTelemetry();
10009
10149
  try {
10010
- const { maybeAutoUpdate } = await import("./maybe-auto-update-Cmv6qJkE.mjs");
10150
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-C81fdNvj.mjs");
10011
10151
  await maybeAutoUpdate(argv);
10012
10152
  await createProgram().parseAsync(argv);
10013
10153
  } finally {
@@ -10017,4 +10157,4 @@ async function runCli(argv) {
10017
10157
  //#endregion
10018
10158
  export { runCli };
10019
10159
 
10020
- //# sourceMappingURL=program-P9sMfvOJ.mjs.map
10160
+ //# sourceMappingURL=program-F1fudP02.mjs.map