mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-25 16:37:32 +00:00
fix(skills): a pasted figma link alone no longer picks the figma skill (#8536)
* test(skills): a description a pasted link alone triggers is refused * fix(skills): a pasted figma link alone no longer picks the figma skill Its description said 'use when the person pastes a figma.com link', so a link with no task started the video workflow (OSS #8530's case). It now names the task; the lint refuses any description a pasted link alone triggers. * test(skills): past and passive link-alone wording is refused too * fix(skills): the link-alone rule reads any tense; figma's description fits its budget * chore(skills): regenerate skills-manifest.json for figma's description
This commit is contained in:
@@ -75,6 +75,27 @@ test("valid: description with a colon inside a quoted string", () => {
|
||||
const has = (violations, needle) =>
|
||||
violations.some((v) => v.message.toLowerCase().includes(needle.toLowerCase()));
|
||||
|
||||
test("invalid: a description that a pasted link alone triggers (#8530)", () => {
|
||||
for (const said of [
|
||||
"Bring Figma into a video. Use when the person pastes a figma.com link or asks to use a Figma design.",
|
||||
"Turn a site into a video. Use when the user shares a URL.",
|
||||
"Capture a website. Use when someone drops a link to a page.",
|
||||
"Capture a website. Use when the user has pasted a link.",
|
||||
"Capture a website. Use when a link is pasted with no other request.",
|
||||
"Capture a website. Use when given a URL.",
|
||||
"Capture a website. Use for pasted links.",
|
||||
]) {
|
||||
const violations = lintFrontmatter(wrap(`name: foo\ndescription: ${said}`));
|
||||
assert.ok(has(violations, "a pasted link alone"), said);
|
||||
}
|
||||
});
|
||||
|
||||
test("valid: a description that names the task a link comes with", () => {
|
||||
const said =
|
||||
"Bring Figma into a video. Use when the person asks to use a Figma design, frame or logo in a video; a link with no task is not that ask.";
|
||||
assert.deepEqual(lintFrontmatter(wrap(`name: foo\ndescription: ${said}`)), []);
|
||||
});
|
||||
|
||||
test("invalid: missing frontmatter block", () => {
|
||||
const violations = lintFrontmatter("# just a body, no dashes\n");
|
||||
assert.ok(has(violations, "Missing SKILL.md YAML frontmatter"));
|
||||
|
||||
@@ -197,10 +197,28 @@ function validateMetadata(data: Record<string, unknown>): LineViolation | null {
|
||||
);
|
||||
}
|
||||
|
||||
// A link with no task picks the skill whose description claims it (#8530): name the task a link comes with instead.
|
||||
// Any tense, active or passive, verb before or after the link; a dot inside "figma.com" does not end the clause.
|
||||
const SHARING = String.raw`\b(?:past(?:e|es|ed|ing)|shar(?:e|es|ed|ing)|drop(?:s|ped|ping)?|sen(?:d|ds|ding|t)|g(?:ive|ives|iven|iving|ave)|provid(?:e|es|ed|ing))\b`;
|
||||
const LINK = String.raw`\b(?:links?|urls?)\b`;
|
||||
const CLAUSE = String.raw`(?:[^.;]|\.(?=\S)){0,40}?`;
|
||||
const LINK_ALONE_TRIGGER = new RegExp(`${SHARING}${CLAUSE}${LINK}|${LINK}${CLAUSE}${SHARING}`, "i");
|
||||
|
||||
function validateTrigger(data: Record<string, unknown>): LineViolation | null {
|
||||
const said = data.description;
|
||||
if (typeof said !== "string" || !LINK_ALONE_TRIGGER.test(said)) return null;
|
||||
return violation(
|
||||
1,
|
||||
`The description makes a pasted link alone pick this skill; say which task the link comes with instead.`,
|
||||
said.match(LINK_ALONE_TRIGGER)?.[0] ?? said,
|
||||
);
|
||||
}
|
||||
|
||||
function validateShape(data: Record<string, unknown>): LineViolation[] {
|
||||
const fieldChecks = [
|
||||
validateStringField(data, "name", false),
|
||||
validateStringField(data, "description", false),
|
||||
validateTrigger(data),
|
||||
validateStringField(data, "license", true),
|
||||
validateAllowedTools(data),
|
||||
validateMetadata(data),
|
||||
|
||||
Reference in New Issue
Block a user