@synkro-sh/cli 1.3.55 → 1.3.57
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 +27 -25
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
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,40 @@ 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",
|
|
3589
|
-
stdio:
|
|
3589
|
+
const proc = nodeSpawn("script", ["-q", tmpFile, "claude", "setup-token"], {
|
|
3590
|
+
stdio: "inherit"
|
|
3590
3591
|
});
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
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 =
|
|
3601
|
-
const
|
|
3607
|
+
const stripped = raw.replace(/\x1B\[[0-9;]*[A-Za-z]|\x1B\][^\x07]*\x07/g, "");
|
|
3608
|
+
const startIdx = stripped.indexOf("Your OAuth token");
|
|
3609
|
+
const endIdx = stripped.indexOf("Store this token");
|
|
3610
|
+
if (startIdx === -1 || endIdx === -1) {
|
|
3611
|
+
reject(new Error("Could not find token in claude setup-token output"));
|
|
3612
|
+
return;
|
|
3613
|
+
}
|
|
3614
|
+
const section = stripped.slice(startIdx, endIdx).replace(/\s/g, "");
|
|
3615
|
+
const match = section.match(/sk-ant-oat01-[A-Za-z0-9_-]+/);
|
|
3602
3616
|
if (!match) {
|
|
3603
3617
|
reject(new Error("Could not find token in claude setup-token output"));
|
|
3604
3618
|
return;
|
|
3605
3619
|
}
|
|
3606
3620
|
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
3621
|
});
|
|
3620
3622
|
});
|
|
3621
3623
|
}
|
|
@@ -3985,7 +3987,7 @@ function writeConfigEnv(opts) {
|
|
|
3985
3987
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
3986
3988
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
3987
3989
|
`SYNKRO_INFERENCE=${shellQuoteSingle(safeInference)}`,
|
|
3988
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.3.
|
|
3990
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.3.57")}`
|
|
3989
3991
|
];
|
|
3990
3992
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
3991
3993
|
if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);
|