okf 1.13.0 → 2.1.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +222 -0
  3. data/README.md +34 -11
  4. data/lib/okf/bundle/folder.rb +27 -1
  5. data/lib/okf/bundle/graph.rb +12 -3
  6. data/lib/okf/bundle/linter.rb +470 -47
  7. data/lib/okf/bundle/reader.rb +10 -4
  8. data/lib/okf/bundle/references.rb +111 -0
  9. data/lib/okf/bundle/row_filter.rb +53 -0
  10. data/lib/okf/bundle/search.rb +20 -2
  11. data/lib/okf/bundle/validator/result.rb +6 -3
  12. data/lib/okf/bundle/validator.rb +267 -26
  13. data/lib/okf/bundle/writer.rb +1 -1
  14. data/lib/okf/bundle.rb +105 -4
  15. data/lib/okf/cli/catalog.rb +1 -1
  16. data/lib/okf/cli/command.rb +27 -8
  17. data/lib/okf/cli/files.rb +1 -1
  18. data/lib/okf/cli/index.rb +1 -1
  19. data/lib/okf/cli/lint.rb +70 -12
  20. data/lib/okf/cli/references.rb +97 -0
  21. data/lib/okf/cli/search.rb +2 -1
  22. data/lib/okf/cli/stats.rb +3 -39
  23. data/lib/okf/cli/tags.rb +6 -43
  24. data/lib/okf/cli/types.rb +1 -1
  25. data/lib/okf/cli/validate.rb +3 -3
  26. data/lib/okf/cli.rb +24 -3
  27. data/lib/okf/concept.rb +362 -10
  28. data/lib/okf/markdown/citations.rb +41 -4
  29. data/lib/okf/markdown/frontmatter.rb +1 -1
  30. data/lib/okf/markdown/links.rb +67 -7
  31. data/lib/okf/render/graph/template.html.erb +173 -41
  32. data/lib/okf/render/graph.rb +11 -3
  33. data/lib/okf/server/app.rb +47 -15
  34. data/lib/okf/server/hub.rb +1 -1
  35. data/lib/okf/skill/SKILL.md +28 -18
  36. data/lib/okf/skill/playbooks/curate.md +8 -3
  37. data/lib/okf/skill/playbooks/doctor.md +3 -1
  38. data/lib/okf/skill/playbooks/maintain.md +10 -7
  39. data/lib/okf/skill/playbooks/menu.md +5 -4
  40. data/lib/okf/skill/playbooks/migrate.md +31 -8
  41. data/lib/okf/skill/playbooks/produce.md +20 -11
  42. data/lib/okf/skill/playbooks/search.md +2 -2
  43. data/lib/okf/skill/reference/SPEC.md +739 -187
  44. data/lib/okf/skill/reference/authoring.md +164 -48
  45. data/lib/okf/skill/reference/cli/checks.md +171 -0
  46. data/lib/okf/skill/reference/cli/graph.md +49 -0
  47. data/lib/okf/skill/reference/cli/map.md +98 -0
  48. data/lib/okf/skill/reference/cli/registry.md +70 -0
  49. data/lib/okf/skill/reference/cli/search.md +130 -0
  50. data/lib/okf/skill/reference/cli/serve.md +83 -0
  51. data/lib/okf/skill/reference/cli/views.md +59 -0
  52. data/lib/okf/skill/reference/cli.md +44 -501
  53. data/lib/okf/skill/reference/spec-map.md +32 -0
  54. data/lib/okf/skill/templates/attested-computation.md +41 -0
  55. data/lib/okf/skill/templates/concept.md +13 -6
  56. data/lib/okf/skill/templates/root-index.md +1 -1
  57. data/lib/okf/version.rb +1 -1
  58. data/lib/okf.rb +22 -2
  59. metadata +13 -1
@@ -0,0 +1,41 @@
1
+ ---
2
+ type: Attested Computation
3
+ title: <What the computation answers, e.g. Revenue for fiscal year>
4
+ description: <Single sentence: what this computes and per whose definition.>
5
+ tags: [<tag>]
6
+ runtime: <REQUIRED — what runs it and what parameters mean: bigquery, dbt, python, …>
7
+ parameters:
8
+ - { name: <name>, type: <type>, required: true }
9
+ executor:
10
+ resource: <path to run instructions, e.g. /references/skills/run-on-bq.md>
11
+ receipt: [<field>, <field>]
12
+ attester:
13
+ resource: <path to the deterministic check, e.g. /references/attesters/check.py>
14
+ generated:
15
+ by: <actor per §7>
16
+ at: <ISO 8601>
17
+ sources:
18
+ - id: <stable-key>
19
+ title: <the definition this computation implements>
20
+ resource: <url or path>
21
+ ---
22
+
23
+ # Computation
24
+
25
+ <The sanctioned computation, in one fenced block — OR set `computation: <path>`
26
+ in the frontmatter instead and omit this section entirely (§10.3: a path is
27
+ used *instead of* the fence; providing both leaves a consumer two candidate
28
+ computations and no rule for which was sanctioned).>
29
+
30
+ ```<language>
31
+ <the computation>
32
+ ```
33
+
34
+ <Prose around it may cite sources per claim.[^<stable-key>]>
35
+
36
+ <!-- rule:okf-computation-untouched -->
37
+ <!-- §10.3, v0.2's only new MUST NOT: an agent MAY bind values for the declared
38
+ `parameters` and MUST NOT author or edit the computation itself. The whole
39
+ point of the type is that the computation is sanctioned — reviewed by a
40
+ person — and an improvised or "fixed" query silently loses that status.
41
+ If the computation is wrong, say so to a human; do not repair it. -->
@@ -4,12 +4,23 @@ title: <Human-readable display name>
4
4
  description: <Single sentence summarizing the concept.>
5
5
  resource: <Canonical URI of the underlying asset — omit for abstract concepts>
6
6
  tags: [<tag>, <tag>]
7
- timestamp: <ISO 8601, e.g. 2026-06-14T10:00:00Z>
7
+ generated:
8
+ by: <actor per §7 — human:<id>, process:<id>, or <producer>/<version>>
9
+ at: <ISO 8601, e.g. 2026-06-14T10:00:00Z>
10
+ sources:
11
+ - id: <stable-key-the-body-cites>
12
+ title: <source title>
13
+ resource: <url, bundle-relative path, or scope descriptor>
14
+ # Optional §5 families, when they apply:
15
+ # verified: [{ by: <actor>, at: <ISO 8601> }] — who confirmed the content (a bare mapping reads as a one-element list)
16
+ # status: draft | stable | deprecated — absent means stable
17
+ # stale_after: YYYY-MM-DD — stale on the day itself
8
18
  ---
9
19
 
10
20
  # Overview
11
21
 
12
- <What this concept is and why it matters.>
22
+ <What this concept is and why it matters. Attribute each empirical claim to a
23
+ source by its id: "The events table is sharded daily.[^<stable-key-the-body-cites>]">
13
24
 
14
25
  # Schema
15
26
 
@@ -18,7 +29,3 @@ timestamp: <ISO 8601, e.g. 2026-06-14T10:00:00Z>
18
29
  | Field | Type | Description |
19
30
  |-------|------|-------------|
20
31
  | | | |
21
-
22
- # Citations
23
-
24
- [1] [<source title>](<url>)
@@ -1,5 +1,5 @@
1
1
  ---
2
- okf_version: "0.1"
2
+ okf_version: "0.2"
3
3
  ---
4
4
 
5
5
  # <Directory / Group Heading>
data/lib/okf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OKF
4
- VERSION = "1.13.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/okf.rb CHANGED
@@ -16,7 +16,7 @@ module OKF
16
16
 
17
17
  # Blank in the frontmatter sense: nil, false, an empty/whitespace-only string,
18
18
  # or an empty collection. Numbers and other scalars are never blank. The one
19
- # domain-wide predicate behind "non-empty type" (§9.2) and the recommended-field
19
+ # domain-wide predicate behind "non-empty type" (§11 cond. 2) and the recommended-field
20
20
  # warnings, kept here so the gem needs no ActiveSupport.
21
21
  def self.blank?(value)
22
22
  return true if value.nil? || value == false
@@ -25,6 +25,18 @@ module OKF
25
25
  value.respond_to?(:empty?) ? value.empty? : false
26
26
  end
27
27
 
28
+ # A temporal value as ISO 8601 — the one serialization rule for
29
+ # generated_at/stale_after, shared by the catalog row and /node/meta so the
30
+ # served and baked pages cannot drift over one concept's dates. YAML hands
31
+ # over a Date or a Time for an unquoted value (whose default to_s is not
32
+ # ISO); a String passes through; a degenerate value serializes as its
33
+ # string, never as raw structure.
34
+ def self.iso8601(value)
35
+ return nil if value.nil?
36
+
37
+ value.respond_to?(:iso8601) ? value.iso8601 : value.to_s
38
+ end
39
+
28
40
  # The directory a concept lives in, derived from its §2 id: the id *is* the
29
41
  # path minus `.md`, so putting the suffix back and taking the dirname is the
30
42
  # definition rather than a parse of it. One home for it because three views
@@ -36,11 +48,17 @@ module OKF
36
48
 
37
49
  require "okf/version"
38
50
 
51
+ # The OKF spec version this gem targets — one declaration behind the validate
52
+ # header and its help row, so the version a bundle is judged against cannot
53
+ # be stated two ways. The gem still *reads* v0.1 (§13.1); this is what it
54
+ # validates for. Known readable versions: Concept::KNOWN_SPEC_VERSIONS.
55
+ SPEC_VERSION = "0.2"
56
+
39
57
  # ── kernel: cross-cutting primitives ──
40
58
  require "okf/path"
41
59
  require "okf/safe_read"
42
60
 
43
- # ── Markdown: parse structure out of a markdown document (§4/§5/§8) ──
61
+ # ── Markdown: parse structure out of a markdown document (§4/§6/§5.1) ──
44
62
  require "okf/markdown/frontmatter"
45
63
  require "okf/markdown/links"
46
64
  require "okf/markdown/citations"
@@ -49,6 +67,8 @@ module OKF
49
67
  require "okf/concept"
50
68
  require "okf/bundle"
51
69
  require "okf/bundle/graph"
70
+ require "okf/bundle/references"
71
+ require "okf/bundle/row_filter"
52
72
  require "okf/bundle/skeleton"
53
73
  require "okf/bundle/search"
54
74
  # These two lines ARE the engine preference order. Each engine registers itself
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: 1.13.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
@@ -89,6 +89,8 @@ files:
89
89
  - lib/okf/bundle/linter.rb
90
90
  - lib/okf/bundle/linter/report.rb
91
91
  - lib/okf/bundle/reader.rb
92
+ - lib/okf/bundle/references.rb
93
+ - lib/okf/bundle/row_filter.rb
92
94
  - lib/okf/bundle/search.rb
93
95
  - lib/okf/bundle/search/index.rb
94
96
  - lib/okf/bundle/search/scan.rb
@@ -105,6 +107,7 @@ files:
105
107
  - lib/okf/cli/index.rb
106
108
  - lib/okf/cli/lint.rb
107
109
  - lib/okf/cli/loose.rb
110
+ - lib/okf/cli/references.rb
108
111
  - lib/okf/cli/registry.rb
109
112
  - lib/okf/cli/render.rb
110
113
  - lib/okf/cli/search.rb
@@ -143,6 +146,15 @@ files:
143
146
  - lib/okf/skill/reference/SPEC.md
144
147
  - lib/okf/skill/reference/authoring.md
145
148
  - lib/okf/skill/reference/cli.md
149
+ - lib/okf/skill/reference/cli/checks.md
150
+ - lib/okf/skill/reference/cli/graph.md
151
+ - lib/okf/skill/reference/cli/map.md
152
+ - lib/okf/skill/reference/cli/registry.md
153
+ - lib/okf/skill/reference/cli/search.md
154
+ - lib/okf/skill/reference/cli/serve.md
155
+ - lib/okf/skill/reference/cli/views.md
156
+ - lib/okf/skill/reference/spec-map.md
157
+ - lib/okf/skill/templates/attested-computation.md
146
158
  - lib/okf/skill/templates/concept.md
147
159
  - lib/okf/skill/templates/index.md
148
160
  - lib/okf/skill/templates/log.md