fix(doctor): parse flow-style skill triggers (#3887) (#3888)

Wave-assembled from PR #3888 by @RerankerGuo. Conflict resolution: KEY_FILES.md
check-resolvable/skill-frontmatter/skill-trigger-index entries taken as the
PR's current-state prose; the PR's stale pre-fold 'doctor.ts extension' entry
dropped (master already folded it into the main doctor entry).

Co-Authored-By: RerankerGuo <121015044+RerankerGuo@users.noreply.github.com>
This commit is contained in:
test
2026-08-13 12:18:13 -07:00
committed by Sina Matian
co-authored by RerankerGuo
parent 1243a7d3bb
commit 136fc109c1
4 changed files with 58 additions and 22 deletions
+32 -1
View File
@@ -214,6 +214,38 @@ describe("extractTriggers", () => {
expect(triggers).toEqual(["what do we know", "tell me about"]);
});
test("parses triggers from a single-line YAML flow sequence", () => {
const fm = [
"---",
"name: transcript-insights",
'triggers: ["analyze this transcript", podcast takeaways]',
"---",
"",
].join("\n");
expect(extractTriggers(fm)).toEqual([
"analyze this transcript",
"podcast takeaways",
]);
});
test("parses triggers from a wrapped YAML flow sequence (#3887)", () => {
const fm = [
"---",
"name: transcript-insights",
"triggers: [analyze this transcript, podcast takeaways, video transcript insights, interview",
" takeaways, policy mechanisms from transcript]",
"---",
"",
].join("\n");
expect(extractTriggers(fm)).toEqual([
"analyze this transcript",
"podcast takeaways",
"video transcript insights",
"interview takeaways",
"policy mechanisms from transcript",
]);
});
test("returns [] when frontmatter is missing", () => {
expect(extractTriggers("# Just a body, no frontmatter\n")).toEqual([]);
});
@@ -450,4 +482,3 @@ function afterEachCleanup(fn: () => void) {
const { afterEach } = require("bun:test");
afterEach(fn);
}