Blog / Build with AI /

Building a release notes formatter with AI

Release notes get written last, in a hurry, from a messy list of things you changed. The result is usually either nothing or a wall of text nobody reads. A tiny formatter fixes the boring half of this: turn rough notes into a clean, consistent list.

The finished thing, in one line: a small web page where you paste rough change notes, one per line with a short prefix, and get tidy release notes grouped under headings like Added, Changed and Fixed.

You don’t need AI inside the tool for this version. AI helps you build it; the tool itself can be plain JavaScript. At the end I’ll cover the option of putting AI inside it.

Step 1: decide the format

Pick a format before you pick any code. A widely used one is the “Keep a Changelog” style, with a version, a date and grouped lists:

## 1.2.0 - 2024-07-18

### Added
- Dark mode toggle

### Changed
- Settings page loads faster

### Fixed
- Export button did nothing on Firefox

Consistent headings make notes scannable. A reader who only cares about fixes can jump straight to them. If you maintain a small tool, an extension or a plugin, this is a good habit anyway.

Step 2: decide the input

Keep the input dull on purpose. Dull inputs make reliable tools. Here’s a rule that works: each line starts with a short tag.

add: dark mode toggle
change: settings page loads faster
fix: export button did nothing on Firefox
fix: typo on the welcome screen

You type four words of structure per line, and the tool does the rest. No guessing, no cleverness.

Step 3: ask for the build

A prompt I’d use:

Build a single HTML file with a textarea, a version field, a date field and a “Format” button. When I click Format, read the textarea line by line. Lines starting with “add:” go under “### Added”, “change:” under “### Changed”, “fix:” under “### Fixed”, and “remove:” under “### Removed”. Skip empty groups. Output Markdown in a second textarea with a “Copy” button. Trim spaces and capitalise the first letter of each item. Ignore lines with no recognised tag, but list them in a warning below so I don’t lose them. Plain JavaScript only, no libraries.

The warning for unrecognised lines is the important bit. A formatter that silently drops a line is worse than no formatter, because you’d trust the output.

Step 4: the core of the code

The logic should look something like this, and it’s short enough to read in full:

const groups = { add: 'Added', change: 'Changed', fix: 'Fixed', remove: 'Removed' };

function format(text, version, date) {
  const found = {};
  const unknown = [];

  text.split('\n').forEach(line => {
    const clean = line.trim();
    if (!clean) return;
    const [tag, ...rest] = clean.split(':');
    const key = tag.trim().toLowerCase();
    const item = rest.join(':').trim();
    if (groups[key] && item) {
      (found[key] = found[key] || []).push(
        item.charAt(0).toUpperCase() + item.slice(1)
      );
    } else {
      unknown.push(clean);
    }
  });

  let out = `## ${version} - ${date}\n`;
  Object.keys(groups).forEach(key => {
    if (found[key]) {
      out += `\n### ${groups[key]}\n` + found[key].map(i => `- ${i}`).join('\n') + '\n';
    }
  });
  return { out, unknown };
}

Notice rest.join(':'). If someone writes “fix: crash when URL contains a colon”, splitting on every colon would chop the sentence. That is exactly the kind of small bug that generated code can have, so test with awkward lines.

Step 5: test it with awkward input

Paste these in and see what happens:

  • An empty line in the middle.
  • A line with no tag.
  • A tag in capitals: FIX: something.
  • A line with two colons.
  • A tag with nothing after it: add:.

If any of these break the output, paste the problem back to the AI with the exact input and the exact result. Specific beats vague. I make the same point in prompts that fix bugs vs prompts that create new ones.

Where AI can go inside the tool

You could send the rough notes to an AI model and ask it to sort and polish them. It works, and it’s tempting when your notes are messy sentences instead of tagged lines. But think about the trade-offs:

  • It can invent. Ask it to “improve” a note and it may add details that aren’t true, like claiming a bug is fixed “on all browsers” when you fixed it on one.
  • It costs money and needs a key. That means a back end to hide the key, which turns a one-file tool into a project.
  • It’s less predictable. The same input may give different headings on different days.

My rule would be: use plain code for structure, and AI only for optional wording suggestions that a human reads before publishing. If you do add AI, tell it explicitly: “Do not add any change that isn’t in the input.”

A small upgrade: a preview

Once the basics work, ask for a live preview. As you type in the first box, the formatted notes update in the second. It sounds like polish, but it changes how you use the tool. You spot a mistyped tag straight away instead of after you’ve pasted the notes into a store listing or a GitHub release.

Another cheap upgrade is a “remember my last version” option using the browser’s local storage, so the version field is already filled in next time. Local storage stays on that one browser, which is fine for a personal helper. Just don’t expect it to follow you to another device.

What to watch

  • Don’t paste secrets. Notes sometimes mention internal URLs or customer names. Strip these before anything leaves your computer.
  • Keep the human sign-off. The formatter tidies; you decide what’s true.
  • Resist feature creep. Version bumping, Git integration and Slack posting can all wait.

Next step

Use it for your next real release, however small. If you spot yourself fixing the same thing by hand each time, that’s your next feature request.

What’s the last update you shipped that never got proper notes?