@keystrokehq/cli 0.1.11 → 0.1.13
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/{pack-artifact-DVnIKrsg-BtNTTQcz.mjs → dist-CCMjOqMx.mjs} +18 -3
- package/dist/dist-CCMjOqMx.mjs.map +1 -0
- package/dist/{dist-BZ7i1Hoi.mjs → dist-CE8k4aAC.mjs} +2642 -3288
- package/dist/dist-CE8k4aAC.mjs.map +1 -0
- package/dist/dist-CEqY8MN8.mjs +3 -0
- package/dist/{dist-HoBmjMMW.mjs → dist-CXBALGTP.mjs} +3 -3
- package/dist/{dist-HoBmjMMW.mjs.map → dist-CXBALGTP.mjs.map} +1 -1
- package/dist/{dist-YV-kApfg.mjs → dist-D638kKxn.mjs} +84 -3
- package/dist/{dist-YV-kApfg.mjs.map → dist-D638kKxn.mjs.map} +1 -1
- package/dist/index.mjs +95 -27
- package/dist/index.mjs.map +1 -1
- package/dist/{maybe-auto-update-BiR_kXZX.mjs → maybe-auto-update-CT8ROK99.mjs} +2 -2
- package/dist/{maybe-auto-update-BiR_kXZX.mjs.map → maybe-auto-update-CT8ROK99.mjs.map} +1 -1
- package/dist/skills-bundle/_AGENTS.mcp.md +70 -0
- package/dist/skills-bundle/skills/keystroke-agents/references/models.md +1 -1
- package/dist/{version-BGuC7Cpu.mjs → version-Brfe7Lb_.mjs} +2 -2
- package/dist/{version-BGuC7Cpu.mjs.map → version-Brfe7Lb_.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/dist-BZ7i1Hoi.mjs.map +0 -1
- package/dist/dist-BkRNDWxd.mjs +0 -3
- package/dist/pack-artifact-DVnIKrsg-BtNTTQcz.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
3
|
-
import { a as installPlaygroundDependencies, c as createCliConfig, d as getEffectiveApiTarget, f as getPlatformUrl, g as resolvePlatformUrlForWebUrl, i as installDependencies, l as getCliConfigDir, m as DEFAULT_PLATFORM_URL, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getWebUrl, s as resolveCliRoot, t as readCliVersion, u as getConfigDir } from "./version-
|
|
4
|
-
import { n as packProjectArtifact, t as
|
|
2
|
+
import { $ as HistoryRunCancelResponseSchema, $t as StartOAuthConnectionResultSchema, A as CreateCustomAppRequestSchema, An as WorkspaceTriggerOverviewSchema, At as PresignProjectSourceRequestSchema, B as CredentialConsumerListQuerySchema, Bn as parseErrorResponse, Bt as PromptResponseSchema, C as ConnectAuthorizeUrlResponseSchema, Cn as WorkflowRunDetailResponseSchema, Ct as OrganizationSidebarBrandingPatchSchema, D as CreateCredentialInstanceBodySchema, Dn as WorkspaceTriggerDetailSchema, Dt as PollRunResponseSchema, E as CreateApiKeyResponseSchema, En as WorkflowSummaryListResponseSchema, Et as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, F as CreateProjectRequestSchema, Fn as isAcceptableInstallExit, Ft as ProjectReachabilityResponseSchema, G as DownloadActiveProjectArtifactResponseSchema, Gt as SkillSummaryDetailResponseSchema, H as CredentialInstanceListResponseSchema, Hn as resolveConnectAppSlug, Ht as QueuedRunResponseSchema, I as CreateProjectResponseSchema, In as listenPortFromPublicUrl, It as ProjectResponseSchema, J as GatewayAttachmentRecordSchema, Jt as StartKeystrokeConnectionInputSchema, K as DownloadActiveProjectSourceResponseSchema, Kt as SkillSummaryListResponseSchema, L as CredentialAssignmentListQuerySchema, Lt as ProjectSettingsResponseSchema, M as CreateOrganizationRequestSchema, Mn as buildConnectDeeplink, Mt as PresignUserAvatarRequestSchema, N as CreateOrganizationResponseSchema, Nt as PresignUserAvatarResponseSchema, O as CreateCredentialsRequestSchema, On as WorkspaceTriggerFileSchema, Ot as PresignOrgLogoRequestSchema, P as CreateProjectArtifactResponseSchema, Pn as detectProjectPackageManagerFromSnapshot, Pt as ProjectPullStateSchema, Q as HealthResponseSchema, Qt as StartOAuthConnectionInputSchema, R as CredentialAssignmentListResponseSchema, Rt as ProjectSlugAvailabilityResponseSchema, S as CompleteProjectArtifactResponseSchema, Sn as UserPreferencesSchema, St as OpenApiDiscoverResponseSchema, T as CreateApiKeyRequestSchema, Tn as WorkflowSummaryDetailResponseSchema, Tt as PROJECT_PULL_STATE_RELATIVE_PATH, U as CredentialInstanceRecordSchema, Un as resolvePublicPlatformOrigin, V as CredentialConsumerListResponseSchema, Vt as QueuedAgentPromptResponseSchema, W as DeclineOrganizationInvitationResponseSchema, Wn as slugifyAppName, Wt as RecentResourceListResponseSchema, X as GetCustomAppResponseSchema, Xt as StartMcpOAuthConnectionInputSchema, Y as GetCredentialResponseSchema, Yt as StartKeystrokeConnectionResultSchema, Z as GraphqlDiscoverResponseSchema, Zt as StartMcpOAuthConnectionResultSchema, _ as ChannelAccountListResponseSchema, _n as UploadProjectSourceResponseSchema, _t as ListProjectFilesResponseSchema, a as AgentSessionDetailResponseSchema, an as TriggerRunListResponseSchema, at as InviteProjectMembersRequestSchema, b as ChannelDirectoryListResponseSchema, bn as UserAvatarSchema, bt as ListProjectsResponseSchema, c as AgentSummaryListResponseSchema, cn as UpdateCredentialRequestSchema, ct as ListAgentMemoryFilesResponseSchema, d as AssignCredentialBodySchema, dn as UpdateOrganizationRequestSchema, dt as ListAppsResponseSchema, en as SubmitMarketingContactRequestSchema, et as HistoryRunDetailResponseSchema, f as BindChannelBodySchema, fn as UpdateProjectMemberRequestSchema, ft as ListCredentialsResponseSchema, g as CatalogAppsPageResponseSchema, gn as UploadProjectSourceManifestRequestSchema, gt as ListProjectDeploymentsResponseSchema, h as CatalogAppDetailResponseSchema, hn as UpdateProjectSettingsRequestSchema, ht as ListOrganizationsResponseSchema, i as AgentSessionChatStateResponseSchema, in as TriggerRunDetailResponseSchema, it as InviteOrganizationMembersResponseSchema, j as CreateCustomAppResponseSchema, jn as WorkspaceTriggerRunListResponseSchema, jt as PresignProjectSourceResponseSchema, k as CreateCredentialsResponseSchema, kn as WorkspaceTriggerListResponseSchema, kt as PresignOrgLogoResponseSchema, l as AgentTriggerSummaryListResponseSchema, ln as UpdateOrganizationMemberRequestSchema, lt as ListAgentWorkspaceFilesResponseSchema, m as CatalogActionsPageResponseSchema, mn as UpdateProjectRequestSchema, mt as ListOrganizationMembersResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as TriggerDetailResponseSchema, nt as HistoryRunListResponseSchema, o as AgentSessionListResponseSchema, on as UpdateChannelBindingBodySchema, ot as InviteProjectMembersResponseSchema, p as CatalogActionDetailResponseSchema, pn as UpdateProjectMemberResponseSchema, pt as ListOrganizationInvitationsResponseSchema, q as ErrorResponseSchema, qt as SlugAvailabilityResponseSchema, r as ActiveOrganizationResponseSchema, rn as TriggerListResponseSchema, rt as InviteOrganizationMembersRequestSchema, s as AgentSummaryDetailResponseSchema, sn as UpdateCredentialInstanceBodySchema, t as ACTIVE_ORG_HEADER, tn as SubmitTeamRequestRequestSchema, tt as HistoryRunListQuerySchema, u as AppSlugAvailabilityResponseSchema, un as UpdateOrganizationMemberResponseSchema, ut as ListApiKeysResponseSchema, v as ChannelConnectionListResponseSchema, vn as UpsertGatewayAttachmentBodySchema, vt as ListProjectMembersResponseSchema, w as ConnectProvidersResponseSchema, wn as WorkflowRunListResponseSchema, wt as OrganizationSidebarBrandingSchema, x as ChannelPlatformSchema, xn as UserPreferencesPatchSchema, xt as McpDiscoverResponseSchema, y as ChannelConnectionSchema, yn as UserAvatarPatchSchema, yt as ListProjectMetricsResponseSchema, z as CredentialAssignmentRecordSchema, zn as parseAppSlug, zt as PromptInputSchema } from "./dist-D638kKxn.mjs";
|
|
3
|
+
import { a as installPlaygroundDependencies, c as createCliConfig, d as getEffectiveApiTarget, f as getPlatformUrl, g as resolvePlatformUrlForWebUrl, i as installDependencies$1, l as getCliConfigDir, m as DEFAULT_PLATFORM_URL, n as buildPlaygroundWorkspace, o as resolvePackageManager, p as getWebUrl, s as resolveCliRoot, t as readCliVersion, u as getConfigDir } from "./version-Brfe7Lb_.mjs";
|
|
4
|
+
import { n as mergeFilteredArtifact, r as packProjectArtifact, t as mapInParallelBatches } from "./dist-CCMjOqMx.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { Command } from "commander";
|
|
7
7
|
import { platform } from "node:os";
|
|
@@ -3445,6 +3445,15 @@ function createArtifactsResource(http) {
|
|
|
3445
3445
|
throw await toPlatformError(error);
|
|
3446
3446
|
}
|
|
3447
3447
|
},
|
|
3448
|
+
/** Download all source files from the project's active deploy snapshot. */
|
|
3449
|
+
async downloadActiveSource(projectId) {
|
|
3450
|
+
try {
|
|
3451
|
+
const data = await http.get(`/api/projects/${encodeURIComponent(projectId)}/artifacts/active/source`).json();
|
|
3452
|
+
return DownloadActiveProjectSourceResponseSchema.parse(data);
|
|
3453
|
+
} catch (error) {
|
|
3454
|
+
throw await toPlatformError(error);
|
|
3455
|
+
}
|
|
3456
|
+
},
|
|
3448
3457
|
/** Download the active artifact tarball bytes via the presigned URL. */
|
|
3449
3458
|
async downloadActiveArchive(projectId) {
|
|
3450
3459
|
const { artifactId, downloadUrl } = await this.downloadActive(projectId);
|
|
@@ -5504,21 +5513,6 @@ function openUrl(url) {
|
|
|
5504
5513
|
}
|
|
5505
5514
|
//#endregion
|
|
5506
5515
|
//#region src/commands/connect/run-connect.ts
|
|
5507
|
-
function resolveConnectAppSlug(slug, apps) {
|
|
5508
|
-
const trimmed = slug.trim();
|
|
5509
|
-
if (!trimmed) throw new Error("App slug is required");
|
|
5510
|
-
try {
|
|
5511
|
-
parseAppSlug(trimmed);
|
|
5512
|
-
} catch {
|
|
5513
|
-
throw new Error(`Invalid app slug: ${slug}`);
|
|
5514
|
-
}
|
|
5515
|
-
const match = apps.find((app) => app.id === trimmed);
|
|
5516
|
-
if (!match) {
|
|
5517
|
-
const available = apps.map((app) => app.id).join(", ") || "(none)";
|
|
5518
|
-
throw new Error(`Unknown app "${trimmed}". Available: ${available}`);
|
|
5519
|
-
}
|
|
5520
|
-
return match;
|
|
5521
|
-
}
|
|
5522
5516
|
async function runConnect(options) {
|
|
5523
5517
|
const apps = await options.platform.apps.listCatalog();
|
|
5524
5518
|
const app = resolveConnectAppSlug(options.slug, apps);
|
|
@@ -6103,7 +6097,7 @@ function registerBuildCommand(program) {
|
|
|
6103
6097
|
program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
6104
6098
|
try {
|
|
6105
6099
|
const root = resolveProjectRoot(options.dir);
|
|
6106
|
-
const { buildApp } = await import("./dist-
|
|
6100
|
+
const { buildApp } = await import("./dist-CXBALGTP.mjs");
|
|
6107
6101
|
await buildApp({ root });
|
|
6108
6102
|
process.stdout.write(`Built ${root}\n`);
|
|
6109
6103
|
} catch (error) {
|
|
@@ -6157,7 +6151,7 @@ async function sleep(ms) {
|
|
|
6157
6151
|
}
|
|
6158
6152
|
async function buildDeployArchive(client, root, projectId, filter) {
|
|
6159
6153
|
if (filter?.length) {
|
|
6160
|
-
const { buildFilteredApp } = await import("./dist-
|
|
6154
|
+
const { buildFilteredApp } = await import("./dist-CXBALGTP.mjs");
|
|
6161
6155
|
const filtered = await buildFilteredApp({
|
|
6162
6156
|
root,
|
|
6163
6157
|
filter,
|
|
@@ -6179,7 +6173,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
|
|
|
6179
6173
|
sourceFiles: filtered.sourceFiles
|
|
6180
6174
|
};
|
|
6181
6175
|
}
|
|
6182
|
-
const { buildApp } = await import("./dist-
|
|
6176
|
+
const { buildApp } = await import("./dist-CXBALGTP.mjs");
|
|
6183
6177
|
const { sourceFiles } = await buildApp({
|
|
6184
6178
|
root,
|
|
6185
6179
|
collectSources: true,
|
|
@@ -6298,7 +6292,7 @@ function runtimeChildEnv(parentEnv, overrides) {
|
|
|
6298
6292
|
//#region src/project/bootstrap-run.ts
|
|
6299
6293
|
/** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
|
|
6300
6294
|
async function resolveBootstrapRun(options) {
|
|
6301
|
-
const { resolveRuntimeBuildArtifact } = await import("./dist-
|
|
6295
|
+
const { resolveRuntimeBuildArtifact } = await import("./dist-CXBALGTP.mjs");
|
|
6302
6296
|
const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
|
|
6303
6297
|
const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
|
|
6304
6298
|
const args = [`--import=${loader}`];
|
|
@@ -6447,7 +6441,7 @@ async function runDev(options) {
|
|
|
6447
6441
|
process.on("SIGINT", shutdown);
|
|
6448
6442
|
process.on("SIGTERM", shutdown);
|
|
6449
6443
|
try {
|
|
6450
|
-
const { watchApp } = await import("./dist-
|
|
6444
|
+
const { watchApp } = await import("./dist-CXBALGTP.mjs");
|
|
6451
6445
|
await watchApp({
|
|
6452
6446
|
root,
|
|
6453
6447
|
clean: false,
|
|
@@ -6597,7 +6591,7 @@ const INIT_CATALOG_VERSIONS = {
|
|
|
6597
6591
|
vitest: "^4.1.7",
|
|
6598
6592
|
"@types/node": "^25.9.1"
|
|
6599
6593
|
};
|
|
6600
|
-
const INIT_KEYSTROKE_VERSION = "^0.1.
|
|
6594
|
+
const INIT_KEYSTROKE_VERSION = "^0.1.12";
|
|
6601
6595
|
//#endregion
|
|
6602
6596
|
//#region src/init/copy-template.ts
|
|
6603
6597
|
function renderTemplate(content, variables) {
|
|
@@ -6848,7 +6842,7 @@ async function runInit(options) {
|
|
|
6848
6842
|
if (!options.skipInstall) if (playgroundRoot) {
|
|
6849
6843
|
installPlaygroundDependencies(targetDir);
|
|
6850
6844
|
buildPlaygroundWorkspace(playgroundRoot);
|
|
6851
|
-
} else installDependencies(targetDir, resolvePackageManager(options.packageManager));
|
|
6845
|
+
} else installDependencies$1(targetDir, resolvePackageManager(options.packageManager));
|
|
6852
6846
|
return {
|
|
6853
6847
|
targetDir,
|
|
6854
6848
|
projectName
|
|
@@ -7294,6 +7288,79 @@ function registerProjectCommand(program) {
|
|
|
7294
7288
|
registerProjectSettingsCommand(project);
|
|
7295
7289
|
}
|
|
7296
7290
|
//#endregion
|
|
7291
|
+
//#region src/commands/pull/run-pull.ts
|
|
7292
|
+
async function readPullState(targetDir) {
|
|
7293
|
+
try {
|
|
7294
|
+
const raw = await readFile(join(targetDir, PROJECT_PULL_STATE_RELATIVE_PATH), "utf8");
|
|
7295
|
+
const parsed = ProjectPullStateSchema.safeParse(JSON.parse(raw));
|
|
7296
|
+
return parsed.success ? parsed.data : void 0;
|
|
7297
|
+
} catch {
|
|
7298
|
+
return;
|
|
7299
|
+
}
|
|
7300
|
+
}
|
|
7301
|
+
async function writePullState(input) {
|
|
7302
|
+
const state = ProjectPullStateSchema.parse({
|
|
7303
|
+
projectId: input.projectId,
|
|
7304
|
+
artifactId: input.artifactId,
|
|
7305
|
+
pulledAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
7306
|
+
});
|
|
7307
|
+
const path = join(input.targetDir, PROJECT_PULL_STATE_RELATIVE_PATH);
|
|
7308
|
+
await mkdir(dirname(path), { recursive: true });
|
|
7309
|
+
await writeFile(path, `${JSON.stringify(state, null, 2)}\n`);
|
|
7310
|
+
}
|
|
7311
|
+
async function writeSourceTree(targetDir, files) {
|
|
7312
|
+
await mapInParallelBatches(files, 8, async (file) => {
|
|
7313
|
+
const absolute = join(targetDir, file.path);
|
|
7314
|
+
await mkdir(dirname(absolute), { recursive: true });
|
|
7315
|
+
await writeFile(absolute, file.contents);
|
|
7316
|
+
});
|
|
7317
|
+
}
|
|
7318
|
+
function installDependencies(targetDir, manager) {
|
|
7319
|
+
const result = spawnSync(manager, ["install"], {
|
|
7320
|
+
cwd: targetDir,
|
|
7321
|
+
encoding: "utf8"
|
|
7322
|
+
});
|
|
7323
|
+
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`;
|
|
7324
|
+
process.stdout.write(output);
|
|
7325
|
+
if (!isAcceptableInstallExit(manager, result.status ?? 1, output)) throw new Error(`${manager} install failed`);
|
|
7326
|
+
}
|
|
7327
|
+
async function runPull(options) {
|
|
7328
|
+
const targetDir = resolve(options.targetDir);
|
|
7329
|
+
await mkdir(targetDir, { recursive: true });
|
|
7330
|
+
const existing = await readPullState(targetDir);
|
|
7331
|
+
const isManagedPull = existing?.projectId === options.projectId;
|
|
7332
|
+
if (await readFile(join(targetDir, "package.json"), "utf8").then(() => true, () => false) && !isManagedPull && !options.force) throw new Error("Target directory already contains a project. Re-run with --force to overwrite from the active deploy.");
|
|
7333
|
+
const source = await options.client.artifacts.downloadActiveSource(options.projectId);
|
|
7334
|
+
if (existing?.artifactId === source.artifactId) {
|
|
7335
|
+
process.stdout.write("Project is already up to date with the active deploy.\n");
|
|
7336
|
+
return;
|
|
7337
|
+
}
|
|
7338
|
+
await writeSourceTree(targetDir, source.files);
|
|
7339
|
+
installDependencies(targetDir, detectProjectPackageManagerFromSnapshot(source.files));
|
|
7340
|
+
await syncBundledSkills(targetDir);
|
|
7341
|
+
await writePullState({
|
|
7342
|
+
targetDir,
|
|
7343
|
+
projectId: options.projectId,
|
|
7344
|
+
artifactId: source.artifactId
|
|
7345
|
+
});
|
|
7346
|
+
process.stdout.write(`Pulled ${source.files.length} files from active deploy (${source.artifactId}).\n`);
|
|
7347
|
+
}
|
|
7348
|
+
//#endregion
|
|
7349
|
+
//#region src/commands/pull/index.ts
|
|
7350
|
+
function registerPullCommand(program) {
|
|
7351
|
+
program.command("pull").description("Download the active deploy source snapshot into a local directory").option("--dir <path>", "Target directory", process.cwd()).option("--force", "Overwrite an existing local project tree").action(async (options) => runCliCommand("Pull failed", async () => {
|
|
7352
|
+
const config = createCliConfig();
|
|
7353
|
+
const projectId = await resolveActiveProjectId(config);
|
|
7354
|
+
if (!projectId) throw new Error("Usage: keystroke pull --project <slug>");
|
|
7355
|
+
await runPull({
|
|
7356
|
+
client: createCliPlatformClient(config),
|
|
7357
|
+
projectId,
|
|
7358
|
+
targetDir: options.dir,
|
|
7359
|
+
force: options.force
|
|
7360
|
+
});
|
|
7361
|
+
}));
|
|
7362
|
+
}
|
|
7363
|
+
//#endregion
|
|
7297
7364
|
//#region src/commands/start.ts
|
|
7298
7365
|
function resolveStartServerUrl(root, portOverride) {
|
|
7299
7366
|
const url = new URL(resolveLocalApiOrigin(root));
|
|
@@ -7306,7 +7373,7 @@ async function runStart(options) {
|
|
|
7306
7373
|
const apiPort = Number(new URL(serverUrl).port || 80);
|
|
7307
7374
|
const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
|
|
7308
7375
|
ensureNativeDeps(runtimeNodeModules);
|
|
7309
|
-
const { buildApp } = await import("./dist-
|
|
7376
|
+
const { buildApp } = await import("./dist-CXBALGTP.mjs");
|
|
7310
7377
|
await buildApp({
|
|
7311
7378
|
root,
|
|
7312
7379
|
clean: false
|
|
@@ -7875,6 +7942,7 @@ function createProgram() {
|
|
|
7875
7942
|
registerSkillCommand(program);
|
|
7876
7943
|
registerBuildCommand(program);
|
|
7877
7944
|
registerDeployCommand(program);
|
|
7945
|
+
registerPullCommand(program);
|
|
7878
7946
|
registerDevCommand(program);
|
|
7879
7947
|
registerStartCommand(program);
|
|
7880
7948
|
registerAgentCommand(program);
|
|
@@ -7885,7 +7953,7 @@ function createProgram() {
|
|
|
7885
7953
|
return program;
|
|
7886
7954
|
}
|
|
7887
7955
|
async function runCli(argv) {
|
|
7888
|
-
const { maybeAutoUpdate } = await import("./maybe-auto-update-
|
|
7956
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-CT8ROK99.mjs");
|
|
7889
7957
|
await maybeAutoUpdate(argv);
|
|
7890
7958
|
createProgram().parse(argv);
|
|
7891
7959
|
}
|