🎥 Make videos programmatically with React
Fix Kimi plugin skill expectations
Jonny Burger3111b92904fa
diff --git a/packages/kimi-code-plugin/test/plugin.test.ts b/packages/kimi-code-plugin/test/plugin.test.tsindex f9bb379166..d9c76302d3 100644--- a/packages/kimi-code-plugin/test/plugin.test.ts+++ b/packages/kimi-code-plugin/test/plugin.test.ts@@ -7,6 +7,7 @@ import {statSync,} from 'node:fs';import path from 'node:path';+import {removeCrossSkillLinksFromMarkdown} from '../../skills/scripts/prepare-embedded-skills';const packageRoot = path.resolve(import.meta.dir, '..');const canonicalSkillsRoot = path.resolve(packageRoot, '..', 'skills', 'skills');@@ -175,6 +176,11 @@ test('generated skills match the canonical skills', () => {);}}+ expectedContents = removeCrossSkillLinksFromMarkdown({+ contents: expectedContents,+ file: generatedFile,+ skillRoot: path.join(generatedSkillsRoot, pathParts[0] as string),+ });expect(readFileSync(generatedFile, 'utf-8')).toBe(expectedContents);} else {expect(readFileSync(generatedFile)).toEqual(readFileSync(canonicalFile));diff --git a/packages/skills/scripts/prepare-embedded-skills.ts b/packages/skills/scripts/prepare-embedded-skills.tsindex 099fdebe9b..73dc76defd 100644--- a/packages/skills/scripts/prepare-embedded-skills.ts+++ b/packages/skills/scripts/prepare-embedded-skills.ts@@ -10,6 +10,43 @@ import path from 'node:path';const embeddedSkillFilename = 'REFERENCE.md';+export const removeCrossSkillLinksFromMarkdown = ({+ contents,+ file,+ skillRoot,+}: {+ contents: string;+ file: string;+ skillRoot: string;+}) => {+ return contents.replace(+ /(!?)\[([^\]]+)]\(([^)]+)\)/g,+ (match, imagePrefix: string, label: string, target: string) => {+ if (+ imagePrefix === '!' ||+ (!target.startsWith('./') && !target.startsWith('../'))+ ) {+ return match;+ }++ const targetWithoutFragment = target.split('#')[0];+ const relativeTarget = path.relative(+ skillRoot,+ path.resolve(path.dirname(file), targetWithoutFragment),+ );+ if (+ relativeTarget === '..' ||+ relativeTarget.startsWith(`..${path.sep}`) ||+ path.isAbsolute(relativeTarget)+ ) {+ return label;+ }++ return match;+ },+ );+};+// Agent Skills file references must stay inside the skill directory. Keep the// handoff text while removing links to sibling skills from distributable builds.const removeCrossSkillLinks = (skillsRoot: string) => {@@ -30,32 +67,11 @@ const removeCrossSkillLinks = (skillsRoot: string) => {}const contents = readFileSync(file, 'utf-8');- const rewritten = contents.replace(- /(!?)\[([^\]]+)]\(([^)]+)\)/g,- (match, imagePrefix: string, label: string, target: string) => {- if (- imagePrefix === '!' ||- (!target.startsWith('./') && !target.startsWith('../'))- ) {- return match;- }-- const targetWithoutFragment = target.split('#')[0];- const relativeTarget = path.relative(- skillRoot,- path.resolve(path.dirname(file), targetWithoutFragment),- );- if (- relativeTarget === '..' ||- relativeTarget.startsWith(`..${path.sep}`) ||- path.isAbsolute(relativeTarget)- ) {- return label;- }-- return match;- },- );+ const rewritten = removeCrossSkillLinksFromMarkdown({+ contents,+ file,+ skillRoot,+ });if (contents !== rewritten) {writeFileSync(file, rewritten);}