Skip to content

Commit 0e9663f

Browse files
Merge remote-tracking branch 'origin/main' into add-mcp-apps-support
2 parents 7855ba9 + 0646781 commit 0e9663f

5 files changed

Lines changed: 132 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ dist/
1212

1313
# Test results
1414
test-results.xml
15+
16+
# Build artifacts
17+
*.tsbuildinfo

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717
- Updated `@modelcontextprotocol/sdk` from 1.25.3 to 1.26.0
1818
- Updated patch file for SDK 1.26.0
1919

20+
### Documentation
21+
22+
- **PR Guidelines**: Added CHANGELOG requirement to CLAUDE.md (#67)
23+
- All pull requests must now update CHANGELOG.md
24+
- Document what changed, why, and any breaking changes
25+
- Add entry under "Unreleased" section with PR number
26+
27+
### Developer Experience
28+
29+
- **Release Process**: Added automated CHANGELOG preparation script (#67)
30+
- New `npm run changelog:prepare-release <version>` command
31+
- Automatically replaces "Unreleased" with version and date
32+
- Adds new empty "Unreleased" section for next changes
33+
- Includes validation for version format and CHANGELOG structure
34+
2035
## 0.4.7
2136

2237
### Security

CLAUDE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,36 @@ Generates three files: `*.input.schema.ts`, `*.output.schema.ts`, and `*.test.ts
7777
- Never update snapshots without verifying changes
7878
- Tool snapshots capture class names, tool names, and descriptions
7979

80+
**Pull Requests:**
81+
82+
When creating pull requests:
83+
84+
- **Always update CHANGELOG.md** - Document what changed, why, and any breaking changes
85+
- Follow the existing changelog format (check recent entries for examples)
86+
- Add your entry under the "Unreleased" section at the top
87+
- Include the PR number and a brief description of the change
88+
89+
**Release Process:**
90+
91+
When preparing a new release:
92+
93+
```bash
94+
# Prepare CHANGELOG for release (replaces "Unreleased" with version and date)
95+
npm run changelog:prepare-release 1.0.0
96+
97+
# Review changes, then commit and tag
98+
git add CHANGELOG.md
99+
git commit -m "Release v1.0.0"
100+
git tag v1.0.0
101+
git push && git push --tags
102+
```
103+
104+
The `changelog:prepare-release` script automatically:
105+
106+
- Replaces "## Unreleased" with "## {version} - {date}"
107+
- Adds a new empty "## Unreleased" section at the top
108+
- Validates version format and CHANGELOG structure
109+
80110
## Important Constraints
81111

82112
- **Tool naming:** Tool names (MCP identifiers) must be `snake_case_tool` (e.g., `list_styles_tool`). TypeScript class names follow `PascalCaseTool` convention (e.g., `ListStylesTool`)

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
"scripts": {
1313
"postinstall": "patch-package || true",
1414
"build": "npm run prepare && tshy && npm run generate-version && node scripts/add-shebang.cjs",
15-
"format": "prettier --check \"./src/**/*.{ts,tsx,js,json,md}\" \"./test/**/*.{ts,tsx,js,json,md}\" \"./examples/**/*.{ts,tsx,js,json,md}\"",
16-
"format:fix": "prettier --write \"./src/**/*.{ts,tsx,js,json,md}\" \"./test/**/*.{ts,tsx,js,json,md}\" \"./examples/**/*.{ts,tsx,js,json,md}\"",
15+
"changelog:prepare-release": "node scripts/prepare-changelog-release.cjs",
16+
"format": "prettier --check \"./src/**/*.{ts,tsx,js,json,md}\" \"./test/**/*.{ts,tsx,js,json,md}\"",
17+
"format:fix": "prettier --write \"./src/**/*.{ts,tsx,js,json,md}\" \"./test/**/*.{ts,tsx,js,json,md}\"",
1718
"generate-version": "node scripts/build-helpers.cjs generate-version",
1819
"inspect:build": "npm run build && npx @modelcontextprotocol/inspector -e MAPBOX_ACCESS_TOKEN=\"$MAPBOX_ACCESS_TOKEN\" node dist/esm/index.js",
1920
"inspect:dev": "npx @modelcontextprotocol/inspector -e MAPBOX_ACCESS_TOKEN=\"$MAPBOX_ACCESS_TOKEN\" npx -y tsx src/index.ts",
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env node
2+
// Copyright (c) Mapbox, Inc.
3+
// Licensed under the MIT License.
4+
5+
/**
6+
* Prepares CHANGELOG.md for a new release by:
7+
* 1. Replacing "## Unreleased" with "## {version}"
8+
* 2. Adding current date to the version heading
9+
* 3. Adding a new empty "## Unreleased" section at the top
10+
*
11+
* Usage:
12+
* node scripts/prepare-changelog-release.cjs <version>
13+
* npm run changelog:prepare-release <version>
14+
*
15+
* Example:
16+
* node scripts/prepare-changelog-release.cjs 1.0.0
17+
*/
18+
19+
const fs = require('node:fs');
20+
const path = require('node:path');
21+
const process = require('node:process');
22+
23+
function prepareChangelogRelease(version) {
24+
if (!version) {
25+
console.error('Error: Version number is required');
26+
console.error('Usage: node scripts/prepare-changelog-release.cjs <version>');
27+
process.exit(1);
28+
}
29+
30+
// Validate version format (basic semver check)
31+
if (!/^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/.test(version)) {
32+
console.error(`Error: Invalid version format: ${version}`);
33+
console.error('Expected format: X.Y.Z or X.Y.Z-prerelease');
34+
process.exit(1);
35+
}
36+
37+
const changelogPath = path.join(process.cwd(), 'CHANGELOG.md');
38+
39+
// Check if CHANGELOG.md exists
40+
if (!fs.existsSync(changelogPath)) {
41+
console.error('Error: CHANGELOG.md not found');
42+
process.exit(1);
43+
}
44+
45+
// Read CHANGELOG.md
46+
const content = fs.readFileSync(changelogPath, 'utf8');
47+
48+
// Check if "## Unreleased" exists
49+
if (!content.includes('## Unreleased')) {
50+
console.error('Error: No "## Unreleased" section found in CHANGELOG.md');
51+
console.error('Nothing to release - add changes under "## Unreleased" first');
52+
process.exit(1);
53+
}
54+
55+
// Get current date in YYYY-MM-DD format
56+
const date = new Date().toISOString().split('T')[0];
57+
58+
// Replace "## Unreleased" with "## {version} - {date}"
59+
// and add a new "## Unreleased" section at the top
60+
const updatedContent = content.replace(
61+
'## Unreleased',
62+
`## Unreleased\n\n## ${version} - ${date}`
63+
);
64+
65+
// Write updated content back to CHANGELOG.md
66+
fs.writeFileSync(changelogPath, updatedContent, 'utf8');
67+
68+
console.log(`✓ CHANGELOG.md updated successfully`);
69+
console.log(` - Released version ${version} (${date})`);
70+
console.log(` - Added new "Unreleased" section`);
71+
console.log('');
72+
console.log('Next steps:');
73+
console.log(' 1. Review CHANGELOG.md');
74+
console.log(' 2. Commit changes: git add CHANGELOG.md && git commit -m "Release v' + version + '"');
75+
console.log(' 3. Create tag: git tag v' + version);
76+
console.log(' 4. Push: git push && git push --tags');
77+
}
78+
79+
// Process command line arguments
80+
const version = process.argv[2];
81+
prepareChangelogRelease(version);

0 commit comments

Comments
 (0)