@synkro-sh/cli 1.3.54 → 1.3.56

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/bootstrap.js CHANGED
@@ -3516,7 +3516,7 @@ __export(setupGithub_exports, {
3516
3516
  import { createInterface as createInterface2 } from "readline/promises";
3517
3517
  import { stdin as input, stdout as output } from "process";
3518
3518
  import { execSync as execSync3, spawn as nodeSpawn } from "child_process";
3519
- import { existsSync as existsSync6, readFileSync as readFileSync4 } from "fs";
3519
+ import { existsSync as existsSync6, readFileSync as readFileSync4, unlinkSync as unlinkSync3 } from "fs";
3520
3520
  import { homedir as homedir4, platform as platform2 } from "os";
3521
3521
  import { join as join5 } from "path";
3522
3522
  import { execFile as execFile2 } from "child_process";
@@ -3584,38 +3584,33 @@ function sleep(ms) {
3584
3584
  return new Promise((r) => setTimeout(r, ms));
3585
3585
  }
3586
3586
  function captureClaudeSetupToken() {
3587
+ const tmpFile = join5(SYNKRO_DIR, `token-capture-${Date.now()}.raw`);
3587
3588
  return new Promise((resolve2, reject) => {
3588
- const proc = nodeSpawn("script", ["-q", "/dev/null", "claude", "setup-token"], {
3589
- stdio: ["inherit", "pipe", "inherit"]
3589
+ const proc = nodeSpawn("script", ["-q", tmpFile, "claude", "setup-token"], {
3590
+ stdio: "inherit"
3590
3591
  });
3591
- let stdout = "";
3592
- let streamEnded = false;
3593
- let exitCode = null;
3594
- const tryResolve = () => {
3595
- if (!streamEnded || exitCode === null) return;
3596
- if (exitCode !== 0) {
3597
- reject(new Error(`claude setup-token exited with code ${exitCode}`));
3592
+ proc.on("error", (err) => reject(new Error(`Failed to spawn claude setup-token: ${err.message}`)));
3593
+ proc.on("close", (code) => {
3594
+ let raw = "";
3595
+ try {
3596
+ raw = readFileSync4(tmpFile, "utf-8");
3597
+ } catch {
3598
+ }
3599
+ try {
3600
+ unlinkSync3(tmpFile);
3601
+ } catch {
3602
+ }
3603
+ if (code !== 0) {
3604
+ reject(new Error(`claude setup-token exited with code ${code}`));
3598
3605
  return;
3599
3606
  }
3600
- const stripped = stdout.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\][^\x07]*\x07/g, "");
3607
+ const stripped = raw.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\][^\x07]*\x07/g, "");
3601
3608
  const match = stripped.replace(/\s/g, "").match(/sk-ant-oat01-[A-Za-z0-9_-]+AAA/);
3602
3609
  if (!match) {
3603
3610
  reject(new Error("Could not find token in claude setup-token output"));
3604
3611
  return;
3605
3612
  }
3606
3613
  resolve2(match[0]);
3607
- };
3608
- proc.stdout.on("data", (chunk) => {
3609
- stdout += chunk.toString();
3610
- });
3611
- proc.stdout.on("end", () => {
3612
- streamEnded = true;
3613
- tryResolve();
3614
- });
3615
- proc.on("error", (err) => reject(new Error(`Failed to spawn claude setup-token: ${err.message}`)));
3616
- proc.on("close", (code) => {
3617
- exitCode = code ?? 1;
3618
- tryResolve();
3619
3614
  });
3620
3615
  });
3621
3616
  }
@@ -3985,7 +3980,7 @@ function writeConfigEnv(opts) {
3985
3980
  `SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
3986
3981
  `SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
3987
3982
  `SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
3988
- `SYNKRO_VERSION=${shellQuoteSingle("1.3.54")}`
3983
+ `SYNKRO_VERSION=${shellQuoteSingle("1.3.56")}`
3989
3984
  ];
3990
3985
  if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
3991
3986
  if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);