@ladamczyk/skillslint 4.2.5 → 4.3.0
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/AGENTS.md +7 -4
- package/README.md +16 -6
- package/lib/{index.mjs → index.js} +8 -13
- package/package.json +37 -27
- package/lib/index.cjs +0 -156
package/AGENTS.md
CHANGED
|
@@ -20,7 +20,7 @@ skillslint [options]
|
|
|
20
20
|
| `-f, --fix` | — | Attempt auto-fix via textlint |
|
|
21
21
|
| `-i, --ignored [names]` | — | Skill directory names to skip |
|
|
22
22
|
|
|
23
|
-
Exits with code `1` if any skill fails to meet its threshold or if textlint
|
|
23
|
+
Exits with code `1` if any skill fails to meet its threshold or if textlint reports an error that is still there after the run (with `--fix`, after fixing).
|
|
24
24
|
|
|
25
25
|
## Programmatic API
|
|
26
26
|
|
|
@@ -65,7 +65,7 @@ So the only thing a send carries is that a run happened. Never sent: skills, fil
|
|
|
65
65
|
| `{ "stats": false }` | denied | nothing sent, never asked again |
|
|
66
66
|
| no key / no file | never asked | nothing sent, asked again on the next TTY run |
|
|
67
67
|
|
|
68
|
-
Edit or delete the file to change the answer; deleting it returns to "never asked". Non-interactive runs — `CI=true`, a pipe, a subprocess — are never prompted
|
|
68
|
+
Edit or delete the file to change the answer; deleting it returns to "never asked". Non-interactive runs — `CI=true`, a pipe, a subprocess — are never prompted and write nothing, so they leave the question open rather than answering it for the user. While no answer is stored they are never counted; once `{ "stats": true }` is stored, they are counted too.
|
|
69
69
|
|
|
70
70
|
- **API** — never prompts, never reads that file, and has no default. `stats: boolean` is a **required** option on `lint()`: the caller holds its own user's consent, so it must pass `true` or `false` outright. `false` sends nothing.
|
|
71
71
|
|
|
@@ -76,9 +76,12 @@ Each subdirectory under `--path` is treated as one skill:
|
|
|
76
76
|
```
|
|
77
77
|
skills/
|
|
78
78
|
my-skill/
|
|
79
|
-
SKILL.md # the skill document
|
|
79
|
+
SKILL.md # the skill document
|
|
80
|
+
*.md # every .md file under --path is checked by textlint
|
|
80
81
|
```
|
|
81
82
|
|
|
83
|
+
The whole skill folder is passed to the scorer.
|
|
84
|
+
|
|
82
85
|
## Scoring categories
|
|
83
86
|
|
|
84
87
|
| Category | What it measures |
|
|
@@ -92,4 +95,4 @@ skills/
|
|
|
92
95
|
## Textlint rules (bundled `.textlintrc.json`)
|
|
93
96
|
|
|
94
97
|
- `common-misspellings` — catches common spelling errors
|
|
95
|
-
- `write-good` —
|
|
98
|
+
- `write-good` — prose readability checks, with `weasel`, `passive`, `adverb` and `tooWordy` disabled
|
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
<h1>
|
|
2
2
|
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/
|
|
4
|
-
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/
|
|
5
|
-
<img alt="" src="https://raw.githubusercontent.com/ladamczyk-it/skillslint/
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/main/logo-dark.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/main/logo.svg">
|
|
5
|
+
<img alt="" src="https://raw.githubusercontent.com/ladamczyk-it/skillslint/main/logo.svg" height="36" align="top">
|
|
6
6
|
</picture>
|
|
7
7
|
Skillslint
|
|
8
8
|
</h1>
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Lint and score [Agent Skills](https://github.com/anthropics/skills) (`SKILL.md`), such as Claude Code skills, before your agents run them: textlint prose checks plus structure, clarity and specificity scores, with thresholds that fail CI. A CLI and a JavaScript API, and an optional check inside [qoq](https://qoq.adamczyk.ovh/).
|
|
11
|
+
|
|
12
|
+
Docs: [skillslint.adamczyk.ovh](https://skillslint.adamczyk.ovh/)
|
|
11
13
|
|
|
12
14
|
## Rationale
|
|
13
15
|
|
|
@@ -29,9 +31,17 @@ to list available options
|
|
|
29
31
|
npx @ladamczyk/skillslint -h
|
|
30
32
|
```
|
|
31
33
|
|
|
34
|
+
## AI agents and CI
|
|
35
|
+
|
|
36
|
+
Skills are prompts agents run unattended, so check them in CI and after an agent writes or edits one. Exit code `1` means a textlint error left after the run or a skill below its floor. `--threshold` (default `70`) is the overall floor; `--overall`, `--structure`, `--clarity`, `--specificity` and `--advanced` replace it with per-category floors. The CLI prints text only; for structured results call `lint()`, which returns `{ passed, fixed, skills, textlint }`. An `AGENTS.md` snippet is in [AI agents and CI](https://skillslint.adamczyk.ovh/docs/ai-agents-and-ci).
|
|
37
|
+
|
|
38
|
+
## qoq
|
|
39
|
+
|
|
40
|
+
[qoq](https://qoq.adamczyk.ovh/) runs Skillslint in-process when `qoq.config.js` has a `skillslint: { path }` block; it is off without one. A failing skill fails `qoq --check`, `qoq --fix` forwards `--fix`, `--skip-skillslint` skips it, and `--json` writes `skillslint-report.json`. qoq currently forwards only `path`, so the default overall floor of `70` applies there. More in [qoq integration](https://skillslint.adamczyk.ovh/docs/qoq).
|
|
41
|
+
|
|
32
42
|
## Anonymous usage stats
|
|
33
43
|
|
|
34
|
-
Opt-in, off until a human says yes. The first interactive run asks; the answer is stored as `stats: true|false` in `~/.config/skillslint.json` (or `$XDG_CONFIG_HOME/skillslint.json`) and never asked again — edit or delete the key to change it. Runs that can't ask (`CI=true`, a pipe) are never prompted
|
|
44
|
+
Opt-in, off until a human says yes. The first interactive run asks; the answer is stored as `stats: true|false` in `~/.config/skillslint.json` (or `$XDG_CONFIG_HOME/skillslint.json`) and never asked again — edit or delete the key to change it. Runs that can't ask (`CI=true`, a pipe) are never prompted. While no answer is stored they are never counted; once `stats: true` is stored in that file, CI and piped runs on the same machine are counted too. The JavaScript API never prompts: `stats` is a required boolean on `lint()`, so the calling host states its own user's consent.
|
|
35
45
|
|
|
36
46
|
A counted run posts one constant to `https://stats.adamczyk.ovh` and nothing else — every run, every flag combination, byte for byte the same body:
|
|
37
47
|
|
|
@@ -45,6 +55,6 @@ Never sent: your skills, file names, paths, scores, findings, thresholds, the fl
|
|
|
45
55
|
|
|
46
56
|
## Last 12 months usage statistics (>=4.2.0)
|
|
47
57
|
|
|
48
|
-
Regenerated on each release, for daily updated numbers click on chart or visit [
|
|
58
|
+
Regenerated on each release, for daily updated numbers click on chart or visit [skillslint.adamczyk.ovh/docs/usage-statistics](https://skillslint.adamczyk.ovh/docs/usage-statistics).
|
|
49
59
|
|
|
50
60
|
[](https://adamczyk.ovh/img/stats/skillslint.png)
|
|
@@ -3,11 +3,11 @@ import c from "picocolors";
|
|
|
3
3
|
import { createLinter, loadFixerFormatter, loadLinterFormatter, loadTextlintrc } from "textlint";
|
|
4
4
|
import { writeFile } from "fs/promises";
|
|
5
5
|
import { join, resolve } from "path";
|
|
6
|
-
import { getPackageInfo, getRelativePath, resolveCwdRelativePath, sendStats } from "@ladamczyk/qoq-utils";
|
|
6
|
+
import { getPackageInfo, getRelativePath, resolveCwdRelativePath, sendStats as sendStats$1 } from "@ladamczyk/qoq-utils";
|
|
7
7
|
import { readdirSync } from "fs";
|
|
8
8
|
import { homedir } from "os";
|
|
9
9
|
import "readline/promises";
|
|
10
|
-
|
|
10
|
+
// src/helpers/paths.ts
|
|
11
11
|
const PACKAGE_NAME = "@ladamczyk/skillslint";
|
|
12
12
|
const getCliPackagePath = () => {
|
|
13
13
|
try {
|
|
@@ -19,8 +19,7 @@ const getCliPackagePath = () => {
|
|
|
19
19
|
};
|
|
20
20
|
const resolveCliPackagePath = (path) => resolve(`${getCliPackagePath()}${path}`);
|
|
21
21
|
const resolveCliRelativePath = (path) => getRelativePath(resolveCliPackagePath(path));
|
|
22
|
-
|
|
23
|
-
//#region src/helpers/textlint.ts
|
|
22
|
+
// src/helpers/textlint.ts
|
|
24
23
|
const ERROR_SEVERITY = 2;
|
|
25
24
|
const NO_TARGET_FILES_ERROR = "TextlintFileSearchError";
|
|
26
25
|
const runTextlint = async (target, fix) => {
|
|
@@ -37,8 +36,7 @@ const runTextlint = async (target, fix) => {
|
|
|
37
36
|
}
|
|
38
37
|
};
|
|
39
38
|
const hasTextlintErrors = (results) => results.some((result) => ("remainingMessages" in result ? result.remainingMessages : result.messages).some((message) => message.severity === ERROR_SEVERITY));
|
|
40
|
-
|
|
41
|
-
//#region src/format.ts
|
|
39
|
+
// src/format.ts
|
|
42
40
|
const BAR_WIDTH = 25;
|
|
43
41
|
const DIMENSIONS = [
|
|
44
42
|
"overall",
|
|
@@ -73,9 +71,8 @@ const format = async (result) => {
|
|
|
73
71
|
return output;
|
|
74
72
|
};
|
|
75
73
|
join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "skillslint.json");
|
|
76
|
-
const sendStats
|
|
77
|
-
|
|
78
|
-
//#region src/helpers/threshold.ts
|
|
74
|
+
const sendStats = async () => sendStats$1("skillslint");
|
|
75
|
+
// src/helpers/threshold.ts
|
|
79
76
|
const DEFAULT_THRESHOLD = 70;
|
|
80
77
|
const buildThreshold = (options) => {
|
|
81
78
|
const { threshold: optionsThreshold, overall, structure, clarity, specificity, advanced } = options;
|
|
@@ -89,12 +86,11 @@ const buildThreshold = (options) => {
|
|
|
89
86
|
return threshold;
|
|
90
87
|
};
|
|
91
88
|
const failsThreshold = (scores, threshold) => scores.overall < (threshold.overall ?? 0) || scores.structure < (threshold.structure ?? 0) || scores.clarity < (threshold.clarity ?? 0) || scores.specificity < (threshold.specificity ?? 0) || scores.advanced < (threshold.advanced ?? 0);
|
|
92
|
-
|
|
93
|
-
//#region src/lint.ts
|
|
89
|
+
// src/lint.ts
|
|
94
90
|
const DEFAULT_PATH = "./skills";
|
|
95
91
|
const lint = async (options) => {
|
|
96
92
|
const { fix = false, path: optionsPath, ignored, stats } = options;
|
|
97
|
-
if (stats) sendStats
|
|
93
|
+
if (stats) sendStats();
|
|
98
94
|
const path = `/${optionsPath ?? "./skills"}`;
|
|
99
95
|
const threshold = buildThreshold(options);
|
|
100
96
|
const skillsPath = resolveCwdRelativePath(path);
|
|
@@ -122,5 +118,4 @@ const lint = async (options) => {
|
|
|
122
118
|
passed: !hasTextlintErrors(textlint) && skills.every((skill) => skill.passed)
|
|
123
119
|
};
|
|
124
120
|
};
|
|
125
|
-
//#endregion
|
|
126
121
|
export { DEFAULT_PATH, DEFAULT_THRESHOLD, buildThreshold, failsThreshold, format, hasTextlintErrors, lint, runTextlint };
|
package/package.json
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ladamczyk/skillslint",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.3.0",
|
|
4
|
+
"description": "Lint and score Agent Skills (SKILL.md) before your agents run them: prose checks plus structure, clarity and specificity scores, with thresholds that fail CI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
7
7
|
"skillslint",
|
|
8
8
|
"agents",
|
|
9
|
-
"skills"
|
|
9
|
+
"agent-skills",
|
|
10
|
+
"skill.md",
|
|
11
|
+
"claude-code",
|
|
12
|
+
"claude-skills",
|
|
13
|
+
"linter",
|
|
14
|
+
"textlint",
|
|
15
|
+
"prompt-quality",
|
|
16
|
+
"ai-agents",
|
|
17
|
+
"ci",
|
|
18
|
+
"quality-gate",
|
|
19
|
+
"qoq"
|
|
10
20
|
],
|
|
11
|
-
"homepage": "https://
|
|
21
|
+
"homepage": "https://skillslint.adamczyk.ovh",
|
|
12
22
|
"bugs": {
|
|
13
23
|
"url": "https://github.com/ladamczyk-it/skillslint/issues"
|
|
14
24
|
},
|
|
@@ -18,14 +28,12 @@
|
|
|
18
28
|
},
|
|
19
29
|
"license": "MIT",
|
|
20
30
|
"type": "module",
|
|
21
|
-
"main": "./lib/index.
|
|
22
|
-
"module": "./lib/index.mjs",
|
|
31
|
+
"main": "./lib/index.js",
|
|
23
32
|
"types": "./lib/src/index.d.ts",
|
|
24
33
|
"exports": {
|
|
25
34
|
".": {
|
|
26
35
|
"types": "./lib/src/index.d.ts",
|
|
27
|
-
"import": "./lib/index.
|
|
28
|
-
"require": "./lib/index.cjs"
|
|
36
|
+
"import": "./lib/index.js"
|
|
29
37
|
},
|
|
30
38
|
"./package.json": "./package.json"
|
|
31
39
|
},
|
|
@@ -52,37 +60,39 @@
|
|
|
52
60
|
"test:coverage": "npm run test -- --coverage"
|
|
53
61
|
},
|
|
54
62
|
"dependencies": {
|
|
55
|
-
"@ladamczyk/qoq-utils": "
|
|
56
|
-
"@textlint/textlint-plugin-markdown": "
|
|
57
|
-
"@textlint/textlint-plugin-text": "
|
|
63
|
+
"@ladamczyk/qoq-utils": "7.5.0",
|
|
64
|
+
"@textlint/textlint-plugin-markdown": "16.1.4",
|
|
65
|
+
"@textlint/textlint-plugin-text": "16.1.4",
|
|
58
66
|
"agent-skills-cli": "1.2.0",
|
|
59
|
-
"cac": "7.
|
|
67
|
+
"cac": "7.1.1",
|
|
60
68
|
"picocolors": "1.1.1",
|
|
61
|
-
"textlint": "
|
|
69
|
+
"textlint": "16.1.4",
|
|
62
70
|
"textlint-rule-common-misspellings": "1.0.1",
|
|
63
71
|
"textlint-rule-terminology": "5.2.16",
|
|
64
72
|
"textlint-rule-write-good": "2.0.0"
|
|
65
73
|
},
|
|
66
74
|
"devDependencies": {
|
|
67
|
-
"@commitlint/cli": "21.
|
|
68
|
-
"@commitlint/config-conventional": "21.
|
|
69
|
-
"@ladamczyk/qoq-cli": "
|
|
70
|
-
"@ladamczyk/qoq-eslint-v9-ts": "
|
|
71
|
-
"@ladamczyk/qoq-
|
|
72
|
-
"@ladamczyk/qoq-
|
|
73
|
-
"@ladamczyk/qoq-
|
|
75
|
+
"@commitlint/cli": "21.3.0",
|
|
76
|
+
"@commitlint/config-conventional": "21.3.0",
|
|
77
|
+
"@ladamczyk/qoq-cli": "7.5.0",
|
|
78
|
+
"@ladamczyk/qoq-eslint-v9-ts": "7.5.0",
|
|
79
|
+
"@ladamczyk/qoq-eslint-v9-ts-react": "7.5.0",
|
|
80
|
+
"@ladamczyk/qoq-jscpd": "7.5.0",
|
|
81
|
+
"@ladamczyk/qoq-knip": "7.5.0",
|
|
82
|
+
"@ladamczyk/qoq-prettier-with-json-sort": "7.5.0",
|
|
74
83
|
"@types/node": "^22",
|
|
75
|
-
"@vitest/coverage-v8": "5.
|
|
76
|
-
"dotenv": "18.0.
|
|
84
|
+
"@vitest/coverage-v8": "5.1.2",
|
|
85
|
+
"dotenv": "18.0.10",
|
|
77
86
|
"husky": "9.1.7",
|
|
78
|
-
"npm-run-all2": "9.0
|
|
79
|
-
"rimraf": "6.1.
|
|
80
|
-
"rolldown": "1.
|
|
87
|
+
"npm-run-all2": "9.1.0",
|
|
88
|
+
"rimraf": "6.1.4",
|
|
89
|
+
"rolldown": "1.4.0",
|
|
81
90
|
"typescript": "6.0.3",
|
|
82
|
-
"vitest": "5.
|
|
91
|
+
"vitest": "5.1.2"
|
|
83
92
|
},
|
|
84
93
|
"engines": {
|
|
85
|
-
"node": "
|
|
94
|
+
"node": "^22.22.2 || ^24.15.0 || >=26.0.0",
|
|
95
|
+
"npm": ">= 10"
|
|
86
96
|
},
|
|
87
97
|
"publishConfig": {
|
|
88
98
|
"access": "public"
|
package/lib/index.cjs
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
|
-
let agent_skills_cli = require("agent-skills-cli");
|
|
25
|
-
let picocolors = require("picocolors");
|
|
26
|
-
picocolors = __toESM(picocolors, 1);
|
|
27
|
-
let textlint = require("textlint");
|
|
28
|
-
let fs_promises = require("fs/promises");
|
|
29
|
-
let path = require("path");
|
|
30
|
-
let _ladamczyk_qoq_utils = require("@ladamczyk/qoq-utils");
|
|
31
|
-
let fs = require("fs");
|
|
32
|
-
let os = require("os");
|
|
33
|
-
//#region src/helpers/paths.ts
|
|
34
|
-
const PACKAGE_NAME = "@ladamczyk/skillslint";
|
|
35
|
-
const getCliPackagePath = () => {
|
|
36
|
-
try {
|
|
37
|
-
const { rootPath } = (0, _ladamczyk_qoq_utils.getPackageInfo)(PACKAGE_NAME) ?? {};
|
|
38
|
-
return rootPath;
|
|
39
|
-
} catch {
|
|
40
|
-
return process.cwd();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const resolveCliPackagePath = (path$1) => (0, path.resolve)(`${getCliPackagePath()}${path$1}`);
|
|
44
|
-
const resolveCliRelativePath = (path$2) => (0, _ladamczyk_qoq_utils.getRelativePath)(resolveCliPackagePath(path$2));
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/helpers/textlint.ts
|
|
47
|
-
const ERROR_SEVERITY = 2;
|
|
48
|
-
const NO_TARGET_FILES_ERROR = "TextlintFileSearchError";
|
|
49
|
-
const runTextlint = async (target, fix) => {
|
|
50
|
-
const descriptor = await (0, textlint.loadTextlintrc)({ configFilePath: resolveCliRelativePath("/.textlintrc.json") });
|
|
51
|
-
const linter = (0, textlint.createLinter)({ descriptor });
|
|
52
|
-
try {
|
|
53
|
-
if (!fix) return await linter.lintFiles([target]);
|
|
54
|
-
const results = await linter.fixFiles([target]);
|
|
55
|
-
await Promise.all(results.map((result) => (0, fs_promises.writeFile)(result.filePath, result.output, "utf-8")));
|
|
56
|
-
return results;
|
|
57
|
-
} catch (error) {
|
|
58
|
-
if (error instanceof Error && error.name === NO_TARGET_FILES_ERROR) return [];
|
|
59
|
-
throw error;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const hasTextlintErrors = (results) => results.some((result) => ("remainingMessages" in result ? result.remainingMessages : result.messages).some((message) => message.severity === ERROR_SEVERITY));
|
|
63
|
-
//#endregion
|
|
64
|
-
//#region src/format.ts
|
|
65
|
-
const BAR_WIDTH = 25;
|
|
66
|
-
const DIMENSIONS = [
|
|
67
|
-
"overall",
|
|
68
|
-
"structure",
|
|
69
|
-
"clarity",
|
|
70
|
-
"specificity",
|
|
71
|
-
"advanced"
|
|
72
|
-
];
|
|
73
|
-
const formatTextlint = async (textlint$1, fixed) => {
|
|
74
|
-
if (fixed) return (await (0, textlint.loadFixerFormatter)({ formatterName: "stylish" })).format(textlint$1);
|
|
75
|
-
return (await (0, textlint.loadLinterFormatter)({ formatterName: "stylish" })).format(textlint$1);
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* Renders an {@link ILintResult} into a console-ready, colorized string
|
|
79
|
-
* (textlint findings, per-skill score bars and the summary verdict).
|
|
80
|
-
*/
|
|
81
|
-
const format = async (result) => {
|
|
82
|
-
let output = "";
|
|
83
|
-
const textlint$2 = await formatTextlint(result.textlint, result.fixed);
|
|
84
|
-
if (textlint$2.trim()) output += `${textlint$2}\n`;
|
|
85
|
-
if (result.fixed && hasTextlintErrors(result.textlint)) output += picocolors.default.red("Can't perform automatic fix!\n\n");
|
|
86
|
-
result.skills.forEach(({ name, scores }) => {
|
|
87
|
-
output += picocolors.default.gray(`\n/${name}\n`);
|
|
88
|
-
DIMENSIONS.forEach((dimension) => {
|
|
89
|
-
const label = `${dimension[0]?.toUpperCase()}${dimension.slice(1)}:`.padEnd(13);
|
|
90
|
-
const color = picocolors.default[(0, agent_skills_cli.getScoreColor)(scores[dimension])];
|
|
91
|
-
output += color(`${label}${(0, agent_skills_cli.formatScoreBar)(scores[dimension], BAR_WIDTH)}\n`);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
if (result.skills.some((skill) => !skill.passed)) output += picocolors.default.red(`At least one skill doesn't meet required threshold!\n`);
|
|
95
|
-
if (result.passed) output += picocolors.default.green("\nAll good!\n");
|
|
96
|
-
return output;
|
|
97
|
-
};
|
|
98
|
-
(0, path.join)(process.env.XDG_CONFIG_HOME ?? (0, path.join)((0, os.homedir)(), ".config"), "skillslint.json");
|
|
99
|
-
const sendStats = async () => (0, _ladamczyk_qoq_utils.sendStats)("skillslint");
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/helpers/threshold.ts
|
|
102
|
-
const DEFAULT_THRESHOLD = 70;
|
|
103
|
-
const buildThreshold = (options) => {
|
|
104
|
-
const { threshold: optionsThreshold, overall, structure, clarity, specificity, advanced } = options;
|
|
105
|
-
const threshold = {};
|
|
106
|
-
if (overall) threshold.overall = overall;
|
|
107
|
-
if (structure) threshold.structure = structure;
|
|
108
|
-
if (clarity) threshold.clarity = clarity;
|
|
109
|
-
if (specificity) threshold.specificity = specificity;
|
|
110
|
-
if (advanced) threshold.advanced = advanced;
|
|
111
|
-
if (Object.keys(threshold).length === 0) threshold.overall = optionsThreshold ?? 70;
|
|
112
|
-
return threshold;
|
|
113
|
-
};
|
|
114
|
-
const failsThreshold = (scores, threshold) => scores.overall < (threshold.overall ?? 0) || scores.structure < (threshold.structure ?? 0) || scores.clarity < (threshold.clarity ?? 0) || scores.specificity < (threshold.specificity ?? 0) || scores.advanced < (threshold.advanced ?? 0);
|
|
115
|
-
//#endregion
|
|
116
|
-
//#region src/lint.ts
|
|
117
|
-
const DEFAULT_PATH = "./skills";
|
|
118
|
-
const lint = async (options) => {
|
|
119
|
-
const { fix = false, path: optionsPath, ignored, stats } = options;
|
|
120
|
-
if (stats) sendStats();
|
|
121
|
-
const path = `/${optionsPath ?? "./skills"}`;
|
|
122
|
-
const threshold = buildThreshold(options);
|
|
123
|
-
const skillsPath = (0, _ladamczyk_qoq_utils.resolveCwdRelativePath)(path);
|
|
124
|
-
const textlint = await runTextlint((0, _ladamczyk_qoq_utils.resolveCwdRelativePath)(`${path}/**/*.md`), fix);
|
|
125
|
-
const skillNames = (0, fs.readdirSync)(skillsPath, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !(ignored ?? []).includes(entry.name)).map(({ name }) => name);
|
|
126
|
-
const skills = await Promise.all(skillNames.map(async (name) => {
|
|
127
|
-
const { overall, structure, clarity, specificity, advanced } = await (0, agent_skills_cli.assessQuality)(`${skillsPath}/${name}`);
|
|
128
|
-
const scores = {
|
|
129
|
-
overall,
|
|
130
|
-
structure,
|
|
131
|
-
clarity,
|
|
132
|
-
specificity,
|
|
133
|
-
advanced
|
|
134
|
-
};
|
|
135
|
-
return {
|
|
136
|
-
name,
|
|
137
|
-
scores,
|
|
138
|
-
passed: !failsThreshold(scores, threshold)
|
|
139
|
-
};
|
|
140
|
-
}));
|
|
141
|
-
return {
|
|
142
|
-
textlint,
|
|
143
|
-
fixed: fix,
|
|
144
|
-
skills,
|
|
145
|
-
passed: !hasTextlintErrors(textlint) && skills.every((skill) => skill.passed)
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
//#endregion
|
|
149
|
-
exports.DEFAULT_PATH = DEFAULT_PATH;
|
|
150
|
-
exports.DEFAULT_THRESHOLD = DEFAULT_THRESHOLD;
|
|
151
|
-
exports.buildThreshold = buildThreshold;
|
|
152
|
-
exports.failsThreshold = failsThreshold;
|
|
153
|
-
exports.format = format;
|
|
154
|
-
exports.hasTextlintErrors = hasTextlintErrors;
|
|
155
|
-
exports.lint = lint;
|
|
156
|
-
exports.runTextlint = runTextlint;
|