From 858e4fe86e45d1c877da691f5c8191582b88e2ab Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 20 Jul 2026 14:15:49 +0200 Subject: [PATCH 1/5] feat: add `sequence` format Hybrid format that can be pasted directly in the sequence editor of a `git rebase --interactive` session, without retaining info such as commit title, author, semverness, PR URL. --- commit-to-output.js | 9 +++++++-- process-commits.js | 2 ++ test.js | 12 ++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/commit-to-output.js b/commit-to-output.js index 31bbfdb..d8d05b9 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -33,6 +33,7 @@ export const formatType = { SHA: 'sha', PLAINTEXT: 'plaintext', MARKDOWN: 'markdown', + SEQUENCE: 'sequence', SIMPLE: 'simple', MESSAGEONLY: 'messageonly' } @@ -60,7 +61,6 @@ function toStringPlaintext (data) { function toStringSimple (data) { let s = '' - s += `* [${data.sha.substr(0, 10)}] - ` s += (data.semver || []).length ? `(${data.semver.join(', ').toUpperCase()}) ` : '' s += data.revert ? 'Revert "' : '' s += data.group ? `${data.group}: ` : '' @@ -68,8 +68,11 @@ function toStringSimple (data) { s += data.revert ? '" ' : ' ' s += data.author ? `(${data.author}) ` : '' s += data.pr ? data.prUrl : '' - s = s.trim() + return s.trim() +} +function toStringSimpleWithListMarker (data) { + const s = `* [${data.sha.substr(0, 10)}] - ${toStringSimple(data)}` return (data.semver && data.semver.length) ? chalk.green.bold(s) : (data.group === 'doc' @@ -119,6 +122,8 @@ export function commitToOutput (commit, format, ghId, commitUrl) { data.cveId = commit.cveId if (format === formatType.SIMPLE) { + return toStringSimpleWithListMarker(data) + } else if (format === formatType.SEQUENCE) { return toStringSimple(data) } else if (format === formatType.PLAINTEXT) { return toStringPlaintext(data) diff --git a/process-commits.js b/process-commits.js index f3fa685..c3233b0 100644 --- a/process-commits.js +++ b/process-commits.js @@ -50,6 +50,8 @@ export async function processCommits (argv, ghId, list) { if (format === formatType.SHA) { list = list.map((commit) => `${commit.sha.substr(0, 10)}`) + } else if (format === formatType.SEQUENCE) { + list = list.map((commit) => `pick ${commit.sha} # ${commitToOutput(commit, format, ghId, commitUrl)}`) } else if ( format === formatType.PLAINTEXT || format === formatType.MESSAGEONLY diff --git a/test.js b/test.js index 2e2791c..ee5ad64 100644 --- a/test.js +++ b/test.js @@ -44,6 +44,18 @@ test('test simple', (t) => { `) t.end() }) +test('test sequence', (t) => { + t.equal(exec('--start-ref=v2.2.7 --end-ref=9c700d29 --group --filter-release --format=sequence'), + `pick cc442b65343cd1bb7cb4ecc3c6e729b4e4625f97 # (SEMVER-MINOR) minor nit (Rod Vagg) https://github.com/nodejs/node/pull/23715 +pick 4f2b7f8136358bc3ecd720e33457fdeff9581733 # deps: use strip-ansi instead of chalk.stripColor (Rod Vagg) +pick 6898501e18f231db40a84b511d2a6a4b8f5f17f3 # deps: update deps, introduce test & lint deps (Rod Vagg) +pick 9c700d29104b5a22fcf79ba21f5f009d7f1cdfc5 # feature: refactor and improve --commit-url (Rod Vagg) +pick 50945246557b4a25133435b106d0e5dd5d88a9be # feature: make the commit url configurable via an additional argument (Jim Nielsen) https://github.com/nodejs/changelog-maker/pull/55 +pick 42f248cf8904224a585e9f3834cc1283713c56cf # src: use \`standard\` for linting (Rod Vagg) +pick 64a8fdef3c35627ca50c48e9acb80c57a3f6d2a2 # test: basic test infrastructure (Rod Vagg) +`) + t.end() +}) test('test plaintext', (t) => { t.equal(exec('--start-ref=9c700d2 --end-ref=dd937e9 --group --filter-release --plaintext'), From b3255636db14548374db47dcb9356b13c2b0617c Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 12 Aug 2026 10:51:31 +0200 Subject: [PATCH 2/5] fixup! feat: add `sequence` format --- README.md | 1 + commit-to-output.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index acd5225..f04bfce 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ npm i changelog-maker -g `github-user` and `github-project` should point to the GitHub repository that can be used to find the `PR-URL` data if just an issue number is provided and will also impact how the PR-URL issue numbers are displayed * `--format`: dictates what formatting the output will have. Possible options are: `simple`, `markdown`, `plaintext`, `messageonly` and `sha`. The default is to print a `simple` output suitable for stdout. + - `sequence`: hybrid format that can be pasted directly in the sequence editor of a `git rebase --interactive` session, without retaining info such as commit title, author, labels, PR URL. - `simple`: don't print full markdown output, good for console printing without the additional fluff. - `sha`: print only the 10-character truncated commit hashes. - `plaintext`: a very simple form, without commit details, implies `--group`. diff --git a/commit-to-output.js b/commit-to-output.js index d8d05b9..abb0e2b 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -59,7 +59,7 @@ function toStringPlaintext (data) { return ` * ${s.trim()}` } -function toStringSimple (data) { +function toStringSimple (data, withLabels = false) { let s = '' s += (data.semver || []).length ? `(${data.semver.join(', ').toUpperCase()}) ` : '' s += data.revert ? 'Revert "' : '' @@ -68,6 +68,7 @@ function toStringSimple (data) { s += data.revert ? '" ' : ' ' s += data.author ? `(${data.author}) ` : '' s += data.pr ? data.prUrl : '' + if (withLabels) s += ' (' + data.labels.join(', ') + ')' return s.trim() } @@ -113,6 +114,7 @@ export function commitToOutput (commit, format, ghId, commitUrl) { data.sha = commit.sha data.shaUrl = commitUrl.replace(/\{ghUser\}/g, ghId.user).replace(/\{ghRepo\}/g, ghId.repo).replace(/\{ref\}/g, ref) data.semver = commit.labels && commit.labels.filter((l) => l.includes('semver')) + data.labels = commit.labels data.revert = isRevert(commit.summary) data.group = toGroups(commit.summary) data.summary = cleanGroupSummary(cleanRevertSummary(commit.summary)) @@ -124,7 +126,7 @@ export function commitToOutput (commit, format, ghId, commitUrl) { if (format === formatType.SIMPLE) { return toStringSimpleWithListMarker(data) } else if (format === formatType.SEQUENCE) { - return toStringSimple(data) + return toStringSimple(data, true) } else if (format === formatType.PLAINTEXT) { return toStringPlaintext(data) } else if (format === formatType.MESSAGEONLY) { From 387ec8d0b7c51642d21cba4b4abcb2c363d32732 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 27 Aug 2026 11:12:11 +0200 Subject: [PATCH 3/5] fixup! feat: add `sequence` format --- commit-to-output.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commit-to-output.js b/commit-to-output.js index abb0e2b..45d9be2 100644 --- a/commit-to-output.js +++ b/commit-to-output.js @@ -68,7 +68,7 @@ function toStringSimple (data, withLabels = false) { s += data.revert ? '" ' : ' ' s += data.author ? `(${data.author}) ` : '' s += data.pr ? data.prUrl : '' - if (withLabels) s += ' (' + data.labels.join(', ') + ')' + if (withLabels && data.labels?.length) s += ' (' + data.labels.join(', ') + ')' return s.trim() } From 5e5a85feb09f88663d1b8c821e41d61eb5c94586 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 27 Aug 2026 11:38:51 +0200 Subject: [PATCH 4/5] fixup! feat: add `sequence` format add --sequence-drop --- README.md | 1 + process-commits.js | 3 ++- test.js | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f04bfce..af32bac 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ npm i changelog-maker -g * `--start-ref=`: use the given git `` as a starting point rather than the _last tag_. The `` can be anything commit-ish including a commit sha, tag, branch name. If you specify a `--start-ref` argument the commit log will not be pruned so that version commits and `working on ` commits are left in the list. * `--end-ref=`: use the given git `` as a end-point rather than the _now_. The `` can be anything commit-ish including a commit sha, tag, branch name. * `--filter-release`: exclude Node-style release commits from the list. e.g. "Working on v1.0.0" or "2015-10-21 Version 2.0.0" and also "npm version X" style commits containing _only_ an `x.y.z` semver designator. +* `--sequence-drop=[,[,…]]`: when `--format=sequence`, will output the commits belonging to a PR with a label listed here as `drop` instead of `pick`. This can be useful for human backporter to understand why a specific commit does not apply cleanly, to spot which commit might be creating conflicts. * `--find-matching-prs`: use the GitHub API to find the pull requests that match commits that don't have the `PR-URL` metadata in their message text. Without metadata, it may be necessary to also pass the org/user and repo name on the commandline (as the `github-user` and `github-project` arguments as demonstrated above, it may also be necessary to use `--find-matching-prs=true` in this case). * `--quiet` or `-q`: do not print to `process.stdout` * `--all` or `-a`: process all commits since beginning, instead of last tag. diff --git a/process-commits.js b/process-commits.js index c3233b0..f07ce79 100644 --- a/process-commits.js +++ b/process-commits.js @@ -51,7 +51,8 @@ export async function processCommits (argv, ghId, list) { if (format === formatType.SHA) { list = list.map((commit) => `${commit.sha.substr(0, 10)}`) } else if (format === formatType.SEQUENCE) { - list = list.map((commit) => `pick ${commit.sha} # ${commitToOutput(commit, format, ghId, commitUrl)}`) + const droppableLabels = argv['sequence-drop']?.split(',') ?? [] + list = list.map((commit) => `${commit.labels?.some(l => droppableLabels.includes(l)) ? 'drop' : 'pick'} ${commit.sha} # ${commitToOutput(commit, format, ghId, commitUrl)}`) } else if ( format === formatType.PLAINTEXT || format === formatType.MESSAGEONLY diff --git a/test.js b/test.js index ee5ad64..fc606f7 100644 --- a/test.js +++ b/test.js @@ -44,9 +44,10 @@ test('test simple', (t) => { `) t.end() }) + test('test sequence', (t) => { t.equal(exec('--start-ref=v2.2.7 --end-ref=9c700d29 --group --filter-release --format=sequence'), - `pick cc442b65343cd1bb7cb4ecc3c6e729b4e4625f97 # (SEMVER-MINOR) minor nit (Rod Vagg) https://github.com/nodejs/node/pull/23715 + `pick cc442b65343cd1bb7cb4ecc3c6e729b4e4625f97 # (SEMVER-MINOR) minor nit (Rod Vagg) https://github.com/nodejs/node/pull/23715 (semver-minor, build, i18n-api) pick 4f2b7f8136358bc3ecd720e33457fdeff9581733 # deps: use strip-ansi instead of chalk.stripColor (Rod Vagg) pick 6898501e18f231db40a84b511d2a6a4b8f5f17f3 # deps: update deps, introduce test & lint deps (Rod Vagg) pick 9c700d29104b5a22fcf79ba21f5f009d7f1cdfc5 # feature: refactor and improve --commit-url (Rod Vagg) @@ -57,6 +58,19 @@ pick 64a8fdef3c35627ca50c48e9acb80c57a3f6d2a2 # test: basic test infrastructure t.end() }) +test('test sequence-drop', (t) => { + t.equal(exec('--start-ref=v2.2.7 --end-ref=9c700d29 --group --filter-release --format=sequence --reverse --sequence-drop=semver-minor'), + `pick 64a8fdef3c35627ca50c48e9acb80c57a3f6d2a2 # test: basic test infrastructure (Rod Vagg) +pick 42f248cf8904224a585e9f3834cc1283713c56cf # src: use \`standard\` for linting (Rod Vagg) +pick 50945246557b4a25133435b106d0e5dd5d88a9be # feature: make the commit url configurable via an additional argument (Jim Nielsen) https://github.com/nodejs/changelog-maker/pull/55 +pick 9c700d29104b5a22fcf79ba21f5f009d7f1cdfc5 # feature: refactor and improve --commit-url (Rod Vagg) +pick 6898501e18f231db40a84b511d2a6a4b8f5f17f3 # deps: update deps, introduce test & lint deps (Rod Vagg) +pick 4f2b7f8136358bc3ecd720e33457fdeff9581733 # deps: use strip-ansi instead of chalk.stripColor (Rod Vagg) +drop cc442b65343cd1bb7cb4ecc3c6e729b4e4625f97 # (SEMVER-MINOR) minor nit (Rod Vagg) https://github.com/nodejs/node/pull/23715 (semver-minor, build, i18n-api) +`) + t.end() +}) + test('test plaintext', (t) => { t.equal(exec('--start-ref=9c700d2 --end-ref=dd937e9 --group --filter-release --plaintext'), `feature: From 76f115411da78b104f91c27dd2923ff1cd91ccb3 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 27 Aug 2026 11:58:11 +0200 Subject: [PATCH 5/5] fixup! fixup! feat: add `sequence` format --- changelog-maker.js | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog-maker.js b/changelog-maker.js index c518bb9..08c100b 100755 --- a/changelog-maker.js +++ b/changelog-maker.js @@ -18,6 +18,7 @@ const { values, positionals } = parseArgs({ 'commit-url': { type: 'string' }, 'end-ref': { type: 'string' }, 'filter-release': { type: 'boolean' }, + 'sequence-drop': { type: 'string' }, 'find-matching-prs': { type: 'boolean' }, format: { type: 'string' }, group: { type: 'boolean', short: 'g' },