@osdlc/wayfinder 0.0.1-stage → 0.7.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.
- package/CHANGELOG.md +231 -0
- package/CONTRIBUTING.md +62 -0
- package/{LICENSE → LICENSE-APACHE} +1 -11
- package/LICENSE-MIT +21 -0
- package/README.md +505 -2
- package/SECURITY.md +44 -0
- package/bin/way.js +18 -0
- package/dist/app.d.ts +24 -0
- package/dist/app.js +24 -0
- package/dist/args.d.ts +44 -0
- package/dist/args.js +93 -0
- package/dist/cache.d.ts +7 -0
- package/dist/cache.js +15 -0
- package/dist/catalog.d.ts +38 -0
- package/dist/catalog.js +61 -0
- package/dist/clean-command.d.ts +43 -0
- package/dist/clean-command.js +274 -0
- package/dist/cli.d.ts +76 -0
- package/dist/cli.js +612 -0
- package/dist/config-command.d.ts +52 -0
- package/dist/config-command.js +342 -0
- package/dist/config.d.ts +367 -0
- package/dist/config.js +700 -0
- package/dist/devlink.d.ts +14 -0
- package/dist/devlink.js +30 -0
- package/dist/groups.d.ts +34 -0
- package/dist/groups.js +38 -0
- package/dist/guide.d.ts +32 -0
- package/dist/guide.js +411 -0
- package/dist/http.d.ts +22 -0
- package/dist/http.js +149 -0
- package/dist/origin-owner.d.ts +14 -0
- package/dist/origin-owner.js +69 -0
- package/dist/page.d.ts +15 -0
- package/dist/page.js +58 -0
- package/dist/providers-command.d.ts +40 -0
- package/dist/providers-command.js +132 -0
- package/dist/serve.d.ts +97 -0
- package/dist/serve.js +678 -0
- package/dist/tools.d.ts +46 -0
- package/dist/tools.js +102 -0
- package/dist/trust-command.d.ts +33 -0
- package/dist/trust-command.js +221 -0
- package/dist/trust-store.d.ts +18 -0
- package/dist/trust-store.js +46 -0
- package/dist/tui.d.ts +178 -0
- package/dist/tui.js +846 -0
- package/dist/web/main.js +2315 -0
- package/dist/web/page.html +110 -0
- package/dist/web/styles.css +1514 -0
- package/dist/xdg.d.ts +10 -0
- package/dist/xdg.js +17 -0
- package/package.json +54 -9
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wayfinder's configuration: layered, and readable without running anything.
|
|
3
|
+
* The settings people want every time (runners to skip, paths that are not
|
|
4
|
+
* project structure, whether execution is allowed, extra tools) are set once,
|
|
5
|
+
* per user and per project; flags stay for the exceptions.
|
|
6
|
+
*
|
|
7
|
+
* ## Layers, lowest precedence first
|
|
8
|
+
*
|
|
9
|
+
* 1. `DEFAULT_CONFIG` — the built-in defaults.
|
|
10
|
+
* 2. USER — `$XDG_CONFIG_HOME/wayfinder/config.json`, or `~/.config/wayfinder/config.json`
|
|
11
|
+
* when `XDG_CONFIG_HOME` is unset.
|
|
12
|
+
* 3. PROJECT — `wayfinder.config.json` at the root `findRoot` resolves.
|
|
13
|
+
* 4. CLI flags — not this module's business. {@link collectOptionsFromConfig}
|
|
14
|
+
* produces the slice a caller spreads its own flags on top of.
|
|
15
|
+
*
|
|
16
|
+
* `allowExec` IS AN EXCEPTION TO THIS ORDER. The project layer may lower it to
|
|
17
|
+
* `false` — a repository asking not to be shelled out for is safe to honour —
|
|
18
|
+
* but it can never raise it to `true`. `wayfinder.config.json` lives INSIDE the
|
|
19
|
+
* repository being scanned, so honouring `allowExec: true` from it would let a
|
|
20
|
+
* repository authorize the execution of its own code. The key is therefore
|
|
21
|
+
* stripped from the project layer before merging, with a warning, and only the
|
|
22
|
+
* user layer and the CLI flags can turn execution on. Granting a repository
|
|
23
|
+
* standing permission is `way trust`, which records the consent outside the
|
|
24
|
+
* repository.
|
|
25
|
+
*
|
|
26
|
+
* `tools` is gated too, because a tool module is code. User-layer entries
|
|
27
|
+
* always load; project-layer entries load only when the repository is trusted
|
|
28
|
+
* and execution is allowed (see `tools.ts`).
|
|
29
|
+
*
|
|
30
|
+
* `trust` IS THE SAME EXCEPTION, more strongly: it has no "lower" state to
|
|
31
|
+
* honour from the project layer at all, so ANY project-layer `trust.paths` or
|
|
32
|
+
* `trust.owners` entry is dropped, with a warning — a repository must not be
|
|
33
|
+
* able to pre-authorize itself, or any class of repositories including
|
|
34
|
+
* itself. Only the USER layer's `trust` reaches `@osdlc/trust-repo`'s
|
|
35
|
+
* `policyExecGate`, which combines it with the marker store that
|
|
36
|
+
* `way trust` writes to. See that package's README for the glob dialect,
|
|
37
|
+
* and `origin-owner.ts` for the origin-remote lookup `trust.owners` rests on.
|
|
38
|
+
*
|
|
39
|
+
* XDG is used on every platform, macOS included, as `gh` does: a developer
|
|
40
|
+
* with a dotfiles repository expects this beside their other tool config.
|
|
41
|
+
*
|
|
42
|
+
* `WAYFINDER_CONFIG=/path/to/file` replaces the USER layer's LOCATION and nothing
|
|
43
|
+
* else. The named file is read INSTEAD OF the XDG path; the project layer is
|
|
44
|
+
* still read from the project root, still merges on top, and cannot be turned
|
|
45
|
+
* off this way. Naming a file that does not exist is an error rather than a
|
|
46
|
+
* silent empty layer — an env var pointing at nothing is a typo, not a choice.
|
|
47
|
+
*
|
|
48
|
+
* ## The old waypost names
|
|
49
|
+
*
|
|
50
|
+
* The tool was called waypost before its first release. Each old name is still
|
|
51
|
+
* read when its new one is absent, so an existing setup keeps working:
|
|
52
|
+
* `WAYPOST_CONFIG` when `WAYFINDER_CONFIG` is unset, `<config>/waypost/config.json`
|
|
53
|
+
* when `<config>/wayfinder/config.json` does not exist, and `waypost.config.json`
|
|
54
|
+
* when `wayfinder.config.json` does not exist. A file found this way is also the
|
|
55
|
+
* one `config set` edits, so a setting never lands in a file that is not read.
|
|
56
|
+
* Each fallback adds a warning that names the new location. When both the old
|
|
57
|
+
* and the new file exist, the new one is read and a warning says the old one
|
|
58
|
+
* is ignored.
|
|
59
|
+
*
|
|
60
|
+
* ## Merge rule
|
|
61
|
+
*
|
|
62
|
+
* Objects merge key-wise; everything else — scalars and arrays alike —
|
|
63
|
+
* REPLACES wholesale. Arrays replace because both of ours are answers to
|
|
64
|
+
* "which ones, in what order", and a project that says `order: ["just"]` means
|
|
65
|
+
* that list, not that list appended to whatever the user happened to have.
|
|
66
|
+
*
|
|
67
|
+
* user { runners: { disabled: ["cargo"], order: ["moon"] } }
|
|
68
|
+
* project { runners: { order: ["just"] } }
|
|
69
|
+
* result { runners: { disabled: ["cargo"], order: ["just"] } }
|
|
70
|
+
*
|
|
71
|
+
* ## Unknown keys and broken files
|
|
72
|
+
*
|
|
73
|
+
* An unknown key is a WARNING naming the file and the key, and the rest of the
|
|
74
|
+
* file still loads — a config written for a newer version must not brick an
|
|
75
|
+
* older one. A file that is malformed, or that holds a wrong-typed value where
|
|
76
|
+
* the type is knowable, is a {@link ConfigError} naming the file and the
|
|
77
|
+
* problem. There is no silent fallback: a setting that quietly did not apply is
|
|
78
|
+
* worse than one that refused to load.
|
|
79
|
+
*/
|
|
80
|
+
import { type PolicyDecisionOptions, type TrustPolicy } from '@osdlc/trust-repo';
|
|
81
|
+
import type { DiscoveryMode } from '@osdlc/system-model/detect';
|
|
82
|
+
import { CONFIG_ENV_VAR, PROJECT_CONFIG_FILENAME } from './app.ts';
|
|
83
|
+
import type { WayOptions } from './catalog.ts';
|
|
84
|
+
export { CONFIG_ENV_VAR, PROJECT_CONFIG_FILENAME };
|
|
85
|
+
/** Directory under `$XDG_CONFIG_HOME` holding the USER layer. */
|
|
86
|
+
export declare const USER_CONFIG_DIR = "wayfinder";
|
|
87
|
+
/** The `tool` key of the trust store (`$XDG_STATE_HOME/<tool>/trusted/`). */
|
|
88
|
+
export declare const TRUST_STORE_TOOL = "wayfinder";
|
|
89
|
+
/** The old {@link USER_CONFIG_DIR}, read when the new user file does not exist. */
|
|
90
|
+
export declare const LEGACY_USER_CONFIG_DIR = "waypost";
|
|
91
|
+
/** The old {@link TRUST_STORE_TOOL}. Its grants are still honoured; see `trust-store.ts`. */
|
|
92
|
+
export declare const LEGACY_TRUST_STORE_TOOL = "waypost";
|
|
93
|
+
/** The USER layer's filename inside {@link USER_CONFIG_DIR}. */
|
|
94
|
+
export declare const USER_CONFIG_FILENAME = "config.json";
|
|
95
|
+
export interface RunnersConfig {
|
|
96
|
+
/** Built-in runner ids to skip entirely. Becomes `CollectOptions.exclude`. */
|
|
97
|
+
disabled?: string[];
|
|
98
|
+
/** Preferred display order. Runners not named here follow alphabetically. */
|
|
99
|
+
order?: string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The policy `@osdlc/trust-repo`'s `policyExecGate` decides trust over, on
|
|
103
|
+
* top of the marker store `way trust` writes to. USER LAYER ONLY — see
|
|
104
|
+
* the module docblock's "trust IS THE SAME EXCEPTION" note; a project-layer
|
|
105
|
+
* entry is dropped before the merge, with a warning.
|
|
106
|
+
*/
|
|
107
|
+
export interface TrustConfig {
|
|
108
|
+
/**
|
|
109
|
+
* Glob patterns (`@osdlc/trust-repo`'s dialect: `*`, `?`, `**`, a trailing
|
|
110
|
+
* `/**` matching descendants only) over the resolved, symlink-free repo
|
|
111
|
+
* root. A leading `~` expands against `home`; there is no `{name}` token
|
|
112
|
+
* vocabulary here the way sdlc's `paths:` map has one.
|
|
113
|
+
*/
|
|
114
|
+
paths?: string[];
|
|
115
|
+
/** Origin remote owners (case-insensitive) that trust a root without a marker. */
|
|
116
|
+
owners?: string[];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The whole configuration document, schema v1.
|
|
120
|
+
*
|
|
121
|
+
* A type alias rather than an interface so it carries an implicit index
|
|
122
|
+
* signature: {@link setConfigValue} and friends operate on this and on the raw
|
|
123
|
+
* untyped record from a file with one implementation.
|
|
124
|
+
*/
|
|
125
|
+
export type TaskConfig = {
|
|
126
|
+
runners?: RunnersConfig;
|
|
127
|
+
/** Default for the exec trust gate. A `--exec` / `--no-exec` flag still wins. */
|
|
128
|
+
allowExec?: boolean;
|
|
129
|
+
discovery?: DiscoveryMode | 'auto';
|
|
130
|
+
/**
|
|
131
|
+
* Paths to leave out of discovery, on top of the built-in list. A bare name
|
|
132
|
+
* matches any path segment; a value with a slash matches a path prefix from
|
|
133
|
+
* the root, taking the tree beneath it.
|
|
134
|
+
*
|
|
135
|
+
* The setting a repository reaches for to say that a tree is DATA rather than
|
|
136
|
+
* project structure — a fixture repo, a vendored sample. Unlike
|
|
137
|
+
* `runners.disabled`, which turns off a runner everywhere in this project,
|
|
138
|
+
* this leaves the runner on and narrows where it looks.
|
|
139
|
+
*
|
|
140
|
+
* The project layer is the natural home: which of a repository's own trees
|
|
141
|
+
* are fixtures is a fact about that repository, and the same answer for
|
|
142
|
+
* everyone working in it. Nothing stops the user layer from setting it, and
|
|
143
|
+
* the usual replace-wholesale rule applies if both do.
|
|
144
|
+
*/
|
|
145
|
+
excludePaths?: string[];
|
|
146
|
+
/** USER LAYER ONLY. See {@link TrustConfig} and the module docblock. */
|
|
147
|
+
trust?: TrustConfig;
|
|
148
|
+
/**
|
|
149
|
+
* Modules that export extra `ToolDef`s, as paths. A relative path resolves
|
|
150
|
+
* against the file that names it. Project entries load only when the
|
|
151
|
+
* repository is trusted and execution is allowed.
|
|
152
|
+
*/
|
|
153
|
+
tools?: string[];
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* The built-in defaults layer.
|
|
157
|
+
*
|
|
158
|
+
* Every leaf is present, which is what makes {@link LoadedConfig.sources}
|
|
159
|
+
* total: a key with no answer anywhere would otherwise have no layer to name.
|
|
160
|
+
*/
|
|
161
|
+
export declare const DEFAULT_CONFIG: Required<TaskConfig>;
|
|
162
|
+
export type ConfigLayer = 'default' | 'user' | 'project';
|
|
163
|
+
export interface ConfigLocations {
|
|
164
|
+
/** Absolute path of the user layer's file, whether or not it exists. */
|
|
165
|
+
user: string;
|
|
166
|
+
/** True when an env var supplied that path instead of XDG. */
|
|
167
|
+
userFromEnv: boolean;
|
|
168
|
+
/** The env var that supplied it: {@link CONFIG_ENV_VAR}, or the old one. Null when none did. */
|
|
169
|
+
userEnvVar: string | null;
|
|
170
|
+
/** True when `user` is the old waypost file, found because the new one does not exist. */
|
|
171
|
+
userLegacy: boolean;
|
|
172
|
+
/** The old waypost user file, when it exists beside the new one and is ignored. */
|
|
173
|
+
userIgnored: string | null;
|
|
174
|
+
/**
|
|
175
|
+
* Absolute path of `<root>/wayfinder.config.json`, whether or not it exists,
|
|
176
|
+
* or of `<root>/waypost.config.json` when only that one exists.
|
|
177
|
+
*/
|
|
178
|
+
project: string;
|
|
179
|
+
/** True when `project` is the old waypost file. */
|
|
180
|
+
projectLegacy: boolean;
|
|
181
|
+
/** `<root>/waypost.config.json`, when it exists beside the new file and is ignored. */
|
|
182
|
+
projectIgnored: string | null;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* A configuration file that cannot be honoured — unparseable, or holding a
|
|
186
|
+
* value of the wrong type.
|
|
187
|
+
*/
|
|
188
|
+
export declare class ConfigError extends Error {
|
|
189
|
+
/**
|
|
190
|
+
* The file the error is about. Empty when the error concerns a value handed
|
|
191
|
+
* in directly, as {@link setConfigValue} does with a bad key or value.
|
|
192
|
+
*/
|
|
193
|
+
readonly file: string;
|
|
194
|
+
constructor(message: string, file: string);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Every settable key, in schema order — the dotted names `config set` accepts.
|
|
198
|
+
*
|
|
199
|
+
* Derived from {@link FIELDS} rather than retyped, so a surface that lists the
|
|
200
|
+
* keys (the `guide` command's config section) cannot fall behind the schema.
|
|
201
|
+
*/
|
|
202
|
+
export declare const CONFIG_KEYS: readonly string[];
|
|
203
|
+
/**
|
|
204
|
+
* Resolve where each layer's file lives. `env` and `home` are injectable
|
|
205
|
+
* because a test that consulted the real environment would read the developer's
|
|
206
|
+
* own `~/.config`, and pass or fail according to what is in it. The only other
|
|
207
|
+
* input is whether a file exists, which picks between a new name and its old
|
|
208
|
+
* waypost fallback (see the module docblock).
|
|
209
|
+
*
|
|
210
|
+
* Two details of how a path out of the environment is read:
|
|
211
|
+
*
|
|
212
|
+
* A leading `~` is expanded against `home`. A shell expands it before exec, but
|
|
213
|
+
* `.env` loaders, direnv and CI YAML hand the literal tilde through, and
|
|
214
|
+
* `~/config.json` quietly becoming `<somewhere>/~/config.json` is the silent
|
|
215
|
+
* wrong answer this module refuses to give anywhere else.
|
|
216
|
+
*
|
|
217
|
+
* A RELATIVE path resolves against `root`, not the process working directory.
|
|
218
|
+
* This function is otherwise a pure function of its arguments; reading
|
|
219
|
+
* `process.cwd()` would smuggle an ambient input in, so a library consumer
|
|
220
|
+
* scanning some other directory would get a user-layer path unrelated to the
|
|
221
|
+
* directory being scanned while the project layer tracked it.
|
|
222
|
+
*/
|
|
223
|
+
export declare function configLocations(root: string, env?: Record<string, string | undefined>, home?: string): ConfigLocations;
|
|
224
|
+
/**
|
|
225
|
+
* Validate a parsed JSON document against schema v1.
|
|
226
|
+
*
|
|
227
|
+
* Throws {@link ConfigError} on a type violation; returns the recognized subset
|
|
228
|
+
* plus one warning per unknown key. The returned config holds ONLY known keys,
|
|
229
|
+
* which is why the write path never round-trips through this shape — see
|
|
230
|
+
* {@link readRawConfigFile}.
|
|
231
|
+
*/
|
|
232
|
+
export declare function validateConfig(raw: unknown, file: string): {
|
|
233
|
+
config: TaskConfig;
|
|
234
|
+
warnings: string[];
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Merge `over` onto `base` per the module's rule: objects key-wise, scalars and
|
|
238
|
+
* arrays wholesale.
|
|
239
|
+
*
|
|
240
|
+
* Non-mutating in both directions: neither argument is touched, and the result
|
|
241
|
+
* shares no object or array with either of them — including branches `over`
|
|
242
|
+
* never mentioned. Mutating a loaded config must not reach back into
|
|
243
|
+
* `DEFAULT_CONFIG`.
|
|
244
|
+
*/
|
|
245
|
+
export declare function mergeConfig(base: TaskConfig, over: TaskConfig): TaskConfig;
|
|
246
|
+
/**
|
|
247
|
+
* The file's parsed object, unvalidated and with every key intact.
|
|
248
|
+
*
|
|
249
|
+
* This is the read half of an edit that preserves what this version does not
|
|
250
|
+
* understand. `set` and `unset` must apply to THIS, not to the validated shape,
|
|
251
|
+
* because validation drops unknown keys — so writing a validated document back
|
|
252
|
+
* would silently delete a setting a newer version had written. `null` when the
|
|
253
|
+
* file does not exist.
|
|
254
|
+
*/
|
|
255
|
+
export declare function readRawConfigFile(file: string): Promise<Record<string, unknown> | null>;
|
|
256
|
+
/**
|
|
257
|
+
* Read, parse and validate one layer. `null` when the file does not exist —
|
|
258
|
+
* absence is normal and is not an error. A file that exists and is broken
|
|
259
|
+
* throws {@link ConfigError}.
|
|
260
|
+
*/
|
|
261
|
+
export declare function readConfigFile(file: string): Promise<{
|
|
262
|
+
config: TaskConfig;
|
|
263
|
+
warnings: string[];
|
|
264
|
+
} | null>;
|
|
265
|
+
/**
|
|
266
|
+
* Write a configuration file: known keys in schema order, unknown keys after
|
|
267
|
+
* them in the order they already had, two-space indent, trailing newline.
|
|
268
|
+
* Parent directories are created.
|
|
269
|
+
*
|
|
270
|
+
* The order is fixed so that writing an unchanged document produces an
|
|
271
|
+
* unchanged file — a config under version control should not churn its diff
|
|
272
|
+
* because a key moved.
|
|
273
|
+
*
|
|
274
|
+
* Accepts a raw record as well as a {@link TaskConfig}, which is what makes the
|
|
275
|
+
* unknown-key-preserving edit path writable.
|
|
276
|
+
*/
|
|
277
|
+
export declare function writeConfigFile(file: string, config: TaskConfig | Record<string, unknown>): Promise<void>;
|
|
278
|
+
export interface LoadedConfig {
|
|
279
|
+
/** Defaults, then user, then project. What a caller should actually act on. */
|
|
280
|
+
effective: TaskConfig;
|
|
281
|
+
/**
|
|
282
|
+
* The layers as they were APPLIED. `project` has already had a rejected
|
|
283
|
+
* `allowExec: true` removed, so it matches what `effective` and `sources`
|
|
284
|
+
* say. Read the file itself with {@link readRawConfigFile} to see what was
|
|
285
|
+
* written.
|
|
286
|
+
*/
|
|
287
|
+
layers: {
|
|
288
|
+
default: TaskConfig;
|
|
289
|
+
user: TaskConfig | null;
|
|
290
|
+
project: TaskConfig | null;
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Dotted key to the layer that supplied the winning value. Every leaf of
|
|
294
|
+
* `effective` appears, so `way config list` can say where each value came
|
|
295
|
+
* from — the question a user asks when a setting is not what they expected.
|
|
296
|
+
*/
|
|
297
|
+
sources: Map<string, ConfigLayer>;
|
|
298
|
+
locations: ConfigLocations;
|
|
299
|
+
/** Unknown-key warnings from every layer, in layer order. */
|
|
300
|
+
warnings: string[];
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Load every layer and merge them. `env` and `home` are injectable for the same
|
|
304
|
+
* reason {@link configLocations} takes them.
|
|
305
|
+
*/
|
|
306
|
+
export declare function loadConfig(root: string, env?: Record<string, string | undefined>, home?: string): Promise<LoadedConfig>;
|
|
307
|
+
/** Read a dotted path — `"runners.order"`, `"allowExec"`. `undefined` when absent. */
|
|
308
|
+
export declare function getConfigValue(config: object, key: string): unknown;
|
|
309
|
+
/**
|
|
310
|
+
* Set a dotted path, returning a new document. Non-mutating and creating any
|
|
311
|
+
* intermediate objects, so `set` works on an empty file.
|
|
312
|
+
*
|
|
313
|
+
* The key must be a known setting and the value must match its type; both throw
|
|
314
|
+
* {@link ConfigError} rather than writing something that will fail to load
|
|
315
|
+
* next time, as does an existing intermediate value that is not an object. The
|
|
316
|
+
* generic return means a raw record edits to a raw record with its unknown keys
|
|
317
|
+
* untouched.
|
|
318
|
+
*/
|
|
319
|
+
export declare function setConfigValue<T extends object>(config: T, key: string, value: unknown): T;
|
|
320
|
+
/**
|
|
321
|
+
* Remove a dotted path, returning a new document. A container left empty by the
|
|
322
|
+
* removal is removed too, so unsetting the last `runners.*` key does not leave
|
|
323
|
+
* `"runners": {}` behind.
|
|
324
|
+
*
|
|
325
|
+
* Unlike `set`, any key may be unset — including one this version does not know
|
|
326
|
+
* — because removing a stale setting is exactly when you need that.
|
|
327
|
+
*/
|
|
328
|
+
export declare function unsetConfigValue<T extends object>(config: T, key: string): T;
|
|
329
|
+
/**
|
|
330
|
+
* Parse a value typed on a command line. JSON first, so `true`, `3` and
|
|
331
|
+
* `["a","b"]` arrive as themselves; a bare word that is not valid JSON falls
|
|
332
|
+
* back to the string, so `moon` does not have to be typed as `"moon"`.
|
|
333
|
+
*/
|
|
334
|
+
export declare function parseConfigValue(raw: string): unknown;
|
|
335
|
+
/**
|
|
336
|
+
* The {@link WayOptions} slice this configuration owns. Only keys the config
|
|
337
|
+
* sets are present, so a caller spreads its own flags after it.
|
|
338
|
+
*/
|
|
339
|
+
export declare function collectOptionsFromConfig(config: TaskConfig): Pick<WayOptions, 'exclude' | 'allowExec' | 'discovery' | 'excludePaths'>;
|
|
340
|
+
/** `config.trust`, defaulted to the empty policy `@osdlc/trust-repo` expects. */
|
|
341
|
+
export declare function trustPolicyFromConfig(config: TaskConfig): TrustPolicy;
|
|
342
|
+
/**
|
|
343
|
+
* Expand a `trust.paths` entry's leading `~` against `home`, then
|
|
344
|
+
* symlink-resolve the pattern's static prefix — the part before the first
|
|
345
|
+
* glob character — through `resolveTrustRoot`.
|
|
346
|
+
*
|
|
347
|
+
* The injected `expandPath` `policyExecGate`/`policyDecision` take. Without it, a pattern written against the spelling a person typed
|
|
348
|
+
* (`/tmp/…`, which on macOS is really `/private/tmp/…`) would silently never
|
|
349
|
+
* match the RESOLVED root `@osdlc/trust-repo`'s `policyDecision` compares it
|
|
350
|
+
* against.
|
|
351
|
+
*/
|
|
352
|
+
export declare function expandTrustPath(raw: string, home: string): Promise<string>;
|
|
353
|
+
/**
|
|
354
|
+
* The options every `@osdlc/trust-repo` gate call takes: {@link expandTrustPath}
|
|
355
|
+
* against `home`, and the git-backed {@link originOwner} lookup `trust.owners`
|
|
356
|
+
* rests on. One home for the binding, so a call site cannot leave `ownerOf` out
|
|
357
|
+
* and silently stop honouring `trust.owners`.
|
|
358
|
+
*/
|
|
359
|
+
export declare function trustPolicyOptions(home: string): PolicyDecisionOptions;
|
|
360
|
+
/**
|
|
361
|
+
* Sort runner-keyed items for display: the ids named in `order` first, in that
|
|
362
|
+
* order, then everything else alphabetically. Alphabetical rather than
|
|
363
|
+
* registry order, so adding a tool does not reshuffle the list.
|
|
364
|
+
*/
|
|
365
|
+
export declare function orderRunners<T extends {
|
|
366
|
+
runner: string;
|
|
367
|
+
}>(items: T[], order?: string[]): T[];
|