okforest 0.1.0 → 0.2.1

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
@@ -18,6 +18,11 @@ alongside it:
18
18
  npx -p okforest -p @d2lang/d2 -p mermaid okforest validate .
19
19
  ```
20
20
 
21
+ In GitHub Actions, use
22
+ [OKForest Validate](https://github.com/okforest/validate-action)
23
+ (`uses: okforest/validate-action@v1`): the same rules, with annotations on the
24
+ pull request and the diagram checks included.
25
+
21
26
  Rules, options, and what counts as a concept: see the
22
27
  [OKForest CLI README](https://github.com/okforest/cli#readme).
23
28
 
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
- const { findings, errors, warnings, infos, concepts, files, ok } = result;
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
- summary: {
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: https://okforest.ai/docs · Source: https://github.com/okforest/cli
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.1.0",
3
+ "version": "0.2.1",
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.1.0",
36
- "@okforest/validate": "0.1.0"
35
+ "@okforest/okf": "0.2.1",
36
+ "@okforest/validate": "0.2.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26.6.5",
@@ -13,10 +13,8 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
15
  - uses: actions/checkout@v7
16
- - uses: actions/setup-node@v7
17
- with:
18
- node-version: 22
19
- # Fails on OKF errors; warnings are reported without failing. To also
20
- # check D2 and Mermaid diagram syntax, add the optional packages:
21
- # npx --yes -p okforest@^{{version}} -p @d2lang/d2 -p mermaid okforest validate .
22
- - run: npx --yes okforest@^{{version}} validate .
16
+ # Annotates each finding on its file and line, lists them all in the job
17
+ # summary, and checks D2 and Mermaid diagram syntax. Fails on OKF errors;
18
+ # warnings are reported without failing. Inputs and outputs:
19
+ # https://github.com/okforest/validate-action
20
+ - uses: okforest/validate-action@v1