okforest 0.2.1 → 0.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/NOTICE +1 -1
- package/README.md +1 -1
- package/dist/cli.mjs +13 -1
- package/package.json +6 -6
package/NOTICE
CHANGED
package/README.md
CHANGED
|
@@ -26,4 +26,4 @@ pull request and the diagram checks included.
|
|
|
26
26
|
Rules, options, and what counts as a concept: see the
|
|
27
27
|
[OKForest CLI README](https://github.com/okforest/cli#readme).
|
|
28
28
|
|
|
29
|
-
Apache-2.0 · © Preneur LLC · [okforest.ai](https://okforest.ai)
|
|
29
|
+
Apache-2.0 · © Preneur LLC · [okforest.ai](https://www.okforest.ai)
|
package/dist/cli.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
import { parseArgs, styleText } from "node:util";
|
|
8
8
|
import { buildInventory } from "@okforest/okf";
|
|
9
9
|
import { readTree } from "@okforest/okf/node";
|
|
10
|
-
import { toReport, validate } from "@okforest/validate";
|
|
10
|
+
import { ruleUrl, toReport, validate } from "@okforest/validate";
|
|
11
11
|
//#region src/io.ts
|
|
12
12
|
/** Exit codes: 0 success, 1 validation errors, 2 usage or read problems. */
|
|
13
13
|
const EXIT = {
|
|
@@ -269,9 +269,21 @@ function toText(result, io) {
|
|
|
269
269
|
});
|
|
270
270
|
out.push("");
|
|
271
271
|
}
|
|
272
|
+
out.push(...ruleDocs(result.findings, io));
|
|
272
273
|
out.push(summary(result, io));
|
|
273
274
|
return `${out.join("\n")}\n`;
|
|
274
275
|
}
|
|
276
|
+
/** Each rule that reported something, with its documentation page. */
|
|
277
|
+
function ruleDocs(findings, io) {
|
|
278
|
+
const ids = [...new Set(findings.map((f) => f.ruleId))];
|
|
279
|
+
if (ids.length === 0) return [];
|
|
280
|
+
const width = Math.max(...ids.map((id) => id.length));
|
|
281
|
+
return [
|
|
282
|
+
paint(io, "underline", "Rule docs"),
|
|
283
|
+
...ids.map((id) => ` ${id.padEnd(width)} ${paint(io, "dim", ruleUrl(id))}`),
|
|
284
|
+
""
|
|
285
|
+
];
|
|
286
|
+
}
|
|
275
287
|
function summary(result, io) {
|
|
276
288
|
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
277
289
|
const scope = `${plural(result.concepts, "concept")} in ${plural(result.files, "file")}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okforest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "The OKForest CLI: validate Open Knowledge Format (OKF) v0.2 trees, inventory their metadata, and scaffold new trees from templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"okf",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "Preneur LLC",
|
|
15
|
-
"homepage": "https://okforest.ai",
|
|
15
|
+
"homepage": "https://www.okforest.ai",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git+https://github.com/okforest/cli.git",
|
|
@@ -32,15 +32,15 @@
|
|
|
32
32
|
"node": ">=22"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@okforest/okf": "0.
|
|
36
|
-
"@okforest/validate": "0.
|
|
35
|
+
"@okforest/okf": "0.3.0",
|
|
36
|
+
"@okforest/validate": "0.3.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26.6.5",
|
|
40
|
-
"@vitest/coverage-v8": "^5.0.
|
|
40
|
+
"@vitest/coverage-v8": "^5.0.4",
|
|
41
41
|
"tsdown": "^0.23.0",
|
|
42
42
|
"typescript": "^7.0.2",
|
|
43
|
-
"vitest": "^5.0.
|
|
43
|
+
"vitest": "^5.0.4"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "tsdown",
|