#74 Bouton « Show where it is » dans l'arbre des fichiers d'un agent
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
255db2d parent: 6cced02 modified
.tickets/issues/0074-bouton-show-where-it-is-dans-l-arbre-des-fichier.yaml +17 -2 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-09T04:42:57.000Z |
| 9 | -updatedAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T04:50:50.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::workspace |
| @@ -36,4 +36,19 @@ body: | | ||
| 36 | 36 | - Libellé adapté au système (« Afficher dans le Finder », « Afficher dans l'Explorateur »…), EN + FR. |
| 37 | 37 | - Tests Go + frontend ; docs EN + FR. |
| 38 | 38 | tasks: [] |
| 39 | -comments: [] | |
| 39 | +comments: | |
| 40 | + - id: 1 | |
| 41 | + author: | |
| 42 | + name: k33g | |
| 43 | + email: ph.charriere@gmail.com | |
| 44 | + createdAt: 2026-11-09T04:50:50.000Z | |
| 45 | + body: | | |
| 46 | + Fait. | |
| 47 | + - Go : `WorkspaceInfo.Revealable` ([workspaces.go](internal/app/workspaces.go)) dit si le dossier de | |
| 48 | + l'agent est sur cet ordinateur (même règle que `hostFile` des fichiers liés) ; le bouton appelle | |
| 49 | + `WorkspaceService.Reveal`, déjà là. | |
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : **📂** au survol (et au focus clavier) de chaque | |
| 51 | + entrée, à côté de 🗑, et **📂 Show where it is** au-dessus du fichier ouvert ; caché sinon. | |
| 52 | + - Libellé : le même que le panneau des fichiers liés (« Show where it is » / « Afficher l'emplacement »), | |
| 53 | + pas de variante par système. Le menu contextuel viendra avec #70. | |
| 54 | + - Test Go ; guide « fichiers et terminal » EN + FR. | |
| @@ -6,7 +6,7 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-09T04:42:57.000Z | 8 | createdAt: 2026-11-09T04:42:57.000Z |
| 9 | -updatedAt: 2026-11-09T04:42:57.000Z | 9 | +updatedAt: 2026-11-09T04:50:50.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::workspace | 12 | - area::workspace |
| @@ -36,4 +36,19 @@ body: | | |||
| 36 | - Libellé adapté au système (« Afficher dans le Finder », « Afficher dans l'Explorateur »…), EN + FR. | 36 | - Libellé adapté au système (« Afficher dans le Finder », « Afficher dans l'Explorateur »…), EN + FR. |
| 37 | - Tests Go + frontend ; docs EN + FR. | 37 | - Tests Go + frontend ; docs EN + FR. |
| 38 | tasks: [] | 38 | tasks: [] |
| 39 | -comments: [] | 39 | +comments: |
| 40 | + - id: 1 | ||
| 41 | + author: | ||
| 42 | + name: k33g | ||
| 43 | + email: ph.charriere@gmail.com | ||
| 44 | + createdAt: 2026-11-09T04:50:50.000Z | ||
| 45 | + body: | | ||
| 46 | + Fait. | ||
| 47 | + - Go : `WorkspaceInfo.Revealable` ([workspaces.go](internal/app/workspaces.go)) dit si le dossier de | ||
| 48 | + l'agent est sur cet ordinateur (même règle que `hostFile` des fichiers liés) ; le bouton appelle | ||
| 49 | + `WorkspaceService.Reveal`, déjà là. | ||
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : **📂** au survol (et au focus clavier) de chaque | ||
| 51 | + entrée, à côté de 🗑, et **📂 Show where it is** au-dessus du fichier ouvert ; caché sinon. | ||
| 52 | + - Libellé : le même que le panneau des fichiers liés (« Show where it is » / « Afficher l'emplacement »), | ||
| 53 | + pas de variante par système. Le menu contextuel viendra avec #70. | ||
| 54 | + - Test Go ; guide « fichiers et terminal » EN + FR. | ||
modified
docs/en/how-to/work-with-an-agents-files.md +2 -0 | @@ -15,6 +15,8 @@ This guide shows how to look at what an agent produced, change its instructions, | ||
| 15 | 15 | Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. |
| 16 | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 17 | 17 | |
| 18 | +To find a file or a folder in the Finder (macOS), the Explorer (Windows) or the file manager (Linux), hover it in the tree and click **📂**, or click **📂 Show where it is** above the open file. The button shows only when the agent's folder is on this computer: an agent on this computer, or in a container or sandbox whose folder is mounted from here. | |
| 19 | + | |
| 18 | 20 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
| 19 | 21 | |
| 20 | 22 | ## Preview a document or an image |
| @@ -15,6 +15,8 @@ This guide shows how to look at what an agent produced, change its instructions, | |||
| 15 | Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. | 15 | Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. |
| 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 17 | 17 | ||
| 18 | +To find a file or a folder in the Finder (macOS), the Explorer (Windows) or the file manager (Linux), hover it in the tree and click **📂**, or click **📂 Show where it is** above the open file. The button shows only when the agent's folder is on this computer: an agent on this computer, or in a container or sandbox whose folder is mounted from here. | ||
| 19 | + | ||
| 18 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). | 20 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
| 19 | 21 | ||
| 20 | ## Preview a document or an image | 22 | ## Preview a document or an image |
modified
docs/fr/how-to/fichiers-et-terminal-d-un-agent.md +2 -0 | @@ -15,6 +15,8 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | ||
| 15 | 15 | Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. |
| 16 | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 17 | 17 | |
| 18 | +Pour retrouver un fichier ou un dossier dans le Finder (macOS), l'Explorateur (Windows) ou le gestionnaire de fichiers (Linux), survolez-le dans l'arbre et cliquez sur **📂**, ou cliquez sur **📂 Afficher l'emplacement** au-dessus du fichier ouvert. Le bouton n'apparaît que si le dossier de l'agent est sur cet ordinateur : un agent sur cet ordinateur, ou dans un conteneur ou une sandbox dont le dossier est monté depuis ici. | |
| 19 | + | |
| 18 | 20 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
| 19 | 21 | |
| 20 | 22 | ## Prévisualiser un document ou une image |
| @@ -15,6 +15,8 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | |||
| 15 | Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. | 15 | Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. |
| 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 17 | 17 | ||
| 18 | +Pour retrouver un fichier ou un dossier dans le Finder (macOS), l'Explorateur (Windows) ou le gestionnaire de fichiers (Linux), survolez-le dans l'arbre et cliquez sur **📂**, ou cliquez sur **📂 Afficher l'emplacement** au-dessus du fichier ouvert. Le bouton n'apparaît que si le dossier de l'agent est sur cet ordinateur : un agent sur cet ordinateur, ou dans un conteneur ou une sandbox dont le dossier est monté depuis ici. | ||
| 19 | + | ||
| 18 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). | 20 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
| 19 | 21 | ||
| 20 | ## Prévisualiser un document ou une image | 22 | ## Prévisualiser un document ou une image |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +6 -0 | @@ -181,4 +181,10 @@ export interface SaveResult { | ||
| 181 | 181 | export interface WorkspaceInfo { |
| 182 | 182 | "location": string; |
| 183 | 183 | "problem": string; |
| 184 | + | |
| 185 | + /** | |
| 186 | + * Revealable tells whether the folder is on this computer, so that its | |
| 187 | + * files can be shown in the Finder or the Explorer (issue #74). | |
| 188 | + */ | |
| 189 | + "revealable": boolean; | |
| 184 | 190 | } |
| @@ -181,4 +181,10 @@ export interface SaveResult { | |||
| 181 | export interface WorkspaceInfo { | 181 | export interface WorkspaceInfo { |
| 182 | "location": string; | 182 | "location": string; |
| 183 | "problem": string; | 183 | "problem": string; |
| 184 | + | ||
| 185 | + /** | ||
| 186 | + * Revealable tells whether the folder is on this computer, so that its | ||
| 187 | + * files can be shown in the Finder or the Explorer (issue #74). | ||
| 188 | + */ | ||
| 189 | + "revealable": boolean; | ||
| 184 | } | 190 | } |
modified
frontend/src/lib/agent/AgentView.svelte +3 -1 | @@ -25,6 +25,7 @@ | ||
| 25 | 25 | // shell survives a look at the files. |
| 26 | 26 | let terminalOpened = $state(false) |
| 27 | 27 | let location = $state('') |
| 28 | + let revealable = $state(false) | |
| 28 | 29 | let problem = $state('') |
| 29 | 30 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. |
| 30 | 31 | let confirmingRemove = $state(false) |
| @@ -50,6 +51,7 @@ | ||
| 50 | 51 | onMount(async () => { |
| 51 | 52 | const info = await WorkspaceService.Info(name) |
| 52 | 53 | location = info?.location ?? '' |
| 54 | + revealable = info?.revealable ?? false | |
| 53 | 55 | problem = info?.problem ?? '' |
| 54 | 56 | }) |
| 55 | 57 | </script> |
| @@ -102,7 +104,7 @@ | ||
| 102 | 104 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> |
| 103 | 105 | {:else} |
| 104 | 106 | <div class="pane" class:hidden={tab !== 'files'}> |
| 105 | - <FilesTab agent={name} inContainer={!location.startsWith('local')} /> | |
| 107 | + <FilesTab agent={name} inContainer={!location.startsWith('local')} {revealable} /> | |
| 106 | 108 | </div> |
| 107 | 109 | {#if terminalOpened} |
| 108 | 110 | <div class="pane" class:hidden={tab !== 'terminal'}> |
| @@ -25,6 +25,7 @@ | |||
| 25 | // shell survives a look at the files. | 25 | // shell survives a look at the files. |
| 26 | let terminalOpened = $state(false) | 26 | let terminalOpened = $state(false) |
| 27 | let location = $state('') | 27 | let location = $state('') |
| 28 | + let revealable = $state(false) | ||
| 28 | let problem = $state('') | 29 | let problem = $state('') |
| 29 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. | 30 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. |
| 30 | let confirmingRemove = $state(false) | 31 | let confirmingRemove = $state(false) |
| @@ -50,6 +51,7 @@ | |||
| 50 | onMount(async () => { | 51 | onMount(async () => { |
| 51 | const info = await WorkspaceService.Info(name) | 52 | const info = await WorkspaceService.Info(name) |
| 52 | location = info?.location ?? '' | 53 | location = info?.location ?? '' |
| 54 | + revealable = info?.revealable ?? false | ||
| 53 | problem = info?.problem ?? '' | 55 | problem = info?.problem ?? '' |
| 54 | }) | 56 | }) |
| 55 | </script> | 57 | </script> |
| @@ -102,7 +104,7 @@ | |||
| 102 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> | 104 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> |
| 103 | {:else} | 105 | {:else} |
| 104 | <div class="pane" class:hidden={tab !== 'files'}> | 106 | <div class="pane" class:hidden={tab !== 'files'}> |
| 105 | - <FilesTab agent={name} inContainer={!location.startsWith('local')} /> | 107 | + <FilesTab agent={name} inContainer={!location.startsWith('local')} {revealable} /> |
| 106 | </div> | 108 | </div> |
| 107 | {#if terminalOpened} | 109 | {#if terminalOpened} |
| 108 | <div class="pane" class:hidden={tab !== 'terminal'}> | 110 | <div class="pane" class:hidden={tab !== 'terminal'}> |
modified
frontend/src/lib/agent/FilesTab.svelte +25 -4 | @@ -13,7 +13,16 @@ | ||
| 13 | 13 | import FilePreview from './FilePreview.svelte' |
| 14 | 14 | import { previewKind } from '../preview' |
| 15 | 15 | |
| 16 | - let { agent, inContainer }: { agent: string; inContainer: boolean } = $props() | |
| 16 | + let { | |
| 17 | + agent, | |
| 18 | + inContainer, | |
| 19 | + revealable = false, | |
| 20 | + }: { | |
| 21 | + agent: string | |
| 22 | + inContainer: boolean | |
| 23 | + /** The folder is on this computer: its files can be shown in the Finder (issue #74). */ | |
| 24 | + revealable?: boolean | |
| 25 | + } = $props() | |
| 17 | 26 | |
| 18 | 27 | // The entries of each folder loaded so far, by folder path ("" is the root). |
| 19 | 28 | let listings: Record<string, Entry[]> = $state({}) |
| @@ -161,6 +170,11 @@ | ||
| 161 | 170 | }) |
| 162 | 171 | } |
| 163 | 172 | |
| 173 | + // Shows a file or a folder in the Finder, the Explorer or the file manager. | |
| 174 | + function reveal(path: string) { | |
| 175 | + void attempt(() => WorkspaceService.Reveal(agent, path)) | |
| 176 | + } | |
| 177 | + | |
| 164 | 178 | function focus(element: HTMLInputElement) { |
| 165 | 179 | element.focus() |
| 166 | 180 | } |
| @@ -224,10 +238,13 @@ | ||
| 224 | 238 | <span aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> |
| 225 | 239 | {entry.name} |
| 226 | 240 | </button> |
| 241 | + {#if revealable} | |
| 242 | + <button class="action" onclick={() => reveal(entry.path)} aria-label={t('workspace.revealEntry', { name: entry.name })} title={t('linked.reveal')}>📂</button> | |
| 243 | + {/if} | |
| 227 | 244 | {#if entry.protected} |
| 228 | 245 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> |
| 229 | 246 | {:else} |
| 230 | - <button class="remove" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | |
| 247 | + <button class="action" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | |
| 231 | 248 | {/if} |
| 232 | 249 | </li> |
| 233 | 250 | {#if confirming === entry.path} |
| @@ -258,6 +275,9 @@ | ||
| 258 | 275 | {#if file} |
| 259 | 276 | <header> |
| 260 | 277 | <span class="path">{file.path}</span> |
| 278 | + {#if revealable} | |
| 279 | + <button class="reveal" onclick={() => file && reveal(file.path)}>📂 {t('linked.reveal')}</button> | |
| 280 | + {/if} | |
| 261 | 281 | {#if kind && kind !== 'image'} |
| 262 | 282 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> |
| 263 | 283 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> |
| @@ -314,14 +334,15 @@ | ||
| 314 | 334 | li { display: flex; align-items: center; border-radius: 4px; } |
| 315 | 335 | li:hover, li.selected { background: var(--panel-2); } |
| 316 | 336 | .row { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } |
| 317 | - .remove { border: none; background: none; padding: 0 6px; font-size: 11px; opacity: 0; } | |
| 337 | + .action { border: none; background: none; padding: 0 4px; font-size: 11px; opacity: 0; } | |
| 338 | + .reveal { border: none; background: none; padding: 0; font-size: 12px; color: var(--accent); } | |
| 318 | 339 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } |
| 319 | 340 | .readonly { color: var(--muted); font-size: 12px; } |
| 320 | 341 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } |
| 321 | 342 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } |
| 322 | 343 | .modes button.active { background: var(--accent); color: #fff; } |
| 323 | 344 | .readonly-hint { color: var(--muted); font-size: 12px; } |
| 324 | - li:hover .remove { opacity: 1; } | |
| 345 | + li:hover .action, li:focus-within .action { opacity: 1; } | |
| 325 | 346 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } |
| 326 | 347 | .confirm span { flex-basis: 100%; } |
| 327 | 348 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } |
| @@ -13,7 +13,16 @@ | |||
| 13 | import FilePreview from './FilePreview.svelte' | 13 | import FilePreview from './FilePreview.svelte' |
| 14 | import { previewKind } from '../preview' | 14 | import { previewKind } from '../preview' |
| 15 | 15 | ||
| 16 | - let { agent, inContainer }: { agent: string; inContainer: boolean } = $props() | 16 | + let { |
| 17 | + agent, | ||
| 18 | + inContainer, | ||
| 19 | + revealable = false, | ||
| 20 | + }: { | ||
| 21 | + agent: string | ||
| 22 | + inContainer: boolean | ||
| 23 | + /** The folder is on this computer: its files can be shown in the Finder (issue #74). */ | ||
| 24 | + revealable?: boolean | ||
| 25 | + } = $props() | ||
| 17 | 26 | ||
| 18 | // The entries of each folder loaded so far, by folder path ("" is the root). | 27 | // The entries of each folder loaded so far, by folder path ("" is the root). |
| 19 | let listings: Record<string, Entry[]> = $state({}) | 28 | let listings: Record<string, Entry[]> = $state({}) |
| @@ -161,6 +170,11 @@ | |||
| 161 | }) | 170 | }) |
| 162 | } | 171 | } |
| 163 | 172 | ||
| 173 | + // Shows a file or a folder in the Finder, the Explorer or the file manager. | ||
| 174 | + function reveal(path: string) { | ||
| 175 | + void attempt(() => WorkspaceService.Reveal(agent, path)) | ||
| 176 | + } | ||
| 177 | + | ||
| 164 | function focus(element: HTMLInputElement) { | 178 | function focus(element: HTMLInputElement) { |
| 165 | element.focus() | 179 | element.focus() |
| 166 | } | 180 | } |
| @@ -224,10 +238,13 @@ | |||
| 224 | <span aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | 238 | <span aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> |
| 225 | {entry.name} | 239 | {entry.name} |
| 226 | </button> | 240 | </button> |
| 241 | + {#if revealable} | ||
| 242 | + <button class="action" onclick={() => reveal(entry.path)} aria-label={t('workspace.revealEntry', { name: entry.name })} title={t('linked.reveal')}>📂</button> | ||
| 243 | + {/if} | ||
| 227 | {#if entry.protected} | 244 | {#if entry.protected} |
| 228 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> | 245 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> |
| 229 | {:else} | 246 | {:else} |
| 230 | - <button class="remove" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | 247 | + <button class="action" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> |
| 231 | {/if} | 248 | {/if} |
| 232 | </li> | 249 | </li> |
| 233 | {#if confirming === entry.path} | 250 | {#if confirming === entry.path} |
| @@ -258,6 +275,9 @@ | |||
| 258 | {#if file} | 275 | {#if file} |
| 259 | <header> | 276 | <header> |
| 260 | <span class="path">{file.path}</span> | 277 | <span class="path">{file.path}</span> |
| 278 | + {#if revealable} | ||
| 279 | + <button class="reveal" onclick={() => file && reveal(file.path)}>📂 {t('linked.reveal')}</button> | ||
| 280 | + {/if} | ||
| 261 | {#if kind && kind !== 'image'} | 281 | {#if kind && kind !== 'image'} |
| 262 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> | 282 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> |
| 263 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> | 283 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> |
| @@ -314,14 +334,15 @@ | |||
| 314 | li { display: flex; align-items: center; border-radius: 4px; } | 334 | li { display: flex; align-items: center; border-radius: 4px; } |
| 315 | li:hover, li.selected { background: var(--panel-2); } | 335 | li:hover, li.selected { background: var(--panel-2); } |
| 316 | .row { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | 336 | .row { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } |
| 317 | - .remove { border: none; background: none; padding: 0 6px; font-size: 11px; opacity: 0; } | 337 | + .action { border: none; background: none; padding: 0 4px; font-size: 11px; opacity: 0; } |
| 338 | + .reveal { border: none; background: none; padding: 0; font-size: 12px; color: var(--accent); } | ||
| 318 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } | 339 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } |
| 319 | .readonly { color: var(--muted); font-size: 12px; } | 340 | .readonly { color: var(--muted); font-size: 12px; } |
| 320 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } | 341 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } |
| 321 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } | 342 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } |
| 322 | .modes button.active { background: var(--accent); color: #fff; } | 343 | .modes button.active { background: var(--accent); color: #fff; } |
| 323 | .readonly-hint { color: var(--muted); font-size: 12px; } | 344 | .readonly-hint { color: var(--muted); font-size: 12px; } |
| 324 | - li:hover .remove { opacity: 1; } | 345 | + li:hover .action, li:focus-within .action { opacity: 1; } |
| 325 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } | 346 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } |
| 326 | .confirm span { flex-basis: 100%; } | 347 | .confirm span { flex-basis: 100%; } |
| 327 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } | 348 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } |
modified
frontend/src/lib/i18n/messages.ts +2 -0 | @@ -221,6 +221,7 @@ export const en = { | ||
| 221 | 221 | 'linked.label': 'The file {file}', |
| 222 | 222 | 'linked.close': 'Close (Esc)', |
| 223 | 223 | 'linked.reveal': 'Show where it is', |
| 224 | + 'workspace.revealEntry': 'Show where {name} is', | |
| 224 | 225 | 'linked.openInFiles': "Open in the agent's files", |
| 225 | 226 | 'linked.reload': 'Read the file again', |
| 226 | 227 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', |
| @@ -568,6 +569,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 568 | 569 | 'linked.label': 'Le fichier {file}', |
| 569 | 570 | 'linked.close': 'Fermer (Échap)', |
| 570 | 571 | 'linked.reveal': "Afficher l'emplacement", |
| 572 | + 'workspace.revealEntry': "Afficher l'emplacement de {name}", | |
| 571 | 573 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", |
| 572 | 574 | 'linked.reload': 'Relire le fichier', |
| 573 | 575 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', |
| @@ -221,6 +221,7 @@ export const en = { | |||
| 221 | 'linked.label': 'The file {file}', | 221 | 'linked.label': 'The file {file}', |
| 222 | 'linked.close': 'Close (Esc)', | 222 | 'linked.close': 'Close (Esc)', |
| 223 | 'linked.reveal': 'Show where it is', | 223 | 'linked.reveal': 'Show where it is', |
| 224 | + 'workspace.revealEntry': 'Show where {name} is', | ||
| 224 | 'linked.openInFiles': "Open in the agent's files", | 225 | 'linked.openInFiles': "Open in the agent's files", |
| 225 | 'linked.reload': 'Read the file again', | 226 | 'linked.reload': 'Read the file again', |
| 226 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', | 227 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', |
| @@ -568,6 +569,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 568 | 'linked.label': 'Le fichier {file}', | 569 | 'linked.label': 'Le fichier {file}', |
| 569 | 'linked.close': 'Fermer (Échap)', | 570 | 'linked.close': 'Fermer (Échap)', |
| 570 | 'linked.reveal': "Afficher l'emplacement", | 571 | 'linked.reveal': "Afficher l'emplacement", |
| 572 | + 'workspace.revealEntry': "Afficher l'emplacement de {name}", | ||
| 571 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", | 573 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", |
| 572 | 'linked.reload': 'Relire le fichier', | 574 | 'linked.reload': 'Relire le fichier', |
| 573 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', | 575 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', |
modified
internal/app/app_test.go +1 -1 | @@ -352,7 +352,7 @@ func workspaceCore(t *testing.T) (*app.Core, string, *events.Recorder) { | ||
| 352 | 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { |
| 353 | 353 | core, folder, _ := workspaceCore(t) |
| 354 | 354 | service := &app.WorkspaceService{Core: core} |
| 355 | - if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" { | |
| 355 | + if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" || !info.Revealable { | |
| 356 | 356 | t.Fatalf("info: %+v", info) |
| 357 | 357 | } |
| 358 | 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { |
| @@ -352,7 +352,7 @@ func workspaceCore(t *testing.T) (*app.Core, string, *events.Recorder) { | |||
| 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { | 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { |
| 353 | core, folder, _ := workspaceCore(t) | 353 | core, folder, _ := workspaceCore(t) |
| 354 | service := &app.WorkspaceService{Core: core} | 354 | service := &app.WorkspaceService{Core: core} |
| 355 | - if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" { | 355 | + if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" || !info.Revealable { |
| 356 | t.Fatalf("info: %+v", info) | 356 | t.Fatalf("info: %+v", info) |
| 357 | } | 357 | } |
| 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { | 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { |
modified
internal/app/workspaces.go +6 -1 | @@ -64,6 +64,9 @@ type WorkspaceService struct { | ||
| 64 | 64 | type WorkspaceInfo struct { |
| 65 | 65 | Location string `json:"location"` |
| 66 | 66 | Problem string `json:"problem"` |
| 67 | + // Revealable tells whether the folder is on this computer, so that its | |
| 68 | + // files can be shown in the Finder or the Explorer (issue #74). | |
| 69 | + Revealable bool `json:"revealable"` | |
| 67 | 70 | } |
| 68 | 71 | |
| 69 | 72 | // SaveResult is the outcome of a save: the new file, or a conflict when the |
| @@ -79,7 +82,9 @@ func (s *WorkspaceService) Info(agent string) WorkspaceInfo { | ||
| 79 | 82 | if err != nil { |
| 80 | 83 | return WorkspaceInfo{Problem: err.Error()} |
| 81 | 84 | } |
| 82 | - return WorkspaceInfo{Location: ws.Location()} | |
| 85 | + definition, _ := s.Core.manager.Definition(agent) | |
| 86 | + _, hostErr := hostFile(definition, "") | |
| 87 | + return WorkspaceInfo{Location: ws.Location(), Revealable: hostErr == nil} | |
| 83 | 88 | } |
| 84 | 89 | |
| 85 | 90 | // List returns the entries of a folder of the agent ("" for its root), |
| @@ -64,6 +64,9 @@ type WorkspaceService struct { | |||
| 64 | type WorkspaceInfo struct { | 64 | type WorkspaceInfo struct { |
| 65 | Location string `json:"location"` | 65 | Location string `json:"location"` |
| 66 | Problem string `json:"problem"` | 66 | Problem string `json:"problem"` |
| 67 | + // Revealable tells whether the folder is on this computer, so that its | ||
| 68 | + // files can be shown in the Finder or the Explorer (issue #74). | ||
| 69 | + Revealable bool `json:"revealable"` | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | // SaveResult is the outcome of a save: the new file, or a conflict when the | 72 | // SaveResult is the outcome of a save: the new file, or a conflict when the |
| @@ -79,7 +82,9 @@ func (s *WorkspaceService) Info(agent string) WorkspaceInfo { | |||
| 79 | if err != nil { | 82 | if err != nil { |
| 80 | return WorkspaceInfo{Problem: err.Error()} | 83 | return WorkspaceInfo{Problem: err.Error()} |
| 81 | } | 84 | } |
| 82 | - return WorkspaceInfo{Location: ws.Location()} | 85 | + definition, _ := s.Core.manager.Definition(agent) |
| 86 | + _, hostErr := hostFile(definition, "") | ||
| 87 | + return WorkspaceInfo{Location: ws.Location(), Revealable: hostErr == nil} | ||
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | // List returns the entries of a folder of the agent ("" for its root), | 90 | // List returns the entries of a folder of the agent ("" for its root), |