@osdlc/wayfinder 0.7.4 → 0.9.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 +240 -0
  2. package/CONTRIBUTING.md +6 -0
  3. package/README.md +310 -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 +45 -4
  14. package/dist/catalog.js +134 -13
  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 +153 -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 +224 -0
  24. package/dist/commands/list.js +178 -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 +272 -257
  36. package/dist/config.js +611 -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 +282 -0
  46. package/dist/core/session.js +602 -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 +508 -0
  56. package/dist/documents.js +181 -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 +118 -0
  62. package/dist/index.js +61 -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 +63 -0
  74. package/dist/serve/catalog-share.js +155 -0
  75. package/dist/serve/index.d.ts +100 -0
  76. package/dist/serve/index.js +259 -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 +193 -0
  92. package/dist/tui/app.js +1400 -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 +91 -0
  106. package/dist/vocabulary.js +155 -0
  107. package/dist/web/main.js +2232 -582
  108. package/dist/web/page.html +41 -33
  109. package/dist/web/styles.css +513 -329
  110. package/dist/xdg.d.ts +76 -4
  111. package/dist/xdg.js +77 -5
  112. package/package.json +27 -8
  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,20 @@ 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 [last saved listing](#the-cache), then for
186
+ a real probe. So the page appears at once, even when the slowest runner takes
187
+ seconds. The rows update in place when the probe finishes. With nothing
188
+ saved, each runner's rows appear as that runner answers. Refresh always runs
189
+ a real probe.
161
190
 
162
191
  ## Execution, and trust
163
192
 
@@ -173,23 +202,35 @@ trusted. You grant trust once per repository, and it is remembered:
173
202
 
174
203
  ```text
175
204
  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
205
+ way trust --untrust remove this repository's whole-repository grant
206
+ way trust --untrust-all remove every grant of this repository
207
+ way trust --show report this root's trust and what decided it
208
+ way trust --list every grant, one per line
209
+ way trust --scope <tool> with a mode above: one tool's grant, such as mise
179
210
  way trust --json the same answer as one JSON object
180
211
  way trust --help this list
181
212
  ```
182
213
 
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.
214
+ Every mode prints the same JSON shape under `--json`:
215
+ `{"action": …, "changed": …, "roots": [{"root": …, "trusted": …, "by": …, "rule": …, "scope": …}]}`.
216
+ A caller does not have to branch on the flag it passed. `--list` gives one
217
+ entry per grant. `by` is `"marker" | "path" | "owner" | null` and names the
218
+ layer that decided (see [The policy](#the-policy) below). `rule` is the
219
+ matching policy entry, present only when `by` is `"path"` or `"owner"`.
220
+ `scope` is present for a one-tool grant. A `--untrust` that finds nothing to
221
+ remove still prints its object, and reports the miss with exit 1 and a line
222
+ on stderr. So a parser never gets an empty stdout.
223
+
224
+ A repository you do not trust as a whole can have single tools trusted.
225
+ `way trust --scope just` lets just run its tool while moon stays withheld.
226
+ A runner needs its own id trusted, and also each tool manager that runs
227
+ commands through itself at the root: in a repository with a `mise.toml`,
228
+ moon runs as `mise exec -- moon`, so it needs `--scope moon` and
229
+ `--scope mise`. A withheld runner's entry in `unknowns` names what it still
230
+ needs in `missing`, and once any tool is trusted its label says which, such
231
+ as `withheld: mise is not trusted`. Detection itself never runs a tool under a
232
+ tool grant. A grant is made from the command line only: the web view's
233
+ server refuses it.
193
234
 
194
235
  `-C` applies here too. Trust, with execution allowed, also lets the project
195
236
  file load tool modules; see
@@ -206,11 +247,15 @@ itself trust, just as it cannot set `allowExec: true`.
206
247
  {
207
248
  "trust": {
208
249
  "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
250
+ "owners": ["my-org", "gitlab.com/other-org"], // `origin` remote owners; bare means github.com
251
+ "tools": { "mise": { "paths": ["/home/me/scratch/**"] } } // one tool only
210
252
  }
211
253
  }
212
254
  ```
213
255
 
256
+ `trust.tools.<tool>` takes the same `paths` and `owners` and trusts that one
257
+ tool only.
258
+
214
259
  `@osdlc/trust-repo`'s `policyExecGate` checks, in order: a marker in the
215
260
  store, then `trust.paths` (a glob over the root, with symlinks resolved), then
216
261
  `trust.owners` (the host and owner in the `origin` remote's URL, which
@@ -234,39 +279,44 @@ the policy still covers the root after the marker is removed.
234
279
 
235
280
  ### Removing what it has stored
236
281
 
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.
282
+ `way clean` removes what wayfinder stores outside your repositories. Bare
283
+ `way clean` only reports, so it deletes nothing by default.
240
284
 
241
285
  ```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
286
+ way clean show each store, where it is, and what it holds
287
+ way clean --cache stored probe results
288
+ way clean --trust forget which repositories you have trusted
289
+ way clean --user-config --yes your user configuration file
290
+ way clean --dev way dev link state and the shims way dev install wrote
291
+ way clean --legacy files left under the tool's name before its first release
292
+ way clean --everything --yes every store above
293
+ way clean --json the same answer as one JSON object
248
294
  ```
249
295
 
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.
296
+ `--json` prints `{mode, stores}`, where each store is
297
+ `{key, flag, what, path, bytes, removed, envVar}`. A bare report lists every
298
+ store; `dev` shims and `legacy` files appear only when present. A removal
299
+ lists only the stores you named. `bytes` is null when nothing was stored.
253
300
  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.
301
+ `removed: false`. `envVar` names the variable that chose the path, such as
302
+ `WAYFINDER_CONFIG`. Notes go to stderr, so stdout stays one JSON document.
303
+
304
+ `--user-config` and `--everything` need `--yes`. The cache is rebuilt by one slow
305
+ probe. Losing trust means answering the trust question again for each
306
+ repository. The configuration is the only store you wrote by hand. A config
307
+ that `WAYFINDER_CONFIG` names is named again before it is removed, since it
308
+ may live in a dotfiles repository. Once a store is gone, empty directories
309
+ above it are removed, up to the base such as `~/.config`. A store whose
310
+ path is, holds or sits in another store, as when `WAYFINDER_CACHE_DIR` is
311
+ `~/.config`, is removed only with `--yes`. `clean` never
312
+ touches anything inside a repository: a project's own `wayfinder.config.json`
313
+ belongs to that project. The web view's server gets the report only.
262
314
 
263
315
  The trust store is a directory of marker files at
264
316
  `$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.
317
+ when that variable is unset. It is state, not config. The program maintains
318
+ trust, and a person does not edit it by hand. A consent record copied to a
319
+ new machine in a dotfiles repository is no longer consent.
270
320
 
271
321
  **A repository cannot trust itself.** `allowExec: true` in
272
322
  `wayfinder.config.json` is ignored with a warning, because that file lives
@@ -277,15 +327,15 @@ choose.
277
327
 
278
328
  `--exec` allows execution for one run and records nothing, which suits a
279
329
  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.
330
+ repository is. Both flags apply on every surface, including the web view,
331
+ whose every command runs with the flags `way serve` started with. The page
332
+ offers a trust grant only when one would change what is read, and asks
333
+ before it sends it.
285
334
 
286
335
  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
336
+ trust. `list` and `query` print one line on stderr. The terminal UI shows
337
+ `2 runners withheld: this repository is not trusted (^s to trust)` beside the
338
+ counts, and a `–` in place of the count on each withheld tab. The web view
289
339
  shows a **Trust this repository** button in a bar above the list, in each
290
340
  withheld runner's info panel and in the runner picker.
291
341
 
@@ -313,12 +363,18 @@ Some runners are slow to ask (moon starts its toolchain, sbt starts a JVM),
313
363
  and a browser that waits for them looks broken. `wayfinder` stores the last
314
364
  answer for each root and runner, so the UI can show rows at once.
315
365
 
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.
366
+ The terminal UI and `serve` always start from what was last shown. Every
367
+ `list`, `query` and refresh saves the catalog it showed in one file, and a
368
+ start draws that file before it reads anything else, so the rows appear in
369
+ well under a second even on a large repository. The file is used only under
370
+ the same trust and settings that produced it. Then they probe in the
371
+ background and update in place. Without it they probe and show each runner
372
+ as it answers, with the runners still loading named. `list` and `query`
373
+ re-probe on every run, because a script or an agent reading them needs what
374
+ the repository has right now. `--cached` makes `list`, `query` and `run`
375
+ answer at once from the same saved listing the UIs draw. It does not check
376
+ whether files changed since its `storedAt`. With no saved listing, `--cached`
377
+ reads the store, which does check.
322
378
 
323
379
  A stored answer is in one of three states, and every surface shows them the
324
380
  same way:
@@ -339,26 +395,42 @@ elsewhere. When a repository has no measurement yet, the surface says so
339
395
  instead of guessing a number.
340
396
 
341
397
  `^r` in the terminal UI and Refresh on the page always run a real probe. They
342
- never answer from the store.
398
+ never answer from the store. On the page, the polls join a probe that is
399
+ already running; Refresh always starts its own, so it never answers with a
400
+ probe that began before an edit.
401
+
402
+ A row from the saved listing or the store is checked before it runs: its
403
+ runner is probed again, and a task that is gone or changed is refused with
404
+ the command it runs now. A dry run is not checked.
343
405
 
344
406
  If you run a row whose task no longer exists, such as a task renamed since the
345
407
  stored probe, both surfaces tell you the row came from the store, instead of
346
408
  showing only a spawn failure.
347
409
 
348
- For the pipeable surfaces, `--cached` names the stale runners on stderr, so
349
- `--list` stays pipeable and `--json` stays parseable:
410
+ For the pipeable surfaces, `--cached` says on stderr what it answered from, so
411
+ `list` stays pipeable and `--json` stays parseable. From the saved listing:
412
+
413
+ ```text
414
+ way: --cached: the last listing, 35s old; files changed since storedAt are not checked
415
+ ```
416
+
417
+ From the store, it names the stale runners:
350
418
 
351
419
  ```text
352
- wayfinder: --cached: stale: just (35s old, refresh usually about 149ms)
353
- wayfinder: --cached: not cached, probed now: github-actions
420
+ way: --cached: just (stale: its files changed, 35s old; refresh usually about 149ms); not cached, probed now: github-actions
354
421
  ```
355
422
 
356
423
  `--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.
424
+ and says so. A runner with nothing stored is probed the same way. The `--json`
425
+ document of `list` and `query` says which it was: `source` is `"fresh"` when
426
+ every runner was probed in this call and `"cached"` when the rows came from the
427
+ store, and `storedAt` is when the oldest stored rows were probed (null when
428
+ fresh). Every `--json` document has a `cache` array, with one entry per
429
+ selected runner. After a fresh probe each entry's `probeMs` is the time that
430
+ runner took. Over HTTP the page always receives this array.
359
431
 
360
432
  The cache is at `$XDG_CACHE_HOME/wayfinder/`, or `~/.cache/wayfinder/`. It is
361
- XDG cache, not the `~/.local/state/wayfinder/` directory that
433
+ cache, not the `~/.local/state/wayfinder/` directory that
362
434
  [trust](#execution-and-trust) uses. Losing the cache costs one slow probe.
363
435
  Losing the trust store would silently un-trust repositories. The cache plays no
364
436
  part in deciding execution. A cached answer is never a trust grant, clearing
@@ -373,22 +445,10 @@ describes the limits of this.
373
445
  Options you would otherwise type on every run can live in a file: which
374
446
  runners to skip, what order to show them in, whether execution is allowed, and
375
447
  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).
448
+ defaults, the user file (`~/.config/wayfinder/config.json` by default),
449
+ `wayfinder.config.json` at the project root, then the flags on the command
450
+ line. `trust`, `open`, `theme` and `skills` count only in the user file, and a
451
+ project file can lower `allowExec` but never raise it.
392
452
 
393
453
  ```text
394
454
  way config list [--json] every setting, and the layer it came from
@@ -396,45 +456,110 @@ way config get <key> one setting's effective value,
396
456
  way config set <key> <value> [--user|--project] write a setting (default --project)
397
457
  way config unset <key> [--user|--project] remove a setting (default --project)
398
458
  way config path where each layer's file lives
399
- way config --help this list
459
+ way config explain <key> how a setting got its value, layer by layer
460
+ ```
461
+
462
+ [Configuration](docs/guide/configuration.md) has every key, the merge rules,
463
+ the paths and the variables that move them, and the exit codes. The package
464
+ ships the file's JSON Schema at `schema/config.json`.
465
+
466
+ ## Commands
467
+
468
+ ```text
469
+ way [dir] the terminal UI (the default command)
470
+ way list [dir] print one command line per task; --json for the catalog
471
+ way query <terms> the tasks matching a search, best match first
472
+ way run <id> [-- args] run one task, with its exit code; --dry-run for the plan
473
+ way serve the same catalog as a live page
474
+ way providers the registered tools, built-in and your own
475
+ way config | trust | clean | guide
476
+ way help [command] help for a command; --all for every flag
477
+ way schema <command> the JSON Schema of a command's --json document
478
+ way --version
479
+ ```
480
+
481
+ `run` takes a task's `id` or its command line, when only one task has it, such
482
+ as `way run 'npm run build'`. Arguments after `--` are bound the way the tool
483
+ expects, as the terminal UI and the page bind them. A task that ends on a
484
+ signal exits 128 plus the signal number. `--dry-run --json` prints the
485
+ `argv`, `cwd` and `env` it would run. A plain `run --json` is refused,
486
+ because the task owns stdout.
487
+
488
+ Global flags go before or after the command word: `way -C ../app list` and
489
+ `way list -C ../app` are the same. A start directory that does not exist is an
490
+ error, so a mistyped command (`way lsit`) is reported with the closest one.
491
+ Messages on stderr start with `way:`.
492
+
493
+ ### Filters
494
+
495
+ `list` and `query` take the same filters, in text and in JSON:
496
+
497
+ ```text
498
+ --services only tasks that run until you stop them
499
+ --declared only tasks a file declares, not ones from a convention
500
+ --depth N only tasks whose source is at most N directories deep
501
+ --cached answer from the last saved listing; files are not checked
502
+ ```
503
+
504
+ ### Documents
505
+
506
+ Every `--json` answer is one object with `schemaVersion` and `kind`:
507
+ `catalog` (`list`), `query`, `run`, `providers`, `trust`, `clean`, `guide`,
508
+ `config-<name>` for each `config` subcommand (`config-list`, `config-set` and
509
+ the rest), and the framework's `help`, `schema`, `version` and `error`.
510
+ `way schema list` prints a command's input and document schemas. Every
511
+ document's schema is exported from `@osdlc/wayfinder/schema`:
512
+
513
+ ```ts
514
+ import { catalogDocumentSchema, documentZod } from '@osdlc/wayfinder/schema'
515
+
516
+ const doc = documentZod('catalog').parse(JSON.parse(output))
400
517
  ```
401
518
 
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.
519
+ | Export | Is |
520
+ |---|---|
521
+ | `catalogSchema`, `taskSchema`, `runnerReportSchema`, `paramSchema`, `toolInfoSchema`, `CATALOG_SCHEMA_VERSION` | system-model's catalog schemas |
522
+ | `catalogDocumentSchema`, `queryDocumentSchema`, `runDocumentSchema`, `providersDocumentSchema`, `trustDocumentSchema`, `cleanDocumentSchema` | the JSON Schema of each document |
523
+ | `DOCUMENT_SCHEMAS`, `DOCUMENT_VERSIONS`, `DOCUMENT_KINDS` | every document's schema and `schemaVersion`, by `kind`, and the kinds |
524
+ | `JsonSchema`, `DocumentKind` | the types of a schema and of a `kind` |
525
+ | `documentZod(kind)` | a Zod schema that parses a document |
406
526
 
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.
527
+ The `catalog` and `query` documents carry `cache`, `filter` and `unknowns`.
528
+ `unknowns` lists what could not be read, each with the `label` the stderr note
529
+ prints: a runner withheld for trust, tasks whose parameters are unknown and
530
+ why, a stale stored answer, a tool missing from `PATH`.
410
531
 
411
- ### `allowExec` here
532
+ ### Progress lines
412
533
 
413
- wayfinder's execution default is `true`, and any file overrides it. Highest
414
- precedence first:
534
+ `way list --progress --output jsonl` prints a `catalog-progress` line as each
535
+ runner answers, then the reports. The first line names every runner in
536
+ `pending`, in display order. Each later line carries the runner that answered
537
+ in `report`, with its `cache` verdict and `unknowns`, and the runners still
538
+ out in `pending`. A report too large for one line (about 1 MiB) is named in
539
+ `omitted` instead and comes with the reports. Over HTTP, `way serve` sends the
540
+ same lines as NDJSON when the request asks for `application/x-ndjson`, with
541
+ the catalog document last. `way schema` describes the line.
415
542
 
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`
543
+ ### Old flags
419
544
 
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)`.
545
+ These still work in this release and will be removed in a later one:
422
546
 
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.
547
+ ```text
548
+ way --serve way serve
549
+ way --list way list
550
+ way --json way list --json
551
+ way query --list way query
552
+ ```
553
+
554
+ Two of them at once are refused.
426
555
 
427
556
  ## Options
428
557
 
429
558
  ```text
430
- query <terms> the tasks matching a search, best match first
431
559
  --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
560
+ --port N with serve: a fixed port
561
+ --no-open with serve: print the URL rather than opening a browser
562
+ --json with a data command: print its document
438
563
 
439
564
  --no-exec skip runners that must run a subprocess
440
565
  --exec allow them for this run only, without recording trust
@@ -446,34 +571,24 @@ query <terms> the tasks matching a search, best match first
446
571
  --discovery M git | walk | auto (default: auto)
447
572
  -C, --dir PATH directory to inspect (default: cwd)
448
573
  --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
574
  ```
460
575
 
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.
576
+ `config`, `trust`, `clean` and `guide` read their own flags. Of the global
577
+ flags they take only `-C`, and only where the answer depends on the
578
+ repository:
464
579
 
465
580
  | Subcommand | `-C, --dir` | Why |
466
581
  |---|---|---|
467
582
  | `config` | yes | reports the configuration THAT directory resolves |
468
583
  | `trust` | yes | the grant keys on that directory's project root |
469
584
  | `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 |
585
+ | `clean` | accepted, unused | resolves every path from the environment and the home directory |
586
+ | `guide` | accepted, unused | its argument is a topic name |
472
587
  | `dev` | no | its state is devlink's, keyed on the tool name; not listed in the help |
473
588
 
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
589
+ `way help` lists the commands and the global flags. `way help <command>` and
590
+ `way <command> --help` show one command, and `--all` adds every note. `way
591
+ --help --all` is the full flag list shown above. `way guide` is the long
477
592
  form, by topic. A usage error, such as a mistyped flag, prints the short form,
478
593
  so the error is not lost in the full list.
479
594
 
@@ -491,7 +606,7 @@ built-ins. A module that exports `tools`, an array of them, can be loaded three
491
606
  ways:
492
607
 
493
608
  ```sh
494
- way --config ./acme-tools.ts --list # this run only
609
+ way --config ./acme-tools.ts list # this run only
495
610
  way config set --user tools '["~/acme-tools.mjs"]' # every run, from your user file
496
611
  way config set tools '["./tools/acme.mjs"]' # this repository, once trusted with exec on
497
612
  ```
@@ -506,12 +621,57 @@ repository is trusted and execution is allowed (`allowExec` not `false`, no
506
621
 
507
622
  `way providers` lists every registered tool: its roles, its runner kind
508
623
  (`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
624
+ whether that binary is on PATH, its language (`any language` for make, just
625
+ and the like), whether it is built in or custom, and its homepage. `--json`
626
+ gives the same rows as data, with a one-line `description`. Only absolute PATH entries count, as in
511
627
  detection: a tool found only through a relative entry (`bin`, `.`,
512
628
  `node_modules/.bin`) reads as not installed. Put an absolute entry for it on
513
629
  PATH.
514
630
 
631
+ ## Library
632
+
633
+ The package's root entry builds the same catalog from code, without spawning
634
+ `way`. It runs on Node.
635
+
636
+ ```ts
637
+ import { buildCatalog, filterTasks, terminalSafe } from '@osdlc/wayfinder'
638
+
639
+ const doc = await buildCatalog({ dir: '.', flags: { allowExec: false } })
640
+ for (const hit of filterTasks(doc.reports, { query: 'dev' })) {
641
+ console.log(terminalSafe(hit.task.display))
642
+ }
643
+ ```
644
+
645
+ `buildCatalog` takes what the CLI takes as flags (`flags`, `cached`,
646
+ `filter`) and returns the `catalog` document `way list --json` prints. It
647
+ reads the same config files, applies the same trust gate and writes the same
648
+ probe store. Nothing in the repository runs unless it is trusted and
649
+ execution is allowed. It throws `SessionError` with a `code` for a directory
650
+ that does not exist, a config file that cannot be used, or a tool module that
651
+ cannot be loaded. `onWarning` gets each warning the CLI prints on stderr,
652
+ such as a project file key that is ignored. `progress` hears about each
653
+ runner as it answers: `onRunners(ids)` once, then `onRunner(report, cache)`
654
+ per runner, withheld ones included, so a caller can show the catalog before
655
+ the slowest runner is done.
656
+
657
+ | Export | Is |
658
+ |---|---|
659
+ | `buildCatalog`, `BuildCatalogOptions`, `CatalogDocument`, `SessionFlags`, `CacheState`, `CatalogProgress` | the catalog for a directory, the flags it takes, each runner's cache verdict and each runner as it answers |
660
+ | `filterTasks`, `keepsTask`, `sourceDepth`, `hasQuery`, `TaskFilter`, `TaskHit`, `Mode` | the search and filters every surface uses |
661
+ | `filterSkills`, `skillLine`, `SkillRow`, `SkillHit`, `SkillsSetting`, `SKILLS_SETTING_VALUES` | the Skills group |
662
+ | `GROUPS`, `SKILLS_GROUP`, `groupOf`, `catalogGroups`, `documentGroups`, `Group`, `GroupId`, `DocumentGroup` | the groups and their order |
663
+ | `unknownsOf`, `unknownLine`, `Unknown`, `UnknownsInput`, `WithheldReason` | what could not be read, with its label |
664
+ | `runnerLabel`, `withheldLabel`, `languageLabel`, `ANY_LANGUAGE`, `toolSummary`, `ToolSummary` | the words a person reads |
665
+ | `terminalSafe`, `jsonText` | repository text made safe for a terminal |
666
+ | `SessionError` | why a catalog could not be built |
667
+ | `Catalog`, `RunnerReport`, `Task`, `Param`, `ToolDef`, `DiscoveryMode`, `RunnerCacheState`, `ParametersUnknownReason`, `StaleReason` | system-model's types |
668
+
669
+ Repository text (task names, skill descriptions, paths) can hold terminal
670
+ control characters. Pass it through `terminalSafe` before printing it.
671
+ Other paths into the package are closed; `@osdlc/wayfinder/schema` is the
672
+ other entry. Before 1.0 a minor release may change these names, and the
673
+ changelog says how.
674
+
515
675
  ## How it compares
516
676
 
517
677
  - **Each tool's own list** (`just --list`, `npm run`, `moon query tasks`)