okforest 0.1.0 → 0.2.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/dist/cli.mjs +6 -16
- package/package.json +3 -3
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 { validate } from "@okforest/validate";
|
|
10
|
+
import { 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 = {
|
|
@@ -236,25 +236,15 @@ async function validateCommand(args, io) {
|
|
|
236
236
|
io.stdout(format === "json" ? toJson(path, result) : toText(result, io));
|
|
237
237
|
return result.ok ? EXIT.ok : EXIT.failed;
|
|
238
238
|
}
|
|
239
|
+
/** The shared validation report (`@okforest/validate`'s `toReport`), as JSON. */
|
|
239
240
|
function toJson(path, result) {
|
|
240
|
-
|
|
241
|
-
return `${JSON.stringify({
|
|
242
|
-
schemaVersion: 1,
|
|
241
|
+
return `${JSON.stringify(toReport(result, {
|
|
243
242
|
tool: {
|
|
244
243
|
name: "okforest",
|
|
245
244
|
version: VERSION
|
|
246
245
|
},
|
|
247
|
-
path
|
|
248
|
-
|
|
249
|
-
ok,
|
|
250
|
-
errors,
|
|
251
|
-
warnings,
|
|
252
|
-
infos,
|
|
253
|
-
concepts,
|
|
254
|
-
files
|
|
255
|
-
},
|
|
256
|
-
findings
|
|
257
|
-
}, null, 2)}\n`;
|
|
246
|
+
path
|
|
247
|
+
}), null, 2)}\n`;
|
|
258
248
|
}
|
|
259
249
|
const LABEL = {
|
|
260
250
|
error: "error",
|
|
@@ -313,7 +303,7 @@ Diagram syntax checks need the optional packages \`@d2lang/d2\` and \`mermaid\`
|
|
|
313
303
|
installed alongside okforest, e.g.:
|
|
314
304
|
npx -p okforest -p @d2lang/d2 -p mermaid okforest validate .
|
|
315
305
|
|
|
316
|
-
Docs
|
|
306
|
+
Docs and source: https://github.com/okforest/cli
|
|
317
307
|
`;
|
|
318
308
|
const COMMANDS = {
|
|
319
309
|
validate: validateCommand,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "okforest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"node": ">=22"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@okforest/okf": "0.
|
|
36
|
-
"@okforest/validate": "0.
|
|
35
|
+
"@okforest/okf": "0.2.0",
|
|
36
|
+
"@okforest/validate": "0.2.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^26.6.5",
|