okf 2.1.1 → 2.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.
- checksums.yaml +4 -4
- data/.okf/capabilities/bundles-manager.md +11 -0
- data/.okf/capabilities/read-views.md +24 -5
- data/.okf/capabilities/search.md +3 -1
- data/.okf/cli.md +31 -10
- data/.okf/design/server-trust-boundary.md +6 -1
- data/.okf/log.md +97 -0
- data/.okf/registry.md +170 -3
- data/.okf/structure/the-cli.md +1 -1
- data/.okf/structure/the-disk-shell.md +11 -2
- data/.okf/structure/the-model.md +2 -2
- data/.okf/testing/adding-a-verb.md +1 -1
- data/CHANGELOG.md +142 -0
- data/README.md +33 -4
- data/lib/okf/bundle/folder.rb +29 -11
- data/lib/okf/bundle/references.rb +47 -34
- data/lib/okf/cli/command.rb +8 -3
- data/lib/okf/cli/references.rb +8 -8
- data/lib/okf/cli/registry.rb +306 -47
- data/lib/okf/cli.rb +1 -1
- data/lib/okf/registry.rb +448 -22
- data/lib/okf/render/graph/template.html.erb +6 -2
- data/lib/okf/server/hub.rb +6 -2
- data/lib/okf/skill/reference/authoring.md +4 -2
- data/lib/okf/skill/reference/cli/checks.md +10 -7
- data/lib/okf/skill/reference/cli/registry.md +49 -6
- data/lib/okf/skill/reference/cli.md +1 -1
- data/lib/okf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b75d2108e64966a44944510d9ea117dcaffcdc1905ab63e98309dafb327a35a5
|
|
4
|
+
data.tar.gz: fe1ab7bbf290f09f0a68cb1ddeb391f52192d783a262ec28e4f057cdd0146396
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 469cb9bddf86d1f6607deeb51775710458c1fb302899815cc81dc362f4384c3a997750d3250df9bf4fb862fc3f484f7b68d48b68e659ae67ee73316059ee292b
|
|
7
|
+
data.tar.gz: 2709a8369407444d3a53d793dfecf1a4f486c5090d6423480b2bd2826248cb58958e5424498a4346dacbb271d80bd6293ab7be9ab7d6a1e1905155b7f0fb0f39
|
|
@@ -53,6 +53,17 @@ red. The verdict keeps the [validate/lint separation](validator.md): a curation
|
|
|
53
53
|
finding is a warning and the bundle stays open, and only a non-conformant bundle
|
|
54
54
|
reads as broken.
|
|
55
55
|
|
|
56
|
+
A bundle that arrived through a registry [link](../registry.md) is listed,
|
|
57
|
+
mounted and served like any other, and is **read-only**: the file that owns it is
|
|
58
|
+
another registry, so the model refuses `rename`, `remove` and `default` against
|
|
59
|
+
it. The page carries that in both halves, because one without the other is a
|
|
60
|
+
worse page than neither. The row shows `via @onm` and **offers no actions menu** —
|
|
61
|
+
three buttons that can only fail are not a menu — and the request is refused
|
|
62
|
+
anyway if it arrives, since the guard lives in `Registry` rather than here. That
|
|
63
|
+
is the same "hiding a button is a UI, refusing the request is the boundary" split
|
|
64
|
+
the read-only gate above keeps, reached from the other direction: there the
|
|
65
|
+
server declines to write at all, here one row does.
|
|
66
|
+
|
|
56
67
|
Rows are matched to entries by **directory**, not by slug. A rename changes the
|
|
57
68
|
slug and nothing else, and a row that lost its identity over a rename is the bug
|
|
58
69
|
that avoids.
|
|
@@ -30,7 +30,7 @@ these views group by, for the price of a few rows.
|
|
|
30
30
|
| `dirs` | every directory with the concepts living directly in it | directory (root first) |
|
|
31
31
|
| `catalog` | concepts with type, tags, link counts, status | top-level dir |
|
|
32
32
|
| `files` | files with titles | folder |
|
|
33
|
-
| `references` |
|
|
33
|
+
| `references` | every on-disk `references/` directory, at any depth (§6.3), with each file's citers and the dangling §6.2 pointers | folder |
|
|
34
34
|
| `types` | types (`@okf-eco format/frontmatter`) with their concepts | count |
|
|
35
35
|
| `tags` | tags (`@okf-eco format/frontmatter`) with their concepts | count |
|
|
36
36
|
| `stats` | rollups: concepts, dirs, types, cross-links, tags | — |
|
|
@@ -49,12 +49,31 @@ of what `--dir` can name.
|
|
|
49
49
|
|
|
50
50
|
`references` is the one view whose rows are not concepts: the reader models
|
|
51
51
|
only markdown, so a `.py` attester or a `.sql` computation exists to no other
|
|
52
|
-
surface, and this verb lists
|
|
53
|
-
|
|
52
|
+
surface, and this verb lists every `references/` directory from disk — the
|
|
53
|
+
root's and any nested one, such as `computations/references/` — with which
|
|
54
|
+
concepts cite each file through the §6.2 path-valued fields, plus every
|
|
54
55
|
pointer that resolves to nothing, the bare-path trap (§6.2 resolves a bare
|
|
55
56
|
`references/…` relative to the concept) named with its leading-slash fix.
|
|
56
|
-
|
|
57
|
-
and a
|
|
57
|
+
§6.3 names the subdirectory without placing it, so the root is not special:
|
|
58
|
+
it once was, and a bare pointer into a sibling `references/` that existed was
|
|
59
|
+
reported as missing. Nothing reached through a directory symlink is listed —
|
|
60
|
+
the reader walks none, and one would list outside names or the same file
|
|
61
|
+
twice; a root `references` that is itself a link lists nothing — nor a file
|
|
62
|
+
whose own symlink target leaves the root. What the inventory lists and what is
|
|
63
|
+
missing are separate questions, answered with one meaning of "in the bundle":
|
|
64
|
+
the path exists and its resolved location stays inside the root. A pointer is
|
|
65
|
+
reported missing only when nothing in the bundle is at its path: a file behind
|
|
66
|
+
a directory link, under a hidden path, or a directory itself still opens, and
|
|
67
|
+
is just not the inventory's to list, while a file whose link leads out of the
|
|
68
|
+
root is missing, as the reader treats it. The leading-slash hint names only a
|
|
69
|
+
file the inventory lists: the disk would also answer for a directory, or for a
|
|
70
|
+
`..` spelling that climbs out and back in, and neither is a fix to suggest. A pointer that escapes the root is not
|
|
71
|
+
reported as dangling, since it names nothing in this bundle, and every pointer
|
|
72
|
+
is cleaned of `.` and `..` before it is looked up. Only a directory named
|
|
73
|
+
exactly `references` counts, so a case-insensitive filesystem lists what a
|
|
74
|
+
case-sensitive one does. Folder scope is still deliberate:
|
|
75
|
+
§6.3 is a naming convention, not a requirement, and a computation stored
|
|
76
|
+
beside its concept outside any `references/` is legal and not inventoried.
|
|
58
77
|
|
|
59
78
|
Every one of them names the bundle it answers about, in the identity the caller
|
|
60
79
|
used — the rule the [CLI](../cli.md) keeps: `bundle` is always the directory,
|
data/.okf/capabilities/search.md
CHANGED
|
@@ -225,7 +225,9 @@ even with zero matches — only an invalid `--regexp` pattern, `-e` paired with
|
|
|
225
225
|
Knowledge rarely lives in one bundle, so search is the one verb that spans the
|
|
226
226
|
[registry](../registry.md): leading @slugs pick bundles explicitly
|
|
227
227
|
(`okf search @handbook @notes auth`), and `@all` is the ref that means every
|
|
228
|
-
registered one
|
|
228
|
+
registered one — including the bundles a [link](../registry.md) folds in, since
|
|
229
|
+
those are registered here in every sense that matters to a reader looking for an
|
|
230
|
+
answer. Every row is labeled by its bundle's slug.
|
|
229
231
|
|
|
230
232
|
**Merged rows are comparable by construction, and each engine earns that
|
|
231
233
|
differently.** The scan's score is absolute — summed field weights, with no
|
data/.okf/cli.md
CHANGED
|
@@ -74,21 +74,42 @@ side should not enrol them in the user's durable list. Registering is always the
|
|
|
74
74
|
explicit act of `okf registry set`.
|
|
75
75
|
|
|
76
76
|
`registry` is an umbrella verb — `init`, `list`, `set`, `del`, `default`,
|
|
77
|
-
`rename`, `group`, `ungroup` — over one persistent
|
|
77
|
+
`rename`, `group`, `ungroup`, `link`, `unlink`, `import` — over one persistent
|
|
78
|
+
file, and it
|
|
79
|
+
is **one row in the map**. It carried ten for a while, which made a third of `okf
|
|
80
|
+
help` about registry management when registry management is not a third of what
|
|
81
|
+
okf does; the row now points at `okf registry --help`, which prints the ten with
|
|
82
|
+
their grammar and the `-g` they share. The map's job is to name the verbs. A verb
|
|
83
|
+
whose own help is the manual is the same progressive disclosure the bundles are
|
|
84
|
+
built on, applied to the CLI's front page — and the row has to *say* the help
|
|
85
|
+
exists, since nothing else tells a reader an umbrella has subcommands at all. `$OKF_HOME` points every
|
|
78
86
|
one of them at a different global registry, which is what keeps the tests off the
|
|
79
87
|
real `~/.okf`; `registry init` and discovery add a [project-local](registry.md#global-by-default-project-local-by-discovery)
|
|
80
88
|
one that replaces it while you stand in its tree, with `OKF_NO_DISCOVERY=1` to
|
|
81
89
|
force the global one.
|
|
82
90
|
|
|
83
|
-
One lever, not two
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
## One lever, not two
|
|
92
|
+
|
|
93
|
+
A *cross-cutting* lever is an env var, never a flag. An earlier design carried a
|
|
94
|
+
`--home DIR` flag, which had to be remembered on the three verbs that offered it
|
|
95
|
+
and forgotten on every other one — a flag whose whole job was to name a location
|
|
96
|
+
the env var already named. `$OKF_HOME` composes where a flag cannot: it reaches
|
|
97
|
+
every verb at once without being typed, it survives into a subprocess, and if the
|
|
98
|
+
directory ever holds more than `registry.json` it keeps meaning the same thing.
|
|
99
|
+
`OKF_NO_DISCOVERY` earns its keep the same way, and this is still why there is no
|
|
100
|
+
`--global` on `lint`, on `search`, or on the eleven others: a per-verb flag for
|
|
101
|
+
resolution would be fourteen places to thread it and fourteen to forget.
|
|
102
|
+
|
|
103
|
+
The `registry` umbrella is the exception, and the line is *subject*, not
|
|
104
|
+
convenience. Every other verb takes a bundle and merely happens to resolve a name
|
|
105
|
+
through a registry; `registry`'s argument **is** a registry file. Saying which one
|
|
106
|
+
is therefore an argument to that verb in the way `--as` is, not a lever bolted
|
|
107
|
+
across the CLI — so `-g`/`--global` lives on its subcommands (all but `init`,
|
|
108
|
+
whose whole job is to create a *local* file) and nowhere else. The env var is
|
|
109
|
+
still the right answer for a whole session or a CI job; the flag is the right
|
|
110
|
+
answer for one command, and for the plain fact that a capability reachable only
|
|
111
|
+
through an env var is one most people never discover. Both name the same
|
|
112
|
+
behavior, so neither can drift from the other.
|
|
92
113
|
|
|
93
114
|
# Every output names its bundle, in the identity the caller used
|
|
94
115
|
|
|
@@ -111,7 +111,12 @@ real root (`Path.under?` is the pure decision, the I/O stays in the shell), and
|
|
|
111
111
|
reads from the *resolved* path so a swap cannot slip between the check and the
|
|
112
112
|
open. An escaping file is quarantined like any unreadable one, so one planted
|
|
113
113
|
link cannot take a whole bundle down, and an escaping or vanished concept reads
|
|
114
|
-
as a plain not-found rather than an error naming the target.
|
|
114
|
+
as a plain not-found rather than an error naming the target. The references
|
|
115
|
+
inventory asks the same primitive before it lists a file, and before it calls
|
|
116
|
+
a pointer's target present: it reads no bytes, but a `references` directory
|
|
117
|
+
that is a link would otherwise put names from outside the root on the page as
|
|
118
|
+
the bundle's own, and a pointer through a link out of the root would pass as
|
|
119
|
+
found.
|
|
115
120
|
<!-- rule:okf-realpath-contains-reads -->
|
|
116
121
|
|
|
117
122
|
The durable half is the rule the old comments claimed and did not hold: **a
|
data/.okf/log.md
CHANGED
|
@@ -1,5 +1,102 @@
|
|
|
1
1
|
# Update Log
|
|
2
2
|
|
|
3
|
+
## 2026-12-02
|
|
4
|
+
|
|
5
|
+
* **Fix**: the [references inventory](capabilities/read-views.md) has one
|
|
6
|
+
meaning of "in the bundle" — the path exists and its resolved location stays
|
|
7
|
+
inside the root — for what it lists and what it calls missing; the
|
|
8
|
+
leading-slash hint keeps naming only listed files, since the disk also
|
|
9
|
+
answers for a directory or a `..` spelling that climbs out and back in, and
|
|
10
|
+
neither is a fix to suggest. The disk check had followed links, so a pointer
|
|
11
|
+
to a file whose link left the root was neither listed nor reported missing;
|
|
12
|
+
it now dangles, as the reader treats such a file
|
|
13
|
+
([server trust boundary](design/server-trust-boundary.md)). A root
|
|
14
|
+
`references` that is itself a link into the bundle lists nothing, since the
|
|
15
|
+
inventory walks no directory link, but pointers through it still resolve.
|
|
16
|
+
|
|
17
|
+
## 2026-12-01
|
|
18
|
+
|
|
19
|
+
* **Fix**: the [references inventory](capabilities/read-views.md) reads a
|
|
20
|
+
`references/` directory at any depth. It globbed only the root's, so a nested
|
|
21
|
+
`computations/references/` was invisible, and a bare pointer resolving into it
|
|
22
|
+
(§6.2, relative to the concept) was reported missing while the file sat there.
|
|
23
|
+
§6.3 names the subdirectory without placing it; the root was never special.
|
|
24
|
+
* **Fix**: the inventory asks `SafeRead` before listing a file and walks real
|
|
25
|
+
directories only, as the reader does, so a `references` link out of the root
|
|
26
|
+
no longer lists outside names as the bundle's
|
|
27
|
+
([server trust boundary](design/server-trust-boundary.md)) and a link within
|
|
28
|
+
it no longer lists files twice. A pointer that escapes the root is not counted
|
|
29
|
+
as a dangling references/ pointer; one whose `..` stays inside still is.
|
|
30
|
+
* **Fix**: one predicate, `Bundle::References.inside?`, now decides what counts
|
|
31
|
+
as references/ for both the glob filter and the dangling check, so a
|
|
32
|
+
case-insensitive filesystem cannot make them disagree. Pointers are cleaned of
|
|
33
|
+
`.` and `..` once, before the lookup. What is listed and what is missing are
|
|
34
|
+
now separate questions: the shell hands the model a way to ask the disk, so a
|
|
35
|
+
pointer to a path the inventory leaves out but that still opens (hidden,
|
|
36
|
+
behind a directory link, a directory) is not reported missing.
|
|
37
|
+
|
|
38
|
+
## 2026-08-22
|
|
39
|
+
|
|
40
|
+
* **The registry can now take a row out of another registry file, and the
|
|
41
|
+
project-local file has a shorter name.** [`registry
|
|
42
|
+
import`](/registry.md#import-the-copy-that-owns-what-it-takes) is the opposite
|
|
43
|
+
trade from `link`: a link holds a live pointer to a whole file and the other
|
|
44
|
+
side keeps owning what it lends, while an import copies chosen references and
|
|
45
|
+
hands over ownership. Both are needed because they answer different questions —
|
|
46
|
+
"compose that repository's curation" against "I want *that one bundle*, here,
|
|
47
|
+
as mine". Without it the second had one answer: read the path out of `okf
|
|
48
|
+
registry list -g` and retype it into `registry set`, laundering through the
|
|
49
|
+
clipboard information already on screen.
|
|
50
|
+
|
|
51
|
+
Three decisions did the work. The source is `--from`, not a second meaning for
|
|
52
|
+
`-g`, because `-g` names the registry acted *on* across all ten sibling
|
|
53
|
+
subcommands and a verb that names two files should name the second rather than
|
|
54
|
+
invert the first. Slugs are preserved and a collision **refuses**, which is
|
|
55
|
+
where import and link deliberately disagree: a linked name was never chosen
|
|
56
|
+
here so `link_slug` mints around it, an imported one was typed so the "never
|
|
57
|
+
substitute a name you chose" rule applies in full. And a group brings the
|
|
58
|
+
groups nested inside it, because recreating a name here that resolved to a
|
|
59
|
+
larger set there is that same substitution with nothing on screen to reveal it.
|
|
60
|
+
Everything is validated before anything is written, so an import lands whole or
|
|
61
|
+
leaves the file byte-for-byte alone — a refusal that already moved three of four
|
|
62
|
+
rows is not a refusal.
|
|
63
|
+
|
|
64
|
+
* **`.okf.json` is the project-local registry's name; `.okf-registry.json` is
|
|
65
|
+
still discovered.** The file is committed, so retiring the old name outright
|
|
66
|
+
would break every repository carrying one to save eight characters. Both are
|
|
67
|
+
checked *per directory* on the way up rather than one name swept to the root
|
|
68
|
+
and then the other, or a legacy file at a repo root would beat a `.okf.json`
|
|
69
|
+
two levels down and "the nearest one wins" would quietly mean something else.
|
|
70
|
+
The deprecation note is the `registry` umbrella's alone — the one verb whose
|
|
71
|
+
subject is a registry file, and the one nobody runs in a loop or pipes into
|
|
72
|
+
something else, which is exactly what `lint` and `search` are.
|
|
73
|
+
|
|
74
|
+
## 2026-08-21
|
|
75
|
+
|
|
76
|
+
* **The [registry](/registry.md) composes other registry files, and its umbrella
|
|
77
|
+
grew a `-g`.** A repository that curates its own bundles — this one commits a
|
|
78
|
+
`.okf-registry.json` naming five — could not lend that curation to `~/.okf`
|
|
79
|
+
without registering every row again by hand and re-syncing forever. `okf
|
|
80
|
+
registry link <name> <file>` points the global registry at the file instead:
|
|
81
|
+
its bundles resolve here at read time under their own slugs, `@<name>` is the
|
|
82
|
+
set, and nothing is copied, so the target goes on owning its rows. Two
|
|
83
|
+
restrictions carry the whole design. Only the *global* registry follows links,
|
|
84
|
+
which makes depth one structural rather than enforced — a linked file's own
|
|
85
|
+
links are never read, so no chain forms and there is no cycle to detect. And a
|
|
86
|
+
link is read-only: `rename`, `del`, `default`, `set --as` and `group` all
|
|
87
|
+
refuse a slug it owns, from the `⚙ Bundles` panel as from the terminal, because
|
|
88
|
+
the guard lives in the model rather than in the [CLI](/cli.md).
|
|
89
|
+
|
|
90
|
+
A linked name is minted around a collision rather than refused (`central` →
|
|
91
|
+
`onm-central`), which is the "implicit is forgiving" rule reaching a name this
|
|
92
|
+
registry did not choose — and it is the design's one *computed* slug, so
|
|
93
|
+
`registry list` prints the moved row with the name it carries in its source
|
|
94
|
+
file. `-g`/`--global` is the smaller half: `OKF_NO_DISCOVERY=1` already forced
|
|
95
|
+
the global registry, but a lever reachable only through an env var is one most
|
|
96
|
+
people never find. It is the `registry` umbrella's alone — the one verb whose
|
|
97
|
+
subject *is* a registry file — so [the env-var rule](/cli.md#one-lever-not-two)
|
|
98
|
+
keeps its scope rather than losing its edge.
|
|
99
|
+
|
|
3
100
|
## 2026-08-19
|
|
4
101
|
|
|
5
102
|
* **This bundle became okf's own, and holds everything about okf.** It began the
|
data/.okf/registry.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: Component
|
|
3
3
|
title: The bundle registry
|
|
4
|
-
description: An ordered list of bundle references persisted as JSON — global under $OKF_HOME, or project-local via `okf registry init` and discovered from the working directory — the kernel behind a bare `okf server`.
|
|
4
|
+
description: An ordered list of bundle references persisted as JSON — global under $OKF_HOME, or project-local via `okf registry init` and discovered from the working directory, composable through links to other registry files and able to import rows out of them — the kernel behind a bare `okf server`.
|
|
5
5
|
resource: gems/okf/lib/okf/registry.rb
|
|
6
6
|
tags: [cli, shell, registry]
|
|
7
7
|
generated:
|
|
@@ -217,7 +217,7 @@ a per-user file, and locking would buy nothing worth the complexity.
|
|
|
217
217
|
|
|
218
218
|
The registry has two homes, and which one answers is decided by *where you stand*,
|
|
219
219
|
not by a flag. The global one is the `$OKF_HOME/registry.json` above — one per
|
|
220
|
-
user, shared across every repo. The project-local one is a `.okf
|
|
220
|
+
user, shared across every repo. The project-local one is a `.okf.json`
|
|
221
221
|
that `okf registry init` drops in a directory; okf finds it by walking up from the
|
|
222
222
|
working directory, and while you are inside its tree it **replaces** the global one
|
|
223
223
|
— every registry op, and every [`@slug`](cli.md), resolves through it. So a bare
|
|
@@ -238,12 +238,36 @@ users who set up a project registry. The escape hatch is therefore a per-invocat
|
|
|
238
238
|
signal, not a second sticky variable — `OKF_NO_DISCOVERY=1`, set inline, forces the
|
|
239
239
|
global registry for a fixed-cwd caller (CI, a tool) that cannot just `cd` out.
|
|
240
240
|
|
|
241
|
+
That file was called `.okf-registry.json` first, and both names are still
|
|
242
|
+
discovered — a local registry is *committed*, so retiring the old one outright
|
|
243
|
+
would break every repository carrying it to save eight characters. The two are
|
|
244
|
+
checked **per directory** on the way up, not one name swept to the root and then
|
|
245
|
+
the other: otherwise a legacy file at a repo's root would beat a `.okf.json` two
|
|
246
|
+
levels down, and "the nearest one wins" would quietly mean something else. Inside
|
|
247
|
+
one directory the short name wins.
|
|
248
|
+
|
|
249
|
+
The deprecation is said **once, by the `registry` umbrella, and nowhere else**.
|
|
250
|
+
That verb is the one whose subject *is* a registry file and the one nobody runs in
|
|
251
|
+
a loop or pipes into something, which is exactly what `lint` and `search` are — a
|
|
252
|
+
note there is noise people learn to redirect away rather than act on. A legacy
|
|
253
|
+
file that is in force gets the one move that retires it; a legacy file sitting
|
|
254
|
+
beside the `.okf.json` that beat it gets named too, because reading one while the
|
|
255
|
+
other lies there unread is a silent wrong answer unless somebody says so.
|
|
256
|
+
|
|
257
|
+
`-g`/`--global` is that same signal spelled as an argument, and it is the
|
|
258
|
+
`registry` umbrella's alone (see [the CLI](cli.md#one-lever-not-two)). It exists
|
|
259
|
+
because a lever reachable only through an env var is a lever most users never
|
|
260
|
+
find — and the umbrella is the one verb whose *subject* is a registry file, so
|
|
261
|
+
naming which file to act on is an argument to it rather than a flag bolted onto
|
|
262
|
+
fourteen unrelated verbs. `init` is the exception that proves it: its whole job is
|
|
263
|
+
to create a *local* file, so `-g` there names nothing and is refused.
|
|
264
|
+
|
|
241
265
|
# A project-local registry stores portable paths
|
|
242
266
|
|
|
243
267
|
The global registry stores absolute paths — correct for `~/.okf`, whose bundles
|
|
244
268
|
are scattered across the disk with no shared anchor. A committed project registry
|
|
245
269
|
needs the opposite: a bundle **inside** the registry's own tree is stored *relative*
|
|
246
|
-
to the `.okf
|
|
270
|
+
to the `.okf.json`, so the file travels with the repo — a checkout on
|
|
247
271
|
another machine, or a container mounting it, resolves the same bundles unchanged. A
|
|
248
272
|
bundle **outside** the tree keeps an absolute path, because a relative path that
|
|
249
273
|
climbs out cannot be re-anchored anywhere useful, and being honest that it will not
|
|
@@ -257,6 +281,149 @@ existing absolute local entry migrates to relative on its next write: a registry
|
|
|
257
281
|
written before this existed heals itself the first time it changes.
|
|
258
282
|
<!-- rule:okf-registry-local-discovery -->
|
|
259
283
|
|
|
284
|
+
# Links: the global registry composes other registry files
|
|
285
|
+
|
|
286
|
+
A **link** is a pointer from the global registry to another registry file. That
|
|
287
|
+
file's bundles resolve through the pointer at read time, under their own slugs,
|
|
288
|
+
and nothing is copied — the same "stores references, never content" rule the
|
|
289
|
+
entries keep, one level up. `okf registry link onm ~/ONM/registry.json` and
|
|
290
|
+
`@onm-central` (or whatever slugs that file holds) answer here; the link name
|
|
291
|
+
itself resolves as a group over exactly its bundles, so `@onm` is the set.
|
|
292
|
+
|
|
293
|
+
The case it exists for is **a repository that already curates its own bundles**.
|
|
294
|
+
This repo commits a `.okf.json` naming five; before links, using them
|
|
295
|
+
from `~/.okf` meant registering all five again by hand and re-syncing whenever
|
|
296
|
+
the repo's list changed. A link points at the file the repo already maintains, so
|
|
297
|
+
the curation is composed rather than duplicated, and it keeps resolving its own
|
|
298
|
+
relative paths because the target is anchored on its own directory — exactly as
|
|
299
|
+
it would from inside that checkout. Two registry files stop being two worlds you
|
|
300
|
+
switch `$OKF_HOME` between and become one view.
|
|
301
|
+
|
|
302
|
+
**Only the global registry follows links.** A project-local one parses them and
|
|
303
|
+
preserves them across a write, but never resolves them — and that single
|
|
304
|
+
restriction is the whole depth rule. A linked file's own links are not read, so
|
|
305
|
+
no chain forms, no prefix compounds, and there is no cycle to detect. The
|
|
306
|
+
alternative was transitive resolution, and it fails on ownership rather than on
|
|
307
|
+
effort: the target is a file this registry does not own, so a cycle-check at
|
|
308
|
+
write time goes stale the moment someone adds a link back on the other side.
|
|
309
|
+
Transitivity would move cycle detection from write time — cheap, one file,
|
|
310
|
+
refusable — to read time, across N files, with nobody to blame. The groups above
|
|
311
|
+
nest safely for exactly the reason links do not: every member lives in one file,
|
|
312
|
+
behind one guard.
|
|
313
|
+
<!-- rule:okf-registry-links-global-only -->
|
|
314
|
+
|
|
315
|
+
# A linked name is minted around a collision, never refused
|
|
316
|
+
|
|
317
|
+
A slug arriving from a linked file answers to itself when the name is free, and
|
|
318
|
+
to `<link>-<slug>` when it is not (`-2` beyond that, through the same `dedupe` a
|
|
319
|
+
basename goes through). That is the [implicit is forgiving, explicit is
|
|
320
|
+
strict](#slugs-implicit-is-forgiving-explicit-is-strict) table one row wider, and
|
|
321
|
+
the row falls on the forgiving side for the reason the table gives: a name in
|
|
322
|
+
someone else's file was never *chosen* here, so inventing around it is licensed —
|
|
323
|
+
while refusing would let one foreign row take down an entire link. The link
|
|
324
|
+
*name* is the strict half, and is refused on collision like any `--as`: you typed
|
|
325
|
+
that one.
|
|
326
|
+
|
|
327
|
+
Precedence is fixed so the derivation is reproducible: the registry's own bundles
|
|
328
|
+
always win the bare name, and between links the file's order decides. Both are
|
|
329
|
+
position, which is state the registry already keeps — the same reason the
|
|
330
|
+
[default](#the-default-is-a-position-not-a-stored-name) is one.
|
|
331
|
+
|
|
332
|
+
What this costs, and it is the design's one genuinely computed name: a slug can
|
|
333
|
+
*move* when an unrelated link is added. Everything else in this file is stable in
|
|
334
|
+
the file. The mitigation is disclosure rather than a mechanism — `registry link`
|
|
335
|
+
says what it moved as it writes, and `registry list` prints the moved row with the
|
|
336
|
+
slug it carries in its source file (`onm-central … [central]`), which is the only
|
|
337
|
+
place a shifted ref is visible. Linked entries also append **after** the local
|
|
338
|
+
ones, so while this registry owns any bundle at all the default stays local.
|
|
339
|
+
|
|
340
|
+
**A linked group is listed with the rest, not beside them.** `groups_listing`
|
|
341
|
+
returns this registry's own groups first, then the linked ones, each carrying the
|
|
342
|
+
`link` it came from — one list, because `group?` *resolves* a linked group and a
|
|
343
|
+
listing that named only the local half would answer about a smaller set than the
|
|
344
|
+
same object can resolve. That gap is invisible at the call site and inherited by
|
|
345
|
+
every consumer: `okf-mcp`'s `list_bundles` and the TUI's groups view both read
|
|
346
|
+
this one method, and both would have hidden a group they could already open. A
|
|
347
|
+
caller that wants only the groups it may edit filters on `link` — which is the
|
|
348
|
+
question they are actually asking, and it is now askable.
|
|
349
|
+
|
|
350
|
+
# A link is read-only, and the refusal lives in the model
|
|
351
|
+
|
|
352
|
+
`rename`, `del`, `default`, `set --as` and `group` all refuse a slug a link owns,
|
|
353
|
+
with a message naming the file that does own it and the `unlink` that would drop
|
|
354
|
+
it. Two of those are worth their own line. A **group** may not hold a linked slug:
|
|
355
|
+
a group stores names, and a linked name lives only while its link resolves, so
|
|
356
|
+
holding one would dangle the group the moment the link goes — the foreign key the
|
|
357
|
+
default rule already refused. And **`registry set` on a directory a link already
|
|
358
|
+
carries** is refused rather than quietly adding a twin, because entries are
|
|
359
|
+
identified by path and the path is already spoken for.
|
|
360
|
+
|
|
361
|
+
The third was a hole this rule had left open, and it failed in the worst
|
|
362
|
+
available way. A group's slug is its *update* path everywhere else — `registry
|
|
363
|
+
group backend @more` adds to the existing one — so `group onm @alpha`, naming a
|
|
364
|
+
link or a group that came with one, took that path: it merged the member, printed
|
|
365
|
+
`grouped onm → …`, and lost it, because `write` persists only the groups this
|
|
366
|
+
registry owns. A refusal is the fix, but the shape is what matters: a write that
|
|
367
|
+
reports success and does not happen is worse than one that raises, and it was
|
|
368
|
+
reachable from the CLI, the TUI and the browser panel alike.
|
|
369
|
+
|
|
370
|
+
The refusals live in this class, not in the [CLI](cli.md), and that placement is
|
|
371
|
+
load-bearing: the graph page's ⚙ Bundles panel posts into these same methods
|
|
372
|
+
([bundles manager](capabilities/bundles-manager.md)), so a guard one layer up
|
|
373
|
+
would leave the browser doing what the terminal refuses. A link whose target has
|
|
374
|
+
gone or cannot be parsed is *reported* — `(missing)`, `(unreadable)` — and
|
|
375
|
+
resolves to nothing, the same tolerance a vanished bundle directory gets, because
|
|
376
|
+
one dead pointer must not take down the registry that holds it.
|
|
377
|
+
|
|
378
|
+
# Import: the copy that owns what it takes
|
|
379
|
+
|
|
380
|
+
`okf registry import <@slug…>` copies chosen bundles — and the groups that hold
|
|
381
|
+
them — out of another registry file into the one in force. It is the **opposite
|
|
382
|
+
trade** from a link, and the pair is the point:
|
|
383
|
+
|
|
384
|
+
| | link | import |
|
|
385
|
+
| --- | --- | --- |
|
|
386
|
+
| what moves | nothing; a pointer | the reference, copied |
|
|
387
|
+
| scope | the whole target file | the slugs you name |
|
|
388
|
+
| ownership | the target keeps it, read-only | yours, editable |
|
|
389
|
+
| freshness | live on every read | a snapshot |
|
|
390
|
+
|
|
391
|
+
Copying a *reference* is not copying content, so the rule at the top of this file
|
|
392
|
+
still holds: the bundle stays in the repository that owns it, and what lands here
|
|
393
|
+
is the same path-and-name row `registry set` would have written. What import saves
|
|
394
|
+
is the laundering. The scenario is standing inside a repo, running `okf registry
|
|
395
|
+
list -g` to see what the global registry holds, and wanting one of them here — the
|
|
396
|
+
path is already on screen, and without this verb the only way to move it is
|
|
397
|
+
through the clipboard.
|
|
398
|
+
|
|
399
|
+
The source is `--from`, defaulting to the global registry, which inside a repo is
|
|
400
|
+
the only other one you have. It is a second flag rather than a second meaning for
|
|
401
|
+
`-g` because [`-g` names the registry acted *on*](cli.md#one-lever-not-two) on
|
|
402
|
+
every other subcommand; this verb names two files, so the second gets its own
|
|
403
|
+
name rather than inverting the first.
|
|
404
|
+
|
|
405
|
+
**A collision refuses.** This is where import and link disagree, and the
|
|
406
|
+
disagreement is the slug rule, not an inconsistency: a linked name was never
|
|
407
|
+
chosen here, so it is [minted around](#a-linked-name-is-minted-around-a-collision-never-refused);
|
|
408
|
+
an imported name lands in *this* file because you typed it, so it is refused
|
|
409
|
+
exactly as `rename` refuses. The gem may invent a name it made up; it may not
|
|
410
|
+
substitute one you chose. A bundle already registered here under a different name
|
|
411
|
+
refuses too, and *first* — when both are true, "that bundle is already here as
|
|
412
|
+
@docs" is the answer and "the name is taken" is only the symptom.
|
|
413
|
+
|
|
414
|
+
**A group brings everything it reaches**, including a group nested inside it.
|
|
415
|
+
Recreating a name here that resolved to a larger set there would be that same
|
|
416
|
+
quiet substitution, with nothing on screen to reveal it. Members are stored
|
|
417
|
+
verbatim, which is the payoff of preserving slugs: a name means the same thing on
|
|
418
|
+
both sides, so there is nothing to remap — the work `fold_linked_bundles` must do
|
|
419
|
+
precisely because a link mints its names.
|
|
420
|
+
|
|
421
|
+
**Nothing is applied until everything is checked.** Every ask is resolved and
|
|
422
|
+
refused against the current state first, then one `write` publishes the lot. Half
|
|
423
|
+
an import is a registry the user has to unpick by hand, reported as a success —
|
|
424
|
+
and a refusal that already moved three of four rows is not a refusal.
|
|
425
|
+
<!-- rule:okf-registry-import-all-or-nothing -->
|
|
426
|
+
|
|
260
427
|
# It costs an embedding app nothing
|
|
261
428
|
|
|
262
429
|
`require "okf"` does not load it. The registry is reached only from the
|
data/.okf/structure/the-cli.md
CHANGED
|
@@ -23,7 +23,7 @@ And one file per verb, each registering itself at load:
|
|
|
23
23
|
| `lib/okf/cli/skill.rb` | `skill` |
|
|
24
24
|
| `lib/okf/cli/server.rb` | `server` |
|
|
25
25
|
| `lib/okf/cli/render.rb` | `render` |
|
|
26
|
-
| `lib/okf/cli/registry.rb` | `registry` and its
|
|
26
|
+
| `lib/okf/cli/registry.rb` | `registry` and its eleven subcommands |
|
|
27
27
|
| `lib/okf/cli/lint.rb` | `lint` |
|
|
28
28
|
| `lib/okf/cli/loose.rb` | `loose` |
|
|
29
29
|
| `lib/okf/cli/validate.rb` | `validate` |
|
|
@@ -50,17 +50,26 @@ logic belongs instead.
|
|
|
50
50
|
|
|
51
51
|
`Registry` is the `@slug` layer. `HOME_ENV`/`DEFAULT_HOME` is the global
|
|
52
52
|
registry under `$OKF_HOME` (default `~/.okf`); `LOCAL_FILE` is the project-local
|
|
53
|
-
`.okf-registry.json` that `discover` finds by walking up from the working
|
|
53
|
+
`.okf.json` (or the legacy `.okf-registry.json`) that `discover` finds by walking up from the working
|
|
54
54
|
directory. **A discovered local registry replaces the global one outright** — it
|
|
55
55
|
does not merge — and `NO_DISCOVERY_ENV` (`OKF_NO_DISCOVERY=1`) is the escape
|
|
56
56
|
hatch that forces the global one, which is what a test that must not see the
|
|
57
|
-
developer's registry sets.
|
|
57
|
+
developer's registry sets. `Registry.load`'s `follow_links:` is the same
|
|
58
|
+
decision one step further: it is true only for the global registry, so a local
|
|
59
|
+
one parses links and never resolves them.
|
|
58
60
|
|
|
59
61
|
`relative_base` is why a local registry's paths stay relative and the file
|
|
60
62
|
travels with the repository. `Registry#reopen` preserves it; `Registry.new(path)`
|
|
61
63
|
does not, and reaching for the latter is how a reload comes to resolve every
|
|
62
64
|
bundle against the wrong base.
|
|
63
65
|
|
|
66
|
+
`Link` points the global registry at another registry file; `resolve_links`
|
|
67
|
+
folds that file's bundles in (through `link_slug`, which prefixes only on a
|
|
68
|
+
collision) and `refuse_linked` is the single guard every write goes through —
|
|
69
|
+
here rather than in the CLI, because the server's bundles panel calls these same
|
|
70
|
+
methods. `open_linked` constructs the target with `follow_links: false`, which is
|
|
71
|
+
the whole of the depth rule.
|
|
72
|
+
|
|
64
73
|
`Group` is a named, recursive set of bundles. `RESERVED_SLUGS` is `all`, because
|
|
65
74
|
`@all` means every bundle and may not be shadowed. `slugify`, `dedupe`,
|
|
66
75
|
`normalize` and `path_shaped?` are the naming rules a `registry set` goes
|
data/.okf/structure/the-model.md
CHANGED
|
@@ -71,8 +71,8 @@ the payload the graph page embeds is not the payload `okf graph --json` prints.
|
|
|
71
71
|
`suggested_cut` — the weight at which the arc diagram stops being a hairball.
|
|
72
72
|
`cuts_for` maps that back onto concrete edges.
|
|
73
73
|
|
|
74
|
-
`References` inventories
|
|
75
|
-
file, including the dangling ones.
|
|
74
|
+
`References` inventories every `references/` folder, at any depth, and the
|
|
75
|
+
concepts citing each file, including the dangling ones.
|
|
76
76
|
|
|
77
77
|
`RowFilter.matches?` is the *single* predicate behind every `--type`, `--dir`,
|
|
78
78
|
`--tag`, `--status` and `--trust` filter in the CLI, the server and the TUI.
|
|
@@ -11,7 +11,7 @@ resource: lib/okf/cli/command.rb
|
|
|
11
11
|
|
|
12
12
|
# Before adding one, check it is not already there
|
|
13
13
|
|
|
14
|
-
Seventeen commands and
|
|
14
|
+
Seventeen commands and eleven subcommands already exist, catalogued in
|
|
15
15
|
[cli](/cli.md) and [read-views](/capabilities/read-views.md), and `okf help`
|
|
16
16
|
prints the same list. Most of what a new verb would want is a *flag* on an
|
|
17
17
|
existing view rather than a view of its own: the shared filters and projections
|