diff --git a/.dockerignore b/.dockerignore index ccc2930..66bcbd1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,12 @@ /coverage -/node_modules + +# Dependency directories +node_modules/ +jspm_packages/ + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..98c3dbc --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +/dist/** +/coverage/** +/node_modules/** diff --git a/.eslintrc.json b/.eslintrc.json index ba2a82b..97c0c7a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,11 +1,12 @@ { "env": { "node": true, - "es2021": true, - "jest/globals": true + "es6": true, + "jest": true }, "extends": [ "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "plugin:jest/recommended", "plugin:prettier/recommended" diff --git a/.gitattributes b/.gitattributes index 93763d5..65de486 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,2 @@ -/dist/** linguist-generated=true -/lib/** linguist-generated=true +/dist/** linguist-generated=true -diff +/lib/** linguist-generated=true -diff diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 42a0e53..2e82715 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,18 +3,28 @@ updates: - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" - time: "06:00" - timezone: "Europe/Paris" + interval: monthly labels: - "dependencies" + commit-message: + prefix: "ci" + include: "scope" + groups: + actions: + patterns: + - "*" - package-ecosystem: "npm" directory: "/" schedule: - interval: "daily" - time: "06:00" - timezone: "Europe/Paris" + interval: monthly allow: - dependency-type: "production" labels: - "dependencies" + commit-message: + prefix: "chore" + include: "scope" + groups: + npm: + patterns: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1aea28..8316602 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,17 @@ name: ci +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions +permissions: + contents: read + on: schedule: - - cron: '0 10 * * *' # everyday at 10am + - cron: '0 10 * * *' + workflow_dispatch: push: branches: - 'master' @@ -10,9 +19,6 @@ on: tags: - 'v*' pull_request: - branches: - - 'master' - - 'releases/v*' jobs: ci: @@ -22,34 +28,30 @@ jobs: matrix: os: - ubuntu-latest - - macOS-latest + - macos-latest - windows-latest version: - latest - - '~> 0.182' + - '~> 2.13' distribution: - goreleaser - goreleaser-pro steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: - go-version: 1.18 - - - name: Check + go-version: stable + - name: Check uses: ./ with: version: ${{ matrix.version }} - args: check --debug + args: check --verbose workdir: ./test - - - name: GoReleaser + - name: GoReleaser if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} uses: ./ env: @@ -57,7 +59,7 @@ jobs: with: distribution: ${{ matrix.distribution }} version: ${{ matrix.version }} - args: release --skip-publish --rm-dist + args: release --skip=publish --clean --snapshot workdir: ./test install-only: @@ -67,34 +69,36 @@ jobs: matrix: version: - latest - - '~> 0.166' + - '~> 2.13' distribution: - goreleaser - goreleaser-pro + cosign: + - true + - false steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: 1.18 - - - name: GoReleaser + - name: Install cosign + if: matrix.cosign + uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1 + - name: GoReleaser if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} uses: ./ with: distribution: ${{ matrix.distribution }} version: ${{ matrix.version }} install-only: true - - - name: Check + - name: Check if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} run: | - goreleaser check --debug + goreleaser check --verbose signing: runs-on: ${{ matrix.os }} @@ -104,41 +108,36 @@ jobs: matrix: os: - ubuntu-latest - - macOS-latest + - macos-latest - windows-latest steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: 1.18 - - - name: Import GPG key + - name: Import GPG key id: import_gpg - uses: crazy-max/ghaction-import-gpg@v5 + uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 with: gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_TEST }} passphrase: ${{ secrets.PASSPHRASE_TEST }} - - - name: Check + - name: Check uses: ./ with: version: latest - args: -f .goreleaser-signing.yml check --debug + args: -f .goreleaser-signing.yml check --verbose workdir: ./test env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} - - - name: GoReleaser + - name: GoReleaser uses: ./ with: version: latest - args: -f .goreleaser-signing.yml release --skip-publish --rm-dist + args: -f .goreleaser-signing.yml release --skip=publish --clean --snapshot workdir: ./test env: GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} @@ -146,77 +145,81 @@ jobs: upload-artifact: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: 1.18 - - - name: Check + - name: Check uses: ./ with: - args: check --debug + args: check --verbose workdir: ./test - - - name: GoReleaser + - name: GoReleaser uses: ./ with: - args: release --skip-publish --rm-dist + args: release --skip=publish --clean --snapshot workdir: ./test - - - name: Upload assets - uses: actions/upload-artifact@v3 + - name: Upload assets + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: myapp path: ./test/dist/* - current-tag: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: 1.18 - - - name: GoReleaser - uses: ./ - with: - args: release --skip-publish --rm-dist - workdir: ./test - env: - GORELEASER_CURRENT_TAG: v99.99.99 - dist: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v3 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version: 1.18 - - - name: GoReleaser + - name: GoReleaser uses: ./ with: - args: release --config .goreleaser-dist.yml --skip-publish --rm-dist + args: release --config .goreleaser-dist.yml --skip=publish --clean --snapshot workdir: ./test - - - name: Check dist + - name: Check dist run: | tree -nh ./test/_output + + nightly: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + distribution: + - goreleaser-pro + - goreleaser + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + go-version: 1.18 + - name: GoReleaser + uses: ./ + with: + install-only: true + distribution: ${{ matrix.distribution }} + version: nightly + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check + run: | + goreleaser check -f ./test/.goreleaser.yml + goreleaser --version + goreleaser --version | grep nightly diff --git a/.github/workflows/release-major-tag.yml b/.github/workflows/release-major-tag.yml new file mode 100644 index 0000000..457f18b --- /dev/null +++ b/.github/workflows/release-major-tag.yml @@ -0,0 +1,42 @@ +name: release major tag + +run-name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }} + +on: + workflow_dispatch: + inputs: + target: + description: The tag, branch, or SHA the major version should point to (e.g. v7.1.0) + required: true + major_version: + type: choice + description: The major version tag to move + options: + - v7 + - v6 + - v5 + - v4 + - v3 + - v2 + - v1 + +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions +permissions: + contents: write + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + - name: Git config + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }} + run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }} + - name: Push + run: git push origin ${{ github.event.inputs.major_version }} --force diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 737a351..08f1c68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,36 +1,42 @@ name: test +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions +permissions: + contents: read + on: push: branches: - 'master' - 'releases/v*' pull_request: - branches: - - 'master' - - 'releases/v*' jobs: test: runs-on: ubuntu-latest steps: - - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 - - - name: Validate - uses: docker/bake-action@v2 + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 with: - targets: validate - - - name: Test - uses: docker/bake-action@v2 + node-version-file: '.node-version' + cache: npm + - name: Install cosign + uses: sigstore/cosign-installer@cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003 # v4.1.1 + - name: Install dependencies + run: npm ci + - name: Test + run: npm test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload coverage + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: - targets: test - - - name: Upload coverage - uses: codecov/codecov-action@v3 - with: - file: ./coverage/clover.xml + files: ./coverage/clover.xml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..3ef7ea5 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,83 @@ +name: validate + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions +permissions: + contents: read + +on: + push: + branches: + - 'master' + - 'releases/v*' + pull_request: + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 + with: + node-version-file: '.node-version' + cache: npm + - name: Install dependencies + run: npm ci + - name: Format check + run: npm run format-check + - name: Lint + run: npm run lint + + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0 + with: + node-version-file: '.node-version' + cache: npm + - name: Install dependencies + run: npm ci --ignore-scripts + - name: Rebuild dist + run: npm run build + - name: Compare dist + id: diff + run: | + if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then + echo "Detected uncommitted changes after build. Run 'npm run build' and commit dist/." >&2 + git diff dist + exit 1 + fi + - name: Upload built dist on failure + if: ${{ failure() && steps.diff.conclusion == 'failure' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: dist + path: dist + + vendor: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0 + with: + node-version-file: '.node-version' + cache: npm + - name: Refresh package-lock.json + run: npm install --package-lock-only + - name: Compare package-lock.json + run: | + if [ -n "$(git status --porcelain -- package-lock.json)" ]; then + echo "package-lock.json is out of sync with package.json. Run 'npm install' and commit." >&2 + git diff package-lock.json + exit 1 + fi diff --git a/.gitignore b/.gitignore index 69b201b..7a623c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,19 +1,11 @@ -/.dev -node_modules/ -lib +# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore -# Jetbrains -/.idea -/*.iml - -# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore # Logs logs *.log npm-debug.log* -yarn-debug.log* -yarn-error.log* lerna-debug.log* +.pnpm-debug.log* # Diagnostic reports (https://nodejs.org/api/report.html) report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json @@ -24,34 +16,14 @@ pids *.seed *.pid.lock -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - # Coverage directory used by tools like istanbul coverage *.lcov -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - # Dependency directories +node_modules/ jspm_packages/ -# TypeScript v1 declaration files -typings/ - # TypeScript cache *.tsbuildinfo @@ -61,36 +33,11 @@ typings/ # Optional eslint cache .eslintcache -# Optional REPL history -.node_repl_history -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file +# dotenv environment variable files .env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ +.env.development.local +.env.test.local +.env.production.local +.env.local +provenance.json diff --git a/.kodiak.toml b/.kodiak.toml deleted file mode 100644 index e538846..0000000 --- a/.kodiak.toml +++ /dev/null @@ -1,15 +0,0 @@ -version = 1 - -[merge] -automerge_label = "automerge" -blacklist_title_regex = "^WIP.*" -method = "squash" -delete_branch_on_merge = true -block_on_reviews_requested = false -notify_on_conflict = true -optimistic_updates = true - -[merge.message] -title = "pull_request_title" -include_pr_number = true -body_type = "markdown" diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..a45fd52 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..5b3b81b --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Dependency directories +node_modules/ +jspm_packages/ + +# yarn v2 +.yarn/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bb87824 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,89 @@ +# Contributing + +Thanks for your interest in contributing! + +## Prerequisites + +- [Node.js](https://nodejs.org/) — version pinned in [`.node-version`](./.node-version). + Tools like [`nvm`](https://github.com/nvm-sh/nvm), [`fnm`](https://github.com/Schniz/fnm), + [`asdf`](https://asdf-vm.com/), or [`mise`](https://mise.jdx.dev/) read this file + automatically. +- [`cosign`](https://docs.sigstore.dev/cosign/installation/) — only required if you + want to run the signature-verification integration tests locally. + +## Setup + +```sh +npm ci +``` + +## Pre-commit checklist + +Before committing changes to `src/`, `__tests__/`, `package.json`, +`package-lock.json`, or `action.yml`: + +```sh +npm run pre-checkin +``` + +That runs `format` + `build` + `test` — the same checks CI runs. + +Then commit `dist/` along with your source changes; the action runtime loads +`dist/index.js` directly, so it must stay in sync. + +If CI's `validate / build` job fails because `dist/` differs from a fresh +build, just download the `dist` artifact from the failed run and commit it — +or rerun `npm run build` locally with the Node version in `.node-version`. + +## npm scripts + +| Script | Purpose | +| ------------------- | ------------------------------------------------ | +| `npm run build` | Bundle `src/` to `dist/index.js` via `ncc` | +| `npm run format` | Run Prettier (write) | +| `npm run format-check` | Run Prettier (check only, used in CI) | +| `npm run lint` | Run ESLint (check only, used in CI) | +| `npm run lint:fix` | Run ESLint with `--fix` | +| `npm test` | Run Jest with coverage | +| `npm run pre-checkin` | `format` + `lint:fix` + `build` + `test` | + +## Tests + +`npm test` runs the full Jest suite, including integration tests that: + +- Download real GoReleaser releases from GitHub +- Verify `checksums.txt` against the downloaded archive +- Verify the cosign sigstore bundle (skipped if `cosign` isn't on `PATH`, + but the CI image always has it installed) + +These need outbound network access. Offline / restrictive-proxy runs will +have those tests fail — that's expected. + +## Commit messages + +Use [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, +`fix:`, `test:`, `docs:`, `chore:`, `ci:`, …). Keep the subject ≤72 chars. + +## Pull requests + +- Target `master`. +- Make sure `npm run pre-checkin` passes. +- One logical change per PR is easier to review. +- The `signing` CI job and `goreleaser-pro` matrix entries are skipped on PRs + from forks because they need repository secrets — that's expected and not + something you need to fix. + +## Releasing (maintainers) + +1. Create a new GitHub Release with a semver tag (e.g. `v7.1.0`) — either + through the UI or `gh release create v7.1.0 --generate-notes`. +2. Once the release exists, run the [**release major tag**](./.github/workflows/release-major-tag.yml) + workflow from the Actions tab: + - `target`: the new tag (e.g. `v7.1.0`) + - `major_version`: the major version to repoint (e.g. `v7`) + + This force-pushes the major tag to the new release so consumers using + `goreleaser/goreleaser-action@v7` pick up the change. + + The same workflow doubles as a rollback tool — pass an older tag as + `target` to revert the major. diff --git a/README.md b/README.md index b9ff8e9..e4a3dce 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
@@ -16,6 +16,7 @@ ___ * [Usage](#usage) * [Workflow](#workflow) + * [Verification](#verification) * [Run on new tag](#run-on-new-tag) * [Signing](#signing) * [Upload artifacts](#upload-artifacts) @@ -30,6 +31,12 @@ ___ ## Usage +GoReleaser Action runs [goreleaser][], please follow its [docs][gdocs] for +more information about how to customize what GoReleaser does. + +[goreleaser]: https://goreleaser.com/ +[gdocs]: https://goreleaser.com/customization + ### Workflow ```yaml @@ -39,26 +46,30 @@ on: pull_request: push: +permissions: + contents: write + jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v6 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v3 + uses: goreleaser/goreleaser-action@v7 with: # either 'goreleaser' (default) or 'goreleaser-pro' distribution: goreleaser - version: latest - args: release --rm-dist + # 'latest', 'nightly', or a semver + version: '~> v2' + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution @@ -67,6 +78,49 @@ jobs: > **IMPORTANT**: note the `fetch-depth: 0` input in `Checkout` step. It is required for the changelog to work correctly. +### Verification + +The action verifies the integrity of the downloaded GoReleaser archive +against the published `checksums.txt` automatically — no configuration +required. + +If [`cosign`](https://docs.sigstore.dev/cosign/) is available on `PATH`, the +action will additionally verify the cosign sigstore signature of the +checksums file against the GoReleaser release workflow's OIDC identity. If +`cosign` isn't installed, this step is silently skipped. + +> **Note**: cosign signature verification requires GoReleaser **v2.13.0 or +> newer** (and the matching `nightly`). Earlier releases ship a `.sig` +> detached signature signed with cosign v2, which is not compatible with +> the cosign v3 sigstore-bundle format the action verifies. For older +> versions the cosign step is silently skipped — only the `checksums.txt` +> SHA-256 verification runs. + +> **Note**: when `version: nightly` is used, the action resolves the +> latest immutable `vX.Y.Z-\\d+)m|\\${W}(?.*)${B})`).exec(Y.slice(t).join(""))||{groups:{}};if(s.code!==undefined){const t=Number.parseFloat(s.code);q=t===L?undefined:t}else if(s.uri!==undefined){H=s.uri.length===0?undefined:s.uri}}const b=R.codes.get(Number(q));if(Y[t+1]==="\n"){if(H){F+=wrapAnsiHyperlink("")}if(q&&b){F+=wrapAnsi(b)}}else if(s==="\n"){if(q&&b){F+=wrapAnsi(q)}if(H){F+=wrapAnsiHyperlink(H)}}}return F};t.exports=(t,s,b)=>String(t).normalize().replace(/\r\n/g,"\n").split("\n").map((t=>exec(t,s,b))).join("\n")},8954:function(t,s,b){"use strict";var _=this&&this.__createBinding||(Object.create?function(t,s,b,_){if(_===undefined)_=b;var F=Object.getOwnPropertyDescriptor(s,b);if(!F||("get"in F?!s.__esModule:F.writable||F.configurable)){F={enumerable:true,get:function(){return s[b]}}}Object.defineProperty(t,_,F)}:function(t,s,b,_){if(_===undefined)_=b;t[_]=s[b]});var F=this&&this.__setModuleDefault||(Object.create?function(t,s){Object.defineProperty(t,"default",{enumerable:true,value:s})}:function(t,s){t["default"]=s});var R=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(t!=null)for(var b in t)if(b!=="default"&&Object.prototype.hasOwnProperty.call(t,b))_(s,t,b);F(s,t);return s};var T=this&&this.__awaiter||function(t,s,b,_){function adopt(t){return t instanceof b?t:new b((function(s){s(t)}))}return new(b||(b=Promise))((function(b,F){function fulfilled(t){try{step(_.next(t))}catch(t){F(t)}}function rejected(t){try{step(_["throw"](t))}catch(t){F(t)}}function step(t){t.done?b(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,s||[])).next())}))};Object.defineProperty(s,"__esModule",{value:true});s.getInputs=s.osArch=s.osPlat=void 0;const L=R(b(2037));const B=R(b(2186));s.osPlat=L.platform();s.osArch=L.arch();function getInputs(){return T(this,void 0,void 0,(function*(){return{distribution:B.getInput("distribution")||"goreleaser",version:B.getInput("version"),args:B.getInput("args"),workdir:B.getInput("workdir")||".",installOnly:B.getBooleanInput("install-only")}}))}s.getInputs=getInputs},6350:function(t,s,b){"use strict";var _=this&&this.__createBinding||(Object.create?function(t,s,b,_){if(_===undefined)_=b;var F=Object.getOwnPropertyDescriptor(s,b);if(!F||("get"in F?!s.__esModule:F.writable||F.configurable)){F={enumerable:true,get:function(){return s[b]}}}Object.defineProperty(t,_,F)}:function(t,s,b,_){if(_===undefined)_=b;t[_]=s[b]});var F=this&&this.__setModuleDefault||(Object.create?function(t,s){Object.defineProperty(t,"default",{enumerable:true,value:s})}:function(t,s){t["default"]=s});var R=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(t!=null)for(var b in t)if(b!=="default"&&Object.prototype.hasOwnProperty.call(t,b))_(s,t,b);F(s,t);return s};var T=this&&this.__awaiter||function(t,s,b,_){function adopt(t){return t instanceof b?t:new b((function(s){s(t)}))}return new(b||(b=Promise))((function(b,F){function fulfilled(t){try{step(_.next(t))}catch(t){F(t)}}function rejected(t){try{step(_["throw"](t))}catch(t){F(t)}}function step(t){t.done?b(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,s||[])).next())}))};Object.defineProperty(s,"__esModule",{value:true});s.getShortCommit=s.isTagDirty=s.getTag=void 0;const L=R(b(1514));const git=(t=[])=>T(void 0,void 0,void 0,(function*(){return yield L.getExecOutput(`git`,t,{ignoreReturnCode:true,silent:true}).then((t=>{if(t.stderr.length>0&&t.exitCode!=0){throw new Error(t.stderr)}return t.stdout.trim()}))}));function getTag(){return T(this,void 0,void 0,(function*(){try{if((process.env.GITHUB_REF||"").startsWith("refs/tags")){const t=(process.env.GITHUB_REF||"").split("/").pop();if(t!==""&&t!==undefined){return t}}return yield git(["tag","--points-at",`${process.env.GITHUB_SHA}`,"--sort","-version:creatordate"]).then((t=>{if(t.length==0){return git(["describe","--tags","--abbrev=0"])}return t.split("\n")[0]}))}catch(t){return""}}))}s.getTag=getTag;function isTagDirty(t){return T(this,void 0,void 0,(function*(){try{yield git(["describe","--exact-match","--tags","--match",t])}catch(t){return true}return false}))}s.isTagDirty=isTagDirty;function getShortCommit(){return T(this,void 0,void 0,(function*(){return yield git(["show","--format='%h'","HEAD","--quiet"])}))}s.getShortCommit=getShortCommit},978:function(t,s,b){"use strict";var _=this&&this.__createBinding||(Object.create?function(t,s,b,_){if(_===undefined)_=b;var F=Object.getOwnPropertyDescriptor(s,b);if(!F||("get"in F?!s.__esModule:F.writable||F.configurable)){F={enumerable:true,get:function(){return s[b]}}}Object.defineProperty(t,_,F)}:function(t,s,b,_){if(_===undefined)_=b;t[_]=s[b]});var F=this&&this.__setModuleDefault||(Object.create?function(t,s){Object.defineProperty(t,"default",{enumerable:true,value:s})}:function(t,s){t["default"]=s});var R=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(t!=null)for(var b in t)if(b!=="default"&&Object.prototype.hasOwnProperty.call(t,b))_(s,t,b);F(s,t);return s};var T=this&&this.__awaiter||function(t,s,b,_){function adopt(t){return t instanceof b?t:new b((function(s){s(t)}))}return new(b||(b=Promise))((function(b,F){function fulfilled(t){try{step(_.next(t))}catch(t){F(t)}}function rejected(t){try{step(_["throw"](t))}catch(t){F(t)}}function step(t){t.done?b(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,s||[])).next())}))};Object.defineProperty(s,"__esModule",{value:true});s.getRelease=void 0;const L=R(b(8218));const B=R(b(5911));const U=R(b(2186));const q=R(b(6255));const getRelease=(t,s)=>T(void 0,void 0,void 0,(function*(){const b=(yield resolveVersion(t,s))||s;const _=`https://github.com/goreleaser/${t}/releases/${b}`;const F=new q.HttpClient("goreleaser-action");return(yield F.getJson(_)).result}));s.getRelease=getRelease;const resolveVersion=(t,s)=>T(void 0,void 0,void 0,(function*(){const b=yield getAllTags(t);if(!b){throw new Error(`Cannot find GoReleaser tags`)}U.debug(`Found ${b.length} tags in total`);if(s==="latest"||!L.isPro(t)){return B.maxSatisfying(b,s)}const _=b.map((t=>cleanTag(t)));const F=cleanTag(s);return B.maxSatisfying(_,F)+L.distribSuffix(t)}));const getAllTags=t=>T(void 0,void 0,void 0,(function*(){const s=new q.HttpClient("goreleaser-action");const b=L.distribSuffix(t);const _=`https://goreleaser.com/static/releases${b}.json`;const F=s.getJson(_);return F.then((t=>{if(t.result==null){return[]}return t.result.map((t=>t.tag_name))}))}));const cleanTag=t=>t.replace(/-pro$/,"")},8218:function(t,s,b){"use strict";var _=this&&this.__createBinding||(Object.create?function(t,s,b,_){if(_===undefined)_=b;var F=Object.getOwnPropertyDescriptor(s,b);if(!F||("get"in F?!s.__esModule:F.writable||F.configurable)){F={enumerable:true,get:function(){return s[b]}}}Object.defineProperty(t,_,F)}:function(t,s,b,_){if(_===undefined)_=b;t[_]=s[b]});var F=this&&this.__setModuleDefault||(Object.create?function(t,s){Object.defineProperty(t,"default",{enumerable:true,value:s})}:function(t,s){t["default"]=s});var R=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(t!=null)for(var b in t)if(b!=="default"&&Object.prototype.hasOwnProperty.call(t,b))_(s,t,b);F(s,t);return s};var T=this&&this.__awaiter||function(t,s,b,_){function adopt(t){return t instanceof b?t:new b((function(s){s(t)}))}return new(b||(b=Promise))((function(b,F){function fulfilled(t){try{step(_.next(t))}catch(t){F(t)}}function rejected(t){try{step(_["throw"](t))}catch(t){F(t)}}function step(t){t.done?b(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,s||[])).next())}))};var L=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(s,"__esModule",{value:true});s.getMetadata=s.getArtifacts=s.getDistPath=s.isPro=s.distribSuffix=s.install=void 0;const B=R(b(7147));const U=R(b(1017));const q=R(b(3837));const H=L(b(1917));const W=R(b(8954));const V=R(b(978));const G=R(b(2186));const Y=R(b(7784));function install(t,s){return T(this,void 0,void 0,(function*(){const b=yield V.getRelease(t,s);if(!b){throw new Error(`Cannot find GoReleaser ${s} release`)}const _=getFilename(t);const F=q.format("https://github.com/goreleaser/%s/releases/download/%s/%s",t,b.tag_name,_);G.info(`Downloading ${F}`);const R=yield Y.downloadTool(F);G.debug(`Downloaded to ${R}`);G.info("Extracting GoReleaser");let T;if(W.osPlat=="win32"){T=yield Y.extractZip(R)}else{T=yield Y.extractTar(R)}G.debug(`Extracted to ${T}`);const L=yield Y.cacheDir(T,"goreleaser-action",b.tag_name.replace(/^v/,""));G.debug(`Cached to ${L}`);const B=U.join(L,W.osPlat=="win32"?"goreleaser.exe":"goreleaser");G.debug(`Exe path is ${B}`);return B}))}s.install=install;const distribSuffix=t=>(0,s.isPro)(t)?"-pro":"";s.distribSuffix=distribSuffix;const isPro=t=>t==="goreleaser-pro";s.isPro=isPro;const getFilename=t=>{let b;switch(W.osArch){case"x64":{b="x86_64";break}case"x32":{b="i386";break}case"arm":{const t=process.config.variables.arm_version;b=t?"armv"+t:"arm";break}default:{b=W.osArch;break}}if(W.osPlat=="darwin"){b="all"}const _=W.osPlat=="win32"?"Windows":W.osPlat=="darwin"?"Darwin":"Linux";const F=W.osPlat=="win32"?"zip":"tar.gz";const R=(0,s.distribSuffix)(t);return q.format("goreleaser%s_%s_%s.%s",R,_,b,F)};function getDistPath(t){return T(this,void 0,void 0,(function*(){const s=H.default.load(B.readFileSync(t,"utf8"));return s.dist||"dist"}))}s.getDistPath=getDistPath;function getArtifacts(t){return T(this,void 0,void 0,(function*(){const s=U.join(t,"artifacts.json");if(!B.existsSync(s)){return undefined}const b=B.readFileSync(s,{encoding:"utf-8"}).trim();if(b==="null"){return undefined}return b}))}s.getArtifacts=getArtifacts;function getMetadata(t){return T(this,void 0,void 0,(function*(){const s=U.join(t,"metadata.json");if(!B.existsSync(s)){return undefined}const b=B.readFileSync(s,{encoding:"utf-8"}).trim();if(b==="null"){return undefined}return b}))}s.getMetadata=getMetadata},399:function(t,s,b){"use strict";var _=this&&this.__createBinding||(Object.create?function(t,s,b,_){if(_===undefined)_=b;var F=Object.getOwnPropertyDescriptor(s,b);if(!F||("get"in F?!s.__esModule:F.writable||F.configurable)){F={enumerable:true,get:function(){return s[b]}}}Object.defineProperty(t,_,F)}:function(t,s,b,_){if(_===undefined)_=b;t[_]=s[b]});var F=this&&this.__setModuleDefault||(Object.create?function(t,s){Object.defineProperty(t,"default",{enumerable:true,value:s})}:function(t,s){t["default"]=s});var R=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var s={};if(t!=null)for(var b in t)if(b!=="default"&&Object.prototype.hasOwnProperty.call(t,b))_(s,t,b);F(s,t);return s};var T=this&&this.__awaiter||function(t,s,b,_){function adopt(t){return t instanceof b?t:new b((function(s){s(t)}))}return new(b||(b=Promise))((function(b,F){function fulfilled(t){try{step(_.next(t))}catch(t){F(t)}}function rejected(t){try{step(_["throw"](t))}catch(t){F(t)}}function step(t){t.done?b(t.value):adopt(t.value).then(fulfilled,rejected)}step((_=_.apply(t,s||[])).next())}))};var L=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(s,"__esModule",{value:true});const B=R(b(7147));const U=R(b(1017));const q=L(b(8822));const H=R(b(8954));const W=R(b(6350));const V=R(b(8218));const G=R(b(2186));const Y=R(b(1514));function run(){return T(this,void 0,void 0,(function*(){try{const t=yield H.getInputs();const s=yield V.install(t.distribution,t.version);G.info(`GoReleaser ${t.version} installed successfully`);if(t.installOnly){const t=U.dirname(s);G.addPath(t);G.debug(`Added ${t} to PATH`);return}else if(!t.args){G.setFailed("args input required");return}if(t.workdir&&t.workdir!=="."){G.info(`Using ${t.workdir} as working directory`);process.chdir(t.workdir)}const b=yield W.getShortCommit();const _=yield W.getTag();const F=yield W.isTagDirty(_);let R;const L=q.default.parse(t.args);if(L.config){R=L.config}else{[".goreleaser.yaml",".goreleaser.yml","goreleaser.yaml","goreleaser.yml"].forEach((t=>{if(B.existsSync(t)){R=t}}))}let z="";if(t.args.split(" ").indexOf("release")>-1){if(F){if(!t.args.includes("--snapshot")&&!t.args.includes("--nightly")){G.info(`No tag found for commit ${b}. Snapshot forced`);z=" --snapshot"}}else{G.info(`${_} tag found for commit ${b}`)}}yield Y.exec(`${s} ${t.args}${z}`);if(typeof R==="string"){const t=yield V.getArtifacts(yield V.getDistPath(R));if(t){yield G.group(`Artifacts output`,(()=>T(this,void 0,void 0,(function*(){G.info(t);G.setOutput("artifacts",t)}))))}const s=yield V.getMetadata(yield V.getDistPath(R));if(s){yield G.group(`Metadata output`,(()=>T(this,void 0,void 0,(function*(){G.info(s);G.setOutput("metadata",s)}))))}}}catch(t){G.setFailed(t.message)}}))}run()},9167:t=>{function webpackEmptyContext(t){var s=new Error("Cannot find module '"+t+"'");s.code="MODULE_NOT_FOUND";throw s}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=9167;t.exports=webpackEmptyContext},5977:t=>{function webpackEmptyContext(t){var s=new Error("Cannot find module '"+t+"'");s.code="MODULE_NOT_FOUND";throw s}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=5977;t.exports=webpackEmptyContext},4907:t=>{function webpackEmptyContext(t){var s=new Error("Cannot find module '"+t+"'");s.code="MODULE_NOT_FOUND";throw s}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=4907;t.exports=webpackEmptyContext},9491:t=>{"use strict";t.exports=require("assert")},2081:t=>{"use strict";t.exports=require("child_process")},6113:t=>{"use strict";t.exports=require("crypto")},2361:t=>{"use strict";t.exports=require("events")},7147:t=>{"use strict";t.exports=require("fs")},3685:t=>{"use strict";t.exports=require("http")},5687:t=>{"use strict";t.exports=require("https")},1808:t=>{"use strict";t.exports=require("net")},2037:t=>{"use strict";t.exports=require("os")},1017:t=>{"use strict";t.exports=require("path")},2781:t=>{"use strict";t.exports=require("stream")},1576:t=>{"use strict";t.exports=require("string_decoder")},9512:t=>{"use strict";t.exports=require("timers")},4404:t=>{"use strict";t.exports=require("tls")},3837:t=>{"use strict";t.exports=require("util")},7059:(t,s,b)=>{"use strict";const _={right:alignRight,center:alignCenter};const F=0;const R=1;const T=2;const L=3;class UI{constructor(t){var s;this.width=t.width;this.wrap=(s=t.wrap)!==null&&s!==void 0?s:true;this.rows=[]}span(...t){const s=this.div(...t);s.span=true}resetOutput(){this.rows=[]}div(...t){if(t.length===0){this.div("")}if(this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]==="string"){return this.applyLayoutDSL(t[0])}const s=t.map((t=>{if(typeof t==="string"){return this.colFromString(t)}return t}));this.rows.push(s);return s}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]==="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const s=t.split("\n").map((t=>t.split("\t")));let b=0;s.forEach((t=>{if(t.length>1&&B.stringWidth(t[0])>b){b=Math.min(Math.floor(this.width*.5),B.stringWidth(t[0]))}}));s.forEach((t=>{this.div(...t.map(((s,_)=>({text:s.trim(),padding:this.measurePadding(s),width:_===0&&t.length>1?b:undefined}))))}));return this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){const s=B.stripAnsi(t);return[0,s.match(/\s*$/)[0].length,0,s.match(/^\s*/)[0].length]}toString(){const t=[];this.rows.forEach((s=>{this.rowToString(s,t)}));return t.filter((t=>!t.hidden)).map((t=>t.text)).join("\n")}rowToString(t,s){this.rasterize(t).forEach(((b,F)=>{let T="";b.forEach(((b,U)=>{const{width:q}=t[U];const H=this.negatePadding(t[U]);let W=b;if(H>B.stringWidth(b)){W+=" ".repeat(H-B.stringWidth(b))}if(t[U].align&&t[U].align!=="left"&&this.wrap){const s=_[t[U].align];W=s(W,H);if(B.stringWidth(W)0){T=this.renderInline(T,s[s.length-1])}}));s.push({text:T.replace(/ +$/,""),span:t.span})}));return s}renderInline(t,s){const b=t.match(/^ */);const _=b?b[0].length:0;const F=s.text;const R=B.stringWidth(F.trimRight());if(!s.span){return t}if(!this.wrap){s.hidden=true;return F+t}if(_{t.width=b[R];if(this.wrap){_=B.wrap(t.text,this.negatePadding(t),{hard:true}).split("\n")}else{_=t.text.split("\n")}if(t.border){_.unshift("."+"-".repeat(this.negatePadding(t)+2)+".");_.push("'"+"-".repeat(this.negatePadding(t)+2)+"'")}if(t.padding){_.unshift(...new Array(t.padding[F]||0).fill(""));_.push(...new Array(t.padding[T]||0).fill(""))}_.forEach(((t,b)=>{if(!s[b]){s.push([])}const _=s[b];for(let t=0;tt.width||B.stringWidth(t.text)))}let s=t.length;let b=this.width;const _=t.map((t=>{if(t.width){s--;b-=t.width;return t.width}return undefined}));const F=s?Math.floor(b/s):0;return _.map(((s,b)=>{if(s===undefined){return Math.max(F,_minWidth(t[b]))}return s}))}}function addBorder(t,s,b){if(t.border){if(/[.']-+[.']/.test(s)){return""}if(s.trim().length!==0){return b}return" "}return""}function _minWidth(t){const s=t.padding||[];const b=1+(s[L]||0)+(s[R]||0);if(t.border){return b+4}return b}function getWindowWidth(){if(typeof process==="object"&&process.stdout&&process.stdout.columns){return process.stdout.columns}return 80}function alignRight(t,s){t=t.trim();const b=B.stringWidth(t);if(b=s){return t}return" ".repeat(s-b>>1)+t}let B;function cliui(t,s){B=s;return new UI({width:(t===null||t===void 0?void 0:t.width)||getWindowWidth(),wrap:t===null||t===void 0?void 0:t.wrap})}const U=b(2577);const q=b(2701);const H=b(9824);function ui(t){return cliui(t,{stringWidth:U,stripAnsi:q,wrap:H})}t.exports=ui},452:(t,s,b)=>{"use strict";var _=b(7147);var F=b(3837);var R=b(1017);let T;class Y18N{constructor(t){t=t||{};this.directory=t.directory||"./locales";this.updateFiles=typeof t.updateFiles==="boolean"?t.updateFiles:true;this.locale=t.locale||"en";this.fallbackToLanguage=typeof t.fallbackToLanguage==="boolean"?t.fallbackToLanguage:true;this.cache=Object.create(null);this.writeQueue=[]}__(...t){if(typeof arguments[0]!=="string"){return this._taggedLiteral(arguments[0],...arguments)}const s=t.shift();let cb=function(){};if(typeof t[t.length-1]==="function")cb=t.pop();cb=cb||function(){};if(!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][s]&&this.updateFiles){this.cache[this.locale][s]=s;this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}return T.format.apply(T.format,[this.cache[this.locale][s]||s].concat(t))}__n(){const t=Array.prototype.slice.call(arguments);const s=t.shift();const b=t.shift();const _=t.shift();let cb=function(){};if(typeof t[t.length-1]==="function")cb=t.pop();if(!this.cache[this.locale])this._readLocaleFile();let F=_===1?s:b;if(this.cache[this.locale][s]){const t=this.cache[this.locale][s];F=t[_===1?"one":"other"]}if(!this.cache[this.locale][s]&&this.updateFiles){this.cache[this.locale][s]={one:s,other:b};this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}const R=[F];if(~F.indexOf("%d"))R.push(_);return T.format.apply(T.format,R.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){if(!this.cache[this.locale])this._readLocaleFile();for(const s in t){if(Object.prototype.hasOwnProperty.call(t,s)){this.cache[this.locale][s]=t[s]}}}_taggedLiteral(t,...s){let b="";t.forEach((function(t,_){const F=s[_+1];b+=t;if(typeof F!=="undefined"){b+="%s"}}));return this.__.apply(this,[b].concat([].slice.call(s,1)))}_enqueueWrite(t){this.writeQueue.push(t);if(this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){const t=this;const s=this.writeQueue[0];const b=s.directory;const _=s.locale;const F=s.cb;const R=this._resolveLocaleFile(b,_);const L=JSON.stringify(this.cache[_],null,2);T.fs.writeFile(R,L,"utf-8",(function(s){t.writeQueue.shift();if(t.writeQueue.length>0)t._processWriteQueue();F(s)}))}_readLocaleFile(){let t={};const s=this._resolveLocaleFile(this.directory,this.locale);try{if(T.fs.readFileSync){t=JSON.parse(T.fs.readFileSync(s,"utf-8"))}}catch(b){if(b instanceof SyntaxError){b.message="syntax error in "+s}if(b.code==="ENOENT")t={};else throw b}this.cache[this.locale]=t}_resolveLocaleFile(t,s){let b=T.resolve(t,"./",s+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(b)&&~s.lastIndexOf("_")){const _=T.resolve(t,"./",s.split("_")[0]+".json");if(this._fileExistsSync(_))b=_}return b}_fileExistsSync(t){return T.exists(t)}}function y18n$1(t,s){T=s;const b=new Y18N(t);return{__:b.__.bind(b),__n:b.__n.bind(b),setLocale:b.setLocale.bind(b),getLocale:b.getLocale.bind(b),updateLocale:b.updateLocale.bind(b),locale:b.locale}}var L={fs:{readFileSync:_.readFileSync,writeFile:_.writeFile},format:F.format,resolve:R.resolve,exists:t=>{try{return _.statSync(t).isFile()}catch(t){return false}}};const y18n=t=>y18n$1(t,L);t.exports=y18n},9562:(t,s,b)=>{"use strict";var _=b(9491);class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let F,R=[];function n(t,s,_,T){F=T;let L={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return L;const T=/\.json|\..*rc$/.test(t.extends);let B=null;if(T)B=function(t,s){return F.path.resolve(t,s)}(s,t.extends);else try{B=b(9167).resolve(t.extends)}catch(s){return t}!function(t){if(R.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(B),R.push(B),L=T?JSON.parse(F.readFileSync(B,"utf8")):b(9167)(t.extends),delete t.extends,L=n(L,F.path.dirname(B),_,F)}return R=[],_?r(L,t):Object.assign({},L,t)}function r(t,s){const b={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(b,t);for(const _ of Object.keys(s))i(s[_])&&i(b[_])?b[_]=r(t[_],s[_]):b[_]=s[_];return b}function o(t){const s=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),b=/\.*[\][<>]/g,_=s.shift();if(!_)throw new Error(`No command found in: ${t}`);const F={cmd:_.replace(b,""),demanded:[],optional:[]};return s.forEach(((t,_)=>{let R=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&_===s.length-1&&(R=!0),/^\[/.test(t)?F.optional.push({cmd:t.replace(b,"").split("|"),variadic:R}):F.demanded.push({cmd:t.replace(b,"").split("|"),variadic:R})})),F}const T=["first","second","third","fourth","fifth","sixth"];function h(t,s,b){try{let _=0;const[F,R,T]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,b],L=[].slice.call(R);for(;L.length&&void 0===L[L.length-1];)L.pop();const B=T||L.length;if(BU)throw new e(`Too many arguments provided. Expected max ${U} but received ${B}.`);F.demanded.forEach((t=>{const s=l(L.shift());0===t.cmd.filter((t=>t===s||"*"===t)).length&&c(s,t.cmd,_),_+=1})),F.optional.forEach((t=>{if(0===L.length)return;const s=l(L.shift());0===t.cmd.filter((t=>t===s||"*"===t)).length&&c(s,t.cmd,_),_+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,b){throw new e(`Invalid ${T[b]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,s,b,_){b.assert.notStrictEqual(t,s,_)}function u(t,s){s.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},s=(()=>!0)){const b={};return p(t).forEach((_=>{s(_,t[_])&&(b[_]=t[_])})),b}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var L=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,s,b,_){if("a"===b&&!_)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof s?t!==s||!_:!s.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===b?_:"a"===b?_.call(t):_?_.value:s.get(t)}function O(t,s,b,_,F){if("m"===_)throw new TypeError("Private method is not writable");if("a"===_&&!F)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof s?t!==s||!F:!s.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===_?F.call(t,b):F?F.value=b:s.set(t,b),b}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,s,b=!0,_=!1){if(h(" [boolean] [boolean] [boolean]",[t,s,b],arguments.length),Array.isArray(t)){for(let _=0;_{const _=[...b[s]||[],s];return!t.option||!_.includes(t.option)})),t.option=s,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,s,b,_){return b.reduce(((t,b)=>{if(b.applyBeforeValidation!==_)return t;if(b.mutates){if(b.applied)return t;b.applied=!0}if(f(t))return t.then((t=>Promise.all([t,b(t,s)]))).then((([t,s])=>Object.assign(t,s)));{const _=b(t,s);return f(_)?_.then((s=>Object.assign(t,s))):Object.assign(t,_)}}),t)}function j(t,s,b=(t=>{throw t})){try{const b="function"==typeof t?t():t;return f(b)?b.then((t=>s(t))):s(b)}catch(t){return b(t)}}const B=/(^\*)|(^\$0)/;class M{constructor(t,s,b,_){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=_,this.usage=t,this.globalMiddleware=b,this.validation=s}addDirectory(t,s,b,_){"boolean"!=typeof(_=_||{}).recurse&&(_.recurse=!1),Array.isArray(_.extensions)||(_.extensions=["js"]);const F="function"==typeof _.visit?_.visit:t=>t;_.visit=(t,s,b)=>{const _=F(t,s,b);if(_){if(this.requireCache.has(s))return _;this.requireCache.add(s),this.addHandler(_)}return _},this.shim.requireDirectory({require:s,filename:b},t,_)}addHandler(t,s,b,_,F,R){let T=[];const L=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(F);if(_=_||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...T]=t;else for(const s of t)this.addHandler(s);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let s=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(s=[].concat(s).concat(t.aliases)),void this.addHandler(s,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(b))return void this.addHandler([t].concat(T),s,b.builder,b.handler,b.middlewares,b.deprecated)}if("string"==typeof t){const F=o(t);T=T.map((t=>o(t).cmd));let U=!1;const q=[F.cmd].concat(T).filter((t=>!B.test(t)||(U=!0,!1)));0===q.length&&U&&q.push("$0"),U&&(F.cmd=q[0],T=q.slice(1),t=t.replace(B,F.cmd)),T.forEach((t=>{this.aliasMap[t]=F.cmd})),!1!==s&&this.usage.command(t,s,U,T,R),this.handlers[F.cmd]={original:t,description:s,handler:_,builder:b||{},middlewares:L,deprecated:R,demanded:F.demanded,optional:F.optional},U&&(this.defaultCommand=this.handlers[F.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,s,b,_,F,R){const T=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,L=s.getInternalMethods().getContext(),B=L.commands.slice(),U=!t;t&&(L.commands.push(t),L.fullCommands.push(T.original));const q=this.applyBuilderUpdateUsageAndParse(U,T,s,b.aliases,B,_,F,R);return f(q)?q.then((t=>this.applyMiddlewareAndGetResult(U,T,t.innerArgv,L,F,t.aliases,s))):this.applyMiddlewareAndGetResult(U,T,q.innerArgv,L,F,q.aliases,s)}applyBuilderUpdateUsageAndParse(t,s,b,_,F,R,T,L){const B=s.builder;let U=b;if(x(B)){const q=B(b.getInternalMethods().reset(_),L);if(f(q))return q.then((_=>{var L;return U=(L=_)&&"function"==typeof L.getInternalMethods?_:b,this.parseAndUpdateUsage(t,s,U,F,R,T)}))}else(function(t){return"object"==typeof t})(B)&&(U=b.getInternalMethods().reset(_),Object.keys(s.builder).forEach((t=>{U.option(t,B[t])})));return this.parseAndUpdateUsage(t,s,U,F,R,T)}parseAndUpdateUsage(t,s,b,_,F,R){t&&b.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(b)&&b.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(_,s),s.description);const T=b.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,F,R);return f(T)?T.then((t=>({aliases:b.parsed.aliases,innerArgv:t}))):{aliases:b.parsed.aliases,innerArgv:T}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,s){const b=B.test(s.original)?s.original.replace(B,"").trim():s.original,_=t.filter((t=>!B.test(t)));return _.push(b),`$0 ${_.join(" ")}`}handleValidationAndGetResult(t,s,b,_,F,R,T,L){if(!R.getInternalMethods().getHasOutput()){const s=R.getInternalMethods().runValidation(F,L,R.parsed.error,t);b=j(b,(t=>(s(t),t)))}if(s.handler&&!R.getInternalMethods().getHasOutput()){R.getInternalMethods().setHasOutput();const _=!!R.getOptions().configuration["populate--"];R.getInternalMethods().postProcess(b,_,!1,!1),b=j(b=C(b,R,T,!1),(t=>{const b=s.handler(t);return f(b)?b.then((()=>t)):t})),t||R.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(b)&&!R.getInternalMethods().hasParseCallback()&&b.catch((t=>{try{R.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(_.commands.pop(),_.fullCommands.pop()),b}applyMiddlewareAndGetResult(t,s,b,_,F,R,T){let L={};if(F)return b;T.getInternalMethods().getHasOutput()||(L=this.populatePositionals(s,b,_,T));const B=this.globalMiddleware.getMiddleware().slice(0).concat(s.middlewares),U=C(b,T,B,!0);return f(U)?U.then((b=>this.handleValidationAndGetResult(t,s,b,_,R,T,B,L))):this.handleValidationAndGetResult(t,s,U,_,R,T,B,L)}populatePositionals(t,s,b,_){s._=s._.slice(b.commands.length);const F=t.demanded.slice(0),R=t.optional.slice(0),T={};for(this.validation.positionalCount(F.length,s._.length);F.length;){const t=F.shift();this.populatePositional(t,s,T)}for(;R.length;){const t=R.shift();this.populatePositional(t,s,T)}return s._=b.commands.concat(s._.map((t=>""+t))),this.postProcessPositionals(s,T,this.cmdToParseOptions(t.original),_),T}populatePositional(t,s,b){const _=t.cmd[0];t.variadic?b[_]=s._.splice(0).map(String):s._.length&&(b[_]=[String(s._.shift())])}cmdToParseOptions(t){const s={array:[],default:{},alias:{},demand:{}},b=o(t);return b.demanded.forEach((t=>{const[b,..._]=t.cmd;t.variadic&&(s.array.push(b),s.default[b]=[]),s.alias[b]=_,s.demand[b]=!0})),b.optional.forEach((t=>{const[b,..._]=t.cmd;t.variadic&&(s.array.push(b),s.default[b]=[]),s.alias[b]=_})),s}postProcessPositionals(t,s,b,_){const F=Object.assign({},_.getOptions());F.default=Object.assign(b.default,F.default);for(const t of Object.keys(b.alias))F.alias[t]=(F.alias[t]||[]).concat(b.alias[t]);F.array=F.array.concat(b.array),F.config={};const R=[];if(Object.keys(s).forEach((t=>{s[t].map((s=>{F.configuration["unknown-options-as-args"]&&(F.key[t]=!0),R.push(`--${t}`),R.push(s)}))})),!R.length)return;const T=Object.assign({},F.configuration,{"populate--":!1}),L=this.shim.Parser.detailed(R,Object.assign({},F,{configuration:T}));if(L.error)_.getInternalMethods().getUsageInstance().fail(L.error.message,L.error);else{const b=Object.keys(s);Object.keys(s).forEach((t=>{b.push(...L.aliases[t])})),Object.keys(L.argv).forEach((F=>{b.includes(F)&&(s[F]||(s[F]=L.argv[F]),!this.isInConfigs(_,F)&&!this.isDefaulted(_,F)&&Object.prototype.hasOwnProperty.call(t,F)&&Object.prototype.hasOwnProperty.call(L.argv,F)&&(Array.isArray(t[F])||Array.isArray(L.argv[F]))?t[F]=[].concat(t[F],L.argv[F]):t[F]=L.argv[F])}))}}isDefaulted(t,s){const{default:b}=t.getOptions();return Object.prototype.hasOwnProperty.call(b,s)||Object.prototype.hasOwnProperty.call(b,this.shim.Parser.camelCase(s))}isInConfigs(t,s){const{configObjects:b}=t.getOptions();return b.some((t=>Object.prototype.hasOwnProperty.call(t,s)))||b.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(s))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const s=B.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(s,this.defaultCommand.description)}const s=this.defaultCommand.builder;if(x(s))return s(t,!0);k(s)||Object.keys(s).forEach((b=>{t.option(b,s[b])}))}moduleName(t){const s=function(t){if(false){}for(let s,_=0,F=Object.keys(b.c);_{const b=s;b._handle&&b.isTTY&&"function"==typeof b._handle.setBlocking&&b._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const b=s.y18n.__,_={},F=[];_.failFn=function(t){F.push(t)};let R=null,T=null,L=!0;_.showHelpOnFail=function(s=!0,b){const[F,B]="string"==typeof s?[!0,s]:[s,b];return t.getInternalMethods().isGlobalContext()&&(T=B),R=B,L=F,_};let B=!1;_.fail=function(s,b){const U=t.getInternalMethods().getLoggerInstance();if(!F.length){if(t.getExitProcess()&&E(!0),!B){B=!0,L&&(t.showHelp("error"),U.error()),(s||b)&&U.error(s||b);const _=R||T;_&&((s||b)&&U.error(""),U.error(_))}if(b=b||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,b);throw b}for(let t=F.length-1;t>=0;--t){const R=F[t];if(A(R)){if(b)throw b;if(s)throw Error(s)}else R(s,b,_)}};let U=[],q=!1;_.usage=(t,s)=>null===t?(q=!0,U=[],_):(q=!1,U.push([t,s||""]),_),_.getUsage=()=>U,_.getUsageDisabled=()=>q,_.getPositionalGroupName=()=>b("Positionals:");let H=[];_.example=(t,s)=>{H.push([t,s||""])};let W=[];_.command=function(t,s,b,_,F=!1){b&&(W=W.map((t=>(t[2]=!1,t)))),W.push([t,s||"",b,_,F])},_.getCommands=()=>W;let V={};_.describe=function(t,s){Array.isArray(t)?t.forEach((t=>{_.describe(t,s)})):"object"==typeof t?Object.keys(t).forEach((s=>{_.describe(s,t[s])})):V[t]=s},_.getDescriptions=()=>V;let G=[];_.epilog=t=>{G.push(t)};let Y,z=!1;_.wrap=t=>{z=!0,Y=t},_.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(z||(Y=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),z=!0),Y);const X="__yargsString__:";function O(t,b,_){let F=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{F=Math.max(s.stringWidth(_?`${_} ${I(t[0])}`:I(t[0]))+$(t[0]),F)})),b&&(F=Math.min(F,parseInt((.5*b).toString(),10))),F}let K;function C(s){return t.getOptions().hiddenOptions.indexOf(s)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,s){let _=`[${b("default:")} `;if(void 0===t&&!s)return null;if(s)_+=s;else switch(typeof t){case"string":_+=`"${t}"`;break;case"object":_+=JSON.stringify(t);break;default:_+=t}return`${_}]`}_.deferY18nLookup=t=>X+t,_.help=function(){if(K)return K;!function(){const s=t.getDemandedOptions(),b=t.getOptions();(Object.keys(b.alias)||[]).forEach((F=>{b.alias[F].forEach((R=>{V[R]&&_.describe(F,V[R]),R in s&&t.demandOption(F,s[R]),b.boolean.includes(R)&&t.boolean(F),b.count.includes(R)&&t.count(F),b.string.includes(R)&&t.string(F),b.normalize.includes(R)&&t.normalize(F),b.array.includes(R)&&t.array(F),b.number.includes(R)&&t.number(F)}))}))}();const F=t.customScriptName?t.$0:s.path.basename(t.$0),R=t.getDemandedOptions(),T=t.getDemandedCommands(),L=t.getDeprecatedOptions(),B=t.getGroups(),Y=t.getOptions();let z=[];z=z.concat(Object.keys(V)),z=z.concat(Object.keys(R)),z=z.concat(Object.keys(T)),z=z.concat(Object.keys(Y.default)),z=z.filter(C),z=Object.keys(z.reduce(((t,s)=>("_"!==s&&(t[s]=!0),t)),{}));const J=_.getWrap(),Z=s.cliui({width:J,wrap:!!J});if(!q)if(U.length)U.forEach((t=>{Z.div({text:`${t[0].replace(/\$0/g,F)}`}),t[1]&&Z.div({text:`${t[1]}`,padding:[1,0,0,0]})})),Z.div();else if(W.length){let t=null;t=T._?`${F} <${b("command")}>\n`:`${F} [${b("command")}]\n`,Z.div(`${t}`)}if(W.length>1||1===W.length&&!W[0][2]){Z.div(b("Commands:"));const s=t.getInternalMethods().getContext(),_=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(W=W.sort(((t,s)=>t[0].localeCompare(s[0]))));const R=F?`${F} `:"";W.forEach((t=>{const s=`${R}${_}${t[0].replace(/^\$0 ?/,"")}`;Z.span({text:s,padding:[0,2,0,2],width:O(W,J,`${F}${_}`)+4},{text:t[1]});const T=[];t[2]&&T.push(`[${b("default")}]`),t[3]&&t[3].length&&T.push(`[${b("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?T.push(`[${b("deprecated: %s",t[4])}]`):T.push(`[${b("deprecated")}]`)),T.length?Z.div({text:T.join(" "),padding:[0,0,0,2],align:"right"}):Z.div()})),Z.div()}const Q=(Object.keys(Y.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);z=z.filter((s=>!t.parsed.newAliases[s]&&Q.every((t=>-1===(Y.alias[t]||[]).indexOf(s)))));const ee=b("Options:");B[ee]||(B[ee]=[]),function(t,s,b,_){let F=[],R=null;Object.keys(b).forEach((t=>{F=F.concat(b[t])})),t.forEach((t=>{R=[t].concat(s[t]),R.some((t=>-1!==F.indexOf(t)))||b[_].push(t)}))}(z,Y.alias,B,ee);const k=t=>/^--/.test(I(t)),te=Object.keys(B).filter((t=>B[t].length>0)).map((t=>({groupName:t,normalizedKeys:B[t].filter(C).map((t=>{if(Q.includes(t))return t;for(let s,b=0;void 0!==(s=Q[b]);b++)if((Y.alias[s]||[]).includes(t))return s;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:s})=>{const b=s.reduce(((s,b)=>(s[b]=[b].concat(Y.alias[b]||[]).map((s=>t===_.getPositionalGroupName()?s:(/^[0-9]$/.test(s)?Y.boolean.includes(b)?"-":"--":s.length>1?"--":"-")+s)).sort(((t,s)=>k(t)===k(s)?0:k(t)?1:-1)).join(", "),s)),{});return{groupName:t,normalizedKeys:s,switches:b}}));if(te.filter((({groupName:t})=>t!==_.getPositionalGroupName())).some((({normalizedKeys:t,switches:s})=>!t.every((t=>k(s[t])))))&&te.filter((({groupName:t})=>t!==_.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:s})=>{t.forEach((t=>{var b,_;k(s[t])&&(s[t]=(b=s[t],_="-x, ".length,S(b)?{text:b.text,indentation:b.indentation+_}:{text:b,indentation:_}))}))})),te.forEach((({groupName:t,normalizedKeys:s,switches:F})=>{Z.div(t),s.forEach((t=>{const s=F[t];let T=V[t]||"",B=null;T.includes(X)&&(T=b(T.substring(X.length))),Y.boolean.includes(t)&&(B=`[${b("boolean")}]`),Y.count.includes(t)&&(B=`[${b("count")}]`),Y.string.includes(t)&&(B=`[${b("string")}]`),Y.normalize.includes(t)&&(B=`[${b("string")}]`),Y.array.includes(t)&&(B=`[${b("array")}]`),Y.number.includes(t)&&(B=`[${b("number")}]`);const U=[t in L?(q=L[t],"string"==typeof q?`[${b("deprecated: %s",q)}]`:`[${b("deprecated")}]`):null,B,t in R?`[${b("required")}]`:null,Y.choices&&Y.choices[t]?`[${b("choices:")} ${_.stringifiedValues(Y.choices[t])}]`:null,j(Y.default[t],Y.defaultDescription[t])].filter(Boolean).join(" ");var q;Z.span({text:I(s),padding:[0,2,0,2+$(s)],width:O(F,J)+4},T),U?Z.div({text:U,padding:[0,0,0,2],align:"right"}):Z.div()})),Z.div()})),H.length&&(Z.div(b("Examples:")),H.forEach((t=>{t[0]=t[0].replace(/\$0/g,F)})),H.forEach((t=>{""===t[1]?Z.div({text:t[0],padding:[0,2,0,2]}):Z.div({text:t[0],padding:[0,2,0,2],width:O(H,J)+4},{text:t[1]})})),Z.div()),G.length>0){const t=G.map((t=>t.replace(/\$0/g,F))).join("\n");Z.div(`${t}\n`)}return Z.toString().replace(/\s*$/,"")},_.cacheHelpMessage=function(){K=this.help()},_.clearCachedHelpMessage=function(){K=void 0},_.hasCachedHelpMessage=function(){return!!K},_.showHelp=s=>{const b=t.getInternalMethods().getLoggerInstance();s||(s="error");("function"==typeof s?s:b[s])(_.help())},_.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):b("generated-value"),")"].join(""),_.stringifiedValues=function(t,s){let b="";const _=s||", ",F=[].concat(t);return t&&F.length?(F.forEach((t=>{b.length&&(b+=_),b+=JSON.stringify(t)})),b):b};let J=null;_.version=t=>{J=t},_.showVersion=s=>{const b=t.getInternalMethods().getLoggerInstance();s||(s="error");("function"==typeof s?s:b[s])(J)},_.reset=function(t){return R=null,B=!1,U=[],q=!1,G=[],H=[],W=[],V=g(V,(s=>!t[s])),_};const Z=[];return _.freeze=function(){Z.push({failMessage:R,failureOutput:B,usages:U,usageDisabled:q,epilogs:G,examples:H,commands:W,descriptions:V})},_.unfreeze=function(t=!1){const s=Z.pop();s&&(t?(V={...s.descriptions,...V},W=[...s.commands,...W],U=[...s.usages,...U],H=[...s.examples,...H],G=[...s.epilogs,...G]):({failMessage:R,failureOutput:B,usages:U,usageDisabled:q,epilogs:G,examples:H,commands:W,descriptions:V}=s))},_}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,s,b,_){var F,R,T;this.yargs=t,this.usage=s,this.command=b,this.shim=_,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(T=(null===(F=this.shim.getEnv("SHELL"))||void 0===F?void 0:F.includes("zsh"))||(null===(R=this.shim.getEnv("ZSH_NAME"))||void 0===R?void 0:R.includes("zsh")))&&void 0!==T&&T}defaultCompletion(t,s,b,_){const F=this.command.getCommandHandlers();for(let s=0,b=t.length;s{const _=o(b[0]).cmd;if(-1===s.indexOf(_))if(this.zshShell){const s=b[1]||"";t.push(_.replace(/:/g,"\\:")+":"+s)}else t.push(_)}))}optionCompletions(t,s,b,_){if((_.match(/^-/)||""===_&&0===t.length)&&!this.previousArgHasChoices(s)){const b=this.yargs.getOptions(),F=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(b.key).forEach((R=>{const T=!!b.configuration["boolean-negation"]&&b.boolean.includes(R);F.includes(R)||b.hiddenOptions.includes(R)||this.argsContainKey(s,R,T)||(this.completeOptionKey(R,t,_),T&&b.default[R]&&this.completeOptionKey(`no-${R}`,t,_))}))}}choicesFromOptionsCompletions(t,s,b,_){if(this.previousArgHasChoices(s)){const b=this.getPreviousArgChoices(s);b&&b.length>0&&t.push(...b.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,s,b,_){if(""===_&&t.length>0&&this.previousArgHasChoices(s))return;const F=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],R=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),T=F[b._.length-R-1];if(!T)return;const L=this.yargs.getOptions().choices[T]||[];for(const s of L)s.startsWith(_)&&t.push(s.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let s=t[t.length-1],b="";if(!s.startsWith("-")&&t.length>1&&(b=s,s=t[t.length-2]),!s.startsWith("-"))return;const _=s.replace(/^-+/,""),F=this.yargs.getOptions(),R=[_,...this.yargs.getAliases()[_]||[]];let T;for(const t of R)if(Object.prototype.hasOwnProperty.call(F.key,t)&&Array.isArray(F.choices[t])){T=F.choices[t];break}return T?T.filter((t=>!b||t.startsWith(b))):void 0}previousArgHasChoices(t){const s=this.getPreviousArgChoices(t);return void 0!==s&&s.length>0}argsContainKey(t,s,b){const i=s=>-1!==t.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s);if(i(s))return!0;if(b&&i(`no-${s}`))return!0;if(this.aliases)for(const t of this.aliases[s])if(i(t))return!0;return!1}completeOptionKey(t,s,b){const _=this.usage.getDescriptions(),F=!/^--/.test(b)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";if(this.zshShell){const b=_[t]||"";s.push(F+`${t.replace(/:/g,"\\:")}:${b.replace("__yargsString__:","")}`)}else s.push(F+t)}customCompletion(t,s,b,_){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(b,s);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{_(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{_(t,void 0)}))})):_(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(b,s,((F=_)=>this.defaultCompletion(t,s,b,F)),(t=>{_(null,t)})):this.customCompletionFunction(b,s,(t=>{_(null,t)}))}getCompletion(t,s){const b=t.length?t[t.length-1]:"",_=this.yargs.parse(t,!0),F=this.customCompletionFunction?_=>this.customCompletion(t,_,b,s):_=>this.defaultCompletion(t,_,b,s);return f(_)?_.then(F):F(_)}generateCompletionScript(t,s){let b=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const _=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),b=b.replace(/{{app_name}}/g,_),b=b.replace(/{{completion_command}}/g,s),b.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,s){if(0===t.length)return s.length;if(0===s.length)return t.length;const b=[];let _,F;for(_=0;_<=s.length;_++)b[_]=[_];for(F=0;F<=t.length;F++)b[0][F]=F;for(_=1;_<=s.length;_++)for(F=1;F<=t.length;F++)s.charAt(_-1)===t.charAt(F-1)?b[_][F]=b[_-1][F-1]:_>1&&F>1&&s.charAt(_-2)===t.charAt(F-1)&&s.charAt(_-1)===t.charAt(F-2)?b[_][F]=b[_-2][F-2]+1:b[_][F]=Math.min(b[_-1][F-1]+1,Math.min(b[_][F-1]+1,b[_-1][F]+1));return b[s.length][t.length]}const U=["$0","--","_"];var q,H,W,V,G,Y,z,X,K,J,Z,Q,ee,te,ne,re,ie,se,oe,ae,ue,le,ce,fe,de,he,pe,ge,me,De,ve,ye,Ee,be;const we=Symbol("copyDoubleDash"),Ce=Symbol("copyDoubleDash"),Oe=Symbol("deleteFromParserHintObject"),Ae=Symbol("emitWarning"),_e=Symbol("freeze"),Fe=Symbol("getDollarZero"),Se=Symbol("getParserConfiguration"),xe=Symbol("guessLocale"),ke=Symbol("guessVersion"),Pe=Symbol("parsePositionalNumbers"),je=Symbol("pkgUp"),Re=Symbol("populateParserHintArray"),Ie=Symbol("populateParserHintSingleValueDictionary"),Me=Symbol("populateParserHintArrayDictionary"),Te=Symbol("populateParserHintDictionary"),Ne=Symbol("sanitizeKey"),Le=Symbol("setKey"),Be=Symbol("unfreeze"),$e=Symbol("validateAsync"),Ue=Symbol("getCommandInstance"),qe=Symbol("getContext"),He=Symbol("getHasOutput"),We=Symbol("getLoggerInstance"),Ve=Symbol("getParseContext"),Ge=Symbol("getUsageInstance"),Ye=Symbol("getValidationInstance"),ze=Symbol("hasParseCallback"),Xe=Symbol("isGlobalContext"),Ke=Symbol("postProcess"),Je=Symbol("rebase"),Ze=Symbol("reset"),Qe=Symbol("runYargsParserAndExecuteCommands"),et=Symbol("runValidation"),tt=Symbol("setHasOutput"),nt=Symbol("kTrackManuallySetKeys");class Xt{constructor(t=[],s,b,_){this.customScriptName=!1,this.parsed=!1,q.set(this,void 0),H.set(this,void 0),W.set(this,{commands:[],fullCommands:[]}),V.set(this,null),G.set(this,null),Y.set(this,"show-hidden"),z.set(this,null),X.set(this,!0),K.set(this,{}),J.set(this,!0),Z.set(this,[]),Q.set(this,void 0),ee.set(this,{}),te.set(this,!1),ne.set(this,null),re.set(this,!0),ie.set(this,void 0),se.set(this,""),oe.set(this,void 0),ae.set(this,void 0),ue.set(this,{}),le.set(this,null),ce.set(this,null),fe.set(this,{}),de.set(this,{}),he.set(this,void 0),pe.set(this,!1),ge.set(this,void 0),me.set(this,!1),De.set(this,!1),ve.set(this,!1),ye.set(this,void 0),Ee.set(this,null),be.set(this,void 0),O(this,ge,_,"f"),O(this,he,t,"f"),O(this,H,s,"f"),O(this,ae,b,"f"),O(this,Q,new w(this),"f"),this.$0=this[Fe](),this[Ze](),O(this,q,v(this,q,"f"),"f"),O(this,ye,v(this,ye,"f"),"f"),O(this,be,v(this,be,"f"),"f"),O(this,oe,v(this,oe,"f"),"f"),v(this,oe,"f").showHiddenOpt=v(this,Y,"f"),O(this,ie,this[Ce](),"f")}addHelpOpt(t,s){return h("[string|boolean] [string]",[t,s],arguments.length),v(this,ne,"f")&&(this[Oe](v(this,ne,"f")),O(this,ne,null,"f")),!1===t&&void 0===s||(O(this,ne,"string"==typeof t?t:"help","f"),this.boolean(v(this,ne,"f")),this.describe(v(this,ne,"f"),s||v(this,ye,"f").deferY18nLookup("Show help"))),this}help(t,s){return this.addHelpOpt(t,s)}addShowHiddenOpt(t,s){if(h("[string|boolean] [string]",[t,s],arguments.length),!1===t&&void 0===s)return this;const b="string"==typeof t?t:v(this,Y,"f");return this.boolean(b),this.describe(b,s||v(this,ye,"f").deferY18nLookup("Show hidden options")),v(this,oe,"f").showHiddenOpt=b,this}showHidden(t,s){return this.addShowHiddenOpt(t,s)}alias(t,s){return h("