@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.
- package/CHANGELOG.md +240 -0
- package/CONTRIBUTING.md +6 -0
- package/README.md +310 -150
- package/SECURITY.md +19 -5
- package/dist/actions.d.ts +23 -0
- package/dist/actions.js +97 -0
- package/dist/app.d.ts +1 -13
- package/dist/app.js +1 -13
- package/dist/args.d.ts +11 -6
- package/dist/args.js +25 -7
- package/dist/cache.d.ts +2 -4
- package/dist/cache.js +5 -10
- package/dist/catalog.d.ts +45 -4
- package/dist/catalog.js +134 -13
- package/dist/clean-command.d.ts +65 -36
- package/dist/clean-command.js +372 -226
- package/dist/cli.d.ts +24 -57
- package/dist/cli.js +139 -568
- package/dist/commands/browse.d.ts +128 -0
- package/dist/commands/browse.js +153 -0
- package/dist/commands/index.d.ts +25 -0
- package/dist/commands/index.js +71 -0
- package/dist/commands/list.d.ts +224 -0
- package/dist/commands/list.js +178 -0
- package/dist/commands/query.d.ts +166 -0
- package/dist/commands/query.js +73 -0
- package/dist/commands/run.d.ts +114 -0
- package/dist/commands/run.js +139 -0
- package/dist/commands/shared.d.ts +152 -0
- package/dist/commands/shared.js +209 -0
- package/dist/config-command.d.ts +27 -43
- package/dist/config-command.js +129 -330
- package/dist/config-keys.d.ts +25 -0
- package/dist/config-keys.js +29 -0
- package/dist/config.d.ts +272 -257
- package/dist/config.js +611 -460
- package/dist/core/copy-text.d.ts +30 -0
- package/dist/core/copy-text.js +50 -0
- package/dist/core/filter.d.ts +55 -0
- package/dist/core/filter.js +59 -0
- package/dist/core/run.d.ts +22 -0
- package/dist/core/run.js +59 -0
- package/dist/core/saved-view.d.ts +59 -0
- package/dist/core/saved-view.js +119 -0
- package/dist/core/session.d.ts +282 -0
- package/dist/core/session.js +602 -0
- package/dist/core/skills.d.ts +53 -0
- package/dist/core/skills.js +54 -0
- package/dist/core/unknowns.d.ts +72 -0
- package/dist/core/unknowns.js +68 -0
- package/dist/devlink.d.ts +3 -0
- package/dist/devlink.js +5 -2
- package/dist/document-schemas.generated.d.ts +22 -0
- package/dist/document-schemas.generated.js +916 -0
- package/dist/documents.d.ts +508 -0
- package/dist/documents.js +181 -0
- package/dist/groups.d.ts +22 -26
- package/dist/groups.js +13 -29
- package/dist/guide.d.ts +26 -13
- package/dist/guide.js +119 -103
- package/dist/index.d.ts +118 -0
- package/dist/index.js +61 -0
- package/dist/keys.d.ts +51 -0
- package/dist/keys.js +273 -0
- package/dist/page.d.ts +18 -8
- package/dist/page.js +28 -17
- package/dist/providers-command.d.ts +81 -20
- package/dist/providers-command.js +33 -75
- package/dist/schema.d.ts +48 -0
- package/dist/schema.js +61 -0
- package/dist/serve/auth.d.ts +46 -0
- package/dist/serve/auth.js +82 -0
- package/dist/serve/catalog-share.d.ts +63 -0
- package/dist/serve/catalog-share.js +155 -0
- package/dist/serve/index.d.ts +100 -0
- package/dist/serve/index.js +259 -0
- package/dist/serve/routes.d.ts +60 -0
- package/dist/serve/routes.js +186 -0
- package/dist/serve/terminal-input.d.ts +50 -0
- package/dist/serve/terminal-input.js +108 -0
- package/dist/skills.d.ts +19 -0
- package/dist/skills.js +54 -0
- package/dist/terminal-text.d.ts +8 -0
- package/dist/terminal-text.js +19 -6
- package/dist/tool-info.d.ts +24 -0
- package/dist/tool-info.js +17 -0
- package/dist/trust-command.d.ts +15 -27
- package/dist/trust-command.js +110 -208
- package/dist/trust-store.d.ts +5 -10
- package/dist/trust-store.js +9 -42
- package/dist/tui/app.d.ts +193 -0
- package/dist/tui/app.js +1400 -0
- package/dist/tui/copy.d.ts +29 -0
- package/dist/tui/copy.js +39 -0
- package/dist/tui/index.d.ts +33 -0
- package/dist/tui/index.js +97 -0
- package/dist/tui/keys-input.d.ts +27 -0
- package/dist/tui/keys-input.js +87 -0
- package/dist/tui/settings.d.ts +94 -0
- package/dist/tui/settings.js +198 -0
- package/dist/tui/style.d.ts +62 -0
- package/dist/tui/style.js +77 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.js +7 -0
- package/dist/vocabulary.d.ts +91 -0
- package/dist/vocabulary.js +155 -0
- package/dist/web/main.js +2232 -582
- package/dist/web/page.html +41 -33
- package/dist/web/styles.css +513 -329
- package/dist/xdg.d.ts +76 -4
- package/dist/xdg.js +77 -5
- package/package.json +27 -8
- package/schema/config.json +133 -0
- package/dist/http.d.ts +0 -22
- package/dist/http.js +0 -149
- package/dist/origin-owner.d.ts +0 -19
- package/dist/origin-owner.js +0 -85
- package/dist/serve.d.ts +0 -98
- package/dist/serve.js +0 -671
- package/dist/tui.d.ts +0 -177
- package/dist/tui.js +0 -840
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enter in the `way serve` terminal. A background job that reads its terminal
|
|
3
|
+
* gets `SIGTTIN`, which stops it, so `way serve &` would stop serving. Lines
|
|
4
|
+
* are read only while the process is in the terminal's foreground process
|
|
5
|
+
* group. Ctrl-Z stops reading before the process stops, and a resume (`fg` or
|
|
6
|
+
* `bg`) checks again. In the background the check repeats, since `fg` on a
|
|
7
|
+
* running job sends no signal.
|
|
8
|
+
*/
|
|
9
|
+
import { spawnRunnerAsync } from '@osdlc/command-seam';
|
|
10
|
+
/** How long the foreground check may take. */
|
|
11
|
+
const PS_TIMEOUT_MS = 2_000;
|
|
12
|
+
/** How often a background process checks whether it is in the foreground. */
|
|
13
|
+
const POLL_MS = 1_000;
|
|
14
|
+
/**
|
|
15
|
+
* True when `ps -o tpgid= -o pgid=` output says the process leads the
|
|
16
|
+
* terminal's foreground group: both ids are equal and positive. A process
|
|
17
|
+
* with no terminal has a `tpgid` of 0 or -1.
|
|
18
|
+
*/
|
|
19
|
+
export function foregroundFromPs(out) {
|
|
20
|
+
const [tpgid, pgid, extra] = out.trim().split(/\s+/);
|
|
21
|
+
if (extra !== undefined || tpgid === undefined || pgid === undefined)
|
|
22
|
+
return false;
|
|
23
|
+
return /^\d+$/.test(tpgid) && Number(tpgid) > 0 && tpgid === pgid;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Whether this process is in its terminal's foreground group. Always true on
|
|
27
|
+
* Windows, which has no job control. False when `ps` fails, so the terminal
|
|
28
|
+
* is not read.
|
|
29
|
+
*/
|
|
30
|
+
export async function inForeground() {
|
|
31
|
+
if (process.platform === 'win32')
|
|
32
|
+
return true;
|
|
33
|
+
const proc = await spawnRunnerAsync('ps', { absolutePathOnly: true }).run(['-o', 'tpgid=', '-o', 'pgid=', '-p', String(process.pid)], { cwd: '/', timeoutMs: PS_TIMEOUT_MS });
|
|
34
|
+
return proc.exitCode === 0 && foregroundFromPs(proc.stdout);
|
|
35
|
+
}
|
|
36
|
+
/** The process's own job-control signals. None on Windows. */
|
|
37
|
+
export const processJobSignals = process.platform === 'win32'
|
|
38
|
+
? null
|
|
39
|
+
: {
|
|
40
|
+
on: (signal, listener) => process.on(signal, listener),
|
|
41
|
+
off: (signal, listener) => process.off(signal, listener),
|
|
42
|
+
suspend: () => process.kill(process.pid, 'SIGSTOP'),
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Call `onLine` for each Enter typed on `input`, while the process is in the
|
|
46
|
+
* foreground.
|
|
47
|
+
*/
|
|
48
|
+
export function readTerminalLines(input, onLine, options = {}) {
|
|
49
|
+
const foreground = options.foreground ?? inForeground;
|
|
50
|
+
const signals = options.signals === undefined ? processJobSignals : options.signals;
|
|
51
|
+
const pollMs = options.pollMs ?? POLL_MS;
|
|
52
|
+
let reading = false;
|
|
53
|
+
let stopped = false;
|
|
54
|
+
let poll;
|
|
55
|
+
const onData = (chunk) => {
|
|
56
|
+
if (String(chunk).includes('\n'))
|
|
57
|
+
onLine();
|
|
58
|
+
};
|
|
59
|
+
const attach = () => {
|
|
60
|
+
if (reading || stopped)
|
|
61
|
+
return;
|
|
62
|
+
reading = true;
|
|
63
|
+
input.on('data', onData);
|
|
64
|
+
input.resume();
|
|
65
|
+
};
|
|
66
|
+
const detach = () => {
|
|
67
|
+
if (!reading)
|
|
68
|
+
return;
|
|
69
|
+
reading = false;
|
|
70
|
+
input.off('data', onData);
|
|
71
|
+
input.pause();
|
|
72
|
+
};
|
|
73
|
+
const check = async () => {
|
|
74
|
+
clearTimeout(poll);
|
|
75
|
+
const now = await foreground().catch(() => false);
|
|
76
|
+
if (stopped)
|
|
77
|
+
return false;
|
|
78
|
+
if (now)
|
|
79
|
+
attach();
|
|
80
|
+
else {
|
|
81
|
+
detach();
|
|
82
|
+
clearTimeout(poll);
|
|
83
|
+
poll = setTimeout(() => void check(), pollMs);
|
|
84
|
+
poll.unref?.();
|
|
85
|
+
}
|
|
86
|
+
return reading;
|
|
87
|
+
};
|
|
88
|
+
// Stop reading before the stop, so a later `bg` does not read the terminal.
|
|
89
|
+
const onStop = () => {
|
|
90
|
+
detach();
|
|
91
|
+
signals?.suspend();
|
|
92
|
+
};
|
|
93
|
+
const onContinue = () => {
|
|
94
|
+
void check();
|
|
95
|
+
};
|
|
96
|
+
signals?.on('SIGTSTP', onStop);
|
|
97
|
+
signals?.on('SIGCONT', onContinue);
|
|
98
|
+
return {
|
|
99
|
+
ready: check(),
|
|
100
|
+
stop() {
|
|
101
|
+
stopped = true;
|
|
102
|
+
clearTimeout(poll);
|
|
103
|
+
detach();
|
|
104
|
+
signals?.off('SIGTSTP', onStop);
|
|
105
|
+
signals?.off('SIGCONT', onContinue);
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
package/dist/skills.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the agent skills for the Skills group from `@osdlc/detect-harness`.
|
|
3
|
+
* It reads files only. No harness program runs, and no skill runs.
|
|
4
|
+
*/
|
|
5
|
+
import type { SkillRow, SkillsSetting } from './core/skills.ts';
|
|
6
|
+
/** What {@link readSkills} needs. */
|
|
7
|
+
export interface ReadSkillsOptions {
|
|
8
|
+
/** Which skills: `project` reads the repository only; `all` adds the home folder's. */
|
|
9
|
+
setting: SkillsSetting;
|
|
10
|
+
home: string;
|
|
11
|
+
env: Record<string, string | undefined>;
|
|
12
|
+
signal?: AbortSignal | undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The skills for `root`, project ones first, then by name. A skill file
|
|
16
|
+
* several agents read is one row that names each of them. `off` reads
|
|
17
|
+
* nothing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function readSkills(root: string, opts: ReadSkillsOptions): Promise<SkillRow[]>;
|
package/dist/skills.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the agent skills for the Skills group from `@osdlc/detect-harness`.
|
|
3
|
+
* It reads files only. No harness program runs, and no skill runs.
|
|
4
|
+
*/
|
|
5
|
+
import { isAbsolute, relative } from 'node:path';
|
|
6
|
+
import { detect } from '@osdlc/detect-harness';
|
|
7
|
+
/** `path` relative to `root` with `/` separators when it is inside it, else as given. */
|
|
8
|
+
function underRoot(root, path) {
|
|
9
|
+
const rel = relative(root, path);
|
|
10
|
+
const outside = rel === '' || rel === '..' || /^\.\.[\\/]/.test(rel) || isAbsolute(rel);
|
|
11
|
+
return outside ? path : rel.split('\\').join('/');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The skills for `root`, project ones first, then by name. A skill file
|
|
15
|
+
* several agents read is one row that names each of them. `off` reads
|
|
16
|
+
* nothing.
|
|
17
|
+
*/
|
|
18
|
+
export async function readSkills(root, opts) {
|
|
19
|
+
if (opts.setting === 'off')
|
|
20
|
+
return [];
|
|
21
|
+
const catalog = await detect({
|
|
22
|
+
projectRoot: root,
|
|
23
|
+
home: opts.home,
|
|
24
|
+
env: opts.env,
|
|
25
|
+
mode: opts.setting === 'all' ? 'full' : 'project',
|
|
26
|
+
allowExec: false,
|
|
27
|
+
...(opts.signal !== undefined ? { signal: opts.signal } : {}),
|
|
28
|
+
});
|
|
29
|
+
const byPath = new Map();
|
|
30
|
+
for (const report of catalog.reports) {
|
|
31
|
+
for (const skill of report.skills) {
|
|
32
|
+
const path = underRoot(root, skill.path);
|
|
33
|
+
const seen = byPath.get(path);
|
|
34
|
+
if (seen !== undefined) {
|
|
35
|
+
if (!seen.harnesses.includes(report.harness))
|
|
36
|
+
seen.harnesses.push(report.harness);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
byPath.set(path, {
|
|
40
|
+
id: `skill:${path}`,
|
|
41
|
+
name: skill.name,
|
|
42
|
+
description: skill.description,
|
|
43
|
+
argumentHint: skill.argumentHint,
|
|
44
|
+
path,
|
|
45
|
+
scope: skill.scope,
|
|
46
|
+
origin: skill.origin,
|
|
47
|
+
harnesses: [report.harness],
|
|
48
|
+
invoke: `/${skill.name}`,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const rank = (s) => (s.origin === 'project' || s.origin === 'local' ? 0 : 1);
|
|
53
|
+
return [...byPath.values()].sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name));
|
|
54
|
+
}
|
package/dist/terminal-text.d.ts
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Each control character becomes one U+FFFD, so the text keeps its length and
|
|
15
15
|
* a match offset into it still points at the same character.
|
|
16
|
+
*
|
|
17
|
+
* This is wayfinder's one filter for repository text. `stripControls` from
|
|
18
|
+
* `@osdlc/ux` covers the same characters but removes them, and whole escape
|
|
19
|
+
* sequences with them. That changes the length, so the terminal UI's match
|
|
20
|
+
* highlights would point at the wrong characters, and a person would not see
|
|
21
|
+
* that the name held anything. Both filters remove the same set of controls.
|
|
16
22
|
*/
|
|
17
23
|
import { type CliIo } from '@osdlc/cli-tool';
|
|
18
24
|
/**
|
|
@@ -23,6 +29,8 @@ import { type CliIo } from '@osdlc/cli-tool';
|
|
|
23
29
|
export declare function terminalSafe(text: string, opts?: {
|
|
24
30
|
multiline?: boolean;
|
|
25
31
|
}): string;
|
|
32
|
+
/** True when `text` holds a character {@link terminalSafe} replaces. */
|
|
33
|
+
export declare function hasControls(text: string): boolean;
|
|
26
34
|
/**
|
|
27
35
|
* `JSON.stringify(value, null, indent)` with DEL, C1 and the bidi controls
|
|
28
36
|
* written as `\u` escapes. It parses to the same value, and is safe to print
|
package/dist/terminal-text.js
CHANGED
|
@@ -13,17 +13,26 @@
|
|
|
13
13
|
*
|
|
14
14
|
* Each control character becomes one U+FFFD, so the text keeps its length and
|
|
15
15
|
* a match offset into it still points at the same character.
|
|
16
|
+
*
|
|
17
|
+
* This is wayfinder's one filter for repository text. `stripControls` from
|
|
18
|
+
* `@osdlc/ux` covers the same characters but removes them, and whole escape
|
|
19
|
+
* sequences with them. That changes the length, so the terminal UI's match
|
|
20
|
+
* highlights would point at the wrong characters, and a person would not see
|
|
21
|
+
* that the name held anything. Both filters remove the same set of controls.
|
|
16
22
|
*/
|
|
17
23
|
import { EXIT } from '@osdlc/cli-tool';
|
|
18
|
-
import {
|
|
19
|
-
/**
|
|
20
|
-
|
|
24
|
+
import { BIN } from "./app.js";
|
|
25
|
+
/**
|
|
26
|
+
* C0 (tab and newline included), DEL, C1, and the bidi controls: the marks
|
|
27
|
+
* U+061C, U+200E and U+200F, and U+202A-202E and U+2066-2069.
|
|
28
|
+
*/
|
|
29
|
+
const CONTROL = /[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
21
30
|
/** The same, but tab and newline are kept. */
|
|
22
|
-
const CONTROL_KEEP_LINES = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g;
|
|
31
|
+
const CONTROL_KEEP_LINES = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
23
32
|
/** C0 without tab and newline. */
|
|
24
33
|
const C0_KEEP_LINES = /[\u0000-\u0008\u000b-\u001f]/g;
|
|
25
34
|
/** What `JSON.stringify` leaves raw of the above: it escapes C0 itself. */
|
|
26
|
-
const JSON_RAW = /[\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g;
|
|
35
|
+
const JSON_RAW = /[\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/g;
|
|
27
36
|
const REPLACEMENT = '�';
|
|
28
37
|
/**
|
|
29
38
|
* `text` with every C0 control character (ESC included), DEL, C1 control
|
|
@@ -33,6 +42,10 @@ const REPLACEMENT = '�';
|
|
|
33
42
|
export function terminalSafe(text, opts = {}) {
|
|
34
43
|
return text.replace(opts.multiline === true ? CONTROL_KEEP_LINES : CONTROL, REPLACEMENT);
|
|
35
44
|
}
|
|
45
|
+
/** True when `text` holds a character {@link terminalSafe} replaces. */
|
|
46
|
+
export function hasControls(text) {
|
|
47
|
+
return new RegExp(CONTROL.source).test(text);
|
|
48
|
+
}
|
|
36
49
|
/**
|
|
37
50
|
* `JSON.stringify(value, null, indent)` with DEL, C1 and the bidi controls
|
|
38
51
|
* written as `\u` escapes. It parses to the same value, and is safe to print
|
|
@@ -85,7 +98,7 @@ export async function guardedExit(run, stderr = (text) => process.stderr.write(t
|
|
|
85
98
|
}
|
|
86
99
|
catch (err) {
|
|
87
100
|
const message = err instanceof Error ? err.message : String(err);
|
|
88
|
-
stderr(`${
|
|
101
|
+
stderr(`${BIN}: ${terminalSafe(message)}\n`);
|
|
89
102
|
return EXIT.error;
|
|
90
103
|
}
|
|
91
104
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a settings screen and `way providers` say about a tool: what it is,
|
|
3
|
+
* its homepage and its language, from `@osdlc/system-model`'s `ToolDef`.
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolDef } from '@osdlc/system-model/detect';
|
|
6
|
+
/** One tool's description, homepage and language. */
|
|
7
|
+
export interface ToolSummary {
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The project's site, `https://` or `http://` only, so a page can link it.
|
|
11
|
+
* Null for a custom tool that sets none or sets another scheme.
|
|
12
|
+
*/
|
|
13
|
+
homepage: string | null;
|
|
14
|
+
/** One sentence on what the tool is. Null for a custom tool that sets none. */
|
|
15
|
+
description: string | null;
|
|
16
|
+
/** The ecosystem id, such as `node`. Null for a tool of no one language. */
|
|
17
|
+
ecosystem: string | null;
|
|
18
|
+
/** The language a person reads: `JavaScript`, or `any language` (see `languageLabel`). */
|
|
19
|
+
language: string;
|
|
20
|
+
/** The runner role's kind: `exec` needs trust to be read. Null with no runner role. */
|
|
21
|
+
runnerKind: 'parse' | 'exec' | null;
|
|
22
|
+
}
|
|
23
|
+
/** The summary of `tool`. A custom tool's `homepage` and `description` are repository text. */
|
|
24
|
+
export declare function toolSummary(tool: ToolDef): ToolSummary;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a settings screen and `way providers` say about a tool: what it is,
|
|
3
|
+
* its homepage and its language, from `@osdlc/system-model`'s `ToolDef`.
|
|
4
|
+
*/
|
|
5
|
+
import { languageLabel } from "./vocabulary.js";
|
|
6
|
+
/** The summary of `tool`. A custom tool's `homepage` and `description` are repository text. */
|
|
7
|
+
export function toolSummary(tool) {
|
|
8
|
+
const ecosystem = tool.ecosystem?.id ?? null;
|
|
9
|
+
return {
|
|
10
|
+
id: tool.id,
|
|
11
|
+
homepage: tool.homepage !== undefined && /^https?:\/\//i.test(tool.homepage) ? tool.homepage : null,
|
|
12
|
+
description: tool.description ?? null,
|
|
13
|
+
ecosystem,
|
|
14
|
+
language: languageLabel(ecosystem),
|
|
15
|
+
runnerKind: tool.roles.runner?.kind ?? null,
|
|
16
|
+
};
|
|
17
|
+
}
|
package/dist/trust-command.d.ts
CHANGED
|
@@ -1,32 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* (
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
6
|
-
* trusted with no marker, and `--show`/`--untrust` say which layer decided
|
|
7
|
-
* (`by`/`rule`).
|
|
2
|
+
* `way trust`: cli-tool's shared `trust` command over wayfinder's marker store
|
|
3
|
+
* (`trust-store.ts`) and the user file's `trust` policy. A root the policy
|
|
4
|
+
* covers reports trusted with no marker, and every answer says which layer
|
|
5
|
+
* decided (`by`, `rule`).
|
|
8
6
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* `--scope <tool>` grants, removes or shows one tool's trust instead of the
|
|
8
|
+
* whole repository's. Granting is `cli-only`: the web view's server refuses
|
|
9
|
+
* it.
|
|
12
10
|
*/
|
|
13
|
-
import { type
|
|
11
|
+
import { type DataCommand } from '@osdlc/cli-tool/command';
|
|
12
|
+
import type { FlagSpec } from '@osdlc/cli-tool/define-cli';
|
|
13
|
+
import { type CommandEnvOptions } from './config-command.ts';
|
|
14
14
|
/**
|
|
15
|
-
* `
|
|
15
|
+
* The `trust` command. Mount it as `trust: trustCommand({ globals })`, with
|
|
16
|
+
* the app's global flags; `-C` must be declared as `dir`.
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/** Defaults to `homeDir()` from `@osdlc/trust-repo`. The base for the non-XDG state path. */
|
|
21
|
-
home?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* `<tool> trust [--untrust|--show|--list]`. `root` is the resolved project
|
|
25
|
-
* root. Returns the exit code.
|
|
26
|
-
*
|
|
27
|
-
* Exit codes follow `runConfigCommand`. 2 is a command that cannot run as
|
|
28
|
-
* typed, decided from the arguments alone. 1 is a valid command that failed
|
|
29
|
-
* against the state it found: here, `--untrust` on a root with no marker, or a
|
|
30
|
-
* config file that will not parse.
|
|
31
|
-
*/
|
|
32
|
-
export declare function runTrustCommand(toolName: string, root: string, argv: string[], io: TrustCommandIO): Promise<number>;
|
|
18
|
+
export declare function trustCommand<G extends FlagSpec = Record<never, never>>(options?: CommandEnvOptions & {
|
|
19
|
+
globals?: G;
|
|
20
|
+
}): DataCommand;
|