@inthedark/wb 0.0.7 → 0.0.8
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/README.md +2 -1
- package/WorkbenchBootstrap.mjs +5 -1
- package/index.d.ts +5 -3
- package/index.mjs +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,8 @@ note: have tried to keep dependencies minimal for the most part
|
|
|
58
58
|
`/daemon/host` — wake service
|
|
59
59
|
`/daemon/server` — workbench harness
|
|
60
60
|
`/daemon/voice` — vtt service (rust)
|
|
61
|
-
`/daemon/repo` — vfs service (go)
|
|
61
|
+
`/daemon/repo` — vfs service (go)
|
|
62
|
+
`/daemon/relay` — linux sandbox loopback relay (go)
|
|
62
63
|
`/integration` — integrations in third party software
|
|
63
64
|
`/instructions` — instructions for agents, copied into the user's `~/.workbench` folder whenever read
|
|
64
65
|
`/app/server` — server for frontend app
|
package/WorkbenchBootstrap.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import WorkbenchInstallPrompt from "./WorkbenchInstallPrompt.mjs";
|
|
|
13
13
|
import WorkbenchBootstrapCommand from "./WorkbenchBootstrapCommand.mjs";
|
|
14
14
|
import WorkbenchToolchain from "./WorkbenchToolchain.mjs";
|
|
15
15
|
import WorkbenchPackageRegistration from "./WorkbenchPackageRegistration.mjs";
|
|
16
|
+
import resolveWorkbenchDataRoot from "./workbench-data-root.mjs";
|
|
16
17
|
|
|
17
18
|
export default class WorkbenchBootstrap {
|
|
18
19
|
constructor({
|
|
@@ -35,7 +36,10 @@ export default class WorkbenchBootstrap {
|
|
|
35
36
|
this.toolchain = toolchain;
|
|
36
37
|
this.registration = registration;
|
|
37
38
|
this.write = write;
|
|
38
|
-
this.registry = path.join(
|
|
39
|
+
this.registry = path.join(
|
|
40
|
+
resolveWorkbenchDataRoot({ environment, homeDirectory: home, platform }),
|
|
41
|
+
"installation", "installation.json",
|
|
42
|
+
);
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
async checkoutExists(root) {
|
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Exports:
|
|
3
|
-
* - WorkbenchConfigOptions: dotenv
|
|
4
|
-
* - WorkbenchConfigOutput:
|
|
5
|
-
* - config: load
|
|
3
|
+
* - WorkbenchConfigOptions: dotenv mapping, missing-value policies, cancellation and warning hooks.
|
|
4
|
+
* - WorkbenchConfigOutput: mapped values after store replacement and policy checks, with the first file read error.
|
|
5
|
+
* - config: load and map dotenv values; resolve stores and check required names before environment writes.
|
|
6
6
|
*/
|
|
7
7
|
export type WorkbenchConfigOptions = {
|
|
8
8
|
/** One file or several; earlier files win unless `override` is set. Defaults to `.env`. */
|
|
@@ -11,6 +11,8 @@ export type WorkbenchConfigOptions = {
|
|
|
11
11
|
/** Replace variables already present in `processEnv`, as dotenv does. */
|
|
12
12
|
override?: boolean;
|
|
13
13
|
processEnv?: Record<string, string | undefined>;
|
|
14
|
+
/** Map merged parsed values before store resolution and policy checks. Rejection prevents environment writes. */
|
|
15
|
+
map?: (env: Record<string, string>) => Record<string, string> | Promise<Record<string, string>>;
|
|
14
16
|
/** Aborting kills running store commands and rejects. */
|
|
15
17
|
signal?: AbortSignal;
|
|
16
18
|
/** Opt into bounded lookup warnings that never contain command output. Silent by default. */
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Exports:
|
|
3
|
-
* - config: load dotenv
|
|
3
|
+
* - config: load and map dotenv values, resolve store references, and enforce an optional missing-variable policy.
|
|
4
4
|
*/
|
|
5
5
|
import fs from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
@@ -109,10 +109,13 @@ export async function config({
|
|
|
109
109
|
runner = new StoreCommandRunner(),
|
|
110
110
|
required,
|
|
111
111
|
optional,
|
|
112
|
+
map,
|
|
112
113
|
} = {}) {
|
|
113
114
|
signal?.throwIfAborted();
|
|
114
115
|
const policy = missingPolicy(required, optional);
|
|
115
|
-
const { parsed:
|
|
116
|
+
const { parsed: input, error } = await readParsed(Array.isArray(paths) ? paths : [paths], encoding, override);
|
|
117
|
+
const raw = map ? await map(input) : input;
|
|
118
|
+
signal?.throwIfAborted();
|
|
116
119
|
const definitions = raw.WB_STORES?.trim() || processEnv.WB_STORES?.trim() || DEFAULT_STORE_DEFINITIONS;
|
|
117
120
|
const { parsed, unresolved } = await resolveReferences(raw, definitions, { runner, signal, warn, policy });
|
|
118
121
|
applyMissingPolicy(parsed, unresolved, policy, processEnv, override);
|