okf 2.2.0 → 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/read-views.md +24 -5
- data/.okf/design/server-trust-boundary.md +6 -1
- data/.okf/log.md +35 -0
- data/.okf/structure/the-model.md +2 -2
- data/CHANGELOG.md +37 -0
- data/lib/okf/bundle/folder.rb +29 -11
- data/lib/okf/bundle/references.rb +47 -34
- data/lib/okf/cli/references.rb +8 -8
- data/lib/okf/skill/reference/authoring.md +4 -2
- data/lib/okf/skill/reference/cli/checks.md +10 -7
- 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
|
|
@@ -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,
|
|
@@ -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,40 @@
|
|
|
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
|
+
|
|
3
38
|
## 2026-08-22
|
|
4
39
|
|
|
5
40
|
* **The registry can now take a row out of another registry file, and the
|
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.
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,43 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.1] - 2026-12-02
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`okf references` sees a `references/` directory at any depth, not only at
|
|
13
|
+
the bundle root.** §6.3 names the subdirectory without placing it, but the
|
|
14
|
+
inventory globbed only `<root>/references/`. A bundle keeping
|
|
15
|
+
`computations/references/` got those files left out, and worse, a bare
|
|
16
|
+
`references/attesters/rev.py` from `computations/revenue.md` — which §6.2
|
|
17
|
+
resolves into that directory, where the file sat — was reported as dangling
|
|
18
|
+
with "which does not exist". The same fix reaches the MCP `references` tool,
|
|
19
|
+
which reads the same inventory.
|
|
20
|
+
- **`okf references` no longer lists a file whose symlink target is outside the
|
|
21
|
+
bundle, and does not walk a directory symlink.** The inventory now asks
|
|
22
|
+
`SafeRead` before listing, the containment check the reader already applies,
|
|
23
|
+
and like the reader it walks real directories only. A `references` directory
|
|
24
|
+
that was a link out of the root put outside names on the page as the
|
|
25
|
+
bundle's own — at the root in 2.2.0, and at any depth once the inventory
|
|
26
|
+
reached every level; a directory link within the root listed its files
|
|
27
|
+
twice. A root
|
|
28
|
+
`references` that is itself a link to another directory in the bundle now
|
|
29
|
+
lists nothing, though pointers through it still resolve.
|
|
30
|
+
- **`okf references` calls a pointer dangling only when nothing in the bundle
|
|
31
|
+
exists at its path.** The inventory leaves out paths that still open — hidden
|
|
32
|
+
ones, files behind a directory link, directories — and missing used to mean
|
|
33
|
+
"not in the inventory", so a pointer to any of those read "which does not
|
|
34
|
+
exist". The disk is now asked instead, through the same containment check:
|
|
35
|
+
a pointer to a file whose link leads out of the root dangles, as the reader
|
|
36
|
+
treats that file. The leading-slash hint still names only a file the
|
|
37
|
+
inventory lists.
|
|
38
|
+
- **`okf references` reads a pointer the way it reads the disk.** A pointer is
|
|
39
|
+
cleaned of `.` and `..` before it is looked up, so `/references/./x.py` cites
|
|
40
|
+
the file instead of dangling, and `./references/x.py` from a subdirectory
|
|
41
|
+
gets the leading-slash hint. Only a directory named exactly `references`
|
|
42
|
+
counts, so macOS no longer lists a `References/` that Linux does not. The
|
|
43
|
+
text hint no longer prints the pointer's `#fragment` as part of a file name.
|
|
44
|
+
|
|
8
45
|
## [2.2.0] - 2026-08-22
|
|
9
46
|
|
|
10
47
|
### Added
|
data/lib/okf/bundle/folder.rb
CHANGED
|
@@ -71,11 +71,12 @@ module OKF
|
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
# The §6.3 inventory — this handle's half is the disk: the reader models
|
|
74
|
-
# only markdown, so listing `references/` here is how a .py
|
|
75
|
-
# .sql computation becomes visible at all.
|
|
76
|
-
# manifest and answers the rest (citers, dangling pointers).
|
|
74
|
+
# only markdown, so listing `references/` files here is how a .py
|
|
75
|
+
# attester or a .sql computation becomes visible at all.
|
|
77
76
|
def references
|
|
78
|
-
|
|
77
|
+
real_root = File.realpath(@root) if Dir.exist?(@root)
|
|
78
|
+
Bundle::References.build(@bundle, files: reference_files(real_root),
|
|
79
|
+
present: ->(relative) { contained?(relative, real_root) })
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
# Every log.md with its content, root scope first — read live from disk so a
|
|
@@ -155,16 +156,33 @@ module OKF
|
|
|
155
156
|
|
|
156
157
|
private
|
|
157
158
|
|
|
158
|
-
# Bundle-relative paths of every file under references
|
|
159
|
-
#
|
|
160
|
-
#
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
# Bundle-relative paths of every file under a references/ directory at
|
|
160
|
+
# any depth, sorted — §6.3 names the subdirectory, not where it sits;
|
|
161
|
+
# membership is References.inside?'s call. The glob is the reader's own
|
|
162
|
+
# `**`, which walks no hidden directory and no directory link, so a link
|
|
163
|
+
# can neither list names from outside the root nor list a file twice.
|
|
164
|
+
def reference_files(real_root)
|
|
165
|
+
return [] unless real_root
|
|
166
|
+
|
|
167
|
+
root = Pathname.new(@root)
|
|
168
|
+
Dir.glob(File.join(@root, "**", "*"))
|
|
169
|
+
.select { |path| path.include?("/references/") } # cheap cut before the Pathname work
|
|
170
|
+
.map { |path| Pathname.new(path).relative_path_from(root).to_s }
|
|
171
|
+
.select { |relative| Bundle::References.inside?(relative) }
|
|
172
|
+
.select { |relative| File.file?(File.join(@root, relative)) && contained?(relative, real_root) }
|
|
165
173
|
.sort
|
|
166
174
|
end
|
|
167
175
|
|
|
176
|
+
# Whether +relative+ exists and its resolved location stays inside the
|
|
177
|
+
# root — the inventory's one meaning of "in the bundle", for what it lists
|
|
178
|
+
# and for what it calls missing, since the reader keeps a link only then.
|
|
179
|
+
def contained?(relative, real_root)
|
|
180
|
+
SafeRead.contained_path!(@root, File.join(@root, relative), real_root: real_root)
|
|
181
|
+
true
|
|
182
|
+
rescue Path::Error, SystemCallError
|
|
183
|
+
false
|
|
184
|
+
end
|
|
185
|
+
|
|
168
186
|
def reserved_hash(basename)
|
|
169
187
|
@bundle.reserved
|
|
170
188
|
.select { |entry| File.basename(entry.path) == basename }
|
|
@@ -4,42 +4,64 @@ require "set"
|
|
|
4
4
|
|
|
5
5
|
module OKF
|
|
6
6
|
class Bundle
|
|
7
|
-
# The §6.3 inventory, pure: every file under `references/`
|
|
8
|
-
# the shell as +files+, because the reader models
|
|
9
|
-
# performs no disk access — with which concepts
|
|
10
|
-
# §6.2 path-valued fields (resource,
|
|
11
|
-
# executor.resource, attester.resource),
|
|
12
|
-
# `references/` that resolve to nothing.
|
|
7
|
+
# The §6.3 inventory, pure: every file under a `references/` directory at
|
|
8
|
+
# any depth — handed in by the shell as +files+, because the reader models
|
|
9
|
+
# concepts and this model performs no disk access — with which concepts
|
|
10
|
+
# cite each one through the §6.2 path-valued fields (resource,
|
|
11
|
+
# sources[].resource, computation, executor.resource, attester.resource),
|
|
12
|
+
# plus the pointers into a `references/` that resolve to nothing.
|
|
13
13
|
#
|
|
14
14
|
# The bare-path trap is what the dangling list exists to surface: §6.2
|
|
15
|
-
# resolves a bare path relative to the concept, so `references/x`
|
|
16
|
-
#
|
|
17
|
-
#
|
|
15
|
+
# resolves a bare path relative to the concept, so `references/x` from
|
|
16
|
+
# `metrics/` means `metrics/references/x` — right when that directory
|
|
17
|
+
# exists, a silent miss when the author meant the root's. When the missed
|
|
18
|
+
# spelling would have hit with a leading slash, the entry says so.
|
|
18
19
|
#
|
|
19
|
-
# Scope is the
|
|
20
|
-
# requirement", and a computation stored beside its concept
|
|
21
|
-
# and deliberately not this inventory's to list.
|
|
20
|
+
# Scope is the folders, by design. §6.3 is "a naming convention, not a
|
|
21
|
+
# requirement", and a computation stored beside its concept outside any
|
|
22
|
+
# `references/` is legal — and deliberately not this inventory's to list.
|
|
22
23
|
class References
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
# +present+ is the shell's disk check, handed in so this model stays pure:
|
|
25
|
+
# the manifest holds only what the inventory chose to list, so a pointer
|
|
26
|
+
# is dangling only when the disk also says nothing is there.
|
|
27
|
+
def self.build(bundle, files:, present:)
|
|
28
|
+
new(bundle, files: files, present: present)
|
|
25
29
|
end
|
|
26
30
|
|
|
27
|
-
#
|
|
31
|
+
# Whether the clean relative +path+ lies inside a directory named exactly
|
|
32
|
+
# `references`, at whatever depth — the one predicate the shell's listing
|
|
33
|
+
# and the dangling check share, so every filesystem lists the same. A path
|
|
34
|
+
# still starting with `..` has left the root (the resolver returns an
|
|
35
|
+
# escape as written).
|
|
36
|
+
def self.inside?(path)
|
|
37
|
+
segments = path.split("/")
|
|
38
|
+
segments.first != ".." && segments[0...-1].include?("references")
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# A pointer's path as written, fragment dropped and `.`/`..` cleaned —
|
|
42
|
+
# the spelling the leading-slash hint tests at the root.
|
|
43
|
+
def self.bare(raw)
|
|
44
|
+
Pathname.new(raw.to_s.split("#", 2).first.to_s).cleanpath.to_s
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Every inventoried file, sorted by path, each
|
|
28
48
|
# { path:, dir:, kind:, referenced_by: [ { id:, field: } ] } — kind is
|
|
29
49
|
# "concept" when the file is a parsed concept (§6.3 allows both), "file"
|
|
30
50
|
# otherwise. referenced_by is ordered by citing concept id.
|
|
31
51
|
attr_reader :entries
|
|
32
52
|
|
|
33
|
-
# Pointers into references/ that resolve to
|
|
34
|
-
# id then field position, each { id:, field:, raw:, resolved:,
|
|
35
|
-
# hint names the leading-slash fix when the bare spelling
|
|
36
|
-
# root, nil otherwise.
|
|
53
|
+
# Pointers into a references/ that resolve to nothing, ordered by
|
|
54
|
+
# concept id then field position, each { id:, field:, raw:, resolved:,
|
|
55
|
+
# hint: } — hint names the leading-slash fix when the bare spelling, read
|
|
56
|
+
# from the bundle root, names a listed file; nil otherwise. Only the
|
|
57
|
+
# root spelling is tried, not an ancestor directory's references/.
|
|
37
58
|
attr_reader :dangling
|
|
38
59
|
|
|
39
|
-
def initialize(bundle, files:)
|
|
60
|
+
def initialize(bundle, files:, present:)
|
|
40
61
|
@bundle = bundle
|
|
41
62
|
@files = files.sort
|
|
42
63
|
@existing = @files.to_set
|
|
64
|
+
@present = present
|
|
43
65
|
build!
|
|
44
66
|
end
|
|
45
67
|
|
|
@@ -55,9 +77,12 @@ module OKF
|
|
|
55
77
|
target = Markdown::Links.resolve_path(raw, from: concept.path, bundle: @bundle.root)
|
|
56
78
|
next if target.nil? # external, empty, or a directory — not a file pointer
|
|
57
79
|
|
|
80
|
+
# The resolver leaves a leading-slash path as given, so `.` and `..`
|
|
81
|
+
# are cleaned here, once, for the lookup, the citation and the row.
|
|
82
|
+
target = Pathname.new(target).cleanpath.to_s
|
|
58
83
|
if @existing.include?(target)
|
|
59
84
|
(cited[target] ||= []) << { id: concept.id, field: field }
|
|
60
|
-
elsif
|
|
85
|
+
elsif self.class.inside?(target) && !@present.call(target)
|
|
61
86
|
@dangling << dangling_row(concept, field, raw, target)
|
|
62
87
|
end
|
|
63
88
|
end
|
|
@@ -86,20 +111,8 @@ module OKF
|
|
|
86
111
|
fields.reject { |_field, raw| OKF.blank?(raw) }
|
|
87
112
|
end
|
|
88
113
|
|
|
89
|
-
def under_references?(path)
|
|
90
|
-
path.to_s.start_with?("references/")
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
# The bare spelling of the trap: a raw that *names* references/ without
|
|
94
|
-
# the leading slash, which §6.2 resolves relative to the concept. From a
|
|
95
|
-
# subdirectory the resolved path leaves references/, so the target check
|
|
96
|
-
# above no longer sees it — the raw is what still does.
|
|
97
|
-
def bare_references?(raw)
|
|
98
|
-
raw.to_s.split("#", 2).first.to_s.start_with?("references/")
|
|
99
|
-
end
|
|
100
|
-
|
|
101
114
|
def dangling_row(concept, field, raw, target)
|
|
102
|
-
bare =
|
|
115
|
+
bare = self.class.bare(raw)
|
|
103
116
|
hint = nil
|
|
104
117
|
if !bare.start_with?("/") && bare != target && @existing.include?(bare)
|
|
105
118
|
hint = "/#{bare} exists — missing leading slash?"
|
data/lib/okf/cli/references.rb
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module OKF
|
|
4
4
|
class CLI
|
|
5
|
-
# The §6.3 inventory: every file under `references
|
|
6
|
-
# it through the §6.2 path-valued fields, and the pointers
|
|
7
|
-
# `references/` that resolve to nothing — with the leading-slash fix
|
|
8
|
-
# when a bare path written from a subdirectory is what missed. An
|
|
9
|
-
# read (exit 0): what a curator acts on lives in the output, never
|
|
10
|
-
# status.
|
|
5
|
+
# The §6.3 inventory: every file under a `references/` directory, which
|
|
6
|
+
# concepts cite it through the §6.2 path-valued fields, and the pointers
|
|
7
|
+
# into a `references/` that resolve to nothing — with the leading-slash fix
|
|
8
|
+
# named when a bare path written from a subdirectory is what missed. An
|
|
9
|
+
# advisory read (exit 0): what a curator acts on lives in the output, never
|
|
10
|
+
# the status.
|
|
11
11
|
class References < Command
|
|
12
12
|
def self.id
|
|
13
13
|
:references
|
|
@@ -19,7 +19,7 @@ module OKF
|
|
|
19
19
|
|
|
20
20
|
def self.help_rows
|
|
21
21
|
[
|
|
22
|
-
[ "references <dir|@slug> [--json]", "inventory references/ files and the concepts citing them" ]
|
|
22
|
+
[ "references <dir|@slug> [--json]", "inventory references/ files, at any depth, and the concepts citing them" ]
|
|
23
23
|
]
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -77,7 +77,7 @@ module OKF
|
|
|
77
77
|
line = " resolves to #{row[:resolved]}, which does not exist"
|
|
78
78
|
# hint is only ever the leading-slash fix, so the human line can name
|
|
79
79
|
# the spelling that would have hit without restating the sentence.
|
|
80
|
-
line += " — /#{row[:raw]} does (missing leading slash?)" if row[:hint]
|
|
80
|
+
line += " — /#{Bundle::References.bare(row[:raw])} does (missing leading slash?)" if row[:hint]
|
|
81
81
|
@out.puts line
|
|
82
82
|
end
|
|
83
83
|
end
|
|
@@ -75,8 +75,10 @@ resolves from the bundle root wherever the concept sits, which is the same reaso
|
|
|
75
75
|
[links](#links-are-untyped-on-purpose) prefer the absolute form. `lint` catches
|
|
76
76
|
the `.md` cases (`broken_attestation_ref`, `broken_source`); a `.sql` or `.py`
|
|
77
77
|
target is not a concept, so no lint check sees it — `okf references` is the
|
|
78
|
-
surface that does: it lists
|
|
79
|
-
that misses, and names the leading-`/` fix when that
|
|
78
|
+
surface that does: it lists every `references/` directory from disk, nested ones
|
|
79
|
+
included, with every pointer that misses, and names the leading-`/` fix when that
|
|
80
|
+
is the miss. A bare path is right only when you mean a `references/` kept beside
|
|
81
|
+
the concept.
|
|
80
82
|
|
|
81
83
|
### A frontmatter `id` renames the concept, not its home <!-- rule:okf-id-extension -->
|
|
82
84
|
§2 defines the Concept ID as the file's path with `.md` removed, full stop.
|
|
@@ -149,11 +149,13 @@ defect — a terminal leaf (a backlog item, a spec reference) can be loose by de
|
|
|
149
149
|
|
|
150
150
|
## references — the `references/` inventory (§6.3)
|
|
151
151
|
|
|
152
|
-
Lists every file under `references/`
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
152
|
+
Lists every file under a `references/` directory at any depth — the root's and
|
|
153
|
+
any nested one, such as `computations/references/` — including the non-markdown
|
|
154
|
+
ones no other verb can see, since the concept model carries only markdown —
|
|
155
|
+
with which concepts cite each file through the §6.2 path-valued fields
|
|
156
|
+
(`resource`, `sources[].resource`, `computation`, `executor.resource`,
|
|
157
|
+
`attester.resource`), plus every pointer into a `references/` that resolves to
|
|
158
|
+
nothing. Advisory:
|
|
157
159
|
**exits `0`** even with dangling pointers — the findings are the output. JSON:
|
|
158
160
|
`{ bundle, dangling, count, references: [{ path, dir, kind, referenced_by }] }`,
|
|
159
161
|
with `--fields`/`--except` projecting the rows. A file that is itself a concept
|
|
@@ -162,8 +164,9 @@ business and are not counted here.
|
|
|
162
164
|
|
|
163
165
|
**The dangling list is where §6.2's bare-path trap surfaces.** A bare
|
|
164
166
|
`references/attesters/rev.py` written from `metrics/` resolves relative to the
|
|
165
|
-
concept — `metrics/references/attesters/rev.py`,
|
|
166
|
-
|
|
167
|
+
concept — `metrics/references/attesters/rev.py`, which is right when that file
|
|
168
|
+
exists and a miss when the author meant the root's — and when the leading-slash
|
|
169
|
+
spelling would have hit, the entry says so:
|
|
167
170
|
`/references/attesters/rev.py exists — missing leading slash?`. Reach is any
|
|
168
171
|
extension, which is exactly what `broken_source` and `broken_attestation_ref`
|
|
169
172
|
cannot offer (their exemptions above), so run it wherever a bundle carries
|
data/lib/okf/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: okf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.2.
|
|
4
|
+
version: 2.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Serradura
|
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
224
224
|
- !ruby/object:Gem::Version
|
|
225
225
|
version: '0'
|
|
226
226
|
requirements: []
|
|
227
|
-
rubygems_version: 4.0.
|
|
227
|
+
rubygems_version: 4.0.10
|
|
228
228
|
specification_version: 4
|
|
229
229
|
summary: 'The complete Open Knowledge Format toolkit: an agent skill, a CLI and library,
|
|
230
230
|
ranked search, and a live knowledge graph. 100% local.'
|