diff --git a/src/webview/main.ts b/src/webview/main.ts
index a02be90..00408f2 100644
--- a/src/webview/main.ts
+++ b/src/webview/main.ts
@@ -24,6 +24,19 @@ import {
UserPersonalStats,
} from '../git/types';
import { t, Language } from '../i18n/locales';
+import {
+ CfButton,
+ CfBadge,
+ CfDrawer,
+ CfTabs,
+ CfToast,
+ CfSkeleton,
+ clampPopoverToViewport,
+ escapeHtml,
+} from './primitives';
+
+// Expose native UI primitives for modular feature modules
+export { CfButton, CfBadge, CfDrawer, CfTabs, CfToast, CfSkeleton, escapeHtml };
declare function acquireVsCodeApi(): {
postMessage(msg: any): void;
@@ -741,12 +754,13 @@ function applyFilters(): void {
}
function renderLoading(): void {
- tableContainer.innerHTML = `
-
-
-
${tr('graph.loading')}
-
- `;
+ tableContainer.innerHTML = '';
+ const skeleton = CfSkeleton({ rows: 10, variant: 'graph' });
+ const label = document.createElement('div');
+ label.style.cssText = 'text-align:center; font-size:var(--font-size-xs); color:var(--text-muted); padding:6px;';
+ label.textContent = tr('graph.loading');
+ tableContainer.appendChild(label);
+ tableContainer.appendChild(skeleton);
}
function renderError(err: string): void {
@@ -1418,20 +1432,20 @@ function showHoverPopover(e: MouseEvent, node: GraphNode): void {
hoverPopover.innerHTML = `
-

+
-
${commit.author.name}
-
${commit.author.relativeTime} • \`${commit.shortHash}\`
+
${escapeHtml(commit.author.name)}
+
${escapeHtml(commit.author.relativeTime)} • ${escapeHtml(commit.shortHash)}
- ${commit.subject}
+ ${escapeHtml(commit.subject)}
${
commit.refs.length > 0
? `
${commit.refs
.map(
(r) =>
- ` ${r.name}`
+ ` ${escapeHtml(r.name)}`
)
.join('')}
`
@@ -1439,26 +1453,9 @@ function showHoverPopover(e: MouseEvent, node: GraphNode): void {
}
`;
- const popoverWidth = Math.min(300, window.innerWidth - 20);
- const popoverHeight = 130;
const rect = (e.currentTarget as HTMLElement).getBoundingClientRect();
-
- // Clamp top position: if bottom doesn't fit, flip to top
- let top = rect.bottom + 4;
- if (top + popoverHeight > window.innerHeight) {
- top = Math.max(8, rect.top - popoverHeight - 4);
- }
-
- // Clamp left position: ensure at least 8px from left and right viewport edges
- let left = rect.left + 40;
- if (left + popoverWidth > window.innerWidth - 8) {
- left = Math.max(8, window.innerWidth - popoverWidth - 8);
- }
-
- hoverPopover.style.top = `${Math.round(top)}px`;
- hoverPopover.style.left = `${Math.round(left)}px`;
- hoverPopover.style.maxWidth = `${popoverWidth}px`;
hoverPopover.classList.add('visible');
+ clampPopoverToViewport(hoverPopover, rect, 8);
}
function hideHoverPopover(): void {
@@ -2834,15 +2831,6 @@ function renderWorktrees(): void {
});
}
-function escapeHtml(str: string): string {
- return str
- .replace(/&/g, '&')
- .replace(//g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''');
-}
-
function renderCloudPatches(): void {
const listEl = document.getElementById('cloud-patches-list');
if (!listEl) return;
diff --git a/src/webview/primitives.ts b/src/webview/primitives.ts
new file mode 100644
index 0000000..46130eb
--- /dev/null
+++ b/src/webview/primitives.ts
@@ -0,0 +1,376 @@
+/**
+ * Native zero-dependency Webview UI primitives for CommitFlow.
+ * Built strictly on VS Code CSS variables (--vscode-*) and @vscode/codicons.
+ * Replaces deprecated @vscode/webview-ui-toolkit with accessible, theme-aware components.
+ */
+
+export interface CfButtonOptions {
+ id?: string;
+ label?: string;
+ icon?: string;
+ variant?: 'primary' | 'secondary' | 'danger' | 'icon' | 'sm';
+ title?: string;
+ ariaLabel?: string;
+ disabled?: boolean;
+ className?: string;
+ onClick?: (e: MouseEvent) => void;
+}
+
+export interface CfBadgeOptions {
+ text: string;
+ variant?: 'default' | 'success' | 'danger' | 'warning' | 'info' | 'purple' | 'subtle';
+ icon?: string;
+ title?: string;
+ tabular?: boolean;
+ className?: string;
+}
+
+export interface CfDrawerOptions {
+ id: string;
+ title: string;
+ onClose?: () => void;
+}
+
+export interface CfTabItem {
+ id: string;
+ label: string;
+ icon?: string;
+ badge?: number;
+ title?: string;
+}
+
+export interface CfTabsOptions {
+ tabs: CfTabItem[];
+ activeTabId?: string;
+ onSelect?: (tabId: string) => void;
+}
+
+export interface CfSkeletonOptions {
+ rows?: number;
+ variant?: 'graph' | 'card' | 'drawer';
+}
+
+export function escapeHtml(str: string): string {
+ return String(str)
+ .replace(/&/g, '&')
+ .replace(//g, '>')
+ .replace(/"/g, '"')
+ .replace(/'/g, ''');
+}
+
+export function CfButton(options: CfButtonOptions): HTMLButtonElement {
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ if (options.id) btn.id = options.id;
+ const variant = options.variant || 'secondary';
+ btn.className = `cf-btn cf-btn-${variant}${options.className ? ` ${options.className}` : ''}`;
+
+ if (options.title) btn.title = options.title;
+ if (options.ariaLabel || options.title || options.label) {
+ btn.setAttribute('aria-label', options.ariaLabel || options.title || options.label || '');
+ }
+ if (options.disabled) btn.disabled = true;
+
+ if (options.icon) {
+ const iconEl = document.createElement('i');
+ iconEl.className = `codicon codicon-${options.icon}`;
+ iconEl.setAttribute('aria-hidden', 'true');
+ btn.appendChild(iconEl);
+ }
+
+ if (options.label) {
+ const span = document.createElement('span');
+ span.textContent = options.label;
+ btn.appendChild(span);
+ }
+
+ if (options.onClick) {
+ btn.addEventListener('click', options.onClick);
+ }
+
+ return btn;
+}
+
+export function CfBadge(options: CfBadgeOptions): HTMLSpanElement {
+ const badge = document.createElement('span');
+ const variant = options.variant || 'default';
+ badge.className = `cf-badge cf-badge-${variant}${options.tabular ? ' tabular-nums' : ''}${
+ options.className ? ` ${options.className}` : ''
+ }`;
+ if (options.title) badge.title = options.title;
+
+ if (options.icon) {
+ const iconEl = document.createElement('i');
+ iconEl.className = `codicon codicon-${options.icon}`;
+ iconEl.setAttribute('aria-hidden', 'true');
+ badge.appendChild(iconEl);
+ }
+
+ const textSpan = document.createElement('span');
+ textSpan.textContent = options.text;
+ badge.appendChild(textSpan);
+
+ return badge;
+}
+
+export function CfDrawer(options: CfDrawerOptions): {
+ element: HTMLElement;
+ body: HTMLElement;
+ open: () => void;
+ close: () => void;
+} {
+ const el = document.createElement('aside');
+ el.id = options.id;
+ el.className = 'cf-drawer';
+ el.setAttribute('role', 'region');
+ el.setAttribute('aria-label', options.title);
+
+ const header = document.createElement('div');
+ header.className = 'cf-drawer-header';
+
+ const titleEl = document.createElement('span');
+ titleEl.className = 'cf-drawer-title';
+ titleEl.textContent = options.title;
+
+ const closeBtn = CfButton({
+ icon: 'close',
+ variant: 'icon',
+ ariaLabel: `Close ${options.title}`,
+ title: 'Close',
+ onClick: () => {
+ el.classList.remove('open');
+ options.onClose?.();
+ },
+ });
+
+ header.appendChild(titleEl);
+ header.appendChild(closeBtn);
+
+ const body = document.createElement('div');
+ body.className = 'cf-drawer-body';
+
+ el.appendChild(header);
+ el.appendChild(body);
+
+ return {
+ element: el,
+ body,
+ open: () => el.classList.add('open'),
+ close: () => {
+ el.classList.remove('open');
+ options.onClose?.();
+ },
+ };
+}
+
+export function CfTabs(options: CfTabsOptions): HTMLElement {
+ const nav = document.createElement('div');
+ nav.className = 'cf-tabs';
+ nav.setAttribute('role', 'tablist');
+
+ let activeId = options.activeTabId || options.tabs[0]?.id || '';
+
+ const buttons: HTMLButtonElement[] = [];
+
+ for (const tab of options.tabs) {
+ const btn = document.createElement('button');
+ btn.type = 'button';
+ btn.className = `cf-tab-btn${tab.id === activeId ? ' active' : ''}`;
+ btn.setAttribute('role', 'tab');
+ btn.setAttribute('aria-selected', tab.id === activeId ? 'true' : 'false');
+ btn.dataset.tabId = tab.id;
+ if (tab.title) btn.title = tab.title;
+
+ if (tab.icon) {
+ const iconEl = document.createElement('i');
+ iconEl.className = `codicon codicon-${tab.icon}`;
+ iconEl.setAttribute('aria-hidden', 'true');
+ btn.appendChild(iconEl);
+ }
+
+ const labelSpan = document.createElement('span');
+ labelSpan.textContent = tab.label;
+ btn.appendChild(labelSpan);
+
+ if (typeof tab.badge === 'number') {
+ const badge = document.createElement('span');
+ badge.className = 'tab-badge tabular-nums';
+ badge.textContent = String(tab.badge);
+ btn.appendChild(badge);
+ }
+
+ btn.addEventListener('click', () => {
+ activeId = tab.id;
+ for (const b of buttons) {
+ const isSelected = b.dataset.tabId === activeId;
+ b.classList.toggle('active', isSelected);
+ b.setAttribute('aria-selected', isSelected ? 'true' : 'false');
+ }
+ options.onSelect?.(tab.id);
+ });
+
+ buttons.push(btn);
+ nav.appendChild(btn);
+ }
+
+ return nav;
+}
+
+export class CfToast {
+ private static container: HTMLElement | null = null;
+
+ private static ensureContainer(): HTMLElement {
+ if (this.container && document.body.contains(this.container)) {
+ return this.container;
+ }
+ const existing = document.getElementById('cf-toast-container');
+ if (existing) {
+ this.container = existing;
+ return existing;
+ }
+ const el = document.createElement('div');
+ el.id = 'cf-toast-container';
+ el.className = 'cf-toast-container';
+ el.setAttribute('aria-live', 'polite');
+ el.setAttribute('aria-atomic', 'false');
+ document.body.appendChild(el);
+ this.container = el;
+ return el;
+ }
+
+ public static showToast(
+ message: string,
+ type: 'info' | 'success' | 'warning' | 'error' = 'info',
+ durationMs: number = 3500
+ ): HTMLElement {
+ const container = this.ensureContainer();
+ const toast = document.createElement('div');
+ toast.className = `cf-toast cf-toast-${type}`;
+ toast.setAttribute('role', 'status');
+
+ const iconName =
+ type === 'success'
+ ? 'pass'
+ : type === 'warning'
+ ? 'warning'
+ : type === 'error'
+ ? 'error'
+ : 'info';
+
+ const iconEl = document.createElement('i');
+ iconEl.className = `codicon codicon-${iconName}`;
+ iconEl.setAttribute('aria-hidden', 'true');
+
+ const msgEl = document.createElement('span');
+ msgEl.className = 'cf-toast-message';
+ msgEl.textContent = message;
+
+ const closeBtn = CfButton({
+ icon: 'close',
+ variant: 'icon',
+ ariaLabel: 'Dismiss notification',
+ onClick: () => toast.remove(),
+ });
+
+ toast.appendChild(iconEl);
+ toast.appendChild(msgEl);
+ toast.appendChild(closeBtn);
+ container.appendChild(toast);
+
+ if (durationMs > 0) {
+ setTimeout(() => {
+ toast.classList.add('cf-toast-leaving');
+ setTimeout(() => toast.remove(), 180);
+ }, durationMs);
+ }
+
+ return toast;
+ }
+}
+
+export function CfSkeleton(options: CfSkeletonOptions = {}): HTMLElement {
+ const rows = Math.max(1, options.rows ?? 8);
+ const variant = options.variant || 'graph';
+ const wrapper = document.createElement('div');
+ wrapper.className = `cf-skeleton cf-skeleton-${variant}`;
+ wrapper.setAttribute('role', 'status');
+ wrapper.setAttribute('aria-busy', 'true');
+ wrapper.setAttribute('aria-label', 'Loading content');
+
+ for (let i = 0; i < rows; i++) {
+ const row = document.createElement('div');
+ row.className = 'cf-skeleton-row';
+ const dot = document.createElement('span');
+ dot.className = 'cf-skeleton-dot';
+ const barPrimary = document.createElement('span');
+ barPrimary.className = 'cf-skeleton-bar';
+ barPrimary.style.width = `${55 + ((i * 13) % 30)}%`;
+ const barMeta = document.createElement('span');
+ barMeta.className = 'cf-skeleton-bar cf-skeleton-bar-short';
+ row.appendChild(dot);
+ row.appendChild(barPrimary);
+ row.appendChild(barMeta);
+ wrapper.appendChild(row);
+ }
+
+ return wrapper;
+}
+
+export interface RectLike {
+ left: number;
+ right: number;
+ top: number;
+ bottom: number;
+ width: number;
+ height: number;
+}
+
+export function computeClampedPosition(
+ anchorRect: RectLike,
+ popoverWidth: number,
+ popoverHeight: number,
+ viewportWidth: number,
+ viewportHeight: number,
+ padding: number = 8
+): { top: number; left: number; maxWidth: number } {
+ const maxWidth = Math.max(160, Math.min(popoverWidth, viewportWidth - padding * 2));
+ let top = anchorRect.bottom + 4;
+ if (top + popoverHeight > viewportHeight - padding) {
+ top = Math.max(padding, anchorRect.top - popoverHeight - 4);
+ }
+
+ let left = anchorRect.left + 24;
+ if (left + maxWidth > viewportWidth - padding) {
+ left = Math.max(padding, viewportWidth - maxWidth - padding);
+ }
+ if (left < padding) {
+ left = padding;
+ }
+
+ return {
+ top: Math.round(top),
+ left: Math.round(left),
+ maxWidth: Math.round(maxWidth),
+ };
+}
+
+export function clampPopoverToViewport(
+ popover: HTMLElement,
+ anchorRect: RectLike,
+ padding: number = 8
+): void {
+ const measuredWidth = popover.offsetWidth || 300;
+ const measuredHeight = popover.offsetHeight || 130;
+ const pos = computeClampedPosition(
+ anchorRect,
+ measuredWidth,
+ measuredHeight,
+ window.innerWidth,
+ window.innerHeight,
+ padding
+ );
+ popover.style.top = `${pos.top}px`;
+ popover.style.left = `${pos.left}px`;
+ popover.style.maxWidth = `${pos.maxWidth}px`;
+}
diff --git a/src/webview/style.css b/src/webview/style.css
index 8509694..5747cf6 100644
--- a/src/webview/style.css
+++ b/src/webview/style.css
@@ -3605,20 +3605,297 @@ body.layout-height-nano .stats-bar {
background: var(--bg-hover) !important;
}
-body.vscode-high-contrast .commit-row.selected,
+body.vscode-high-contrast .commit-row.selected {
+ outline: 2px solid var(--vscode-contrastActiveBorder, #ffffff);
+ outline-offset: -2px;
+}
+
body.vscode-high-contrast-light .commit-row.selected {
- outline: 2px solid #ffffff;
+ outline: 2px solid var(--vscode-contrastActiveBorder, #0f4a85);
outline-offset: -2px;
}
-body.vscode-high-contrast .modal-card,
+body.vscode-high-contrast .modal-card {
+ border: 2px solid var(--vscode-contrastBorder, #ffffff) !important;
+}
+
body.vscode-high-contrast-light .modal-card {
- border: 2px solid #ffffff !important;
+ border: 2px solid var(--vscode-contrastBorder, #0f4a85) !important;
+}
+
+body.vscode-high-contrast .rebase-todo-item {
+ border: 1px solid var(--vscode-contrastBorder, #ffffff) !important;
}
-body.vscode-high-contrast .rebase-todo-item,
body.vscode-high-contrast-light .rebase-todo-item {
- border: 1px solid #ffffff !important;
+ border: 1px solid var(--vscode-contrastBorder, #0f4a85) !important;
+}
+
+/* ==========================================================================
+ Native UI Primitives (Issue #7) & Telemetry Typography
+ ========================================================================== */
+.tabular-nums,
+.commit-hash,
+.file-delta-badge,
+.stat-value,
+.tab-badge,
+.rebase-item-sha {
+ font-variant-numeric: tabular-nums;
+}
+
+.cf-btn {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ gap: 5px;
+ border-radius: var(--radius-xs);
+ border: 1px solid transparent;
+ font-family: var(--vscode-font-family);
+ font-size: var(--font-size-sm);
+ font-weight: 500;
+ cursor: pointer;
+ transition: background var(--duration-fast) ease, border-color var(--duration-fast) ease, transform var(--duration-fast) ease;
+}
+
+.cf-btn:focus-visible {
+ outline: 1px solid var(--vscode-focusBorder, var(--focus-ring));
+ outline-offset: 1px;
+}
+
+.cf-btn:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+}
+
+.cf-btn-primary {
+ padding: 5px 10px;
+ background: var(--vscode-button-background, var(--accent-cyan));
+ color: var(--vscode-button-foreground, #ffffff);
+}
+
+.cf-btn-primary:hover:not(:disabled) {
+ background: var(--vscode-button-hoverBackground, var(--accent-blue));
+}
+
+.cf-btn-secondary {
+ padding: 5px 10px;
+ background: var(--vscode-button-secondaryBackground, var(--bg-tertiary));
+ color: var(--vscode-button-secondaryForeground, var(--text-primary));
+ border-color: var(--border-subtle);
+}
+
+.cf-btn-danger {
+ padding: 5px 10px;
+ background: rgba(239, 68, 68, 0.16);
+ color: var(--vscode-errorForeground, #ef4444);
+ border-color: rgba(239, 68, 68, 0.4);
+}
+
+.cf-btn-icon {
+ min-width: 28px;
+ min-height: 28px;
+ padding: 4px;
+ background: transparent;
+ color: var(--text-muted);
+}
+
+.cf-btn-icon:hover:not(:disabled) {
+ background: var(--bg-hover);
+ color: var(--text-primary);
+}
+
+.cf-btn-sm {
+ padding: 3px 8px;
+ font-size: var(--font-size-xs);
+ background: var(--bg-tertiary);
+ color: var(--text-primary);
+ border-color: var(--border-subtle);
+}
+
+.cf-badge {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ padding: 2px 7px;
+ border-radius: var(--radius-full);
+ font-size: var(--font-size-xs);
+ font-weight: 600;
+ border: 1px solid var(--border-subtle);
+ background: var(--bg-tertiary);
+ color: var(--text-primary);
+}
+
+.cf-badge-success {
+ background: rgba(16, 185, 129, 0.16);
+ color: #10b981;
+ border-color: rgba(16, 185, 129, 0.35);
+}
+
+.cf-badge-danger {
+ background: rgba(239, 68, 68, 0.16);
+ color: #ef4444;
+ border-color: rgba(239, 68, 68, 0.35);
+}
+
+.cf-badge-warning {
+ background: rgba(245, 158, 11, 0.16);
+ color: #f59e0b;
+ border-color: rgba(245, 158, 11, 0.35);
+}
+
+.cf-badge-info {
+ background: rgba(6, 182, 212, 0.16);
+ color: #06b6d4;
+ border-color: rgba(6, 182, 212, 0.35);
+}
+
+.cf-badge-purple {
+ background: rgba(139, 92, 246, 0.16);
+ color: #8b5cf6;
+ border-color: rgba(139, 92, 246, 0.35);
+}
+
+.cf-drawer {
+ display: none;
+ flex-direction: column;
+ background: var(--bg-secondary);
+ border-left: 1px solid var(--border-subtle);
+}
+
+.cf-drawer.open {
+ display: flex;
+}
+
+.cf-drawer-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 8px 12px;
+ border-bottom: 1px solid var(--border-subtle);
+}
+
+.cf-drawer-title {
+ font-weight: 600;
+ font-size: var(--font-size-base);
+}
+
+.cf-drawer-body {
+ padding: 12px;
+ overflow-y: auto;
+ flex: 1;
+}
+
+.cf-tabs {
+ display: flex;
+ gap: 4px;
+ flex-wrap: wrap;
+}
+
+.cf-tab-btn {
+ display: inline-flex;
+ align-items: center;
+ gap: 5px;
+ padding: 4px 10px;
+ border: 1px solid transparent;
+ border-radius: var(--radius-xs);
+ background: transparent;
+ color: var(--text-muted);
+ cursor: pointer;
+}
+
+.cf-tab-btn.active {
+ background: var(--bg-active);
+ color: var(--text-primary);
+ border-color: var(--border-hover);
+}
+
+.cf-toast-container {
+ position: fixed;
+ bottom: 14px;
+ right: 14px;
+ z-index: 9999;
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ max-width: min(360px, calc(100vw - 24px));
+ pointer-events: none;
+}
+
+.cf-toast {
+ pointer-events: auto;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 8px 10px;
+ border-radius: var(--radius-md);
+ background: var(--bg-tertiary);
+ color: var(--text-primary);
+ border: 1px solid var(--border-subtle);
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
+ font-size: var(--font-size-sm);
+}
+
+.cf-toast-success { border-color: rgba(16, 185, 129, 0.5); }
+.cf-toast-warning { border-color: rgba(245, 158, 11, 0.5); }
+.cf-toast-error { border-color: rgba(239, 68, 68, 0.5); }
+
+.cf-toast-message {
+ flex: 1;
+}
+
+.cf-skeleton {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 12px;
+ width: 100%;
+ box-sizing: border-box;
+}
+
+.cf-skeleton-row {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ height: 22px;
+}
+
+.cf-skeleton-dot {
+ width: 10px;
+ height: 10px;
+ border-radius: 50%;
+ background: var(--bg-tertiary);
+ flex-shrink: 0;
+}
+
+.cf-skeleton-bar {
+ height: 10px;
+ border-radius: var(--radius-xs);
+ background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-hover) 50%, var(--bg-tertiary) 75%);
+ background-size: 200% 100%;
+ animation: cf-shimmer 1.4s infinite linear;
+}
+
+.cf-skeleton-bar-short {
+ width: 64px;
+ margin-left: auto;
+}
+
+@keyframes cf-shimmer {
+ 0% { background-position: 200% 0; }
+ 100% { background-position: -200% 0; }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ *, *::before, *::after {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ scroll-behavior: auto !important;
+ }
+ .branch-pulse-dot,
+ .codicon-modifier-spin {
+ animation: none !important;
+ }
}
.sr-only {
diff --git a/test/runTests.ts b/test/runTests.ts
index 1c22bef..ec3867c 100644
--- a/test/runTests.ts
+++ b/test/runTests.ts
@@ -20,6 +20,7 @@ import { ApiKeyManager } from '../src/mcp/apiKeyManager';
import { CommitFlowHttpServer } from '../src/mcp/commitflowHttpServer';
import { PersistenceManager } from '../src/state/persistenceManager';
import { GitFsReader } from '../src/git/gitFsReader';
+import { computeClampedPosition, escapeHtml } from '../src/webview/primitives';
console.log('Starting CommitFlow Extended Test Suite...\n');
@@ -1296,7 +1297,45 @@ Host *.internal.corp
}
console.log(' [PASS] AI Studio, Multi-Client Snippets & Instant Key Revocation E2E tests passed!');
- console.log('\n[PASS] ALL 42 COMMITFLOW TEST SUITES PASSED WITH 100% SUCCESS!\n');
+ console.log('\nTesting Native UI Primitives & Zero Deprecated Toolkit Audit...');
+ {
+ const pkgJson = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8');
+ assert.ok(!pkgJson.includes('@vscode/webview-ui-toolkit'), 'package.json must NOT depend on deprecated @vscode/webview-ui-toolkit');
+
+ const primitivesSrc = fs.readFileSync(path.join(__dirname, '..', 'src', 'webview', 'primitives.ts'), 'utf8');
+ assert.ok(primitivesSrc.includes('export function CfButton'));
+ assert.ok(primitivesSrc.includes('export function CfBadge'));
+ assert.ok(primitivesSrc.includes('export function CfDrawer'));
+ assert.ok(primitivesSrc.includes('export function CfTabs'));
+ assert.ok(primitivesSrc.includes('export class CfToast'));
+ assert.ok(primitivesSrc.includes('export function CfSkeleton'));
+
+ assert.ok(fs.existsSync(path.join(__dirname, '..', 'DESIGN.md')), 'DESIGN.md must exist');
+ assert.ok(fs.existsSync(path.join(__dirname, '..', '.claude', 'skills', 'commitflow-ui-design', 'SKILL.md')));
+ assert.ok(fs.existsSync(path.join(__dirname, '..', '.claude', 'skills', 'commitflow-canvas-dag', 'SKILL.md')));
+ assert.ok(fs.existsSync(path.join(__dirname, '..', '.claude', 'skills', 'commitflow-qa-testing', 'SKILL.md')));
+ assert.ok(fs.existsSync(path.join(__dirname, '..', '.claude', 'skills', 'commitflow-issue-workflow', 'SKILL.md')));
+
+ assert.ok(cssContent.includes('.cf-btn-primary'));
+ assert.ok(cssContent.includes('.cf-skeleton'));
+ assert.ok(cssContent.includes('prefers-reduced-motion: reduce'));
+ assert.ok(cssContent.includes('tabular-nums'));
+
+ const clamped = computeClampedPosition(
+ { left: 210, right: 235, top: 680, bottom: 700, width: 25, height: 20 },
+ 300,
+ 130,
+ 240,
+ 720,
+ 8
+ );
+ assert.ok(clamped.left >= 8 && clamped.left + clamped.maxWidth <= 240);
+ assert.ok(clamped.top < 680, 'Popover near bottom should flip upward');
+ assert.strictEqual(escapeHtml(''), '<script>"x"</script>');
+ }
+ console.log(' [PASS] Native UI Primitives & Zero Deprecated Toolkit Audit tests passed!');
+
+ console.log('\n[PASS] ALL 43 COMMITFLOW TEST SUITES PASSED WITH 100% SUCCESS!\n');
})().catch((err) => {
console.error('[CommitFlow] Test suite failed:', err);
process.exit(1);