@keystrokehq/cli 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist-6GfH430k.mjs +3 -0
- package/dist/{dist-CJL2zYbP.mjs → dist-D0bvBuXk.mjs} +64 -5
- package/dist/dist-D0bvBuXk.mjs.map +1 -0
- package/dist/{dist-CwR72_PS.mjs → dist-D5mdqlok.mjs} +16 -4
- package/dist/dist-D5mdqlok.mjs.map +1 -0
- package/dist/{dist-C47GdlWY.mjs → dist-DAVSXcfW.mjs} +272 -136
- package/dist/{dist-C47GdlWY.mjs.map → dist-DAVSXcfW.mjs.map} +1 -1
- package/dist/index.mjs +449 -176
- package/dist/index.mjs.map +1 -1
- package/dist/{maybe-auto-update-B0kal2FM.mjs → maybe-auto-update-C5I7EUot.mjs} +2 -2
- package/dist/{maybe-auto-update-B0kal2FM.mjs.map → maybe-auto-update-C5I7EUot.mjs.map} +1 -1
- package/dist/{version-Dxl3y5p6.mjs → version-_fM2Xco6.mjs} +2 -2
- package/dist/{version-Dxl3y5p6.mjs.map → version-_fM2Xco6.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/dist-CJL2zYbP.mjs.map +0 -1
- package/dist/dist-Ch53z2P3.mjs +0 -3
- package/dist/dist-CwR72_PS.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
3
|
-
import { _ as resolvePlatformUrlForWebUrl, a as installPlaygroundDependencies, c as createCliConfig, d as getEffectiveApiTarget, f as getPlatformUrl, h as DEFAULT_PLATFORM_URL, i as installDependencies, l as getCliConfigDir, m as getWebUrl, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getServerUrl, s as resolveCliRoot, t as readCliVersion, u as getConfigDir } from "./version-
|
|
2
|
+
import { $ as ListCredentialsResponseSchema, $t as UpsertGatewayAttachmentBodySchema, A as CreateOrganizationResponseSchema, At as SlugAvailabilityResponseSchema, B as GetCredentialResponseSchema, Bt as TriggerRunListResponseSchema, C as CreateApiKeyResponseSchema, Ct as PromptResponseSchema, D as CreateCustomAppRequestSchema, Dt as RecentResourceListResponseSchema, E as CreateCredentialsResponseSchema, Et as ROUTE_MANIFEST_REL_PATH, F as CredentialInstanceRecordSchema, Ft as StoredRouteManifestSchema, G as HistoryRunListQuerySchema, Gt as UpdateOrganizationMemberResponseSchema, H as HealthResponseSchema, Ht as UpdateCredentialInstanceBodySchema, I as DeclineOrganizationInvitationResponseSchema, It as SubmitTeamRequestRequestSchema, J as InviteOrganizationMembersResponseSchema, Jt as UpdateProjectMemberResponseSchema, K as HistoryRunListResponseSchema, Kt as UpdateOrganizationRequestSchema, L as DownloadActiveProjectArtifactResponseSchema, Lt as TriggerDetailResponseSchema, M as CreateProjectRequestSchema, Mt as StartKeystrokeConnectionResultSchema, N as CreateProjectResponseSchema, Nt as StartOAuthConnectionInputSchema, O as CreateCustomAppResponseSchema, Ot as SkillSummaryDetailResponseSchema, P as CredentialInstanceListResponseSchema, Pt as StartOAuthConnectionResultSchema, Q as ListAppsResponseSchema, Qt as UploadProjectSourceResponseSchema, R as ErrorResponseSchema, Rt as TriggerListResponseSchema, S as CreateApiKeyRequestSchema, St as PromptInputSchema, T as CreateCredentialsRequestSchema, Tt as QueuedRunResponseSchema, U as HistoryRunCancelResponseSchema, Ut as UpdateCredentialRequestSchema, V as GetCustomAppResponseSchema, Vt as UpdateChannelBindingBodySchema, W as HistoryRunDetailResponseSchema, Wt as UpdateOrganizationMemberRequestSchema, X as InviteProjectMembersResponseSchema, Xt as UpdateProjectSettingsRequestSchema, Y as InviteProjectMembersRequestSchema, Yt as UpdateProjectRequestSchema, Z as ListApiKeysResponseSchema, Zt as UploadProjectSourceManifestRequestSchema, _ as ChannelDirectoryListResponseSchema, _t as PresignUserAvatarResponseSchema, a as AgentSessionListResponseSchema, an as WorkflowRunListResponseSchema, at as ListProjectMembersResponseSchema, b as ConnectAuthorizeUrlResponseSchema, bt as ProjectSettingsResponseSchema, c as AppSlugAvailabilityResponseSchema, cn as listenPortFromPublicUrl, ct as OrganizationSidebarBrandingPatchSchema, d as CatalogActionsPageResponseSchema, dn as parseAppSlug, dt as PollRunResponseSchema, en as UserAvatarPatchSchema, et as ListOrganizationInvitationsResponseSchema, f as CatalogAppDetailResponseSchema, fn as parseErrorResponse, ft as PresignOrgLogoRequestSchema, g as ChannelConnectionSchema, gt as PresignUserAvatarRequestSchema, h as ChannelConnectionListResponseSchema, ht as PresignProjectSourceResponseSchema, i as AgentSessionDetailResponseSchema, in as WorkflowRunDetailResponseSchema, it as ListProjectFilesResponseSchema, j as CreateProjectArtifactResponseSchema, jt as StartKeystrokeConnectionInputSchema, k as CreateOrganizationRequestSchema, kt as SkillSummaryListResponseSchema, l as BindChannelBodySchema, lt as OrganizationSidebarBrandingSchema, m as ChannelAccountListResponseSchema, mt as PresignProjectSourceRequestSchema, n as AcceptOrganizationInvitationResponseSchema, nn as UserPreferencesPatchSchema, nt as ListOrganizationsResponseSchema, o as AgentSummaryDetailResponseSchema, on as WorkflowSummaryDetailResponseSchema, ot as ListProjectMetricsResponseSchema, p as CatalogAppsPageResponseSchema, pn as slugifyAppName, pt as PresignOrgLogoResponseSchema, q as InviteOrganizationMembersRequestSchema, qt as UpdateProjectMemberRequestSchema, r as ActiveOrganizationResponseSchema, rn as UserPreferencesSchema, rt as ListProjectDeploymentsResponseSchema, s as AgentSummaryListResponseSchema, sn as WorkflowSummaryListResponseSchema, st as ListProjectsResponseSchema, t as ACTIVE_ORG_HEADER, tn as UserAvatarSchema, tt as ListOrganizationMembersResponseSchema, u as CatalogActionDetailResponseSchema, ut as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, v as ChannelPlatformSchema, vt as ProjectReachabilityResponseSchema, w as CreateCredentialInstanceBodySchema, wt as QueuedAgentPromptResponseSchema, x as ConnectProvidersResponseSchema, xt as ProjectSlugAvailabilityResponseSchema, y as CompleteProjectArtifactResponseSchema, yt as ProjectResponseSchema, z as GatewayAttachmentRecordSchema, zt as TriggerRunDetailResponseSchema } from "./dist-DAVSXcfW.mjs";
|
|
3
|
+
import { _ as resolvePlatformUrlForWebUrl, a as installPlaygroundDependencies, c as createCliConfig, d as getEffectiveApiTarget, f as getPlatformUrl, h as DEFAULT_PLATFORM_URL, i as installDependencies, l as getCliConfigDir, m as getWebUrl, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getServerUrl, s as resolveCliRoot, t as readCliVersion, u as getConfigDir } from "./version-_fM2Xco6.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { Command } from "commander";
|
|
6
6
|
import { platform, tmpdir } from "node:os";
|
|
@@ -8,9 +8,9 @@ import { basename, dirname, isAbsolute, join, relative, resolve } from "node:pat
|
|
|
8
8
|
import { Entry } from "@napi-rs/keyring";
|
|
9
9
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
10
10
|
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
11
|
+
import { access, copyFile, cp, lstat, mkdir, readFile, readdir, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
11
12
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
13
|
import { pathToFileURL } from "node:url";
|
|
13
|
-
import { access, copyFile, cp, lstat, mkdir, readFile, readdir, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
14
14
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
|
|
15
15
|
/**
|
|
16
16
|
Base class for all Ky-specific errors. `HTTPError`, `NetworkError`, `TimeoutError`, and `ForceRetryError` extend this class.
|
|
@@ -1700,7 +1700,7 @@ function createJwtTokenCache(mint) {
|
|
|
1700
1700
|
};
|
|
1701
1701
|
}
|
|
1702
1702
|
//#endregion
|
|
1703
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
1703
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/version.mjs
|
|
1704
1704
|
const PACKAGE_VERSION = "1.6.11";
|
|
1705
1705
|
//#endregion
|
|
1706
1706
|
//#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.4.3/node_modules/better-call/dist/error.mjs
|
|
@@ -1825,7 +1825,7 @@ var BetterAuthError = class extends Error {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
};
|
|
1827
1827
|
//#endregion
|
|
1828
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
1828
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
|
|
1829
1829
|
const deviceAuthorizationClient = () => {
|
|
1830
1830
|
return {
|
|
1831
1831
|
id: "device-authorization",
|
|
@@ -1970,7 +1970,7 @@ let onMount = ($store, initialize) => {
|
|
|
1970
1970
|
});
|
|
1971
1971
|
};
|
|
1972
1972
|
//#endregion
|
|
1973
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
1973
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/query.mjs
|
|
1974
1974
|
const isServer = () => typeof window === "undefined";
|
|
1975
1975
|
const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
1976
1976
|
const value = /* @__PURE__ */ atom({
|
|
@@ -2064,7 +2064,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
2064
2064
|
return value;
|
|
2065
2065
|
};
|
|
2066
2066
|
//#endregion
|
|
2067
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2067
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
2068
2068
|
const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
2069
2069
|
const now$1 = () => Math.floor(Date.now() / 1e3);
|
|
2070
2070
|
var WindowBroadcastChannel = class {
|
|
@@ -2107,7 +2107,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
2107
2107
|
return globalThis[kBroadcastChannel];
|
|
2108
2108
|
}
|
|
2109
2109
|
//#endregion
|
|
2110
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2110
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
2111
2111
|
const kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
2112
2112
|
var WindowFocusManager = class {
|
|
2113
2113
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2136,7 +2136,7 @@ function getGlobalFocusManager() {
|
|
|
2136
2136
|
return globalThis[kFocusManager];
|
|
2137
2137
|
}
|
|
2138
2138
|
//#endregion
|
|
2139
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2139
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/online-manager.mjs
|
|
2140
2140
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
2141
2141
|
var WindowOnlineManager = class {
|
|
2142
2142
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -2168,7 +2168,7 @@ function getGlobalOnlineManager() {
|
|
|
2168
2168
|
return globalThis[kOnlineManager];
|
|
2169
2169
|
}
|
|
2170
2170
|
//#endregion
|
|
2171
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2171
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/parser.mjs
|
|
2172
2172
|
const PROTO_POLLUTION_PATTERNS = {
|
|
2173
2173
|
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
2174
2174
|
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
@@ -2238,7 +2238,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
2238
2238
|
return betterJSONParse(value, options);
|
|
2239
2239
|
}
|
|
2240
2240
|
//#endregion
|
|
2241
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2241
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
2242
2242
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
2243
2243
|
/**
|
|
2244
2244
|
* Normalize $fetch response: `throw: true` returns data directly, otherwise `{ data, error }`.
|
|
@@ -2436,7 +2436,7 @@ Object.freeze({
|
|
|
2436
2436
|
}
|
|
2437
2437
|
});
|
|
2438
2438
|
//#endregion
|
|
2439
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2439
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/utils/url.mjs
|
|
2440
2440
|
function checkHasPath(url) {
|
|
2441
2441
|
try {
|
|
2442
2442
|
return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
|
|
@@ -2508,7 +2508,7 @@ function getOrigin(url) {
|
|
|
2508
2508
|
}
|
|
2509
2509
|
}
|
|
2510
2510
|
//#endregion
|
|
2511
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2511
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
2512
2512
|
const redirectPlugin = {
|
|
2513
2513
|
id: "redirect",
|
|
2514
2514
|
name: "Redirect",
|
|
@@ -2523,7 +2523,7 @@ const redirectPlugin = {
|
|
|
2523
2523
|
} }
|
|
2524
2524
|
};
|
|
2525
2525
|
//#endregion
|
|
2526
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
2526
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/session-atom.mjs
|
|
2527
2527
|
function getSessionAtom($fetch, options) {
|
|
2528
2528
|
const $signal = /* @__PURE__ */ atom(false);
|
|
2529
2529
|
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
@@ -3010,7 +3010,7 @@ var betterFetch = async (url, options) => {
|
|
|
3010
3010
|
};
|
|
3011
3011
|
};
|
|
3012
3012
|
//#endregion
|
|
3013
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
3013
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/config.mjs
|
|
3014
3014
|
const resolvePublicAuthUrl = (basePath) => {
|
|
3015
3015
|
if (typeof process === "undefined") return void 0;
|
|
3016
3016
|
const path = basePath ?? "/api/auth";
|
|
@@ -3108,12 +3108,12 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
3108
3108
|
};
|
|
3109
3109
|
};
|
|
3110
3110
|
//#endregion
|
|
3111
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
3111
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
3112
3112
|
function isAtom(value) {
|
|
3113
3113
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
3114
3114
|
}
|
|
3115
3115
|
//#endregion
|
|
3116
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
3116
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/proxy.mjs
|
|
3117
3117
|
function getMethod(path, knownPathMethods, args) {
|
|
3118
3118
|
const method = knownPathMethods[path];
|
|
3119
3119
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -3193,7 +3193,7 @@ function capitalizeFirstLetter(str) {
|
|
|
3193
3193
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
3194
3194
|
}
|
|
3195
3195
|
//#endregion
|
|
3196
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4.
|
|
3196
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@opentelemetry+api@1.9.1_@tanstack+react-start@1.168.26_crossws@0.4._775c78039924a67af81d79c1d7be3379/node_modules/better-auth/dist/client/vanilla.mjs
|
|
3197
3197
|
function createAuthClient(options) {
|
|
3198
3198
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
3199
3199
|
const resolvedHooks = {};
|
|
@@ -3351,6 +3351,7 @@ var PlatformError = class extends Error {
|
|
|
3351
3351
|
}
|
|
3352
3352
|
};
|
|
3353
3353
|
async function toPlatformError(error) {
|
|
3354
|
+
if (error instanceof PlatformError) return error;
|
|
3354
3355
|
if (!isHTTPError(error)) return new PlatformError(error instanceof Error ? error.message : "Request failed", 0, null);
|
|
3355
3356
|
const status = error.response.status;
|
|
3356
3357
|
const body = error.data ?? null;
|
|
@@ -3421,7 +3422,7 @@ function createDeploymentsResource(http) {
|
|
|
3421
3422
|
return { async listForProject(projectId) {
|
|
3422
3423
|
try {
|
|
3423
3424
|
const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}/deployments`).json();
|
|
3424
|
-
return ListProjectDeploymentsResponseSchema.parse(data)
|
|
3425
|
+
return ListProjectDeploymentsResponseSchema.parse(data);
|
|
3425
3426
|
} catch (error) {
|
|
3426
3427
|
throw await toPlatformError(error);
|
|
3427
3428
|
}
|
|
@@ -3474,7 +3475,7 @@ function createOrganizationsResource(http, options = {}) {
|
|
|
3474
3475
|
async function get(organizationId) {
|
|
3475
3476
|
try {
|
|
3476
3477
|
const data = await http.get(`/api/organizations/${organizationId}`).json();
|
|
3477
|
-
const organization = ActiveOrganizationResponseSchema.parse(data)
|
|
3478
|
+
const organization = ActiveOrganizationResponseSchema.parse(data);
|
|
3478
3479
|
if (!organization) throw new Error("Organization was not returned");
|
|
3479
3480
|
return organization;
|
|
3480
3481
|
} catch (error) {
|
|
@@ -3487,7 +3488,7 @@ function createOrganizationsResource(http, options = {}) {
|
|
|
3487
3488
|
if (!organizationId) throw new Error("No active organization");
|
|
3488
3489
|
try {
|
|
3489
3490
|
const data = await http.patch(`/api/organizations/${organizationId}`, { json: body }).json();
|
|
3490
|
-
const organization = ActiveOrganizationResponseSchema.parse(data)
|
|
3491
|
+
const organization = ActiveOrganizationResponseSchema.parse(data);
|
|
3491
3492
|
if (!organization) throw new Error("Active organization was not returned");
|
|
3492
3493
|
return organization;
|
|
3493
3494
|
} catch (error) {
|
|
@@ -3498,7 +3499,7 @@ function createOrganizationsResource(http, options = {}) {
|
|
|
3498
3499
|
async list() {
|
|
3499
3500
|
try {
|
|
3500
3501
|
const data = await http.get("/api/organizations").json();
|
|
3501
|
-
return ListOrganizationsResponseSchema.parse(data)
|
|
3502
|
+
return ListOrganizationsResponseSchema.parse(data);
|
|
3502
3503
|
} catch (error) {
|
|
3503
3504
|
throw await toPlatformError(error);
|
|
3504
3505
|
}
|
|
@@ -3530,7 +3531,7 @@ function createOrganizationsResource(http, options = {}) {
|
|
|
3530
3531
|
const body = CreateOrganizationRequestSchema.parse(input);
|
|
3531
3532
|
try {
|
|
3532
3533
|
const data = await http.post("/api/organizations", { json: body }).json();
|
|
3533
|
-
return CreateOrganizationResponseSchema.parse(data)
|
|
3534
|
+
return CreateOrganizationResponseSchema.parse(data);
|
|
3534
3535
|
} catch (error) {
|
|
3535
3536
|
throw await toPlatformError(error);
|
|
3536
3537
|
}
|
|
@@ -3589,7 +3590,7 @@ function createProjectsResource(http) {
|
|
|
3589
3590
|
async list(options) {
|
|
3590
3591
|
try {
|
|
3591
3592
|
const data = await http.get("/api/projects", { searchParams: listSearchParams(options) }).json();
|
|
3592
|
-
return ListProjectsResponseSchema.parse(data)
|
|
3593
|
+
return ListProjectsResponseSchema.parse(data);
|
|
3593
3594
|
} catch (error) {
|
|
3594
3595
|
throw await toPlatformError(error);
|
|
3595
3596
|
}
|
|
@@ -3598,7 +3599,7 @@ function createProjectsResource(http) {
|
|
|
3598
3599
|
const body = CreateProjectRequestSchema.parse(input);
|
|
3599
3600
|
try {
|
|
3600
3601
|
const data = await http.post("/api/projects", { json: body }).json();
|
|
3601
|
-
return CreateProjectResponseSchema.parse(data)
|
|
3602
|
+
return CreateProjectResponseSchema.parse(data);
|
|
3602
3603
|
} catch (error) {
|
|
3603
3604
|
throw await toPlatformError(error);
|
|
3604
3605
|
}
|
|
@@ -3606,7 +3607,7 @@ function createProjectsResource(http) {
|
|
|
3606
3607
|
async get(projectId) {
|
|
3607
3608
|
try {
|
|
3608
3609
|
const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}`).json();
|
|
3609
|
-
return ProjectResponseSchema.parse(data)
|
|
3610
|
+
return ProjectResponseSchema.parse(data);
|
|
3610
3611
|
} catch (error) {
|
|
3611
3612
|
throw await toPlatformError(error);
|
|
3612
3613
|
}
|
|
@@ -3615,7 +3616,7 @@ function createProjectsResource(http) {
|
|
|
3615
3616
|
const body = UpdateProjectRequestSchema.parse(patch);
|
|
3616
3617
|
try {
|
|
3617
3618
|
const data = await http.patch(`/api/projects/${encodeURIComponent(projectId)}`, { json: body }).json();
|
|
3618
|
-
return ProjectResponseSchema.parse(data)
|
|
3619
|
+
return ProjectResponseSchema.parse(data);
|
|
3619
3620
|
} catch (error) {
|
|
3620
3621
|
throw await toPlatformError(error);
|
|
3621
3622
|
}
|
|
@@ -3651,7 +3652,7 @@ function createProjectMetricsResource(http) {
|
|
|
3651
3652
|
return { async list(options) {
|
|
3652
3653
|
try {
|
|
3653
3654
|
const data = await http.get("/api/projects/metrics", { searchParams: listSearchParams(options) }).json();
|
|
3654
|
-
return ListProjectMetricsResponseSchema.parse(data)
|
|
3655
|
+
return ListProjectMetricsResponseSchema.parse(data);
|
|
3655
3656
|
} catch (error) {
|
|
3656
3657
|
throw await toPlatformError(error);
|
|
3657
3658
|
}
|
|
@@ -3737,6 +3738,8 @@ function buildOAuthAuthorizeSearchParams(input) {
|
|
|
3737
3738
|
if (projectIds.length > 0) params.projects = projectIds.join(",");
|
|
3738
3739
|
if (input.createOrganizationCredential) params.org = "true";
|
|
3739
3740
|
if (input.createUserProvidedCredential) params.user = "true";
|
|
3741
|
+
const label = input.label?.trim();
|
|
3742
|
+
if (label) params.label = label;
|
|
3740
3743
|
return params;
|
|
3741
3744
|
}
|
|
3742
3745
|
function createCredentialsResource(http) {
|
|
@@ -3744,7 +3747,7 @@ function createCredentialsResource(http) {
|
|
|
3744
3747
|
async list() {
|
|
3745
3748
|
try {
|
|
3746
3749
|
const data = await http.get("/api/credentials").json();
|
|
3747
|
-
return ListCredentialsResponseSchema.parse(data)
|
|
3750
|
+
return ListCredentialsResponseSchema.parse(data);
|
|
3748
3751
|
} catch (error) {
|
|
3749
3752
|
throw await toPlatformError(error);
|
|
3750
3753
|
}
|
|
@@ -3752,7 +3755,7 @@ function createCredentialsResource(http) {
|
|
|
3752
3755
|
async get(credentialId) {
|
|
3753
3756
|
try {
|
|
3754
3757
|
const data = await http.get(`/api/credentials/${encodeURIComponent(credentialId)}`).json();
|
|
3755
|
-
return GetCredentialResponseSchema.parse(data)
|
|
3758
|
+
return GetCredentialResponseSchema.parse(data);
|
|
3756
3759
|
} catch (error) {
|
|
3757
3760
|
throw await toPlatformError(error);
|
|
3758
3761
|
}
|
|
@@ -3761,7 +3764,7 @@ function createCredentialsResource(http) {
|
|
|
3761
3764
|
const body = CreateCredentialsRequestSchema.parse(input);
|
|
3762
3765
|
try {
|
|
3763
3766
|
const data = await http.post("/api/credentials", { json: body }).json();
|
|
3764
|
-
return CreateCredentialsResponseSchema.parse(data)
|
|
3767
|
+
return CreateCredentialsResponseSchema.parse(data);
|
|
3765
3768
|
} catch (error) {
|
|
3766
3769
|
throw await toPlatformError(error);
|
|
3767
3770
|
}
|
|
@@ -3770,7 +3773,7 @@ function createCredentialsResource(http) {
|
|
|
3770
3773
|
const body = UpdateCredentialRequestSchema.parse(patch);
|
|
3771
3774
|
try {
|
|
3772
3775
|
const data = await http.patch(`/api/credentials/${encodeURIComponent(credentialId)}`, { json: body }).json();
|
|
3773
|
-
return GetCredentialResponseSchema.parse(data)
|
|
3776
|
+
return GetCredentialResponseSchema.parse(data);
|
|
3774
3777
|
} catch (error) {
|
|
3775
3778
|
throw await toPlatformError(error);
|
|
3776
3779
|
}
|
|
@@ -3794,25 +3797,128 @@ function createCredentialsResource(http) {
|
|
|
3794
3797
|
} catch (error) {
|
|
3795
3798
|
throw await toPlatformError(error);
|
|
3796
3799
|
}
|
|
3800
|
+
},
|
|
3801
|
+
async startKeystrokeConnection(input) {
|
|
3802
|
+
const body = StartKeystrokeConnectionInputSchema.parse(input);
|
|
3803
|
+
try {
|
|
3804
|
+
const data = await http.post("/mcp/connections", { json: body }).json();
|
|
3805
|
+
return StartKeystrokeConnectionResultSchema.parse(data);
|
|
3806
|
+
} catch (error) {
|
|
3807
|
+
throw await toPlatformError(error);
|
|
3808
|
+
}
|
|
3797
3809
|
}
|
|
3798
3810
|
};
|
|
3799
3811
|
}
|
|
3812
|
+
function parseCatalogData(schema, data) {
|
|
3813
|
+
const parsed = schema.safeParse(data);
|
|
3814
|
+
if (parsed.success) return parsed.data;
|
|
3815
|
+
throw new PlatformError(`Invalid catalog response: ${parsed.error.message}`, 502, data);
|
|
3816
|
+
}
|
|
3817
|
+
function catalogSearchParams(params) {
|
|
3818
|
+
const searchParams = new URLSearchParams();
|
|
3819
|
+
for (const [key, value] of Object.entries(params)) {
|
|
3820
|
+
if (value === void 0 || value === "") continue;
|
|
3821
|
+
searchParams.set(key, String(value));
|
|
3822
|
+
}
|
|
3823
|
+
return searchParams;
|
|
3824
|
+
}
|
|
3800
3825
|
function createAppsResource(http) {
|
|
3801
|
-
return {
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3826
|
+
return {
|
|
3827
|
+
async listCatalog() {
|
|
3828
|
+
try {
|
|
3829
|
+
const data = await http.get("/api/apps").json();
|
|
3830
|
+
return ListAppsResponseSchema.parse(data);
|
|
3831
|
+
} catch (error) {
|
|
3832
|
+
throw await toPlatformError(error);
|
|
3833
|
+
}
|
|
3834
|
+
},
|
|
3835
|
+
async searchCatalog(options) {
|
|
3836
|
+
try {
|
|
3837
|
+
const searchParams = catalogSearchParams({
|
|
3838
|
+
search: options.search,
|
|
3839
|
+
category: options.category,
|
|
3840
|
+
sort_by: options.sortBy,
|
|
3841
|
+
limit: options.limit,
|
|
3842
|
+
cursor: options.cursor
|
|
3843
|
+
});
|
|
3844
|
+
return parseCatalogData(CatalogAppsPageResponseSchema, await http.get(`/mcp/catalog/apps?${searchParams}`).json());
|
|
3845
|
+
} catch (error) {
|
|
3846
|
+
throw await toPlatformError(error);
|
|
3847
|
+
}
|
|
3848
|
+
},
|
|
3849
|
+
async getCatalogApp(slug) {
|
|
3850
|
+
try {
|
|
3851
|
+
return parseCatalogData(CatalogAppDetailResponseSchema, await http.get(`/mcp/catalog/apps/${encodeURIComponent(slug)}`).json());
|
|
3852
|
+
} catch (error) {
|
|
3853
|
+
throw await toPlatformError(error);
|
|
3854
|
+
}
|
|
3855
|
+
},
|
|
3856
|
+
async listCatalogActions(slug, options) {
|
|
3857
|
+
try {
|
|
3858
|
+
const searchParams = catalogSearchParams({
|
|
3859
|
+
search: options?.search,
|
|
3860
|
+
limit: options?.limit,
|
|
3861
|
+
cursor: options?.cursor
|
|
3862
|
+
});
|
|
3863
|
+
const query = searchParams.size > 0 ? `?${searchParams}` : "";
|
|
3864
|
+
return parseCatalogData(CatalogActionsPageResponseSchema, await http.get(`/mcp/catalog/apps/${encodeURIComponent(slug)}/actions${query}`).json());
|
|
3865
|
+
} catch (error) {
|
|
3866
|
+
throw await toPlatformError(error);
|
|
3867
|
+
}
|
|
3868
|
+
},
|
|
3869
|
+
async searchCatalogActions(options) {
|
|
3870
|
+
try {
|
|
3871
|
+
const searchParams = catalogSearchParams({
|
|
3872
|
+
search: options.search,
|
|
3873
|
+
limit: options.limit,
|
|
3874
|
+
cursor: options.cursor
|
|
3875
|
+
});
|
|
3876
|
+
return parseCatalogData(CatalogActionsPageResponseSchema, await http.get(`/mcp/catalog/actions?${searchParams}`).json());
|
|
3877
|
+
} catch (error) {
|
|
3878
|
+
throw await toPlatformError(error);
|
|
3879
|
+
}
|
|
3880
|
+
},
|
|
3881
|
+
async getCatalogAction(toolSlug) {
|
|
3882
|
+
try {
|
|
3883
|
+
return parseCatalogData(CatalogActionDetailResponseSchema, await http.get(`/mcp/catalog/actions/${encodeURIComponent(toolSlug)}`).json());
|
|
3884
|
+
} catch (error) {
|
|
3885
|
+
throw await toPlatformError(error);
|
|
3886
|
+
}
|
|
3887
|
+
},
|
|
3888
|
+
async checkSlug(slug) {
|
|
3889
|
+
try {
|
|
3890
|
+
const searchParams = new URLSearchParams({ slug });
|
|
3891
|
+
const data = await http.get(`/api/apps/slug-available?${searchParams}`).json();
|
|
3892
|
+
return AppSlugAvailabilityResponseSchema.parse(data);
|
|
3893
|
+
} catch (error) {
|
|
3894
|
+
throw await toPlatformError(error);
|
|
3895
|
+
}
|
|
3896
|
+
},
|
|
3897
|
+
async create(input) {
|
|
3898
|
+
try {
|
|
3899
|
+
const body = CreateCustomAppRequestSchema.parse(input);
|
|
3900
|
+
const data = await http.post("/api/apps", { json: body }).json();
|
|
3901
|
+
return CreateCustomAppResponseSchema.parse(data);
|
|
3902
|
+
} catch (error) {
|
|
3903
|
+
throw await toPlatformError(error);
|
|
3904
|
+
}
|
|
3905
|
+
},
|
|
3906
|
+
async get(slug) {
|
|
3907
|
+
try {
|
|
3908
|
+
const data = await http.get(`/api/apps/${encodeURIComponent(slug)}`).json();
|
|
3909
|
+
return GetCustomAppResponseSchema.parse(data);
|
|
3910
|
+
} catch (error) {
|
|
3911
|
+
throw await toPlatformError(error);
|
|
3912
|
+
}
|
|
3807
3913
|
}
|
|
3808
|
-
}
|
|
3914
|
+
};
|
|
3809
3915
|
}
|
|
3810
3916
|
function createMembersResource(http) {
|
|
3811
3917
|
return {
|
|
3812
3918
|
async listOrganizationMembers() {
|
|
3813
3919
|
try {
|
|
3814
3920
|
const data = await http.get("/api/members").json();
|
|
3815
|
-
return ListOrganizationMembersResponseSchema.parse(data)
|
|
3921
|
+
return ListOrganizationMembersResponseSchema.parse(data);
|
|
3816
3922
|
} catch (error) {
|
|
3817
3923
|
throw await toPlatformError(error);
|
|
3818
3924
|
}
|
|
@@ -3830,7 +3936,7 @@ function createMembersResource(http) {
|
|
|
3830
3936
|
const body = UpdateOrganizationMemberRequestSchema.parse(input);
|
|
3831
3937
|
try {
|
|
3832
3938
|
const data = await http.patch(`/api/members/${encodeURIComponent(userId)}`, { json: body }).json();
|
|
3833
|
-
return UpdateOrganizationMemberResponseSchema.parse(data)
|
|
3939
|
+
return UpdateOrganizationMemberResponseSchema.parse(data);
|
|
3834
3940
|
} catch (error) {
|
|
3835
3941
|
throw await toPlatformError(error);
|
|
3836
3942
|
}
|
|
@@ -3845,7 +3951,7 @@ function createMembersResource(http) {
|
|
|
3845
3951
|
async listForProject(projectId) {
|
|
3846
3952
|
try {
|
|
3847
3953
|
const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}/members`).json();
|
|
3848
|
-
return ListProjectMembersResponseSchema.parse(data)
|
|
3954
|
+
return ListProjectMembersResponseSchema.parse(data);
|
|
3849
3955
|
} catch (error) {
|
|
3850
3956
|
throw await toPlatformError(error);
|
|
3851
3957
|
}
|
|
@@ -3866,7 +3972,7 @@ function createMembersResource(http) {
|
|
|
3866
3972
|
const body = UpdateProjectMemberRequestSchema.parse(input);
|
|
3867
3973
|
try {
|
|
3868
3974
|
const data = await http.patch(`/api/projects/${encodeURIComponent(projectId)}/members/${encodeURIComponent(userId)}`, { json: body }).json();
|
|
3869
|
-
return UpdateProjectMemberResponseSchema.parse(data)
|
|
3975
|
+
return UpdateProjectMemberResponseSchema.parse(data);
|
|
3870
3976
|
} catch (error) {
|
|
3871
3977
|
throw await toPlatformError(error);
|
|
3872
3978
|
}
|
|
@@ -3892,7 +3998,7 @@ function createProjectSettingsResource(http) {
|
|
|
3892
3998
|
async get(projectId) {
|
|
3893
3999
|
try {
|
|
3894
4000
|
const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}/settings`).json();
|
|
3895
|
-
return ProjectSettingsResponseSchema.parse(data)
|
|
4001
|
+
return ProjectSettingsResponseSchema.parse(data);
|
|
3896
4002
|
} catch (error) {
|
|
3897
4003
|
throw await toPlatformError(error);
|
|
3898
4004
|
}
|
|
@@ -3901,7 +4007,7 @@ function createProjectSettingsResource(http) {
|
|
|
3901
4007
|
const body = UpdateProjectSettingsRequestSchema.parse(patch);
|
|
3902
4008
|
try {
|
|
3903
4009
|
const data = await http.patch(`/api/projects/${encodeURIComponent(projectId)}/settings`, { json: body }).json();
|
|
3904
|
-
return ProjectSettingsResponseSchema.parse(data)
|
|
4010
|
+
return ProjectSettingsResponseSchema.parse(data);
|
|
3905
4011
|
} catch (error) {
|
|
3906
4012
|
throw await toPlatformError(error);
|
|
3907
4013
|
}
|
|
@@ -3913,7 +4019,7 @@ function createInvitationsResource(http) {
|
|
|
3913
4019
|
async list() {
|
|
3914
4020
|
try {
|
|
3915
4021
|
const data = await http.get("/api/invitations").json();
|
|
3916
|
-
return ListOrganizationInvitationsResponseSchema.parse(data)
|
|
4022
|
+
return ListOrganizationInvitationsResponseSchema.parse(data);
|
|
3917
4023
|
} catch (error) {
|
|
3918
4024
|
throw await toPlatformError(error);
|
|
3919
4025
|
}
|
|
@@ -3921,7 +4027,7 @@ function createInvitationsResource(http) {
|
|
|
3921
4027
|
async accept(invitationId) {
|
|
3922
4028
|
try {
|
|
3923
4029
|
const data = await http.post(`/api/invitations/${encodeURIComponent(invitationId)}/accept`).json();
|
|
3924
|
-
return AcceptOrganizationInvitationResponseSchema.parse(data)
|
|
4030
|
+
return AcceptOrganizationInvitationResponseSchema.parse(data);
|
|
3925
4031
|
} catch (error) {
|
|
3926
4032
|
throw await toPlatformError(error);
|
|
3927
4033
|
}
|
|
@@ -3941,7 +4047,7 @@ function createApiKeysResource(http) {
|
|
|
3941
4047
|
async list() {
|
|
3942
4048
|
try {
|
|
3943
4049
|
const data = await http.get("/api/api-keys").json();
|
|
3944
|
-
return ListApiKeysResponseSchema.parse(data)
|
|
4050
|
+
return ListApiKeysResponseSchema.parse(data);
|
|
3945
4051
|
} catch (error) {
|
|
3946
4052
|
throw await toPlatformError(error);
|
|
3947
4053
|
}
|
|
@@ -4148,7 +4254,7 @@ function createChannelsResource(http) {
|
|
|
4148
4254
|
async function listGatewayPlatforms() {
|
|
4149
4255
|
try {
|
|
4150
4256
|
const data = await http.get("/api/apps").json();
|
|
4151
|
-
return ListAppsResponseSchema.parse(data).
|
|
4257
|
+
return ListAppsResponseSchema.parse(data).filter((app) => app.gateway).map((app) => projectChannelPlatform(app));
|
|
4152
4258
|
} catch (error) {
|
|
4153
4259
|
throw await toPlatformError(error);
|
|
4154
4260
|
}
|
|
@@ -4160,7 +4266,7 @@ function createChannelsResource(http) {
|
|
|
4160
4266
|
async listAccounts(projectId, platform) {
|
|
4161
4267
|
try {
|
|
4162
4268
|
const data = await http.get(`${projectPrefix(projectId)}/channels/${encodeURIComponent(platform)}/accounts`).json();
|
|
4163
|
-
return ChannelAccountListResponseSchema.parse(data)
|
|
4269
|
+
return ChannelAccountListResponseSchema.parse(data);
|
|
4164
4270
|
} catch (error) {
|
|
4165
4271
|
throw await toPlatformError(error);
|
|
4166
4272
|
}
|
|
@@ -4168,7 +4274,7 @@ function createChannelsResource(http) {
|
|
|
4168
4274
|
async listForAgent(projectId, agentId) {
|
|
4169
4275
|
try {
|
|
4170
4276
|
const data = await http.get(`${projectPrefix(projectId)}/agents/${encodeURIComponent(agentId)}/channels`).json();
|
|
4171
|
-
return ChannelConnectionListResponseSchema.parse(data)
|
|
4277
|
+
return ChannelConnectionListResponseSchema.parse(data);
|
|
4172
4278
|
} catch (error) {
|
|
4173
4279
|
throw await toPlatformError(error);
|
|
4174
4280
|
}
|
|
@@ -4176,7 +4282,7 @@ function createChannelsResource(http) {
|
|
|
4176
4282
|
async listChannels(projectId, platform, accountId) {
|
|
4177
4283
|
try {
|
|
4178
4284
|
const data = await http.get(`${projectPrefix(projectId)}/channels/${encodeURIComponent(platform)}/directory`, { searchParams: { accountId } }).json();
|
|
4179
|
-
return ChannelDirectoryListResponseSchema.parse(data)
|
|
4285
|
+
return ChannelDirectoryListResponseSchema.parse(data);
|
|
4180
4286
|
} catch (error) {
|
|
4181
4287
|
throw await toPlatformError(error);
|
|
4182
4288
|
}
|
|
@@ -4560,7 +4666,13 @@ function formatHttpClientError(error, context) {
|
|
|
4560
4666
|
if (origin && !getAccessToken(origin)) return "Not logged in. Run `keystroke auth login` first.";
|
|
4561
4667
|
return "Authentication failed. Run `keystroke auth login` again.";
|
|
4562
4668
|
}
|
|
4563
|
-
if (error.status ===
|
|
4669
|
+
if (error.status === 403) {
|
|
4670
|
+
if (parseErrorResponse(error.body)?.code === "org_unverified") return "This organization is pending verification. Request access in the Keystroke dashboard.";
|
|
4671
|
+
}
|
|
4672
|
+
if (error.status === 0) {
|
|
4673
|
+
if (error.message && !isUnreachableServerError(error)) return error.message;
|
|
4674
|
+
return unreachableServerMessage(unreachableTarget(context));
|
|
4675
|
+
}
|
|
4564
4676
|
const parsed = parseErrorResponse(error.body);
|
|
4565
4677
|
if (parsed) return formatApiErrorMessage(parsed, error.message, context);
|
|
4566
4678
|
return error.message;
|
|
@@ -4845,6 +4957,120 @@ function registerApiKeyCommand(program) {
|
|
|
4845
4957
|
});
|
|
4846
4958
|
}
|
|
4847
4959
|
//#endregion
|
|
4960
|
+
//#region src/commands/app/run-app-catalog.ts
|
|
4961
|
+
async function runAppSearch(client, query, options) {
|
|
4962
|
+
const trimmed = query.trim();
|
|
4963
|
+
if (!trimmed) throw new Error("Search query is required");
|
|
4964
|
+
return client.apps.searchCatalog({
|
|
4965
|
+
search: trimmed,
|
|
4966
|
+
category: options?.category,
|
|
4967
|
+
limit: options?.limit,
|
|
4968
|
+
cursor: options?.cursor
|
|
4969
|
+
});
|
|
4970
|
+
}
|
|
4971
|
+
async function runAppShow(client, slug) {
|
|
4972
|
+
const trimmed = slug.trim();
|
|
4973
|
+
if (!trimmed) throw new Error("App slug is required");
|
|
4974
|
+
return client.apps.getCatalogApp(trimmed);
|
|
4975
|
+
}
|
|
4976
|
+
async function runAppActions(client, options) {
|
|
4977
|
+
const slug = options.slug?.trim();
|
|
4978
|
+
const search = options.search?.trim();
|
|
4979
|
+
if (slug) return client.apps.listCatalogActions(slug, {
|
|
4980
|
+
search,
|
|
4981
|
+
limit: options.limit,
|
|
4982
|
+
cursor: options.cursor
|
|
4983
|
+
});
|
|
4984
|
+
if (!search) throw new Error("App slug or --search is required");
|
|
4985
|
+
return client.apps.searchCatalogActions({
|
|
4986
|
+
search,
|
|
4987
|
+
limit: options.limit,
|
|
4988
|
+
cursor: options.cursor
|
|
4989
|
+
});
|
|
4990
|
+
}
|
|
4991
|
+
async function runAppAction(client, toolSlug) {
|
|
4992
|
+
const trimmed = toolSlug.trim();
|
|
4993
|
+
if (!trimmed) throw new Error("Tool slug is required");
|
|
4994
|
+
return client.apps.getCatalogAction(trimmed);
|
|
4995
|
+
}
|
|
4996
|
+
//#endregion
|
|
4997
|
+
//#region src/commands/app/action.ts
|
|
4998
|
+
function registerAppActionCommand(app) {
|
|
4999
|
+
app.command("action").description("Show a Composio action schema from the live catalog").argument("<tool-slug>", "Composio tool slug (e.g. GITHUB_CREATE_ISSUE)").action((toolSlug) => runCliCommand("App action failed", async () => {
|
|
5000
|
+
const config = createCliConfig();
|
|
5001
|
+
const client = createCliPlatformClient(config);
|
|
5002
|
+
await ensureActiveOrganization(config);
|
|
5003
|
+
const result = await runAppAction(client, toolSlug);
|
|
5004
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
5005
|
+
}, void 0, { orgScoped: true }));
|
|
5006
|
+
}
|
|
5007
|
+
//#endregion
|
|
5008
|
+
//#region src/commands/app/actions.ts
|
|
5009
|
+
function registerAppActionsCommand(app) {
|
|
5010
|
+
app.command("actions [slug]").description("List or search Composio actions (per app or globally with --search)").option("--search <query>", "Search actions within the app or across all apps").option("--limit <n>", "Page size", (value) => Number.parseInt(value, 10)).option("--cursor <cursor>", "Pagination cursor").action((slug, options) => runCliCommand("App actions failed", async () => {
|
|
5011
|
+
const config = createCliConfig();
|
|
5012
|
+
const client = createCliPlatformClient(config);
|
|
5013
|
+
await ensureActiveOrganization(config);
|
|
5014
|
+
const result = await runAppActions(client, {
|
|
5015
|
+
slug,
|
|
5016
|
+
...options
|
|
5017
|
+
});
|
|
5018
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
5019
|
+
}, void 0, { orgScoped: true }));
|
|
5020
|
+
}
|
|
5021
|
+
//#endregion
|
|
5022
|
+
//#region src/commands/app/parse-custom-app-fields.ts
|
|
5023
|
+
function parseCustomAppFieldFlag(value) {
|
|
5024
|
+
const parts = value.split(":").map((part) => part.trim()).filter(Boolean);
|
|
5025
|
+
const key = parts[0];
|
|
5026
|
+
if (!key || !/^[a-zA-Z][a-zA-Z0-9_]*$/.test(key)) throw new Error(`Invalid field key in --field ${JSON.stringify(value)}`);
|
|
5027
|
+
const optional = parts.includes("optional");
|
|
5028
|
+
return {
|
|
5029
|
+
key,
|
|
5030
|
+
secret: parts.includes("public") ? false : parts.includes("secret") || !optional,
|
|
5031
|
+
optional
|
|
5032
|
+
};
|
|
5033
|
+
}
|
|
5034
|
+
function parseCustomAppFields(flags) {
|
|
5035
|
+
const fields = {};
|
|
5036
|
+
for (const flag of flags) {
|
|
5037
|
+
const parsed = parseCustomAppFieldFlag(flag);
|
|
5038
|
+
fields[parsed.key] = {
|
|
5039
|
+
...parsed.secret ? { secret: true } : {},
|
|
5040
|
+
...parsed.optional ? { optional: true } : {}
|
|
5041
|
+
};
|
|
5042
|
+
}
|
|
5043
|
+
if (Object.keys(fields).length === 0) throw new Error("At least one --field is required");
|
|
5044
|
+
if (!Object.values(fields).some((field) => field.optional !== true)) return fields;
|
|
5045
|
+
if (!Object.values(fields).some((field) => field.optional !== true)) throw new Error("At least one --field must be required (omit :optional)");
|
|
5046
|
+
return fields;
|
|
5047
|
+
}
|
|
5048
|
+
function collectValues$1(value, previous) {
|
|
5049
|
+
return [...previous, value];
|
|
5050
|
+
}
|
|
5051
|
+
//#endregion
|
|
5052
|
+
//#region src/commands/app/run-app-create.ts
|
|
5053
|
+
async function runAppCreate(client, input) {
|
|
5054
|
+
return client.apps.create(input);
|
|
5055
|
+
}
|
|
5056
|
+
//#endregion
|
|
5057
|
+
//#region src/commands/app/create.ts
|
|
5058
|
+
function registerAppCreateCommand(app) {
|
|
5059
|
+
app.command("create").description("Create a custom org api_key app").requiredOption("--name <name>", "App display name").option("--slug <slug>", "App slug segment (defaults from name)").requiredOption("--description <description>", "App description").option("--field <field>", "Credential field as key, key:secret, key:optional, or key:secret:optional (repeatable)", collectValues$1, []).action((options) => runCliCommand("Create app failed", async () => {
|
|
5060
|
+
const config = createCliConfig();
|
|
5061
|
+
const client = createCliPlatformClient(config);
|
|
5062
|
+
await ensureActiveOrganization(config);
|
|
5063
|
+
const slug = options.slug?.trim() || slugifyAppName(options.name);
|
|
5064
|
+
const created = await runAppCreate(client, {
|
|
5065
|
+
name: options.name.trim(),
|
|
5066
|
+
slug,
|
|
5067
|
+
description: options.description,
|
|
5068
|
+
fields: parseCustomAppFields(options.field)
|
|
5069
|
+
});
|
|
5070
|
+
process.stdout.write(`${JSON.stringify(created, null, 2)}\n`);
|
|
5071
|
+
}, void 0, { orgScoped: true }));
|
|
5072
|
+
}
|
|
5073
|
+
//#endregion
|
|
4848
5074
|
//#region src/commands/app/run-app-list.ts
|
|
4849
5075
|
async function runAppList(client) {
|
|
4850
5076
|
return client.apps.listCatalog();
|
|
@@ -4861,26 +5087,111 @@ function registerAppListCommand(app) {
|
|
|
4861
5087
|
}, void 0, { orgScoped: true }));
|
|
4862
5088
|
}
|
|
4863
5089
|
//#endregion
|
|
4864
|
-
//#region src/commands/app/
|
|
4865
|
-
function
|
|
4866
|
-
|
|
5090
|
+
//#region src/commands/app/search.ts
|
|
5091
|
+
function registerAppSearchCommand(app) {
|
|
5092
|
+
app.command("search").description("Search the Composio app catalog (live)").argument("<query>", "Search query").option("--category <category>", "Filter by category").option("--limit <n>", "Page size", (value) => Number.parseInt(value, 10)).option("--cursor <cursor>", "Pagination cursor").action((query, options) => runCliCommand("App search failed", async () => {
|
|
5093
|
+
const config = createCliConfig();
|
|
5094
|
+
const client = createCliPlatformClient(config);
|
|
5095
|
+
await ensureActiveOrganization(config);
|
|
5096
|
+
const result = await runAppSearch(client, query, options);
|
|
5097
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
5098
|
+
}, void 0, { orgScoped: true }));
|
|
4867
5099
|
}
|
|
4868
5100
|
//#endregion
|
|
4869
|
-
//#region src/commands/
|
|
4870
|
-
function
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
5101
|
+
//#region src/commands/app/show.ts
|
|
5102
|
+
function registerAppShowCommand(app) {
|
|
5103
|
+
app.command("show").description("Show a Composio app from the live catalog").argument("<slug>", "App slug").action((slug) => runCliCommand("App show failed", async () => {
|
|
5104
|
+
const config = createCliConfig();
|
|
5105
|
+
const client = createCliPlatformClient(config);
|
|
5106
|
+
await ensureActiveOrganization(config);
|
|
5107
|
+
const result = await runAppShow(client, slug);
|
|
5108
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
5109
|
+
}, void 0, { orgScoped: true }));
|
|
5110
|
+
}
|
|
5111
|
+
//#endregion
|
|
5112
|
+
//#region src/project/resolve-keystroke-config-root.ts
|
|
5113
|
+
const KEYSTROKE_CONFIG = "keystroke.config.ts";
|
|
5114
|
+
/** Walk up from `fromDir` and return the directory containing `keystroke.config.ts`, if any. */
|
|
5115
|
+
function resolveKeystrokeConfigRoot(fromDir = process.cwd()) {
|
|
5116
|
+
let dir = resolve(fromDir);
|
|
5117
|
+
while (dir !== dirname(dir)) {
|
|
5118
|
+
if (existsSync(join(dir, KEYSTROKE_CONFIG))) return dir;
|
|
5119
|
+
dir = dirname(dir);
|
|
5120
|
+
}
|
|
5121
|
+
if (existsSync(join(dir, KEYSTROKE_CONFIG))) return dir;
|
|
5122
|
+
return null;
|
|
5123
|
+
}
|
|
5124
|
+
//#endregion
|
|
5125
|
+
//#region src/commands/app/generate-app-stub.ts
|
|
5126
|
+
function slugPartToExportName(part) {
|
|
5127
|
+
return part.split(/[-_]+/).filter(Boolean).map((segment, index) => index === 0 ? segment.charAt(0).toLowerCase() + segment.slice(1) : segment.charAt(0).toUpperCase() + segment.slice(1)).join("");
|
|
5128
|
+
}
|
|
5129
|
+
function resolveSyncedAppExportName(slug) {
|
|
5130
|
+
const parsed = parseAppSlug(slug);
|
|
5131
|
+
const exportName = slugPartToExportName(parsed.kind === "org" ? parsed.name : parsed.slug);
|
|
5132
|
+
if (!exportName) throw new Error(`Cannot derive export name from app slug: ${slug}`);
|
|
5133
|
+
return exportName;
|
|
5134
|
+
}
|
|
5135
|
+
function resolveSyncedAppDirName(slug) {
|
|
5136
|
+
const parsed = parseAppSlug(slug);
|
|
5137
|
+
return parsed.kind === "org" ? parsed.name : parsed.slug;
|
|
5138
|
+
}
|
|
5139
|
+
function generateAppStub(app) {
|
|
5140
|
+
const exportName = resolveSyncedAppExportName(app.slug);
|
|
5141
|
+
const credentialLines = Object.entries(app.credentialFields).map(([key, field]) => {
|
|
5142
|
+
return ` ${key}: ${field.optional ? "z.string().optional()" : "z.string()"},`;
|
|
5143
|
+
}).join("\n");
|
|
5144
|
+
return `import { defineApp } from "@keystrokehq/keystroke/app";
|
|
5145
|
+
import { z } from "zod";
|
|
5146
|
+
|
|
5147
|
+
/** Synced from platform app \`${app.slug}\`. Re-run \`keystroke app sync ${app.slug}\` after template changes. */
|
|
5148
|
+
export const ${exportName} = defineApp({
|
|
5149
|
+
slug: ${JSON.stringify(app.slug)},
|
|
5150
|
+
auth: "api_key",
|
|
5151
|
+
credential: {
|
|
5152
|
+
${credentialLines}
|
|
5153
|
+
},
|
|
5154
|
+
});
|
|
5155
|
+
`;
|
|
5156
|
+
}
|
|
5157
|
+
//#endregion
|
|
5158
|
+
//#region src/commands/app/run-app-sync.ts
|
|
5159
|
+
async function runAppSync(options) {
|
|
5160
|
+
const projectRoot = resolveKeystrokeConfigRoot(options.dir ?? process.cwd());
|
|
5161
|
+
if (!projectRoot) throw new Error("Not in a keystroke project (keystroke.config.ts not found)");
|
|
5162
|
+
const app = await options.client.apps.get(options.slug);
|
|
5163
|
+
const appDir = join(projectRoot, "src", "apps", resolveSyncedAppDirName(app.slug));
|
|
5164
|
+
const outputPath = join(appDir, "app.ts");
|
|
5165
|
+
await mkdir(appDir, { recursive: true });
|
|
5166
|
+
await writeFile(outputPath, generateAppStub(app), "utf8");
|
|
5167
|
+
return { outputPath };
|
|
5168
|
+
}
|
|
5169
|
+
//#endregion
|
|
5170
|
+
//#region src/commands/app/sync.ts
|
|
5171
|
+
function registerAppSyncCommand(app) {
|
|
5172
|
+
app.command("sync").description("Sync a custom app credential template into src/apps/<name>/app.ts").argument("<slug>", "App slug, e.g. acme/internal-api").option("--dir <dir>", "Project root (defaults to cwd)").action((slug, options) => runCliCommand("Sync app failed", async () => {
|
|
5173
|
+
const config = createCliConfig();
|
|
5174
|
+
const client = createCliPlatformClient(config);
|
|
5175
|
+
await ensureActiveOrganization(config);
|
|
5176
|
+
const result = await runAppSync({
|
|
5177
|
+
client,
|
|
5178
|
+
slug,
|
|
5179
|
+
...options.dir !== void 0 ? { dir: options.dir } : {}
|
|
5180
|
+
});
|
|
5181
|
+
process.stdout.write(`Wrote ${result.outputPath}\n`);
|
|
5182
|
+
}, void 0, { orgScoped: true }));
|
|
5183
|
+
}
|
|
5184
|
+
//#endregion
|
|
5185
|
+
//#region src/commands/app/index.ts
|
|
5186
|
+
function registerAppCommand(program) {
|
|
5187
|
+
const app = program.command("app").description("Browse connectable integrations");
|
|
5188
|
+
registerAppListCommand(app);
|
|
5189
|
+
registerAppSearchCommand(app);
|
|
5190
|
+
registerAppShowCommand(app);
|
|
5191
|
+
registerAppActionsCommand(app);
|
|
5192
|
+
registerAppActionCommand(app);
|
|
5193
|
+
registerAppCreateCommand(app);
|
|
5194
|
+
registerAppSyncCommand(app);
|
|
4884
5195
|
}
|
|
4885
5196
|
//#endregion
|
|
4886
5197
|
//#region src/auth/open-url.ts
|
|
@@ -4893,101 +5204,59 @@ function openUrl(url) {
|
|
|
4893
5204
|
}
|
|
4894
5205
|
//#endregion
|
|
4895
5206
|
//#region src/commands/connect/run-connect.ts
|
|
4896
|
-
function
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
const url = `${serverUrl}${provider.path}`;
|
|
4904
|
-
if (printUrl) {
|
|
4905
|
-
process.stdout.write(`${url}\n`);
|
|
4906
|
-
return;
|
|
4907
|
-
}
|
|
4908
|
-
openUrl(url);
|
|
4909
|
-
process.stdout.write(`Complete ${label} sign-in in your browser.\n`);
|
|
4910
|
-
return;
|
|
4911
|
-
}
|
|
4912
|
-
if (platform) {
|
|
4913
|
-
const scopes = credentialScopes ?? parseConnectScopes([], []);
|
|
4914
|
-
const result = await platform.credentials.startOAuthConnection({
|
|
4915
|
-
appId: provider.key,
|
|
4916
|
-
scopes: oauthScopes,
|
|
4917
|
-
permissionMode: "default",
|
|
4918
|
-
projects: scopes.projects,
|
|
4919
|
-
createOrganizationCredential: scopes.createOrganizationCredential,
|
|
4920
|
-
createUserProvidedCredential: scopes.createUserProvidedCredential
|
|
4921
|
-
});
|
|
4922
|
-
if (!result.authorizeUrl) throw new Error("OAuth provider did not return an authorize URL");
|
|
4923
|
-
if (oauthScopes.length > 0) {
|
|
4924
|
-
process.stdout.write("Requested OAuth scopes:\n");
|
|
4925
|
-
for (const scope of oauthScopes) process.stdout.write(` - ${scope}\n`);
|
|
4926
|
-
process.stdout.write("\n");
|
|
4927
|
-
}
|
|
4928
|
-
if (printUrl) {
|
|
4929
|
-
process.stdout.write(`${result.authorizeUrl}\n`);
|
|
4930
|
-
return;
|
|
4931
|
-
}
|
|
4932
|
-
openUrl(result.authorizeUrl);
|
|
4933
|
-
process.stdout.write(`Complete ${label} sign-in in your browser.\n`);
|
|
4934
|
-
return;
|
|
5207
|
+
function resolveConnectAppSlug(slug, apps) {
|
|
5208
|
+
const trimmed = slug.trim();
|
|
5209
|
+
if (!trimmed) throw new Error("App slug is required");
|
|
5210
|
+
try {
|
|
5211
|
+
parseAppSlug(trimmed);
|
|
5212
|
+
} catch {
|
|
5213
|
+
throw new Error(`Invalid app slug: ${slug}`);
|
|
4935
5214
|
}
|
|
4936
|
-
const
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
for (const scope of scopes) process.stdout.write(` - ${scope}\n`);
|
|
4941
|
-
process.stdout.write("\n");
|
|
5215
|
+
const match = apps.find((app) => app.id === trimmed);
|
|
5216
|
+
if (!match) {
|
|
5217
|
+
const available = apps.map((app) => app.id).join(", ") || "(none)";
|
|
5218
|
+
throw new Error(`Unknown app "${trimmed}". Available: ${available}`);
|
|
4942
5219
|
}
|
|
4943
|
-
|
|
4944
|
-
|
|
5220
|
+
return match;
|
|
5221
|
+
}
|
|
5222
|
+
function buildConnectDeeplink(options) {
|
|
5223
|
+
const base = options.webUrl.replace(/\/+$/, "");
|
|
5224
|
+
const params = new URLSearchParams({ connect: options.appSlug });
|
|
5225
|
+
return `${base}/${options.orgSlug}/apps?${params.toString()}`;
|
|
5226
|
+
}
|
|
5227
|
+
async function runConnect(options) {
|
|
5228
|
+
const apps = await options.platform.apps.listCatalog();
|
|
5229
|
+
const app = resolveConnectAppSlug(options.slug, apps);
|
|
5230
|
+
const url = buildConnectDeeplink({
|
|
5231
|
+
webUrl: options.webUrl,
|
|
5232
|
+
orgSlug: options.orgSlug,
|
|
5233
|
+
appSlug: app.id
|
|
5234
|
+
});
|
|
5235
|
+
if (options.printUrl) {
|
|
5236
|
+
process.stdout.write(`${url}\n`);
|
|
4945
5237
|
return;
|
|
4946
5238
|
}
|
|
4947
|
-
openUrl(
|
|
4948
|
-
process.stdout.write(`
|
|
5239
|
+
openUrl(url);
|
|
5240
|
+
process.stdout.write(`Opening ${app.name} connect flow in your browser.\n`);
|
|
4949
5241
|
}
|
|
4950
5242
|
//#endregion
|
|
4951
5243
|
//#region src/commands/connect/index.ts
|
|
4952
|
-
function resolveConnectTargetOptions() {
|
|
4953
|
-
const { local } = getCliTargetOptions();
|
|
4954
|
-
if (local) return { local: true };
|
|
4955
|
-
return { orgScoped: true };
|
|
4956
|
-
}
|
|
4957
|
-
function collectValues$1(value, previous) {
|
|
4958
|
-
return previous.concat([value]);
|
|
4959
|
-
}
|
|
4960
5244
|
function registerConnectCommand(program) {
|
|
4961
|
-
program.command("connect
|
|
4962
|
-
const
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
process.stdout.write("Available providers:\n");
|
|
4969
|
-
for (const entry of providers) process.stdout.write(` ${entry.key}\n`);
|
|
4970
|
-
return;
|
|
4971
|
-
}
|
|
4972
|
-
const match = providers.find((entry) => entry.key === provider);
|
|
4973
|
-
if (!match) {
|
|
4974
|
-
const available = providers.map((entry) => entry.key).join(", ") || "(none)";
|
|
4975
|
-
throw new Error(`Unknown provider "${provider}". Available: ${available}`);
|
|
4976
|
-
}
|
|
4977
|
-
const hasScopeFlags = options.scope.length > 0 || options.projectSlug.length > 0;
|
|
4978
|
-
if (ctx.apiTarget.mode === "local" && hasScopeFlags) throw new Error("--scope and --project-slug are only supported against the platform API (omit --local)");
|
|
4979
|
-
const credentialScopes = ctx.apiTarget.mode === "platform" ? parseConnectScopes(options.scope, options.projectSlug) : void 0;
|
|
4980
|
-
const platform = ctx.apiTarget.mode === "platform" ? createCliPlatformClient(createCliConfig()) : void 0;
|
|
5245
|
+
program.command("connect <slug>").description("Open the web app to connect an integration by catalog slug").option("--print-url", "Print the connect URL and exit without opening the browser").action((slug, options) => runCliCommand("Connect failed", async () => {
|
|
5246
|
+
const config = createCliConfig();
|
|
5247
|
+
await ensureActiveOrganization(config);
|
|
5248
|
+
const organizations = await listOrganizations(config);
|
|
5249
|
+
const activeOrganizationId = config.get("activeOrganizationId");
|
|
5250
|
+
const activeOrg = organizations.find((entry) => entry.organization.id === activeOrganizationId);
|
|
5251
|
+
if (!activeOrg) throw new Error("No active organization. Run `keystroke auth login` or `keystroke config use org`.");
|
|
4981
5252
|
await runConnect({
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
printUrl: options.printUrl
|
|
4987
|
-
oauthScopes: options.oauthScope,
|
|
4988
|
-
credentialScopes
|
|
5253
|
+
platform: createCliPlatformClient(config),
|
|
5254
|
+
webUrl: getWebUrl(config),
|
|
5255
|
+
orgSlug: activeOrg.organization.slug,
|
|
5256
|
+
slug,
|
|
5257
|
+
printUrl: options.printUrl
|
|
4989
5258
|
});
|
|
4990
|
-
}, void 0,
|
|
5259
|
+
}, void 0, { orgScoped: true }));
|
|
4991
5260
|
}
|
|
4992
5261
|
//#endregion
|
|
4993
5262
|
//#region src/commands/credentials/target-options.ts
|
|
@@ -5248,6 +5517,23 @@ async function assertNoSetConflict(client, args) {
|
|
|
5248
5517
|
}));
|
|
5249
5518
|
}
|
|
5250
5519
|
//#endregion
|
|
5520
|
+
//#region src/commands/connect/parse-connect-scopes.ts
|
|
5521
|
+
function parseConnectScopes(scopes, projectSlugs) {
|
|
5522
|
+
const normalized = scopes.length > 0 ? scopes : ["org"];
|
|
5523
|
+
for (const scope of normalized) if (scope !== "org" && scope !== "user" && scope !== "project") throw new Error(`Unknown scope "${scope}". Expected org, user, or project.`);
|
|
5524
|
+
const createOrganizationCredential = normalized.includes("org");
|
|
5525
|
+
const createUserProvidedCredential = normalized.includes("user");
|
|
5526
|
+
const includesProject = normalized.includes("project");
|
|
5527
|
+
const selectedProjects = includesProject ? projectSlugs : [];
|
|
5528
|
+
if (includesProject && selectedProjects.length === 0) throw new Error("--project-slug is required when scope includes project");
|
|
5529
|
+
if (!createOrganizationCredential && !createUserProvidedCredential && selectedProjects.length === 0) throw new Error("At least one scope is required via --scope and/or --project-slug");
|
|
5530
|
+
return {
|
|
5531
|
+
createOrganizationCredential,
|
|
5532
|
+
createUserProvidedCredential,
|
|
5533
|
+
projects: selectedProjects
|
|
5534
|
+
};
|
|
5535
|
+
}
|
|
5536
|
+
//#endregion
|
|
5251
5537
|
//#region src/commands/credentials/parse-set-scopes.ts
|
|
5252
5538
|
function parseCredentialSetScopes(scopes, projectSlugs) {
|
|
5253
5539
|
return parseConnectScopes(scopes, projectSlugs);
|
|
@@ -5476,7 +5762,7 @@ function registerBuildCommand(program) {
|
|
|
5476
5762
|
program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
5477
5763
|
try {
|
|
5478
5764
|
const root = resolveProjectRoot(options.dir);
|
|
5479
|
-
const { buildApp } = await import("./dist-
|
|
5765
|
+
const { buildApp } = await import("./dist-D0bvBuXk.mjs");
|
|
5480
5766
|
await buildApp({ root });
|
|
5481
5767
|
process.stdout.write(`Built ${root}\n`);
|
|
5482
5768
|
} catch (error) {
|
|
@@ -5633,7 +5919,7 @@ async function sleep(ms) {
|
|
|
5633
5919
|
}
|
|
5634
5920
|
async function buildDeployArchive(client, root, projectId, filter) {
|
|
5635
5921
|
if (filter?.length) {
|
|
5636
|
-
const { buildFilteredApp } = await import("./dist-
|
|
5922
|
+
const { buildFilteredApp } = await import("./dist-D0bvBuXk.mjs");
|
|
5637
5923
|
const filtered = await buildFilteredApp({
|
|
5638
5924
|
root,
|
|
5639
5925
|
filter,
|
|
@@ -5655,7 +5941,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
|
|
|
5655
5941
|
sourceFiles: filtered.sourceFiles
|
|
5656
5942
|
};
|
|
5657
5943
|
}
|
|
5658
|
-
const { buildApp } = await import("./dist-
|
|
5944
|
+
const { buildApp } = await import("./dist-D0bvBuXk.mjs");
|
|
5659
5945
|
const { sourceFiles } = await buildApp({
|
|
5660
5946
|
root,
|
|
5661
5947
|
collectSources: true,
|
|
@@ -5768,7 +6054,7 @@ function runtimeChildEnv(parentEnv, overrides) {
|
|
|
5768
6054
|
//#region src/project/bootstrap-run.ts
|
|
5769
6055
|
/** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
|
|
5770
6056
|
async function resolveBootstrapRun(options) {
|
|
5771
|
-
const { resolveRuntimeBuildArtifact } = await import("./dist-
|
|
6057
|
+
const { resolveRuntimeBuildArtifact } = await import("./dist-D0bvBuXk.mjs");
|
|
5772
6058
|
const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
|
|
5773
6059
|
const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
|
|
5774
6060
|
const args = [`--import=${loader}`];
|
|
@@ -5919,7 +6205,7 @@ async function runDev(options) {
|
|
|
5919
6205
|
process.on("SIGINT", shutdown);
|
|
5920
6206
|
process.on("SIGTERM", shutdown);
|
|
5921
6207
|
try {
|
|
5922
|
-
const { watchApp } = await import("./dist-
|
|
6208
|
+
const { watchApp } = await import("./dist-D0bvBuXk.mjs");
|
|
5923
6209
|
await watchApp({
|
|
5924
6210
|
root,
|
|
5925
6211
|
clean: false,
|
|
@@ -6745,7 +7031,7 @@ async function runStart(options) {
|
|
|
6745
7031
|
const apiPort = Number(new URL(serverUrl).port || 80);
|
|
6746
7032
|
const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
|
|
6747
7033
|
ensureNativeDeps(runtimeNodeModules);
|
|
6748
|
-
const { buildApp } = await import("./dist-
|
|
7034
|
+
const { buildApp } = await import("./dist-D0bvBuXk.mjs");
|
|
6749
7035
|
await buildApp({
|
|
6750
7036
|
root,
|
|
6751
7037
|
clean: false
|
|
@@ -7201,19 +7487,6 @@ function registerSkillsCommand(program) {
|
|
|
7201
7487
|
});
|
|
7202
7488
|
}
|
|
7203
7489
|
//#endregion
|
|
7204
|
-
//#region src/project/resolve-keystroke-config-root.ts
|
|
7205
|
-
const KEYSTROKE_CONFIG = "keystroke.config.ts";
|
|
7206
|
-
/** Walk up from `fromDir` and return the directory containing `keystroke.config.ts`, if any. */
|
|
7207
|
-
function resolveKeystrokeConfigRoot(fromDir = process.cwd()) {
|
|
7208
|
-
let dir = resolve(fromDir);
|
|
7209
|
-
while (dir !== dirname(dir)) {
|
|
7210
|
-
if (existsSync(join(dir, KEYSTROKE_CONFIG))) return dir;
|
|
7211
|
-
dir = dirname(dir);
|
|
7212
|
-
}
|
|
7213
|
-
if (existsSync(join(dir, KEYSTROKE_CONFIG))) return dir;
|
|
7214
|
-
return null;
|
|
7215
|
-
}
|
|
7216
|
-
//#endregion
|
|
7217
7490
|
//#region src/skills/sync-skills.ts
|
|
7218
7491
|
function commandPath(command) {
|
|
7219
7492
|
const names = [];
|
|
@@ -7281,7 +7554,7 @@ function createProgram() {
|
|
|
7281
7554
|
return program;
|
|
7282
7555
|
}
|
|
7283
7556
|
async function runCli(argv) {
|
|
7284
|
-
const { maybeAutoUpdate } = await import("./maybe-auto-update-
|
|
7557
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-C5I7EUot.mjs");
|
|
7285
7558
|
await maybeAutoUpdate(argv);
|
|
7286
7559
|
createProgram().parse(argv);
|
|
7287
7560
|
}
|