Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions plugins/tracing/src/skills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const SKILL_ACCESS_TOOLS = new Set([
]);
const SKILL_ACCESS_FIELDS = ["cmd", "command", "code", "uri"];

const SKILL_DOC = /([A-Za-z0-9._@+-]+)\/SKILL\.md\b/g;
const SKILL_SCRIPT = /\bskills\/(?:\.[A-Za-z0-9._-]+\/)?([A-Za-z0-9._@+-]+)\/scripts\//g;
const SKILL_DOC = /([A-Za-z0-9._@+-]+)[\\/]+SKILL\.md\b/g;
const SKILL_SCRIPT =
/\bskills[\\/]+(?:\.[A-Za-z0-9._-]+[\\/]+)?([A-Za-z0-9._@+-]+)[\\/]+scripts[\\/]+/g;
const SKILL_PROMPT_FRAGMENT = /<skill>\s*<name>([^<\n]+)<\/name>/g;

const MAX_SKILL_NAME_LENGTH = 64;
Expand Down
32 changes: 32 additions & 0 deletions plugins/tracing/test/skills.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ describe("skillsForToolCall", () => {
).toEqual(["figma-use"]);
});

it.each([
[
"native Windows command",
exec(String.raw`Get-Content C:\Users\dev\.codex\skills\pdf\SKILL.md`),
],
[
"escaped Windows path inside exec source",
toolCall(
"exec",
String.raw`const r = await tools.exec_command({cmd:"Get-Content C:\\Users\\dev\\.codex\\skills\\pdf\\SKILL.md"});`,
),
],
[
"Windows argument array",
toolCall("local_shell", {
command: ["Get-Content", String.raw`C:\Users\dev\.codex\skills\pdf\SKILL.md`],
}),
],
["mixed separators", exec(String.raw`Get-Content C:\Users\dev/.codex/skills/pdf\SKILL.md`)],
])("detects a SKILL.md read with %s", (_label, call) => {
expect(skillsForToolCall(call)).toEqual(["pdf"]);
});

it.each([
String.raw`node C:\Users\dev\.codex\skills\pdf\scripts\read.mjs`,
String.raw`node C:\\Users\\dev\\.codex\\skills\\pdf\\scripts\\read.mjs`,
String.raw`node C:\Users\dev\.codex\skills\.system\pdf\scripts\read.mjs`,
String.raw`node C:\Users\dev/.codex/skills/pdf\scripts/read.mjs`,
])("detects a Windows skill script: %s", (cmd) => {
expect(skillsForToolCall(exec(cmd))).toEqual(["pdf"]);
});

it("ignores searches, unrelated source paths, and non-command tools", () => {
expect(skillsForToolCall(exec("find .agents -type f -name 'SKILL.md'"))).toEqual([]);
expect(
Expand Down