@aiwayds/dsh-opentui 0.9.2 → 0.9.4

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,518 @@
1
+ // Pure planning logic for provision-opentui-profile.mjs.
2
+ //
3
+ // Nothing in this module touches the filesystem or spawns a process: the
4
+ // script feeds it a profile manifest it read, and the unit tests feed it
5
+ // fixtures. That split is what makes the idempotency rules (dep present,
6
+ // node_modules version satisfies, bundle entry present) testable without a
7
+ // network or a real dsh profile.
8
+
9
+ export const PROFILE = 'opentui'
10
+ export const PREFIX = 'provision-opentui-profile: '
11
+ export const STEPS = 5
12
+ export const DEFAULT_TIER = 'recommended'
13
+ export const TIERS = ['core', 'recommended', 'none']
14
+
15
+ // The plugin set this launcher ships with. `reason` is printed by
16
+ // `--dry-run --plugins=<tier>` style troubleshooting and documents WHY a
17
+ // package is in the set, so a future reader can re-judge the decision.
18
+ //
19
+ // Ordering contract: `@aiwayds/dsh-ask-router` MUST stay first among the
20
+ // UI/ask bundles — it owns the ask surface every later UI bundle attaches to.
21
+ // `selectPlugins()` preserves this array's order, and the installer appends
22
+ // bundle entries in that order.
23
+ export const PLUGIN_SET = [
24
+ {
25
+ name: '@aiwayds/dsh-ask-router',
26
+ version: '0.7.0',
27
+ tier: 'core',
28
+ reason: 'owns the ask surface; must load before any other UI/ask bundle',
29
+ },
30
+ {
31
+ name: '@aiwayds/dsh-subagent-registry',
32
+ version: '0.19.1',
33
+ tier: 'core',
34
+ reason: 'subagent discovery and registration for the shell',
35
+ },
36
+ {
37
+ name: '@aiwayds/dsh-llm-net-retry',
38
+ version: '0.8.0',
39
+ tier: 'core',
40
+ reason: 'retries transient provider/network failures',
41
+ },
42
+ {
43
+ name: '@aiwayds/dsh-web-search-anysearch',
44
+ version: '0.9.0',
45
+ tier: 'core',
46
+ reason: 'web search without a per-provider key',
47
+ },
48
+ {
49
+ name: '@aiwayds/dsh-mcp-adapter',
50
+ version: '0.8.0',
51
+ tier: 'core',
52
+ reason: 'MCP catalog/dispatch meta-tools paired with the default context7 server row',
53
+ },
54
+ {
55
+ name: '@aiwayds/dsh-approval-policy',
56
+ version: '0.3.0',
57
+ tier: 'core',
58
+ reason: 'tool-approval policy shared with the shell approval cards',
59
+ },
60
+ {
61
+ name: '@aiwayds/dsh-model-sync',
62
+ version: '0.9.0',
63
+ tier: 'core',
64
+ reason: 'keeps the profile model list in sync with the provider catalog',
65
+ },
66
+ {
67
+ name: '@aiwayds/dsh-llm-stats',
68
+ version: '0.9.0',
69
+ tier: 'recommended',
70
+ reason: 'token/cost accounting behind /usage',
71
+ },
72
+ {
73
+ name: '@aiwayds/dsh-topics-memory',
74
+ version: '0.26.0',
75
+ tier: 'recommended',
76
+ reason: 'cross-session topic memory',
77
+ },
78
+ {
79
+ name: '@aiwayds/dsh-cron',
80
+ version: '0.7.0',
81
+ tier: 'recommended',
82
+ reason: 'scheduled prompts',
83
+ },
84
+ {
85
+ name: '@aiwayds/dsh-workflow',
86
+ version: '0.2.1',
87
+ tier: 'recommended',
88
+ reason: 'dynamic workflow runs',
89
+ },
90
+ {
91
+ name: '@aiwayds/dsh-vault',
92
+ version: '0.8.0',
93
+ tier: 'recommended',
94
+ reason: 'secret storage used by the companion plugins',
95
+ },
96
+ ]
97
+
98
+ // Deliberately NOT installed. Kept explicit so a reviewer can see the
99
+ // decision instead of inferring it from an absence.
100
+ export const EXCLUDED_PLUGINS = [
101
+ { name: '@aiwayds/dsh-tui-pi', reason: 'takes over stdout/stdin — hard conflict with the opentui client' },
102
+ { name: '@aiwayds/dsh-dcp', reason: 'web-app-preset isolated; an idle no-op in this profile' },
103
+ { name: '@aiwayds/dsh-feishu', reason: 'claims the ask surface and does not fall back' },
104
+ { name: '@aiwayds/dsh-agent-dispatch', reason: 'not part of the shell workflow' },
105
+ { name: '@aiwayds/dsh-self-improve', reason: 'not part of the shell workflow' },
106
+ { name: '@aiwayds/dsh-llm-proxy', reason: 'not part of the shell workflow' },
107
+ { name: '@aiwayds/dsh-web-search-tavily', reason: 'requires an API key' },
108
+ { name: '@aiwayds/dsh-profile-switch', reason: 'profile switching is the launcher\'s job' },
109
+ ]
110
+
111
+ // Entries a historic opentui profile may still carry. `@aiwayds/dsh-opentui`
112
+ // is the retired plugin-mode package: the global 0.9.2 declares no
113
+ // `dsh.bundle`, so every boot prints a "skipping profile bundle" warning, and
114
+ // the profile's dependency pointed at a tgz that no longer exists.
115
+ export const RETIRED_PROFILE_ENTRIES = ['@aiwayds/dsh-opentui']
116
+
117
+ /** Parse the `--plugins=` value (or the DSH_OPENTUI_PLUGINS env override).
118
+ * Throws on an unknown tier so a typo cannot silently install nothing. */
119
+ export function parseTier(value) {
120
+ if (value === undefined || value === null || value === '') return DEFAULT_TIER
121
+ const tier = String(value).trim().toLowerCase()
122
+ if (!TIERS.includes(tier)) {
123
+ throw new Error(`unknown plugin tier ${JSON.stringify(value)} — expected one of: ${TIERS.join(', ')}`)
124
+ }
125
+ return tier
126
+ }
127
+
128
+ /** True when the run must only print the commands it would execute. */
129
+ export function isDryRun(argv = [], env = {}) {
130
+ return argv.includes('--dry-run') || env.DSH_PROVISION_DRY_RUN === '1'
131
+ }
132
+
133
+ /** The plugins a tier installs, in install order. `recommended` is a superset
134
+ * of `core`; `none` installs nothing. */
135
+ export function selectPlugins(tier) {
136
+ if (tier === 'none') return []
137
+ const wanted = tier === 'core' ? ['core'] : ['core', 'recommended']
138
+ return PLUGIN_SET.filter((plugin) => wanted.includes(plugin.tier))
139
+ }
140
+
141
+ /** package@version specs for `dsh plugin ... add`. */
142
+ export function installSpecs(plugins) {
143
+ return plugins.map((plugin) => `${plugin.name}@${plugin.version}`)
144
+ }
145
+
146
+ /** argv tail for the single batched install. */
147
+ export function pluginAddArgs(profile, specs) {
148
+ return ['plugin', '--profile', profile, 'add', ...specs]
149
+ }
150
+
151
+ /** Human-readable form of `pluginAddArgs` (used by the progress line). */
152
+ export function pluginAddCommand(profile, specs) {
153
+ return ['dsh', ...pluginAddArgs(profile, specs)].join(' ')
154
+ }
155
+
156
+ /** Format one progress line: `[n/m] label` with the value column aligned.
157
+ * Mirrors dsh-tui-pi's onboarding output, with the script name as prefix. */
158
+ export function formatStep(step, label, value = '') {
159
+ return `${PREFIX}[${step}/${STEPS}] ${String(label).padEnd(15)}${value}`
160
+ }
161
+
162
+ // ---------------------------------------------------------------------------
163
+ // Versions — a deliberately small semver subset: exact, ^, ~, >=.
164
+ // ---------------------------------------------------------------------------
165
+ export function parseVersion(version) {
166
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(String(version).trim())
167
+ if (!match) return null
168
+ return {
169
+ major: Number(match[1]),
170
+ minor: Number(match[2]),
171
+ patch: Number(match[3]),
172
+ pre: match[4] ? match[4].split('.') : [],
173
+ }
174
+ }
175
+
176
+ /** -1 / 0 / 1; unparsable versions compare equal (callers treat that as
177
+ * "unknown, do not downgrade"). */
178
+ export function compareVersions(a, b) {
179
+ const pa = parseVersion(a)
180
+ const pb = parseVersion(b)
181
+ if (!pa || !pb) return 0
182
+ for (const key of ['major', 'minor', 'patch']) {
183
+ if (pa[key] !== pb[key]) return pa[key] < pb[key] ? -1 : 1
184
+ }
185
+ if (pa.pre.length === 0 && pb.pre.length === 0) return 0
186
+ if (pa.pre.length === 0) return 1
187
+ if (pb.pre.length === 0) return -1
188
+ for (let i = 0; i < Math.max(pa.pre.length, pb.pre.length); i += 1) {
189
+ const x = pa.pre[i]
190
+ const y = pb.pre[i]
191
+ if (x === undefined) return -1
192
+ if (y === undefined) return 1
193
+ const xn = Number.parseInt(x, 10)
194
+ const yn = Number.parseInt(y, 10)
195
+ if (!Number.isNaN(xn) && !Number.isNaN(yn) && xn !== yn) return xn < yn ? -1 : 1
196
+ if (x !== y) return x < y ? -1 : 1
197
+ }
198
+ return 0
199
+ }
200
+
201
+ /** Does `installed` satisfy the `wanted` requirement? An empty/unknown
202
+ * `installed` never satisfies. */
203
+ export function satisfiesVersion(installed, wanted) {
204
+ const got = parseVersion(installed)
205
+ if (!got) return false
206
+ const wantedText = String(wanted ?? '').trim()
207
+ if (wantedText === '' || wantedText === '*' || wantedText === 'latest') return true
208
+ const cmp = compareVersions(installed, wantedText.replace(/^[\^~]|^>=/, ''))
209
+ if (/^\^/.test(wantedText)) {
210
+ const want = parseVersion(wantedText.slice(1))
211
+ if (!want) return false
212
+ if (want.major > 0) return got.major === want.major && cmp >= 0
213
+ if (want.minor > 0) return got.major === 0 && got.minor === want.minor && cmp >= 0
214
+ return got.major === 0 && got.minor === 0 && got.patch === want.patch
215
+ }
216
+ if (/^~/.test(wantedText)) {
217
+ const want = parseVersion(wantedText.slice(1))
218
+ if (!want) return false
219
+ return got.major === want.major && got.minor === want.minor && cmp >= 0
220
+ }
221
+ if (/^>=/.test(wantedText)) return cmp >= 0
222
+ return cmp === 0
223
+ }
224
+
225
+ /** Dep specs that point somewhere other than the registry (`link:`, `file:`,
226
+ * `workspace:`, `portal:`). A profile that pins a plugin this way is a local
227
+ * development setup — the installer must not replace it with a registry
228
+ * version, so such a dep always counts as satisfied. */
229
+ export function isLocalSpec(spec) {
230
+ return typeof spec === 'string' && /^(?:link|file|workspace|portal):/.test(spec)
231
+ }
232
+
233
+ // ---------------------------------------------------------------------------
234
+ // Plan
235
+ // ---------------------------------------------------------------------------
236
+
237
+ /**
238
+ * Decide what a run must do for one tier. Pure: every filesystem fact arrives
239
+ * in the inputs.
240
+ *
241
+ * Idempotency rule (all three must hold for a plugin to count as satisfied):
242
+ * 1. the package is a `dependencies` entry in the profile manifest
243
+ * 2. `node_modules/<pkg>/package.json` exists (its version is passed in)
244
+ * 3. that version satisfies the pinned version
245
+ * A dep pinned with a local spec (link/file/workspace) skips 2/3: the local
246
+ * pin wins and is never replaced.
247
+ *
248
+ * @param {{tier: string, dependencies?: Record<string,string>, bundles?: string[], installedVersions?: Record<string,string>}} input
249
+ * @returns {{
250
+ * total: number,
251
+ * satisfied: number,
252
+ * install: Array<{name: string, spec: string, reason: string}>,
253
+ * missingBundles: string[],
254
+ * managedOrder: string[],
255
+ * }}
256
+ */
257
+ export function planPluginInstall({ tier, dependencies = {}, bundles = [], installedVersions = {} }) {
258
+ const plugins = selectPlugins(tier)
259
+ const install = []
260
+ const missingBundles = []
261
+ const managedOrder = plugins.map((plugin) => plugin.name)
262
+
263
+ for (const plugin of plugins) {
264
+ const depSpec = dependencies[plugin.name]
265
+ const installed = installedVersions[plugin.name]
266
+ const depOk = depSpec !== undefined && (isLocalSpec(depSpec) || satisfiesVersion(installed, plugin.version))
267
+ if (!depOk) {
268
+ install.push({ name: plugin.name, spec: `${plugin.name}@${plugin.version}`, reason: plugin.reason })
269
+ continue
270
+ }
271
+ if (!bundles.includes(plugin.name)) missingBundles.push(plugin.name)
272
+ }
273
+
274
+ return {
275
+ total: plugins.length,
276
+ // "satisfied" counts plugins that need no work at all (dep + bundle).
277
+ satisfied: plugins.length - install.length - missingBundles.length,
278
+ install,
279
+ missingBundles,
280
+ managedOrder,
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Merge bundle selection: drop retired entries, append missing managed
286
+ * entries, and keep the managed subset in `managedOrder` (the ask-router-first
287
+ * contract) without disturbing unmanaged entries.
288
+ *
289
+ * @param {string[]} bundles
290
+ * @param {{managedOrder?: string[], retire?: string[]}} input
291
+ * @returns {{bundles: string[], appended: string[], removed: string[], reordered: boolean}}
292
+ */
293
+ export function mergeBundles(bundles, { managedOrder = [], retire = [] } = {}) {
294
+ const removed = bundles.filter((name) => retire.includes(name))
295
+ let next = bundles.filter((name) => !retire.includes(name))
296
+
297
+ const appended = []
298
+ for (const name of managedOrder) {
299
+ if (!next.includes(name)) {
300
+ next.push(name)
301
+ appended.push(name)
302
+ }
303
+ }
304
+
305
+ // Reorder ONLY the managed slots: take the positions managed names currently
306
+ // occupy and refill them in managedOrder. Unmanaged entries keep their
307
+ // index, so dsh-base / dsh-web-app keep loading first.
308
+ const managedSet = new Set(managedOrder)
309
+ const slots = []
310
+ next.forEach((name, index) => {
311
+ if (managedSet.has(name)) slots.push(index)
312
+ })
313
+ const present = managedOrder.filter((name) => next.includes(name))
314
+ const reordered = slots.some((slot, i) => next[slot] !== present[i])
315
+ if (reordered) {
316
+ const copy = [...next]
317
+ slots.forEach((slot, i) => {
318
+ copy[slot] = present[i]
319
+ })
320
+ next = copy
321
+ }
322
+
323
+ return { bundles: next, appended, removed, reordered }
324
+ }
325
+
326
+ /** Remove retired packages from the dependency map. */
327
+ export function cleanupDependencies(dependencies, retire = RETIRED_PROFILE_ENTRIES) {
328
+ const next = { ...dependencies }
329
+ const removed = []
330
+ for (const name of retire) {
331
+ if (name in next) {
332
+ delete next[name]
333
+ removed.push(name)
334
+ }
335
+ }
336
+ return { dependencies: next, removed }
337
+ }
338
+
339
+ // ---------------------------------------------------------------------------
340
+ // Profile patch rows for the model-facing web tools
341
+ //
342
+ // The @deepseek-ai/dsh-web-app bundle disables the ambient `tool-web` row
343
+ // (`disabled: true`) and recomposes it per agent preset. The opentui profile's
344
+ // default preset resolves to `native` (an empty preset), so nothing turns the
345
+ // row back on and the model sees no `web_search`/`web_fetch`. These two rows
346
+ // are appended to the profile patch (the last layer, so they win per id):
347
+ //
348
+ // - tool-web re-enables the ambient row with the shipped tool defaults
349
+ // - web pins the vendor-neutral search provider (anysearch needs no
350
+ // key); the identical row ships in the anysearch bundle patch,
351
+ // repeated here so the profile patch stays self-describing and
352
+ // keeps the choice when `--plugins=none` skips that bundle
353
+ //
354
+ // Idempotency follows the model-route rule but checks the row's *state*, not
355
+ // just its id: a row that is already enabled / pinned is left untouched (a
356
+ // re-run never duplicates it and never rewrites a config the user edited).
357
+ // ---------------------------------------------------------------------------
358
+ export const TOOL_WEB_PATCH = `- id: tool-web
359
+ name: '@deepseek-ai/dsh-tool-web'
360
+ disabled: false
361
+ config:
362
+ fetch: true
363
+ searchTimeoutMs: 60000
364
+ `
365
+ export const WEB_SEARCH_PATCH = `- id: web
366
+ config:
367
+ searchProvider: anysearch
368
+ `
369
+
370
+ const escapeRegExp = (value) => String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
371
+
372
+ /** The raw text of the first TOP-LEVEL `- id: <id>` entry, or null. Nested
373
+ * ids (`- insert:` rows are indented) never match: the pattern anchors the
374
+ * dash at column 0, the same rule the script's model-route check uses. The
375
+ * block runs to the next column-0 `- ` line. */
376
+ export function patchEntryBlock(text, id) {
377
+ const lines = String(text ?? '').split('\n')
378
+ const idPattern = new RegExp(`^- id: ${escapeRegExp(id)}\\s*$`)
379
+ const start = lines.findIndex((line) => idPattern.test(line))
380
+ if (start < 0) return null
381
+ let end = lines.length
382
+ for (let i = start + 1; i < lines.length; i += 1) {
383
+ if (/^- /.test(lines[i])) {
384
+ end = i
385
+ break
386
+ }
387
+ }
388
+ return lines.slice(start, end).join('\n')
389
+ }
390
+
391
+ /** The value of a key at the entry's own indentation (two spaces), ignoring
392
+ * comments and blank lines. Nested keys are indented deeper and do not match. */
393
+ function entryValue(block, key) {
394
+ const pattern = new RegExp(`^ ${escapeRegExp(key)}:[ \\t]*(.*?)[ \\t]*$`, 'm')
395
+ const match = pattern.exec(block)
396
+ return match ? match[1] : undefined
397
+ }
398
+
399
+ /** True when the row itself states `disabled: false`. An omitted `disabled`
400
+ * inherits the earlier layer's value (the web-app row is `disabled: true`),
401
+ * so only an explicit false counts as enabled. */
402
+ export function isEntryEnabled(block) {
403
+ const value = entryValue(block, 'disabled')
404
+ return value !== undefined && /^(?:false|False|FALSE)$/.test(value)
405
+ }
406
+
407
+ /** True when the row's `config:` block pins `searchProvider: <provider>`. A
408
+ * config block is one map replaced wholesale by an id-targeted patch row, so
409
+ * only the configured provider id counts; an unset provider auto-selects. */
410
+ export function pinsSearchProvider(block, provider) {
411
+ const lines = block.split('\n')
412
+ const configStart = lines.findIndex((line) => /^ config:[ \t]*$/.test(line))
413
+ if (configStart < 0) return false
414
+ for (let i = configStart + 1; i < lines.length; i += 1) {
415
+ const line = lines[i]
416
+ if (line.trim() === '' || line.trim().startsWith('#')) continue
417
+ if ((/^\s*/.exec(line)?.[0].length ?? 0) <= 2) break
418
+ const match = /^ {3,}searchProvider:[ \t]*(.*?)[ \t]*$/.exec(line)
419
+ if (match) return match[1].replace(/^['"]|['"]$/g, '') === provider
420
+ }
421
+ return false
422
+ }
423
+
424
+ /**
425
+ * Plan the web-tool rows a profile patch still needs. Pure: the caller passes
426
+ * the patch text it read.
427
+ *
428
+ * @param {string} existingText
429
+ * @returns {{
430
+ * append: string[],
431
+ * toolWeb: 'missing'|'disabled'|'enabled',
432
+ * web: 'missing'|'unpinned'|'pinned',
433
+ * changed: boolean,
434
+ * }}
435
+ */
436
+ export function planToolPatch(existingText = '') {
437
+ const toolWebBlock = patchEntryBlock(existingText, 'tool-web')
438
+ const webBlock = patchEntryBlock(existingText, 'web')
439
+ const toolWebEnabled = toolWebBlock !== null && isEntryEnabled(toolWebBlock)
440
+ const webPinned = webBlock !== null && pinsSearchProvider(webBlock, 'anysearch')
441
+
442
+ return {
443
+ append: [...(toolWebEnabled ? [] : [TOOL_WEB_PATCH]), ...(webPinned ? [] : [WEB_SEARCH_PATCH])],
444
+ toolWeb: toolWebBlock === null ? 'missing' : toolWebEnabled ? 'enabled' : 'disabled',
445
+ web: webBlock === null ? 'missing' : webPinned ? 'pinned' : 'unpinned',
446
+ changed: !toolWebEnabled || !webPinned,
447
+ }
448
+ }
449
+
450
+ // ---------------------------------------------------------------------------
451
+ // Profile patch rows for MCP (adapter + one default server)
452
+ //
453
+ // @aiwayds/dsh-mcp-adapter is a prompt-side shim over the official
454
+ // @deepseek-ai/dsh-mcp-client: the client owns the connection and registers
455
+ // `mcp__<server>__<tool>` on ctx.tools, the adapter exposes the constant
456
+ // `mcp_list` / `mcp_call` meta-tools on top of those registrations. Without at
457
+ // least one client row the adapter's catalog is empty, so the pair ships
458
+ // together: the plugin set installs the adapter, and this row starts one
459
+ // server.
460
+ //
461
+ // The row is INSIDE an `- insert:` list (the same form the tui profile uses),
462
+ // so the id check must match nested entries — the top-level `patchEntryBlock`
463
+ // deliberately does not. Detection is by id alone: an existing
464
+ // `mcp-context7` row is the user's (possibly edited) row and is never
465
+ // rewritten or duplicated. `--plugins=none` writes no row at all: without the
466
+ // adapter the client's tools would surface unfolded, which is not the
467
+ // promised setup.
468
+ //
469
+ // context7 is the default server because it needs no API key, starts fast
470
+ // over streamable HTTP, and is read-only documentation lookup. A failed or
471
+ // offline connection is non-fatal by contract: mcp-client's
472
+ // `failOnStartupError` defaults to false and the host boots without its tools.
473
+ // ---------------------------------------------------------------------------
474
+ export const MCP_CONTEXT7_PATCH = `- insert:
475
+ - id: mcp-context7
476
+ name: '@deepseek-ai/dsh-mcp-client'
477
+ config:
478
+ serverName: context7
479
+ transport: streamable-http
480
+ url: https://mcp.context7.com/mcp
481
+ `
482
+
483
+ /** True when `<id>` appears as a patch row at ANY indentation (top-level id
484
+ * entries and rows nested under `- insert:`). */
485
+ export function hasAnyEntry(text, id) {
486
+ return new RegExp(`^[ \\t]*- id: ${escapeRegExp(id)}[ \\t]*$`, 'm').test(String(text ?? ''))
487
+ }
488
+
489
+ /**
490
+ * Plan the MCP client row a profile patch still needs. Pure.
491
+ *
492
+ * @param {string} existingText
493
+ * @param {{enabled?: boolean}} options `enabled: false` is `--plugins=none`.
494
+ * @returns {{append: string[], mcp: 'configured'|'missing'|'skipped', changed: boolean}}
495
+ */
496
+ export function planMcpPatch(existingText = '', { enabled = true } = {}) {
497
+ const present = hasAnyEntry(existingText, 'mcp-context7')
498
+ if (!enabled) return { append: [], mcp: 'skipped', changed: false }
499
+ return {
500
+ append: present ? [] : [MCP_CONTEXT7_PATCH],
501
+ mcp: present ? 'configured' : 'missing',
502
+ changed: !present,
503
+ }
504
+ }
505
+
506
+ // ---------------------------------------------------------------------------
507
+ // Verify (dsh opentui --dump-config)
508
+ // ---------------------------------------------------------------------------
509
+ export function parseDumpConfig(stdout = '', stderr = '') {
510
+ const layers = String(stdout)
511
+ .split('\n')
512
+ .filter((line) => /^# == /.test(line)).length
513
+ const skipped = String(stderr)
514
+ .split('\n')
515
+ .map((line) => line.trim())
516
+ .filter((line) => line.includes('skipping profile bundle'))
517
+ return { layers, skipped }
518
+ }