diff --git a/ui/src/i18n/locales/de.json b/ui/src/i18n/locales/de.json index ec6d60ac7..e530fb1ce 100644 --- a/ui/src/i18n/locales/de.json +++ b/ui/src/i18n/locales/de.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Quellordner", "extras.modal.sourceFolderHint": "Extras im selben Ordner synchronisieren jeweils ihre eigene Datei.", "extras.modal.sourceFolderInvalid": "Gib einen Ordnernamen ein, keinen Pfad.", + "extras.modal.existingFolders": "Vorhanden:", "extras.modal.agentsNote": "Ein Extra mit der Datei AGENTS.md erscheint im Tab AGENTS.md.", "extras.hint.fileAs": "Lass den Dateinamen leer, um {file} zu behalten.", "extras.hint.fileModes": "merge verlinkt die Datei · copy schreibt eine Kopie · import fügt eine @-Zeile hinzu, nur für Tools, die @-Importe lesen.", diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.json index 9375aed28..33704e078 100644 --- a/ui/src/i18n/locales/en.json +++ b/ui/src/i18n/locales/en.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Source folder", "extras.modal.sourceFolderHint": "Extras in the same folder each sync their own file.", "extras.modal.sourceFolderInvalid": "Enter a folder name, not a path.", + "extras.modal.existingFolders": "Existing:", "extras.modal.agentsNote": "An extra whose file is AGENTS.md appears on the AGENTS.md tab.", "extras.hint.fileAs": "Leave File name empty to keep {file}.", "extras.hint.fileModes": "merge links the file · copy writes a copy · import adds an @ line, only for tools that read @ imports.", diff --git a/ui/src/i18n/locales/es.json b/ui/src/i18n/locales/es.json index f6d9ed0e3..b0529509f 100644 --- a/ui/src/i18n/locales/es.json +++ b/ui/src/i18n/locales/es.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Carpeta de origen", "extras.modal.sourceFolderHint": "Los extras de la misma carpeta sincronizan cada uno su propio archivo.", "extras.modal.sourceFolderInvalid": "Escribe un nombre de carpeta, no una ruta.", + "extras.modal.existingFolders": "Existentes:", "extras.modal.agentsNote": "Un extra cuyo archivo es AGENTS.md aparece en la pestaña AGENTS.md.", "extras.hint.fileAs": "Deja vacío el nombre de archivo para conservar {file}.", "extras.hint.fileModes": "merge enlaza el archivo · copy escribe una copia · import añade una línea @, solo para herramientas que leen importaciones @.", diff --git a/ui/src/i18n/locales/fa.json b/ui/src/i18n/locales/fa.json index 9b2876440..29eb6a8a2 100644 --- a/ui/src/i18n/locales/fa.json +++ b/ui/src/i18n/locales/fa.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "پوشه منبع", "extras.modal.sourceFolderHint": "extraهایی که در یک پوشه‌اند هر کدام فایل خودشان را همگام می‌کنند.", "extras.modal.sourceFolderInvalid": "نام پوشه را وارد کنید، نه مسیر.", + "extras.modal.existingFolders": "موجود:", "extras.modal.agentsNote": "extraای که فایلش AGENTS.md است در زبانه AGENTS.md نمایش داده می‌شود.", "extras.hint.fileAs": "برای نگه داشتن {file}، نام فایل را خالی بگذارید.", "extras.hint.fileModes": "merge فایل را پیوند می‌دهد · copy یک نسخه می‌نویسد · import یک خط @ اضافه می‌کند، فقط برای ابزارهایی که importهای @ را می‌خوانند.", diff --git a/ui/src/i18n/locales/fr.json b/ui/src/i18n/locales/fr.json index b152b85b7..e7ddeace6 100644 --- a/ui/src/i18n/locales/fr.json +++ b/ui/src/i18n/locales/fr.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Dossier source", "extras.modal.sourceFolderHint": "Les extras d'un même dossier synchronisent chacun leur propre fichier.", "extras.modal.sourceFolderInvalid": "Saisissez un nom de dossier, pas un chemin.", + "extras.modal.existingFolders": "Existants :", "extras.modal.agentsNote": "Un extra dont le fichier est AGENTS.md apparaît dans l'onglet AGENTS.md.", "extras.hint.fileAs": "Laissez le nom du fichier vide pour garder {file}.", "extras.hint.fileModes": "merge crée un lien vers le fichier · copy écrit une copie · import ajoute une ligne @, uniquement pour les outils qui lisent les imports @.", diff --git a/ui/src/i18n/locales/id.json b/ui/src/i18n/locales/id.json index 54eff819f..134f8251d 100644 --- a/ui/src/i18n/locales/id.json +++ b/ui/src/i18n/locales/id.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Folder sumber", "extras.modal.sourceFolderHint": "Extra dalam folder yang sama masing-masing menyinkronkan filenya sendiri.", "extras.modal.sourceFolderInvalid": "Masukkan nama folder, bukan path.", + "extras.modal.existingFolders": "Yang ada:", "extras.modal.agentsNote": "Extra dengan file AGENTS.md muncul di tab AGENTS.md.", "extras.hint.fileAs": "Kosongkan Nama file untuk tetap memakai {file}.", "extras.hint.fileModes": "merge menautkan file · copy menulis salinan · import menambahkan baris @, hanya untuk alat yang membaca impor @.", diff --git a/ui/src/i18n/locales/ja.json b/ui/src/i18n/locales/ja.json index 53cadb88a..714726baa 100644 --- a/ui/src/i18n/locales/ja.json +++ b/ui/src/i18n/locales/ja.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "ソースフォルダー", "extras.modal.sourceFolderHint": "同じフォルダーの extra は、それぞれ自分のファイルを同期します。", "extras.modal.sourceFolderInvalid": "パスではなくフォルダー名を入力してください。", + "extras.modal.existingFolders": "既存のフォルダ:", "extras.modal.agentsNote": "ファイルが AGENTS.md の extra は「AGENTS.md」タブに表示されます。", "extras.hint.fileAs": "ファイル名を空にすると {file} のままになります。", "extras.hint.fileModes": "merge はファイルをリンク · copy はコピーを書き込み · import は @ 行を追加(@ インポートを読むツールのみ)。", diff --git a/ui/src/i18n/locales/ko.json b/ui/src/i18n/locales/ko.json index d3cd69a60..08a3245ee 100644 --- a/ui/src/i18n/locales/ko.json +++ b/ui/src/i18n/locales/ko.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "소스 폴더", "extras.modal.sourceFolderHint": "같은 폴더의 extra는 각자 자기 파일을 동기화합니다.", "extras.modal.sourceFolderInvalid": "경로가 아닌 폴더 이름을 입력하세요.", + "extras.modal.existingFolders": "기존 폴더:", "extras.modal.agentsNote": "파일이 AGENTS.md인 extra는 AGENTS.md 탭에 표시됩니다.", "extras.hint.fileAs": "파일 이름을 비워 두면 {file}을(를) 그대로 사용합니다.", "extras.hint.fileModes": "merge는 파일을 링크 · copy는 사본을 작성 · import는 @ 줄을 추가하며, @ import를 읽는 도구에서만 동작합니다.", diff --git a/ui/src/i18n/locales/pt-BR.json b/ui/src/i18n/locales/pt-BR.json index 1d10c6c69..b92e36edc 100644 --- a/ui/src/i18n/locales/pt-BR.json +++ b/ui/src/i18n/locales/pt-BR.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "Pasta de origem", "extras.modal.sourceFolderHint": "Extras na mesma pasta sincronizam cada um o seu próprio arquivo.", "extras.modal.sourceFolderInvalid": "Digite um nome de pasta, não um caminho.", + "extras.modal.existingFolders": "Existentes:", "extras.modal.agentsNote": "Um extra cujo arquivo é AGENTS.md aparece na aba AGENTS.md.", "extras.hint.fileAs": "Deixe o nome do arquivo vazio para manter {file}.", "extras.hint.fileModes": "merge cria um link para o arquivo · copy grava uma cópia · import adiciona uma linha @, só para ferramentas que leem imports @.", diff --git a/ui/src/i18n/locales/zh-CN.json b/ui/src/i18n/locales/zh-CN.json index 28ec36fb4..87b925c2c 100644 --- a/ui/src/i18n/locales/zh-CN.json +++ b/ui/src/i18n/locales/zh-CN.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "源文件夹", "extras.modal.sourceFolderHint": "同一文件夹中的 extra 各自同步自己的文件。", "extras.modal.sourceFolderInvalid": "请输入文件夹名称,而不是路径。", + "extras.modal.existingFolders": "现有文件夹:", "extras.modal.agentsNote": "文件为 AGENTS.md 的 extra 会显示在“AGENTS.md”标签页。", "extras.hint.fileAs": "文件名留空则保留 {file}。", "extras.hint.fileModes": "merge 链接文件 · copy 写入副本 · import 添加一行 @,仅适用于读取 @ import 的工具。", diff --git a/ui/src/i18n/locales/zh-TW.json b/ui/src/i18n/locales/zh-TW.json index 441d3a462..4b1cc4571 100644 --- a/ui/src/i18n/locales/zh-TW.json +++ b/ui/src/i18n/locales/zh-TW.json @@ -1076,6 +1076,7 @@ "extras.modal.sourceFolder": "來源資料夾", "extras.modal.sourceFolderHint": "同一個資料夾裡的 extra 各自同步自己的檔案。", "extras.modal.sourceFolderInvalid": "請輸入資料夾名稱,不是路徑。", + "extras.modal.existingFolders": "現有資料夾:", "extras.modal.agentsNote": "檔案是 AGENTS.md 的 extra 會顯示在「AGENTS.md」分頁。", "extras.hint.fileAs": "檔名留空就沿用 {file}。", "extras.hint.fileModes": "merge 連結檔案 · copy 寫入副本 · import 加一行 @,只適用於會讀 @ import 的工具。", diff --git a/ui/src/pages/ExtrasPage.test.tsx b/ui/src/pages/ExtrasPage.test.tsx index 2642f7fe8..9d9d3ea54 100644 --- a/ui/src/pages/ExtrasPage.test.tsx +++ b/ui/src/pages/ExtrasPage.test.tsx @@ -98,7 +98,7 @@ describe('Extras page in a project', () => { await user.click(within(dialog).getByRole('radio', { name: 'Single file' })); const [fileInput] = within(dialog).getAllByRole('textbox', { name: 'File name' }); await user.type(fileInput, 'review.md'); - await user.type(within(dialog).getByRole('combobox', { name: 'Source folder' }), 'prompts'); + await user.type(within(dialog).getByRole('textbox', { name: 'Source folder' }), 'prompts'); await user.type(within(dialog).getByRole('textbox', { name: 'Folder' }), '.claude/commands'); expect(within(dialog).getByText(/\/extras\/prompts\/review\.md/)).toBeInTheDocument(); await user.click(within(dialog).getByRole('button', { name: 'Create' })); @@ -110,4 +110,16 @@ describe('Extras page in a project', () => { targets: [{ path: '.claude/commands', mode: 'merge' }], }); }); + + it('fills the source folder from a folder another single-file extra uses', async () => { + vi.mocked(api.getOverview).mockResolvedValue({ extrasSource: '/p/.skillshare/extras' } as never); + const user = userEvent.setup(); + renderPage(); + await user.click(await screen.findByRole('button', { name: 'Add extra' })); + const dialog = screen.getByRole('dialog'); + await user.click(within(dialog).getByRole('radio', { name: 'Single file' })); + await user.click(await within(dialog).findByRole('button', { name: 'conventions' })); + expect(within(dialog).getByRole('textbox', { name: 'Source folder' })).toHaveValue('conventions'); + vi.mocked(api.getOverview).mockResolvedValue({} as never); + }); }); diff --git a/ui/src/pages/ExtrasPage.tsx b/ui/src/pages/ExtrasPage.tsx index 76536fe8d..f170bf3f3 100644 --- a/ui/src/pages/ExtrasPage.tsx +++ b/ui/src/pages/ExtrasPage.tsx @@ -296,11 +296,17 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir, fold ) : single ? ( <> - setFolder(e.target.value)} list="extra-folders" placeholder={name.trim() || t('extras.modal.namePlaceholder')} aria-label={t('extras.modal.sourceFolder')} aria-invalid={isPathLike(folderName)} disabled={saving} /> + setFolder(e.target.value)} placeholder={name.trim() || t('extras.modal.namePlaceholder')} aria-label={t('extras.modal.sourceFolder')} aria-invalid={isPathLike(folderName)} disabled={saving} /> - - {folders.map((f) => + {/* Folders other single-file extras use, one click to share one. */} + {folders.length > 0 && ( + + {t('extras.modal.existingFolders')} + {folders.map((f) => ( + + ))} + + )} {t(isPathLike(folderName) ? 'extras.modal.sourceFolderInvalid' : 'extras.modal.sourceFolderHint')} ) : (