@keystrokehq/cli 0.1.22 → 0.1.25
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-UdbUy9DM.mjs → dist-BOhrc_Nv.mjs} +20 -2
- package/dist/{dist-UdbUy9DM.mjs.map → dist-BOhrc_Nv.mjs.map} +1 -1
- package/dist/{dist-Bwn5tAiT.mjs → dist-C1QOfWMM.mjs} +206 -8545
- package/dist/dist-C1QOfWMM.mjs.map +1 -0
- package/dist/{dist-BdewSOMb.mjs → dist-CUEVu120.mjs} +3 -3
- package/dist/{dist-BdewSOMb.mjs.map → dist-CUEVu120.mjs.map} +1 -1
- package/dist/dist-DsdMtFME.mjs +3 -0
- package/dist/dist-Re6HHSqz.mjs +11561 -0
- package/dist/dist-Re6HHSqz.mjs.map +1 -0
- package/dist/index.mjs +132 -63
- package/dist/index.mjs.map +1 -1
- package/dist/{maybe-auto-update-BK4A8nTA.mjs → maybe-auto-update-q5MthdI8.mjs} +2 -2
- package/dist/{maybe-auto-update-BK4A8nTA.mjs.map → maybe-auto-update-q5MthdI8.mjs.map} +1 -1
- package/dist/skills-bundle/_AGENTS.mcp.md +101 -38
- package/dist/skills-bundle/_AGENTS.md +128 -49
- package/dist/{version-CUTRAMa8.mjs → version-DcR3O1UD.mjs} +2 -2
- package/dist/{version-CUTRAMa8.mjs.map → version-DcR3O1UD.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/dist-Bwn5tAiT.mjs.map +0 -1
- package/dist/dist-D8wvycYm.mjs +0 -127
- package/dist/dist-D8wvycYm.mjs.map +0 -1
- package/dist/dist-Dms4EW-W.mjs +0 -3
- package/dist/skills-bundle/skills/keystroke-actions/SKILL.md +0 -160
- package/dist/skills-bundle/skills/keystroke-actions/references/catalog-and-imports.md +0 -71
- package/dist/skills-bundle/skills/keystroke-agents/SKILL.md +0 -115
- package/dist/skills-bundle/skills/keystroke-agents/references/models.md +0 -23
- package/dist/skills-bundle/skills/keystroke-agents/references/tools-mcp-codemode.md +0 -73
- package/dist/skills-bundle/skills/keystroke-agents/references/workflows-and-testing.md +0 -26
- package/dist/skills-bundle/skills/keystroke-apps/SKILL.md +0 -151
- package/dist/skills-bundle/skills/keystroke-apps/references/cli-and-catalog.md +0 -104
- package/dist/skills-bundle/skills/keystroke-channels/SKILL.md +0 -66
- package/dist/skills-bundle/skills/keystroke-channels/references/slack-setup.md +0 -41
- package/dist/skills-bundle/skills/keystroke-cli/SKILL.md +0 -93
- package/dist/skills-bundle/skills/keystroke-deploy/SKILL.md +0 -93
- package/dist/skills-bundle/skills/keystroke-deploy/references/build-and-full-deploy.md +0 -30
- package/dist/skills-bundle/skills/keystroke-deploy/references/filtered-deploy.md +0 -50
- package/dist/skills-bundle/skills/keystroke-deploy/references/wip-ignore.md +0 -35
- package/dist/skills-bundle/skills/keystroke-files/SKILL.md +0 -43
- package/dist/skills-bundle/skills/keystroke-skills/SKILL.md +0 -42
- package/dist/skills-bundle/skills/keystroke-triggers/SKILL.md +0 -143
- package/dist/skills-bundle/skills/keystroke-workflows/SKILL.md +0 -78
- package/dist/skills-bundle/skills/keystroke-workflows/references/authoring.md +0 -168
- package/dist/skills-bundle/skills/keystroke-workflows/references/testing.md +0 -138
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
2
|
+
import { $ as GetCustomAppResponseSchema, $n as slugifyAppName, $t as SlugAvailabilityResponseSchema, A as CreateCustomAppRequestSchema, An as WorkflowRunHooksResponseSchema, At as PollRunResponseSchema, B as CredentialConsumerListQuerySchema, Bt as ProjectReachabilityResponseSchema, C as ConnectAuthorizeUrlResponseSchema, Cn as UploadProjectSourceResponseSchema, Ct as ListProjectsResponseSchema, D as CreateCredentialInstanceBodySchema, Dn as UserPreferencesPatchSchema, Dt as OrganizationSidebarBrandingSchema, E as CreateApiKeyResponseSchema, En as UserAvatarSchema, Et as OrganizationSidebarBrandingPatchSchema, F as CreateProjectRequestSchema, Fn as WorkspaceTriggerFileSchema, Ft as PresignProjectSourceRequestSchema, G as DOCS_QUERY_TOOL, Gt as PromptResponseSchema, H as CredentialInstanceListResponseSchema, Hn as detectProjectPackageManagerFromSnapshot, Ht as ProjectSettingsResponseSchema, I as CreateProjectResponseSchema, In as WorkspaceTriggerListResponseSchema, It as PresignProjectSourceResponseSchema, J as DownloadActiveProjectArtifactResponseSchema, Jn as parseErrorResponse, Jt as QueuedRunResponseSchema, K as DOCS_SEARCH_TOOL, L as CredentialAssignmentListQuerySchema, Ln as WorkspaceTriggerOverviewSchema, Lt as PresignUserAvatarRequestSchema, M as CreateOrganizationRequestSchema, Mn as WorkflowSummaryDetailResponseSchema, Mt as PresignChatAttachmentResponseSchema, N as CreateOrganizationResponseSchema, Nn as WorkflowSummaryListResponseSchema, Nt as PresignOrgLogoRequestSchema, O as CreateCredentialsRequestSchema, On as UserPreferencesSchema, Ot as PROJECT_PULL_STATE_RELATIVE_PATH, P as CreateProjectArtifactResponseSchema, Pn as WorkspaceTriggerDetailSchema, Pt as PresignOrgLogoResponseSchema, Q as GetCredentialResponseSchema, Qn as resolvePublicPlatformOrigin, Qt as SkillSummaryListResponseSchema, R as CredentialAssignmentListResponseSchema, Rn as WorkspaceTriggerRunListResponseSchema, Rt as PresignUserAvatarResponseSchema, S as CompleteProjectArtifactResponseSchema, Sn as UploadProjectSourceManifestRequestSchema, St as ListProjectMetricsResponseSchema, T as CreateApiKeyRequestSchema, Tn as UserAvatarPatchSchema, Tt as OpenApiDiscoverResponseSchema, U as CredentialInstanceRecordSchema, Un as isAcceptableInstallExit, Ut as ProjectSlugAvailabilityResponseSchema, V as CredentialConsumerListResponseSchema, Vn as deriveCustomAppDisplay, Vt as ProjectResponseSchema, Wn as listenPortFromPublicUrl, Wt as PromptInputSchema, X as ErrorResponseSchema, Xn as resolveConnectAppSlug, Xt as RecentResourceListResponseSchema, Y as DownloadActiveProjectSourceResponseSchema, Z as GatewayAttachmentRecordSchema, Zn as resolveDocsMcpUrl, Zt as SkillSummaryDetailResponseSchema, _ as ChannelAccountListResponseSchema, _n as UpdateOrganizationRequestSchema, _t as ListOrganizationMembersResponseSchema, a as AgentSessionDetailResponseSchema, an as StartOAuthConnectionResultSchema, at as HistoryRunListResponseSchema, b as ChannelDirectoryListResponseSchema, bn as UpdateProjectRequestSchema, bt as ListProjectFilesResponseSchema, c as AgentSummaryListResponseSchema, cn as TriggerDetailResponseSchema, ct as InviteProjectMembersRequestSchema, d as AssignCredentialBodySchema, dn as TriggerRunListResponseSchema, dt as ListAgentMemoryFilesResponseSchema, en as StartKeystrokeConnectionInputSchema, et as GraphqlDiscoverResponseSchema, f as BindChannelBodySchema, fn as UpdateChannelBindingBodySchema, ft as ListAgentWorkspaceFilesResponseSchema, g as CatalogAppsPageResponseSchema, gn as UpdateOrganizationMemberResponseSchema, gt as ListOrganizationInvitationsResponseSchema, h as CatalogAppDetailResponseSchema, hn as UpdateOrganizationMemberRequestSchema, ht as ListCredentialsResponseSchema, i as AgentSessionChatStateResponseSchema, in as StartOAuthConnectionInputSchema, it as HistoryRunListQuerySchema, j as CreateCustomAppResponseSchema, jn as WorkflowRunListResponseSchema, jt as PresignChatAttachmentRequestSchema, k as CreateCredentialsResponseSchema, kn as WorkflowRunDetailResponseSchema, kt as PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS, l as AgentTriggerSummaryListResponseSchema, ln as TriggerListResponseSchema, lt as InviteProjectMembersResponseSchema, m as CatalogActionsPageResponseSchema, mn as UpdateCredentialRequestSchema, mt as ListAppsResponseSchema, n as AcceptOrganizationInvitationResponseSchema, nn as StartMcpOAuthConnectionInputSchema, nt as HistoryRunCancelResponseSchema, o as AgentSessionListResponseSchema, on as SubmitMarketingContactRequestSchema, ot as InviteOrganizationMembersRequestSchema, p as CatalogActionDetailResponseSchema, pn as UpdateCredentialInstanceBodySchema, pt as ListApiKeysResponseSchema, q as DeclineOrganizationInvitationResponseSchema, qn as parseAppSlug, qt as QueuedAgentPromptResponseSchema, r as ActiveOrganizationResponseSchema, rn as StartMcpOAuthConnectionResultSchema, rt as HistoryRunDetailResponseSchema, s as AgentSummaryDetailResponseSchema, sn as SubmitTeamRequestRequestSchema, st as InviteOrganizationMembersResponseSchema, t as ACTIVE_ORG_HEADER, tn as StartKeystrokeConnectionResultSchema, tt as HealthResponseSchema, u as AppSlugAvailabilityResponseSchema, un as TriggerRunDetailResponseSchema, v as ChannelConnectionListResponseSchema, vn as UpdateProjectMemberRequestSchema, vt as ListOrganizationsResponseSchema, w as ConnectProvidersResponseSchema, wn as UpsertGatewayAttachmentBodySchema, wt as McpDiscoverResponseSchema, x as ChannelPlatformSchema, xn as UpdateProjectSettingsRequestSchema, xt as ListProjectMembersResponseSchema, y as ChannelConnectionSchema, yn as UpdateProjectMemberResponseSchema, yt as ListProjectDeploymentsResponseSchema, z as CredentialAssignmentRecordSchema, zn as buildConnectDeeplink, zt as ProjectPullStateSchema } from "./dist-BOhrc_Nv.mjs";
|
|
3
|
+
import { i as packProjectArtifact, n as withMcpReadClient, r as mergeFilteredArtifact, t as mapInParallelBatches } from "./dist-Re6HHSqz.mjs";
|
|
4
|
+
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-DcR3O1UD.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { Command } from "commander";
|
|
7
|
-
import { platform } from "node:os";
|
|
8
7
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
8
|
import { Entry } from "@napi-rs/keyring";
|
|
10
9
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
11
10
|
import { existsSync, lstatSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
12
|
-
import { access, copyFile,
|
|
11
|
+
import { access, copyFile, lstat, mkdir, readFile, readdir, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
13
12
|
import { spawn, spawnSync } from "node:child_process";
|
|
14
13
|
import { pathToFileURL } from "node:url";
|
|
15
14
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
|
|
@@ -5012,6 +5011,23 @@ function formatCliError(error, fallback, context) {
|
|
|
5012
5011
|
}
|
|
5013
5012
|
//#endregion
|
|
5014
5013
|
//#region src/errors/run-command.ts
|
|
5014
|
+
/**
|
|
5015
|
+
* Run a command that needs no project/org target or auth (e.g. public docs).
|
|
5016
|
+
* Builds config and formats errors, but skips `resolveApiTarget` / `ensureActiveOrganization`,
|
|
5017
|
+
* so it works logged-out from any directory.
|
|
5018
|
+
*/
|
|
5019
|
+
async function runStandaloneCliCommand(fallback, fn, errorContext) {
|
|
5020
|
+
const config = createCliConfig();
|
|
5021
|
+
try {
|
|
5022
|
+
await fn({ config });
|
|
5023
|
+
} catch (error) {
|
|
5024
|
+
process.stderr.write(`${formatCliError(error, fallback, {
|
|
5025
|
+
...errorContext,
|
|
5026
|
+
webUrl: getWebUrl(config)
|
|
5027
|
+
})}\n`);
|
|
5028
|
+
process.exitCode = 1;
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5015
5031
|
async function runProjectCliCommand(fallback, fn, errorContext, targetOptions = {}) {
|
|
5016
5032
|
return runCliCommand(fallback, fn, errorContext, {
|
|
5017
5033
|
...projectScopedTarget,
|
|
@@ -6206,7 +6222,7 @@ function registerBuildCommand(program) {
|
|
|
6206
6222
|
program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
6207
6223
|
try {
|
|
6208
6224
|
const root = resolveProjectRoot(options.dir);
|
|
6209
|
-
const { buildApp } = await import("./dist-
|
|
6225
|
+
const { buildApp } = await import("./dist-CUEVu120.mjs");
|
|
6210
6226
|
await buildApp({ root });
|
|
6211
6227
|
process.stdout.write(`Built ${root}\n`);
|
|
6212
6228
|
} catch (error) {
|
|
@@ -6260,7 +6276,7 @@ async function sleep(ms) {
|
|
|
6260
6276
|
}
|
|
6261
6277
|
async function buildDeployArchive(client, root, projectId, filter) {
|
|
6262
6278
|
if (filter?.length) {
|
|
6263
|
-
const { buildFilteredApp } = await import("./dist-
|
|
6279
|
+
const { buildFilteredApp } = await import("./dist-CUEVu120.mjs");
|
|
6264
6280
|
const filtered = await buildFilteredApp({
|
|
6265
6281
|
root,
|
|
6266
6282
|
filter,
|
|
@@ -6282,7 +6298,7 @@ async function buildDeployArchive(client, root, projectId, filter) {
|
|
|
6282
6298
|
sourceFiles: filtered.sourceFiles
|
|
6283
6299
|
};
|
|
6284
6300
|
}
|
|
6285
|
-
const { buildApp } = await import("./dist-
|
|
6301
|
+
const { buildApp } = await import("./dist-CUEVu120.mjs");
|
|
6286
6302
|
const { sourceFiles } = await buildApp({
|
|
6287
6303
|
root,
|
|
6288
6304
|
collectSources: true,
|
|
@@ -6401,7 +6417,7 @@ function runtimeChildEnv(parentEnv, overrides) {
|
|
|
6401
6417
|
//#region src/project/bootstrap-run.ts
|
|
6402
6418
|
/** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
|
|
6403
6419
|
async function resolveBootstrapRun(options) {
|
|
6404
|
-
const { resolveRuntimeBuildArtifact } = await import("./dist-
|
|
6420
|
+
const { resolveRuntimeBuildArtifact } = await import("./dist-CUEVu120.mjs");
|
|
6405
6421
|
const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
|
|
6406
6422
|
const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/standalone-bootstrap.mjs");
|
|
6407
6423
|
const args = [`--import=${loader}`];
|
|
@@ -6550,7 +6566,7 @@ async function runDev(options) {
|
|
|
6550
6566
|
process.on("SIGINT", shutdown);
|
|
6551
6567
|
process.on("SIGTERM", shutdown);
|
|
6552
6568
|
try {
|
|
6553
|
-
const { watchApp } = await import("./dist-
|
|
6569
|
+
const { watchApp } = await import("./dist-CUEVu120.mjs");
|
|
6554
6570
|
await watchApp({
|
|
6555
6571
|
root,
|
|
6556
6572
|
clean: false,
|
|
@@ -6578,6 +6594,63 @@ function registerDevCommand(program) {
|
|
|
6578
6594
|
});
|
|
6579
6595
|
}
|
|
6580
6596
|
//#endregion
|
|
6597
|
+
//#region src/commands/docs/run-docs.ts
|
|
6598
|
+
/**
|
|
6599
|
+
* Render an MCP tool result for the terminal. The docs tools return text/markdown
|
|
6600
|
+
* blocks (search hits, file contents, sandbox stdout/stderr), so we pass them through
|
|
6601
|
+
* verbatim and only fall back to JSON when a result carries no text.
|
|
6602
|
+
*/
|
|
6603
|
+
function renderToolResult(result) {
|
|
6604
|
+
const blocks = result?.content;
|
|
6605
|
+
if (Array.isArray(blocks)) {
|
|
6606
|
+
const text = blocks.filter((block) => block?.type === "text" && typeof block.text === "string").map((block) => block.text).join("\n");
|
|
6607
|
+
if (text.length > 0) return text;
|
|
6608
|
+
}
|
|
6609
|
+
return JSON.stringify(result, null, 2);
|
|
6610
|
+
}
|
|
6611
|
+
/** Call a docs MCP tool and render its result as text. */
|
|
6612
|
+
async function callDocsTool(client, name, args) {
|
|
6613
|
+
return renderToolResult(await client.callTool({
|
|
6614
|
+
name,
|
|
6615
|
+
arguments: args
|
|
6616
|
+
}));
|
|
6617
|
+
}
|
|
6618
|
+
//#endregion
|
|
6619
|
+
//#region src/commands/docs/docs-mcp-url.ts
|
|
6620
|
+
/**
|
|
6621
|
+
* Public Keystroke docs MCP endpoint (Mintlify-hosted, no auth).
|
|
6622
|
+
* Derived from the configured web URL; `KEYSTROKE_DOCS_MCP_URL` overrides for dev/testing.
|
|
6623
|
+
*/
|
|
6624
|
+
function getDocsMcpUrl(config) {
|
|
6625
|
+
return resolveDocsMcpUrl({
|
|
6626
|
+
webUrl: getWebUrl(config),
|
|
6627
|
+
override: process.env.KEYSTROKE_DOCS_MCP_URL
|
|
6628
|
+
});
|
|
6629
|
+
}
|
|
6630
|
+
//#endregion
|
|
6631
|
+
//#region src/commands/docs/query.ts
|
|
6632
|
+
function registerDocsQueryCommand(docs) {
|
|
6633
|
+
docs.command("query").description("Read the Keystroke docs filesystem with a shell-style command (cat, rg, ls, tree)").argument("<command>", "Read-only command, e.g. \"cat /quickstart.mdx\" or \"rg -il auth /\"").action((command) => runStandaloneCliCommand("Docs query failed", async ({ config }) => {
|
|
6634
|
+
const output = await withMcpReadClient(getDocsMcpUrl(config), (client) => callDocsTool(client, DOCS_QUERY_TOOL, { command }));
|
|
6635
|
+
process.stdout.write(`${output}\n`);
|
|
6636
|
+
}));
|
|
6637
|
+
}
|
|
6638
|
+
//#endregion
|
|
6639
|
+
//#region src/commands/docs/search.ts
|
|
6640
|
+
function registerDocsSearchCommand(docs) {
|
|
6641
|
+
docs.command("search").description("Search the Keystroke documentation for relevant pages and examples").argument("<query>", "Search query").action((query) => runStandaloneCliCommand("Docs search failed", async ({ config }) => {
|
|
6642
|
+
const output = await withMcpReadClient(getDocsMcpUrl(config), (client) => callDocsTool(client, DOCS_SEARCH_TOOL, { query }));
|
|
6643
|
+
process.stdout.write(`${output}\n`);
|
|
6644
|
+
}));
|
|
6645
|
+
}
|
|
6646
|
+
//#endregion
|
|
6647
|
+
//#region src/commands/docs/index.ts
|
|
6648
|
+
function registerDocsCommand(program) {
|
|
6649
|
+
const docs = program.command("docs").description("Search and read the Keystroke documentation");
|
|
6650
|
+
registerDocsSearchCommand(docs);
|
|
6651
|
+
registerDocsQueryCommand(docs);
|
|
6652
|
+
}
|
|
6653
|
+
//#endregion
|
|
6581
6654
|
//#region src/commands/history/run-history.ts
|
|
6582
6655
|
async function runHistoryList(config, filters) {
|
|
6583
6656
|
if (filters?.admin) await requireAdminRole(config);
|
|
@@ -6700,7 +6773,7 @@ const INIT_CATALOG_VERSIONS = {
|
|
|
6700
6773
|
vitest: "^4.1.7",
|
|
6701
6774
|
"@types/node": "^25.9.1"
|
|
6702
6775
|
};
|
|
6703
|
-
const INIT_KEYSTROKE_VERSION = "^0.1.
|
|
6776
|
+
const INIT_KEYSTROKE_VERSION = "^0.1.22";
|
|
6704
6777
|
//#endregion
|
|
6705
6778
|
//#region src/init/copy-template.ts
|
|
6706
6779
|
function renderTemplate(content, variables) {
|
|
@@ -6790,6 +6863,26 @@ async function applyPlaygroundManifest(targetDir, projectName, monorepoRoot) {
|
|
|
6790
6863
|
await writeFile(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}\n`);
|
|
6791
6864
|
}
|
|
6792
6865
|
//#endregion
|
|
6866
|
+
//#region src/skills/agents-guide-version.ts
|
|
6867
|
+
const BUNDLE_VERSION_FILENAME = ".bundle-version";
|
|
6868
|
+
const LEGACY_BUNDLE_VERSION_RELATIVE_PATH = join("skills", BUNDLE_VERSION_FILENAME);
|
|
6869
|
+
function agentsGuideDir(projectRoot) {
|
|
6870
|
+
return join(projectRoot, ".agents");
|
|
6871
|
+
}
|
|
6872
|
+
function bundleVersionPath(projectRoot) {
|
|
6873
|
+
return join(agentsGuideDir(projectRoot), BUNDLE_VERSION_FILENAME);
|
|
6874
|
+
}
|
|
6875
|
+
async function readBundleVersion(projectRoot) {
|
|
6876
|
+
for (const path of [bundleVersionPath(projectRoot), join(agentsGuideDir(projectRoot), LEGACY_BUNDLE_VERSION_RELATIVE_PATH)]) try {
|
|
6877
|
+
return (await readFile(path, "utf8")).trim();
|
|
6878
|
+
} catch {}
|
|
6879
|
+
return null;
|
|
6880
|
+
}
|
|
6881
|
+
async function writeBundleVersion(projectRoot) {
|
|
6882
|
+
await mkdir(agentsGuideDir(projectRoot), { recursive: true });
|
|
6883
|
+
await writeFile(bundleVersionPath(projectRoot), `${readCliVersion()}\n`);
|
|
6884
|
+
}
|
|
6885
|
+
//#endregion
|
|
6793
6886
|
//#region src/skills/resolve-skills-bundle-dir.ts
|
|
6794
6887
|
const SKILLS_BUNDLE = "skills-bundle";
|
|
6795
6888
|
function resolveSkillsBundleDir(fromModuleUrl = import.meta.url) {
|
|
@@ -6801,53 +6894,26 @@ function resolveSkillsBundleDir(fromModuleUrl = import.meta.url) {
|
|
|
6801
6894
|
join(cliRoot, SKILLS_BUNDLE)
|
|
6802
6895
|
];
|
|
6803
6896
|
for (const candidate of candidates) if (existsSync(join(candidate, "_AGENTS.md"))) return candidate;
|
|
6804
|
-
throw new Error("Bundled
|
|
6897
|
+
throw new Error("Bundled AGENTS guide not found — run `pnpm --filter @keystrokehq/cli build`");
|
|
6805
6898
|
}
|
|
6806
6899
|
//#endregion
|
|
6807
|
-
//#region src/skills/
|
|
6808
|
-
|
|
6809
|
-
function agentsSkillsDir(projectRoot) {
|
|
6810
|
-
return join(projectRoot, ".agents", "skills");
|
|
6811
|
-
}
|
|
6812
|
-
function bundleVersionPath(projectRoot) {
|
|
6813
|
-
return join(agentsSkillsDir(projectRoot), BUNDLE_VERSION_FILENAME);
|
|
6814
|
-
}
|
|
6815
|
-
async function readBundleVersion(projectRoot) {
|
|
6816
|
-
try {
|
|
6817
|
-
return (await readFile(bundleVersionPath(projectRoot), "utf8")).trim();
|
|
6818
|
-
} catch {
|
|
6819
|
-
return null;
|
|
6820
|
-
}
|
|
6821
|
-
}
|
|
6822
|
-
async function ensureSymlink(target, linkPath, kind) {
|
|
6900
|
+
//#region src/skills/scaffold-agents-guide.ts
|
|
6901
|
+
async function ensureSymlink(target, linkPath) {
|
|
6823
6902
|
await mkdir(dirname(linkPath), { recursive: true });
|
|
6824
6903
|
await rm(linkPath, {
|
|
6825
6904
|
recursive: true,
|
|
6826
6905
|
force: true
|
|
6827
6906
|
});
|
|
6828
|
-
await symlink(target, linkPath,
|
|
6907
|
+
await symlink(target, linkPath, "file");
|
|
6829
6908
|
}
|
|
6830
|
-
/**
|
|
6831
|
-
async function
|
|
6909
|
+
/** Writes AGENTS.md from the CLI bundle and recreates the CLAUDE.md symlink. */
|
|
6910
|
+
async function scaffoldAgentsGuide(projectRoot, fromModuleUrl = import.meta.url) {
|
|
6832
6911
|
const bundleDir = resolveSkillsBundleDir(fromModuleUrl);
|
|
6833
|
-
const skillsDir = agentsSkillsDir(projectRoot);
|
|
6834
6912
|
const agentsMdPath = join(projectRoot, "AGENTS.md");
|
|
6835
|
-
await mkdir(join(projectRoot, ".agents"), { recursive: true });
|
|
6836
|
-
if ((await lstat(skillsDir).catch(() => null))?.isSymbolicLink()) {
|
|
6837
|
-
await rm(skillsDir, { force: true });
|
|
6838
|
-
await cp(join(bundleDir, "skills"), skillsDir, { recursive: true });
|
|
6839
|
-
} else {
|
|
6840
|
-
await mkdir(skillsDir, { recursive: true });
|
|
6841
|
-
await cp(join(bundleDir, "skills"), skillsDir, {
|
|
6842
|
-
recursive: true,
|
|
6843
|
-
force: true
|
|
6844
|
-
});
|
|
6845
|
-
}
|
|
6846
6913
|
if ((await lstat(agentsMdPath).catch(() => null))?.isSymbolicLink()) await rm(agentsMdPath, { force: true });
|
|
6847
6914
|
await writeFile(agentsMdPath, await readFile(join(bundleDir, "_AGENTS.md"), "utf8"));
|
|
6848
|
-
await ensureSymlink(relative(dirname(join(projectRoot, ".
|
|
6849
|
-
await
|
|
6850
|
-
await writeFile(bundleVersionPath(projectRoot), `${readCliVersion()}\n`);
|
|
6915
|
+
await ensureSymlink(relative(dirname(join(projectRoot, "CLAUDE.md")), agentsMdPath), join(projectRoot, "CLAUDE.md"));
|
|
6916
|
+
await writeBundleVersion(projectRoot);
|
|
6851
6917
|
}
|
|
6852
6918
|
//#endregion
|
|
6853
6919
|
//#region src/init/scaffold-empty-src-dirs.ts
|
|
@@ -6948,7 +7014,7 @@ async function runInit(options) {
|
|
|
6948
7014
|
}
|
|
6949
7015
|
if (playgroundRoot) await applyPlaygroundManifest(targetDir, projectName, playgroundRoot);
|
|
6950
7016
|
else await scaffoldProjectDotfiles(targetDir);
|
|
6951
|
-
await
|
|
7017
|
+
await scaffoldAgentsGuide(targetDir);
|
|
6952
7018
|
await copyFile(join(targetDir, ".env.example"), join(targetDir, ".env"));
|
|
6953
7019
|
if (!options.skipInstall) if (playgroundRoot) {
|
|
6954
7020
|
installPlaygroundDependencies(targetDir);
|
|
@@ -7449,7 +7515,7 @@ async function runPull(options) {
|
|
|
7449
7515
|
}
|
|
7450
7516
|
await writeSourceTree(targetDir, source.files);
|
|
7451
7517
|
installDependencies(targetDir, detectProjectPackageManagerFromSnapshot(source.files));
|
|
7452
|
-
await
|
|
7518
|
+
await scaffoldAgentsGuide(targetDir);
|
|
7453
7519
|
await writePullState({
|
|
7454
7520
|
targetDir,
|
|
7455
7521
|
projectId: options.projectId,
|
|
@@ -7485,7 +7551,7 @@ async function runStart(options) {
|
|
|
7485
7551
|
const apiPort = Number(new URL(serverUrl).port || 80);
|
|
7486
7552
|
const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
|
|
7487
7553
|
ensureNativeDeps(runtimeNodeModules);
|
|
7488
|
-
const { buildApp } = await import("./dist-
|
|
7554
|
+
const { buildApp } = await import("./dist-CUEVu120.mjs");
|
|
7489
7555
|
await buildApp({
|
|
7490
7556
|
root,
|
|
7491
7557
|
clean: false
|
|
@@ -7988,20 +8054,20 @@ function registerSkillCommand(program) {
|
|
|
7988
8054
|
//#endregion
|
|
7989
8055
|
//#region src/commands/skills.ts
|
|
7990
8056
|
function registerSkillsCommand(program) {
|
|
7991
|
-
program.command("skills").description("Manage
|
|
8057
|
+
program.command("skills").description("Manage the scaffolded AGENTS guide").command("sync").description("Overwrite AGENTS.md with the CLI version").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
7992
8058
|
try {
|
|
7993
8059
|
const root = resolveProjectRoot(options.dir);
|
|
7994
|
-
await
|
|
7995
|
-
process.stdout.write(`Synced
|
|
8060
|
+
await scaffoldAgentsGuide(root);
|
|
8061
|
+
process.stdout.write(`Synced AGENTS.md at ${root}\n`);
|
|
7996
8062
|
} catch (error) {
|
|
7997
|
-
const message = error instanceof Error ? error.message : "
|
|
8063
|
+
const message = error instanceof Error ? error.message : "AGENTS guide sync failed";
|
|
7998
8064
|
process.stderr.write(`${message}\n`);
|
|
7999
8065
|
process.exitCode = 1;
|
|
8000
8066
|
}
|
|
8001
8067
|
});
|
|
8002
8068
|
}
|
|
8003
8069
|
//#endregion
|
|
8004
|
-
//#region src/skills/sync-
|
|
8070
|
+
//#region src/skills/sync-agents-guide.ts
|
|
8005
8071
|
function commandPath(command) {
|
|
8006
8072
|
const names = [];
|
|
8007
8073
|
for (let current = command; current; current = current.parent) {
|
|
@@ -8020,18 +8086,20 @@ function shouldSkipAutoSync(command) {
|
|
|
8020
8086
|
function resolveAutoSyncRoot(command) {
|
|
8021
8087
|
return resolveKeystrokeConfigRoot(command.opts().dir ?? process.cwd());
|
|
8022
8088
|
}
|
|
8023
|
-
/** Sync
|
|
8024
|
-
async function
|
|
8089
|
+
/** Sync AGENTS.md when stale; no-op when not in a project or already up to date. */
|
|
8090
|
+
async function syncAgentsGuide(command) {
|
|
8025
8091
|
if (shouldSkipAutoSync(command)) return;
|
|
8026
8092
|
const projectRoot = resolveAutoSyncRoot(command);
|
|
8027
8093
|
if (!projectRoot) return;
|
|
8028
|
-
const
|
|
8029
|
-
if (!existsSync(
|
|
8030
|
-
if (lstatSync(
|
|
8094
|
+
const agentsMdPath = join(projectRoot, "AGENTS.md");
|
|
8095
|
+
if (!existsSync(agentsMdPath)) return;
|
|
8096
|
+
if (lstatSync(agentsMdPath).isSymbolicLink()) return;
|
|
8097
|
+
const legacySkillsDir = join(agentsGuideDir(projectRoot), "skills");
|
|
8098
|
+
if (existsSync(legacySkillsDir) && lstatSync(legacySkillsDir).isSymbolicLink()) return;
|
|
8031
8099
|
const currentVersion = readCliVersion();
|
|
8032
8100
|
if (await readBundleVersion(projectRoot) === currentVersion) return;
|
|
8033
|
-
await
|
|
8034
|
-
process.stderr.write(`Synced
|
|
8101
|
+
await scaffoldAgentsGuide(projectRoot);
|
|
8102
|
+
process.stderr.write(`Synced AGENTS.md to ${currentVersion}\n`);
|
|
8035
8103
|
}
|
|
8036
8104
|
//#endregion
|
|
8037
8105
|
//#region src/program.ts
|
|
@@ -8042,7 +8110,7 @@ function createProgram() {
|
|
|
8042
8110
|
projectId: opts.project,
|
|
8043
8111
|
local: opts.local
|
|
8044
8112
|
});
|
|
8045
|
-
await
|
|
8113
|
+
await syncAgentsGuide(actionCommand);
|
|
8046
8114
|
});
|
|
8047
8115
|
registerAuthCommand(program);
|
|
8048
8116
|
registerConnectCommand(program);
|
|
@@ -8053,6 +8121,7 @@ function createProgram() {
|
|
|
8053
8121
|
registerHistoryCommand(program);
|
|
8054
8122
|
registerCredentialsCommand(program);
|
|
8055
8123
|
registerHealthCommand(program);
|
|
8124
|
+
registerDocsCommand(program);
|
|
8056
8125
|
registerInitCommand(program);
|
|
8057
8126
|
registerSkillsCommand(program);
|
|
8058
8127
|
registerSkillCommand(program);
|
|
@@ -8069,7 +8138,7 @@ function createProgram() {
|
|
|
8069
8138
|
return program;
|
|
8070
8139
|
}
|
|
8071
8140
|
async function runCli(argv) {
|
|
8072
|
-
const { maybeAutoUpdate } = await import("./maybe-auto-update-
|
|
8141
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-q5MthdI8.mjs");
|
|
8073
8142
|
await maybeAutoUpdate(argv);
|
|
8074
8143
|
createProgram().parse(argv);
|
|
8075
8144
|
}
|