@ladamczyk/skillslint 4.2.5 → 4.2.6

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/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  <h1>
2
2
  <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/master/logo-dark.svg">
4
- <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ladamczyk-it/skillslint/master/logo.svg">
5
- <img alt="" src="https://raw.githubusercontent.com/ladamczyk-it/skillslint/master/logo.svg" height="36" align="top">
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
  &nbsp;Skillslint
8
8
  </h1>
@@ -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
- //#region src/helpers/paths.ts
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
- //#endregion
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
- //#endregion
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$1 = async () => sendStats("skillslint");
77
- //#endregion
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
- //#endregion
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$1();
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ladamczyk/skillslint",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "Linter for agents skills",
5
5
  "keywords": [
6
6
  "cli",
@@ -18,14 +18,12 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "type": "module",
21
- "main": "./lib/index.cjs",
22
- "module": "./lib/index.mjs",
21
+ "main": "./lib/index.js",
23
22
  "types": "./lib/src/index.d.ts",
24
23
  "exports": {
25
24
  ".": {
26
25
  "types": "./lib/src/index.d.ts",
27
- "import": "./lib/index.mjs",
28
- "require": "./lib/index.cjs"
26
+ "import": "./lib/index.js"
29
27
  },
30
28
  "./package.json": "./package.json"
31
29
  },
@@ -52,37 +50,38 @@
52
50
  "test:coverage": "npm run test -- --coverage"
53
51
  },
54
52
  "dependencies": {
55
- "@ladamczyk/qoq-utils": "6.2.1",
56
- "@textlint/textlint-plugin-markdown": "15.8.0",
57
- "@textlint/textlint-plugin-text": "15.8.0",
53
+ "@ladamczyk/qoq-utils": "7.0.0",
54
+ "@textlint/textlint-plugin-markdown": "16.1.1",
55
+ "@textlint/textlint-plugin-text": "16.1.1",
58
56
  "agent-skills-cli": "1.2.0",
59
- "cac": "7.0.1",
57
+ "cac": "7.1.0",
60
58
  "picocolors": "1.1.1",
61
- "textlint": "15.8.0",
59
+ "textlint": "16.1.1",
62
60
  "textlint-rule-common-misspellings": "1.0.1",
63
61
  "textlint-rule-terminology": "5.2.16",
64
62
  "textlint-rule-write-good": "2.0.0"
65
63
  },
66
64
  "devDependencies": {
67
- "@commitlint/cli": "21.2.3",
68
- "@commitlint/config-conventional": "21.2.3",
69
- "@ladamczyk/qoq-cli": "6.2.1",
70
- "@ladamczyk/qoq-eslint-v9-ts": "6.2.1",
71
- "@ladamczyk/qoq-jscpd": "6.2.1",
72
- "@ladamczyk/qoq-knip": "6.2.1",
73
- "@ladamczyk/qoq-prettier-with-json-sort": "6.2.1",
65
+ "@commitlint/cli": "21.2.4",
66
+ "@commitlint/config-conventional": "21.2.4",
67
+ "@ladamczyk/qoq-cli": "7.0.0",
68
+ "@ladamczyk/qoq-eslint-v9-ts": "7.0.0",
69
+ "@ladamczyk/qoq-jscpd": "7.0.0",
70
+ "@ladamczyk/qoq-knip": "7.0.0",
71
+ "@ladamczyk/qoq-prettier-with-json-sort": "7.0.0",
74
72
  "@types/node": "^22",
75
- "@vitest/coverage-v8": "5.0.3",
76
- "dotenv": "18.0.7",
73
+ "@vitest/coverage-v8": "5.1.1",
74
+ "dotenv": "18.0.10",
77
75
  "husky": "9.1.7",
78
- "npm-run-all2": "9.0.3",
79
- "rimraf": "6.1.3",
80
- "rolldown": "1.2.13",
76
+ "npm-run-all2": "9.0.4",
77
+ "rimraf": "6.1.4",
78
+ "rolldown": "1.3.3",
81
79
  "typescript": "6.0.3",
82
- "vitest": "5.0.3"
80
+ "vitest": "5.1.1"
83
81
  },
84
82
  "engines": {
85
- "node": ">=22.22.2"
83
+ "node": "^22.22.2 || ^24.15.0 || >=26.0.0",
84
+ "npm": ">= 10"
86
85
  },
87
86
  "publishConfig": {
88
87
  "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;