@osdlc/wayfinder 0.7.3 → 0.8.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 (121) hide show
  1. package/CHANGELOG.md +221 -0
  2. package/CONTRIBUTING.md +6 -0
  3. package/README.md +295 -150
  4. package/SECURITY.md +19 -5
  5. package/dist/actions.d.ts +23 -0
  6. package/dist/actions.js +97 -0
  7. package/dist/app.d.ts +1 -13
  8. package/dist/app.js +1 -13
  9. package/dist/args.d.ts +11 -6
  10. package/dist/args.js +25 -7
  11. package/dist/cache.d.ts +2 -4
  12. package/dist/cache.js +5 -10
  13. package/dist/catalog.d.ts +30 -3
  14. package/dist/catalog.js +87 -11
  15. package/dist/clean-command.d.ts +65 -36
  16. package/dist/clean-command.js +372 -226
  17. package/dist/cli.d.ts +24 -57
  18. package/dist/cli.js +139 -568
  19. package/dist/commands/browse.d.ts +128 -0
  20. package/dist/commands/browse.js +151 -0
  21. package/dist/commands/index.d.ts +25 -0
  22. package/dist/commands/index.js +71 -0
  23. package/dist/commands/list.d.ts +208 -0
  24. package/dist/commands/list.js +127 -0
  25. package/dist/commands/query.d.ts +166 -0
  26. package/dist/commands/query.js +73 -0
  27. package/dist/commands/run.d.ts +114 -0
  28. package/dist/commands/run.js +139 -0
  29. package/dist/commands/shared.d.ts +152 -0
  30. package/dist/commands/shared.js +209 -0
  31. package/dist/config-command.d.ts +27 -43
  32. package/dist/config-command.js +129 -330
  33. package/dist/config-keys.d.ts +25 -0
  34. package/dist/config-keys.js +29 -0
  35. package/dist/config.d.ts +271 -257
  36. package/dist/config.js +610 -460
  37. package/dist/core/copy-text.d.ts +30 -0
  38. package/dist/core/copy-text.js +50 -0
  39. package/dist/core/filter.d.ts +55 -0
  40. package/dist/core/filter.js +59 -0
  41. package/dist/core/run.d.ts +22 -0
  42. package/dist/core/run.js +59 -0
  43. package/dist/core/saved-view.d.ts +59 -0
  44. package/dist/core/saved-view.js +119 -0
  45. package/dist/core/session.d.ts +262 -0
  46. package/dist/core/session.js +589 -0
  47. package/dist/core/skills.d.ts +53 -0
  48. package/dist/core/skills.js +54 -0
  49. package/dist/core/unknowns.d.ts +72 -0
  50. package/dist/core/unknowns.js +68 -0
  51. package/dist/devlink.d.ts +3 -0
  52. package/dist/devlink.js +5 -2
  53. package/dist/document-schemas.generated.d.ts +22 -0
  54. package/dist/document-schemas.generated.js +916 -0
  55. package/dist/documents.d.ts +432 -0
  56. package/dist/documents.js +163 -0
  57. package/dist/groups.d.ts +22 -26
  58. package/dist/groups.js +13 -29
  59. package/dist/guide.d.ts +26 -13
  60. package/dist/guide.js +119 -103
  61. package/dist/index.d.ts +112 -0
  62. package/dist/index.js +58 -0
  63. package/dist/keys.d.ts +51 -0
  64. package/dist/keys.js +273 -0
  65. package/dist/page.d.ts +18 -8
  66. package/dist/page.js +28 -17
  67. package/dist/providers-command.d.ts +81 -20
  68. package/dist/providers-command.js +33 -75
  69. package/dist/schema.d.ts +48 -0
  70. package/dist/schema.js +61 -0
  71. package/dist/serve/auth.d.ts +46 -0
  72. package/dist/serve/auth.js +82 -0
  73. package/dist/serve/catalog-share.d.ts +51 -0
  74. package/dist/serve/catalog-share.js +116 -0
  75. package/dist/serve/index.d.ts +98 -0
  76. package/dist/serve/index.js +251 -0
  77. package/dist/serve/routes.d.ts +60 -0
  78. package/dist/serve/routes.js +186 -0
  79. package/dist/serve/terminal-input.d.ts +50 -0
  80. package/dist/serve/terminal-input.js +108 -0
  81. package/dist/skills.d.ts +19 -0
  82. package/dist/skills.js +54 -0
  83. package/dist/terminal-text.d.ts +8 -0
  84. package/dist/terminal-text.js +19 -6
  85. package/dist/tool-info.d.ts +24 -0
  86. package/dist/tool-info.js +17 -0
  87. package/dist/trust-command.d.ts +15 -27
  88. package/dist/trust-command.js +110 -208
  89. package/dist/trust-store.d.ts +5 -10
  90. package/dist/trust-store.js +9 -42
  91. package/dist/tui/app.d.ts +180 -0
  92. package/dist/tui/app.js +1278 -0
  93. package/dist/tui/copy.d.ts +29 -0
  94. package/dist/tui/copy.js +39 -0
  95. package/dist/tui/index.d.ts +33 -0
  96. package/dist/tui/index.js +97 -0
  97. package/dist/tui/keys-input.d.ts +27 -0
  98. package/dist/tui/keys-input.js +87 -0
  99. package/dist/tui/settings.d.ts +94 -0
  100. package/dist/tui/settings.js +198 -0
  101. package/dist/tui/style.d.ts +62 -0
  102. package/dist/tui/style.js +77 -0
  103. package/dist/version.d.ts +6 -0
  104. package/dist/version.js +7 -0
  105. package/dist/vocabulary.d.ts +89 -0
  106. package/dist/vocabulary.js +153 -0
  107. package/dist/web/main.js +1965 -568
  108. package/dist/web/page.html +39 -33
  109. package/dist/web/styles.css +457 -329
  110. package/dist/xdg.d.ts +76 -4
  111. package/dist/xdg.js +77 -5
  112. package/package.json +28 -9
  113. package/schema/config.json +133 -0
  114. package/dist/http.d.ts +0 -22
  115. package/dist/http.js +0 -149
  116. package/dist/origin-owner.d.ts +0 -19
  117. package/dist/origin-owner.js +0 -85
  118. package/dist/serve.d.ts +0 -98
  119. package/dist/serve.js +0 -671
  120. package/dist/tui.d.ts +0 -177
  121. package/dist/tui.js +0 -840
package/README.md CHANGED
@@ -5,11 +5,12 @@ scripts, just, make, cargo, moon, mise and the rest, plus the install, tool and
5
5
  git-hook commands your package managers and tool managers imply.
6
6
 
7
7
  ```sh
8
- way # the terminal UI; Enter runs the selected task
9
- way --serve # the same catalog as a live page
10
- way query dev # the tasks matching a search, best match first
11
- way --json # the data, for anything else
12
- way providers # every tool it knows, and whether its binary is on PATH
8
+ way # the terminal UI; Enter runs the selected task
9
+ way serve # the same catalog as a live page
10
+ way query dev # the tasks matching a search, best match first
11
+ way run 'just build' # run one task by its id or command line
12
+ way list --json # the data, for anything else
13
+ way providers # every tool it knows, and whether its binary is on PATH
13
14
  ```
14
15
 
15
16
  It is for people who move between repositories and do not want to learn each
@@ -44,7 +45,7 @@ contributor tool, so `way --help` does not list it.
44
45
  way dev install # once: put shims for this checkout on PATH as way and wayfinder
45
46
  way dev link # this checkout answers everywhere, until told otherwise
46
47
  way dev history # every checkout ever linked, most recent first, with branch and HEAD
47
- way dev use #2 # back to an earlier one …
48
+ way dev use '#2' # back to an earlier one …
48
49
  way dev use canonical # … or to the install itself
49
50
  way dev status # which checkout runs now, and why
50
51
  ```
@@ -54,8 +55,10 @@ install. `way` never picks a checkout from the cwd, so a repository you run it
54
55
  in cannot choose the code that runs. A checkout must hold `src/cli.ts` and a
55
56
  `package.json` named `@osdlc/wayfinder`; anything else is skipped. The shim
56
57
  prints which one it chose on stderr, and `WAY_QUIET=1` silences it. State
57
- is kept in `<config>/way/`, which is `~/Library/Application Support/way` on
58
- macOS and `${XDG_CONFIG_HOME:-~/.config}/way` elsewhere. A checkout runs from
58
+ is kept in `${XDG_CONFIG_HOME:-~/.config}/way` on Linux and macOS and
59
+ `%APPDATA%\way` on Windows, or under `$WAYFINDER_ROOT/config/way` when that
60
+ is set. `way clean --dev` removes it,
61
+ with the shims `way dev install` wrote. A checkout runs from
59
62
  source, so it needs [Bun](https://bun.sh) on an absolute PATH entry and a
60
63
  `pnpm install` in the checkout. A `bun` found only through a relative entry
61
64
  such as `bin` or `.` is not used.
@@ -72,7 +75,7 @@ you would type, and in the terminal UI, Enter runs it.
72
75
 
73
76
  ## Groups
74
77
 
75
- Rows come in four groups, in this order, on every surface:
78
+ Rows come in five groups, in this order, on every surface:
76
79
 
77
80
  | Group | What fills it | Example rows |
78
81
  | --- | --- | --- |
@@ -80,27 +83,47 @@ Rows come in four groups, in this order, on every surface:
80
83
  | Dependencies | the detected package managers | `npm ci`, `cargo fetch` |
81
84
  | Tools | tool managers such as mise and proto | `mise install` |
82
85
  | Git hooks | lefthook, husky, pre-commit | `lefthook install` |
86
+ | Skills | agent skills in `.claude/skills`, `.agents/skills`, `.cursor/skills` | `/review [pr-number]` |
83
87
 
84
88
  The terminal UI and the page show a break between groups in the tab bar.
85
89
  `--json` adds a `groups` array: `{id, title, runners}` for each group that has
86
90
  rows. `runners.order` reorders runners within a group; the groups keep their
87
91
  order.
88
92
 
93
+ Skills are not tasks. An agent runs one when you type `/<name>`, so Run
94
+ copies `/<name>` and nothing is spawned; `way run /review` says so and exits
95
+ 1. `list` and `query` print a `/<name> [hint]` line for each skill after the
96
+ tasks, and search matches a skill's name and description as it matches a
97
+ task. `--json` puts them in `skills`: `name`, `description`, `argumentHint`,
98
+ `path`, `scope`, `origin` (`project`, `user` or `plugin:<id>`), `harnesses`
99
+ and `invoke`. They are read from files by `@osdlc/detect-harness`; nothing
100
+ runs. The `skills` setting chooses which: `project` (the default) lists the
101
+ repository's own, `all` adds yours and your plugins' from the home folder, and
102
+ `off` lists none.
103
+
89
104
  ## The terminal UI
90
105
 
91
106
  ```text
92
107
  enter run the selected task, handing it this terminal
93
- (a task with parameters asks for them first)
94
- ^y copy its command
95
- tab next runner (all · just · node-scripts │ dependencies │ tools …)
96
- ^e exact search instead of fuzzy
97
- ^t only services — tasks that run until you stop them
98
- ^s trust this repository, when runners are hidden for want of it
108
+ (a task that takes arguments asks for them first)
109
+ ^y copy its command line (on a skill: /<name>)
110
+ tab next tab (all · just · node-scripts │ dependencies │ tools … │ skills)
111
+ , settings: runners, discovery, excluded paths and trust
112
+ ^s trust this repository, when runners are withheld for want of it
99
113
  ^r re-probe (always a real probe, never the store)
100
- , this project's configuration, read-only
114
+ ^t only services — tasks that run until you stop them
115
+ ^e exact search instead of fuzzy
116
+ ^d only tasks a file declares
117
+ ^o scope: all, the root only, or at most 2 or 3 levels down
118
+ ? every key
101
119
  esc quit
102
120
  ```
103
121
 
122
+ The footer shows as many of these as fit, and always `? help` and `esc quit`.
123
+ `?` lists every key; `way --help --all` prints the same list. Both come from
124
+ one table, `KEY_TABLE` in `src/keys.ts`, which the web view's key help reads
125
+ too.
126
+
104
127
  `^s` asks first. The status line becomes `trust this repository? y/n`, and
105
128
  only `y` records a grant. A single key press should not decide whether this
106
129
  repository's code may run.
@@ -108,8 +131,9 @@ repository's code may run.
108
131
  A recipe that takes arguments asks for them first. Enter on
109
132
  `just deploy <env>` turns the key line into a command line, with the command
110
133
  already on it and the cursor after it. Type `staging` and press Enter to run
111
- `just deploy staging`, or press `esc` to go back. A task with no arguments
112
- runs as soon as you press Enter.
134
+ `just deploy staging`, or press `esc` to go back. A task whose parameters
135
+ could not be read is marked `?` and asks too; an empty line runs it as it
136
+ is. A task with no arguments runs as soon as you press Enter.
113
137
 
114
138
  Fuzzy by default. Terms are ANDed, so `photo dev` narrows to a photo app's dev
115
139
  server. A leading `'` forces one term to match exactly.
@@ -123,7 +147,9 @@ reinterpret a recipe that has `<placeholders>`.
123
147
  ## Searching from the shell
124
148
 
125
149
  `way query <terms>` is the terminal UI's search without the UI: the same
126
- matcher, the same ranking, one command line per match.
150
+ matcher, the same ranking, one command line per match. Each line is the one
151
+ Copy gives, quoted for your shell: sh quoting, or PowerShell's on Windows,
152
+ where the line starts with the call operator `&`. `way run` takes it back.
127
153
 
128
154
  ```text
129
155
  way query dev every task matching "dev", best match first
@@ -135,11 +161,11 @@ way query dev --json the matching tasks, rather than their command lines
135
161
 
136
162
  A leading `'` forces one term to match exactly, as it does in the UI. A search
137
163
  that matches nothing exits 1, so `way query dev && …` works in a script. A bare
138
- `way query` matches everything, the same as `way --list`. Every collection
164
+ `way query` matches everything, the same as `way list`. Every collection
139
165
  flag applies (`-C`, `--only`, `--exclude`, `--cached` and the rest). Like
140
- `--list` and `--json`, it re-probes unless you pass `--cached`.
166
+ `list`, it re-probes unless you pass `--cached`.
141
167
 
142
- `--list`, `query` and the terminal UI replace each control character and bidi
168
+ `list`, `query` and the terminal UI replace each control character and bidi
143
169
  control in repository text with U+FFFD, so a task name cannot send escape
144
170
  sequences to your terminal or read in a different order from what runs.
145
171
  `--json` keeps the text exact, writing DEL, C1 and bidi controls as `\u`
@@ -147,17 +173,19 @@ escapes, so it is safe to print too.
147
173
 
148
174
  ## The web view
149
175
 
150
- `way --serve` opens a page with the same catalog: a collapsible tree by call
176
+ `way serve` opens a page with the same catalog: a collapsible tree by call
151
177
  chain, sticky group headers, fuzzy and exact search, and copy buttons.
152
178
 
153
179
  It is a server, not a generated file, on purpose. A file goes out of date as
154
180
  soon as you add a task. The server re-probes, and the page refreshes when it
155
181
  gets focus and on a slow poll, so it shows what the repository has now.
156
182
 
157
- The first request is answered from the [stored probe](#the-cache) while a real
158
- probe runs in the background. So the page appears at once, even when the
159
- slowest runner takes seconds. The rows update in place when the probe
160
- finishes. Refresh always runs a real probe.
183
+ Every action on the page is a command of `way` called over HTTP: the list
184
+ is `way list`, a trust grant is `way trust`, a saved setting is `way config
185
+ set`. The page first asks for the [stored probe](#the-cache), then for a
186
+ real one. So the page appears at once, even when the slowest runner takes
187
+ seconds. The rows update in place when the probe finishes. Refresh always
188
+ runs a real probe.
161
189
 
162
190
  ## Execution, and trust
163
191
 
@@ -173,23 +201,35 @@ trusted. You grant trust once per repository, and it is remembered:
173
201
 
174
202
  ```text
175
203
  way trust trust the repository at the resolved root
176
- way trust --untrust remove this repository's trust
177
- way trust --show report this root's trust status
178
- way trust --list every trusted path, one per line
204
+ way trust --untrust remove this repository's whole-repository grant
205
+ way trust --untrust-all remove every grant of this repository
206
+ way trust --show report this root's trust and what decided it
207
+ way trust --list every grant, one per line
208
+ way trust --scope <tool> with a mode above: one tool's grant, such as mise
179
209
  way trust --json the same answer as one JSON object
180
210
  way trust --help this list
181
211
  ```
182
212
 
183
- Each mode also has a JSON form, and `--json` prints one object per run. The
184
- three modes that act on the root (the plain grant, `--untrust` and `--show`)
185
- all print `{"root": …, "trusted": …, "changed": …, "by": …, "rule": …}`, so a
186
- caller does not have to branch on the flag it passed. `--list` prints
187
- `{"trusted": [paths]}`. `by` is `"marker" | "path" | "owner" | null` and names
188
- the layer that decided (see [The policy](#the-policy) below). `rule` is the
189
- matching `trust.paths` or `trust.owners` entry, present only when `by` is
190
- `"path"` or `"owner"`. A `--untrust` that finds no marker to remove still
191
- prints its object, and reports the miss with exit 1 and a line on stderr. So a
192
- parser never gets an empty stdout.
213
+ Every mode prints the same JSON shape under `--json`:
214
+ `{"action": …, "changed": …, "roots": [{"root": …, "trusted": …, "by": …, "rule": …, "scope": …}]}`.
215
+ A caller does not have to branch on the flag it passed. `--list` gives one
216
+ entry per grant. `by` is `"marker" | "path" | "owner" | null` and names the
217
+ layer that decided (see [The policy](#the-policy) below). `rule` is the
218
+ matching policy entry, present only when `by` is `"path"` or `"owner"`.
219
+ `scope` is present for a one-tool grant. A `--untrust` that finds nothing to
220
+ remove still prints its object, and reports the miss with exit 1 and a line
221
+ on stderr. So a parser never gets an empty stdout.
222
+
223
+ A repository you do not trust as a whole can have single tools trusted.
224
+ `way trust --scope just` lets just run its tool while moon stays withheld.
225
+ A runner needs its own id trusted, and also each tool manager that runs
226
+ commands through itself at the root: in a repository with a `mise.toml`,
227
+ moon runs as `mise exec -- moon`, so it needs `--scope moon` and
228
+ `--scope mise`. A withheld runner's entry in `unknowns` names what it still
229
+ needs in `missing`, and once any tool is trusted its label says which, such
230
+ as `withheld: mise is not trusted`. Detection itself never runs a tool under a
231
+ tool grant. A grant is made from the command line only: the web view's
232
+ server refuses it.
193
233
 
194
234
  `-C` applies here too. Trust, with execution allowed, also lets the project
195
235
  file load tool modules; see
@@ -206,11 +246,15 @@ itself trust, just as it cannot set `allowExec: true`.
206
246
  {
207
247
  "trust": {
208
248
  "paths": ["/home/me/work/**"], // @osdlc/trust-repo's glob dialect
209
- "owners": ["my-org", "gitlab.com/other-org"] // `origin` remote owners; bare means github.com
249
+ "owners": ["my-org", "gitlab.com/other-org"], // `origin` remote owners; bare means github.com
250
+ "tools": { "mise": { "paths": ["/home/me/scratch/**"] } } // one tool only
210
251
  }
211
252
  }
212
253
  ```
213
254
 
255
+ `trust.tools.<tool>` takes the same `paths` and `owners` and trusts that one
256
+ tool only.
257
+
214
258
  `@osdlc/trust-repo`'s `policyExecGate` checks, in order: a marker in the
215
259
  store, then `trust.paths` (a glob over the root, with symlinks resolved), then
216
260
  `trust.owners` (the host and owner in the `origin` remote's URL, which
@@ -234,39 +278,44 @@ the policy still covers the root after the marker is removed.
234
278
 
235
279
  ### Removing what it has stored
236
280
 
237
- wayfinder stores three things outside your repositories, and `way clean`
238
- removes them. Bare `way clean` only reports them, so it deletes nothing by
239
- default.
281
+ `way clean` removes what wayfinder stores outside your repositories. Bare
282
+ `way clean` only reports, so it deletes nothing by default.
240
283
 
241
284
  ```text
242
- way clean show each store, where it is, and what it holds
243
- way clean --cache stored probe results
244
- way clean --trust forget which repositories you have trusted
245
- way clean --config --yes your user configuration file
246
- way clean --all --yes all three
247
- way clean --json the same answer as one JSON object
285
+ way clean show each store, where it is, and what it holds
286
+ way clean --cache stored probe results
287
+ way clean --trust forget which repositories you have trusted
288
+ way clean --user-config --yes your user configuration file
289
+ way clean --dev way dev link state and the shims way dev install wrote
290
+ way clean --legacy files left under the tool's name before its first release
291
+ way clean --everything --yes every store above
292
+ way clean --json the same answer as one JSON object
248
293
  ```
249
294
 
250
- `--json` prints one object with a `stores` array of
251
- `{key, flag, what, path, bytes, removed}`. A bare report lists every store. A
252
- removal lists only the ones you named. `bytes` is null when nothing was stored.
295
+ `--json` prints `{mode, stores}`, where each store is
296
+ `{key, flag, what, path, bytes, removed, envVar}`. A bare report lists every
297
+ store; `dev` shims and `legacy` files appear only when present. A removal
298
+ lists only the stores you named. `bytes` is null when nothing was stored.
253
299
  That tells "nothing to remove" apart from "could not remove", since both have
254
- `removed: false`. Under `--json`, the closing note that trust will be asked for
255
- again goes to stderr, so stdout stays one JSON document.
256
-
257
- `--config` and `--all` need `--yes` because the three stores are not equally
258
- easy to replace. The cache is rebuilt by one slow probe. Losing trust means
259
- answering the trust question again for each repository. The configuration is
260
- the only one you wrote by hand. `clean` never touches anything inside a
261
- repository: a project's own `wayfinder.config.json` belongs to that project.
300
+ `removed: false`. `envVar` names the variable that chose the path, such as
301
+ `WAYFINDER_CONFIG`. Notes go to stderr, so stdout stays one JSON document.
302
+
303
+ `--user-config` and `--everything` need `--yes`. The cache is rebuilt by one slow
304
+ probe. Losing trust means answering the trust question again for each
305
+ repository. The configuration is the only store you wrote by hand. A config
306
+ that `WAYFINDER_CONFIG` names is named again before it is removed, since it
307
+ may live in a dotfiles repository. Once a store is gone, empty directories
308
+ above it are removed, up to the base such as `~/.config`. A store whose
309
+ path is, holds or sits in another store, as when `WAYFINDER_CACHE_DIR` is
310
+ `~/.config`, is removed only with `--yes`. `clean` never
311
+ touches anything inside a repository: a project's own `wayfinder.config.json`
312
+ belongs to that project. The web view's server gets the report only.
262
313
 
263
314
  The trust store is a directory of marker files at
264
315
  `$XDG_STATE_HOME/wayfinder/trusted/`, or `~/.local/state/wayfinder/trusted/`
265
- when that variable is unset. It is XDG state, not config. The program
266
- maintains trust, and a person does not edit it by hand. A consent record
267
- copied to a new machine in a dotfiles repository is no longer consent. Grants
268
- made under the old waypost name, in `~/.local/state/waypost/trusted/`, still
269
- count.
316
+ when that variable is unset. It is state, not config. The program maintains
317
+ trust, and a person does not edit it by hand. A consent record copied to a
318
+ new machine in a dotfiles repository is no longer consent.
270
319
 
271
320
  **A repository cannot trust itself.** `allowExec: true` in
272
321
  `wayfinder.config.json` is ignored with a warning, because that file lives
@@ -277,15 +326,15 @@ choose.
277
326
 
278
327
  `--exec` allows execution for one run and records nothing, which suits a
279
328
  script or a CI job. `--no-exec` turns execution off, however trusted the
280
- repository is. Both flags apply on every surface, including the web view. Its
281
- `POST /api/trust` returns `409` whenever a grant would have no effect, so the
282
- page cannot lift `--no-exec` or make an `--exec` run permanent. The page hides
283
- its trust button in those states, and the server refuses the request anyway.
284
- The session token proves who is asking, not that the request makes sense.
329
+ repository is. Both flags apply on every surface, including the web view,
330
+ whose every command runs with the flags `way serve` started with. The page
331
+ offers a trust grant only when one would change what is read, and asks
332
+ before it sends it.
285
333
 
286
334
  When runners are withheld, every surface says so and offers a way to grant
287
- trust. `--list` and `--json` print one line on stderr. The terminal UI shows
288
- `N hidden — repo not trusted (^s to trust)` beside the counts. The web view
335
+ trust. `list` and `query` print one line on stderr. The terminal UI shows
336
+ `2 runners withheld: this repository is not trusted (^s to trust)` beside the
337
+ counts, and a `–` in place of the count on each withheld tab. The web view
289
338
  shows a **Trust this repository** button in a bar above the list, in each
290
339
  withheld runner's info panel and in the runner picker.
291
340
 
@@ -313,12 +362,18 @@ Some runners are slow to ask (moon starts its toolchain, sbt starts a JVM),
313
362
  and a browser that waits for them looks broken. `wayfinder` stores the last
314
363
  answer for each root and runner, so the UI can show rows at once.
315
364
 
316
- The terminal UI and `--serve` always start from the store. They read it, show
317
- the rows, then probe in the background and update in place. `--json` and
318
- `--list` re-probe on every run, because a script or an agent reading them needs
319
- what the repository has right now. Those runs also write the store, so the next
320
- UI start is instant. `--cached` makes `--json` and `--list` read the store for
321
- one run.
365
+ The terminal UI and `serve` always start from what was last shown. Every
366
+ `list`, `query` and refresh saves the catalog it showed in one file, and a
367
+ start draws that file before it reads anything else, so the rows appear in
368
+ well under a second even on a large repository. The file is used only under
369
+ the same trust and settings that produced it. Without it they read the store,
370
+ which needs no probe but detects the project and hashes each runner's files.
371
+ Then they probe in the background and update in place. `list` and `query`
372
+ re-probe on every run, because a script or an agent reading them needs what
373
+ the repository has right now. `--cached` makes `list`, `query` and `run`
374
+ answer at once from the same saved listing the UIs draw. It does not check
375
+ whether files changed since its `storedAt`. With no saved listing, `--cached`
376
+ reads the store, which does check.
322
377
 
323
378
  A stored answer is in one of three states, and every surface shows them the
324
379
  same way:
@@ -339,26 +394,42 @@ elsewhere. When a repository has no measurement yet, the surface says so
339
394
  instead of guessing a number.
340
395
 
341
396
  `^r` in the terminal UI and Refresh on the page always run a real probe. They
342
- never answer from the store.
397
+ never answer from the store. On the page, the polls join a probe that is
398
+ already running; Refresh always starts its own, so it never answers with a
399
+ probe that began before an edit.
400
+
401
+ A row from the saved listing or the store is checked before it runs: its
402
+ runner is probed again, and a task that is gone or changed is refused with
403
+ the command it runs now. A dry run is not checked.
343
404
 
344
405
  If you run a row whose task no longer exists, such as a task renamed since the
345
406
  stored probe, both surfaces tell you the row came from the store, instead of
346
407
  showing only a spawn failure.
347
408
 
348
- For the pipeable surfaces, `--cached` names the stale runners on stderr, so
349
- `--list` stays pipeable and `--json` stays parseable:
409
+ For the pipeable surfaces, `--cached` says on stderr what it answered from, so
410
+ `list` stays pipeable and `--json` stays parseable. From the saved listing:
350
411
 
351
412
  ```text
352
- wayfinder: --cached: stale: just (35s old, refresh usually about 149ms)
353
- wayfinder: --cached: not cached, probed now: github-actions
413
+ way: --cached: the last listing, 35s old; files changed since storedAt are not checked
414
+ ```
415
+
416
+ From the store, it names the stale runners:
417
+
418
+ ```text
419
+ way: --cached: just (stale: its files changed, 35s old; refresh usually about 149ms); not cached, probed now: github-actions
354
420
  ```
355
421
 
356
422
  `--cached` with an empty store is not an error. It probes, stores the result,
357
- and says so. `--json --cached` adds a `cache` array beside the catalog, with
358
- one entry per selected runner. Over HTTP the page always receives this array.
423
+ and says so. A runner with nothing stored is probed the same way. The `--json`
424
+ document of `list` and `query` says which it was: `source` is `"fresh"` when
425
+ every runner was probed in this call and `"cached"` when the rows came from the
426
+ store, and `storedAt` is when the oldest stored rows were probed (null when
427
+ fresh). Every `--json` document has a `cache` array, with one entry per
428
+ selected runner. After a fresh probe each entry's `probeMs` is the time that
429
+ runner took. Over HTTP the page always receives this array.
359
430
 
360
431
  The cache is at `$XDG_CACHE_HOME/wayfinder/`, or `~/.cache/wayfinder/`. It is
361
- XDG cache, not the `~/.local/state/wayfinder/` directory that
432
+ cache, not the `~/.local/state/wayfinder/` directory that
362
433
  [trust](#execution-and-trust) uses. Losing the cache costs one slow probe.
363
434
  Losing the trust store would silently un-trust repositories. The cache plays no
364
435
  part in deciding execution. A cached answer is never a trust grant, clearing
@@ -373,22 +444,10 @@ describes the limits of this.
373
444
  Options you would otherwise type on every run can live in a file: which
374
445
  runners to skip, what order to show them in, whether execution is allowed, and
375
446
  how files are discovered. The layers, lowest precedence first: built-in
376
- defaults, `$XDG_CONFIG_HOME/wayfinder/config.json` (or
377
- `~/.config/wayfinder/config.json`), `wayfinder.config.json` at the project
378
- root, then the flags on the command line.
379
-
380
- The keys are `runners.disabled`, `runners.order`, `allowExec`, `discovery`,
381
- `excludePaths`, `trust.paths`, `trust.owners` and `tools`. `WAYFINDER_CONFIG`
382
- names a different user file and changes nothing else. A relative
383
- `WAYFINDER_CONFIG` is ignored with a warning: from the repository root it
384
- would name a file in the repository. Use an absolute path or `~/`. A relative
385
- `HOME` counts as unset, and the account's home is used. A relative `XDG_CONFIG_HOME`, `XDG_STATE_HOME` or `XDG_CACHE_HOME` is
386
- ignored, as the XDG spec says.
387
-
388
- The tool was called waypost before its first release. `WAYPOST_CONFIG`,
389
- `~/.config/waypost/config.json` and `waypost.config.json` are still read when
390
- the new name is absent, with a warning. See the
391
- [configuration guide](docs/guide/configuration.md#files-from-the-waypost-name).
447
+ defaults, the user file (`~/.config/wayfinder/config.json` by default),
448
+ `wayfinder.config.json` at the project root, then the flags on the command
449
+ line. `trust`, `open`, `theme` and `skills` count only in the user file, and a
450
+ project file can lower `allowExec` but never raise it.
392
451
 
393
452
  ```text
394
453
  way config list [--json] every setting, and the layer it came from
@@ -396,45 +455,99 @@ way config get <key> one setting's effective value,
396
455
  way config set <key> <value> [--user|--project] write a setting (default --project)
397
456
  way config unset <key> [--user|--project] remove a setting (default --project)
398
457
  way config path where each layer's file lives
399
- way config --help this list
458
+ way config explain <key> how a setting got its value, layer by layer
459
+ ```
460
+
461
+ [Configuration](docs/guide/configuration.md) has every key, the merge rules,
462
+ the paths and the variables that move them, and the exit codes. The package
463
+ ships the file's JSON Schema at `schema/config.json`.
464
+
465
+ ## Commands
466
+
467
+ ```text
468
+ way [dir] the terminal UI (the default command)
469
+ way list [dir] print one command line per task; --json for the catalog
470
+ way query <terms> the tasks matching a search, best match first
471
+ way run <id> [-- args] run one task, with its exit code; --dry-run for the plan
472
+ way serve the same catalog as a live page
473
+ way providers the registered tools, built-in and your own
474
+ way config | trust | clean | guide
475
+ way help [command] help for a command; --all for every flag
476
+ way schema <command> the JSON Schema of a command's --json document
477
+ way --version
478
+ ```
479
+
480
+ `run` takes a task's `id` or its command line, when only one task has it, such
481
+ as `way run 'npm run build'`. Arguments after `--` are bound the way the tool
482
+ expects, as the terminal UI and the page bind them. A task that ends on a
483
+ signal exits 128 plus the signal number. `--dry-run --json` prints the
484
+ `argv`, `cwd` and `env` it would run. A plain `run --json` is refused,
485
+ because the task owns stdout.
486
+
487
+ Global flags go before or after the command word: `way -C ../app list` and
488
+ `way list -C ../app` are the same. A start directory that does not exist is an
489
+ error, so a mistyped command (`way lsit`) is reported with the closest one.
490
+ Messages on stderr start with `way:`.
491
+
492
+ ### Filters
493
+
494
+ `list` and `query` take the same filters, in text and in JSON:
495
+
496
+ ```text
497
+ --services only tasks that run until you stop them
498
+ --declared only tasks a file declares, not ones from a convention
499
+ --depth N only tasks whose source is at most N directories deep
500
+ --cached answer from the last saved listing; files are not checked
400
501
  ```
401
502
 
402
- `-C` applies here too, so `way config path -C /elsewhere` reports that
403
- directory's files rather than this one's. Exit code 2 means the command as
404
- typed cannot run, such as an unknown key or a value of the wrong type. Exit
405
- code 1 means the command was valid but failed against the state it found.
503
+ ### Documents
504
+
505
+ Every `--json` answer is one object with `schemaVersion` and `kind`:
506
+ `catalog` (`list`), `query`, `run`, `providers`, `trust`, `clean`, `guide`,
507
+ `config-<name>` for each `config` subcommand (`config-list`, `config-set` and
508
+ the rest), and the framework's `help`, `schema`, `version` and `error`.
509
+ `way schema list` prints a command's input and document schemas. Every
510
+ document's schema is exported from `@osdlc/wayfinder/schema`:
406
511
 
407
- `runners.order` sets the runner order everywhere: `--json`, `--list`, the
408
- terminal UI's tab order, and the web view. In the web view, an order you set by
409
- dragging is saved in the browser and overrides it.
512
+ ```ts
513
+ import { catalogDocumentSchema, documentZod } from '@osdlc/wayfinder/schema'
410
514
 
411
- ### `allowExec` here
515
+ const doc = documentZod('catalog').parse(JSON.parse(output))
516
+ ```
412
517
 
413
- wayfinder's execution default is `true`, and any file overrides it. Highest
414
- precedence first:
518
+ | Export | Is |
519
+ |---|---|
520
+ | `catalogSchema`, `taskSchema`, `runnerReportSchema`, `paramSchema`, `toolInfoSchema`, `CATALOG_SCHEMA_VERSION` | system-model's catalog schemas |
521
+ | `catalogDocumentSchema`, `queryDocumentSchema`, `runDocumentSchema`, `providersDocumentSchema`, `trustDocumentSchema`, `cleanDocumentSchema` | the JSON Schema of each document |
522
+ | `DOCUMENT_SCHEMAS`, `DOCUMENT_VERSIONS`, `DOCUMENT_KINDS` | every document's schema and `schemaVersion`, by `kind`, and the kinds |
523
+ | `JsonSchema`, `DocumentKind` | the types of a schema and of a `kind` |
524
+ | `documentZod(kind)` | a Zod schema that parses a document |
415
525
 
416
- 1. `--exec` or `--no-exec` on this command line
417
- 2. `allowExec: false` in `wayfinder.config.json`, then `allowExec` in the user file
418
- 3. wayfinder's own default, `true`
526
+ The `catalog` and `query` documents carry `cache`, `filter` and `unknowns`.
527
+ `unknowns` lists what could not be read, each with the `label` the stderr note
528
+ prints: a runner withheld for trust, tasks whose parameters are unknown and
529
+ why, a stale stored answer, a tool missing from `PATH`.
419
530
 
420
- A file has to say `false` for execution to be off. `way config list` and
421
- `way config get allowExec` report that default, labelled `(default)`.
531
+ ### Old flags
422
532
 
423
- This setting alone does not allow execution. The repository must also be
424
- [trusted](#execution-and-trust), so with `true` here, runners that must run to
425
- be read are still skipped until then.
533
+ These still work in this release and will be removed in a later one:
534
+
535
+ ```text
536
+ way --serve way serve
537
+ way --list way list
538
+ way --json way list --json
539
+ way query --list way query
540
+ ```
541
+
542
+ Two of them at once are refused.
426
543
 
427
544
  ## Options
428
545
 
429
546
  ```text
430
- query <terms> the tasks matching a search, best match first
431
547
  --exact with query: terms match as substrings, not subsequences
432
- --services with query: only tasks that run until you stop them
433
- --serve a page instead of the terminal UI
434
- --port N fixed port for --serve
435
- --no-open print the URL rather than opening a browser
436
- --json | --list print the catalog and exit
437
- --cached answer those two from the last stored probe
548
+ --port N with serve: a fixed port
549
+ --no-open with serve: print the URL rather than opening a browser
550
+ --json with a data command: print its document
438
551
 
439
552
  --no-exec skip runners that must run a subprocess
440
553
  --exec allow them for this run only, without recording trust
@@ -446,34 +559,24 @@ query <terms> the tasks matching a search, best match first
446
559
  --discovery M git | walk | auto (default: auto)
447
560
  -C, --dir PATH directory to inspect (default: cwd)
448
561
  --config MODULE load extra tools from a module, this run only; repeatable
449
- -h, --help the short form: the ways in, and where the rest is
450
- --help --all the block above, every default and every note
451
-
452
- config read and write the layered settings; `config --help`
453
- trust allow this repository's runners to be read by running
454
- them; `trust --help`
455
- providers the registered tools, built-in and your own;
456
- `providers --help`
457
- clean remove what this tool has stored; `clean --help`
458
- guide how to use and extend this tool, in Markdown
459
562
  ```
460
563
 
461
- A subcommand is matched before flags are parsed, so the flags above belong to
462
- the top-level command, not to the subcommands. `-C` is the exception. The
463
- subcommands whose answer depends on the repository take it.
564
+ `config`, `trust`, `clean` and `guide` read their own flags. Of the global
565
+ flags they take only `-C`, and only where the answer depends on the
566
+ repository:
464
567
 
465
568
  | Subcommand | `-C, --dir` | Why |
466
569
  |---|---|---|
467
570
  | `config` | yes | reports the configuration THAT directory resolves |
468
571
  | `trust` | yes | the grant keys on that directory's project root |
469
572
  | `providers` | yes | a trusted project file can add tools when execution is allowed |
470
- | `clean` | no | resolves every path from the environment and the home directory |
471
- | `guide` | no | its argument is a topic name |
573
+ | `clean` | accepted, unused | resolves every path from the environment and the home directory |
574
+ | `guide` | accepted, unused | its argument is a topic name |
472
575
  | `dev` | no | its state is devlink's, keyed on the tool name; not listed in the help |
473
576
 
474
- `way --help` is the short form: the main ways to run it, the flags most runs
475
- pass, and the names of the subcommands. `way --help --all` is the full flag
476
- list shown above. Each subcommand has its own `--help`. `way guide` is the long
577
+ `way help` lists the commands and the global flags. `way help <command>` and
578
+ `way <command> --help` show one command, and `--all` adds every note. `way
579
+ --help --all` is the full flag list shown above. `way guide` is the long
477
580
  form, by topic. A usage error, such as a mistyped flag, prints the short form,
478
581
  so the error is not lost in the full list.
479
582
 
@@ -491,7 +594,7 @@ built-ins. A module that exports `tools`, an array of them, can be loaded three
491
594
  ways:
492
595
 
493
596
  ```sh
494
- way --config ./acme-tools.ts --list # this run only
597
+ way --config ./acme-tools.ts list # this run only
495
598
  way config set --user tools '["~/acme-tools.mjs"]' # every run, from your user file
496
599
  way config set tools '["./tools/acme.mjs"]' # this repository, once trusted with exec on
497
600
  ```
@@ -506,12 +609,54 @@ repository is trusted and execution is allowed (`allowExec` not `false`, no
506
609
 
507
610
  `way providers` lists every registered tool: its roles, its runner kind
508
611
  (`parse` reads files, `exec` must run the tool and needs trust), its binary,
509
- whether that binary is on PATH, and whether it is built in or custom.
510
- `--json` gives the same rows as data. Only absolute PATH entries count, as in
612
+ whether that binary is on PATH, its language (`any language` for make, just
613
+ and the like), whether it is built in or custom, and its homepage. `--json`
614
+ gives the same rows as data, with a one-line `description`. Only absolute PATH entries count, as in
511
615
  detection: a tool found only through a relative entry (`bin`, `.`,
512
616
  `node_modules/.bin`) reads as not installed. Put an absolute entry for it on
513
617
  PATH.
514
618
 
619
+ ## Library
620
+
621
+ The package's root entry builds the same catalog from code, without spawning
622
+ `way`. It runs on Node.
623
+
624
+ ```ts
625
+ import { buildCatalog, filterTasks, terminalSafe } from '@osdlc/wayfinder'
626
+
627
+ const doc = await buildCatalog({ dir: '.', flags: { allowExec: false } })
628
+ for (const hit of filterTasks(doc.reports, { query: 'dev' })) {
629
+ console.log(terminalSafe(hit.task.display))
630
+ }
631
+ ```
632
+
633
+ `buildCatalog` takes what the CLI takes as flags (`flags`, `cached`,
634
+ `filter`) and returns the `catalog` document `way list --json` prints. It
635
+ reads the same config files, applies the same trust gate and writes the same
636
+ probe store. Nothing in the repository runs unless it is trusted and
637
+ execution is allowed. It throws `SessionError` with a `code` for a directory
638
+ that does not exist, a config file that cannot be used, or a tool module that
639
+ cannot be loaded. `onWarning` gets each warning the CLI prints on stderr,
640
+ such as a project file key that is ignored.
641
+
642
+ | Export | Is |
643
+ |---|---|
644
+ | `buildCatalog`, `BuildCatalogOptions`, `CatalogDocument`, `SessionFlags`, `CacheState` | the catalog for a directory, the flags it takes and each runner's cache verdict |
645
+ | `filterTasks`, `keepsTask`, `sourceDepth`, `hasQuery`, `TaskFilter`, `TaskHit`, `Mode` | the search and filters every surface uses |
646
+ | `filterSkills`, `skillLine`, `SkillRow`, `SkillHit`, `SkillsSetting`, `SKILLS_SETTING_VALUES` | the Skills group |
647
+ | `GROUPS`, `SKILLS_GROUP`, `groupOf`, `catalogGroups`, `documentGroups`, `Group`, `GroupId`, `DocumentGroup` | the groups and their order |
648
+ | `unknownsOf`, `unknownLine`, `Unknown`, `UnknownsInput`, `WithheldReason` | what could not be read, with its label |
649
+ | `runnerLabel`, `withheldLabel`, `languageLabel`, `ANY_LANGUAGE`, `toolSummary`, `ToolSummary` | the words a person reads |
650
+ | `terminalSafe`, `jsonText` | repository text made safe for a terminal |
651
+ | `SessionError` | why a catalog could not be built |
652
+ | `Catalog`, `RunnerReport`, `Task`, `Param`, `ToolDef`, `DiscoveryMode`, `RunnerCacheState`, `ParametersUnknownReason`, `StaleReason` | system-model's types |
653
+
654
+ Repository text (task names, skill descriptions, paths) can hold terminal
655
+ control characters. Pass it through `terminalSafe` before printing it.
656
+ Other paths into the package are closed; `@osdlc/wayfinder/schema` is the
657
+ other entry. Before 1.0 a minor release may change these names, and the
658
+ changelog says how.
659
+
515
660
  ## How it compares
516
661
 
517
662
  - **Each tool's own list** (`just --list`, `npm run`, `moon query tasks`)