Skip to content

feat: write @Filename without a leading slash - #199

Merged
Shinrai merged 2 commits into
nextfrom
fix/relative-filename
Nov 25, 2026
Merged

Shinrai merged 2 commits into
nextfrom
fix/relative-filename

Conversation

@cldmv-bot

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

Copy link
Copy Markdown
Contributor

@Filename is the path relative to the project root, so it's now written as src/index.mjs instead of /src/index.mjs. A header with the old leading slash is rewritten on the next run and keeps its @Last modified by, so picking this up in a repo is a header-only change. README examples are updated to match. The declaration-copy check from #196 compares only the file name, so it works with both forms.

The second commit restamps this repo's own headers with the new form.

Resolves #198

@filename is the file's path relative to the project root, so write it as
src/index.mjs instead of /src/index.mjs. A header written by an earlier
version with the slash is rewritten on the next run, keeping the recorded
@last modified by. The #195 declaration-copy check compares only the file
name, so it accepts both forms.

Resolves #198
@cldmv-bot cldmv-bot Bot added ! fix → next v4 flow: fix 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: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files type: documentation Relates to docs, README updates, guides, or inline code comments labels Nov 25, 2026
@cldmv-bot cldmv-bot Bot changed the title chore: restamp headers with the slashless @Filename feat: write @Filename without a leading slash Nov 25, 2026
@cldmv-bot

cldmv-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Auto-normalized PR title: rewrote PR title to match the highest-priority commit type (feat).

  • Before: chore: restamp headers with the slashless @Filename
  • After: feat: write @Filename without a leading slash

If this isn't what you want, edit the title — the normalizer won't re-fire as long as the title stays conventional.

@Shinrai
Shinrai merged commit f62f16d into next Nov 25, 2026
36 checks passed
@cldmv-bot
cldmv-bot Bot deleted the fix/relative-filename branch November 25, 2026 21:13
Shinrai added a commit that referenced this pull request Nov 25, 2026
Release notes for v2.4.0: `docs/changelog/v2/v2.4.0.md` covering #196
and #199, and README What's New promoted to v2.4.0 (v2.3.0 moves into
Recent Releases, v2.2.4 drops off).
cldmv-bot Bot added a commit that referenced this pull request Nov 25, 2026
# `@cldmv/fix-headers` v2.4.0 Changelog

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

---

## Overview

`@Filename` is now written without a leading slash. It is the file's path relative to the project root, and `/src/index.mjs` read as an absolute path, so it is written as `src/index.mjs`. Headers written by earlier versions are rewritten on the next run.

Declaration files that `tsc` emits with a copy of their source's header are now left alone, so `tsc` and fix-headers stop rewriting each other's `@Filename` in committed `types/` folders.

---

## ✨ Features

### `@Filename` without a leading slash ([#199](#199))

`src/index.mjs` → `@Filename: src/index.mjs` (was `/src/index.mjs`). A file with no project root above it gets just its file name. An existing header with the leading slash is rewritten on the next run like any other stale field: only the `@Filename` line and `@Last modified time` change, and the recorded `@Last modified by` is kept because the file's content was not edited.

Fixes [#198](#198).

## 🐛 Bug Fixes

### Declarations carrying `tsc`'s copy of the source header are skipped ([#196](#196))

`tsc` copies a source file's leading comment into the `.d.ts` / `.d.mts` / `.d.cts` it emits, so a generated `types/src/x.d.mts` carried `@Filename` naming `src/x.mts`. fix-headers rewrote it to the declaration's own path, and the next `tsc` build wrote it back, so every build and every fix-headers run changed the committed declarations. A declaration whose header names its own source is now reported in `skipped` and left as `tsc` wrote it. The pairs are `x.d.mts` from `x.mts` / `x.mjs`, `x.d.ts` from `x.ts` / `x.tsx` / `x.js` / `x.jsx`, and `x.d.cts` from `x.cts` / `x.cjs`; the check compares file names only, so both the old slashed and the new `@Filename` form match. A declaration with no header, or one naming any other file (a hand-written declaration that was moved or renamed), is fixed as before.

Fixes [#195](#195).

## 📚 Documentation

- **NEW:** [docs/changelog/v2/v2.4.0.md](https://github.com/CLDMV/fix-headers/blob/v2.4.0/docs/changelog/v2/v2.4.0.md): this changelog.
- README: every `@Filename` example uses the slashless form, the project-root rules say so, and the skip rules describe generated declaration files ([#196](#196), [#199](#199)).
- README What's New promoted to v2.4.0.

## 🔧 Dependencies

_No dependency updates._

---

## Upgrade notes

- The first run after upgrading rewrites the `@Filename` line (and `@Last modified time`) in every file that has a header. Land it on its own, as a header-only commit, when no open PRs touch the same files.
- `@Last modified by` and `@Author` are kept on that run.
- Generated declarations whose header names their own source now show up in `skipped`; nothing else about how declarations are handled changes.



<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%** · `a32ffe5` · 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 ! fix → next v4 flow: fix contributor PR targeting the next integration branch type: ci Changes to CI workflows, actions, or build pipelines type: config Changes to repository or project configuration files 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