synthesisui 0.4.12 → 0.4.13

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.
@@ -1,16 +1,24 @@
1
1
  import { spawn } from "node:child_process";
2
+ import { release } from "node:os";
2
3
  import { resolveRegistry, writeToken } from "../config.js";
3
4
  import { RegistryError } from "../registry.js";
4
5
  const CLIENT_ID = "synthesisui-cli";
5
6
  const GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
6
7
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
8
+ /** True inside WSL, where xdg-open usually does nothing - the Windows host
9
+ * must open the browser instead. */
10
+ function isWsl() {
11
+ return process.platform === "linux" && /microsoft/i.test(release());
12
+ }
7
13
  /** Tries to open the OS browser; silent if it fails. */
8
14
  function openBrowser(url) {
9
15
  const [cmd, args] = process.platform === "darwin"
10
16
  ? ["open", [url]]
11
17
  : process.platform === "win32"
12
18
  ? ["cmd", ["/c", "start", "", url]]
13
- : ["xdg-open", [url]];
19
+ : isWsl()
20
+ ? ["powershell.exe", ["-NoProfile", "Start-Process", `"${url}"`]]
21
+ : ["xdg-open", [url]];
14
22
  try {
15
23
  const child = spawn(cmd, args, {
16
24
  stdio: "ignore",
@@ -38,9 +46,12 @@ export async function login(opts) {
38
46
  : ". Check the URL and your connection."));
39
47
  }
40
48
  const code = (await codeRes.json());
49
+ // The manual path prints the COMPLETE url (code embedded) - on machines
50
+ // where the browser cannot auto-open (WSL, ssh, containers) the user
51
+ // copies ONE link and lands with the code pre-filled, Vercel-style.
41
52
  console.log("\nTo connect the CLI to your account:");
42
- console.log(` 1. open: ${code.verification_uri}`);
43
- console.log(` 2. confirm the code: ${code.user_code}\n`);
53
+ console.log(` 1. open: ${code.verification_uri_complete}`);
54
+ console.log(` 2. it should show the code: ${code.user_code} - confirm.\n`);
44
55
  console.log("(trying to open the browser…)");
45
56
  openBrowser(code.verification_uri_complete);
46
57
  let interval = (code.interval || 5) * 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "synthesisui",
3
- "version": "0.4.12",
3
+ "version": "0.4.13",
4
4
  "description": "Bring SynthesisUI design systems into any project - tokens, typed components, whole pages and an agent-ready CLAUDE.md manifest.",
5
5
  "type": "module",
6
6
  "bin": {