@keystrokehq/cli 0.1.113 → 0.1.115

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { $ as CredentialInstanceListResponseSchema, $n as WorkflowCanvasRunSchema, $t as PresignOrgLogoResponseSchema, A as ConnectAuthorizeUrlResponseSchema, An as TriggerListResponseSchema, Ar as slugifyAppName, At as ListCredentialsPageQuerySchema, B as CreateCustomAppRequestSchema, Bn as UpdateOrganizationRequestSchema, Bt as ListProjectMetricsResponseSchema, C as ChannelAccountListResponseSchema, Cn as StartOAuthConnectionInputSchema, Cr as parseAppSlug, Ct as InviteProjectMembersResponseSchema, D as CompleteProjectArtifactResponseSchema, Dn as TriggerDetailResponseSchema, Dr as resolveConnectAppSlug, Dt as ListApiKeysResponseSchema, E as ChannelDirectoryListResponseSchema, En as SubmitTeamRequestRequestSchema, Et as ListAgentWorkspaceFilesResponseSchema, F as CreateBillingPortalRequestSchema, Fn as UpdateCredentialInstanceBodySchema, Ft as ListOrganizationMembersPageResponseSchema, G as CreateProjectRequestSchema, Gn as UploadProjectSourceManifestRequestSchema, Gt as OpenApiDiscoverResponseSchema, H as CreateOrganizationRequestSchema, Hn as UpdateProjectMemberResponseSchema, Ht as ManagedServiceCredentialSchema, I as CreateCredentialInstanceBodySchema, In as UpdateCredentialRequestSchema, It as ListOrganizationsResponseSchema, J as CredentialAssignmentListQuerySchema, Jn as UserAvatarPatchSchema, Jt as PROJECT_PULL_STATE_RELATIVE_PATH, K as CreateProjectResponseSchema, Kn as UploadProjectSourceResponseSchema, Kt as OrganizationSidebarBrandingPatchSchema, L as CreateCredentialsRequestSchema, Ln as UpdateManagedServiceCredentialRequestSchema, Lt as ListProjectDeploymentsResponseSchema, M as ConnectProvidersResponseSchema, Mn as TriggerRunListResponseSchema, Mt as ListManagedServiceCredentialsResponseSchema, N as CreateApiKeyRequestSchema, Nn as UpdateAutoTopupRequestSchema, Nt as ListOrganizationInvitationsResponseSchema, O as ConfirmCheckoutRequestSchema, On as TriggerInvokeInputsSchema, Or as resolveDocsMcpUrl, Ot as ListAppsResponseSchema, P as CreateApiKeyResponseSchema, Pn as UpdateChannelBindingBodySchema, Pt as ListOrganizationMembersPageQuerySchema, Q as CredentialConsumerListResponseSchema, Qn as WorkflowCanvasCredentialBindingsSchema, Qt as PresignOrgLogoRequestSchema, R as CreateCredentialsResponseSchema, Rn as UpdateOrganizationMemberRequestSchema, Rt as ListProjectFilesResponseSchema, S as CatalogAppsPageResponseSchema, Sn as StartMcpOAuthConnectionResultSchema, St as InviteProjectMembersRequestSchema, T as ChannelConnectionSchema, Tn as SubmitMarketingContactRequestSchema, Tt as ListAgentMemoryFilesResponseSchema, U as CreateOrganizationResponseSchema, Un as UpdateProjectRequestSchema, Ut as ManagedServiceKindSchema, V as CreateCustomAppResponseSchema, Vn as UpdateProjectMemberRequestSchema, Vt as ListProjectsResponseSchema, W as CreateProjectArtifactResponseSchema, Wn as UpdateProjectSettingsRequestSchema, Wt as McpDiscoverResponseSchema, X as CredentialAssignmentRecordSchema, Xn as UserPreferencesPatchSchema, Xt as PresignChatAttachmentRequestSchema, Y as CredentialAssignmentListResponseSchema, Yn as UserAvatarSchema, Yt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, Z as CredentialConsumerListQuerySchema, Zn as UserPreferencesSchema, Zt as PresignChatAttachmentResponseSchema, _ as BindChannelBodySchema, _n as SkillSummaryListResponseSchema, _r as deriveCustomAppDisplay, _t as HistoryRunDetailResponseSchema, a as AgentSessionListResponseSchema, an as ProjectReachabilityResponseSchema, ar as WorkflowRunListResponseSchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, bn as StartKeystrokeConnectionResultSchema, br as listenPortFromPublicUrl, bt as InviteOrganizationMembersRequestSchema, c as AgentTriggerSummaryListResponseSchema, cn as ProjectSlugAvailabilityResponseSchema, cr as WorkflowSummaryListResponseSchema, ct as ExecuteKeystrokeToolRequestSchema, d as AutoTopupSummarySchema, dr as WorkspaceTriggerListResponseSchema, dt as GetAppCatalogEntryResponseSchema, en as PresignProjectSourceRequestSchema, er as WorkflowCanvasSchema, et as CredentialInstanceRecordSchema, f as BillingActivityResponseSchema, fn as QueuedAgentPromptResponseSchema, fr as WorkspaceTriggerOverviewSchema, ft as GetCredentialResponseSchema, g as BillingUsageResponseSchema, gn as SkillSummaryDetailResponseSchema, gt as HistoryRunCancelResponseSchema, h as BillingSummaryResponseSchema, hn as RecentResourceListResponseSchema, hr as buildConnectDeeplink, ht as HealthResponseSchema, i as AgentSessionDetailResponseSchema, in as ProjectPullStateSchema, ir as WorkflowRunInputsSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as TriggerRunDetailResponseSchema, jt as ListCredentialsPageResponseSchema, k as ConfirmCheckoutResponseSchema, kn as TriggerInvokeResponseSchema, kr as resolvePublicPlatformOrigin, kt as ListChannelPlatformsResponseSchema, l as AppSlugAvailabilityResponseSchema, ln as PromptInputSchema, lr as WorkspaceTriggerDetailSchema, m as BillingRedirectResponseSchema, mr as WorkspaceWorkflowOverviewSchema, mt as GraphqlDiscoverResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignUserAvatarRequestSchema, nr as WorkflowRunHooksResponseSchema, nt as DOCS_QUERY_TOOL, o as AgentSummaryDetailResponseSchema, on as ProjectResponseSchema, or as WorkflowRunResponseSchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingInvoiceUrlResponseSchema, pn as QueuedRunResponseSchema, pr as WorkspaceTriggerRunListResponseSchema, pt as GetCustomAppResponseSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UpsertGatewayAttachmentBodySchema, qt as OrganizationSidebarBrandingSchema, r as ActiveOrganizationResponseSchema, rn as PresignUserAvatarResponseSchema, rr as WorkflowRunInputsPutBodySchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryListResponseSchema, sn as ProjectSettingsResponseSchema, sr as WorkflowSummaryDetailResponseSchema, st as ErrorResponseSchema, t as ACTIVE_ORG_HEADER, tn as PresignProjectSourceResponseSchema, tr as WorkflowRunDetailResponseSchema, u as AssignCredentialBodySchema, un as PromptResponseSchema, ur as WorkspaceTriggerFileSchema, ut as GatewayAttachmentRecordSchema, v as CLIENT_CHANNEL_HEADER, vn as SlugAvailabilityResponseSchema, vr as detectProjectPackageManagerFromSnapshot, vt as HistoryRunListQuerySchema, w as ChannelConnectionListResponseSchema, wn as StartOAuthConnectionResultSchema, wr as parseErrorResponse, x as CatalogAppDetailResponseSchema, xn as StartMcpOAuthConnectionInputSchema, xt as InviteOrganizationMembersResponseSchema, y as CatalogActionDetailResponseSchema, yn as StartKeystrokeConnectionInputSchema, yr as isAcceptableInstallExit, yt as HistoryRunListResponseSchema, z as CreateCreditsCheckoutRequestSchema, zn as UpdateOrganizationMemberResponseSchema, zt as ListProjectMembersResponseSchema } from "./dist-BoZPZ9Sz.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-De18Uq1U.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-D_jU5wZe.mjs";
2
+ import { $ as CredentialInstanceListResponseSchema, $n as UserPreferencesSchema, $t as PresignChatAttachmentResponseSchema, A as ConnectAuthorizeUrlResponseSchema, An as TriggerInvokeInputsSchema, Ar as resolveDocsMcpUrl, At as ListAppsResponseSchema, B as CreateCustomAppRequestSchema, Bn as UpdateOrganizationMemberRequestSchema, Bt as ListProjectFilesResponseSchema, C as ChannelAccountListResponseSchema, Cn as StartMcpOAuthConnectionInputSchema, Ct as InviteOrganizationMembersResponseSchema, D as CompleteProjectArtifactResponseSchema, Dn as SubmitMarketingContactRequestSchema, Dt as ListAgentMemoryFilesResponseSchema, E as ChannelDirectoryListResponseSchema, En as StartOAuthConnectionResultSchema, Er as parseErrorResponse, F as CreateBillingPortalRequestSchema, Fn as UpdateAutoTopupRequestSchema, Ft as ListOrganizationInvitationsResponseSchema, G as CreateProjectRequestSchema, Gn as UpdateProjectRequestSchema, Gt as ManagedServiceKindSchema, H as CreateOrganizationRequestSchema, Hn as UpdateOrganizationRequestSchema, Ht as ListProjectMetricsResponseSchema, I as CreateCredentialInstanceBodySchema, In as UpdateChannelBindingBodySchema, It as ListOrganizationMembersPageQuerySchema, J as CredentialAssignmentListQuerySchema, Jn as UploadProjectSourceResponseSchema, Jt as OrganizationSidebarBrandingPatchSchema, K as CreateProjectResponseSchema, Kn as UpdateProjectSettingsRequestSchema, Kt as McpDiscoverResponseSchema, L as CreateCredentialsRequestSchema, Ln as UpdateCredentialInstanceBodySchema, Lt as ListOrganizationMembersPageResponseSchema, M as ConnectProvidersResponseSchema, Mn as TriggerListResponseSchema, Mr as slugifyAppName, Mt as ListCredentialsPageQuerySchema, N as CreateApiKeyRequestSchema, Nn as TriggerRunDetailResponseSchema, Nt as ListCredentialsPageResponseSchema, O as ConfirmCheckoutRequestSchema, On as SubmitTeamRequestRequestSchema, Ot as ListAgentWorkspaceFilesResponseSchema, P as CreateApiKeyResponseSchema, Pn as TriggerRunListResponseSchema, Pt as ListManagedServiceCredentialsResponseSchema, Q as CredentialConsumerListResponseSchema, Qn as UserPreferencesPatchSchema, Qt as PresignChatAttachmentRequestSchema, R as CreateCredentialsResponseSchema, Rn as UpdateCredentialRequestSchema, Rt as ListOrganizationsResponseSchema, S as CatalogAppsPageResponseSchema, Sn as StartKeystrokeConnectionResultSchema, Sr as listenPortFromPublicUrl, St as InviteOrganizationMembersRequestSchema, T as ChannelConnectionSchema, Tn as StartOAuthConnectionInputSchema, Tr as parseAppSlug, Tt as InviteProjectMembersResponseSchema, U as CreateOrganizationResponseSchema, Un as UpdateProjectMemberRequestSchema, Ut as ListProjectsResponseSchema, V as CreateCustomAppResponseSchema, Vn as UpdateOrganizationMemberResponseSchema, Vt as ListProjectMembersResponseSchema, W as CreateProjectArtifactResponseSchema, Wn as UpdateProjectMemberResponseSchema, Wt as ManagedServiceCredentialSchema, X as CredentialAssignmentRecordSchema, Xn as UserAvatarPatchSchema, Xt as PROJECT_PULL_STATE_RELATIVE_PATH, Y as CredentialAssignmentListResponseSchema, Yn as UpsertGatewayAttachmentBodySchema, Yt as OrganizationSidebarBrandingSchema, Z as CredentialConsumerListQuerySchema, Zn as UserAvatarSchema, Zt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, _ as BindChannelBodySchema, _n as RecentResourceListResponseSchema, _r as buildConnectDeeplink, _t as HealthResponseSchema, a as AgentSessionListResponseSchema, an as PresignUserAvatarResponseSchema, ar as WorkflowRunInputsPutBodySchema, at as DownloadActiveProjectArtifactResponseSchema, b as CatalogActionsPageResponseSchema, bn as SlugAvailabilityResponseSchema, br as detectProjectPackageManagerFromSnapshot, bt as HistoryRunListQuerySchema, c as AgentTriggerSummaryListResponseSchema, cn as ProjectResponseSchema, cr as WorkflowRunResponseSchema, ct as DuplicateCredentialsResponseSchema, d as AutoTopupSummarySchema, dn as PromptInputSchema, dr as WorkspaceTriggerDetailSchema, en as PresignOrgLogoRequestSchema, er as WorkflowCanvasCredentialBindingsSchema, et as CredentialInstanceRecordSchema, f as BillingActivityResponseSchema, fn as PromptResponseSchema, fr as WorkspaceTriggerFileSchema, ft as GatewayAttachmentRecordSchema, g as BillingUsageResponseSchema, gr as WorkspaceWorkflowOverviewSchema, gt as GraphqlDiscoverResponseSchema, h as BillingSummaryResponseSchema, hn as QueuedRunResponseSchema, hr as WorkspaceTriggerRunListResponseSchema, ht as GetCustomAppResponseSchema, i as AgentSessionDetailResponseSchema, in as PresignUserAvatarRequestSchema, ir as WorkflowRunHooksResponseSchema, it as DeclineOrganizationInvitationResponseSchema, j as ConnectManagedServiceCredentialRequestSchema, jn as TriggerInvokeResponseSchema, jr as resolvePublicPlatformOrigin, jt as ListChannelPlatformsResponseSchema, k as ConfirmCheckoutResponseSchema, kn as TriggerDetailResponseSchema, kr as resolveConnectAppSlug, kt as ListApiKeysResponseSchema, l as AppSlugAvailabilityResponseSchema, ln as ProjectSettingsResponseSchema, lr as WorkflowSummaryDetailResponseSchema, lt as ErrorResponseSchema, m as BillingRedirectResponseSchema, mn as QueuedAgentPromptResponseSchema, mr as WorkspaceTriggerOverviewSchema, mt as GetCredentialResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as PresignProjectSourceRequestSchema, nr as WorkflowCanvasSchema, nt as DOCS_QUERY_TOOL, o as AgentSummaryDetailResponseSchema, on as ProjectPullStateSchema, or as WorkflowRunInputsSchema, ot as DownloadActiveProjectSourceResponseSchema, p as BillingInvoiceUrlResponseSchema, pr as WorkspaceTriggerListResponseSchema, pt as GetAppCatalogEntryResponseSchema, q as CreateSubscriptionCheckoutRequestSchema, qn as UploadProjectSourceManifestRequestSchema, qt as OpenApiDiscoverResponseSchema, r as ActiveOrganizationResponseSchema, rn as PresignProjectSourceResponseSchema, rr as WorkflowRunDetailResponseSchema, rt as DOCS_SEARCH_TOOL, s as AgentSummaryListResponseSchema, sn as ProjectReachabilityResponseSchema, sr as WorkflowRunListResponseSchema, st as DuplicateCredentialRequestSchema, t as ACTIVE_ORG_HEADER, tn as PresignOrgLogoResponseSchema, tr as WorkflowCanvasRunSchema, u as AssignCredentialBodySchema, un as ProjectSlugAvailabilityResponseSchema, ur as WorkflowSummaryListResponseSchema, ut as ExecuteKeystrokeToolRequestSchema, v as CLIENT_CHANNEL_HEADER, vn as SkillSummaryDetailResponseSchema, vt as HistoryRunCancelResponseSchema, w as ChannelConnectionListResponseSchema, wn as StartMcpOAuthConnectionResultSchema, wt as InviteProjectMembersRequestSchema, x as CatalogAppDetailResponseSchema, xn as StartKeystrokeConnectionInputSchema, xr as isAcceptableInstallExit, xt as HistoryRunListResponseSchema, y as CatalogActionDetailResponseSchema, yn as SkillSummaryListResponseSchema, yr as deriveCustomAppDisplay, yt as HistoryRunDetailResponseSchema, z as CreateCreditsCheckoutRequestSchema, zn as UpdateManagedServiceCredentialRequestSchema, zt as ListProjectDeploymentsResponseSchema } from "./dist-D9wyqCGM.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-gIiA66FZ.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-BvOJBqBB.mjs";
5
5
  import { createRequire } from "node:module";
6
6
  import { Command } from "commander";
7
7
  import { platform, release } from "node:os";
@@ -4334,6 +4334,15 @@ function createCredentialsResource(http) {
4334
4334
  throw await toPlatformError(error);
4335
4335
  }
4336
4336
  },
4337
+ async duplicate(credentialId, input) {
4338
+ const body = DuplicateCredentialRequestSchema.parse(input);
4339
+ try {
4340
+ const data = await http.post(`/api/credentials/${encodeURIComponent(credentialId)}/duplicate`, { json: body }).json();
4341
+ return DuplicateCredentialsResponseSchema.parse(data);
4342
+ } catch (error) {
4343
+ throw await toPlatformError(error);
4344
+ }
4345
+ },
4337
4346
  async delete(credentialId) {
4338
4347
  try {
4339
4348
  await http.delete(`/api/credentials/${encodeURIComponent(credentialId)}`);
@@ -6406,7 +6415,7 @@ function parseCustomAppFields(flags) {
6406
6415
  if (!Object.values(fields).some((field) => field.optional !== true)) throw new Error("At least one --field must be required (omit :optional)");
6407
6416
  return fields;
6408
6417
  }
6409
- function collectValues$1(value, previous) {
6418
+ function collectValues$3(value, previous) {
6410
6419
  return [...previous, value];
6411
6420
  }
6412
6421
  //#endregion
@@ -6492,7 +6501,7 @@ function parseFieldOverrides(flags) {
6492
6501
  return parseCustomAppFields(flags);
6493
6502
  }
6494
6503
  function registerAppCreateCommand(app) {
6495
- app.command("create").description("Create a custom org app").option("--name <name>", "App display name").option("--slug <slug>", "App slug segment (defaults from name)").option("--description <description>", "App description (defaults to --name)").option("--field <field>", "Credential field as key, key:secret, key:optional, or key:secret:optional (repeatable)", collectValues$1, []).option("--mcp <url>", "Create from an MCP server URL (auto-detect auth)").option("--openapi <url>", "Create from an OpenAPI spec URL (auto-detect auth)").option("--graphql <url>", "Create from a GraphQL endpoint URL (auto-detect auth)").option("--auth <kind>", "Override detected auth: oauth or api_key (MCP only)").option("--preview", "Show the request that would be created without creating").action((options) => runCliCommand("Create app failed", async () => {
6504
+ app.command("create").description("Create a custom org app").option("--name <name>", "App display name").option("--slug <slug>", "App slug segment (defaults from name)").option("--description <description>", "App description (defaults to --name)").option("--field <field>", "Credential field as key, key:secret, key:optional, or key:secret:optional (repeatable)", collectValues$3, []).option("--mcp <url>", "Create from an MCP server URL (auto-detect auth)").option("--openapi <url>", "Create from an OpenAPI spec URL (auto-detect auth)").option("--graphql <url>", "Create from a GraphQL endpoint URL (auto-detect auth)").option("--auth <kind>", "Override detected auth: oauth or api_key (MCP only)").option("--preview", "Show the request that would be created without creating").action((options) => runCliCommand("Create app failed", async () => {
6496
6505
  const config = createCliConfig();
6497
6506
  const client = createCliPlatformClient(config);
6498
6507
  await resolveActiveOrganization(config);
@@ -6899,7 +6908,9 @@ function buildPlatformUpdatePatch(args) {
6899
6908
  return {
6900
6909
  ...args.label !== void 0 ? { label: args.label } : {},
6901
6910
  ...args.isDefault !== void 0 ? { isDefault: args.isDefault } : {},
6902
- ...args.value ? { value: args.value } : {}
6911
+ ...args.value ? { value: args.value } : {},
6912
+ ...args.scope !== void 0 ? { scope: args.scope } : {},
6913
+ ...args.projectSlug !== void 0 ? { projectSlug: args.projectSlug } : {}
6903
6914
  };
6904
6915
  }
6905
6916
  //#endregion
@@ -6915,6 +6926,47 @@ function registerCredentialsDeleteCommand(credentials) {
6915
6926
  }));
6916
6927
  }
6917
6928
  //#endregion
6929
+ //#region src/commands/connect/parse-connect-scopes.ts
6930
+ function parseConnectScopes(scopes, projectSlugs) {
6931
+ const normalized = scopes.length > 0 ? scopes : ["org"];
6932
+ for (const scope of normalized) if (scope !== "org" && scope !== "user" && scope !== "project") throw new Error(`Unknown scope "${scope}". Expected org, user, or project.`);
6933
+ const createOrganizationCredential = normalized.includes("org");
6934
+ const createUserProvidedCredential = normalized.includes("user");
6935
+ const includesProject = normalized.includes("project");
6936
+ const selectedProjects = includesProject ? projectSlugs : [];
6937
+ if (includesProject && selectedProjects.length === 0) throw new Error("--project-slug is required when scope includes project");
6938
+ if (!createOrganizationCredential && !createUserProvidedCredential && selectedProjects.length === 0) throw new Error("At least one scope is required via --scope and/or --project-slug");
6939
+ return {
6940
+ createOrganizationCredential,
6941
+ createUserProvidedCredential,
6942
+ projects: selectedProjects
6943
+ };
6944
+ }
6945
+ //#endregion
6946
+ //#region src/commands/credentials/parse-set-scopes.ts
6947
+ function parseCredentialSetScopes(scopes, projectSlugs) {
6948
+ return parseConnectScopes(scopes, projectSlugs);
6949
+ }
6950
+ //#endregion
6951
+ //#region src/commands/credentials/duplicate.ts
6952
+ function registerCredentialsDuplicateCommand(credentials) {
6953
+ credentials.command("duplicate").description("Duplicate a credential into one or more scopes").argument("<ref>", "Credential slug or id").option("--name <name>", "Display name for the copy").option("--label <label>", "Alias for --name").option("--scope <scope>", "org, user, or project (repeatable)", collectValues$2, []).option("--project-slug <slug>", "Project slug when scope includes project (repeatable)", collectValues$2, []).action((ref, options) => runCredentialsCommand("Duplicate credential failed", async ({ platform, local }) => {
6954
+ if (local) throw new Error("Duplicate is only supported for platform credentials");
6955
+ const targets = parseCredentialSetScopes(options.scope, options.projectSlug);
6956
+ const displayName = options.name ?? options.label;
6957
+ const credentials = await platform.credentials.duplicate(ref, {
6958
+ projects: targets.projects,
6959
+ createOrganizationCredential: targets.createOrganizationCredential,
6960
+ createUserProvidedCredential: targets.createUserProvidedCredential,
6961
+ ...displayName !== void 0 ? { label: displayName } : {}
6962
+ });
6963
+ process.stdout.write(`${JSON.stringify({ credentials }, null, 2)}\n`);
6964
+ }));
6965
+ }
6966
+ function collectValues$2(value, previous) {
6967
+ return previous.concat([value]);
6968
+ }
6969
+ //#endregion
6918
6970
  //#region src/commands/credentials/get.ts
6919
6971
  function registerCredentialsGetCommand(credentials) {
6920
6972
  credentials.command("get").description("Get a credential instance by id").argument("<id>", "Credential instance id").action((id) => runCredentialsCommand("Get credential failed", async ({ platform, local }) => {
@@ -7043,31 +7095,9 @@ async function assertNoSetConflict(client, args) {
7043
7095
  }));
7044
7096
  }
7045
7097
  //#endregion
7046
- //#region src/commands/connect/parse-connect-scopes.ts
7047
- function parseConnectScopes(scopes, projectSlugs) {
7048
- const normalized = scopes.length > 0 ? scopes : ["org"];
7049
- for (const scope of normalized) if (scope !== "org" && scope !== "user" && scope !== "project") throw new Error(`Unknown scope "${scope}". Expected org, user, or project.`);
7050
- const createOrganizationCredential = normalized.includes("org");
7051
- const createUserProvidedCredential = normalized.includes("user");
7052
- const includesProject = normalized.includes("project");
7053
- const selectedProjects = includesProject ? projectSlugs : [];
7054
- if (includesProject && selectedProjects.length === 0) throw new Error("--project-slug is required when scope includes project");
7055
- if (!createOrganizationCredential && !createUserProvidedCredential && selectedProjects.length === 0) throw new Error("At least one scope is required via --scope and/or --project-slug");
7056
- return {
7057
- createOrganizationCredential,
7058
- createUserProvidedCredential,
7059
- projects: selectedProjects
7060
- };
7061
- }
7062
- //#endregion
7063
- //#region src/commands/credentials/parse-set-scopes.ts
7064
- function parseCredentialSetScopes(scopes, projectSlugs) {
7065
- return parseConnectScopes(scopes, projectSlugs);
7066
- }
7067
- //#endregion
7068
7098
  //#region src/commands/credentials/set.ts
7069
7099
  function registerCredentialsCreateCommand(credentials) {
7070
- credentials.command("create").description("Create a new api_key credential instance").argument("<key>", "Credential key or app id, e.g. exa").option("--scope <scope>", "org, user, or project (repeatable)", collectValues, []).option("--project-slug <slug>", "Project slug when scope includes project (repeatable)", collectValues, []).option("--slug <slug>", "Friendly credential slug within the scope").option("--name <name>", "Display name (used to derive slug when --slug is omitted)").option("--label <label>", "Alias for --name").option("--default", "Mark as default for this scope").option("--set <field>", "Credential field as key=value or key=@env:VAR (falls back to project .env when unset in shell)", collectSetValues$1, []).action((key, options) => runCredentialsCommand("Set credential failed", async ({ platform, local }) => {
7100
+ credentials.command("create").description("Create a new api_key credential instance").argument("<key>", "Credential key or app id, e.g. exa").option("--scope <scope>", "org, user, or project (repeatable)", collectValues$1, []).option("--project-slug <slug>", "Project slug when scope includes project (repeatable)", collectValues$1, []).option("--slug <slug>", "Friendly credential slug within the scope").option("--name <name>", "Display name (used to derive slug when --slug is omitted)").option("--label <label>", "Alias for --name").option("--default", "Mark as default for this scope").option("--set <field>", "Credential field as key=value or key=@env:VAR (falls back to project .env when unset in shell)", collectSetValues$1, []).action((key, options) => runCredentialsCommand("Set credential failed", async ({ platform, local }) => {
7071
7101
  const value = parseCredentialValueFields(options.set);
7072
7102
  const parsedScopes = parseCredentialSetScopes(options.scope, options.projectSlug);
7073
7103
  if (local) {
@@ -7119,7 +7149,7 @@ function registerCredentialsCreateCommand(credentials) {
7119
7149
  process.stdout.write(`${JSON.stringify({ credentials: created }, null, 2)}\n`);
7120
7150
  })).alias("set");
7121
7151
  }
7122
- function collectValues(value, previous) {
7152
+ function collectValues$1(value, previous) {
7123
7153
  return previous.concat([value]);
7124
7154
  }
7125
7155
  function collectSetValues$1(value, previous) {
@@ -7143,12 +7173,32 @@ function expandLocalCredentialTargets(targets) {
7143
7173
  return expanded;
7144
7174
  }
7145
7175
  //#endregion
7176
+ //#region src/commands/credentials/parse-update-scope.ts
7177
+ /** Parse a single destination scope for `credentials update --scope`. */
7178
+ function parseCredentialUpdateScope(scopes, projectSlugs) {
7179
+ if (scopes.length === 0) return;
7180
+ if (scopes.length > 1) throw new Error("Scope swap accepts a single --scope value (org, user, or project)");
7181
+ const scope = scopes[0];
7182
+ if (scope !== "org" && scope !== "user" && scope !== "project") throw new Error(`Unknown scope "${scope}". Expected org, user, or project.`);
7183
+ if (scope === "project") {
7184
+ if (projectSlugs.length !== 1) throw new Error("--project-slug is required exactly once when scope is project");
7185
+ return {
7186
+ scope: "project",
7187
+ projectSlug: projectSlugs[0]
7188
+ };
7189
+ }
7190
+ if (projectSlugs.length > 0) throw new Error("--project-slug is only valid when scope is project");
7191
+ return { scope: scope === "org" ? "organization" : "user" };
7192
+ }
7193
+ //#endregion
7146
7194
  //#region src/commands/credentials/update.ts
7147
7195
  function registerCredentialsUpdateCommand(credentials) {
7148
- credentials.command("update").description("Update a credential instance").argument("<ref>", "Credential slug or id").option("--slug <slug>", "Update friendly slug").option("--name <name>", "Update display name").option("--label <label>", "Alias for --name").option("--default", "Mark as default for this scope").option("--set <field>", "Credential field as key=value or key=@env:VAR", collectSetValues, []).action((ref, options) => runCredentialsCommand("Update credential failed", async ({ platform, local }) => {
7196
+ credentials.command("update").description("Update a credential instance").argument("<ref>", "Credential slug or id").option("--slug <slug>", "Update friendly slug").option("--name <name>", "Update display name").option("--label <label>", "Alias for --name").option("--default", "Mark as default for this scope").option("--scope <scope>", "Move to org, user, or project scope", collectValues, []).option("--project-slug <slug>", "Project slug when --scope is project", collectValues, []).option("--set <field>", "Credential field as key=value or key=@env:VAR", collectSetValues, []).action((ref, options) => runCredentialsCommand("Update credential failed", async ({ platform, local }) => {
7149
7197
  const value = options.set.length > 0 ? parseCredentialValueFields(options.set) : void 0;
7150
7198
  const displayName = options.name ?? options.label;
7199
+ const scopeTarget = parseCredentialUpdateScope(options.scope, options.projectSlug);
7151
7200
  if (local) {
7201
+ if (scopeTarget) throw new Error("Scope swap is only supported for platform credentials");
7152
7202
  const { client } = await createLocalCredentialsClient();
7153
7203
  const result = await client.credentials.updateInstance(ref, {
7154
7204
  ...options.slug !== void 0 ? { slug: options.slug } : {},
@@ -7162,7 +7212,11 @@ function registerCredentialsUpdateCommand(credentials) {
7162
7212
  const patch = buildPlatformUpdatePatch({
7163
7213
  ...displayName !== void 0 ? { label: displayName } : {},
7164
7214
  ...options.default !== void 0 ? { isDefault: options.default } : {},
7165
- ...value ? { value } : {}
7215
+ ...value ? { value } : {},
7216
+ ...scopeTarget ? {
7217
+ scope: scopeTarget.scope,
7218
+ ...scopeTarget.projectSlug !== void 0 ? { projectSlug: scopeTarget.projectSlug } : {}
7219
+ } : {}
7166
7220
  });
7167
7221
  const credential = await platform.credentials.update(ref, patch);
7168
7222
  process.stdout.write(`${JSON.stringify({ credential }, null, 2)}\n`);
@@ -7171,6 +7225,9 @@ function registerCredentialsUpdateCommand(credentials) {
7171
7225
  function collectSetValues(value, previous) {
7172
7226
  return previous.concat([value]);
7173
7227
  }
7228
+ function collectValues(value, previous) {
7229
+ return previous.concat([value]);
7230
+ }
7174
7231
  //#endregion
7175
7232
  //#region src/commands/credentials/index.ts
7176
7233
  function registerCredentialsCommand(program) {
@@ -7179,6 +7236,7 @@ function registerCredentialsCommand(program) {
7179
7236
  registerCredentialsGetCommand(credentials);
7180
7237
  registerCredentialsCreateCommand(credentials);
7181
7238
  registerCredentialsUpdateCommand(credentials);
7239
+ registerCredentialsDuplicateCommand(credentials);
7182
7240
  registerCredentialsRotateCommand(credentials);
7183
7241
  registerCredentialsDeleteCommand(credentials);
7184
7242
  registerCredentialsAssignmentsCommands(credentials);
@@ -7393,7 +7451,7 @@ function registerBuildCommand(program) {
7393
7451
  try {
7394
7452
  const root = resolveProjectRoot(options.dir);
7395
7453
  await ensureSdkCurrent(root);
7396
- const { buildApp } = await import("./dist-yDNd8kGO.mjs");
7454
+ const { buildApp } = await import("./dist-GJJ5OG1V.mjs");
7397
7455
  await buildApp({ root });
7398
7456
  process.stdout.write(`Built ${root}\n`);
7399
7457
  } catch (error) {
@@ -7518,7 +7576,7 @@ async function sleep(ms) {
7518
7576
  }
7519
7577
  async function buildDeployArchive(client, root, projectId, filter) {
7520
7578
  if (filter?.length) {
7521
- const { buildFilteredApp } = await import("./dist-yDNd8kGO.mjs");
7579
+ const { buildFilteredApp } = await import("./dist-GJJ5OG1V.mjs");
7522
7580
  const filtered = await buildFilteredApp({
7523
7581
  root,
7524
7582
  filter,
@@ -7540,7 +7598,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
7540
7598
  sourceFiles: filtered.sourceFiles
7541
7599
  };
7542
7600
  }
7543
- const { buildApp } = await import("./dist-yDNd8kGO.mjs");
7601
+ const { buildApp } = await import("./dist-GJJ5OG1V.mjs");
7544
7602
  const { sourceFiles } = await buildApp({
7545
7603
  root,
7546
7604
  collectSources: true,
@@ -7667,7 +7725,7 @@ function runtimeChildEnv(parentEnv, overrides) {
7667
7725
  //#region src/project/bootstrap-run.ts
7668
7726
  /** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
7669
7727
  async function resolveBootstrapRun(options) {
7670
- const { resolveRuntimeBuildArtifact } = await import("./dist-yDNd8kGO.mjs");
7728
+ const { resolveRuntimeBuildArtifact } = await import("./dist-GJJ5OG1V.mjs");
7671
7729
  const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
7672
7730
  const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
7673
7731
  const args = [`--import=${loader}`];
@@ -7817,7 +7875,7 @@ async function runDev(options) {
7817
7875
  process.on("SIGINT", shutdown);
7818
7876
  process.on("SIGTERM", shutdown);
7819
7877
  try {
7820
- const { watchApp } = await import("./dist-yDNd8kGO.mjs");
7878
+ const { watchApp } = await import("./dist-GJJ5OG1V.mjs");
7821
7879
  await watchApp({
7822
7880
  root,
7823
7881
  clean: false,
@@ -8879,7 +8937,7 @@ async function runStart(options) {
8879
8937
  const apiPort = Number(new URL(serverUrl).port || 80);
8880
8938
  const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
8881
8939
  ensureNativeDeps(runtimeNodeModules);
8882
- const { buildApp } = await import("./dist-yDNd8kGO.mjs");
8940
+ const { buildApp } = await import("./dist-GJJ5OG1V.mjs");
8883
8941
  await buildApp({
8884
8942
  root,
8885
8943
  clean: false
@@ -9711,7 +9769,7 @@ function createProgram() {
9711
9769
  async function runCli(argv) {
9712
9770
  initCliTelemetry();
9713
9771
  try {
9714
- const { maybeAutoUpdate } = await import("./maybe-auto-update-C-HUlgKp.mjs");
9772
+ const { maybeAutoUpdate } = await import("./maybe-auto-update-DHXEHwKF.mjs");
9715
9773
  await maybeAutoUpdate(argv);
9716
9774
  await createProgram().parseAsync(argv);
9717
9775
  } finally {