From a2f4ab0da110a469c0621b0e6af1da9c705400ad Mon Sep 17 00:00:00 2001 From: Cory Rylan Date: Fri, 26 Jun 2026 14:38:43 -0500 Subject: [PATCH] fix(cli): version and updater checks - Added support for versioning output files in the build process, ensuring that the correct version is written to bundled files. - Introduced a new utility function to replace bundled constants in the output files, improving maintainability. - Updated the installation script to utilize the embedded build SHA and version, enhancing the manifest generation. - Refactored error handling in the update check to ensure proper feedback when the SHA is missing. Signed-off-by: Cory Rylan --- .github/workflows/ci.yml | 51 ++++++- projects/cli/README.md | 2 +- projects/cli/package.json | 2 +- .../cli/scripts/write-install-manifest.mjs | 18 ++- projects/cli/server.json | 31 ++++ projects/cli/src/index.test.ts | 55 +++++++ projects/cli/src/index.ts | 72 ++++++---- projects/cli/src/install.test.ts | 64 ++++++++- projects/cli/src/install.ts | 11 +- projects/cli/src/update.test.ts | 40 +++++- projects/cli/src/update.ts | 9 +- projects/cli/src/utils.test.ts | 135 +++++++++++++++++- projects/cli/src/utils.ts | 73 ++++++++-- projects/cli/vite.config.ts | 12 +- .../internals/tools/src/api/utils.test.ts | 33 +++-- projects/internals/tools/src/api/utils.ts | 4 +- .../internals/tools/src/cli/utils.test.ts | 9 ++ projects/internals/tools/src/cli/utils.ts | 2 +- .../tools/src/playground/utils.test.ts | 2 +- .../internals/tools/src/playground/utils.ts | 4 +- .../tools/src/project/health.test.ts | 23 ++- .../internals/tools/src/project/health.ts | 31 ++-- projects/internals/vite/src/configs/build.js | 10 +- .../internals/vite/src/configs/build.node.js | 10 +- projects/internals/vite/src/configs/env.js | 36 +++++ projects/internals/vite/src/configs/test.js | 10 +- .../internals/vite/src/configs/test.node.js | 10 +- projects/site/src/_11ty/utils/env.js | 22 ++- projects/site/src/_11ty/utils/env.test.ts | 67 --------- projects/site/src/docs/cli/index.md | 4 +- release.config.js | 29 +++- 31 files changed, 667 insertions(+), 214 deletions(-) create mode 100644 projects/cli/server.json create mode 100644 projects/internals/vite/src/configs/env.js delete mode 100644 projects/site/src/_11ty/utils/env.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd5487fab..38b9e74be7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,6 @@ jobs: # On main, checkout credentials must match the release token used by that dry-run. token: ${{ github.ref == 'refs/heads/main' && secrets.RELEASE_TOKEN || github.token }} - uses: ./.github/actions/setup-ci - # - uses: google/wireit@setup-github-actions-caching/v2 - name: Run CI checks env: ELEMENTS_PAGES_BASE_URL: ${{vars.ELEMENTS_PAGES_BASE_URL}} @@ -77,7 +76,6 @@ jobs: fetch-depth: 0 lfs: true - uses: ./.github/actions/setup-ci - # - uses: google/wireit@setup-github-actions-caching/v2 - name: Run Lighthouse tests run: WIREIT_FAILURES=kill pnpm run lighthouse && node ./projects/internals/ci/cache-validate.js lighthouse && node ./projects/internals/ci/metrics.lighthouse.js - name: Write lighthouse job summary @@ -120,6 +118,51 @@ jobs: GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} run: WIREIT_PARALLEL=1 WIREIT_LOGGER=metrics pnpm run release + - name: Upload MCP server manifest + uses: actions/upload-artifact@v7 + with: + name: mcp-server + retention-days: 1 + path: projects/cli/server.json + + publish-mcp: + needs: release + runs-on: ubuntu-latest + permissions: + id-token: write + concurrency: mcp-registry-publish + steps: + - name: Download MCP server manifest + uses: actions/download-artifact@v8 + with: + name: mcp-server + path: projects/cli + - name: Check MCP Registry + id: registry + run: | + path=$(jq -r '[.name, .version] | map(@uri) | join("/versions/")' projects/cli/server.json) + status=$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' \ + --retry 3 --retry-all-errors --connect-timeout 10 --max-time 30 \ + "https://registry.modelcontextprotocol.io/v0.1/servers/$path") + + case "$status" in + 200) publish=false ;; + 404) publish=true ;; + *) + echo "Unexpected MCP Registry response: HTTP $status" >&2 + exit 1 + ;; + esac + echo "publish=$publish" >> "$GITHUB_OUTPUT" + - name: Publish to MCP Registry + if: steps.registry.outputs.publish == 'true' + run: | + curl --fail --location --show-error \ + "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" \ + | tar xz mcp-publisher + ./mcp-publisher validate projects/cli/server.json + ./mcp-publisher login github-oidc + ./mcp-publisher publish projects/cli/server.json deploy-pages: needs: ci @@ -131,9 +174,7 @@ jobs: environment: name: github-pages url: ${{steps.deployment.outputs.page_url}} - concurrency: - group: pages - cancel-in-progress: false + concurrency: pages steps: - name: Deploy to GitHub Pages id: deployment diff --git a/projects/cli/README.md b/projects/cli/README.md index 706b5a8488..b1c59db4d3 100644 --- a/projects/cli/README.md +++ b/projects/cli/README.md @@ -52,7 +52,7 @@ npm install -g @nvidia-elements/cli | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------- | | `nve` | Show About and help output. | | `nve api.list [format]` | Get a list of all available Elements (`nve-*`) APIs and components. | -| `nve api.get [format]` | Get documentation for known components or attributes by name (`nve-*`). | +| `nve api.get [--format ]` | Get documentation for one to five known components or attributes (`nve-*`). | | `nve api.template.validate