Skip to content
This repository was archived by the owner on Nov 14, 2025. It is now read-only.

Commit 8828190

Browse files
sapientpantsclaudeCopilot
authored
fix: fix changelog format configuration (#166)
* fix: fix changelog format configuration - Add custom changelog generator for improved release notes - Update changeset config to use custom formatter - Fix repository reference in changelog config 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * Update .changeset/config.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/dev/changelog-custom.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update src/dev/changelog-custom.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 488ae64 commit 8828190

File tree

6 files changed

+131
-29
lines changed

6 files changed

+131
-29
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
33
"changelog": [
4-
"@changesets/changelog-github",
4+
"../dist/src/dev/changelog-custom.js",
55
{
66
"repo": "sapientpants/deepsource-mcp-server"
77
}

.changeset/fix-changelog-format.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'deepsource-mcp-server': patch
3+
---
4+
5+
Fix changelog format configuration and add custom changelog generator for improved release notes formatting

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Minor Changes
66

7-
- [#164](https://github.com/sapientpants/deepsource-mcp-server/pull/164) [`8939e69`](https://github.com/sapientpants/deepsource-mcp-server/commit/8939e6975ba7ef4f7c12fe6d72175b1dbee593bc) Thanks [@sapientpants](https://github.com/sapientpants)! - Add unified versioning system with single source of truth
7+
- [#164](https://github.com/sapientpants/deepsource-mcp-server/pull/164) [`8939e69`](https://github.com/sapientpants/deepsource-mcp-server/commit/8939e6975ba7ef4f7c12fe6d72175b1dbee593bc) - Add unified versioning system with single source of truth
88
- Created central `version.ts` module that reads from package.json
99
- Added CLI support for `--version` and `-v` flags to display version
1010
- Added `--help` and `-h` flags with comprehensive help text
@@ -26,7 +26,7 @@
2626

2727
### Patch Changes
2828

29-
- [#163](https://github.com/sapientpants/deepsource-mcp-server/pull/163) [`e181abc`](https://github.com/sapientpants/deepsource-mcp-server/commit/e181abcef0b30d442df5285a999f80b94b9e3ef4) Thanks [@sapientpants](https://github.com/sapientpants)! - Update Node.js to 22.19.0 and pnpm to 10.15.1
29+
- [#163](https://github.com/sapientpants/deepsource-mcp-server/pull/163) [`e181abc`](https://github.com/sapientpants/deepsource-mcp-server/commit/e181abcef0b30d442df5285a999f80b94b9e3ef4) - Update Node.js to 22.19.0 and pnpm to 10.15.1
3030
- Update Node.js from 22.0.0 to 22.19.0 (latest 22.x LTS)
3131
- Update pnpm from 10.15.0 to 10.15.1 (latest version)
3232
- Configure mise for version management
@@ -37,7 +37,7 @@
3737

3838
### Minor Changes
3939

40-
- [#162](https://github.com/sapientpants/deepsource-mcp-server/pull/162) [`56d4985`](https://github.com/sapientpants/deepsource-mcp-server/commit/56d4985bb76ef7753b59f34d215337d25ed46c9d) Thanks [@sapientpants](https://github.com/sapientpants)! - feat: implement true pagination for all list queries
40+
- [#162](https://github.com/sapientpants/deepsource-mcp-server/pull/162) [`56d4985`](https://github.com/sapientpants/deepsource-mcp-server/commit/56d4985bb76ef7753b59f34d215337d25ed46c9d) - feat: implement true pagination for all list queries
4141

4242
Adds comprehensive cursor-based pagination support across all list endpoints to handle large datasets efficiently and provide deterministic, complete results.
4343

@@ -126,7 +126,7 @@
126126

127127
### Patch Changes
128128

129-
- [#151](https://github.com/sapientpants/deepsource-mcp-server/pull/151) [`c7c4569`](https://github.com/sapientpants/deepsource-mcp-server/commit/c7c45697c4f3c9d07620614a47ff503c7e76015d) Thanks [@sapientpants](https://github.com/sapientpants)! - Update dependencies to latest versions
129+
- [#151](https://github.com/sapientpants/deepsource-mcp-server/pull/151) [`c7c4569`](https://github.com/sapientpants/deepsource-mcp-server/commit/c7c45697c4f3c9d07620614a47ff503c7e76015d) - Update dependencies to latest versions
130130
- Updated pino from 9.9.0 to 9.9.4 (production dependency)
131131
- Updated @changesets/cli from 2.29.6 to 2.29.7
132132
- Updated @cyclonedx/cdxgen from 11.6.0 to 11.7.0
@@ -144,7 +144,7 @@
144144

145145
### Patch Changes
146146

147-
- [#142](https://github.com/sapientpants/deepsource-mcp-server/pull/142) [`04f7440`](https://github.com/sapientpants/deepsource-mcp-server/commit/04f744073131e99d4613ba661ccb93b090001ffc) Thanks [@sapientpants](https://github.com/sapientpants)! - Fixed TypeScript strict mode compatibility and integrated agentic-node-ts-starter template
147+
- [#142](https://github.com/sapientpants/deepsource-mcp-server/pull/142) [`04f7440`](https://github.com/sapientpants/deepsource-mcp-server/commit/04f744073131e99d4613ba661ccb93b090001ffc) - Fixed TypeScript strict mode compatibility and integrated agentic-node-ts-starter template
148148
- Resolved hundreds of `exactOptionalPropertyTypes` errors across the codebase
149149
- Migrated test suite from Jest to Vitest
150150
- Enhanced CI/CD workflows with security scanning and validation

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@
9494
"zod": "^3.25.76"
9595
},
9696
"devDependencies": {
97-
"@changesets/changelog-github": "0.5.1",
9897
"@changesets/cli": "^2.29.7",
98+
"@changesets/get-github-info": "0.6.0",
99+
"@changesets/types": "6.1.0",
99100
"@commitlint/cli": "^19.8.1",
100101
"@commitlint/config-conventional": "^19.8.1",
101102
"@cyclonedx/cdxgen": "11.7.0",
@@ -110,10 +111,10 @@
110111
"@typescript-eslint/eslint-plugin": "^8.43.0",
111112
"@typescript-eslint/parser": "^8.43.0",
112113
"@vitest/coverage-v8": "^3.2.4",
113-
"eslint": "^9.35.0",
114114
"eslint-config-prettier": "^10.1.8",
115115
"eslint-plugin-jsonc": "2.20.1",
116116
"eslint-plugin-prettier": "^5.5.4",
117+
"eslint": "^9.35.0",
117118
"fast-check": "^4.2.0",
118119
"husky": "^9.1.7",
119120
"jest": "^30.0.5",
@@ -126,8 +127,8 @@
126127
"rimraf": "^6.0.1",
127128
"supertest": "^7.1.4",
128129
"ts-jest": "^29.4.1",
129-
"ts-node": "^10.9.2",
130130
"ts-node-dev": "^2.0.0",
131+
"ts-node": "^10.9.2",
131132
"typescript": "^5.9.2",
132133
"vite": "7.1.5",
133134
"vitest": "^3.2.4",

pnpm-lock.yaml

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

src/dev/changelog-custom.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// Adapted from https://github.com/changesets/changesets/blob/main/packages/changelog-github/src/index.ts
2+
import type { ChangelogFunctions } from '@changesets/types';
3+
import { getInfo, getInfoFromPullRequest } from '@changesets/get-github-info';
4+
5+
interface Options {
6+
repo: string;
7+
}
8+
9+
const changelogFunctions: ChangelogFunctions = {
10+
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => {
11+
const opts = options as Options;
12+
if (!opts.repo) {
13+
throw new Error(
14+
'Please provide a repo to this changelog generator like this:\n"changelog": ["<custom-changelog-generator>", { "repo": "org/repo" }]'
15+
);
16+
}
17+
if (dependenciesUpdated.length === 0) return '';
18+
19+
const changesetLink = `- Updated dependencies [${(
20+
await Promise.all(
21+
changesets.map(async (cs) => {
22+
if (cs.commit) {
23+
const { links } = await getInfo({
24+
repo: opts.repo,
25+
commit: cs.commit,
26+
});
27+
return links.commit;
28+
}
29+
})
30+
)
31+
)
32+
.filter((_) => _)
33+
.join(', ')}]:`;
34+
35+
const updatedDependenciesList = dependenciesUpdated.map(
36+
(dependency) => ` - ${dependency.name}@${dependency.newVersion}`
37+
);
38+
39+
return [changesetLink, ...updatedDependenciesList].join('\n');
40+
},
41+
getReleaseLine: async (changeset, _type, options) => {
42+
const opts = options as Options | undefined;
43+
if (!opts?.repo) {
44+
throw new Error(
45+
'Please provide a repo to this changelog generator like this:\n"changelog": ["<custom-changelog-generator>", { "repo": "org/repo" }]'
46+
);
47+
}
48+
49+
let prFromSummary: number | undefined;
50+
let commitFromSummary: string | undefined;
51+
52+
const replacedChangelog = changeset.summary
53+
.replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr: string) => {
54+
const num = Number(pr);
55+
if (!isNaN(num)) prFromSummary = num;
56+
return '';
57+
})
58+
.replace(/^\s*commit:\s*([^\s]+)/im, (_, commit: string) => {
59+
commitFromSummary = commit;
60+
return '';
61+
})
62+
.replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, () => {
63+
return '';
64+
})
65+
.trim();
66+
67+
const [firstLine, ...futureLines] = replacedChangelog.split('\n').map((l) => l.trimRight());
68+
69+
const links = await (async () => {
70+
if (prFromSummary !== undefined) {
71+
let { links } = await getInfoFromPullRequest({
72+
repo: opts.repo,
73+
pull: prFromSummary,
74+
});
75+
if (commitFromSummary) {
76+
const shortCommitId = commitFromSummary.slice(0, 7);
77+
links = {
78+
...links,
79+
commit: `[\`${shortCommitId}\`](https://github.com/${opts.repo}/commit/${commitFromSummary})`,
80+
};
81+
}
82+
return links;
83+
}
84+
const commitToFetchFrom = commitFromSummary || changeset.commit;
85+
if (commitToFetchFrom) {
86+
const { links } = await getInfo({
87+
repo: opts.repo,
88+
commit: commitToFetchFrom,
89+
});
90+
return links;
91+
}
92+
return {
93+
commit: null,
94+
pull: null,
95+
user: null,
96+
};
97+
})();
98+
99+
const prefix = [
100+
links.pull === null ? '' : ` ${links.pull}`,
101+
links.commit === null ? '' : ` ${links.commit}`,
102+
].join('');
103+
104+
return `\n\n-${prefix ? `${prefix} -` : ''} ${firstLine}\n${futureLines
105+
.map((l) => ` ${l}`)
106+
.join('\n')}`;
107+
},
108+
};
109+
110+
export default changelogFunctions;

0 commit comments

Comments
 (0)