@kryd/cli 0.5.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -12
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -14894,8 +14894,9 @@ function isTerminalResourceStatus(status) {
14894
14894
  }
14895
14895
 
14896
14896
  // src/index.ts
14897
- import { existsSync as existsSync3 } from "node:fs";
14897
+ import { existsSync as existsSync3, realpathSync } from "node:fs";
14898
14898
  import { isAbsolute, relative, resolve } from "node:path";
14899
+ import { pathToFileURL } from "node:url";
14899
14900
 
14900
14901
  // src/config.ts
14901
14902
  import {
@@ -15064,6 +15065,7 @@ function browserLogin(dashboardUrl, opts = {}) {
15064
15065
  fn();
15065
15066
  };
15066
15067
  const server = createServer((req, res) => {
15068
+ res.setHeader("connection", "close");
15067
15069
  const reqUrl = new URL(req.url ?? "/", "http://127.0.0.1");
15068
15070
  if (reqUrl.pathname !== "/callback") {
15069
15071
  res.writeHead(404);
@@ -15075,20 +15077,26 @@ function browserLogin(dashboardUrl, opts = {}) {
15075
15077
  const gotState = reqUrl.searchParams.get("state");
15076
15078
  if (!token || gotState !== state) {
15077
15079
  res.writeHead(400, { "content-type": "text/html" });
15078
- res.end(FAIL_HTML);
15079
- settle(() => {
15080
- server.close();
15081
- reject(new Error("Login failed \u2014 the approval didn't match this request. Try `kryd login` again."));
15080
+ res.end(FAIL_HTML, () => {
15081
+ settle(() => {
15082
+ shutdown();
15083
+ reject(new Error("Login failed \u2014 the approval didn't match this request. Try `kryd login` again."));
15084
+ });
15082
15085
  });
15083
15086
  return;
15084
15087
  }
15085
15088
  res.writeHead(200, { "content-type": "text/html" });
15086
- res.end(SUCCESS_HTML);
15087
- settle(() => {
15088
- server.close();
15089
- resolve2({ token, ...apiUrl ? { apiUrl } : {} });
15089
+ res.end(SUCCESS_HTML, () => {
15090
+ settle(() => {
15091
+ shutdown();
15092
+ resolve2({ token, ...apiUrl ? { apiUrl } : {} });
15093
+ });
15090
15094
  });
15091
15095
  });
15096
+ const shutdown = () => {
15097
+ server.closeAllConnections();
15098
+ server.close();
15099
+ };
15092
15100
  server.on("error", (err) => settle(() => reject(err)));
15093
15101
  server.listen(0, "127.0.0.1", () => {
15094
15102
  const port = server.address().port;
@@ -15105,7 +15113,7 @@ Waiting for approval\u2026
15105
15113
  });
15106
15114
  setTimeout(
15107
15115
  () => settle(() => {
15108
- server.close();
15116
+ shutdown();
15109
15117
  reject(new Error("Login timed out after 2 minutes."));
15110
15118
  }),
15111
15119
  timeoutMs
@@ -17658,7 +17666,7 @@ Run \`kryd env list\` to see what is set. (If you meant the runtime variable of
17658
17666
  reportError(err);
17659
17667
  }
17660
17668
  }
17661
- var CLI_VERSION = true ? "0.5.0" : "0.0.0-dev";
17669
+ var CLI_VERSION = true ? "0.5.1" : "0.0.0-dev";
17662
17670
  var program = new Command();
17663
17671
  program.name("kryd").description("Kryd CLI").version(CLI_VERSION);
17664
17672
  program.command("login").description("Sign in via the browser (default) and store a token").option("--email <email>", "account email (with --password; non-interactive escape hatch)").option("--password <password>", "account password (with --email; visible in `ps` \u2014 prefer the browser flow)").option(
@@ -17750,7 +17758,16 @@ env.command("pull [project]").description(
17750
17758
  ).option("--force", "overwrite the --out file if it already exists").option("--api-url <url>", "control-plane API base URL").action((project2, opts) => runEnvPull({ ...opts, project: project2 }));
17751
17759
  var ai = program.command("ai").description("Manage the app's EU AI gateway");
17752
17760
  ai.command("enable [project]").description("Give the project an authenticated EU AI endpoint (injects on next deploy)").option("--api-url <url>", "control-plane API base URL").action((project2, opts) => runAiEnable({ ...opts, project: project2 }));
17753
- if (import.meta.url === `file://${process.argv[1]}`) {
17761
+ function invokedDirectly() {
17762
+ const entry = process.argv[1];
17763
+ if (!entry) return false;
17764
+ try {
17765
+ return import.meta.url === pathToFileURL(realpathSync(entry)).href;
17766
+ } catch {
17767
+ return false;
17768
+ }
17769
+ }
17770
+ if (invokedDirectly()) {
17754
17771
  program.parseAsync().catch((err) => {
17755
17772
  process.stderr.write(
17756
17773
  `${err instanceof Error ? err.message : String(err)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kryd/cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Kryd CLI — push a React / Vite / Next.js app to the European cloud for your AI: git push → live with SSL, one-click managed Postgres & object storage, and an EU-hosted AI gateway already wired in. Your code and your model calls stay in the EU.",
5
5
  "keywords": [
6
6
  "kryd",
@@ -58,6 +58,7 @@
58
58
  "typecheck": "tsc -p tsconfig.json --noEmit",
59
59
  "lint": "eslint src",
60
60
  "test": "vitest run",
61
+ "smoke": "bash scripts/smoke-package.sh",
61
62
  "dev": "tsx src/index.ts"
62
63
  }
63
64
  }