mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(agents): normalize punctuation for extensionless imports
This commit is contained in:
1 parent
d10bceab7b
commit
4a73cf3828
3 files changed
+18
-2
No files matched your search
@@ -63,7 +63,8 @@ HTML video, audio, source and track `src` assets and video posters use the same
|
||||
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.
|
||||
Extensionless inline candidates are also imports when they resolve to repository files.
|
||||
Extensionless inline candidates are also imports when they resolve to repository files,
|
||||
after removing prose punctuation, including Unicode separators.
|
||||
Declared scoped dependencies, scope wildcards and matching TypeScript path aliases
|
||||
are recognized as package/alias mentions. Traversal and document-file imports are
|
||||
rejected before those exemptions. TypeScript configuration is parsed as JSONC.
|
||||
|
||||
@@ -188,7 +188,9 @@ export async function validateAgentGuidance({ rootDir }) {
|
||||
inlineImports.push(token);
|
||||
continue;
|
||||
}
|
||||
const candidate = token.replace(/[?!.,;:)"'\]}]+$/u, '');
|
||||
const candidate = token
|
||||
.split(/(?=[^\x00-\x7f])\p{P}/u, 1)[0]
|
||||
.replace(/[?!.,;:)"'\]}]+$/u, '');
|
||||
try {
|
||||
if ((await stat(resolve(rootDir, candidate))).isFile())
|
||||
inlineImports.push(token);
|
||||
|
||||
@@ -1123,3 +1123,16 @@ for (const punctuation of ['—its', '–its', '…', ',next', '。next', '”
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
for (const suffix of ['—then', ',next', '”']) {
|
||||
test(`extensionless imports stop at Unicode punctuation: ${suffix}`, async (t) => {
|
||||
const result = await diagnostics(t, {
|
||||
'CLAUDE.md':
|
||||
'@AGENTS.md\n\nRead @INSTRUCTIONS' + suffix + ' continue',
|
||||
INSTRUCTIONS: 'Additional guidance',
|
||||
});
|
||||
assert.ok(
|
||||
result.some((message) => message.includes('additional or inline'))
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user