Skip to content

--input <file>.md adds a JS comment header to Markdown; .md files should only get a header when explicitly forced #122

Description

@Shinrai

Problem

Markdown files don't get file headers. A default repo-wide run correctly skips .md. But naming a Markdown file with --input processes it anyway, and writes a JavaScript /** … */ block at the top.

Reproduced on @cldmv/fix-headers@2.1.3:

npx fix-headers --dry-run --verbose              # .md files: not scanned (correct)
npx fix-headers --input doc.md --dry-run --sample-output
# fix-headers complete: scanned=1, updated=1, dryRun=true
# /**
#  *	@Project: fh-md
#  ...

In Markdown that comment renders as visible text. It's also a trap in normal use: the per-version changelog (docs/changelog/vX/vX.Y.Z.md) becomes the release PR body and the GitHub Release notes, so a header there would ship in the release notes. During the 2026-10-03 release-docs sweep (CLDMV/uuid#53, CLDMV/droidsock#60, CLDMV/wisp#32, CLDMV/stubborn-tcp#7, CLDMV/mxnet-control#8), every agent had to skip the tool on new .md files for this reason.

Expected

  • .md files are never given a header unless the caller explicitly forces it, through a dedicated option or config setting. Merely passing the file via --input must not count as forcing. With --input, a non-forced .md file is reported as skipped, not "updated".
  • When a header is forced on Markdown, it uses Markdown-safe syntax (an HTML comment, <!-- … -->), never a JS block comment.
  • The same rule covers every format that can't carry a JS comment. JSON is Running on a .json file inserts a JS comment header and breaks the JSON #120: never write a comment into it.

Tests

  • A repo-wide run leaves .md untouched (already true; keep it covered).
  • --input <file>.md without the force option: file unchanged, reported as skipped.
  • With the force option: an HTML-comment header, and running it again updates that header in place rather than adding a second one.

Related: #120 (JSON), #119 (repeated --input).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreTouches core library / runtime source codepriority: highNeeds attention soon — not blocking, but don't let it sitstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: bugSomething is broken or not behaving as expected

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions