Skip to content

Commit 84898fb

Browse files
fix(ci): skill docs may name the project files a workflow writes (#4902)
* fix(ci): skill docs may name the project files a workflow writes * style(ci): wrap the project-file citation test to the format width
1 parent bad0bc7 commit 84898fb

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎scripts/check-comment-citations.mjs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ const ALLOW = new Set([
123123
...REACT_DOM_EXPORTS,
124124
]);
125125

126-
// A URL, an absolute path, a `<sha>:<path>`, or build output: none of these resolve in the tree.
126+
// Files a skill workflow writes into the user's project at run time; skill docs name them bare.
127+
const PROJECT_FILES = new Set(["frame.md", "STORYBOARD.md", "SCRIPT.md", "_role.md"]);
128+
129+
// A URL, an absolute path, a `<sha>:<path>`, build output or a project file: none resolve in the tree.
127130
function namesSomethingElse(cited) {
131+
if (PROJECT_FILES.has(cited)) return true;
128132
if (cited.startsWith("/") || cited.startsWith("~")) return true;
129133
if (cited.includes(":")) return true;
130134
return cited.split("/")[0] === "dist";

‎scripts/check-comment-citations.test.mjs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,23 @@ test("a cited file that does not exist fails", (t) => {
6767
assert.equal(failures[0].where, "src/subject.ts:1");
6868
});
6969

70+
test("a bare project file a skill workflow writes is not this repo's to resolve", (t) => {
71+
const { failures } = checkSubject(t, {
72+
"skills/demo/references/visual-design.md": ["Enrich `STORYBOARD.md` from `frame.md`.", ""].join(
73+
"\n",
74+
),
75+
});
76+
assert.deepEqual(failures, []);
77+
});
78+
79+
test("a repo path ending in a project file name is still resolved", (t) => {
80+
const { failures } = checkSubject(t, {
81+
"skills/demo/references/visual-design.md": ["See `skills/demo/frame.md`.", ""].join("\n"),
82+
});
83+
assert.equal(failures.length, 1);
84+
assert.match(failures[0].why, /no such file/);
85+
});
86+
7087
test("a line number past the end of a real file fails", (t) => {
7188
const { failures } = checkSubject(t, {
7289
"src/subject.ts": oneLiner("// Defined at `src/brand.ts:99`."),

0 commit comments

Comments
 (0)