Skip to content

Commit 20402e1

Browse files
committed
feat(patternFly): find closest pf version
* build, semver package for version checks * docs, guidance example aligned * options, semver defaults for available patternfly * patternFly.helpers, find closest pf version * server.getResources, findNearestPackageJson, matchPackageVersion * server.helpers, expand isUrl, add isPath * server.toolsUser, move to isUrl, isPath from server.helpers
1 parent 1e10745 commit 20402e1

15 files changed

Lines changed: 697 additions & 234 deletions

cspell.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"onsessionclosed",
1212
"patternfly",
1313
"rereview",
14+
"rsort",
1415
"sparkline",
1516
"streamable",
1617
"unrepresentable",

guidelines/agent_behaviors.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,15 @@ When implementing tools that interact with the local filesystem, always use `res
118118
```typescript
119119
import { resolveLocalPathFunction } from './server.getResources';
120120
// ...
121-
const safePath = await resolveLocalPathFunction(requestedPath, rootDir);
121+
let safePath;
122122

123-
if (!safePath) {
123+
try {
124+
safePath = resolveLocalPathFunction(requestedPath);
125+
} catch {
124126
throw new McpError(ErrorCode.InvalidParams, 'Access denied');
125127
}
128+
129+
// use safePath for subsequent file operations
126130
```
127131

128132
### 6.2 Plugin Isolation

package-lock.json

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

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@
5959
"@patternfly/patternfly-component-schemas": "1.2.0",
6060
"fastest-levenshtein": "1.0.16",
6161
"pid-port": "2.0.1",
62+
"semver": "7.7.3",
6263
"zod": "4.3.5"
6364
},
6465
"devDependencies": {
6566
"@cdcabrera/eslint-config-toolkit": "^0.4.0",
6667
"@types/jest": "^30.0.0",
6768
"@types/node": "^25.0.10",
69+
"@types/semver": "7.7.1",
6870
"@typescript-eslint/eslint-plugin": "^8.54.0",
6971
"@typescript-eslint/parser": "^8.54.0",
7072
"changelog-light": "^3.0.5",

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ exports[`options defaults should return specific properties: defaults 1`] = `
3232
"nodeVersion": 22,
3333
"patternflyOptions": {
3434
"availableResourceVersions": [
35-
"v6",
35+
"6.0.0",
3636
],
3737
"default": {
38-
"defaultVersion": "v6",
38+
"defaultVersion": "6.0.0",
3939
"versionStrategy": "highest",
4040
"versionWhitelist": [
4141
"@patternfly/react-core",

0 commit comments

Comments
 (0)