@mrciphersmith/keryx 0.2.81 → 0.2.82

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/cli.js +48 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -36259,7 +36259,7 @@ async function loginDeviceCode(input) {
36259
36259
  saveOAuthGrant(input.provider, grantFromTokens("device-code", tokens, input.now), input.dir);
36260
36260
  return { ok: true, provider: input.provider };
36261
36261
  } catch (err) {
36262
- const message = err instanceof DeviceCodeError ? err.message : "device authorization failed";
36262
+ const message = err instanceof DeviceCodeError ? err.message : err instanceof Error ? err.message : "device authorization failed";
36263
36263
  return { ok: false, error: message };
36264
36264
  }
36265
36265
  }
@@ -70772,11 +70772,11 @@ async function runGoalCommand(params) {
70772
70772
 
70773
70773
  // src/tui/tui-shell.ts
70774
70774
  init_metaproject_adapter();
70775
- import { spawn as spawn5, spawnSync as spawnSync2 } from "child_process";
70775
+ import { spawnSync as spawnSync2 } from "child_process";
70776
70776
  // package.json
70777
70777
  var package_default = {
70778
70778
  name: "@mrciphersmith/keryx",
70779
- version: "0.2.81",
70779
+ version: "0.2.82",
70780
70780
  description: "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
70781
70781
  private: false,
70782
70782
  publishConfig: {
@@ -75635,6 +75635,41 @@ init_patch_risk();
75635
75635
  init_catalog();
75636
75636
  init_grants();
75637
75637
  init_login();
75638
+
75639
+ // src/lib/oauth/open-url.ts
75640
+ import { spawn as spawn5 } from "child_process";
75641
+ function browserOpenPlan(url, platform = process.platform, env = process.env) {
75642
+ if (url.length === 0) {
75643
+ return;
75644
+ }
75645
+ if (platform === "darwin") {
75646
+ return { cmd: "open", args: [url] };
75647
+ }
75648
+ if (platform === "win32") {
75649
+ return { cmd: "cmd", args: ["/c", "start", "", url] };
75650
+ }
75651
+ if (typeof env.DISPLAY === "string" && env.DISPLAY.length > 0) {
75652
+ return { cmd: "xdg-open", args: [url] };
75653
+ }
75654
+ if (typeof env.WAYLAND_DISPLAY === "string" && env.WAYLAND_DISPLAY.length > 0) {
75655
+ return { cmd: "xdg-open", args: [url] };
75656
+ }
75657
+ return;
75658
+ }
75659
+ function openVerificationUrl(url, deps = {}) {
75660
+ const plan = browserOpenPlan(url, deps.platform ?? process.platform, deps.env ?? process.env);
75661
+ if (plan === undefined) {
75662
+ return;
75663
+ }
75664
+ const spawnFn = deps.spawn ?? spawn5;
75665
+ try {
75666
+ const child = spawnFn(plan.cmd, plan.args, { stdio: "ignore", detached: true });
75667
+ child.on("error", () => {});
75668
+ child.unref();
75669
+ } catch {}
75670
+ }
75671
+
75672
+ // src/tui/tui-shell.ts
75638
75673
  init_shell_config();
75639
75674
  init_provider_config();
75640
75675
 
@@ -80094,26 +80129,26 @@ function runDeviceLoginInTui(otui, r, provider) {
80094
80129
  fetch: (input, init) => globalThis.fetch(input, init),
80095
80130
  signal: controller.signal,
80096
80131
  onChallenge: (challenge) => {
80097
- status.content = otui.t`${otui.bold(challenge.userCode)}\n${otui.dim(challenge.verificationUri)}\n${otui.dim("Waiting for authorization\u2026")}`;
80098
- const url = challenge.verificationUriComplete ?? challenge.verificationUri;
80099
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? undefined : "xdg-open";
80100
- if (cmd !== undefined) {
80101
- try {
80102
- spawn5(cmd, [url], { stdio: "ignore", detached: true }).unref();
80103
- } catch {}
80104
- }
80132
+ status.content = otui.t`${otui.bold(challenge.userCode)}\n${otui.dim(challenge.verificationUri)}\n${otui.dim("Open that URL on any device and enter the code. Waiting for authorization\u2026")}`;
80133
+ openVerificationUrl(challenge.verificationUriComplete ?? challenge.verificationUri);
80105
80134
  }
80106
80135
  }).then((result) => {
80107
80136
  if (controller.signal.aborted) {
80108
80137
  return;
80109
80138
  }
80110
- cleanup();
80111
80139
  if (result.ok) {
80140
+ cleanup();
80112
80141
  applyOAuthAccessToEnv();
80113
80142
  resolve(true);
80114
80143
  return;
80115
80144
  }
80116
- resolve(false);
80145
+ status.content = otui.t`${otui.red("\u2717")} ${otui.bold(result.error)} ${otui.dim("(Esc to go back)")}`;
80146
+ }).catch((err) => {
80147
+ if (controller.signal.aborted) {
80148
+ return;
80149
+ }
80150
+ const message = err instanceof Error ? err.message : "device authorization failed";
80151
+ status.content = otui.t`${otui.red("\u2717")} ${otui.bold(message)} ${otui.dim("(Esc to go back)")}`;
80117
80152
  });
80118
80153
  });
80119
80154
  }
@@ -90567,7 +90602,6 @@ init_providers();
90567
90602
  init_catalog();
90568
90603
  init_grants();
90569
90604
  init_login();
90570
- import { spawn as spawn8 } from "child_process";
90571
90605
  function printAuthHelp() {
90572
90606
  console.log(`Usage:
90573
90607
  keryx auth list [--json]
@@ -90579,13 +90613,6 @@ Providers with a sanctioned subscription login: grok (SuperGrok), openai (ChatGP
90579
90613
  Claude Pro/Max, Gemini Google-account login, and DeepSeek OAuth are not offered.
90580
90614
  `);
90581
90615
  }
90582
- function openVerificationUrl(url) {
90583
- const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
90584
- const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
90585
- try {
90586
- spawn8(cmd, args, { stdio: "ignore", detached: true }).unref();
90587
- } catch {}
90588
- }
90589
90616
  async function authCommand(args) {
90590
90617
  const command = args[0];
90591
90618
  if (!command || command === "--help" || command === "-h") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.2.81",
3
+ "version": "0.2.82",
4
4
  "description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
5
5
  "private": false,
6
6
  "publishConfig": {