fix(agents): recognize possessive package mentions

This commit is contained in:
4gray committed 2026-09-20 23:23:11 +02:00
1 parent 0ac3421594
commit cb42c74f43
3 files changed
+16 -1

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ rejected before those exemptions. TypeScript configuration is parsed as JSONC.
Declared packages also permit safe subpaths; exact aliases stay exact.
Declared package mentions may include a version or dist-tag qualifier.
Qualifier handling includes unscoped names; terminal sentence punctuation is
removed before matching a declared package.
removed before matching a declared package, as are straight/curly apostrophe possessives.
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.
+1
View File
@@ -115,6 +115,7 @@ async function packageMentions(rootDir) {
const scopes = new Set(declared.map((name) => name.split('/')[0]));
return (raw) => {
let token = raw.replace(/[?!.,;:)"'\]}]+$/u, '');
token = token.replace(/['’]s$/iu, '');
token = token.replace(
/^([^/@]+(?:\/[^/@]+)?)@(?:[~^]?\d[\w.+-]*|[a-z][\w-]*)$/iu,
'$1'
@@ -991,3 +991,17 @@ for (const html of [
);
});
}
for (const suffix of ["'s", '’s']) {
test(`declared package may be possessive: ${suffix}`, async (t) => {
assert.deepEqual(
await diagnostics(t, {
'package.json': JSON.stringify({
dependencies: { '@angular/core': '*' },
}),
'AGENTS.md': '@angular/core' + suffix + ' API',
}),
[]
);
});
}