@keystrokehq/cli 0.1.148 → 0.1.150
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-CSUmvad5.mjs +3 -0
- package/dist/{dist-GDLyM5sd.mjs → dist-CYcxzKHH.mjs} +1 -1
- package/dist/{dist-BjwZD7UZ.mjs → dist-CtEL33PB.mjs} +96 -20
- package/dist/dist-CtEL33PB.mjs.map +1 -0
- package/dist/{dist-xLTJXuWY.mjs → dist-DG8fjuMY.mjs} +5 -3
- package/dist/dist-DG8fjuMY.mjs.map +1 -0
- package/dist/index.mjs +9 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{program-DU1iPR-p.mjs → program-Bv7Wv_O4.mjs} +137 -49
- package/dist/program-Bv7Wv_O4.mjs.map +1 -0
- package/dist/skills-bundle/_AGENTS.mcp.md +2 -2
- package/dist/skills-bundle/_AGENTS.md +7 -3
- package/package.json +3 -3
- package/dist/dist-BjwZD7UZ.mjs.map +0 -1
- package/dist/dist-CgDJj_3M.mjs +0 -3
- package/dist/dist-xLTJXuWY.mjs.map +0 -1
- package/dist/program-DU1iPR-p.mjs.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { A as resolvePlatformUrlForWebUrl, C as createCliConfig, D as getWebUrl, E as getPlatformUrl, M as ExpectedCliError, N as isExpectedCliError, O as DEFAULT_PLATFORM_URL, S as resolveCliRoot, T as getCredentialStorage, _ as isLocalSdkSpec, a as formatReleaseAgeBlockMessage, b as shouldUpdateCliVersion, c as detectManagerFromLockfile, d as installDependencies$1, f as installPlaygroundDependencies, g as ensureSdkCurrent, i as readPnpmMinimumReleaseAgeMinutes, j as parseCredentialStorage, l as buildPlaygroundWorkspace, m as resolvePackageManager, n as ensureMinimumReleaseAgeExclude, o as isReleaseAgeBlock, p as resolveGithubPackagesToken, r as computeReleaseAgeRetryAfter, s as detectCliInstall, t as runPackageManagerUpdate, u as detectPackageManager$2, v as fetchLatestCliRelease, w as getCliConfigDir, x as readCliVersion, y as resolveCliDistTag } from "./run-package-manager-update-C4uA6xWB.mjs";
|
|
3
3
|
import { $ as DownloadActiveProjectArtifactResponseSchema, $i as CreateCreditsCheckoutRequestSchema, $n as SkillSummaryDetailResponseSchema, $r as WorkflowSummaryDetailResponseSchema, $t as OpenApiDiscoverResponseSchema, A as CreateApiKeyResponseSchema, Ai as CredentialConsumerListQuerySchema, An as ProjectGitStatusResponseSchema, Ar as UpdateOrganizationRequestSchema, At as ListApiKeysResponseSchema, B as CreateProjectArtifactRequestSchema, Bi as CLIENT_CHANNEL_HEADER, Bn as PublicFormSubmitResponseSchema, Br as UserPreferencesPatchSchema, Bt as ListOrganizationMembersPageResponseSchema, C as CompleteManagedDeployArtifactResponseSchema, Ci as resolveDocsMcpUrl, Cn as PresignProjectSourceRequestSchema, Cr as TriggerRunListResponseSchema, Ct as HistoryRunListResponseSchema, D as ConnectManagedServiceCredentialRequestSchema, Di as CredentialAssignmentListQuerySchema, Dr as UpdateManagedServiceCredentialRequestSchema, Dt as InviteProjectMembersResponseSchema, E as ConnectAuthorizeUrlResponseSchema, Ei as AssignCredentialBodySchema, En as PresignUserAvatarResponseSchema, Er as UpdateCredentialRequestSchema, Et as InviteProjectMembersRequestSchema, F as CreateCustomAppResponseSchema, Fn as ProjectSlugAvailabilityResponseSchema, Fr as UploadProjectSourceManifestRequestSchema, Ft as ListDraftFilesResponseSchema, G as CreateSlackAppResponseSchema, Gi as BillingActivityResponseSchema, Gn as QueuedAgentPromptResponseSchema, Gr as WorkflowFormResponseSchema, Gt as ListProjectMetricsResponseSchema, H as CreateProjectRequestSchema, Hi as PresignChatAttachmentResponseSchema, Hn as PublishManagedDeployCandidateResponseSchema, Hr as WorkflowCanvasCredentialBindingsSchema, Ht as ListProjectDeploymentsResponseSchema, I as CreateDraftCommitRequestSchema, In as PromptInputSchema, Ir as UploadProjectSourceResponseSchema, It as ListManagedServiceCredentialsResponseSchema, J as CredentialInstanceListResponseSchema, Ji as BillingSummaryResponseSchema, Jn as RenewManagedDeployUploadRequestSchema, Jr as WorkflowRunHooksResponseSchema, Jt as MANAGED_DEPLOY_REQUEST_TIMEOUT_MS, K as CreateSlackChannelBodySchema, Ki as BillingInvoiceUrlResponseSchema, Kn as QueuedRunResponseSchema, Kr as WorkflowFormUpsertBodySchema, Kt as ListProjectsResponseSchema, L as CreateDraftDiffCommitRequestSchema, Ln as PromptResponseSchema, Lr as UpsertGatewayAttachmentBodySchema, Lt as ListMcpAppToolsResponseSchema, M as CreateCredentialsRequestSchema, Mi as ExecuteKeystrokeToolRequestSchema, Mn as ProjectReachabilityResponseSchema, Mr as UpdateProjectMemberResponseSchema, Mt as ListChannelPlatformsResponseSchema, N as CreateCredentialsResponseSchema, Nn as ProjectResponseSchema, Nr as UpdateProjectRequestSchema, Nt as ListCredentialsPageQuerySchema, O as ConnectProvidersResponseSchema, Oi as CredentialAssignmentListResponseSchema, On as ProjectGitRemoteRequestSchema, Or as UpdateOrganizationMemberRequestSchema, Ot as ListAgentMemoryFilesResponseSchema, P as CreateCustomAppRequestSchema, Pn as ProjectSettingsResponseSchema, Pr as UpdateProjectSettingsRequestSchema, Pt as ListCredentialsPageResponseSchema, Q as DeclineOrganizationInvitationResponseSchema, Qi as CreateBillingPortalRequestSchema, Qr as WorkflowRunResponseSchema, Qt as McpDiscoverResponseSchema, R as CreateOrganizationRequestSchema, Rn as PublicFormMetadataSchema, Rr as UserAvatarPatchSchema, Rt as ListOrganizationInvitationsResponseSchema, S as CompleteManagedDeployArtifactRequestSchema, Si as resolveConnectAppSlug, Sn as PresignOrgLogoResponseSchema, Sr as TriggerRunDetailResponseSchema, St as HistoryRunListQuerySchema, T as CompleteProjectArtifactResponseSchema, Tn as PresignUserAvatarRequestSchema, Tr as UpdateCredentialInstanceBodySchema, Tt as InviteOrganizationMembersResponseSchema, U as CreateProjectResponseSchema, Un as PublishedFormListResponseSchema, Ur as WorkflowCanvasRunSchema, Ut as ListProjectFilesResponseSchema, V as CreateProjectArtifactResponseSchema, Vi as PresignChatAttachmentRequestSchema, Vn as PublishManagedDeployCandidateRequestSchema, Vr as UserPreferencesSchema, Vt as ListOrganizationsResponseSchema, W as CreateSlackAppRequestSchema, Wi as AutoTopupSummarySchema, Wn as PublishedFormSchema, Wr as WorkflowCanvasSchema, Wt as ListProjectMembersResponseSchema, X as DOCS_QUERY_TOOL, Xi as ConfirmCheckoutRequestSchema, Xr as WorkflowRunInputsSchema, Xt as ManagedServiceCredentialSchema, Y as CredentialInstanceRecordSchema, Yi as BillingUsageResponseSchema, Yn as RenewManagedDeployUploadResponseSchema, Yr as WorkflowRunInputsPutBodySchema, Yt as ManagedDeployResourceKeySchema, Z as DOCS_SEARCH_TOOL, Zi as ConfirmCheckoutResponseSchema, Zn as SLACK_PERSONAL_APP_SLUG, Zr as WorkflowRunListResponseSchema, Zt as ManagedServiceKindSchema, _ as CatalogAppsPageResponseSchema, _i as parseAppSlug, _n as PrepareManagedDeployRequestSchema, _r as TemplateFilesResponseSchema, _t as HealthResponseSchema, a as AgentSessionListResponseSchema, ai as WorkspaceTriggerRunListResponseSchema, ar as SlackAppManifestResponseSchema, at as DraftUpdateEventSchema, b as ChannelConnectionSchema, bi as parseSlackConnectFlow, bn as PresignCustomAppLogoResponseSchema, br as TriggerInvokeResponseSchema, bt as HistoryRunCancelResponseSchema, c as AgentTriggerSummaryListResponseSchema, ci as buildConnectDeeplink, cr as StartKeystrokeConnectionInputSchema, ct as FinalizeCustomAppLogoRequestSchema, d as BindChannelBodySchema, di as isAcceptableInstallExit, dr as StartMcpOAuthConnectionResultSchema, dt as GatewayAttachmentRecordSchema, ea as CreateSubscriptionCheckoutRequestSchema, ei as WorkflowSummaryListResponseSchema, en as OrganizationSidebarBrandingPatchSchema, er as SkillSummaryListResponseSchema, et as DownloadActiveProjectSourceResponseSchema, f as CancelManagedDeployRequestSchema, fn as PlatformAgentCancelResponseSchema, fr as StartOAuthConnectionInputSchema, ft as GetAppCatalogEntryResponseSchema, g as CatalogAppDetailResponseSchema, gn as PlatformAgentSessionListResponseSchema, gr as SubmitTeamRequestRequestSchema, gt as GraphqlDiscoverResponseSchema, h as CatalogActionsPageResponseSchema, hi as normalizeDocsSearchPaths, hn as PlatformAgentSessionDetailResponseSchema, hr as SubmitMarketingContactRequestSchema, ht as GetTemplateResponseSchema, i as AgentSessionDetailResponseSchema, ii as WorkspaceTriggerOverviewSchema, in as PROJECT_DRAFT_DIFF_MAX_BYTES, ir as SlackAppManifestRequestSchema, it as DraftRevisionResponseSchema, j as CreateCredentialInstanceBodySchema, ji as CredentialConsumerListResponseSchema, jn as ProjectPullStateSchema, jr as UpdateProjectMemberRequestSchema, jt as ListAppsResponseSchema, k as CreateApiKeyRequestSchema, ki as CredentialAssignmentRecordSchema, kn as ProjectGitRemoteResponseSchema, kr as UpdateOrganizationMemberResponseSchema, kt as ListAgentWorkspaceFilesResponseSchema, l as AppSlugAvailabilityResponseSchema, li as deriveCustomAppDisplay, lr as StartKeystrokeConnectionResultSchema, lt as FinalizeCustomAppLogoResponseSchema, m as CatalogActionDetailResponseSchema, mn as PlatformAgentPromptResponseSchema, mr as SubmitAgentFeedbackRequestSchema, mt as GetCustomAppResponseSchema, n as ActiveOrganizationResponseSchema, ni as WorkspaceTriggerFileSchema, nn as PNPM_FROZEN_INSTALL_ARGS, nr as SlackAppInstallStartResponseSchema, nt as DraftConflictResponseSchema, o as AgentSummaryDetailResponseSchema, oi as WorkspaceWorkflowOverviewSchema, on as PROJECT_PULL_STATE_RELATIVE_PATH, or as SlackMembershipChannelBodySchema, ot as DuplicateCredentialRequestSchema, p as CancelManagedDeployResponseSchema, pi as isIgnoredProjectSourcePath, pn as PlatformAgentPromptInputSchema, pr as StartOAuthConnectionResultSchema, pt as GetCredentialResponseSchema, q as CreateSlackChannelResponseSchema, qi as BillingRedirectResponseSchema, qn as RecentResourceListResponseSchema, qr as WorkflowRunDetailResponseSchema, qt as ListTemplatesResponseSchema, r as ActiveProjectSourceRevisionSchema, ri as WorkspaceTriggerListResponseSchema, rn as PROJECT_DRAFT_COMMIT_REQUEST_TIMEOUT_MS, rr as SlackAppListResponseSchema, rt as DraftFileContentResponseSchema, s as AgentSummaryListResponseSchema, si as buildAgentSlackDeeplink, sn as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, sr as SlugAvailabilityResponseSchema, st as DuplicateCredentialsResponseSchema, t as AcceptOrganizationInvitationResponseSchema, ta as UpdateAutoTopupRequestSchema, ti as WorkspaceTriggerDetailSchema, tn as OrganizationSidebarBrandingSchema, tr as SlackAgentMembershipsResponseSchema, tt as DraftCommitResponseSchema, u as BindAgentSlackAppBodySchema, ui as detectProjectPackageManagerFromSnapshot, ur as StartMcpOAuthConnectionInputSchema, ut as FormFieldConfigSchema, v as ChannelAccountListResponseSchema, vi as parseErrorResponse, vn as PrepareManagedDeployResponseSchema, vr as TriggerDetailResponseSchema, vt as HeartbeatManagedDeployRequestSchema, w as CompleteProjectArtifactRequestSchema, wi as slugifyAppName, wn as PresignProjectSourceResponseSchema, wr as UpdateChannelBindingBodySchema, wt as InviteOrganizationMembersRequestSchema, x as ChannelDirectoryListResponseSchema, xn as PresignOrgLogoRequestSchema, xr as TriggerListResponseSchema, xt as HistoryRunDetailResponseSchema, y as ChannelConnectionListResponseSchema, yn as PresignCustomAppLogoRequestSchema, yr as TriggerInvokeInputsSchema, yt as HeartbeatManagedDeployResponseSchema, z as CreateOrganizationResponseSchema, zi as ACTIVE_ORG_HEADER, zn as PublicFormSubmitBodySchema, zr as UserAvatarSchema, zt as ListOrganizationMembersPageQuerySchema } from "./dist-C6adeAws.mjs";
|
|
4
|
-
import { $ as
|
|
5
|
-
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-
|
|
4
|
+
import { $ as withMcpReadClient, Q as assertPublicHttpUrl, Z as PublicHttpUrlError, _t as captureException, bt as flushTelemetry, et as artifactIndexFromModules, gt as alias, nt as mapInParallelBatches, rt as moduleBlobRefsFromModules, tt as collectArtifactModules, vt as configureTelemetry, xt as shutdownTelemetry, yt as event } from "./dist-CtEL33PB.mjs";
|
|
5
|
+
import { a as buildApp, c as computeSafeFilteredDeploy, r as analyzeDeployableClosures, t as ANALYZER_CONTRACT_VERSION } from "./dist-DG8fjuMY.mjs";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
import { homedir, platform, release, tmpdir } from "node:os";
|
|
@@ -7739,7 +7739,16 @@ function listActionsHint(app) {
|
|
|
7739
7739
|
/** Hint when listing actions for a custom org app (no toolkit tools). */
|
|
7740
7740
|
function listCustomAppActionsHint(app) {
|
|
7741
7741
|
const bin = cliBinaryName();
|
|
7742
|
-
return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n`;
|
|
7742
|
+
return `\nCustom org apps have no catalog action list.\n Inspect app: ${bin} apps get ${app}\n Scaffold code: ${bin} apps sync ${app}\n Connect secret: ${bin} connect ${app}\n Author actions: defineApp({ slug: "${app}", ... }).action(...)\n Smoke-test: deploy a thin workflow that calls the action, then\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n (${bin} apps execute is catalog-only — not for custom app actions.)\n`;
|
|
7743
|
+
}
|
|
7744
|
+
/**
|
|
7745
|
+
* Error when `apps execute` is pointed at a custom org app (`{org}/{name}`).
|
|
7746
|
+
* Catalog toolkit execute cannot reach defineApp(...).action(...) project code.
|
|
7747
|
+
*/
|
|
7748
|
+
function customAppExecuteError(app, options) {
|
|
7749
|
+
const bin = cliBinaryName();
|
|
7750
|
+
const mcpLine = options?.source === "mcp" ? ` Live MCP tools: ${bin} apps actions list ${app} (after connect)\n` : "";
|
|
7751
|
+
return `${bin} apps execute only runs built-in catalog toolkit actions.\n"${app}" is a custom org app — its actions live in project code as defineApp(...).action(...), not in the catalog.\n\nSmoke-test a custom app action by deploying a thin workflow that calls it, then:\n ${bin} workflows run <workflow-slug> --input '{...}' --wait\n\n Inspect app: ${bin} apps get ${app}\n Scaffold/author: ${bin} apps sync ${app}\n` + mcpLine;
|
|
7743
7752
|
}
|
|
7744
7753
|
/** Hint after listing live tools on a connected custom MCP app. */
|
|
7745
7754
|
function listMcpAppActionsHint(app) {
|
|
@@ -7760,7 +7769,7 @@ function showActionHint(app, tool, inputParameters) {
|
|
|
7760
7769
|
//#region src/commands/apps/run-app-catalog.ts
|
|
7761
7770
|
const CUSTOM_APP_ACTIONS_MESSAGE = "Custom org apps do not expose catalog actions. Actions live in your project as defineApp(...).action(...). Use `keystroke apps get <slug>` for the credential template, or `keystroke apps sync <slug>` to scaffold the app module.";
|
|
7762
7771
|
const MCP_CONNECT_HINT = "Connect this MCP app first (`keystroke connect <slug> --print-url`), then re-run `keystroke apps actions list <slug>`. Prefer `keystroke docs search` for Keystroke docs before inventing integration code.";
|
|
7763
|
-
function isNotFoundError(error) {
|
|
7772
|
+
function isNotFoundError$1(error) {
|
|
7764
7773
|
if (!(error instanceof PlatformError)) return false;
|
|
7765
7774
|
if (error.status === 404) return true;
|
|
7766
7775
|
return /not found/i.test(error.message);
|
|
@@ -7789,14 +7798,14 @@ async function runAppShow(client, slug) {
|
|
|
7789
7798
|
app: await client.apps.getCatalogApp(trimmed)
|
|
7790
7799
|
};
|
|
7791
7800
|
} catch (error) {
|
|
7792
|
-
if (!isNotFoundError(error)) throw error;
|
|
7801
|
+
if (!isNotFoundError$1(error)) throw error;
|
|
7793
7802
|
try {
|
|
7794
7803
|
return {
|
|
7795
7804
|
kind: "custom",
|
|
7796
7805
|
app: await client.apps.get(trimmed)
|
|
7797
7806
|
};
|
|
7798
7807
|
} catch (fallbackError) {
|
|
7799
|
-
if (isNotFoundError(fallbackError)) throw error;
|
|
7808
|
+
if (isNotFoundError$1(fallbackError)) throw error;
|
|
7800
7809
|
throw fallbackError;
|
|
7801
7810
|
}
|
|
7802
7811
|
}
|
|
@@ -8087,13 +8096,36 @@ function isNotConnectedError(error) {
|
|
|
8087
8096
|
if (typeof body !== "object" || body === null || !("error" in body)) return false;
|
|
8088
8097
|
return body.error === "not_found";
|
|
8089
8098
|
}
|
|
8099
|
+
function isNotFoundError(error) {
|
|
8100
|
+
if (!(error instanceof PlatformError)) return false;
|
|
8101
|
+
if (error.status === 404) return true;
|
|
8102
|
+
return /not found/i.test(error.message);
|
|
8103
|
+
}
|
|
8090
8104
|
async function runAppExecute(client, appSlug, toolSlug, options) {
|
|
8091
8105
|
const app = appSlug.trim().toLowerCase();
|
|
8092
8106
|
const tool = toolSlug.trim().toUpperCase();
|
|
8093
8107
|
if (!app || !tool) throw new Error("App and tool slugs are required (e.g. github github_get_the_authenticated_user)");
|
|
8108
|
+
const parsed = parseAppSlug(app);
|
|
8109
|
+
if (parsed.kind === "org") {
|
|
8110
|
+
let source;
|
|
8111
|
+
try {
|
|
8112
|
+
const shown = await runAppShow(client, parsed.slug);
|
|
8113
|
+
if (shown.kind === "custom") source = shown.app.source;
|
|
8114
|
+
} catch {}
|
|
8115
|
+
throw new Error(customAppExecuteError(parsed.slug, { source }));
|
|
8116
|
+
}
|
|
8094
8117
|
const credentialSlug = options.credentialSlug?.trim() || void 0;
|
|
8095
8118
|
const projectSlug = options.projectSlug?.trim() || void 0;
|
|
8096
|
-
|
|
8119
|
+
let version = options.version?.trim() || void 0;
|
|
8120
|
+
if (!version) try {
|
|
8121
|
+
version = (await client.apps.getCatalogAction(tool)).version?.trim() || void 0;
|
|
8122
|
+
} catch (error) {
|
|
8123
|
+
if (isNotFoundError(error)) {
|
|
8124
|
+
const shown = await runAppShow(client, app).catch(() => null);
|
|
8125
|
+
if (shown?.kind === "custom") throw new Error(customAppExecuteError(shown.app.slug, { source: shown.app.source }));
|
|
8126
|
+
}
|
|
8127
|
+
throw error;
|
|
8128
|
+
}
|
|
8097
8129
|
if (!version) throw new Error(`Catalog action "${tool}" has no pinned version. Pass --version explicitly.`);
|
|
8098
8130
|
try {
|
|
8099
8131
|
const { result } = await client.apps.executeTool({
|
|
@@ -8113,7 +8145,7 @@ async function runAppExecute(client, appSlug, toolSlug, options) {
|
|
|
8113
8145
|
//#endregion
|
|
8114
8146
|
//#region src/commands/apps/execute.ts
|
|
8115
8147
|
function registerAppExecuteCommand(app) {
|
|
8116
|
-
app.command("execute").description("Run a connected catalog action against the cloud (no local server)").argument("<app>", "
|
|
8148
|
+
app.command("execute").description("Run a connected catalog toolkit action against the cloud (no local server). Custom org apps ({org}/{name}) are not supported — smoke-test those via workflows run.").argument("<app>", "Catalog app slug (e.g. github); not a custom {org}/{name} app").argument("<tool>", "Catalog tool slug (e.g. github_get_the_authenticated_user)").option("--input <json>", "JSON arguments (defaults to {})", "{}").option("--version <version>", "Pinned toolkit version (defaults to the catalog value)").option("--credential <slug>", `Pin a specific credential by slug (see '${cliBinaryName()} credentials list'); overrides the default and is the only way to use a user credential`).addHelpText("after", `
|
|
8117
8149
|
Credential resolution matches the runtime: project default → org default. User credentials are
|
|
8118
8150
|
never a default — reach one with --credential <slug>. Target a project with the global
|
|
8119
8151
|
--project <slug> flag; without it, only org credentials resolve.
|
|
@@ -8934,7 +8966,7 @@ function registerBuildCommand(program) {
|
|
|
8934
8966
|
try {
|
|
8935
8967
|
const root = resolveProjectRoot(options.dir);
|
|
8936
8968
|
await ensureSdkCurrent(root);
|
|
8937
|
-
const { buildApp } = await import("./dist-
|
|
8969
|
+
const { buildApp } = await import("./dist-CSUmvad5.mjs");
|
|
8938
8970
|
await buildApp({ root });
|
|
8939
8971
|
process.stdout.write(`Built ${root}\n`);
|
|
8940
8972
|
} catch (error) {
|
|
@@ -11094,6 +11126,64 @@ function assertCheckoutMatchesDraft(inspection, expectedDraftSha) {
|
|
|
11094
11126
|
if (head !== expected) throw new ExpectedCliError(`Hosted checkout HEAD (${head || "unknown"}) does not match draft tip ${expected}. Sync the session workspace to ks/draft and retry.`);
|
|
11095
11127
|
}
|
|
11096
11128
|
//#endregion
|
|
11129
|
+
//#region src/commands/deploy-output.ts
|
|
11130
|
+
/** Format elapsed deploy wall time for the success line. */
|
|
11131
|
+
function formatDeployDuration(ms) {
|
|
11132
|
+
return `${(Math.max(0, ms) / 1e3).toFixed(1)}s`;
|
|
11133
|
+
}
|
|
11134
|
+
/**
|
|
11135
|
+
* True for hosts that are not useful on CLI stdout (private / loopback / link-local).
|
|
11136
|
+
* Reuses the MCP SSRF host classifier so deploy URL filtering stays in sync.
|
|
11137
|
+
*/
|
|
11138
|
+
function isPrivateDeployBaseUrl(baseUrl) {
|
|
11139
|
+
try {
|
|
11140
|
+
assertPublicHttpUrl(baseUrl);
|
|
11141
|
+
return false;
|
|
11142
|
+
} catch (error) {
|
|
11143
|
+
if (error instanceof PublicHttpUrlError) return true;
|
|
11144
|
+
throw error;
|
|
11145
|
+
}
|
|
11146
|
+
}
|
|
11147
|
+
/** Short default progress line after local preflight. */
|
|
11148
|
+
function formatPlanProgress(plan) {
|
|
11149
|
+
const fileCount = plan.changedPaths.length;
|
|
11150
|
+
const files = fileCount === 1 ? "1 file changed" : `${fileCount} files changed`;
|
|
11151
|
+
const lines = [`Deploying (${plan.mode}) — ${files}`];
|
|
11152
|
+
if (plan.mode === "filtered") {
|
|
11153
|
+
if (plan.requestedResourceKeys.length > 0) lines.push(` Requested: ${plan.requestedResourceKeys.join(", ")}`);
|
|
11154
|
+
if (plan.impactedResourceKeys.length > 0) lines.push(` Also rebuilding from main: ${plan.impactedResourceKeys.sort().join(", ")}`);
|
|
11155
|
+
if (plan.impactCompleteness === "unknown") lines.push(" Impact completeness: unknown (additional resources may be affected)");
|
|
11156
|
+
for (const warning of plan.warnings) lines.push(` Warning: ${warning}`);
|
|
11157
|
+
}
|
|
11158
|
+
return `${lines.join("\n")}\n`;
|
|
11159
|
+
}
|
|
11160
|
+
/** Full plan dump for `--verbose` (pins, paths, expansions). */
|
|
11161
|
+
function formatPlanSummary(plan) {
|
|
11162
|
+
const lines = [
|
|
11163
|
+
`Pinned main (M0): ${plan.mainSha}`,
|
|
11164
|
+
`Pinned draft (D0): ${plan.draftSha}`,
|
|
11165
|
+
`Mode: ${plan.mode}`
|
|
11166
|
+
];
|
|
11167
|
+
if ("requestedResourceKeys" in plan && plan.requestedResourceKeys.length > 0) lines.push(`Requested: ${plan.requestedResourceKeys.join(", ")}`);
|
|
11168
|
+
if ("impactedResourceKeys" in plan && plan.impactedResourceKeys.length > 0) lines.push(`Impacted (rebuild from main): ${plan.impactedResourceKeys.join(", ")}`);
|
|
11169
|
+
if ("resourceKeys" in plan && plan.resourceKeys.length > 0) lines.push(`Rebuild set: ${plan.resourceKeys.join(", ")}`);
|
|
11170
|
+
if ("impactCompleteness" in plan && plan.impactCompleteness === "unknown") lines.push("Impact completeness: unknown (additional resources may be affected)");
|
|
11171
|
+
if ("warnings" in plan && plan.warnings.length > 0) {
|
|
11172
|
+
lines.push("Warnings:");
|
|
11173
|
+
for (const warning of plan.warnings) lines.push(` - ${warning}`);
|
|
11174
|
+
}
|
|
11175
|
+
if ("expansions" in plan && plan.expansions.length > 0) {
|
|
11176
|
+
lines.push("Impacts:");
|
|
11177
|
+
for (const expansion of plan.expansions) lines.push(` - ${expansion.resourceKey}: ${expansion.reason}` + (expansion.sharedInputs.length ? ` (${expansion.sharedInputs.slice(0, 3).join(", ")}${expansion.sharedInputs.length > 3 ? ", …" : ""})` : ""));
|
|
11178
|
+
}
|
|
11179
|
+
if (plan.mode === "blocked") lines.push(`Blocked (${plan.requireFull?.code ?? "unknown"}): ${plan.requireFull?.reason ?? "filtered deploy not safe"}`);
|
|
11180
|
+
if (plan.changedPaths.length > 0) {
|
|
11181
|
+
const preview = plan.changedPaths.slice(0, 8).join(", ");
|
|
11182
|
+
lines.push(`Changed paths (${plan.changedPaths.length}): ${preview}${plan.changedPaths.length > 8 ? ", …" : ""}`);
|
|
11183
|
+
}
|
|
11184
|
+
return `${lines.join("\n")}\n`;
|
|
11185
|
+
}
|
|
11186
|
+
//#endregion
|
|
11097
11187
|
//#region src/commands/deploy.ts
|
|
11098
11188
|
/**
|
|
11099
11189
|
* Poll aggressively at first — sticky loads often finish in well under 2s.
|
|
@@ -11149,31 +11239,6 @@ function parseManagedFilter(filter) {
|
|
|
11149
11239
|
}
|
|
11150
11240
|
return keys;
|
|
11151
11241
|
}
|
|
11152
|
-
function formatPlanSummary(plan) {
|
|
11153
|
-
const lines = [
|
|
11154
|
-
`Pinned main (M0): ${plan.mainSha}`,
|
|
11155
|
-
`Pinned draft (D0): ${plan.draftSha}`,
|
|
11156
|
-
`Mode: ${plan.mode}`
|
|
11157
|
-
];
|
|
11158
|
-
if ("requestedResourceKeys" in plan && plan.requestedResourceKeys.length > 0) lines.push(`Requested: ${plan.requestedResourceKeys.join(", ")}`);
|
|
11159
|
-
if ("impactedResourceKeys" in plan && plan.impactedResourceKeys.length > 0) lines.push(`Impacted (rebuild from main): ${plan.impactedResourceKeys.join(", ")}`);
|
|
11160
|
-
if ("resourceKeys" in plan && plan.resourceKeys.length > 0) lines.push(`Rebuild set: ${plan.resourceKeys.join(", ")}`);
|
|
11161
|
-
if ("impactCompleteness" in plan && plan.impactCompleteness === "unknown") lines.push("Impact completeness: unknown (additional resources may be affected)");
|
|
11162
|
-
if ("warnings" in plan && plan.warnings.length > 0) {
|
|
11163
|
-
lines.push("Warnings:");
|
|
11164
|
-
for (const warning of plan.warnings) lines.push(` - ${warning}`);
|
|
11165
|
-
}
|
|
11166
|
-
if ("expansions" in plan && plan.expansions.length > 0) {
|
|
11167
|
-
lines.push("Impacts:");
|
|
11168
|
-
for (const expansion of plan.expansions) lines.push(` - ${expansion.resourceKey}: ${expansion.reason}` + (expansion.sharedInputs.length ? ` (${expansion.sharedInputs.slice(0, 3).join(", ")}${expansion.sharedInputs.length > 3 ? ", …" : ""})` : ""));
|
|
11169
|
-
}
|
|
11170
|
-
if (plan.mode === "blocked") lines.push(`Blocked (${plan.requireFull?.code ?? "unknown"}): ${plan.requireFull?.reason ?? "filtered deploy not safe"}`);
|
|
11171
|
-
if (plan.changedPaths.length > 0) {
|
|
11172
|
-
const preview = plan.changedPaths.slice(0, 8).join(", ");
|
|
11173
|
-
lines.push(`Changed paths (${plan.changedPaths.length}): ${preview}${plan.changedPaths.length > 8 ? ", …" : ""}`);
|
|
11174
|
-
}
|
|
11175
|
-
return `${lines.join("\n")}\n`;
|
|
11176
|
-
}
|
|
11177
11242
|
function confirmationMessage(plan) {
|
|
11178
11243
|
if (plan.impactCompleteness === "unknown") return "Deploy impact may be incomplete — additional resources could be affected.\nProceed with this managed deploy?";
|
|
11179
11244
|
if (plan.impactedResourceKeys.length > 0 || plan.expansions.length > 0) {
|
|
@@ -11211,8 +11276,8 @@ async function pollProjectActive(client, projectId, options = {}) {
|
|
|
11211
11276
|
throw new Error(`${lastError}${unpackHint}`);
|
|
11212
11277
|
}
|
|
11213
11278
|
if (current.status === "active" && (!requestedArtifactId || current.activeArtifactId === requestedArtifactId)) {
|
|
11214
|
-
process.stdout.write(`Project active${current.baseUrl ? `: ${current.baseUrl}` : ""}\n`);
|
|
11215
|
-
return;
|
|
11279
|
+
if (options.verbose) process.stdout.write(`Project active${current.baseUrl ? `: ${current.baseUrl}` : ""}\n`);
|
|
11280
|
+
return { baseUrl: current.baseUrl };
|
|
11216
11281
|
}
|
|
11217
11282
|
await sleep(POLL_INTERVAL_MS);
|
|
11218
11283
|
}
|
|
@@ -11223,9 +11288,18 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11223
11288
|
const deployStarted = Date.now();
|
|
11224
11289
|
const root = resolveProjectRoot(options.dir);
|
|
11225
11290
|
await assertPortableProjectDependencies(root);
|
|
11291
|
+
const verbose = options.verbose === true;
|
|
11226
11292
|
const phase = (label, started) => {
|
|
11293
|
+
if (!verbose) return;
|
|
11227
11294
|
process.stdout.write(` ${label}: ${Date.now() - started}ms\n`);
|
|
11228
11295
|
};
|
|
11296
|
+
const writePlan = (activePlan) => {
|
|
11297
|
+
if (verbose) {
|
|
11298
|
+
process.stdout.write(formatPlanSummary(activePlan));
|
|
11299
|
+
return;
|
|
11300
|
+
}
|
|
11301
|
+
if (activePlan.mode === "full" || activePlan.mode === "filtered") process.stdout.write(formatPlanProgress(activePlan));
|
|
11302
|
+
};
|
|
11229
11303
|
const gitContext = await resolveDeployGitContext(root);
|
|
11230
11304
|
const gatesStarted = Date.now();
|
|
11231
11305
|
let gatesMs = 0;
|
|
@@ -11241,7 +11315,8 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11241
11315
|
client,
|
|
11242
11316
|
projectId: options.projectId,
|
|
11243
11317
|
root,
|
|
11244
|
-
gitContext
|
|
11318
|
+
gitContext,
|
|
11319
|
+
verbose
|
|
11245
11320
|
});
|
|
11246
11321
|
phase("draft sync", draftStarted);
|
|
11247
11322
|
const filter = parseManagedFilter(options.filter);
|
|
@@ -11261,7 +11336,7 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11261
11336
|
...filter ? { filter } : {}
|
|
11262
11337
|
});
|
|
11263
11338
|
phase("plan", planStarted);
|
|
11264
|
-
|
|
11339
|
+
writePlan(plan);
|
|
11265
11340
|
if (plan.mode === "no_op") {
|
|
11266
11341
|
earlyGatesPromise.catch(() => void 0);
|
|
11267
11342
|
process.stdout.write("Nothing to deploy — draft matches main.\n");
|
|
@@ -11336,6 +11411,7 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11336
11411
|
const gatesPromise = verifyOutside && !hostedCheckout ? earlyGatesPromise : Promise.resolve().then(() => {
|
|
11337
11412
|
gatesMs = 0;
|
|
11338
11413
|
});
|
|
11414
|
+
if (!verbose) process.stdout.write("Building…\n");
|
|
11339
11415
|
const publishStarted = Date.now();
|
|
11340
11416
|
const publishPromise = (async () => {
|
|
11341
11417
|
if (prepared.publishMode === "git_push") {
|
|
@@ -11422,8 +11498,10 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11422
11498
|
]);
|
|
11423
11499
|
throw error;
|
|
11424
11500
|
}
|
|
11425
|
-
|
|
11426
|
-
|
|
11501
|
+
if (verbose) {
|
|
11502
|
+
process.stdout.write(` publish candidate: ${publishMs}ms\n`);
|
|
11503
|
+
if (gatesMs > 0) process.stdout.write(` gates: ${gatesMs}ms\n`);
|
|
11504
|
+
}
|
|
11427
11505
|
let built = await buildPromise;
|
|
11428
11506
|
if (publishedCandidateSha.toLowerCase() !== composed.candidateSha.toLowerCase()) {
|
|
11429
11507
|
if (await resolveCommitTreeSha({
|
|
@@ -11443,8 +11521,9 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11443
11521
|
buildMs += Date.now() - rebuildStarted;
|
|
11444
11522
|
}
|
|
11445
11523
|
}
|
|
11446
|
-
process.stdout.write(` build: ${buildMs}ms\n`);
|
|
11524
|
+
if (verbose) process.stdout.write(` build: ${buildMs}ms\n`);
|
|
11447
11525
|
assertLease();
|
|
11526
|
+
if (!verbose) process.stdout.write("Uploading…\n");
|
|
11448
11527
|
const uploadStarted = Date.now();
|
|
11449
11528
|
const renewed = await client.projectGit.renewDeployUpload(options.projectId, {
|
|
11450
11529
|
artifactId: prepared.artifact.id,
|
|
@@ -11469,7 +11548,7 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11469
11548
|
index: built.index
|
|
11470
11549
|
});
|
|
11471
11550
|
phase("complete", completeStarted);
|
|
11472
|
-
process.stdout.write(`Deploy ${completed.artifact.id} started (${completed.mode})\n`);
|
|
11551
|
+
if (verbose) process.stdout.write(`Deploy ${completed.artifact.id} started (${completed.mode})\n`);
|
|
11473
11552
|
return completed.artifact.id;
|
|
11474
11553
|
}
|
|
11475
11554
|
});
|
|
@@ -11491,7 +11570,7 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11491
11570
|
env: gitContext.env,
|
|
11492
11571
|
...filter ? { filter } : {}
|
|
11493
11572
|
});
|
|
11494
|
-
|
|
11573
|
+
writePlan(plan);
|
|
11495
11574
|
if (plan.mode === "no_op") {
|
|
11496
11575
|
process.stdout.write("Nothing to deploy — draft matches main.\n");
|
|
11497
11576
|
return;
|
|
@@ -11504,10 +11583,18 @@ async function runManagedDeploy(client, config, options) {
|
|
|
11504
11583
|
});
|
|
11505
11584
|
artifactId = await runTrusted(plan);
|
|
11506
11585
|
}
|
|
11586
|
+
if (!verbose) process.stdout.write("Activating…\n");
|
|
11507
11587
|
const healthStarted = Date.now();
|
|
11508
|
-
await pollProjectActive(client, options.projectId, {
|
|
11588
|
+
const active = await pollProjectActive(client, options.projectId, {
|
|
11589
|
+
artifactId,
|
|
11590
|
+
verbose
|
|
11591
|
+
});
|
|
11509
11592
|
phase("health/promotion", healthStarted);
|
|
11510
|
-
process.stdout.write(`CLI→active: ${Date.now() - deployStarted}ms\n`);
|
|
11593
|
+
if (verbose) process.stdout.write(`CLI→active: ${Date.now() - deployStarted}ms\n`);
|
|
11594
|
+
else {
|
|
11595
|
+
process.stdout.write(`Deployed in ${formatDeployDuration(Date.now() - deployStarted)}\n`);
|
|
11596
|
+
if (active.baseUrl && !isPrivateDeployBaseUrl(active.baseUrl)) process.stdout.write(`${active.baseUrl}\n`);
|
|
11597
|
+
}
|
|
11511
11598
|
}
|
|
11512
11599
|
/** @internal Exported for unit tests. */
|
|
11513
11600
|
async function resolveManagedDeployDraftSha(input) {
|
|
@@ -11519,7 +11606,7 @@ async function resolveManagedDeployDraftSha(input) {
|
|
|
11519
11606
|
const inspection = await assertHostedCheckoutDeployable(input.root, { env: input.gitContext.env });
|
|
11520
11607
|
const revision = await input.client.projectDraft.getRevision(input.projectId);
|
|
11521
11608
|
assertCheckoutMatchesDraft(inspection, revision.commitSha);
|
|
11522
|
-
process.stdout.write(`Hosted checkout ready (${revision.commitSha.slice(0, 12)} on ks/draft).\n`);
|
|
11609
|
+
if (input.verbose) process.stdout.write(`Hosted checkout ready (${revision.commitSha.slice(0, 12)} on ks/draft).\n`);
|
|
11523
11610
|
return revision.commitSha.toLowerCase();
|
|
11524
11611
|
}
|
|
11525
11612
|
/** @internal Exported for unit tests. */
|
|
@@ -11545,7 +11632,7 @@ async function runDeploy(options) {
|
|
|
11545
11632
|
await runManagedDeploy(client, config, options);
|
|
11546
11633
|
}
|
|
11547
11634
|
function registerDeployCommand(program) {
|
|
11548
|
-
program.command("deploy").description("Deploy the project via managed Git (draft sync, local analyze/build, cutover)").option("--dir <path>", "Project directory", process.cwd()).option("--filter <entry>", "Deploy only matching workflow/agent keys (repeatable; e.g. workflows/ping)", (value, previous) => [...previous, value], []).option("--accept-impact", "Accept the current filtered deploy impact (required for non-TTY expansion)").action(async (options) => {
|
|
11635
|
+
program.command("deploy").description("Deploy the project via managed Git (draft sync, local analyze/build, cutover)").option("--dir <path>", "Project directory", process.cwd()).option("--filter <entry>", "Deploy only matching workflow/agent keys (repeatable; e.g. workflows/ping)", (value, previous) => [...previous, value], []).option("--accept-impact", "Accept the current filtered deploy impact (required for non-TTY expansion)").option("--verbose", "Show phase timings, pin SHAs, and deploy detail").action(async (options) => {
|
|
11549
11636
|
let config;
|
|
11550
11637
|
try {
|
|
11551
11638
|
config = createCliConfig();
|
|
@@ -11556,7 +11643,8 @@ function registerDeployCommand(program) {
|
|
|
11556
11643
|
dir: options.dir,
|
|
11557
11644
|
projectId,
|
|
11558
11645
|
filter: options.filter.length > 0 ? options.filter : void 0,
|
|
11559
|
-
acceptImpact: options.acceptImpact === true
|
|
11646
|
+
acceptImpact: options.acceptImpact === true,
|
|
11647
|
+
verbose: options.verbose === true
|
|
11560
11648
|
});
|
|
11561
11649
|
await trackCliEvent("cli:deploy", { projectId });
|
|
11562
11650
|
} catch (error) {
|
|
@@ -14006,4 +14094,4 @@ async function runCli(argv) {
|
|
|
14006
14094
|
//#endregion
|
|
14007
14095
|
export { runCli };
|
|
14008
14096
|
|
|
14009
|
-
//# sourceMappingURL=program-
|
|
14097
|
+
//# sourceMappingURL=program-Bv7Wv_O4.mjs.map
|