okf 1.9.0 → 1.10.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +493 -133
- data/README.md +101 -10
- data/lib/okf/bundle/folder.rb +4 -0
- data/lib/okf/bundle.rb +25 -1
- data/lib/okf/cli/catalog.rb +66 -0
- data/lib/okf/cli/command.rb +495 -0
- data/lib/okf/cli/files.rb +68 -0
- data/lib/okf/cli/graph.rb +82 -0
- data/lib/okf/cli/index.rb +127 -0
- data/lib/okf/cli/lint.rb +139 -0
- data/lib/okf/cli/loose.rb +78 -0
- data/lib/okf/cli/registry.rb +229 -0
- data/lib/okf/cli/render.rb +66 -0
- data/lib/okf/cli/search.rb +285 -0
- data/lib/okf/cli/server.rb +179 -0
- data/lib/okf/cli/skill.rb +57 -0
- data/lib/okf/cli/stats.rb +88 -0
- data/lib/okf/cli/tags.rb +122 -0
- data/lib/okf/cli/types.rb +37 -0
- data/lib/okf/cli/validate.rb +66 -0
- data/lib/okf/cli.rb +418 -1703
- data/lib/okf/render/graph/template.html.erb +1020 -61
- data/lib/okf/render/graph.rb +46 -2
- data/lib/okf/server/app.rb +10 -4
- data/lib/okf/server/hub/not_found.rb +663 -0
- data/lib/okf/server/hub.rb +504 -38
- data/lib/okf/skill/SKILL.md +14 -10
- data/lib/okf/skill/playbooks/curate.md +3 -1
- data/lib/okf/skill/playbooks/maintain.md +3 -2
- data/lib/okf/skill/playbooks/menu.md +5 -0
- data/lib/okf/skill/playbooks/refine.md +92 -0
- data/lib/okf/skill/reference/cli.md +22 -4
- data/lib/okf/version.rb +1 -1
- metadata +19 -1
data/lib/okf/render/graph.rb
CHANGED
|
@@ -71,9 +71,11 @@ module OKF
|
|
|
71
71
|
# +siblings+/+self_slug+/+hub_path+ carry the hub's bundle switcher into the
|
|
72
72
|
# page (server mode only). nil — the standalone-server and `okf render`
|
|
73
73
|
# default — injects an empty SIBLINGS, so the switcher never appears in a
|
|
74
|
-
# single bundle or a static file.
|
|
74
|
+
# single bundle or a static file. +search_endpoint+ rides along with them:
|
|
75
|
+
# the hub's cross-bundle /search, which only a hub can answer.
|
|
75
76
|
def initialize(graph, title: nil, link: nil, layout: "cose", node_endpoint: "node", meta_endpoint: "node/meta", embed: nil,
|
|
76
|
-
siblings: nil, self_slug: nil, hub_path: nil
|
|
77
|
+
siblings: nil, self_slug: nil, hub_path: nil, search_endpoint: nil,
|
|
78
|
+
manage_root: nil, manage_token: nil)
|
|
77
79
|
@graph = graph
|
|
78
80
|
@title = title
|
|
79
81
|
@link = link
|
|
@@ -84,6 +86,9 @@ module OKF
|
|
|
84
86
|
@siblings = siblings
|
|
85
87
|
@self_slug = self_slug
|
|
86
88
|
@hub_path = hub_path
|
|
89
|
+
@search_endpoint = search_endpoint
|
|
90
|
+
@manage_root = manage_root
|
|
91
|
+
@manage_token = manage_token
|
|
87
92
|
end
|
|
88
93
|
|
|
89
94
|
def render
|
|
@@ -158,6 +163,45 @@ module OKF
|
|
|
158
163
|
json_for_script(@hub_path)
|
|
159
164
|
end
|
|
160
165
|
|
|
166
|
+
# The hub's cross-bundle /search, mount-relative — null everywhere else, and
|
|
167
|
+
# that null is the gate: a standalone server and a static file have no set
|
|
168
|
+
# of bundles to search, so the palette never offers concepts there.
|
|
169
|
+
def search_endpoint_json
|
|
170
|
+
json_for_script(@search_endpoint)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# Behind a hub the mark is a link back to the bundle list — "../" reaches
|
|
174
|
+
# it under any mount, because every page lives at <prefix>/b/<slug>/.
|
|
175
|
+
# Standalone and static have nowhere to go, so there it stays the plain
|
|
176
|
+
# identity badge it has always been, and an <a href> to nothing is worse
|
|
177
|
+
# than no <a> at all.
|
|
178
|
+
def rail_brand_open
|
|
179
|
+
return %(<span class="rail-brand" title=") unless @manage_root
|
|
180
|
+
|
|
181
|
+
%(<a class="rail-brand" href="../" aria-label="All bundles" title=")
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def rail_brand_close
|
|
185
|
+
@manage_root ? "</a>" : "</span>"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# The hub root, mount-relative — where the Bundles panel reads /bundles and
|
|
189
|
+
# posts /registry/<verb>. Null everywhere else, and that null is the gate:
|
|
190
|
+
# a standalone server and a static file have no registry behind them, so
|
|
191
|
+
# the panel never appears there.
|
|
192
|
+
def manage_root_json
|
|
193
|
+
json_for_script(@manage_root)
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# This boot's CSRF token, and only where a write could be honoured — a
|
|
197
|
+
# read-only hub bakes null, so the page holds no credential it may not use.
|
|
198
|
+
# It is no wider than the /b/ manager, which any script on this origin
|
|
199
|
+
# could already read; keeping it out of the page where it is useless is
|
|
200
|
+
# tidiness, not a boundary.
|
|
201
|
+
def manage_token_json
|
|
202
|
+
json_for_script(@manage_token)
|
|
203
|
+
end
|
|
204
|
+
|
|
161
205
|
# JSON-encode for safe embedding in an inline <script>: escaping every `<` to
|
|
162
206
|
# its JSON unicode escape neutralizes </script>, <!-- and <script in one
|
|
163
207
|
# stroke, and the result stays valid JSON *and* JavaScript.
|
data/lib/okf/server/app.rb
CHANGED
|
@@ -33,9 +33,11 @@ module OKF
|
|
|
33
33
|
class App
|
|
34
34
|
# +siblings+/+self_slug+/+hub_path+ are set only when this app is hosted under
|
|
35
35
|
# a hub (OKF::Server::Hub): the other bundles the in-page switcher offers, this
|
|
36
|
-
# bundle's own mount slug,
|
|
37
|
-
# server and for `okf render`, so a
|
|
38
|
-
|
|
36
|
+
# bundle's own mount slug, the hub root, and the hub's cross-bundle search
|
|
37
|
+
# route. They stay nil for a standalone server and for `okf render`, so a
|
|
38
|
+
# static file never advertises a switcher or a search it cannot answer.
|
|
39
|
+
def initialize(folder, title: nil, link: nil, layout: "cose", siblings: nil, self_slug: nil, hub_path: nil,
|
|
40
|
+
search_endpoint: nil, manage_root: nil, manage_token: nil)
|
|
39
41
|
@folder = folder
|
|
40
42
|
@title = title
|
|
41
43
|
@link = link
|
|
@@ -43,6 +45,9 @@ module OKF
|
|
|
43
45
|
@siblings = siblings
|
|
44
46
|
@self_slug = self_slug
|
|
45
47
|
@hub_path = hub_path
|
|
48
|
+
@search_endpoint = search_endpoint
|
|
49
|
+
@manage_root = manage_root
|
|
50
|
+
@manage_token = manage_token
|
|
46
51
|
end
|
|
47
52
|
|
|
48
53
|
def call(env)
|
|
@@ -100,7 +105,8 @@ module OKF
|
|
|
100
105
|
def page
|
|
101
106
|
@page ||= OKF::Render::Graph.new(
|
|
102
107
|
graph, title: @title || @folder.name, link: @link, layout: @layout,
|
|
103
|
-
siblings: @siblings, self_slug: @self_slug, hub_path: @hub_path
|
|
108
|
+
siblings: @siblings, self_slug: @self_slug, hub_path: @hub_path, search_endpoint: @search_endpoint,
|
|
109
|
+
manage_root: @manage_root, manage_token: @manage_token
|
|
104
110
|
).render
|
|
105
111
|
end
|
|
106
112
|
|