bots-garden/sidekickspublic Fork
⑂ 95bbae3
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Merge feature/117-linked-code-colours into main

agent committed 2026-11-15T19:38:25+01:00 Browse files
95bbae3 parents: 713ea6e 8c3138a
modified .memory/history.md +2 -0
@@ -374,3 +374,5 @@
374374 - **2026-11-15 — #111 composer height** (branch feature/111-composer-height): fit() in a $effect on text + window resize (was only in onInput); composerHeight() in composer.ts with a test; Xvfb: send / ↑ / ↓ resize correctly. Release notes v1.7.0. Not committed; #111 open for the owner's test.
375375 - **2026-11-15 — tickets #117** (code of a linked source file not coloured: LinkedFilePanel shows <pre>) **and #118** (↑ recall works with mini-me kept sessions, not other agents; composer history is in-memory per Composer — to reproduce). Owner restated #111 (reset after send) — already what the branch does; likely an old build on the Mac.
376376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).
377+- **2026-11-15 — #117** (branch feature/117-linked-code-colours): LinkedFilePanel shows source code in a read-only FileEditor (codeLanguage() in files.ts); Xvfb light/dark/read-only. #118: owner wants the ↑ history per channel (comment + acceptance criterion added). Not committed.
378+- **2026-11-15 — #117 closed** (owner); feature/117-linked-code-colours merged into main with the #118 per-channel note (not pushed).
@@ -374,3 +374,5 @@
374 - **2026-11-15 — #111 composer height** (branch feature/111-composer-height): fit() in a $effect on text + window resize (was only in onInput); composerHeight() in composer.ts with a test; Xvfb: send / ↑ / ↓ resize correctly. Release notes v1.7.0. Not committed; #111 open for the owner's test.374 - **2026-11-15 — #111 composer height** (branch feature/111-composer-height): fit() in a $effect on text + window resize (was only in onInput); composerHeight() in composer.ts with a test; Xvfb: send / ↑ / ↓ resize correctly. Release notes v1.7.0. Not committed; #111 open for the owner's test.
375 - **2026-11-15 — tickets #117** (code of a linked source file not coloured: LinkedFilePanel shows <pre>) **and #118** (↑ recall works with mini-me kept sessions, not other agents; composer history is in-memory per Composer — to reproduce). Owner restated #111 (reset after send) — already what the branch does; likely an old build on the Mac.375 - **2026-11-15 — tickets #117** (code of a linked source file not coloured: LinkedFilePanel shows <pre>) **and #118** (↑ recall works with mini-me kept sessions, not other agents; composer history is in-memory per Composer — to reproduce). Owner restated #111 (reset after send) — already what the branch does; likely an old build on the Mac.
376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).376 - **2026-11-15 — #111 closed** (owner); feature/111-composer-height merged into main with tickets #117, #118 (not pushed).
377+- **2026-11-15 — #117** (branch feature/117-linked-code-colours): LinkedFilePanel shows source code in a read-only FileEditor (codeLanguage() in files.ts); Xvfb light/dark/read-only. #118: owner wants the ↑ history per channel (comment + acceptance criterion added). Not committed.
378+- **2026-11-15 — #117 closed** (owner); feature/117-linked-code-colours merged into main with the #118 per-channel note (not pushed).
modified .tickets/issues/0117-panneau-d-un-fichier-lie-colorer-le-code-source.yaml +31 -6
@@ -1,12 +1,12 @@
11 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
22 id: 117
33 title: "Panneau d'un fichier lié : colorer le code source"
4-state: open
4+state: closed
55 author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:23:34.000Z
9+updatedAt: 2026-11-15T18:38:25.000Z
1010 labels:
1111 - kind::feature
1212 - area::ui
@@ -42,26 +42,51 @@ body: |
4242 tasks:
4343 - id: 1
4444 title: "Choisir la coloration (Shiki ou CodeMirror en lecture seule) et le langage d'après l'extension"
45- state: open
45+ state: closed
4646 priority: high
4747 author:
4848 name: k33g
4949 email: ph.charriere@gmail.com
5050 createdAt: 2026-11-15T18:23:34.000Z
51+ updatedAt: 2026-11-15T18:34:01.000Z
52+ closedAt: 2026-11-15T18:34:01.000Z
5153 - id: 2
5254 title: "Colorer le code dans LinkedFilePanel (thème clair/sombre, gros fichiers)"
53- state: open
55+ state: closed
5456 priority: high
5557 author:
5658 name: k33g
5759 email: ph.charriere@gmail.com
5860 createdAt: 2026-11-15T18:23:34.000Z
61+ updatedAt: 2026-11-15T18:34:01.000Z
62+ closedAt: 2026-11-15T18:34:01.000Z
5963 - id: 3
6064 title: "Tests vitest, doc EN + FR, notes de release v1.7.0"
61- state: open
65+ state: closed
6266 priority: medium
6367 author:
6468 name: k33g
6569 email: ph.charriere@gmail.com
6670 createdAt: 2026-11-15T18:23:34.000Z
67-comments: []
71+ updatedAt: 2026-11-15T18:34:01.000Z
72+ closedAt: 2026-11-15T18:34:01.000Z
73+comments:
74+ - id: 1
75+ author:
76+ name: k33g
77+ email: ph.charriere@gmail.com
78+ createdAt: 2026-11-15T18:34:01.000Z
79+ body: |
80+ Fait sur `feature/117-linked-code-colours`, selon la recommandation : **CodeMirror en lecture seule** (le
81+ `FileEditor` de l'onglet Fichiers avec `readOnly`), langage d'après le nom ou l'extension (`codeLanguage` =
82+ `languageFor` sauf `text`, ~30 langages) ; mêmes couleurs, numéros de ligne, thème sombre One Dark ; un gros
83+ fichier reste sans couleurs (`maxHighlightedSize`), un langage inconnu en texte brut. Vérifié sous Xvfb avec un
84+ faux agent qui répond par un lien vers `main.go` : couleurs en clair et en sombre, frappe sans effet. Doc EN + FR,
85+ notes v1.7.0. Reste : le test de l'owner.
86+ - id: 2
87+ author:
88+ name: k33g
89+ email: ph.charriere@gmail.com
90+ createdAt: 2026-11-15T18:38:25.000Z
91+ body: |
92+ Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé.
@@ -1,12 +1,12 @@
1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2 id: 1172 id: 117
3 title: "Panneau d'un fichier lié : colorer le code source"3 title: "Panneau d'un fichier lié : colorer le code source"
4-state: open4+state: closed
5 author:5 author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-15T18:23:34.000Z8 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:23:34.000Z9+updatedAt: 2026-11-15T18:38:25.000Z
10 labels:10 labels:
11 - kind::feature11 - kind::feature
12 - area::ui12 - area::ui
@@ -42,26 +42,51 @@ body: |
42 tasks:42 tasks:
43 - id: 143 - id: 1
44 title: "Choisir la coloration (Shiki ou CodeMirror en lecture seule) et le langage d'après l'extension"44 title: "Choisir la coloration (Shiki ou CodeMirror en lecture seule) et le langage d'après l'extension"
45- state: open45+ state: closed
46 priority: high46 priority: high
47 author:47 author:
48 name: k33g48 name: k33g
49 email: ph.charriere@gmail.com49 email: ph.charriere@gmail.com
50 createdAt: 2026-11-15T18:23:34.000Z50 createdAt: 2026-11-15T18:23:34.000Z
51+ updatedAt: 2026-11-15T18:34:01.000Z
52+ closedAt: 2026-11-15T18:34:01.000Z
51 - id: 253 - id: 2
52 title: "Colorer le code dans LinkedFilePanel (thème clair/sombre, gros fichiers)"54 title: "Colorer le code dans LinkedFilePanel (thème clair/sombre, gros fichiers)"
53- state: open55+ state: closed
54 priority: high56 priority: high
55 author:57 author:
56 name: k33g58 name: k33g
57 email: ph.charriere@gmail.com59 email: ph.charriere@gmail.com
58 createdAt: 2026-11-15T18:23:34.000Z60 createdAt: 2026-11-15T18:23:34.000Z
61+ updatedAt: 2026-11-15T18:34:01.000Z
62+ closedAt: 2026-11-15T18:34:01.000Z
59 - id: 363 - id: 3
60 title: "Tests vitest, doc EN + FR, notes de release v1.7.0"64 title: "Tests vitest, doc EN + FR, notes de release v1.7.0"
61- state: open65+ state: closed
62 priority: medium66 priority: medium
63 author:67 author:
64 name: k33g68 name: k33g
65 email: ph.charriere@gmail.com69 email: ph.charriere@gmail.com
66 createdAt: 2026-11-15T18:23:34.000Z70 createdAt: 2026-11-15T18:23:34.000Z
67-comments: []71+ updatedAt: 2026-11-15T18:34:01.000Z
72+ closedAt: 2026-11-15T18:34:01.000Z
73+comments:
74+ - id: 1
75+ author:
76+ name: k33g
77+ email: ph.charriere@gmail.com
78+ createdAt: 2026-11-15T18:34:01.000Z
79+ body: |
80+ Fait sur `feature/117-linked-code-colours`, selon la recommandation : **CodeMirror en lecture seule** (le
81+ `FileEditor` de l'onglet Fichiers avec `readOnly`), langage d'après le nom ou l'extension (`codeLanguage` =
82+ `languageFor` sauf `text`, ~30 langages) ; mêmes couleurs, numéros de ligne, thème sombre One Dark ; un gros
83+ fichier reste sans couleurs (`maxHighlightedSize`), un langage inconnu en texte brut. Vérifié sous Xvfb avec un
84+ faux agent qui répond par un lien vers `main.go` : couleurs en clair et en sombre, frappe sans effet. Doc EN + FR,
85+ notes v1.7.0. Reste : le test de l'owner.
86+ - id: 2
87+ author:
88+ name: k33g
89+ email: ph.charriere@gmail.com
90+ createdAt: 2026-11-15T18:38:25.000Z
91+ body: |
92+ Testé sur le Mac par l'owner : ça fonctionne. Mergé dans main. Ticket fermé.
modified .tickets/issues/0118-rappeler-les-derniers-messages-avec-pour-tous-le.yaml +11 -2
@@ -6,7 +6,7 @@ author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:23:34.000Z
9+updatedAt: 2026-11-15T18:34:01.000Z
1010 labels:
1111 - kind::bug
1212 - area::ui
@@ -34,6 +34,7 @@ body: |
3434 conversation, même après un changement de channel ou un redémarrage.
3535
3636 ## Critères d'acceptation
37+ - L'historique est **par channel** (et par conversation directe) : ↑ ne rappelle jamais un message d'un autre channel.
3738 - Dans une conversation ou un channel, ↑ rappelle les derniers messages envoyés, quel que soit le type d'agent,
3839 y compris après être revenu sur le channel ou avoir relancé Sidekicks.
3940 - ↓ revient au brouillon en cours ; pas de doublons consécutifs ; tests vitest ; notes de release v1.7.0.
@@ -62,4 +63,12 @@ tasks:
6263 name: k33g
6364 email: ph.charriere@gmail.com
6465 createdAt: 2026-11-15T18:23:34.000Z
65-comments: []
66+comments:
67+ - id: 1
68+ author:
69+ name: k33g
70+ email: ph.charriere@gmail.com
71+ createdAt: 2026-11-15T18:34:01.000Z
72+ body: |
73+ Précision de l'owner : **l'historique est par channel** — dans un channel, ↑ ne rappelle que les messages envoyés
74+ dans ce channel (ou cette conversation directe), jamais ceux d'un autre channel.
@@ -6,7 +6,7 @@ author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-15T18:23:34.000Z8 createdAt: 2026-11-15T18:23:34.000Z
9-updatedAt: 2026-11-15T18:23:34.000Z9+updatedAt: 2026-11-15T18:34:01.000Z
10 labels:10 labels:
11 - kind::bug11 - kind::bug
12 - area::ui12 - area::ui
@@ -34,6 +34,7 @@ body: |
34 conversation, même après un changement de channel ou un redémarrage.34 conversation, même après un changement de channel ou un redémarrage.
35 35
36 ## Critères d'acceptation36 ## Critères d'acceptation
37+ - L'historique est **par channel** (et par conversation directe) : ↑ ne rappelle jamais un message d'un autre channel.
37 - Dans une conversation ou un channel, ↑ rappelle les derniers messages envoyés, quel que soit le type d'agent,38 - Dans une conversation ou un channel, ↑ rappelle les derniers messages envoyés, quel que soit le type d'agent,
38 y compris après être revenu sur le channel ou avoir relancé Sidekicks.39 y compris après être revenu sur le channel ou avoir relancé Sidekicks.
39 - ↓ revient au brouillon en cours ; pas de doublons consécutifs ; tests vitest ; notes de release v1.7.0.40 - ↓ revient au brouillon en cours ; pas de doublons consécutifs ; tests vitest ; notes de release v1.7.0.
@@ -62,4 +63,12 @@ tasks:
62 name: k33g63 name: k33g
63 email: ph.charriere@gmail.com64 email: ph.charriere@gmail.com
64 createdAt: 2026-11-15T18:23:34.000Z65 createdAt: 2026-11-15T18:23:34.000Z
65-comments: []66+comments:
67+ - id: 1
68+ author:
69+ name: k33g
70+ email: ph.charriere@gmail.com
71+ createdAt: 2026-11-15T18:34:01.000Z
72+ body: |
73+ Précision de l'owner : **l'historique est par channel** — dans un channel, ↑ ne rappelle que les messages envoyés
74+ dans ce channel (ou cette conversation directe), jamais ceux d'un autre channel.
modified docs/en/how-to/work-with-an-agents-files.md +1 -1
@@ -32,7 +32,7 @@ Markdown (`.md`), AsciiDoc (`.adoc`, `.asciidoc`, `.asc`) and HTML (`.html`, `.h
3232
3333 When an agent writes a document and gives a link to it in its answer, click the link: the file opens in a panel at the right of the conversation, which stays in view.
3434
35-- The panel previews Markdown, AsciiDoc, HTML and images as above, and shows any other text file as is. Links of the document to other files of the folder open in the same panel.
35+- The panel previews Markdown, AsciiDoc, HTML and images as above. Source code (Go, TypeScript, Python, shell, YAML… the languages of the editor) is coloured like in the **Files** tab, read-only, with line numbers (issue #117); any other text file is shown as is. Links of the document to other files of the folder open in the same panel.
3636 - **📂 Show where it is** opens the Finder (macOS) or the Explorer (Windows) with the file selected. It 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.
3737 - **Open in the agent's files** shows the file in the **Files** tab, to change it. **↻** reads it again after the agent changed it.
3838 - **×** or **Escape** closes the panel; drag its left edge to resize it.
@@ -32,7 +32,7 @@ Markdown (`.md`), AsciiDoc (`.adoc`, `.asciidoc`, `.asc`) and HTML (`.html`, `.h
32 32
33 When an agent writes a document and gives a link to it in its answer, click the link: the file opens in a panel at the right of the conversation, which stays in view.33 When an agent writes a document and gives a link to it in its answer, click the link: the file opens in a panel at the right of the conversation, which stays in view.
34 34
35-- The panel previews Markdown, AsciiDoc, HTML and images as above, and shows any other text file as is. Links of the document to other files of the folder open in the same panel.35+- The panel previews Markdown, AsciiDoc, HTML and images as above. Source code (Go, TypeScript, Python, shell, YAML… the languages of the editor) is coloured like in the **Files** tab, read-only, with line numbers (issue #117); any other text file is shown as is. Links of the document to other files of the folder open in the same panel.
36 - **📂 Show where it is** opens the Finder (macOS) or the Explorer (Windows) with the file selected. It 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.36 - **📂 Show where it is** opens the Finder (macOS) or the Explorer (Windows) with the file selected. It 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.
37 - **Open in the agent's files** shows the file in the **Files** tab, to change it. **↻** reads it again after the agent changed it.37 - **Open in the agent's files** shows the file in the **Files** tab, to change it. **↻** reads it again after the agent changed it.
38 - **×** or **Escape** closes the panel; drag its left edge to resize it.38 - **×** or **Escape** closes the panel; drag its left edge to resize it.
modified docs/fr/how-to/fichiers-et-terminal-d-un-agent.md +1 -1
@@ -32,7 +32,7 @@ Les fichiers Markdown (`.md`), AsciiDoc (`.adoc`, `.asciidoc`, `.asc`) et HTML (
3232
3333 Quand un agent écrit un document et donne un lien vers lui dans sa réponse, cliquez sur le lien : le fichier s'ouvre dans un panneau à droite de la conversation, qui reste visible.
3434
35-- Le panneau prévisualise le Markdown, l'AsciiDoc, le HTML et les images comme ci-dessus, et affiche tout autre fichier texte tel quel. Les liens du document vers d'autres fichiers du dossier s'ouvrent dans le même panneau.
35+- Le panneau prévisualise le Markdown, l'AsciiDoc, le HTML et les images comme ci-dessus. Le code source (Go, TypeScript, Python, shell, YAML… les langages de l'éditeur) est coloré comme dans l'onglet **Fichiers**, en lecture seule, avec les numéros de ligne (issue #117) ; tout autre fichier texte est affiché tel quel. Les liens du document vers d'autres fichiers du dossier s'ouvrent dans le même panneau.
3636 - **📂 Afficher l'emplacement** ouvre le Finder (macOS) ou l'Explorateur (Windows) avec le fichier sélectionné. Il 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 celui-ci.
3737 - **Ouvrir dans les fichiers de l'agent** montre le fichier dans l'onglet **Files**, pour le modifier. **↻** le relit après un changement de l'agent.
3838 - **×** ou **Échap** ferme le panneau ; faites glisser son bord gauche pour le redimensionner.
@@ -32,7 +32,7 @@ Les fichiers Markdown (`.md`), AsciiDoc (`.adoc`, `.asciidoc`, `.asc`) et HTML (
32 32
33 Quand un agent écrit un document et donne un lien vers lui dans sa réponse, cliquez sur le lien : le fichier s'ouvre dans un panneau à droite de la conversation, qui reste visible.33 Quand un agent écrit un document et donne un lien vers lui dans sa réponse, cliquez sur le lien : le fichier s'ouvre dans un panneau à droite de la conversation, qui reste visible.
34 34
35-- Le panneau prévisualise le Markdown, l'AsciiDoc, le HTML et les images comme ci-dessus, et affiche tout autre fichier texte tel quel. Les liens du document vers d'autres fichiers du dossier s'ouvrent dans le même panneau.35+- Le panneau prévisualise le Markdown, l'AsciiDoc, le HTML et les images comme ci-dessus. Le code source (Go, TypeScript, Python, shell, YAML… les langages de l'éditeur) est coloré comme dans l'onglet **Fichiers**, en lecture seule, avec les numéros de ligne (issue #117) ; tout autre fichier texte est affiché tel quel. Les liens du document vers d'autres fichiers du dossier s'ouvrent dans le même panneau.
36 - **📂 Afficher l'emplacement** ouvre le Finder (macOS) ou l'Explorateur (Windows) avec le fichier sélectionné. Il 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 celui-ci.36 - **📂 Afficher l'emplacement** ouvre le Finder (macOS) ou l'Explorateur (Windows) avec le fichier sélectionné. Il 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 celui-ci.
37 - **Ouvrir dans les fichiers de l'agent** montre le fichier dans l'onglet **Files**, pour le modifier. **↻** le relit après un changement de l'agent.37 - **Ouvrir dans les fichiers de l'agent** montre le fichier dans l'onglet **Files**, pour le modifier. **↻** le relit après un changement de l'agent.
38 - **×** ou **Échap** ferme le panneau ; faites glisser son bord gauche pour le redimensionner.38 - **×** ou **Échap** ferme le panneau ; faites glisser son bord gauche pour le redimensionner.
modified docs/release-notes/v1.7.0.fr.md +1 -0
@@ -15,4 +15,5 @@ Brouillon — complété au fil des tickets de la 1.7.0.
1515
1616 ### Petits changements
1717
18+- Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117).
1819 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).
@@ -15,4 +15,5 @@ Brouillon — complété au fil des tickets de la 1.7.0.
15 15
16 ### Petits changements16 ### Petits changements
17 17
18+- Le code d'un fichier dont un agent donne le lien dans sa réponse est maintenant coloré dans le panneau à côté de la conversation, comme dans l'onglet Fichiers, en lecture seule (#117).
18 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).19 - La zone de saisie grandit avec un long message et reprend maintenant sa taille une fois le message envoyé, ou quand ↑ / ↓ rappellent un message plus court (#111).
modified docs/release-notes/v1.7.0.md +1 -0
@@ -15,4 +15,5 @@ Draft — completed as the 1.7.0 tickets are done.
1515
1616 ### Smaller changes
1717
18+- The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117).
1819 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).
@@ -15,4 +15,5 @@ Draft — completed as the 1.7.0 tickets are done.
15 15
16 ### Smaller changes16 ### Smaller changes
17 17
18+- The code of a file an agent links to in its answer is now coloured in the panel beside the conversation, like in the Files tab, read-only (#117).
18 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).19 - The message box grows with a long message and now shrinks back once it is sent, or when ↑ / ↓ bring back a shorter message (#111).
modified frontend/src/lib/agent/LinkedFilePanel.svelte +10 -0
@@ -8,10 +8,14 @@
88 import { previewKind } from '../preview'
99 import { act, agentTitle, appState, closeLinkedFile, openLinkedFile, openWorkspace, type LinkedView } from '../state.svelte'
1010 import FilePreview from './FilePreview.svelte'
11+ import FileEditor from './FileEditor.svelte'
12+ import { codeLanguage } from '../files'
1113
1214 let { linked }: { linked: LinkedView } = $props()
1315
1416 const kind = $derived(previewKind(linked.path))
17+ // Source code is coloured like in the Files tab, read-only (issue #117).
18+ const language = $derived(codeLanguage(linked.path))
1519 const name = $derived(linked.path.slice(linked.path.lastIndexOf('/') + 1))
1620 let content = $state('')
1721 let problem = $state('')
@@ -73,6 +77,11 @@
7377 <p class="muted">…</p>
7478 {:else if kind}
7579 <FilePreview agent={linked.agent} path={linked.path} {content} {kind} {revision} onFile={(file) => openLinkedFile(linked.channel, linked.agent, file)} />
80+ {:else if language}
81+ <!-- Shown again from scratch when the file is read again (↻ or the agent's changes). -->
82+ {#key content}
83+ <div class="code"><FileEditor {content} {language} readOnly onChange={() => {}} onSave={() => {}} /></div>
84+ {/key}
7685 {:else}
7786 <pre>{content}</pre>
7887 {/if}
@@ -89,6 +98,7 @@
8998 .actions { grid-column: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; }
9099 .actions button { font-size: 12px; padding: 2px 8px; }
91100 .body { flex: 1; min-height: 0; padding: 10px 12px; overflow: auto; }
101+ .code { height: 100%; }
92102 pre { margin: 0; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; }
93103 .problem { color: var(--danger); font-size: 13px; }
94104 .muted { color: var(--muted); }
@@ -8,10 +8,14 @@
8 import { previewKind } from '../preview'8 import { previewKind } from '../preview'
9 import { act, agentTitle, appState, closeLinkedFile, openLinkedFile, openWorkspace, type LinkedView } from '../state.svelte'9 import { act, agentTitle, appState, closeLinkedFile, openLinkedFile, openWorkspace, type LinkedView } from '../state.svelte'
10 import FilePreview from './FilePreview.svelte'10 import FilePreview from './FilePreview.svelte'
11+ import FileEditor from './FileEditor.svelte'
12+ import { codeLanguage } from '../files'
11 13
12 let { linked }: { linked: LinkedView } = $props()14 let { linked }: { linked: LinkedView } = $props()
13 15
14 const kind = $derived(previewKind(linked.path))16 const kind = $derived(previewKind(linked.path))
17+ // Source code is coloured like in the Files tab, read-only (issue #117).
18+ const language = $derived(codeLanguage(linked.path))
15 const name = $derived(linked.path.slice(linked.path.lastIndexOf('/') + 1))19 const name = $derived(linked.path.slice(linked.path.lastIndexOf('/') + 1))
16 let content = $state('')20 let content = $state('')
17 let problem = $state('')21 let problem = $state('')
@@ -73,6 +77,11 @@
73 <p class="muted">…</p>77 <p class="muted">…</p>
74 {:else if kind}78 {:else if kind}
75 <FilePreview agent={linked.agent} path={linked.path} {content} {kind} {revision} onFile={(file) => openLinkedFile(linked.channel, linked.agent, file)} />79 <FilePreview agent={linked.agent} path={linked.path} {content} {kind} {revision} onFile={(file) => openLinkedFile(linked.channel, linked.agent, file)} />
80+ {:else if language}
81+ <!-- Shown again from scratch when the file is read again (↻ or the agent's changes). -->
82+ {#key content}
83+ <div class="code"><FileEditor {content} {language} readOnly onChange={() => {}} onSave={() => {}} /></div>
84+ {/key}
76 {:else}85 {:else}
77 <pre>{content}</pre>86 <pre>{content}</pre>
78 {/if}87 {/if}
@@ -89,6 +98,7 @@
89 .actions { grid-column: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; }98 .actions { grid-column: 1 / span 2; display: flex; flex-wrap: wrap; gap: 6px; }
90 .actions button { font-size: 12px; padding: 2px 8px; }99 .actions button { font-size: 12px; padding: 2px 8px; }
91 .body { flex: 1; min-height: 0; padding: 10px 12px; overflow: auto; }100 .body { flex: 1; min-height: 0; padding: 10px 12px; overflow: auto; }
101+ .code { height: 100%; }
92 pre { margin: 0; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; }102 pre { margin: 0; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; }
93 .problem { color: var(--danger); font-size: 13px; }103 .problem { color: var(--danger); font-size: 13px; }
94 .muted { color: var(--muted); }104 .muted { color: var(--muted); }
modified frontend/src/lib/files.test.ts +14 -1
@@ -1,7 +1,7 @@
11 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
22
33 import { describe, expect, it } from 'vitest'
4-import { iconFor, isHidden, languageFor, parentsOf, validFileName } from './files'
4+import { codeLanguage, iconFor, isHidden, languageFor, parentsOf, validFileName } from './files'
55
66 describe('workspace files', () => {
77 it('hides dot files and generated folders by default', () => {
@@ -54,3 +54,16 @@ describe('workspace files', () => {
5454 expect(parentsOf('AGENTS.md')).toEqual([])
5555 })
5656 })
57+
58+describe('the code of a linked file (issue #117)', () => {
59+ it('is coloured in the language of its name or extension', () => {
60+ expect(codeLanguage('src/main.go')).toBe('go')
61+ expect(codeLanguage('app/index.TS')).toBe('typescript')
62+ expect(codeLanguage('Dockerfile')).toBe('dockerfile')
63+ })
64+ it('stays plain text when the language is unknown', () => {
65+ expect(codeLanguage('notes.txt')).toBeNull()
66+ expect(codeLanguage('LICENSE')).toBeNull()
67+ })
68+})
69+
@@ -1,7 +1,7 @@
1 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE1 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2 2
3 import { describe, expect, it } from 'vitest'3 import { describe, expect, it } from 'vitest'
4-import { iconFor, isHidden, languageFor, parentsOf, validFileName } from './files'4+import { codeLanguage, iconFor, isHidden, languageFor, parentsOf, validFileName } from './files'
5 5
6 describe('workspace files', () => {6 describe('workspace files', () => {
7 it('hides dot files and generated folders by default', () => {7 it('hides dot files and generated folders by default', () => {
@@ -54,3 +54,16 @@ describe('workspace files', () => {
54 expect(parentsOf('AGENTS.md')).toEqual([])54 expect(parentsOf('AGENTS.md')).toEqual([])
55 })55 })
56 })56 })
57+
58+describe('the code of a linked file (issue #117)', () => {
59+ it('is coloured in the language of its name or extension', () => {
60+ expect(codeLanguage('src/main.go')).toBe('go')
61+ expect(codeLanguage('app/index.TS')).toBe('typescript')
62+ expect(codeLanguage('Dockerfile')).toBe('dockerfile')
63+ })
64+ it('stays plain text when the language is unknown', () => {
65+ expect(codeLanguage('notes.txt')).toBeNull()
66+ expect(codeLanguage('LICENSE')).toBeNull()
67+ })
68+})
69+
modified frontend/src/lib/files.ts +13 -0
@@ -76,6 +76,19 @@ export function languageFor(path: string): EditorLanguage {
7676 return languagesByExtension[extensionOf(name)] ?? 'text'
7777 }
7878
79+/**
80+ * The language a linked file's code is coloured in (issue #117), or null
81+ * when it is not one the editor knows: such a file stays plain text.
82+ *
83+ * @example
84+ * codeLanguage('src/main.go') // 'go'
85+ * codeLanguage('notes.txt') // null
86+ */
87+export function codeLanguage(path: string): EditorLanguage | null {
88+ const language = languageFor(path)
89+ return language === 'text' ? null : language
90+}
91+
7992 function extensionOf(name: string): string {
8093 const dot = name.lastIndexOf('.')
8194 return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''
@@ -76,6 +76,19 @@ export function languageFor(path: string): EditorLanguage {
76 return languagesByExtension[extensionOf(name)] ?? 'text'76 return languagesByExtension[extensionOf(name)] ?? 'text'
77 }77 }
78 78
79+/**
80+ * The language a linked file's code is coloured in (issue #117), or null
81+ * when it is not one the editor knows: such a file stays plain text.
82+ *
83+ * @example
84+ * codeLanguage('src/main.go') // 'go'
85+ * codeLanguage('notes.txt') // null
86+ */
87+export function codeLanguage(path: string): EditorLanguage | null {
88+ const language = languageFor(path)
89+ return language === 'text' ? null : language
90+}
91+
79 function extensionOf(name: string): string {92 function extensionOf(name: string): string {
80 const dot = name.lastIndexOf('.')93 const dot = name.lastIndexOf('.')
81 return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''94 return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''