@keystrokehq/cli 0.1.24 → 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/index.mjs +46 -52
- package/dist/index.mjs.map +1 -1
- package/dist/skills-bundle/_AGENTS.md +1 -1
- package/package.json +3 -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 -85
- 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
|
@@ -4,12 +4,11 @@ import { i as packProjectArtifact, n as withMcpReadClient, r as mergeFilteredArt
|
|
|
4
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
|
|
@@ -6864,6 +6863,26 @@ async function applyPlaygroundManifest(targetDir, projectName, monorepoRoot) {
|
|
|
6864
6863
|
await writeFile(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}\n`);
|
|
6865
6864
|
}
|
|
6866
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
|
|
6867
6886
|
//#region src/skills/resolve-skills-bundle-dir.ts
|
|
6868
6887
|
const SKILLS_BUNDLE = "skills-bundle";
|
|
6869
6888
|
function resolveSkillsBundleDir(fromModuleUrl = import.meta.url) {
|
|
@@ -6875,53 +6894,26 @@ function resolveSkillsBundleDir(fromModuleUrl = import.meta.url) {
|
|
|
6875
6894
|
join(cliRoot, SKILLS_BUNDLE)
|
|
6876
6895
|
];
|
|
6877
6896
|
for (const candidate of candidates) if (existsSync(join(candidate, "_AGENTS.md"))) return candidate;
|
|
6878
|
-
throw new Error("Bundled
|
|
6897
|
+
throw new Error("Bundled AGENTS guide not found — run `pnpm --filter @keystrokehq/cli build`");
|
|
6879
6898
|
}
|
|
6880
6899
|
//#endregion
|
|
6881
|
-
//#region src/skills/
|
|
6882
|
-
|
|
6883
|
-
function agentsSkillsDir(projectRoot) {
|
|
6884
|
-
return join(projectRoot, ".agents", "skills");
|
|
6885
|
-
}
|
|
6886
|
-
function bundleVersionPath(projectRoot) {
|
|
6887
|
-
return join(agentsSkillsDir(projectRoot), BUNDLE_VERSION_FILENAME);
|
|
6888
|
-
}
|
|
6889
|
-
async function readBundleVersion(projectRoot) {
|
|
6890
|
-
try {
|
|
6891
|
-
return (await readFile(bundleVersionPath(projectRoot), "utf8")).trim();
|
|
6892
|
-
} catch {
|
|
6893
|
-
return null;
|
|
6894
|
-
}
|
|
6895
|
-
}
|
|
6896
|
-
async function ensureSymlink(target, linkPath, kind) {
|
|
6900
|
+
//#region src/skills/scaffold-agents-guide.ts
|
|
6901
|
+
async function ensureSymlink(target, linkPath) {
|
|
6897
6902
|
await mkdir(dirname(linkPath), { recursive: true });
|
|
6898
6903
|
await rm(linkPath, {
|
|
6899
6904
|
recursive: true,
|
|
6900
6905
|
force: true
|
|
6901
6906
|
});
|
|
6902
|
-
await symlink(target, linkPath,
|
|
6907
|
+
await symlink(target, linkPath, "file");
|
|
6903
6908
|
}
|
|
6904
|
-
/**
|
|
6905
|
-
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) {
|
|
6906
6911
|
const bundleDir = resolveSkillsBundleDir(fromModuleUrl);
|
|
6907
|
-
const skillsDir = agentsSkillsDir(projectRoot);
|
|
6908
6912
|
const agentsMdPath = join(projectRoot, "AGENTS.md");
|
|
6909
|
-
await mkdir(join(projectRoot, ".agents"), { recursive: true });
|
|
6910
|
-
if ((await lstat(skillsDir).catch(() => null))?.isSymbolicLink()) {
|
|
6911
|
-
await rm(skillsDir, { force: true });
|
|
6912
|
-
await cp(join(bundleDir, "skills"), skillsDir, { recursive: true });
|
|
6913
|
-
} else {
|
|
6914
|
-
await mkdir(skillsDir, { recursive: true });
|
|
6915
|
-
await cp(join(bundleDir, "skills"), skillsDir, {
|
|
6916
|
-
recursive: true,
|
|
6917
|
-
force: true
|
|
6918
|
-
});
|
|
6919
|
-
}
|
|
6920
6913
|
if ((await lstat(agentsMdPath).catch(() => null))?.isSymbolicLink()) await rm(agentsMdPath, { force: true });
|
|
6921
6914
|
await writeFile(agentsMdPath, await readFile(join(bundleDir, "_AGENTS.md"), "utf8"));
|
|
6922
|
-
await ensureSymlink(relative(dirname(join(projectRoot, ".
|
|
6923
|
-
await
|
|
6924
|
-
await writeFile(bundleVersionPath(projectRoot), `${readCliVersion()}\n`);
|
|
6915
|
+
await ensureSymlink(relative(dirname(join(projectRoot, "CLAUDE.md")), agentsMdPath), join(projectRoot, "CLAUDE.md"));
|
|
6916
|
+
await writeBundleVersion(projectRoot);
|
|
6925
6917
|
}
|
|
6926
6918
|
//#endregion
|
|
6927
6919
|
//#region src/init/scaffold-empty-src-dirs.ts
|
|
@@ -7022,7 +7014,7 @@ async function runInit(options) {
|
|
|
7022
7014
|
}
|
|
7023
7015
|
if (playgroundRoot) await applyPlaygroundManifest(targetDir, projectName, playgroundRoot);
|
|
7024
7016
|
else await scaffoldProjectDotfiles(targetDir);
|
|
7025
|
-
await
|
|
7017
|
+
await scaffoldAgentsGuide(targetDir);
|
|
7026
7018
|
await copyFile(join(targetDir, ".env.example"), join(targetDir, ".env"));
|
|
7027
7019
|
if (!options.skipInstall) if (playgroundRoot) {
|
|
7028
7020
|
installPlaygroundDependencies(targetDir);
|
|
@@ -7523,7 +7515,7 @@ async function runPull(options) {
|
|
|
7523
7515
|
}
|
|
7524
7516
|
await writeSourceTree(targetDir, source.files);
|
|
7525
7517
|
installDependencies(targetDir, detectProjectPackageManagerFromSnapshot(source.files));
|
|
7526
|
-
await
|
|
7518
|
+
await scaffoldAgentsGuide(targetDir);
|
|
7527
7519
|
await writePullState({
|
|
7528
7520
|
targetDir,
|
|
7529
7521
|
projectId: options.projectId,
|
|
@@ -8062,20 +8054,20 @@ function registerSkillCommand(program) {
|
|
|
8062
8054
|
//#endregion
|
|
8063
8055
|
//#region src/commands/skills.ts
|
|
8064
8056
|
function registerSkillsCommand(program) {
|
|
8065
|
-
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) => {
|
|
8066
8058
|
try {
|
|
8067
8059
|
const root = resolveProjectRoot(options.dir);
|
|
8068
|
-
await
|
|
8069
|
-
process.stdout.write(`Synced
|
|
8060
|
+
await scaffoldAgentsGuide(root);
|
|
8061
|
+
process.stdout.write(`Synced AGENTS.md at ${root}\n`);
|
|
8070
8062
|
} catch (error) {
|
|
8071
|
-
const message = error instanceof Error ? error.message : "
|
|
8063
|
+
const message = error instanceof Error ? error.message : "AGENTS guide sync failed";
|
|
8072
8064
|
process.stderr.write(`${message}\n`);
|
|
8073
8065
|
process.exitCode = 1;
|
|
8074
8066
|
}
|
|
8075
8067
|
});
|
|
8076
8068
|
}
|
|
8077
8069
|
//#endregion
|
|
8078
|
-
//#region src/skills/sync-
|
|
8070
|
+
//#region src/skills/sync-agents-guide.ts
|
|
8079
8071
|
function commandPath(command) {
|
|
8080
8072
|
const names = [];
|
|
8081
8073
|
for (let current = command; current; current = current.parent) {
|
|
@@ -8094,18 +8086,20 @@ function shouldSkipAutoSync(command) {
|
|
|
8094
8086
|
function resolveAutoSyncRoot(command) {
|
|
8095
8087
|
return resolveKeystrokeConfigRoot(command.opts().dir ?? process.cwd());
|
|
8096
8088
|
}
|
|
8097
|
-
/** Sync
|
|
8098
|
-
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) {
|
|
8099
8091
|
if (shouldSkipAutoSync(command)) return;
|
|
8100
8092
|
const projectRoot = resolveAutoSyncRoot(command);
|
|
8101
8093
|
if (!projectRoot) return;
|
|
8102
|
-
const
|
|
8103
|
-
if (!existsSync(
|
|
8104
|
-
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;
|
|
8105
8099
|
const currentVersion = readCliVersion();
|
|
8106
8100
|
if (await readBundleVersion(projectRoot) === currentVersion) return;
|
|
8107
|
-
await
|
|
8108
|
-
process.stderr.write(`Synced
|
|
8101
|
+
await scaffoldAgentsGuide(projectRoot);
|
|
8102
|
+
process.stderr.write(`Synced AGENTS.md to ${currentVersion}\n`);
|
|
8109
8103
|
}
|
|
8110
8104
|
//#endregion
|
|
8111
8105
|
//#region src/program.ts
|
|
@@ -8116,7 +8110,7 @@ function createProgram() {
|
|
|
8116
8110
|
projectId: opts.project,
|
|
8117
8111
|
local: opts.local
|
|
8118
8112
|
});
|
|
8119
|
-
await
|
|
8113
|
+
await syncAgentsGuide(actionCommand);
|
|
8120
8114
|
});
|
|
8121
8115
|
registerAuthCommand(program);
|
|
8122
8116
|
registerConnectCommand(program);
|