@yogiadhik/skillcheck 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/dist/lint/rules.js +15 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
package/dist/lint/rules.js
CHANGED
|
@@ -30,9 +30,23 @@ export const tokenBudget = (s) => {
|
|
|
30
30
|
return [finding(s, 'token-budget', 'warning', `skill is roughly ${tokens} tokens; every invocation pays this cost`)];
|
|
31
31
|
return [];
|
|
32
32
|
};
|
|
33
|
+
// links inside fenced blocks or inline code are examples, not references
|
|
34
|
+
function proseOnly(body) {
|
|
35
|
+
const kept = [];
|
|
36
|
+
let inFence = false;
|
|
37
|
+
for (const line of body.split('\n')) {
|
|
38
|
+
if (/^\s*(```|~~~)/.test(line)) {
|
|
39
|
+
inFence = !inFence;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (!inFence)
|
|
43
|
+
kept.push(line);
|
|
44
|
+
}
|
|
45
|
+
return kept.join('\n').replace(/`[^`\n]*`/g, '');
|
|
46
|
+
}
|
|
33
47
|
export const relativeLinks = (s) => {
|
|
34
48
|
const out = [];
|
|
35
|
-
for (const m of s.body.matchAll(/\[[^\]]*\]\(([^)]+)\)/g)) {
|
|
49
|
+
for (const m of proseOnly(s.body).matchAll(/\[[^\]]*\]\(([^)]+)\)/g)) {
|
|
36
50
|
const target = m[1];
|
|
37
51
|
if (/^(https?:|mailto:|#)/.test(target))
|
|
38
52
|
continue;
|