@synkro-sh/cli 1.3.12 → 1.3.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.
- package/dist/bootstrap.js +22 -15
- package/dist/bootstrap.js.map +1 -1
- package/package.json +3 -3
package/dist/bootstrap.js
CHANGED
|
@@ -2580,7 +2580,7 @@ async function listAccessibleRepos(opts) {
|
|
|
2580
2580
|
const repos = [];
|
|
2581
2581
|
let page = 1;
|
|
2582
2582
|
while (page <= 5) {
|
|
2583
|
-
const url = `https://api.github.com/user/repos?per_page=100&page=${page}&affiliation=owner,collaborator`;
|
|
2583
|
+
const url = `https://api.github.com/user/repos?per_page=100&page=${page}&affiliation=owner,collaborator,organization_member`;
|
|
2584
2584
|
const resp = await fetch(url, {
|
|
2585
2585
|
headers: {
|
|
2586
2586
|
Authorization: `Bearer ${opts.token}`,
|
|
@@ -2941,7 +2941,11 @@ async function setupGithubCommand(opts = {}) {
|
|
|
2941
2941
|
console.error(`Failed to mint CI API key: ${err.message}`);
|
|
2942
2942
|
process.exit(1);
|
|
2943
2943
|
}
|
|
2944
|
-
|
|
2944
|
+
let _rl = null;
|
|
2945
|
+
function getRL() {
|
|
2946
|
+
if (!_rl) _rl = createInterface2({ input, output });
|
|
2947
|
+
return _rl;
|
|
2948
|
+
}
|
|
2945
2949
|
let ghToken = opts.githubToken || "";
|
|
2946
2950
|
if (!ghToken) {
|
|
2947
2951
|
try {
|
|
@@ -2967,13 +2971,13 @@ async function setupGithubCommand(opts = {}) {
|
|
|
2967
2971
|
console.log(" \u2713 GitHub authorized");
|
|
2968
2972
|
} catch (err) {
|
|
2969
2973
|
console.error(`GitHub authorization failed: ${err.message}`);
|
|
2970
|
-
|
|
2974
|
+
_rl?.close();
|
|
2971
2975
|
process.exit(1);
|
|
2972
2976
|
}
|
|
2973
2977
|
}
|
|
2974
2978
|
if (!ghToken) {
|
|
2975
2979
|
console.error("No GitHub token available.");
|
|
2976
|
-
|
|
2980
|
+
_rl?.close();
|
|
2977
2981
|
process.exit(1);
|
|
2978
2982
|
}
|
|
2979
2983
|
let claudeToken = opts.claudeOauthToken || "";
|
|
@@ -3042,7 +3046,7 @@ async function setupGithubCommand(opts = {}) {
|
|
|
3042
3046
|
const repos = await listAccessibleRepos({ token: ghToken });
|
|
3043
3047
|
if (repos.length === 0) {
|
|
3044
3048
|
console.error("No accessible repos found. Verify the GitHub token has `repo` scope.");
|
|
3045
|
-
|
|
3049
|
+
_rl?.close();
|
|
3046
3050
|
process.exit(1);
|
|
3047
3051
|
}
|
|
3048
3052
|
let selected;
|
|
@@ -3056,19 +3060,21 @@ async function setupGithubCommand(opts = {}) {
|
|
|
3056
3060
|
} catch {
|
|
3057
3061
|
}
|
|
3058
3062
|
if (currentFullName) {
|
|
3059
|
-
const match = repos.find(
|
|
3063
|
+
const match = repos.find(
|
|
3064
|
+
(r) => r.full_name === currentFullName || r.full_name.toLowerCase() === currentFullName.toLowerCase()
|
|
3065
|
+
);
|
|
3060
3066
|
if (match) {
|
|
3061
3067
|
selected = [match];
|
|
3062
3068
|
console.log(` Auto-selected current repo: ${match.full_name}`);
|
|
3063
3069
|
} else {
|
|
3064
|
-
console.
|
|
3065
|
-
|
|
3066
|
-
|
|
3070
|
+
console.warn(` \u26A0 Current repo "${currentFullName}" not found in accessible repos. Skipping PR scan setup.`);
|
|
3071
|
+
console.warn(" Run `synkro-cli setup-github` manually to select a repo.");
|
|
3072
|
+
return;
|
|
3067
3073
|
}
|
|
3068
3074
|
} else {
|
|
3069
|
-
console.
|
|
3070
|
-
|
|
3071
|
-
|
|
3075
|
+
console.warn(" \u26A0 Not in a GitHub repo. Skipping PR scan setup.");
|
|
3076
|
+
console.warn(" Run `synkro-cli setup-github` from inside a repo.");
|
|
3077
|
+
return;
|
|
3072
3078
|
}
|
|
3073
3079
|
} else {
|
|
3074
3080
|
console.log(`
|
|
@@ -3078,6 +3084,7 @@ Found ${repos.length} accessible repo(s):
|
|
|
3078
3084
|
console.log(` ${String(i + 1).padStart(3)}. ${r.full_name}`);
|
|
3079
3085
|
});
|
|
3080
3086
|
console.log();
|
|
3087
|
+
const rl = getRL();
|
|
3081
3088
|
const selectionRaw = await prompt(rl, "Select repos to enable (comma-separated numbers, e.g. 1,3,5): ");
|
|
3082
3089
|
const selectedIdx = selectionRaw.split(",").map((s) => parseInt(s.trim(), 10) - 1).filter((n) => !isNaN(n) && n >= 0 && n < repos.length);
|
|
3083
3090
|
if (selectedIdx.length === 0) {
|
|
@@ -3097,7 +3104,7 @@ Will push secrets to ${selected.length} repo(s):`);
|
|
|
3097
3104
|
process.exit(0);
|
|
3098
3105
|
}
|
|
3099
3106
|
}
|
|
3100
|
-
|
|
3107
|
+
_rl?.close();
|
|
3101
3108
|
console.log();
|
|
3102
3109
|
for (const r of selected) {
|
|
3103
3110
|
process.stdout.write(`Pushing secrets to ${r.full_name}... `);
|
|
@@ -3113,7 +3120,7 @@ Will push secrets to ${selected.length} repo(s):`);
|
|
|
3113
3120
|
);
|
|
3114
3121
|
console.log("\u2713");
|
|
3115
3122
|
} catch (err) {
|
|
3116
|
-
console.log(`\u2717 (${err.message})`);
|
|
3123
|
+
console.log(`\u2717 (${err instanceof Error ? err.message : String(err)})`);
|
|
3117
3124
|
}
|
|
3118
3125
|
}
|
|
3119
3126
|
console.log();
|
|
@@ -3263,7 +3270,7 @@ function writeConfigEnv(opts) {
|
|
|
3263
3270
|
`SYNKRO_GATEWAY_URL=${shellQuoteSingle(safeGateway)}`,
|
|
3264
3271
|
`SYNKRO_CREDENTIALS_PATH=${shellQuoteSingle(credsPath)}`,
|
|
3265
3272
|
`SYNKRO_TIER=${shellQuoteSingle(safeTier)}`,
|
|
3266
|
-
`SYNKRO_VERSION=${shellQuoteSingle("1.3.
|
|
3273
|
+
`SYNKRO_VERSION=${shellQuoteSingle("1.3.13")}`
|
|
3267
3274
|
];
|
|
3268
3275
|
if (safeUserId) lines.push(`SYNKRO_USER_ID=${shellQuoteSingle(safeUserId)}`);
|
|
3269
3276
|
if (safeOrgId) lines.push(`SYNKRO_ORG_ID=${shellQuoteSingle(safeOrgId)}`);
|