@synkro-sh/cli 1.3.11 → 1.3.12
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 +51 -24
- package/dist/bootstrap.js.map +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -3045,30 +3045,57 @@ async function setupGithubCommand(opts = {}) {
|
|
|
3045
3045
|
rl.close();
|
|
3046
3046
|
process.exit(1);
|
|
3047
3047
|
}
|
|
3048
|
-
|
|
3048
|
+
let selected;
|
|
3049
|
+
if (opts.nonInteractive) {
|
|
3050
|
+
let currentFullName = null;
|
|
3051
|
+
try {
|
|
3052
|
+
const { execSync: gs } = await import("child_process");
|
|
3053
|
+
const remoteUrl = gs("git remote get-url origin", { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
3054
|
+
const m = remoteUrl.match(/(?:github\.com)[:/](.+?)(?:\.git)?$/);
|
|
3055
|
+
if (m) currentFullName = m[1];
|
|
3056
|
+
} catch {
|
|
3057
|
+
}
|
|
3058
|
+
if (currentFullName) {
|
|
3059
|
+
const match = repos.find((r) => r.full_name === currentFullName);
|
|
3060
|
+
if (match) {
|
|
3061
|
+
selected = [match];
|
|
3062
|
+
console.log(` Auto-selected current repo: ${match.full_name}`);
|
|
3063
|
+
} else {
|
|
3064
|
+
console.error(`Current repo "${currentFullName}" not found in accessible repos.`);
|
|
3065
|
+
rl.close();
|
|
3066
|
+
process.exit(1);
|
|
3067
|
+
}
|
|
3068
|
+
} else {
|
|
3069
|
+
console.error("Not in a GitHub repo. Cannot auto-select in non-interactive mode.");
|
|
3070
|
+
rl.close();
|
|
3071
|
+
process.exit(1);
|
|
3072
|
+
}
|
|
3073
|
+
} else {
|
|
3074
|
+
console.log(`
|
|
3049
3075
|
Found ${repos.length} accessible repo(s):
|
|
3050
3076
|
`);
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3077
|
+
repos.slice(0, 100).forEach((r, i) => {
|
|
3078
|
+
console.log(` ${String(i + 1).padStart(3)}. ${r.full_name}`);
|
|
3079
|
+
});
|
|
3080
|
+
console.log();
|
|
3081
|
+
const selectionRaw = await prompt(rl, "Select repos to enable (comma-separated numbers, e.g. 1,3,5): ");
|
|
3082
|
+
const selectedIdx = selectionRaw.split(",").map((s) => parseInt(s.trim(), 10) - 1).filter((n) => !isNaN(n) && n >= 0 && n < repos.length);
|
|
3083
|
+
if (selectedIdx.length === 0) {
|
|
3084
|
+
console.error("No valid selections.");
|
|
3085
|
+
rl.close();
|
|
3086
|
+
process.exit(1);
|
|
3087
|
+
}
|
|
3088
|
+
selected = selectedIdx.map((i) => repos[i]);
|
|
3089
|
+
console.log(`
|
|
3064
3090
|
Will push secrets to ${selected.length} repo(s):`);
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3091
|
+
for (const r of selected) console.log(` \u2022 ${r.full_name}`);
|
|
3092
|
+
console.log();
|
|
3093
|
+
const confirm = (await prompt(rl, "Continue? (yes/no): ")).trim().toLowerCase();
|
|
3094
|
+
if (confirm !== "yes" && confirm !== "y") {
|
|
3095
|
+
console.log("Cancelled.");
|
|
3096
|
+
rl.close();
|
|
3097
|
+
process.exit(0);
|
|
3098
|
+
}
|
|
3072
3099
|
}
|
|
3073
3100
|
rl.close();
|
|
3074
3101
|
console.log();
|
|
@@ -3236,7 +3263,7 @@ function writeConfigEnv(opts) {
|
|
|
3236
3263
|
`SYNKRO_GATEWAY_URL=${shellQuoteSingle(safeGateway)}`,
|
|
3237
3264
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
3238
3265
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
3239
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.3.
|
|
3266
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.3.12")}`
|
|
3240
3267
|
];
|
|
3241
3268
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
3242
3269
|
if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);
|
|
@@ -3512,7 +3539,7 @@ async function installCommand(opts = {}) {
|
|
|
3512
3539
|
}
|
|
3513
3540
|
if (choice === "1") {
|
|
3514
3541
|
try {
|
|
3515
|
-
await setupGithubCommand({ githubToken: opts.githubToken });
|
|
3542
|
+
await setupGithubCommand({ githubToken: opts.githubToken, nonInteractive: opts.nonInteractive });
|
|
3516
3543
|
} catch (err) {
|
|
3517
3544
|
console.warn(` \u26A0 GitHub setup failed: ${err.message}`);
|
|
3518
3545
|
console.warn(" Run `synkro-cli setup-github` to retry.\n");
|
|
@@ -3574,7 +3601,7 @@ async function installCommand(opts = {}) {
|
|
|
3574
3601
|
}
|
|
3575
3602
|
}
|
|
3576
3603
|
try {
|
|
3577
|
-
await setupGithubCommand({ skipClaudeToken: true, githubToken: opts.githubToken });
|
|
3604
|
+
await setupGithubCommand({ skipClaudeToken: true, githubToken: opts.githubToken, nonInteractive: opts.nonInteractive });
|
|
3578
3605
|
} catch (err) {
|
|
3579
3606
|
console.warn(` \u26A0 GitHub setup failed: ${err.message}`);
|
|
3580
3607
|
console.warn(" Run `synkro-cli setup-github` to retry.\n");
|