dev-cockpit 0.5.0 → 0.6.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/dist/commands/mount.d.ts +20 -1
- package/dist/commands/mount.d.ts.map +1 -1
- package/dist/index.js +25 -7
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/commands/mount.d.ts
CHANGED
|
@@ -25,6 +25,25 @@ export interface MountCommandOptions {
|
|
|
25
25
|
quiet?: boolean;
|
|
26
26
|
}
|
|
27
27
|
export declare function mergeMounts(configMounts: readonly Mount[], providerMounts: readonly Mount[]): Mount[];
|
|
28
|
+
/**
|
|
29
|
+
* Seed the candidate list from the currently-applied manifest.
|
|
30
|
+
*
|
|
31
|
+
* Two jobs:
|
|
32
|
+
* 1. Manifest entries with no discovered/config counterpart (ad-hoc custom
|
|
33
|
+
* mounts added via the picker's add-custom loop) are appended as
|
|
34
|
+
* candidates — otherwise they'd be invisible on the next `mount` run and
|
|
35
|
+
* silently dropped by any re-apply, with no way to toggle just one off.
|
|
36
|
+
* 2. Returns the applied-key set so the picker can pre-check exactly the
|
|
37
|
+
* mounts that are currently applied (instead of pre-checking everything,
|
|
38
|
+
* where an absent-minded ⏎ would apply mounts the user never had).
|
|
39
|
+
*
|
|
40
|
+
* `appliedKeys` is null when no manifest exists — first-run pickers keep the
|
|
41
|
+
* legacy default (everything matched pre-checked).
|
|
42
|
+
*/
|
|
43
|
+
export declare function seedCandidatesFromManifest(merged: readonly Mount[], manifestMounts: readonly Mount[] | null): {
|
|
44
|
+
candidates: Mount[];
|
|
45
|
+
appliedKeys: ReadonlySet<string> | null;
|
|
46
|
+
};
|
|
28
47
|
/**
|
|
29
48
|
* Interactive picker. Lazy-imports @inquirer/prompts to keep the `dev`
|
|
30
49
|
* command's startup time clean. Three phases:
|
|
@@ -39,7 +58,7 @@ export declare function mergeMounts(configMounts: readonly Mount[], providerMoun
|
|
|
39
58
|
* Returns the final mount set in source-of-truth order. The caller writes
|
|
40
59
|
* the overlay / manifest from this list.
|
|
41
60
|
*/
|
|
42
|
-
export declare function pickMounts(candidates: readonly Mount[]): Promise<Mount[]>;
|
|
61
|
+
export declare function pickMounts(candidates: readonly Mount[], appliedKeys?: ReadonlySet<string> | null): Promise<Mount[]>;
|
|
43
62
|
export declare function mountCommand(opts?: MountCommandOptions): Promise<void>;
|
|
44
63
|
export declare function mountStatusCommand(opts?: MountCommandOptions): Promise<void>;
|
|
45
64
|
export declare function mountClearCommand(opts?: MountCommandOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/commands/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAWD,wBAAgB,WAAW,CACzB,YAAY,EAAE,SAAS,KAAK,EAAE,EAC9B,cAAc,EAAE,SAAS,KAAK,EAAE,GAC/B,KAAK,EAAE,CAKT;AAsHD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../src/commands/mount.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAoBvD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qDAAqD;IACrD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAWD,wBAAgB,WAAW,CACzB,YAAY,EAAE,SAAS,KAAK,EAAE,EAC9B,cAAc,EAAE,SAAS,KAAK,EAAE,GAC/B,KAAK,EAAE,CAKT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,KAAK,EAAE,EACxB,cAAc,EAAE,SAAS,KAAK,EAAE,GAAG,IAAI,GACtC;IAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;CAAE,CAUlE;AAsHD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,SAAS,KAAK,EAAE,EAC5B,WAAW,GAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAW,GAC7C,OAAO,CAAC,KAAK,EAAE,CAAC,CA6KlB;AAED,wBAAsB,YAAY,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwGhF;AAED,wBAAsB,kBAAkB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoEtF;AAED,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCrF"}
|
package/dist/index.js
CHANGED
|
@@ -93157,6 +93157,17 @@ function mergeMounts(configMounts, providerMounts) {
|
|
|
93157
93157
|
for (const m of configMounts) seen.set(mountKey(m), m);
|
|
93158
93158
|
return Array.from(seen.values());
|
|
93159
93159
|
}
|
|
93160
|
+
function seedCandidatesFromManifest(merged, manifestMounts) {
|
|
93161
|
+
if (manifestMounts === null) {
|
|
93162
|
+
return { candidates: [...merged], appliedKeys: null };
|
|
93163
|
+
}
|
|
93164
|
+
const mergedKeys = new Set(merged.map(mountKey));
|
|
93165
|
+
const extras = manifestMounts.filter((m) => !mergedKeys.has(mountKey(m)));
|
|
93166
|
+
return {
|
|
93167
|
+
candidates: [...merged, ...extras],
|
|
93168
|
+
appliedKeys: new Set(manifestMounts.map(mountKey))
|
|
93169
|
+
};
|
|
93170
|
+
}
|
|
93160
93171
|
async function resolveContext(opts) {
|
|
93161
93172
|
const profile = opts.profile;
|
|
93162
93173
|
let configPath;
|
|
@@ -93243,18 +93254,19 @@ async function pickSourceForMount(m, prompts) {
|
|
|
93243
93254
|
validate: (v) => v.trim().length > 0 && path24.isAbsolute(v.trim()) ? true : "must be an absolute path"
|
|
93244
93255
|
})).trim();
|
|
93245
93256
|
}
|
|
93246
|
-
async function pickMounts(candidates) {
|
|
93257
|
+
async function pickMounts(candidates, appliedKeys = null) {
|
|
93247
93258
|
const { checkbox, confirm, input, select } = await import("@inquirer/prompts");
|
|
93248
93259
|
const prompts = { select, input };
|
|
93249
93260
|
let selected = [];
|
|
93250
93261
|
if (candidates.length > 0) {
|
|
93251
93262
|
const choices = candidates.map((m) => {
|
|
93252
93263
|
const unmatched = isUnmatched(m);
|
|
93253
|
-
const
|
|
93264
|
+
const applied = appliedKeys?.has(mountKey(m)) ?? false;
|
|
93265
|
+
const suffix = unmatched ? " (no source found \u2014 pick one)" : ` ${m.hostPath}${applied ? " [applied]" : ""}`;
|
|
93254
93266
|
return {
|
|
93255
93267
|
name: `${mountLabel(m)}${suffix}`,
|
|
93256
93268
|
value: m,
|
|
93257
|
-
checked: !unmatched
|
|
93269
|
+
checked: !unmatched && (appliedKeys ? applied : true)
|
|
93258
93270
|
};
|
|
93259
93271
|
});
|
|
93260
93272
|
selected = await checkbox({ message: "Select mounts to apply:", choices });
|
|
@@ -93377,26 +93389,32 @@ async function mountCommand(opts = {}) {
|
|
|
93377
93389
|
profile
|
|
93378
93390
|
} = ctx;
|
|
93379
93391
|
const merged = mergeMounts(configMounts, providerMounts);
|
|
93392
|
+
let manifestMounts = null;
|
|
93393
|
+
try {
|
|
93394
|
+
manifestMounts = readMountManifest(manifestPath2)?.mounts ?? null;
|
|
93395
|
+
} catch {
|
|
93396
|
+
}
|
|
93397
|
+
const { candidates, appliedKeys } = seedCandidatesFromManifest(merged, manifestMounts);
|
|
93380
93398
|
let selected;
|
|
93381
93399
|
if (opts.quiet || configMounts.length > 0 && providerMounts.length === 0) {
|
|
93382
|
-
if (
|
|
93400
|
+
if (candidates.length === 0) {
|
|
93383
93401
|
process.stdout.write(
|
|
93384
93402
|
"dev-cockpit mount: no mount candidates from config.mounts[] or profile.mountCandidatesProvider.\n"
|
|
93385
93403
|
);
|
|
93386
93404
|
return;
|
|
93387
93405
|
}
|
|
93388
|
-
selected =
|
|
93406
|
+
selected = candidates;
|
|
93389
93407
|
if (opts.quiet) {
|
|
93390
93408
|
process.stdout.write(`dev-cockpit mount: applying all ${selected.length} candidate(s).
|
|
93391
93409
|
`);
|
|
93392
93410
|
}
|
|
93393
93411
|
} else {
|
|
93394
|
-
if (
|
|
93412
|
+
if (candidates.length === 0) {
|
|
93395
93413
|
process.stdout.write(
|
|
93396
93414
|
"dev-cockpit mount: no mount candidates discovered. You can add custom mounts interactively below, or Ctrl-C to bail.\n"
|
|
93397
93415
|
);
|
|
93398
93416
|
}
|
|
93399
|
-
selected = await pickMounts(
|
|
93417
|
+
selected = await pickMounts(candidates, appliedKeys);
|
|
93400
93418
|
if (selected.length === 0) {
|
|
93401
93419
|
process.stdout.write("dev-cockpit mount: nothing selected; nothing to apply.\n");
|
|
93402
93420
|
return;
|