@osdlc/wayfinder 0.7.4 → 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 +214 -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/dist/tui.d.ts DELETED
@@ -1,177 +0,0 @@
1
- /**
2
- * The terminal UI: browse every task in a repository, and run one.
3
- *
4
- * Unlike the page, Enter runs the selected task in this shell and hands it the
5
- * terminal. The page can only give you a command to paste.
6
- *
7
- * No dependencies: raw mode, ANSI, and one frame string per keystroke. A TUI
8
- * toolkit would weigh more than the code it saves, and this has to keep
9
- * working from a checkout whose node_modules is what you are trying to repair.
10
- * The CLI sends its output through `CliIo` so `main()` can be tested without
11
- * a real stream. This file writes to `process.stdout` directly, because its
12
- * job is to control the terminal: raw mode, the alternate screen, and handing
13
- * the terminal to a spawned task.
14
- *
15
- * Collection is async, which is what most of the state handling below is for:
16
- * keystrokes arrive during a refresh, and a row can be stale.
17
- */
18
- import { type Catalog, type Project, type RunnerCacheState, type Task } from '@osdlc/system-model/detect';
19
- import { type Mode } from '@osdlc/system-model/match';
20
- import type { ExecGate } from '@osdlc/trust-repo';
21
- import { type WayOptions } from './catalog.ts';
22
- export interface Row {
23
- task: Task;
24
- score: number;
25
- labelHits: number[] | null;
26
- }
27
- interface State {
28
- catalog: Catalog | null;
29
- /** The registered tools, built-ins plus any loaded. */
30
- project: Project;
31
- /**
32
- * The project file names tools that were not loaded, because the repository
33
- * is untrusted or execution is off.
34
- */
35
- projectToolsPending: boolean;
36
- root: string;
37
- options: WayOptions;
38
- /** `runners.order` from config; applied to every collected catalog. */
39
- runnerOrder: string[] | undefined;
40
- /**
41
- * The trust store's environment and home, passed from the CLI. Injectable so
42
- * a test does not grant trust in the developer's own
43
- * `~/.local/state/wayfinder/`. Only tests pass them.
44
- */
45
- env: Record<string, string | undefined> | undefined;
46
- home: string | undefined;
47
- /** Where stored probes live, resolved once from the injected env and home. */
48
- store: string;
49
- /**
50
- * Where each runner's rows came from, one entry per selected runner.
51
- *
52
- * At start the screen shows the store before anything is probed, so a row
53
- * may be an hour old. This records which rows are, and is reset to all-fresh
54
- * as soon as a real probe finishes.
55
- */
56
- cache: RunnerCacheState[];
57
- runner: string;
58
- query: string;
59
- mode: Mode;
60
- /** Show only services — tasks that run until you stop them. Toggled by ^t. */
61
- servicesOnly: boolean;
62
- /** Selection is held by task id, not row index — see `refresh`. */
63
- selectedId: string | null;
64
- scroll: number;
65
- message: string;
66
- loading: boolean;
67
- /**
68
- * Why execution is on or off, decided once by the CLI. Only `"untrusted"`
69
- * offers ^s. When a config file turned execution off, trusting the
70
- * repository would change nothing, so offering it would mislead.
71
- */
72
- gate: ExecGate | null;
73
- /**
74
- * True once ^s has asked and is waiting for `y`. Trust lets this
75
- * repository's code run, so one keystroke cannot grant it. This matters
76
- * most for ^s, which is flow control on many terminals and can be sent by
77
- * accident. The second key makes it a decision.
78
- */
79
- confirmingTrust: boolean;
80
- /**
81
- * The task whose arguments are being typed, and what has been typed so far.
82
- *
83
- * Set only for a task that declares parameters. `argv` leaves them out, so
84
- * running it straight from Enter would spawn `just deploy` with no
85
- * environment, and the terminal would be handed over before anything could
86
- * say so. For a task with no parameters it stays null and Enter runs it.
87
- */
88
- entering: {
89
- task: Task;
90
- text: string;
91
- } | null;
92
- /**
93
- * The settings screen's rendered lines, or null when it is closed.
94
- *
95
- * Rendered once on open rather than on every frame. It reads the config
96
- * from disk, and nothing on this screen can change it, so re-reading it per
97
- * keystroke would be wasted work.
98
- */
99
- settings: string[] | null;
100
- /** Increased on each refresh, so an older result cannot overwrite a newer one. */
101
- generation: number;
102
- inFlight: AbortController | null;
103
- rows: Row[];
104
- }
105
- /**
106
- * The module singleton.
107
- *
108
- * Exported for one reason. `runTui` takes over a real terminal and never
109
- * returns, so the selection rule (the selection must survive a refresh that
110
- * reorders or drops rows under the cursor) can only be tested through this
111
- * and {@link recompute}. Nothing outside a test writes to it.
112
- */
113
- export declare const state: State;
114
- /**
115
- * What the status line says about the rows on screen, in three states.
116
- *
117
- * Fresh says nothing. A line that is always shown is a line nobody reads,
118
- * and there is nothing to report.
119
- *
120
- * Stale and slow is kept apart from ordinary stale because it is the case the
121
- * cache exists for. A runner measured at several seconds in this repository
122
- * is why the screen would otherwise be empty. Showing it the same way as a
123
- * 200ms refresh would hide the one warning that matters. Slowness is
124
- * measured, never assumed: a runner that is quick here is not called slow
125
- * because it is slow elsewhere.
126
- */
127
- export declare function refreshNote(rows: readonly RunnerCacheState[], loading: boolean): {
128
- text: string;
129
- slow: boolean;
130
- } | null;
131
- /** Index of the selected task, or 0 when its id is no longer present. */
132
- export declare function cursor(): number;
133
- /**
134
- * The whole screen as one string.
135
- *
136
- * Exported with {@link state} and {@link recompute} so tests can check the
137
- * three cache states in the rendered lines, not only in the helper that
138
- * builds them. The user reads the status line, and a correct note placed in
139
- * the wrong line helps nobody.
140
- */
141
- export declare function frame(width: number, height: number): string;
142
- /**
143
- * Rebuild the visible rows and re-anchor the selection onto a task that is
144
- * still there.
145
- *
146
- * Split out of {@link draw} so it can be tested without a terminal. This is
147
- * why selection is held by task id: a refresh reorders and drops rows, and an
148
- * index would silently point at a different task, so the same keystroke
149
- * would run the wrong command.
150
- */
151
- export declare function recompute(): void;
152
- /**
153
- * One keystroke.
154
- *
155
- * Exported for the same reason `state` is. `runTui` takes over a real
156
- * terminal and never returns, so tests reach the keys that touch disk
157
- * (settings, trust) only through this.
158
- */
159
- export declare function handle(key: string): void;
160
- /**
161
- * `gate` is the trust decision the CLI already made. The TUI needs the whole
162
- * decision, not just its boolean. "No exec because a file said so" and "no
163
- * exec because this repository is not trusted" need different messages, and
164
- * only the second has a key that fixes it.
165
- */
166
- export interface TuiOptions {
167
- project: Project;
168
- projectToolsPending?: boolean | undefined;
169
- root: string;
170
- options: WayOptions;
171
- runnerOrder?: string[] | undefined;
172
- gate?: ExecGate | undefined;
173
- env?: Record<string, string | undefined> | undefined;
174
- home?: string | undefined;
175
- }
176
- export declare function runTui({ project, projectToolsPending, root, options, runnerOrder, gate, env, home, }: TuiOptions): Promise<number>;
177
- export {};