Skip to content

Commit c16ed32

Browse files
committed
Update reference check
Validate that Markdown references in skills point to files, not directories.
1 parent ae3a148 commit c16ed32

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

plugin/skills/azure-diagnostics/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Activate this skill when user wants to:
4646

4747
| Service | Common Issues | Reference |
4848
|---------|---------------|-----------|
49-
| **Container Apps** | Image pull failures, cold starts, health probes, port mismatches | [container-apps/](references/container-apps/) |
49+
| **Container Apps** | Image pull failures, cold starts, health probes, port mismatches | [container-apps/](references/container-apps/README.md) |
5050

5151
---
5252

scripts/src/references/cli.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* Markdown Reference Validator
44
*
55
* Checks every skill's markdown files to ensure:
6-
* 1. Every local markdown link points to an actual file or directory.
6+
* 1. Every local markdown link points to an actual file.
77
* 2. Every local markdown link resolves to a path inside the skill's
88
* own directory.
9+
* 3. No local markdown link points to a directory instead of a file.
910
*
1011
* Usage:
1112
* npm run references # Validate all skills
@@ -144,7 +145,22 @@ function validateFile(mdFile: string, skillDir: string): LinkIssue[] {
144145
continue; // no point checking containment if it doesn't exist
145146
}
146147

147-
// ── Check 2: Is the target inside the skill's directory? ────────────
148+
// ── Check 2: Is the target a directory? ────────────────────────────
149+
try {
150+
if (statSync(resolved).isDirectory()) {
151+
issues.push({
152+
file: mdFile,
153+
line: i + 1,
154+
link: rawTarget,
155+
reason: `Reference points to a directory, not a file: ${target}`,
156+
});
157+
continue;
158+
}
159+
} catch {
160+
// skip if stat fails
161+
}
162+
163+
// ── Check 3: Is the target inside the skill's directory? ────────────
148164
const normalizedResolved = normalize(resolved).toLowerCase();
149165
const normalizedSkillDir = normalize(skillDir).toLowerCase();
150166

0 commit comments

Comments
 (0)