feat: introducing Tool Name Strategy option (fixes: #6)#8
fixes: https://github.com/ryoppippi/sitemcp/issues/6 I tested with the config below: ```json { "mcpServers": { "FSD": { "command": "/Users/username/.nodenv/shims/npx", // Using path to npx because of nodenv "args": [ "-y", "https://pkg.pr.new/ryoppippi/sitemcp@5937251", "https://feature-sliced.github.io/documentation/", "-t", "subdomain" ], "logLevel": "warn" } } } ``` and it works!! <img width="872" alt="SCR-20250409-rwaj" src="https://github.com/user-attachments/assets/f01369b3-e82c-40dd-adef-1d8a974b468e" /> This pull request introduces several new features and improvements across multiple files, primarily focusing on adding a tool name strategy option and enhancing test coverage. The most important changes include adding the `tool-name-strategy` option, updating related server and utility functions, and expanding the test suite. ### New Features: * [`src/cli.ts`](diffhunk://#diff-fa8d4e24d8399e8350f1c8bad05df53e8032ea995835bf911507015e2db61cddR17-R20): Added a new command-line option `-t, --tool-name-strategy` to specify the tool name strategy. (`[src/cli.tsR17-R20](diffhunk://#diff-fa8d4e24d8399e8350f1c8bad05df53e8032ea995835bf911507015e2db61cddR17-R20)`) * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R45-R55): Documented the new `-t, --tool-name-strategy` option with examples. (`[README.mdR45-R55](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R45-R55)`) ### Server and Utility Function Updates: * [`src/server.ts`](diffhunk://#diff-8a8ae07582c9d433ec8c2e5c4310ff8901e604f4965c5b90a49117ad46c47595R26): Updated the `startServer` function to accept and handle the `toolNameStrategy` option, defaulting to "domain". (`[[1]](diffhunk://#diff-8a8ae07582c9d433ec8c2e5c4310ff8901e604f4965c5b90a49117ad46c47595R26)`, `[[2]](diffhunk://#diff-8a8ae07582c9d433ec8c2e5c4310ff8901e604f4965c5b90a49117ad46c47595R39)`, `[[3]](diffhunk://#diff-8a8ae07582c9d433ec8c2e5c4310ff8901e604f4965c5b90a49117ad46c47595L94-R99)`) * [`src/types.ts`](diffhunk://#diff-c54113cf61ec99691748a3890bfbeb00e10efb3f0a76f03a0fd9ec49072e410aR36-R37): Added a new type `ToolNameStrategy` to define the possible values for the tool name strategy. (`[src/types.tsR36-R37](diffhunk://#diff-c54113cf61ec99691748a3890bfbeb00e10efb3f0a76f03a0fd9ec49072e410aR36-R37)`) * [`src/utils.ts`](diffhunk://#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351L48-R120): Refactored the `sanitizeToolName` function to use the new strategy types and added helper functions `getSubdomain`, `getDomain`, and `getPathname`. (`[src/utils.tsL48-R120](diffhunk://#diff-39b2554fd18da165b59a6351b1aafff3714e2a80c1435f2de9706355b4d32351L48-R120)`) ### Test Coverage: * [`src/utils.test.ts`](diffhunk://#diff-04abd0e283864d1e858d70a5f86f67ccf45fcd3b752e56b136c3eee449b06b28R1-R50): Added tests for the new utility functions and the updated `sanitizeToolName` function to ensure proper functionality. (`[src/utils.test.tsR1-R50](diffhunk://#diff-04abd0e283864d1e858d70a5f86f67ccf45fcd3b752e56b136c3eee449b06b28R1-R50)`) ### Additional Changes: * [`.github/workflows/ci.yaml`](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddR18): Added a step to run tests in the CI workflow. (`[.github/workflows/ci.yamlR18](diffhunk://#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddR18)`) * [`package.json`](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R15): Added a new script for running tests and included the `just-pascal-case` dependency. (`[[1]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R15)`, `[[2]](diffhunk://#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R40)`)
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by ryoppippi and has received 1 comments.