aboutsummaryrefslogtreecommitdiff
path: root/src/profile/picker.ts
diff options
context:
space:
mode:
authoramankumarsingh77 <amankumarsingh7702@gmail.com>2026-07-28 20:29:29 +0530
committerAman Kumar <145339995+amankumarsingh77@users.noreply.github.com>2026-08-02 19:12:46 +0530
commita6ec1d0915106b127affbd6b5fcc9efec48ef712 (patch)
tree120b16ede45c1c8863291d3c7f139449c5638b28 /src/profile/picker.ts
parenta2588bb315a56a8dfcd3aa8a261cdc19b160d079 (diff)
refactor(profile): strip comment noise
Removes module banners and comments restating the code. Keeps one-line notes for the ProcessSingleton user-data-dir rule, the sentinel-URL and async-spawn-error quirks, the replicated getAgentDir, pi's tilde-expansion mirroring, the Windows wmic removal, the macOS/Linux process-identification quirks, the picker's undefined-means-cancel contract, and the deliberately unpersisted browserContextId. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/profile/picker.ts')
-rw-r--r--src/profile/picker.ts25
1 files changed, 1 insertions, 24 deletions
diff --git a/src/profile/picker.ts b/src/profile/picker.ts
index b4df059..d2a057b 100644
--- a/src/profile/picker.ts
+++ b/src/profile/picker.ts
@@ -1,17 +1,4 @@
-/**
- * The profile picker, shared by /browser-profile and first-run setup so both
- * show the user exactly the same list.
- *
- * Rendering rules:
- * - one row per profile, labelled "Name (email)" — or "Name (Profile 3)" when
- * the profile has no signed-in account, so every row keeps its shape
- * - the pinned profile is marked with a check
- * - a final row clears the selection, since a pin must be undoable
- *
- * `ctx.ui.select` resolves to undefined when the user presses Escape AND in
- * non-interactive modes (pi's print/RPC UI context returns undefined for every
- * dialog), so callers must treat "no answer" as "change nothing".
- */
+// `ctx.ui.select` resolves to undefined both on Escape and in non-interactive modes, so "no answer" must mean "change nothing".
import type { ExtensionContext } from "@mariozechner/pi-coding-agent";
import type { BrowserProfile } from "./list";
@@ -24,21 +11,12 @@ export type ProfileChoice =
| { readonly kind: "clear" }
| { readonly kind: "cancelled" };
-/**
- * Two profiles can legitimately share a name and account (the same person
- * signed into two profiles). Labels must stay distinct or the selection cannot
- * be mapped back, so a repeated label gains its directory.
- */
const disambiguate = (profiles: ReadonlyArray<BrowserProfile>): ReadonlyArray<string> => {
const counts = new Map<string, number>();
for (const p of profiles) counts.set(p.label, (counts.get(p.label) ?? 0) + 1);
return profiles.map((p) => ((counts.get(p.label) ?? 0) > 1 ? `${p.label} [${p.dir}]` : p.label));
};
-/**
- * Show the picker and report what the user chose. Returns "cancelled" when
- * there is no UI or the user dismissed the dialog.
- */
export const promptForProfile = async (
ctx: ExtensionContext,
profiles: ReadonlyArray<BrowserProfile>,
@@ -64,7 +42,6 @@ export const promptForProfile = async (
return { kind: "profile", profile };
};
-/** Build the durable pin for a chosen profile. */
export const pinFor = (userDataDir: string, profile: BrowserProfile): ProfilePin => ({
userDataDir,
profileDir: profile.dir,