mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(agents): delimit package prose at Unicode punctuation
This commit is contained in:
1 parent
bbbaebce83
commit
d10bceab7b
3 files changed
+18
-1
No files matched your search
@@ -71,6 +71,7 @@ Declared packages also permit safe subpaths; exact aliases stay exact.
|
||||
Declared package mentions may include a version (including semver comparators) or dist-tag qualifier.
|
||||
Qualifier handling includes unscoped names; terminal sentence punctuation is
|
||||
removed before matching a declared package, as are straight/curly apostrophe possessives.
|
||||
Non-ASCII punctuation separates package mentions from adjacent prose.
|
||||
Markdown destinations decode HTML entities before URI parsing, matching rendered links.
|
||||
Heading-anchor lookup is limited to Markdown targets. Source-file line fragments,
|
||||
PDF page fragments and other non-Markdown fragments retain file-existence checks.
|
||||
|
||||
@@ -114,7 +114,9 @@ async function packageMentions(rootDir) {
|
||||
.map((name) => name.slice(1));
|
||||
const scopes = new Set(declared.map((name) => name.split('/')[0]));
|
||||
return (raw) => {
|
||||
let token = raw.replace(/[?!.,;:)"'\]}]+$/u, '');
|
||||
// ASCII punctuation also belongs to package names and version ranges.
|
||||
let token = raw.split(/(?=[^\x00-\x7f])\p{P}/u, 1)[0];
|
||||
token = token.replace(/[?!.,;:)"'\]}]+$/u, '');
|
||||
token = token.replace(/['’]s$/iu, '');
|
||||
token = token.replace(
|
||||
/^([^/@]+(?:\/[^/@]+)?)@(?:(?:[~^]|[<>]=?|=)?\d[\w.+-]*|[a-z][\w-]*)$/iu,
|
||||
|
||||
@@ -1109,3 +1109,17 @@ for (const ending of ['\n', '\r\n', '\r']) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const punctuation of ['—its', '–its', '…', ',next', '。next', '”']) {
|
||||
test(`package mention stops at Unicode punctuation: ${punctuation}`, async (t) => {
|
||||
assert.deepEqual(
|
||||
await diagnostics(t, {
|
||||
'package.json': JSON.stringify({
|
||||
dependencies: { '@angular/core': '*' },
|
||||
}),
|
||||
'AGENTS.md': 'Use @angular/core' + punctuation + ' APIs',
|
||||
}),
|
||||
[]
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user