fix(ui): fix assistant panel scrolling, remove false target warnings, add virtual scroll

- Fix Config and Audit Rules assistant panels with fixed 500px content
  height to enable scrolling (matching CodeMirror editor height)
- Remove target name validation that produced false "Unknown target"
  warnings — target names are user-defined and freely configurable
- Enrich targets field docs example with all sub-fields
- Add react-virtuoso virtual scrolling to FilterStudioPage preview list
- Add v0.17.9 changelog and website changelog
This commit is contained in:
Willie
2026-03-20 18:29:05 +08:00
parent 5a0a8753d0
commit 5198a74287
11 changed files with 74 additions and 115 deletions
+13
View File
@@ -1,5 +1,18 @@
# Changelog
## [0.17.9] - 2026-03-20
### Bug Fixes
- **Config page assistant panel now scrollable** — the right-side Structure/Diff panel now has a fixed 500px content area matching the editor height, enabling vertical scrolling when the YAML structure is long
- **Removed false "Unknown target" warnings** — the config editor no longer flags custom target names as unknown. Target names are user-defined and freely configurable — any name is valid
- **Audit rules assistant panel scrollable** — same fixed-height scrolling fix applied to the Audit Rules page's assistant panel
### Improvements
- **Richer `targets` field docs** — the `targets` field documentation example now shows all sub-fields (`path`, `mode`, `include`, `exclude`) with multiple targets
- **Filter Studio virtual scrolling** — the skill preview list now uses virtual scrolling for smooth performance with large skill collections
## [0.17.8] - 2026-03-19
### New Features
@@ -155,7 +155,7 @@ export default function AuditAssistantPanel({
return (
<div
className="ss-audit-assistant-panel flex flex-col h-full border-l border-muted bg-surface"
className="ss-audit-assistant-panel flex flex-col h-full overflow-hidden border-l border-muted bg-surface"
onKeyDown={handleKeyDown}
>
{/* Status bar */}
@@ -169,7 +169,7 @@ export default function AuditAssistantPanel({
/>
{/* Context area */}
<div className="ss-panel-content flex-1 overflow-y-auto animate-fade-in">{renderContextArea()}</div>
<div className="ss-panel-content h-[500px] overflow-y-auto animate-fade-in">{renderContextArea()}</div>
{/* Bottom bar */}
<div className="ss-panel-toolbar flex items-center gap-2 px-2 py-1.5 border-t border-muted/40 bg-paper">
+2 -5
View File
@@ -23,7 +23,6 @@ interface Props {
collapsed: boolean;
onToggleCollapse: () => void;
onRevert: () => void;
schemaUnavailable?: boolean;
mode?: 'config' | 'skillignore';
ignoredSkills?: string[];
}
@@ -39,7 +38,6 @@ export default function AssistantPanel({
collapsed,
onToggleCollapse,
onRevert,
schemaUnavailable = false,
mode = 'config',
ignoredSkills = [],
}: Props) {
@@ -121,7 +119,7 @@ export default function AssistantPanel({
return (
<div
className="ss-assistant-panel flex flex-col h-full border-l border-muted bg-surface"
className="ss-assistant-panel flex flex-col h-full overflow-hidden border-l border-muted bg-surface"
onKeyDown={handleKeyDown}
>
{/* Status bar */}
@@ -131,12 +129,11 @@ export default function AssistantPanel({
collapsed={collapsed}
onToggleCollapse={onToggleCollapse}
onErrorsClick={handleErrorsClick}
schemaUnavailable={schemaUnavailable}
mode={mode}
/>
{/* Context area */}
<div className="ss-panel-content flex-1 overflow-y-auto animate-fade-in">{renderContextArea()}</div>
<div className="ss-panel-content h-[500px] overflow-y-auto animate-fade-in">{renderContextArea()}</div>
{/* Bottom bar — config mode only */}
{mode === 'config' && (
+1 -3
View File
@@ -9,7 +9,6 @@ interface ConfigStatusBarProps {
collapsed: boolean;
onToggleCollapse: () => void;
onErrorsClick: () => void;
schemaUnavailable?: boolean;
mode?: 'config' | 'skillignore' | 'audit';
}
@@ -19,7 +18,6 @@ export default function ConfigStatusBar({
collapsed,
onToggleCollapse,
onErrorsClick,
schemaUnavailable = false,
mode = 'config',
}: ConfigStatusBarProps) {
const errorCount = errors.filter(e => e.severity === 'error').length;
@@ -35,7 +33,7 @@ export default function ConfigStatusBar({
<>
{isValid ? (
<Badge variant="success" dot>
{schemaUnavailable ? 'Valid YAML (schema unavailable)' : 'Valid YAML'}
Valid YAML
</Badge>
) : (
<button
@@ -4,50 +4,40 @@ import { validateYaml } from '../useYamlValidation';
describe('validateYaml', () => {
it('returns empty array for valid YAML', () => {
const errors = validateYaml('sync_mode: merge\n', []);
const errors = validateYaml('sync_mode: merge\n');
expect(errors).toEqual([]);
});
it('returns syntax error with line number for invalid YAML', () => {
const errors = validateYaml('foo:\n bar\n baz: invalid', []);
const errors = validateYaml('foo:\n bar\n baz: invalid');
expect(errors.length).toBeGreaterThan(0);
expect(errors[0].severity).toBe('error');
expect(errors[0].line).toBeGreaterThan(0);
});
it('returns empty array for empty input', () => {
const errors = validateYaml('', []);
const errors = validateYaml('');
expect(errors).toEqual([]);
});
it('detects unknown target names', () => {
const yaml = 'targets:\n claudee:\n mode: merge\n';
const validTargets = ['claude', 'cursor', 'windsurf'];
const errors = validateYaml(yaml, validTargets);
expect(errors.length).toBe(1);
expect(errors[0].severity).toBe('warning');
expect(errors[0].message).toContain('claudee');
});
it('suggests closest target name for typos', () => {
const yaml = 'targets:\n cursr:\n mode: merge\n';
const validTargets = ['claude', 'cursor', 'windsurf'];
const errors = validateYaml(yaml, validTargets);
expect(errors[0].message).toContain('cursor');
});
it('does not flag valid target names', () => {
const yaml = 'targets:\n claude:\n mode: merge\n';
const validTargets = ['claude', 'cursor'];
const errors = validateYaml(yaml, validTargets);
it('accepts any target name without warnings', () => {
const yaml = 'targets:\n my-custom-target:\n mode: merge\n';
const errors = validateYaml(yaml);
expect(errors).toEqual([]);
});
it('detects invalid sync_mode values', () => {
const yaml = 'sync_mode: invalid_mode\n';
const errors = validateYaml(yaml, []);
const errors = validateYaml(yaml);
expect(errors.length).toBe(1);
expect(errors[0].severity).toBe('warning');
expect(errors[0].message).toContain('invalid_mode');
});
it('detects invalid per-target mode', () => {
const yaml = 'targets:\n claude:\n mode: bad\n';
const errors = validateYaml(yaml);
expect(errors.length).toBe(1);
expect(errors[0].message).toContain('bad');
});
});
+4 -49
View File
@@ -35,7 +35,6 @@ function validateEnum(
/** Pure validation function (testable without React) */
export function validateYaml(
source: string,
validTargets: string[],
): ValidationError[] {
if (!source.trim()) return [];
@@ -60,21 +59,8 @@ export function validateYaml(
validateEnum(errors, sourceLines, parsed.mode, 'mode', VALID_SYNC_MODES, 'mode');
validateEnum(errors, sourceLines, parsed.sync_mode, 'sync_mode', VALID_SYNC_MODES, 'sync_mode');
// Validate target names and per-target mode
// Validate per-target mode
if (parsed.targets) {
if (validTargets.length > 0) {
for (const name of Object.keys(parsed.targets)) {
if (!validTargets.includes(name)) {
const lineNum = findKeyLine(sourceLines, name);
const suggestion = closestMatch(name, validTargets);
const msg = suggestion
? `Unknown target "${name}" — did you mean "${suggestion}"?`
: `Unknown target "${name}"`;
errors.push({ line: lineNum, message: msg, severity: 'warning' });
}
}
}
for (const [name, cfg] of Object.entries(parsed.targets)) {
if (cfg && typeof cfg === 'object' && 'mode' in cfg) {
validateEnum(errors, sourceLines, (cfg as Record<string, unknown>).mode, 'mode', VALID_SYNC_MODES, `mode for target "${name}"`, name);
@@ -107,45 +93,14 @@ function findKeyLine(sourceLines: string[], key: string, afterKey?: string): num
return 1;
}
/** Levenshtein distance */
function levenshtein(a: string, b: string): number {
const m = a.length, n = b.length;
const dp: number[][] = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
for (let i = 0; i <= m; i++) dp[i][0] = i;
for (let j = 0; j <= n; j++) dp[0][j] = j;
for (let i = 1; i <= m; i++) {
for (let j = 1; j <= n; j++) {
dp[i][j] = a[i - 1] === b[j - 1]
? dp[i - 1][j - 1]
: 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
}
}
return dp[m][n];
}
/** Find closest match within distance threshold */
function closestMatch(input: string, candidates: string[]): string | null {
let best: string | null = null;
let bestDist = Infinity;
const threshold = Math.max(2, Math.floor(input.length / 2));
for (const c of candidates) {
const d = levenshtein(input.toLowerCase(), c.toLowerCase());
if (d < bestDist && d <= threshold) {
best = c;
bestDist = d;
}
}
return best;
}
/** React hook: debounced YAML validation */
export function useYamlValidation(source: string, validTargets: string[]) {
export function useYamlValidation(source: string) {
const [errors, setErrors] = useState<ValidationError[]>([]);
const timerRef = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
const validate = useCallback(() => {
setErrors(validateYaml(source, validTargets));
}, [source, validTargets]);
setErrors(validateYaml(source));
}, [source]);
useEffect(() => {
clearTimeout(timerRef.current);
+1 -1
View File
@@ -49,7 +49,7 @@ export const fieldDocs: Record<string, FieldDoc> = {
targets: {
description: 'Map of target AI tools to configure. Each target can have include/exclude filters and a sync mode override.',
type: 'object',
example: 'targets:\n claude:\n include: ["my-skill"]',
example: 'targets:\n claude:\n path: ~/.claude/skills\n mode: merge\n include: ["skill-a", "skill-b"]\n exclude: ["debug-only"]\n cursor:\n mode: symlink',
},
'targets.include': {
description: 'List of skill names to include for this target. If set, only these skills are synced.',
+2 -2
View File
@@ -257,7 +257,7 @@ export default function AuditRulesYaml({
panelCollapsed ? 'flex-[0] w-0 opacity-0 pointer-events-none' : 'flex-[2] opacity-100'
}`}
>
<Card className="h-full !p-0 !overflow-visible min-w-[280px]">
<Card className="!p-0 !overflow-visible min-w-[280px]">
<AuditAssistantPanel
errors={[]}
changeCount={0}
@@ -325,7 +325,7 @@ export default function AuditRulesYaml({
panelCollapsed ? 'flex-[0] w-0 opacity-0 pointer-events-none' : 'flex-[2] opacity-100'
}`}
>
<Card className="h-full !p-0 !overflow-visible min-w-[280px]">
<Card className="!p-0 !overflow-visible min-w-[280px]">
<AuditAssistantPanel
errors={errors}
changeCount={changeCount}
+4 -17
View File
@@ -95,20 +95,8 @@ export default function ConfigPage() {
}
};
// Fetch target names for schema validation
const { data: targetsData, error: targetsError } = useQuery({
queryKey: queryKeys.targets.all,
queryFn: () => api.listTargets(),
staleTime: staleTimes.targets,
});
const validTargetNames = useMemo(
() => targetsData?.targets?.map((t: any) => t.name) ?? [],
[targetsData],
);
const schemaUnavailable = !!targetsError;
// Assistant panel hooks
const { errors: yamlErrors } = useYamlValidation(raw, validTargetNames);
const { errors: yamlErrors } = useYamlValidation(raw);
const { fieldPath, cursorLine, extension: cursorExtension } = useCursorField();
const { diff, changeCount } = useLineDiff(configData?.raw ?? '', raw, !panelCollapsed);
@@ -380,13 +368,13 @@ export default function ConfigPage() {
</div>
</Card>
{/* Panel: collapses via CSS transition */}
{/* Assistant panel */}
<div
className={`hidden lg:block transition-all duration-300 ease-in-out overflow-hidden ${
panelCollapsed ? 'flex-[0] w-0 opacity-0 pointer-events-none' : 'flex-[2] opacity-100'
}`}
>
<Card className="h-full !p-0 !overflow-visible min-w-[280px]">
<Card className="!p-0 !overflow-visible min-w-[280px]">
<AssistantPanel
errors={yamlErrors}
changeCount={changeCount}
@@ -398,7 +386,6 @@ export default function ConfigPage() {
collapsed={panelCollapsed}
onToggleCollapse={togglePanel}
onRevert={() => setShowRevertDialog(true)}
schemaUnavailable={schemaUnavailable}
/>
</Card>
</div>
@@ -424,7 +411,7 @@ export default function ConfigPage() {
panelCollapsed ? 'flex-[0] w-0 opacity-0 pointer-events-none' : 'flex-[2] opacity-100'
}`}
>
<Card className="h-full !p-0 !overflow-visible min-w-[280px]">
<Card className="!p-0 !overflow-visible min-w-[280px]">
<AssistantPanel
mode="skillignore"
errors={[]}
+18 -12
View File
@@ -1,6 +1,7 @@
import { useState, useEffect, useCallback, useRef, useMemo } from 'react';
import { useState, useEffect, useCallback, useRef, useMemo, memo } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { useQuery, useQueryClient } from '@tanstack/react-query';
import { Virtuoso } from 'react-virtuoso';
import { Filter, Check, X, Info, PackageOpen, Search } from 'lucide-react';
import { api } from '../api/client';
import type { SyncMatrixEntry } from '../api/client';
@@ -249,20 +250,25 @@ export default function FilterStudioPage() {
</div>
<div
className="max-h-[28rem] overflow-y-auto border-2 border-dashed border-pencil-light/30"
className="border-2 border-dashed border-pencil-light/30"
style={{ borderRadius: radius.md }}
>
{filteredPreview.map((entry) => (
<PreviewRow
key={entry.skill}
entry={entry}
onClick={() => handleToggleSkill(entry)}
/>
))}
{filteredPreview.length === 0 && previewSearch && (
{filteredPreview.length === 0 && previewSearch ? (
<p className="text-sm text-pencil-light text-center py-6">
No skills matching "{previewSearch}"
</p>
) : (
<Virtuoso
style={{ height: '28rem' }}
totalCount={filteredPreview.length}
overscan={200}
itemContent={(index) => (
<PreviewRow
entry={filteredPreview[index]}
onClick={() => handleToggleSkill(filteredPreview[index])}
/>
)}
/>
)}
</div>
@@ -280,7 +286,7 @@ export default function FilterStudioPage() {
}
/** Single preview row with status indicator and click-to-toggle */
function PreviewRow({
const PreviewRow = memo(function PreviewRow({
entry,
onClick,
}: {
@@ -323,7 +329,7 @@ function PreviewRow({
)}
</div>
);
}
});
function StatusIcon({ status }: { status: SyncMatrixEntry['status'] }) {
switch (status) {
+13
View File
@@ -9,6 +9,19 @@ All notable changes to skillshare are documented here. For the full commit histo
---
## [0.17.9] - 2026-03-20
### Bug Fixes
- **Config page assistant panel now scrollable** — the right-side Structure/Diff panel now has a fixed 500px content area matching the editor height, enabling vertical scrolling when the YAML structure is long
- **Removed false "Unknown target" warnings** — the config editor no longer flags custom target names as unknown. Target names are user-defined and freely configurable — any name is valid
- **Audit rules assistant panel scrollable** — same fixed-height scrolling fix applied to the Audit Rules page's assistant panel
### Improvements
- **Richer `targets` field docs** — the `targets` field documentation example now shows all sub-fields (`path`, `mode`, `include`, `exclude`) with multiple targets
- **Filter Studio virtual scrolling** — the skill preview list now uses virtual scrolling for smooth performance with large skill collections
## [0.17.8] - 2026-03-19
### New Features