qualty 0.1.11 → 0.1.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/bin/qualty.js +47 -4
- package/package.json +1 -1
package/bin/qualty.js
CHANGED
|
@@ -9,8 +9,7 @@ import process from "node:process";
|
|
|
9
9
|
import { runLocalCi } from "./local-runner.js";
|
|
10
10
|
|
|
11
11
|
/** CLI backend URL is fixed by Qualty distribution. */
|
|
12
|
-
|
|
13
|
-
const DEFAULT_QUALTY_API_URL = "http://localhost:8000";
|
|
12
|
+
const DEFAULT_QUALTY_API_URL = "https://qualty-api-development.up.railway.app";
|
|
14
13
|
|
|
15
14
|
const QUALTY_CONFIG_DIR = join(homedir(), ".config", "qualty");
|
|
16
15
|
const QUALTY_CONFIG_PATH = join(QUALTY_CONFIG_DIR, "config.json");
|
|
@@ -1269,8 +1268,52 @@ async function runAuthSetup(args) {
|
|
|
1269
1268
|
|
|
1270
1269
|
let profile = String(args.profile || "").trim();
|
|
1271
1270
|
if (!profile) {
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1271
|
+
const existingProfilesPayload = await apiRequest({
|
|
1272
|
+
apiUrl,
|
|
1273
|
+
token,
|
|
1274
|
+
orgId,
|
|
1275
|
+
path: `/api/v1/projects/${encodeURIComponent(project.id)}/saved-login-profiles`,
|
|
1276
|
+
}).catch(() => []);
|
|
1277
|
+
const existingProfileNames = (Array.isArray(existingProfilesPayload) ? existingProfilesPayload : [])
|
|
1278
|
+
.map((p) => String(p?.name || "").trim())
|
|
1279
|
+
.filter(Boolean);
|
|
1280
|
+
|
|
1281
|
+
const suggestedName = "default";
|
|
1282
|
+
if (existingProfileNames.length > 0) {
|
|
1283
|
+
// eslint-disable-next-line no-console
|
|
1284
|
+
console.log("[qualty][auth] Found existing saved login profiles on dashboard:");
|
|
1285
|
+
// eslint-disable-next-line no-console
|
|
1286
|
+
console.log(" 0) Create new profile");
|
|
1287
|
+
for (let i = 0; i < existingProfileNames.length; i += 1) {
|
|
1288
|
+
const name = existingProfileNames[i];
|
|
1289
|
+
// eslint-disable-next-line no-console
|
|
1290
|
+
console.log(` ${i + 1}) ${name}`);
|
|
1291
|
+
}
|
|
1292
|
+
while (!profile) {
|
|
1293
|
+
const raw = String(
|
|
1294
|
+
await rl.question(`Select profile [0-${existingProfileNames.length}]: `)
|
|
1295
|
+
).trim();
|
|
1296
|
+
const picked = Number(raw);
|
|
1297
|
+
if (!Number.isInteger(picked) || picked < 0 || picked > existingProfileNames.length) {
|
|
1298
|
+
// eslint-disable-next-line no-console
|
|
1299
|
+
console.log(`[qualty] Please enter a number from 0 to ${existingProfileNames.length}.`);
|
|
1300
|
+
continue;
|
|
1301
|
+
}
|
|
1302
|
+
if (picked === 0) {
|
|
1303
|
+
const proposed = String(await rl.question(`New profile name [${suggestedName}]: `)).trim() || suggestedName;
|
|
1304
|
+
if (!proposed) {
|
|
1305
|
+
// eslint-disable-next-line no-console
|
|
1306
|
+
console.log("[qualty] Profile name cannot be empty.");
|
|
1307
|
+
continue;
|
|
1308
|
+
}
|
|
1309
|
+
profile = proposed;
|
|
1310
|
+
} else {
|
|
1311
|
+
profile = existingProfileNames[picked - 1];
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
} else {
|
|
1315
|
+
profile = String(await rl.question(`Profile name [${suggestedName}]: `)).trim() || suggestedName;
|
|
1316
|
+
}
|
|
1274
1317
|
}
|
|
1275
1318
|
const statePath = localAuthStatePath({
|
|
1276
1319
|
orgId,
|