@slbdn/mcp-tester 1.4.3 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/README.md +49 -0
- package/dist/ai/provider.d.ts +145 -0
- package/dist/ai/provider.d.ts.map +1 -0
- package/dist/ai/provider.js +428 -0
- package/dist/ai/provider.js.map +1 -0
- package/dist/cli/index.js +214 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/generate-cases.d.ts +113 -0
- package/dist/generate-cases.d.ts.map +1 -0
- package/dist/generate-cases.js +565 -0
- package/dist/generate-cases.js.map +1 -0
- package/dist/generate-tests.d.ts +52 -1
- package/dist/generate-tests.d.ts.map +1 -1
- package/dist/generate-tests.js +208 -81
- package/dist/generate-tests.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/matchers.d.ts +31 -21
- package/dist/matchers.d.ts.map +1 -1
- package/dist/matchers.js.map +1 -1
- package/dist/templates/full-stack/.github/workflows/test.yml +34 -0
- package/dist/templates/full-stack/README.md +73 -0
- package/dist/templates/full-stack/examples/mock-server.js +115 -0
- package/dist/templates/full-stack/jest.config.js +39 -0
- package/dist/templates/full-stack/package.json +31 -0
- package/dist/templates/full-stack/scripts/generate-tests.ts +32 -0
- package/dist/templates/full-stack/scripts/generate-types.ts +28 -0
- package/dist/templates/full-stack/src/server.ts +78 -0
- package/dist/templates/full-stack/tests/helpers.ts +29 -0
- package/dist/templates/full-stack/tests/parallel.test.ts +44 -0
- package/dist/templates/full-stack/tests/server.test.ts +36 -0
- package/dist/templates/full-stack/tests/tools.test.ts +61 -0
- package/dist/templates/full-stack/tsconfig.json +19 -0
- package/dist/templates/minimal-jest/README.md +42 -0
- package/dist/templates/minimal-jest/examples/mock-server.js +62 -0
- package/dist/templates/minimal-jest/jest.config.js +24 -0
- package/dist/templates/minimal-jest/package.json +24 -0
- package/dist/templates/minimal-jest/tests/server.test.ts +64 -0
- package/dist/templates/minimal-jest/tsconfig.json +19 -0
- package/dist/templates/standard-jest/.github/workflows/test.yml +32 -0
- package/dist/templates/standard-jest/README.md +44 -0
- package/dist/templates/standard-jest/examples/mock-server.js +122 -0
- package/dist/templates/standard-jest/jest.config.js +39 -0
- package/dist/templates/standard-jest/package.json +27 -0
- package/dist/templates/standard-jest/tests/helpers.ts +43 -0
- package/dist/templates/standard-jest/tests/prompts.test.ts +37 -0
- package/dist/templates/standard-jest/tests/resources.test.ts +37 -0
- package/dist/templates/standard-jest/tests/server.test.ts +30 -0
- package/dist/templates/standard-jest/tests/tools.test.ts +87 -0
- package/dist/templates/standard-jest/tsconfig.json +19 -0
- package/docs/advanced.md +424 -0
- package/docs/ai-generation.md +211 -0
- package/docs/api-reference.md +819 -0
- package/docs/cicd.md +289 -0
- package/docs/cli.md +225 -0
- package/docs/examples.md +300 -0
- package/docs/nodejs-compatibility.md +81 -0
- package/docs/releases.md +413 -0
- package/docs/starter-templates.md +110 -0
- package/docs/testing.md +443 -0
- package/docs/troubleshooting.md +139 -0
- package/jest.d.ts +43 -0
- package/package.json +5 -2
package/docs/releases.md
ADDED
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# Release Guide
|
|
2
|
+
|
|
3
|
+
This guide explains how to create and publish new releases of MCP Tester.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. **NPM Token Setup**
|
|
8
|
+
- Go to [npmjs.com](https://www.npmjs.com/settings/tokens)
|
|
9
|
+
- Create a new automation token
|
|
10
|
+
- Add it to GitHub repository secrets as `NPM_TOKEN`
|
|
11
|
+
- Navigate to: Repository Settings → Secrets and variables → Actions
|
|
12
|
+
- Click "New repository secret"
|
|
13
|
+
- Name: `NPM_TOKEN`
|
|
14
|
+
- Value: Your npm automation token
|
|
15
|
+
|
|
16
|
+
2. **GitHub Token**
|
|
17
|
+
- The `GITHUB_TOKEN` is automatically provided by GitHub Actions
|
|
18
|
+
- Ensure the workflow has permission to create releases (already configured)
|
|
19
|
+
|
|
20
|
+
## Release Process
|
|
21
|
+
|
|
22
|
+
### Option 1: Quick Release (Recommended)
|
|
23
|
+
|
|
24
|
+
Use this for routine releases (patch, minor, or major version bumps):
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# For patch release (1.0.0 → 1.0.1)
|
|
28
|
+
npm run release:patch
|
|
29
|
+
|
|
30
|
+
# For minor release (1.0.0 → 1.1.0)
|
|
31
|
+
npm run release:minor
|
|
32
|
+
|
|
33
|
+
# For major release (1.0.0 → 2.0.0)
|
|
34
|
+
npm run release:major
|
|
35
|
+
|
|
36
|
+
# For prerelease (1.0.0 → 1.0.1-beta.0)
|
|
37
|
+
npm run release:prerelease
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then commit and create tag:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Commit the version bump and CHANGELOG updates
|
|
44
|
+
npm run release:commit
|
|
45
|
+
|
|
46
|
+
# Create and push the tag
|
|
47
|
+
git tag v$(node -p "require('./package.json').version")
|
|
48
|
+
git push origin main --tags
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The release workflow will automatically:
|
|
52
|
+
- ✅ Verify version matches tag
|
|
53
|
+
- ✅ Run tests across Node.js versions (20, 22)
|
|
54
|
+
- ✅ Build the project
|
|
55
|
+
- ✅ Run security audits
|
|
56
|
+
- ✅ Publish to npm
|
|
57
|
+
- ✅ Create GitHub release with notes from CHANGELOG
|
|
58
|
+
- ✅ Upload coverage to Codecov
|
|
59
|
+
|
|
60
|
+
### Option 2: Manual Release
|
|
61
|
+
|
|
62
|
+
For full control over the release process:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 1. Update version in package.json
|
|
66
|
+
npm version patch # or minor, major, prerelease
|
|
67
|
+
|
|
68
|
+
# 2. Update CHANGELOG.md
|
|
69
|
+
# - Move items from [Unreleased] to new version section
|
|
70
|
+
# - Add date to version header: ## [1.0.1] - 2025-01-20
|
|
71
|
+
# - Keep [Unreleased] section for next changes
|
|
72
|
+
|
|
73
|
+
# 3. Verify tests pass
|
|
74
|
+
npm test
|
|
75
|
+
|
|
76
|
+
# 4. Build project
|
|
77
|
+
npm run build
|
|
78
|
+
|
|
79
|
+
# 5. Commit changes
|
|
80
|
+
git add package.json CHANGELOG.md
|
|
81
|
+
git commit -m "chore: release v1.0.1"
|
|
82
|
+
|
|
83
|
+
# 6. Create and push tag
|
|
84
|
+
git tag v1.0.1
|
|
85
|
+
git push origin main --tags
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Option 3: Custom Version
|
|
89
|
+
|
|
90
|
+
To set a specific version:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Set specific version
|
|
94
|
+
npm version 1.2.3
|
|
95
|
+
|
|
96
|
+
# Update CHANGELOG.md manually
|
|
97
|
+
# ... edit CHANGELOG.md ...
|
|
98
|
+
|
|
99
|
+
# Commit
|
|
100
|
+
git add package.json CHANGELOG.md
|
|
101
|
+
git commit -m "chore: release v1.2.3"
|
|
102
|
+
|
|
103
|
+
# Create tag and push
|
|
104
|
+
git tag v1.2.3
|
|
105
|
+
git push origin main --tags
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Version Numbering
|
|
109
|
+
|
|
110
|
+
Follow [Semantic Versioning](https://semver.org/):
|
|
111
|
+
|
|
112
|
+
- **MAJOR** (X.0.0): Breaking changes or major features
|
|
113
|
+
- Example: 1.0.0 → 2.0.0
|
|
114
|
+
- Use when: API changes that break compatibility
|
|
115
|
+
|
|
116
|
+
- **MINOR** (0.X.0): New features, backward compatible
|
|
117
|
+
- Example: 1.0.0 → 1.1.0
|
|
118
|
+
- Use when: Adding new features without breaking changes
|
|
119
|
+
|
|
120
|
+
- **PATCH** (0.0.X): Bug fixes
|
|
121
|
+
- Example: 1.0.0 → 1.0.1
|
|
122
|
+
- Use when: Fixing bugs without adding features
|
|
123
|
+
|
|
124
|
+
- **PRERELEASE** (0.0.0-X): Pre-release versions
|
|
125
|
+
- Example: 1.0.0 → 1.1.0-alpha.1
|
|
126
|
+
- Use when: Testing unreleased features
|
|
127
|
+
|
|
128
|
+
## Pre-Release Checklist
|
|
129
|
+
|
|
130
|
+
Before creating a release:
|
|
131
|
+
|
|
132
|
+
### 1. Update CHANGELOG.md
|
|
133
|
+
```markdown
|
|
134
|
+
## [1.0.1] - 2025-01-20
|
|
135
|
+
|
|
136
|
+
### Added
|
|
137
|
+
- New feature X
|
|
138
|
+
|
|
139
|
+
### Fixed
|
|
140
|
+
- Bug Y fixed
|
|
141
|
+
|
|
142
|
+
### Changed
|
|
143
|
+
- Updated dependency Z
|
|
144
|
+
|
|
145
|
+
## [Unreleased]
|
|
146
|
+
|
|
147
|
+
### Added
|
|
148
|
+
- Next feature A (stays here)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 2. Run Tests
|
|
152
|
+
```bash
|
|
153
|
+
npm test
|
|
154
|
+
npm run test:coverage
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 3. Verify Build
|
|
158
|
+
```bash
|
|
159
|
+
npm run build
|
|
160
|
+
npm run lint
|
|
161
|
+
npm run format:check
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 4. Check Dependencies
|
|
165
|
+
```bash
|
|
166
|
+
npm audit
|
|
167
|
+
npm outdated
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 5. Review Documentation
|
|
171
|
+
- [ ] README.md is up to date
|
|
172
|
+
- [ ] CHANGELOG.md includes all changes
|
|
173
|
+
- [ ] Examples work correctly
|
|
174
|
+
- [ ] API documentation is accurate
|
|
175
|
+
|
|
176
|
+
### 6. Verify Version
|
|
177
|
+
```bash
|
|
178
|
+
npm version patch # This updates package.json
|
|
179
|
+
cat package.json | grep version
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Release Workflow
|
|
183
|
+
|
|
184
|
+
When you push a version tag (e.g., `v1.0.1`), the release workflow:
|
|
185
|
+
|
|
186
|
+
1. **Trigger**: Starts automatically on tag push
|
|
187
|
+
2. **Verify**: Confirms tag version matches package.json
|
|
188
|
+
3. **Test**: Runs all tests across Node.js 20, 22
|
|
189
|
+
4. **Build**: Compiles TypeScript to JavaScript
|
|
190
|
+
5. **Audit**: Runs security audits
|
|
191
|
+
6. **Lint**: Checks code quality
|
|
192
|
+
7. **Publish**: Publishes package to npm registry
|
|
193
|
+
8. **Release**: Creates GitHub release with CHANGELOG notes
|
|
194
|
+
9. **Verify**: Verifies package can be installed from npm
|
|
195
|
+
|
|
196
|
+
## Monitoring Release Progress
|
|
197
|
+
|
|
198
|
+
After pushing the tag:
|
|
199
|
+
|
|
200
|
+
1. Go to: `https://github.com/islobodan/mcp-tester/actions`
|
|
201
|
+
2. Click on the "Release" workflow run
|
|
202
|
+
3. Monitor the progress through each step
|
|
203
|
+
|
|
204
|
+
Expected duration: ~5-8 minutes
|
|
205
|
+
|
|
206
|
+
## Post-Release
|
|
207
|
+
|
|
208
|
+
### 1. Verify on npm
|
|
209
|
+
```bash
|
|
210
|
+
# Check if package is available
|
|
211
|
+
npm view @slbdn/mcp-tester
|
|
212
|
+
|
|
213
|
+
# Install and test
|
|
214
|
+
npm install @slbdn/mcp-tester@latest
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### 2. Verify GitHub Release
|
|
218
|
+
- Go to: `https://github.com/islobodan/mcp-tester/releases`
|
|
219
|
+
- Check release notes are correct
|
|
220
|
+
- Verify release assets are attached
|
|
221
|
+
|
|
222
|
+
### 3. Update Documentation
|
|
223
|
+
- Update README.md if needed
|
|
224
|
+
- Update examples if API changed
|
|
225
|
+
- Update AGENTS.md with new features
|
|
226
|
+
|
|
227
|
+
### 4. Announce Release
|
|
228
|
+
- Create GitHub Discussion
|
|
229
|
+
- Post issue about the release
|
|
230
|
+
- Update project documentation
|
|
231
|
+
|
|
232
|
+
## Troubleshooting
|
|
233
|
+
|
|
234
|
+
### Release Workflow Failed
|
|
235
|
+
|
|
236
|
+
**Check:**
|
|
237
|
+
1. Version tag format (must be `vX.Y.Z`)
|
|
238
|
+
2. Version matches package.json exactly
|
|
239
|
+
3. Tests are passing locally
|
|
240
|
+
4. NPM_TOKEN is set correctly
|
|
241
|
+
|
|
242
|
+
**Fix:**
|
|
243
|
+
```bash
|
|
244
|
+
# Delete and recreate tag
|
|
245
|
+
git tag -d v1.0.1
|
|
246
|
+
git push origin :refs/tags/v1.0.1
|
|
247
|
+
|
|
248
|
+
# Fix issues, then recreate
|
|
249
|
+
git tag v1.0.1
|
|
250
|
+
git push origin v1.0.1
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### NPM Publish Failed
|
|
254
|
+
|
|
255
|
+
**Check:**
|
|
256
|
+
1. NPM_TOKEN has publish permissions
|
|
257
|
+
2. Package name is not already taken
|
|
258
|
+
3. Version doesn't already exist on npm
|
|
259
|
+
|
|
260
|
+
**Fix:**
|
|
261
|
+
```bash
|
|
262
|
+
# Verify token
|
|
263
|
+
npm whoami
|
|
264
|
+
|
|
265
|
+
# Check if version exists
|
|
266
|
+
npm view @slbdn/mcp-tester@1.0.1
|
|
267
|
+
|
|
268
|
+
# If version exists, increment it
|
|
269
|
+
npm version patch
|
|
270
|
+
git commit package.json -m "chore: increment version"
|
|
271
|
+
git tag v1.0.2
|
|
272
|
+
git push origin v1.0.2
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### GitHub Release Not Created
|
|
276
|
+
|
|
277
|
+
**Check:**
|
|
278
|
+
1. GITHUB_TOKEN has write permissions
|
|
279
|
+
2. Workflow has permission to create releases
|
|
280
|
+
3. Tag format is correct
|
|
281
|
+
|
|
282
|
+
**Fix:**
|
|
283
|
+
- Manually create release from GitHub UI
|
|
284
|
+
- Or delete tag and push again
|
|
285
|
+
|
|
286
|
+
### Tests Failing in CI
|
|
287
|
+
|
|
288
|
+
**Check:**
|
|
289
|
+
1. All tests pass locally
|
|
290
|
+
2. Node.js version compatibility
|
|
291
|
+
3. Dependencies are installed correctly
|
|
292
|
+
|
|
293
|
+
**Fix:**
|
|
294
|
+
```bash
|
|
295
|
+
# Clean and reinstall
|
|
296
|
+
rm -rf node_modules package-lock.json
|
|
297
|
+
npm install
|
|
298
|
+
|
|
299
|
+
# Run tests
|
|
300
|
+
npm test
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Rollback Procedure
|
|
304
|
+
|
|
305
|
+
If you need to rollback a release:
|
|
306
|
+
|
|
307
|
+
### 1. Yank NPM Version
|
|
308
|
+
```bash
|
|
309
|
+
npm deprecate @slbdn/mcp-tester@1.0.1 "Release rollback due to bug"
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### 2. Delete GitHub Release
|
|
313
|
+
1. Go to repository releases page
|
|
314
|
+
2. Edit or delete the release
|
|
315
|
+
3. Delete the tag if needed
|
|
316
|
+
|
|
317
|
+
### 3. Create Hotfix
|
|
318
|
+
```bash
|
|
319
|
+
# Create hotfix branch
|
|
320
|
+
git checkout -b hotfix/issue
|
|
321
|
+
|
|
322
|
+
# Fix issue
|
|
323
|
+
git commit -am "fix: critical bug"
|
|
324
|
+
|
|
325
|
+
# Bump version
|
|
326
|
+
npm version patch
|
|
327
|
+
|
|
328
|
+
# Release
|
|
329
|
+
git tag v1.0.2
|
|
330
|
+
git push origin v1.0.2
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## Best Practices
|
|
334
|
+
|
|
335
|
+
1. **Update CHANGELOG First**
|
|
336
|
+
- Always update CHANGELOG.md before version bump
|
|
337
|
+
- Include all changes in the release
|
|
338
|
+
- Reference issues/PRs if helpful
|
|
339
|
+
|
|
340
|
+
2. **Test Before Release**
|
|
341
|
+
- Run all tests locally
|
|
342
|
+
- Build the project
|
|
343
|
+
- Install and test locally
|
|
344
|
+
|
|
345
|
+
3. **Use Semantic Versioning**
|
|
346
|
+
- MAJOR: Breaking changes
|
|
347
|
+
- MINOR: New features
|
|
348
|
+
- PATCH: Bug fixes
|
|
349
|
+
|
|
350
|
+
4. **Tag Naming**
|
|
351
|
+
- Always use `v` prefix: `v1.0.1`
|
|
352
|
+
- Follow semver format: `vX.Y.Z`
|
|
353
|
+
|
|
354
|
+
5. **Review Before Pushing**
|
|
355
|
+
- Check CHANGELOG is complete
|
|
356
|
+
- Verify version is correct
|
|
357
|
+
- Confirm tests pass
|
|
358
|
+
|
|
359
|
+
6. **Monitor Release**
|
|
360
|
+
- Watch GitHub Actions workflow
|
|
361
|
+
- Check npm publication
|
|
362
|
+
- Verify GitHub release creation
|
|
363
|
+
|
|
364
|
+
7. **Document Breaking Changes**
|
|
365
|
+
- Clearly document breaking changes in CHANGELOG
|
|
366
|
+
- Add migration guide if needed
|
|
367
|
+
- Update examples to use new API
|
|
368
|
+
|
|
369
|
+
## Example: Complete Release Workflow
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
# 1. Update CHANGELOG.md
|
|
373
|
+
# Edit CHANGELOG.md, move items from [Unreleased] to new version
|
|
374
|
+
|
|
375
|
+
# 2. Bump version (patch release)
|
|
376
|
+
npm run release:patch
|
|
377
|
+
|
|
378
|
+
# 3. Verify tests pass
|
|
379
|
+
npm test
|
|
380
|
+
|
|
381
|
+
# 4. Build project
|
|
382
|
+
npm run build
|
|
383
|
+
|
|
384
|
+
# 5. Commit changes
|
|
385
|
+
npm run release:commit
|
|
386
|
+
|
|
387
|
+
# 6. Create and push tag
|
|
388
|
+
VERSION=$(node -p "require('./package.json').version")
|
|
389
|
+
git tag v$VERSION
|
|
390
|
+
git push origin main --tags
|
|
391
|
+
|
|
392
|
+
# 7. Monitor release at:
|
|
393
|
+
# https://github.com/islobodan/mcp-tester/actions
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Additional Resources
|
|
397
|
+
|
|
398
|
+
- [Semantic Versioning](https://semver.org/)
|
|
399
|
+
- [npm Publishing](https://docs.npmjs.com/cli/publish)
|
|
400
|
+
- [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository)
|
|
401
|
+
- [GitHub Actions](https://docs.github.com/en/actions)
|
|
402
|
+
|
|
403
|
+
## Support
|
|
404
|
+
|
|
405
|
+
If you encounter issues with releases:
|
|
406
|
+
|
|
407
|
+
1. Check GitHub Actions logs for detailed error messages
|
|
408
|
+
2. Review this guide's troubleshooting section
|
|
409
|
+
3. Open an issue on GitHub with:
|
|
410
|
+
- Version being released
|
|
411
|
+
- Error messages
|
|
412
|
+
- Steps taken
|
|
413
|
+
- Expected vs actual behavior
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Starter Templates
|
|
2
|
+
|
|
3
|
+
Three ready-to-use scaffolds for testing MCP servers. Pick the one that matches the size of your project, then `npx @slbdn/mcp-tester create <template> <dest>` (or just copy `templates/<template>/` by hand).
|
|
4
|
+
|
|
5
|
+
| Template | Best for | Includes |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `minimal-jest` | Tiny side projects | One test file, one mock server, zero ceremony |
|
|
8
|
+
| `standard-jest` | Real-world CI | Per-capability test files, HTML reporter, GitHub Actions matrix |
|
|
9
|
+
| `full-stack` | A library that ships a server | Real TS server, code generation, typed tool calls |
|
|
10
|
+
|
|
11
|
+
## CLI usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx @slbdn/mcp-tester create <template> <dest> # scaffold + npm install
|
|
15
|
+
npx @slbdn/mcp-tester create list # show all templates
|
|
16
|
+
npx @slbdn/mcp-tester create <template> <dest> --no-install # skip install
|
|
17
|
+
npx @slbdn/mcp-tester create <template> <dest> --git # also git init
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`__NAME__` placeholders in `package.json` are replaced with the destination directory name.
|
|
21
|
+
|
|
22
|
+
## Manual usage
|
|
23
|
+
|
|
24
|
+
Copy any subdirectory of [`templates/`](../templates/) into your project and run `npm install`.
|
|
25
|
+
|
|
26
|
+
## Which template should I pick?
|
|
27
|
+
|
|
28
|
+
- **I'm evaluating mcp-tester** → `minimal-jest`
|
|
29
|
+
- **I'm adding CI to an existing server** → `standard-jest`
|
|
30
|
+
- **I'm building a library and need type-safe tool calls** → `full-stack`
|
|
31
|
+
|
|
32
|
+
## What lives in each template?
|
|
33
|
+
|
|
34
|
+
### `minimal-jest`
|
|
35
|
+
```
|
|
36
|
+
minimal-jest/
|
|
37
|
+
├── README.md
|
|
38
|
+
├── package.json
|
|
39
|
+
├── tsconfig.json
|
|
40
|
+
├── jest.config.js
|
|
41
|
+
├── .gitignore
|
|
42
|
+
├── tests/server.test.ts # 4 tests: connect, list, echo, add
|
|
43
|
+
└── examples/mock-server.js # echo, add
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Run:** `npm install && npm test` (≈1.5s, 4 tests)
|
|
47
|
+
|
|
48
|
+
### `standard-jest`
|
|
49
|
+
```
|
|
50
|
+
standard-jest/
|
|
51
|
+
├── README.md
|
|
52
|
+
├── package.json # + jest-html-reporters
|
|
53
|
+
├── tsconfig.json
|
|
54
|
+
├── jest.config.js # HTML reporter configured
|
|
55
|
+
├── .gitignore
|
|
56
|
+
├── examples/mock-server.js # echo, add, slow + version resource + greet prompt
|
|
57
|
+
├── tests/
|
|
58
|
+
│ ├── helpers.ts
|
|
59
|
+
│ ├── server.test.ts # lifecycle + health
|
|
60
|
+
│ ├── tools.test.ts # list, schemas, calls (incl. timeout)
|
|
61
|
+
│ ├── resources.test.ts
|
|
62
|
+
│ └── prompts.test.ts
|
|
63
|
+
└── .github/workflows/test.yml # Node 20/22 matrix + report upload
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Run:** `npm install && npm test` (≈4.5s, 15 tests)
|
|
67
|
+
**HTML report:** `reports/test-report.html`
|
|
68
|
+
**CI:** matrix on Node 20 and 22 with HTML artifact upload
|
|
69
|
+
|
|
70
|
+
### `full-stack`
|
|
71
|
+
```
|
|
72
|
+
full-stack/
|
|
73
|
+
├── README.md
|
|
74
|
+
├── package.json # + tsx
|
|
75
|
+
├── tsconfig.json
|
|
76
|
+
├── jest.config.js
|
|
77
|
+
├── .gitignore
|
|
78
|
+
├── src/server.ts # Real TS server (greet, sum, uppercase)
|
|
79
|
+
├── examples/mock-server.js # JS mirror (used by tests so spawn path stays JS)
|
|
80
|
+
├── scripts/
|
|
81
|
+
│ ├── generate-tests.ts # `npm run gen:tests`
|
|
82
|
+
│ └── generate-types.ts # `npm run gen:types`
|
|
83
|
+
├── tests/
|
|
84
|
+
│ ├── helpers.ts
|
|
85
|
+
│ ├── server.test.ts # lifecycle, health, tool listing
|
|
86
|
+
│ ├── tools.test.ts # happy-path + edge cases
|
|
87
|
+
│ └── parallel.test.ts # Promise.all stress tests
|
|
88
|
+
└── .github/workflows/test.yml # build + test on Node 20/22
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Run:** `npm install && npm run build && npm test` (≈2s, 10 tests)
|
|
92
|
+
**Generate:** `npm run gen:tests` writes `tests/generated.test.ts`
|
|
93
|
+
**Types:** `npm run gen:types` writes `src/generated-types.ts`
|
|
94
|
+
|
|
95
|
+
## Customising
|
|
96
|
+
|
|
97
|
+
1. Replace `examples/mock-server.js` (and `src/server.ts` for full-stack) with your server.
|
|
98
|
+
2. Edit `tests/helpers.ts` to point at your server.
|
|
99
|
+
3. Run `npm test`.
|
|
100
|
+
|
|
101
|
+
## Adding a new template
|
|
102
|
+
|
|
103
|
+
Templates live in [`templates/`](../templates/) and are copied verbatim by the CLI. To add one:
|
|
104
|
+
|
|
105
|
+
1. Create `templates/<your-template>/` with the files above.
|
|
106
|
+
2. Use `__NAME__` as the `package.json` `name` field if you want it substituted on scaffold.
|
|
107
|
+
3. Rebuild: `npm run build` (copies `templates/` → `dist/templates/`).
|
|
108
|
+
4. Update the comparison table and sections on this page by hand.
|
|
109
|
+
|
|
110
|
+
The CLI discovers templates by scanning the directory at runtime — no code changes needed.
|