@ladamczyk/skillslint 4.2.1 → 4.2.2

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
@@ -47,12 +47,14 @@ result.textlint; // raw textlint results for the linted markdown files
47
47
 
48
48
  ## Anonymous usage stats
49
49
 
50
- Opt-in, off until a human says yes. A counted run posts one constant to `https://adamczyk.ovh/stats` and nothing else — every run, every flag combination, byte for byte the same body:
50
+ Opt-in, off until a human says yes. 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:
51
51
 
52
52
  ```jsonc
53
53
  { "tool": "skillslint", "options": [] } // `options` is always empty
54
54
  ```
55
55
 
56
+ Where an outbound POST never leaves the network, the same run counts as a plain image GET instead — `https://adamczyk.ovh/img/stats/pixel.png?tool=skillslint` — which carries the same single value and nothing more.
57
+
56
58
  So the only thing a send carries is that a run happened. Never sent: skills, file names, paths, scores, findings, thresholds, the flags you typed, project or package names, or anything identifying the user or machine. Sends are fire-and-forget with a 2s timeout; a failure is swallowed and never affects the exit code.
57
59
 
58
60
  - **CLI** — asks the user, once, the first time it runs with a TTY on both stdin and stdout, and stores the answer in `$XDG_CONFIG_HOME/skillslint.json` (`~/.config/skillslint.json` by default):
package/README.md CHANGED
@@ -33,12 +33,14 @@ npx @ladamczyk/skillslint -h
33
33
 
34
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 and never counted. The JavaScript API never prompts: `stats` is a required boolean on `lint()`, so the calling host states its own user's consent.
35
35
 
36
- A counted run posts one constant to `https://adamczyk.ovh/stats` and nothing else — every run, every flag combination, byte for byte the same body:
36
+ 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
37
 
38
38
  ```jsonc
39
39
  { "tool": "skillslint", "options": [] } // `options` is always empty
40
40
  ```
41
41
 
42
+ Where an outbound POST never leaves the network, the same run counts as a plain image GET instead — `https://adamczyk.ovh/img/stats/pixel.png?tool=skillslint` — which carries the same single value and nothing more.
43
+
42
44
  Never sent: your skills, file names, paths, scores, findings, thresholds, the flags you typed, project or package names, or anything identifying the user or machine. Sends are fire-and-forget with a 2s timeout; a failure is swallowed and never affects the exit code.
43
45
 
44
46
  ## Last 12 months usage statistics (>=4.2.0)
package/bin/cli.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import{EExitCode as e,getPackageInfo as t,getRelativePath as n,resolveCwdRelativePath as r}from"@ladamczyk/qoq-utils";import i from"cac";import{assessQuality as a,formatScoreBar as o,getScoreColor as s}from"agent-skills-cli";import c from"picocolors";import{createLinter as l,loadFixerFormatter as u,loadLinterFormatter as d,loadTextlintrc as f}from"textlint";import{writeFile as p}from"fs/promises";import{dirname as m,join as h,resolve as g}from"path";import{mkdirSync as _,readFileSync as v,readdirSync as y,writeFileSync as b}from"fs";import{homedir as x}from"os";import{createInterface as S}from"readline/promises";const C=()=>{try{let{rootPath:e}=t(`@ladamczyk/skillslint`)??{};return e}catch{return process.cwd()}},w=e=>g(`${C()}${e}`),T=e=>n(w(e)),E=async(e,t)=>{let n=await f({configFilePath:T(`/.textlintrc.json`)}),r=l({descriptor:n});try{if(!t)return await r.lintFiles([e]);let n=await r.fixFiles([e]);return await Promise.all(n.map(e=>p(e.filePath,e.output,`utf-8`))),n}catch(e){if(e instanceof Error&&e.name===`TextlintFileSearchError`)return[];throw e}},D=e=>e.some(e=>(`remainingMessages`in e?e.remainingMessages:e.messages).some(e=>e.severity===2)),O=[`overall`,`structure`,`clarity`,`specificity`,`advanced`],k=async(e,t)=>t?(await u({formatterName:`stylish`})).format(e):(await d({formatterName:`stylish`})).format(e),A=async e=>{let t=``,n=await k(e.textlint,e.fixed);return n.trim()&&(t+=`${n}\n`),e.fixed&&D(e.textlint)&&(t+=c.red(`Can't perform automatic fix!
2
+ import{EExitCode as e,PIXEL_URL as t,STATS_URL as n,getPackageInfo as r,getRelativePath as i,resolveCwdRelativePath as a,sendStats as o}from"@ladamczyk/qoq-utils";import s from"cac";import{assessQuality as c,formatScoreBar as l,getScoreColor as u}from"agent-skills-cli";import d from"picocolors";import{createLinter as f,loadFixerFormatter as p,loadLinterFormatter as m,loadTextlintrc as h}from"textlint";import{writeFile as g}from"fs/promises";import{dirname as _,join as v,resolve as y}from"path";import{mkdirSync as b,readFileSync as x,readdirSync as S,writeFileSync as C}from"fs";import{homedir as w}from"os";import{createInterface as T}from"readline/promises";const E=()=>{try{let{rootPath:e}=r(`@ladamczyk/skillslint`)??{};return e}catch{return process.cwd()}},D=e=>y(`${E()}${e}`),O=e=>i(D(e)),k=async(e,t)=>{let n=await h({configFilePath:O(`/.textlintrc.json`)}),r=f({descriptor:n});try{if(!t)return await r.lintFiles([e]);let n=await r.fixFiles([e]);return await Promise.all(n.map(e=>g(e.filePath,e.output,`utf-8`))),n}catch(e){if(e instanceof Error&&e.name===`TextlintFileSearchError`)return[];throw e}},A=e=>e.some(e=>(`remainingMessages`in e?e.remainingMessages:e.messages).some(e=>e.severity===2)),j=[`overall`,`structure`,`clarity`,`specificity`,`advanced`],M=async(e,t)=>t?(await p({formatterName:`stylish`})).format(e):(await m({formatterName:`stylish`})).format(e),N=async e=>{let t=``,n=await M(e.textlint,e.fixed);return n.trim()&&(t+=`${n}\n`),e.fixed&&A(e.textlint)&&(t+=d.red(`Can't perform automatic fix!
3
3
 
4
- `)),e.skills.forEach(({name:e,scores:n})=>{t+=c.gray(`\n/${e}\n`),O.forEach(e=>{let r=`${e[0]?.toUpperCase()}${e.slice(1)}:`.padEnd(13),i=c[s(n[e])];t+=i(`${r}${o(n[e],25)}\n`)})}),e.skills.some(e=>!e.passed)&&(t+=c.red(`At least one skill doesn't meet required threshold!
5
- `)),e.passed&&(t+=c.green(`
4
+ `)),e.skills.forEach(({name:e,scores:n})=>{t+=d.gray(`\n/${e}\n`),j.forEach(e=>{let r=`${e[0]?.toUpperCase()}${e.slice(1)}:`.padEnd(13),i=d[u(n[e])];t+=i(`${r}${l(n[e],25)}\n`)})}),e.skills.some(e=>!e.passed)&&(t+=d.red(`At least one skill doesn't meet required threshold!
5
+ `)),e.passed&&(t+=d.green(`
6
6
  All good!
7
- `)),t},j=`https://adamczyk.ovh/stats`,M=h(process.env.XDG_CONFIG_HOME??h(x(),`.config`),`skillslint.json`),N=e=>{try{let t=JSON.parse(v(e,`utf8`));return typeof t==`object`&&t?t:{}}catch{return{}}},P=(e,t)=>{try{_(m(e),{recursive:!0}),b(e,`${JSON.stringify({...N(e),stats:t},null,2)}\n`)}catch{}},F=async()=>{process.stdout.write([c.bold(`
7
+ `)),t},P=v(process.env.XDG_CONFIG_HOME??v(w(),`.config`),`skillslint.json`),F=e=>{try{let t=JSON.parse(x(e,`utf8`));return typeof t==`object`&&t?t:{}}catch{return{}}},I=(e,t)=>{try{b(_(e),{recursive:!0}),C(e,`${JSON.stringify({...F(e),stats:t},null,2)}\n`)}catch{}},L=async()=>{process.stdout.write([d.bold(`
8
8
  Skillslint usage stats
9
- `),`Send a count of skillslint runs to ${j}? Each run posts one thing:\n`,` • the tool name — always the literal ${c.cyan(`"skillslint"`)}\n`,c.gray(`Never sent: your skills, file names, paths, scores, findings, thresholds,
9
+ `),`Send a count of skillslint runs to ${n}? Each run posts one thing:\n`,` • the tool name — always the literal ${d.cyan(`"skillslint"`)}\n`,d.gray(`Blocked POST? The same values go to ${t} as a GET.\n`),d.gray(`Never sent: your skills, file names, paths, scores, findings, thresholds,
10
10
  the flags you typed, project or package names, and nothing identifying
11
11
  you or your machine.
12
- `),c.gray(`Stored as \`stats: true|false\` in ${M} — edit it any time.\n\n`)].join(``));let e=S({input:process.stdin,output:process.stdout});try{return(await e.question(`Send anonymous usage stats? [y/N] `)).trim().toLowerCase()===`y`}finally{e.close()}},I=async(e=M)=>{let t=N(e).stats;if(typeof t==`boolean`)return t;if(process.env.CI===`true`||!process.stdin.isTTY||!process.stdout.isTTY)return;let n=await F();return P(e,n),n},L=async()=>{try{await fetch(j,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({tool:`skillslint`,options:[]}),signal:AbortSignal.timeout(2e3)})}catch{}},R=e=>{let{threshold:t,overall:n,structure:r,clarity:i,specificity:a,advanced:o}=e,s={};return n&&(s.overall=n),r&&(s.structure=r),i&&(s.clarity=i),a&&(s.specificity=a),o&&(s.advanced=o),Object.keys(s).length===0&&(s.overall=t??70),s},z=(e,t)=>e.overall<(t.overall??0)||e.structure<(t.structure??0)||e.clarity<(t.clarity??0)||e.specificity<(t.specificity??0)||e.advanced<(t.advanced??0),B=async e=>{let{fix:t=!1,path:n,ignored:i,stats:o}=e;o&&L();let s=`/${n??`./skills`}`,c=R(e),l=r(s),u=await E(r(`${s}/**/*.md`),t),d=y(l,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!(i??[]).includes(e.name)).map(({name:e})=>e),f=await Promise.all(d.map(async e=>{let{overall:t,structure:n,clarity:r,specificity:i,advanced:o}=await a(`${l}/${e}`),s={overall:t,structure:n,clarity:r,specificity:i,advanced:o};return{name:e,scores:s,passed:!z(s,c)}}));return{textlint:u,fixed:t,skills:f,passed:!D(u)&&f.every(e=>e.passed)}},V=i(`skillslint`);V.command(``,`Linter for agents skills`).option(`-p,--path <path>`,`Lint path`,{default:`./skills`}).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=>{let n=await B({...t,stats:await I()??!1});process.stdout.write(await A(n)),process.exit(n.passed?e.OK:e.ERROR)}),V.help(),V.parse();
12
+ `),d.gray(`Stored as \`stats: true|false\` in ${P} — edit it any time.\n\n`)].join(``));let e=T({input:process.stdin,output:process.stdout});try{return(await e.question(`Send anonymous usage stats? [y/N] `)).trim().toLowerCase()===`y`}finally{e.close()}},R=async(e=P)=>{let t=F(e).stats;if(typeof t==`boolean`)return t;if(process.env.CI===`true`||!process.stdin.isTTY||!process.stdout.isTTY)return;let n=await L();return I(e,n),n},z=async()=>o(`skillslint`),B=e=>{let{threshold:t,overall:n,structure:r,clarity:i,specificity:a,advanced:o}=e,s={};return n&&(s.overall=n),r&&(s.structure=r),i&&(s.clarity=i),a&&(s.specificity=a),o&&(s.advanced=o),Object.keys(s).length===0&&(s.overall=t??70),s},V=(e,t)=>e.overall<(t.overall??0)||e.structure<(t.structure??0)||e.clarity<(t.clarity??0)||e.specificity<(t.specificity??0)||e.advanced<(t.advanced??0),H=async e=>{let{fix:t=!1,path:n,ignored:r,stats:i}=e;i&&z();let o=`/${n??`./skills`}`,s=B(e),l=a(o),u=await k(a(`${o}/**/*.md`),t),d=S(l,{withFileTypes:!0}).filter(e=>e.isDirectory()&&!(r??[]).includes(e.name)).map(({name:e})=>e),f=await Promise.all(d.map(async e=>{let{overall:t,structure:n,clarity:r,specificity:i,advanced:a}=await c(`${l}/${e}`),o={overall:t,structure:n,clarity:r,specificity:i,advanced:a};return{name:e,scores:o,passed:!V(o,s)}}));return{textlint:u,fixed:t,skills:f,passed:!A(u)&&f.every(e=>e.passed)}},U=s(`skillslint`);U.command(``,`Linter for agents skills`).option(`-p,--path <path>`,`Lint path`,{default:`./skills`}).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=>{let n=await H({...t,stats:await R()??!1});process.stdout.write(await N(n)),process.exit(n.passed?e.OK:e.ERROR)}),U.help(),U.parse();
package/lib/index.cjs CHANGED
@@ -95,24 +95,8 @@ const format = async (result) => {
95
95
  if (result.passed) output += picocolors.default.green("\nAll good!\n");
96
96
  return output;
97
97
  };
98
- //#endregion
99
- //#region src/helpers/stats.ts
100
- const STATS_URL = "https://adamczyk.ovh/stats";
101
- const STATS_TIMEOUT_MS = 2e3;
102
98
  (0, path.join)(process.env.XDG_CONFIG_HOME ?? (0, path.join)((0, os.homedir)(), ".config"), "skillslint.json");
103
- const sendStats = async () => {
104
- try {
105
- await fetch(STATS_URL, {
106
- method: "POST",
107
- headers: { "content-type": "application/json" },
108
- body: JSON.stringify({
109
- tool: "skillslint",
110
- options: []
111
- }),
112
- signal: AbortSignal.timeout(STATS_TIMEOUT_MS)
113
- });
114
- } catch {}
115
- };
99
+ const sendStats = async () => (0, _ladamczyk_qoq_utils.sendStats)("skillslint");
116
100
  //#endregion
117
101
  //#region src/helpers/threshold.ts
118
102
  const DEFAULT_THRESHOLD = 70;
package/lib/index.mjs CHANGED
@@ -3,7 +3,7 @@ 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 } from "@ladamczyk/qoq-utils";
6
+ import { getPackageInfo, getRelativePath, resolveCwdRelativePath, sendStats } from "@ladamczyk/qoq-utils";
7
7
  import { readdirSync } from "fs";
8
8
  import { homedir } from "os";
9
9
  import "readline/promises";
@@ -72,24 +72,8 @@ const format = async (result) => {
72
72
  if (result.passed) output += c.green("\nAll good!\n");
73
73
  return output;
74
74
  };
75
- //#endregion
76
- //#region src/helpers/stats.ts
77
- const STATS_URL = "https://adamczyk.ovh/stats";
78
- const STATS_TIMEOUT_MS = 2e3;
79
75
  join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "skillslint.json");
80
- const sendStats = async () => {
81
- try {
82
- await fetch(STATS_URL, {
83
- method: "POST",
84
- headers: { "content-type": "application/json" },
85
- body: JSON.stringify({
86
- tool: "skillslint",
87
- options: []
88
- }),
89
- signal: AbortSignal.timeout(STATS_TIMEOUT_MS)
90
- });
91
- } catch {}
92
- };
76
+ const sendStats$1 = async () => sendStats("skillslint");
93
77
  //#endregion
94
78
  //#region src/helpers/threshold.ts
95
79
  const DEFAULT_THRESHOLD = 70;
@@ -110,7 +94,7 @@ const failsThreshold = (scores, threshold) => scores.overall < (threshold.overal
110
94
  const DEFAULT_PATH = "./skills";
111
95
  const lint = async (options) => {
112
96
  const { fix = false, path: optionsPath, ignored, stats } = options;
113
- if (stats) sendStats();
97
+ if (stats) sendStats$1();
114
98
  const path = `/${optionsPath ?? "./skills"}`;
115
99
  const threshold = buildThreshold(options);
116
100
  const skillsPath = resolveCwdRelativePath(path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ladamczyk/skillslint",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Linter for agents skills",
5
5
  "keywords": [
6
6
  "cli",
@@ -52,7 +52,7 @@
52
52
  "test:coverage": "npm run test -- --coverage"
53
53
  },
54
54
  "dependencies": {
55
- "@ladamczyk/qoq-utils": "6.1.1",
55
+ "@ladamczyk/qoq-utils": "6.1.4",
56
56
  "@textlint/textlint-plugin-markdown": "15.8.0",
57
57
  "@textlint/textlint-plugin-text": "15.8.0",
58
58
  "agent-skills-cli": "1.1.9",
@@ -66,18 +66,18 @@
66
66
  "devDependencies": {
67
67
  "@commitlint/cli": "21.2.2",
68
68
  "@commitlint/config-conventional": "21.2.2",
69
- "@ladamczyk/qoq-cli": "6.1.1",
70
- "@ladamczyk/qoq-eslint-v9-ts": "6.1.1",
71
- "@ladamczyk/qoq-jscpd": "6.1.1",
72
- "@ladamczyk/qoq-knip": "6.1.1",
73
- "@ladamczyk/qoq-prettier-with-json-sort": "6.1.1",
69
+ "@ladamczyk/qoq-cli": "6.1.4",
70
+ "@ladamczyk/qoq-eslint-v9-ts": "6.1.4",
71
+ "@ladamczyk/qoq-jscpd": "6.1.4",
72
+ "@ladamczyk/qoq-knip": "6.1.4",
73
+ "@ladamczyk/qoq-prettier-with-json-sort": "6.1.4",
74
74
  "@types/node": "^22",
75
75
  "@vitest/coverage-v8": "4.1.11",
76
76
  "dotenv": "17.4.2",
77
77
  "husky": "9.1.7",
78
78
  "npm-run-all": "4.1.5",
79
79
  "rimraf": "6.1.3",
80
- "rolldown": "1.2.4",
80
+ "rolldown": "1.2.6",
81
81
  "typescript": "6.0.3",
82
82
  "vitest": "4.1.11"
83
83
  },