@osdlc/wayfinder 0.9.0 → 0.11.1
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 +74 -0
- package/CONTRIBUTING.md +6 -1
- package/README.md +9 -4
- package/dist/args.d.ts +7 -8
- package/dist/args.js +7 -8
- package/dist/catalog.d.ts +13 -4
- package/dist/catalog.js +16 -8
- package/dist/clean-command.d.ts +3 -1
- package/dist/clean-command.js +23 -11
- package/dist/cli.js +3 -3
- package/dist/commands/index.js +1 -1
- package/dist/commands/list.d.ts +5 -2
- package/dist/commands/list.js +28 -3
- package/dist/commands/query.js +1 -1
- package/dist/commands/run.js +1 -1
- package/dist/commands/shared.js +2 -1
- package/dist/config-keys.d.ts +4 -0
- package/dist/config-keys.js +4 -0
- package/dist/config.d.ts +24 -10
- package/dist/config.js +64 -19
- package/dist/core/run.d.ts +2 -1
- package/dist/core/run.js +10 -2
- package/dist/core/saved-view.d.ts +2 -7
- package/dist/core/saved-view.js +5 -12
- package/dist/core/session.d.ts +7 -1
- package/dist/core/session.js +59 -22
- package/dist/core/writes.d.ts +13 -0
- package/dist/core/writes.js +22 -0
- package/dist/document-schemas.generated.js +6 -0
- package/dist/documents.d.ts +15 -2
- package/dist/documents.js +23 -14
- package/dist/guide.js +2 -2
- package/dist/index.js +2 -2
- package/dist/providers-command.d.ts +2 -2
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +1 -1
- package/dist/serve/auth.js +3 -16
- package/dist/serve/routes.d.ts +1 -1
- package/dist/serve/routes.js +1 -26
- package/dist/terminal-text.d.ts +4 -4
- package/dist/terminal-text.js +17 -12
- package/dist/tool-info.d.ts +2 -2
- package/dist/tools.js +1 -1
- package/dist/tui/app.js +24 -0
- package/dist/tui/index.js +3 -3
- package/dist/vocabulary.d.ts +5 -1
- package/dist/vocabulary.js +3 -1
- package/dist/web/main.js +67 -34
- package/dist/xdg.d.ts +0 -7
- package/dist/xdg.js +0 -14
- package/package.json +15 -13
- package/schema/config.json +14 -1
package/dist/web/main.js
CHANGED
|
@@ -135,6 +135,7 @@ function commandString(argv, opts = {}) {
|
|
|
135
135
|
case "posix": {
|
|
136
136
|
const line = shellJoin(argv);
|
|
137
137
|
if (cwd === void 0) return line;
|
|
138
|
+
if (cwd === "-") return `cd ./- && ${line}`;
|
|
138
139
|
return `cd ${cwd.startsWith("-") ? "-- " : ""}${shellQuote(cwd)} && ${line}`;
|
|
139
140
|
}
|
|
140
141
|
case "powershell": {
|
|
@@ -217,9 +218,9 @@ function cmdCommand(command) {
|
|
|
217
218
|
* probe cost is a rough estimate, and `1.4s` is easier to read than `1423ms`.
|
|
218
219
|
*/
|
|
219
220
|
function humanMs(ms) {
|
|
220
|
-
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
221
|
-
if (ms <
|
|
222
|
-
if (ms <
|
|
221
|
+
if (Math.round(ms) < 1e3) return `${Math.round(ms)}ms`;
|
|
222
|
+
if (ms < 9950) return `${(ms / 1e3).toFixed(1)}s`;
|
|
223
|
+
if (Math.round(ms / 1e3) < 60) return `${Math.round(ms / 1e3)}s`;
|
|
223
224
|
return `${Math.round(ms / 6e4)}m`;
|
|
224
225
|
}
|
|
225
226
|
/**
|
|
@@ -233,30 +234,17 @@ function humanMs(ms) {
|
|
|
233
234
|
*/
|
|
234
235
|
function humanAge(ms) {
|
|
235
236
|
if (ms === void 0) return "of unknown age";
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
237
|
+
const seconds = Math.max(1, Math.round(ms / 1e3));
|
|
238
|
+
if (seconds < 60) return `${seconds}s old`;
|
|
239
|
+
const minutes = Math.round(ms / 6e4);
|
|
240
|
+
if (minutes < 60) return `${minutes}m old`;
|
|
241
|
+
const hours = Math.round(ms / 36e5);
|
|
242
|
+
if (hours < 24) return `${hours}h old`;
|
|
239
243
|
return `${Math.round(ms / 864e5)}d old`;
|
|
240
244
|
}
|
|
241
245
|
//#endregion
|
|
242
246
|
//#region ../system-model/dist/match.js
|
|
243
247
|
/**
|
|
244
|
-
* Ranked search over catalog entries. Both views use this one matcher.
|
|
245
|
-
*
|
|
246
|
-
* Every view of this catalog must agree on what a query means. Otherwise the
|
|
247
|
-
* same query ranks differently depending on which view you use. The terminal
|
|
248
|
-
* UI imports it directly. The web view loads it transpiled for the browser.
|
|
249
|
-
* That is why it has its own `./match` export subpath, and why it must not use
|
|
250
|
-
* the DOM or Node built-ins. Importing anything from `node:fs` here breaks the
|
|
251
|
-
* browser build.
|
|
252
|
-
*
|
|
253
|
-
* Query language:
|
|
254
|
-
* - terms are whitespace-separated and ANDed; every term must match a field
|
|
255
|
-
* - a leading `'` forces that term to match as a substring, fzf-style
|
|
256
|
-
* - `mode: "exact"` forces every term to, without the prefix
|
|
257
|
-
* - matching is case-insensitive throughout
|
|
258
|
-
*/
|
|
259
|
-
/**
|
|
260
248
|
* Case-insensitive subsequence match. Consecutive characters and matches at a
|
|
261
249
|
* word boundary score higher, so "ddev" ranks "determined:dev" above an
|
|
262
250
|
* incidental scatter of those letters.
|
|
@@ -430,6 +418,38 @@ function filterTasks(reports, filter = {}) {
|
|
|
430
418
|
return hits;
|
|
431
419
|
}
|
|
432
420
|
//#endregion
|
|
421
|
+
//#region ../ux/dist/text.js
|
|
422
|
+
/**
|
|
423
|
+
* Bidirectional controls, which reorder the text around them: the marks ALM,
|
|
424
|
+
* LRM and RLM, and the embeddings, overrides and isolates. A character-class
|
|
425
|
+
* body.
|
|
426
|
+
*/
|
|
427
|
+
const BIDI = "\\u061c\\u200e\\u200f\\u202a-\\u202e\\u2066-\\u2069";
|
|
428
|
+
new RegExp(`[\\u0000-\\u001f\\u007f-\\u009f${BIDI}]`);
|
|
429
|
+
/** The C0 class body for each choice of kept tab and line feed. */
|
|
430
|
+
function c0Class(options) {
|
|
431
|
+
const tab = options.tab === true;
|
|
432
|
+
const newline = options.newline === true;
|
|
433
|
+
if (tab && newline) return "\\u0000-\\u0008\\u000b-\\u001f";
|
|
434
|
+
if (tab) return "\\u0000-\\u0008\\u000a-\\u001f";
|
|
435
|
+
if (newline) return "\\u0000-\\u0009\\u000b-\\u001f";
|
|
436
|
+
return "\\u0000-\\u001f";
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* A global `RegExp` that matches, one character at a time, every control
|
|
440
|
+
* character {@link stripControls} removes with the same `options`: C0 (a tab
|
|
441
|
+
* or line feed kept by `options` excepted; a carriage return always
|
|
442
|
+
* matches), DEL, C1 and the bidirectional controls.
|
|
443
|
+
*
|
|
444
|
+
* It does not know escape sequences, so it matches only the ESC or C1
|
|
445
|
+
* introducer of one, not the rest. For a filter that must keep the text's
|
|
446
|
+
* length, such as one that replaces each control with U+FFFD so offsets into
|
|
447
|
+
* the text stay valid.
|
|
448
|
+
*/
|
|
449
|
+
function controlPattern(options = {}) {
|
|
450
|
+
return new RegExp(`[${c0Class(options)}\\u007f-\\u009f${BIDI}]`, "g");
|
|
451
|
+
}
|
|
452
|
+
//#endregion
|
|
433
453
|
//#region src/app.ts
|
|
434
454
|
/**
|
|
435
455
|
* The app's names. Every user-facing name that carries the product name
|
|
@@ -444,9 +464,12 @@ const APP = "wayfinder";
|
|
|
444
464
|
* C0 (tab and newline included), DEL, C1, and the bidi controls: the marks
|
|
445
465
|
* U+061C, U+200E and U+200F, and U+202A-202E and U+2066-2069.
|
|
446
466
|
*/
|
|
447
|
-
const CONTROL =
|
|
467
|
+
const CONTROL = controlPattern();
|
|
448
468
|
/** The same, but tab and newline are kept. */
|
|
449
|
-
const CONTROL_KEEP_LINES =
|
|
469
|
+
const CONTROL_KEEP_LINES = controlPattern({
|
|
470
|
+
newline: true,
|
|
471
|
+
tab: true
|
|
472
|
+
});
|
|
450
473
|
const REPLACEMENT = "�";
|
|
451
474
|
/**
|
|
452
475
|
* `text` with every C0 control character (ESC included), DEL, C1 control
|
|
@@ -2365,6 +2388,8 @@ const THEME_VALUES = [
|
|
|
2365
2388
|
"light",
|
|
2366
2389
|
"dark"
|
|
2367
2390
|
];
|
|
2391
|
+
/** The `open` values: what the bare `way` command opens. */
|
|
2392
|
+
const OPEN_VALUES = ["tui", "web"];
|
|
2368
2393
|
/**
|
|
2369
2394
|
* The keys `config set` and `config unset` change from the command line only.
|
|
2370
2395
|
* cli-tool's adapters, such as the HTTP one the web view's server runs,
|
|
@@ -2397,6 +2422,13 @@ function settingLayer(key, source) {
|
|
|
2397
2422
|
}
|
|
2398
2423
|
//#endregion
|
|
2399
2424
|
//#region src/web/api.ts
|
|
2425
|
+
/**
|
|
2426
|
+
* The page's calls to the server. Every action but Run is a command of the
|
|
2427
|
+
* tree, sent to `POST /api/commands/<command>` with a JSON body of its flags
|
|
2428
|
+
* and positionals, exactly as `way <command> --json` would run it. Run is
|
|
2429
|
+
* `POST /run`, which resolves the task with `way run --dry-run`. Which
|
|
2430
|
+
* command each action is lives in `../actions.ts`, where a test checks it.
|
|
2431
|
+
*/
|
|
2400
2432
|
/** The media type of a streamed answer: one JSON line per event, then the document. */
|
|
2401
2433
|
const NDJSON = "application/x-ndjson";
|
|
2402
2434
|
/** Where the bearer token is kept for this tab. */
|
|
@@ -2633,8 +2665,8 @@ async function load(opts = {}) {
|
|
|
2633
2665
|
}
|
|
2634
2666
|
/**
|
|
2635
2667
|
* One progress line of a probe. While nothing else is on screen, the runner
|
|
2636
|
-
* that answered
|
|
2637
|
-
* count of runners still loading moves.
|
|
2668
|
+
* that answered, or the skills, join the catalog and the page draws them;
|
|
2669
|
+
* otherwise only the count of runners still loading moves.
|
|
2638
2670
|
*/
|
|
2639
2671
|
function onProgress(line) {
|
|
2640
2672
|
const event = line;
|
|
@@ -2662,7 +2694,11 @@ function onProgress(line) {
|
|
|
2662
2694
|
unknowns: [],
|
|
2663
2695
|
skills: []
|
|
2664
2696
|
};
|
|
2665
|
-
if (
|
|
2697
|
+
if (event.skills !== void 0) state.catalog = {
|
|
2698
|
+
...base,
|
|
2699
|
+
skills: event.skills
|
|
2700
|
+
};
|
|
2701
|
+
else if (report === void 0) state.catalog = base;
|
|
2666
2702
|
else {
|
|
2667
2703
|
const others = (list) => (list ?? []).filter((r) => r.runner !== report.runner);
|
|
2668
2704
|
const rank = (r) => {
|
|
@@ -2924,9 +2960,10 @@ async function requestRun(id, args = []) {
|
|
|
2924
2960
|
})
|
|
2925
2961
|
};
|
|
2926
2962
|
}
|
|
2963
|
+
const argv = body?.argv;
|
|
2927
2964
|
return {
|
|
2928
2965
|
outcome: "handed-off",
|
|
2929
|
-
command:
|
|
2966
|
+
command: argv !== void 0 && argv.length > 0 ? commandString(argv, { platform: serverPlatform() }) : body?.display || "the task"
|
|
2930
2967
|
};
|
|
2931
2968
|
}
|
|
2932
2969
|
//#endregion
|
|
@@ -3069,7 +3106,7 @@ function excludedSection() {
|
|
|
3069
3106
|
return section("Excluded paths", "excludePaths", (paths.length === 0 ? "<p class=\"set-empty\">none</p>" : "<ul class=\"set-list\">" + paths.map((p, i) => "<li><code>" + escapeHtml(p) + "</code><button class=\"set-x\" data-drop-path=\"" + i + "\" aria-label=\"Remove " + escapeHtml(p) + "\">×</button></li>").join("") + "</ul>") + "<div class=\"set-add\"><input type=\"text\" id=\"set-path\" placeholder=\"vendor, or src/fixtures\" aria-label=\"Path to exclude\" /><button data-add-path=\"1\">Add</button></div><p class=\"set-sub\">A bare name matches any path segment; a value with a slash matches from the root. This narrows where runners look, and is not the same as turning a runner off.</p>");
|
|
3070
3107
|
}
|
|
3071
3108
|
function personalSection() {
|
|
3072
|
-
return section("Personal", null, "<p class=\"set-sub\">Saved in your user config, not the project.</p><h4>Theme " + layerNote("theme") + "</h4>" + radios("theme", THEME_VALUES) + "<h4>What <code>" + escapeHtml("way") + "</code> opens " + layerNote("open") + "</h4>" + radios("open",
|
|
3109
|
+
return section("Personal", null, "<p class=\"set-sub\">Saved in your user config, not the project.</p><h4>Theme " + layerNote("theme") + "</h4>" + radios("theme", THEME_VALUES) + "<h4>What <code>" + escapeHtml("way") + "</code> opens " + layerNote("open") + "</h4>" + radios("open", OPEN_VALUES));
|
|
3073
3110
|
}
|
|
3074
3111
|
/** The settings the page may not write, each with the command that does. */
|
|
3075
3112
|
function cliOnlySection() {
|
|
@@ -3224,10 +3261,6 @@ async function reload() {
|
|
|
3224
3261
|
if (fresh !== null) loaded = fresh;
|
|
3225
3262
|
repaint();
|
|
3226
3263
|
}
|
|
3227
|
-
/** "a", "a and b", "a, b and c". */
|
|
3228
|
-
function listed(items) {
|
|
3229
|
-
return items.length <= 1 ? items[0] ?? "" : items.slice(0, -1).join(", ") + " and " + items[items.length - 1];
|
|
3230
|
-
}
|
|
3231
3264
|
/**
|
|
3232
3265
|
* Write the staged edits, one `config set` each, and say what was written
|
|
3233
3266
|
* where. A refused write stops there and keeps it and the edits after it
|
|
@@ -3246,7 +3279,7 @@ async function commit() {
|
|
|
3246
3279
|
delete staged[key];
|
|
3247
3280
|
if (key === "theme") applyTheme(value);
|
|
3248
3281
|
}
|
|
3249
|
-
const saved = [...written].map(([file, keys]) => "Saved " +
|
|
3282
|
+
const saved = [...written].map(([file, keys]) => "Saved " + listWords(keys) + " to " + file + ".");
|
|
3250
3283
|
notice = failure === null ? {
|
|
3251
3284
|
kind: "ok",
|
|
3252
3285
|
text: saved.join(" ") || "Nothing to save."
|
package/dist/xdg.d.ts
CHANGED
|
@@ -73,10 +73,3 @@ export declare function pre08Bases(env: Record<string, string | undefined>, home
|
|
|
73
73
|
state: string;
|
|
74
74
|
cache: string;
|
|
75
75
|
};
|
|
76
|
-
/**
|
|
77
|
-
* Expand a leading `~` against `home`, and `~\` too on Windows; anything
|
|
78
|
-
* else is returned unchanged.
|
|
79
|
-
* direnv, `.env` loaders and CI YAML pass a literal tilde through, and
|
|
80
|
-
* `<cwd>/~/x` would be a silent wrong answer.
|
|
81
|
-
*/
|
|
82
|
-
export declare function expandTilde(path: string, home: string, platform?: NodeJS.Platform): string;
|
package/dist/xdg.js
CHANGED
|
@@ -73,17 +73,3 @@ export function pre08Bases(env, home) {
|
|
|
73
73
|
cache: xdgHome(env, home, 'XDG_CACHE_HOME', '.cache'),
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Expand a leading `~` against `home`, and `~\` too on Windows; anything
|
|
78
|
-
* else is returned unchanged.
|
|
79
|
-
* direnv, `.env` loaders and CI YAML pass a literal tilde through, and
|
|
80
|
-
* `<cwd>/~/x` would be a silent wrong answer.
|
|
81
|
-
*/
|
|
82
|
-
export function expandTilde(path, home, platform = process.platform) {
|
|
83
|
-
if (path === '~')
|
|
84
|
-
return home;
|
|
85
|
-
if (path.startsWith('~/') || (platform === 'win32' && path.startsWith('~\\'))) {
|
|
86
|
-
return join(home, path.slice(2));
|
|
87
|
-
}
|
|
88
|
-
return path;
|
|
89
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdlc/wayfinder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Browse and run every task in a repository from one list: a terminal UI where Enter runs the selected task, a live web view, and JSON for scripts. Tasks, installs, tool trust and git hooks come from @osdlc/system-model.",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "sksizer",
|
|
@@ -55,16 +55,17 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"zod": "4.4.3",
|
|
58
|
-
"@osdlc/command-seam": "^0.
|
|
59
|
-
"@osdlc/cli-tool": "^0.
|
|
60
|
-
"@osdlc/
|
|
61
|
-
"@osdlc/etag-write": "^0.
|
|
62
|
-
"@osdlc/
|
|
63
|
-
"@osdlc/
|
|
64
|
-
"@osdlc/
|
|
65
|
-
"@osdlc/
|
|
66
|
-
"@osdlc/trust-repo": "^0.
|
|
67
|
-
"@osdlc/
|
|
58
|
+
"@osdlc/command-seam": "^0.14.0",
|
|
59
|
+
"@osdlc/cli-tool": "^0.10.1",
|
|
60
|
+
"@osdlc/detect-harness": "^0.7.0",
|
|
61
|
+
"@osdlc/etag-write": "^0.3.0",
|
|
62
|
+
"@osdlc/path-guard": "^0.3.1",
|
|
63
|
+
"@osdlc/config-layers": "^0.8.0",
|
|
64
|
+
"@osdlc/system-model": "^0.7.1",
|
|
65
|
+
"@osdlc/tiered-dirs": "^0.5.0",
|
|
66
|
+
"@osdlc/trust-repo": "^0.5.1",
|
|
67
|
+
"@osdlc/typed-git": "^0.10.0",
|
|
68
|
+
"@osdlc/ux": "^0.1.1"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@types/node": "^26.1.0",
|
|
@@ -75,12 +76,13 @@
|
|
|
75
76
|
"rolldown": "^1.2.14",
|
|
76
77
|
"typescript": "~6.0.3",
|
|
77
78
|
"vitest": "^5.0.5",
|
|
78
|
-
"@osdlc/color": "^1.1.0",
|
|
79
79
|
"@osdlc/prettier-config": "^0.3.1",
|
|
80
|
+
"@osdlc/color": "^1.1.0",
|
|
80
81
|
"@osdlc/tsconfig": "^0.4.1"
|
|
81
82
|
},
|
|
82
83
|
"scripts": {
|
|
83
|
-
"build": "node scripts/write-document-schemas.ts && tsc -p tsconfig.build.json && node scripts/build-web.mjs
|
|
84
|
+
"build": "node scripts/write-document-schemas.ts && tsc -p tsconfig.build.json && node scripts/build-web.mjs",
|
|
85
|
+
"write:config-schema": "node scripts/write-config-schema.mjs",
|
|
84
86
|
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
85
87
|
"test": "vitest run",
|
|
86
88
|
"test:e2e": "vitest run tests/e2e",
|
package/schema/config.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://unpkg.com/@osdlc/wayfinder@0.
|
|
3
|
+
"$id": "https://unpkg.com/@osdlc/wayfinder@0.11/schema/config.json",
|
|
4
4
|
"title": "wayfinder configuration",
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
@@ -24,6 +24,19 @@
|
|
|
24
24
|
"type": "string"
|
|
25
25
|
},
|
|
26
26
|
"description": "Preferred display order. Runners not named follow alphabetically."
|
|
27
|
+
},
|
|
28
|
+
"timeout": {
|
|
29
|
+
"anyOf": [
|
|
30
|
+
{
|
|
31
|
+
"type": "number",
|
|
32
|
+
"minimum": 1,
|
|
33
|
+
"maximum": 3600
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"type": "null"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"description": "Seconds one runner may take to list its tasks, its subprocesses included. A runner still running then is stopped and shows \"timed out\". null (the default): each runner has its own limit, 10 for just and task, 30 for mise and rake, 120 for moon, 300 for gradle and sbt, 60 for the rest. A project file can only lower a limit: each runner takes the smaller of its value and the limit it would have."
|
|
27
40
|
}
|
|
28
41
|
},
|
|
29
42
|
"description": "Which runners are read, and in what order they are shown."
|