fix: distinguish reference inputs and validate installed result workflows
This commit is contained in:
@@ -6,8 +6,11 @@ export function requestedFilePaths(text) {
|
||||
const action = /(?:创建|新建|保存|写入|修改|重写|修复|调整|替换)|\b(?:create|save|write|modify|rewrite|fix|change|replace)\b/i.exec(clause);
|
||||
if (!action || negatedFileAction(clause.slice(0, action.index))) continue;
|
||||
const suffix = clause.slice(action.index + action[0].length);
|
||||
if (/\b(?:from|using|based on)\b|(?:根据|参考)/i.test(suffix.split(/(?:[\w\u3400-\u9fff@.-]+\/)*[\w\u3400-\u9fff@-]+\.(?:html?|svg|txt|md|json|[cm]?[jt]sx?|css|py|ya?ml)\b/i)[0])) continue;
|
||||
for (const match of suffix.matchAll(/(?:[\w\u3400-\u9fff@.-]+\/)*[\w\u3400-\u9fff@-]+\.(?:html?|svg|txt|md|json|[cm]?[jt]sx?|css|py|ya?ml)\b/ig)) paths.push(match[0]);
|
||||
// Stop at a reference or prohibition instead of treating its input file as
|
||||
// another required output. Ambiguous wording stays outside this small gate.
|
||||
const boundary = /\b(?:from|using|based on)\b|(?:根据|参考|参照|不要|无需|不用|禁止|不得)/i.exec(suffix);
|
||||
const outputs = boundary ? suffix.slice(0, boundary.index) : suffix;
|
||||
for (const match of outputs.matchAll(/(?:[\w\u3400-\u9fff@.-]+\/)*[\w\u3400-\u9fff@-]+\.(?:html?|svg|txt|md|json|[cm]?[jt]sx?|css|py|ya?ml)\b/ig)) paths.push(match[0]);
|
||||
}
|
||||
return [...new Set(paths)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user