@rakshazi/comment-gate0.1.0
Block multi-line and over-long comments before they reach disk
Untested on omp
This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.
Reports 0
No reports yet.
Readme
comment-gate: one-line comments, enforced at write time
Install with pi install npm:@rakshazi/comment-gate.
A write or edit that adds an oversized comment to a source file is blocked before it reaches the disk. The block reason names the file, the line and what is wrong, with a short excerpt.
What it blocks
In files ending in .go, .rs, .ts, .tsx, .py or .cpp:
| Kind | Rule |
|---|---|
| Run | Two or more comment lines in a row, or a block comment that spans more than one line |
| Long | A comment line over 120 characters (MAXLEN) |
| Docstring | A Python docstring over 7 lines (MAXDOC) |
Directive lines are exempt from all three, since they are machine grammar: //go:build, //nolint:, /// <reference, // @ts-ignore, a shebang, # noqa, # type: and their kin (isDirectiveLine).
Only text that lands is checked: content for write, every edits[].newText for edit. The first offender in each piece is reported.
The bypass
A comment that earns its lines, a license header for example, gets through with a marker: the block reason spells out a phrase, the model posts it with its reason as a message of its own, and the next edit passes. One marker clears one edit. The phrase is uncomfortable on purpose.
What it skips
Paths matching SKIP_FILE: node_modules/, vendor/, generated mocks and API docs, and the extension's own index.ts. The self-exemption matches the installed location, a path ending in extensions/comment-gate/index.ts or pi-extensions/comment-gate/index.ts.
Limits
- The detector reads lines and knows nothing of syntax. A
//inside a string literal at the start of a line counts as a comment. - An
editis judged by its new text alone, so a second comment line added under an existing one passes. - It fails open: an error inside the extension shows a warning and lets the write through.
bashis not watched.- No configuration and no tests.