Skip to content

feat: support .mts/.cts and add a C/C++ detector - #193

Merged
Shinrai merged 1 commit into
nextfrom
feat/mts-cts-c-detector
Nov 25, 2026
Merged

Shinrai merged 1 commit into
nextfrom
feat/mts-cts-c-detector

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Adds .mts/.cts to the node detector and a new c detector for .c .h .cc .cpp .cxx .hh .hpp .hxx (plain /* */ header at the top, above #include / #pragma once / include guards).

Vendored C is skipped: a file whose prologue has a license/copyright notice that isn't a fix-headers header is left untouched, so the SQLite amalgamation keeps its own notice.

Resolves #192

The node detector now handles .mts and .cts. A new c detector covers
.c .h .cc .cpp .cxx .hh .hpp .hxx with a plain /* */ header at the top,
above #include, #pragma once and include guards.

Third-party C is left alone: a file whose prologue (comments, blank
lines and preprocessor directives before the first line of code) holds a
license or copyright notice that is not a fix-headers header is skipped,
so a vendored SQLite amalgamation keeps its own notice.

Resolves #192
@cldmv-bot cldmv-bot Bot added ! feature → next v4 flow: contributor PR targeting the next integration branch type: feature Implements new functionality — a PR or issue that adds a feature area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 25, 2026
@Shinrai
Shinrai merged commit f6f993e into next Nov 25, 2026
34 checks passed
@cldmv-bot
cldmv-bot Bot deleted the feat/mts-cts-c-detector branch November 25, 2026 18:44
Shinrai added a commit that referenced this pull request Nov 25, 2026
Adds the v2.3.0 changelog (`docs/changelog/v2/v2.3.0.md`) and promotes
the README What's New to v2.3.0 (v2.2.7 moves to Recent Releases, v2.2.3
drops off). Covers #189, #191 and #193.
cldmv-bot Bot added a commit that referenced this pull request Nov 25, 2026
# `@cldmv/fix-headers` v2.3.0 Changelog

**Release Date**: November 2026
**Release Type**: Minor
**Branch**: `release/2.3.0`

---

## Overview

Version 2.3.0 adds two kinds of files. The `node` detector now handles TypeScript's `.mts` and `.cts` extensions, and a new `c` detector stamps C and C++ sources and headers (`.c .h .cc .cpp .cxx .hh .hpp .hxx`).

Vendored C is left alone: a C file whose opening comments carry someone else's license or copyright notice is skipped and reported in `skipped`, so a bundled library such as the SQLite amalgamation keeps its own notice. Header output for every file type that was already supported is unchanged.

---

## ✨ Features

### `.mts` and `.cts` in the `node` detector ([#193](#193))

`.mts` and `.cts` files get the same `/** … */` header as `.ts`. A repo-wide run now stamps them instead of skipping them as unhandled.

### New `c` detector for C and C++ ([#193](#193))

The `c` detector is on by default and covers `.c`, `.h`, `.cc`, `.cpp`, `.cxx`, `.hh`, `.hpp` and `.hxx`. The header is a plain `/* … */` comment (not `/** … */`, so Doxygen doesn't take it as the documentation of the first declaration), placed at the top of the file above `#include`, `#pragma once` and include guards. Turn it off with `disabledDetectors: ["c"]`.

### Third-party C is skipped ([#193](#193))

The detector reads a C file's prologue (its comments, blank lines and preprocessor lines up to the first line of code). If any comment there mentions a copyright, a license, an `SPDX-License-Identifier` or "public domain" and isn't a fix-headers header, the file is reported in `skipped` and its bytes are not touched. This catches the SQLite amalgamation, whose public-domain notice sits below a few `#define` lines. A file whose first comment is already a fix-headers header is always treated as the project's own. Whole vendor folders can still be left out with `excludeFolders` / `--exclude-folder`.

Fixes [#192](#192).

## 🔧 CI & tooling

- `ci.yml` synced with the CLDMV/.github v4.43.0 template, so the release PR no longer reruns the test matrix on a commit its push run already tested ([#191](#191)).

## 📚 Documentation

- **NEW:** [docs/changelog/v2/v2.3.0.md](https://github.com/CLDMV/fix-headers/blob/v2.3.0/docs/changelog/v2/v2.3.0.md): this changelog.
- README: the supported-file-types table lists `.mts`/`.cts` and the `c` detector, and the skip rules describe how third-party C is detected ([#193](#193)).
- README What's New promoted to v2.3.0.

## 🔧 Dependencies

Development only ([#189](#189)):

- `@cldmv/eslint-plugin-jsonv` 1.0.17 → 1.1.2
- `@cldmv/jsonv` 1.1.5 → 1.2.2
- `@cldmv/prettier-plugin-jsonv` 1.1.4 → 1.2.2
- `@cldmv/vitest-runner` 1.5.6 → 1.6.1
- `eslint` 10.14.0 → 10.15.0
- `prettier` 3.9.10 → 3.10.1

---

## Upgrade notes

- No breaking changes; drop-in for v2.2.7.
- A repo-wide run now also stamps `.mts`, `.cts` and C/C++ files that were skipped before. Add `"c"` to `disabledDetectors`, or exclude the folders, if you don't want that.
- A project C file whose opening comment mentions a copyright or license (and isn't a fix-headers header yet) is skipped as third-party; the reason is shown in the run output.



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-99.6%25-brightgreen?style=for-the-badge&logo=vitest&logoColor=white)

| Metric | Coverage |
|--------|----------|
| Statements | 99.9% |
| Branches   | 98.8% |
| Functions  | 100.0% |
| Lines      | 99.9% |

*Avg: **99.6%** · `5d93a9f` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! feature → next v4 flow: contributor PR targeting the next integration branch type: documentation Relates to docs, README updates, guides, or inline code comments type: feature Implements new functionality — a PR or issue that adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant