@papillon6814/copi 0.2.0 → 0.2.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/dist/src/wizard.d.ts +1 -0
- package/dist/src/wizard.js +15 -3
- package/package.json +1 -1
package/dist/src/wizard.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { LegacySavedItem, ResourceCandidate, SavedItem, StoredCatalog } fro
|
|
|
6
6
|
export declare function safeDisplay(value: string): string;
|
|
7
7
|
/** The editor parses literal paste versus cancel keys; stream EOF/errors/signals stay global. */
|
|
8
8
|
export declare function withEditorInput<T>(operation: () => Promise<T>): Promise<T>;
|
|
9
|
+
export declare const multiselectKeyHint = "(Tab: select, Enter: confirm)";
|
|
9
10
|
/** One process-wide interactive lifecycle shared by manage and its existing wizard routes. */
|
|
10
11
|
export declare function withWizardLifecycle(operation: (signal: AbortSignal) => Promise<void>): Promise<void>;
|
|
11
12
|
export interface SearchRoots {
|
package/dist/src/wizard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { autocompleteMultiselect as clackMultiselect, cancel as clackCancel, confirm as clackConfirm, intro as clackIntro, isCancel, log, note as clackNote, outro as clackOutro, select as clackSelect, text as clackText } from "@clack/prompts";
|
|
1
|
+
import { autocompleteMultiselect as clackMultiselect, cancel as clackCancel, confirm as clackConfirm, intro as clackIntro, isCancel, log, note as clackNote, outro as clackOutro, select as clackSelect, spinner as clackSpinner, text as clackText } from "@clack/prompts";
|
|
2
2
|
import { lstat } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { assertModernCatalog, importPreparedResource, loadCatalog, prepareResource, readPreparedResource, readSnapshotFiles, saveCatalog, saveNameChanges } from "./catalog.js";
|
|
@@ -34,8 +34,10 @@ const select = (options) => clackSelect({
|
|
|
34
34
|
...options, ...inheritedSignal(options.signal), message: safeDisplay(options.message),
|
|
35
35
|
options: options.options.map((option) => ({ ...option, label: safeDisplay(option.label ?? "Unavailable entry"), ...(option.hint === undefined ? {} : { hint: safeDisplay(option.hint) }) })),
|
|
36
36
|
});
|
|
37
|
+
// Clack's own key legend is dim and below the list; repeat it in the question so Tab-to-select is not missed.
|
|
38
|
+
export const multiselectKeyHint = "(Tab: select, Enter: confirm)";
|
|
37
39
|
const autocompleteMultiselect = (options) => clackMultiselect({
|
|
38
|
-
...options, ...inheritedSignal(options.signal), message: safeDisplay(options.message)
|
|
40
|
+
...options, ...inheritedSignal(options.signal), message: `${safeDisplay(options.message)} ${multiselectKeyHint}`,
|
|
39
41
|
options: typeof options.options === "function" ? options.options : options.options.map((option) => ({ ...option, label: safeDisplay(option.label ?? "Unavailable entry"), ...(option.hint === undefined ? {} : { hint: safeDisplay(option.hint) }) })),
|
|
40
42
|
});
|
|
41
43
|
const text = (options) => clackText({ ...options, ...inheritedSignal(options.signal), message: safeDisplay(options.message) });
|
|
@@ -330,7 +332,17 @@ export async function runSetup(libraryDir, roots) {
|
|
|
330
332
|
outro("Search not authorized; no resources were inspected or saved.");
|
|
331
333
|
return;
|
|
332
334
|
}
|
|
333
|
-
const
|
|
335
|
+
const progress = clackSpinner(inheritedSignal());
|
|
336
|
+
progress.start("Searching selected locations (searching all of HOME can take a minute or more)");
|
|
337
|
+
let discovery;
|
|
338
|
+
try {
|
|
339
|
+
discovery = await discoverResources(searchOptions);
|
|
340
|
+
}
|
|
341
|
+
catch (error) {
|
|
342
|
+
progress.error("Search failed");
|
|
343
|
+
throw error;
|
|
344
|
+
}
|
|
345
|
+
progress.stop(`Search complete: ${discovery.candidates.length} supported resource(s) found`);
|
|
334
346
|
showWarnings(discovery.warnings, "Search warnings");
|
|
335
347
|
if (discovery.excludedPaths.length > 0)
|
|
336
348
|
note(discovery.excludedPaths.join("\n"), "Excluded paths");
|