@keystrokehq/cli 0.1.58 → 0.1.60

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 CHANGED
@@ -4974,18 +4974,24 @@ async function ensureActiveOrganization(config) {
4974
4974
  throw new Error("No active organization. Run `keystroke auth login` or `keystroke config use org`.");
4975
4975
  }
4976
4976
  //#endregion
4977
- //#region src/project/resolve-project-root.ts
4978
- function hasProjectLayout(dir) {
4979
- return existsSync(join(dir, "package.json")) && existsSync(join(dir, "src", "agents"));
4980
- }
4981
- function resolveProjectRoot(fromDir = process.cwd()) {
4977
+ //#region src/project/resolve-keystroke-config-root.ts
4978
+ const KEYSTROKE_CONFIG$2 = "keystroke.config.ts";
4979
+ /** Walk up from `fromDir` and return the directory containing `keystroke.config.ts`, if any. */
4980
+ function resolveKeystrokeConfigRoot(fromDir = process.cwd()) {
4982
4981
  let dir = resolve(fromDir);
4983
4982
  while (dir !== dirname(dir)) {
4984
- if (hasProjectLayout(dir)) return dir;
4983
+ if (existsSync(join(dir, KEYSTROKE_CONFIG$2))) return dir;
4985
4984
  dir = dirname(dir);
4986
4985
  }
4987
- if (hasProjectLayout(dir)) return dir;
4988
- throw new Error("Could not find keystroke project root (expected package.json and src/agents/)");
4986
+ if (existsSync(join(dir, KEYSTROKE_CONFIG$2))) return dir;
4987
+ return null;
4988
+ }
4989
+ //#endregion
4990
+ //#region src/project/resolve-project-root.ts
4991
+ function resolveProjectRoot(fromDir = process.cwd()) {
4992
+ const root = resolveKeystrokeConfigRoot(fromDir);
4993
+ if (!root) throw new Error("Could not find keystroke project root (expected keystroke.config.ts)");
4994
+ return root;
4989
4995
  }
4990
4996
  //#endregion
4991
4997
  //#region src/project/load-project-env.ts
@@ -5054,19 +5060,6 @@ function readDevSession(configDir = getCliConfigDir()) {
5054
5060
  }
5055
5061
  }
5056
5062
  //#endregion
5057
- //#region src/project/resolve-keystroke-config-root.ts
5058
- const KEYSTROKE_CONFIG$2 = "keystroke.config.ts";
5059
- /** Walk up from `fromDir` and return the directory containing `keystroke.config.ts`, if any. */
5060
- function resolveKeystrokeConfigRoot(fromDir = process.cwd()) {
5061
- let dir = resolve(fromDir);
5062
- while (dir !== dirname(dir)) {
5063
- if (existsSync(join(dir, KEYSTROKE_CONFIG$2))) return dir;
5064
- dir = dirname(dir);
5065
- }
5066
- if (existsSync(join(dir, KEYSTROKE_CONFIG$2))) return dir;
5067
- return null;
5068
- }
5069
- //#endregion
5070
5063
  //#region src/project/read-project-config.ts
5071
5064
  const KEYSTROKE_CONFIG$1 = "keystroke.config.ts";
5072
5065
  /** Remove line and block comments before scanning config literals. */
@@ -6581,22 +6574,21 @@ function readPackageJson(root) {
6581
6574
  return;
6582
6575
  }
6583
6576
  }
6584
- /** Exact semver pins and local/workspace specs are left alone; everything else floats to latest. */
6585
- function isPinnedSdkSpec(spec) {
6577
+ /** Local/workspace specs are left alone; everything else (ranges and exact pins) updates to latest. */
6578
+ function isLocalSdkSpec(spec) {
6586
6579
  if (!spec) return true;
6587
6580
  const trimmed = spec.trim();
6588
- if (trimmed.startsWith("workspace:") || trimmed.startsWith("link:") || trimmed.startsWith("file:")) return true;
6589
- return /^\d+\.\d+\.\d+(-[\w.]+)?(\+[\w.]+)?$/.test(trimmed);
6581
+ return trimmed.startsWith("workspace:") || trimmed.startsWith("link:") || trimmed.startsWith("file:");
6590
6582
  }
6591
- function listFloatingKeystrokePackages(root) {
6583
+ function listUpdatableKeystrokePackages(root) {
6592
6584
  const pkg = readPackageJson(root);
6593
6585
  if (!pkg) return [];
6594
6586
  const packages = [];
6595
- for (const [name, spec] of Object.entries(pkg.dependencies ?? {})) if (name.startsWith(KEYSTROKE_SCOPE) && !isPinnedSdkSpec(spec)) packages.push({
6587
+ for (const [name, spec] of Object.entries(pkg.dependencies ?? {})) if (name.startsWith(KEYSTROKE_SCOPE) && !isLocalSdkSpec(spec)) packages.push({
6596
6588
  name,
6597
6589
  dev: false
6598
6590
  });
6599
- for (const [name, spec] of Object.entries(pkg.devDependencies ?? {})) if (name.startsWith(KEYSTROKE_SCOPE) && !isPinnedSdkSpec(spec)) packages.push({
6591
+ for (const [name, spec] of Object.entries(pkg.devDependencies ?? {})) if (name.startsWith(KEYSTROKE_SCOPE) && !isLocalSdkSpec(spec)) packages.push({
6600
6592
  name,
6601
6593
  dev: true
6602
6594
  });
@@ -6625,12 +6617,12 @@ function warnReleaseAgeBlock(packageName) {
6625
6617
  process.stderr.write(`Warning: ${packageName}@latest is held back by your minimum-release-age setting; continuing with the currently installed version.\n`);
6626
6618
  }
6627
6619
  /**
6628
- * Keep floating @keystrokehq/* project dependencies on latest before build/deploy.
6620
+ * Keep @keystrokehq/* project dependencies on latest before build/deploy.
6629
6621
  * The package manager no-ops when already current; minimum-release-age failures warn only.
6630
6622
  */
6631
6623
  function ensureSdkCurrent(root) {
6632
6624
  if (shouldSkip()) return;
6633
- const packages = listFloatingKeystrokePackages(root);
6625
+ const packages = listUpdatableKeystrokePackages(root);
6634
6626
  if (packages.length === 0) return;
6635
6627
  const manager = detectManagerFromLockfile(root) ?? detectPackageManager();
6636
6628
  const token = resolveGithubPackagesToken();
@@ -8091,7 +8083,7 @@ async function runPull(options) {
8091
8083
  function registerPullCommand(program) {
8092
8084
  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 () => {
8093
8085
  const config = createCliConfig();
8094
- const projectId = await resolveActiveProjectId(config, resolveProjectRoot(options.dir));
8086
+ const projectId = await resolveActiveProjectId(config, options.dir);
8095
8087
  if (!projectId) throw new Error("Usage: keystroke pull --project <slug>");
8096
8088
  await runPull({
8097
8089
  client: createCliPlatformClient(config),