@keystrokehq/cli 0.1.58 → 0.1.59

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. */
@@ -8091,7 +8084,7 @@ async function runPull(options) {
8091
8084
  function registerPullCommand(program) {
8092
8085
  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
8086
  const config = createCliConfig();
8094
- const projectId = await resolveActiveProjectId(config, resolveProjectRoot(options.dir));
8087
+ const projectId = await resolveActiveProjectId(config, options.dir);
8095
8088
  if (!projectId) throw new Error("Usage: keystroke pull --project <slug>");
8096
8089
  await runPull({
8097
8090
  client: createCliPlatformClient(config),