proper-base 0.6.0 → 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.
@@ -0,0 +1,132 @@
1
+ import { stripVTControlCharacters } from "node:util";
2
+ import {
3
+ DefaultPackageManager,
4
+ type ExtensionContext,
5
+ InteractiveMode,
6
+ } from "@earendil-works/pi-coding-agent";
7
+ import { installWrapper } from "../host-interop.ts";
8
+ import type { UpdateKind } from "./readiness.ts";
9
+
10
+ function showRestartHint(receiver: object, start: number): void {
11
+ const chat = Reflect.get(receiver, "chatContainer") as
12
+ | { children?: object[] }
13
+ | undefined;
14
+ if (!Array.isArray(chat?.children)) return;
15
+ for (const child of chat.children.slice(start)) {
16
+ if (child.constructor?.name !== "Text") continue;
17
+ const text = Reflect.get(child, "text");
18
+ const setText = Reflect.get(child, "setText");
19
+ if (typeof text !== "string" || typeof setText !== "function") continue;
20
+ const lines = text.split("\n");
21
+ const instruction = stripVTControlCharacters(lines[1] ?? "").match(
22
+ /^(New version .+ is available\.|Package updates are available\.) Run pi update(?: --extensions)?$/,
23
+ );
24
+ if (!instruction) continue;
25
+ lines[1] = `${instruction[1]} Restart Pi to install detected updates.`;
26
+ Reflect.apply(setText, child, [lines.join("\n")]);
27
+ }
28
+ }
29
+
30
+ function childCount(receiver: object): number {
31
+ const chat = Reflect.get(receiver, "chatContainer") as
32
+ | { children?: unknown[] }
33
+ | undefined;
34
+ return Array.isArray(chat?.children) ? chat.children.length : 0;
35
+ }
36
+
37
+ // @lat: [[auto-updates#Native availability adapter]]
38
+ export function observeAvailability(
39
+ agentDir: string,
40
+ onAvailable: (kind: UpdateKind, ctx: ExtensionContext) => boolean,
41
+ ) {
42
+ const manager = DefaultPackageManager.prototype;
43
+ const mode = InteractiveMode.prototype;
44
+ const check = manager.checkForAvailableUpdates;
45
+ const show = mode.showNewVersionNotification;
46
+ const showPackages = mode.showPackageUpdateNotification;
47
+ if (
48
+ typeof check !== "function" ||
49
+ typeof show !== "function" ||
50
+ typeof showPackages !== "function"
51
+ )
52
+ return undefined;
53
+ let context: ExtensionContext | undefined;
54
+ let active = true;
55
+ let packagesReady: ExtensionContext | undefined;
56
+ let projectReady = false;
57
+ const removeCheck = installWrapper(
58
+ manager,
59
+ "checkForAvailableUpdates",
60
+ async function (
61
+ this: DefaultPackageManager,
62
+ ...args: Parameters<typeof check>
63
+ ) {
64
+ const owner = context;
65
+ const matches =
66
+ owner &&
67
+ Reflect.get(this, "agentDir") === agentDir &&
68
+ Reflect.get(this, "cwd") === owner.cwd;
69
+ const updates = (await Reflect.apply(check, this, args)) as Awaited<
70
+ ReturnType<typeof check>
71
+ >;
72
+ if (active && matches && context === owner) {
73
+ let ready = updates.length > 0;
74
+ projectReady = updates.some((update) => update.scope === "project");
75
+ for (const scope of new Set(updates.map((update) => update.scope))) {
76
+ if (scope === "project" && !owner.isProjectTrusted()) ready = false;
77
+ else if (!onAvailable(scope, owner)) ready = false;
78
+ }
79
+ packagesReady = ready ? owner : undefined;
80
+ }
81
+ return updates;
82
+ },
83
+ );
84
+ const removeShow = installWrapper(
85
+ mode,
86
+ "showNewVersionNotification",
87
+ function (this: InteractiveMode, ...args: Parameters<typeof show>) {
88
+ const start = childCount(this);
89
+ const result = Reflect.apply(show, this, args);
90
+ const owner = context;
91
+ if (
92
+ active &&
93
+ owner &&
94
+ Reflect.get(this, "sessionManager") === owner.sessionManager &&
95
+ typeof args[0]?.version === "string" &&
96
+ args[0].version.trim()
97
+ )
98
+ if (onAvailable("pi", owner)) showRestartHint(this, start);
99
+ return result;
100
+ },
101
+ );
102
+ const removePackages = installWrapper(
103
+ mode,
104
+ "showPackageUpdateNotification",
105
+ function (this: InteractiveMode, ...args: Parameters<typeof showPackages>) {
106
+ const start = childCount(this);
107
+ const result = Reflect.apply(showPackages, this, args);
108
+ if (
109
+ active &&
110
+ context &&
111
+ packagesReady === context &&
112
+ Reflect.get(this, "sessionManager") === context.sessionManager &&
113
+ (!projectReady || context.isProjectTrusted())
114
+ )
115
+ showRestartHint(this, start);
116
+ return result;
117
+ },
118
+ );
119
+ return {
120
+ setContext(ctx: ExtensionContext | undefined) {
121
+ if (context !== ctx) packagesReady = undefined;
122
+ context = ctx;
123
+ },
124
+ dispose() {
125
+ active = false;
126
+ context = undefined;
127
+ removeCheck();
128
+ removeShow();
129
+ removePackages();
130
+ },
131
+ };
132
+ }
@@ -0,0 +1,403 @@
1
+ import { writeSync } from "node:fs";
2
+ import { access, readFile, realpath } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import {
6
+ type ExtensionAPI,
7
+ type ExtensionContext,
8
+ getAgentDir,
9
+ getPackageDir,
10
+ parseArgs,
11
+ type SessionStartEvent,
12
+ VERSION,
13
+ } from "@earendil-works/pi-coding-agent";
14
+ import { observeAvailability } from "./availability.ts";
15
+ import { clearUpdates, pendingUpdates, rememberUpdate } from "./readiness.ts";
16
+ import {
17
+ acquireLock,
18
+ changes,
19
+ consumeRestartMarker,
20
+ enabled,
21
+ parseSnapshot,
22
+ RESTART_MARKER,
23
+ restartArgs,
24
+ run,
25
+ summary,
26
+ updateStatus,
27
+ } from "./runtime.ts";
28
+ import { installSettings } from "./settings.ts";
29
+
30
+ const STARTED = Symbol.for("proper-updater.started.v1");
31
+ const RESULT = "PROPER_UPDATER_RESULT";
32
+
33
+ // @lat: [[auto-updates#Startup behavior]]
34
+ export function registerAutoUpdates(pi: ExtensionAPI): void {
35
+ pi.registerFlag("no-auto-update", {
36
+ description: "Skip automatic updates for this launch",
37
+ type: "boolean",
38
+ default: false,
39
+ });
40
+ let controller: AbortController | undefined;
41
+ let removeInput: (() => void) | undefined;
42
+ let cleanupSignals: (() => void) | undefined;
43
+ let restarting = false;
44
+ let pending: Promise<void> | undefined;
45
+ let restartSupported = false;
46
+ const agentDir = getAgentDir();
47
+ const createObserver = () =>
48
+ observeAvailability(agentDir, (kind, ctx) => {
49
+ try {
50
+ rememberUpdate(agentDir, kind, ctx.cwd);
51
+ return restartSupported;
52
+ } catch (error) {
53
+ if (typeof (error as NodeJS.ErrnoException).code !== "string")
54
+ throw error;
55
+ ctx.ui.notify(
56
+ "proper-base updates: Could not save update availability. Run pi update --all manually.",
57
+ "warning",
58
+ );
59
+ return false;
60
+ }
61
+ });
62
+ let observer: ReturnType<typeof observeAvailability>;
63
+ let settings: ReturnType<typeof installSettings> | undefined;
64
+ let autoUpdateEnabled = true;
65
+ const refreshObserver = (ctx: ExtensionContext) => {
66
+ const parsed = parseArgs(process.argv.slice(2));
67
+ if (
68
+ ctx.mode === "tui" &&
69
+ autoUpdateEnabled &&
70
+ !enabled(process.env.PROPER_UPDATER_OFF) &&
71
+ !process.env.PI_OFFLINE &&
72
+ !parsed.offline &&
73
+ !pi.getFlag("no-auto-update")
74
+ ) {
75
+ observer ??= createObserver();
76
+ observer?.setContext(ctx);
77
+ } else observer?.setContext(undefined);
78
+ };
79
+
80
+ pi.on("session_shutdown", async () => {
81
+ settings?.dispose();
82
+ observer?.dispose();
83
+ observer = undefined;
84
+ controller?.abort();
85
+ // Keep Pi alive until installers are terminated and the lock is released.
86
+ await pending;
87
+ removeInput?.();
88
+ if (!restarting) cleanupSignals?.();
89
+ });
90
+
91
+ async function start(
92
+ event: SessionStartEvent,
93
+ ctx: ExtensionContext,
94
+ ): Promise<void> {
95
+ if (event.reason !== "startup" || Reflect.get(process, STARTED)) return;
96
+ Reflect.set(process, STARTED, true);
97
+ const restarted = consumeRestartMarker(process.env, process.pid);
98
+ const result = process.env[RESULT];
99
+ delete process.env[RESULT];
100
+ if (restarted) {
101
+ if (ctx.mode === "tui")
102
+ ctx.ui.notify(result?.slice(0, 1200) || "Updates active.", "info");
103
+ return;
104
+ }
105
+ const rawArgs = process.argv.slice(2);
106
+ const parsed = parseArgs(rawArgs);
107
+ if (
108
+ ctx.mode !== "tui" ||
109
+ !autoUpdateEnabled ||
110
+ enabled(process.env.PROPER_UPDATER_OFF) ||
111
+ process.env.PI_OFFLINE ||
112
+ parsed.offline ||
113
+ pi.getFlag("no-auto-update")
114
+ )
115
+ return;
116
+ const warn = (message: string) =>
117
+ ctx.ui.notify(`proper-base updates: ${message}`, "warning");
118
+ if (!observer) {
119
+ warn(
120
+ "Native update observation is unavailable in this Pi version. Run pi update --all manually.",
121
+ );
122
+ return;
123
+ }
124
+ controller = new AbortController();
125
+ const signal = controller.signal;
126
+ const hasPending =
127
+ (await pendingUpdates(agentDir, ctx.cwd, ctx.isProjectTrusted())).files
128
+ .length > 0;
129
+ if (signal.aborted) return;
130
+ const execve = process.execve;
131
+ const packageDir = getPackageDir();
132
+ const entry = process.argv[1];
133
+ // Immutable pnpm/managed release paths and embedded SDK hosts cannot be
134
+ // relaunched by replaying this script path. Do not update a different Pi.
135
+ if (
136
+ !process.stdin.isTTY ||
137
+ !process.stdout.isTTY ||
138
+ !execve ||
139
+ !["linux", "darwin"].includes(process.platform) ||
140
+ process.versions.bun ||
141
+ process.env.PI_MANAGED_INSTALL_ROOT ||
142
+ packageDir.includes("/.pnpm/") ||
143
+ !packageDir.includes("/lib/node_modules/") ||
144
+ !entry
145
+ ) {
146
+ if (hasPending)
147
+ warn(
148
+ "Automatic updates require an npm-installed Pi on Linux/macOS with Node 22.19+. Run pi update --all manually.",
149
+ );
150
+ return;
151
+ }
152
+ const manifest = JSON.parse(
153
+ await readFile(join(packageDir, "package.json"), "utf8"),
154
+ ) as { bin?: { pi?: string } };
155
+ if (
156
+ !manifest.bin?.pi ||
157
+ (await realpath(entry)) !==
158
+ (await realpath(join(packageDir, manifest.bin.pi)))
159
+ ) {
160
+ if (hasPending)
161
+ warn("Unrecognized Pi launcher; run pi update --all manually.");
162
+ return;
163
+ }
164
+ if (signal.aborted) return;
165
+ restartSupported = true;
166
+ if (!hasPending) return;
167
+ let interrupted = false;
168
+ const cancel = () => {
169
+ interrupted = true;
170
+ controller?.abort();
171
+ };
172
+ for (const name of ["SIGINT", "SIGTERM", "SIGHUP"] as const)
173
+ process.on(name, cancel);
174
+ cleanupSignals = () => {
175
+ for (const name of ["SIGINT", "SIGTERM", "SIGHUP"] as const)
176
+ process.off(name, cancel);
177
+ };
178
+ let inputReceived = false;
179
+ removeInput = ctx.ui.onTerminalInput(() => {
180
+ inputReceived = true;
181
+ });
182
+ const env = { ...process.env, GIT_TERMINAL_PROMPT: "0" };
183
+ const options = { cwd: ctx.cwd, env, signal };
184
+ const inventoryScript = fileURLToPath(
185
+ new URL("./inventory.mjs", import.meta.url),
186
+ );
187
+ const snapshot = async () => {
188
+ const result = await run(
189
+ process.execPath,
190
+ [
191
+ inventoryScript,
192
+ packageDir,
193
+ agentDir,
194
+ ctx.cwd,
195
+ String(ctx.isProjectTrusted()),
196
+ ],
197
+ { ...options, timeout: 30_000 },
198
+ );
199
+ if (result.code !== 0 || result.stopped) return undefined;
200
+ return parseSnapshot(result.stdout);
201
+ };
202
+ let release: (() => Promise<void>) | undefined;
203
+ let progressTimer: ReturnType<typeof setInterval> | undefined;
204
+ const startedAt = Date.now();
205
+ let phase = "Reading installed versions…";
206
+ const renderProgress = () =>
207
+ ctx.ui.setWidget("proper-updater", [
208
+ `${phase} (${Math.floor((Date.now() - startedAt) / 1000)}s)`,
209
+ ]);
210
+ const setProgress = (next: string) => {
211
+ phase = next;
212
+ renderProgress();
213
+ };
214
+ try {
215
+ release = await acquireLock(agentDir);
216
+ if (!release) {
217
+ warn(
218
+ `Another updater owns ${join(agentDir, "proper-updater.lock")}. Updates skipped. If stale, check its PID before removing it.`,
219
+ );
220
+ return;
221
+ }
222
+ // Recheck under the installer lock: another launch may have handled these.
223
+ const ready = await pendingUpdates(
224
+ agentDir,
225
+ ctx.cwd,
226
+ ctx.isProjectTrusted(),
227
+ );
228
+ if (!ready.files.length) return;
229
+ renderProgress();
230
+ progressTimer = setInterval(renderProgress, 1000);
231
+ const before = await snapshot();
232
+ if (!before) {
233
+ if (!signal.aborted)
234
+ warn(
235
+ "Could not inspect installed packages; no updates attempted. Run pi update --all manually.",
236
+ );
237
+ return;
238
+ }
239
+ // Another launch may already have replaced Pi after this runtime loaded.
240
+ before.pi = { name: "Pi", revision: VERSION };
241
+ setProgress(
242
+ ready.packages ? "Checking package updates…" : "Checking Pi version…",
243
+ );
244
+ const update = await run(
245
+ process.execPath,
246
+ [
247
+ entry,
248
+ "update",
249
+ ready.pi ? (ready.packages ? "--all" : "--self") : "--extensions",
250
+ ready.project && ctx.isProjectTrusted()
251
+ ? "--approve"
252
+ : "--no-approve",
253
+ ],
254
+ {
255
+ ...options,
256
+ onLine: (line) => {
257
+ const status = updateStatus(line);
258
+ if (status)
259
+ setProgress(
260
+ !ready.pi && status === "Checking Pi version…"
261
+ ? "Package updates finished"
262
+ : status,
263
+ );
264
+ },
265
+ },
266
+ );
267
+ if (signal.aborted) return;
268
+ if (update.code !== 0 || update.stopped) {
269
+ warn(
270
+ `Update ${update.stopped ? "timed out" : `failed (exit ${update.code})`}. Some packages may have changed. Run pi update --all for details.`,
271
+ );
272
+ }
273
+ // --all can update packages and then fail self-update. Compare even on failure.
274
+ setProgress("Verifying installed versions…");
275
+ const after = await snapshot();
276
+ if (!after) {
277
+ if (!signal.aborted)
278
+ warn(
279
+ "Could not verify installed versions. Restart Pi manually before continuing.",
280
+ );
281
+ return;
282
+ }
283
+ if (update.code === 0 && !update.stopped && !signal.aborted)
284
+ await clearUpdates(ready.files);
285
+ const changed = changes(before, after);
286
+ if (!changed.length) return;
287
+ const changedSummary = summary(changed);
288
+ let sessionFile = ctx.sessionManager.getSessionFile();
289
+ if (sessionFile) {
290
+ try {
291
+ await access(sessionFile);
292
+ } catch (error) {
293
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
294
+ sessionFile = undefined;
295
+ }
296
+ }
297
+ const args = restartArgs(rawArgs, parsed, sessionFile);
298
+ if (
299
+ !args ||
300
+ inputReceived ||
301
+ ctx.ui.getEditorText() ||
302
+ !ctx.isIdle() ||
303
+ ctx.hasPendingMessages()
304
+ ) {
305
+ warn(
306
+ `Updated ${changedSummary}. Restart Pi to activate updates; automatic restart deferred to preserve input/session state.`,
307
+ );
308
+ return;
309
+ }
310
+ // Verify that the preserved launcher actually resolves to the new Pi.
311
+ setProgress("Preparing restart…");
312
+ const probe = await run(process.execPath, [entry, "--version"], {
313
+ ...options,
314
+ timeout: 15_000,
315
+ });
316
+ if (
317
+ probe.code !== 0 ||
318
+ probe.stdout.trim() !== after.pi?.revision ||
319
+ signal.aborted
320
+ ) {
321
+ warn(
322
+ `Updated ${changedSummary}. Could not verify the restart executable; restart Pi manually.`,
323
+ );
324
+ return;
325
+ }
326
+ // Recheck after the asynchronous probe so typing cannot race shutdown.
327
+ if (
328
+ inputReceived ||
329
+ ctx.ui.getEditorText() ||
330
+ !ctx.isIdle() ||
331
+ ctx.hasPendingMessages()
332
+ ) {
333
+ warn(
334
+ `Updated ${changedSummary}. Restart Pi to activate updates; input arrived during verification.`,
335
+ );
336
+ return;
337
+ }
338
+ await release();
339
+ release = undefined;
340
+ if (signal.aborted) return;
341
+ if (
342
+ inputReceived ||
343
+ ctx.ui.getEditorText() ||
344
+ !ctx.isIdle() ||
345
+ ctx.hasPendingMessages()
346
+ ) {
347
+ warn(
348
+ `Updated ${changedSummary}. Restart Pi to activate updates; input arrived before shutdown.`,
349
+ );
350
+ return;
351
+ }
352
+ restarting = true;
353
+ ctx.ui.notify(`Updated ${changedSummary}. Restarting Pi…`, "info");
354
+ // Pi's quit path stops the TUI and awaits ALL extension shutdown handlers
355
+ // before process.exit(0). execve in session_shutdown would skip later owners.
356
+ process.once("exit", (code) => {
357
+ if (code !== 0 || interrupted) return;
358
+ const nextEnv: Record<string, string> = {};
359
+ for (const [key, value] of Object.entries(process.env))
360
+ if (value !== undefined) nextEnv[key] = value;
361
+ nextEnv[RESTART_MARKER] = String(process.pid);
362
+ nextEnv[RESULT] =
363
+ `Updates active: ${changedSummary}${update.code ? ". Update was incomplete; run pi update --all for details." : ""}`;
364
+ try {
365
+ execve(
366
+ process.execPath,
367
+ [process.execPath, ...process.execArgv, entry, ...args],
368
+ nextEnv,
369
+ );
370
+ } catch (error) {
371
+ if (typeof (error as NodeJS.ErrnoException).code !== "string")
372
+ throw error;
373
+ writeSync(
374
+ 2,
375
+ "proper-base updates: Restart failed. Launch pi again to activate installed updates.\n",
376
+ );
377
+ }
378
+ });
379
+ ctx.shutdown();
380
+ } finally {
381
+ clearInterval(progressTimer);
382
+ await release?.();
383
+ ctx.ui.setWidget("proper-updater", undefined);
384
+ removeInput?.();
385
+ if (!restarting) cleanupSignals?.();
386
+ }
387
+ }
388
+ pi.on("session_start", (event, ctx) => {
389
+ settings?.dispose();
390
+ if (ctx.mode === "tui") {
391
+ settings = installSettings(agentDir, ctx, (value) => {
392
+ autoUpdateEnabled = value;
393
+ refreshObserver(ctx);
394
+ });
395
+ autoUpdateEnabled = settings.enabled();
396
+ }
397
+ refreshObserver(ctx);
398
+ // A duplicate load/reload must not replace the pending operation cleanup awaits.
399
+ if (pending) return pending;
400
+ pending = start(event, ctx);
401
+ return pending;
402
+ });
403
+ }
@@ -0,0 +1,96 @@
1
+ import { execFile } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { readFile } from "node:fs/promises";
4
+ import { basename, join } from "node:path";
5
+ import { pathToFileURL } from "node:url";
6
+ import { promisify } from "node:util";
7
+
8
+ // Run outside the TUI: Pi's inventory API can synchronously query legacy npm
9
+ // roots. Resolve the running host, not a development copy beside this package.
10
+ const [packageDir, agentDir, cwd, trusted] = process.argv.slice(2);
11
+ const manifest = JSON.parse(
12
+ await readFile(join(packageDir, "package.json"), "utf8"),
13
+ );
14
+ const rootExport = manifest.exports?.["."]?.import;
15
+ if (typeof rootExport !== "string")
16
+ throw new TypeError("Pi has no ESM root export");
17
+ const { DefaultPackageManager, SettingsManager, VERSION, CONFIG_DIR_NAME } =
18
+ await import(pathToFileURL(join(packageDir, rootExport)).href);
19
+ const settings = SettingsManager.create(cwd, agentDir, {
20
+ projectTrusted: trusted === "true",
21
+ });
22
+ const manager = new DefaultPackageManager({
23
+ cwd,
24
+ agentDir,
25
+ settingsManager: settings,
26
+ });
27
+ const errors = settings.drainErrors();
28
+ if (errors.length) throw new Error("Could not read package settings");
29
+ const inventory = { pi: { name: "Pi", revision: VERSION } };
30
+
31
+ async function optionalFile(path) {
32
+ try {
33
+ return await readFile(path, "utf8");
34
+ } catch (error) {
35
+ if (error.code === "ENOENT") return undefined;
36
+ throw error;
37
+ }
38
+ }
39
+
40
+ async function dependencies(path, key, name) {
41
+ const content = await optionalFile(path);
42
+ inventory[key] = {
43
+ name,
44
+ revision:
45
+ content === undefined
46
+ ? "missing"
47
+ : createHash("sha256").update(content).digest("hex").slice(0, 12),
48
+ };
49
+ }
50
+
51
+ for (const pkg of manager.listConfiguredPackages()) {
52
+ const npm = pkg.source.startsWith("npm:");
53
+ const git = /^(git:|https?:|ssh:|git:\/\/)/.test(pkg.source);
54
+ if (!npm && !git) continue;
55
+ const key = `${pkg.scope}:${pkg.source}`;
56
+ const npmName =
57
+ pkg.source.slice(4).match(/^(@[^/]+\/[^@]+|[^@]+)/)?.[0] ?? "npm package";
58
+ const name = `${pkg.scope === "project" ? "project " : ""}${npm ? npmName : basename(pkg.installedPath ?? "git package")}`;
59
+ let revision = "missing";
60
+ if (pkg.installedPath) {
61
+ if (npm) {
62
+ const manifest = JSON.parse(
63
+ await readFile(join(pkg.installedPath, "package.json"), "utf8"),
64
+ );
65
+ if (typeof manifest.version !== "string")
66
+ throw new TypeError("Missing package version");
67
+ revision = manifest.version;
68
+ } else {
69
+ const { stdout } = await promisify(execFile)(
70
+ "git",
71
+ ["-C", pkg.installedPath, "rev-parse", "HEAD"],
72
+ { timeout: 5000 },
73
+ );
74
+ revision = stdout.trim();
75
+ await dependencies(
76
+ join(pkg.installedPath, "node_modules", ".package-lock.json"),
77
+ `${key}:dependencies`,
78
+ `${name} dependencies`,
79
+ );
80
+ }
81
+ }
82
+ inventory[key] = { name, revision };
83
+ }
84
+ await dependencies(
85
+ join(agentDir, "npm", "node_modules", ".package-lock.json"),
86
+ "user:dependencies",
87
+ "Package dependencies",
88
+ );
89
+ if (trusted === "true") {
90
+ await dependencies(
91
+ join(cwd, CONFIG_DIR_NAME, "npm", "node_modules", ".package-lock.json"),
92
+ "project:dependencies",
93
+ "Project package dependencies",
94
+ );
95
+ }
96
+ process.stdout.write(JSON.stringify(inventory));