diff --git a/docs/development/agent-workflow.md b/docs/development/agent-workflow.md index 7e3e9232f..e862497c0 100644 --- a/docs/development/agent-workflow.md +++ b/docs/development/agent-workflow.md @@ -72,6 +72,7 @@ existence checks as images. Entity decoding uses full HTML text/attribute rules, including references whose semicolon may be omitted. Inline guidance imports are rejected after punctuation as well as whitespace. At-signs inside external URLs are excluded per HTML text node, preserving adjacent imports. +A closing bracket followed by punctuation and an at-sign terminates a bare URL exclusion. Extensionless inline candidates are also imports when they resolve to repository files, checking the full filename before prefixes at ASCII/Unicode prose separators. Declared scoped dependencies, scope wildcards and matching TypeScript path aliases diff --git a/tools/skills/agent-guidance-markdown.mjs b/tools/skills/agent-guidance-markdown.mjs index b55000c9e..78a17fab8 100644 --- a/tools/skills/agent-guidance-markdown.mjs +++ b/tools/skills/agent-guidance-markdown.mjs @@ -147,7 +147,7 @@ export function guidanceProse(markdown) { return ' '; if (node.nodeName === '#text') return node.value.replace( - /(?:\b[a-z][a-z\d+.-]*:\/\/|\/\/)[^\s]+/giu, + /(?:\b[a-z][a-z\d+.-]*:\/\/|\/\/)[^\s]*?(?=[)\]}>][.,;:!?]*@|\s|$)/giu, ' ' ); const content = (node.childNodes ?? []).map(text).join(''); diff --git a/tools/skills/validate-agent-guidance.test.mjs b/tools/skills/validate-agent-guidance.test.mjs index e5f4ec852..649f6e861 100644 --- a/tools/skills/validate-agent-guidance.test.mjs +++ b/tools/skills/validate-agent-guidance.test.mjs @@ -1489,3 +1489,18 @@ test('local HTML base uses native filesystem paths', async (t) => { [] ); }); + +for (const boundary of [').', '];', '}']) { + test(`bare URL preserves adjacent import after ${boundary}`, async (t) => { + assert.ok( + ( + await diagnostics(t, { + 'CLAUDE.md': + '@AGENTS.md\n\nhttps://example.com/path' + + boundary + + '@docs/guide.md', + }) + ).some((message) => message.includes('additional or inline')) + ); + }); +}