Pure composition of runtime branches onto a tool's contributed commands.
A BRANCH extends or wraps one path of a tool's command tree, at any depth:
graft git belt hello beside what git belt already routes
around middleware, (fn [next] handler), over a verb, a subtree or the tool
The host re-reads contributions on every call and lets a contribution win over its own verb of the same name, so composing HERE, on the way out of the store, needs nothing from the host. Touching a root the host itself owns contributes that root, with a re-entry into the tool as its default route: the host's own verb is still what answers everything no branch took.
A leaf that routes its own remainder is SPLIT, never replaced: it becomes {:_handler leaf, seg branch} and still receives the whole :command.
A graft never shadows a route; changing one is what around is for.
No reader conditionals, as for the registry above it. Catching a platform exception is therefore the :guard the host injects.
Pure composition of runtime branches onto a tool's contributed commands.
A BRANCH extends or wraps one path of a tool's command tree, at any depth:
graft `git belt hello` beside what `git belt` already routes
around middleware, (fn [next] handler), over a verb, a subtree or the tool
The host re-reads contributions on every call and lets a contribution win over
its own verb of the same name, so composing HERE, on the way out of the store,
needs nothing from the host. Touching a root the host itself owns contributes
that root, with a re-entry into the tool as its default route: the host's own
verb is still what answers everything no branch took.
A leaf that routes its own remainder is SPLIT, never replaced: it becomes
{:_handler leaf, seg branch} and still receives the whole :command.
A graft never shadows a route; changing one is what `around` is for.
No reader conditionals, as for the registry above it. Catching a platform
exception is therefore the :guard the host injects.Command contributions to a composite tool.
An addon contributes named subcommands to a host tool, so
analysis command="lint ..." reaches the contributing addon's handler.
Each contribution records the contributing addon so shutdown can retract
everything that addon added.
Shape: {tool-name {command-name {:handler fn :params {} :description str :addon addon-id}}}
Command contributions to a composite tool.
An addon contributes named subcommands to a host tool, so
`analysis command="lint ..."` reaches the contributing addon's handler.
Each contribution records the contributing addon so shutdown can retract
everything that addon added.
Shape: {tool-name {command-name {:handler fn :params {} :description str
:addon addon-id}}}Opaque capability registry.
An addon registers an implementation under a keyword key at startup; a consumer looks it up without knowing which addon provides it:
(register! :gs/struct-cmp my-cmp-fn)
(if-let [f (get-extension :gs/struct-cmp)] (f a b) fallback)
Registration is atomic and idempotent — re-registering a key replaces it.
Opaque capability registry.
An addon registers an implementation under a keyword key at startup; a
consumer looks it up without knowing which addon provides it:
(register! :gs/struct-cmp my-cmp-fn)
(if-let [f (get-extension :gs/struct-cmp)]
(f a b)
fallback)
Registration is atomic and idempotent — re-registering a key replaces it.Schema-property extensions contributed to a host tool.
An addon widens an existing tool's input schema by registering extra properties under that tool's name. Contributions merge, so several addons may extend the same tool.
Schema-property extensions contributed to a host tool. An addon widens an existing tool's input schema by registering extra properties under that tool's name. Contributions merge, so several addons may extend the same tool.
Dynamically registered tool definitions.
A tool definition is a map carrying at least a :name string and a :handler fn. Registration is keyed by :name, last write wins.
Dynamically registered tool definitions. A tool definition is a map carrying at least a :name string and a :handler fn. Registration is keyed by :name, last write wins.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |