Skip to content

Smithery: fix build entry by adding module field in package.json#19

Merged
cloudbring merged 4 commits into
masterfrom
chore/smithery-fix-entry
Aug 9, 2025
Merged

Smithery: fix build entry by adding module field in package.json#19
cloudbring merged 4 commits into
masterfrom
chore/smithery-fix-entry

Conversation

@cloudbring
Copy link
Copy Markdown
Owner

@cloudbring cloudbring commented Aug 9, 2025

  • Add "module": "./src/server.ts" so @smithery/cli build can find an entry point
  • Matches smithery.yaml entry: src/server.ts
  • Local tests and build pass

This should unblock Smithery’s Docker build step that failed with:
"No entry point found in package.json. Please define the "module" field"

Summary by CodeRabbit

  • Chores
    • Updated continuous integration to test across multiple Node.js versions and improved workflow permissions.
    • Adjusted test coverage reporting and artifact handling for Node.js 22.x.
    • Upgraded Codecov action for coverage uploads and improved error handling in artifact uploads.
    • Updated build process to use Node.js 22.x.
    • Added a module entry point to the package manifest for improved compatibility.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 9, 2025

Walkthrough

The CI workflow was updated to test against Node.js versions 20.x, 22.x, and 24.x, with conditional coverage and integration steps for 22.x only. Coverage upload and artifact steps are refined, and action versions are updated. The build-and-publish job now uses Node.js 22.x. Additionally, the package.json adds a "module" field referencing src/server.ts.

Changes

Cohort / File(s) Change Summary
CI Workflow Updates
.github/workflows/ci.yml
Expanded test matrix to Node.js 20.x, 22.x, 24.x; conditional coverage/integration for 22.x; updated action versions; refined artifact and Codecov steps; set explicit permissions; build-and-publish now uses 22.x.
Package Manifest Update
package.json
Added "module": "./src/server.ts" to specify the module entry point.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Actions
    participant Matrix (Node 20.x/22.x/24.x)
    participant Test Runner
    participant Codecov

    GitHub Actions->>Matrix: Start job (Node.js 20.x, 22.x, 24.x)
    alt Node.js 22.x
        Matrix->>Test Runner: Run tests with coverage + integration
        Test Runner->>Codecov: Upload coverage
    else Node.js 20.x or 24.x
        Matrix->>Test Runner: Run unit tests only
    end
    alt Node.js 22.x
        Matrix->>GitHub Actions: Upload HTML coverage artifact
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Possibly related PRs

Poem

Three Node.js hares now hop in line,
Twenty, twenty-two, and twenty-four—how fine!
Coverage leaps for twenty-two alone,
While a new module field is clearly shown.
CI fields and package paths align,
In this garden, all builds entwine. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/smithery-fix-entry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
package.json (1)

5-5: Smithery fix looks correct, but verify publish-time implications of pointing "module" at TS source.

Adding "module": "./src/server.ts" satisfies @smithery/cli’s entry-point requirement. However, your "files" whitelist excludes src/, so the published tarball will contain package.json advertising a "module" that doesn’t exist in the package. Some bundlers prefer "module" over "main" and may try to resolve it when consumers import this package.

Recommended:

  • Keep "module" for Smithery.
  • Add an "exports" map that directs both ESM and CJS consumers to the built artifact in dist/ to avoid accidental TS resolution by bundlers.
  • Optionally add "types" if you intend to be importable as a library.

Example (non-diff, for clarity):

{
  "exports": {
    ".": {
      "import": "./dist/server.js",
      "require": "./dist/server.js",
      "default": "./dist/server.js"
    }
  },
  "types": "./dist/server.d.ts"
}

If this package is strictly a CLI and not meant to be imported, consider adding "private": false (already implied) and documenting that import is unsupported, or add "exports": { ".": "./dist/server.js" } to keep imports predictable.

.github/workflows/ci.yml (1)

94-94: Build-and-publish on Node 22.x aligns with test matrix.

Consider adding npm cache to speed the job:

- - uses: actions/setup-node@v4
+ - uses: actions/setup-node@v4
    with:
      node-version: '22.x'
      registry-url: 'https://registry.npmjs.org'
+     cache: 'npm'
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5342450 and 77941bb.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (3 hunks)
  • package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test (24.x)
🔇 Additional comments (7)
.github/workflows/ci.yml (7)

12-14: Good permissions hardening for test job.

Minimal permissions plus id-token: write is appropriate for OIDC (Codecov v4).


16-16: fail-fast disabled is appropriate for matrix reliability.

Prevents early termination from masking per-version failures.


18-18: Matrix bump to 20.x/22.x/24.x looks good.

Covers current and next Node lines; aligns with build-and-publish on 22.x.


49-52: Split unit-only path for non-22.x is clear and correct.

Keeps matrix runtime sensible.


63-63: Artifact upload conditioned to 22.x only is sensible.

Reduces noise and storage; good use of always().


68-68: Nice touch using if-no-files-found: warn.

Prevents hard failures when coverage output changes.


72-72: Coverage summary append scoped to 22.x is appropriate.

Concise summary improves UX without spamming other matrix jobs.

Comment thread .github/workflows/ci.yml
run: npm run typecheck

- name: Run tests with coverage (and integration)
if: matrix.node-version == '22.x'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Gate integration/coverage step to avoid secret-less fork PRs.

On forked PRs, secrets.* are unavailable; running integration may fail. Consider additionally gating by event or fork status.

Suggested change:

- if: matrix.node-version == '22.x'
+ if: matrix.node-version == '22.x' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)

This keeps full coverage/integration on branch pushes and trusted PRs while avoiding failures on forks.

🤖 Prompt for AI Agents
In .github/workflows/ci.yml at line 42, the condition for running the
integration/coverage step only checks for node version '22.x' but does not
prevent execution on forked PRs where secrets are unavailable. Modify the if
condition to also check that the event is not a pull request from a fork or that
secrets are available, for example by gating on the event type or checking if
the repository is the base repo. This will prevent running the step on forked
PRs without secrets, avoiding failures while preserving coverage on branch
pushes and trusted PRs.

Comment thread .github/workflows/ci.yml
Comment on lines +54 to 58
if: matrix.node-version == '22.x'
uses: codecov/codecov-action@v4
with:
file: ./coverage/coverage-final.json
files: ./coverage/coverage-final.json
flags: unittests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Codecov v4: explicitly enable OIDC and consider token fallback.

With id-token: write, be explicit to avoid ambiguity and future regressions:

- uses: codecov/codecov-action@v4
+ uses: codecov/codecov-action@v4
  with:
    files: ./coverage/coverage-final.json
+   use_oidc: true
    flags: unittests
    name: codecov-umbrella
    fail_ci_if_error: false

If the repo becomes private or you encounter OIDC issues, add:

token: ${{ secrets.CODECOV_TOKEN }}
🤖 Prompt for AI Agents
In .github/workflows/ci.yml around lines 54 to 58, explicitly add the parameter
'id-token: write' to the codecov-action step to enable OIDC authentication
clearly. Additionally, include a fallback by adding 'token: ${{
secrets.CODECOV_TOKEN }}' under 'with:' to handle cases where the repository is
private or OIDC fails. This ensures secure and reliable authentication for the
Codecov upload.

@cloudbring cloudbring merged commit 59e067b into master Aug 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant