Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,25 @@ export default [
}],
'n/no-process-exit': 0,
// Disallow console.log/info in runtime to protect STDIO; allow warn/error
'no-console': ['error', { allow: ['warn', 'error'] }]
'no-console': ['error', { allow: ['warn', 'error'] }],
// Custom syntax rules
'no-restricted-syntax': [
'error',
{
// Disallow rest parameters in a property named `keyHash`
selector:
"Property[key.name='keyHash'] > :matches(FunctionExpression, ArrowFunctionExpression) > RestElement",
message:
'keyHash must accept a single array parameter (args). Do not use rest params (...args).'
},
{
// Also catch when `keyHash` lives in a CallExpression options object (e.g., memo(fn, { keyHash() {} }))
selector:
"CallExpression > ObjectExpression > Property[key.name='keyHash'] > :matches(FunctionExpression, ArrowFunctionExpression) > RestElement",
message:
'keyHash must accept a single array parameter (args). Do not use rest params (...args).'
}
]
}
},
{
Expand Down
25 changes: 24 additions & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,30 @@ export default {
roots: ['src'],
testMatch: ['<rootDir>/src/**/*.test.ts'],
setupFilesAfterEnv: ['<rootDir>/jest.setupTests.ts'],
...baseConfig
...baseConfig,
transform: {
'^.+\\.(ts|tsx)$': [
'ts-jest',
{
...tsConfig,
diagnostics: {
ignoreCodes: [1343]
},
astTransformers: {
before: [
{
path: 'ts-jest-mock-import-meta',
options: {
metaObjectReplacement: {
url: 'file:///mock/import-meta-url'
}
}
}
]
}
}
]
}
},
{
displayName: 'e2e',
Expand Down
19 changes: 15 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
"description": "PatternFly documentation MCP server built with Node.js and TypeScript",
"main": "dist/index.js",
"type": "module",
"imports": {
"#toolsHost": "./dist/server.toolsHost.js"
},
"exports": {
".": "./dist/index.js"
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"bin": {
"patternfly-mcp": "dist/cli.js",
Expand Down Expand Up @@ -47,7 +53,7 @@
"author": "Red Hat",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "1.24.2",
"@modelcontextprotocol/sdk": "1.24.3",
"@patternfly/patternfly-component-schemas": "1.2.0",
"fastest-levenshtein": "1.0.16",
"pid-port": "2.0.0",
Expand All @@ -64,6 +70,7 @@
"jest": "^30.2.0",
"pkgroll": "^2.20.1",
"ts-jest": "29.4.4",
"ts-jest-mock-import-meta": "^1.3.1",
"ts-node": "^10.1.0",
"tsx": "^4.21.0",
"typescript": "^5.9.3",
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/__snapshots__/options.defaults.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ exports[`options defaults should return specific properties: defaults 1`] = `
"invokeTimeoutMs": 10000,
"loadTimeoutMs": 5000,
},
"pluginIsolation": "none",
"repoName": "patternfly-mcp",
"resourceMemoOptions": {
"default": {
Expand Down Expand Up @@ -70,6 +71,7 @@ exports[`options defaults should return specific properties: defaults 1`] = `
"expire": 60000,
},
},
"toolModules": [],
"urlRegex": /\\^\\(https\\?:\\)\\\\/\\\\//i,
"version": "0.0.0",
}
Expand Down
25 changes: 25 additions & 0 deletions src/__tests__/__snapshots__/server.tools.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`composeTools should handle IPC errors gracefully: warn 1`] = `
[
[
"Failed to resolve file path: ./test-module.js: TypeError: {(intermediate value)}.resolve is not a function",
],
]
`;

exports[`composeTools should handle spawn errors gracefully: warn 1`] = `
[
[
"Failed to resolve file path: ./test-module.js: TypeError: {(intermediate value)}.resolve is not a function",
],
]
`;

exports[`composeTools should log warnings and errors from load: warn 1`] = `
[
[
"Failed to resolve file path: ./test-module.js: TypeError: {(intermediate value)}.resolve is not a function",
],
]
`;
Loading
Loading