@ladamczyk/skillslint 4.0.8 → 4.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @ladamczyk/skillslint — Agent Context
2
2
 
3
- CLI linter for Claude Code agent skill documentation. Runs two checks: markdown prose quality via textlint, and structured quality scoring via `agent-skills-cli`.
3
+ Linter for agent skill documentation. Runs two checks: markdown prose quality via textlint, and structured quality scoring via `agent-skills-cli`. Ships both a CLI (default) and a JavaScript API.
4
4
 
5
5
  ## Command
6
6
 
@@ -22,6 +22,23 @@ skillslint [options]
22
22
 
23
23
  Exits with code `1` if any skill fails to meet its threshold or if textlint finds unfixable issues.
24
24
 
25
+ ## Programmatic API
26
+
27
+ The package also exports a JavaScript API (ESM). The `lint` function runs the same two checks and returns structured results without printing or exiting:
28
+
29
+ ```js
30
+ import { lint } from '@ladamczyk/skillslint';
31
+
32
+ const result = await lint({ path: './skills', threshold: 70, ignored: ['wip-skill'] });
33
+
34
+ result.passed; // boolean — every skill met its threshold and textlint found no errors
35
+ result.fixed; // boolean — whether `fix` was requested (fixes are written to disk)
36
+ result.skills; // Array<{ name, scores: { overall, structure, clarity, specificity, advanced }, passed }>
37
+ result.textlint; // raw textlint results for the linted markdown files
38
+ ```
39
+
40
+ `lint(options)` accepts the same options as the CLI flags (`path`, `fix`, `ignored`, `threshold`, `overall`, `structure`, `clarity`, `specificity`, `advanced`). Additional named exports: `DEFAULT_PATH`, `DEFAULT_THRESHOLD`, `buildThreshold`, `failsThreshold`, `runTextlint`, `hasTextlintErrors`, and the TypeScript types (`ILintOptions`, `ILintResult`, `IScores`, `ISkillScore`, `IThreshold`).
41
+
25
42
  ## Skills directory structure
26
43
 
27
44
  Each subdirectory under `--path` is treated as one skill:
package/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import{getRelativePath as t,getPackageInfo as e,resolveCwdRelativePath as r,EExitCode as i}from"@ladamczyk/qoq-utils";import{assessQuality as s,getScoreColor as o,formatScoreBar as a}from"agent-skills-cli";import l from"cac";import c from"picocolors";import{loadTextlintrc as n,createLinter as d,loadFixerFormatter as p,loadLinterFormatter as f}from"textlint";import{writeFile as h}from"fs/promises";import{resolve as m}from"path";import{readdirSync as u}from"fs";const y=t=>m(`${(()=>{try{const{rootPath:t}=e("@ladamczyk/skillslint")??{};return t}catch{return process.cwd()}})()}${t}`),v=t=>t.some(t=>("remainingMessages"in t?t.remainingMessages:t.messages).some(t=>2===t.severity)),w=(t,e)=>t.overall<(e.overall??0)||t.structure<(e.structure??0)||t.clarity<(e.clarity??0)||t.specificity<(e.specificity??0)||t.advanced<(e.advanced??0),g="./skills",x=async(e={})=>{const{fix:i=!1,path:o,ignored:a}=e,l=`/${o??g}`,c=(t=>{const{threshold:e,overall:r,structure:i,clarity:s,specificity:o,advanced:a}=t,l={};return r&&(l.overall=r),i&&(l.structure=i),s&&(l.clarity=s),o&&(l.specificity=o),a&&(l.advanced=a),0===Object.keys(l).length&&(l.overall=e??70),l})(e),p=r(l),f=await(async(e,r)=>{const i=await n({configFilePath:(s="/.textlintrc.json",t(y(s)))});var s;const o=d({descriptor:i});try{if(!r)return await o.lintFiles([e]);const t=await o.fixFiles([e]);return await Promise.all(t.map(t=>h(t.filePath,t.output,"utf-8"))),t}catch(t){if(t instanceof Error&&"TextlintFileSearchError"===t.name)return[];throw t}})(r(`${l}/**/*.md`),i),m=u(p,{withFileTypes:!0}).filter(t=>t.isDirectory()&&!(a??[]).includes(t.name)).map(({name:t})=>t),x=await Promise.all(m.map(async t=>{const{overall:e,structure:r,clarity:i,specificity:o,advanced:a}=await s(`${p}/${t}`),l={overall:e,structure:r,clarity:i,specificity:o,advanced:a};return{name:t,scores:l,passed:!w(l,c)}})),k=!v(f)&&x.every(t=>t.passed);return{textlint:f,fixed:i,skills:x,passed:k}},k=l("skillslint");k.command("","Linter for agents skills").option("-p,--path <path>","Lint path",{default:g}).option("-t, --threshold <threshold>","Same as --overall 70, will take effect only if no other threshold options are configured",{default:70}).option("-f,--fix","Try to fix findings").option("-i,--ignored [ignored]","Ignored skills").option("--overall <threshold>","Overall required threshold").option("--structure <threshold>","Structure required threshold").option("--clarity <threshold>","Clarity required threshold").option("--specificity <threshold>","Specificity required threshold").option("--advanced <threshold>","Advanced required threshold").action(async t=>{const e=await x(t),r=await(async(t,e)=>{if(e)return(await p({formatterName:"stylish"})).format(t);return(await f({formatterName:"stylish"})).format(t)})(e.textlint,e.fixed);r.trim()&&process.stdout.write(`${r}\n`),e.fixed&&v(e.textlint)&&process.stdout.write(c.red("Can't perform automatic fix!\n\n")),e.skills.forEach(({name:t,scores:e})=>{process.stdout.write(c.gray(`\n/${t}\n`)),["overall","structure","clarity","specificity","advanced"].forEach(t=>{const r=`${t[0]?.toUpperCase()}${t.slice(1)}:`.padEnd(13),i=c[o(e[t])];process.stdout.write(i(`${r}${a(e[t],25)}\n`))})}),e.skills.some(t=>!t.passed)&&process.stdout.write(c.red("At least one skill doesn't meet required threshold!\n")),e.passed&&(process.stdout.write(c.green("\nAll good!\n")),process.exit(i.OK)),process.exit(i.ERROR)}),k.help(),k.parse();
package/lib/index.cjs ADDED
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ var fs = require('fs');
4
+ var qoqUtils = require('@ladamczyk/qoq-utils');
5
+ var agentSkillsCli = require('agent-skills-cli');
6
+ var promises = require('fs/promises');
7
+ var textlint = require('textlint');
8
+ var path = require('path');
9
+
10
+ const PACKAGE_NAME = '@ladamczyk/skillslint';
11
+ const getCliPackagePath = () => {
12
+ try {
13
+ const { rootPath } = qoqUtils.getPackageInfo(PACKAGE_NAME) ?? {};
14
+ return rootPath;
15
+ }
16
+ catch {
17
+ // this is for npx
18
+ return process.cwd();
19
+ }
20
+ };
21
+ const resolveCliPackagePath = (path$1) => path.resolve(`${getCliPackagePath()}${path$1}`);
22
+ const resolveCliRelativePath = (path) => qoqUtils.getRelativePath(resolveCliPackagePath(path));
23
+
24
+ const ERROR_SEVERITY = 2;
25
+ const NO_TARGET_FILES_ERROR = 'TextlintFileSearchError';
26
+ const runTextlint = async (target, fix) => {
27
+ const descriptor = await textlint.loadTextlintrc({
28
+ configFilePath: resolveCliRelativePath('/.textlintrc.json'),
29
+ });
30
+ const linter = textlint.createLinter({ descriptor });
31
+ try {
32
+ if (!fix) {
33
+ return await linter.lintFiles([target]);
34
+ }
35
+ const results = await linter.fixFiles([target]);
36
+ // fixFiles only computes the fixed output; persist it the way the textlint CLI does.
37
+ await Promise.all(results.map((result) => promises.writeFile(result.filePath, result.output, 'utf-8')));
38
+ return results;
39
+ }
40
+ catch (error) {
41
+ // textlint throws when no markdown files match the glob; treat as nothing to lint.
42
+ if (error instanceof Error && error.name === NO_TARGET_FILES_ERROR) {
43
+ return [];
44
+ }
45
+ throw error;
46
+ }
47
+ };
48
+ const hasTextlintErrors = (results) => results.some((result) => ('remainingMessages' in result ? result.remainingMessages : result.messages).some((message) => message.severity === ERROR_SEVERITY));
49
+
50
+ const DEFAULT_THRESHOLD = 70;
51
+ const buildThreshold = (options) => {
52
+ const { threshold: optionsThreshold, overall, structure, clarity, specificity, advanced, } = options;
53
+ const threshold = {};
54
+ if (overall) {
55
+ threshold.overall = overall;
56
+ }
57
+ if (structure) {
58
+ threshold.structure = structure;
59
+ }
60
+ if (clarity) {
61
+ threshold.clarity = clarity;
62
+ }
63
+ if (specificity) {
64
+ threshold.specificity = specificity;
65
+ }
66
+ if (advanced) {
67
+ threshold.advanced = advanced;
68
+ }
69
+ if (Object.keys(threshold).length === 0) {
70
+ threshold.overall = optionsThreshold ?? DEFAULT_THRESHOLD;
71
+ }
72
+ return threshold;
73
+ };
74
+ const failsThreshold = (scores, threshold) => scores.overall < (threshold.overall ?? 0) ||
75
+ scores.structure < (threshold.structure ?? 0) ||
76
+ scores.clarity < (threshold.clarity ?? 0) ||
77
+ scores.specificity < (threshold.specificity ?? 0) ||
78
+ scores.advanced < (threshold.advanced ?? 0);
79
+
80
+ const DEFAULT_PATH = './skills';
81
+ const lint = async (options = {}) => {
82
+ const { fix = false, path: optionsPath, ignored } = options;
83
+ const path = `/${optionsPath ?? DEFAULT_PATH}`;
84
+ const threshold = buildThreshold(options);
85
+ const skillsPath = qoqUtils.resolveCwdRelativePath(path);
86
+ const textlint = await runTextlint(qoqUtils.resolveCwdRelativePath(`${path}/**/*.md`), fix);
87
+ const skillNames = fs.readdirSync(skillsPath, { withFileTypes: true })
88
+ .filter((entry) => entry.isDirectory() && !(ignored ?? []).includes(entry.name))
89
+ .map(({ name }) => name);
90
+ const skills = await Promise.all(skillNames.map(async (name) => {
91
+ const { overall, structure, clarity, specificity, advanced } = await agentSkillsCli.assessQuality(`${skillsPath}/${name}`);
92
+ const scores = { overall, structure, clarity, specificity, advanced };
93
+ return { name, scores, passed: !failsThreshold(scores, threshold) };
94
+ }));
95
+ const passed = !hasTextlintErrors(textlint) && skills.every((skill) => skill.passed);
96
+ return { textlint, fixed: fix, skills, passed };
97
+ };
98
+
99
+ exports.DEFAULT_PATH = DEFAULT_PATH;
100
+ exports.DEFAULT_THRESHOLD = DEFAULT_THRESHOLD;
101
+ exports.buildThreshold = buildThreshold;
102
+ exports.failsThreshold = failsThreshold;
103
+ exports.hasTextlintErrors = hasTextlintErrors;
104
+ exports.lint = lint;
105
+ exports.runTextlint = runTextlint;
package/lib/index.mjs ADDED
@@ -0,0 +1,97 @@
1
+ import { readdirSync } from 'fs';
2
+ import { getRelativePath, getPackageInfo, resolveCwdRelativePath } from '@ladamczyk/qoq-utils';
3
+ import { assessQuality } from 'agent-skills-cli';
4
+ import { writeFile } from 'fs/promises';
5
+ import { loadTextlintrc, createLinter } from 'textlint';
6
+ import { resolve } from 'path';
7
+
8
+ const PACKAGE_NAME = '@ladamczyk/skillslint';
9
+ const getCliPackagePath = () => {
10
+ try {
11
+ const { rootPath } = getPackageInfo(PACKAGE_NAME) ?? {};
12
+ return rootPath;
13
+ }
14
+ catch {
15
+ // this is for npx
16
+ return process.cwd();
17
+ }
18
+ };
19
+ const resolveCliPackagePath = (path) => resolve(`${getCliPackagePath()}${path}`);
20
+ const resolveCliRelativePath = (path) => getRelativePath(resolveCliPackagePath(path));
21
+
22
+ const ERROR_SEVERITY = 2;
23
+ const NO_TARGET_FILES_ERROR = 'TextlintFileSearchError';
24
+ const runTextlint = async (target, fix) => {
25
+ const descriptor = await loadTextlintrc({
26
+ configFilePath: resolveCliRelativePath('/.textlintrc.json'),
27
+ });
28
+ const linter = createLinter({ descriptor });
29
+ try {
30
+ if (!fix) {
31
+ return await linter.lintFiles([target]);
32
+ }
33
+ const results = await linter.fixFiles([target]);
34
+ // fixFiles only computes the fixed output; persist it the way the textlint CLI does.
35
+ await Promise.all(results.map((result) => writeFile(result.filePath, result.output, 'utf-8')));
36
+ return results;
37
+ }
38
+ catch (error) {
39
+ // textlint throws when no markdown files match the glob; treat as nothing to lint.
40
+ if (error instanceof Error && error.name === NO_TARGET_FILES_ERROR) {
41
+ return [];
42
+ }
43
+ throw error;
44
+ }
45
+ };
46
+ const hasTextlintErrors = (results) => results.some((result) => ('remainingMessages' in result ? result.remainingMessages : result.messages).some((message) => message.severity === ERROR_SEVERITY));
47
+
48
+ const DEFAULT_THRESHOLD = 70;
49
+ const buildThreshold = (options) => {
50
+ const { threshold: optionsThreshold, overall, structure, clarity, specificity, advanced, } = options;
51
+ const threshold = {};
52
+ if (overall) {
53
+ threshold.overall = overall;
54
+ }
55
+ if (structure) {
56
+ threshold.structure = structure;
57
+ }
58
+ if (clarity) {
59
+ threshold.clarity = clarity;
60
+ }
61
+ if (specificity) {
62
+ threshold.specificity = specificity;
63
+ }
64
+ if (advanced) {
65
+ threshold.advanced = advanced;
66
+ }
67
+ if (Object.keys(threshold).length === 0) {
68
+ threshold.overall = optionsThreshold ?? DEFAULT_THRESHOLD;
69
+ }
70
+ return threshold;
71
+ };
72
+ const failsThreshold = (scores, threshold) => scores.overall < (threshold.overall ?? 0) ||
73
+ scores.structure < (threshold.structure ?? 0) ||
74
+ scores.clarity < (threshold.clarity ?? 0) ||
75
+ scores.specificity < (threshold.specificity ?? 0) ||
76
+ scores.advanced < (threshold.advanced ?? 0);
77
+
78
+ const DEFAULT_PATH = './skills';
79
+ const lint = async (options = {}) => {
80
+ const { fix = false, path: optionsPath, ignored } = options;
81
+ const path = `/${optionsPath ?? DEFAULT_PATH}`;
82
+ const threshold = buildThreshold(options);
83
+ const skillsPath = resolveCwdRelativePath(path);
84
+ const textlint = await runTextlint(resolveCwdRelativePath(`${path}/**/*.md`), fix);
85
+ const skillNames = readdirSync(skillsPath, { withFileTypes: true })
86
+ .filter((entry) => entry.isDirectory() && !(ignored ?? []).includes(entry.name))
87
+ .map(({ name }) => name);
88
+ const skills = await Promise.all(skillNames.map(async (name) => {
89
+ const { overall, structure, clarity, specificity, advanced } = await assessQuality(`${skillsPath}/${name}`);
90
+ const scores = { overall, structure, clarity, specificity, advanced };
91
+ return { name, scores, passed: !failsThreshold(scores, threshold) };
92
+ }));
93
+ const passed = !hasTextlintErrors(textlint) && skills.every((skill) => skill.passed);
94
+ return { textlint, fixed: fix, skills, passed };
95
+ };
96
+
97
+ export { DEFAULT_PATH, DEFAULT_THRESHOLD, buildThreshold, failsThreshold, hasTextlintErrors, lint, runTextlint };
@@ -0,0 +1 @@
1
+ export declare const resolveCliRelativePath: (path: string) => string;
@@ -0,0 +1,3 @@
1
+ import type { TTextlintResults } from '../types.ts';
2
+ export declare const runTextlint: (target: string, fix: boolean) => Promise<TTextlintResults>;
3
+ export declare const hasTextlintErrors: (results: TTextlintResults) => boolean;
@@ -0,0 +1,4 @@
1
+ import type { ILintOptions, IScores, IThreshold } from '../types.ts';
2
+ export declare const DEFAULT_THRESHOLD = 70;
3
+ export declare const buildThreshold: (options: ILintOptions) => IThreshold;
4
+ export declare const failsThreshold: (scores: IScores, threshold: IThreshold) => boolean;
@@ -0,0 +1,4 @@
1
+ export { DEFAULT_PATH, lint } from './lint.ts';
2
+ export { buildThreshold, DEFAULT_THRESHOLD, failsThreshold } from './helpers/threshold.ts';
3
+ export { hasTextlintErrors, runTextlint } from './helpers/textlint.ts';
4
+ export type { ILintOptions, ILintResult, IScores, ISkillScore, IThreshold, TTextlintFixResult, TTextlintLintResult, TTextlintResults, } from './types.ts';
@@ -0,0 +1,3 @@
1
+ import type { ILintOptions, ILintResult } from './types.ts';
2
+ export declare const DEFAULT_PATH = "./skills";
3
+ export declare const lint: (options?: ILintOptions) => Promise<ILintResult>;
@@ -0,0 +1,37 @@
1
+ import type { createLinter } from 'textlint';
2
+ type TLinter = ReturnType<typeof createLinter>;
3
+ export type TTextlintLintResult = Awaited<ReturnType<TLinter['lintFiles']>>[number];
4
+ export type TTextlintFixResult = Awaited<ReturnType<TLinter['fixFiles']>>[number];
5
+ export type TTextlintResults = TTextlintLintResult[] | TTextlintFixResult[];
6
+ export interface IThreshold {
7
+ overall?: number;
8
+ structure?: number;
9
+ clarity?: number;
10
+ specificity?: number;
11
+ advanced?: number;
12
+ }
13
+ export interface IScores {
14
+ overall: number;
15
+ structure: number;
16
+ clarity: number;
17
+ specificity: number;
18
+ advanced: number;
19
+ }
20
+ export interface ILintOptions extends IThreshold {
21
+ fix?: boolean;
22
+ path?: string;
23
+ threshold?: number;
24
+ ignored?: string[];
25
+ }
26
+ export interface ISkillScore {
27
+ name: string;
28
+ scores: IScores;
29
+ passed: boolean;
30
+ }
31
+ export interface ILintResult {
32
+ textlint: TTextlintResults;
33
+ fixed: boolean;
34
+ skills: ISkillScore[];
35
+ passed: boolean;
36
+ }
37
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ladamczyk/skillslint",
3
- "version": "4.0.8",
3
+ "version": "4.1.0",
4
4
  "description": "Linter for agents skills",
5
5
  "keywords": [
6
6
  "cli",
@@ -18,18 +18,29 @@
18
18
  },
19
19
  "license": "MIT",
20
20
  "type": "module",
21
- "main": "./bin/skillslint.js",
21
+ "main": "./lib/index.cjs",
22
+ "module": "./lib/index.mjs",
23
+ "types": "./lib/src/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./lib/src/index.d.ts",
27
+ "import": "./lib/index.mjs",
28
+ "require": "./lib/index.cjs"
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
22
32
  "bin": {
23
- "skillslint": "bin/skillslint.js"
33
+ "skillslint": "bin/cli.js"
24
34
  },
25
35
  "files": [
26
36
  "bin",
37
+ "lib",
27
38
  ".textlintrc.json",
28
39
  "AGENTS.md"
29
40
  ],
30
41
  "scripts": {
31
- "build": "rimraf ./bin && rollup -c --silent && chmod +x ./bin/skillslint.js",
32
- "dev": "npm run build && node ./bin/skillslint.js",
42
+ "build": "rimraf ./bin ./lib && rollup -c rollup.bin.js --silent && rollup -c --silent && chmod +x ./bin/cli.js",
43
+ "dev": "npm run build && node ./bin/cli.js",
33
44
  "husky:pre-push": "run-s qoq:check test build",
34
45
  "prepare": "husky",
35
46
  "publish:full": "run-s husky:pre-push publish:release",
@@ -41,7 +52,7 @@
41
52
  "test:coverage": "npm run test -- --coverage"
42
53
  },
43
54
  "dependencies": {
44
- "@ladamczyk/qoq-utils": "4.2.0",
55
+ "@ladamczyk/qoq-utils": "4.3.5",
45
56
  "@textlint/textlint-plugin-markdown": "15.7.1",
46
57
  "@textlint/textlint-plugin-text": "15.7.1",
47
58
  "agent-skills-cli": "1.1.9",
@@ -55,26 +66,27 @@
55
66
  "devDependencies": {
56
67
  "@commitlint/cli": "21.0.2",
57
68
  "@commitlint/config-conventional": "21.0.2",
58
- "@ladamczyk/qoq-cli": "4.2.0",
59
- "@ladamczyk/qoq-eslint-v9-ts": "4.2.0",
60
- "@ladamczyk/qoq-jscpd": "4.2.0",
61
- "@ladamczyk/qoq-knip": "4.2.0",
62
- "@ladamczyk/qoq-prettier-with-json-sort": "4.2.0",
69
+ "@ladamczyk/qoq-cli": "4.3.5",
70
+ "@ladamczyk/qoq-eslint-v9-ts": "4.3.5",
71
+ "@ladamczyk/qoq-jscpd": "4.3.5",
72
+ "@ladamczyk/qoq-knip": "4.3.5",
73
+ "@ladamczyk/qoq-prettier-with-json-sort": "4.3.5",
63
74
  "@rollup/plugin-commonjs": "29.0.3",
64
75
  "@rollup/plugin-json": "6.1.0",
65
76
  "@rollup/plugin-node-resolve": "16.0.3",
66
77
  "@rollup/plugin-terser": "1.0.0",
78
+ "@rollup/plugin-typescript": "12.3.0",
67
79
  "@types/node": "^22",
68
- "@vitest/coverage-v8": "4.1.8",
80
+ "@vitest/coverage-v8": "4.1.9",
69
81
  "dotenv": "17.4.2",
70
- "esbuild": "0.28.0",
82
+ "esbuild": "0.28.1",
71
83
  "husky": "9.1.7",
72
84
  "npm-run-all": "4.1.5",
73
85
  "rimraf": "6.1.3",
74
- "rollup": "4.61.1",
86
+ "rollup": "4.62.2",
75
87
  "rollup-plugin-esbuild": "6.2.1",
76
88
  "typescript": "6.0.3",
77
- "vitest": "4.1.8"
89
+ "vitest": "4.1.9"
78
90
  },
79
91
  "engines": {
80
92
  "node": ">=22.13.1"
package/bin/skillslint.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import{readdirSync as t}from"fs";import{getRelativePath as e,getPackageInfo as r,executeCommand as o,resolveCwdRelativePath as i,EExitCode as s}from"@ladamczyk/qoq-utils";import{assessQuality as l,getScoreColor as c,formatScoreBar as a}from"agent-skills-cli";import n from"cac";import d from"picocolors";import{resolve as p}from"path";var h="@ladamczyk/skillslint";const u=t=>p(`${(()=>{try{const{rootPath:t}=r(h)??{};return t}catch{return process.cwd()}})()}${t}`),f=t=>e(u(t)),y="./skills",m=n("skillslint");m.command("","Linter for agents skills").option("-p,--path <path>","Lint path",{default:y}).option("-t, --threshold <threshold>","Same as --overall 70, will take effect only if no other threshold options are configured",{default:70}).option("-f,--fix","Try to fix findings").option("-i,--ignored [ignored]","Ignored skills").option("--overall <threshold>","Overall required threshold").option("--structure <threshold>","Structure required threshold").option("--clarity <threshold>","Clarity required threshold").option("--specificity <threshold>","Specificity required threshold").option("--advanced <threshold>","Advanced required threshold").action(async e=>{const{fix:r,path:n,ignored:p}=e,h=`/${n??y}`,u=(t=>{const{threshold:e,overall:r,structure:o,clarity:i,specificity:s,advanced:l}=t,c={};return r&&(c.overall=r),o&&(c.structure=o),i&&(c.clarity=i),s&&(c.specificity=s),l&&(c.advanced=l),0===Object.keys(c).length&&(c.overall=e??70),c})(e);let m=await o("textlint",[r?"--fix":"","--config",f("/.textlintrc.json"),i(`${h}/**/*.md`)]);r&&m===s.ERROR&&process.stdout.write(d.red("Can't perform automatic fix!\n\n"));const v=t(i(h),{withFileTypes:!0}).filter(t=>t.isDirectory()&&!(p??[]).includes(t.name)).map(({name:t})=>t),w=await Promise.all(v.map(t=>l(`${i(h)}/${t}`)));w.forEach((t,e)=>{let r=d.gray;process.stdout.write(r(`\n/${v[e]}\n`)),r=d[c(t.overall)],process.stdout.write(r(`Overall: ${a(t.overall,25)}\n`)),r=d[c(t.structure)],process.stdout.write(r(`Structure: ${a(t.structure,25)}\n`)),r=d[c(t.clarity)],process.stdout.write(r(`Clarity: ${a(t.clarity,25)}\n`)),r=d[c(t.specificity)],process.stdout.write(r(`Specificity: ${a(t.specificity,25)}\n`)),r=d[c(t.advanced)],process.stdout.write(r(`Advanced: ${a(t.advanced,25)}\n`))}),w.some(t=>((t,e)=>t.overall<(e.overall??0)||t.structure<(e.structure??0)||t.clarity<(e.clarity??0)||t.specificity<(e.specificity??0)||t.advanced<(e.advanced??0))(t,u))&&(process.stdout.write(d.red("At least one skill doesn't meet required threshold!\n")),m=s.ERROR),m===s.ERROR?process.exit(m):(process.stdout.write(d.green("\nAll good!\n")),process.exit(s.OK))}),m.help(),m.parse();