From a7cac1e9b075dfef888182d78d5e5adce6c61ee3 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:16:04 +0000 Subject: [PATCH 1/4] feat: sort profiles once so Home and the matrix share one order Default comes first, the Agents window profile second, and every other profile follows in a case-insensitive natural sort. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PQkVogxxACrrFCdh1xebk1 --- src/core/inventory.ts | 25 ++++++++++----- test/unit/inventory.test.ts | 61 ++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 11 deletions(-) diff --git a/src/core/inventory.ts b/src/core/inventory.ts index ea9fbe6..ec226c6 100644 --- a/src/core/inventory.ts +++ b/src/core/inventory.ts @@ -1,5 +1,5 @@ import { asError } from './errors'; -import { disabledProfileIds } from './inventoryQueries'; +import { disabledProfileIds, isAgentsWindowProfile } from './inventoryQueries'; import { pathFor, type Platform, type ResolvedPaths, type WatchTarget } from './paths'; import { type ManifestEntry, @@ -42,12 +42,14 @@ export function composeInventory(input: ComposeInput): Inventory { const profiles: Profile[] = [ { id: 'default', name: 'Default', isDefault: true, inheritsDefaultExtensions: false }, - ...input.rawProfiles.map((p) => ({ - id: p.location, - name: p.name, - isDefault: false, - inheritsDefaultExtensions: p.inheritsDefaultExtensions, - })), + ...input.rawProfiles + .map((p): Profile => ({ + id: p.location, + name: p.name, + isDefault: false, + inheritsDefaultExtensions: p.inheritsDefaultExtensions, + })) + .sort(compareNamedProfiles), ]; // Fail closed on duplicate names. VS Code's profile editor rejects duplicates @@ -217,6 +219,15 @@ export function composeInventory(input: ComposeInput): Inventory { return { profiles, extensions, warnings }; } +const profileNameCollator = new Intl.Collator(undefined, { numeric: true }); + +/** The Agents window profile first, then every other profile by name. */ +function compareNamedProfiles(a: Profile, b: Profile): number { + const agentsFirst = Number(isAgentsWindowProfile(b)) - Number(isAgentsWindowProfile(a)); + if (agentsFirst !== 0) return agentsFirst; + return profileNameCollator.compare(a.name, b.name); +} + /** * Defense in depth for package.json `icon` values, which are attacker-controlled data from an * installed extension's folder: only a plain relative path inside the extension folder is diff --git a/test/unit/inventory.test.ts b/test/unit/inventory.test.ts index c0137be..602d684 100644 --- a/test/unit/inventory.test.ts +++ b/test/unit/inventory.test.ts @@ -9,6 +9,7 @@ import { InventoryService, type InventoryIo, } from '../../src/core/inventory'; +import { withoutAgentsWindowProfile } from '../../src/core/inventoryQueries'; import type { ResolvedPaths } from '../../src/core/paths'; import type { ManifestEntry, RawProfile } from '../../src/core/parsers'; import type { Inventory, Profile } from '../../src/core/types'; @@ -39,11 +40,11 @@ const baseInput = () => ({ }); describe('composeInventory', () => { - it('lists default profile first, then registry profiles', () => { + it('lists the default profile, then the registry profiles in display order', () => { const inv = composeInventory(baseInput()); - expect(inv.profiles.map((p) => p.id)).toEqual(['default', 'aaa', 'builtin/agents']); + expect(inv.profiles.map((p) => p.id)).toEqual(['default', 'builtin/agents', 'aaa']); expect(inv.profiles[0]?.isDefault).toBe(true); - expect(inv.profiles[2]?.inheritsDefaultExtensions).toBe(true); + expect(inv.profiles[1]?.inheritsDefaultExtensions).toBe(true); }); it('disables changes to every profile sharing a name, since the code CLI targets profiles by name', () => { @@ -91,7 +92,7 @@ describe('composeInventory', () => { const inv = composeInventory(baseInput()); const everywhere = inv.extensions.find((e) => e.id === 'pub.everywhere'); expect(everywhere?.applyToAllProfiles).toBe(true); - expect(everywhere?.installedIn).toEqual(['default', 'aaa', 'builtin/agents']); + expect(everywhere?.installedIn).toEqual(['default', 'builtin/agents', 'aaa']); expect(everywhere?.displayName).toBe('Everywhere!'); }); @@ -211,6 +212,58 @@ describe('composeInventory', () => { }); }); +describe('composeInventory profile order', () => { + const orderOf = (rawProfiles: RawProfile[]): string[] => + composeInventory({ ...baseInput(), rawProfiles, profileManifests: new Map() }).profiles.map((p) => p.name); + const named = (location: string, name: string, inheritsDefaultExtensions = false): RawProfile => ({ + location, + name, + inheritsDefaultExtensions, + }); + + it('puts Default first and the Agents window profile second, whatever the registry order', () => { + expect( + orderOf([named('w', 'Work'), named('a', 'Alpha'), named('builtin/agents', 'Agents', true)]), + ).toEqual(['Default', 'Agents', 'Alpha', 'Work']); + }); + + it('sorts numbered profiles in natural order, so "Profile 2" comes before "Profile 10"', () => { + expect(orderOf([named('c', 'Profile 10'), named('a', 'Profile 2'), named('b', 'Profile 1')])).toEqual([ + 'Default', + 'Profile 1', + 'Profile 2', + 'Profile 10', + ]); + }); + + it('ignores case when sorting names', () => { + expect(orderOf([named('z', 'zeta'), named('b', 'Beta'), named('a', 'alpha')])).toEqual([ + 'Default', + 'alpha', + 'Beta', + 'zeta', + ]); + }); + + it('keeps Default first and the rest in name order when the Agents window profile is hidden', () => { + const inv = composeInventory({ + ...baseInput(), + rawProfiles: [named('w', 'Work'), named('builtin/agents', 'Agents', true), named('a', 'alpha')], + profileManifests: new Map(), + }); + expect(withoutAgentsWindowProfile(inv).profiles.map((p) => p.name)).toEqual(['Default', 'alpha', 'Work']); + }); + + it('sorts a user profile named "Agents" with the others, since only the built-in location is the Agents window', () => { + expect(orderOf([named('w', 'Work'), named('x', 'Agents'), named('a', 'Aardvark')])).toEqual([ + 'Default', + 'Aardvark', + 'Agents', + 'Work', + ]); + }); +}); + describe('InventoryService', () => { const PATHS: ResolvedPaths = { userDataDir: '/data', From 87361099eccef5997094c4ab82019481385056f0 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:19:15 +0000 Subject: [PATCH 2/4] feat: rename Home's first section to VS Code Profiles and use standard buttons Home's first section is now headed "VS Code Profiles" without the "Profiles" subheading. Profile names are plain text, and the pencil is a native button. Home's buttons take VS Code's text-button shape, capped at the 300px width VS Code gives buttons in its views, and the workspace card's manifest actions become secondary buttons. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PQkVogxxACrrFCdh1xebk1 --- GLOSSARY.md | 2 +- src/panel/homeView.ts | 73 ++++++++++++++++++++++++++----------------- src/protocol.ts | 1 - src/webview/home.ts | 35 +++++---------------- 4 files changed, 54 insertions(+), 57 deletions(-) diff --git a/GLOSSARY.md b/GLOSSARY.md index 30ae183..4b61284 100644 --- a/GLOSSARY.md +++ b/GLOSSARY.md @@ -45,7 +45,7 @@ _Avoid_: unqualified "profile", VS Code profile, persona ### Product surfaces **Home**: -The Personas sidebar, divided into one section per area, including Profiles & Extensions and PowerShell Profiles. +The Personas sidebar, divided into one section per area, including VS Code Profiles and PowerShell Profiles. _Avoid_: welcome view, dashboard **Extension Matrix**: diff --git a/src/panel/homeView.ts b/src/panel/homeView.ts index 15892db..f37c770 100644 --- a/src/panel/homeView.ts +++ b/src/panel/homeView.ts @@ -14,10 +14,10 @@ import { openReadOnly } from './readOnlyProvider'; import { createNonce, homeContentSecurityPolicy, renderContentSecurityPolicyMeta } from './webviewSecurity'; /** - * Home, the Personas sidebar: one section per area, currently only Profiles & Extensions. Owns no - * business logic of its own: counts, orphan detection and sizing all come from pure/core helpers - * (`profileExtensionCounts`, `buildOrphanInfos`) — this class only wires services to the webview - * and reacts to its messages. It reaches the Extension Matrix only through commands, never by + * Home, the Personas sidebar: several sections, one per area (VS Code Profiles and PowerShell + * Profiles). Owns no business logic of its own: counts, orphan detection and sizing all come from + * pure/core helpers (`profileExtensionCounts`, `buildOrphanInfos`) — this class only wires services + * to the webview and reacts to its messages. It reaches the Extension Matrix only through commands, never by * importing MatrixPanel. The rendering script lives in dist/home.js (built from * src/webview/home.ts) rather than inline, to keep this file's HTML skeleton small. */ @@ -173,12 +173,6 @@ export class HomeViewProvider implements vscode.WebviewViewProvider { case 'openMatrix': await vscode.commands.executeCommand('personas.showMatrix'); return; - case 'openProfileReadOnly': { - const profile = this.profiles.find((p) => p.id === m.profileId); - if (!profile?.filePath) return; - await openReadOnly(`${profile.name} — extensions.json (read-only)`, profile.filePath); - return; - } case 'editProfileFile': { const profile = this.profiles.find((p) => p.id === m.profileId); if (!profile?.filePath) return; @@ -220,16 +214,21 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} } /* High-contrast themes can color a button the same as the surface behind it and rely on * contrastBorder for its edge. Other themes leave contrastBorder unset, so the border stays - * transparent there, and the padding gives back the border's 1px to keep the button's size. */ + * transparent there. The shape follows VS Code's own text buttons (.monaco-text-button in + * src/vs/base/browser/ui/button/button.css): a 1px border outside 4px by 8px padding and a 4px + * corner radius. */ button { background: var(--vscode-button-background); color: var(--vscode-button-foreground); border: 1px solid var(--vscode-contrastBorder, transparent); - padding: calc(0.3rem - 1px) calc(0.7rem - 1px); - border-radius: 1rem; + padding: 4px 8px; + border-radius: 4px; cursor: pointer; } button:hover { background: var(--vscode-button-hoverBackground); } + /* Full width up to the 300px cap VS Code gives the buttons in its views' welcome content + * (.welcome-view-content > .button-container in src/vs/workbench/browser/parts/views/media/views.css). */ + .standard-button { display: block; box-sizing: border-box; width: 100%; max-width: 300px; } h2 { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; margin: 0.5rem 0 0.5rem; } h3 { font-size: 0.95em; margin: 1rem 0 0.25rem; } .home-section + .home-section { margin-top: 1.25rem; } @@ -238,6 +237,7 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} #profiles li:last-child { margin-bottom: 0; } a { color: var(--vscode-textLink-foreground); text-decoration: none; cursor: pointer; } a:hover, a:focus { text-decoration: underline; } + #launcher { margin-bottom: 0.75rem; } .profile-line1 { display: flex; align-items: center; gap: 0.3rem; } .profile-name { flex: 1 1 auto; @@ -246,8 +246,28 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} text-overflow: ellipsis; white-space: nowrap; } - .edit-icon { margin-left: 0.35rem; flex-shrink: 0; } - .edit-icon:focus { outline: 1px solid var(--vscode-focusBorder); } + /* An icon button in the manner of VS Code's view toolbar actions. */ + button.edit-icon { + flex: none; + display: inline-flex; + align-items: center; + justify-content: center; + width: 22px; + height: 22px; + margin-left: 0.35rem; + padding: 0; + border: none; + border-radius: 5px; + background: transparent; + color: var(--vscode-icon-foreground); + font: inherit; + } + button.edit-icon:hover { + background: var(--vscode-toolbar-hoverBackground); + outline: 1px dashed var(--vscode-contrastActiveBorder, transparent); + outline-offset: -1px; + } + button.edit-icon:focus-visible { outline: 1px solid var(--vscode-focusBorder); outline-offset: -1px; } .profile-counts { margin-top: 0.15rem; font-size: 0.85em; color: var(--vscode-descriptionForeground); } .workspace-card { width: 100%; @@ -271,23 +291,21 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} } .workspace-matrix:hover { background: var(--vscode-list-hoverBackground); } .workspace-matrix:focus { outline: 1px solid var(--vscode-focusBorder); outline-offset: -1px; } + /* The manifest actions are VS Code's secondary buttons: the same shape as Open Extension Matrix, + * set below it in emphasis, and capped together at the same 300px. */ .workspace-actions { display: flex; gap: 0.35rem; + max-width: 300px; padding: 0 0.65rem 0.55rem; } .workspace-action { - padding: 0; - border: none; - border-radius: 0; - background: transparent; - color: var(--vscode-textLink-foreground); - font-size: 0.85em; - } - .workspace-action:hover, .workspace-action:focus { - background: transparent; - text-decoration: underline; + flex: 1 1 0; + min-width: 0; + background: var(--vscode-button-secondaryBackground); + color: var(--vscode-button-secondaryForeground); } + .workspace-action:hover { background: var(--vscode-button-secondaryHoverBackground); } .workspace-title { font-weight: 600; } .workspace-name { color: var(--vscode-textLink-foreground); margin-top: 0.15rem; } .workspace-readonly, .workspace-counts, .workspace-profile { @@ -453,12 +471,11 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))}
-

Profiles & Extensions

+

VS Code Profiles

- +
-

Profiles

    diff --git a/src/protocol.ts b/src/protocol.ts index 9c4a623..d7171d6 100644 --- a/src/protocol.ts +++ b/src/protocol.ts @@ -85,7 +85,6 @@ export type HomeToHost = | { type: 'powerShellAction'; action: 'refresh' | 'help' | 'resolve' | 'open' | 'delete' | 'copy' | 'reveal'; id?: string } | { type: 'ready' } | { type: 'openMatrix' } - | { type: 'openProfileReadOnly'; profileId: string } | { type: 'editProfileFile'; profileId: string } | { type: 'openWorkspaceReadOnly' } | { type: 'editWorkspaceFile' } diff --git a/src/webview/home.ts b/src/webview/home.ts index d8c627b..6242ba2 100644 --- a/src/webview/home.ts +++ b/src/webview/home.ts @@ -71,35 +71,16 @@ function render(): void { for (const p of state.profiles) { const li = document.createElement('li'); const line1 = el('div', 'profile-line1'); - if (p.inheritsDefaultExtensions) { - const nameSpan = el('span', 'profile-name', p.label); - nameSpan.title = p.tooltip ?? p.label; - line1.append(nameSpan); - } else { - const link = el('a', 'profile-name', p.label) as HTMLAnchorElement; - link.href = '#'; - link.title = p.tooltip ?? p.label; - link.addEventListener('click', (e) => { - e.preventDefault(); - vscode.postMessage({ type: 'openProfileReadOnly', profileId: p.id }); - }); - line1.append(link); - - const edit = el('a', 'edit-icon', '✎') as HTMLAnchorElement; - edit.href = '#'; - edit.tabIndex = 0; + const nameSpan = el('span', 'profile-name', p.label); + nameSpan.title = p.tooltip ?? p.label; + line1.append(nameSpan); + // A profile that uses Default's extensions has no file of its own to edit. + if (!p.inheritsDefaultExtensions) { + const edit = el('button', 'edit-icon', '✎') as HTMLButtonElement; + edit.type = 'button'; edit.title = 'Edit raw file — caution: VS Code owns this file'; - edit.setAttribute('role', 'button'); edit.setAttribute('aria-label', `Edit raw file for ${p.name} — caution: VS Code owns this file`); - const openEdit = (e: Event) => { - e.preventDefault(); - vscode.postMessage({ type: 'editProfileFile', profileId: p.id }); - }; - edit.addEventListener('click', openEdit); - edit.addEventListener('keydown', (e) => { - const key = (e as KeyboardEvent).key; - if (key === 'Enter' || key === ' ') openEdit(e); - }); + edit.addEventListener('click', () => vscode.postMessage({ type: 'editProfileFile', profileId: p.id })); line1.append(edit); } const own = p.agentsWindow From e0dd9db848a434c2f00a28324923aad335441248 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:30:38 +0000 Subject: [PATCH 3/4] fix: stack the workspace manifest buttons in a narrow sidebar Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PQkVogxxACrrFCdh1xebk1 --- src/panel/homeView.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/panel/homeView.ts b/src/panel/homeView.ts index f37c770..c950811 100644 --- a/src/panel/homeView.ts +++ b/src/panel/homeView.ts @@ -295,13 +295,14 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} * set below it in emphasis, and capped together at the same 300px. */ .workspace-actions { display: flex; + flex-wrap: wrap; gap: 0.35rem; max-width: 300px; padding: 0 0.65rem 0.55rem; } + /* The pair stacks when the sidebar is too narrow to fit both labels on one line. */ .workspace-action { - flex: 1 1 0; - min-width: 0; + flex: 1 1 7rem; background: var(--vscode-button-secondaryBackground); color: var(--vscode-button-secondaryForeground); } From 4a5b70fbf9e2aab8a8115b3b74462b5065ecc084 Mon Sep 17 00:00:00 2001 From: Sam Erde <20478745+SamErde@users.noreply.github.com> Date: Tue, 17 Nov 2026 01:33:51 +0000 Subject: [PATCH 4/4] fix: address code review findings for #125 Comments are now complete sentences. The comparator is named for what it does and compares at base sensitivity. Buttons inherit the VS Code font, and the manifest button row counts its padding inside the 300px cap so it lines up with Open Extension Matrix. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01PQkVogxxACrrFCdh1xebk1 --- src/core/inventory.ts | 11 +++++++---- src/panel/homeView.ts | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/core/inventory.ts b/src/core/inventory.ts index ec226c6..3b83212 100644 --- a/src/core/inventory.ts +++ b/src/core/inventory.ts @@ -49,7 +49,7 @@ export function composeInventory(input: ComposeInput): Inventory { isDefault: false, inheritsDefaultExtensions: p.inheritsDefaultExtensions, })) - .sort(compareNamedProfiles), + .sort(compareProfilesForDisplay), ]; // Fail closed on duplicate names. VS Code's profile editor rejects duplicates @@ -219,10 +219,13 @@ export function composeInventory(input: ComposeInput): Inventory { return { profiles, extensions, warnings }; } -const profileNameCollator = new Intl.Collator(undefined, { numeric: true }); +const profileNameCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }); -/** The Agents window profile first, then every other profile by name. */ -function compareNamedProfiles(a: Profile, b: Profile): number { +/** + * Orders named profiles for display. The Agents window profile comes first, and the rest follow + * in a case-insensitive natural sort, so "Profile 2" comes before "Profile 10". + */ +function compareProfilesForDisplay(a: Profile, b: Profile): number { const agentsFirst = Number(isAgentsWindowProfile(b)) - Number(isAgentsWindowProfile(a)); if (agentsFirst !== 0) return agentsFirst; return profileNameCollator.compare(a.name, b.name); diff --git a/src/panel/homeView.ts b/src/panel/homeView.ts index c950811..440a00e 100644 --- a/src/panel/homeView.ts +++ b/src/panel/homeView.ts @@ -223,11 +223,13 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} border: 1px solid var(--vscode-contrastBorder, transparent); padding: 4px 8px; border-radius: 4px; + font: inherit; cursor: pointer; } button:hover { background: var(--vscode-button-hoverBackground); } - /* Full width up to the 300px cap VS Code gives the buttons in its views' welcome content - * (.welcome-view-content > .button-container in src/vs/workbench/browser/parts/views/media/views.css). */ + /* A standard button fills the width up to 300px, the cap VS Code gives the buttons in its views' + * welcome content (.welcome-view-content > .button-container in + * src/vs/workbench/browser/parts/views/media/views.css). */ .standard-button { display: block; box-sizing: border-box; width: 100%; max-width: 300px; } h2 { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.04em; margin: 0.5rem 0 0.5rem; } h3 { font-size: 0.95em; margin: 1rem 0 0.25rem; } @@ -246,7 +248,7 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} text-overflow: ellipsis; white-space: nowrap; } - /* An icon button in the manner of VS Code's view toolbar actions. */ + /* The pencil is an icon button styled like the actions in VS Code's view toolbars. */ button.edit-icon { flex: none; display: inline-flex; @@ -297,6 +299,7 @@ ${renderContentSecurityPolicyMeta(homeContentSecurityPolicy(nonce))} display: flex; flex-wrap: wrap; gap: 0.35rem; + box-sizing: border-box; max-width: 300px; padding: 0 0.65rem 0.55rem; }