okf 1.3.0 → 1.5.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +68 -0
  3. data/README.md +15 -15
  4. data/lib/okf/bundle/search.rb +155 -0
  5. data/lib/okf/bundle.rb +2 -2
  6. data/lib/okf/cli.rb +68 -4
  7. data/lib/okf/server/app.rb +29 -0
  8. data/lib/okf/server/graph/template.html.erb +385 -50
  9. data/lib/okf/server/graph.rb +2 -2
  10. data/lib/okf/skill/SKILL.md +17 -11
  11. data/lib/okf/skill/playbooks/consume.md +4 -2
  12. data/lib/okf/skill/playbooks/maintain.md +6 -4
  13. data/lib/okf/skill/playbooks/menu.md +10 -6
  14. data/lib/okf/skill/playbooks/search.md +42 -0
  15. data/lib/okf/skill/reference/authoring.md +2 -2
  16. data/lib/okf/skill/reference/cli.md +55 -17
  17. data/lib/okf/version.rb +1 -1
  18. data/lib/okf.rb +1 -0
  19. metadata +3 -26
  20. data/.okf/capabilities/agent-skill.md +0 -46
  21. data/.okf/capabilities/graph-server.md +0 -63
  22. data/.okf/capabilities/index.md +0 -20
  23. data/.okf/capabilities/library-api.md +0 -72
  24. data/.okf/capabilities/linter.md +0 -49
  25. data/.okf/capabilities/read-views.md +0 -84
  26. data/.okf/capabilities/validator.md +0 -40
  27. data/.okf/cli.md +0 -52
  28. data/.okf/design/core-shell-split.md +0 -58
  29. data/.okf/design/index.md +0 -10
  30. data/.okf/design/ruby-floor.md +0 -45
  31. data/.okf/design/runtime-dependencies.md +0 -44
  32. data/.okf/design/server-trust-boundary.md +0 -40
  33. data/.okf/format/citations.md +0 -33
  34. data/.okf/format/cross-links.md +0 -52
  35. data/.okf/format/frontmatter.md +0 -38
  36. data/.okf/format/index.md +0 -9
  37. data/.okf/format/okf-format.md +0 -43
  38. data/.okf/index.md +0 -18
  39. data/.okf/log.md +0 -10
  40. data/.okf/model/bundle.md +0 -38
  41. data/.okf/model/concept.md +0 -44
  42. data/.okf/model/graph.md +0 -44
  43. data/.okf/model/index.md +0 -8
  44. data/.okf/overview.md +0 -67
@@ -1,44 +0,0 @@
1
- ---
2
- type: Component
3
- title: OKF::Concept
4
- description: The pure in-memory model of a single OKF file — frontmatter, body, and a stable id.
5
- resource: lib/okf/concept.rb
6
- tags: [model, concept, pure]
7
- timestamp: 2026-07-11T12:00:00Z
8
- ---
9
-
10
- # Overview
11
-
12
- `OKF::Concept` is the atomic node: a `path`, a parsed
13
- [`frontmatter`](../format/frontmatter.md) hash, and a Markdown `body`. It is
14
- [pure](../design/core-shell-split.md) — it holds no file handle and does no I/O.
15
- The on-disk counterpart is `OKF::Concept::File`, part of the
16
- [library API](../capabilities/library-api.md).
17
-
18
- # The id is the concept's identity
19
-
20
- `#id` is the `path` minus `.md` (e.g. `model/graph.md` → `model/graph`). That id
21
- is the concept's **stable identifier** across the whole system — it is the graph
22
- node key, the link target, and the thing you name a concept for. Name a file for
23
- what it *is*, not where it sits, because the id follows the path.
24
-
25
- # What it derives from its own content
26
-
27
- The concept parses its body on demand into the structural facts the rest of the
28
- gem consumes:
29
-
30
- - `#type`, `#title`, `#description`, `#resource`, `#tags`, `#timestamp` — typed
31
- reads over the frontmatter;
32
- - `#links` — the bundle-relative [cross-links](../format/cross-links.md) (edges);
33
- - `#external_links` — URLs and `mailto:` (not edges);
34
- - `#citations` — the [`# Citations`](../format/citations.md) entries;
35
- - `#to_markdown` — the inverse of the frontmatter parser;
36
- - `#lint` — the concept-scoped [lint](../capabilities/linter.md) checks in isolation.
37
-
38
- A concept never decides conformance alone; a [bundle](bundle.md) does, because
39
- some checks (duplicate titles, missing link targets) are only meaningful across
40
- the set.
41
-
42
- # Citations
43
-
44
- [1] [lib/okf/concept.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/concept.rb) — the pure concept model.
data/.okf/model/graph.md DELETED
@@ -1,44 +0,0 @@
1
- ---
2
- type: Component
3
- title: OKF::Bundle::Graph
4
- description: The in-memory knowledge graph — concepts as nodes, cross-links as directed edges, with type and tag indexes.
5
- resource: lib/okf/bundle/graph.rb
6
- tags: [model, graph, pure]
7
- timestamp: 2026-07-11T21:40:00Z
8
- ---
9
-
10
- # Overview
11
-
12
- `OKF::Bundle::Graph` turns a [bundle](bundle.md) into nodes and edges:
13
- [concepts](concept.md) become nodes keyed by id, and bundle-relative
14
- [cross-links](../format/cross-links.md) become directed edges. It is pure — it
15
- carries no presentation concerns; sizing and colour belong to a renderer like
16
- the [graph server](../capabilities/graph-server.md).
17
-
18
- # Fidelity is a build option
19
-
20
- The same graph ships at three weights, so a client downloads only what it needs
21
- and fetches the rest on demand:
22
-
23
- | Build | Node payload |
24
- |-------|--------------|
25
- | default (`body: true`) | id, type, title, description, tags, **body** |
26
- | `body: false` | everything but the body |
27
- | `minimal: true` | just id and title — the leanest payload to draw |
28
-
29
- # Indexes come free at every weight
30
-
31
- Regardless of node fidelity, the graph exposes two inverted indexes computed from
32
- every concept:
33
-
34
- - `type_index` — `{ type => [id, …] }`, so even a minimal client can colour nodes
35
- by [`type`](concept.md);
36
- - `tag_index` — `{ tag => [id, …] }`, so it can filter by tag.
37
-
38
- Those indexes, plus `unlinked_ids` (degree-0 nodes), are what the
39
- [read views](../capabilities/read-views.md) — `types`, `tags`, `stats`, `loose`
40
- — are built from, and what their `--type`/`--area`/`--tag` filters match against.
41
-
42
- # Citations
43
-
44
- [1] [lib/okf/bundle/graph.rb](https://github.com/serradura/okf-gem/blob/main/lib/okf/bundle/graph.rb) — graph construction and the type/tag indexes.
data/.okf/model/index.md DELETED
@@ -1,8 +0,0 @@
1
- # The model
2
-
3
- The pure, in-memory data structures the gem builds a bundle out of — no disk, no
4
- stdio. Everything else reads or renders these.
5
-
6
- * [Concept](concept.md) - one file's worth of knowledge: frontmatter plus body, with a stable id.
7
- * [Bundle](bundle.md) - a collection of concepts you validate, lint, and graph.
8
- * [Graph](graph.md) - concepts as nodes, cross-links as edges, plus type and tag indexes.
data/.okf/overview.md DELETED
@@ -1,67 +0,0 @@
1
- ---
2
- type: Overview
3
- title: okf-gem at a glance
4
- description: A light Ruby gem that reads, validates, lints, and serves Open Knowledge Format v0.1 bundles.
5
- tags: [okf, gem, overview, diagram]
6
- timestamp: 2026-07-12T12:00:00Z
7
- ---
8
-
9
- # Overview
10
-
11
- **okf-gem** — `okf` on RubyGems — operates on [OKF v0.1](format/okf-format.md)
12
- bundles: directories of Markdown files with YAML frontmatter that humans and
13
- agents both read from one source. It does not define new knowledge storage; it
14
- gives you leverage over knowledge that already lives as Markdown.
15
-
16
- ```mermaid
17
- flowchart LR
18
- skill["companion<br/>agent skill"] -. authors/curate .-> bundle[("OKF v0.1 bundle<br/>Markdown + YAML")]
19
- bundle --> model["pure model<br/>Concept · Bundle · Graph"]
20
- skill -. execute .-> cli
21
- subgraph cli ["okf CLI"]
22
- validate["validate — legal? §9"]
23
- lint["lint — well-curated?"]
24
- server["server — explore"]
25
- end
26
- model --> cli
27
- model --> library["library API<br/>embed in Ruby"]
28
- ```
29
-
30
- Over such a bundle the gem gives you five capabilities behind one
31
- [command-line tool](cli.md):
32
-
33
- | Capability | What it answers | Verb |
34
- | -------------------------------------------------------- | --------------------------------- | ---------------- |
35
- | [Companion agent skill](capabilities/agent-skill.md) | Can an agent author it? | `skill` |
36
- | [Conformance validator](capabilities/validator.md) | Is this a legal OKF bundle? (§9) | `validate` |
37
- | [Curation linter](capabilities/linter.md) | Is it navigable, complete, fresh? | `lint` / `loose` |
38
- | [Interactive graph server](capabilities/graph-server.md) | Can I explore it visually? | `server` |
39
- | [Library API](capabilities/library-api.md) | Can my Ruby program use it? | (in-process) |
40
-
41
- Alongside those, a family of [read views](capabilities/read-views.md) —
42
- `index`, `catalog`, `files`, `tags`, `stats`, `graph` — print the bundle at a
43
- glance so an agent reads it without a browser.
44
-
45
- # The two ideas it inherits from the format
46
-
47
- - **Dual audience.** Every file serves a human skimming it _and_ an agent
48
- extracting from it, so bodies are structural Markdown and
49
- [links](format/cross-links.md) are plain Markdown links — both readers already
50
- understand them.
51
- - **The graph is emergent.** Files are nodes, Markdown links are edges. You never
52
- declare a graph; the gem [builds one](model/graph.md) from how concepts link.
53
-
54
- # Design ethos
55
-
56
- The gem is deliberately light so it runs on the Ruby an OS already ships. That
57
- ethos is not incidental — it is enforced by [hard constraints](design/):
58
- a [Ruby 2.4 floor](design/ruby-floor.md), exactly
59
- [two runtime dependencies](design/runtime-dependencies.md), and a
60
- [core/shell split](design/core-shell-split.md) that keeps all logic pure and
61
- testable without disk. Everything else — no ActiveSupport, no build step, no
62
- JavaScript toolchain — follows from those.
63
-
64
- # Citations
65
-
66
- [1] [README.md](https://github.com/serradura/okf-gem/blob/main/README.md) — the gem's own overview.
67
- [2] [AGENTS.md](https://github.com/serradura/okf-gem/blob/main/AGENTS.md) — the maintainer guide.