From 7c913086d095bee91d48729883bab8e081d003f7 Mon Sep 17 00:00:00 2001 From: Willie Date: Wed, 25 Mar 2026 13:29:41 +0800 Subject: [PATCH] fix(ui): show correct field docs for target names in config editor - name: claude under targets was showing mode doc (targets.mode) instead of target name doc. Fixed by adding targets.name fieldDoc entry which scores higher in subsequence matching. - Bare list values like "- agents" (short-form target name) were invisible: extractKey, parseYamlTree, and lookupFieldDoc now handle them. --- CHANGELOG.md | 1 + specs/RELEASE_NOTES_0.17.11.md | 4 ++++ ui/src/components/config/FieldDocs.tsx | 7 ++++--- ui/src/components/config/StructureTree.tsx | 10 ++++++---- ui/src/hooks/useCursorField.ts | 3 +++ ui/src/lib/fieldDocs.ts | 5 +++++ website/src/pages/changelog.md | 1 + 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aad7f8ad..12967f0cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - **Flatten checkbox** — the Extras page shows a flatten checkbox per target, both when creating extras and on existing targets. Disabled when mode is symlink - **Config editor validation** — the YAML config editor warns when `flatten: true` is combined with `mode: symlink` +- **Target name field docs** — clicking a target name in the config editor (both `name: claude` and short-form `- agents`) now shows the correct "target name" documentation instead of unrelated field docs ## [0.17.10] - 2026-03-24 diff --git a/specs/RELEASE_NOTES_0.17.11.md b/specs/RELEASE_NOTES_0.17.11.md index b1c51dc24..39a79c634 100644 --- a/specs/RELEASE_NOTES_0.17.11.md +++ b/specs/RELEASE_NOTES_0.17.11.md @@ -54,3 +54,7 @@ The `extras init` interactive wizard now includes a "Flatten files into target r ## Web UI The Extras page now shows a flatten checkbox per target — both in the "Add Extra" modal and on existing targets. The checkbox is disabled when mode is `symlink`. The YAML config editor warns when `flatten: true` is combined with `mode: symlink`. + +## Config Editor — Target Name Docs + +Clicking a target name in the config editor now shows the correct "target name" field documentation. Previously, clicking `name: claude` under `targets` incorrectly showed the sync mode documentation. Short-form entries like `- agents` are also recognized and show the same target name docs. diff --git a/ui/src/components/config/FieldDocs.tsx b/ui/src/components/config/FieldDocs.tsx index bb76b1d83..a88ce5cd4 100644 --- a/ui/src/components/config/FieldDocs.tsx +++ b/ui/src/components/config/FieldDocs.tsx @@ -48,10 +48,11 @@ function lookupFieldDoc(fieldPath: string | null, docsMap: Record= 2) { - doc = docsMap[parts[0]]; + const nameKey = parts[0] + '.name'; + doc = docsMap[nameKey] ?? docsMap[parts[0]]; } } diff --git a/ui/src/components/config/StructureTree.tsx b/ui/src/components/config/StructureTree.tsx index 3d8554566..e247fdad1 100644 --- a/ui/src/components/config/StructureTree.tsx +++ b/ui/src/components/config/StructureTree.tsx @@ -33,9 +33,6 @@ function parseYamlTree(source: string): TreeNode[] { const trimmed = rawLine.trim(); // Skip blank lines and comment lines if (!trimmed || trimmed.startsWith('#')) continue; - // Skip bare list values (- value without colon) - if ((trimmed.startsWith('- ') || trimmed === '-') && !trimmed.includes(':')) continue; - let key: string | null = null; let rest = ''; let indent = rawLine.length - rawLine.trimStart().length; @@ -45,13 +42,18 @@ function parseYamlTree(source: string): TreeNode[] { if (listMatch) { key = listMatch[1]; rest = listMatch[2].trim(); - // For depth calc, use indent of the dash } else { // Plain key: "key: value" const plainMatch = trimmed.match(/^([a-zA-Z_][\w.-]*)\s*:(.*)/); if (plainMatch) { key = plainMatch[1]; rest = plainMatch[2].trim(); + } else { + // Bare list value: "- agents" (short-form target name, no colon) + const bareMatch = trimmed.match(/^-\s+([a-zA-Z_][\w.-]+)$/); + if (bareMatch) { + key = bareMatch[1]; + } } } diff --git a/ui/src/hooks/useCursorField.ts b/ui/src/hooks/useCursorField.ts index 2b031dcf2..8a509788e 100644 --- a/ui/src/hooks/useCursorField.ts +++ b/ui/src/hooks/useCursorField.ts @@ -14,6 +14,9 @@ function extractKey(line: string): string | null { // Try list item key: " - key: value" const listItem = line.match(/^\s*-\s+([a-zA-Z_][\w.-]*)\s*:/); if (listItem) return listItem[1]; + // Bare list value: " - agents" (no colon, e.g. short-form target name) + const bare = line.match(/^\s*-\s+([a-zA-Z_][\w.-]+)\s*$/); + if (bare) return bare[1]; return null; } diff --git a/ui/src/lib/fieldDocs.ts b/ui/src/lib/fieldDocs.ts index 33c7124b5..d4ab566af 100644 --- a/ui/src/lib/fieldDocs.ts +++ b/ui/src/lib/fieldDocs.ts @@ -51,6 +51,11 @@ export const fieldDocs: Record = { type: 'object', 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.name': { + description: 'Target name in config. Use a built-in name (e.g., claude, cursor, codex) for automatic path resolution, or any custom name with an explicit path.', + type: 'string', + example: '- name: claude\n path: ~/.claude/skills', + }, 'targets.include': { description: 'List of skill names to include for this target. If set, only these skills are synced.', type: 'string[]', diff --git a/website/src/pages/changelog.md b/website/src/pages/changelog.md index d638e7012..beed7eaec 100644 --- a/website/src/pages/changelog.md +++ b/website/src/pages/changelog.md @@ -43,6 +43,7 @@ All notable changes to skillshare are documented here. For the full commit histo - **Flatten checkbox** — the Extras page shows a flatten checkbox per target, both when creating extras and on existing targets. Disabled when mode is symlink - **Config editor validation** — the YAML config editor warns when `flatten: true` is combined with `mode: symlink` +- **Target name field docs** — clicking a target name in the config editor (both `name: claude` and short-form `- agents`) now shows the correct "target name" documentation instead of unrelated field docs ## [0.17.10] - 2026-03-24