@ontology-kit/okb 0.2.0 → 0.3.0-alpha.133
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/check.js +21 -2
- package/dist/checks.js +23 -0
- package/dist/cli.js +11 -819
- package/dist/clidocs.d.ts +0 -2
- package/dist/clidocs.js +5 -27
- package/dist/command-table.d.ts +144 -0
- package/dist/command-table.js +85 -0
- package/dist/commands/documents.d.ts +3 -0
- package/dist/commands/documents.js +250 -0
- package/dist/commands/getting-started.d.ts +3 -0
- package/dist/commands/getting-started.js +135 -0
- package/dist/commands/housekeeping.d.ts +3 -0
- package/dist/commands/housekeeping.js +203 -0
- package/dist/commands/modeling.d.ts +3 -0
- package/dist/commands/modeling.js +467 -0
- package/dist/commands/planning.d.ts +3 -0
- package/dist/commands/planning.js +251 -0
- package/dist/commands/reviewing.d.ts +3 -0
- package/dist/commands/reviewing.js +234 -0
- package/dist/commands/skills.d.ts +3 -0
- package/dist/commands/skills.js +53 -0
- package/dist/commands.d.ts +10 -22
- package/dist/commands.js +15 -716
- package/dist/cqanswer.d.ts +51 -0
- package/dist/cqanswer.js +76 -0
- package/dist/export-changes.d.ts +40 -0
- package/dist/export-changes.js +115 -0
- package/dist/export-csv.d.ts +17 -0
- package/dist/export-csv.js +188 -0
- package/dist/export-eval-cases.d.ts +38 -0
- package/dist/export-eval-cases.js +40 -0
- package/dist/export.d.ts +33 -2
- package/dist/export.js +69 -11
- package/dist/help.d.ts +11 -2
- package/dist/help.js +51 -64
- package/dist/ops/admin.d.ts +1 -1
- package/dist/ops/admin.js +2 -1
- package/dist/ops/classes.js +2 -2
- package/dist/ops/common.d.ts +12 -2
- package/dist/ops/common.js +3 -0
- package/dist/ops/instances.js +2 -2
- package/dist/ops/links.d.ts +1 -1
- package/dist/ops/links.js +2 -1
- package/dist/ops/scope.d.ts +9 -2
- package/dist/ops/scope.js +19 -3
- package/dist/ops/slots.js +6 -6
- package/dist/provenance.d.ts +1 -1
- package/dist/provenance.js +3 -2
- package/dist/release.d.ts +4 -0
- package/dist/release.js +22 -3
- package/dist/render.d.ts +85 -1
- package/dist/render.js +244 -1
- package/dist/runner.d.ts +3 -0
- package/dist/runner.js +84 -0
- package/dist/skills.d.ts +19 -3
- package/dist/skills.js +129 -13
- package/dist/verifynote.d.ts +4 -3
- package/dist/verifynote.js +3 -2
- package/dist/workflows.d.ts +283 -0
- package/dist/workflows.js +270 -0
- package/meta-kb/data/edges.json +25 -0
- package/meta-kb/data/manifest.json +4 -4
- package/meta-kb/data/nodes.json +39 -2
- package/package.json +4 -3
- package/schema/node.schema.json +22 -1
- package/skills/build-domain-kb-from-docs/SKILL.md +2 -2
- package/skills/ontology-coach/SKILL.md +3 -3
- package/skills/ontology-maintainer/SKILL.md +2 -2
- package/skills/ontology-review/SKILL.md +2 -2
- package/skills/ontology-signoff/SKILL.md +2 -2
- package/templates/okb-check.yml +17 -1
package/meta-kb/data/nodes.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{
|
|
3
3
|
"type": "MetaKB",
|
|
4
4
|
"id": "metakb",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.8.1",
|
|
6
6
|
"formatVersion": "okb-lpg/3",
|
|
7
7
|
"description": "Rules, method and vocabulary for building ontologies, derived from Ontology 101 (Noy & McGuinness 2001) and Gruber (1993)."
|
|
8
8
|
},
|
|
@@ -2359,6 +2359,25 @@
|
|
|
2359
2359
|
"id": "rat.scope-cq-coverage",
|
|
2360
2360
|
"explanation": "Competency questions are the litmus test: does the ontology contain enough information to answer them? NEEDS links make that test explicit and checkable."
|
|
2361
2361
|
},
|
|
2362
|
+
{
|
|
2363
|
+
"type": "Rule",
|
|
2364
|
+
"id": "rule.scope-cq-expected-answer",
|
|
2365
|
+
"key": "scope-cq-expected-answer",
|
|
2366
|
+
"modality": "SHOULD",
|
|
2367
|
+
"basis": "interpretive",
|
|
2368
|
+
"check": "heuristic",
|
|
2369
|
+
"severity": "warning",
|
|
2370
|
+
"fromStep": 8,
|
|
2371
|
+
"statement": "Each competency question should record the answer the ontology is expected to give.",
|
|
2372
|
+
"plainLanguage": "Write down what each question should return, so a script can tell you when a change stops the ontology from answering it.",
|
|
2373
|
+
"review": "Read each stored query next to its question: does it really ask what the question asks?",
|
|
2374
|
+
"fix": "`okb cq answer <n> --query '<JSON>' --expect A,B,C`."
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
"type": "Rationale",
|
|
2378
|
+
"id": "rat.scope-cq-expected-answer",
|
|
2379
|
+
"explanation": "Competency questions are the litmus test, but a test nobody runs proves nothing. A stored query and its expected names turn each question into a regression check that `okb cq check` and `okb check` run on every change. okb can see that no answer is stored, not that the stored one is the right answer."
|
|
2380
|
+
},
|
|
2362
2381
|
{
|
|
2363
2382
|
"type": "Rule",
|
|
2364
2383
|
"id": "rule.scope-no-unneeded",
|
|
@@ -2508,6 +2527,24 @@
|
|
|
2508
2527
|
"id": "rat.struct-well-formed",
|
|
2509
2528
|
"explanation": "Every other check assumes the graph is structurally sound."
|
|
2510
2529
|
},
|
|
2530
|
+
{
|
|
2531
|
+
"type": "Rule",
|
|
2532
|
+
"id": "rule.struct-no-save-leftovers",
|
|
2533
|
+
"key": "struct-no-save-leftovers",
|
|
2534
|
+
"modality": "SHOULD",
|
|
2535
|
+
"basis": "operational",
|
|
2536
|
+
"check": "mechanical",
|
|
2537
|
+
"severity": "warning",
|
|
2538
|
+
"fromStep": 1,
|
|
2539
|
+
"statement": "An ontology folder should hold no leftovers of an interrupted save: no okb.json.tmp, nodes.jsonl.tmp or edges.jsonl.tmp, and no .okb.saving.tmp marker.",
|
|
2540
|
+
"plainLanguage": "A save that was killed halfway can leave new nodes next to old edges, and nothing else notices. Leftover temp files are the sign.",
|
|
2541
|
+
"fix": "If a command is running, wait for it. If the marker is there, run any okb command that changes this folder: it finishes the save. If only `*.tmp` files are there, run `okb validate` to check the real files agree (a save killed halfway can leave new nodes beside old edges), restore the folder from git or a backup if they don't, then delete the leftovers."
|
|
2542
|
+
},
|
|
2543
|
+
{
|
|
2544
|
+
"type": "Rationale",
|
|
2545
|
+
"id": "rat.struct-no-save-leftovers",
|
|
2546
|
+
"explanation": "A folder with leftovers can pass every other check while some of its files come from an older save. Older okb versions, and a save killed before it finished writing, leave temp files with no marker, so no load finishes them on its own."
|
|
2547
|
+
},
|
|
2511
2548
|
{
|
|
2512
2549
|
"type": "Rule",
|
|
2513
2550
|
"id": "rule.prov-verified",
|
|
@@ -3196,7 +3233,7 @@
|
|
|
3196
3233
|
"id",
|
|
3197
3234
|
"text"
|
|
3198
3235
|
],
|
|
3199
|
-
"description": "A question the ontology must answer. status: draft | answerable."
|
|
3236
|
+
"description": "A question the ontology must answer. status: draft | answerable. answer (`okb cq answer`): {query, expect[], match: exact | includes}, a declarative find/traverse/slots query and the names it must return, which `okb cq check` evaluates."
|
|
3200
3237
|
},
|
|
3201
3238
|
{
|
|
3202
3239
|
"type": "NodeType",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontology-kit/okb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-alpha.133",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A toolkit for building knowledge graphs with guardrails: a checked file format, rules from a meta-KB, provenance down to verbatim quotes, and skills that drive it.",
|
|
6
6
|
"homepage": "https://ontology-kit.dev",
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^26.6.6",
|
|
58
58
|
"ajv": "^8.20.0",
|
|
59
|
-
"typescript": "^
|
|
59
|
+
"typescript": "^7.0.2"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
62
|
"pdfjs-dist": "^6.3.289"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@ontology-kit/reader": "0.
|
|
65
|
+
"@ontology-kit/reader": "0.3.0-alpha.133",
|
|
66
66
|
"yaml": "^2.8.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"docs": "node src/gendocs.ts",
|
|
73
73
|
"example": "node examples/build-wine.ts && node examples/build-espresso.ts",
|
|
74
74
|
"typecheck": "tsc",
|
|
75
|
+
"bench": "node scripts/bench-scale.ts",
|
|
75
76
|
"test": "node --test --test-concurrency=1 \"tests/*.test.ts\"",
|
|
76
77
|
"build": "pnpm --filter @ontology-kit/reader run build && rm -rf dist && tsc -p tsconfig.build.json && node ../../scripts/rewrite-dts.ts"
|
|
77
78
|
}
|
package/schema/node.schema.json
CHANGED
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
},
|
|
224
224
|
"CompetencyQuestion": {
|
|
225
225
|
"title": "CompetencyQuestion",
|
|
226
|
-
"description": "A question the ontology must answer. status: draft | answerable.",
|
|
226
|
+
"description": "A question the ontology must answer. status: draft | answerable. answer (`okb cq answer`): {query, expect[], match: exact | includes}, a declarative find/traverse/slots query and the names it must return, which `okb cq check` evaluates.",
|
|
227
227
|
"type": "object",
|
|
228
228
|
"required": [
|
|
229
229
|
"id",
|
|
@@ -256,6 +256,27 @@
|
|
|
256
256
|
"draft",
|
|
257
257
|
"answerable"
|
|
258
258
|
]
|
|
259
|
+
},
|
|
260
|
+
"answer": {
|
|
261
|
+
"type": "object",
|
|
262
|
+
"required": [
|
|
263
|
+
"query",
|
|
264
|
+
"expect"
|
|
265
|
+
],
|
|
266
|
+
"properties": {
|
|
267
|
+
"query": {
|
|
268
|
+
"type": "object"
|
|
269
|
+
},
|
|
270
|
+
"expect": {
|
|
271
|
+
"$ref": "#/$defs/Strings"
|
|
272
|
+
},
|
|
273
|
+
"match": {
|
|
274
|
+
"enum": [
|
|
275
|
+
"exact",
|
|
276
|
+
"includes"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
}
|
|
259
280
|
}
|
|
260
281
|
}
|
|
261
282
|
},
|
|
@@ -5,7 +5,7 @@ description: Use when extracting design-system (or other) documentation, usually
|
|
|
5
5
|
|
|
6
6
|
# Build a domain KB from docs
|
|
7
7
|
|
|
8
|
-
**Version 2.
|
|
8
|
+
**Version 2.8.1.** It should match the meta-KB version that `okb version` prints.
|
|
9
9
|
|
|
10
10
|
Turns a documentation source (usually a markdown component doc, sometimes a PDF) into an okb ontology: Class, Slot and Instance nodes plus domain Rule nodes, each tied to a verbatim quote with its heading path and line numbers. It follows the meta-KB's rules in `packages/okb/meta-kb/` and the pipeline in `docs/EXTRACTION-PIPELINE.md` (both in the ontology-kit repository, usually `~/Projects/ontology-kit`).
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ The point of this skill is to be deterministic where possible and to stop for hu
|
|
|
13
13
|
|
|
14
14
|
## Step 0: Set up
|
|
15
15
|
|
|
16
|
-
1. Find okb: `okb version` (Node 24+; if it isn't installed, `npm install --global @ontology-kit/okb`, or from a clone of the repo `node <ontology-kit>/packages/okb/src/cli.ts`). Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
16
|
+
1. Find okb: `okb version` (Node 24+; if it isn't installed, `npm install --global @ontology-kit/okb`, or from a clone of the repo `node <ontology-kit>/packages/okb/src/cli.ts`). Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. `okb skills install` asks before it replaces a skill folder that is older or edited. You have no terminal to answer it, so it refuses and says what it found: show that to the user, and run it again with `--force` only after they agree (it keeps the old folder in a backup). The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
17
17
|
2. The target ontology must exist and have a **scope and at least three competency questions** (`okb status`). If it doesn't, stop and do Step 1 of the method first, or hand off to the **ontology-coach** skill. Competency questions decide what's worth extracting; without them, extraction turns into copying the docs.
|
|
18
18
|
3. Load the modeling rules: `okb explain` (list), and `okb explain <rule-id>` for any you're unsure of. Don't invent structural rules beyond the meta-KB. If a modeling question isn't answered by a meta-KB rule or decision guide, raise it as an open question in the output rather than deciding silently.
|
|
19
19
|
4. Register the document, from a local copy (the markdown source, not the rendered website):
|
|
@@ -5,7 +5,7 @@ description: Coach someone who has never built an ontology or knowledge base thr
|
|
|
5
5
|
|
|
6
6
|
# Ontology coach
|
|
7
7
|
|
|
8
|
-
**Version 2.
|
|
8
|
+
**Version 2.8.1.** It should match the meta-KB version that `okb version` prints.
|
|
9
9
|
|
|
10
10
|
You are coaching a beginner through building an ontology with the **ontology-kit** toolkit. They have probably never built one. Your job is to make each decision small, explain each idea just before it's needed, do the typing for them, and leave behind an ontology that passes `okb validate` plus a record of _why_ it looks the way it does.
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ The toolkit's meta-KB is the authority on method, vocabulary and rules. **Don't
|
|
|
13
13
|
|
|
14
14
|
## 0. Setup (every session)
|
|
15
15
|
|
|
16
|
-
1. **Find the toolkit.** Try `okb version`. If that fails, okb isn't installed: ask the user to run `npm install --global @ontology-kit/okb` (it needs Node 24+, check with `node --version`). Only if they are working from a clone of the repo, look for the `ontology-kit` folder (usually `~/Projects/ontology-kit`) and run okb as `node <kit>/packages/okb/src/cli.ts ...`; if that folder isn't reachable from this session, ask the user to connect it, and don't try to rebuild the toolkit. Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
16
|
+
1. **Find the toolkit.** Try `okb version`. If that fails, okb isn't installed: ask the user to run `npm install --global @ontology-kit/okb` (it needs Node 24+, check with `node --version`). Only if they are working from a clone of the repo, look for the `ontology-kit` folder (usually `~/Projects/ontology-kit`) and run okb as `node <kit>/packages/okb/src/cli.ts ...`; if that folder isn't reachable from this session, ask the user to connect it, and don't try to rebuild the toolkit. Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. `okb skills install` asks before it replaces a skill folder that is older or edited. You have no terminal to answer it, so it refuses and says what it found: show that to the user, and run it again with `--force` only after they agree (it keeps the old folder in a backup). The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
17
17
|
2. **Find or create their ontology.**
|
|
18
18
|
- Resuming: run `okb status` in their ontology folder and pick up where they are. Briefly recap their scope and the step they're on.
|
|
19
19
|
- New: ask what they want to model and what they'll use it for (one question), then `okb init <folder> --name "<Name>"`.
|
|
@@ -74,7 +74,7 @@ Pick one competency question and add just enough instances to answer it end to e
|
|
|
74
74
|
|
|
75
75
|
### Step 8: Review and iterate
|
|
76
76
|
|
|
77
|
-
1. For each competency question, ask what answers it and link it: `okb cq link <n> <Class|slot>...`. A question with nothing to link means something is missing, so go back and add it. okb then suggests the question's family; widen it with the user (see below).
|
|
77
|
+
1. For each competency question, ask what answers it and link it: `okb cq link <n> <Class|slot>...`. A question with nothing to link means something is missing, so go back and add it. okb then suggests the question's family; widen it with the user (see below). Then store what each question should return, so a script can tell when a change breaks it: `okb cq answer <n> --query '<JSON>' --expect A,B,C` (queries are `find`, `traverse` or `slots`; `okb cq answer --help` shows the shapes). `okb cq check` runs them all, and `okb check` includes it.
|
|
78
78
|
2. `okb validate --all`: fix errors; fix or explain warnings.
|
|
79
79
|
3. Run the **ontology-review** skill (or `okb review` yourself) for the judgment rules a script can't check.
|
|
80
80
|
4. Suggest showing the tree (`okb diagram --out diagram.md`) to someone who knows the domain.
|
|
@@ -5,7 +5,7 @@ description: Use when someone looks after an existing okb knowledge base that is
|
|
|
5
5
|
|
|
6
6
|
# Maintain an existing KB
|
|
7
7
|
|
|
8
|
-
**Version 2.
|
|
8
|
+
**Version 2.8.1.** It should match the meta-KB version that `okb version` prints.
|
|
9
9
|
|
|
10
10
|
For the person (or the agent working for them) who looks after a KB that was built once and is now kept in git with `okb check` in CI. It works out what is open, does the routine update, and finishes with the pull request text. It adds no commands of its own: everything goes through `okb`. The same sequences, with their output, are in the maintainer guide (<https://ontology-kit.dev/build/maintaining/>) and the CI guide (<https://ontology-kit.dev/build/check-in-ci/>); read those when a step here is not enough.
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ For the person (or the agent working for them) who looks after a KB that was bui
|
|
|
20
20
|
|
|
21
21
|
## Step 0: Set up and triage
|
|
22
22
|
|
|
23
|
-
1. Find okb with `okb version`. Compare the meta-KB version it prints with this skill's version. If they differ, tell the user the skill or okb is out of date and offer `okb skills status`, then `okb skills install`, before going on.
|
|
23
|
+
1. Find okb with `okb version`. Compare the meta-KB version it prints with this skill's version. If they differ, tell the user the skill or okb is out of date and offer `okb skills status`, then `okb skills install`, before going on. `okb skills install` asks before it replaces a skill folder that is older or edited. You have no terminal to answer it, so it refuses and says what it found: show that to the user, and run it again with `--force` only after they agree (it keeps the old folder in a backup).
|
|
24
24
|
2. Make sure you're on a branch cut from the KB's main branch (`git fetch origin`, `git branch --show-current`, `git status --short`). Don't work on `main`.
|
|
25
25
|
3. Record what is already failing, before you touch anything, so the PR neither inherits nor hides it:
|
|
26
26
|
|
|
@@ -5,13 +5,13 @@ description: Review an ontology built with ontology-kit (okb) against the Ontolo
|
|
|
5
5
|
|
|
6
6
|
# Ontology review
|
|
7
7
|
|
|
8
|
-
**Version 2.
|
|
8
|
+
**Version 2.8.1.** It should match the meta-KB version that `okb version` prints.
|
|
9
9
|
|
|
10
10
|
Give an okb ontology a second opinion. `okb validate` already covers the mechanical rules. The value of this review is in the rules **only a person can judge** (is this really a kind-of? are these siblings equally general? should this class be a slot value?) and in **double-checking heuristic findings**, which can be false positives. The reader may be a beginner, so every finding must be understandable without prior ontology knowledge.
|
|
11
11
|
|
|
12
12
|
## 1. Gather
|
|
13
13
|
|
|
14
|
-
1. Find okb: `okb version` (Node 24+; if it isn't installed, `npm install --global @ontology-kit/okb`, or from a clone of the repo `node <ontology-kit>/packages/okb/src/cli.ts`). Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
14
|
+
1. Find okb: `okb version` (Node 24+; if it isn't installed, `npm install --global @ontology-kit/okb`, or from a clone of the repo `node <ontology-kit>/packages/okb/src/cli.ts`). Compare the meta-KB version it prints with this skill's version (top of this file). If they differ, tell the user that the skill or okb is out of date and offer to run `okb skills status`, then `okb skills install` to refresh the skills from this okb (the Installation page, <https://ontology-kit.dev/getting-started/installation/>, covers updating okb itself), before going on. `okb skills install` asks before it replaces a skill folder that is older or edited. You have no terminal to answer it, so it refuses and says what it found: show that to the user, and run it again with `--force` only after they agree (it keeps the old folder in a backup). The docs are readable as plain markdown: <https://ontology-kit.dev/llms.txt> lists every page with a one-line summary, and each page has a `.md` version.
|
|
15
15
|
2. In the ontology folder, collect:
|
|
16
16
|
- `okb status --json`: the step they're on and what's complete
|
|
17
17
|
- `okb validate --all --json`: mechanical and heuristic findings
|
|
@@ -5,7 +5,7 @@ description: Use when a subject-matter expert or a pull request reviewer has to
|
|
|
5
5
|
|
|
6
6
|
# Sign off on a KB
|
|
7
7
|
|
|
8
|
-
**Version 2.
|
|
8
|
+
**Version 2.8.1.** It should match the meta-KB version that `okb version` prints.
|
|
9
9
|
|
|
10
10
|
For the person who knows the subject but may not know git, JSON or the `okb` command: a subject-matter expert (SME) whose documents an agent turned into rules, or a teammate reviewing a pull request that changes a KB. The job is to put each rule in front of them with the words it came from, get a decision, and keep a record. You run the commands. They answer questions.
|
|
11
11
|
|
|
@@ -22,7 +22,7 @@ This is a check on facts: is this rule true, and does the source say it? It is n
|
|
|
22
22
|
|
|
23
23
|
## Step 0: Set up
|
|
24
24
|
|
|
25
|
-
1. Run `okb version`. Compare the meta-KB version with this skill's version (top of this file). If they differ, tell the person the skill or okb is out of date and offer `okb skills status`, then `okb skills install`, before going on.
|
|
25
|
+
1. Run `okb version`. Compare the meta-KB version with this skill's version (top of this file). If they differ, tell the person the skill or okb is out of date and offer `okb skills status`, then `okb skills install`, before going on. `okb skills install` asks before it replaces a skill folder that is older or edited. You have no terminal to answer it, so it refuses and says what it found: show that to the user, and run it again with `--force` only after they agree (it keeps the old folder in a backup).
|
|
26
26
|
2. Find the KB folder (the one with `okb.json`). Make sure you are in it and that the source documents are on disk beside it: the context views read them.
|
|
27
27
|
3. Pick a scratch folder for the review pages, outside the KB folder (for example a new folder under the system temp directory). Use the same one for the whole session. Never write review pages into the KB's own `docs` folder.
|
|
28
28
|
4. Ask what they are here to do, in one question: "Is this the first time you're reading what was pulled out of your documents, or are you reviewing a change someone made?" First time: Story 1. A change: Story 2. If they say they have little time, run the story and use Story 3's order.
|
package/templates/okb-check.yml
CHANGED
|
@@ -65,6 +65,16 @@ jobs:
|
|
|
65
65
|
cat "$RUNNER_TEMP/check.txt"
|
|
66
66
|
exit "$status"
|
|
67
67
|
|
|
68
|
+
# Optional: ask the competency questions through the MCP server's tools, as an agent would, and not
|
|
69
|
+
# only against the files. Uncomment it if the KB is served with @ontology-kit/mcp. It needs the
|
|
70
|
+
# questions' answers stored (`okb cq answer`) and exits 1 when one fails. Add `continue-on-error: true`
|
|
71
|
+
# to report it without blocking the merge. The comment below reads this step's outcome through its `id`, and
|
|
72
|
+
# says "not safe to merge" when it failed, even if `continue-on-error` lets the job pass.
|
|
73
|
+
# - name: Run the competency questions through the MCP server
|
|
74
|
+
# id: mcp
|
|
75
|
+
# shell: bash
|
|
76
|
+
# run: npx --yes @ontology-kit/mcp check "$KB_DIR"
|
|
77
|
+
|
|
68
78
|
- name: Run okb diff against the base branch
|
|
69
79
|
if: always()
|
|
70
80
|
env:
|
|
@@ -81,13 +91,19 @@ jobs:
|
|
|
81
91
|
if: always()
|
|
82
92
|
env:
|
|
83
93
|
RESULT: ${{ steps.check.outcome }}
|
|
94
|
+
# Empty while the optional MCP step above is commented out, which counts as "not run".
|
|
95
|
+
MCP_RESULT: ${{ steps.mcp.outcome }}
|
|
84
96
|
shell: bash
|
|
85
97
|
run: |
|
|
86
98
|
# The backticks are Markdown, not command substitution.
|
|
87
99
|
# shellcheck disable=SC2016
|
|
88
100
|
{
|
|
89
101
|
echo '<!-- okb-check -->'
|
|
90
|
-
if [ "$RESULT" = success ]; then echo '## okb check: safe to merge'; else echo '## okb check: not safe to merge'; fi
|
|
102
|
+
if [ "$RESULT" = success ] && [ "$MCP_RESULT" != failure ]; then echo '## okb check: safe to merge'; else echo '## okb check: not safe to merge'; fi
|
|
103
|
+
if [ "$MCP_RESULT" = failure ]; then
|
|
104
|
+
echo
|
|
105
|
+
echo 'The competency questions asked through the MCP server failed (see the step in the run log).'
|
|
106
|
+
fi
|
|
91
107
|
echo
|
|
92
108
|
echo '~~~~text'
|
|
93
109
|
sed 's/\x1b\[[0-9;]*m//g' "$RUNNER_TEMP/check.txt"
|