diff --git a/.changeset/config.json b/.changeset/config.json index 5c62167..a884d84 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,7 +1,7 @@ { "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", "changelog": [ - "@changesets/changelog-github", + "../dist/src/dev/changelog-custom.js", { "repo": "sapientpants/deepsource-mcp-server" } diff --git a/.changeset/fix-changelog-format.md b/.changeset/fix-changelog-format.md new file mode 100644 index 0000000..b23c271 --- /dev/null +++ b/.changeset/fix-changelog-format.md @@ -0,0 +1,5 @@ +--- +'deepsource-mcp-server': patch +--- + +Fix changelog format configuration and add custom changelog generator for improved release notes formatting diff --git a/CHANGELOG.md b/CHANGELOG.md index 64956f1..628d599 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Minor Changes -- [#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 +- [#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 - Created central `version.ts` module that reads from package.json - Added CLI support for `--version` and `-v` flags to display version - Added `--help` and `-h` flags with comprehensive help text @@ -26,7 +26,7 @@ ### Patch Changes -- [#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 +- [#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 - Update Node.js from 22.0.0 to 22.19.0 (latest 22.x LTS) - Update pnpm from 10.15.0 to 10.15.1 (latest version) - Configure mise for version management @@ -37,7 +37,7 @@ ### Minor Changes -- [#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 +- [#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 Adds comprehensive cursor-based pagination support across all list endpoints to handle large datasets efficiently and provide deterministic, complete results. @@ -126,7 +126,7 @@ ### Patch Changes -- [#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 +- [#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 - Updated pino from 9.9.0 to 9.9.4 (production dependency) - Updated @changesets/cli from 2.29.6 to 2.29.7 - Updated @cyclonedx/cdxgen from 11.6.0 to 11.7.0 @@ -144,7 +144,7 @@ ### Patch Changes -- [#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 +- [#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 - Resolved hundreds of `exactOptionalPropertyTypes` errors across the codebase - Migrated test suite from Jest to Vitest - Enhanced CI/CD workflows with security scanning and validation diff --git a/package.json b/package.json index 1ef113b..2b11861 100644 --- a/package.json +++ b/package.json @@ -94,8 +94,9 @@ "zod": "^3.25.76" }, "devDependencies": { - "@changesets/changelog-github": "0.5.1", "@changesets/cli": "^2.29.7", + "@changesets/get-github-info": "0.6.0", + "@changesets/types": "6.1.0", "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", "@cyclonedx/cdxgen": "11.7.0", @@ -110,10 +111,10 @@ "@typescript-eslint/eslint-plugin": "^8.43.0", "@typescript-eslint/parser": "^8.43.0", "@vitest/coverage-v8": "^3.2.4", - "eslint": "^9.35.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-jsonc": "2.20.1", "eslint-plugin-prettier": "^5.5.4", + "eslint": "^9.35.0", "fast-check": "^4.2.0", "husky": "^9.1.7", "jest": "^30.0.5", @@ -126,8 +127,8 @@ "rimraf": "^6.0.1", "supertest": "^7.1.4", "ts-jest": "^29.4.1", - "ts-node": "^10.9.2", "ts-node-dev": "^2.0.0", + "ts-node": "^10.9.2", "typescript": "^5.9.2", "vite": "7.1.5", "vitest": "^3.2.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2fba06f..3cddab9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,12 +36,15 @@ importers: specifier: ^3.25.76 version: 3.25.76 devDependencies: - '@changesets/changelog-github': - specifier: 0.5.1 - version: 0.5.1(encoding@0.1.13) '@changesets/cli': specifier: ^2.29.7 version: 2.29.7(@types/node@24.3.1) + '@changesets/get-github-info': + specifier: 0.6.0 + version: 0.6.0(encoding@0.1.13) + '@changesets/types': + specifier: 6.1.0 + version: 6.1.0 '@commitlint/cli': specifier: ^19.8.1 version: 19.8.1(@types/node@24.3.1)(typescript@5.9.2) @@ -376,9 +379,6 @@ packages: '@changesets/changelog-git@0.2.1': resolution: {integrity: sha512-x/xEleCFLH28c3bQeQIyeZf8lFXyDFVn1SgcBiR2Tw/r4IAWlk1fzxCEZ6NxQAjF2Nwtczoen3OA2qR+UawQ8Q==} - '@changesets/changelog-github@0.5.1': - resolution: {integrity: sha512-BVuHtF+hrhUScSoHnJwTELB4/INQxVFc+P/Qdt20BLiBFIHFJDDUaGsZw+8fQeJTRP5hJZrzpt3oZWh0G19rAQ==} - '@changesets/cli@2.29.7': resolution: {integrity: sha512-R7RqWoaksyyKXbKXBTbT4REdy22yH81mcFK6sWtqSanxUCbUi9Uf+6aqxZtDQouIqPdem2W56CdxXgsxdq7FLQ==} hasBin: true @@ -2161,10 +2161,6 @@ packages: resolution: {integrity: sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==} engines: {node: '>=8'} - dotenv@8.6.0: - resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} - engines: {node: '>=10'} - dottie@2.0.6: resolution: {integrity: sha512-iGCHkfUc5kFekGiqhe8B/mdaurD+lakO9txNnTvKtA6PISrw86LgqHvRzWYPyoE2Ph5aMIrCw9/uko6XHTKCwA==} @@ -5233,14 +5229,6 @@ snapshots: dependencies: '@changesets/types': 6.1.0 - '@changesets/changelog-github@0.5.1(encoding@0.1.13)': - dependencies: - '@changesets/get-github-info': 0.6.0(encoding@0.1.13) - '@changesets/types': 6.1.0 - dotenv: 8.6.0 - transitivePeerDependencies: - - encoding - '@changesets/cli@2.29.7(@types/node@24.3.1)': dependencies: '@changesets/apply-release-plan': 7.0.13 @@ -7338,8 +7326,6 @@ snapshots: dependencies: is-obj: 2.0.0 - dotenv@8.6.0: {} - dottie@2.0.6: optional: true diff --git a/src/dev/changelog-custom.ts b/src/dev/changelog-custom.ts new file mode 100644 index 0000000..39bbb3f --- /dev/null +++ b/src/dev/changelog-custom.ts @@ -0,0 +1,110 @@ +// Adapted from https://github.com/changesets/changesets/blob/main/packages/changelog-github/src/index.ts +import type { ChangelogFunctions } from '@changesets/types'; +import { getInfo, getInfoFromPullRequest } from '@changesets/get-github-info'; + +interface Options { + repo: string; +} + +const changelogFunctions: ChangelogFunctions = { + getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => { + const opts = options as Options; + if (!opts.repo) { + throw new Error( + 'Please provide a repo to this changelog generator like this:\n"changelog": ["", { "repo": "org/repo" }]' + ); + } + if (dependenciesUpdated.length === 0) return ''; + + const changesetLink = `- Updated dependencies [${( + await Promise.all( + changesets.map(async (cs) => { + if (cs.commit) { + const { links } = await getInfo({ + repo: opts.repo, + commit: cs.commit, + }); + return links.commit; + } + }) + ) + ) + .filter((_) => _) + .join(', ')}]:`; + + const updatedDependenciesList = dependenciesUpdated.map( + (dependency) => ` - ${dependency.name}@${dependency.newVersion}` + ); + + return [changesetLink, ...updatedDependenciesList].join('\n'); + }, + getReleaseLine: async (changeset, _type, options) => { + const opts = options as Options | undefined; + if (!opts?.repo) { + throw new Error( + 'Please provide a repo to this changelog generator like this:\n"changelog": ["", { "repo": "org/repo" }]' + ); + } + + let prFromSummary: number | undefined; + let commitFromSummary: string | undefined; + + const replacedChangelog = changeset.summary + .replace(/^\s*(?:pr|pull|pull\s+request):\s*#?(\d+)/im, (_, pr: string) => { + const num = Number(pr); + if (!isNaN(num)) prFromSummary = num; + return ''; + }) + .replace(/^\s*commit:\s*([^\s]+)/im, (_, commit: string) => { + commitFromSummary = commit; + return ''; + }) + .replace(/^\s*(?:author|user):\s*@?([^\s]+)/gim, () => { + return ''; + }) + .trim(); + + const [firstLine, ...futureLines] = replacedChangelog.split('\n').map((l) => l.trimRight()); + + const links = await (async () => { + if (prFromSummary !== undefined) { + let { links } = await getInfoFromPullRequest({ + repo: opts.repo, + pull: prFromSummary, + }); + if (commitFromSummary) { + const shortCommitId = commitFromSummary.slice(0, 7); + links = { + ...links, + commit: `[\`${shortCommitId}\`](https://github.com/${opts.repo}/commit/${commitFromSummary})`, + }; + } + return links; + } + const commitToFetchFrom = commitFromSummary || changeset.commit; + if (commitToFetchFrom) { + const { links } = await getInfo({ + repo: opts.repo, + commit: commitToFetchFrom, + }); + return links; + } + return { + commit: null, + pull: null, + user: null, + }; + })(); + + const prefix = [ + links.pull === null ? '' : ` ${links.pull}`, + links.commit === null ? '' : ` ${links.commit}`, + ].join(''); + + return `\n\n-${prefix ? `${prefix} -` : ''} ${firstLine}\n${futureLines + .map((l) => ` ${l}`) + .join('\n')}`; + }, +}; + +export default changelogFunctions;