@osdlc/wayfinder 0.7.0 → 0.7.2
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.
- package/CHANGELOG.md +37 -0
- package/README.md +210 -182
- package/SECURITY.md +39 -1
- package/bin/way.js +14 -9
- package/dist/args.d.ts +16 -16
- package/dist/args.js +19 -19
- package/dist/cache.js +3 -4
- package/dist/clean-command.d.ts +18 -18
- package/dist/clean-command.js +35 -36
- package/dist/cli.d.ts +19 -20
- package/dist/cli.js +76 -69
- package/dist/config-command.d.ts +15 -14
- package/dist/config-command.js +63 -59
- package/dist/config.d.ts +135 -130
- package/dist/config.js +156 -149
- package/dist/devlink.d.ts +6 -2
- package/dist/devlink.js +7 -2
- package/dist/guide.js +5 -4
- package/dist/origin-owner.d.ts +7 -2
- package/dist/origin-owner.js +20 -4
- package/dist/providers-command.d.ts +1 -1
- package/dist/providers-command.js +11 -23
- package/dist/serve.d.ts +43 -42
- package/dist/serve.js +251 -258
- package/dist/terminal-text.d.ts +57 -0
- package/dist/terminal-text.js +91 -0
- package/dist/tools.d.ts +4 -4
- package/dist/tools.js +4 -4
- package/dist/trust-command.d.ts +6 -7
- package/dist/trust-command.js +48 -50
- package/dist/trust-store.d.ts +1 -1
- package/dist/tui.d.ts +65 -66
- package/dist/tui.js +124 -130
- package/dist/web/main.js +371 -386
- package/dist/web/page.html +6 -5
- package/dist/web/styles.css +258 -271
- package/package.json +9 -9
package/dist/config.d.ts
CHANGED
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* wayfinder's configuration
|
|
3
|
-
*
|
|
2
|
+
* wayfinder's configuration. It is layered, and reading it runs nothing.
|
|
3
|
+
* Settings people want on every run (runners to skip, paths that are not
|
|
4
4
|
* project structure, whether execution is allowed, extra tools) are set once,
|
|
5
|
-
* per user and per project
|
|
5
|
+
* per user and per project. Flags are for one-off changes.
|
|
6
6
|
*
|
|
7
7
|
* ## Layers, lowest precedence first
|
|
8
8
|
*
|
|
9
9
|
* 1. `DEFAULT_CONFIG` — the built-in defaults.
|
|
10
10
|
* 2. USER — `$XDG_CONFIG_HOME/wayfinder/config.json`, or `~/.config/wayfinder/config.json`
|
|
11
|
-
* when `XDG_CONFIG_HOME` is unset.
|
|
11
|
+
* when `XDG_CONFIG_HOME` is unset or relative.
|
|
12
12
|
* 3. PROJECT — `wayfinder.config.json` at the root `findRoot` resolves.
|
|
13
|
-
* 4. CLI flags
|
|
14
|
-
*
|
|
13
|
+
* 4. CLI flags, applied by the caller. {@link collectOptionsFromConfig}
|
|
14
|
+
* returns the options a caller spreads its own flags on top of.
|
|
15
15
|
*
|
|
16
|
-
* `allowExec`
|
|
17
|
-
* `false
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* repository.
|
|
16
|
+
* `allowExec` is an exception to this order. The project layer may lower it to
|
|
17
|
+
* `false`, since a repository asking not to be run is safe to honour. It can
|
|
18
|
+
* never raise it to `true`. `wayfinder.config.json` lives inside the repository
|
|
19
|
+
* being scanned, so honouring `allowExec: true` from it would let a repository
|
|
20
|
+
* authorize running its own code. So `allowExec: true` is removed from the
|
|
21
|
+
* project layer before merging, with a warning. Only the user layer and the CLI
|
|
22
|
+
* flags can turn execution on. To give a repository lasting permission, run
|
|
23
|
+
* `way trust`, which records the consent outside the repository.
|
|
25
24
|
*
|
|
26
25
|
* `tools` is gated too, because a tool module is code. User-layer entries
|
|
27
26
|
* always load; project-layer entries load only when the repository is trusted
|
|
28
27
|
* and execution is allowed (see `tools.ts`).
|
|
29
28
|
*
|
|
30
|
-
* `trust`
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* `
|
|
36
|
-
*
|
|
37
|
-
*
|
|
29
|
+
* `trust` is a stricter exception. It has no lower setting a project could
|
|
30
|
+
* choose, so the whole project-layer `trust` block is dropped, with a warning
|
|
31
|
+
* when it is not empty. A repository must not be able to pre-authorize itself,
|
|
32
|
+
* or any group of repositories that includes it. Only the user layer's `trust`
|
|
33
|
+
* reaches `@osdlc/trust-repo`'s `policyExecGate`, which combines it with the
|
|
34
|
+
* marker store that `way trust` writes to. See that package's README for the
|
|
35
|
+
* glob dialect, and `origin-owner.ts` for the origin-remote lookup that
|
|
36
|
+
* `trust.owners` uses.
|
|
38
37
|
*
|
|
39
|
-
* XDG
|
|
40
|
-
* with a dotfiles repository expects this beside their other
|
|
38
|
+
* XDG paths are used on every platform, macOS included, as `gh` does. A
|
|
39
|
+
* developer with a dotfiles repository expects this file beside their other
|
|
40
|
+
* tool config.
|
|
41
41
|
*
|
|
42
|
-
* `WAYFINDER_CONFIG=/path/to/file`
|
|
43
|
-
*
|
|
44
|
-
* still read from the project root
|
|
45
|
-
*
|
|
46
|
-
*
|
|
42
|
+
* `WAYFINDER_CONFIG=/path/to/file` changes only where the user layer is read
|
|
43
|
+
* from. The named file is read instead of the XDG path. The project layer is
|
|
44
|
+
* still read from the project root and still merges on top. Naming a file that
|
|
45
|
+
* does not exist is an error, not an empty layer: an env var that points at
|
|
46
|
+
* nothing is a typo. A relative value is ignored with a warning, and the XDG
|
|
47
|
+
* path is read instead.
|
|
47
48
|
*
|
|
48
49
|
* ## The old waypost names
|
|
49
50
|
*
|
|
@@ -59,10 +60,10 @@
|
|
|
59
60
|
*
|
|
60
61
|
* ## Merge rule
|
|
61
62
|
*
|
|
62
|
-
* Objects merge key
|
|
63
|
-
*
|
|
64
|
-
* "which ones, in what order"
|
|
65
|
-
* that list, not that list appended to
|
|
63
|
+
* Objects merge key by key. Everything else, scalars and arrays alike,
|
|
64
|
+
* replaces the lower value whole. Arrays replace because each array setting
|
|
65
|
+
* answers "which ones, in what order". A project that says `order: ["just"]`
|
|
66
|
+
* means that list, not that list appended to the user's.
|
|
66
67
|
*
|
|
67
68
|
* user { runners: { disabled: ["cargo"], order: ["moon"] } }
|
|
68
69
|
* project { runners: { order: ["just"] } }
|
|
@@ -70,12 +71,12 @@
|
|
|
70
71
|
*
|
|
71
72
|
* ## Unknown keys and broken files
|
|
72
73
|
*
|
|
73
|
-
* An unknown key is a
|
|
74
|
-
* file still loads
|
|
75
|
-
* older one. A file
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
74
|
+
* An unknown key is a warning naming the file and the key, and the rest of the
|
|
75
|
+
* file still loads. A config written for a newer version must not break an
|
|
76
|
+
* older one. A malformed file, or a value of the wrong type for a known key, is
|
|
77
|
+
* a {@link ConfigError} naming the file and the problem. There is no silent
|
|
78
|
+
* fallback: a setting that quietly did not apply is worse than one that refused
|
|
79
|
+
* to load.
|
|
79
80
|
*/
|
|
80
81
|
import { type PolicyDecisionOptions, type TrustPolicy } from '@osdlc/trust-repo';
|
|
81
82
|
import type { DiscoveryMode } from '@osdlc/system-model/detect';
|
|
@@ -100,27 +101,28 @@ export interface RunnersConfig {
|
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
102
103
|
* The policy `@osdlc/trust-repo`'s `policyExecGate` decides trust over, on
|
|
103
|
-
* top of the marker store `way trust` writes to.
|
|
104
|
-
*
|
|
105
|
-
* entry is dropped before the merge, with a warning.
|
|
104
|
+
* top of the marker store `way trust` writes to. User layer only (see the
|
|
105
|
+
* module docblock). A project-layer block is dropped before the merge.
|
|
106
106
|
*/
|
|
107
107
|
export interface TrustConfig {
|
|
108
108
|
/**
|
|
109
109
|
* Glob patterns (`@osdlc/trust-repo`'s dialect: `*`, `?`, `**`, a trailing
|
|
110
|
-
* `/**` matching descendants only) over the
|
|
111
|
-
*
|
|
112
|
-
* vocabulary here the way sdlc's `paths:` map has one.
|
|
110
|
+
* `/**` matching descendants only) over the repo root with symlinks resolved.
|
|
111
|
+
* A leading `~` expands against `home`. There are no `{name}` tokens.
|
|
113
112
|
*/
|
|
114
113
|
paths?: string[];
|
|
115
|
-
/**
|
|
114
|
+
/**
|
|
115
|
+
* Origin remote owners that trust a root without a marker: `host/owner`, or
|
|
116
|
+
* a bare `owner` for `github.com/owner`. Case-insensitive.
|
|
117
|
+
*/
|
|
116
118
|
owners?: string[];
|
|
117
119
|
}
|
|
118
120
|
/**
|
|
119
121
|
* The whole configuration document, schema v1.
|
|
120
122
|
*
|
|
121
|
-
* A type alias rather than an interface so it
|
|
122
|
-
* signature
|
|
123
|
-
*
|
|
123
|
+
* A type alias rather than an interface, so it has an implicit index
|
|
124
|
+
* signature. That lets {@link setConfigValue} and the related functions take
|
|
125
|
+
* both this and the raw record read from a file.
|
|
124
126
|
*/
|
|
125
127
|
export type TaskConfig = {
|
|
126
128
|
runners?: RunnersConfig;
|
|
@@ -132,18 +134,17 @@ export type TaskConfig = {
|
|
|
132
134
|
* matches any path segment; a value with a slash matches a path prefix from
|
|
133
135
|
* the root, taking the tree beneath it.
|
|
134
136
|
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
137
|
+
* Use it to mark a tree as data rather than project structure, such as a
|
|
138
|
+
* fixture repo or a vendored sample. `runners.disabled` turns a runner off
|
|
139
|
+
* everywhere in the project. This leaves the runner on and narrows where it
|
|
140
|
+
* looks.
|
|
139
141
|
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* the usual replace-wholesale rule applies if both do.
|
|
142
|
+
* It usually belongs in the project layer: which trees are fixtures is a fact
|
|
143
|
+
* about the repository, the same for everyone working in it. The user layer
|
|
144
|
+
* may set it too, and then the project value replaces the user value whole.
|
|
144
145
|
*/
|
|
145
146
|
excludePaths?: string[];
|
|
146
|
-
/**
|
|
147
|
+
/** User layer only. See {@link TrustConfig} and the module docblock. */
|
|
147
148
|
trust?: TrustConfig;
|
|
148
149
|
/**
|
|
149
150
|
* Modules that export extra `ToolDef`s, as paths. A relative path resolves
|
|
@@ -155,8 +156,8 @@ export type TaskConfig = {
|
|
|
155
156
|
/**
|
|
156
157
|
* The built-in defaults layer.
|
|
157
158
|
*
|
|
158
|
-
* Every leaf is present,
|
|
159
|
-
*
|
|
159
|
+
* Every leaf is present, so {@link LoadedConfig.sources} has an entry for
|
|
160
|
+
* every key. A key set in no file is attributed to this layer.
|
|
160
161
|
*/
|
|
161
162
|
export declare const DEFAULT_CONFIG: Required<TaskConfig>;
|
|
162
163
|
export type ConfigLayer = 'default' | 'user' | 'project';
|
|
@@ -171,6 +172,14 @@ export interface ConfigLocations {
|
|
|
171
172
|
userLegacy: boolean;
|
|
172
173
|
/** The old waypost user file, when it exists beside the new one and is ignored. */
|
|
173
174
|
userIgnored: string | null;
|
|
175
|
+
/**
|
|
176
|
+
* A relative {@link CONFIG_ENV_VAR} (or old-name) value, which is ignored:
|
|
177
|
+
* the variable and its value. Null when none was ignored.
|
|
178
|
+
*/
|
|
179
|
+
userEnvIgnored: {
|
|
180
|
+
variable: string;
|
|
181
|
+
value: string;
|
|
182
|
+
} | null;
|
|
174
183
|
/**
|
|
175
184
|
* Absolute path of `<root>/wayfinder.config.json`, whether or not it exists,
|
|
176
185
|
* or of `<root>/waypost.config.json` when only that one exists.
|
|
@@ -196,67 +205,62 @@ export declare class ConfigError extends Error {
|
|
|
196
205
|
/**
|
|
197
206
|
* Every settable key, in schema order — the dotted names `config set` accepts.
|
|
198
207
|
*
|
|
199
|
-
* Derived from {@link FIELDS}
|
|
200
|
-
*
|
|
208
|
+
* Derived from {@link FIELDS}, so anything that lists the keys (the `guide`
|
|
209
|
+
* command's config section) stays in step with the schema.
|
|
201
210
|
*/
|
|
202
211
|
export declare const CONFIG_KEYS: readonly string[];
|
|
203
212
|
/**
|
|
204
|
-
* Resolve where each layer's file lives. `env` and `home` are injectable
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* waypost fallback (see the module docblock).
|
|
213
|
+
* Resolve where each layer's file lives. `env` and `home` are injectable so a
|
|
214
|
+
* test does not read the developer's own `~/.config`. The only other input is
|
|
215
|
+
* whether a file exists, which picks between a new name and its old waypost
|
|
216
|
+
* name (see the module docblock).
|
|
209
217
|
*
|
|
210
|
-
*
|
|
218
|
+
* Rules for a path taken from the environment:
|
|
211
219
|
*
|
|
212
220
|
* A leading `~` is expanded against `home`. A shell expands it before exec, but
|
|
213
|
-
* `.env` loaders, direnv and CI YAML
|
|
214
|
-
* `~/config.json`
|
|
215
|
-
* wrong answer this module refuses to give anywhere else.
|
|
221
|
+
* `.env` loaders, direnv and CI YAML pass the literal tilde through. Without
|
|
222
|
+
* this, `~/config.json` would silently become `<somewhere>/~/config.json`.
|
|
216
223
|
*
|
|
217
|
-
* A
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
224
|
+
* A relative `XDG_CONFIG_HOME` is ignored, as the XDG spec says. A relative
|
|
225
|
+
* `WAYFINDER_CONFIG` is ignored too, and `userEnvIgnored` says so. Resolved
|
|
226
|
+
* against the root, or against the cwd, which is usually the root, it would
|
|
227
|
+
* name a file inside the repository being scanned, and the user layer can
|
|
228
|
+
* turn execution on and load tools.
|
|
222
229
|
*/
|
|
223
230
|
export declare function configLocations(root: string, env?: Record<string, string | undefined>, home?: string): ConfigLocations;
|
|
224
231
|
/**
|
|
225
232
|
* Validate a parsed JSON document against schema v1.
|
|
226
233
|
*
|
|
227
|
-
* Throws {@link ConfigError} on a type
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
* {@link readRawConfigFile}.
|
|
234
|
+
* Throws {@link ConfigError} on a type error. Returns the known keys plus one
|
|
235
|
+
* warning per unknown key. Because the result holds only known keys, the write
|
|
236
|
+
* path never goes through this shape (see {@link readRawConfigFile}).
|
|
231
237
|
*/
|
|
232
238
|
export declare function validateConfig(raw: unknown, file: string): {
|
|
233
239
|
config: TaskConfig;
|
|
234
240
|
warnings: string[];
|
|
235
241
|
};
|
|
236
242
|
/**
|
|
237
|
-
* Merge `over` onto `base` per the module's rule: objects key
|
|
238
|
-
* arrays
|
|
243
|
+
* Merge `over` onto `base` per the module's rule: objects key by key, scalars
|
|
244
|
+
* and arrays replaced whole.
|
|
239
245
|
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* `DEFAULT_CONFIG`.
|
|
246
|
+
* Neither argument is changed, and the result shares no object or array with
|
|
247
|
+
* either, including branches `over` does not mention. Mutating a loaded config
|
|
248
|
+
* must not change `DEFAULT_CONFIG`.
|
|
244
249
|
*/
|
|
245
250
|
export declare function mergeConfig(base: TaskConfig, over: TaskConfig): TaskConfig;
|
|
246
251
|
/**
|
|
247
252
|
* The file's parsed object, unvalidated and with every key intact.
|
|
248
253
|
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* file does not exist.
|
|
254
|
+
* `set` and `unset` edit this object, not the validated shape, because
|
|
255
|
+
* validation drops unknown keys. Writing a validated document back would
|
|
256
|
+
* silently delete a setting a newer version had written. `null` when the file
|
|
257
|
+
* does not exist.
|
|
254
258
|
*/
|
|
255
259
|
export declare function readRawConfigFile(file: string): Promise<Record<string, unknown> | null>;
|
|
256
260
|
/**
|
|
257
|
-
* Read, parse and validate one layer. `null` when the file does not exist
|
|
258
|
-
*
|
|
259
|
-
*
|
|
261
|
+
* Read, parse and validate one layer. `null` when the file does not exist,
|
|
262
|
+
* which is normal and not an error. A file that exists and is broken throws
|
|
263
|
+
* {@link ConfigError}.
|
|
260
264
|
*/
|
|
261
265
|
export declare function readConfigFile(file: string): Promise<{
|
|
262
266
|
config: TaskConfig;
|
|
@@ -268,21 +272,21 @@ export declare function readConfigFile(file: string): Promise<{
|
|
|
268
272
|
* Parent directories are created.
|
|
269
273
|
*
|
|
270
274
|
* The order is fixed so that writing an unchanged document produces an
|
|
271
|
-
* unchanged file
|
|
275
|
+
* unchanged file. A config under version control should not show a diff
|
|
272
276
|
* because a key moved.
|
|
273
277
|
*
|
|
274
|
-
* Accepts a raw record as well as a {@link TaskConfig},
|
|
275
|
-
* unknown
|
|
278
|
+
* Accepts a raw record as well as a {@link TaskConfig}, so an edit can keep
|
|
279
|
+
* unknown keys.
|
|
276
280
|
*/
|
|
277
281
|
export declare function writeConfigFile(file: string, config: TaskConfig | Record<string, unknown>): Promise<void>;
|
|
278
282
|
export interface LoadedConfig {
|
|
279
|
-
/** Defaults, then user, then project.
|
|
283
|
+
/** Defaults, then user, then project, merged. The values a caller should use. */
|
|
280
284
|
effective: TaskConfig;
|
|
281
285
|
/**
|
|
282
|
-
* The layers as they were
|
|
283
|
-
* `allowExec: true` removed, so it matches
|
|
284
|
-
*
|
|
285
|
-
* written.
|
|
286
|
+
* The layers as they were applied. `project` has already had a rejected
|
|
287
|
+
* `allowExec: true` and any `trust` block removed, so it matches `effective`
|
|
288
|
+
* and `sources`. Read the file itself with {@link readRawConfigFile} to see
|
|
289
|
+
* what was written.
|
|
286
290
|
*/
|
|
287
291
|
layers: {
|
|
288
292
|
default: TaskConfig;
|
|
@@ -292,11 +296,11 @@ export interface LoadedConfig {
|
|
|
292
296
|
/**
|
|
293
297
|
* Dotted key to the layer that supplied the winning value. Every leaf of
|
|
294
298
|
* `effective` appears, so `way config list` can say where each value came
|
|
295
|
-
* from
|
|
299
|
+
* from when a setting is not what the user expected.
|
|
296
300
|
*/
|
|
297
301
|
sources: Map<string, ConfigLayer>;
|
|
298
302
|
locations: ConfigLocations;
|
|
299
|
-
/**
|
|
303
|
+
/** Warnings from every layer: unknown keys, ignored project keys, old waypost names. */
|
|
300
304
|
warnings: string[];
|
|
301
305
|
}
|
|
302
306
|
/**
|
|
@@ -304,17 +308,18 @@ export interface LoadedConfig {
|
|
|
304
308
|
* reason {@link configLocations} takes them.
|
|
305
309
|
*/
|
|
306
310
|
export declare function loadConfig(root: string, env?: Record<string, string | undefined>, home?: string): Promise<LoadedConfig>;
|
|
311
|
+
/** The warning for a relative `WAYFINDER_CONFIG` that was ignored, or null. */
|
|
312
|
+
export declare function envIgnoredWarning(locations: ConfigLocations): string | null;
|
|
307
313
|
/** Read a dotted path — `"runners.order"`, `"allowExec"`. `undefined` when absent. */
|
|
308
314
|
export declare function getConfigValue(config: object, key: string): unknown;
|
|
309
315
|
/**
|
|
310
|
-
* Set a dotted path, returning a new document.
|
|
311
|
-
* intermediate objects, so `set` works on an empty file.
|
|
316
|
+
* Set a dotted path, returning a new document. The input is not changed.
|
|
317
|
+
* Missing intermediate objects are created, so `set` works on an empty file.
|
|
312
318
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* untouched.
|
|
319
|
+
* Throws {@link ConfigError} for an unknown key, a value of the wrong type, or
|
|
320
|
+
* an existing intermediate value that is not an object, rather than writing a
|
|
321
|
+
* file that will fail to load. Given a raw record, it returns a raw record with
|
|
322
|
+
* its unknown keys untouched.
|
|
318
323
|
*/
|
|
319
324
|
export declare function setConfigValue<T extends object>(config: T, key: string, value: unknown): T;
|
|
320
325
|
/**
|
|
@@ -322,45 +327,45 @@ export declare function setConfigValue<T extends object>(config: T, key: string,
|
|
|
322
327
|
* removal is removed too, so unsetting the last `runners.*` key does not leave
|
|
323
328
|
* `"runners": {}` behind.
|
|
324
329
|
*
|
|
325
|
-
* Unlike `set`, any key may be unset
|
|
326
|
-
*
|
|
330
|
+
* Unlike `set`, any key may be unset, including one this version does not
|
|
331
|
+
* know, so a stale setting can be removed.
|
|
327
332
|
*/
|
|
328
333
|
export declare function unsetConfigValue<T extends object>(config: T, key: string): T;
|
|
329
334
|
/**
|
|
330
|
-
* Parse a value typed on a command line. JSON first, so
|
|
331
|
-
* `["a","b"]`
|
|
332
|
-
*
|
|
335
|
+
* Parse a value typed on a command line. It is parsed as JSON first, so
|
|
336
|
+
* `true`, `3` and `["a","b"]` keep their types. A bare word that is not valid
|
|
337
|
+
* JSON is kept as a string, so `moon` need not be typed as `"moon"`.
|
|
333
338
|
*/
|
|
334
339
|
export declare function parseConfigValue(raw: string): unknown;
|
|
335
340
|
/**
|
|
336
|
-
* The {@link WayOptions}
|
|
337
|
-
* sets are present, so a caller spreads its own flags after it.
|
|
341
|
+
* The {@link WayOptions} fields this configuration controls. Only keys the
|
|
342
|
+
* config sets are present, so a caller spreads its own flags after it.
|
|
338
343
|
*/
|
|
339
344
|
export declare function collectOptionsFromConfig(config: TaskConfig): Pick<WayOptions, 'exclude' | 'allowExec' | 'discovery' | 'excludePaths'>;
|
|
340
345
|
/** `config.trust`, defaulted to the empty policy `@osdlc/trust-repo` expects. */
|
|
341
346
|
export declare function trustPolicyFromConfig(config: TaskConfig): TrustPolicy;
|
|
342
347
|
/**
|
|
343
|
-
* Expand a `trust.paths` entry's leading `~` against `home`, then
|
|
344
|
-
*
|
|
345
|
-
*
|
|
348
|
+
* Expand a `trust.paths` entry's leading `~` against `home`, then resolve
|
|
349
|
+
* symlinks in the pattern's static prefix (the part before the first glob
|
|
350
|
+
* character) with `resolveTrustRoot`.
|
|
346
351
|
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* match the
|
|
350
|
-
*
|
|
352
|
+
* This is the `expandPath` that `policyExecGate` and `policyDecision` take.
|
|
353
|
+
* Without it, a pattern written as a person typed it (`/tmp/…`, which on macOS
|
|
354
|
+
* is really `/private/tmp/…`) would never match the resolved root that
|
|
355
|
+
* `policyDecision` compares it with.
|
|
351
356
|
*/
|
|
352
357
|
export declare function expandTrustPath(raw: string, home: string): Promise<string>;
|
|
353
358
|
/**
|
|
354
359
|
* The options every `@osdlc/trust-repo` gate call takes: {@link expandTrustPath}
|
|
355
|
-
* against `home`, and the
|
|
356
|
-
*
|
|
357
|
-
*
|
|
360
|
+
* against `home`, and the {@link originOwner} lookup that `trust.owners` needs.
|
|
361
|
+
* Built in one place, so a call site cannot leave out `ownerOf` and silently
|
|
362
|
+
* stop honouring `trust.owners`.
|
|
358
363
|
*/
|
|
359
364
|
export declare function trustPolicyOptions(home: string): PolicyDecisionOptions;
|
|
360
365
|
/**
|
|
361
366
|
* Sort runner-keyed items for display: the ids named in `order` first, in that
|
|
362
367
|
* order, then everything else alphabetically. Alphabetical rather than
|
|
363
|
-
* registry order, so adding a tool does not
|
|
368
|
+
* registry order, so adding a tool does not reorder the list.
|
|
364
369
|
*/
|
|
365
370
|
export declare function orderRunners<T extends {
|
|
366
371
|
runner: string;
|