Skip to content

Commit 9bc2b16

Browse files
committed
feat(tools-user): user facing tools-as-plugins
1 parent be4f884 commit 9bc2b16

18 files changed

+4068
-9
lines changed

eslint.config.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,25 @@ export default [
8181
}],
8282
'n/no-process-exit': 0,
8383
// Disallow console.log/info in runtime to protect STDIO; allow warn/error
84-
'no-console': ['error', { allow: ['warn', 'error'] }]
84+
'no-console': ['error', { allow: ['warn', 'error'] }],
85+
// Custom syntax rules
86+
'no-restricted-syntax': [
87+
'error',
88+
{
89+
// Disallow rest parameters in a property named `keyHash`
90+
selector:
91+
"Property[key.name='keyHash'] > :matches(FunctionExpression, ArrowFunctionExpression) > RestElement",
92+
message:
93+
'keyHash must accept a single array parameter (args). Do not use rest params (...args).'
94+
},
95+
{
96+
// Also catch when `keyHash` lives in a CallExpression options object (e.g., memo(fn, { keyHash() {} }))
97+
selector:
98+
"CallExpression > ObjectExpression > Property[key.name='keyHash'] > :matches(FunctionExpression, ArrowFunctionExpression) > RestElement",
99+
message:
100+
'keyHash must accept a single array parameter (args). Do not use rest params (...args).'
101+
}
102+
]
85103
}
86104
},
87105
{

jest.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,25 @@ export default {
2525
roots: ['src'],
2626
testMatch: ['<rootDir>/src/**/*.test.ts'],
2727
setupFilesAfterEnv: ['<rootDir>/jest.setupTests.ts'],
28-
...baseConfig
28+
...baseConfig,
29+
transform: {
30+
'^.+\\.(ts|tsx)$': [
31+
'ts-jest',
32+
{
33+
...tsConfig,
34+
diagnostics: {
35+
ignoreCodes: [1343]
36+
},
37+
astTransformers: {
38+
before: [
39+
{
40+
path: 'ts-jest-mock-import-meta'
41+
}
42+
]
43+
}
44+
}
45+
]
46+
}
2947
},
3048
{
3149
displayName: 'e2e',

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44
"description": "PatternFly documentation MCP server built with Node.js and TypeScript",
55
"main": "dist/index.js",
66
"type": "module",
7+
"imports": {
8+
"#toolsHost": "./dist/server.toolsHost.js"
9+
},
710
"exports": {
8-
".": "./dist/index.js"
11+
".": {
12+
"types": "./dist/index.d.ts",
13+
"default": "./dist/index.js"
14+
}
915
},
1016
"bin": {
1117
"patternfly-mcp": "dist/cli.js",
@@ -64,6 +70,7 @@
6470
"jest": "^30.2.0",
6571
"pkgroll": "^2.20.1",
6672
"ts-jest": "29.4.4",
73+
"ts-jest-mock-import-meta": "^1.3.1",
6774
"ts-node": "^10.1.0",
6875
"tsx": "^4.21.0",
6976
"typescript": "^5.9.3",

src/__tests__/__snapshots__/options.defaults.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ exports[`options defaults should return specific properties: defaults 1`] = `
3737
"invokeTimeoutMs": 10000,
3838
"loadTimeoutMs": 5000,
3939
},
40+
"pluginIsolation": "none",
4041
"repoName": "patternfly-mcp",
4142
"resourceMemoOptions": {
4243
"default": {
@@ -70,6 +71,7 @@ exports[`options defaults should return specific properties: defaults 1`] = `
7071
"expire": 60000,
7172
},
7273
},
74+
"toolModules": [],
7375
"urlRegex": /\\^\\(https\\?:\\)\\\\/\\\\//i,
7476
"version": "0.0.0",
7577
}

0 commit comments

Comments
 (0)