Skip to content

Conversation

@gagik
Copy link
Collaborator

@gagik gagik commented Dec 15, 2025

This allows for more flexibility when parsing, including specifying custom defaults, environment prefixes, etc..

@gagik gagik requested a review from a team as a code owner December 15, 2025 09:48
Copilot AI review requested due to automatic review settings December 15, 2025 09:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR renames createUserConfig to parseUserConfig and adds support for schema overrides and custom parser options. The changes enable more flexible configuration parsing, including custom environment variable prefixes and default value overrides.

Key changes:

  • Renamed createUserConfig to parseUserConfig throughout the codebase
  • Added support for schema overrides through a new overrides parameter
  • Exposed ParserOptions type and defaultParserOptions for customization
  • Updated public API exports to reflect the new naming

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/common/config/createUserConfig.ts Renamed to parseUserConfig.ts; added overrides and parserOptions parameters to support custom schemas and parser configuration
tests/unit/common/config.test.ts Updated all test calls from createUserConfig to parseUserConfig; added tests for schema overrides and custom environment prefixes
src/lib.ts Updated exports to expose parseUserConfig, defaultParserOptions, and ParserOptions type instead of parseCliArgumentsAsUserConfig
src/index.ts Updated import to use parseUserConfig instead of createUserConfig
src/transports/base.ts Updated documentation comments to reference parseUserConfig instead of createUserConfig
eslint-rules/enforce-zod-v4.js Updated allowed file path from createUserConfig.ts to parseUserConfig.ts
MCP_SERVER_LIBRARY.md Updated documentation to reflect parseUserConfig naming and simplified function signature

export { Server, type ServerOptions } from "./server.js";
export { Session, type SessionOptions } from "./common/session.js";
export { type UserConfig, UserConfigSchema } from "./common/config/userConfig.js";
export { createUserConfig as parseCliArgumentsAsUserConfig } from "./common/config/createUserConfig.js";
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so I unfortunately missed that we're doing this; it's weird to have this discrepancy where our external export is named differently than our internal one. To me the idea that the name isn't straightforward was a code smell.

parseCliArgumentsAsUserConfig is inherently misleading though since by default it also parses environment variables. This can mislead users so it's best to rename it.

It is technically a library breaking change though.

@coveralls
Copy link
Collaborator

coveralls commented Dec 15, 2025

Pull Request Test Coverage Report for Build 20228819696

Details

  • 36 of 38 (94.74%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 80.403%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/index.ts 0 2 0.0%
Totals Coverage Status
Change from base Build 20169939886: 0.3%
Covered Lines: 6706
Relevant Lines: 8255

💛 - Coveralls

```typescript
function parseCliArgumentsAsUserConfig(options?: {
args?: string[];
helpers?: CreateUserConfigHelpers;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the concept of CreateUserConfigHelpers was unused.

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.

3 participants