qualty 0.1.25 → 0.1.26
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 +35 -31
- package/package.json +1 -1
package/bin/qualty.js
CHANGED
|
@@ -187,13 +187,13 @@ function usage() {
|
|
|
187
187
|
"Usage:",
|
|
188
188
|
" qualty setup [--token <bearer-token>] [--org <org-id>]",
|
|
189
189
|
" qualty auth setup [--project <project-id>] [--profile <profile-name>] [--headed]",
|
|
190
|
-
" qualty
|
|
191
|
-
"
|
|
192
|
-
"
|
|
193
|
-
"
|
|
194
|
-
"
|
|
195
|
-
"
|
|
196
|
-
"
|
|
190
|
+
" qualty ci setup [--project <project-id>] [--profile <profile-name>] [--org <org-id>]",
|
|
191
|
+
" [--all-profiles] [--profiles <name1,name2>]",
|
|
192
|
+
" [--suite-id <suite-uuid>] [--ids <id1,id2>] bundle login profiles required by tests",
|
|
193
|
+
" [--url <api-base-url>] [--repo <owner/repo>]",
|
|
194
|
+
" [--output <path>] [--no-file] [--copy] [--gzip] [--include-token]",
|
|
195
|
+
" [--set-secret | --set-github] gh: secrets (token, API URL, auth bundle) + variables",
|
|
196
|
+
" [--cli-repo <owner/repo>] [--cli-ref <branch>] Optional CI variables",
|
|
197
197
|
" qualty auth restore-ci [--org <org-id>] [--project <project-id>] [--profile <fallback-profile>]",
|
|
198
198
|
" Reads QUALTY_AUTH_STATE_B64 (+ _2, _3, … shards) and writes ~/.qualty/local-contexts/…",
|
|
199
199
|
" qualty connect --project <project-id> [--port 3000] [--token <bearer-token>] [--org <org-id>]",
|
|
@@ -542,7 +542,7 @@ function localAuthStatePath({ orgId, projectId, profile }) {
|
|
|
542
542
|
return join(QUALTY_SHARED_CREDS_DIR, "local-contexts", orgSeg, projectSeg, `${profileSeg}.json`);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
-
function
|
|
545
|
+
function ciSetupAuthBundleOutputPath(statePath) {
|
|
546
546
|
return statePath.replace(/\.json$/i, ".b64");
|
|
547
547
|
}
|
|
548
548
|
|
|
@@ -754,7 +754,7 @@ function configStringValue(projectCfg, key, configPath) {
|
|
|
754
754
|
);
|
|
755
755
|
}
|
|
756
756
|
|
|
757
|
-
function
|
|
757
|
+
function missingCiSetupField(fieldLabel, { flag, configKey, configPath, hasFlag }) {
|
|
758
758
|
const configHint = configPath
|
|
759
759
|
? `${PROJECT_CONFIG_FILENAME} at ${configPath} (${configKey})`
|
|
760
760
|
: `${PROJECT_CONFIG_FILENAME} (not found walking up from ${process.cwd()})`;
|
|
@@ -770,7 +770,7 @@ function missingExportCiField(fieldLabel, { flag, configKey, configPath, hasFlag
|
|
|
770
770
|
].join(" ");
|
|
771
771
|
}
|
|
772
772
|
|
|
773
|
-
function
|
|
773
|
+
function resolveCiSetupConfig(args, { requireProfile = true } = {}) {
|
|
774
774
|
const { configPath, config: projectCfg } = readProjectConfigStrict();
|
|
775
775
|
|
|
776
776
|
const orgFromFlag = String(args.org || "").trim();
|
|
@@ -804,7 +804,7 @@ function resolveExportCiConfig(args, { requireProfile = true } = {}) {
|
|
|
804
804
|
|
|
805
805
|
if (!orgId) {
|
|
806
806
|
throw new Error(
|
|
807
|
-
|
|
807
|
+
missingCiSetupField("org ID", {
|
|
808
808
|
flag: "--org",
|
|
809
809
|
configKey: "default_org_id",
|
|
810
810
|
configPath,
|
|
@@ -814,7 +814,7 @@ function resolveExportCiConfig(args, { requireProfile = true } = {}) {
|
|
|
814
814
|
}
|
|
815
815
|
if (!projectId) {
|
|
816
816
|
throw new Error(
|
|
817
|
-
|
|
817
|
+
missingCiSetupField("project ID", {
|
|
818
818
|
flag: "--project",
|
|
819
819
|
configKey: "default_project_id",
|
|
820
820
|
configPath,
|
|
@@ -827,7 +827,7 @@ function resolveExportCiConfig(args, { requireProfile = true } = {}) {
|
|
|
827
827
|
allProfiles || profilesList.length > 0 || Boolean(suiteId) || explicitIds.length > 0;
|
|
828
828
|
if (requireProfile && !profile && !hasMultiProfileMode) {
|
|
829
829
|
throw new Error(
|
|
830
|
-
|
|
830
|
+
missingCiSetupField("auth profile", {
|
|
831
831
|
flag: "--profile",
|
|
832
832
|
configKey: "default_auth_profile",
|
|
833
833
|
configPath,
|
|
@@ -910,7 +910,7 @@ async function resolveRequiredProfileNamesFromTests({
|
|
|
910
910
|
return [...names];
|
|
911
911
|
}
|
|
912
912
|
|
|
913
|
-
async function
|
|
913
|
+
async function resolveCiSetupProfileEntries({
|
|
914
914
|
orgId,
|
|
915
915
|
projectId,
|
|
916
916
|
profile,
|
|
@@ -1033,7 +1033,7 @@ async function runAuthRestoreCi(args) {
|
|
|
1033
1033
|
const payloads = collectAuthShardPayloadsFromEnv(process.env);
|
|
1034
1034
|
if (payloads.length === 0) {
|
|
1035
1035
|
throw new Error(
|
|
1036
|
-
`Missing ${AUTH_SECRET_PRIMARY}. Run qualty
|
|
1036
|
+
`Missing ${AUTH_SECRET_PRIMARY}. Run qualty ci setup --set-github from your app repo.`
|
|
1037
1037
|
);
|
|
1038
1038
|
}
|
|
1039
1039
|
|
|
@@ -1052,7 +1052,7 @@ async function runAuthRestoreCi(args) {
|
|
|
1052
1052
|
console.log(`Restored ${restored.length} login profile(s).`);
|
|
1053
1053
|
}
|
|
1054
1054
|
|
|
1055
|
-
async function
|
|
1055
|
+
async function runCiSetup(args) {
|
|
1056
1056
|
const {
|
|
1057
1057
|
orgId,
|
|
1058
1058
|
projectId,
|
|
@@ -1061,18 +1061,18 @@ async function runAuthExportCi(args) {
|
|
|
1061
1061
|
configPath,
|
|
1062
1062
|
allProfiles,
|
|
1063
1063
|
profilesList,
|
|
1064
|
-
suiteId:
|
|
1064
|
+
suiteId: configSuiteId,
|
|
1065
1065
|
explicitIds,
|
|
1066
|
-
} =
|
|
1066
|
+
} = resolveCiSetupConfig(args);
|
|
1067
1067
|
const token = resolveToken(args);
|
|
1068
1068
|
|
|
1069
|
-
const profileEntries = await
|
|
1069
|
+
const profileEntries = await resolveCiSetupProfileEntries({
|
|
1070
1070
|
orgId,
|
|
1071
1071
|
projectId,
|
|
1072
1072
|
profile,
|
|
1073
1073
|
allProfiles,
|
|
1074
1074
|
profilesList,
|
|
1075
|
-
suiteId:
|
|
1075
|
+
suiteId: configSuiteId,
|
|
1076
1076
|
explicitIds,
|
|
1077
1077
|
apiUrl,
|
|
1078
1078
|
token,
|
|
@@ -1090,12 +1090,12 @@ async function runAuthExportCi(args) {
|
|
|
1090
1090
|
const outputPath = noFile
|
|
1091
1091
|
? String(args.output || "").trim()
|
|
1092
1092
|
: String(args.output || "").trim() ||
|
|
1093
|
-
|
|
1093
|
+
ciSetupAuthBundleOutputPath(
|
|
1094
1094
|
localAuthStatePath({ orgId, projectId, profile: profileEntries[0].localProfileName })
|
|
1095
1095
|
);
|
|
1096
1096
|
const copyToClipboardFlag = parseBoolean(args.copy, false);
|
|
1097
1097
|
const githubRepo = String(args.repo || "").trim();
|
|
1098
|
-
const suiteId = String(args["suite-id"] || args.suite ||
|
|
1098
|
+
const suiteId = String(args["suite-id"] || args.suite || configSuiteId || "").trim();
|
|
1099
1099
|
const cliRepo = String(args["cli-repo"] || "").trim();
|
|
1100
1100
|
const cliRef = String(args["cli-ref"] || "").trim();
|
|
1101
1101
|
|
|
@@ -1202,10 +1202,10 @@ async function runAuthExportCi(args) {
|
|
|
1202
1202
|
console.log(
|
|
1203
1203
|
"1. GitHub Actions config was pushed via gh (secrets + repository variables — see sync above). Fix any ✗ manually."
|
|
1204
1204
|
);
|
|
1205
|
-
if (!suiteId && !
|
|
1205
|
+
if (!suiteId && !configSuiteId && explicitIds.length === 0) {
|
|
1206
1206
|
// eslint-disable-next-line no-console
|
|
1207
1207
|
console.log(
|
|
1208
|
-
" Tip: pass --suite-id or --ids to
|
|
1208
|
+
" Tip: pass --suite-id or --ids to bundle only login profiles required by those tests."
|
|
1209
1209
|
);
|
|
1210
1210
|
}
|
|
1211
1211
|
if (authShards.length > 1) {
|
|
@@ -1359,7 +1359,7 @@ async function runAuthExportCi(args) {
|
|
|
1359
1359
|
// eslint-disable-next-line no-console
|
|
1360
1360
|
console.log("");
|
|
1361
1361
|
// eslint-disable-next-line no-console
|
|
1362
|
-
console.log("When login expires, re-run qualty auth setup and qualty
|
|
1362
|
+
console.log("When login expires, re-run qualty auth setup and qualty ci setup --set-github to refresh secrets.");
|
|
1363
1363
|
// eslint-disable-next-line no-console
|
|
1364
1364
|
console.log("");
|
|
1365
1365
|
}
|
|
@@ -2473,7 +2473,7 @@ async function runAuthSetup(args) {
|
|
|
2473
2473
|
// eslint-disable-next-line no-console
|
|
2474
2474
|
console.log(
|
|
2475
2475
|
`[qualty][auth] For GitHub Actions secrets, run:\n` +
|
|
2476
|
-
` qualty
|
|
2476
|
+
` qualty ci setup --project ${project.id} --profile "${profile}"`
|
|
2477
2477
|
);
|
|
2478
2478
|
} finally {
|
|
2479
2479
|
rl.close();
|
|
@@ -2495,21 +2495,25 @@ async function main() {
|
|
|
2495
2495
|
await runSetup(args);
|
|
2496
2496
|
return;
|
|
2497
2497
|
}
|
|
2498
|
-
if (command === "
|
|
2498
|
+
if (command === "ci") {
|
|
2499
2499
|
const sub = args._[1];
|
|
2500
2500
|
if (sub === "setup") {
|
|
2501
|
-
await
|
|
2501
|
+
await runCiSetup(args);
|
|
2502
2502
|
return;
|
|
2503
2503
|
}
|
|
2504
|
-
|
|
2505
|
-
|
|
2504
|
+
throw new Error("Unknown ci subcommand. Use: qualty ci setup");
|
|
2505
|
+
}
|
|
2506
|
+
if (command === "auth") {
|
|
2507
|
+
const sub = args._[1];
|
|
2508
|
+
if (sub === "setup") {
|
|
2509
|
+
await runAuthSetup(args);
|
|
2506
2510
|
return;
|
|
2507
2511
|
}
|
|
2508
2512
|
if (sub === "restore-ci") {
|
|
2509
2513
|
await runAuthRestoreCi(args);
|
|
2510
2514
|
return;
|
|
2511
2515
|
}
|
|
2512
|
-
throw new Error("Unknown auth subcommand. Use: qualty auth setup | qualty auth
|
|
2516
|
+
throw new Error("Unknown auth subcommand. Use: qualty auth setup | qualty auth restore-ci");
|
|
2513
2517
|
}
|
|
2514
2518
|
if (command === "run") {
|
|
2515
2519
|
if (parseBoolean(args.local, false)) {
|