@codacy/verity-cli 0.27.0-experimental.1106a16 → 0.27.0-experimental.8f12b5a

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.
Files changed (2) hide show
  1. package/bin/verity.js +12 -18
  2. package/package.json +1 -1
package/bin/verity.js CHANGED
@@ -11121,18 +11121,21 @@ async function waitForEnter(prompt) {
11121
11121
  rl.close();
11122
11122
  }
11123
11123
  }
11124
- async function ensureAppInstalled(owner, repo, token, installUrl) {
11125
- const notInstalledError = {
11126
- ok: false,
11127
- error: `The Verity GitHub App can't see ${owner}/${repo}. Install it on "${owner}" and grant access to this repository, then re-run:
11128
- ${installUrl}`
11129
- };
11124
+ async function ensureAppInstalled(owner, repo, token) {
11125
+ let installUrl = null;
11130
11126
  const maxAttempts = 3;
11131
11127
  for (let attempt = 1; ; attempt++) {
11132
11128
  const visible = await githubCanSeeRepo(owner, repo, token);
11133
11129
  if (!visible.ok) return { ok: true, data: void 0 };
11134
11130
  if (visible.data) return { ok: true, data: void 0 };
11135
- if (!isInteractive() || attempt >= maxAttempts) return notInstalledError;
11131
+ if (installUrl === null) installUrl = githubAppInstallUrl(await githubAccountId(owner));
11132
+ if (!isInteractive() || attempt >= maxAttempts) {
11133
+ return {
11134
+ ok: false,
11135
+ error: `The Verity GitHub App can't see ${owner}/${repo}. Install it on "${owner}" and grant access to this repository, then re-run:
11136
+ ${installUrl}`
11137
+ };
11138
+ }
11136
11139
  printWarn(`The Verity GitHub App can't see ${owner}/${repo} yet.`);
11137
11140
  printInfo(`Install it on "${owner}" (grant access to this repo):`);
11138
11141
  printInfo(` ${installUrl}`);
@@ -11148,22 +11151,13 @@ async function registerProject(opts) {
11148
11151
  return { ok: false, error: `Provider '${parsed.provider}' is not supported yet \u2014 GitHub only for now.` };
11149
11152
  }
11150
11153
  const usingTokenOverride = Boolean(process.env.VERITY_PROVIDER_TOKEN);
11151
- const ownerId = usingTokenOverride ? null : await githubAccountId(parsed.owner);
11152
- const installUrl = githubAppInstallUrl(ownerId);
11153
- if (!usingTokenOverride && isInteractive()) {
11154
- printInfo("");
11155
- printInfo(`Verity uses a read-only GitHub App to verify write access to ${parsed.owner}/${parsed.repo}.`);
11156
- printInfo(`Install it on "${parsed.owner}" (grant access to this repo) if you haven't already:`);
11157
- printInfo(` ${installUrl}`);
11158
- await waitForEnter("Press Enter to continue to GitHub authorization\u2026 ");
11159
- }
11160
11154
  const providerAuth = await githubDeviceFlow();
11161
11155
  if (!providerAuth.ok) {
11162
11156
  return { ok: false, error: providerAuth.error };
11163
11157
  }
11164
11158
  const providerToken = providerAuth.data;
11165
11159
  if (!usingTokenOverride) {
11166
- const installed = await ensureAppInstalled(parsed.owner, parsed.repo, providerToken, installUrl);
11160
+ const installed = await ensureAppInstalled(parsed.owner, parsed.repo, providerToken);
11167
11161
  if (!installed.ok) {
11168
11162
  return { ok: false, error: installed.error };
11169
11163
  }
@@ -17167,7 +17161,7 @@ function registerTelemetryCommands(program2) {
17167
17161
  }
17168
17162
 
17169
17163
  // src/cli.ts
17170
- program.name("verity").description("CLI for Verity quality gate service").version("0.27.0-experimental.1106a16").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
17164
+ program.name("verity").description("CLI for Verity quality gate service").version("0.27.0-experimental.8f12b5a").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr");
17171
17165
  registerAuthCommands(program);
17172
17166
  registerHooksCommands(program);
17173
17167
  registerIntentCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codacy/verity-cli",
3
- "version": "0.27.0-experimental.1106a16",
3
+ "version": "0.27.0-experimental.8f12b5a",
4
4
  "description": "CLI for Verity quality gate service",
5
5
  "homepage": "https://verity.md",
6
6
  "repository": {